bpmn-js 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- /*! bpmn-js - bpmn-modeler v3.4.0 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.BpmnJS=t()}(this,function(){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e(function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),n=e(function(e){var c=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++){o=Math.floor(Math.random()*t).toString(t)+o}if(r){var a=Math.pow(t,r);o=Math.floor(Math.random()*a).toString(t)+o}var s=parseInt(o,t);return s!==1/0&&s>=Math.pow(2,e)?c(e,t):o};c.rack=function(i,r,o){function n(e){var t=0;do{if(10<t++){if(!o)throw new Error("too many ID collisions, use more bits");i+=o}var n=c(i,r)}while(Object.hasOwnProperty.call(a,n));return a[n]=e,n}var a=n.hats={};return n.get=function(e){return n.hats[e]},n.set=function(e,t){return n.hats[e]=t,n},n.bits=i||128,n.base=r||16,n}});function r(e){if(!(this instanceof r))return new r(e);e=e||[128,36,1],this._seed=e.length?n.rack(e[0],e[1],e[2]):e}var o=r;function h(e){return Array.prototype.concat.apply([],e)}r.prototype.next=function(e){return this._seed(e||!0)},r.prototype.nextPrefixed=function(e,t){for(var n;n=e+this.next(!0),this.assigned(n););return this.claim(n,t),n},r.prototype.claim=function(e,t){this._seed.set(e,t||!0)},r.prototype.assigned=function(e){return this._seed.get(e)||!1},r.prototype.unclaim=function(e){delete this._seed.hats[e]},r.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var a=Object.prototype.toString,s=Object.prototype.hasOwnProperty;function p(e){return void 0===e}function c(e){return void 0!==e}function g(e){return"[object Array]"===a.call(e)}function P(e){return"[object Object]"===a.call(e)}function l(e){return"[object Number]"===a.call(e)}function u(e){return"[object Function]"===a.call(e)}function d(e){return"[object String]"===a.call(e)}function f(e,t){return s.call(e,t)}function R(e,n){var i;return n=B(n),k(e,function(e,t){if(n(e,t))return i=e,!1}),i}function m(e,n){n=B(n);var i=g(e)?-1:void 0;return k(e,function(e,t){if(n(e,t))return i=t,!1}),i}function A(e,n){var i=[];return k(e,function(e,t){n(e,t)&&i.push(e)}),i}function k(e,t){if(!p(e)){var n=g(e)?L:O;for(var i in e){if(f(e,i))if(!1===t(e[i],n(i)))return}}}function y(e,n){return p(e)?[]:(function(e){if(!g(e))throw new Error("must supply array")}(e),n=B(n),e.filter(function(e,t){return!n(e,t)}))}function v(e,n,i){return k(e,function(e,t){i=n(i,e,t)}),i}function b(e,i){return v(e,function(e,t,n){return e&&i(t,n)},!0)}function x(e,t){return!!R(e,t)}function _(e,n){var i=[];return k(e,function(e,t){i.push(n(e,t))}),i}function E(e){return e&&Object.keys(e)||[]}function w(e){return _(e,function(e){return e})}function S(e,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return i=N(i),k(e,function(e){var t=i(e)||"_",n=r[t];n||(n=r[t]=[]),n.push(e)}),r}function C(t){t=N(t);for(var n={},e=arguments.length,i=Array(1<e?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return k(i,function(e){return S(e,t,n)}),_(n,function(e,t){return e[0]})}var T=C;function M(e,o){o=N(o);var a=[];return k(e,function(e,t){for(var n=o(e,t),i={d:n,v:e},r=0;r<a.length;r++){if(n<a[r].d)return void a.splice(r,0,i)}a.push(i)}),_(a,function(e){return e.v})}function D(e){return function(n){return b(e,function(e,t){return n[t]===e})}}function N(t){return u(t)?t:function(e){return e[t]}}function B(t){return u(t)?t:function(e){return e===t}}function O(e){return e}function L(e){return Number(e)}function I(n,i){var r,o,a,s;function t(){var e=Date.now(),t=s+i-e;if(0<t)return c(t);n.apply(a,o),r=s=o=a=void 0}function c(e){r=setTimeout(t,e)}return function(){s=Date.now();for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];o=t,a=this,r||c(i)}}function j(e,t){return e.bind(t)}var z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function F(e){for(var t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return z.apply(void 0,[e].concat(n))}function $(t,e){var n={},i=Object(t);return k(e,function(e){e in i&&(n[e]=t[e])}),n}function H(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}function W(e,t){if(G)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var G=[].indexOf,V=/\s+/,U=Object.prototype.toString;function q(e){return new K(e)}function K(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Y(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}K.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~W(t,e)||t.push(e),this.el.className=t.join(" "),this},K.prototype.remove=function(e){if("[object RegExp]"==U.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=W(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},K.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},K.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):void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},K.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(V);return""===e[0]&&e.shift(),e},K.prototype.has=K.prototype.contains=function(e){return this.list?this.list.contains(e):!!~W(this.array(),e)};var X=Element.prototype,Z=X.matchesSelector||X.webkitMatchesSelector||X.mozMatchesSelector||X.msMatchesSelector||X.oMatchesSelector,Q=function(e,t){if(Z)return Z.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var J,ee=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(Q(i,t))return i;i=i.parentNode}},te=window.addEventListener?"addEventListener":"attachEvent",ne=window.removeEventListener?"removeEventListener":"detachEvent",ie="addEventListener"!=te?"on":"",re={bind:function(e,t,n,i){return e[te](ie+t,n,i||!1),n},unbind:function(e,t,n,i){return e[ne](ie+t,n,i||!1),n}},oe=["focus","blur"],ae={bind:function(n,i,e,r,t){return-1!==oe.indexOf(e)&&(t=!0),re.bind(n,e,function(e){var t=e.target||e.srcElement;e.delegateTarget=ee(t,i,!0,n),e.delegateTarget&&r.call(n,e)},t)},unbind:function(e,t,n,i){-1!==oe.indexOf(t)&&(i=!0),re.unbind(e,t,n,i)}},se=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 i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=pe[i]||pe._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},ce=!1;"undefined"!=typeof document&&((J=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',ce=!J.getElementsByTagName("link").length,J=void 0);var pe={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:ce?[1,"X<div>","</div>"]:[0,"",""]};pe.td=pe.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],pe.option=pe.optgroup=[1,'<select multiple="multiple">',"</select>"],pe.thead=pe.tbody=pe.colgroup=pe.caption=pe.tfoot=[1,"<table>","</table>"],pe.polyline=pe.ellipse=pe.polygon=pe.circle=pe.text=pe.line=pe.path=pe.rect=pe.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var le="undefined"!=typeof Element?Element.prototype:{},ue=le.matches||le.matchesSelector||le.webkitMatchesSelector||le.mozMatchesSelector||le.msMatchesSelector||le.oMatchesSelector,he=function(e,t){if(!e||1!==e.nodeType)return!1;if(ue)return ue.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};function de(e,t){return(t=t||document).querySelector(e)}function me(e,t){return(t=t||document).querySelectorAll(e)}function fe(e){e.parentNode&&e.parentNode.removeChild(e)}function ye(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 ve(e,t){return ye(t,e),e}var ge=2,be={"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":ge,"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":ge,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function xe(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=be[i];r?(r===ge&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function _e(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return be[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);xe(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)xe(e,i,t[i])}(e,t);return e}function Ee(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 we=/\s+/,Se=Object.prototype.toString;function Ce(e){return void 0!==e}function Te(e){return new Re(e)}function Re(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ae(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Pe(e){for(var t;t=e.firstChild;)Ae(t);return e}Re.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Ee(t,e)||t.push(e),Ce(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Re.prototype.remove=function(e){if("[object RegExp]"===Se.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Ee(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Re.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},Re.prototype.toggle=function(e,t){return this.list?Ce(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):Ce(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},Re.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(we);return""===e[0]&&e.shift(),e},Re.prototype.has=Re.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Ee(this.array(),e)};var ke={svg:"http://www.w3.org/2000/svg"},Me='<svg xmlns="'+ke.svg+'"';function De(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(ke.svg)&&(e=Me+e.substring(4)):(e=Me+">"+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 i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Ne(e,t){var n;return n="<"===e.charAt(0)?(n=De(e).firstChild,document.importNode(n,!0)):document.createElementNS(ke.svg,e),t&&_e(n,t),n}var Be=Ne("svg");function Oe(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Le(e){return e?Be.createSVGTransformFromMatrix(e):Be.createSVGTransform()}var Ie=/([&<>]{1})/g,je=/([\n\r"]{1})/g,ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Fe(e,t){return e.replace(t,function(e,t){return ze[t]||t})}function $e(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Fe(e.textContent,Ie));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Fe(o.value,je),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)$e(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Fe(e.nodeValue,Ie),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function He(e,t){var n=De(t);if(Pe(e),t){!function(e){return"#document-fragment"===e.nodeName}(n)&&(n=n.documentElement);for(var i=function(e){return Array.prototype.slice.call(e)}(n.childNodes),r=0;r<i.length;r++)ye(i[r],e)}}function We(e,t){if(void 0===t)return function(e){for(var t=e.firstChild,n=[];t;)$e(t,n),t=t.nextSibling;return n.join("")}(e);try{He(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}function Ge(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i,r,o;for(e.clear(),n=0;i=t[n];n++)e.appendItem((r=e,(o=i)instanceof SVGMatrix?r.createSVGTransformFromMatrix(o):o))}(n,t)),n.consolidate()}var Ve=/^class /;function Ue(e){return"[object Array]"===Object.prototype.toString.call(e)}function qe(){var e=Array.prototype.slice.call(arguments);1===e.length&&Ue(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Ke=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Ye=/^function\s*[^(]*\(\s*([^)]*)\)/m,Xe=/\/\*([^*]*)\*\//m;function Ze(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return Ve.test(e.toString())}(e)?Ke:Ye);return t&&t[1]&&t[1].split(",").map(function(e){return(t=e.match(Xe))?t[1].trim():e.trim()})||[]}var Qe="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};function Je(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function et(e,r){r=r||{get:function(e,t){if(s.push(e),!1===t)return null;throw p('No provider for "'+e+'"!')}};function o(e,t){if(!d[e]&&-1!==e.indexOf(".")){for(var n=e.split("."),i=o(n.shift());n.length;)i=i[n.shift()];return i}if(tt(c,e))return c[e];if(tt(d,e)){if(-1!==s.indexOf(e))throw s.push(e),p("Cannot resolve circular dependency!");return s.push(e),c[e]=d[e][0](d[e][1]),s.pop(),c[e]}return r.get(e,t)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!Ue(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=qe(e.slice())}return{fn:e,dependencies:(e.$inject||Ze(e)).map(function(e){return tt(t,e)?t[e]:o(e)})}}function t(e){var t=a(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(Je(n))))}function n(e,t,n){var i=a(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(Je(r)))}function h(t){return qe(function(e){return t.get(e)})}var s=[],d=this._providers=Object.create(r._providers||null),c=this._instances=Object.create(null),m=c.injector=this,p=function(e){var t=s.join(" -> ");return s.length=0,new Error(t?e+" (Resolving: "+t+")":e)},l={factory:n,type:t,value:function(e){return e}};e.forEach(function(i){function r(e,t){return"value"!==e&&Ue(t)&&(t=qe(t.slice())),t}if(i instanceof function(){var n=[];this.factory=function(e,t){return n.push([e,"factory",t]),this},this.value=function(e,t){return n.push([e,"value",t]),this},this.type=function(e,t){return n.push([e,"type",t]),this},this.forEach=function(e){n.forEach(e)}})i.forEach(function(e){var t=e[0],n=e[1],i=e[2];d[t]=[l[n],r(n,i),n]});else if("object"===(void 0===i?"undefined":Qe(i)))if(i.__exports__){var e=Object.keys(i).reduce(function(e,t){return"__"!==t.substring(0,2)&&(e[t]=i[t]),e},Object.create(null)),t=new et((i.__modules__||[]).concat([e]),m),n=qe(function(e){return t.get(e)});i.__exports__.forEach(function(e){d[e]=[n,e,"private",t]})}else Object.keys(i).forEach(function(e){if("private"!==i[e][2]){var t=i[e][0],n=i[e][1];d[e]=[l[t],r(t,n),t]}else d[e]=i[e]})}),this.get=o,this.invoke=n,this.instantiate=t,this.createChild=function(e,t){if(t&&t.length){var n,i,r,o,a=Object.create(null),s=Object.create(null),c=[],p=[],l=[];for(var u in d)n=d[u],-1!==t.indexOf(u)&&("private"===n[2]?-1===(i=c.indexOf(n[3]))?(r=n[3].createChild([],t),o=h(r),c.push(n[3]),p.push(r),l.push(o),a[u]=[o,u,"private",r]):a[u]=[l[i],u,"private",p[i]]:a[u]=[n[2],n[1]],s[u]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(a[u]=[n[2],n[1]],s[e]=!0)});t.forEach(function(e){if(!s[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(a)}return new et(e,m)}}function tt(e,t){return Object.hasOwnProperty.call(e,t)}var nt=1e3;function it(e,t){var o=this;t=t||nt,e.on(["render.shape","render.connection"],t,function(e,t){var n=e.type,i=t.element,r=t.gfx;if(o.canRender(i))return"render.shape"===n?o.drawShape(r,i):o.drawConnection(r,i)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(o.canRender(t))return"render.getShapePath"===e.type?o.getShapePath(t):o.getConnectionPath(t)})}function rt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function ot(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function at(e,t){var n=Ne("polyline");return _e(n,{points:ot(e)}),t&&_e(n,t),n}it.prototype.canRender=function(){},it.prototype.drawShape=function(){},it.prototype.drawConnection=function(){},it.prototype.getShapePath=function(){},it.prototype.getConnectionPath=function(){};function st(e,t){it.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})}t(st,it),st.prototype.canRender=function(){return!0},st.prototype.drawShape=function(e,t){var n=Ne("rect");return _e(n,{x:0,y:0,width:t.width||0,height:t.height||0}),_e(n,this.SHAPE_STYLE),ve(e,n),n},st.prototype.drawConnection=function(e,t){var n=at(t.waypoints,this.CONNECTION_STYLE);return ve(e,n),n},st.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return rt([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},st.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return rt(r)},st.$inject=["eventBus","styles"];var ct={__init__:["defaultRenderer"],defaultRenderer:["type",st],styles:["type",function(){var i={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},r=this;this.cls=function(e,t,n){return F(this.style(t,n),{class:e})},this.style=function(e,t){g(e)||t||(t=e,e=[]);var n=v(e,function(e,t){return F(e,i[t]||{})},{});return t?F(n,t):n},this.computeStyle=function(e,t,n){return g(t)||(n=t,t=[]),r.style(t||[],F({},n,e||{}))}}]};function pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function lt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function ut(e,t){return e&&t?e.indexOf(t):-1}function ht(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function dt(e,i,r){r=r||0,g(e)||(e=[e]),k(e,function(e,t){var n=i(e,t,r);g(n)&&n.length&&dt(n,i,r+1)})}function mt(e,t){return function(e,r,o){var a=[],s=[];return dt(e,function(e,t,n){ht(a,e,r);var i=e.children;if((-1===o||n<o)&&i&&ht(s,i,r))return i}),a}(e,!t,-1)}function ft(e,a){var s,c,p,l;return a=!!a,g(e)||(e=[e]),k(e,function(e){var t=e;e.waypoints&&!a&&(t=ft(e.waypoints,!0));var n=t.x,i=t.y,r=t.height||0,o=t.width||0;(n<s||void 0===s)&&(s=n),(i<c||void 0===c)&&(c=i),(p<n+o||void 0===p)&&(p=n+o),(l<i+r||void 0===l)&&(l=i+r)}),{x:s,y:c,height:l-c,width:p-s}}function yt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function vt(e,t){return F({},e||{},t||{})}function gt(e,t){return Math.round(e*t)/t}function bt(e){return l(e)?e+"px":e}function xt(e,t,n){var i=Ne("g");Te(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var _t={shape:["x","y","width","height"],connection:["waypoints"]};function Et(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function wt(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Et.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Et.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=F({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),F(n.style,{position:"relative",overflow:"hidden",width:bt(e.width),height:bt(e.height)}),t.appendChild(n),n}(e),i=this._svg=Ne("svg");_e(i,{width:"100%",height:"100%"}),ve(n,i);var r=this._viewport=xt(i,"viewport");!(this._layers={})!==e.deferUpdate&&(this._viewboxChanged=I(j(this._viewboxChanged,this),300)),t.on("diagram.init",function(){t.fire("canvas.init",{svg:i,viewport:r})},this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Et.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._rootElement,delete this._viewport},Et.prototype._clear=function(){var n=this;this._elementRegistry.getAll().forEach(function(e){var t=yt(e);"root"===t?n.setRootElement(null,!0):n._removeElement(e,t)}),delete this._cachedViewbox},Et.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Et.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},Et.prototype._createLayer=function(e,n){n||(n=0);var t=v(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:xt(this._viewport,"layer-"+e,t),index:n}},Et.prototype.getContainer=function(){return this._container},Et.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(k([i.gfx,i.secondaryGfx],function(e){e&&(n?Te(e).add(t):Te(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Et.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Et.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Et.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Te(this.getGraphics(e)).has(t)},Et.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Et.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Et.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e},Et.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 with id "+t.id+" already exists");var n=_t[e];if(!b(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Et.prototype._setParent=function(e,t,n){lt(t.children,e,n),e.parent=t},Et.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Et.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Et.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Et.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),pt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Et.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Et.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Et.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Et.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Et.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Et.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,i,r,o,a,s=this._viewport,c=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(c.width/t.width,c.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);Ge(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=Ge(s))?i.matrix:function(e,t,n,i,r,o){var a=Be.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Oe(a,e);case 6:return Oe(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=gt(n.a,1e3),o=gt(-n.e||0,1e3),a=gt(-n.f||0,1e3),t=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:c})},Et.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=F({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),wt(t,n)}),{x:n.e,y:n.f}},Et.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}),i=this._setZoom(e,t)}),gt(i.a,1e3)):this.viewbox(e).scale;var n,i},Et.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return n=0<=o.x&&0<=o.y&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?{x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),{x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Et.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return o=t?(n=F(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),i.multiply(r)):c.scale(e),wt(this._viewport,o),o},Et.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Et.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}},Et.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var St="data-element-id";function Ct(e){this._elements={},this._eventBus=e}Ct.$inject=["eventBus"],Ct.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),_e(t,St,i),n&&_e(n,St,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ct.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(_e(i.gfx,St,""),i.secondaryGfx&&_e(i.secondaryGfx,St,""),delete t[n])},Ct.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),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Ct.prototype.get=function(e){var t;t="string"==typeof e?e:e&&_e(e,St);var n=this._elements[t];return n&&n.element},Ct.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},Ct.prototype.getAll=function(){return this.filter(function(e){return e})},Ct.prototype.forEach=function(r){var o=this._elements;Object.keys(o).forEach(function(e){var t=o[e],n=t.element,i=t.gfx;return r(n,i)})},Ct.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ct.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 Tt={extend:function(e,i,t,r){var o=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),i.unset(e,o,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&i.set(e,o,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function Rt(t,n,i){var e=Tt.extend(i[n.name]||[],t,n,i);Object.defineProperty(i,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,i)})}function At(e,t){if(!(this instanceof At))return new At(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}At.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?Rt(this,t,e):function(n,e,i){var r=e.inverse,o=i[e.name];Object.defineProperty(i,e.name,{configurable:e.configurable,enumerable:e.enumerable,get:function(){return o},set:function(e){if(e!==o){var t=o;o=null,t&&n.unset(t,r,i),o=e,n.set(o,r,i)}}})}(this,t,e)},At.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Tt.isExtended(n)||Rt(this,t,e),n},At.prototype.ensureBound=function(e,t){!function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}(e,t)&&this.bind(e,t)},At.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},At.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Pt=At,kt=Tt;Pt.Collection=kt;var Mt=new Pt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Dt=new Pt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nt=new Pt({name:"attachers",collection:!0},{name:"host"}),Bt=new Pt({name:"outgoing",collection:!0},{name:"source"}),Ot=new Pt({name:"incoming",collection:!0},{name:"target"});function Lt(){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)}}),Mt.bind(this,"parent"),Dt.bind(this,"labels"),Bt.bind(this,"outgoing"),Ot.bind(this,"incoming")}function It(){Lt.call(this),Mt.bind(this,"children"),Nt.bind(this,"host"),Nt.bind(this,"attachers")}function jt(){It.call(this)}function zt(){It.call(this),Dt.bind(this,"labelTarget")}function Ft(){Lt.call(this),Bt.bind(this,"source"),Ot.bind(this,"target")}t(It,Lt),t(jt,It),t(zt,It),t(Ft,Lt);var $t={connection:Ft,shape:It,label:zt,root:jt};function Ht(){this._uid=12}Ht.prototype.createRoot=function(e){return this.create("root",e)},Ht.prototype.createLabel=function(e){return this.create("label",e)},Ht.prototype.createShape=function(e){return this.create("shape",e)},Ht.prototype.createConnection=function(e){return this.create("connection",e)},Ht.prototype.create=function(e,t){return(t=F({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=$t[e];if(!n)throw new Error("unknown type: <"+e+">");return F(new n,t)}(e,t)};var Wt="__fn",Gt=Array.prototype.slice;function Vt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Ut(){}function qt(e,t,n,i,r){var o=Le();o.setTranslate(t,n);var a=Le();a.setRotate(i,0,0);var s=Le();s.setScale(r||1,r||1),Ge(e,[o,a,s])}function Kt(e,t,n){var i=Le();i.setTranslate(t,n),Ge(e,i)}function Yt(e,t){var n=Le();n.setRotate(t,0,0),Ge(e,n)}function Xt(e,t){this._eventBus=e,this._elementRegistry=t}function Zt(e,t,n){t.insertBefore(e,n||t.firstChild)}Vt.prototype.on=function(e,t,n,i){if(e=g(e)?e:[e],u(t)&&(i=n,n=t,t=1e3),!l(t))throw new Error("priority must be a number");var r=n;i&&((r=j(n,i))[Wt]=n[Wt]||n);var o=this;e.forEach(function(e){o._addListener(e,{priority:t,callback:r,next:null})})},Vt.prototype.once=function(t,e,n,i){var r=this;if(u(e)&&(i=n,n=e,e=1e3),!l(e))throw new Error("priority must be a number");function o(){var e=n.apply(i,arguments);return r.off(t,o),e}o[Wt]=n,this.on(t,e,o)},Vt.prototype.off=function(e,t){e=g(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},Vt.prototype.createEvent=function(e){var t=new Ut;return t.init(e),t},Vt.prototype.fire=function(e,t){var n,i,r,o;if(o=Gt.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Ut?t:this.createEvent(t);var a=(o[0]=n).type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Vt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Vt.prototype._destroy=function(){this._listeners={}},Vt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vt.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},Vt.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));i=(n=i).next}n.next=t}else this._setListeners(e,t)},Vt.prototype._getListeners=function(e){return this._listeners[e]},Vt.prototype._setListeners=function(e,t){this._listeners[e]=t},Vt.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r[Wt]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},Ut.prototype.stopPropagation=function(){this.cancelBubble=!0},Ut.prototype.preventDefault=function(){this.defaultPrevented=!0},Ut.prototype.init=function(e){F(this,e||{})},Xt.$inject=["eventBus","elementRegistry"],Xt.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Te(t=Ne("g")).add("djs-children"),ve(n.parentNode,t)):t=n,t},Xt.prototype._clear=function(e){var t=function(e){return de(".djs-visual",e)}(e);return Y(t),t},Xt.prototype._createContainer=function(e,t,n){var i=Ne("g");Te(i).add("djs-group"),void 0!==n?Zt(i,t,t.childNodes[n]):ve(t,i);var r=Ne("g");Te(r).add("djs-element"),Te(r).add("djs-"+e),ve(i,r);var o=Ne("g");return Te(o).add("djs-visual"),ve(r,o),r},Xt.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},Xt.prototype.updateContainments=function(e){var i=this,r=this._elementRegistry;k(v(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t=e.children;if(t){var n=i._getChildren(e);k(t.slice().reverse(),function(e){Zt(r.getGraphics(e).parentNode,n)})}})},Xt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Xt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Xt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Xt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Xt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Kt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?_e(n,"display","none"):_e(n,"display","block")}},Xt.prototype.remove=function(e){Ae(this._elementRegistry.getGraphics(e).parentNode)};var Qt={__depends__:[ct],__init__:["canvas"],canvas:["type",Et],elementRegistry:["type",Ct],elementFactory:["type",Ht],eventBus:["type",Vt],graphicsFactory:["type",Xt]};function Jt(e){var n=[],i=[];function r(e){return 0<=n.indexOf(e)}e.forEach(function e(t){r(t)||((t.__depends__||[]).forEach(e),r(t)||(function(e){n.push(e)}(t),(t.__init__||[]).forEach(function(e){i.push(e)})))});var t=new et(n);return i.forEach(function(e){try{t["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),t}function en(e,t){this.injector=t=t||function(e){return Jt([{config:["value",e=e||{}]},Qt].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function tn(){}function nn(e,t){this.model=e,this.properties=t}en.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},en.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},tn.prototype.get=function(e){return this.$model.properties.get(this,e)},tn.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},nn.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(tn.prototype);k(e.properties,function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(e,j(function(e,t){this.set(t,e)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var rn={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},on={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};function an(e,t){var n=on[e];return n?n(t):t}function sn(e){return!!rn[e]}function cn(e){return!!on[e]}function pn(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function un(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,k(e,j(this.registerPackage,this))}function hn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function dn(e){this.model=e}function mn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function fn(e){this.properties=new dn(this),this.factory=new nn(this,this.properties),this.registry=new un(e,this.properties),this.typeCache={}}ln.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ln.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},ln.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=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=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=pn(r[0],i),a=pn(r[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},ln.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ln.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},ln.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},ln.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},ln.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(k(i.properties,j(function(e){e=F({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:i});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(i),e[n]=i)},un.prototype.getPackage=function(e){return this.packageMap[e]},un.prototype.getPackages=function(){return this.packages},un.prototype.registerPackage=function(t){t=F({},t);var e=this.packageMap;hn(e,t,"prefix"),hn(e,t,"uri"),k(t.types,j(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},un.prototype.registerType=function(e,t){var i=pn((e=F({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:F(e.meta||{})})).name,t.prefix),n=i.name,r={};k(e.properties,j(function(e){var t=pn(e.name,i.prefix),n=t.name;sn(e.type)||(e.type=pn(e.type,t.prefix).name),F(e,{ns:t,name:n}),r[n]=e},this)),F(e,{ns:i,name:n,propertiesByName:r}),k(e.extends,j(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},un.prototype.mapTypes=function(i,r,e){var t=sn(i.name)?{name:i.name}:this.typeMap[i.name],o=this;function n(e){return a(e,!0)}function a(e,t){var n=pn(e,sn(e)?"":i.prefix);o.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+i.name+">");k(t.superClass,e?n:a),r(t,!e),k(t.traits,n)},un.prototype.getEffectiveDescriptor=function(e){var t=pn(e),n=new ln(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},un.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},dn.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;!function(e){return void 0===e}(n)?i?r in e?e[r]=n:mn(e,i,n):e.$attrs[t]=n:i?delete e[r]:delete e.$attrs[t]},dn.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&mn(e,n,[]),e[i]},dn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},dn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},dn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},fn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},fn.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},fn.prototype.createAny=function(e,t,n){var i=pn(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),k(n,function(e,t){P(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},fn.prototype.getPackage=function(e){return this.registry.getPackage(e)},fn.prototype.getPackages=function(){return this.registry.getPackages()},fn.prototype.getElementDescriptor=function(e){return e.$descriptor},fn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},fn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},fn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var yn=String.fromCharCode,vn=Object.prototype.hasOwnProperty,gn=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,bn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function xn(e,t,n,i){return i?vn.call(bn,i)?bn[i]:"&"+i+";":yn(t||parseInt(n,16))}function _n(e){return 3<e.length&&-1!==e.indexOf("&")?e.replace(gn,xn):e}Object.keys(bn).forEach(function(e){bn[e.toUpperCase()]=bn[e]});var En="http://www.w3.org/2001/XMLSchema-instance",wn="xsi",Sn="xsi:type",Cn="non-whitespace outside of root node";function Tn(e){return new Error(e)}function Rn(e){return"missing namespace for prefix <"+e+">"}function An(e){return{get:e,enumerable:!0}}function Pn(e){var t,n={};for(t in e)n[t]=e[t];return n}function kn(e){return e+"$uri"}function Mn(){return{line:0,column:0}}function Dn(e){throw e}function Nn(e){if(!this)return new Nn(e);var v,w,S,C,n,T,R,A,P,k=e&&e.proxy,i=Dn,M=Mn,D=!1,N=!1,t=null,B=!1;function O(e){e instanceof Error||(e=Tn(e)),i(t=e,M)}function L(e){n&&(e instanceof Error||(e=Tn(e)),n(e,M))}this.on=function(e,t){if("function"!=typeof t)throw Tn("required args <name, cb>");switch(e){case"openTag":w=t;break;case"text":v=t;break;case"closeTag":S=t;break;case"error":i=t;break;case"warn":n=t;break;case"cdata":C=t;break;case"attention":A=t;break;case"question":R=t;break;case"comment":T=t;break;default:throw Tn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Tn("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[En]=wn,N=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw Tn("required args <xml=string>");return t=null,function(a){var e,t,n,i,r,o,s,c,p,g,l=N?[]:null,b=N?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[kn(n)]=t;return i}(P):null,u=[],x=0,h=!1,d=!1,m=0,f=0,_="",E=0;function y(){if(null!==g)return g;var e,t,n,i,r,o,a,s,c,p,l,u=N&&b.xmlns,h=N&&D?[]:null,d=E,m=_,f=m.length,y={},v={};e:for(;d<f;d++)if(c=!1,!(32===(p=m.charCodeAt(d))||p<14&&8<p)){for(!(p<65||122<p||90<p&&p<97)||95!==p&&58!==p&&(L("illegal first char attribute name"),c=!0),l=d+1;l<f;l++)if(!(96<(p=m.charCodeAt(l))&&p<123||64<p&&p<91||47<p&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&8<p){L("missing attribute value"),d=l;continue e}if(61===p)break;L("illegal attribute name char"),c=!0}if("xmlns:xmlns"===(s=m.substring(d,l))&&(L("illegal declaration of xmlns"),c=!0),34===(p=m.charCodeAt(l+1)))-1!==(l=m.indexOf('"',d=l+2))||-1!==(l=m.indexOf("'",d))&&(L("attribute value quote missmatch"),c=!0);else if(39===p)-1!==(l=m.indexOf("'",d=l+2))||-1!==(l=m.indexOf('"',d))&&(L("attribute value quote missmatch"),c=!0);else for(L("missing attribute value quotes"),c=!0,l+=1;l<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++);for(-1===l&&(L("missing closing quotes"),l=f,c=!0),c||(o=m.substring(d,l)),d=l;l+1<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++)d===l&&(L("illegal character after attribute end"),c=!0);if(d=l+1,!c)if(s in v)L("attribute <"+s+"> already defined");else if(v[s]=!0,N)if(D){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=_n(o),t=kn(r),!(a=P[e])){if("xmlns"===r||t in b&&b[t]!==e)for(;a="ns"+x++,void 0!==b[a];);else a=r;P[e]=a}b[r]!==a&&(i||(b=Pn(b),i=!0),b[r]=a,"xmlns"===r&&(b[kn(a)]=e,u=a),b[t]=e),y[s]=o;continue}h.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=b[s.substring(0,p)])?((s=u===n?s.substr(p+1):n+s.substr(p))===Sn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o),y[s]=o):L(Rn(s.substring(0,p))):y[s]=o;else y[s]=o}if(D)for(d=0,f=h.length;d<f;d++){if(s=h[d++],o=h[d],-1!==(p=s.indexOf(":"))){if(!(n=b[s.substring(0,p)])){L(Rn(s.substring(0,p)));continue}(s=u===n?s.substr(p+1):n+s.substr(p))===Sn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o)}y[s]=o}return g=y}M=function(){for(var e,t=/(\r\n|\r|\n)/g,n=0,i=0,r=0,o=f;r<=m&&(e=t.exec(a))&&(o=e[0].length+e.index,!(m<o));)n+=1,r=o;return{data:-1==m?(i=o,a.substring(f)):0===f?(console.log(m-r),a.substring(f,m)):(i=m-r,-1==f?a.substring(m):a.substring(m,f+1)),line:n,column:i}},k&&(p=Object.create({},{name:An(function(){return s}),originalName:An(function(){return c}),attrs:An(y),ns:An(function(){return b})}));for(;-1!==f;){if(-1===(m=60===a.charCodeAt(f)?f:a.indexOf("<",f)))return u.length?O("unexpected end of file"):0===f?O("missing start tag"):f<a.length&&a.substring(f).trim()&&L(Cn);if(f!==m)if(u.length){if(v&&(v(a.substring(f,m),_n,M),B))return}else if(a.substring(f,m).trim()&&(L(Cn),B))return;if(33!==(r=a.charCodeAt(m+1)))if(63!==r){if(-1==(f=a.indexOf(">",m+1)))return O("unclosed tag");if(g={},47===r){if(d=!(h=!1),!u.length)return O("missing open tag");if(t=s=u.pop(),i=m+2+t.length,a.substring(m+2,i)!==t)return O("closing tag mismatch");for(;i<f;i++)if(!(32===(r=a.charCodeAt(i))||8<r&&r<14))return O("close tag")}else{if(d=47===a.charCodeAt(f-1)?(t=s=a.substring(m+1,f-1),h=!0):(t=s=a.substring(m+1,f),!(h=!0)),!(96<r&&r<123||64<r&&r<91||95===r||58===r))return O("illegal first char nodeName");for(i=1,n=t.length;i<n;i++)if(!(96<(r=t.charCodeAt(i))&&r<123||64<r&&r<91||47<r&&r<59||45===r||95===r||46==r)){if(32===r||r<14&&8<r){s=t.substring(0,i),g=null;break}return O("invalid nodeName")}d||u.push(s)}if(N){if(e=b,h&&(d||l.push(e),null!==g||(D=-1!==t.indexOf("xmlns",i))&&(E=i,_=t,y(),D=!1)),-1!==(r=(c=s).indexOf(":"))){if(!(o=b[s.substring(0,r)]))return O("missing namespace on <"+c+">");s=s.substr(r+1)}else o=b.xmlns;o&&(s=o+":"+s)}if(h&&(E=i,_=t,w&&(k?w(p,_n,d,M):w(s,y,_n,d,M),B)))return;if(d){if(S&&(S(k?p:s,_n,h,M),B))return;N&&(b=h?e:l.pop())}f+=1}else{if(-1===(f=a.indexOf("?>",m)))return O("unclosed question");if(R&&(R(a.substring(m,f+2),M),B))return;f+=2}else{if(91===(r=a.charCodeAt(m+2))&&"CDATA["===a.substr(m+3,6)){if(-1===(f=a.indexOf("]]>",m)))return O("unclosed cdata");if(C&&(C(a.substring(m+9,f),M),B))return;f+=3;continue}if(45===r&&45===a.charCodeAt(m+3)){if(-1===(f=a.indexOf("--\x3e",m)))return O("unclosed comment");if(T&&(T(a.substring(m+4,f),_n,M),B))return;f+=3;continue}if(-1===(f=a.indexOf(">",m+1)))return O("unclosed tag");if(A&&(A(a.substring(m,f+1),_n,M),B))return;f+=1}}}(e),M=Mn,B=!1,t},this.stop=function(){B=!0}}function Bn(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var On={xsi:"http://www.w3.org/2001/XMLSchema-instance"},Ln="xsi:type";function In(e){return e.xml&&e.xml.serialize}function jn(e){return In(e)===Ln}function zn(e,t){return Bn(t)?e.prefix+":"+function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(e.localName):e.name}function Fn(e){return new Error(e)}function $n(e){return e.$descriptor}function Hn(e){F(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Fn("expected element");var t,n=this.elementsById,i=$n(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw Fn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Wn(){}function Gn(){}function Vn(){}function Un(e,t){this.property=e,this.context=t}function qn(e,t){this.element=t,this.propertyDesc=e}function Kn(){}function Yn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Xn(e,t,n){Yn.call(this,e,t,n)}function Zn(e,t,n){this.model=e,this.context=n}function Qn(e){e instanceof fn&&(e={model:e}),F(this,{lax:!1},e)}Wn.prototype.handleEnd=function(){},Wn.prototype.handleText=function(){},Wn.prototype.handleNode=function(){},(Gn.prototype=Object.create(Wn.prototype)).handleNode=function(){return this},(Vn.prototype=Object.create(Wn.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Un.prototype=Object.create(Vn.prototype)).handleNode=function(e){if(this.element)throw Fn("expected no sub nodes");return this.element=this.createReference(e),this},Un.prototype.handleEnd=function(){this.element.id=this.body},Un.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(qn.prototype=Object.create(Vn.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=an(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Kn.prototype=Object.create(Vn.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},(Yn.prototype=Object.create(Kn.prototype)).addReference=function(e){this.context.addReference(e)},Yn.prototype.handleText=function(e){if(!$n(this.element).bodyProperty)throw Fn("unexpected body text <"+e+">");Vn.prototype.handleText.call(this,e)},Yn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=$n(t).bodyProperty;n&&void 0!==e&&(e=an(n.type,e),t.set(n.name,e))},Yn.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=$n(n),o=this.context,a=new n({}),s=this.model;return k(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?k(e.split(" "),function(e){o.addReference({element:a,property:n.ns.name,id:e})}):o.addReference({element:a,property:n.ns.name,id:e}):(n?e=an(n.type,e):"xmlns"!==t&&(i=pn(t,r.ns.prefix),s.getPackage(i.prefix)&&o.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},Yn.prototype.getPropertyForNode=function(e){var t,n,i=pn(e.name),r=this.type,o=this.model,a=$n(r),s=i.name,c=a.propertiesByName[s];if(c)return jn(c)&&(t=e.attributes[Ln])?(t=function(e,t){var n=pn(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),F({},c,{effectiveType:$n(n=o.getType(t)).name})):c;var p=o.getPackage(i.prefix);if(p){if(t=zn(i,p),n=o.getType(t),c=R(a.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return F({},c,{effectiveType:$n(n).name})}else if(c=R(a.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return c;throw Fn("unrecognized element <"+i.name+">")},Yn.prototype.toString=function(){return"ElementDescriptor["+$n(this.type).name+"]"},Yn.prototype.valueHandler=function(e,t){return new qn(e,t)},Yn.prototype.referenceHandler=function(e){return new Un(e,this.context)},Yn.prototype.handler=function(e){return"Element"===e?new Zn(this.model,e,this.context):new Yn(this.model,e,this.context)},Yn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,cn(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(F(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},(Xn.prototype=Object.create(Yn.prototype)).createElement=function(e){var t=e.name,n=pn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&zn(n,o)||t;if(!r.hasType(a))throw Fn("unexpected element <"+e.originalName+">");return Yn.prototype.createElement.call(this,e)},(Zn.prototype=Object.create(Kn.prototype)).createElement=function(e){var t=e.name,n=pn(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Zn.prototype.handleChild=function(e){var t=new Zn(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Zn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Qn.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof Yn?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t=this.model,a=this.lax,p=new Hn(F({},e,{rootHandler:r})),o=new Nn({proxy:!0}),s=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var s="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return p.addWarning({message:s,error:e}),!0;throw Fn(s)}function l(e,t){return c(e,t,!0)}r.context=p,s.push(r);var u=/^<\?xml /i,h=/ encoding="([^"]+)"/i,d=/^utf-8$/i;function m(e,t){try{s.peek().handleText(e)}catch(e){l(e,t)}}var f=t.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});o.ns(f).on("openTag",function(e,i,t,n){var r=e.attrs||{},o=Object.keys(r).reduce(function(e,t){var n=i(r[t]);return e[t]=n,e},{});!function(e,t){var n=s.peek();try{s.push(n.handleNode(e))}catch(e){c(e,t,a)&&s.push(new Gn)}}({name:e.name,originalName:e.originalName,attributes:o,ns:e.ns},n)}).on("question",function(e){if(u.test(e)){var t=h.exec(e),n=t&&t[1];n&&!d.test(n)&&p.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){s.pop().handleEnd()}).on("cdata",m).on("text",function(e,t,n){!function(e,t){(e=e.trim())&&m(e,t)}(t(e),n)}).on("error",c).on("warn",l),function(e){setTimeout(e,0)}(function(){var t;try{o.parse(n),function(){var e,t,n=p.elementsById,i=p.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=$n(r).propertiesByName[t.property];if(o||p.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var s=r.get(a.name),c=s.indexOf(t);-1===c&&(c=s.length),o?s[c]=o:s.splice(c,1)}else r.set(a.name,o)}}()}catch(e){t=e}var e=r.element;t||e||(t=Fn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)})},Qn.prototype.handler=function(e){return new Xn(this.model,e)};var Jn=/<|>|'|"|&|\n\r|\n/g,ei=/<|>|&/g;function ti(t){var n={},i={},r={},o=[],a=[];this.byUri=function(e){return i[e]||t&&t.byUri(e)},this.add=function(e,t){i[e.uri]=e,t?o.push(e):a.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(o,a).filter(function(e){return r[e.uri]})}}function ni(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ii(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function ri(e,t){return t.isGeneric?F({localName:t.ns.localName},e):F({localName:function(e,t){return Bn(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}(t.ns.localName,t.$pkg)},e)}var oi={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ai={"<":"lt",">":"gt","&":"amp"};function si(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function ci(e){this.tagName=e}function pi(){}function li(e){this.tagName=e}function ui(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function hi(e,t){ui.call(this,e,t)}function di(){this.value="",this.write=function(e){this.value+=e}}function mi(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function fi(r){return r=F({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new di,i=new mi(n,r.format);if(r.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new ui).build(e).serializeTo(i),!t)return n.value}}}function yi(e,t){fn.call(this,e,t)}ci.prototype.build=function(e){return this.element=e,this},ci.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},pi.prototype.serializeValue=pi.prototype.serializeTo=function(e){e.append(this.escape?function(e){return si(e,ei,ai)}(this.value):this.value)},pi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ei)&&(this.escape=!0),this},ni(li,pi),li.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},ui.prototype.build=function(e){var t,n,i=(this.element=e).$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(i){return A(i.$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!i.hasOwnProperty(t))return!1;var n=i[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)})}(e),this.parseAttributes(function(e){return A(e,function(e){return e.isAttr})}(n)),this.parseContainments(function(e){return A(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},ui.prototype.nsTagName=function(e){return ri(this.logNamespaceUsed(e.ns),e)},ui.prototype.nsPropertyTagName=function(e){return function(e,t){return F({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},ui.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ui.prototype.nsAttributeName=function(e){var t;if(t=d(e)?pn(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}:F({localName:t.localName},n)},ui.prototype.parseGeneric=function(n){var i=this,r=this.body,o=[];return k(n,function(e,t){"$body"===t?r.push((new pi).build({type:"String"},e)):"$children"===t?k(e,function(e){r.push(new ui(i).build(e))}):0===t.indexOf("$")||i.parseNsAttribute(n,t,e)&&o.push({name:t,value:e})}),o},ui.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=pn(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},ui.prototype.parseNsAttributes=function(i,e){var r=this,t=i.$attrs,o=[];return k(t,function(e,t){var n=r.parseNsAttribute(i,t,e);n&&o.push(n)}),o},ui.prototype.parseGenericAttributes=function(n,e){var i=this;k(e,function(t){if(t.name!==Ln)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},ui.prototype.parseContainments=function(e){var o=this,a=this.body,s=this.element;k(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)a.push((new pi).build(n,e[0]));else if(cn(n.type))k(e,function(e){a.push(new li(o.addTagName(o.nsPropertyTagName(n))).build(n,e))});else if(t)k(e,function(e){a.push(new ci(o.addTagName(o.nsPropertyTagName(n))).build(e))});else{var i=jn(n),r=function(e){return"property"===In(e)}(n);k(e,function(e){var t;t=i?new hi(o,n):r?new ui(o,n):new ui(o),a.push(t.build(e))})}})},ui.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ti(t):n=t),n},ui.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(o,r),e},ui.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=On[s]||o&&(o.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},ui.prototype.parseAttributes=function(e){var i=this,r=this.element;k(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];k(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;i.addAttribute(i.nsAttributeName(e),t)})},ui.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ii(e)},ui.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=function(e){return si(e,Jn,oi)}(t)),n.push({name:e,value:t})},ui.prototype.serializeAttributes=function(t){var e=this.attrs,n=this.namespaces;n&&(e=function(e){return _(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(e)),k(e,function(e){t.append(" ").append(ii(e.name)).append('="').append(e.value).append('"')})},ui.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==pi;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),k(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("</"+this.tagName+">")),t.appendNewLine()},ni(hi,ui),hi.prototype.parseNsAttributes=function(e){var t=ui.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Ln),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},hi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(yi.prototype=Object.create(fn.prototype)).fromXML=function(e,t,n,i){d(t)||(i=n,n=t,t="bpmn:Definitions"),u(n)&&(i=n,n={});var r=new Qn(F({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)};yi.prototype.toXML=function(e,t,n){u(t)&&(n=t,t={});var i,r,o=new fi(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var vi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{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",type:"String",isAttr:!0}]},{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",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{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:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!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",type:"String",isBody:!0}]},{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",type:"String",isAttr:!0},{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",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!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"],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"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",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:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/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}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{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,isVirtual:!0,isMany:!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",type:"String",isAttr:!0,isId:!0},{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,isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",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:[]}};function gi(e,t){return new yi(F({},vi,e),t)}function bi(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var xi=new Pt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function _i(e,t){return e.$instanceOf(t)}function Ei(a,s){var c={},p=[];function l(t,n){return function(e){t(e,n)}}function i(e){c[e.id]=e}function r(t,e){try{var n=t.di&&function(e,t){if(e.gfx)throw new Error(s("already rendered {element}",{element:bi(e)}));return a.element(e,t)}(t,e);return i(t),n}catch(e){u(e.message,{element:t,error:e}),console.error(s("failed to import {element}",{element:bi(t)})),console.error(e)}}function u(e,t){a.error(e,t)}function h(e){var t=e.bpmnElement;t?t.di?u(s("multiple DI elements defined for {element}",{element:bi(t)}),{element:t}):(xi.bind(t,"di"),t.di=e):u(s("no bpmnElement referenced in {element}",{element:bi(e)}),{element:e})}function d(e){!function(e){h(e),k(e.planeElement,t)}(e.plane)}function t(e){h(e)}function m(){for(;p.length;)p.shift()()}function f(e,t){C(e,t),x(e.ioSpecification,t),b(e.artifacts,t),i(e)}function y(e,t){r(e,t)}function o(e,t){r(e,t)}function n(e,t){r(e,t)}function v(e,t){r(e,t)}function g(e,t){r(e,t)}function b(e,t){k(e,function(e){_i(e,"bpmn:Association")?p.push(function(){g(e,t)}):g(e,t)})}function x(e,t){e&&(k(e.dataInputs,l(n,t)),k(e.dataOutputs,l(v,t)))}function _(e,t){C(e,t),b(e.artifacts,t)}function E(e,t){r(e,t)}function w(t,n){p.push(function(){var e=r(t,n);t.childLaneSet&&S(t.childLaneSet,e||n),function(n){k(n.flowNodeRef,function(e){var t=e.get("lanes");t&&t.push(n)})}(t)})}function S(e,t){k(e.lanes,l(w,t))}function C(e,t){!function(e,t){k(e,function(e){_i(e,"bpmn:SequenceFlow")?p.push(function(){!function(e,t){r(e,t)}(e,t)}):_i(e,"bpmn:BoundaryEvent")?p.unshift(function(){!function(e,t){r(e,t)}(e,t)}):_i(e,"bpmn:FlowNode")?function(e,t){var n=r(e,t);_i(e,"bpmn:SubProcess")&&_(e,n||t),_i(e,"bpmn:Activity")&&x(e.ioSpecification,t),p.push(function(){k(e.dataInputAssociations,l(o,t)),k(e.dataOutputAssociations,l(o,t))})}(e,t):_i(e,"bpmn:DataObject")||(_i(e,"bpmn:DataStoreReference")?E(e,t):_i(e,"bpmn:DataObjectReference")?E(e,t):u(s("unrecognized flowElement {element} in context {context}",{element:bi(e),context:t?bi(t.businessObject):"null"}),{element:e,context:t}))})}(e.flowElements,t),e.laneSets&&function(e,t){k(e,l(S,t))}(e.laneSets,t)}function T(e,t){var n=r(e,t),i=e.processRef;i&&f(i,n||t)}return{handleDeferred:m,handleDefinitions:function(e,t){var n=e.diagrams;if(t&&-1===n.indexOf(t))throw new Error(s("diagram not part of bpmn:Definitions"));if(!t&&n&&n.length&&(t=n[0]),!t)throw new Error(s("no diagram to display"));d(t);var i=t.plane;if(!i)throw new Error(s("no plane for {element}",{element:bi(t)}));var r=i.bpmnElement;if(!r){if(!(r=function(e){return R(e.rootElements,function(e){return _i(e,"bpmn:Process")||_i(e,"bpmn:Collaboration")})}(e)))throw new Error(s("no process or collaboration to display"));u(s("correcting missing bpmnElement on {plane} to {rootElement}",{plane:bi(i),rootElement:bi(r)})),i.bpmnElement=r,h(i)}var o=function(e,t){return a.root(e,t)}(r,i);if(_i(r,"bpmn:Process"))f(r,o);else{if(!_i(r,"bpmn:Collaboration"))throw new Error(s("unsupported bpmnElement for {plane}: {rootElement}",{plane:bi(i),rootElement:bi(r)}));!function(e){k(e.participants,l(T)),b(e.artifacts),p.push(function(){!function(e,t){k(e,l(y,t))}(e.messageFlows)})}(r),function(e,t){A(e,function(e){return!function(e){return c[e.id]}(e)&&_i(e,"bpmn:Process")&&e.laneSets}).forEach(l(f,t))}(e.rootElements,o)}m()},handleSubProcess:_,registerDi:h}}function wi(e,t){var n=Si(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Si(e){return e&&e.businessObject||e}function Ci(e){return!wi(e,"bpmn:CallActivity")&&(wi(e,"bpmn:SubProcess")?!!Si(e).di.isExpanded:!wi(e,"bpmn:Participant")||!!Si(e).processRef)}function Ti(e){return e&&!!Si(e).triggeredByEvent}function Ri(e,t){var n=Si(e),i=!1;return n.eventDefinitions&&k(n.eventDefinitions,function(e){wi(e,t)&&(i=!0)}),i}function Ai(t,n,i){return x(t.eventDefinitions,function(e){return e.$type===n&&function(n,e){return b(e,function(e,t){return n[t]==e})}(t,i)})}function Pi(e){return e.businessObject.di}function ki(e){return e.businessObject}function Mi(e,t){return Pi(e).get("bioc:fill")||t||"white"}function Di(e,t){return Pi(e).get("bioc:stroke")||t||"black"}var Ni=new o;function Bi(e,t,r,l,s,o,n){it.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,a=Ni.next(),c={},p=r.computeStyle;function d(e,t){var n=F({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var o=Ne("marker");_e(t.element,n),ve(o,t.element),_e(o,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var a=de("defs",s._svg);a||(a=Ne("defs"),ve(s._svg,a)),ve(a,o),c[e]=o}function m(e){return e.replace(/[()\s,#]+/g,"_")}function f(e,t,n){var i=e+"-"+m(t)+"-"+m(n)+"-"+a;return c[i]||function(e,t,n,i){if("sequenceflow-end"===t){var r=Ne("path");_e(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),d(e,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var o=Ne("circle");_e(o,{cx:6,cy:6,r:3.5}),d(e,{element:o,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ne("path");_e(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),d(e,{element:a,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ne("path");_e(s,{d:"M 11 5 L 1 10 L 11 15"}),d(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var c=Ne("path");_e(c,{d:"M 1 5 L 11 10 L 1 15"}),d(e,{element:c,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=Ne("path");_e(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),d(e,{element:p,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var l=Ne("path");_e(l,{d:"M 6 4 L 10 16"}),d(e,{element:l,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){P(i)&&(r=i,i=0),i=i||0,"none"===(r=p(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Ne("circle");return _e(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),_e(s,r),ve(e,s),s}function v(e,t,n,i,r,o){P(r)&&(o=r,r=0),r=r||0,o=p(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Ne("rect");return _e(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),_e(a,o),ve(e,a),a}function g(e,t,n){var i=at(t,n=p(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return ve(e,i),i}function b(e,t,n){n=p(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=Ne("path");return _e(i,{d:t}),_e(i,n),ve(e,i),i}function i(e,t,n,i){return b(t,n,F({"data-marker":e},i))}function x(n){return function(e,t){return R[n](e,t)}}function _(e){return R[e]}function E(e,t){var n=ki(e),i=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return Ai(n,"bpmn:MessageEventDefinition")?_("bpmn:MessageEventDefinition")(t,e,i):Ai(n,"bpmn:TimerEventDefinition")?_("bpmn:TimerEventDefinition")(t,e,i):Ai(n,"bpmn:ConditionalEventDefinition")?_("bpmn:ConditionalEventDefinition")(t,e):Ai(n,"bpmn:SignalEventDefinition")?_("bpmn:SignalEventDefinition")(t,e,i):Ai(n,"bpmn:CancelEventDefinition")&&Ai(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?_("bpmn:MultipleEventDefinition")(t,e,i):Ai(n,"bpmn:CancelEventDefinition")&&Ai(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?_("bpmn:ParallelMultipleEventDefinition")(t,e,i):Ai(n,"bpmn:EscalationEventDefinition")?_("bpmn:EscalationEventDefinition")(t,e,i):Ai(n,"bpmn:LinkEventDefinition")?_("bpmn:LinkEventDefinition")(t,e,i):Ai(n,"bpmn:ErrorEventDefinition")?_("bpmn:ErrorEventDefinition")(t,e,i):Ai(n,"bpmn:CancelEventDefinition")?_("bpmn:CancelEventDefinition")(t,e,i):Ai(n,"bpmn:CompensateEventDefinition")?_("bpmn:CompensateEventDefinition")(t,e,i):Ai(n,"bpmn:TerminateEventDefinition")?_("bpmn:TerminateEventDefinition")(t,e,i):null}function w(e,t,n){n=F({size:{width:100}},n);var i=o.createText(t||"",n);return Te(i).add("djs-label"),ve(e,i),i}function S(e,t,n){return w(e,ki(t).name,{box:t,align:n,padding:5,style:{fill:Di(t,h)}})}function C(e,t,n){qt(w(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Di(n,h)}}),0,-(-1*n.height),270)}function T(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var R=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=.95),y(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Mi(t,u),stroke:Di(t,h)};ki(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Mi(t,u),stroke:Di(t,h)});var i=_("bpmn:Event")(e,t,n);return E(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Di(t,h):Mi(t,u),stroke:n?Mi(t,u):Di(t,h)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Mi(t,u),stroke:Di(t,h)});b(e,l.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Di(t,h)});for(var i=0;i<12;i++){var r=l.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),o=t.width/2;b(e,r,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+o+")",stroke:Di(t,h)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:ConditionalEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Di(t,h)})},"bpmn:LinkEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:ErrorEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=b(e,l.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)});return Yt(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:SignalEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:MultipleEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Di(t,h):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)})},"bpmn:EndEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:4,fill:Mi(t,u),stroke:Di(t,h)});return E(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:Di(t,h),stroke:Di(t,h)})},"bpmn:IntermediateEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)});return y(e,t.width,t.height,3,{strokeWidth:1,fill:Mi(t,"none"),stroke:Di(t,h)}),E(t,e),n},"bpmn:IntermediateCatchEvent":x("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":x("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=.95),v(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Mi(t,u),stroke:Di(t,h)},i=_("bpmn:Activity")(e,t,n);return S(e,t,"center-middle"),A(e,t),i},"bpmn:ServiceTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Mi(t,u)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:UserTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ManualTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:SendTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Di(t,h),stroke:Mi(t,u)}),n},"bpmn:ReceiveTask":function(e,t){var n=ki(t),i=_("bpmn:Task")(e,t);return b(e,n.instantiate?(y(e,28,28,4.4,{strokeWidth:1}),l.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),i},"bpmn:ScriptTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Di(t,h)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=_("bpmn:Task")(e,t);return _e(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Mi(t,"#aaaaaa"),stroke:Di(t,h)}),_e(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Di(t,h)}),n},"bpmn:SubProcess":function(e,t,n){n=F({fill:Mi(t,u),stroke:Di(t,h)},n);var i=_("bpmn:Activity")(e,t,n),r=Ci(t);return Ti(t)&&_e(i,{strokeDasharray:"1,2"}),S(e,t,r?"center-top":"center-middle"),r?A(e,t):A(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return _("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var n=_("bpmn:SubProcess")(e,t),i=r.style(["no-fill","no-events"],{stroke:Di(t,h)});return v(e,t.width,t.height,8,3,i),n},"bpmn:CallActivity":function(e,t){return _("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:.95,fill:Mi(t,u),stroke:Di(t,h)},i=_("bpmn:Lane")(e,t,n);Ci(t)?(g(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Di(t,h)}),C(e,ki(t).name,t)):w(e,ki(t).name,{box:t,align:"center-middle",style:{fill:Di(t,h)}});return!!ki(t).participantMultiplicity&&_("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=v(e,t.width,t.height,0,F({fill:Mi(t,u),fillOpacity:.35,stroke:Di(t,h)},n)),r=ki(t);"bpmn:Lane"===r.$type&&C(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return y(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t),i=l.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Pi(t).isMarkerVisible&&b(e,i,{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ComplexGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ParallelGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:EventBasedGateway":function(e,t){var n=ki(t),i=_("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Di(t,h)});var r,o,a=n.eventGatewayType,s=!!n.instantiate;if("Parallel"===a){var c=l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});_e(b(e,c),{strokeWidth:1,fill:"none"})}else if("Exclusive"===a){if(!s)_e(y(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Di(t,h)});r=l.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),o={strokeWidth:2,fill:Mi(t,"none"),stroke:Di(t,h)},b(e,r,o)}return i},"bpmn:Gateway":function(e,t){var n={fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)};return function(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map(function(e){return e.x+","+e.y}).join(" ");i=p(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=Ne("polygon");return _e(s,{points:a}),_e(s,i),ve(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=T(t),r=Mi(t,u),o=Di(t,h),a=b(e,i,{strokeLinejoin:"round",markerEnd:f("sequenceflow-end",r,o),stroke:Di(t,h)}),s=ki(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&_e(a,{markerStart:f("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&_e(a,{markerStart:f("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=ki(t),r=Mi(t,u),o=Di(t,h);return n=F({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Di(t,h)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=f("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=f("association-start",r,o)),g(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Mi(t,u),i=Di(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Mi(t,u),i=Di(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=ki(t),i=Pi(t),r=Mi(t,u),o=Di(t,h),a=b(e,T(t),{markerEnd:f("messageflow-end",r,o),markerStart:f("messageflow-start",r,o),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Di(t,h)});if(n.messageRef){var s=a.getPointAtLength(a.getTotalLength()/2),c=l.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:s.x,y:s.y}}),p={strokeWidth:1};"initiating"===i.messageVisibleKind?(p.fill="white",p.stroke="black"):(p.fill="#888",p.stroke="white"),b(e,c,p)}return a},"bpmn:DataObject":function(e,t){var n=b(e,l.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(ki(t))&&function(e,t){var n=(t.height-16)/t.height,i=l.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:n}});b(e,i,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":x("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return b(e,l.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)})},"bpmn:BoundaryEvent":function(e,t){var n=ki(t).cancelActivity,i={strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=F({},i,{fillOpacity:1}),o=F({},i,{fill:"none"}),a=_("bpmn:Event")(e,t,r);return y(e,t.width,t.height,3,o),E(t,e),a},"bpmn:Group":function(e,t){var n=ki(t),i=Pi(t),r=v(e,t.width,t.height,10,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"}),o=n.categoryValueRef||{};if(o.value){var a=i.label?i.label.bounds:t;w(e,o.value,{box:a,style:{fill:Di(t,h)}})}return r},label:function(e,t){return function(e,t){var n=ki(t),i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return w(e,n.name,{box:i,fitBox:!0,style:F({},o.getExternalStyle(),{fill:Di(t,h)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return b(e,l.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Di(t,h)}),w(e,ki(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Di(t,h)}}),n},ParticipantMultiplicityMarker:function(e,t){i("participant-multiplicity",e,l.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:1,fill:Mi(t,u),stroke:Di(t,h)})},SubProcessMarker:function(e,t){Kt(v(e,14,14,0,{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),t.width/2-7.5,t.height-20),i("sub-process",e,l.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:Mi(t,u),stroke:Di(t,h)})},ParallelMarker:function(e,t,n){i("parallel",e,l.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:Mi(t,u),stroke:Di(t,h)})},SequentialMarker:function(e,t,n){i("sequential",e,l.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:Mi(t,u),stroke:Di(t,h)})},CompensationMarker:function(e,t,n){i("compensation",e,l.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:Mi(t,u),stroke:Di(t,h)})},LoopMarker:function(e,t,n){i("loop",e,l.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:Mi(t,u),stroke:Di(t,h),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){i("adhoc",e,l.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:Di(t,h),stroke:Di(t,h)})}};function A(t,n,e){var i,r=ki(n),o=e&&-1!==e.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},k(e,function(e){_(e)(t,n,i)}),r.isForCompensation&&_("CompensationMarker")(t,n,i),"bpmn:AdHocSubProcess"===r.$type&&_("AdhocMarker")(t,n,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&_("LoopMarker")(t,n,i),!1===s&&_("ParallelMarker")(t,n,i),!0===s&&_("SequentialMarker")(t,n,i))}this._drawPath=b}t(Bi,it),Bi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Bi.prototype.canRender=function(e){return wi(e,"bpmn:BaseElement")},Bi.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Bi.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Bi.prototype.getShapePath=function(e){return wi(e,"bpmn:Event")?function(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2;return rt([["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])}(e):wi(e,"bpmn:Activity")?function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return rt([["M",n+t,i],["l",r-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-r,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):wi(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return rt([["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,i=e.width;return rt([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])}(e)};var Oi=0,Li={width:150,height:50};function Ii(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function ji(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Ii(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return zi(e,o,r,i);o=Fi(o,i.width,t)}}function zi(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function Fi(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(1<i.length)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $i(e){this._config=F({},{size:Li,padding:Oi,style:{},align:"center-top"},e||{})}$i.prototype.createText=function(e,t){return this.layoutText(e,t).element},$i.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$i.prototype.layoutText=function(e,t){var n=F({},this._config.size,t.box),i=F({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return P(e)?F({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)}(i),c=e.split(/\r?\n/g),p=[],l=n.width-o.left-o.right,u=Ne("text");for(_e(u,{x:0,y:0}),_e(u,i),ve(function(){var e=document.getElementById("helper-svg");return e||(_e(e=Ne("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}(),u);c.length;)p.push(ji(c,l,u));"middle"===r.vertical&&(o.top=o.bottom=0);var h=v(p,function(e,t,n){return e+(s||t.height)},0)+o.top+o.bottom,d=v(p,function(e,t,n){return t.width>e?t.width:e},0),m=o.top;"middle"===r.vertical&&(m+=(n.height-h)/2),m-=(s||p[0].height)/4;var f=Ne("text");return _e(f,i),k(p,function(e){var t;switch(m+=s||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(a?d:l)-o.right-e.width;break;default:t=Math.max(((a?d:l)-e.width)/2+o.left,0)}var n=Ne("tspan");_e(n,{x:t,y:m}),n.textContent=e.text,ve(f,n)}),Ae(u),{dimensions:{width:d,height:h},element:f}};function Hi(e){var i=F({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(i.fontSize,10)-1,r=F({},i,{fontSize:t},e&&e.externalStyle||{}),o=new $i({style:i});this.getExternalLabelBounds=function(e,t){var n=o.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,t){var n=o.getDimensions(t,{box:e,style:i,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(n.height))}},this.createText=function(e,t){return o.createText(e,t||{})},this.getDefaultStyle=function(){return i},this.getExternalStyle=function(){return r}}Hi.$inject=["config.textRenderer"];var Wi=/\{([^}]+)\}/g,Gi=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Vi={__init__:["bpmnRenderer"],bpmnRenderer:["type",Bi],textRenderer:["type",Hi],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 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},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,i,r=this.pathMap[e];i=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my);var o={};if(t.position){for(var a=t.containerHeight/r.height*t.yScaleFactor,s=t.containerWidth/r.width*t.xScaleFactor,c=0;c<r.heightElements.length;c++)o["y"+c]=r.heightElements[c]*a;for(var p=0;p<r.widthElements.length;p++)o["x"+p]=r.widthElements[p]*s}return function(e,n){return String(e).replace(Wi,function(e,t){return function(e,t,n){var o=n;return t.replace(Gi,function(e,t,n,i,r){t=t||i,o&&(t in o&&(o=o[t]),"function"==typeof o&&r&&(o=o()))}),o=(null==o||o==n?e:o)+""}(e,t,n)})}(r.d,{mx:n,my:i,e:o})}}]};var Ui={translate:["value",function(e,n){return n=n||{},e.replace(/{([^}]+)}/g,function(e,t){return n[t]||"{"+t+"}"})}]},qi={width:90,height:20},Ki=15;function Yi(e){return wi(e,"bpmn:Event")||wi(e,"bpmn:Gateway")||wi(e,"bpmn:DataStoreReference")||wi(e,"bpmn:DataObjectReference")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")}function Xi(e){return Ji(e.label)}function Zi(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(.01+t)],r=function(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(.01+t)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Ki:a+=Ki,{x:a,y:s}}function Qi(e){return e.waypoints?Zi(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+qi.height/2}}function Ji(e){return e&&e.labelTarget}function er(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function tr(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=er(e,t);return Math.abs(r/o)<=i}var nr=2;function ir(e,t){return Math.abs(e.x-t.x)<=nr?"h":Math.abs(e.y-t.y)<=nr&&"v"}function rr(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 or(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}
1
+ /*! bpmn-js - bpmn-modeler v3.5.0 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.BpmnJS=t()}(this,function(){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e(function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),n=e(function(e){var c=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++){o=Math.floor(Math.random()*t).toString(t)+o}if(r){var a=Math.pow(t,r);o=Math.floor(Math.random()*a).toString(t)+o}var s=parseInt(o,t);return s!==1/0&&s>=Math.pow(2,e)?c(e,t):o};c.rack=function(i,r,o){var n=function(e){var t=0;do{if(10<t++){if(!o)throw new Error("too many ID collisions, use more bits");i+=o}var n=c(i,r)}while(Object.hasOwnProperty.call(a,n));return a[n]=e,n},a=n.hats={};return n.get=function(e){return n.hats[e]},n.set=function(e,t){return n.hats[e]=t,n},n.bits=i||128,n.base=r||16,n}});function r(e){if(!(this instanceof r))return new r(e);e=e||[128,36,1],this._seed=e.length?n.rack(e[0],e[1],e[2]):e}var o=r;function h(e){return Array.prototype.concat.apply([],e)}r.prototype.next=function(e){return this._seed(e||!0)},r.prototype.nextPrefixed=function(e,t){for(var n;n=e+this.next(!0),this.assigned(n););return this.claim(n,t),n},r.prototype.claim=function(e,t){this._seed.set(e,t||!0)},r.prototype.assigned=function(e){return this._seed.get(e)||!1},r.prototype.unclaim=function(e){delete this._seed.hats[e]},r.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var a=Object.prototype.toString,s=Object.prototype.hasOwnProperty;function p(e){return void 0===e}function c(e){return void 0!==e}function g(e){return"[object Array]"===a.call(e)}function P(e){return"[object Object]"===a.call(e)}function l(e){return"[object Number]"===a.call(e)}function u(e){return"[object Function]"===a.call(e)}function d(e){return"[object String]"===a.call(e)}function _(e,t){return s.call(e,t)}function A(e,n){var i;return n=B(n),M(e,function(e,t){if(n(e,t))return i=e,!1}),i}function m(e,n){n=B(n);var i=g(e)?-1:void 0;return M(e,function(e,t){if(n(e,t))return i=t,!1}),i}function k(e,n){var i=[];return M(e,function(e,t){n(e,t)&&i.push(e)}),i}function M(e,t){if(!p(e)){var n=g(e)?L:O;for(var i in e){if(_(e,i))if(!1===t(e[i],n(i)))return}}}function f(e,n){return p(e)?[]:(function(e){if(!g(e))throw new Error("must supply array")}(e),n=B(n),e.filter(function(e,t){return!n(e,t)}))}function x(e,n,i){return M(e,function(e,t){i=n(i,e,t)}),i}function y(e,i){return x(e,function(e,t,n){return e&&i(t,n)},!0)}function v(e,t){return!!A(e,t)}function b(e,n){var i=[];return M(e,function(e,t){i.push(n(e,t))}),i}function E(e){return e&&Object.keys(e)||[]}function w(e){return b(e,function(e){return e})}function S(e,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return i=N(i),M(e,function(e){var t=i(e)||"_",n=r[t];n||(n=r[t]=[]),n.push(e)}),r}function C(t){t=N(t);for(var n={},e=arguments.length,i=Array(1<e?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return M(i,function(e){return S(e,t,n)}),b(n,function(e,t){return e[0]})}var T=C;function R(e,o){o=N(o);var a=[];return M(e,function(e,t){for(var n=o(e,t),i={d:n,v:e},r=0;r<a.length;r++){if(n<a[r].d)return void a.splice(r,0,i)}a.push(i)}),b(a,function(e){return e.v})}function D(e){return function(n){return y(e,function(e,t){return n[t]===e})}}function N(t){return u(t)?t:function(e){return e[t]}}function B(t){return u(t)?t:function(e){return e===t}}function O(e){return e}function L(e){return Number(e)}function I(n,i){var r,o,a,s;function t(){var e=Date.now(),t=s+i-e;if(0<t)return c(t);n.apply(a,o),r=s=o=a=void 0}function c(e){r=setTimeout(t,e)}return function(){s=Date.now();for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];o=t,a=this,r||c(i)}}function j(e,t){return e.bind(t)}var z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function $(e){for(var t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return z.apply(void 0,[e].concat(n))}function F(t,e){var n={},i=Object(t);return M(e,function(e){e in i&&(n[e]=t[e])}),n}function H(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var W=[].indexOf,G=function(e,t){if(W)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},V=/\s+/,U=Object.prototype.toString;function q(e){return new K(e)}function K(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Y(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}K.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~G(t,e)||t.push(e),this.el.className=t.join(" "),this},K.prototype.remove=function(e){if("[object RegExp]"==U.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=G(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},K.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},K.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):void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},K.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(V);return""===e[0]&&e.shift(),e},K.prototype.has=K.prototype.contains=function(e){return this.list?this.list.contains(e):!!~G(this.array(),e)};var X=Element.prototype,Z=X.matchesSelector||X.webkitMatchesSelector||X.mozMatchesSelector||X.msMatchesSelector||X.oMatchesSelector,Q=function(e,t){if(Z)return Z.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var J,ee=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(Q(i,t))return i;i=i.parentNode}},te=window.addEventListener?"addEventListener":"attachEvent",ne=window.removeEventListener?"removeEventListener":"detachEvent",ie="addEventListener"!==te?"on":"",re={bind:function(e,t,n,i){return e[te](ie+t,n,i||!1),n},unbind:function(e,t,n,i){return e[ne](ie+t,n,i||!1),n}},oe=["focus","blur"],ae={bind:function(n,i,e,r,t){return-1!==oe.indexOf(e)&&(t=!0),re.bind(n,e,function(e){var t=e.target||e.srcElement;e.delegateTarget=ee(t,i,!0,n),e.delegateTarget&&r.call(n,e)},t)},unbind:function(e,t,n,i){-1!==oe.indexOf(t)&&(i=!0),re.unbind(e,t,n,i)}},se=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 i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=pe[i]||pe._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},ce=!1;"undefined"!=typeof document&&((J=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',ce=!J.getElementsByTagName("link").length,J=void 0);var pe={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:ce?[1,"X<div>","</div>"]:[0,"",""]};pe.td=pe.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],pe.option=pe.optgroup=[1,'<select multiple="multiple">',"</select>"],pe.thead=pe.tbody=pe.colgroup=pe.caption=pe.tfoot=[1,"<table>","</table>"],pe.polyline=pe.ellipse=pe.polygon=pe.circle=pe.text=pe.line=pe.path=pe.rect=pe.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var le="undefined"!=typeof Element?Element.prototype:{},ue=le.matches||le.matchesSelector||le.webkitMatchesSelector||le.mozMatchesSelector||le.msMatchesSelector||le.oMatchesSelector,he=function(e,t){if(!e||1!==e.nodeType)return!1;if(ue)return ue.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};function de(e,t){return(t=t||document).querySelector(e)}function me(e,t){return(t=t||document).querySelectorAll(e)}function fe(e){e.parentNode&&e.parentNode.removeChild(e)}function ye(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 ve(e,t){return ye(t,e),e}var ge=2,be={"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":ge,"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":ge,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function xe(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=be[i];r?(r===ge&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function _e(e,t,n){if("string"==typeof t){if(void 0===n)return i=e,be[r=t]?i.style[r]:i.getAttributeNS(null,r);xe(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)xe(e,i,t[i])}(e,t);var i,r;return e}function Ee(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 we=/\s+/,Se=Object.prototype.toString;function Ce(e){return void 0!==e}function Te(e){return new Re(e)}function Re(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ae(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Pe(e){for(var t;t=e.firstChild;)Ae(t);return e}Re.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Ee(t,e)||t.push(e),Ce(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Re.prototype.remove=function(e){if("[object RegExp]"===Se.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Ee(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Re.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},Re.prototype.toggle=function(e,t){return this.list?Ce(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):Ce(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},Re.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(we);return""===e[0]&&e.shift(),e},Re.prototype.has=Re.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Ee(this.array(),e)};var ke={svg:"http://www.w3.org/2000/svg"},Me='<svg xmlns="'+ke.svg+'"';function De(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(ke.svg)&&(e=Me+e.substring(4)):(e=Me+">"+e+"</svg>",t=!0);var n,i,r=(n=e,(i=new DOMParser).async=!1,i.parseFromString(n,"text/xml"));if(!t)return r;for(var o=document.createDocumentFragment(),a=r.firstChild;a.firstChild;)o.appendChild(a.firstChild);return o}function Ne(e,t){var n;return n="<"===e.charAt(0)?(n=De(e).firstChild,document.importNode(n,!0)):document.createElementNS(ke.svg,e),t&&_e(n,t),n}var Be=Ne("svg");function Oe(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Le(e){return e?Be.createSVGTransformFromMatrix(e):Be.createSVGTransform()}var Ie=/([&<>]{1})/g,je=/([\n\r"]{1})/g,ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Fe(e,t){return e.replace(t,function(e,t){return ze[t]||t})}function $e(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Fe(e.textContent,Ie));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Fe(o.value,je),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)$e(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Fe(e.nodeValue,Ie),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function He(e,t){var n=De(t);if(Pe(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)ye(r[o],e)}}function We(e,t){if(void 0===t)return function(e){for(var t=e.firstChild,n=[];t;)$e(t,n),t=t.nextSibling;return n.join("")}(e);try{He(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}function Ge(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i,r,o;for(e.clear(),n=0;i=t[n];n++)e.appendItem((r=e,(o=i)instanceof SVGMatrix?r.createSVGTransformFromMatrix(o):o))}(n,t)),n.consolidate()}var Ve=/^class /;function Ue(e){return"[object Array]"===Object.prototype.toString.call(e)}function qe(){var e=Array.prototype.slice.call(arguments);1===e.length&&Ue(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Ke=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Ye=/^function\s*[^(]*\(\s*([^)]*)\)/m,Xe=/\/\*([^*]*)\*\//m;function Ze(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t,n=e.toString().match((t=e,Ve.test(t.toString())?Ke:Ye));return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(Xe))?n[1].trim():e.trim()})||[]}var Qe="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};function Je(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function et(e,o){o=o||{get:function(e,t){if(a.push(e),!1===t)return null;throw c('No provider for "'+e+'"!')}};var a=[],h=this._providers=Object.create(o._providers||null),s=this._instances=Object.create(null),d=s.injector=this,c=function(e){var t=a.join(" -> ");return a.length=0,new Error(t?e+" (Resolving: "+t+")":e)},n=function e(t,n){if(!h[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),r=e(i.shift());i.length;)r=r[i.shift()];return r}if(tt(s,t))return s[t];if(tt(h,t)){if(-1!==a.indexOf(t))throw a.push(t),c("Cannot resolve circular dependency!");return a.push(t),s[t]=h[t][0](h[t][1]),a.pop(),s[t]}return o.get(t,n)},p=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!Ue(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=qe(e.slice())}return{fn:e,dependencies:(e.$inject||Ze(e)).map(function(e){return tt(t,e)?t[e]:n(e)})}},t=function(e){var t=p(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(Je(n))))},i=function(e,t,n){var i=p(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(Je(r)))},m=function(t){return qe(function(e){return t.get(e)})},l={factory:i,type:t,value:function(e){return e}};e.forEach(function(i){function r(e,t){return"value"!==e&&Ue(t)&&(t=qe(t.slice())),t}if(i instanceof function(){var n=[];this.factory=function(e,t){return n.push([e,"factory",t]),this},this.value=function(e,t){return n.push([e,"value",t]),this},this.type=function(e,t){return n.push([e,"type",t]),this},this.forEach=function(e){n.forEach(e)}})i.forEach(function(e){var t=e[0],n=e[1],i=e[2];h[t]=[l[n],r(n,i),n]});else if("object"===(void 0===i?"undefined":Qe(i)))if(i.__exports__){var e=Object.keys(i).reduce(function(e,t){return"__"!==t.substring(0,2)&&(e[t]=i[t]),e},Object.create(null)),t=new et((i.__modules__||[]).concat([e]),d),n=qe(function(e){return t.get(e)});i.__exports__.forEach(function(e){h[e]=[n,e,"private",t]})}else Object.keys(i).forEach(function(e){if("private"!==i[e][2]){var t=i[e][0],n=i[e][1];h[e]=[l[t],r(t,n),t]}else h[e]=i[e]})}),this.get=n,this.invoke=i,this.instantiate=t,this.createChild=function(e,t){if(t&&t.length){var n,i,r,o,a=Object.create(null),s=Object.create(null),c=[],p=[],l=[];for(var u in h)n=h[u],-1!==t.indexOf(u)&&("private"===n[2]?(i=c.indexOf(n[3]),a[u]=-1===i?(r=n[3].createChild([],t),o=m(r),c.push(n[3]),p.push(r),l.push(o),[o,u,"private",r]):[l[i],u,"private",p[i]]):a[u]=[n[2],n[1]],s[u]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(a[u]=[n[2],n[1]],s[e]=!0)});t.forEach(function(e){if(!s[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(a)}return new et(e,d)}}function tt(e,t){return Object.hasOwnProperty.call(e,t)}var nt=1e3;function it(e,t){var o=this;t=t||nt,e.on(["render.shape","render.connection"],t,function(e,t){var n=e.type,i=t.element,r=t.gfx;if(o.canRender(i))return"render.shape"===n?o.drawShape(r,i):o.drawConnection(r,i)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(o.canRender(t))return"render.getShapePath"===e.type?o.getShapePath(t):o.getConnectionPath(t)})}function rt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function ot(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function at(e,t){var n=Ne("polyline");return _e(n,{points:ot(e)}),t&&_e(n,t),n}it.prototype.canRender=function(){},it.prototype.drawShape=function(){},it.prototype.drawConnection=function(){},it.prototype.getShapePath=function(){},it.prototype.getConnectionPath=function(){};function st(e,t){it.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})}t(st,it),st.prototype.canRender=function(){return!0},st.prototype.drawShape=function(e,t){var n=Ne("rect");return _e(n,{x:0,y:0,width:t.width||0,height:t.height||0}),_e(n,this.SHAPE_STYLE),ve(e,n),n},st.prototype.drawConnection=function(e,t){var n=at(t.waypoints,this.CONNECTION_STYLE);return ve(e,n),n},st.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return rt([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},st.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return rt(r)},st.$inject=["eventBus","styles"];var ct={__init__:["defaultRenderer"],defaultRenderer:["type",st],styles:["type",function(){var i={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},r=this;this.cls=function(e,t,n){return $(this.style(t,n),{class:e})},this.style=function(e,t){g(e)||t||(t=e,e=[]);var n=x(e,function(e,t){return $(e,i[t]||{})},{});return t?$(n,t):n},this.computeStyle=function(e,t,n){return g(t)||(n=t,t=[]),r.style(t||[],$({},n,e||{}))}}]};function pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function lt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function ut(e,t){return e&&t?e.indexOf(t):-1}function ht(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function dt(e,i,r){r=r||0,g(e)||(e=[e]),M(e,function(e,t){var n=i(e,t,r);g(n)&&n.length&&dt(n,i,r+1)})}function mt(e,t){return r=!t,o=-1,a=[],s=[],dt(e,function(e,t,n){ht(a,e,r);var i=e.children;if((-1===o||n<o)&&i&&ht(s,i,r))return i}),a;var r,o,a,s}function ft(e,a){var s,c,p,l;return a=!!a,g(e)||(e=[e]),M(e,function(e){var t=e;e.waypoints&&!a&&(t=ft(e.waypoints,!0));var n=t.x,i=t.y,r=t.height||0,o=t.width||0;(n<s||void 0===s)&&(s=n),(i<c||void 0===c)&&(c=i),(p<n+o||void 0===p)&&(p=n+o),(l<i+r||void 0===l)&&(l=i+r)}),{x:s,y:c,height:l-c,width:p-s}}function yt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function vt(e,t){return $({},e||{},t||{})}function gt(e,t){return Math.round(e*t)/t}function bt(e){return l(e)?e+"px":e}function xt(e,t,n){var i=Ne("g");Te(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var _t={shape:["x","y","width","height"],connection:["waypoints"]};function Et(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function wt(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Et.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Et.prototype._init=function(e){var t,n,i,r=this._eventBus,o=this._container=(n=(t=$({},{width:"100%",height:"100%"},t=e)).container||document.body,(i=document.createElement("div")).setAttribute("class","djs-container"),$(i.style,{position:"relative",overflow:"hidden",width:bt(t.width),height:bt(t.height)}),n.appendChild(i),i),a=this._svg=Ne("svg");_e(a,{width:"100%",height:"100%"}),ve(o,a);var s=this._viewport=xt(a,"viewport");!(this._layers={})!==e.deferUpdate&&(this._viewboxChanged=I(j(this._viewboxChanged,this),300)),r.on("diagram.init",function(){r.fire("canvas.init",{svg:a,viewport:s})},this),r.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),r.on("diagram.destroy",500,this._destroy,this),r.on("diagram.clear",500,this._clear,this)},Et.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._rootElement,delete this._viewport},Et.prototype._clear=function(){var n=this;this._elementRegistry.getAll().forEach(function(e){var t=yt(e);"root"===t?n.setRootElement(null,!0):n._removeElement(e,t)}),delete this._cachedViewbox},Et.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Et.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},Et.prototype._createLayer=function(e,n){n||(n=0);var t=x(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:xt(this._viewport,"layer-"+e,t),index:n}},Et.prototype.getContainer=function(){return this._container},Et.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(M([i.gfx,i.secondaryGfx],function(e){e&&(n?Te(e).add(t):Te(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Et.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Et.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Et.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Te(this.getGraphics(e)).has(t)},Et.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Et.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Et.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e},Et.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 with id "+t.id+" already exists");var n=_t[e];if(!y(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Et.prototype._setParent=function(e,t,n){lt(t.children,e,n),e.parent=t},Et.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Et.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Et.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Et.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),pt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Et.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Et.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Et.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Et.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Et.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Et.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,i,r,o,a,s=this._viewport,c=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(c.width/t.width,c.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);Ge(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=Ge(s))?i.matrix:function(e,t,n,i,r,o){var a=Be.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Oe(a,e);case 6:return Oe(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=gt(n.a,1e3),o=gt(-n.e||0,1e3),a=gt(-n.f||0,1e3),t=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:c})},Et.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=$({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),wt(t,n)}),{x:n.e,y:n.f}},Et.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}),i=this._setZoom(e,t)}),gt(i.a,1e3)):this.viewbox(e).scale;var n,i},Et.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return n=0<=o.x&&0<=o.y&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?{x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),{x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Et.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return o=t?(n=$(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),i.multiply(r)):c.scale(e),wt(this._viewport,o),o},Et.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Et.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}},Et.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var St="data-element-id";function Ct(e){this._elements={},this._eventBus=e}Ct.$inject=["eventBus"],Ct.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),_e(t,St,i),n&&_e(n,St,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ct.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(_e(i.gfx,St,""),i.secondaryGfx&&_e(i.secondaryGfx,St,""),delete t[n])},Ct.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),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Ct.prototype.get=function(e){var t;t="string"==typeof e?e:e&&_e(e,St);var n=this._elements[t];return n&&n.element},Ct.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},Ct.prototype.getAll=function(){return this.filter(function(e){return e})},Ct.prototype.forEach=function(r){var o=this._elements;Object.keys(o).forEach(function(e){var t=o[e],n=t.element,i=t.gfx;return r(n,i)})},Ct.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ct.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 Tt={extend:function(e,i,t,r){var o=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),i.unset(e,o,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&i.set(e,o,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function Rt(t,n,i){var e=Tt.extend(i[n.name]||[],t,n,i);Object.defineProperty(i,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,i)})}function At(e,t){if(!(this instanceof At))return new At(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}At.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]}var n,i,r,o,a;t.collection?Rt(this,t,e):(n=this,r=e,o=(i=t).inverse,a=r[i.name],Object.defineProperty(r,i.name,{configurable:i.configurable,enumerable:i.enumerable,get:function(){return a},set:function(e){if(e!==a){var t=a;a=null,t&&n.unset(t,o,r),a=e,n.set(a,o,r)}}}))},At.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Tt.isExtended(n)||Rt(this,t,e),n},At.prototype.ensureBound=function(e,t){var n,i;n=e,i=t,Object.prototype.hasOwnProperty.call(n,i.name||i)||this.bind(e,t)},At.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},At.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Pt=At,kt=Tt;Pt.Collection=kt;var Mt=new Pt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Dt=new Pt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nt=new Pt({name:"attachers",collection:!0},{name:"host"}),Bt=new Pt({name:"outgoing",collection:!0},{name:"source"}),Ot=new Pt({name:"incoming",collection:!0},{name:"target"});function Lt(){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)}}),Mt.bind(this,"parent"),Dt.bind(this,"labels"),Bt.bind(this,"outgoing"),Ot.bind(this,"incoming")}function It(){Lt.call(this),Mt.bind(this,"children"),Nt.bind(this,"host"),Nt.bind(this,"attachers")}function jt(){It.call(this)}function zt(){It.call(this),Dt.bind(this,"labelTarget")}function Ft(){Lt.call(this),Bt.bind(this,"source"),Ot.bind(this,"target")}t(It,Lt),t(jt,It),t(zt,It),t(Ft,Lt);var $t={connection:Ft,shape:It,label:zt,root:jt};function Ht(){this._uid=12}Ht.prototype.createRoot=function(e){return this.create("root",e)},Ht.prototype.createLabel=function(e){return this.create("label",e)},Ht.prototype.createShape=function(e){return this.create("shape",e)},Ht.prototype.createConnection=function(e){return this.create("connection",e)},Ht.prototype.create=function(e,t){return(t=$({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=$t[e];if(!n)throw new Error("unknown type: <"+e+">");return $(new n,t)}(e,t)};var Wt="__fn",Gt=Array.prototype.slice;function Vt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Ut(){}function qt(e,t,n,i,r){var o=Le();o.setTranslate(t,n);var a=Le();a.setRotate(i,0,0);var s=Le();s.setScale(r||1,r||1),Ge(e,[o,a,s])}function Kt(e,t,n){var i=Le();i.setTranslate(t,n),Ge(e,i)}function Yt(e,t){var n=Le();n.setRotate(t,0,0),Ge(e,n)}function Xt(e,t){this._eventBus=e,this._elementRegistry=t}function Zt(e,t,n){t.insertBefore(e,n||t.firstChild)}Vt.prototype.on=function(e,t,n,i){if(e=g(e)?e:[e],u(t)&&(i=n,n=t,t=1e3),!l(t))throw new Error("priority must be a number");var r=n;i&&((r=j(n,i))[Wt]=n[Wt]||n);var o=this;e.forEach(function(e){o._addListener(e,{priority:t,callback:r,next:null})})},Vt.prototype.once=function(t,e,n,i){var r=this;if(u(e)&&(i=n,n=e,e=1e3),!l(e))throw new Error("priority must be a number");function o(){var e=n.apply(i,arguments);return r.off(t,o),e}o[Wt]=n,this.on(t,e,o)},Vt.prototype.off=function(e,t){e=g(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},Vt.prototype.createEvent=function(e){var t=new Ut;return t.init(e),t},Vt.prototype.fire=function(e,t){var n,i,r,o;if(o=Gt.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Ut?t:this.createEvent(t);var a=(o[0]=n).type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Vt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Vt.prototype._destroy=function(){this._listeners={}},Vt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vt.prototype._invokeListener=function(e,t,n){var i,r,o;try{r=n.callback,o=t,void 0!==(i=r.apply(null,o))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},Vt.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));i=(n=i).next}n.next=t}else this._setListeners(e,t)},Vt.prototype._getListeners=function(e){return this._listeners[e]},Vt.prototype._setListeners=function(e,t){this._listeners[e]=t},Vt.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r[Wt]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},Ut.prototype.stopPropagation=function(){this.cancelBubble=!0},Ut.prototype.preventDefault=function(){this.defaultPrevented=!0},Ut.prototype.init=function(e){$(this,e||{})},Xt.$inject=["eventBus","elementRegistry"],Xt.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=n.parentNode.childNodes[1])||(Te(t=Ne("g")).add("djs-children"),ve(n.parentNode,t)):t=n,t},Xt.prototype._clear=function(e){var t=de(".djs-visual",e);return Y(t),t},Xt.prototype._createContainer=function(e,t,n){var i=Ne("g");Te(i).add("djs-group"),void 0!==n?Zt(i,t,t.childNodes[n]):ve(t,i);var r=Ne("g");Te(r).add("djs-element"),Te(r).add("djs-"+e),ve(i,r);var o=Ne("g");return Te(o).add("djs-visual"),ve(r,o),r},Xt.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},Xt.prototype.updateContainments=function(e){var i=this,r=this._elementRegistry;M(x(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t=e.children;if(t){var n=i._getChildren(e);M(t.slice().reverse(),function(e){Zt(r.getGraphics(e).parentNode,n)})}})},Xt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Xt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Xt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Xt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Xt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Kt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?_e(n,"display","none"):_e(n,"display","block")}},Xt.prototype.remove=function(e){Ae(this._elementRegistry.getGraphics(e).parentNode)};var Qt={__depends__:[ct],__init__:["canvas"],canvas:["type",Et],elementRegistry:["type",Ct],elementFactory:["type",Ht],eventBus:["type",Vt],graphicsFactory:["type",Xt]};function Jt(e){var i=[],r=[];function o(e){return 0<=i.indexOf(e)}e.forEach(function e(t){var n;o(t)||((t.__depends__||[]).forEach(e),o(t)||(n=t,i.push(n),(t.__init__||[]).forEach(function(e){r.push(e)})))});var t=new et(i);return r.forEach(function(e){try{t["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),t}function en(e,t){var n;this.injector=t=t||Jt([{config:["value",n=(n=e)||{}]},Qt].concat(n.modules||[])),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function tn(){}function nn(e,t){this.model=e,this.properties=t}en.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},en.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},tn.prototype.get=function(e){return this.$model.properties.get(this,e)},tn.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},nn.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(tn.prototype);M(e.properties,function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(e,j(function(e,t){this.set(t,e)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var rn={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},on={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};function an(e,t){var n=on[e];return n?n(t):t}function sn(e){return!!rn[e]}function cn(e){return!!on[e]}function pn(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function un(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,M(e,j(this.registerPackage,this))}function hn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function dn(e){this.model=e}function mn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function fn(e){this.properties=new dn(this),this.factory=new nn(this,this.properties),this.registry=new un(e,this.properties),this.typeCache={}}ln.prototype.build=function(){return F(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ln.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},ln.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=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=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=pn(r[0],i),a=pn(r[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},ln.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ln.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},ln.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},ln.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},ln.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(M(i.properties,j(function(e){e=$({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:i});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(i),e[n]=i)},un.prototype.getPackage=function(e){return this.packageMap[e]},un.prototype.getPackages=function(){return this.packages},un.prototype.registerPackage=function(t){t=$({},t);var e=this.packageMap;hn(e,t,"prefix"),hn(e,t,"uri"),M(t.types,j(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},un.prototype.registerType=function(e,t){var i=pn((e=$({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:$(e.meta||{})})).name,t.prefix),n=i.name,r={};M(e.properties,j(function(e){var t=pn(e.name,i.prefix),n=t.name;sn(e.type)||(e.type=pn(e.type,t.prefix).name),$(e,{ns:t,name:n}),r[n]=e},this)),$(e,{ns:i,name:n,propertiesByName:r}),M(e.extends,j(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},un.prototype.mapTypes=function(i,r,e){var t=sn(i.name)?{name:i.name}:this.typeMap[i.name],o=this;function n(e){return a(e,!0)}function a(e,t){var n=pn(e,sn(e)?"":i.prefix);o.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+i.name+">");M(t.superClass,e?n:a),r(t,!e),M(t.traits,n)},un.prototype.getEffectiveDescriptor=function(e){var t=pn(e),n=new ln(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},un.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},dn.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:mn(e,i,n):e.$attrs[t]=n},dn.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&mn(e,n,[]),e[i]},dn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},dn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},dn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},fn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},fn.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},fn.prototype.createAny=function(e,t,n){var i=pn(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),M(n,function(e,t){P(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},fn.prototype.getPackage=function(e){return this.registry.getPackage(e)},fn.prototype.getPackages=function(){return this.registry.getPackages()},fn.prototype.getElementDescriptor=function(e){return e.$descriptor},fn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},fn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},fn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var yn=String.fromCharCode,vn=Object.prototype.hasOwnProperty,gn=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,bn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function xn(e,t,n,i){return i?vn.call(bn,i)?bn[i]:"&"+i+";":yn(t||parseInt(n,16))}function _n(e){return 3<e.length&&-1!==e.indexOf("&")?e.replace(gn,xn):e}Object.keys(bn).forEach(function(e){bn[e.toUpperCase()]=bn[e]});var En="http://www.w3.org/2001/XMLSchema-instance",wn="xsi",Sn="xsi:type",Cn="non-whitespace outside of root node";function Tn(e){return new Error(e)}function Rn(e){return"missing namespace for prefix <"+e+">"}function An(e){return{get:e,enumerable:!0}}function Pn(e){var t,n={};for(t in e)n[t]=e[t];return n}function kn(e){return e+"$uri"}function Mn(){return{line:0,column:0}}function Dn(e){throw e}function Nn(e){if(!this)return new Nn(e);var v,w,S,C,n,T,R,A,P,k=e&&e.proxy,i=Dn,M=Mn,D=!1,N=!1,t=null,B=!1;function O(e){e instanceof Error||(e=Tn(e)),i(t=e,M)}function L(e){n&&(e instanceof Error||(e=Tn(e)),n(e,M))}this.on=function(e,t){if("function"!=typeof t)throw Tn("required args <name, cb>");switch(e){case"openTag":w=t;break;case"text":v=t;break;case"closeTag":S=t;break;case"error":i=t;break;case"warn":n=t;break;case"cdata":C=t;break;case"attention":A=t;break;case"question":R=t;break;case"comment":T=t;break;default:throw Tn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Tn("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[En]=wn,N=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw Tn("required args <xml=string>");return t=null,function(a){var e,t,n,i,r,o,s,c,p,g,l=N?[]:null,b=N?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[kn(n)]=t;return i}(P):null,u=[],x=0,h=!1,d=!1,m=0,f=0,_="",E=0;function y(){if(null!==g)return g;var e,t,n,i,r,o,a,s,c,p,l,u=N&&b.xmlns,h=N&&D?[]:null,d=E,m=_,f=m.length,y={},v={};e:for(;d<f;d++)if(c=!1,!(32===(p=m.charCodeAt(d))||p<14&&8<p)){for((p<65||122<p||90<p&&p<97)&&95!==p&&58!==p&&(L("illegal first char attribute name"),c=!0),l=d+1;l<f;l++)if(!(96<(p=m.charCodeAt(l))&&p<123||64<p&&p<91||47<p&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&8<p){L("missing attribute value"),d=l;continue e}if(61===p)break;L("illegal attribute name char"),c=!0}if("xmlns:xmlns"===(s=m.substring(d,l))&&(L("illegal declaration of xmlns"),c=!0),34===(p=m.charCodeAt(l+1)))-1===(l=m.indexOf('"',d=l+2))&&-1!==(l=m.indexOf("'",d))&&(L("attribute value quote missmatch"),c=!0);else if(39===p)-1===(l=m.indexOf("'",d=l+2))&&-1!==(l=m.indexOf('"',d))&&(L("attribute value quote missmatch"),c=!0);else for(L("missing attribute value quotes"),c=!0,l+=1;l<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++);for(-1===l&&(L("missing closing quotes"),l=f,c=!0),c||(o=m.substring(d,l)),d=l;l+1<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++)d===l&&(L("illegal character after attribute end"),c=!0);if(d=l+1,!c)if(s in v)L("attribute <"+s+"> already defined");else if(v[s]=!0,N)if(D){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=_n(o),t=kn(r),!(a=P[e])){if("xmlns"===r||t in b&&b[t]!==e)for(;a="ns"+x++,void 0!==b[a];);else a=r;P[e]=a}b[r]!==a&&(i||(b=Pn(b),i=!0),b[r]=a,"xmlns"===r&&(b[kn(a)]=e,u=a),b[t]=e),y[s]=o;continue}h.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=b[s.substring(0,p)])?((s=u===n?s.substr(p+1):n+s.substr(p))===Sn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o),y[s]=o):L(Rn(s.substring(0,p))):y[s]=o;else y[s]=o}if(D)for(d=0,f=h.length;d<f;d++){if(s=h[d++],o=h[d],-1!==(p=s.indexOf(":"))){if(!(n=b[s.substring(0,p)])){L(Rn(s.substring(0,p)));continue}(s=u===n?s.substr(p+1):n+s.substr(p))===Sn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o)}y[s]=o}return g=y}M=function(){for(var e,t=/(\r\n|\r|\n)/g,n=0,i=0,r=0,o=f;r<=m&&(e=t.exec(a))&&(o=e[0].length+e.index,!(m<o));)n+=1,r=o;return{data:-1==m?(i=o,a.substring(f)):0===f?(console.log(m-r),a.substring(f,m)):(i=m-r,-1==f?a.substring(m):a.substring(m,f+1)),line:n,column:i}},k&&(p=Object.create({},{name:An(function(){return s}),originalName:An(function(){return c}),attrs:An(y),ns:An(function(){return b})}));for(;-1!==f;){if(-1===(m=60===a.charCodeAt(f)?f:a.indexOf("<",f)))return u.length?O("unexpected end of file"):0===f?O("missing start tag"):f<a.length&&a.substring(f).trim()&&L(Cn);if(f!==m)if(u.length){if(v&&(v(a.substring(f,m),_n,M),B))return}else if(a.substring(f,m).trim()&&(L(Cn),B))return;if(33!==(r=a.charCodeAt(m+1)))if(63!==r){if(-1==(f=a.indexOf(">",m+1)))return O("unclosed tag");if(g={},47===r){if(d=!(h=!1),!u.length)return O("missing open tag");if(t=s=u.pop(),i=m+2+t.length,a.substring(m+2,i)!==t)return O("closing tag mismatch");for(;i<f;i++)if(!(32===(r=a.charCodeAt(i))||8<r&&r<14))return O("close tag")}else{if(d=47===a.charCodeAt(f-1)?(t=s=a.substring(m+1,f-1),h=!0):(t=s=a.substring(m+1,f),!(h=!0)),!(96<r&&r<123||64<r&&r<91||95===r||58===r))return O("illegal first char nodeName");for(i=1,n=t.length;i<n;i++)if(!(96<(r=t.charCodeAt(i))&&r<123||64<r&&r<91||47<r&&r<59||45===r||95===r||46==r)){if(32===r||r<14&&8<r){s=t.substring(0,i),g=null;break}return O("invalid nodeName")}d||u.push(s)}if(N){if(e=b,h&&(d||l.push(e),null===g&&(D=-1!==t.indexOf("xmlns",i))&&(E=i,_=t,y(),D=!1)),-1!==(r=(c=s).indexOf(":"))){if(!(o=b[s.substring(0,r)]))return O("missing namespace on <"+c+">");s=s.substr(r+1)}else o=b.xmlns;o&&(s=o+":"+s)}if(h&&(E=i,_=t,w&&(k?w(p,_n,d,M):w(s,y,_n,d,M),B)))return;if(d){if(S&&(S(k?p:s,_n,h,M),B))return;N&&(b=h?e:l.pop())}f+=1}else{if(-1===(f=a.indexOf("?>",m)))return O("unclosed question");if(R&&(R(a.substring(m,f+2),M),B))return;f+=2}else{if(91===(r=a.charCodeAt(m+2))&&"CDATA["===a.substr(m+3,6)){if(-1===(f=a.indexOf("]]>",m)))return O("unclosed cdata");if(C&&(C(a.substring(m+9,f),M),B))return;f+=3;continue}if(45===r&&45===a.charCodeAt(m+3)){if(-1===(f=a.indexOf("--\x3e",m)))return O("unclosed comment");if(T&&(T(a.substring(m+4,f),_n,M),B))return;f+=3;continue}if(-1===(f=a.indexOf(">",m+1)))return O("unclosed tag");if(A&&(A(a.substring(m,f+1),_n,M),B))return;f+=1}}}(e),M=Mn,B=!1,t},this.stop=function(){B=!0}}function Bn(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var On={xsi:"http://www.w3.org/2001/XMLSchema-instance"},Ln="xsi:type";function In(e){return e.xml&&e.xml.serialize}function jn(e){return In(e)===Ln}function zn(e,t){return Bn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Fn(e){return new Error(e)}function $n(e){return e.$descriptor}function Hn(e){$(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Fn("expected element");var t,n=this.elementsById,i=$n(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw Fn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Wn(){}function Gn(){}function Vn(){}function Un(e,t){this.property=e,this.context=t}function qn(e,t){this.element=t,this.propertyDesc=e}function Kn(){}function Yn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Xn(e,t,n){Yn.call(this,e,t,n)}function Zn(e,t,n){this.model=e,this.context=n}function Qn(e){e instanceof fn&&(e={model:e}),$(this,{lax:!1},e)}Wn.prototype.handleEnd=function(){},Wn.prototype.handleText=function(){},Wn.prototype.handleNode=function(){},(Gn.prototype=Object.create(Wn.prototype)).handleNode=function(){return this},(Vn.prototype=Object.create(Wn.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Un.prototype=Object.create(Vn.prototype)).handleNode=function(e){if(this.element)throw Fn("expected no sub nodes");return this.element=this.createReference(e),this},Un.prototype.handleEnd=function(){this.element.id=this.body},Un.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(qn.prototype=Object.create(Vn.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=an(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Kn.prototype=Object.create(Vn.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},(Yn.prototype=Object.create(Kn.prototype)).addReference=function(e){this.context.addReference(e)},Yn.prototype.handleText=function(e){if(!$n(this.element).bodyProperty)throw Fn("unexpected body text <"+e+">");Vn.prototype.handleText.call(this,e)},Yn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=$n(t).bodyProperty;n&&void 0!==e&&(e=an(n.type,e),t.set(n.name,e))},Yn.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=$n(n),o=this.context,a=new n({}),s=this.model;return M(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?M(e.split(" "),function(e){o.addReference({element:a,property:n.ns.name,id:e})}):o.addReference({element:a,property:n.ns.name,id:e}):(n?e=an(n.type,e):"xmlns"!==t&&(i=pn(t,r.ns.prefix),s.getPackage(i.prefix)&&o.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},Yn.prototype.getPropertyForNode=function(e){var t,n,i,r,o,a,s,c,p,l,u=pn(e.name),h=this.type,d=this.model,m=$n(h),f=u.name,y=m.propertiesByName[f];if(y)return jn(y)&&(t=e.attributes[Ln])?(i=d,p=pn(t),l=i.getPackage(p.prefix),o=l,a=(r=p).name,s=r.localName,t=(c=o.xml&&o.xml.typePrefix)&&0===s.indexOf(c)?r.prefix+":"+s.slice(c.length):a,$({},y,{effectiveType:$n(n=d.getType(t)).name})):y;var v=d.getPackage(u.prefix);if(v){if(t=zn(u,v),n=d.getType(t),y=A(m.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return $({},y,{effectiveType:$n(n).name})}else if(y=A(m.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return y;throw Fn("unrecognized element <"+u.name+">")},Yn.prototype.toString=function(){return"ElementDescriptor["+$n(this.type).name+"]"},Yn.prototype.valueHandler=function(e,t){return new qn(e,t)},Yn.prototype.referenceHandler=function(e){return new Un(e,this.context)},Yn.prototype.handler=function(e){return"Element"===e?new Zn(this.model,e,this.context):new Yn(this.model,e,this.context)},Yn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,cn(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?($(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},(Xn.prototype=Object.create(Yn.prototype)).createElement=function(e){var t=e.name,n=pn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&zn(n,o)||t;if(!r.hasType(a))throw Fn("unexpected element <"+e.originalName+">");return Yn.prototype.createElement.call(this,e)},(Zn.prototype=Object.create(Kn.prototype)).createElement=function(e){var t=e.name,n=pn(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Zn.prototype.handleChild=function(e){var t=new Zn(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Zn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Qn.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof Yn?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t,o=this.model,a=this.lax,p=new Hn($({},e,{rootHandler:r})),s=new Nn({proxy:!0}),c=(t=[],Object.defineProperty(t,"peek",{value:function(){return this[this.length-1]}}),t);function l(e,t,n){var i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var s="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return p.addWarning({message:s,error:e}),!0;throw Fn(s)}function u(e,t){return l(e,t,!0)}r.context=p,c.push(r);var h=/^<\?xml /i,d=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function f(e,t){try{c.peek().handleText(e)}catch(e){u(e,t)}}var y=o.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(y).on("openTag",function(e,i,t,n){var r=e.attrs||{},o=Object.keys(r).reduce(function(e,t){var n=i(r[t]);return e[t]=n,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){l(e,t,a)&&c.push(new Gn)}}({name:e.name,originalName:e.originalName,attributes:o,ns:e.ns},n)}).on("question",function(e){if(h.test(e)){var t=d.exec(e),n=t&&t[1];n&&!m.test(n)&&p.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",f).on("text",function(e,t,n){var i,r;i=t(e),r=n,(i=i.trim())&&f(i,r)}).on("error",l).on("warn",u),setTimeout(function(){var t;try{s.parse(n),function(){var e,t,n=p.elementsById,i=p.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=$n(r).propertiesByName[t.property];if(o||p.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var s=r.get(a.name),c=s.indexOf(t);-1===c&&(c=s.length),o?s[c]=o:s.splice(c,1)}else r.set(a.name,o)}}()}catch(e){t=e}var e=r.element;t||e||(t=Fn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)},0)},Qn.prototype.handler=function(e){return new Xn(this.model,e)};var Jn=/<|>|'|"|&|\n\r|\n/g,ei=/<|>|&/g;function ti(t){var n={},i={},r={},o=[],a=[];this.byUri=function(e){return i[e]||t&&t.byUri(e)},this.add=function(e,t){i[e.uri]=e,t?o.push(e):a.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(o,a).filter(function(e){return r[e.uri]})}}function ni(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ii(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function ri(e,t){return t.isGeneric?$({localName:t.ns.localName},e):$({localName:(n=t.ns.localName,i=t.$pkg,Bn(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var oi={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ai={"<":"lt",">":"gt","&":"amp"};function si(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function ci(e){this.tagName=e}function pi(){}function li(e){this.tagName=e}function ui(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function hi(e,t){ui.call(this,e,t)}function di(){this.value="",this.write=function(e){this.value+=e}}function mi(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function fi(r){return r=$({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new di,i=new mi(n,r.format);if(r.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new ui).build(e).serializeTo(i),!t)return n.value}}}function yi(e,t){fn.call(this,e,t)}ci.prototype.build=function(e){return this.element=e,this},ci.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},pi.prototype.serializeValue=pi.prototype.serializeTo=function(e){e.append(this.escape?si(this.value,ei,ai):this.value)},pi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ei)&&(this.escape=!0),this},ni(li,pi),li.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},ui.prototype.build=function(e){var t,n,i,r=(this.element=e).$descriptor,o=this.propertyDescriptor,a=r.isGeneric;return t=a?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=o?this.nsPropertyTagName(o):this.nsTagName(r),this.tagName=this.addTagName(this.ns),a||(n=k((i=e).$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!i.hasOwnProperty(t))return!1;var n=i[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)}),this.parseAttributes(k(n,function(e){return e.isAttr})),this.parseContainments(k(n,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,t),this},ui.prototype.nsTagName=function(e){return ri(this.logNamespaceUsed(e.ns),e)},ui.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,$({localName:e.ns.localName},t)},ui.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ui.prototype.nsAttributeName=function(e){var t;if(t=d(e)?pn(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}:$({localName:t.localName},n)},ui.prototype.parseGeneric=function(n){var i=this,r=this.body,o=[];return M(n,function(e,t){"$body"===t?r.push((new pi).build({type:"String"},e)):"$children"===t?M(e,function(e){r.push(new ui(i).build(e))}):0!==t.indexOf("$")&&i.parseNsAttribute(n,t,e)&&o.push({name:t,value:e})}),o},ui.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=pn(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},ui.prototype.parseNsAttributes=function(i,e){var r=this,t=i.$attrs,o=[];return M(t,function(e,t){var n=r.parseNsAttribute(i,t,e);n&&o.push(n)}),o},ui.prototype.parseGenericAttributes=function(n,e){var i=this;M(e,function(t){if(t.name!==Ln)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},ui.prototype.parseContainments=function(e){var o=this,a=this.body,s=this.element;M(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)a.push((new pi).build(n,e[0]));else if(cn(n.type))M(e,function(e){a.push(new li(o.addTagName(o.nsPropertyTagName(n))).build(n,e))});else if(t)M(e,function(e){a.push(new ci(o.addTagName(o.nsPropertyTagName(n))).build(e))});else{var i=jn(n),r="property"===In(n);M(e,function(e){var t;t=i?new hi(o,n):r?new ui(o,n):new ui(o),a.push(t.build(e))})}})},ui.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ti(t):n=t),n},ui.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(o,r),e},ui.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=On[s]||o&&(o.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},ui.prototype.parseAttributes=function(e){var i=this,r=this.element;M(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];M(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;i.addAttribute(i.nsAttributeName(e),t)})},ui.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ii(e)},ui.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=si(t,Jn,oi)),n.push({name:e,value:t})},ui.prototype.serializeAttributes=function(t){var e,n=this.attrs,i=this.namespaces;i&&(n=(e=i,b(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})).concat(n)),M(n,function(e){t.append(" ").append(ii(e.name)).append('="').append(e.value).append('"')})},ui.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==pi;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),M(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("</"+this.tagName+">")),t.appendNewLine()},ni(hi,ui),hi.prototype.parseNsAttributes=function(e){var t=ui.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Ln),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},hi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(yi.prototype=Object.create(fn.prototype)).fromXML=function(e,t,n,i){d(t)||(i=n,n=t,t="bpmn:Definitions"),u(n)&&(i=n,n={});var r=new Qn($({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)};yi.prototype.toXML=function(e,t,n){u(t)&&(n=t,t={});var i,r,o=new fi(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var vi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{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",type:"String",isAttr:!0}]},{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",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{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:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!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",type:"String",isBody:!0}]},{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",type:"String",isAttr:!0},{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",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!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"],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"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",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:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/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}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{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,isVirtual:!0,isMany:!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",type:"String",isAttr:!0,isId:!0},{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,isVirtual:!0,isMany:!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",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",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:[]}};function gi(e,t){return new yi($({},vi,e),t)}function bi(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var xi=new Pt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function _i(e,t){return e.$instanceOf(t)}function Ei(u,h){var d={},m=[];function f(t,n){return function(e){t(e,n)}}function i(e){d[e.id]=e}function o(t,e){try{var n=t.di&&function(e,t){if(e.gfx)throw new Error(h("already rendered {element}",{element:bi(e)}));return u.element(e,t)}(t,e);return i(t),n}catch(e){y(e.message,{element:t,error:e}),console.error(h("failed to import {element}",{element:bi(t)})),console.error(e)}}function y(e,t){u.error(e,t)}function v(e){var t=e.bpmnElement;t?t.di?y(h("multiple DI elements defined for {element}",{element:bi(t)}),{element:t}):(xi.bind(t,"di"),t.di=e):y(h("no bpmnElement referenced in {element}",{element:bi(e)}),{element:e})}function g(e){var t;v(t=e.plane),M(t.planeElement,n)}function n(e){v(e)}function b(){for(;m.length;)m.shift()()}function x(e,t){T(e,t),p(e.ioSpecification,t),E(e.artifacts,t),i(e)}function _(e,t){o(e,t)}function a(e,t){o(e,t)}function r(e,t){o(e,t)}function s(e,t){o(e,t)}function c(e,t){o(e,t)}function E(e,t){M(e,function(e){_i(e,"bpmn:Association")?m.push(function(){c(e,t)}):c(e,t)})}function p(e,t){e&&(M(e.dataInputs,f(r,t)),M(e.dataOutputs,f(s,t)))}function l(e,t){T(e,t),E(e.artifacts,t)}function w(e,t){o(e,t)}function S(t,i){m.push(function(){var n,e=o(t,i);t.childLaneSet&&C(t.childLaneSet,e||i),M((n=t).flowNodeRef,function(e){var t=e.get("lanes");t&&t.push(n)})})}function C(e,t){M(e.lanes,f(S,t))}function T(e,t){var n,r;n=e.flowElements,r=t,M(n,function(e){var t,n,i;_i(e,"bpmn:SequenceFlow")?m.push(function(){o(e,r)}):_i(e,"bpmn:BoundaryEvent")?m.unshift(function(){o(e,r)}):_i(e,"bpmn:FlowNode")?(i=o(t=e,n=r),_i(t,"bpmn:SubProcess")&&l(t,i||n),_i(t,"bpmn:Activity")&&p(t.ioSpecification,n),m.push(function(){M(t.dataInputAssociations,f(a,n)),M(t.dataOutputAssociations,f(a,n))})):_i(e,"bpmn:DataObject")||(_i(e,"bpmn:DataStoreReference")?w(e,r):_i(e,"bpmn:DataObjectReference")?w(e,r):y(h("unrecognized flowElement {element} in context {context}",{element:bi(e),context:r?bi(r.businessObject):"null"}),{element:e,context:r}))}),e.laneSets&&M(e.laneSets,f(C,t))}function R(e,t){var n=o(e,t),i=e.processRef;i&&x(i,n||t)}return{handleDeferred:b,handleDefinitions:function(e,t){var n=e.diagrams;if(t&&-1===n.indexOf(t))throw new Error(h("diagram not part of bpmn:Definitions"));if(!t&&n&&n.length&&(t=n[0]),!t)throw new Error(h("no diagram to display"));g(t);var i=t.plane;if(!i)throw new Error(h("no plane for {element}",{element:bi(t)}));var r=i.bpmnElement;if(!r){if(!(r=A(e.rootElements,function(e){return _i(e,"bpmn:Process")||_i(e,"bpmn:Collaboration")})))throw new Error(h("no process or collaboration to display"));y(h("correcting missing bpmnElement on {plane} to {rootElement}",{plane:bi(i),rootElement:bi(r)})),i.bpmnElement=r,v(i)}var o,a,s,c,p,l=(o=r,a=i,u.root(o,a));if(_i(r,"bpmn:Process"))x(r,l);else{if(!_i(r,"bpmn:Collaboration"))throw new Error(h("unsupported bpmnElement for {plane}: {rootElement}",{plane:bi(i),rootElement:bi(r)}));M((p=r).participants,f(R)),E(p.artifacts),m.push(function(){var e;M(p.messageFlows,f(_,e))}),s=e.rootElements,c=l,k(s,function(e){return!d[e.id]&&_i(e,"bpmn:Process")&&e.laneSets}).forEach(f(x,c))}b()},handleSubProcess:l,registerDi:v}}function wi(e,t){var n=Si(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Si(e){return e&&e.businessObject||e}function Ci(e){return!wi(e,"bpmn:CallActivity")&&(wi(e,"bpmn:SubProcess")?!!Si(e).di.isExpanded:!wi(e,"bpmn:Participant")||!!Si(e).processRef)}function Ti(e){return e&&!!Si(e).triggeredByEvent}function Ri(e,t){var n=Si(e),i=!1;return n.eventDefinitions&&M(n.eventDefinitions,function(e){wi(e,t)&&(i=!0)}),i}function Ai(t,i,r){return v(t.eventDefinitions,function(e){return e.$type===i&&(n=t,y(r,function(e,t){return n[t]==e}));var n})}function Pi(e){return e.businessObject.di}function ki(e){return e.businessObject}function Mi(e,t){return Pi(e).get("bioc:fill")||t||"white"}function Di(e,t){return Pi(e).get("bioc:stroke")||t||"black"}var Ni=new o;function Bi(e,t,r,l,s,a,n){it.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,o=Ni.next(),c={},p=r.computeStyle;function d(e,t){var n=$({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var o=Ne("marker");_e(t.element,n),ve(o,t.element),_e(o,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var a=de("defs",s._svg);a||(a=Ne("defs"),ve(s._svg,a)),ve(a,o),c[e]=o}function m(e){return e.replace(/[()\s,#]+/g,"_")}function f(e,t,n){var i=e+"-"+m(t)+"-"+m(n)+"-"+o;return c[i]||function(e,t,n,i){if("sequenceflow-end"===t){var r=Ne("path");_e(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),d(e,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var o=Ne("circle");_e(o,{cx:6,cy:6,r:3.5}),d(e,{element:o,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ne("path");_e(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),d(e,{element:a,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ne("path");_e(s,{d:"M 11 5 L 1 10 L 11 15"}),d(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var c=Ne("path");_e(c,{d:"M 1 5 L 11 10 L 1 15"}),d(e,{element:c,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=Ne("path");_e(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),d(e,{element:p,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var l=Ne("path");_e(l,{d:"M 6 4 L 10 16"}),d(e,{element:l,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){P(i)&&(r=i,i=0),i=i||0,"none"===(r=p(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Ne("circle");return _e(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),_e(s,r),ve(e,s),s}function v(e,t,n,i,r,o){P(r)&&(o=r,r=0),r=r||0,o=p(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Ne("rect");return _e(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),_e(a,o),ve(e,a),a}function g(e,t,n){var i=at(t,n=p(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return ve(e,i),i}function b(e,t,n){n=p(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=Ne("path");return _e(i,{d:t}),_e(i,n),ve(e,i),i}function i(e,t,n,i){return b(t,n,$({"data-marker":e},i))}function x(n){return function(e,t){return R[n](e,t)}}function _(e){return R[e]}function E(e,t){var n,i=ki(e),r="bpmn:IntermediateThrowEvent"===(n=i).$type||"bpmn:EndEvent"===n.$type;return Ai(i,"bpmn:MessageEventDefinition")?_("bpmn:MessageEventDefinition")(t,e,r):Ai(i,"bpmn:TimerEventDefinition")?_("bpmn:TimerEventDefinition")(t,e,r):Ai(i,"bpmn:ConditionalEventDefinition")?_("bpmn:ConditionalEventDefinition")(t,e):Ai(i,"bpmn:SignalEventDefinition")?_("bpmn:SignalEventDefinition")(t,e,r):Ai(i,"bpmn:CancelEventDefinition")&&Ai(i,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?_("bpmn:MultipleEventDefinition")(t,e,r):Ai(i,"bpmn:CancelEventDefinition")&&Ai(i,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?_("bpmn:ParallelMultipleEventDefinition")(t,e,r):Ai(i,"bpmn:EscalationEventDefinition")?_("bpmn:EscalationEventDefinition")(t,e,r):Ai(i,"bpmn:LinkEventDefinition")?_("bpmn:LinkEventDefinition")(t,e,r):Ai(i,"bpmn:ErrorEventDefinition")?_("bpmn:ErrorEventDefinition")(t,e,r):Ai(i,"bpmn:CancelEventDefinition")?_("bpmn:CancelEventDefinition")(t,e,r):Ai(i,"bpmn:CompensateEventDefinition")?_("bpmn:CompensateEventDefinition")(t,e,r):Ai(i,"bpmn:TerminateEventDefinition")?_("bpmn:TerminateEventDefinition")(t,e,r):null}function w(e,t,n){n=$({size:{width:100}},n);var i=a.createText(t||"",n);return Te(i).add("djs-label"),ve(e,i),i}function S(e,t,n){return w(e,ki(t).name,{box:t,align:n,padding:5,style:{fill:Di(t,h)}})}function C(e,t,n){qt(w(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Di(n,h)}}),0,-(-1*n.height),270)}function T(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var R=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=.95),y(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Mi(t,u),stroke:Di(t,h)};ki(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Mi(t,u),stroke:Di(t,h)});var i=_("bpmn:Event")(e,t,n);return E(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Di(t,h):Mi(t,u),stroke:n?Mi(t,u):Di(t,h)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Mi(t,u),stroke:Di(t,h)});b(e,l.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Di(t,h)});for(var i=0;i<12;i++){var r=l.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),o=t.width/2;b(e,r,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+o+")",stroke:Di(t,h)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:ConditionalEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Di(t,h)})},"bpmn:LinkEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:ErrorEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=b(e,l.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)});return Yt(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:SignalEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Di(t,h):"none",stroke:Di(t,h)})},"bpmn:MultipleEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Di(t,h):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)})},"bpmn:EndEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:4,fill:Mi(t,u),stroke:Di(t,h)});return E(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:Di(t,h),stroke:Di(t,h)})},"bpmn:IntermediateEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)});return y(e,t.width,t.height,3,{strokeWidth:1,fill:Mi(t,"none"),stroke:Di(t,h)}),E(t,e),n},"bpmn:IntermediateCatchEvent":x("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":x("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=.95),v(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Mi(t,u),stroke:Di(t,h)},i=_("bpmn:Activity")(e,t,n);return S(e,t,"center-middle"),A(e,t),i},"bpmn:ServiceTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Mi(t,u)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:UserTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ManualTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:SendTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Di(t,h),stroke:Mi(t,u)}),n},"bpmn:ReceiveTask":function(e,t){var n=ki(t),i=_("bpmn:Task")(e,t);return b(e,n.instantiate?(y(e,28,28,4.4,{strokeWidth:1}),l.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),i},"bpmn:ScriptTask":function(e,t){var n=_("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Di(t,h)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=_("bpmn:Task")(e,t);return _e(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Mi(t,"#aaaaaa"),stroke:Di(t,h)}),_e(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Di(t,h)}),n},"bpmn:SubProcess":function(e,t,n){n=$({fill:Mi(t,u),stroke:Di(t,h)},n);var i=_("bpmn:Activity")(e,t,n),r=Ci(t);return Ti(t)&&_e(i,{strokeDasharray:"1,2"}),S(e,t,r?"center-top":"center-middle"),r?A(e,t):A(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return _("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var n=_("bpmn:SubProcess")(e,t),i=r.style(["no-fill","no-events"],{stroke:Di(t,h)});return v(e,t.width,t.height,8,3,i),n},"bpmn:CallActivity":function(e,t){return _("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:.95,fill:Mi(t,u),stroke:Di(t,h)},i=_("bpmn:Lane")(e,t,n);Ci(t)?(g(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Di(t,h)}),C(e,ki(t).name,t)):w(e,ki(t).name,{box:t,align:"center-middle",style:{fill:Di(t,h)}});return!!ki(t).participantMultiplicity&&_("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=v(e,t.width,t.height,0,$({fill:Mi(t,u),fillOpacity:.35,stroke:Di(t,h)},n)),r=ki(t);"bpmn:Lane"===r.$type&&C(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return y(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Mi(t,u),stroke:Di(t,h)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=_("bpmn:Gateway")(e,t),i=l.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Pi(t).isMarkerVisible&&b(e,i,{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ComplexGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:ParallelGateway":function(e,t){var n=_("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Di(t,h),stroke:Di(t,h)}),n},"bpmn:EventBasedGateway":function(e,t){var n=ki(t),i=_("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Di(t,h)});var r,o,a=n.eventGatewayType,s=!!n.instantiate;if("Parallel"===a){var c=l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});_e(b(e,c),{strokeWidth:1,fill:"none"})}else if("Exclusive"===a){if(!s)_e(y(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Di(t,h)});r=l.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),o={strokeWidth:2,fill:Mi(t,"none"),stroke:Di(t,h)},b(e,r,o)}return i},"bpmn:Gateway":function(e,t){var n={fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)};return function(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map(function(e){return e.x+","+e.y}).join(" ");i=p(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=Ne("polygon");return _e(s,{points:a}),_e(s,i),ve(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=T(t),r=Mi(t,u),o=Di(t,h),a=b(e,i,{strokeLinejoin:"round",markerEnd:f("sequenceflow-end",r,o),stroke:Di(t,h)}),s=ki(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&_e(a,{markerStart:f("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&_e(a,{markerStart:f("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=ki(t),r=Mi(t,u),o=Di(t,h);return n=$({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Di(t,h)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=f("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=f("association-start",r,o)),g(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Mi(t,u),i=Di(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Mi(t,u),i=Di(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=ki(t),i=Pi(t),r=Mi(t,u),o=Di(t,h),a=b(e,T(t),{markerEnd:f("messageflow-end",r,o),markerStart:f("messageflow-start",r,o),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Di(t,h)});if(n.messageRef){var s=a.getPointAtLength(a.getTotalLength()/2),c=l.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:s.x,y:s.y}}),p={strokeWidth:1};"initiating"===i.messageVisibleKind?(p.fill="white",p.stroke="black"):(p.fill="#888",p.stroke="white"),b(e,c,p)}return a},"bpmn:DataObject":function(e,t){var n,i,r,o,a,s,c=b(e,l.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)}),p=ki(t);return s=(a=p).dataObjectRef,(a.isCollection||s&&s.isCollection)&&(n=e,r=((i=t).height-16)/i.height,o=l.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:.451,my:r}}),b(n,o,{strokeWidth:2})),c},"bpmn:DataObjectReference":x("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=_("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return b(e,l.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Mi(t,u),fillOpacity:.95,stroke:Di(t,h)})},"bpmn:BoundaryEvent":function(e,t){var n=ki(t).cancelActivity,i={strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=$({},i,{fillOpacity:1}),o=$({},i,{fill:"none"}),a=_("bpmn:Event")(e,t,r);return y(e,t.width,t.height,3,o),E(t,e),a},"bpmn:Group":function(e,t){var n=ki(t),i=Pi(t),r=v(e,t.width,t.height,10,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"}),o=n.categoryValueRef||{};if(o.value){var a=i.label?i.label.bounds:t;w(e,o.value,{box:a,style:{fill:Di(t,h)}})}return r},label:function(e,t){return n=e,r=ki(i=t),o={width:90,height:30,x:i.width/2+i.x,y:i.height/2+i.y},w(n,r.name,{box:o,fitBox:!0,style:$({},a.getExternalStyle(),{fill:Di(i,h)})});var n,i,r,o},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return b(e,l.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Di(t,h)}),w(e,ki(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Di(t,h)}}),n},ParticipantMultiplicityMarker:function(e,t){i("participant-multiplicity",e,l.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:1,fill:Mi(t,u),stroke:Di(t,h)})},SubProcessMarker:function(e,t){Kt(v(e,14,14,0,{strokeWidth:1,fill:Mi(t,u),stroke:Di(t,h)}),t.width/2-7.5,t.height-20),i("sub-process",e,l.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:Mi(t,u),stroke:Di(t,h)})},ParallelMarker:function(e,t,n){i("parallel",e,l.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:Mi(t,u),stroke:Di(t,h)})},SequentialMarker:function(e,t,n){i("sequential",e,l.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:Mi(t,u),stroke:Di(t,h)})},CompensationMarker:function(e,t,n){i("compensation",e,l.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:Mi(t,u),stroke:Di(t,h)})},LoopMarker:function(e,t,n){i("loop",e,l.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:Mi(t,u),stroke:Di(t,h),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){i("adhoc",e,l.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:Di(t,h),stroke:Di(t,h)})}};function A(t,n,e){var i,r=ki(n),o=e&&-1!==e.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},M(e,function(e){_(e)(t,n,i)}),r.isForCompensation&&_("CompensationMarker")(t,n,i),"bpmn:AdHocSubProcess"===r.$type&&_("AdhocMarker")(t,n,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&_("LoopMarker")(t,n,i),!1===s&&_("ParallelMarker")(t,n,i),!0===s&&_("SequentialMarker")(t,n,i))}this._drawPath=b}t(Bi,it),Bi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Bi.prototype.canRender=function(e){return wi(e,"bpmn:BaseElement")},Bi.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Bi.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Bi.prototype.getShapePath=function(e){return wi(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,rt([["M",n,i],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]])):wi(e,"bpmn:Activity")?(a=10,s=(o=e).x,c=o.y,p=o.width,l=o.height,rt([["M",s+a,c],["l",p-2*a,0],["a",a,a,0,0,1,a,a],["l",0,l-2*a],["a",a,a,0,0,1,-a,a],["l",2*a-p,0],["a",a,a,0,0,1,-a,-a],["l",0,2*a-l],["a",a,a,0,0,1,a,-a],["z"]])):wi(e,"bpmn:Gateway")?(h=(u=e).width/2,d=u.height/2,rt([["M",u.x+h,u.y],["l",h,d],["l",-h,d],["l",-h,-d],["z"]])):(f=(m=e).x,y=m.y,v=m.width,rt([["M",f,y],["l",v,0],["l",0,m.height],["l",-v,0],["z"]]));var t,n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v};var Oi=0,Li={width:150,height:50};function Ii(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function ji(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Ii(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return zi(e,o,r,i);o=Fi(o,i.width,t)}}function zi(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function Fi(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(1<i.length)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $i(e){this._config=$({},{size:Li,padding:Oi,style:{},align:"center-top"},e||{})}$i.prototype.createText=function(e,t){return this.layoutText(e,t).element},$i.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$i.prototype.layoutText=function(e,t){var n,i,r,o,a=$({},this._config.size,t.box),s=$({},this._config.style,t.style),c=(i=t.align||this._config.align,{horizontal:(r=i.split("-"))[0]||"center",vertical:r[1]||"top"}),p=P(n=void 0!==t.padding?t.padding:this._config.padding)?$({top:0,left:0,right:0,bottom:0},n):{top:n,left:n,right:n,bottom:n},l=t.fitBox||!1,u=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(s),h=e.split(/\r?\n/g),d=[],m=a.width-p.left-p.right,f=Ne("text");for(_e(f,{x:0,y:0}),_e(f,s),ve(((o=document.getElementById("helper-svg"))||(_e(o=Ne("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(o)),o),f);h.length;)d.push(ji(h,m,f));"middle"===c.vertical&&(p.top=p.bottom=0);var y=x(d,function(e,t,n){return e+(u||t.height)},0)+p.top+p.bottom,v=x(d,function(e,t,n){return t.width>e?t.width:e},0),g=p.top;"middle"===c.vertical&&(g+=(a.height-y)/2),g-=(u||d[0].height)/4;var b=Ne("text");return _e(b,s),M(d,function(e){var t;switch(g+=u||e.height,c.horizontal){case"left":t=p.left;break;case"right":t=(l?v:m)-p.right-e.width;break;default:t=Math.max(((l?v:m)-e.width)/2+p.left,0)}var n=Ne("tspan");_e(n,{x:t,y:g}),n.textContent=e.text,ve(b,n)}),Ae(f),{dimensions:{width:v,height:y},element:b}};function Hi(e){var i=$({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(i.fontSize,10)-1,r=$({},i,{fontSize:t},e&&e.externalStyle||{}),o=new $i({style:i});this.getExternalLabelBounds=function(e,t){var n=o.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,t){var n=o.getDimensions(t,{box:e,style:i,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(n.height))}},this.createText=function(e,t){return o.createText(e,t||{})},this.getDefaultStyle=function(){return i},this.getExternalStyle=function(){return r}}Hi.$inject=["config.textRenderer"];var Wi=/\{([^}]+)\}/g,Gi=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Vi={__init__:["bpmnRenderer"],bpmnRenderer:["type",Bi],textRenderer:["type",Hi],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 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},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,i,r=this.pathMap[e];i=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(Wi,function(e,t){return n=e,o=i=a,t.replace(Gi,function(e,t,n,i,r){t=t||i,o&&(t in o&&(o=o[t]),"function"==typeof o&&r&&(o=o()))}),o=(null==o||o==i?n:o)+"";var n,i,o})}}]};var Ui={translate:["value",function(e,n){return n=n||{},e.replace(/{([^}]+)}/g,function(e,t){return n[t]||"{"+t+"}"})}]},qi={width:90,height:20},Ki=15;function Yi(e){return wi(e,"bpmn:Event")||wi(e,"bpmn:Gateway")||wi(e,"bpmn:DataStoreReference")||wi(e,"bpmn:DataObjectReference")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")}function Xi(e){return Ji(e.label)}function Zi(e){var t,n,i,r,o=e.length/2-1,a=e[Math.floor(o)],s=e[Math.ceil(o+.01)],c=(n=(t=e).length/2-1,i=t[Math.floor(n)],r=t[Math.ceil(n+.01)],{x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),p=Math.atan((s.y-a.y)/(s.x-a.x)),l=c.x,u=c.y;return Math.abs(p)<Math.PI/2?u-=Ki:l+=Ki,{x:l,y:u}}function Qi(e){return e.waypoints?Zi(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+qi.height/2}}function Ji(e){return e&&e.labelTarget}function er(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function tr(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=er(e,t);return Math.abs(r/o)<=i}var nr=2;function ir(e,t){return Math.abs(e.x-t.x)<=nr?"h":Math.abs(e.y-t.y)<=nr&&"v"}function rr(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 or(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}
3
3
  /**
4
4
  * This file contains portions that got extraced from Snap.svg (licensed Apache-2.0).
5
5
  *
6
6
  * @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
7
- */var ar="hasOwnProperty",sr=/,?([a-z]),?/gi,cr=parseFloat,pr=Math,lr=pr.PI,ur=pr.min,hr=pr.max,dr=pr.pow,mr=pr.abs,fr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,yr=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function vr(e,t){return"finite"==(t=String.prototype.toLowerCase.call(t))?isFinite(e):!("array"!=t||!(e instanceof Array||Array.isArray&&Array.isArray(e)))||("null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||Object.prototype.toString.call(e).slice(8,-1).toLowerCase()==t)}function gr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[ar](n)&&(t[n]=gr(e[n]));return t}function br(t){var n=br.ps=br.ps||{};return n[t]?n[t].sleep=100:n[t]={sleep:100},setTimeout(function(){for(var e in n)n[ar](e)&&e!=t&&(n[e].sleep--,n[e].sleep||delete n[e])}),n[t]}function xr(e,t,n,i){return null==e&&(e=t=n=i=0),null==t&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,w:n,height:i,h:i,x2:e+n,y2:t+i,cx:e+n/2,cy:t+i/2,r1:pr.min(n,i)/2,r2:pr.max(n,i)/2,r0:pr.sqrt(n*n+i*i)/2,path:function(e,t,n,i,r){if(r)return[["M",+e+ +r,t],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var o=[["M",e,t],["l",n,0],["l",0,i],["l",-n,0],["z"]];return o.toString=_r,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function _r(){return this.join(",").replace(sr,"$1")}function Er(e){var t=gr(e);return t.toString=_r,t}function wr(e,t,n,i,r,o,a,s,c){var p=1-c,l=dr(p,3),u=dr(p,2),h=c*c,d=h*c,m=e+2*c*(n-e)+h*(r-2*n+e),f=t+2*c*(i-t)+h*(o-2*i+t),y=n+2*c*(r-n)+h*(a-2*r+n),v=i+2*c*(o-i)+h*(s-2*o+i);return{x:l*e+3*u*c*n+3*p*c*c*r+d*a,y:l*t+3*u*c*i+3*p*c*c*o+d*s,m:{x:m,y:f},n:{x:y,y:v},start:{x:p*e+c*n,y:p*t+c*i},end:{x:p*r+c*a,y:p*o+c*s},alpha:90-180*pr.atan2(m-y,f-v)/lr}}function Sr(e,t,n,i,r,o,a,s){vr(e,"array")||(e=[e,t,n,i,r,o,a,s]);var c=function(e,t,n,i,r,o,a,s){for(var c,p,l,u,h,d,m,f,y=[],v=[[],[]],g=0;g<2;++g)if(l=0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,3*i-3*t),mr(c)<1e-12){if(mr(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=pr.sqrt(m),m<0||(0<(h=(-p+f)/(2*c))&&h<1&&y.push(h),0<(d=(-p-f)/(2*c))&&d<1&&y.push(d));var b,x=y.length,_=x;for(;x--;)u=y[x],b=1-u,v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*r+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*i+3*b*u*u*o+u*u*u*s;return v[0][_]=e,v[1][_]=t,v[0][_+1]=a,v[1][_+1]=s,v[0].length=v[1].length=_+2,{min:{x:ur.apply(0,v[0]),y:ur.apply(0,v[1])},max:{x:hr.apply(0,v[0]),y:hr.apply(0,v[1])}}}.apply(null,e);return xr(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function Cr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Tr(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function Rr(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=1<c?1:c<0?0:c)/2,l=[-.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],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=Tr(m,e,n,r,a),y=Tr(m,t,i,o,s),v=f*f+y*y;h+=u[d]*pr.sqrt(v)}return p*h}function Ar(e,t,n,i,r,o,a,s){if(!(hr(e,n)<ur(r,a)||ur(e,n)>hr(r,a)||hr(t,i)<ur(o,s)||ur(t,i)>hr(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+ur(e,n).toFixed(2)||u>+hr(e,n).toFixed(2)||u<+ur(r,a).toFixed(2)||u>+hr(r,a).toFixed(2)||h<+ur(t,i).toFixed(2)||h>+hr(t,i).toFixed(2)||h<+ur(o,s).toFixed(2)||h>+hr(o,s).toFixed(2)))return{x:p,y:l}}}}function Pr(e,t,n){if(!function(e,t){return e=xr(e),Cr(t=xr(t),e.x,e.y)||Cr(t,e.x2,e.y)||Cr(t,e.x,e.y2)||Cr(t,e.x2,e.y2)||Cr(e,t.x,t.y)||Cr(e,t.x2,t.y)||Cr(e,t.x,t.y2)||Cr(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)}(Sr(e),Sr(t)))return n?0:[];for(var i=~~(Rr.apply(0,e)/5),r=~~(Rr.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<1+i;p++){var l=wr.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<1+r;p++)l=wr.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],m=a[u],f=a[u+1],y=mr(d.x-h.x)<.01?"y":"x",v=mr(f.x-m.x)<.01?"y":"x",g=Ar(h.x,h.y,d.x,d.y,m.x,m.y,f.x,f.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+mr((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=m.t+mr((g[v]-m[v])/(f[v]-m[v]))*(f.t-m.t);0<=b&&b<=1&&0<=x&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function kr(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(180<r-i),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=_r,c}function Mr(e){var t=br(e);if(t.abs)return Er(t.abs);if(vr(e,"array")&&vr(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=br(e);if(t.arr)return gr(t.arr);var o={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},a=[];return vr(e,"array")&&vr(e[0],"array")&&(a=gr(e)),a.length||String(e).replace(fr,function(e,t,n){var i=[],r=t.toLowerCase();if(n.replace(yr,function(e,t){t&&i.push(+t)}),"m"==r&&2<i.length&&(a.push([t].concat(i.splice(0,2))),r="l",t="m"==t?"l":"L"),"o"==r&&1==i.length&&a.push([t,i[0]]),"r"==r)a.push([t].concat(i));else for(;i.length>=o[r]&&(a.push([t].concat(i.splice(0,o[r]))),o[r]););}),a.toString=br.toString,t.arr=gr(a),a}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var m=[r,o].concat(l.slice(1)),f=2,y=m.length;f<y;f++)m[f]=+m[f]+r,m[++f]=+m[f]+o;i.pop(),i=i.concat(Or(m,u));break;case"O":i.pop(),(m=kr(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(kr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(f=1,y=l.length;f<y;f++)p[f]=+l[f]+(f%2?r:o)}else if("R"==n)m=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(Or(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=kr(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(kr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];if("O"!=(n=n.toUpperCase()))switch(p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=_r,t.abs=Er(i),i}function Dr(e,t,n,i){return[e,t,n,i,n,i]}function Nr(e,t,n,i,r,o){return[1/3*e+2/3*n,1/3*t+2/3*i,1/3*r+2/3*n,1/3*o+2/3*i,r,o]}function Br(e,t,n,i,r,o,a,s,c,p){var l,u=120*lr/180,h=lr/180*(+r||0),d=[],m=function(o,a,s){return function e(){var t=Array.prototype.slice.call(arguments,0),n=t.join("␀"),i=e.cache=e.cache||{},r=e.count=e.count||[];return i[ar](n)?function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n):(1e3<=r.length&&delete i[r.shift()],r.push(n),i[n]=o.apply(a,t)),s?s(i[n]):i[n]}}(function(e,t,n){return{x:e*pr.cos(n)-t*pr.sin(n),y:e*pr.sin(n)+t*pr.cos(n)}});if(p)w=p[0],S=p[1],_=p[2],E=p[3];else{e=(l=m(e,t,-h)).x,t=l.y;var f=(e-(s=(l=m(s,c,-h)).x))/2,y=(t-(c=l.y))/2,v=f*f/(n*n)+y*y/(i*i);1<v&&(n*=v=pr.sqrt(v),i*=v);var g=n*n,b=i*i,x=(o==a?-1:1)*pr.sqrt(mr((g*b-g*y*y-b*f*f)/(g*y*y+b*f*f))),_=x*n*y/i+(e+s)/2,E=x*-i*f/n+(t+c)/2,w=pr.asin(((t-E)/i).toFixed(9)),S=pr.asin(((c-E)/i).toFixed(9));(w=e<_?lr-w:w)<0&&(w=2*lr+w),(S=s<_?lr-S:S)<0&&(S=2*lr+S),a&&S<w&&(w-=2*lr),!a&&w<S&&(S-=2*lr)}var C=S-w;if(mr(C)>u){var T=S,R=s,A=c;S=w+u*(a&&w<S?1:-1),d=Br(s=_+n*pr.cos(S),c=E+i*pr.sin(S),n,i,r,0,a,R,A,[S,T,_,E])}C=S-w;var P=pr.cos(w),k=pr.sin(w),M=pr.cos(S),D=pr.sin(S),N=pr.tan(C/4),B=4/3*n*N,O=4/3*i*N,L=[e,t],I=[e+B*k,t-O*P],j=[s+B*D,c-O*M],z=[s,c];if(I[0]=2*L[0]-I[0],I[1]=2*L[1]-I[1],p)return[I,j,z].concat(d);for(var F=[],$=0,H=(d=[I,j,z].concat(d).join().split(",")).length;$<H;$++)F[$]=$%2?m(d[$-1],d[$],h).y:m(d[$],d[$+1],h).x;return F}function Or(e,t){for(var n=[],i=0,r=e.length;i<r-2*!t;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function Lr(e,t){var n=!t&&br(e);if(!t&&n.curve)return Er(n.curve);for(var o=Mr(e),a=t&&Mr(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;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(Br.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":r="C"==n||"S"==n?(i=2*t.x-t.bx,2*t.y-t.by):(i=t.x,t.y),e=["C",i,r].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(Nr(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(Nr(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(Dr(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(Dr(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(Dr(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(Dr(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(7<e[t].length){e[t].shift();for(var n=e[t];n.length;)l[t]="A",a&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=hr(o.length,a&&a.length||0)}},p=function(e,t,n,i,r){e&&t&&"M"==e[r][0]&&"M"!=t[r][0]&&(t.splice(r,0,["M",i.x,i.y]),n.bx=0,n.by=0,n.x=e[r][1],n.y=e[r][2],f=hr(o.length,a&&a.length||0))},l=[],u=[],h="",d="",m=0,f=hr(o.length,a&&a.length||0);m<f;m++){o[m]&&(h=o[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),o[m]=s(o[m],i,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(o,m),a&&(a[m]&&(h=a[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),a[m]=s(a[m],r,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(a,m)),p(o,a,i,r,m),p(a,o,r,i,m);var y=o[m],v=a&&a[m],g=y.length,b=a&&v.length;i.x=y[g-2],i.y=y[g-1],i.bx=cr(y[g-4])||i.x,i.by=cr(y[g-3])||i.y,r.bx=a&&(cr(v[b-4])||r.x),r.by=a&&(cr(v[b-3])||r.y),r.x=a&&v[b-2],r.y=a&&v[b-1]}return a||(n.curve=Er(o)),a?[o,a]:o}var Ir=function(e,t,n){e=Lr(e),t=Lr(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])i=s=y[1],r=c=y[2];else{r="C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],u[7]):(u=[i,r,i,r,s,c,s,c],i=s,c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{a="C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],h[7]):(h=[o,a,o,a,p,l,p,l],o=p,l);var x=Pr(u,h,n);if(n)d+=x;else{for(var _=0,E=x.length;_<E;_++)x[_].segment1=m,x[_].segment2=v,x[_].bez1=u,x[_].bez2=h;d=d.concat(x)}}}}}return d};function jr(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function zr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Fr(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function $r(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Hr(e){return zr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Wr(e,t,n){P(n=n||0)||(n={x:n,y:n});var i=Fr(e),r=Fr(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"}function Gr(e,t,n){var i=function(e,t){return Ir(e,t)}(e,t);return 1===i.length?zr(i[0]):2===i.length&&er(i[0],i[1])<1?zr(i[0]):1<i.length?zr((i=M(i,function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t}))[n?0:i.length-1]):null}function Vr(e,t){return F({id:e.id,type:e.$type,businessObject:e},t)}function Ur(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:bi(n),referenced:bi(t),property:i}))}function qr(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}qr.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],qr.prototype.add=function(e,t){var n,i,r,o=e.di,a=this._translate;if(wi(o,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Vr(e)),this._canvas.setRootElement(n);else if(wi(o,"bpmndi:BPMNShape")){var s=!Ci(e);i=t&&(t.hidden||t.collapsed);var c=e.di.bounds;n=this._elementFactory.createShape(Vr(e,{collapsed:s,hidden:i,x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height)})),wi(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),wi(e,"bpmn:Lane")&&(r=0),wi(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}(t,Hr(c))||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!wi(o,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:bi(o),semantic:bi(e)}));var p=this._getSource(e),l=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Vr(e,{hidden:i,source:p,target:l,waypoints:function(e,t,n){var i=e.di.waypoint;return!i||i.length<2?[Hr(t),Hr(n)]:i.map(function(e){return{x:e.x,y:e.y}})}(e,p,l)})),wi(e,"bpmn:DataAssociation")&&(t=null),wi(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return Yi(e)&&e.name&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},qr.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:bi(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ur(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},qr.prototype.addLabel=function(e,t){var n,i,r;return n=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(qi.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Qi(t),i=qi),F({x:n.x-i.width/2,y:n.y-i.height/2},i)}(e,t),(i=e.name)&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(Vr(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!e.name,x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},qr.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Ur(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:bi(e),side:t}))},qr.prototype._getSource=function(e){return this._getEnd(e,"source")},qr.prototype._getTarget=function(e){return this._getEnd(e,"target")},qr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Kr={__depends__:[Vi,{__depends__:[Ui],bpmnImporter:["type",qr]}]};function Yr(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Xr(e){return e.originalEvent||e.srcEvent}function Zr(e,t){Yr(e),Yr(Xr(e))}function Qr(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 Jr(e){return!(Xr(e)||e).button}function eo(e){var t=Xr(e)||e;return!!Jr(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function to(e){return!0}function no(o,a,e){var r=e.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function s(e,t,n){var i,r;!function(e,t){return!(u[e]||Jr)(t)}(e,t)&&(n?r=a.getGraphics(n):(i=t.delegateTarget||t.target)&&(r=i,n=a.get(r)),r&&n&&!1===o.fire(e,{element:n,gfx:r,originalEvent:t})&&(t.stopPropagation(),t.preventDefault()))}var c={};function p(e){return c[e]}var l={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":to};var h="svg, .djs-element";function i(e,t,n,i){var r=c[n]=function(e){s(n,e)};i&&(u[n]=i),r.$delegate=ae.bind(e,h,t,r)}function d(e,t,n){var i=p(n);i&&ae.unbind(e,t,i.$delegate)}o.on("canvas.destroy",function(e){!function(n){k(l,function(e,t){d(n,t,e)})}(e.svg)}),o.on("canvas.init",function(e){!function(n){k(l,function(e,t){i(n,t,e)})}(e.svg)}),o.on(["shape.added","connection.added"],function(e){var t,n=e.element,i=e.gfx;n.waypoints?t=at(n.waypoints):_e(t=Ne("rect"),{x:0,y:0,width:n.width,height:n.height}),_e(t,r),ve(i,t)}),o.on("shape.changed",500,function(e){var t=e.element;_e(de(".djs-hit",e.gfx),{width:t.width,height:t.height})}),o.on("connection.changed",function(e){var t=e.element;!function(e,t){_e(e,{points:ot(t)})}(de(".djs-hit",e.gfx),t.waypoints)}),this.fire=s,this.triggerMouseEvent=function(e,t,n){var i=l[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return s(i,t,n)},this.mouseHandler=p,this.registerEvent=i,this.unregisterEvent=d}no.$inject=["eventBus","elementRegistry","styles"];var io={__init__:["interactionEvents"],interactionEvents:["type",no]};function ro(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Ne("rect");return _e(n,F({x:10,y:10,width:100,height:100},i)),ve(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,i=de(".djs-outline",n);i||(i=o(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=de(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}ro.prototype.updateShapeOutline=function(e,t){_e(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ro.prototype.updateConnectionOutline=function(e,t){var n=ft(t);_e(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ro.$inject=["eventBus","styles","elementRegistry"];var oo={__init__:["outline"],outline:["type",ro]};function ao(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}ao.$inject=["eventBus"],ao.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},ao.prototype.get=function(){return this._selectedElements},ao.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},ao.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();g(e)||(e=e?[e]:[]),t?k(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var so="selected";function co(e,n,t,i){function r(e,t){n.addMarker(e,t)}function o(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){o(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;k(t,function(e){-1===n.indexOf(e)&&function(e){o(e,so)}(e)}),k(n,function(e){-1===t.indexOf(e)&&function(e){r(e,so)}(e)})})}function po(e,o,a,i){e.on("create.end",500,function(e){e.context.canExecute&&o.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&o.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=i.get(e.context.shape.id);R(t,function(e){return n.id===e.id})||o.select(n)}),e.on("element.click",function(e){var t=e.element;t===a.getRootElement()&&(t=null);var n=o.isSelected(t),i=1<o.get().length,r=eo(e);if(n&&i)return r?o.deselect(t):o.select(t);n?o.deselect(t):o.select(t,r)})}co.$inject=["eventBus","canvas","selection","styles"],po.$inject=["eventBus","selection","canvas","elementRegistry"];var lo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[io,oo],selection:["type",ao],selectionVisuals:["type",co],selectionBehavior:["type",po]};function uo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}uo.prototype.next=function(){return this._prefix+ ++this._counter};var ho=new uo("ov");function mo(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=ho,this._overlayDefaults=F({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=function(e){var t=se('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />');return e.insertBefore(t,e.firstChild),t}(n.getContainer()),this._init()}function fo(e,t,n){F(e.style,{left:t+"px",top:n+"px"})}function yo(e,t){e.style.display=!1===t?"none":""}function vo(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}mo.$inject=["config.overlays","eventBus","canvas","elementRegistry"],mo.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?A(t.overlays,D({type:e.type})):t.overlays.slice():[]}return e.type?A(this._overlays,D({type:e.type})):e.id?this._overlays[e.id]:null},mo.prototype.add=function(e,t,n){if(P(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 i=this._ids.next();return n=F({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},mo.prototype.remove=function(e){var t=this.get(e)||[];g(t)||(t=[t]);var i=this;k(t,function(e){var t=i._getOverlayContainer(e.element,!0);if(e&&(fe(e.html),fe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete i._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},mo.prototype.show=function(){yo(this._overlayRoot)},mo.prototype.hide=function(){yo(this._overlayRoot,!1)},mo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Y(this._overlayRoot)},mo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ft(t);i=o.x,r=o.y}fo(n,i,r),H(e.html,"data-container-id",t.id)},mo.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?ft(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?ft(o).height:o.height,s=-1*i.bottom+n);fo(r,a||0,s||0)},mo.prototype._createOverlayContainer=function(e){var t=se('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},mo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";vo(this._overlayRoot,n)},mo.prototype._getOverlayContainer=function(t,e){var n=R(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},mo.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),d(o)&&(o=se(o)),n=this._getOverlayContainer(r),(t=se('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&q(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((c(i)&&i>t.scale||c(r)&&r<t.scale)&&(a=!1),yo(o,a)),this._updateOverlayScale(e,t)},mo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(i=!1===o?n=1:(n=o.min,o.max),c(n)&&t.scale<n&&(r=(1/t.scale||1)*n),c(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),c(r)&&(s="scale("+r+","+r+")"),vo(a,s)},mo.prototype._updateOverlaysVisibilty=function(t){var n=this;k(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},mo.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){!function(e){r._updateRoot(e),r._updateOverlaysVisibilty(e),r.show()}(e.viewbox)}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;k(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){fe(n.html);var i=r._overlayContainers.indexOf(n);-1!==i&&r._overlayContainers.splice(i,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(k(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&q(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var go={__init__:["overlays"],overlays:["type",mo]},bo='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';
7
+ */var ar="hasOwnProperty",sr=/,?([a-z]),?/gi,cr=parseFloat,pr=Math,lr=pr.PI,ur=pr.min,hr=pr.max,dr=pr.pow,mr=pr.abs,fr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,yr=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function vr(e,t){return"finite"==(t=String.prototype.toLowerCase.call(t))?isFinite(e):!("array"!=t||!(e instanceof Array||Array.isArray&&Array.isArray(e)))||("null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||Object.prototype.toString.call(e).slice(8,-1).toLowerCase()==t)}function gr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[ar](n)&&(t[n]=gr(e[n]));return t}function br(t){var n=br.ps=br.ps||{};return n[t]?n[t].sleep=100:n[t]={sleep:100},setTimeout(function(){for(var e in n)n[ar](e)&&e!=t&&(n[e].sleep--,!n[e].sleep&&delete n[e])}),n[t]}function xr(e,t,n,i){return null==e&&(e=t=n=i=0),null==t&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,w:n,height:i,h:i,x2:e+n,y2:t+i,cx:e+n/2,cy:t+i/2,r1:pr.min(n,i)/2,r2:pr.max(n,i)/2,r0:pr.sqrt(n*n+i*i)/2,path:function(e,t,n,i,r){if(r)return[["M",+e+ +r,t],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var o=[["M",e,t],["l",n,0],["l",0,i],["l",-n,0],["z"]];return o.toString=_r,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function _r(){return this.join(",").replace(sr,"$1")}function Er(e){var t=gr(e);return t.toString=_r,t}function wr(e,t,n,i,r,o,a,s,c){var p=1-c,l=dr(p,3),u=dr(p,2),h=c*c,d=h*c,m=e+2*c*(n-e)+h*(r-2*n+e),f=t+2*c*(i-t)+h*(o-2*i+t),y=n+2*c*(r-n)+h*(a-2*r+n),v=i+2*c*(o-i)+h*(s-2*o+i);return{x:l*e+3*u*c*n+3*p*c*c*r+d*a,y:l*t+3*u*c*i+3*p*c*c*o+d*s,m:{x:m,y:f},n:{x:y,y:v},start:{x:p*e+c*n,y:p*t+c*i},end:{x:p*r+c*a,y:p*o+c*s},alpha:90-180*pr.atan2(m-y,f-v)/lr}}function Sr(e,t,n,i,r,o,a,s){vr(e,"array")||(e=[e,t,n,i,r,o,a,s]);var c=function(e,t,n,i,r,o,a,s){for(var c,p,l,u,h,d,m,f,y=[],v=[[],[]],g=0;g<2;++g)if(l=0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,3*i-3*t),mr(c)<1e-12){if(mr(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=pr.sqrt(m),m<0||(0<(h=(-p+f)/(2*c))&&h<1&&y.push(h),0<(d=(-p-f)/(2*c))&&d<1&&y.push(d));var b,x=y.length,_=x;for(;x--;)u=y[x],b=1-u,v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*r+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*i+3*b*u*u*o+u*u*u*s;return v[0][_]=e,v[1][_]=t,v[0][_+1]=a,v[1][_+1]=s,v[0].length=v[1].length=_+2,{min:{x:ur.apply(0,v[0]),y:ur.apply(0,v[1])},max:{x:hr.apply(0,v[0]),y:hr.apply(0,v[1])}}}.apply(null,e);return xr(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function Cr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Tr(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function Rr(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=1<c?1:c<0?0:c)/2,l=[-.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],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=Tr(m,e,n,r,a),y=Tr(m,t,i,o,s),v=f*f+y*y;h+=u[d]*pr.sqrt(v)}return p*h}function Ar(e,t,n,i,r,o,a,s){if(!(hr(e,n)<ur(r,a)||ur(e,n)>hr(r,a)||hr(t,i)<ur(o,s)||ur(t,i)>hr(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+ur(e,n).toFixed(2)||u>+hr(e,n).toFixed(2)||u<+ur(r,a).toFixed(2)||u>+hr(r,a).toFixed(2)||h<+ur(t,i).toFixed(2)||h>+hr(t,i).toFixed(2)||h<+ur(o,s).toFixed(2)||h>+hr(o,s).toFixed(2)))return{x:p,y:l}}}}function Pr(e,t,n){var i,r,o=Sr(e),a=Sr(t);if(r=a,i=xr(i=o),!(Cr(r=xr(r),i.x,i.y)||Cr(r,i.x2,i.y)||Cr(r,i.x,i.y2)||Cr(r,i.x2,i.y2)||Cr(i,r.x,r.y)||Cr(i,r.x2,r.y)||Cr(i,r.x,r.y2)||Cr(i,r.x2,r.y2)||(i.x<r.x2&&i.x>r.x||r.x<i.x2&&r.x>i.x)&&(i.y<r.y2&&i.y>r.y||r.y<i.y2&&r.y>i.y)))return n?0:[];for(var s=~~(Rr.apply(0,e)/5),c=~~(Rr.apply(0,t)/5),p=[],l=[],u={},h=n?0:[],d=0;d<s+1;d++){var m=wr.apply(0,e.concat(d/s));p.push({x:m.x,y:m.y,t:d/s})}for(d=0;d<c+1;d++)m=wr.apply(0,t.concat(d/c)),l.push({x:m.x,y:m.y,t:d/c});for(d=0;d<s;d++)for(var f=0;f<c;f++){var y=p[d],v=p[d+1],g=l[f],b=l[f+1],x=mr(v.x-y.x)<.01?"y":"x",_=mr(b.x-g.x)<.01?"y":"x",E=Ar(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y);if(E){if(u[E.x.toFixed(0)]==E.y.toFixed(0))continue;u[E.x.toFixed(0)]=E.y.toFixed(0);var w=y.t+mr((E[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),S=g.t+mr((E[_]-g[_])/(b[_]-g[_]))*(b.t-g.t);0<=w&&w<=1&&0<=S&&S<=1&&(n?h++:h.push({x:E.x,y:E.y,t1:w,t2:S}))}}return h}function kr(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(180<r-i),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=_r,c}function Mr(e){var t=br(e);if(t.abs)return Er(t.abs);if(vr(e,"array")&&vr(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=br(e);if(t.arr)return gr(t.arr);var o={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},a=[];return vr(e,"array")&&vr(e[0],"array")&&(a=gr(e)),a.length||String(e).replace(fr,function(e,t,n){var i=[],r=t.toLowerCase();if(n.replace(yr,function(e,t){t&&i.push(+t)}),"m"==r&&2<i.length&&(a.push([t].concat(i.splice(0,2))),r="l",t="m"==t?"l":"L"),"o"==r&&1==i.length&&a.push([t,i[0]]),"r"==r)a.push([t].concat(i));else for(;i.length>=o[r]&&(a.push([t].concat(i.splice(0,o[r]))),o[r]););}),a.toString=br.toString,t.arr=gr(a),a}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var m=[r,o].concat(l.slice(1)),f=2,y=m.length;f<y;f++)m[f]=+m[f]+r,m[++f]=+m[f]+o;i.pop(),i=i.concat(Or(m,u));break;case"O":i.pop(),(m=kr(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(kr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(f=1,y=l.length;f<y;f++)p[f]=+l[f]+(f%2?r:o)}else if("R"==n)m=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(Or(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=kr(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(kr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];if("O"!=(n=n.toUpperCase()))switch(p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=_r,t.abs=Er(i),i}function Dr(e,t,n,i){return[e,t,n,i,n,i]}function Nr(e,t,n,i,r,o){return[1/3*e+2/3*n,1/3*t+2/3*i,1/3*r+2/3*n,1/3*o+2/3*i,r,o]}function Br(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*lr/180,f=lr/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*pr.cos(n)-t*pr.sin(n),y:e*pr.sin(n)+t*pr.cos(n)}},function e(){var t=Array.prototype.slice.call(arguments,0),n=t.join("␀"),i=e.cache=e.cache||{},r=e.count=e.count||[];return i[ar](n)?function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n):(1e3<=r.length&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t)),d?d(i[n]):i[n]});if(p)T=p[0],R=p[1],S=p[2],C=p[3];else{e=(l=v(e,t,-f)).x,t=l.y;var g=(e-(s=(l=v(s,c,-f)).x))/2,b=(t-(c=l.y))/2,x=g*g/(n*n)+b*b/(i*i);1<x&&(n*=x=pr.sqrt(x),i*=x);var _=n*n,E=i*i,w=(o==a?-1:1)*pr.sqrt(mr((_*E-_*b*b-E*g*g)/(_*b*b+E*g*g))),S=w*n*b/i+(e+s)/2,C=w*-i*g/n+(t+c)/2,T=pr.asin(((t-C)/i).toFixed(9)),R=pr.asin(((c-C)/i).toFixed(9));(T=e<S?lr-T:T)<0&&(T=2*lr+T),(R=s<S?lr-R:R)<0&&(R=2*lr+R),a&&R<T&&(T-=2*lr),!a&&T<R&&(R-=2*lr)}var A=R-T;if(mr(A)>m){var P=R,k=s,M=c;R=T+m*(a&&T<R?1:-1),y=Br(s=S+n*pr.cos(R),c=C+i*pr.sin(R),n,i,r,0,a,k,M,[R,P,S,C])}A=R-T;var D=pr.cos(T),N=pr.sin(T),B=pr.cos(R),O=pr.sin(R),L=pr.tan(A/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*D],$=[s+I*O,c-j*B],H=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,H].concat(y);for(var W=[],G=0,V=(y=[F,$,H].concat(y).join().split(",")).length;G<V;G++)W[G]=G%2?v(y[G-1],y[G],f).y:v(y[G],y[G+1],f).x;return W}function Or(e,t){for(var n=[],i=0,r=e.length;i<r-2*!t;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function Lr(e,t){var n=!t&&br(e);if(!t&&n.curve)return Er(n.curve);for(var o=Mr(e),a=t&&Mr(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;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(Br.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":r="C"==n||"S"==n?(i=2*t.x-t.bx,2*t.y-t.by):(i=t.x,t.y),e=["C",i,r].concat(e.slice(1));break;case"T":t.qy="Q"==n||"T"==n?(t.qx=2*t.x-t.qx,2*t.y-t.qy):(t.qx=t.x,t.y),e=["C"].concat(Nr(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(Nr(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(Dr(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(Dr(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(Dr(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(Dr(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(7<e[t].length){e[t].shift();for(var n=e[t];n.length;)l[t]="A",a&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=hr(o.length,a&&a.length||0)}},p=function(e,t,n,i,r){e&&t&&"M"==e[r][0]&&"M"!=t[r][0]&&(t.splice(r,0,["M",i.x,i.y]),n.bx=0,n.by=0,n.x=e[r][1],n.y=e[r][2],f=hr(o.length,a&&a.length||0))},l=[],u=[],h="",d="",m=0,f=hr(o.length,a&&a.length||0);m<f;m++){o[m]&&(h=o[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),o[m]=s(o[m],i,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(o,m),a&&(a[m]&&(h=a[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),a[m]=s(a[m],r,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(a,m)),p(o,a,i,r,m),p(a,o,r,i,m);var y=o[m],v=a&&a[m],g=y.length,b=a&&v.length;i.x=y[g-2],i.y=y[g-1],i.bx=cr(y[g-4])||i.x,i.by=cr(y[g-3])||i.y,r.bx=a&&(cr(v[b-4])||r.x),r.by=a&&(cr(v[b-3])||r.y),r.x=a&&v[b-2],r.y=a&&v[b-1]}return a||(n.curve=Er(o)),a?[o,a]:o}var Ir=function(e,t,n){e=Lr(e),t=Lr(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])i=s=y[1],r=c=y[2];else{r="C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],u[7]):(u=[i,r,i,r,s,c,s,c],i=s,c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{a="C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],h[7]):(h=[o,a,o,a,p,l,p,l],o=p,l);var x=Pr(u,h,n);if(n)d+=x;else{for(var _=0,E=x.length;_<E;_++)x[_].segment1=m,x[_].segment2=v,x[_].bez1=u,x[_].bez2=h;d=d.concat(x)}}}}}return d};function jr(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function zr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Fr(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function $r(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Hr(e){return zr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Wr(e,t,n){P(n=n||0)||(n={x:n,y:n});var i=Fr(e),r=Fr(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"}function Gr(e,t,n){var i=Ir(e,t);return 1===i.length?zr(i[0]):2===i.length&&er(i[0],i[1])<1?zr(i[0]):1<i.length?zr((i=R(i,function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t}))[n?0:i.length-1]):null}function Vr(e,t){return $({id:e.id,type:e.$type,businessObject:e},t)}function Ur(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:bi(n),referenced:bi(t),property:i}))}function qr(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}qr.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],qr.prototype.add=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d=e.di,m=this._translate;if(wi(d,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Vr(e)),this._canvas.setRootElement(n);else if(wi(d,"bpmndi:BPMNShape")){var f=!Ci(e);i=t&&(t.hidden||t.collapsed);var y=e.di.bounds;n=this._elementFactory.createShape(Vr(e,{collapsed:f,hidden:i,x:Math.round(y.x),y:Math.round(y.y),width:Math.round(y.width),height:Math.round(y.height)})),wi(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),wi(e,"bpmn:Lane")&&(r=0),wi(e,"bpmn:DataStoreReference")&&(p=t,l=Hr(y),u=l.x,h=l.y,u>=p.x&&u<=p.x+p.width&&h>=p.y&&h<=p.y+p.height||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!wi(d,"bpmndi:BPMNEdge"))throw new Error(m("unknown di {di} for element {semantic}",{di:bi(d),semantic:bi(e)}));var v=this._getSource(e),g=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Vr(e,{hidden:i,source:v,target:g,waypoints:(o=e,a=v,s=g,c=o.di.waypoint,!c||c.length<2?[Hr(a),Hr(s)]:c.map(function(e){return{x:e.x,y:e.y}}))})),wi(e,"bpmn:DataAssociation")&&(t=null),wi(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return Yi(e)&&e.name&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},qr.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:bi(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ur(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},qr.prototype.addLabel=function(e,t){var n,i,r,o,a,s,c,p;return o=t,(p=e.di.label)&&p.bounds?(c=p.bounds,s={width:Math.max(qi.width,c.width),height:c.height},a={x:c.x+c.width/2,y:c.y+c.height/2}):(a=Qi(o),s=qi),n=$({x:a.x-s.width/2,y:a.y-s.height/2},s),(i=e.name)&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(Vr(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!e.name,x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},qr.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Ur(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:bi(e),side:t}))},qr.prototype._getSource=function(e){return this._getEnd(e,"source")},qr.prototype._getTarget=function(e){return this._getEnd(e,"target")},qr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Kr={__depends__:[Vi,{__depends__:[Ui],bpmnImporter:["type",qr]}]};function Yr(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Xr(e){return e.originalEvent||e.srcEvent}function Zr(e,t){Yr(e),Yr(Xr(e))}function Qr(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 Jr(e){return!(Xr(e)||e).button}function eo(e){var t=Xr(e)||e;return!!Jr(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function to(e){return!0}function no(a,s,e){var r=e.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function o(e,t,n){var i,r,o;(i=t,(u[e]||Jr)(i))&&(n?o=s.getGraphics(n):(r=t.delegateTarget||t.target)&&(o=r,n=s.get(o)),o&&n&&!1===a.fire(e,{element:n,gfx:o,originalEvent:t})&&(t.stopPropagation(),t.preventDefault()))}var c={};function p(e){return c[e]}var l={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":to};var h="svg, .djs-element";function i(e,t,n,i){var r=c[n]=function(e){o(n,e)};i&&(u[n]=i),r.$delegate=ae.bind(e,h,t,r)}function d(e,t,n){var i=p(n);i&&ae.unbind(e,t,i.$delegate)}a.on("canvas.destroy",function(e){var n;n=e.svg,M(l,function(e,t){d(n,t,e)})}),a.on("canvas.init",function(e){var n;n=e.svg,M(l,function(e,t){i(n,t,e)})}),a.on(["shape.added","connection.added"],function(e){var t,n=e.element,i=e.gfx;n.waypoints?t=at(n.waypoints):_e(t=Ne("rect"),{x:0,y:0,width:n.width,height:n.height}),_e(t,r),ve(i,t)}),a.on("shape.changed",500,function(e){var t=e.element;_e(de(".djs-hit",e.gfx),{width:t.width,height:t.height})}),a.on("connection.changed",function(e){var t,n,i=e.element,r=de(".djs-hit",e.gfx);t=r,n=i.waypoints,_e(t,{points:ot(n)})}),this.fire=o,this.triggerMouseEvent=function(e,t,n){var i=l[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return o(i,t,n)},this.mouseHandler=p,this.registerEvent=i,this.unregisterEvent=d}no.$inject=["eventBus","elementRegistry","styles"];var io={__init__:["interactionEvents"],interactionEvents:["type",no]};function ro(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Ne("rect");return _e(n,$({x:10,y:10,width:100,height:100},i)),ve(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,i=de(".djs-outline",n);i||(i=o(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=de(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}ro.prototype.updateShapeOutline=function(e,t){_e(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ro.prototype.updateConnectionOutline=function(e,t){var n=ft(t);_e(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ro.$inject=["eventBus","styles","elementRegistry"];var oo={__init__:["outline"],outline:["type",ro]};function ao(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}ao.$inject=["eventBus"],ao.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},ao.prototype.get=function(){return this._selectedElements},ao.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},ao.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();g(e)||(e=e?[e]:[]),t?M(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var so="selected";function co(e,n,t,i){function r(e,t){n.addMarker(e,t)}function o(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){o(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;M(t,function(e){-1===n.indexOf(e)&&o(e,so)}),M(n,function(e){-1===t.indexOf(e)&&r(e,so)})})}function po(e,o,a,i){e.on("create.end",500,function(e){e.context.canExecute&&o.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&o.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=i.get(e.context.shape.id);A(t,function(e){return n.id===e.id})||o.select(n)}),e.on("element.click",function(e){var t=e.element;t===a.getRootElement()&&(t=null);var n=o.isSelected(t),i=1<o.get().length,r=eo(e);if(n&&i)return r?o.deselect(t):o.select(t);n?o.deselect(t):o.select(t,r)})}co.$inject=["eventBus","canvas","selection","styles"],po.$inject=["eventBus","selection","canvas","elementRegistry"];var lo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[io,oo],selection:["type",ao],selectionVisuals:["type",co],selectionBehavior:["type",po]};function uo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}uo.prototype.next=function(){return this._prefix+ ++this._counter};var ho=new uo("ov");function mo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=ho,this._overlayDefaults=$({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=se('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}function fo(e,t,n){$(e.style,{left:t+"px",top:n+"px"})}function yo(e,t){e.style.display=!1===t?"none":""}function vo(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}mo.$inject=["config.overlays","eventBus","canvas","elementRegistry"],mo.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k(t.overlays,D({type:e.type})):t.overlays.slice():[]}return e.type?k(this._overlays,D({type:e.type})):e.id?this._overlays[e.id]:null},mo.prototype.add=function(e,t,n){if(P(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 i=this._ids.next();return n=$({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},mo.prototype.remove=function(e){var t=this.get(e)||[];g(t)||(t=[t]);var i=this;M(t,function(e){var t=i._getOverlayContainer(e.element,!0);if(e&&(fe(e.html),fe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete i._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},mo.prototype.show=function(){yo(this._overlayRoot)},mo.prototype.hide=function(){yo(this._overlayRoot,!1)},mo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Y(this._overlayRoot)},mo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ft(t);i=o.x,r=o.y}fo(n,i,r),H(e.html,"data-container-id",t.id)},mo.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?ft(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?ft(o).height:o.height,s=-1*i.bottom+n);fo(r,a||0,s||0)},mo.prototype._createOverlayContainer=function(e){var t=se('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},mo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";vo(this._overlayRoot,n)},mo.prototype._getOverlayContainer=function(t,e){var n=A(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},mo.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),d(o)&&(o=se(o)),n=this._getOverlayContainer(r),(t=se('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&q(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((c(i)&&i>t.scale||c(r)&&r<t.scale)&&(a=!1),yo(o,a)),this._updateOverlayScale(e,t)},mo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(i=!1===o?n=1:(n=o.min,o.max),c(n)&&t.scale<n&&(r=(1/t.scale||1)*n),c(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),c(r)&&(s="scale("+r+","+r+")"),vo(a,s)},mo.prototype._updateOverlaysVisibilty=function(t){var n=this;M(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},mo.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,r._updateRoot(t),r._updateOverlaysVisibilty(t),r.show()}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;M(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){fe(n.html);var i=r._overlayContainers.indexOf(n);-1!==i&&r._overlayContainers.splice(i,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(M(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&q(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var go={__init__:["overlays"],overlays:["type",mo]},bo='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';
8
8
  /**
9
9
  * This file must not be changed or exchanged.
10
10
  *
11
11
  * @see http://bpmn.io/license for more information.
12
- */function xo(e){return e.join(";")}var _o,Eo='<div class="bjs-powered-by-lightbox" style="'+xo(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+xo(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+xo(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+bo+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';var wo={width:"100%",height:"100%",position:"relative"};function So(e){return e+(l(e)?"px":"")}function Co(e){e=F({},wo,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),
12
+ */function xo(e){return e.join(";")}var _o,Eo='<div class="bjs-powered-by-lightbox" style="'+xo(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+xo(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+xo(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+bo+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';var wo={width:"100%",height:"100%",position:"relative"};function So(e){return e+(l(e)?"px":"")}function Co(e){
13
13
  /**
14
14
  * Adds the project logo to the diagram container as
15
15
  * required by the bpmn.io license.
@@ -18,17 +18,10 @@
18
18
  *
19
19
  * @param {Element} container
20
20
  */
21
- function(e){var t=se('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+bo+"</a>");e.appendChild(t),re.bind(t,"click",function(e){_o||(_o=se(Eo),ae.bind(_o,".backdrop","click",function(e){document.body.removeChild(_o)})),document.body.appendChild(_o),e.preventDefault()})}(this._container),this._init(this._container,this._moddle,e)}function To(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Ro(e,t){return-1<(e=g(e)?e:[e]).indexOf(t.key)}function Ao(e){return e.shiftKey}t(Co,en),Co.prototype.importXML=function(e,r,o){u(r)&&(o=r,r=null),o=o||function(){};var a=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,t,n){t=a._emit("import.parse.complete",{error:e,definitions:t,context:n})||t;var i=n.warnings;if(e)return e=
22
- /**
23
- * The code in the <project-logo></project-logo> area
24
- * must not be changed.
25
- *
26
- * @see http://bpmn.io/license for more information.
27
- */
28
- function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),a._emit("import.done",{error:e,warnings:i}),o(e,i);a._setDefinitions(t),a.open(r,function(e,t){var n=[].concat(i,t||[]);a._emit("import.done",{error:e,warnings:n}),o(e,n)})})},Co.prototype.open=function(e,t){u(e)&&(t=e,e=null);var n=this._definitions,i=e;if(t=t||function(){},!n)return t(new Error("no XML imported"));if("string"==typeof e&&!(i=function(e,t){return t&&R(e.diagrams,function(e){return e.id===t})||null}(n,e)))return t(new Error("BPMNDiagram <"+e+"> not found"));try{this.clear()}catch(e){return t(e)}return function(e,t,n,i){var r,o,a;u(n)&&(i=n,n=null);var s,c,p,l=[];try{r=e.get("bpmnImporter"),o=e.get("eventBus"),a=e.get("translate"),o.fire("import.render.start",{definitions:t}),c=t,p=n,new Ei({root:function(e){return r.add(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){l.push({message:e,context:t})}},a).handleDefinitions(c,p),o.fire("import.render.complete",{error:s,warnings:l})}catch(e){s=e}i(s,l)}(this,n,i,t)},Co.prototype.saveXML=function(e,n){n||(n=e,e={});var i=this,t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=i._emit("saveXML.serialized",{error:e,xml:t})||t,i._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})},Co.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={}),this._emit("saveSVG.start");try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=de("defs",r._svg),s=We(o),c=a?"<defs>"+We(a)+"</defs>":"",p=o.getBBox();n='<?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+s+"</svg>"}catch(e){i=e}this._emit("saveSVG.done",{error:i,svg:n}),t(i,n)},Co.prototype._setDefinitions=function(e){this._definitions=e},Co.prototype.getModules=function(){return this._modules},Co.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),en.prototype.clear.call(this)},Co.prototype.destroy=function(){en.prototype.destroy.call(this),fe(this._container)},Co.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Co.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Co.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=de(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Co.prototype.getDefinitions=function(){return this._definitions},Co.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Co.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=F(function(e,n){var i={};return k(Object(e),function(e,t){-1===n.indexOf(t)&&(i[t]=e)}),i}(n,["additionalModules"]),{canvas:F({},n.canvas,{container:e}),modules:o});en.call(this,a),n&&n.container&&this.attachTo(n.container)},Co.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Co.prototype._createContainer=function(e){var t=se('<div class="bjs-container"></div>');return F(t.style,{width:So(e.width),height:So(e.height),position:e.position}),t},Co.prototype._createModdle=function(e){return new gi(F({},this._moddleExtensions,e.moddleExtensions))},Co.prototype._modules=[Kr,Ui,lo,go],Co.prototype._moddleExtensions={};var Po="keyboard.keydown";function ko(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keyHandler=this._keyHandler.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()})}ko.$inject=["config.keyboard","eventBus"],ko.prototype._keyHandler=function(e){if(!function(e){return e&&(he(e,"input, textarea")||"true"===e.contentEditable)}(e.target)){var t={keyEvent:e};this._eventBus.fire(Po,t)&&e.preventDefault()}},ko.prototype.bind=function(e){this.unbind(),this._node=e,re.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},ko.prototype.getBinding=function(){return this._node},ko.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),re.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},ko.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},ko.prototype.addListener=function(e,t){u(e)&&(t=e,e=1e3),this._eventBus.on(Po,e,t)},ko.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},ko.prototype.isCmd=To,ko.prototype.isShift=Ao,ko.prototype.isKey=Ro;var Mo=500;function Do(e,n){var i=this;e.on("editorActions.init",Mo,function(e){var t=e.editorActions;i.registerBindings(n,t)})}Do.$inject=["eventBus","keyboard"],Do.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(To(t)&&!Ao(t)&&Ro(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(To(t)&&(Ro(["y","Y"],t)||Ro(["z","Z"],t)&&Ao(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(To(t)&&Ro(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(To(t)&&Ro(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Ro(["+","Add"],t)&&To(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Ro(["-","Subtract"],t)&&To(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Ro("0",t)&&To(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Ro(["Delete","Del"],e.keyEvent))return i.trigger("removeSelection"),!0})};var No={__init__:["keyboard","keyboardBindings"],keyboard:["type",ko],keyboardBindings:["type",Do]},Bo={moveSpeed:50,moveSpeedAccelerated:200};function Oo(e,o,r){var a=this;this._config=F({},Bo,e||{}),o.addListener(function(e){var t=e.keyEvent,n=a._config;if(!o.isCmd(t))return;if(o.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var i,r=o.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":i="left";break;case"ArrowUp":case"Up":i="up";break;case"ArrowRight":case"Right":i="right";break;case"ArrowDown":case"Down":i="down"}return a.moveCanvas({speed:r,direction:i}),!0}}),this.moveCanvas=function(e){var t=0,n=0,i=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":n=i;break;case"right":t=-i;break;case"down":n=-i}r.scroll({dx:t,dy:n})}}Oo.$inject=["config.keyboardMove","keyboard","canvas"];var Lo={__depends__:[No],__init__:["keyboardMove"],keyboardMove:["type",Oo]},Io=/^djs-cursor-.*$/;function jo(e){var t=q(document.body);t.removeMatching(Io),e&&t.add("djs-cursor-"+e)}function zo(){jo(null)}var Fo=5e3;function $o(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Fo,n),function(){e.off(t,n)}}function Ho(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Go(r,o){var a;function t(e){var t=a.start,n=Qr(e),i=Wo(n,t);(!a.dragging&&15<function(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}(i)&&(a.dragging=!0,$o(r),jo("grab")),a.dragging)&&(i=Wo(n,a.last||a.start),o.scroll({dx:i.x,dy:i.y}),a.last=n);e.preventDefault()}function n(e){re.unbind(document,"mousemove",t),re.unbind(document,"mouseup",n),a=null,zo()}r.on("element.mousedown",500,function(e){return function(e){if(ee(e.target,".djs-draggable"))return;if(e.button||e.ctrlKey||e.shiftKey||e.altKey)return;return a={start:Qr(e)},re.bind(document,"mousemove",t),re.bind(document,"mouseup",n),!0}(e.originalEvent)})}Go.$inject=["eventBus","canvas"];var Vo={__init__:["moveCanvas"],moveCanvas:["type",Go]};function Uo(e){return Math.log(e)/Math.log(10)}function qo(e,t){var n=Uo(e.min),i=Uo(e.max);return(Math.abs(n)+Math.abs(i))/t}var Ko=Math.sign||function(e){return 0<=e?1:-1},Yo={min:.2,max:4};function Xo(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=j(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var i=this;e.on("canvas.init",function(e){i._init(!1!==t.enabled)})}Xo.$inject=["config.zoomScroll","eventBus","canvas"],Xo.prototype.scroll=function(e){this._canvas.scroll(e)},Xo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Xo.prototype.zoom=function(e,t){var n=qo(Yo,20);this._totalDelta+=e,.1<Math.abs(this._totalDelta)&&(this._zoom(e,t,n),this._totalDelta=0)},Xo.prototype._handleWheel=function(e){if(!ee(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){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))*Ko(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Xo.prototype.stepZoom=function(e,t){var n=qo(Yo,10);this._zoom(e,t,n)},Xo.prototype._zoom=function(e,t,n){var i=this._canvas,r=0<e?1:-1,o=Uo(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Yo,s),t)},Xo.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&re[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e},Xo.prototype._init=function(e){this.toggle(e)};var Zo={__init__:["zoomScroll"],zoomScroll:["type",Xo]};function Qo(e){Co.call(this,e)}t(Qo,Co),Qo.prototype._modules=[].concat(Qo.prototype._modules,Qo.prototype._navigationModules=[Lo,Vo,Zo]);var Jo=e(function(Ge){
21
+ var t,n;e=$({},wo,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=se('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+bo+"</a>"),t.appendChild(n),re.bind(n,"click",function(e){_o||(_o=se(Eo),ae.bind(_o,".backdrop","click",function(e){document.body.removeChild(_o)})),document.body.appendChild(_o),e.preventDefault()}),this._init(this._container,this._moddle,e)}function To(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Ro(e,t){return-1<(e=g(e)?e:[e]).indexOf(t.key)}function Ao(e){return e.shiftKey}t(Co,en),Co.prototype.importXML=function(e,a,s){u(a)&&(s=a,a=null),s=s||function(){};var c=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,t,n){t=c._emit("import.parse.complete",{error:e,definitions:t,context:n})||t;var i,r,o=n.warnings;if(e)return(r=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec((i=e).message))&&(i.message="unparsable content <"+r[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+r[2]),e=i,c._emit("import.done",{error:e,warnings:o}),s(e,o);c.importDefinitions(t,a,function(e,t){var n=[].concat(o,t||[]);c._emit("import.done",{error:e,warnings:n}),s(e,n)})})},Co.prototype.importDefinitions=function(e,t,n){return u(t)&&(n=t,t=null),n=n||function(){},this._setDefinitions(e),this.open(t,n)},Co.prototype.open=function(e,t){u(e)&&(t=e,e=null);var n,i,r=this._definitions,o=e;if(t=t||function(){},!r)return t(new Error("no XML imported"));if("string"==typeof e&&(n=r,!(o=(i=e)&&A(n.diagrams,function(e){return e.id===i})||null)))return t(new Error("BPMNDiagram <"+e+"> not found"));try{this.clear()}catch(e){return t(e)}return function(e,t,n,i){var r,o,a;u(n)&&(i=n,n=null);var s,c,p,l=[];try{r=e.get("bpmnImporter"),o=e.get("eventBus"),a=e.get("translate"),o.fire("import.render.start",{definitions:t}),c=t,p=n,new Ei({root:function(e){return r.add(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){l.push({message:e,context:t})}},a).handleDefinitions(c,p),o.fire("import.render.complete",{error:s,warnings:l})}catch(e){s=e}i(s,l)}(this,r,o,t)},Co.prototype.saveXML=function(e,n){n||(n=e,e={});var i=this,t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=i._emit("saveXML.serialized",{error:e,xml:t})||t,i._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})},Co.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={}),this._emit("saveSVG.start");try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=de("defs",r._svg),s=We(o),c=a?"<defs>"+We(a)+"</defs>":"",p=o.getBBox();n='<?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+s+"</svg>"}catch(e){i=e}this._emit("saveSVG.done",{error:i,svg:n}),t(i,n)},Co.prototype._setDefinitions=function(e){this._definitions=e},Co.prototype.getModules=function(){return this._modules},Co.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),en.prototype.clear.call(this)},Co.prototype.destroy=function(){en.prototype.destroy.call(this),fe(this._container)},Co.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Co.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Co.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=de(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Co.prototype.getDefinitions=function(){return this._definitions},Co.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Co.prototype._init=function(e,t,n){var i,r,o=n.modules||this.getModules(),a=n.additionalModules||[],s=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],o,a),c=$((i=["additionalModules"],r={},M(Object(n),function(e,t){-1===i.indexOf(t)&&(r[t]=e)}),r),{canvas:$({},n.canvas,{container:e}),modules:s});en.call(this,c),n&&n.container&&this.attachTo(n.container)},Co.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Co.prototype._createContainer=function(e){var t=se('<div class="bjs-container"></div>');return $(t.style,{width:So(e.width),height:So(e.height),position:e.position}),t},Co.prototype._createModdle=function(e){return new gi($({},this._moddleExtensions,e.moddleExtensions))},Co.prototype._modules=[Kr,Ui,lo,go],Co.prototype._moddleExtensions={};var Po="keyboard.keydown";function ko(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keyHandler=this._keyHandler.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()})}ko.$inject=["config.keyboard","eventBus"],ko.prototype._keyHandler=function(e){var t=e.target;if(!(n=t)||!he(n,"input, textarea")&&"true"!==n.contentEditable){var n,i={keyEvent:e};this._eventBus.fire(Po,i)&&e.preventDefault()}},ko.prototype.bind=function(e){this.unbind(),this._node=e,re.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},ko.prototype.getBinding=function(){return this._node},ko.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),re.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},ko.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},ko.prototype.addListener=function(e,t){u(e)&&(t=e,e=1e3),this._eventBus.on(Po,e,t)},ko.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},ko.prototype.isCmd=To,ko.prototype.isShift=Ao,ko.prototype.isKey=Ro;var Mo=500;function Do(e,n){var i=this;e.on("editorActions.init",Mo,function(e){var t=e.editorActions;i.registerBindings(n,t)})}Do.$inject=["eventBus","keyboard"],Do.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(To(t)&&!Ao(t)&&Ro(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(To(t)&&(Ro(["y","Y"],t)||Ro(["z","Z"],t)&&Ao(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(To(t)&&Ro(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(To(t)&&Ro(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Ro(["+","Add"],t)&&To(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Ro(["-","Subtract"],t)&&To(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Ro("0",t)&&To(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Ro(["Delete","Del"],e.keyEvent))return i.trigger("removeSelection"),!0})};var No={__init__:["keyboard","keyboardBindings"],keyboard:["type",ko],keyboardBindings:["type",Do]},Bo={moveSpeed:50,moveSpeedAccelerated:200};function Oo(e,o,r){var a=this;this._config=$({},Bo,e||{}),o.addListener(function(e){var t=e.keyEvent,n=a._config;if(!o.isCmd(t))return;if(o.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var i,r=o.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":i="left";break;case"ArrowUp":case"Up":i="up";break;case"ArrowRight":case"Right":i="right";break;case"ArrowDown":case"Down":i="down"}return a.moveCanvas({speed:r,direction:i}),!0}}),this.moveCanvas=function(e){var t=0,n=0,i=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":n=i;break;case"right":t=-i;break;case"down":n=-i}r.scroll({dx:t,dy:n})}}Oo.$inject=["config.keyboardMove","keyboard","canvas"];var Lo={__depends__:[No],__init__:["keyboardMove"],keyboardMove:["type",Oo]},Io=/^djs-cursor-.*$/;function jo(e){var t=q(document.body);t.removeMatching(Io),e&&t.add("djs-cursor-"+e)}function zo(){jo(null)}var Fo=5e3;function $o(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Fo,n),function(){e.off(t,n)}}function Ho(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Go(o,a){var s;function t(e){var t,n=s.start,i=Qr(e),r=Wo(i,n);(!s.dragging&&(t=r,15<Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)))&&(s.dragging=!0,$o(o),jo("grab")),s.dragging)&&(r=Wo(i,s.last||s.start),a.scroll({dx:r.x,dy:r.y}),s.last=i);e.preventDefault()}function n(e){re.unbind(document,"mousemove",t),re.unbind(document,"mouseup",n),s=null,zo()}o.on("element.mousedown",500,function(e){return function(e){if(ee(e.target,".djs-draggable"))return;if(e.button||e.ctrlKey||e.shiftKey||e.altKey)return;return s={start:Qr(e)},re.bind(document,"mousemove",t),re.bind(document,"mouseup",n),!0}(e.originalEvent)})}Go.$inject=["eventBus","canvas"];var Vo={__init__:["moveCanvas"],moveCanvas:["type",Go]};function Uo(e){return Math.log(e)/Math.log(10)}function qo(e,t){var n=Uo(e.min),i=Uo(e.max);return(Math.abs(n)+Math.abs(i))/t}var Ko=Math.sign||function(e){return 0<=e?1:-1},Yo={min:.2,max:4};function Xo(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=j(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var i=this;e.on("canvas.init",function(e){i._init(!1!==t.enabled)})}Xo.$inject=["config.zoomScroll","eventBus","canvas"],Xo.prototype.scroll=function(e){this._canvas.scroll(e)},Xo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Xo.prototype.zoom=function(e,t){var n=qo(Yo,20);this._totalDelta+=e,.1<Math.abs(this._totalDelta)&&(this._zoom(e,t,n),this._totalDelta=0)},Xo.prototype._handleWheel=function(e){if(!ee(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){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))*Ko(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Xo.prototype.stepZoom=function(e,t){var n=qo(Yo,10);this._zoom(e,t,n)},Xo.prototype._zoom=function(e,t,n){var i=this._canvas,r=0<e?1:-1,o=Uo(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s,c,p=Math.pow(10,a);i.zoom((s=Yo,c=p,Math.max(s.min,Math.min(s.max,c))),t)},Xo.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&re[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e},Xo.prototype._init=function(e){this.toggle(e)};var Zo={__init__:["zoomScroll"],zoomScroll:["type",Xo]};function Qo(e){Co.call(this,e)}t(Qo,Co),Qo.prototype._modules=[].concat(Qo.prototype._modules,Qo.prototype._navigationModules=[Lo,Vo,Zo]);var Jo=e(function(Ge){
29
22
  /*! Hammer.JS - v2.0.7 - 2016-04-22
30
23
  * http://hammerjs.github.io/
31
24
  *
32
25
  * Copyright (c) 2016 Jorik Tangelder;
33
26
  * Licensed under the MIT license */
34
- !function(o,r,e,u){var a,s=["","webkit","Moz","MS","ms","o"],t=r.createElement("div"),n="function",c=Math.round,h=Math.abs,d=Date.now;function p(e,t,n){return setTimeout(g(e,n),t)}function i(e,t,n){return!!Array.isArray(e)&&(l(e,n[t],n),!0)}function l(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==u)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function m(i,e,t){var r="DEPRECATED METHOD: "+e+"\n"+t+" AT \n";return function(){var e=new Error("get-stack-trace"),t=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=o.console&&(o.console.warn||o.console.log);return n&&n.call(o.console,r,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===u||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==u&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var f=m(function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===u)&&(e[i[r]]=t[i[r]]),r++;return e},"extend","Use `assign`."),y=m(function(e,t){return f(e,t,!0)},"merge","Use `assign`.");function v(e,t,n){var i,r=t.prototype;(i=e.prototype=Object.create(r)).constructor=e,i._super=r,n&&a(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==n?e.apply(t&&t[0]||u,t):e}function x(e,t){return e===u?t:e}function _(t,e,n){l(C(e),function(e){t.addEventListener(e,n,!1)})}function E(t,e,n){l(C(e),function(e){t.removeEventListener(e,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return-1<e.indexOf(t)}function C(e){return e.trim().split(/\s+/g)}function T(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function R(e){return Array.prototype.slice.call(e,0)}function A(e,n,t){for(var i=[],r=[],o=0;o<e.length;){var a=n?e[o][n]:e[o];T(r,a)<0&&i.push(e[o]),r[o]=a,o++}return t&&(i=n?i.sort(function(e,t){return e[n]>t[n]}):i.sort()),i}function P(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;o<s.length;){if((i=(n=s[o])?n+r:t)in e)return i;o++}return u}var k=1;function M(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||o}var D="ontouchstart"in o,N=P(o,"PointerEvent")!==u,B=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O="touch",L=25,I=1,j=4,z=8,F=1,$=2,H=4,W=8,G=16,V=$|H,U=W|G,q=V|U,K=["x","y"],Y=["clientX","clientY"];function X(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){b(t.options.enable,[t])&&n.handler(e)},this.init()}function Z(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,o=t&I&&i-r==0,a=t&(j|z)&&i-r==0;n.isFirst=!!o,n.isFinal=!!a,o&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=Q(t));1<r&&!n.firstMultiple?n.firstMultiple=Q(t):1===r&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,c=t.center=J(i);t.timeStamp=d(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=ie(s,c),t.distance=ne(s,c),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==I&&o.eventType!==j||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=te(t.deltaX,t.deltaY);var p=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=h(p.x)>h(p.y)?p.x:p.y,t.scale=a?function(e,t){return ne(t[0],t[1],Y)/ne(e[0],e[1],Y)}(a.pointers,i):1,t.rotation=a?function(e,t){return ie(t[1],t[0],Y)+ie(e[1],e[0],Y)}(a.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,r,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(L<s||a.velocity===u)){var c=t.deltaX-a.deltaX,p=t.deltaY-a.deltaY,l=ee(s,c,p);i=l.x,r=l.y,n=h(l.x)>h(l.y)?l.x:l.y,o=te(c,p),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}(n,t);var l=e.element;w(t.srcEvent.target,l)&&(l=t.srcEvent.target);t.target=l}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Q(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:d(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:h(e)>=h(t)?e<0?$:H:t<0?W:G}function ne(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(M(this.element),this.evWin,this.domHandler)}};var re={mousedown:I,mousemove:2,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}v(se,X,{handler:function(e){var t=re[e.type];t&I&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=j),this.pressed&&(t&j&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:I,pointermove:2,pointerup:j,pointercancel:z,pointerout:z},pe={2:O,3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),v(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a=o==O,s=T(t,e.pointerId,"pointerId");r&I&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(j|z)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var de={touchstart:I,touchmove:2,touchend:j,touchcancel:z};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,X.apply(this,arguments)}v(me,X,{handler:function(e){var t=de[e.type];if(t===I&&(this.started=!0),this.started){var n=function(e,t){var n=R(e.touches),i=R(e.changedTouches);t&(j|z)&&(n=A(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(j|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}}});var fe={touchstart:I,touchmove:2,touchend:j,touchcancel:z},ye="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=ye,this.targetIds={},X.apply(this,arguments)}v(ve,X,{handler:function(e){var t=fe[e.type],n=function(e,t){var n=R(e.touches),i=this.targetIds;if(t&(2|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=R(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===I)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;return s.length?[A(o.concat(s),"identifier",!0),s]:void 0}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}});var ge=2500;function be(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new ve(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function xe(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);-1<e&&i.splice(e,1)},ge)}}v(be,X,{handler:function(e,t,n){var i=n.pointerType==O,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&I?(this.primaryTouch=t.changedPointers[0].identifier,xe.call(this,t)):e&(j|z)&&xe.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=25&&a<=25)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var _e=P(t.style,"touchAction"),Ee=_e!==u,we="manipulation",Se="none",Ce="pan-x",Te="pan-y",Re=function(){if(!Ee)return!1;var t={},n=o.CSS&&o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){t[e]=!n||o.CSS.supports("touch-action",e)}),t}();function Ae(e,t){this.manager=e,this.set(t)}Ae.prototype={set:function(e){"compute"==e&&(e=this.compute()),Ee&&this.manager.element.style&&Re[e]&&(this.manager.element.style[_e]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return l(this.manager.recognizers,function(e){b(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),function(e){if(S(e,Se))return Se;var t=S(e,Ce),n=S(e,Te);if(t&&n)return Se;if(t||n)return t?Ce:Te;if(S(e,we))return we;return"auto"}(t.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Se)&&!Re.none,o=S(i,Te)&&!Re[Te],a=S(i,Ce)&&!Re[Ce];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&U?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Pe=1;function ke(e){this.options=a({},this.defaults,e||{}),this.id=k++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Pe,this.simultaneous={},this.requireFail=[]}function Me(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function De(e){return e==G?"down":e==W?"up":e==$?"left":e==H?"right":""}function Ne(e,t){var n=t.manager;return n?n.get(e):e}function Be(){ke.apply(this,arguments)}function Oe(){Be.apply(this,arguments),this.pX=null,this.pY=null}function Le(){Be.apply(this,arguments)}function Ie(){ke.apply(this,arguments),this._timer=null,this._input=null}function je(){Be.apply(this,arguments)}function ze(){Be.apply(this,arguments)}function Fe(){ke.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function $e(e,t){return(t=t||{}).recognizers=x(t.recognizers,$e.defaults.preset),new He(e,t)}ke.prototype={defaults:{},set:function(e){return a(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(i(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ne(e,this)).id]||(t[e.id]=e).recognizeWith(this),this},dropRecognizeWith:function(e){return i(e,"dropRecognizeWith",this)||(e=Ne(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(i(e,"requireFailure",this))return this;var t=this.requireFail;return-1===T(t,e=Ne(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(i(e,"dropRequireFailure",this))return this;e=Ne(e,this);var t=T(this.requireFail,e);return-1<t&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return 0<this.requireFail.length},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(t){var n=this,e=this.state;function i(e){n.manager.emit(e,t)}e<8&&i(n.options.event+Me(e)),i(n.options.event),t.additionalEvent&&i(t.additionalEvent),8<=e&&i(n.options.event+Me(e))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Pe)))return!1;e++}return!0},recognize:function(e){var t=a({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);56&this.state&&(this.state=Pe),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(Be,ke,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,r=this.attrTest(e);return i&&(n&z||!r)?16|t:i||r?n&j?8|t:2&t?4|t:2:32}}),v(Oe,Be,{defaults:{event:"pan",threshold:10,pointers:1,direction:q},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Te),e&U&&t.push(Ce),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(i=t.direction&V?(r=0===o?F:o<0?$:H,n=o!=this.pX,Math.abs(e.deltaX)):(r=0===a?F:a<0?W:G,n=a!=this.pY,Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Be.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Le,Be,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Ie,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(j|z)&&!r)this.reset();else if(e.eventType&I)this.reset(),this._timer=p(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&j)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),v(je,Be,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(ze,Be,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|U,pointers:1},getTouchAction:function(){return Oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|U)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&U&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&h(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Fe,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[we]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&I&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=j)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ne(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=p(function(){this.state=8,this.tryEmit()},t.interval,this),2):8}return 32},failTimeout:function(){return this._timer=p(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),$e.VERSION="2.0.7",$e.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[je,{enable:!1}],[Le,{enable:!1},["rotate"]],[ze,{direction:V}],[Oe,{direction:V},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[Ie]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function He(e,t){this.options=a({},$e.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=function(e){var t=e.options.inputClass;return new(t||(N?he:B?ve:D?be:se))(e,Z)}(this),this.touchAction=new Ae(this,this.options.touchAction),We(this,!0),l(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function We(n,i){var r,o=n.element;o.style&&(l(n.options.cssProps,function(e,t){r=P(o.style,t),i?(n.oldCssProps[r]=o.style[r],o.style[r]=e):o.style[r]=n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}He.prototype={set:function(e){return a(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&14&n.state&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ke)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(i(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),(e.manager=this).touchAction.update(),e},remove:function(e){if(i(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=T(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==u&&t!==u){var n=this.handlers;return l(C(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==u){var n=this.handlers;return l(C(e),function(e){t?n[e]&&n[e].splice(T(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var n=r.createEvent("Event");n.initEvent(e,!0,!0),(n.gesture=t).target.dispatchEvent(n)}(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](t),i++}},destroy:function(){this.element&&We(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},a($e,{INPUT_START:I,INPUT_MOVE:2,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Pe,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:H,DIRECTION_UP:W,DIRECTION_DOWN:G,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:U,DIRECTION_ALL:q,Manager:He,Input:X,TouchAction:Ae,TouchInput:ve,MouseInput:se,PointerEventInput:he,TouchMouseInput:be,SingleTouchInput:me,Recognizer:ke,AttrRecognizer:Be,Tap:Fe,Pan:Oe,Swipe:ze,Pinch:Le,Rotate:je,Press:Ie,on:_,off:E,each:l,merge:y,extend:f,assign:a,inherit:v,bindFn:g,prefixed:P}),(void 0!==o?o:"undefined"!=typeof self?self:{}).Hammer=$e,"function"==typeof u&&u.amd?u(function(){return $e}):Ge.exports?Ge.exports=$e:o.Hammer=$e}(window,document)}),ea=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function ta(e,t){return t.get(e,!1)}function na(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function ia(t){function e(e){setTimeout(function(){k(ea,function(e){re.unbind(t,e,na,!0)})},500)}re.bind(t,"touchstart",function(e){k(ea,function(e){re.bind(t,e,na,!0)})},!0),re.bind(t,"touchend",e,!0),re.bind(t,"touchcancel",e,!0);var r=new Jo.Manager(t,{inputClass:Jo.TouchInput,recognizers:[]}),n=new Jo.Tap,i=new Jo.Pan({threshold:10}),o=new Jo.Press,a=new Jo.Pinch,s=new Jo.Tap({event:"doubletap",taps:2});return a.requireFailure(i),a.requireFailure(o),r.add([i,o,a,s,n]),r.reset=function(e){var n=this.recognizers,i=this.session;i.stopped||(r.stop(e),setTimeout(function(){var e,t;for(e=0;t=n[e];e++)t.reset(),t.state=8;i.curRecognizer=null},0))},r.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&r.reset(!0)}),r}function ra(e,o,t,a,n){var s,c=ta("dragging",e),i=ta("move",e),r=ta("contextPad",e),p=ta("palette",e);function l(t){return function(e){n.fire(t,e)}}function u(e){return ee(e,"svg, .djs-element",!0)}function h(e){function t(e){var t=u(e.target),n=t&&a.get(t);if(i&&o.getRootElement()!==n)return i.start(e,n,!0);!function(e){var i=0,r=0;function t(e){var t=e.deltaX-i,n=e.deltaY-r;o.scroll({dx:t,dy:n}),i=e.deltaX,r=e.deltaY}function n(e){s.off("panmove",t),s.off("panend",n),s.off("pancancel",n)}s.on("panmove",t),s.on("panend",n),s.on("pancancel",n)}()}(s=ia(e)).on("doubletap",l("element.dblclick")),s.on("tap",l("element.click")),s.on("panstart",t),s.on("press",t),s.on("pinchstart",function(e){var i=o.zoom(),r=e.center;function t(e){var t=1-(1-e.scale)/1.5,n=Math.max(.2,Math.min(4,t*i));o.zoom(n,r),na(e)}function n(e){s.off("pinchmove",t),s.off("pinchend",n),s.off("pinchcancel",n),s.reset(!0)}s.on("pinchmove",t),s.on("pinchend",n),s.on("pinchcancel",n)})}c&&t.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Qr(t),i=u(document.elementFromPoint(n.x,n.y)),r=i&&a.get(i);r!==e.hover&&(e.hover&&c.out(e),r&&(c.hover({element:r,gfx:i}),e.hover=r,e.hoverGfx=i))}}),r&&t.on("contextPad.create",function(e){var t=ia(e.pad.html);t.on("panstart",function(e){r.trigger("dragstart",e,!0)}),t.on("press",function(e){r.trigger("dragstart",e,!0)}),t.on("tap",function(e){r.trigger("click",e)})}),p&&t.on("palette.create",function(e){var t=ia(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),t.on("canvas.init",function(e){h(e.svg)})}function oa(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}ra.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],oa.$inject=["canvas","eventBus"],oa.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Ne("rect");_e(n,{x:-1e4,y:1e4,width:10,height:10}),_e(n,t),ve(e,n);var i=Ne("rect");_e(i,{x:1e4,y:1e4,width:10,height:10}),_e(i,t),ve(e,i)};var aa={__depends__:[{__depends__:[io],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",ra],touchFix:["type",oa]}]};function sa(e){return e&&e[e.length-1]}function ca(e){return e.y}function pa(e){return e.x}var la={left:pa,center:pa,right:function(e){return e.x+e.width},top:ca,middle:ca,bottom:function(e){return e.y+e.height}};function ua(e){this._modeling=e}ua.$inject=["modeling"],ua.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ua.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ua.prototype._alignmentPosition=function(e,t){var n,i,r,o,a,s=this._getOrientationDetails(e),c=s.axis,p=s.dimension,l={},u={},h=!1;if(this._isType(e,["left","top"]))l[e]=t[0][c];else if(this._isType(e,["right","bottom"]))r=sa(t),l[e]=r[c]+r[p];else if(this._isType(e,["center","middle"])){if(k(t,function(e){var t=e[c]+Math.round(e[p]/2);u[t]?u[t].elements.push(e):u[t]={elements:[e],center:t}}),n=M(u,function(e){return 1<e.elements.length&&(h=!0),e.elements.length}),h)return l[e]=sa(n).center,l;i=t[0],r=sa(t=M(t,function(e){return e[c]+e[p]})),l[e]=(o=i,a=r,Math.round((o[c]+a[c]+a[p])/2))}return l},ua.prototype.trigger=function(e,t){var n=this._modeling,i=M(A(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),la[t]),r=this._alignmentPosition(t,i);n.alignElements(i,r)};var ha={__init__:["alignElements"],alignElements:["type",ua]};function da(t,e){return x(e,function(e){return wi(t,e)})}var ma=50,fa=250,ya=10;function va(e,t){var n,i=Fr(e),r=Hr(e),o=function(e,t){var n=Fr(e);function i(e){return wi(e,"bpmn:SequenceFlow")}var r=v(v([].concat(wa(e,i).map(function(t){return function(e){return{shape:e,weight:t,distanceTo:function(e){var t=Fr(e);return t.left-n.right}}}}(5)),Ea(e,i).map(function(t){return function(e){return{shape:e,weight:t,distanceTo:function(e){var t=Fr(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||fa<n||(r=e[String(n)]=e[String(n)]||{value:n,count:0},i=r.count+=1*a,(!c||c.count<i)&&(e.fav=r)),e},{});return r.fav?r.fav.value:ma}(e),a="left",s=30;return!wi(e,"bpmn:BoundaryEvent")||-1!==(a=Wr(e,e.host,-25)).indexOf("top")&&(s*=-1),ba(e,t,{x:i.right+o+t.width/2,y:r.y+(n=a,-1!=n.indexOf("top")?-80:-1!=n.indexOf("bottom")?80:0)},{y:{margin:s,rowSize:80}})}function ga(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return R(function(e,t){var n=_a(e);return e.host&&(n=n.concat(_a(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(_a(t))},[]))),n}(e),function(e){return e!==n&&"intersect"===Wr(e,i,ya)})}function ba(e,s,c,p){function t(o){var a={x:c.x,y:c.y};return["x","y"].forEach(function(e){var t=p[e];if(t){var n="x"===e?"width":"height",i=t.margin,r=t.rowSize;a[e]=i<0?Math.min(o[e]+i-s[n]/2,c[e]-r+i):Math.max(l[e]+l[n]+i+s[n]/2,c[e]+r+i)}}),a}for(var l;l=ga(e,c,s);)c=t(l);return c}function xa(){return!0}function _a(e,t){return[].concat(wa(e,t),Ea(e,t))}function Ea(e,t){return t||(t=xa),e.incoming.filter(t).map(function(e){return e.source})}function wa(e,t){return t||(t=xa),e.outgoing.filter(t).map(function(e){return e.target})}function Sa(n,r){function o(e,t){return n.fire(e,t)}this.append=function(e,t){var n=o("autoPlace",{source:e,shape:t});n||(n=function(e,t){if(wi(t,"bpmn:TextAnnotation"))return function(e,t){var n=Fr(e);return ba(e,t,{x:n.right+t.width/2,y:n.top-50-t.height/2},{y:{margin:-30,rowSize:20}})}(e,t);if(da(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return function(e,t){var n=Fr(e);return ba(e,t,{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},{x:{margin:30,rowSize:30}})}(e,t);if(wi(t,"bpmn:FlowNode"))return va(e,t);return function(e,t){var n=Fr(e),i=Hr(e);return{x:n.right+ma+t.width/2,y:i.y}}(e,t)}(e,t));var i=r.appendShape(e,t,n,e.parent);return o("autoPlace.end",{shape:i}),i}}function Ca(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}Sa.$inject=["eventBus","modeling"],Ca.$inject=["eventBus","selection"];var Ta={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Sa],autoPlaceSelectionBehavior:["type",Ca]};function Ra(e){this._eventBus=e}Ra.$inject=["eventBus"],Ra.prototype.on=function(e,n,i,r,o,a){if((u(n)||l(n))&&(a=o,o=r,r=i,i=n,n=null),u(i)&&(a=o,o=r,r=i,i=1e3),P(o)&&(a=o,o=!1),!u(r))throw new Error("handlerFn must be a function");g(e)||(e=[e]);var s=this._eventBus;k(e,function(e){var t=["commandStack",e,n].filter(function(e){return e}).join(".");s.on(t,i,o?function(t,n){return function(e){return t.call(n||null,e.context,e.command,e)}}(r,a):r,a)})};function Aa(e,t,n,i){Ra.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,r=t.parent||t.newParent;n&&(!1===n.root||!1===n.autoResize)||o._expand([i],r)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=h(w(t.closure.topLevel)),i=t.hints,r=!i||i.autoResize;!1!==r&&k(S(n,function(e){return e.parent.id}),function(e,t){g(r)&&(e=e.filter(function(e){return-1!==r.indexOf(e)})),o._expand(e,t)})}),this.postExecuted(["shape.toggleCollapse"],function(e){var t=e.context,n=t.hints,i=t.shape;n&&(!1===n.root||!1===n.autoResize)||i.collapsed||o._expand(i.children||[],i)}),this.postExecuted(["shape.resize"],function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&(!1===n.root||!1===n.autoResize)||r&&o._expand([i],r)})}function Pa(e){e.invoke(Aa,this)}function ka(e){Ra.call(this,e),this.init()}function Ma(e){ka.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}function Da(e,t){Ma.call(this,e),this._modeling=t}k(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(o){Ra.prototype[o]=function(e,t,n,i,r){(u(e)||l(e))&&(r=i,i=n,n=t,t=e,e=null),this.on(e,o,t,n,i,r)}}),Aa.$inject=["eventBus","elementRegistry","modeling","rules"],t(Aa,Ra),Aa.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Fr(ft(e)),o=Fr(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),$r(F({},o,a))},Aa.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){this.resize(t,n);var i=t.parent;i&&this._expand([t],i)}}},Aa.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Aa.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Aa.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)},Pa.$inject=["injector"],t(Pa,Aa),Pa.prototype.resize=function(e,t){wi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},ka.$inject=["eventBus"],t(ka,Ra),ka.prototype.addRule=function(e,t,i){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.canExecute(e,t,function(e,t,n){return i(e)},!0)})},ka.prototype.init=function(){},Ma.$inject=["eventBus"],t(Ma,ka),Ma.prototype.canResize=function(e,t){return!1},t(Da,Ma),Da.$inject=["eventBus","modeling"],Da.prototype.canResize=function(e,t){if(!wi(t,"bpmn:Participant")&&!wi(t,"bpmn:Lane")&&!wi(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(e){(wi(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Na={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Pa],bpmnAutoResizeProvider:["type",Da]},Ba=Math.round,Oa="djs-drag-active";function La(e){e.preventDefault()}function Ia(l,u,h){var d,m={threshold:5,trapClick:!0};function f(e){var t=u.viewbox(),n=u._container.getBoundingClientRect();return{x:t.x+(e.x-n.left)/t.scale,y:t.y+(e.y-n.top)/t.scale}}function y(e,t){t=t||d;var n=l.createEvent(F({},t.payload,t.data,{isTouch:t.isTouch}));return!1!==l.fire("drag."+e,n)&&l.fire(t.prefix+"."+e,n)}function v(e,t){var n=d.payload,i=d.displacement,r=d.globalStart,o=Qr(e),a=Wo(o,r),s=d.localStart,c=f(o),p=Wo(c,s);if(!d.active&&(t||function(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}(a)>d.threshold)){if(F(n,{x:Ba(s.x+i.x),y:Ba(s.y+i.y),dx:0,dy:0},{originalEvent:e}),!1===y("start"))return S();d.active=!0,d.keepSelection||(n.previousSelection=h.get(),h.select(null)),d.cursor&&jo(d.cursor),u.addMarker(u.getRootElement(),Oa)}Zr(e),d.active&&(F(n,{x:Ba(c.x+i.x),y:Ba(c.y+i.y),dx:Ba(p.x),dy:Ba(p.y)},{originalEvent:e}),y("move"))}function g(e){var t=!0;d.active&&(e&&Zr(d.payload.originalEvent=e),t=y("end")),!1===t&&y("rejected"),y("ended",i(!0!==t))}function b(e){27===e.which&&(La(e),S())}function x(e){var t;d.active&&(t=$o(l),setTimeout(t,400),La(e)),g(e)}function _(e){v(e)}function E(e){var t=d.payload;t.hoverGfx=e.gfx,t.hover=e.element,y("hover")}function w(e){y("out");var t=d.payload;t.hoverGfx=null,t.hover=null}function S(e){var t;if(d){var n=d.active;n&&y("cancel"),t=i(e),n&&y("canceled",t)}}function i(e){var t,n;y("cleanup"),zo(),n=d.trapClick?x:g,re.unbind(document,"mousemove",v),re.unbind(document,"dragstart",La),re.unbind(document,"selectstart",La),re.unbind(document,"mousedown",n,!0),re.unbind(document,"mouseup",n,!0),re.unbind(document,"keyup",b),re.unbind(document,"touchstart",_,!0),re.unbind(document,"touchcancel",S,!0),re.unbind(document,"touchmove",v,!0),re.unbind(document,"touchend",g,!0),l.off("element.hover",E),l.off("element.out",w),u.removeMarker(u.getRootElement(),Oa);var i=d.payload.previousSelection;return!1!==e&&i&&!h.get().length&&h.select(i),t=d,d=null,t}l.on("diagram.destroy",S),this.init=function(e,t,n,i){d&&S(!1),"string"==typeof t&&(i=n,n=t,t=null);var r,o,a,s,c,p=(i=F({},m,i||{})).data||{};s=i.trapClick?x:g,e?(r=Xr(e)||e,o=Qr(e),Zr(e),"dragstart"===r.type&&La(r)):(r=null,o={x:0,y:0}),a=f(o),t||(t=a),c=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(r),d=F({prefix:n,data:p,payload:{},globalStart:o,displacement:Wo(t,a),localStart:a,isTouch:c},i),i.manual||(c?(re.bind(document,"touchstart",_,!0),re.bind(document,"touchcancel",S,!0),re.bind(document,"touchmove",v,!0),re.bind(document,"touchend",g,!0)):(re.bind(document,"mousemove",v),re.bind(document,"dragstart",La),re.bind(document,"selectstart",La),re.bind(document,"mousedown",s,!0),re.bind(document,"mouseup",s,!0)),re.bind(document,"keyup",b),l.on("element.hover",E),l.on("element.out",w)),y("init"),i.autoActivate&&v(e,!0)},this.move=v,this.hover=E,this.out=w,this.end=g,this.cancel=S,this.context=function(){return d},this.setOptions=function(e){F(m,e)}}function ja(t,o,a){var n=this;t.on("drag.start",function(e){t.once("drag.move",function(){t.once("drag.move",function(e){n.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var t,n,i,r=e.originalEvent;r instanceof MouseEvent&&(t=Qr(r),(i=function(e){return ee(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y)))&&(n=a.get(i),o.hover({element:n,gfx:i})))}}}Ia.$inject=["eventBus","canvas","selection"],ja.$inject=["eventBus","dragging","elementRegistry"];var za={__init__:["hoverFix"],__depends__:[lo],dragging:["type",Ia],hoverFix:["type",ja]};function Fa(e,t){this._eventBus=e,this._canvas=t,this._init()}Fa.$inject=["eventBus","canvas"],Fa.prototype.getHoverContext=function(){var e=this._canvas.viewbox();return{element:this._hoverElement,point:{x:e.x+Math.round(this._mouseX/e.scale),y:e.y+Math.round(this._mouseY/e.scale)}}},Fa.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=j(this._setMousePosition,this),t.addEventListener("mousemove",this._setMousePosition),e.on("diagram.destroy",function(){t.removeEventListener("mousemove",this._setMousePosition)},this),e.on("element.hover",this._setHoverElement,this)},Fa.prototype._setHoverElement=function(e){this._hoverElement=e.element},Fa.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var $a={__init__:["mouseTracking"],mouseTracking:["type",Fa]};function Ha(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=F({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}function Wa(e,t,n){return t<e&&e<n}Ha.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"],Ha.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)Wa(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))},Ha.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ha.prototype.setOptions=function(e){this._opts=F({},this._opts,e)},Ha.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Qr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Ga={__depends__:[za,$a],__init__:["autoScroll"],autoScroll:["type",Ha]};function Va(e){this._commandStack=e.get("commandStack",!1)}Va.$inject=["injector"],Va.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Ua={__init__:["rules"],rules:["type",Va]},qa="djs-bendpoint",Ka="djs-segment-dragger";function Ya(e,t){var n=Ne("g");Te(n).add(qa),ve(e,n);var i=Ne("circle");_e(i,{cx:0,cy:0,r:4}),Te(i).add("djs-visual"),ve(n,i);var r=Ne("circle");return _e(r,{cx:0,cy:0,r:10}),Te(r).add("djs-hit"),ve(n,r),t&&Te(n).add(t),n}function Xa(e,t,n){var i=Ne("g"),r=or(t,n),o=ir(t,n);return ve(e,i),function(e,t,n){var i=Ne("g");ve(e,i);var r=Ne("rect");_e(r,{x:-7,y:-1.5,width:14,height:3}),Te(r).add("djs-visual"),ve(i,r);var o=Ne("rect");_e(o,{x:-10,y:-4.5,width:20,height:9}),Te(o).add("djs-hit"),ve(i,o),Yt(i,"h"===n?90:0)}(i,0,o),Te(i).add(Ka),Te(i).add("h"===o?"vertical":"horizontal"),Kt(i,r.x,r.y),i}var Za=e(function(e,t){var n;n=i,e.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),i=n.length,r=-1,o="",a=n.charCodeAt(0);++r<i;)0!=(t=n.charCodeAt(r))?o+=1<=t&&t<=31||127==t||0==r&&48<=t&&t<=57||1==r&&48<=t&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==r&&1==i&&45==t||!(128<=t||45==t||95==t||48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122)?"\\"+n.charAt(r):n.charAt(r):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t}(n)}),Qa=Math.round,Ja=Math.max;var es=10;function ts(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(er(i,t)<=es)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i=Ir(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,es),function(e){var n=[];return e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n}(e)),r=i[0],o=i[i.length-1];return r?r!==o?r.segment2!==o.segment2?{point:e[n=Ja(r.segment2,o.segment2)-1],bendpoint:!0,index:n}:{point:{x:Qa(r.x+o.x)/2,y:Qa(r.y+o.y)/2},index:r.segment2}:{point:{x:Qa(r.x),y:Qa(r.y)},index:r.segment2}:null}(e,t)}function ns(e,r,i,o,a){function s(e,t){return ts(e,function(e,t){var n,i=Qr(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(r,t))}function c(e,t){var n=t.waypoints,i=s(n,e);if(i)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(o=or(i=t[p-1],r=t[p]),a=ir(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(i,n,10)?o.start(e,t,i.index,!i.bendpoint):a.start(e,t,i.index),!0}function p(e,t,n){re.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function l(e,t){var n=r.getLayer("overlays"),i=de('.djs-bendpoints[data-element-id="'+Za(e.id)+'"]',n);return!i&&t&&(_e(i=Ne("g"),{"data-element-id":e.id}),Te(i).add("djs-bendpoints"),ve(n,i),p(i,"mousedown",e),p(i,"click",e),p(i,"dblclick",e)),i}function n(i,e){e.waypoints.forEach(function(e,t){var n=Ya(i);ve(i,n),Kt(n,e.x,e.y)}),Ya(i,"floating")}function u(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)ir(n=r[o-1],i=r[o])&&Xa(e,n,i)}function h(e){var t=l(e);return t||(n(t=l(e,!0),e),u(t,e)),t}function t(e){var t=l(e);t&&(function(e){k(me("."+Ka,e),function(e){Ae(e)})}(t),function(e){k(me("."+qa,e),function(e){Ae(e)})}(t),u(t,e),n(t,e))}e.on("connection.changed",function(e){t(e.element)}),e.on("connection.remove",function(e){var t=l(e.element);t&&Ae(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=h(n),e.add?Te(t).add(e.marker):Te(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i=e.element,r=i.waypoints;if(r){if(!(t=de(".floating",l(i,!0))))return;(n=s(r,e.originalEvent))&&Kt(t,n.point.x,n.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element;if(n.waypoints)return c(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&h(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(h(t),i.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){i.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=l(t);i&&_e(i,{"data-element-id":n})}}),this.addHandles=h,this.updateHandles=t,this.getBendpointsContainer=l}ns.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var is="connect-ok",rs="connect-not-ok",os="connect-hover",as="djs-updating",ss="connection.updateWaypoints",cs="connection.reconnectStart",ps="connection.reconnectEnd",ls=Math.round;function us(e,t,s,c,n,i,p){var a=e.get("connectionDocking",!1);function l(e){n.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,n,i){var r,o=t.waypoints,a=s.getGraphics(t);r={connection:t,bendpointIndex:n,insert:i,type:i||0!==n?i||n!==o.length-1?ss:ps:cs},c.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:a,context:r}})},t.on("bendpoint.move.start",function(e){var t=e.context,n=t.connection,i=n.waypoints,r=i.slice(),o=t.insert,a=t.bendpointIndex;t.originalWaypoints=i,o&&r.splice(a,0,null),n.waypoints=r,t.draggerGfx=Ya(s.getLayer("overlays")),Te(t.draggerGfx).add("djs-dragging"),s.addMarker(n,as)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){s.addMarker(e.hover,os);var n=t.allowed=i.allowed(t.type,t);n?(s.removeMarker(t.hover,rs),s.addMarker(t.hover,is),t.target=t.hover):!1===n&&(s.removeMarker(t.hover,is),s.addMarker(t.hover,rs),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(s.removeMarker(t,os),s.removeMarker(t,e.context.target?is:rs))}),t.on("bendpoint.move.move",function(e){var t,n,i=e.context,r=i.type,o=e.connection;o.waypoints[i.bendpointIndex]={x:e.x,y:e.y},a&&(i.hover&&(r===cs&&(t=i.hover),r===ps&&(n=i.hover)),o.waypoints=a.getCroppedWaypoints(o,t,n)),Kt(i.draggerGfx,e.x,e.y),l(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,n=t.hover,i=t.connection;Ae(t.draggerGfx),t.newWaypoints=i.waypoints.slice(),i.waypoints=t.originalWaypoints,s.removeMarker(i,as),n&&(s.removeMarker(n,is),s.removeMarker(n,rs))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],a=n.allowed;if(o.x=ls(o.x),o.y=ls(o.y),a&&n.type===cs)p.reconnectStart(n.connection,n.target,o);else if(a&&n.type===ps)p.reconnectEnd(n.connection,n.target,o);else{if(!1===a||n.type!==ss)return l(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},p.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===er(t,i=e[r+1])||tr(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){l(e)})}us.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var hs="connect-hover",ds="djs-updating";function ms(e,t,n){return fs(e,t,e[t]+n)}function fs(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function ys(e){return"x"===e?"y":"x"}function vs(e,t,n){var i,r;return e.original?e.original:(i=Hr(t),fs(e,r=ys(n),i[r]))}function gs(e,t,h,d,n,i,p){var r=e.get("connectionDocking",!1);function f(e,t){if(!r)return t;var n,i=e.waypoints;return e.waypoints=t,n=r.getCroppedWaypoints(e),e.waypoints=i,n}function y(e){n.update("connection",e.connection,e.connectionGfx)}function v(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return fs(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],ys(e.axis));Kt(e.draggerGfx,r.x,r.y)}this.start=function(e,t,n){var i,r,o,a=h.getGraphics(t),s=n-1,c=n,p=t.waypoints,l=p[s],u=p[c];(r=ir(l,u))&&(o="v"===r?"y":"x",0==s&&(l=vs(l,t.source,o)),c===p.length-1&&(u=vs(u,t.target,o)),i={connection:t,segmentStartIndex:s,segmentEndIndex:c,segmentStart:l,segmentEnd:u,axis:o},d.init(e,{x:(l.x+u.x)/2,y:(l.y+u.y)/2},"connectionSegment.move",{cursor:"x"==o?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:a,context:i}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,n=e.connection,i=h.getLayer("overlays");t.originalWaypoints=n.waypoints.slice(),t.draggerGfx=Xa(i,t.segmentStart,t.segmentEnd),Te(t.draggerGfx).add("djs-dragging"),h.addMarker(n,ds)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,s=i.segmentStart,c=i.segmentEnd,p=i.axis,l=i.originalWaypoints.slice(),u=ms(s,p,e["d"+p]),h=ms(c,p,e["d"+p]),d=l.length,m=0;l[o]=u,l[a]=h,o<2&&(t=Wr(r.source,u),1===o?"intersect"===t&&(l.shift(),l[0]=u,m--):"intersect"!==t&&(l.unshift(s),m++)),d-3<a&&(n=Wr(r.target,h),a===d-2?"intersect"===n&&(l.pop(),l[l.length-1]=h):"intersect"!==n&&l.push(c)),i.newWaypoints=r.waypoints=f(r,l),v(i,m,e),i.newSegmentStartIndex=o+m,y(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,h.addMarker(e.hover,hs)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&h.removeMarker(t,hs)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,n=t.connection;t.draggerGfx&&Ae(t.draggerGfx),h.removeMarker(n,ds)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,y(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,o=function(n,i){var r=0;return{waypoints:n.filter(function(e,t){return!tr(n[t-1],n[t+1],e)||(r=t<=i?r-1:r,!1)}),segmentOffset:r}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),a=f(n,o.waypoints),s=o.segmentOffset,c={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+s}};p.updateWaypoints(n,a,c)})}gs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var bs=Math.abs,xs=Math.round;function _s(e){function p(e,t){if(g(e)){for(var n=e.length;n--;)if(bs(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(e-10<i)return t-i+e}return t}function l(e){if(e.width)return{x:xs(e.width/2+e.x),y:xs(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var t,n,i=function(e){var t=e.snapPoints,n=e.connection,i=n.waypoints,r=e.segmentStart,o=e.segmentStartIndex,a=e.segmentEnd,s=e.segmentEndIndex,c=e.axis;if(t)return t;var p=[i[o-1],r,a,i[s+1]];return o<2&&p.unshift(l(n.source)),s>i.length-3&&p.unshift(l(n.target)),e.snapPoints=t={horizontal:[],vertical:[]},k(p,function(e){e&&(e=e.original||e,"y"===c&&t.horizontal.push(e.y),"x"===c&&t.vertical.push(e.x))}),t}(e.context),r=e.x,o=e.y;if(i){var a=r-(t=p(i.vertical,r)),s=o-(n=p(i.horizontal,o));F(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n})}}),e.on("bendpoint.move.move",1500,function(e){var t=e.context,n=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},k(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(t),i=t.target,r=i&&l(i),o=e.x,a=e.y;if(n){var s=o-p(r?n.vertical.concat([r.x]):n.vertical,o),c=a-p(r?n.horizontal.concat([r.y]):n.horizontal,a);F(e,{dx:e.dx-s,dy:e.dy-c,x:e.x-s,y:e.y-c})}})}_s.$inject=["eventBus"];var Es={__depends__:[za,Ua],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",ns],bendpointMove:["type",us],connectionSegmentMove:["type",gs],bendpointSnapping:["type",_s]},ws=Math.min,Ss=Math.max;function Cs(e){e.preventDefault()}function Ts(e){e.stopPropagation()}function Rs(e){this.container=e.container,this.parent=se('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=de("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=j(this.autoResize,this),this.handlePaste=j(this.handlePaste,this)}function As(e,t){this._eventBus=e,this._providers=[],this._textbox=new Rs({container:t.getContainer(),keyHandler:j(this._handleKey,this),resizeHandler:j(this._handleResize,this)})}Rs.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);F(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return F(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&F(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,re.bind(o,"keydown",this.keyHandler),re.bind(o,"mousedown",Ts),re.bind(o,"paste",this.handlePaste),i.autoResize&&re.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Rs.prototype.handlePaste=function(e){var n,t=this,i=this.options,r=this.style;if(e.preventDefault(),n=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,n)){var o,a,s=this.getSelection(),c=s.startContainer,p=s.endContainer,l=s.startOffset,u=s.endOffset,h=s.commonAncestorContainer,d=function(e){return[].slice.call(e)}(h.childNodes);if(function(e){return e.nodeType===Node.TEXT_NODE}(h)){var m=c.textContent;c.textContent=m.substring(0,l)+n+m.substring(u),o=c,a=l+n.length}else if(c===this.content&&p===this.content){var f=document.createTextNode(n);this.content.insertBefore(f,d[l]),a=(o=f).textContent.length}else{var y=d.indexOf(c),v=d.indexOf(p);d.forEach(function(e,t){t===y?e.textContent=c.textContent.substring(0,l)+n+p.textContent.substring(u):y<t&&t<=v&&fe(e)}),o=c,a=l+n.length}o&&void 0!==a&&setTimeout(function(){t.setSelection(o,a)})}if(i.autoResize){var g=this.autoResize(r);g&&this.resizeHandler(g)}},Rs.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Rs.prototype.resizable=function(){var i=this,r=this.parent,e=this.resizeHandle,o=parseInt(this.style.minWidth)||0,a=parseInt(this.style.minHeight)||0,s=parseInt(this.style.maxWidth)||1/0,c=parseInt(this.style.maxHeight)||1/0;if(!e){var p,l,u,h;e=this.resizeHandle=se('<div class="djs-direct-editing-resize-handle"></div>');var n=function(e){Cs(e),Ts(e);var t=ws(Ss(u+e.clientX-p,o),s),n=ws(Ss(h+e.clientY-l,a),c);r.style.width=t+"px",r.style.height=n+"px",i.resizeHandler({width:u,height:h,dx:e.clientX-p,dy:e.clientY-l})},d=function(e){Cs(e),Ts(e),re.unbind(document,"mousemove",n,!1),re.unbind(document,"mouseup",d,!1)};re.bind(e,"mousedown",function(e){Cs(e),Ts(e),p=e.clientX,l=e.clientY;var t=r.getBoundingClientRect();u=t.width,h=t.height,re.bind(document,"mousemove",n),re.bind(document,"mouseup",d)})}F(e.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),r.appendChild(e)},Rs.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),re.unbind(t,"keydown",this.keyHandler),re.unbind(t,"mousedown",Ts),re.unbind(t,"input",this.autoResize),re.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),fe(n)),fe(e)},Rs.prototype.getValue=function(){return this.content.innerText.trim()},Rs.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Rs.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},As.$inject=["eventBus","canvas"],As.prototype.registerProvider=function(e){this._providers.push(e)},As.prototype.isActive=function(){return!!this._active},As.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},As.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},As.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},As.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},As.prototype.getValue=function(){return this._textbox.getValue()},As.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},As.prototype._handleResize=function(e){this._fire("resize",e)},As.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=R(this._providers,function(e){return(n=e.activate(t))?e:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:t,context:n,provider:e},n.options&&n.options.resizable&&(this.resizable=!0),this._fire("activate")),!!n};var Ps={__depends__:[io],__init__:["directEditing"],directEditing:["type",As]};function ks(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:i},this._current=null,this._init()}ks.$inject=["config.contextPad","eventBus","overlays"],ks.prototype._init=function(){var e=this._eventBus,i=this;e.on("selection.changed",function(e){var t=e.newSelection;1===t.length?i.open(t[0]):i.close()}),e.on("elements.delete",function(e){k(e.elements,function(e){i.isOpen(e)&&i.close()})}),e.on("element.changed",function(e){var t=e.element,n=i._current;n&&n.element===t&&i.open(t,!0)})},ks.prototype.registerProvider=function(e){this._providers.push(e)},ks.prototype.getEntries=function(t){var n={};return k(this._providers,function(e){k(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},ks.prototype.trigger=function(e,t,n){var i,r,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(i=a[H(s,"data-action")].action,r=t.originalEvent||t,u(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},ks.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ks.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),o=n.html;k(t,function(e,t){var n,i=e.group||"default",r=se(e.html||'<div class="entry" draggable="true"></div>');H(r,"data-action",t),(n=de("[data-group="+i+"]",o))||(n=se('<div class="group" data-group="'+i+'"></div>'),o.appendChild(n)),n.appendChild(r),e.className&&function(e,t){var n=q(e);(g(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})}(r,e.className),e.title&&H(r,"title",e.title),e.imageUrl&&r.appendChild(se('<img src="'+e.imageUrl+'">'))}),q(o).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},ks.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=se('<div class="djs-context-pad"></div>'),r=F({html:i},this._overlaysConfig);ae.bind(i,".entry","click",function(e){t.trigger("click",e)}),ae.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),re.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",r);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},ks.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ks.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Ms={__depends__:[io,go],contextPad:["type",ks]},Ds="connect-ok",Ns="connect-not-ok";function Bs(e,r,p,n,o,s){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n=e.context,i=n.source,r=n.target;_e(n.visual,{points:[(t=function(e,t,n,i){var r=s.getShapePath(n),o=i&&s.getShapePath(i),a=s.getConnectionPath({waypoints:[e,t]});return[e=Gr(r,a,!0)||e,t=i&&Gr(o,a,!1)||t]}(n.sourcePosition,{x:e.x,y:e.y},i,r))[0].x,t[0].y,t[1].x,t[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,r=e.hover;null!==(t=n.canExecute=l(i,r))&&(n.target=r,o.addMarker(r,t?Ds:Ns))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&o.removeMarker(t.target,t.canExecute?Ds:Ns),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;_e(t=Ne("polyline"),{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),ve(o.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,n=t.source,i=t.sourcePosition,r=t.target,o={x:e.x,y:e.y},a=t.canExecute||l(n,r);if(!a)return!1;var s=null,c={connectionStart:i,connectionEnd:o};"object"==typeof a&&(s=a),p.connect(n,r,s,c)}),this.start=function(e,t,n,i){"object"!=typeof n&&(i=n,n=Hr(t)),r.init(e,"connect",{autoActivate:i,data:{shape:t,context:{source:t,sourcePosition:n}}})}}Bs.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Os={__depends__:[lo,Ua,za],connect:["type",Bs]},Ls="drop-ok",Is="drop-not-ok",js="attach-ok",zs="new-parent";function Fs(e,i,c,p,o,a,s){function l(t,n){[js,Ls,Is,zs].forEach(function(e){e===n?o.addMarker(t,e):o.removeMarker(t,e)})}e.on("create.move",function(e){var t,n=e.context,i=e.hover,r=n.shape,o=n.source,a={x:e.x,y:e.y};t=n.canExecute=i&&function(e,t,n,i){if(!t)return!1;var r,o,a,s={source:n,shape:e,target:t,position:i};return(o=c.allowed("shape.attach",s))||(r=c.allowed("shape.create",s)),(r||o)&&(a=n&&c.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:o}})),!(!r&&!o)&&{attach:o,connect:a}}(r,i,o,a),i&&null!==t&&(n.target=i,t&&t.attach?l(i,js):l(i,t?zs:Is))}),e.on("create.move",750,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;_e(t=Ne("g"),a.cls("djs-drag-group",["no-events"])),ve(o.getDefaultLayer(),t),Te(n=Ne("g")).add("djs-dragger"),ve(t,n),Kt(n,e.width/-2,e.height/-2);var r=Ne("g");return Te(r).add("djs-visual"),ve(n,r),i=r,s.drawShape(i,e),t}(n)),Kt(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&l(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,i=t.shape,r=t.target,o=t.canExecute,a=o&&o.attach,s=o&&o.connect,c={x:e.x,y:e.y};if(!o)return!1;i=s?p.appendShape(n,i,c,r,{attach:a,connection:!0===s?{}:s}):p.createShape(i,c,r,{attach:a}),t.shape=i}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),this.start=function(e,t,n){i.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:{shape:t,source:n}}})}}Fs.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var $s={__depends__:[za,lo,Ua],create:["type",Fs]},Hs="data-id";function Ws(e,t,n){var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}Ws.$inject=["config.popupMenu","eventBus","canvas"],Ws.prototype.registerProvider=function(e,t){this._providers[e]=t},Ws.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._providers[t],i=n.getEntries(e),r=n.getHeaderEntries&&n.getHeaderEntries(e),o=0<i.length,a=r&&0<r.length;return!o&&!a},Ws.prototype.open=function(e,t,n){var i=this._providers[t];if(!e)throw new Error("Element is missing");if(!i)throw new Error("Provider is not registered: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close(),this._emit("open");var r=this._current={provider:i,className:t,element:e,position:n};i.getHeaderEntries&&(r.headerEntries=i.getHeaderEntries(e)),r.entries=i.getEntries(e),r.container=this._createContainer();var o=r.headerEntries||[],a=r.entries||[];o.length&&r.container.appendChild(this._createEntries(r.headerEntries,"djs-popup-header")),a.length&&r.container.appendChild(this._createEntries(r.entries,"djs-popup-body"));var s=this._canvas.getContainer();this._attachContainer(r.container,s,n.cursor)},Ws.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindHandlers(),fe(this._current.container),this._current.container=null)},Ws.prototype.isOpen=function(){return!!this._current.container},Ws.prototype.trigger=function(e){e.preventDefault();var t=H(e.delegateTarget||e.target,Hs),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},Ws.prototype._getEntry=function(e){var t=D({id:e}),n=R(this._current.entries,t)||R(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},Ws.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},Ws.prototype._createContainer=function(){var e=se('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return F(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),q(e).add(n),e},Ws.prototype._attachContainer=function(e,t,n){var i=this;ae.bind(e,".entry","click",function(e){i.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},Ws.prototype._updateScale=function(e){var t,n,i=this._canvas.zoom(),r=this._config.scale,o=i;!0!==r&&(n=!1===r?t=1:(t=r.min,r.max),c(t)&&i<t&&(o=t),c(n)&&n<i&&(o=n)),function(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}(e,"scale("+o+")")},Ws.prototype._assureIsInbounds=function(e,t){var n,i,r=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,c=e.scrollHeight,p={},l=t.x-r.left,u=t.y-r.top;o+s>r.width&&(p.x=!0),a+c>r.height&&(p.y=!0),p.x&&p.y?(n=l-s+"px",i=u-c+"px"):p.x?(n=l-s+"px",i=u+"px"):p.y&&u<c?(n=l+"px",i="10px"):p.y&&(n=l+"px",i=u-c+"px"),F(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},Ws.prototype._createEntries=function(e,t){var n=se("<div>"),i=this;return q(n).add(t),k(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},Ws.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=se("<div>"),n=q(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),H(t,Hs,e.id),e.label){var i=se("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(se('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},Ws.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},Ws.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var Gs={__init__:["popupMenu"],popupMenu:["type",Ws]},Vs=Math.round;function Us(e){this._modeling=e}Us.$inject=["modeling"],Us.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Vs(e.x+(t.width||e.width)/2),t.y=Vs(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var qs={__init__:["replace"],replace:["type",Us]},Ks=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"];function Ys(e,t){var n=[];return k(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n}function Xs(e,t){this._eventBus=e,this._bpmnFactory=t}Xs.prototype.clone=function(a,s,e){var c=this,p={newElement:s,hasNestedProperty:!1};return k(e=M(e,function(e){return"bpmn:extensionElements"===e}),function(e){var t,n,i=a.get(e),r=s.get(e),o=s.$model.getPropertyDescriptor(s,e);r!==i&&(o&&(o.isId||o.isReference)||(!function(t,e){return x(e,function(e){return typeof t===e})}(i,["boolean","string","number"])&&null!==i?g(i)?k(i,function(e){var t;p.refTopLevelProperty=e,t=c._deepClone(e,p),p.hasNestedProperty&&(t.$parent=s,r.push(t)),p.hasNestedProperty=!1}):(n=e.replace(/bpmn:/,""),p.refTopLevelProperty=i,t=c._deepClone(i,p),p.hasNestedProperty&&(t.$parent=s).set(n,t),p.hasNestedProperty=!1):s.set(e,i)))}),s},Xs.prototype._deepClone=function(r,o){var a=this,s=this._eventBus,c=this._bpmnFactory.create(r.$type),e=A(Object.keys(r),function(e){var t=c.$model.getPropertyDescriptor(c,e);return(!t||!t.isId&&!t.isReference)&&(-1===Ks.indexOf(e)&&"$type"!==e)});return e.length||(o.hasNestedProperty=!0),k(e,function(i){void 0!==r[i]&&(r[i].$type||g(r[i]))?g(r[i])?(c[i]=[],k(r[i],function(e){var t,n=r.$model.getTypeDescriptor(e.$type);if(n){if(!s.fire("property.clone",{newElement:o.newElement,refTopLevelProperty:o.refTopLevelProperty,propertyDescriptor:n})&&"bpmn:ExtensionElements"===r.$type&&n.meta&&n.meta.allowedIn&&!function(e,t){var n=e.meta.allowedIn;return 1===n.length&&"*"===n[0]||-1!==n.indexOf(t)}(n,o.newElement.$type))return!1;((t=a._deepClone(e,o)).$parent=c)[i]||(c[i]=[]),o.hasNestedProperty=!0,c[i].push(t)}})):r[i].$type&&(c[i]=a._deepClone(r[i],o),c[i]&&(o.hasNestedProperty=!0,c[i].$parent=c)):(o.hasNestedProperty=!0,c[i]=r[i])}),c};var Zs=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Qs(p,l,u,h,d,e){var m=new Xs(e,p);this.replaceElement=function(n,i,e){e=e||{};var t=i.type,r=n.businessObject;if(Js(r)&&"bpmn:SubProcess"===t&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Ci(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(n,i))return d.toggleCollapse(n),n;var o=p.create(t),a={type:t,businessObject:o},s=function(e,t){return e.filter(function(e){return-1!==t.indexOf(e)})}(Ys(r.$descriptor),Ys(o.$descriptor,!0));F(o,$(i,Zs));var c=A(s,function(e){var t=e.replace(/bpmn:/,"");return"eventDefinitions"===t?ec(n,i.eventDefinitionType):"loopCharacteristics"===t?!Ti(o):!(e in o||"processRef"===t&&!1===i.isExpanded||"triggeredByEvent"===t||-1!==Ks.indexOf(t))});return o=m.clone(r,o,c),i.eventDefinitionType&&(ec(o,i.eventDefinitionType)||(a.eventDefinitionType=i.eventDefinitionType)),wi(r,"bpmn:Activity")&&(Js(r)?a.isExpanded=Ci(r):i&&f(i,"isExpanded")&&(a.isExpanded=i.isExpanded),Ci(r)&&!wi(r,"bpmn:Task")&&a.isExpanded&&(a.width=n.width,a.height=n.height)),Js(r)&&!Js(o)&&(e.moveChildren=!1),wi(r,"bpmn:Participant")&&(!0===i.isExpanded?o.processRef=p.create("bpmn:Process"):e.moveChildren=!1,a.width=n.width,a.height=l._getDefaultSize(o).height),o.name=r.name,da(r,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&da(o,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(o.default=r.default),("fill"in r.di||"stroke"in r.di)&&F(a,{colors:$(r.di,["fill","stroke"])}),a=u.replaceElement(n,a,e),!1!==e.select&&h.select(a),a}}function Js(e){return wi(e,"bpmn:SubProcess")}function ec(e,t){var n=Si(e);return t&&n.get("eventDefinitions").some(function(e){return wi(e,t)})}Qs.$inject=["bpmnFactory","elementFactory","replace","selection","modeling","eventBus"];var tc={__depends__:[lo,qs],bpmnReplace:["type",Qs]};function nc(c){return function(e){var t=e.target,n=Si(c),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=n.triggeredByEvent===t.triggeredByEvent,s=void 0===t.isExpanded||t.isExpanded===Ci(n);return!(r&&o&&a&&s)}}var ic=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],rc=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],oc=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],ac=[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],sc=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],cc=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],pc=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}}],lc=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],uc=[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],hc=[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],dc=[{label:"Sequence Flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default Flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional Flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],mc=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function fc(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._bpmnReplace=i,this._rules=r,this._translate=o,this.register()}fc.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],fc.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},fc.prototype.getEntries=function(r){var e,o=r.businessObject;if(!this._rules.allowed("shape.replace",{element:r}))return[];var a=nc(r);return wi(o,"bpmn:StartEvent")&&!Ti(o.$parent)?(e=A(ic,a),this._createEntries(r,e)):wi(o,"bpmn:Participant")?(e=A(mc,function(e){return Ci(o)!==e.target.isExpanded}),this._createEntries(r,e)):wi(o,"bpmn:StartEvent")&&Ti(o.$parent)?(e=A(hc,function(e){var t=!1!==e.target.isInterrupting,n=Si(r).isInterrupting===t;return a(e)||!a(e)&&!n}),this._createEntries(r,e)):wi(o,"bpmn:EndEvent")?(e=A(oc,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!wi(o.$parent,"bpmn:Transaction"))&&a(e)}),this._createEntries(r,e)):wi(o,"bpmn:BoundaryEvent")?(e=A(uc,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!wi(o.attachedToRef,"bpmn:Transaction"))return!1;var n=!1!==t.cancelActivity,i=o.cancelActivity==n;return a(e)||!a(e)&&!i}),this._createEntries(r,e)):wi(o,"bpmn:IntermediateCatchEvent")||wi(o,"bpmn:IntermediateThrowEvent")?(e=A(rc,a),this._createEntries(r,e)):wi(o,"bpmn:Gateway")?(e=A(ac,a),this._createEntries(r,e)):wi(o,"bpmn:Transaction")?(e=A(cc,a),this._createEntries(r,e)):Ti(o)&&Ci(o)?(e=A(pc,a),this._createEntries(r,e)):wi(o,"bpmn:SubProcess")&&Ci(o)?(e=A(sc,a),this._createEntries(r,e)):wi(o,"bpmn:AdHocSubProcess")&&!Ci(o)?(e=A(lc,function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return nc(r)&&(!n||i)}),this._createEntries(r,e)):wi(o,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(r,dc):wi(o,"bpmn:FlowNode")?(e=A(lc,a),wi(o,"bpmn:SubProcess")&&!Ci(o)&&(e=A(e,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(r,e)):[]},fc.prototype.getHeaderEntries=function(e){var t=[];return wi(e,"bpmn:Activity")&&!Ti(e)&&(t=t.concat(this._getLoopEntries(e))),!wi(e,"bpmn:SubProcess")||wi(e,"bpmn:Transaction")||Ti(e)||t.push(this._getAdHocEntry(e)),t},fc.prototype._createEntries=function(n,e){var i=[],r=this;return k(e,function(e){var t=r._createMenuEntry(e,n);i.push(t)}),i},fc.prototype._createSequenceFlowEntries=function(t,e){var n=Si(t),i=[],r=this._modeling,o=this._moddle,a=this;return k(e,function(e){switch(e.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&wi(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(e,t,function(){var e=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(t,{conditionExpression:e})}));break;default:if(wi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t,{conditionExpression:void 0})}));if((wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:void 0})}))}}),i},fc.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:i(e.label),className:e.className,id:e.actionName,action:n}},fc.prototype._getLoopEntries=function(i){var r=this,e=this._translate;function t(e,t){var n;t.active?n=void 0:(n=r._moddle.create(t.options.loopCharacteristics),t.options.isSequential&&(n.isSequential=t.options.isSequential)),r._modeling.updateProperties(i,{loopCharacteristics:n})}var n,o,a,s=Si(i).loopCharacteristics;return s&&(n=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:e("Parallel Multi Instance"),active:a,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:e("Sequential Multi Instance"),active:n,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:e("Loop"),active:o,action:t,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},fc.prototype._getAdHocEntry=function(n){var e=this._translate,i=wi(Si(n),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:e("Ad-hoc"),active:i,action:function(e,t){return r(n,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var yc={__depends__:[Gs,tc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",fc]},vc=Math.max,gc=Math.min,bc=20;function xc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function _c(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return l(r)&&(i=(/top|left/.test(e)?gc:vc)(i,r)),l(o)&&(i=(/top|left/.test(e)?vc:gc)(i,o)),i}function Ec(e,t){return void 0!==e?e:bc}function wc(e){return!e.waypoints&&"label"!==e.type}function Sc(e,t){var n;if((n=void 0===e.length?A(e.children,wc):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=Ec(t.left),i=Ec(t.right),r=Ec(t.top),o=Ec(t.bottom)):n=i=r=o=Ec(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(ft(n),t)}var Cc=Math.abs;var Tc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function Rc(e,t){return t=t||[],e.children.filter(function(e){wi(e,"bpmn:Lane")&&(Rc(e,t),t.push(e))}),t}function Ac(e){return e.children.filter(function(e){return wi(e,"bpmn:Lane")})}function Pc(e){return function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(da(e,t))return e;return null}(e,Tc)||e}function kc(a,e){var t=Pc(a),n=Rc(t,wi(t,"bpmn:Process")?[]:[t]),s=Fr(a),c=Fr(e),p=function(e,t){return xc(Fr(t),Fr(e))}(a,e),l=[];return n.forEach(function(e){if(e!==a){var t=0,n=p.right,i=0,r=p.left,o=Fr(e);p.top&&(Cc(o.bottom-s.top)<10&&(i=c.top-o.bottom),Cc(o.top-s.top)<5&&(t=c.top-o.top)),p.bottom&&(Cc(o.top-s.bottom)<10&&(t=c.bottom-o.top),Cc(o.bottom-s.bottom)<5&&(i=c.bottom-o.bottom)),(t||n||i||r)&&l.push({shape:e,newBounds:function(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}(e,{top:t,right:n,bottom:i,left:r})})}}),l}function Mc(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(e){var t=e.context.shape;if(eo(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function Dc(e,t,n){var i=e.$instanceOf(t),r=!1;return k(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}Mc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],Mc.prototype.getContextPadEntries=function(t){var a=this._contextPad,i=this._modeling,o=this._elementFactory,n=this._connect,s=this._create,r=this._popupMenu,c=this._canvas,e=this._rules,p=this._autoPlace,l=this._translate,u={};if("label"===t.type)return u;var h=t.businessObject;function d(e,t){n.start(e,t)}function m(i,e,t,r){function n(e,t){var n=o.createShape(F({type:i},r));s.start(e,n,t)}return"string"!=typeof t&&(r=t,t=l("Append {type}",{type:i.replace(/^bpmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:p?function(e,t){var n=o.createShape(F({type:i},r));p.append(t,n)}:n}}}function f(n){return function(e,t){i.splitLane(t,n),a.open(t,!0)}}if(da(h,["bpmn:Lane","bpmn:Participant"])&&Ci(h)){var y=Ac(t);F(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add Lane above"),action:{click:function(e,t){i.addLane(t,"top")}}}}),y.length<2&&(120<=t.height&&F(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two Lanes"),action:{click:f(2)}}}),180<=t.height&&F(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three Lanes"),action:{click:f(3)}}})),F(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add Lane below"),action:{click:function(e,t){i.addLane(t,"bottom")}}}})}wi(h,"bpmn:FlowNode")&&(wi(h,"bpmn:EventBasedGateway")?F(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Dc(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?F(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):wi(h,"bpmn:EndEvent")||h.isForCompensation||Dc(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Ti(h)||F(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append Intermediate/Boundary Event"))})),r.isEmpty(t,"bpmn-replace")||F(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,t){var n=F(function(e){var t=c.getContainer(),n=a.getPad(e).html,i=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=r.top-i.top;return{x:r.left-i.left,y:o+r.height+5}}(t),{cursor:{x:e.x,y:e.y}});r.open(t,"bpmn-replace",n)}}}}),da(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using "+(h.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:d,dragstart:d}}}),da(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using DataInputAssociation"),action:{click:d,dragstart:d}}});var v=e.allowed("elements.delete",{elements:[t]});return g(v)&&(v=v[0]===t),v&&F(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Remove"),action:{click:function(e){i.removeElements([t])}}}}),u};var Nc={__depends__:[Ps,Ms,lo,Os,$s,yc],__init__:["contextPadProvider"],contextPadProvider:["type",Mc]};function Bc(){}Bc.prototype.get=function(){return this._data},Bc.prototype.set=function(e){this._data=e},Bc.prototype.clear=function(){var e=this._data;return delete this._data,e},Bc.prototype.isEmpty=function(){return!this._data};var Oc={clipboard:["type",Bc]};function Lc(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,n){return n.priority=1,n.id=e.id,e.parent&&(n.parent=e.parent.id),e.labelTarget&&(n.priority=4,n.labelTarget=e.labelTarget.id),e.host&&(n.priority=2,n.host=e.host.id),"number"==typeof e.x&&(n.x=e.x,n.y=e.y),e.width&&(n.width=e.width,n.height=e.height),e.waypoints&&(n.priority=3,n.waypoints=[],k(e.waypoints,function(e){var t={x:e.x,y:e.y};e.original&&(t.original={x:e.original.x,y:e.original.y}),n.waypoints.push(t)})),e.source&&e.target&&(n.source=e.source.id,n.target=e.target.id),n})}Lc.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],Lc.prototype.copy=function(e){var t,r,n=this._clipboard;if(g(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),r=this._bbox=Ho(ft(t.allShapes)),delete t.allShapes,k(t,function(i){k(i,function(e){var n,t;e.labelTarget?(t=R(i,D({id:e.labelTarget})),n=t.waypoints?Wo(e,t.waypoints[0]):Wo(e,t)):3===e.priority?(n=[],k(e.waypoints,function(e){var t=Wo(e,r);n.push(t)})):n=Wo(e,r),e.delta=n})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?n.clear():n.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},Lc.prototype.paste=function(e){var t,n=this._clipboard,i=this._modeling,r=this._eventBus,o=this._rules,a=n.get(),s=e.element,c=e.point;n.isEmpty()||(t=v(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)||(e[i]=t),e},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},Lc.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Wo(t,t.labelTarget):(3===t.priority?(i=[],k(t.waypoints,function(e){var t=Wo(e,n);i.push(t)})):i=Wo(t,n),i)},Lc.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=R(e,D({id:t.source.id})),i=R(e,D({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!R(e,D({id:t.labelTarget.id})))},Lc.prototype.registerDescriptor=function(e){if("function"!=typeof e)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(e))throw new Error("this descriptor is already registered");this._descriptors.push(e)},Lc.prototype._executeDescriptors=function(t){return t.descriptor||(t.descriptor={}),k(this._descriptors,function(e){t.descriptor=e(t.element,t.descriptor)}),t},Lc.prototype.createTree=function(e){var n,i=this._rules,r=this,o={},a=[],t=function(e){var n={},i=[],t=[],r=[];return k(e,function(e){var t=e.parent;n[t.id]||(n[t.id]=[]),-1===i.indexOf(t.id)&&i.push(t.id),n[t.id].push(e)}),k(i,function(e){k(n[e],function(e){n[e.id]&&r.push(e.id)})}),k(i,function(e){-1===r.indexOf(e)&&(t=t.concat(n[e]))}),t}(e);function s(e){var t=m(a,D({element:e.element}));if(-1===t)return a.push(e);a[t].depth<e.depth&&(a.splice(t,1),a.push(e))}return o.allShapes=[],dt(t,function(e,t,n){var i=e.children;if(!e.labelTarget)return k(e.labels,function(e){s({element:e,depth:n})}),k([e.attachers,e.incoming,e.outgoing],function(e){e&&e.length&&k(e,function(e){k(e.labels,function(e){s({element:e,depth:n})}),s({element:e,depth:n})})}),s({element:e,depth:n}),i||void 0}),a=M(a=_(a,function(e){return r._executeDescriptors(e)}),function(e){return e.descriptor.priority}),n=_(a,function(e){return e.element}),k(a,function(e){var t=e.depth;r.hasRelations(o.allShapes,e.element)&&(!function(e,t){return i.allowed("element.copy",{collection:e,element:t})}(n,e.element)||(o.allShapes.push(e.element),o[t]||(o[t]=[]),o[t].push(e.descriptor)))}),o};var Ic={__depends__:[Oc,Ua,$a],__init__:["copyPaste"],copyPaste:["type",Lc]};function jc(t,n,e){k(e,function(e){void 0!==n[e]&&(t[e]=n[e])})}function zc(u,e,t,n,h,d){var m=new Xs(e,u);t.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Si(e),i={};return t.type=e.type,jc(t,n.di,["isExpanded"]),jc(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type||(jc(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id)),t}),e.on("element.paste",function(e){var t,n,i,r,o=e.descriptor,a=e.createdElements,s=o.parent,c=h.getRootElement(),p=o.oldBusinessObject;t=u.create(p.$type);var l=Ys(p.$descriptor);l=A(l,function(e){return-1===Ks.indexOf(e.replace(/bpmn:/,""))}),o.businessObject=m.clone(p,t,l),"label"!==o.type&&(wi(s,"bpmn:Process")&&(o.parent=wi(c,"bpmn:Collaboration")?c:s),"bpmn:DataOutputAssociation"!==o.type&&"bpmn:DataInputAssociation"!==o.type&&"bpmn:MessageFlow"!==o.type||(o.parent=c),wi(s,"bpmn:Lane")&&(o.parent=s.parent),o.waypoints&&(n=a[o.source],i=a[o.target],n&&i&&(n=n.element,i=i.element),(r=d.canConnect(n,i))&&(o.type=r.type)),delete t.id,u._ensureId(t),"bpmn:Participant"===o.type&&o.processRef&&(o.processRef=t.processRef=u.create("bpmn:Process")),jc(t,o,["isExpanded","triggeredByEvent"]),function(t,e){k(e,function(e){t[e]&&delete t[e]})}(o,["triggeredByEvent"]))})}zc.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Fc={__depends__:[Ic],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",zc]},$c={horizontal:["x","width"],vertical:["y","height"]};function Hc(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return k(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),A(e,function(e){return e[n]<i+50})})}Hc.$inject=["modeling"],Hc.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Hc.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Hc.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(e){r=e(r,n,i)}),r):e},Hc.prototype._createGroups=function(e){var o=[],a=this,s=this._axis,c=this._dimension;if(!s)throw new Error('must have a defined "axis" and "dimension"');return k(M(e,s),function(e,t){var n,i=a._findRange(e,s,c),r=o[o.length-1];r&&a._hasIntersection(r.range,i)?o[o.length-1].elements.push(e):(n={range:i,elements:[e]},o.push(n))}),o},Hc.prototype._setOrientation=function(e){var t=$c[e];this._axis=t[0],this._dimension=t[1]},Hc.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Hc.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Wc={__init__:["distributeElements"],distributeElements:["type",Hc]};function Gc(e){e.registerFilter(function(e){return A(e,function(e){var t=da(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}Gc.$inject=["distributeElements"];var Vc={__depends__:[Wc],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Gc]},Uc="is not a registered action";function qc(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function Kc(e,t){return new Error(e+" "+t)}qc.$inject=["eventBus","injector"],qc.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),i=e.get("modeling",!1),r=e.get("selection",!1),n=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("mouseTracking",!1),p=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var e=r.get();o.copy(e)}),c&&o&&this.register("paste",function(){var e=c.getHoverContext();o.paste(e)}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),i&&r&&s&&this.register("removeSelection",function(){var e=r.get();if(e.length){var t,n=s.allowed("elements.delete",{elements:e});!1===n||(t=g(n)?n:e).length&&i.removeElements(t.slice())}}),p&&this.register("moveCanvas",function(e){p.moveCanvas(e)}),l&&this.register("moveSelection",function(e){l.moveSelection(e.direction,e.accelerated)})},qc.prototype.trigger=function(e,t){if(!this._actions[e])throw Kc(e,Uc);return this._actions[e](t)},qc.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);k(e,function(e,t){n._registerAction(t,e)})},qc.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Kc(e,"is already registered");this._actions[e]=t},qc.prototype.unregister=function(e){if(!this.isRegistered(e))throw Kc(e,Uc);this._actions[e]=void 0},qc.prototype.getActions=function(){return Object.keys(this._actions)},qc.prototype.isRegistered=function(e){return!!this._actions[e]};var Yc={__init__:["editorActions"],editorActions:["type",qc]};function Xc(e){e.invoke(qc,this)}t(Xc,qc),Xc.$inject=["injector"],Xc.prototype._registerDefaultActions=function(e){qc.prototype._registerDefaultActions.call(this,e);var i=e.get("canvas",!1),r=e.get("elementRegistry",!1),o=e.get("selection",!1),t=e.get("spaceTool",!1),n=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1);i&&r&&o&&this._registerAction("selectElements",function(){var t=i.getRootElement(),e=r.filter(function(e){return e!==t});return o.select(e),e}),t&&this._registerAction("spaceTool",function(){t.toggle()}),n&&this._registerAction("lassoTool",function(){n.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),o&&c&&this._registerAction("distributeElements",function(e){var t=o.get(),n=e.type;t.length&&c.trigger(t,n)}),o&&p&&this._registerAction("alignElements",function(e){var t=o.get(),n=[],i=e.type;t.length&&(n=A(t,function(e){return!wi(e,"bpmn:Lane")}),p.trigger(n,i))}),o&&h&&this._registerAction("setColor",function(e){var t=o.get();t.length&&h.setColor(t,e)}),o&&l&&this._registerAction("directEditing",function(){var e=o.get();e.length&&l.activate(e[0])}),u&&this._registerAction("find",function(){u.toggle()}),i&&h&&this._registerAction("moveToOrigin",function(){var e,t,n=i.getRootElement();e=ft(t=wi(n,"bpmn:Collaboration")?r.filter(function(e){return wi(e.parent,"bpmn:Collaboration")}):r.filter(function(e){return e!==n&&!wi(e.parent,"bpmn:SubProcess")})),h.moveElements(t,{x:-e.x,y:-e.y},n)})};var Zc={__depends__:[Yc],editorActions:["type",Xc]};function Qc(e){e.invoke(Do,this)}t(Qc,Do),Qc.$inject=["injector"],Qc.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}Do.prototype.registerBindings.call(this,n,i),e("selectElements",function(e){var t=e.keyEvent;if(n.isKey(["a","A"],t)&&n.isCmd(t))return i.trigger("selectElements"),!0}),e("find",function(e){var t=e.keyEvent;if(n.isKey(["f","F"],t)&&n.isCmd(t))return i.trigger("find"),!0}),e("spaceTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["s","S"],t)?(i.trigger("spaceTool"),!0):void 0}),e("lassoTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["l","L"],t)?(i.trigger("lassoTool"),!0):void 0}),e("handTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["h","H"],t)?(i.trigger("handTool"),!0):void 0}),e("globalConnectTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["c","C"],t)?(i.trigger("globalConnectTool"),!0):void 0}),e("directEditing",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["e","E"],t)?(i.trigger("directEditing"),!0):void 0})};var Jc={__depends__:[No],__init__:["keyboardBindings"],keyboardBindings:["type",Qc]},ep={moveSpeed:1,moveSpeedAccelerated:10},tp={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},np={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function ip(e,r,o,a){var s=this;this._config=F({},ep,e||{}),r.addListener(1500,function(e){var t=e.keyEvent,n=tp[t.key];if(n&&!r.isCmd(t)){var i=r.isShift(t);return s.moveSelection(n,i),!0}}),this.moveSelection=function(e,t){var n=a.get();if(n.length){var i=this._config[t?"moveSpeedAccelerated":"moveSpeed"],r=np[e](i);o.moveElements(n,r)}}}ip.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var rp={__depends__:[No,lo],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ip]};function op(n,i,r,o){n.on("element.changed",function(e){var t=e.element;!t.parent&&t!==i.getRootElement()||(e.gfx=r.getGraphics(t)),e.gfx&&n.fire(yt(t)+".changed",e)}),n.on("elements.changed",function(e){var t=e.elements;t.forEach(function(e){n.fire("element.changed",{element:e})}),o.updateContainments(t)}),n.on("shape.changed",function(e){o.update("shape",e.element,e.gfx)}),n.on("connection.changed",function(e){o.update("connection",e.element,e.gfx)})}op.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ap={__init__:["changeSupport"],changeSupport:["type",op]};function sp(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}sp.$inject=["elementRegistry","canvas","styles"],sp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sp.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=function(e){return e.cloneNode(!0)}(n),r=n.getBoundingClientRect();return function(e){return e.waypoints}(e)&&function t(e){e.children&&k(e.children,function(e){t(e)});e.style.markerStart="";e.style.markerEnd=""}(i),_e(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ve(t,i),i},sp.prototype.addFrame=function(e,t){var n=Ne("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ve(t,n),n};var cp={__init__:["previewSupport"],previewSupport:["type",sp]};function pp(e,t,r,n){this._dragging=n,this._rules=t;var a=this;function i(e,t){var n,i=e.shape,r=e.direction,o=e.resizeConstraints;n=function(e,t,n){var i=n.x,r=n.y;switch(t){case"nw":return{x:e.x+i,y:e.y+r,width:e.width-i,height:e.height-r};case"sw":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height+r};case"ne":return{x:e.x,y:e.y+r,width:e.width+i,height:e.height-r};case"se":return{x:e.x,y:e.y,width:e.width+i,height:e.height+r};default:throw new Error("unrecognized direction: "+t)}}(i,r,e.delta=t),e.newBounds=function(e,t){if(!t)return e;var n=Fr(e);return $r({top:_c("top",n,t),right:_c("right",n,t),bottom:_c("bottom",n,t),left:_c("left",n,t)})}(n,o),e.canExecute=a.canResize(e)}e.on("resize.start",function(e){!function(e){var t=e.resizeConstraints,n=e.minBounds;void 0===t&&(void 0===n&&(n=a.computeMinResizeBox(e)),e.resizeConstraints={min:Fr(n)})}(e.context)}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};i(e.context,t)}),e.on("resize.end",function(e){!function(e){var t=e.shape,n=e.canExecute,i=e.newBounds;n&&(i=jr(i),r.resizeShape(t,i))}(e.context)})}pp.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},pp.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=F({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");var a={x:/w/.test(r)?t.x:t.x+t.width,y:/n/.test(r)?t.y:t.y+t.height};o.init(e,a,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},pp.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=Fr(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Fr(i):o;return $r({top:gc(o.top,a.top),left:gc(o.left,a.left),bottom:vc(o.bottom,a.bottom),right:vc(o.right,a.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Sc(t,e.childrenBoxPadding))},pp.$inject=["eventBus","rules","modeling","dragging"];var lp="djs-resizing",up="resize-not-ok";function hp(e,r,o){e.on("resize.move",500,function(e){!function(e){var t=e.shape,n=e.newBounds,i=e.frame;i||(i=e.frame=o.addFrame(t,r.getDefaultLayer()),r.addMarker(t,lp)),5<n.width&&_e(i,{x:n.x,width:n.width}),5<n.height&&_e(i,{y:n.y,height:n.height}),e.canExecute?Te(i).remove(up):Te(i).add(up)}(e.context)}),e.on("resize.cleanup",function(e){!function(e){var t=e.shape;e.frame&&Ae(e.frame),r.removeMarker(t,lp)}(e.context)})}hp.$inject=["eventBus","canvas","previewSupport"];var dp="djs-resizer";function mp(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&k(t,j(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}mp.prototype.makeDraggable=function(t,e,n){var i=this._resize;function r(e){Jr(e)&&i.activate(e,t,n)}re.bind(e,"mousedown",r),re.bind(e,"touchstart",r)},mp.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=Ne("g");Te(a).add(dp),Te(a).add(dp+"-"+e.id),Te(a).add(dp+"-"+r),ve(o,a);var s=Ne("rect");_e(s,{x:-7,y:-7,width:5,height:5}),Te(s).add(dp+"-visual"),ve(a,s);var c=Ne("rect");return _e(c,{x:-7,y:-7,width:20,height:20}),Te(c).add(dp+"-hit"),ve(a,c),qt(a,t,n,i),a},mp.prototype.createResizer=function(e,t){var n,i=Fr(e);n="nw"===t?this._createResizer(e,i.left,i.top,0,t):"ne"===t?this._createResizer(e,i.right,i.top,90,t):"se"===t?this._createResizer(e,i.right,i.bottom,180,t):this._createResizer(e,i.left,i.bottom,270,t),this.makeDraggable(e,n,t)},mp.prototype.addResizer=function(e){this._resize.canResize({shape:e})&&(this.createResizer(e,"nw"),this.createResizer(e,"ne"),this.createResizer(e,"se"),this.createResizer(e,"sw"))},mp.prototype.removeResizers=function(){Pe(this._getResizersParent())},mp.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},mp.$inject=["eventBus","canvas","selection","resize"];var fp={__depends__:[Ua,za,cp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",pp],resizePreview:["type",hp],resizeHandles:["type",mp]};function yp(e){return wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Participant")||wi(e,"bpmn:Lane")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")?"name":wi(e,"bpmn:TextAnnotation")?"text":void 0}function vp(e){var t=e.businessObject,n=yp(t);if(n)return t[n]||""}function gp(e,t,n,i,r,o){function a(e,t){(t||da(e,["bpmn:Task","bpmn:TextAnnotation"])||bp(e))&&n.activate(e)}this._canvas=t,this._modeling=i,this._textRenderer=o,n.registerProvider(this),e.on("element.dblclick",function(e){a(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace","popupMenu.open"],function(e){n.isActive()&&n.complete()}),e.on(["commandStack.changed"],function(e){n.isActive()&&n.cancel()}),e.on("directEditing.activate",function(e){r.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&a(t)}),e.on("autoPlace.end",500,function(e){a(e.shape)})}function bp(e){return wi(e,"bpmn:SubProcess")&&!Ci(e)}gp.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],gp.prototype.activate=function(e){var t=vp(e);if(void 0!==t){var n={text:t};F(n,this.getEditingBBox(e));var i={};return(da(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||bp(e))&&F(i,{centerVertically:!0}),Yi(e)&&F(i,{autoResize:!0}),wi(e,"bpmn:TextAnnotation")&&F(i,{resizable:!0,autoResize:!0}),F(n,{options:i}),n}},gp.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=this._textRenderer.getDefaultStyle(),p=this._textRenderer.getExternalStyle(),l=p.fontSize*s,u=p.lineHeight,h=c.fontSize*s,d=c.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(wi(e,"bpmn:Lane")||function(e){return wi(e,"bpmn:Participant")&&Ci(e)}(e))&&(F(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),F(m,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(da(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return wi(e,"bpmn:Participant")&&!Ci(e)}(e)||bp(e))&&(F(a,{width:i.width,height:i.height}),F(m,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return wi(e,"bpmn:SubProcess")&&Ci(e)}(e)&&(F(a,{width:i.width,x:i.x}),F(m,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"}));var f=90*s,y=7*s,v=4*s;if(n.labelTarget&&(F(a,{width:f,height:i.height+y+v,x:r-f/2,y:i.y-y}),F(m,{fontSize:l+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:v+"px"})),Yi(n)&&!Xi(n)&&!Ji(n)){var g=Qi(e),b=t.getAbsoluteBBox({x:g.x,y:g.y,width:0,height:0}),x=l+y+v;F(a,{width:f,height:x,x:b.x-f/2,y:b.y-x/2}),F(m,{fontSize:l+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:v+"px"})}return wi(e,"bpmn:TextAnnotation")&&(F(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),F(m,{textAlign:"left",paddingTop:5*s+"px",paddingBottom:7*s+"px",paddingLeft:7*s+"px",paddingRight:5*s+"px",fontSize:h+"px",lineHeight:d})),{bounds:a,style:m}},gp.prototype.update=function(e,t,n,i){var r,o;wi(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),function(e){return!e||!e.trim()}(t)&&(t=null),this._modeling.updateLabel(e,t,r)};var xp="djs-element-hidden",_p="djs-label-hidden";function Ep(e,r,t,o){var a,s,c,p=this,l=r.getDefaultLayer();e.on("directEditing.activate",function(e){var t=e.active;if(wi(a=t.element.label||t.element,"bpmn:TextAnnotation")){s=r.getAbsoluteBBox(a),c=Ne("g");var n=o.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:a.height,position:{mx:0,my:0}}),i=p.path=Ne("path");_e(i,{d:n,strokeWidth:2,stroke:function(e,t){return Si(e).di.get("stroke")||t||"black"}(a)}),ve(c,i),ve(l,c),Kt(c,a.x,a.y)}wi(a,"bpmn:TextAnnotation")||a.labelTarget?r.addMarker(a,xp):(wi(a,"bpmn:Task")||wi(a,"bpmn:CallActivity")||wi(a,"bpmn:SubProcess")||wi(a,"bpmn:Participant"))&&r.addMarker(a,_p)}),e.on("directEditing.resize",function(e){if(wi(a,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,i=Math.max(a.height/s.height*(t+n),0),r=o.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:i,position:{mx:0,my:0}});_e(p.path,{d:r})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var t=e.active;t&&(r.removeMarker(t.element.label||t.element,xp),r.removeMarker(a,_p)),s=a=void 0,c&&(Ae(c),c=void 0)})}Ep.$inject=["eventBus","canvas","elementRegistry","pathMap"];var wp={__depends__:[ap,fp,Ps],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",gp],labelEditingPreview:["type",Ep]};function Sp(e,c){function r(e){if(Xi(e)){var t=function(e){var t=Hr(e.label),n=Hr(e),i=Tp(n,t);if(!function(e){return-1!==Cp.indexOf(e)}(i))return;var r=[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return Tp(n,e)}),o=Cp.filter(function(e){return-1===r.indexOf(e)});return-1===o.indexOf(i)?o[0]:void 0}(e);t&&function(e,t){var n,i=Hr(e),r=e.label,o=Hr(r),a=Fr(e);switch(t){case"top":n={x:i.x,y:a.top-p-r.height/2};break;case"left":n={x:a.left-p-r.width/2,y:i.y};break;case"bottom":n={x:i.x,y:a.bottom+p+r.height/2};break;case"right":n={x:a.right+p+r.width/2,y:i.y}}var s=Wo(n,o);c.moveShape(r,s)}(e,t)}}Ra.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(e){var t=e.context.connection,n=t.source,i=t.target;r(n),r(i)}),this.postExecuted(["label.create"],function(e){r(e.context.shape.labelTarget)});var p=10}t(Sp,Ra),Sp.$inject=["eventBus","modeling"];var Cp=["top","bottom","left","right"];function Tp(e,t){return Wr(t,e,5)}function Rp(e,t,n){Ra.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(wi(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})},!0)}function Ap(e,r){function o(e){return A(e.attachers,function(e){return wi(e,"bpmn:BoundaryEvent")})}Ra.call(this,e),this.postExecute("connection.create",function(e){var t=e.context.source,n=e.context.target,i=o(n);wi(t,"bpmn:EventBasedGateway")&&wi(n,"bpmn:ReceiveTask")&&0<i.length&&r.removeElements(i)}),this.postExecute("connection.reconnectStart",function(e){var t=e.context.oldSource,n=e.context.newSource;wi(t,"bpmn:Gateway")&&wi(n,"bpmn:EventBasedGateway")&&k(n.outgoing,function(e){var t=e.target,n=o(t);wi(t,"bpmn:ReceiveTask")&&0<n.length&&r.removeElements(n)})})}function Pp(e,a,n){Ra.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),wi(t,"bpmn:Lane"))for(;wi(t=e.topParent=t.parent,"bpmn:Lane")||!wi(t,"bpmn:Participant"););},!0),this.postExecute("elements.paste",function(e){var o=e.tree.createdElements;k(o,function(e){var t,n=e.element,i=n.businessObject,r=e.descriptor;(wi(i,"bpmn:ExclusiveGateway")||wi(i,"bpmn:InclusiveGateway")||wi(i,"bpmn:Activity"))&&r.default&&(t=(t=o[r.default])?t.element:void 0,delete n.default,a.updateProperties(n,{default:t}))})},!0)}function kp(e,t,o,a){Ra.call(this,e),this.preExecute("shape.create",function(e){var t,n=e.shape,i=e.host,r={cancelActivity:!0};i&&wi(n,"bpmn:IntermediateThrowEvent")&&(r.attachedToRef=i.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:a.create("bpmn:BoundaryEvent",r)},e.shape=o.createShape(t))},!0)}function Mp(e,i,t){Ra.call(this,e),this.preExecute("shape.create",function(e){var t=e.context.shape;if(wi(t,"bpmn:DataObjectReference")&&"label"!==t.type){var n=i.create("bpmn:DataObject");t.businessObject.dataObjectRef=n}})}function Dp(e,a,t,n,s){Ra.call(this,e),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape,i=e.position,r=s.getRootElement();if(wi(t,"bpmn:Process")&&wi(n,"bpmn:Participant")&&!wi(r,"bpmn:Collaboration")){var o=a.makeCollaboration();e.position=i,e.parent=o,e.processRoot=t}},!0),this.execute("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var t=e.processRoot,n=e.shape;if(t){var i=t.children.slice();a.moveElements(i,{x:0,y:0},n)}},!0)}t(Rp,Ra),Rp.$inject=["eventBus","elementFactory","bpmnRules"],Ap.$inject=["eventBus","modeling"],t(Ap,Ra),Pp.$inject=["eventBus","modeling","canvas"],t(Pp,Ra),kp.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],t(kp,Ra),Mp.$inject=["eventBus","bpmnFactory","moddle"],t(Mp,Ra),Dp.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],t(Dp,Ra);var Np="__targetRef_placeholder";function Bp(e,r){function h(e,t){var n=e.get("properties"),i=R(n,function(e){return e.name===Np});return!i&&t&&lt(n,i=r.create("bpmn:Property",{name:Np})),i}function d(e,t){var n=h(e);!n||!function(e,t,n){return R(e.get("dataInputAssociations"),function(e){return e!==n&&e.targetRef===t})}(e,n,t)&&pt(e.get("properties"),n)}function t(e){var t,n=e.context,i=n.connection,r=i.businessObject,o=i.target,a=o&&o.businessObject,s=n.newTarget,c=s&&s.businessObject,p=n.oldTarget||n.target,l=p&&p.businessObject,u=i.businessObject;l&&l!==a&&d(l,r),c&&c!==a&&d(c,r),a?(t=h(a,!0),u.targetRef=t):u.targetRef=null}Ra.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Op(t)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Op(t))}function Op(t){return function(e){if(wi(e.context.connection,"bpmn:DataInputAssociation"))return t(e)}}function Lp(e){this._bpmnUpdater=e}function Ip(i,r,o,e){function a(e){return e.children.filter(function(e){return wi(e,"bpmn:DataStoreReference")&&!e.labelTarget})}function s(e,t){var n=e.businessObject||e;if(t=t||o.filter(function(e){return wi(e,"bpmn:Participant")})[0]){var i=t.businessObject||t;r.execute("dataStore.updateContainment",{dataStoreBo:n,newSemanticParent:i.processRef||i,newDiParent:i.di})}}Ra.call(this,e),r.registerHandler("dataStore.updateContainment",Lp),this.preExecute("shape.create",function(e){var t=e.context,n=t.shape;wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)}),this.preExecute("elements.move",function(e){var t=e.context,n=t.shapes;n.filter(function(e){return wi(e,"bpmn:DataStoreReference")}).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter(function(e){return!wi(e,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(e){var t=e.context.shape,n=t.parent;wi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&wi(n,"bpmn:Collaboration")&&s(t)}),this.postExecute("shape.move",function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;wi(i,"bpmn:Collaboration")||wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&wi(r,"bpmn:Collaboration")&&s(n,wi(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(wi(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))}),this.postExecute("shape.delete",function(e){var t=e.context.shape,n=i.getRootElement();da(t,["bpmn:Participant","bpmn:SubProcess"])&&wi(n,"bpmn:Collaboration")&&a(n).filter(function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,t)}).forEach(function(e){s(e)})}),this.postExecute("canvas.updateRoot",function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;a(n).forEach(function(e){wi(i,"bpmn:Process")&&s(e,i)})})}Bp.$inject=["eventBus","bpmnFactory"],t(Bp,Ra),Lp.$inject=["bpmnUpdater"],Lp.prototype.execute=function(e){var t=e.dataStoreBo,n=e.newSemanticParent,i=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=t.di.$parent,this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},Lp.prototype.revert=function(e){var t=e.dataStoreBo,n=e.oldSemanticParent,i=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},Ip.$inject=["canvas","commandStack","elementRegistry","eventBus"],t(Ip,Ra);function jp(e,t,c){Ra.call(this,e),this.postExecuted("shape.delete",500,function(e){var t=e.context,n=t.hints,i=t.shape,r=t.oldParent;wi(i,"bpmn:Lane")&&(n&&n.nested||function(t,e){var n,i,r,o=Ac(e),a=[],s=[];dt(o,function(e){return e.y>t.y?s.push(e):a.push(e),e.children}),o.length&&(n=s.length&&a.length?t.height/2:t.height,a.length&&(i=c.calculateAdjustments(a,"y",n,t.y-10),c.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:n},"s")),s.length&&(r=c.calculateAdjustments(s,"y",-n,t.y+t.height+10),c.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:-n},"n")))}(i,r))})}function zp(e,f,y){function r(e,t,n){var i,r,o,a,s,c,p,l=t.waypoints,u=e.outgoing.slice(),h=e.incoming.slice(),d=ts(l,n);if(d){if(i=l.slice(0,d.index),r=l.slice(d.index+(d.bendpoint?1:0)),!i.length||!r.length)return;o=d.bendpoint?l[d.index]:n,Fp(e,i[i.length-1])||i.push($p(o)),Fp(e,r[0])||r.unshift($p(o))}a=t.source,s=t.target,f.canConnect(a,e,t)&&(y.reconnectEnd(t,e,i||n),c=t),f.canConnect(e,s,t)&&(p=c?y.connect(e,s,{type:t.type,waypoints:r}):(y.reconnectStart(t,e,r||n),t));var m=[].concat(c&&A(h,function(e){return e.source===c.source})||[],p&&A(u,function(e){return e.source===p.source})||[]);m.length&&y.removeElements(m)}Ra.call(this,e),this.preExecute("elements.move",function(e){var t=e.newParent,n=e.shapes,i=e.delta,r=n[0];if(r&&t){t&&t.waypoints&&(e.newParent=t=t.parent);var o=function(e){return{x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)}}(r),a={x:o.x+i.x,y:o.y+i.y},s=R(t.children,function(e){return f.canInsert(n,e)&&ts(e.waypoints,a)});s&&(e.targetFlow=s,e.position=a)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape;f.canInsert(n,t)&&(e.targetFlow=t,e.parent=t.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}function Fp(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function $p(e){return F({},e)}function Hp(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Wp(e){function n(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Hp(e,t,n,r),s=Hp(e,t,n,o);i=a&&s?Gp(a,n)>Gp(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var t=e.element;t.waypoints&&function(e){var t=e.waypoints;n(t[0],t[1],Hr(e.source)),n(t[t.length-1],t[t.length-2],Hr(e.target))}(t)})}function Gp(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vp(e){Ra.call(this,e);var n=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(e){var t=Si(e.context.shape);da(t,n)&&!t.di.get("isHorizontal")&&t.di.set("isHorizontal",!0)})}function Up(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qp(e,t){return function(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}({x:e.x-t.x,y:e.y-t.y})}jp.$inject=["eventBus","modeling","spaceTool"],t(jp,Ra),t(zp,Ra),zp.$inject=["eventBus","bpmnRules","modeling"],Wp.$inject=["eventBus"],Vp.$inject=["eventBus"],t(Vp,Ra);var Kp=Math.sqrt,Yp=Math.min,Xp=Math.max,Zp=Math.abs;function Qp(e){return Math.pow(e,2)}function Jp(e,t){return Kp(Qp(e.x-t.x)+Qp(e.y-t.y))}function el(t,n,e,i){var r=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&-1e-6<l&&(l=0),l<0)return[];var u=Kp(l),h=-p+u,d=-p-u,m={x:t.x-r*h,y:t.y-o*h};return 0===l?[m]:[m,{x:t.x-r*d,y:t.y-o*d}].filter(function(e){return function(e,t,n){return tl(e.x,t.x,n.x)&&tl(e.y,t.y,n.y)}(e,t,n)})}function tl(e,t,n){return e>=Yp(t,n)-nl&&e<=Xp(t,n)+nl}var nl=.1;function il(e,t){return Zp(e.x-t.x)<=nl&&Zp(e.y-t.y)<=nl}function rl(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m<t.length-1;m++){if((s=il(n=t[m],i=t[m+1])?[n]:(r=Jp(e,n),o=Jp(e,i),el(n,i,e,Yp(r,o)))).length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:il(n,s[0])?m:m+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:m,relativeLocation:Jp(n,a)/Jp(n,i)}),p=Jp(c.position,e),(!u||p<l)&&(u=c,l=p)}return u}(a,n),c=s.segmentIndex,p=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:s<=r?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;return 0==o?r:(l<=r&&(c=p?r+1:r-1),r<l&&(c=r,!p||"bendpoint"===n.type||l-1!==r||ol(t,l)<n.relativeLocation&&c++),c)}return 0==o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l=al(n,c),u=al(t,p),h=s.position,d=function(e,t){var n=qp(e[0],e[1]),i=qp(e[0],t);return 0===n?0:i/n}(l,h),m=function(e,t){var n=Up(e);return Up(t)-n}(l,u);if("bendpoint"===s.type){var f=t.length-n.length,y=s.bendpointIndex,v=n[y];if(-1!==t.indexOf(v))return{x:r,y:o};if(0==f){var g=t[y];return{x:g.x-s.position.x,y:g.y-s.position.y}}f<0&&0!==y&&y<n.length-1&&(d=ol(n,y))}var b=(u[1].x-u[0].x)*d+u[0].x,x=(u[1].y-u[0].y)*d+u[0].y,_=function(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}({x:a.x-h.x,y:a.y-h.y},m);return zr({x:r=b+_.x-a.x,y:o=x+_.y-a.y})}function ol(e,t){var n=qp(e[t-1],e[t]);return n/(n+qp(e[t],e[t+1]))}function al(e,t){return[e[t],e[t+1]]}var sl={width:90,height:20};function cl(e,a,i,s){Ra.call(this,e),this.postExecute("element.updateProperties",function(e){var t=e.context,n=t.element,i=t.properties;if("name"in i&&a.updateLabel(n,i.name),"text"in i&&wi(n,"bpmn:TextAnnotation")){var r=s.getTextAnnotationBounds({x:n.x,y:n.y,width:n.width,height:n.height},i.text||"");a.updateLabel(n,i.text,r)}}),this.postExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=n.businessObject;if(Yi(n)&&i.name){var r=Qi(n),o=s.getExternalLabelBounds(sl,i.name||"");a.createLabel(n,r,{id:i.id+"_label",businessObject:i,width:o.width,height:o.height})}}),this.postExecute("shape.delete",function(e){var t=e.context,n=t.labelTarget,i=t.hints||{};n&&!1!==i.unsetLabel&&a.updateLabel(n,null,null,{removeShape:!1})}),this.postExecute(["label.create"],function(e){var t,n=e.context.shape;!n.labelTarget||wi(n.labelTarget||n,"bpmn:BaseElement")&&((t=n.businessObject.di).label||(t.label=i.create("bpmndi:BPMNLabel",{bounds:i.create("dc:Bounds")})),F(t.label.bounds,{x:n.x,y:n.y,width:n.width,height:n.height}))}),this.postExecute(["connection.layout","connection.updateWaypoints"],function(e){var t,n=e.context.connection.label;n&&(t=function(e){var t=e.context,n=t.connection,i=n.label,r=F({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),rl(i,o,a,r)}(e),a.moveShape(n,t))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Si(n);r&&Yi(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})}t(cl,Ra),cl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];var pl="flow elements must be children of pools/participants";function ll(e,i,r){function o(e,t,n){i.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:n||2e3,html:"<div>"+t+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,n=t.shape;wi(t.target,"bpmn:Collaboration")&&wi(n,"bpmn:FlowNode")&&o(e,r(pl))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,n=t.position,i=t.target;wi(i,"bpmn:Collaboration")&&o(n,r(pl)),wi(i,"bpmn:Process")&&o(n,r("participants cannot be pasted onto a non-empty process diagram"),3e3)})}function ul(e,a,o){function t(e){var t,n,i=e.source,r=e.target;e.parent&&(wi(e,"bpmn:SequenceFlow")&&(o.canConnectSequenceFlow(i,r)||(n=!0),o.canConnectMessageFlow(i,r)&&(t="bpmn:MessageFlow")),wi(e,"bpmn:MessageFlow")&&(o.canConnectMessageFlow(i,r)||(n=!0),o.canConnectSequenceFlow(i,r)&&(t="bpmn:SequenceFlow")),wi(e,"bpmn:Association")&&!o.canConnectAssociation(i,r)&&(n=!0),n&&a.removeConnection(e),t&&a.connect(i,r,{type:t,waypoints:e.waypoints.slice()}))}Ra.call(this,e),this.postExecuted("elements.move",function(e){k(e.closure.allConnections,t)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){t(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var t,n=e.context,i=n.properties,r=n.element,o=r.businessObject;!i.default||(t=R(r.outgoing,D({id:r.businessObject.default.id})))&&a.updateProperties(t,{conditionExpression:void 0}),i.conditionExpression&&o.sourceRef.default===o&&a.updateProperties(r.source,{default:void 0})})}function hl(e,n){Ra.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;wi(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var t=e.collaborationRoot;t&&!t.businessObject.participants.length&&n.makeProcess()},!0)}function dl(e,t,a,n,i,r){Ra.call(this,e),this._bpmnReplace=t,this._elementRegistry=n,this._selection=i,this._modeling=r,this.postExecuted(["elements.move"],500,function(e){var t=e.context,n=t.newParent,i=t.newHost,r=[];k(t.closure.topLevel,function(e){r=Ti(e)?r.concat(e.children):r.concat(e)}),1===r.length&&i&&(n=i);var o=a.canReplace(r,n);o&&this.replaceElements(r,o.replacements,i)},this),this.postExecute(["shape.replace"],1500,function(e){var t,n=e.context,i=n.oldShape,r=n.newShape,o=i.attachers;o&&o.length&&(t=a.canReplace(o,r),this.replaceElements(o,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})})}ll.$inject=["eventBus","tooltips","translate"],t(ul,Ra),ul.$inject=["eventBus","modeling","bpmnRules"],hl.$inject=["eventBus","modeling"],t(hl,Ra),t(dl,Ra),dl.prototype.replaceElements=function(r,e,o){var a=this._elementRegistry,s=this._bpmnReplace,t=this._selection,c=this._modeling;k(e,function(e){var t={type:e.newElementType},n=a.get(e.oldElementId);o&&wi(n,"bpmn:BoundaryEvent")&&c.updateAttachment(n,null);var i=r.indexOf(n);r[i]=s.replaceElement(n,t,{select:!1}),o&&wi(r[i],"bpmn:BoundaryEvent")&&c.updateAttachment(r[i],o)}),e&&t.select(r)},dl.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];function ml(e,o){e.on("resize.start",1501,function(e){var t=e.context,n=t.shape;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.balanced=!eo(e))}),e.on("resize.end",1001,function(e){var t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds;if(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))return i&&(r=jr(r),o.resizeLane(n,r,t.balanced)),!1})}function fl(e,o,a){Ra.call(this,e),this.preExecute("shape.delete",function(e){var t=e.context.shape;if(1===t.incoming.length&&1===t.outgoing.length){var n=t.incoming[0],i=t.outgoing[0];if(wi(n,"bpmn:SequenceFlow")&&wi(i,"bpmn:SequenceFlow")&&o.canConnect(n.source,i.target,n)){var r=function(e,t){var n=Hp(yl(e[e.length-2]),yl(e[e.length-1]),yl(t[1]),yl(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yl(e[0]),yl(t[t.length-1])]}(n.waypoints,i.waypoints);a.reconnectEnd(n,i.target,r)}}})}function yl(e){return e.original||e}ml.$inject=["eventBus","modeling"],t(fl,Ra),fl.$inject=["eventBus","bpmnRules","modeling"];function vl(e,r,o,t){Ra.call(this,e),this.executed(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;wi(t,"bpmn:SubProcess")&&(t.collapsed?Si(t).di.isExpanded=!1:(function(e){e.length&&e.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})}(t.children),Si(t).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;t.collapsed?Si(t).di.isExpanded=!1:Si(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],500,function(e){var t,n=e.context.shape,i=r._getDefaultSize(n);t=n.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(n,i):function(e,t){var n,i=t;return(n=Sc(function(e){return e.filter(function(e){return!e.hidden})}(e.children).concat([e])))?(i.width=Math.max(n.width,i.width),i.height=Math.max(n.height,i.height),i.x=n.x+(n.width-i.width)/2,i.y=n.y+(n.height-i.height)/2):(i.x=e.x+(e.width-i.width)/2,i.y=e.y+(e.height-i.height)/2),i}(n,i),o.resizeShape(n,t)})}function gl(e,t){Ra.call(this,e),this.preExecute("elements.delete",function(e){k(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}t(vl,Ra),vl.$inject=["eventBus","elementFactory","modeling"],t(gl,Ra),gl.$inject=["eventBus","modeling"];function bl(e,t,i){var r;Ra.call(this,e);var n=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(n,5e3,function(e){(r=r||new xl).enter()}),this.postExecuted(n,500,function(e){!function(){if(!r)throw new Error(i("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=function(){if(!r)throw new Error(i("out of bounds release"));return r}();t.labelTarget||(wi(t,"bpmn:Lane")&&n.addLane(t),wi(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function xl(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function _l(e,i){Ra.call(this,e),this.preExecute("connection.delete",function(e){var t=e.context.connection,n=t.source;!function(e,t){if(!wi(e,"bpmn:SequenceFlow"))return!1;var n=Si(t),i=Si(e);return n.get("default")===i}(t,n)||i.updateProperties(n,{default:null})})}bl.$inject=["eventBus","modeling","translate"],t(bl,Ra),t(_l,Ra),_l.$inject=["eventBus","modeling"];var El={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","boundaryEventBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","dataStoreBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","isHorizontalFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",Sp],appendBehavior:["type",Rp],boundaryEventBehavior:["type",Ap],copyPasteBehavior:["type",Pp],createBoundaryEventBehavior:["type",kp],createDataObjectBehavior:["type",Mp],createParticipantBehavior:["type",Dp],dataInputAssociationBehavior:["type",Bp],dataStoreBehavior:["type",Ip],deleteLaneBehavior:["type",jp],dropOnFlowBehavior:["type",zp],importDockingFix:["type",Wp],isHorizontalFix:["type",Vp],labelBehavior:["type",cl],modelingFeedback:["type",ll],replaceConnectionBehavior:["type",ul],removeParticipantBehavior:["type",hl],replaceElementBehaviour:["type",dl],resizeLaneBehavior:["type",ml],removeElementBehavior:["type",fl],toggleElementCollapseBehaviour:["type",vl],unclaimIdBehavior:["type",gl],updateFlowNodeRefsBehavior:["type",bl],unsetDefaultFlowBehavior:["type",_l]};function wl(e,t){var n=Wr(e,t,-15);return"intersect"!==n?n:null}var Sl=Math.abs,Cl=Math.min,Tl=Math.max;function Rl(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Al(e,t,n){return Rl(e,t,n,Cl)}function Pl(e,t,n){return Rl(e,t,n,Tl)}var kl=60,Ml=300,Dl=20,Nl=50,Bl=20,Ol=20;function Ll(e){ka.call(this,e)}function Il(e){return!e||Ji(e)}function jl(e){do{if(wi(e,"bpmn:Process"))return Si(e);if(wi(e,"bpmn:Participant"))return Si(e).processRef||Si(e)}while(e=e.parent)}function zl(e){return wi(e,"bpmn:TextAnnotation")}function Fl(e){return wi(e,"bpmn:BoundaryEvent")&&Wl(e,"bpmn:CompensateEventDefinition")}function $l(e){return Si(e).isForCompensation}function Hl(e){for(var t=e;t=t.parent;){if(wi(t,"bpmn:FlowElementsContainer"))return Si(t);if(wi(t,"bpmn:Participant"))return Si(t).processRef}return null}function Wl(e,t){return!!R(Si(e).eventDefinitions||[],function(e){return wi(e,t)})}function Gl(e,t){return(Si(e).eventDefinitions||[]).every(function(e){return wi(e,t)})}function Vl(e){return e.waypoints}function Ul(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function ql(e,t,n){if(Il(e)||Il(t))return null;if(!wi(n,"bpmn:DataAssociation")){if(iu(e,t))return{type:"bpmn:MessageFlow"};if(ru(e,t))return{type:"bpmn:SequenceFlow"}}var i=ou(e,t);return i||(Fl(e)&&$l(t)?{type:"bpmn:Association",associationDirection:"One"}:!!nu(e,t)&&{type:"bpmn:Association"})}function Kl(e,t,n){return!!Ji(e)||!(wi(t,"bpmn:Participant")&&!Ci(t))&&(wi(e,"bpmn:Participant")?wi(t,"bpmn:Process")||wi(t,"bpmn:Collaboration"):da(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:wi(e,"bpmn:Lane")?wi(t,"bpmn:Participant")||wi(t,"bpmn:Lane"):!wi(e,"bpmn:BoundaryEvent")&&(wi(e,"bpmn:FlowElement")&&!wi(e,"bpmn:DataStoreReference")?wi(t,"bpmn:FlowElementsContainer")?Ci(t):da(t,["bpmn:Participant","bpmn:Lane"]):da(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?da(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!wi(e,"bpmn:MessageFlow")&&(wi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Yl(e){return!Ji(e)&&wi(e,"bpmn:BoundaryEvent")}function Xl(e){return wi(e,"bpmn:Lane")}function Zl(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r=e[0];return!Ji(r)&&(!!function(e){return Yl(e)||wi(e,"bpmn:IntermediateThrowEvent")&&!e.parent}(r)&&(!t||!Ti(t)&&(!(!wi(t,"bpmn:Activity")||$l(t))&&(!(i&&!wl(i,t))&&(!function(e){return wi(e,"bpmn:ReceiveTask")&&R(e.incoming,function(e){return wi(e.source,"bpmn:EventBasedGateway")})}(t)&&"attach")))))}function Ql(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(e){Ti(t)||wi(e,"bpmn:StartEvent")&&"label"!==e.type&&Kl(e,t)&&(!function(e){return e&&!1!==Si(e).isInterrupting}(e)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Ri(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Ri(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Ri(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),wi(t,"bpmn:Transaction")||Wl(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(wi(e,"bpmn:EndEvent")&&Kl(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),wi(e,"bpmn:BoundaryEvent")&&Zl(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function Jl(e,t){return!x(e,Yl)&&(!x(e,Xl)&&(!t||e.every(function(e){return Kl(e,t)})))}function eu(e,t,n,i){return!!t&&(Ji(t)?null:!function(e,t){return e===t}(n,t)&&((!n||!Ul(n,t))&&(Kl(e,t)||au(e,t,i))))}function tu(e,t){return wi(e,"bpmn:SubProcess")?Ci(e)&&(!t||100<=t.width&&80<=t.height):wi(e,"bpmn:Lane")?!t||130<=t.width&&60<=t.height:wi(e,"bpmn:Participant")?!t||250<=t.width&&50<=t.height:!!zl(e)}function nu(e,t){return!Vl(e)&&!Vl(t)&&(!(!Fl(e)||!$l(t))||!Ul(t,e)&&!Ul(e,t)&&function(e,t){var n=zl(e),i=zl(t);return(n||i)&&n!==i}(e,t))}function iu(e,t){return function(e){return wi(e,"bpmn:InteractionNode")&&(!wi(e,"bpmn:Event")||wi(e,"bpmn:ThrowEvent")&&Gl(e,"bpmn:MessageEventDefinition"))}(e)&&function(e){return wi(e,"bpmn:InteractionNode")&&!$l(e)&&(!wi(e,"bpmn:Event")||wi(e,"bpmn:CatchEvent")&&Gl(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return jl(e)===jl(t)}(e,t)}function ru(e,t){return function(e){return wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:EndEvent")&&!Ti(e)&&!(wi(e,"bpmn:IntermediateThrowEvent")&&Wl(e,"bpmn:LinkEventDefinition"))&&!Fl(e)&&!$l(e)}(e)&&function(e){return wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:StartEvent")&&!wi(e,"bpmn:BoundaryEvent")&&!Ti(e)&&!(wi(e,"bpmn:IntermediateCatchEvent")&&Wl(e,"bpmn:LinkEventDefinition"))&&!$l(e)}(t)&&function(e,t){var n=Hl(e),i=Hl(t);return n&&n===i}(e,t)&&!(wi(e,"bpmn:EventBasedGateway")&&!function(e){return wi(e,"bpmn:ReceiveTask")||wi(e,"bpmn:IntermediateCatchEvent")&&(Wl(e,"bpmn:MessageEventDefinition")||Wl(e,"bpmn:TimerEventDefinition")||Wl(e,"bpmn:ConditionalEventDefinition")||Wl(e,"bpmn:SignalEventDefinition"))}(t))}function ou(e,t){return da(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&da(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!da(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!da(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function au(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(da(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ji(t)&&wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:BoundaryEvent")&&Kl(e,t.parent))}function su(e,t){return e&&t&&-1!==e.indexOf(t)}function cu(e,t){return!(wi(t,"bpmn:Lane")&&!su(e,t.parent))&&!(wi(t,"bpmn:BoundaryEvent")&&!su(e,t.host))}t(Ll,ka),Ll.$inject=["eventBus"],Ll.prototype.init=function(){this.addRule("connection.start",function(e){return function(e){if(Il(e))return null;return da(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])}(e.source)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return ql(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return ql(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return ql(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return tu(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return Zl(n,t,null,i)||Ql(n,t,i)||Jl(n,t)||au(n,t,i)}),this.addRule("shape.create",function(e){return eu(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Zl(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return cu(e.collection,e.element)}),this.addRule("element.paste",function(e){var t=e.parent,n=e.element,i=e.position,r=e.source,o=e.target;return r||o?ql(r,o):Zl([n],t,null,i)||eu(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(wi(t,"bpmn:Collaboration"))return b(n,function(e){return"bpmn:Participant"===e.type});if(wi(t,"bpmn:Process"))return!(x(n,function(e){return"bpmn:Participant"===e.type})&&0<t.children.length);if(wi(t,"bpmn:Participant")&&!Ci(t))return!1;if(wi(t,"bpmn:FlowElementsContainer"))return Ci(t);return da(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)})},Ll.prototype.canConnectMessageFlow=iu,Ll.prototype.canConnectSequenceFlow=ru,Ll.prototype.canConnectDataAssociation=ou,Ll.prototype.canConnectAssociation=nu,Ll.prototype.canMove=Jl,Ll.prototype.canAttach=Zl,Ll.prototype.canReplace=Ql,Ll.prototype.canDrop=Kl,Ll.prototype.canInsert=au,Ll.prototype.canCreate=eu,Ll.prototype.canConnect=ql,Ll.prototype.canResize=tu,Ll.prototype.canCopy=cu;var pu={__depends__:[Ua],__init__:["bpmnRules"],bpmnRules:["type",Ll]};function lu(e){Ra.call(this,e);var o=this;this.preExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=t.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.parent=r.parent),t.parentIndex=r.index)}),this.preExecute(["shape.move","connection.move"],function(e){var t=e.context,n=t.shape||t.connection,i=t.newParent||n.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.newParent=r.parent),t.newParentIndex=r.index)})}function uu(e,o,a){lu.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:3,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function s(e){var t=e.order;return t||(e.order=t=function(t){if(t.labelTarget)return{level:10};var e=R(n,function(e){return da(t,[e.type])});return e&&e.order||{level:1}}(e)),t}this.getOrdering=function(t,e){if(t.labelTarget)return{parent:o.getRootElement(),index:-1};var n=s(t);n.containers&&(e=function(e,t,n){for(var i=t;i&&!da(i,n);)i=i.parent;if(!i)throw new Error(a("no parent for {element} in {parent}",{element:e.id,parent:t.id}));return i}(t,e,n.containers));var i=e.children.indexOf(t),r=m(e.children,function(e){return!(!t.labelTarget&&e.labelTarget)&&n.level<s(e).level});return-1===r||-1!==i&&i<r&&(r-=1),{index:r,parent:e}}}lu.prototype.getOrdering=function(e,t){return null},t(lu,Ra),uu.$inject=["eventBus","canvas","translate"],t(uu,lu);var hu={__depends__:[Ui],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",uu]};function du(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}du.$inject=["eventBus","injector"],du.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},du.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},du.prototype.clear=function(e){this._stack.length=0,!(this._stackIdx=-1)!==e&&this._fire("changed")},du.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},du.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},du.prototype.register=function(e,t){this._setHandler(e,t)},du.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},du.prototype.canUndo=function(){return!!this._getUndoAction()},du.prototype.canRedo=function(){return!!this._getRedoAction()},du.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},du.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},du.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)})},du.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},du.prototype._createId=function(){return this._uid++},du.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},du.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo(function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)}),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},du.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},du.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:C("id",n)}),n.length=0,this._fire("changed"))},du.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=g(e)?e:[e],t.dirty=t.dirty.concat(e))},du.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},du.prototype._revertedAction=function(e){this._stackIdx--},du.prototype._getHandler=function(e){return this._handlerMap[e]},du.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var mu={commandStack:["type",du]},fu=new uo("tt");function yu(e,t){e.style.display=!1===t?"none":""}var vu="djs-tooltip",gu="."+vu;function bu(e,t){this._eventBus=e,this._canvas=t,this._ids=fu,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=function(e){var t=se('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />');return e.insertBefore(t,e.firstChild),t}(t.getContainer());var n=this;ae.bind(this._tooltipRoot,gu,"mousedown",function(e){e.stopPropagation()}),ae.bind(this._tooltipRoot,gu,"mouseover",function(e){n.trigger("mouseover",e)}),ae.bind(this._tooltipRoot,gu,"mouseout",function(e){n.trigger("mouseout",e)}),this._init()}bu.$inject=["eventBus","canvas"],bu.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=F({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bu.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(H(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},bu.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},bu.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bu.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},bu.prototype.remove=function(e){var t=this.get(e);t&&(fe(t.html),fe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bu.prototype.show=function(){yu(this._tooltipRoot)},bu.prototype.hide=function(){yu(this._tooltipRoot,!1)},bu.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},bu.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=se(i)),(t=se('<div data-tooltip-id="'+n+'" class="'+vu+'" style="position: absolute">')).appendChild(i),e.type&&q(t).add("djs-tooltip-"+e.type),e.className&&q(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},bu.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){F(e.style,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},bu.prototype._updateTooltipVisibilty=function(r){k(this._tooltips,function(e){var t=e.show,n=e.htmlContainer,i=!0;t&&((t.minZoom>r.scale||t.maxZoom<r.scale)&&(i=!1),yu(n,i))})},bu.prototype._init=function(){var t=this;this._eventBus.on("canvas.viewbox.changing",function(e){t.hide()}),this._eventBus.on("canvas.viewbox.changed",function(e){!function(e){t._updateRoot(e),t._updateTooltipVisibilty(e),t.show()}(e.viewbox)})};var xu={__init__:["tooltips"],tooltips:["type",bu]};function _u(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function Eu(e,t,n){Ra.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=wu(n),t.validatedShapes=wu(i)}),r&&t.on("shape.move.start",250,function(e){var n=e.context,t=n.shapes,i=[];k(t,function(t){k(t.labels,function(e){e.hidden||-1!==n.shapes.indexOf(e)||i.push(e),t.labelTarget&&i.push(t)})}),k(i,function(e){r.makeDraggable(n,e,!0)})}),this.preExecuted("elements.move",1400,function(e){var t=e.context.closure,n=t.enclosedElements,i=[];k(n,function(e){k(e.labels,function(e){n[e.id]||i.push(e)})}),t.addAll(i)}),this.preExecute(["connection.delete","shape.delete"],function(e){var t=e.context;_u((t.connection||t.shape).labels,function(e){n.removeShape(e,{nested:!0})})}),this.execute("shape.delete",function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=ut(i.labels,n),t.labelTarget=i,n.labelTarget=null)}),this.revert("shape.delete",function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(lt(i.labels,n,r),n.labelTarget=i)})}function wu(t){return A(t,function(e){return-1===t.indexOf(e.labelTarget)})}t(Eu,Ra),Eu.$inject=["injector","eventBus","modeling"];var Su={__init__:["labelSupport"],labelSupport:["type",Eu]};function Cu(e,t,n){var i=Ho(t),r=Ho(n),o=Wo(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return zr({x:r.x+a,y:r.y+s})}function Tu(e,t,n){var i=Ho(e),r=Ho(t),o=Ho(n),a=Wo(e,i),s=Wo(i,r),c=s.x*(n.width/t.width),p=s.y*(n.height/t.height),l=o.x+c,u=o.y+p;return zr({x:l+a.x-e.x,y:u+a.y-e.y})}function Ru(e,t,r,o){Ra.call(this,t);var n=e.get("movePreview",!1);t.on("shape.move.start",1401,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=function(e){var t=Au(e);return T("id",e,t)}(n),t.validatedShapes=function(e){var t=S(e,"id");return A(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(i)}),n&&t.on("shape.move.start",251,function(e){var t=e.context;k(Au(t.shapes),function(e){n.makeDraggable(t,e,!0),k(e.labels,function(e){n.makeDraggable(t,e,!0)})})}),this.preExecuted("elements.move",1401,function(e){var t=e.context,n=t.closure;k(Au(t.shapes),function(e){n.add(e,n.topLevel[e.host.id])})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.shapes,i=t.newHost;1<n.length||k(i?n:A(n,function(e){return!!e.host}),function(e){o.updateAttachment(e,i)})}),this.postExecuted("elements.move",function(e){k(e.context.shapes,function(e){k(e.attachers,function(e){k(e.outgoing.slice(),function(e){r.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)}),k(e.incoming.slice(),function(e){r.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,i=t.host;i&&o.updateAttachment(n,i)}),this.postExecute("shape.replace",function(e){var t=e.context,n=t.oldShape,i=t.newShape;_u(n.attachers,function(e){"attach"===r.allowed("elements.move",{target:i,shapes:[e]})?o.updateAttachment(e,i):o.removeShape(e)}),i.attachers.length&&k(i.attachers,function(e){var t=Tu(e,n,i);o.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,i=t.oldBounds,r=t.newBounds;k(n.attachers,function(e){var t=Tu(e,i,r);o.moveShape(e,t,e.parent),k(e.labels,function(e){o.moveShape(e,t,e.parent)})})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;_u(t.attachers,function(e){o.removeShape(e)}),t.host&&o.updateAttachment(t,null)}),t.on("spaceTool.move",function(e){var t=e.context,n=t.initialized,i=t.attachSupportInitialized;if(n&&!i){var r=t.movingShapes;k(A(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)}),function(t){pt(r,t),k(t.labels,function(e){pt(r,t.label)})}),t.attachSupportInitialized=!0}})}function Au(e){return h(_(e,function(e){return e.attachers||[]}))}t(Ru,Ra),Ru.$inject=["injector","eventBus","rules","modeling"];var Pu={__depends__:[Ua],__init__:["attachSupport"],attachSupport:["type",Ru]};function ku(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}ku.$inject=["eventBus","dragging"],ku.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},ku.prototype.isActive=function(e){return e&&this._active===e},ku.prototype.length=function(e){return this._tools.length},ku.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ku.prototype.bindEvents=function(t,e){var n=this._eventBus,i=this._dragging,r=[];n.on(e.tool+".init",function(e){if(!e.context.reactivate&&this.isActive(t))return this.setActive(null),void i.cancel();this.setActive(t)},this),k(e,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;this._active&&(t&&ee(t.target,'.group[data-group="tools"]')||this.setActive(null))},this)};var Mu={__depends__:[za],__init__:["toolManager"],toolManager:["type",ku]};var Du=Math.abs,Nu=Math.round,Bu="crosshair",Ou={x:"width",y:"height"},Lu={x:"y",y:"x"};function Iu(c,e,t,n,i,r){this._canvas=t,this._dragging=e,this._modeling=n,this._rules=i,this._toolManager=r;var p=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),c.on("spaceTool.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&c.once("spaceTool.selection.ended",function(){p.activateMakeSpace(e.originalEvent)})}),c.on("spaceTool.move",1500,function(e){var t=e.context;t.initialized||(t.initialized=p.initializeMakeSpace(e,t))}),c.on("spaceTool.end",function(t){var e=t.context,n=e.axis,i=e.direction,r=e.movingShapes,o=e.resizingShapes;if(e.initialized){var a={x:Nu(t.dx),y:Nu(t.dy)},s=!(a[Lu[n]]=0);k(o,function(e){("w"===i&&t.x>e.x+e.width||"e"===i&&t.x<e.x||"n"===i&&t.y>e.y+e.height||"s"===i&&t.y<e.y)&&(s=!1)}),s&&p.makeSpace(r,o,a,i),c.once("spaceTool.ended",function(e){p.activateSelection(e.originalEvent,!0,!0)})}})}Iu.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"],Iu.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:Bu,autoActivate:t,data:{context:{reactivate:n}}})},Iu.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Bu,data:{context:{}}})},Iu.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},Iu.prototype.initializeMakeSpace=function(e,t){var n=Du(e.dx)>Du(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Du(i)<5)return!1;i<0&&(i*=-1),eo(e)&&(i*=-1);var o=mt(this._canvas.getRootElement(),!0);return F(t,this.calculateAdjustments(o,n,i,r),{axis:n,direction:function(e,t){if("x"===e){if(0<t)return"e";if(t<0)return"w"}if("y"===e){if(0<t)return"s";if(t<0)return"n"}return null}(n,i)}),jo("resize-"+("x"==n?"ew":"ns")),!0},Iu.prototype.calculateAdjustments=function(e,i,r,o){var a=[],s=[],c=this._rules;return e.forEach(function(e){var t=e[i],n=t+e[Ou[i]];if(e.parent&&!e.waypoints)return 0<r&&o<t?a.push(e):r<0&&n<o?a.push(e):t<o&&o<n&&c.allowed("shape.resize",{shape:e})?s.push(e):void 0}),{movingShapes:a,resizingShapes:s}},Iu.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Iu.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var ju="djs-dragging",zu="djs-resizing";function Fu(e,u,h,d,m){function f(e,t){k(e,function(e){m.addDragger(e,t),h.addMarker(e,ju)})}e.on("spaceTool.selection.start",function(e){var t=h.getLayer("space"),n=e.context,i="M 0,-10000 L 0,10000",r="M -10000,0 L 10000,0",o=Ne("g");_e(o,d.cls("djs-crosshair-group",["no-events"])),ve(t,o);var a=Ne("path");_e(a,"d",i),Te(a).add("djs-crosshair"),ve(o,a);var s=Ne("path");_e(s,"d",r),Te(s).add("djs-crosshair"),ve(o,s),n.crosshairGroup=o}),e.on("spaceTool.selection.move",function(e){Kt(e.context.crosshairGroup,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&Ae(t)}),e.on("spaceTool.move",250,function(e){var t=e.context,n=t.line,i=t.axis,a=t.movingShapes,s=t.resizingShapes;if(t.initialized){if(!t.dragGroup){var r=h.getLayer("space");_e(n=Ne("path"),"d","M0,0 L0,0"),Te(n).add("djs-crosshair"),ve(r,n),t.line=n;var o=Ne("g");_e(o,d.cls("djs-drag-group",["no-events"])),ve(h.getDefaultLayer(),o),f(a,o),f(t.movingConnections=u.filter(function(t){var n=!1;k(a,function(e){k(e.outgoing,function(e){t===e&&(n=!0)})});var i=!1;k(a,function(e){k(e.incoming,function(e){t===e&&(i=!0)})});var r=!1;k(s,function(e){k(e.outgoing,function(e){t===e&&(r=!0)})});var o=!1;return k(s,function(e){k(e.incoming,function(e){t===e&&(o=!0)})}),function(e){return e.waypoints}(t)&&(n||r)&&(i||o)}),o),t.dragGroup=o}if(!t.frameGroup){var c=Ne("g");_e(c,d.cls("djs-frame-group",["no-events"])),ve(h.getDefaultLayer(),c);var p=[];k(s,function(e){var t=m.addFrame(e,c);p.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),h.addMarker(e,zu)}),t.frameGroup=c,t.frames=p}_e(n,{path:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[i],display:""});var l={x:e.dx,y:e.dy};l[{x:"y",y:"x"}[t.axis]]=0,Kt(t.dragGroup,l.x,l.y),k(t.frames,function(e){5<e.initialWidth+l.x&&_e(e.element,{width:e.initialWidth+l.x}),5<e.initialHeight+l.y&&_e(e.element,{height:e.initialHeight+l.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,n=t.movingShapes,i=t.movingConnections,r=t.resizingShapes,o=t.line,a=t.dragGroup,s=t.frameGroup;k(n,function(e){h.removeMarker(e,ju)}),k(i,function(e){h.removeMarker(e,ju)}),a&&(Ae(o),Ae(a)),k(r,function(e){h.removeMarker(e,zu)}),s&&Ae(s)})}Fu.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var $u={__init__:["spaceToolPreview"],__depends__:[za,Ua,Mu,cp],spaceTool:["type",Iu],spaceToolPreview:["type",Fu]};function Hu(e){this._model=e}function Wu(e,t,i,n){Ra.call(this,e),this._bpmnFactory=t,this._translate=n;var r=this;function o(e){k(e.context.oldRoot.children,function(e){wi(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;wi(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function c(e){r.updateConnectionWaypoints(e.context.connection)}function p(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],function(e){var t,n=e.context;n.cropped||((t=n.connection).waypoints=i.getCroppedWaypoints(t),n.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Gu(function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)})),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Gu(function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)})),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Gu(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],Gu(function(e){"label"!==e.context.shape.type&&a(e)})),e.on("shape.changed",function(e){"label"===e.element.type&&a({context:{shape:e.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],Gu(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],Gu(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Gu(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Gu(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],Gu(function(e){var t=e.context,n=t.connection,i=Si(n),r=Si(t.oldSource),o=Si(t.oldTarget),a=Si(n.source),s=Si(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(wi(s,"bpmn:Activity")||wi(s,"bpmn:EndEvent")||wi(s,"bpmn:Gateway")||wi(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!wi(a,"bpmn:Activity")&&!wi(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(wi(s,"bpmn:Activity")||wi(s,"bpmn:EndEvent")||wi(s,"bpmn:Gateway")||wi(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],Gu(function(e){var t=e.context,n=t.connection,i=Si(n),r=Si(n.source);!t.default||(wi(r,"bpmn:ExclusiveGateway")||wi(r,"bpmn:InclusiveGateway")||wi(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&wi(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],Gu(p)),this.reverted(["element.updateAttachment"],Gu(p))}function Gu(n){return function(e){var t=e.context;wi(t.shape||t.connection,"bpmn:BaseElement")&&n(e)}}function Vu(e,t,n){Ht.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Uu(e,t,n){e[n]=t[n],delete t[n]}function qu(e){this._modeling=e}Hu.$inject=["moddle"],Hu.prototype._needsId=function(e){return da(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property"])},Hu.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Hu.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Hu.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Hu.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",F({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Hu.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Hu.prototype.createDiWaypoints=function(e){var t=this;return _(e,function(e){return t.createDiWaypoint(e)})},Hu.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},Hu.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",F({bpmnElement:e},n))},Hu.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})},t(Wu,Ra),Wu.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Wu.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Wu.prototype.updateParent=function(e,t){if(!(e instanceof zt||wi(e,"bpmn:DataStoreReference")&&e.parent&&wi(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;wi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),wi(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),wi(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),wi(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},Wu.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof zt?this._getLabel(t):t,i=n.bounds;i||(i=this._bpmnFactory.createDiBounds(),n.set("bounds",i)),F(i,{x:e.x,y:e.y,width:e.width,height:e.height})},Wu.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(wi(n,"bpmn:Lane")&&pt(n.get("flowNodeRef"),e),wi(t,"bpmn:Lane")&&lt(t.get("flowNodeRef"),e))},Wu.prototype.updateDiConnection=function(e,t,n){e.sourceElement&&e.sourceElement.bpmnElement!==t&&(e.sourceElement=t&&t.di),e.targetElement&&e.targetElement.bpmnElement!==n&&(e.targetElement=n&&n.di)},Wu.prototype.updateDiParent=function(e,t){if(t&&!wi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(pt(n,e),e.$parent=null)}},Wu.prototype.getLaneSet=function(e){var t,n;return wi(e,"bpmn:Lane")?(t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),(e.childLaneSet=t).$parent=e):(wi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t))),t},Wu.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&!((wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput"))&&(wi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(wi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(wi(e,"bpmn:FlowElement")){if(t)if(wi(t,"bpmn:Participant"))t=t.processRef;else if(wi(t,"bpmn:Lane"))for(;wi(t=t.$parent.$parent,"bpmn:Lane"););i="flowElements"}else if(wi(e,"bpmn:Artifact")){for(;t&&!wi(t,"bpmn:Process")&&!wi(t,"bpmn:SubProcess")&&!wi(t,"bpmn:Collaboration");){if(wi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(wi(e,"bpmn:MessageFlow"))i="messageFlows";else if(wi(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!wi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(pt(o.get("rootElements"),a),a.$parent=null),t&&(lt(o.get("rootElements"),a),a.$parent=o))}else wi(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":wi(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&pt(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);pt(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Wu.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Wu.prototype.updateConnection=function(e){var t,n=e.connection,i=Si(n),r=Si(n.source),o=Si(n.target);if(wi(i,"bpmn:DataAssociation"))wi(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):wi(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=wi(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(pt(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(pt(i.targetRef&&i.targetRef.get("incoming"),i),o&&o.get("incoming")&&o.get("incoming").push(i)),i.targetRef=o)}this.updateConnectionWaypoints(n),this.updateDiConnection(i.di,r,o)},Wu.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},t(Vu,Ht),Vu.$inject=["bpmnFactory","moddle","translate"],Vu.prototype.baseCreate=Ht.prototype.create,Vu.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,F({type:"label"},qi,t)):this.createBpmnElement(e,t)},Vu.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),t.colors&&(F(a.di,t.colors),delete t.colors),function(t,n,e){k(e,function(e){void 0!==n[e]&&Uu(t,n,e)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&Uu(a.di,t,"isExpanded"),wi(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),(r.$parent=a).eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=F({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},Vu.prototype._getDefaultSize=function(e){return wi(e,"bpmn:SubProcess")?Ci(e)?{width:350,height:200}:{width:100,height:80}:wi(e,"bpmn:Task")?{width:100,height:80}:wi(e,"bpmn:Gateway")?{width:50,height:50}:wi(e,"bpmn:Event")?{width:36,height:36}:wi(e,"bpmn:Participant")?Ci(e)?{width:600,height:250}:{width:400,height:100}:wi(e,"bpmn:Lane")?{width:400,height:100}:wi(e,"bpmn:DataObjectReference")?{width:36,height:50}:wi(e,"bpmn:DataStoreReference")?{width:50,height:50}:wi(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},Vu.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)},qu.$inject=["modeling"],qu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape;i=e.shape=this._modeling.createShape(i,e.position,n,{attach:e.attach}),e.shape=i},qu.prototype.postExecute=function(e){var t=e.connectionParent||e.shape.parent;!function(e,t){return x(e.outgoing,function(e){return e.target===t})}(e.source,e.shape)&&this._modeling.connect(e.source,e.shape,e.connection,t)};var Ku=Math.round;function Yu(e){this._canvas=e}function Xu(e,t){this._canvas=e,this._modeling=t}function Zu(e,t,n){var i=nh(e)[0];return Cu(i.original||i,n,t)}function Qu(e,t,n){var i=nh(e),r=i[i.length-1];return Cu(r.original||r,n,t)}function Ju(e,t,n){return Zu(e,t,th(t,n))}function eh(e,t,n){return Qu(e,t,th(t,n))}function th(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function nh(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ih(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function rh(e){this._modeling=e}function oh(e){this._modeling=e,this._helper=new rh(e)}function ah(e){this._modeling=e}function sh(e,t){this._modeling=e,this._rules=t}function ch(e){this._modeling=e}function ph(e){this._modeling=e}function lh(e){Yu.call(this,e)}Yu.$inject=["canvas"],Yu.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?F(t,n):F(t,{x:n.x-Ku(t.width/2),y:n.y-Ku(t.height/2)}),this._canvas.addShape(t,i,r),t},Yu.prototype.revert=function(e){this._canvas.removeShape(e.shape)},Xu.$inject=["canvas","modeling"],Xu.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;_u(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),_u(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),_u(n.children,function(e){!function(e){return e.waypoints}(e)?t.removeShape(e,{nested:!0}):t.removeConnection(e,{nested:!0})})},Xu.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ut(i.children,n),t.removeShape(n),n},Xu.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return lt(i.children,n,r),t.addShape(n,i),n},ih.prototype.add=function(e,t){return this.addAll([e],t)},ih.prototype.addAll=function(e,t){return F(this,function(e,t,n){p(t)&&(t=!0),P(t)&&(n=t,t=!0);var i=vt((n=n||{}).allShapes),r=vt(n.allConnections),o=vt(n.enclosedElements),a=vt(n.enclosedConnections),s=vt(n.topLevel,t&&S(e,function(e){return e.id}));function c(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return dt(e,function(e){if(!(o[e.id]=e).waypoints)return k((i[e.id]=e).incoming,c),k(e.outgoing,c),e.children;a[e.id]=r[e.id]=e}),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},rh.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},rh.prototype.moveClosure=function(e,i,r,t,n){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;n&&n.parent===r&&(l=!0),k(a,function(e){o.moveShape(e,i,p[e.id]&&!l&&r,{recurse:!1,layout:!1})}),k(s,function(e){var t=!!a[e.source.id],n=!!a[e.target.id];c[e.id]&&t&&n?o.moveConnection(e,i,p[e.id]&&!l&&r):o.layoutConnection(e,{connectionStart:t&&Ju(e,e.source,i),connectionEnd:n&&eh(e,e.target,i)})})},rh.prototype.getClosure=function(e){return(new ih).addAll(e,!0)},oh.$inject=["modeling"],oh.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=pt(o.children,t),lt(i.children,t,r),F(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},oh.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(k(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:eh(e,t,n)})}),k(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:Ju(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},oh.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return lt(n.children,t,i),F(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},oh.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},oh.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},ah.$inject=["modeling"],ah.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},F(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ah.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;k(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:Qu(e,t,n)})}),k(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Zu(e,t,n)})})},ah.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return F(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},sh.$inject=["modeling","rules"],sh.prototype.preExecute=function(e){var i,r=this,t=this._modeling,o=this._rules,n=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return o.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};i=e.newShape=e.newShape||r.createShape(a,l,n.parent,s),n.host&&t.updateAttachment(i,n.host),!1!==s.moveChildren&&(p=n.children.slice(),t.moveElements(p,{x:0,y:0},i));var u=n.incoming.slice(),h=n.outgoing.slice();k(u,function(e){var t=e.waypoints,n=t[t.length-1];c("connection.reconnectEnd",e.source,i,e)&&r.reconnectEnd(e,i,n)}),k(h,function(e){var t=e.waypoints[0],n=e.target;c("connection.reconnectStart",i,n,e)&&r.reconnectStart(e,i,t)})},sh.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;k(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),k(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},sh.prototype.execute=function(e){},sh.prototype.revert=function(e){},sh.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},sh.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},sh.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)},ch.$inject=["modeling"],ch.prototype.execute=function(e){var t=e.shape,n=t.children;return e.oldChildrenVisibility=function(e){var t={};return e.forEach(function(e){t[e.id]=e.hidden}),t}(n),t.collapsed=!t.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(n,t.collapsed),[t].concat(n)},ch.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children;return function(e,t){e.forEach(function(e){e.hidden=t[e.id]})}(i,n),t.collapsed=!t.collapsed,[t].concat(i)},ph.$inject=["modeling"],ph.prototype.preExecute=function(e){var n=this._modeling,t=e.resizingShapes,i=e.delta,r=e.direction;k(t,function(e){var t=function(e,t,n){var i=n.x,r=n.y;switch(t){case"n":return{x:e.x,y:e.y+r,width:e.width,height:e.height-r};case"s":return{x:e.x,y:e.y,width:e.width,height:e.height+r};case"w":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height};case"e":return{x:e.x,y:e.y,width:e.width+i,height:e.height};default:throw new Error("unrecognized direction: "+t)}}(e,r,i);n.resizeShape(e,t)})},ph.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},ph.prototype.execute=function(e){},ph.prototype.revert=function(e){},t(lh,Yu),lh.$inject=["canvas"];var uh=Yu.prototype.execute;lh.prototype.execute=function(e){var t=e.shape;return function(t){["width","height"].forEach(function(e){void 0===t[e]&&(t[e]=0)})}(t),t.labelTarget=e.labelTarget,uh.call(this,e)};var hh=Yu.prototype.revert;function dh(e,t){this._canvas=e,this._layouter=t}function mh(e,t){this._canvas=e,this._modeling=t}function fh(){}function yh(e,t){this._layouter=e,this._canvas=t}function vh(){}function gh(e){this._modeling=e}function bh(e){this._helper=new rh(e)}function xh(e,t){this._modeling=e,this._elementRegistry=t}function _h(e){this._modeling=e}lh.prototype.revert=function(e){return e.shape.labelTarget=null,hh.call(this,e)},dh.$inject=["canvas","layouter"],dh.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},dh.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null},mh.$inject=["canvas","modeling"],mh.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ut(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},mh.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,lt(n.children,t,i),this._canvas.addConnection(t,n),t},fh.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=pt(o.children,t),lt(i.children,t,r),t.parent=i,k(t.waypoints,function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)}),t},fh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return pt(n.children,t),lt(i.children,t,r),t.parent=i,k(t.waypoints,function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)}),t},yh.$inject=["layouter","canvas"],yh.prototype.execute=function(e){var t=e.connection;return F(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},yh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},vh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},gh.$inject=["modeling"],gh.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget are required");if(t&&n)throw new Error("must specify either newSource or newTarget");return g(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},gh.prototype.postExecute=function(e){var t,n=e.connection,i=e.dockingOrPoints,r=e.newSource,o=r?"connectionStart":"connectionEnd",a={};t=g(i)?r?i[0]:i[i.length-1]:i,a[o]=function(e){return e.original||e}(t),this._modeling.layoutConnection(n,a)},gh.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},bh.$inject=["modeling"],bh.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},bh.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},xh.$inject=["modeling","elementRegistry"],xh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;k(e.elements,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})},_h.$inject=["modeling"];var Eh={x:"y",y:"x"};function wh(e,t){this._modeling=e,this._canvas=t}function Sh(e){this._modeling=e}function Ch(e,t){return pt(e&&e.attachers,t)}function Th(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),lt(i,t,n)}}function Rh(t,e){k(e,function(e){t[e]&&delete t[e]})}function Ah(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}function Ph(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}_h.prototype.preExecute=function(e){var o=this._modeling,a=e.groups,s=e.axis,c=e.dimension;function p(e,t){e.range.min=Math.min(t[s],e.range.min),e.range.max=Math.max(t[s]+t[c],e.range.max)}function l(e){return e[s]+e[c]/2}function u(e){return e.length-1}function h(e){return e.max-e.min}var d,t,m=a[0],f=u(a),y=a[f],v=0;k(a,function(t,e){var n,i,r;t.elements.length<2?e&&e!==a.length-1&&(p(t,t.elements[0]),v+=h(t.range)):(i=(n=M(t.elements,s))[0],e===f&&(i=n[u(n)]),r=l(i),t.range=null,k(n,function(e){!function(e,t){var n={y:0};n[s]=e-l(t),n[s]&&(n[Eh[s]]=0,o.moveElements([t],n,t.parent))}(r,e),null!==t.range?p(t,e):t.range={min:e[s],max:e[s]+e[c]}}),e&&e!==a.length-1&&(v+=h(t.range)))}),t=Math.abs(y.range.min-m.range.max),(d=Math.round((t-v)/(a.length-1)))<a.length-1||k(a,function(n,e){var i,r={};n!==m&&n!==y&&(i=a[e-1],n.range.max=0,k(n.elements,function(e,t){r[Eh[s]]=0,r[s]=i.range.max-e[s]+d,n.range.min!==e[s]&&(r[s]+=e[s]-n.range.min),r[s]&&o.moveElements([e],r,e.parent),n.range.max=Math.max(e[s]+e[c],t?n.range.max:0)}))})},_h.prototype.postExecute=function(e){},wh.$inject=["modeling","canvas"],wh.prototype.preExecute=function(e){var n=this._modeling,t=e.elements,i=e.alignment;k(t,function(e){var t={x:0,y:0};i.left?t.x=i.left-e.x:i.right?t.x=i.right-e.width-e.x:i.center?t.x=i.center-Math.round(e.width/2)-e.x:i.top?t.y=i.top-e.y:i.bottom?t.y=i.bottom-e.height-e.y:i.middle&&(t.y=i.middle-Math.round(e.height/2)-e.y),n.moveElements([e],t,e.parent)})},wh.prototype.postExecute=function(e){},Sh.$inject=["modeling"],Sh.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Ch(i,t),Th(n,t),t.host=n,t},Sh.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Ch(n,t),Th(i,t,r),t},Ah.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"],Ah.prototype.preExecute=function(e){var s=this._eventBus,c=this,p=e.tree,l=e.topParent,u=e.position;p.createdElements={},p.labels=[],k(p,function(e,t){var a=parseInt(t,10);isNaN(a)||(a||(e=_(e,function(e){return e.parent=l,e})),k(e=M(e,"priority"),function(e){var t,n=e.id,i=e.parent,r={},o=F({},e);if(a&&(o.parent=c._getCreatedElement(i,p)),i)if(s.fire("element.paste",{createdElements:p.createdElements,descriptor:o}),i=o.parent,o.waypoints)(o=c._createConnection(o,i,u,p))&&(p.createdElements[n]={element:o,descriptor:e});else{if(o.parent!==l&&(r.root=!1),o.host&&(r.attach=!0,i=c._getCreatedElement(o.host,p)),o.labelTarget)return p.labels.push(o);t={x:Math.round(u.x+o.delta.x+o.width/2),y:Math.round(u.y+o.delta.y+o.height/2)},Rh(o,["id","parent","delta","host","priority"]),(o=c._createShape(o,i,t,r))&&(p.createdElements[n]={element:o,descriptor:e})}}))})},Ah.prototype.postExecute=function(e){var o=this._modeling,t=this._selection,a=this,s=e.tree,n=s.labels,i=[];k(n,function(t){var e,n,i,r=a._getCreatedElement(t.labelTarget,s);!r||(e=r.labels)&&e.length&&(n={x:r.x,y:r.y},r.waypoints&&(n=r.waypoints[0]),k(e,function(e){i={x:Math.round(n.x-e.x+t.delta.x),y:Math.round(n.y-e.y+t.delta.y)},o.moveShape(e,i,r.parent)}))}),k(s[0],function(e){var t=e.id,n=s.createdElements[t];n&&i.push(n.element)}),t.select(i)},Ah.prototype._createConnection=function(n,e,i,t){var r,o,a=this._modeling,s=this._rules;return n.waypoints=_(n.waypoints,function(e,t){return{x:Math.round(i.x+n.delta[t].x),y:Math.round(i.y+n.delta[t].y)}}),r=this._getCreatedElement(n.source,t),o=this._getCreatedElement(n.target,t),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Rh(n,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,n,e)):null},Ah.prototype._createShape=function(e,t,n,i,r){var o=this._modeling,a=this._elementFactory;if(!this._rules.allowed("element.paste",{element:e,position:n,parent:t}))return null;var s=a.createShape(e);return o.createShape(s,n,t,i,r),s},Ah.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element},Ph.$inject=["eventBus","elementFactory","commandStack"],Ph.prototype.getHandlers=function(){return{"shape.append":qu,"shape.create":Yu,"shape.delete":Xu,"shape.move":oh,"shape.resize":ah,"shape.replace":sh,"shape.toggleCollapse":ch,spaceTool:ph,"label.create":lh,"connection.create":dh,"connection.delete":mh,"connection.move":fh,"connection.layout":yh,"connection.updateWaypoints":vh,"connection.reconnectStart":gh,"connection.reconnectEnd":gh,"elements.move":bh,"elements.delete":xh,"elements.distribute":_h,"elements.align":wh,"element.updateAttachment":Sh,"elements.paste":Ah}},Ph.prototype.registerHandlers=function(n){k(this.getHandlers(),function(e,t){n.registerHandler(t,e)})},Ph.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Ph.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ph.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?a=(r=n).parent:!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Ph.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Ph.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ph.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Ph.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Ph.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Ph.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,attach:r.attach};return this._commandStack.execute("shape.append",o),o.shape},Ph.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ph.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ph.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ph.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ph.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ph.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},Ph.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ph.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},Ph.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Ph.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ph.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},Ph.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},Ph.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ph.prototype._create=function(e,t){return t instanceof Lt?t:this._elementFactory.create(e,t)},Ph.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};var kh="default",Mh="id",Dh={width:0,height:0};function Nh(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function Bh(e,t){return Mh in e&&e.id!==t.id}function Oh(n,e){k(e,function(e,t){"di"!==t?n.set(t,e):n.di&&function(n,e){k(e,function(e,t){n.set(t,e)})}(n.di,e)})}Nh.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Nh.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(t){var n=F({},t);return Lh.forEach(function(e){e in t&&(n[e]=Si(n[e]))}),n}(e.properties),c=e.oldProperties||function(n,i){return v(E(i),function(e,t){return e[t]="di"!==t?n.get(t):function(n,e){return v(e,function(e,t){return e[t]=n.get(t),e},{})}(n.di,E(i.di)),e},{})}(a,s);return Bh(s,a)&&(o.unclaim(a.id),r.updateId(t,s.id),o.claim(s.id,a)),kh in s&&(s[kh]&&n.push(r.get(s[kh].id)),a[kh]&&n.push(r.get(a[kh].id))),Oh(a,s),e.oldProperties=c,e.changed=n},Nh.prototype.postExecute=function(e){var t=e.element.label,n=t&&Si(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,Dh)}},Nh.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Oh(r,i),Bh(n,r)&&(a.unclaim(n.id),o.updateId(t,i.id),a.claim(i.id,r)),e.changed};var Lh=["default"];function Ih(e,t){this._canvas=e,this._modeling=t}function jh(e,t){this._modeling=e,this._spaceTool=t}function zh(e,t){this._modeling=e,this._translate=t}function Fh(e,t){this._modeling=e,this._spaceTool=t}Ih.$inject=["canvas","modeling"],Ih.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=o.di;t.setRootElement(n,!0),lt(a.rootElements,i),pt((i.$parent=a).rootElements,o),o.$parent=null,o.di=null,(s.bpmnElement=i).di=s,e.oldRoot=r},Ih.prototype.revert=function(e){var t=this._canvas,n=e.newRoot.businessObject,i=e.oldRoot,r=i.businessObject,o=n.$parent,a=n.di;t.setRootElement(i,!0),pt(o.rootElements,n),n.$parent=null,lt(o.rootElements,r),r.$parent=o,n.di=null,(a.bpmnElement=r).di=a},jh.$inject=["modeling","spaceTool"],jh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Pc(i),a=o===i,s=a?i:i.parent;Ac(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+30,y:i.y,width:i.width-30,height:i.height},s);var c=[];dt(o,function(e){return c.push(e),e===i?[]:A(e.children,function(e){return e!==i})});var p="top"===r?-120:120,l="top"===r?i.y:i.y+i.height,u=l+("top"===r?10:-10),h="top"===r?"n":"s",d=t.calculateAdjustments(c,"y",p,u);t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?30:0),y:l-("top"===r?120:0),width:i.width-(a?30:0),height:120},s)},zh.$inject=["modeling","translate"],zh.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Ac(i),a=o.length;if(r<a)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+30,y:s,width:i.width-30,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},Fh.$inject=["modeling","spaceTool"],Fh.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Fh.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=kc(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Fh.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=Fr(e),p=xc(Fr(t),c),l=Pc(e),u=[],h=[];dt(l,function(e){return u.push(e),(wi(e,"bpmn:Lane")||wi(e,"bpmn:Participant"))&&h.push(e),e.children}),(p.bottom||p.top)&&(n=p.bottom||p.top,i=e.y+(p.bottom?e.height:0)+(p.bottom?-10:10),r=p.bottom?"s":"n",o=0<p.top||p.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(p.left||p.right)&&(n=p.right||p.left,i=e.x+(p.right?e.width:0)+(p.right?-10:100),r=p.right?"e":"w",o=0<p.left||p.right<0?-n:n,a=s.calculateAdjustments(h,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var $h="flowNodeRef",Hh="lanes";function Wh(e){this._elementRegistry=e}function Gh(e){this._moddle=e}Wh.$inject=["elementRegistry"],Wh.prototype.computeUpdates=function(e,t){var n={},r=[],i={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(t){return t.parent?function(e){var t=Pc(e);return i[t.id]||(i[t.id]=Rc(t)),i[t.id]}(t).filter(function(e){return function(e,t){var n=Fr(t),i=e.x+e.width/2,r=e.y+e.height/2;return i>n.left&&i<n.right&&r>n.top&&r<n.bottom}(t,e)}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=Pc(e);t&&!n[t.id]&&(t.children.filter(function(e){return wi(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get(Hh).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get($h).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},Wh.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get(Hh);e.remove.forEach(function(e){pt(n,e),pt(e.get($h),t)}),e.add.forEach(function(e){lt(n,e),lt(e.get($h),t)})})},Wh.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get(Hh);e.add.forEach(function(e){pt(n,e),pt(e.get($h),t)}),e.remove.forEach(function(e){lt(n,e),lt(e.get($h),t)})})},Gh.$inject=["moddle"],Gh.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Gh.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var Vh={fill:void 0,stroke:void 0};function Uh(e){this._commandStack=e}Uh.$inject=["commandStack"],Uh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Vh,i=this,r={};"fill"in n&&F(r,{fill:n.fill}),"stroke"in n&&F(r,{stroke:n.stroke}),k(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var qh={width:0,height:0};function Kh(c,p){function t(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t,n){var i=e.businessObject,r=yp(i);r&&(i[r]=t)}(n,t),[n,i]}this.preExecute=function(e){var t=e.element,n=t.businessObject,i=e.newLabel;if(!Ji(t)&&Yi(t)&&!Xi(t)&&!Yh(i)){var r=Qi(t);r={x:r.x,y:r.y+7},c.createLabel(t,r,{id:n.id+"_label",businessObject:n})}},this.execute=function(e){return e.oldLabel=vp(e.element),t(e.element,e.newLabel)},this.revert=function(e){return t(e.element,e.oldLabel)},this.postExecute=function(e){var t=e.element,n=t.label||t,i=e.newLabel,r=e.newBounds,o=e.hints||{};if(Ji(n)&&Yh(i))!1!==o.removeShape&&c.removeShape(n,{unsetLabel:!1});else if(Yi(t)||wi(t,"bpmn:TextAnnotation")){var a=Si(n),s=a.name||a.text;s&&(void 0===r&&(r=p.getExternalLabelBounds(n,s)),r&&c.resizeShape(n,r,qh))}}}function Yh(e){return!e||!e.trim()}function Xh(e,t,n,i){Ph.call(this,e,t,n),this._bpmnRules=i}function Zh(){}Kh.$inject=["modeling","textRenderer"],t(Xh,Ph),Xh.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Xh.prototype.getHandlers=function(){var e=Ph.prototype.getHandlers.call(this);return e["element.updateProperties"]=Nh,e["canvas.updateRoot"]=Ih,e["lane.add"]=jh,e["lane.resize"]=Fh,e["lane.split"]=zh,e["lane.updateRefs"]=Wh,e["id.updateClaim"]=Gh,e["element.setColor"]=Uh,e["element.updateLabel"]=Kh,e},Xh.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Xh.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},Xh.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Xh.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Xh.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Xh.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Xh.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Xh.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Xh.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},Xh.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Xh.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Xh.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Zh.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Hr(e.source),t.connectionEnd||Hr(e.target)]};var Qh=20,Jh=5,ed=Math.round,td=20,nd={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function id(e,t,n){var i,r,o=Wr(t,e,Jh),a=n.split(":")[0],s=ed((t.x-e.x)/2+e.x),c=ed((t.y-e.y)/2+e.y),p=function(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}(a,o),l=/h|r|l/.test(a),u=!1;return p?(i=l?{x:s,y:e.y}:{x:e.x,y:c},r=l?"h:h":"v:v"):(r=l?"h:v":"v:h",i=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(o,a)?l?(u=c===e.y,{x:e.x+Qh*(/l/.test(a)?-1:1),y:u?c+Qh:c}):{x:(u=s===e.x)?s+Qh:s,y:e.y+Qh*(/t/.test(a)?-1:1)}:{x:s,y:c}),{waypoints:od(e,i,r).concat(i),directions:r,turnNextDirections:u}}function rd(e){return e.split(":").reverse().join(":")}function od(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ld(n)){var i=function(e,t,n){return id(e,t,n)}(e,t,n),r=function(e,t,n){var i=id(t,e,rd(n));return{waypoints:i.waypoints.slice().reverse(),directions:rd(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:od(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=ed((t.x-e.x)/2+e.x),r=ed((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function ad(e,t,n,i,r){var o=y(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=Wr(e,t,nd[o]||0),s=function(e,t){if(ld(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(a,o);n=n||Hr(e),i=i||Hr(t);var c=s.split(":");return function(e,t,n){var i=od(e,t,n);return i.unshift(e),i.push(t),hd(i)}(ud(n,e,c[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(a)),ud(i,t,c[1],a),s)}function sd(e,t,n,i,r,o){var a;return g(n)&&(r=n,o=i,n=Hr(e),i=Hr(t)),r=r||[],(a=-1!==(o=F({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=Wr(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===r.preserveDocking?cd(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:cd(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null}(e,t,n,i,o))?a:(a=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return(r=pd(e,t,n,r))?r.reverse():null}(t,e,i,r))?a:(a=o.connectionStart&&function(e,t,n,i){return pd(e,t,n,i)}(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:ad(e,t,n,i,o))}function cd(e,t,n){return function(e,t,n){return t<=e&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function pd(e,t,n,i){if((r=i).length<3||!(4<r.length)&&R(r,function(e,t){var n=r[t-1];return n&&er(e,n)<3}))return null;var r,o,a=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(ir(t,e)){case"v":return{x:e.x,y:n.y};case"h":return{x:n.x,y:e.y}}return{x:e.x,y:e.y}}(s[1],a,n),(o=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(rr(e[i],t,td)||rr(e[i],n,td))return e.slice(i);return e}(s,e,t))!==s?pd(e,t,n,o):s}function ld(e){return e&&/t|r|b|l/.test(e)}function ud(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function hd(i){return i.reduce(function(e,t,n){return tr(e[e.length-1],i[n+1],t,0)||e.push(t),e},[])}function dd(){}function md(e,t){return e?e.original||e:Hr(t)}function fd(e){var t=e.source,n=e.target;return wi(n,"bpmn:Activity")&&wi(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function yd(e){return wi(e,"bpmn:SubProcess")&&Ci(e)}function vd(e,t){return e===t}t(dd,Zh),dd.prototype.layoutConnection=function(e,t){t=t||{};var n,i,r=e.source,o=e.target,a=e.waypoints,s=t.connectionStart,c=t.connectionEnd;return s||(s=md(a&&a[0],r)),c||(c=md(a&&a[a.length-1],o)),(wi(e,"bpmn:Association")||wi(e,"bpmn:DataAssociation"))&&a&&!fd(e)?[].concat([s],a.slice(1,-1),[c]):(wi(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:function(e,t){if(wi(t,"bpmn:Participant"))return"source";if(wi(e,"bpmn:Participant"))return"target";if(yd(t))return"source";if(yd(e))return"target";if(wi(t,"bpmn:Event"))return"target";if(wi(e,"bpmn:Event"))return"source";return null}(e,t)}}(r,o):(wi(e,"bpmn:SequenceFlow")||fd(e))&&(n=r===o?{preferredLayouts:["b:l"]}:wi(r,"bpmn:BoundaryEvent")?{preferredLayouts:function(e,t){var n,i,r=Hr(e),o=Hr(t),a=function(e){var t=e.host;return Wr(Hr(e),t,-10)}(e),s=vd(e.host,t),c=function(e,t){return-1!==t.indexOf(e)}(a,["top","right","bottom","left"]),p=Wr(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return n=function(e,t,n,i){return n?bd[e]:i||vd(_d(e),_d(t))||function(e,t){return gd[e]===t}(xd(e),xd(t))?bd[_d(e)]:bd[xd(e)]}(a,p,c,s),i=function(e,t,n,i){return n?Ed(e)?i||function(e,t){var n=xd(e),i=gd[n];return-1!==t.indexOf(i)}(e,t)||vd(e,t)?"h":"v":i||function(e,t){var n=_d(e),i=gd[n];return-1!==t.indexOf(i)}(e,t)||vd(e,t)?"v":"h":Ed(t)||vd(_d(e),_d(t))&&xd(t)?"h":"v"}(a,p,c,s),[n+":"+i]}(r,o)}:wi(r,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:wi(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=hd(sd(r,o,s,c,a,n=F(n,t)))),i||[s,c])};var gd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},bd={top:"t",right:"r",bottom:"b",left:"l"};function xd(e){var t=/right|left/.exec(e);return t&&t[0]}function _d(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ed(e){return"right"===e||"left"===e}function wd(e){return F({original:e.point.original||e.point},e.actual)}function Sd(e,t){this._elementRegistry=e,this._graphicsFactory=t}Sd.$inject=["elementRegistry","graphicsFactory"],Sd.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(wd(i)),o.push(wd(r)),o},Sd.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},Sd.prototype._getIntersection=function(e,t,n){return Gr(this._getShapePath(e),this._getConnectionPath(t),n)},Sd.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Sd.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Sd.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Cd={__init__:["modeling","bpmnUpdater"],__depends__:[El,pu,hu,tc,mu,xu,Su,Pu,lo,ap,$u],bpmnFactory:["type",Hu],bpmnUpdater:["type",Wu],elementFactory:["type",Vu],modeling:["type",Xh],layouter:["type",dd],connectionDocking:["type",Sd]},Td=Math.round;function Rd(e,r,a,o,s){function c(e,t,n,i){return s.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function n(e,t,n){if(!t.waypoints&&t.parent){var i=function(e){return{x:e.x+Td(e.width/2),y:e.y+Td(e.height/2)}}(t);return r.init(e,i,"shape.move",{cursor:"grabbing",autoActivate:n,data:{shape:t,context:{}}}),!0}}e.on("shape.move.start",1500,function(e){var t=e.context,n=e.shape,i=o.get().slice();-1===i.indexOf(n)&&(i=[n]),F(t,{shapes:i=function(e){var t=S(e,"id");return A(e,function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0})}(i),validatedShapes:i,shape:n})}),e.on("shape.move.start",1250,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=c(n)))return!1}),e.on("shape.move.move",500,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,o={x:e.dx,y:e.dy};t=c(i,o,{x:e.x,y:e.y},r),n.delta=o,null!==(n.canExecute=t)?n.target=r:n.target=null}),e.on("shape.move.end",function(e){var t=e.context,n=t.delta,i=t.canExecute,r="attach"===i,o=t.shapes;if(!i)return!1;n.x=Td(n.x),n.y=Td(n.y),a.moveElements(o,n,t.target,{primaryShape:t.shape,attach:r})}),e.on("element.mousedown",function(e){var t=Xr(e);if(!t)throw new Error("must supply DOM mousedown event");return n(t,e.element)}),this.start=n}Rd.$inject=["eventBus","dragging","modeling","selection","rules"];var Ad="djs-dragging",Pd="drop-ok",kd="drop-not-ok",Md="new-parent",Dd="attach-ok";function Nd(e,t,a,s,c){function p(e){return function(t){return A(t,function(e){return!function(e){return e.waypoints}(e)||R(t,D({id:e.source.id}))&&R(t,D({id:e.target.id}))})}(l(e))}function l(e){var t=mt(e,!0),n=_(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return h(t.concat(n))}function u(t,n){[Dd,Pd,kd,Md].forEach(function(e){e===n?a.addMarker(t,e):a.removeMarker(t,e)})}e.on("shape.move.start",499,function(e){var t=e.context,n=t.shapes,i=t.allDraggedElements,r=p(n);if(!t.dragGroup){var o=Ne("g");_e(o,s.cls("djs-drag-group",["no-events"])),ve(a.getDefaultLayer(),o),t.dragGroup=o}r.forEach(function(e){c.addDragger(e,t.dragGroup)}),k(i=i?h([i,l(n)]):l(n),function(e){a.addMarker(e,Ad)}),t.allDraggedElements=i,t.differentParents=function(e){return 1!==function(e){return E(e).length}(S(e,function(e){return e.parent&&e.parent.id}))}(n)}),e.on("shape.move.move",499,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?u(i,Dd):t.canExecute&&i&&i.id!==r.id?u(i,Md):u(i,t.canExecute?Pd:kd)),Kt(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&u(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,n=t.allDraggedElements,i=t.dragGroup;k(n,function(e){a.removeMarker(e,Ad)}),i&&Pe(i)}),this.makeDraggable=function(e,t,n){c.addDragger(t,e.dragGroup),n&&a.addMarker(t,Ad),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}Nd.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Bd={__depends__:[io,lo,oo,Ua,za,cp],__init__:["move","movePreview"],move:["type",Rd],movePreview:["type",Nd]},Od=".djs-palette-toggle";function Ld(e,t){this._eventBus=e,this._canvas=t,this._providers=[];var n=this;e.on("tool-manager.update",function(e){var t=e.tool;n.updateToolHighlight(t)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._providers.length&&(n._init(),n._update())})}Ld.$inject=["eventBus","canvas"],Ld.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},Ld.prototype.getEntries=function(){var n={};return k(this._providers,function(e){k(e.getPaletteEntries(),function(e,t){n[t]=e})}),n},Ld.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=se(Ld.HTML_MARKUP),r=this;n.appendChild(i),ae.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(he(t,Od))return r.toggle();r.trigger("click",e)}),re.bind(i,"mousedown",function(e){e.stopPropagation()}),ae.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ld.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=q(i);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle("two-column",t),"open"in e&&o.toggle("open",e.open),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ld.prototype._update=function(){var a=de(".djs-palette-entries",this._container),e=this._entries=this.getEntries();Y(a),k(e,function(e,t){var n=e.group||"default",i=de("[data-group="+n+"]",a);i||(i=se('<div class="group" data-group="'+n+'"></div>'),a.appendChild(i));var r=e.html||(e.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),o=se(r);i.appendChild(o),e.separator||(H(o,"data-action",t),e.title&&H(o,"title",e.title),e.className&&function(e,t){var n=q(e);(g(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})}(o,e.className),e.imageUrl&&o.appendChild(se('<img src="'+e.imageUrl+'">')))}),this.open()},Ld.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(i=a[H(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,u(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},Ld.prototype._layoutChanged=function(){this._toggleState({})},Ld.prototype._needsCollapse=function(e,t){return e<50+46*Object.keys(t).length},Ld.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ld.prototype.open=function(){this._toggleState({open:!0})},Ld.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Ld.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ld.prototype.updateToolHighlight=function(i){var e;this._toolsContainer||(e=de(".djs-palette-entries",this._container),this._toolsContainer=de("[data-group=tools]",e)),k(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");if(t){var n=q(e);t=t.replace("-tool",""),n.contains("entry")&&t===i?n.add("highlighted-entry"):n.remove("highlighted-entry")}})},Ld.prototype.isOpen=function(){return q(this._container).has("open")},Ld.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ld.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Id={__init__:["palette"],palette:["type",Ld]},jd="crosshair";function zd(n,i,e,r,t,o){this._selection=t,this._dragging=e;var a=this,s=function(e){var t,n=i.getDefaultLayer();_e(t=e.frame=Ne("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(n,t)},c=function(e){var t=e.frame,n=e.bbox;_e(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ae(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&n.once("lasso.selection.ended",function(){a.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=Fd(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=Fd(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=Fd(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;p(t)}),n.on("element.mousedown",1500,function(e){if(function(e){var t=Xr(e)||e;return Jr(e)&&t.shiftKey}(e))return a.activateLasso(e.originalEvent),!0})}function Fd(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:n.x<=t.x&&t.y<n.y||n.x<t.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&n.y<t.y||t.x<n.x&&n.y<=t.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:n.x<=t.x&&n.y<t.y||n.x<t.x&&n.y<=t.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}zd.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],zd.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:jd,data:{context:{}}})},zd.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:jd,data:{context:{}}})},zd.prototype.select=function(e,t){var n=function(e,n){var i={};return k(e,function(e){var t=e;t.waypoints&&(t=ft(t)),!l(n.y)&&t.x>n.x&&(i[e.id]=e),!l(n.x)&&t.y>n.y&&(i[e.id]=e),t.x>n.x&&t.y>n.y&&(l(n.width)&&l(n.height)&&t.width+t.x<n.width+n.x&&t.height+t.y<n.height+n.y?i[e.id]=e:l(n.width)&&l(n.height)||(i[e.id]=e))}),i}(e,t);this._selection.select(w(n))},zd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},zd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var $d={__depends__:[Mu],__init__:["lassoTool"],lassoTool:["type",zd]};function Hd(n,i,e,t){this._dragging=e,t.registerTool("hand",{tool:"hand",dragging:"hand.move"}),n.on("element.mousedown",1500,function(e){if(eo(e))return this.activateMove(e.originalEvent),!1},this),n.on("hand.end",function(e){var t=e.originalEvent.target;if(!(e.hover||t instanceof SVGElement))return!1;n.once("hand.ended",function(){this.activateMove(e.originalEvent,{reactivate:!0})},this)},this),n.on("hand.move.move",function(e){var t=i.viewbox().scale;i.scroll({dx:e.dx*t,dy:e.dy*t})}),n.on("hand.move.end",function(e){var t=e.context.reactivate;return!eo(e)&&t&&n.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Hd.$inject=["eventBus","canvas","dragging","toolManager"],Hd.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:"grab",data:{context:n||{}}})},Hd.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Hd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Hd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var Wd={__depends__:[Mu],__init__:["handTool"],handTool:["type",Hd]},Gd="connect-ok",Vd="connect-not-ok";function Ud(i,e,r,o,t,n){var a=this;this._dragging=e,this._rules=n,t.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),i.on("global-connect.hover",function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,o.addMarker(n,i?Gd:Vd))}),i.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&o.removeMarker(t,n?Gd:Vd)}),i.on(["global-connect.ended"],function(e){var t=e.context.startTarget,n={x:e.x,y:e.y};if(a.canStartConnect(t))return i.once("element.out",function(){i.once(["connect.ended","connect.canceled"],function(){i.fire("global-connect.drag.ended")}),r.start(null,t,n)}),!1})}Ud.$inject=["eventBus","dragging","connect","canvas","toolManager","rules"],Ud.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Ud.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Ud.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ud.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var qd={__depends__:[Os,Ua,za,Mu],globalConnect:["type",Ud]};function Kd(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Kd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kd.prototype.getPaletteEntries=function(e){var t={},s=this._create,c=this._elementFactory,n=this._spaceTool,i=this._lassoTool,r=this._handTool,o=this._globalConnect,p=this._translate;function a(n,e,t,i,r){function o(e){var t=c.createShape(F({type:n},r));r&&(t.businessObject.di.isExpanded=r.isExpanded),s.start(e,t)}var a=n.replace(/^bpmn:/,"");return{group:e,className:t,title:i||p("Create {type}",{type:a}),action:{dragstart:o,click:o}}}function l(e,t){s.start(e,c.createParticipantShape(t))}return F(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:p("Activate the hand tool"),action:{click:function(e){r.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:p("Activate the lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:p("Activate the create/remove space tool"),action:{click:function(e){n.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:p("Activate the global connect tool"),action:{click:function(e){o.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":a("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":a("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",p("Create Intermediate/Boundary Event")),"create.end-event":a("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":a("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":a("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":a("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":a("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":a("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",p("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:p("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Yd={__depends__:[Id,$s,$u,$d,Wd,qd,Ui],__init__:["paletteProvider"],paletteProvider:["type",Kd]};function Xd(e,c,p,l,u){Ra.call(this,e),e.on("shape.move.move",250,function(e){var t=e.context,n=t.canExecute;t.visualReplacements||(t.visualReplacements={}),n.replacements?function(s){k(s.canExecute.replacements,function(e){var t=e.oldElementId,n={type:e.newElementType};if(!s.visualReplacements[t]){var i=c.get(t);F(n,{x:i.x,y:i.y});var r=p.createShape(n);l.addShape(r,i.parent);var o=de('[data-element-id="'+Za(i.id)+'"]',s.dragGroup);o&&_e(o,{display:"none"});var a=u.addDragger(r,s.dragGroup);s.visualReplacements[t]=a,l.removeShape(r)}})}(t):function(i){var r=i.visualReplacements;k(r,function(e,t){var n=de('[data-element-id="'+Za(t)+'"]',i.dragGroup);n&&_e(n,{display:"inline"}),e.remove(),r[t]&&delete r[t]})}(t)})}Xd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],t(Xd,Ra);var Zd={__depends__:[cp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xd]},Qd=Math.abs,Jd=Math.round;function em(e){return{x:e.x,y:e.y}}function tm(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Jd(e.x+e.width/2),y:Jd(e.y+e.height/2)}}function nm(e){return{x:e.x+e.width,y:e.y+e.height}}function im(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function rm(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function om(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function am(e){this._snapValues={}}om.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},om.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},om.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},om.prototype.getSnapLocations=function(){return this._snapLocations},om.prototype.setSnapLocations=function(e){this._snapLocations=e},om.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new am).initDefaults(this._defaultSnaps),n},am.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},am.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],Qd(r-e)<=n)return r}(e[n],r[n],i)},am.prototype.initDefaults=function(e){var n=this;k(e||{},function(e,t){k(e,function(e){n.add(t,e)})})};var sm=1250;function cm(e,t){this._canvas=t;var n=this;e.on(["shape.move.start","create.start"],function(e){n.initSnap(e)}),e.on(["shape.move.move","shape.move.end","create.move","create.end"],sm,function(e){e.originalEvent&&e.originalEvent.ctrlKey||im(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=I(j(this.hide,this),1e3)}cm.$inject=["eventBus","canvas"],cm.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new om);var r=tm(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},cm.prototype.snap=function(o){var e=o.context,t=e.snapContext,n=e.shape,i=e.target,r=t.getSnapLocations();if(i){var a=t.pointsForTarget(i);a.initialized||(this.addTargetSnaps(a,n,i),a.initialized=!0);var s={x:im(o,"x"),y:im(o,"y")};k(r,function(n){var i=t.getSnapOrigin(n),r={x:o.x+i.x,y:o.y+i.y};if(k(["x","y"],function(e){var t;s[e]||void 0!==(t=a.snap(r,n,e,7))&&(s[e]={value:t,originValue:t-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),k(["x","y"],function(e){var t=s[e];"object"==typeof t&&rm(o,e,t.originValue)})}},cm.prototype._createLine=function(t){var e=this._canvas.getLayer("snap"),n=Ne("path");return _e(n,{d:"M0,0 L0,0"}),Te(n).add("djs-snap-line"),ve(e,n),{update:function(e){_e(n,"number"!=typeof e?{display:"none"}:"horizontal"===t?{d:"M-100000,"+e+" L+100000,"+e,display:""}:{d:"M "+e+",-100000 L "+e+", +100000",display:""})}}},cm.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},cm.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},cm.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},cm.prototype.hide=function(){k(this._snapLines,function(e){e.update()})},cm.prototype.addTargetSnaps=function(t,e,n){k(this.getSiblings(e,n),function(e){t.add("mid",tm(e))})},cm.prototype.getSiblings=function(t,e){return e&&A(e.children,function(e){return!e.hidden&&!e.labelTarget&&e.host!==t&&e!==t})};var pm=Math.round,lm=1500;function um(e,r,o,i){cm.call(this,e,r),e.on("create.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();wi(n,"bpmn:Participant")&&wi(i,"bpmn:Process")&&hm(t,n,i.children)}),e.on(["create.move","create.end"],lm,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!im(e)&&i&&function(e,t,n,i){i=i||0;var r=t.width/2-i,o=t.height/2,a={x:n.x-r-i,y:n.y-o},s={x:n.x+r+i,y:n.y+o},c=e,p=nm(e);a.x>=c.x?rm(n,"x",c.x+i+r):s.x<=p.x&&rm(n,"x",p.x-i-r);a.y>=c.y?rm(n,"y",c.y+o):s.y<=p.y&&rm(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();wi(n,"bpmn:Participant")&&wi(i,"bpmn:Process")&&hm(t,n,i.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],lm,function(e){var t=e.context,n=t.target,i=t.shape;n&&!im(e)&&function(e,t,n){return"attach"===o.canAttach([e],t,null,n)}(i,n,e)&&function(e,t,n){var i=Fr(n),r=wl(e,n);/top/.test(r)?rm(e,"y",i.top):/bottom/.test(r)&&rm(e,"y",i.bottom);/left/.test(r)?rm(e,"x",i.left):/right/.test(r)&&rm(e,"x",i.right)}(e,0,n)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],lm,function(e){var t=e.context.shape,n=e.hover;wi(n,"bpmn:Lane")&&!da(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=Pc(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],lm,function(e){var t=e.context,n=t.source,i=t.target,r=function(e,t){return o.canConnect(e,t)}(n,i)||{};t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition),!i||"bpmn:Association"!==r.type&&"bpmn:DataOutputAssociation"!==r.type&&"bpmn:DataInputAssociation"!==r.type&&"bpmn:SequenceFlow"!==r.type?"bpmn:MessageFlow"===r.type?(wi(n,"bpmn:Event")&&(t.sourcePosition=tm(n)),wi(i,"bpmn:Event")&&dm(e,tm(i))):t.sourcePosition=t.initialSourcePosition:(t.sourcePosition=tm(n),dm(e,tm(i)))}),e.on("resize.start",lm,function(e){var t=e.context,n=t.shape;wi(n,"bpmn:SubProcess")&&Ci(n)&&(t.minDimensions={width:140,height:120}),wi(n,"bpmn:Participant")&&(t.minDimensions={width:300,height:150}),(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,n,i){var t=Pc(e),r=!0,o=!0,a=Rc(t,[t]),s=Fr(e),c={},p={};return/e/.test(n)?p.right=s.left+Ml:/w/.test(n)&&(p.left=s.right-Ml),a.forEach(function(e){var t=Fr(e);/n/.test(n)&&(t.top<s.top-10&&(r=!1),i&&Sl(s.top-t.bottom)<10&&Pl(c,"top",t.top+kl),Sl(s.top-t.top)<5&&Al(p,"top",t.bottom-kl)),/s/.test(n)&&(t.bottom>s.bottom+10&&(o=!1),i&&Sl(s.bottom-t.top)<10&&Al(c,"bottom",t.bottom-kl),Sl(s.bottom-t.bottom)<5&&Pl(p,"bottom",t.top+kl))}),t.children.filter(function(e){return!e.hidden&&!e.waypoints&&(wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Artifact"))}).forEach(function(e){var t=Fr(e);r&&/n/.test(n)&&Al(p,"top",t.top-Bl),/e/.test(n)&&Pl(p,"right",t.right+Dl),o&&/s/.test(n)&&Pl(p,"bottom",t.bottom+Ol),/w/.test(n)&&Al(p,"left",t.left-Nl)}),{min:p,max:c}}(n,t.direction,t.balanced)),wi(n,"bpmn:TextAnnotation")&&(t.minDimensions={width:50,height:30})})}function hm(e,t,n){if(n.length){var i=ft(n.filter(function(e){return!e.labelTarget&&!e.waypoints}));i.x-=50,i.y-=20,i.width+=70,i.height+=40,t.width=Math.max(t.width,i.width),t.height=Math.max(t.height,i.height),e.participantSnapBox=i}}function dm(e,t){rm(e,"x",t.x),rm(e,"y",t.y)}t(um,cm),um.$inject=["eventBus","canvas","bpmnRules","elementRegistry"],um.prototype.initSnap=function(n){var e,t,i,r,o,a=n.context,s=n.shape;o=cm.prototype.initSnap.call(this,n),wi(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(e=tm(s,n),i=em(t={width:s.width,height:s.height,x:isNaN(s.x)?pm(e.x-s.width/2):s.x,y:isNaN(s.y)?pm(e.y-s.height/2):s.y}),r=nm(t),o.setSnapOrigin("top-left",{x:i.x-n.x,y:i.y-n.y}),o.setSnapOrigin("bottom-right",{x:r.x-n.x,y:r.y-n.y}),k(s.outgoing,function(e){var t=e.waypoints[0];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),k(s.incoming,function(e){var t=e.waypoints[e.waypoints.length-1];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}));var c=a.source;c&&o.addDefaultSnap("mid",tm(c))},um.prototype.addTargetSnaps=function(o,e,t){wi(e,"bpmn:BoundaryEvent")&&"label"!==e.type&&(t=t.parent),wi(t,"bpmn:SequenceFlow")&&this.addTargetSnaps(o,e,t.parent);var n=this.getSiblings(e,t)||[];k(n,function(r){wi(r,"bpmn:Lane")||(r.waypoints?k(r.waypoints.slice(1,-1),function(e,t){var n=r.waypoints[t+2],i=r.waypoints[t];if(!n||!i)throw new Error("waypoints must exist");n.x!==e.x&&n.y!==e.y&&i.x!==e.x&&i.y!==e.y||o.add("mid",e)}):(o.add("mid",tm(r)),wi(r,"bpmn:Participant")&&(o.add("top-left",em(r)),o.add("bottom-right",nm(r)))))}),k(e.incoming,function(e){-1===n.indexOf(e.source)&&o.add("mid",tm(e.source));var t=e.waypoints[0];o.add(e.id+"-docking",t.original||t)}),k(e.outgoing,function(e){-1===n.indexOf(e.target)&&o.add("mid",tm(e.target));var t=e.waypoints[e.waypoints.length-1];o.add(e.id+"-docking",t.original||t)})};var mm={__init__:["snapping"],snapping:["type",um]};function fm(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=se(fm.BOX_HTML),this._searchInput=de(fm.INPUT_SELECTOR,this._container),this._resultsContainer=de(fm.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function ym(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+fm.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":t+=e.normal}),""!==t?t:null}(t),r=se(n);r.innerHTML=i,e.appendChild(r)}fm.$inject=["canvas","eventBus","overlays","selection"],fm.prototype._bindEvents=function(){var r=this;function e(e,t,n,i){r._eventMaps.push({el:e,type:n,listener:ae.bind(e,t,n,i)})}e(document,"html","click",function(e){r.close()}),e(this._container,fm.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),e(this._container,fm.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),r._scrollToNode(e.delegateTarget),r._preselect(e.delegateTarget)}),e(this._container,fm.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),r._select(e.delegateTarget)}),e(this._container,fm.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),e(this._container,fm.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return r.close();if(13!==e.keyCode)return 38===e.keyCode?r._scrollToDirection(!0):40===e.keyCode?r._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&r._search(e.delegateTarget.value));var t=r._getCurrentResult();return t?r._select(t):r.close()})},fm.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ae.unbind(e.el,e.type,e.listener)})},fm.prototype._search=function(e){var i=this;if(this._clearResults(),e&&""!==e){var t=this._searchProvider.find(e);if(t.length){t.forEach(function(e){var t=e.element.id,n=i._createResultNode(e,t);i._results[t]={element:e.element,node:n}});var n=de(fm.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(n),this._preselect(n)}}},fm.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},fm.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},fm.prototype._clearResults=function(){Y(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},fm.prototype._getCurrentResult=function(){return de(fm.RESULT_SELECTED_SELECTOR,this._resultsContainer)},fm.prototype._createResultNode=function(e,t){var n=se(fm.RESULT_HTML);return 0<e.primaryTokens.length&&ym(n,e.primaryTokens,fm.RESULT_PRIMARY_HTML),ym(n,e.secondaryTokens,fm.RESULT_SECONDARY_HTML),H(n,fm.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},fm.prototype.registerProvider=function(e){this._searchProvider=e},fm.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,q(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},fm.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,q(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},fm.prototype.toggle=function(){this.isOpen()?this.close():this.open()},fm.prototype.isOpen=function(){return this._open},fm.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&q(t).remove(fm.RESULT_SELECTED_CLASS);var n=H(e,fm.RESULT_ID_ATTRIBUTE),i=this._results[n].element;q(e).add(fm.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},fm.prototype._select=function(e){var t=H(e,fm.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._centerViewbox(n),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},fm.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=ft(e),i={x:n.x+n.width/2-t.outer.width/2,y:n.y+n.height/2-t.outer.height/2,width:t.outer.width,height:t.outer.height};this._canvas.viewbox(i),this._canvas.zoom(t.scale)},fm.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+fm.OVERLAY_CLASS+'"></div>'}}(ft(e));this._overlayId=this._overlays.add(e,t)}},fm.CONTAINER_SELECTOR=".djs-search-container",fm.INPUT_SELECTOR=".djs-search-input input",fm.RESULTS_CONTAINER_SELECTOR=".djs-search-results",fm.RESULT_SELECTOR=".djs-search-result",fm.RESULT_SELECTED_SELECTOR="."+(fm.RESULT_SELECTED_CLASS="djs-search-result-selected"),fm.RESULT_ID_ATTRIBUTE="data-result-id",fm.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",fm.OVERLAY_CLASS="djs-search-overlay",fm.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',fm.RESULT_HTML='<div class="djs-search-result"></div>',fm.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',fm.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var vm={__depends__:[go,lo],searchPad:["type",fm]};function gm(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function bm(e){return 0<A(e,function(e){return!!e.matched}).length}function xm(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return-1<r?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}gm.$inject=["elementRegistry","searchPad","canvas"],gm.prototype.find=function(t){var n=this._canvas.getRootElement(),e=this._elementRegistry.filter(function(e){return!e.labelTarget});return e=M(e=A(e=_(e=A(e,function(e){return e!==n}),function(e){return{primaryTokens:xm(vp(e),t),secondaryTokens:xm(e.id,t),element:e}}),function(e){return bm(e.primaryTokens)||bm(e.secondaryTokens)}),function(e){return vp(e.element)+e.element.id})};var _m={__depends__:[vm],__init__:["bpmnSearch"],bpmnSearch:["type",gm]};function Em(e){Co.call(this,e),this.on("import.parse.complete",function(e){e.error||this._collectIds(e.definitions,e.context)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}return t(Em,Co),Em.Viewer=Co,Em.NavigatedViewer=Qo,Em.prototype.createDiagram=function(e){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>',e)},Em.prototype._createModdle=function(e){var t=Co.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Em.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},Em.prototype._modules=[].concat(Em.prototype._modules,Em.prototype._interactionModules=[Lo,Vo,aa,Zo],Em.prototype._modelingModules=[ha,Ta,Ga,Na,Es,Nc,Fc,Vc,Zc,Jc,rp,wp,Cd,Bd,Yd,Zd,fp,mm,_m]),Em});
27
+ !function(o,s,e,f){var a,c=["","webkit","Moz","MS","ms","o"],t=s.createElement("div"),n="function",p=Math.round,y=Math.abs,v=Date.now;function l(e,t,n){return setTimeout(g(e,n),t)}function i(e,t,n){return!!Array.isArray(e)&&(u(e,n[t],n),!0)}function u(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==f)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function r(i,e,t){var r="DEPRECATED METHOD: "+e+"\n"+t+" AT \n";return function(){var e=new Error("get-stack-trace"),t=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=o.console&&(o.console.warn||o.console.log);return n&&n.call(o.console,r,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===f||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==f&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var h=r(function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===f)&&(e[i[r]]=t[i[r]]),r++;return e},"extend","Use `assign`."),d=r(function(e,t){return h(e,t,!0)},"merge","Use `assign`.");function m(e,t,n){var i,r=t.prototype;(i=e.prototype=Object.create(r)).constructor=e,i._super=r,n&&a(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==n?e.apply(t&&t[0]||f,t):e}function x(e,t){return e===f?t:e}function _(t,e,n){u(C(e),function(e){t.addEventListener(e,n,!1)})}function E(t,e,n){u(C(e),function(e){t.removeEventListener(e,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return-1<e.indexOf(t)}function C(e){return e.trim().split(/\s+/g)}function T(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function R(e){return Array.prototype.slice.call(e,0)}function A(e,n,t){for(var i=[],r=[],o=0;o<e.length;){var a=n?e[o][n]:e[o];T(r,a)<0&&i.push(e[o]),r[o]=a,o++}return t&&(i=n?i.sort(function(e,t){return e[n]>t[n]}):i.sort()),i}function P(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;o<c.length;){if((i=(n=c[o])?n+r:t)in e)return i;o++}return f}var k=1;function M(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||o}var D="ontouchstart"in o,N=P(o,"PointerEvent")!==f,B=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O="touch",L=25,I=1,j=4,z=8,F=1,$=2,H=4,W=8,G=16,V=$|H,U=W|G,q=V|U,K=["x","y"],Y=["clientX","clientY"];function X(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){b(t.options.enable,[t])&&n.handler(e)},this.init()}function Z(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,o=t&I&&i-r==0,a=t&(j|z)&&i-r==0;n.isFirst=!!o,n.isFinal=!!a,o&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=Q(t));1<r&&!n.firstMultiple?n.firstMultiple=Q(t):1===r&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,c=t.center=J(i);t.timeStamp=v(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=ie(s,c),t.distance=ne(s,c),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==I&&o.eventType!==j||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=te(t.deltaX,t.deltaY);var p=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=y(p.x)>y(p.y)?p.x:p.y,t.scale=a?(h=a.pointers,d=i,ne(d[0],d[1],Y)/ne(h[0],h[1],Y)):1,t.rotation=a?(l=a.pointers,u=i,ie(u[1],u[0],Y)+ie(l[1],l[0],Y)):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,r,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(L<s||a.velocity===f)){var c=t.deltaX-a.deltaX,p=t.deltaY-a.deltaY,l=ee(s,c,p);i=l.x,r=l.y,n=y(l.x)>y(l.y)?l.x:l.y,o=te(c,p),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}(n,t);var l,u;var h,d;var m=e.element;w(t.srcEvent.target,m)&&(m=t.srcEvent.target);t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Q(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:p(e.pointers[n].clientX),clientY:p(e.pointers[n].clientY)},n++;return{timeStamp:v(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:p(e[0].clientX),y:p(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:p(n/t),y:p(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:y(e)>=y(t)?e<0?$:H:t<0?W:G}function ne(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(M(this.element),this.evWin,this.domHandler)}};var re={mousedown:I,mousemove:2,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}m(se,X,{handler:function(e){var t=re[e.type];t&I&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=j),this.pressed&&(t&j&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:I,pointermove:2,pointerup:j,pointercancel:z,pointerout:z},pe={2:O,3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),m(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a=o==O,s=T(t,e.pointerId,"pointerId");r&I&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(j|z)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var de={touchstart:I,touchmove:2,touchend:j,touchcancel:z};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,X.apply(this,arguments)}m(me,X,{handler:function(e){var t=de[e.type];if(t===I&&(this.started=!0),this.started){var n=function(e,t){var n=R(e.touches),i=R(e.changedTouches);t&(j|z)&&(n=A(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(j|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}}});var fe={touchstart:I,touchmove:2,touchend:j,touchcancel:z},ye="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=ye,this.targetIds={},X.apply(this,arguments)}m(ve,X,{handler:function(e){var t=fe[e.type],n=function(e,t){var n=R(e.touches),i=this.targetIds;if(t&(2|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=R(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===I)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;return s.length?[A(o.concat(s),"identifier",!0),s]:void 0}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}});var ge=2500;function be(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new ve(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function xe(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);-1<e&&i.splice(e,1)},ge)}}m(be,X,{handler:function(e,t,n){var i=n.pointerType==O,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&I?(this.primaryTouch=t.changedPointers[0].identifier,xe.call(this,t)):e&(j|z)&&xe.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=25&&a<=25)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var _e=P(t.style,"touchAction"),Ee=_e!==f,we="manipulation",Se="none",Ce="pan-x",Te="pan-y",Re=function(){if(!Ee)return!1;var t={},n=o.CSS&&o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){t[e]=!n||o.CSS.supports("touch-action",e)}),t}();function Ae(e,t){this.manager=e,this.set(t)}Ae.prototype={set:function(e){"compute"==e&&(e=this.compute()),Ee&&this.manager.element.style&&Re[e]&&(this.manager.element.style[_e]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return u(this.manager.recognizers,function(e){b(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),function(e){if(S(e,Se))return Se;var t=S(e,Ce),n=S(e,Te);if(t&&n)return Se;if(t||n)return t?Ce:Te;if(S(e,we))return we;return"auto"}(t.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Se)&&!Re.none,o=S(i,Te)&&!Re[Te],a=S(i,Ce)&&!Re[Ce];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&U?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Pe=1;function ke(e){this.options=a({},this.defaults,e||{}),this.id=k++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Pe,this.simultaneous={},this.requireFail=[]}function Me(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function De(e){return e==G?"down":e==W?"up":e==$?"left":e==H?"right":""}function Ne(e,t){var n=t.manager;return n?n.get(e):e}function Be(){ke.apply(this,arguments)}function Oe(){Be.apply(this,arguments),this.pX=null,this.pY=null}function Le(){Be.apply(this,arguments)}function Ie(){ke.apply(this,arguments),this._timer=null,this._input=null}function je(){Be.apply(this,arguments)}function ze(){Be.apply(this,arguments)}function Fe(){ke.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function $e(e,t){return(t=t||{}).recognizers=x(t.recognizers,$e.defaults.preset),new He(e,t)}ke.prototype={defaults:{},set:function(e){return a(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(i(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ne(e,this)).id]||(t[e.id]=e).recognizeWith(this),this},dropRecognizeWith:function(e){return i(e,"dropRecognizeWith",this)||(e=Ne(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(i(e,"requireFailure",this))return this;var t=this.requireFail;return-1===T(t,e=Ne(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(i(e,"dropRequireFailure",this))return this;e=Ne(e,this);var t=T(this.requireFail,e);return-1<t&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return 0<this.requireFail.length},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(t){var n=this,e=this.state;function i(e){n.manager.emit(e,t)}e<8&&i(n.options.event+Me(e)),i(n.options.event),t.additionalEvent&&i(t.additionalEvent),8<=e&&i(n.options.event+Me(e))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Pe)))return!1;e++}return!0},recognize:function(e){var t=a({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);56&this.state&&(this.state=Pe),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},m(Be,ke,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,r=this.attrTest(e);return i&&(n&z||!r)?16|t:i||r?n&j?8|t:2&t?4|t:2:32}}),m(Oe,Be,{defaults:{event:"pan",threshold:10,pointers:1,direction:q},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Te),e&U&&t.push(Ce),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(i=t.direction&V?(r=0===o?F:o<0?$:H,n=o!=this.pX,Math.abs(e.deltaX)):(r=0===a?F:a<0?W:G,n=a!=this.pY,Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Be.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(Le,Be,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),m(Ie,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(j|z)&&!r)this.reset();else if(e.eventType&I)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&j)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=v(),this.manager.emit(this.options.event,this._input)))}}),m(je,Be,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),m(ze,Be,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|U,pointers:1},getTouchAction:function(){return Oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|U)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&U&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&y(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),m(Fe,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[we]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&I&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=j)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ne(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=l(function(){this.state=8,this.tryEmit()},t.interval,this),2):8}return 32},failTimeout:function(){return this._timer=l(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),$e.VERSION="2.0.7",$e.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[je,{enable:!1}],[Le,{enable:!1},["rotate"]],[ze,{direction:V}],[Oe,{direction:V},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[Ie]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function He(e,t){var n;this.options=a({},$e.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(N?he:B?ve:D?be:se))(n,Z),this.touchAction=new Ae(this,this.options.touchAction),We(this,!0),u(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function We(n,i){var r,o=n.element;o.style&&(u(n.options.cssProps,function(e,t){r=P(o.style,t),o.style[r]=i?(n.oldCssProps[r]=o.style[r],e):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}He.prototype={set:function(e){return a(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&14&n.state&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ke)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(i(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),(e.manager=this).touchAction.update(),e},remove:function(e){if(i(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=T(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==f&&t!==f){var n=this.handlers;return u(C(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==f){var n=this.handlers;return u(C(e),function(e){t?n[e]&&n[e].splice(T(n[e],t),1):delete n[e]}),this}},emit:function(e,t){var n,i,r;this.options.domEvents&&(n=e,i=t,(r=s.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[e]&&this.handlers[e].slice();if(o&&o.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var a=0;a<o.length;)o[a](t),a++}},destroy:function(){this.element&&We(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},a($e,{INPUT_START:I,INPUT_MOVE:2,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Pe,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:H,DIRECTION_UP:W,DIRECTION_DOWN:G,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:U,DIRECTION_ALL:q,Manager:He,Input:X,TouchAction:Ae,TouchInput:ve,MouseInput:se,PointerEventInput:he,TouchMouseInput:be,SingleTouchInput:me,Recognizer:ke,AttrRecognizer:Be,Tap:Fe,Pan:Oe,Swipe:ze,Pinch:Le,Rotate:je,Press:Ie,on:_,off:E,each:u,merge:d,extend:h,assign:a,inherit:m,bindFn:g,prefixed:P}),(void 0!==o?o:"undefined"!=typeof self?self:{}).Hammer=$e,"function"==typeof f&&f.amd?f(function(){return $e}):Ge.exports?Ge.exports=$e:o.Hammer=$e}(window,document)}),ea=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function ta(e,t){return t.get(e,!1)}function na(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function ia(t){function e(e){setTimeout(function(){M(ea,function(e){re.unbind(t,e,na,!0)})},500)}re.bind(t,"touchstart",function(e){M(ea,function(e){re.bind(t,e,na,!0)})},!0),re.bind(t,"touchend",e,!0),re.bind(t,"touchcancel",e,!0);var r=new Jo.Manager(t,{inputClass:Jo.TouchInput,recognizers:[]}),n=new Jo.Tap,i=new Jo.Pan({threshold:10}),o=new Jo.Press,a=new Jo.Pinch,s=new Jo.Tap({event:"doubletap",taps:2});return a.requireFailure(i),a.requireFailure(o),r.add([i,o,a,s,n]),r.reset=function(e){var n=this.recognizers,i=this.session;i.stopped||(r.stop(e),setTimeout(function(){var e,t;for(e=0;t=n[e];e++)t.reset(),t.state=8;i.curRecognizer=null},0))},r.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&r.reset(!0)}),r}function ra(e,o,t,a,n){var s,c=ta("dragging",e),i=ta("move",e),r=ta("contextPad",e),p=ta("palette",e);function l(t){return function(e){n.fire(t,e)}}function u(e){return ee(e,"svg, .djs-element",!0)}function h(e){function t(e){var t=u(e.target),n=t&&a.get(t);if(i&&o.getRootElement()!==n)return i.start(e,n,!0);!function(e){var i=0,r=0;function t(e){var t=e.deltaX-i,n=e.deltaY-r;o.scroll({dx:t,dy:n}),i=e.deltaX,r=e.deltaY}function n(e){s.off("panmove",t),s.off("panend",n),s.off("pancancel",n)}s.on("panmove",t),s.on("panend",n),s.on("pancancel",n)}()}(s=ia(e)).on("doubletap",l("element.dblclick")),s.on("tap",l("element.click")),s.on("panstart",t),s.on("press",t),s.on("pinchstart",function(e){var i=o.zoom(),r=e.center;function t(e){var t=1-(1-e.scale)/1.5,n=Math.max(.2,Math.min(4,t*i));o.zoom(n,r),na(e)}function n(e){s.off("pinchmove",t),s.off("pinchend",n),s.off("pinchcancel",n),s.reset(!0)}s.on("pinchmove",t),s.on("pinchend",n),s.on("pinchcancel",n)})}c&&t.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Qr(t),i=u(document.elementFromPoint(n.x,n.y)),r=i&&a.get(i);r!==e.hover&&(e.hover&&c.out(e),r&&(c.hover({element:r,gfx:i}),e.hover=r,e.hoverGfx=i))}}),r&&t.on("contextPad.create",function(e){var t=ia(e.pad.html);t.on("panstart",function(e){r.trigger("dragstart",e,!0)}),t.on("press",function(e){r.trigger("dragstart",e,!0)}),t.on("tap",function(e){r.trigger("click",e)})}),p&&t.on("palette.create",function(e){var t=ia(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),t.on("canvas.init",function(e){h(e.svg)})}function oa(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}ra.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],oa.$inject=["canvas","eventBus"],oa.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Ne("rect");_e(n,{x:-1e4,y:1e4,width:10,height:10}),_e(n,t),ve(e,n);var i=Ne("rect");_e(i,{x:1e4,y:1e4,width:10,height:10}),_e(i,t),ve(e,i)};var aa={__depends__:[{__depends__:[io],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",ra],touchFix:["type",oa]}]};function sa(e){return e&&e[e.length-1]}function ca(e){return e.y}function pa(e){return e.x}var la={left:pa,center:pa,right:function(e){return e.x+e.width},top:ca,middle:ca,bottom:function(e){return e.y+e.height}};function ua(e){this._modeling=e}ua.$inject=["modeling"],ua.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ua.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ua.prototype._alignmentPosition=function(e,t){var n,i,r,o,a,s=this._getOrientationDetails(e),c=s.axis,p=s.dimension,l={},u={},h=!1;if(this._isType(e,["left","top"]))l[e]=t[0][c];else if(this._isType(e,["right","bottom"]))r=sa(t),l[e]=r[c]+r[p];else if(this._isType(e,["center","middle"])){if(M(t,function(e){var t=e[c]+Math.round(e[p]/2);u[t]?u[t].elements.push(e):u[t]={elements:[e],center:t}}),n=R(u,function(e){return 1<e.elements.length&&(h=!0),e.elements.length}),h)return l[e]=sa(n).center,l;i=t[0],r=sa(t=R(t,function(e){return e[c]+e[p]})),l[e]=(o=i,a=r,Math.round((o[c]+a[c]+a[p])/2))}return l},ua.prototype.trigger=function(e,t){var n=this._modeling,i=R(k(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),la[t]),r=this._alignmentPosition(t,i);n.alignElements(i,r)};var ha={__init__:["alignElements"],alignElements:["type",ua]};function da(t,e){return v(e,function(e){return wi(t,e)})}var ma=50,fa=250,ya=10;function va(e,t){var n,i=Fr(e),r=Hr(e),o=function(e,t){var n=Fr(e);function i(e){return wi(e,"bpmn:SequenceFlow")}var r=x(x([].concat(wa(e,i).map((a=5,function(e){return{shape:e,weight:a,distanceTo:function(e){var t=Fr(e);return t.left-n.right}}})),Ea(e,i).map((o=1,function(e){return{shape:e,weight:o,distanceTo:function(e){var t=Fr(e);return n.left-t.right}}}))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||fa<n||(r=e[String(n)]=e[String(n)]||{value:n,count:0},i=r.count+=1*a,(!c||c.count<i)&&(e.fav=r)),e},{});var o;var a;return r.fav?r.fav.value:ma}(e),a="left",s=30;return wi(e,"bpmn:BoundaryEvent")&&-1!==(a=Wr(e,e.host,-25)).indexOf("top")&&(s*=-1),ba(e,t,{x:i.right+o+t.width/2,y:r.y+(n=a,-1!=n.indexOf("top")?-80:-1!=n.indexOf("bottom")?80:0)},{y:{margin:s,rowSize:80}})}function ga(e,t,n){var i,r,o={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return A((r=_a(i=e),i.host&&(r=r.concat(_a(i.host))),i.attachers&&(r=r.concat(i.attachers.reduce(function(e,t){return e.concat(_a(t))},[]))),r),function(e){return e!==n&&"intersect"===Wr(e,o,ya)})}function ba(e,s,c,p){function t(o){var a={x:c.x,y:c.y};return["x","y"].forEach(function(e){var t=p[e];if(t){var n="x"===e?"width":"height",i=t.margin,r=t.rowSize;a[e]=i<0?Math.min(o[e]+i-s[n]/2,c[e]-r+i):Math.max(l[e]+l[n]+i+s[n]/2,c[e]+r+i)}}),a}for(var l;l=ga(e,c,s);)c=t(l);return c}function xa(){return!0}function _a(e,t){return[].concat(wa(e,t),Ea(e,t))}function Ea(e,t){return t||(t=xa),e.incoming.filter(t).map(function(e){return e.source})}function wa(e,t){return t||(t=xa),e.outgoing.filter(t).map(function(e){return e.target})}function Sa(n,r){function o(e,t){return n.fire(e,t)}this.append=function(e,t){var n=o("autoPlace",{source:e,shape:t});n||(n=function(e,t){if(wi(t,"bpmn:TextAnnotation"))return i=t,r=Fr(n=e),ba(n,i,{x:r.right+i.width/2,y:r.top-50-i.height/2},{y:{margin:-30,rowSize:20}});var n,i,r;if(da(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return a=t,s=Fr(o=e),ba(o,a,{x:s.right-10+a.width/2,y:s.bottom+40+a.width/2},{x:{margin:30,rowSize:30}});var o,a,s;if(wi(t,"bpmn:FlowNode"))return va(e,t);return c=e,p=t,l=Fr(c),u=Hr(c),{x:l.right+ma+p.width/2,y:u.y};var c,p,l,u}(e,t));var i=r.appendShape(e,t,n,e.parent);return o("autoPlace.end",{shape:i}),i}}function Ca(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}Sa.$inject=["eventBus","modeling"],Ca.$inject=["eventBus","selection"];var Ta={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Sa],autoPlaceSelectionBehavior:["type",Ca]};function Ra(e){this._eventBus=e}Ra.$inject=["eventBus"],Ra.prototype.on=function(e,r,o,a,s,c){if((u(r)||l(r))&&(c=s,s=a,a=o,o=r,r=null),u(o)&&(c=s,s=a,a=o,o=1e3),P(s)&&(c=s,s=!1),!u(a))throw new Error("handlerFn must be a function");g(e)||(e=[e]);var p=this._eventBus;M(e,function(e){var t,n,i=["commandStack",e,r].filter(function(e){return e}).join(".");p.on(i,o,s?(t=a,n=c,function(e){return t.call(n||null,e.context,e.command,e)}):a,c)})};function Aa(e,t,n,i){Ra.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,r=t.parent||t.newParent;(!n||!1!==n.root&&!1!==n.autoResize)&&o._expand([i],r)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=h(w(t.closure.topLevel)),i=t.hints,r=!i||i.autoResize;!1!==r&&M(S(n,function(e){return e.parent.id}),function(e,t){g(r)&&(e=e.filter(function(e){return-1!==r.indexOf(e)})),o._expand(e,t)})}),this.postExecuted(["shape.toggleCollapse"],function(e){var t=e.context,n=t.hints,i=t.shape;(!n||!1!==n.root&&!1!==n.autoResize)&&(i.collapsed||o._expand(i.children||[],i))}),this.postExecuted(["shape.resize"],function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;(!n||!1!==n.root&&!1!==n.autoResize)&&r&&o._expand([i],r)})}function Pa(e){e.invoke(Aa,this)}function ka(e){Ra.call(this,e),this.init()}function Ma(e){ka.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}function Da(e,t){Ma.call(this,e),this._modeling=t}M(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(o){Ra.prototype[o]=function(e,t,n,i,r){(u(e)||l(e))&&(r=i,i=n,n=t,t=e,e=null),this.on(e,o,t,n,i,r)}}),Aa.$inject=["eventBus","elementRegistry","modeling","rules"],t(Aa,Ra),Aa.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Fr(ft(e)),o=Fr(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),$r($({},o,a))},Aa.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(r=t,(i=n).x!==r.x||i.y!==r.y||i.width!==r.width||i.height!==r.height){var i,r;this.resize(t,n);var o=t.parent;o&&this._expand([t],o)}}},Aa.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Aa.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Aa.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)},Pa.$inject=["injector"],t(Pa,Aa),Pa.prototype.resize=function(e,t){wi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},ka.$inject=["eventBus"],t(ka,Ra),ka.prototype.addRule=function(e,t,i){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.canExecute(e,t,function(e,t,n){return i(e)},!0)})},ka.prototype.init=function(){},Ma.$inject=["eventBus"],t(Ma,ka),Ma.prototype.canResize=function(e,t){return!1},t(Da,Ma),Da.$inject=["eventBus","modeling"],Da.prototype.canResize=function(e,t){if(!wi(t,"bpmn:Participant")&&!wi(t,"bpmn:Lane")&&!wi(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(e){(wi(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Na={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Pa],bpmnAutoResizeProvider:["type",Da]},Ba=Math.round,Oa="djs-drag-active";function La(e){e.preventDefault()}function Ia(u,h,d){var m,f={threshold:5,trapClick:!0};function y(e){var t=h.viewbox(),n=h._container.getBoundingClientRect();return{x:t.x+(e.x-n.left)/t.scale,y:t.y+(e.y-n.top)/t.scale}}function v(e,t){t=t||m;var n=u.createEvent($({},t.payload,t.data,{isTouch:t.isTouch}));return!1!==u.fire("drag."+e,n)&&u.fire(t.prefix+"."+e,n)}function g(e,t){var n,i=m.payload,r=m.displacement,o=m.globalStart,a=Qr(e),s=Wo(a,o),c=m.localStart,p=y(a),l=Wo(p,c);if(!m.active&&(t||(n=s,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))>m.threshold))){if($(i,{x:Ba(c.x+r.x),y:Ba(c.y+r.y),dx:0,dy:0},{originalEvent:e}),!1===v("start"))return C();m.active=!0,m.keepSelection||(i.previousSelection=d.get(),d.select(null)),m.cursor&&jo(m.cursor),h.addMarker(h.getRootElement(),Oa)}Zr(e),m.active&&($(i,{x:Ba(p.x+r.x),y:Ba(p.y+r.y),dx:Ba(l.x),dy:Ba(l.y)},{originalEvent:e}),v("move"))}function b(e){var t=!0;m.active&&(e&&Zr(m.payload.originalEvent=e),t=v("end")),!1===t&&v("rejected"),v("ended",i(!0!==t))}function x(e){27===e.which&&(La(e),C())}function _(e){var t;m.active&&(t=$o(u),setTimeout(t,400),La(e)),b(e)}function E(e){g(e)}function w(e){var t=m.payload;t.hoverGfx=e.gfx,t.hover=e.element,v("hover")}function S(e){v("out");var t=m.payload;t.hoverGfx=null,t.hover=null}function C(e){var t;if(m){var n=m.active;n&&v("cancel"),t=i(e),n&&v("canceled",t)}}function i(e){var t,n;v("cleanup"),zo(),n=m.trapClick?_:b,re.unbind(document,"mousemove",g),re.unbind(document,"dragstart",La),re.unbind(document,"selectstart",La),re.unbind(document,"mousedown",n,!0),re.unbind(document,"mouseup",n,!0),re.unbind(document,"keyup",x),re.unbind(document,"touchstart",E,!0),re.unbind(document,"touchcancel",C,!0),re.unbind(document,"touchmove",g,!0),re.unbind(document,"touchend",b,!0),u.off("element.hover",w),u.off("element.out",S),h.removeMarker(h.getRootElement(),Oa);var i=m.payload.previousSelection;return!1!==e&&i&&!d.get().length&&d.select(i),t=m,m=null,t}u.on("diagram.destroy",C),this.init=function(e,t,n,i){m&&C(!1),"string"==typeof t&&(i=n,n=t,t=null);var r,o,a,s,c,p,l=(i=$({},f,i||{})).data||{};s=i.trapClick?_:b,e?(r=Xr(e)||e,o=Qr(e),Zr(e),"dragstart"===r.type&&La(r)):(r=null,o={x:0,y:0}),a=y(o),t||(t=a),p=r,c="undefined"!=typeof TouchEvent&&p instanceof TouchEvent,m=$({prefix:n,data:l,payload:{},globalStart:o,displacement:Wo(t,a),localStart:a,isTouch:c},i),i.manual||(c?(re.bind(document,"touchstart",E,!0),re.bind(document,"touchcancel",C,!0),re.bind(document,"touchmove",g,!0),re.bind(document,"touchend",b,!0)):(re.bind(document,"mousemove",g),re.bind(document,"dragstart",La),re.bind(document,"selectstart",La),re.bind(document,"mousedown",s,!0),re.bind(document,"mouseup",s,!0)),re.bind(document,"keyup",x),u.on("element.hover",w),u.on("element.out",S)),v("init"),i.autoActivate&&g(e,!0)},this.move=g,this.hover=w,this.out=S,this.end=b,this.cancel=C,this.context=function(){return m},this.setOptions=function(e){$(f,e)}}function ja(t,a,s){var n=this;t.on("drag.start",function(e){t.once("drag.move",function(){t.once("drag.move",function(e){n.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var t,n,i,r,o=e.originalEvent;if(o instanceof MouseEvent)t=Qr(o),n=document.elementFromPoint(t.x,t.y),(r=ee(n,"svg, .djs-element",!0))&&(i=s.get(r),a.hover({element:i,gfx:r}))}}}Ia.$inject=["eventBus","canvas","selection"],ja.$inject=["eventBus","dragging","elementRegistry"];var za={__init__:["hoverFix"],__depends__:[lo],dragging:["type",Ia],hoverFix:["type",ja]};function Fa(e,t){this._eventBus=e,this._canvas=t,this._init()}Fa.$inject=["eventBus","canvas"],Fa.prototype.getHoverContext=function(){var e=this._canvas.viewbox();return{element:this._hoverElement,point:{x:e.x+Math.round(this._mouseX/e.scale),y:e.y+Math.round(this._mouseY/e.scale)}}},Fa.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=j(this._setMousePosition,this),t.addEventListener("mousemove",this._setMousePosition),e.on("diagram.destroy",function(){t.removeEventListener("mousemove",this._setMousePosition)},this),e.on("element.hover",this._setHoverElement,this)},Fa.prototype._setHoverElement=function(e){this._hoverElement=e.element},Fa.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var $a={__init__:["mouseTracking"],mouseTracking:["type",Fa]};function Ha(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=$({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}function Wa(e,t,n){return t<e&&e<n}Ha.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"],Ha.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)Wa(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))},Ha.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ha.prototype.setOptions=function(e){this._opts=$({},this._opts,e)},Ha.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Qr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Ga={__depends__:[za,$a],__init__:["autoScroll"],autoScroll:["type",Ha]};function Va(e){this._commandStack=e.get("commandStack",!1)}Va.$inject=["injector"],Va.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Ua={__init__:["rules"],rules:["type",Va]},qa="djs-bendpoint",Ka="djs-segment-dragger";function Ya(e,t){var n=Ne("g");Te(n).add(qa),ve(e,n);var i=Ne("circle");_e(i,{cx:0,cy:0,r:4}),Te(i).add("djs-visual"),ve(n,i);var r=Ne("circle");return _e(r,{cx:0,cy:0,r:10}),Te(r).add("djs-hit"),ve(n,r),t&&Te(n).add(t),n}function Xa(e,t,n){var i=Ne("g"),r=or(t,n),o=ir(t,n);return ve(e,i),function(e,t,n){var i=Ne("g");ve(e,i);var r=Ne("rect");_e(r,{x:-7,y:-1.5,width:14,height:3}),Te(r).add("djs-visual"),ve(i,r);var o=Ne("rect");_e(o,{x:-10,y:-4.5,width:20,height:9}),Te(o).add("djs-hit"),ve(i,o),Yt(i,"h"===n?90:0)}(i,0,o),Te(i).add(Ka),Te(i).add("h"===o?"vertical":"horizontal"),Kt(i,r.x,r.y),i}var Za=e(function(e,t){var n;n=i,e.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),i=n.length,r=-1,o="",a=n.charCodeAt(0);++r<i;)0!=(t=n.charCodeAt(r))?o+=1<=t&&t<=31||127==t||0==r&&48<=t&&t<=57||1==r&&48<=t&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==r&&1==i&&45==t||!(128<=t||45==t||95==t||48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122)?"\\"+n.charAt(r):n.charAt(r):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t}(n)}),Qa={"<":"&lt",">":"&gt"};function Ja(e){return e.replace(/[<>]/g,function(e){return Qa[e]})}var es=Math.round,ts=Math.max;var ns=10;function is(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(er(i,t)<=ns)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||(n=e,s=Ir((o=ns,[["M",(r=t).x,r.y],["m",0,-o],["a",o,o,0,1,1,0,2*o],["a",o,o,0,1,1,0,-2*o],["z"]]),(i=[],n.forEach(function(e,t){i.push([0===t?"M":"L",e.x,e.y])}),i)),c=s[0],p=s[s.length-1],c?c!==p?c.segment2!==p.segment2?{point:n[a=ts(c.segment2,p.segment2)-1],bendpoint:!0,index:a}:{point:{x:es(c.x+p.x)/2,y:es(c.y+p.y)/2},index:c.segment2}:{point:{x:es(c.x),y:es(c.y)},index:c.segment2}:null);var n,i,r,o,a,s,c,p}function rs(e,r,i,f,y){function v(e,t){return is(e,function(e,t){var n,i=Qr(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(r,t))}function o(e,t){var n,i,r,o,a,s,c,p,l,u,h,d=t.waypoints,m=v(d,e);if(m)return i=d,r=10,u=(n=m).index,h=n.point,!(u<=0||n.bendpoint)&&(s=or(o=i[u-1],a=i[u]),c=ir(o,a),p=Math.abs(h.x-s.x),l=Math.abs(h.y-s.y),c&&p<=r&&l<=r)?y.start(e,t,m.index):f.start(e,t,m.index,!m.bendpoint),!0}function a(e,t,n){re.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function s(e,t){var n=r.getLayer("overlays"),i=de('.djs-bendpoints[data-element-id="'+Za(e.id)+'"]',n);return!i&&t&&(_e(i=Ne("g"),{"data-element-id":e.id}),Te(i).add("djs-bendpoints"),ve(n,i),a(i,"mousedown",e),a(i,"click",e),a(i,"dblclick",e)),i}function n(i,e){e.waypoints.forEach(function(e,t){var n=Ya(i);ve(i,n),Kt(n,e.x,e.y)}),Ya(i,"floating")}function c(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)ir(n=r[o-1],i=r[o])&&Xa(e,n,i)}function p(e){var t=s(e);return t||(n(t=s(e,!0),e),c(t,e)),t}function t(e){var t=s(e);t&&(M(me("."+Ka,t),function(e){Ae(e)}),M(me("."+qa,t),function(e){Ae(e)}),c(t,e),n(t,e))}e.on("connection.changed",function(e){t(e.element)}),e.on("connection.remove",function(e){var t=s(e.element);t&&Ae(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=p(n),e.add?Te(t).add(e.marker):Te(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i=e.element,r=i.waypoints;if(r){if(!(t=de(".floating",s(i,!0))))return;(n=v(r,e.originalEvent))&&Kt(t,n.point.x,n.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return o(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&p(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(p(t),i.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){i.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=s(t);i&&_e(i,{"data-element-id":n})}}),this.addHandles=p,this.updateHandles=t,this.getBendpointsContainer=s}rs.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var os="connect-ok",as="connect-not-ok",ss="connect-hover",cs="djs-updating",ps="connection.updateWaypoints",ls="connection.reconnectStart",us="connection.reconnectEnd",hs=Math.round;function ds(e,t,s,c,n,i,p){var a=e.get("connectionDocking",!1);function l(e){n.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,n,i){var r,o=t.waypoints,a=s.getGraphics(t);r={connection:t,bendpointIndex:n,insert:i,type:i||0!==n?i||n!==o.length-1?ps:us:ls},c.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:a,context:r}})},t.on("bendpoint.move.start",function(e){var t=e.context,n=t.connection,i=n.waypoints,r=i.slice(),o=t.insert,a=t.bendpointIndex;t.originalWaypoints=i,o&&r.splice(a,0,null),n.waypoints=r,t.draggerGfx=Ya(s.getLayer("overlays")),Te(t.draggerGfx).add("djs-dragging"),s.addMarker(n,cs)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){s.addMarker(e.hover,ss);var n=t.allowed=i.allowed(t.type,t);n?(s.removeMarker(t.hover,as),s.addMarker(t.hover,os),t.target=t.hover):!1===n&&(s.removeMarker(t.hover,os),s.addMarker(t.hover,as),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(s.removeMarker(t,ss),s.removeMarker(t,e.context.target?os:as))}),t.on("bendpoint.move.move",function(e){var t,n,i=e.context,r=i.type,o=e.connection;o.waypoints[i.bendpointIndex]={x:e.x,y:e.y},a&&(i.hover&&(r===ls&&(t=i.hover),r===us&&(n=i.hover)),o.waypoints=a.getCroppedWaypoints(o,t,n)),Kt(i.draggerGfx,e.x,e.y),l(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,n=t.hover,i=t.connection;Ae(t.draggerGfx),t.newWaypoints=i.waypoints.slice(),i.waypoints=t.originalWaypoints,s.removeMarker(i,cs),n&&(s.removeMarker(n,os),s.removeMarker(n,as))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],a=n.allowed;if(o.x=hs(o.x),o.y=hs(o.y),a&&n.type===ls)p.reconnectStart(n.connection,n.target,o);else if(a&&n.type===us)p.reconnectEnd(n.connection,n.target,o);else{if(!1===a||n.type!==ps)return l(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},p.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===er(t,i=e[r+1])||tr(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){l(e)})}ds.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var ms="connect-hover",fs="djs-updating";function ys(e,t,n){return vs(e,t,e[t]+n)}function vs(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function gs(e){return"x"===e?"y":"x"}function bs(e,t,n){var i,r;return e.original?e.original:(i=Hr(t),vs(e,r=gs(n),i[r]))}function xs(e,t,h,d,n,i,m){var r=e.get("connectionDocking",!1);function f(e,t){if(!r)return t;var n,i=e.waypoints;return e.waypoints=t,n=r.getCroppedWaypoints(e),e.waypoints=i,n}function y(e){n.update("connection",e.connection,e.connectionGfx)}function v(e,t,n){var i,r,o,a,s,c,p=e.newWaypoints,l=p[e.segmentStartIndex+t],u=p[e.segmentEndIndex+t],h=gs(e.axis),d=(i=n,r=l,o=u,a=h,s=Math.max(r[a],o[a]),c=Math.min(r[a],o[a]),vs(r,a,Math.min(Math.max(c+20,i[a]),s-20)));Kt(e.draggerGfx,d.x,d.y)}this.start=function(e,t,n){var i,r,o,a=h.getGraphics(t),s=n-1,c=n,p=t.waypoints,l=p[s],u=p[c];(r=ir(l,u))&&(o="v"===r?"y":"x",0===s&&(l=bs(l,t.source,o)),c===p.length-1&&(u=bs(u,t.target,o)),i={connection:t,segmentStartIndex:s,segmentEndIndex:c,segmentStart:l,segmentEnd:u,axis:o},d.init(e,{x:(l.x+u.x)/2,y:(l.y+u.y)/2},"connectionSegment.move",{cursor:"x"===o?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:a,context:i}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,n=e.connection,i=h.getLayer("overlays");t.originalWaypoints=n.waypoints.slice(),t.draggerGfx=Xa(i,t.segmentStart,t.segmentEnd),Te(t.draggerGfx).add("djs-dragging"),h.addMarker(n,fs)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,s=i.segmentStart,c=i.segmentEnd,p=i.axis,l=i.originalWaypoints.slice(),u=ys(s,p,e["d"+p]),h=ys(c,p,e["d"+p]),d=l.length,m=0;l[o]=u,l[a]=h,o<2&&(t=Wr(r.source,u),1===o?"intersect"===t&&(l.shift(),l[0]=u,m--):"intersect"!==t&&(l.unshift(s),m++)),d-3<a&&(n=Wr(r.target,h),a===d-2?"intersect"===n&&(l.pop(),l[l.length-1]=h):"intersect"!==n&&l.push(c)),i.newWaypoints=r.waypoints=f(r,l),v(i,m,e),i.newSegmentStartIndex=o+m,y(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,h.addMarker(e.hover,ms)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&h.removeMarker(t,ms)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,n=t.connection;t.draggerGfx&&Ae(t.draggerGfx),h.removeMarker(n,fs)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,y(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}});var o,a,s,c=(a=r,s=0,{waypoints:(o=i).filter(function(e,t){return!tr(o[t-1],o[t+1],e)||(s=t<=a?s-1:s,!1)}),segmentOffset:s}),p=f(n,c.waypoints),l=c.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+l}};m.updateWaypoints(n,p,u)})}xs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var _s=Math.abs,Es=Math.round;function ws(e){function p(e,t){if(g(e)){for(var n=e.length;n--;)if(_s(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(e-10<i)return t-i+e}return t}function l(e){if(e.width)return{x:Es(e.width/2+e.x),y:Es(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var t,n,i=function(e){var t=e.snapPoints,n=e.connection,i=n.waypoints,r=e.segmentStart,o=e.segmentStartIndex,a=e.segmentEnd,s=e.segmentEndIndex,c=e.axis;if(t)return t;var p=[i[o-1],r,a,i[s+1]];return o<2&&p.unshift(l(n.source)),s>i.length-3&&p.unshift(l(n.target)),e.snapPoints=t={horizontal:[],vertical:[]},M(p,function(e){e&&(e=e.original||e,"y"===c&&t.horizontal.push(e.y),"x"===c&&t.vertical.push(e.x))}),t}(e.context),r=e.x,o=e.y;if(i){var a=r-(t=p(i.vertical,r)),s=o-(n=p(i.horizontal,o));$(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n})}}),e.on("bendpoint.move.move",1500,function(e){var t=e.context,n=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},M(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(t),i=t.target,r=i&&l(i),o=e.x,a=e.y;if(n){var s=o-p(r?n.vertical.concat([r.x]):n.vertical,o),c=a-p(r?n.horizontal.concat([r.y]):n.horizontal,a);$(e,{dx:e.dx-s,dy:e.dy-c,x:e.x-s,y:e.y-c})}})}ws.$inject=["eventBus"];var Ss={__depends__:[za,Ua],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",rs],bendpointMove:["type",ds],connectionSegmentMove:["type",xs],bendpointSnapping:["type",ws]},Cs=Math.min,Ts=Math.max;function Rs(e){e.preventDefault()}function As(e){e.stopPropagation()}function Ps(e){this.container=e.container,this.parent=se('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=de("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=j(this.autoResize,this),this.handlePaste=j(this.handlePaste,this)}function ks(e,t){this._eventBus=e,this._providers=[],this._textbox=new Ps({container:t.getContainer(),keyHandler:j(this._handleKey,this),resizeHandler:j(this._handleResize,this)})}Ps.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=F(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);$(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=F(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return $(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&$(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,re.bind(o,"keydown",this.keyHandler),re.bind(o,"mousedown",As),re.bind(o,"paste",this.handlePaste),i.autoResize&&re.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Ps.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},Ps.prototype.insertText=function(e){document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Ps.prototype._insertTextIE=function(n){var e,t,i,r=this.getSelection(),o=r.startContainer,a=r.endContainer,s=r.startOffset,c=r.endOffset,p=r.commonAncestorContainer,l=(e=p.childNodes,[].slice.call(e));if(p.nodeType===Node.TEXT_NODE){var u=o.textContent;o.textContent=u.substring(0,s)+n+u.substring(c),t=o,i=s+n.length}else if(o===this.content&&a===this.content){var h=document.createTextNode(n);this.content.insertBefore(h,l[s]),i=(t=h).textContent.length}else{var d=l.indexOf(o),m=l.indexOf(a);l.forEach(function(e,t){t===d?e.textContent=o.textContent.substring(0,s)+n+a.textContent.substring(c):d<t&&t<=m&&fe(e)}),t=o,i=s+n.length}t&&void 0!==i&&setTimeout(function(){self.setSelection(t,i)})},Ps.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Ps.prototype.resizable=function(){var i=this,r=this.parent,e=this.resizeHandle,o=parseInt(this.style.minWidth)||0,a=parseInt(this.style.minHeight)||0,s=parseInt(this.style.maxWidth)||1/0,c=parseInt(this.style.maxHeight)||1/0;if(!e){var p,l,u,h;e=this.resizeHandle=se('<div class="djs-direct-editing-resize-handle"></div>');var n=function(e){Rs(e),As(e);var t=Cs(Ts(u+e.clientX-p,o),s),n=Cs(Ts(h+e.clientY-l,a),c);r.style.width=t+"px",r.style.height=n+"px",i.resizeHandler({width:u,height:h,dx:e.clientX-p,dy:e.clientY-l})},d=function(e){Rs(e),As(e),re.unbind(document,"mousemove",n,!1),re.unbind(document,"mouseup",d,!1)};re.bind(e,"mousedown",function(e){Rs(e),As(e),p=e.clientX,l=e.clientY;var t=r.getBoundingClientRect();u=t.width,h=t.height,re.bind(document,"mousemove",n),re.bind(document,"mouseup",d)})}$(e.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),r.appendChild(e)},Ps.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),re.unbind(t,"keydown",this.keyHandler),re.unbind(t,"mousedown",As),re.unbind(t,"input",this.autoResize),re.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),fe(n)),fe(e)},Ps.prototype.getValue=function(){return this.content.innerText.trim()},Ps.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ps.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},ks.$inject=["eventBus","canvas"],ks.prototype.registerProvider=function(e){this._providers.push(e)},ks.prototype.isActive=function(){return!!this._active},ks.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ks.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ks.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},ks.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ks.prototype.getValue=function(){return this._textbox.getValue()},ks.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},ks.prototype._handleResize=function(e){this._fire("resize",e)},ks.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=A(this._providers,function(e){return(n=e.activate(t))?e:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:t,context:n,provider:e},n.options&&n.options.resizable&&(this.resizable=!0),this._fire("activate")),!!n};var Ms={__depends__:[io],__init__:["directEditing"],directEditing:["type",ks]};function Ds(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:i},this._current=null,this._init()}Ds.$inject=["config.contextPad","eventBus","overlays"],Ds.prototype._init=function(){var e=this._eventBus,i=this;e.on("selection.changed",function(e){var t=e.newSelection;1===t.length?i.open(t[0]):i.close()}),e.on("elements.delete",function(e){M(e.elements,function(e){i.isOpen(e)&&i.close()})}),e.on("element.changed",function(e){var t=e.element,n=i._current;n&&n.element===t&&i.open(t,!0)})},Ds.prototype.registerProvider=function(e){this._providers.push(e)},Ds.prototype.getEntries=function(t){var n={};return M(this._providers,function(e){M(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},Ds.prototype.trigger=function(e,t,n){var i,r,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(i=a[H(s,"data-action")].action,r=t.originalEvent||t,u(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},Ds.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ds.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),c=n.html;M(t,function(e,t){var n,i,r,o,a=e.group||"default",s=se(e.html||'<div class="entry" draggable="true"></div>');H(s,"data-action",t),(n=de("[data-group="+a+"]",c))||(n=se('<div class="group" data-group="'+a+'"></div>'),c.appendChild(n)),n.appendChild(s),e.className&&(i=s,r=e.className,o=q(i),(g(r)?r:r.split(/\s+/g)).forEach(function(e){o.add(e)})),e.title&&H(s,"title",e.title),e.imageUrl&&s.appendChild(se('<img src="'+e.imageUrl+'">'))}),q(c).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},Ds.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=se('<div class="djs-context-pad"></div>'),r=$({html:i},this._overlaysConfig);ae.bind(i,".entry","click",function(e){t.trigger("click",e)}),ae.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),re.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",r);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},Ds.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ds.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Ns={__depends__:[io,go],contextPad:["type",Ds]},Bs="connect-ok",Os="connect-not-ok";function Ls(e,r,p,n,o,f){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n,i,r,o,a,s,c,p,l=e.context,u=l.source,h=l.target,d=l.visual,m=l.sourcePosition;t={x:e.x,y:e.y},i=m,r=t,o=u,a=h,s=f.getShapePath(o),c=a&&f.getShapePath(a),p=f.getConnectionPath({waypoints:[i,r]}),_e(d,{points:[(n=[i=Gr(s,p,!0)||i,r=a&&Gr(c,p,!1)||r])[0].x,n[0].y,n[1].x,n[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,r=e.hover;null!==(t=n.canExecute=l(i,r))&&(n.target=r,o.addMarker(r,t?Bs:Os))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&o.removeMarker(t.target,t.canExecute?Bs:Os),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;_e(t=Ne("polyline"),{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),ve(o.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,n=t.source,i=t.sourcePosition,r=t.target,o={x:e.x,y:e.y},a=t.canExecute||l(n,r);if(!a)return!1;var s=null,c={connectionStart:i,connectionEnd:o};"object"==typeof a&&(s=a),p.connect(n,r,s,c)}),this.start=function(e,t,n,i){"object"!=typeof n&&(i=n,n=Hr(t)),r.init(e,"connect",{autoActivate:i,data:{shape:t,context:{source:t,sourcePosition:n}}})}}Ls.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Is={__depends__:[lo,Ua,za],connect:["type",Ls]},js="drop-ok",zs="drop-not-ok",Fs="attach-ok",$s="new-parent";function Hs(e,i,c,p,o,a,s){function l(t,n){[Fs,js,zs,$s].forEach(function(e){e===n?o.addMarker(t,e):o.removeMarker(t,e)})}e.on("create.move",function(e){var t,n=e.context,i=e.hover,r=n.shape,o=n.source,a={x:e.x,y:e.y};t=n.canExecute=i&&function(e,t,n,i){if(!t)return!1;var r,o,a,s={source:n,shape:e,target:t,position:i};return(o=c.allowed("shape.attach",s))||(r=c.allowed("shape.create",s)),(r||o)&&(a=n&&c.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:o}})),!(!r&&!o)&&{attach:o,connect:a}}(r,i,o,a),i&&null!==t&&(n.target=i,t&&t.attach?l(i,Fs):l(i,t?$s:zs))}),e.on("create.move",750,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;_e(t=Ne("g"),a.cls("djs-drag-group",["no-events"])),ve(o.getDefaultLayer(),t),Te(n=Ne("g")).add("djs-dragger"),ve(t,n),Kt(n,e.width/-2,e.height/-2);var r=Ne("g");return Te(r).add("djs-visual"),ve(n,r),i=r,s.drawShape(i,e),t}(n)),Kt(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&l(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,i=t.shape,r=t.target,o=t.canExecute,a=o&&o.attach,s=o&&o.connect,c={x:e.x,y:e.y};if(!o)return!1;i=s?p.appendShape(n,i,c,r,{attach:a,connection:!0===s?{}:s}):p.createShape(i,c,r,{attach:a}),t.shape=i}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),this.start=function(e,t,n){i.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:{shape:t,source:n}}})}}Hs.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var Ws={__depends__:[za,lo,Ua],create:["type",Hs]},Gs="data-id";function Vs(e,t,n){var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}Vs.$inject=["config.popupMenu","eventBus","canvas"],Vs.prototype.registerProvider=function(e,t){this._providers[e]=t},Vs.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._providers[t],i=n.getEntries(e),r=n.getHeaderEntries&&n.getHeaderEntries(e),o=0<i.length,a=r&&0<r.length;return!o&&!a},Vs.prototype.open=function(e,t,n){var i=this._providers[t];if(!e)throw new Error("Element is missing");if(!i)throw new Error("Provider is not registered: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close(),this._emit("open");var r=this._current={provider:i,className:t,element:e,position:n};i.getHeaderEntries&&(r.headerEntries=i.getHeaderEntries(e)),r.entries=i.getEntries(e),r.container=this._createContainer();var o=r.headerEntries||[],a=r.entries||[];o.length&&r.container.appendChild(this._createEntries(r.headerEntries,"djs-popup-header")),a.length&&r.container.appendChild(this._createEntries(r.entries,"djs-popup-body"));var s=this._canvas.getContainer();this._attachContainer(r.container,s,n.cursor)},Vs.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindHandlers(),fe(this._current.container),this._current.container=null)},Vs.prototype.isOpen=function(){return!!this._current.container},Vs.prototype.trigger=function(e){e.preventDefault();var t=H(e.delegateTarget||e.target,Gs),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},Vs.prototype._getEntry=function(e){var t=D({id:e}),n=A(this._current.entries,t)||A(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},Vs.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},Vs.prototype._createContainer=function(){var e=se('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return $(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),q(e).add(n),e},Vs.prototype._attachContainer=function(e,t,n){var i=this;ae.bind(e,".entry","click",function(e){i.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},Vs.prototype._updateScale=function(e){var t,n,i,r,o=this._canvas.zoom(),a=this._config.scale,s=o;!0!==a&&(n=!1===a?t=1:(t=a.min,a.max),c(t)&&o<t&&(s=t),c(n)&&n<o&&(s=n)),r="scale("+s+")",(i=e).style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){i.style[e+"transform"]=r})},Vs.prototype._assureIsInbounds=function(e,t){var n,i,r=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,c=e.scrollHeight,p={},l=t.x-r.left,u=t.y-r.top;o+s>r.width&&(p.x=!0),a+c>r.height&&(p.y=!0),p.x&&p.y?(n=l-s+"px",i=u-c+"px"):p.x?(n=l-s+"px",i=u+"px"):p.y&&u<c?(n=l+"px",i="10px"):p.y&&(n=l+"px",i=u-c+"px"),$(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},Vs.prototype._createEntries=function(e,t){var n=se("<div>"),i=this;return q(n).add(t),M(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},Vs.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=se("<div>"),n=q(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),H(t,Gs,e.id),e.label){var i=se("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(se('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},Vs.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},Vs.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var Us={__init__:["popupMenu"],popupMenu:["type",Vs]},qs=Math.round;function Ks(e){this._modeling=e}Ks.$inject=["modeling"],Ks.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=qs(e.x+(t.width||e.width)/2),t.y=qs(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var Ys={__init__:["replace"],replace:["type",Ks]},Xs=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"];function Zs(e,t){var n=[];return M(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n}function Qs(e,t){this._eventBus=e,this._bpmnFactory=t}Qs.prototype.clone=function(s,c,e){var p=this,l={newElement:c,hasNestedProperty:!1};return M(e=R(e,function(e){return"bpmn:extensionElements"===e}),function(e){var t,n,i,r=s.get(e),o=c.get(e),a=c.$model.getPropertyDescriptor(c,e);o!==r&&(a&&(a.isId||a.isReference)||(i=r,v(["boolean","string","number"],function(e){return typeof i===e})||null===r?c.set(e,r):g(r)?M(r,function(e){var t;l.refTopLevelProperty=e,t=p._deepClone(e,l),l.hasNestedProperty&&(t.$parent=c,o.push(t)),l.hasNestedProperty=!1}):(n=e.replace(/bpmn:/,""),l.refTopLevelProperty=r,t=p._deepClone(r,l),l.hasNestedProperty&&(t.$parent=c).set(n,t),l.hasNestedProperty=!1)))}),c},Qs.prototype._deepClone=function(s,c){var p=this,l=this._eventBus,u=this._bpmnFactory.create(s.$type),e=k(Object.keys(s),function(e){var t=u.$model.getPropertyDescriptor(u,e);return(!t||!t.isId&&!t.isReference)&&(-1===Xs.indexOf(e)&&"$type"!==e)});return e.length||(c.hasNestedProperty=!0),M(e,function(a){void 0!==s[a]&&(s[a].$type||g(s[a]))?g(s[a])?(u[a]=[],M(s[a],function(e){var t,n=s.$model.getTypeDescriptor(e.$type);if(n){var i,r,o;if(!l.fire("property.clone",{newElement:c.newElement,refTopLevelProperty:c.refTopLevelProperty,propertyDescriptor:n})&&"bpmn:ExtensionElements"===s.$type&&n.meta&&n.meta.allowedIn&&(i=n,r=c.newElement.$type,(1!==(o=i.meta.allowedIn).length||"*"!==o[0])&&-1===o.indexOf(r)))return!1;((t=p._deepClone(e,c)).$parent=u)[a]||(u[a]=[]),c.hasNestedProperty=!0,u[a].push(t)}})):s[a].$type&&(u[a]=p._deepClone(s[a],c),u[a]&&(c.hasNestedProperty=!0,u[a].$parent=u)):(c.hasNestedProperty=!0,u[a]=s[a])}),u};var Js=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function ec(f,y,v,g,b,e){var x=new Qs(e,f);this.replaceElement=function(n,i,e){e=e||{};var t,r,o,a=i.type,s=n.businessObject;if(tc(s)&&"bpmn:SubProcess"===a&&(r=i,(o=(t=n)&&_(t,"collapsed")?t.collapsed:!Ci(t))!==(r&&(_(r,"collapsed")||_(r,"isExpanded"))?_(r,"collapsed")?r.collapsed:!r.isExpanded:o)&&(t.collapsed=o,1)))return b.toggleCollapse(n),n;var c,p=f.create(a),l={type:a,businessObject:p},u=Zs(s.$descriptor),h=Zs(p.$descriptor,!0),d=(c=h,u.filter(function(e){return-1!==c.indexOf(e)}));$(p,F(i,Js));var m=k(d,function(e){var t=e.replace(/bpmn:/,"");return"eventDefinitions"===t?nc(n,i.eventDefinitionType):"loopCharacteristics"===t?!Ti(p):!(e in p||"processRef"===t&&!1===i.isExpanded||"triggeredByEvent"===t||-1!==Xs.indexOf(t))});return p=x.clone(s,p,m),i.eventDefinitionType&&(nc(p,i.eventDefinitionType)||(l.eventDefinitionType=i.eventDefinitionType)),wi(s,"bpmn:Activity")&&(tc(s)?l.isExpanded=Ci(s):i&&_(i,"isExpanded")&&(l.isExpanded=i.isExpanded),Ci(s)&&!wi(s,"bpmn:Task")&&l.isExpanded&&(l.width=n.width,l.height=n.height)),tc(s)&&!tc(p)&&(e.moveChildren=!1),wi(s,"bpmn:Participant")&&(!0===i.isExpanded?p.processRef=f.create("bpmn:Process"):e.moveChildren=!1,l.width=n.width,l.height=y._getDefaultSize(p).height),p.name=s.name,da(s,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&da(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=s.default),("fill"in s.di||"stroke"in s.di)&&$(l,{colors:F(s.di,["fill","stroke"])}),l=v.replaceElement(n,l,e),!1!==e.select&&g.select(l),l}}function tc(e){return wi(e,"bpmn:SubProcess")}function nc(e,t){var n=Si(e);return t&&n.get("eventDefinitions").some(function(e){return wi(e,t)})}ec.$inject=["bpmnFactory","elementFactory","replace","selection","modeling","eventBus"];var ic={__depends__:[lo,Ys],bpmnReplace:["type",ec]};function rc(c){return function(e){var t=e.target,n=Si(c),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=n.triggeredByEvent===t.triggeredByEvent,s=void 0===t.isExpanded||t.isExpanded===Ci(n);return!(r&&o&&a&&s)}}var oc=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],ac=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],sc=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],cc=[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],pc=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],lc=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],uc=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}}],hc=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],dc=[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],mc=[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],fc=[{label:"Sequence Flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default Flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional Flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],yc=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function vc(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._bpmnReplace=i,this._rules=r,this._translate=o,this.register()}vc.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],vc.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},vc.prototype.getEntries=function(r){var e,o=r.businessObject;if(!this._rules.allowed("shape.replace",{element:r}))return[];var a=rc(r);return wi(o,"bpmn:StartEvent")&&!Ti(o.$parent)?(e=k(oc,a),this._createEntries(r,e)):wi(o,"bpmn:Participant")?(e=k(yc,function(e){return Ci(o)!==e.target.isExpanded}),this._createEntries(r,e)):wi(o,"bpmn:StartEvent")&&Ti(o.$parent)?(e=k(mc,function(e){var t=!1!==e.target.isInterrupting,n=Si(r).isInterrupting===t;return a(e)||!a(e)&&!n}),this._createEntries(r,e)):wi(o,"bpmn:EndEvent")?(e=k(sc,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!wi(o.$parent,"bpmn:Transaction"))&&a(e)}),this._createEntries(r,e)):wi(o,"bpmn:BoundaryEvent")?(e=k(dc,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!wi(o.attachedToRef,"bpmn:Transaction"))return!1;var n=!1!==t.cancelActivity,i=o.cancelActivity==n;return a(e)||!a(e)&&!i}),this._createEntries(r,e)):wi(o,"bpmn:IntermediateCatchEvent")||wi(o,"bpmn:IntermediateThrowEvent")?(e=k(ac,a),this._createEntries(r,e)):wi(o,"bpmn:Gateway")?(e=k(cc,a),this._createEntries(r,e)):wi(o,"bpmn:Transaction")?(e=k(lc,a),this._createEntries(r,e)):Ti(o)&&Ci(o)?(e=k(uc,a),this._createEntries(r,e)):wi(o,"bpmn:SubProcess")&&Ci(o)?(e=k(pc,a),this._createEntries(r,e)):wi(o,"bpmn:AdHocSubProcess")&&!Ci(o)?(e=k(hc,function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return rc(r)&&(!n||i)}),this._createEntries(r,e)):wi(o,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(r,fc):wi(o,"bpmn:FlowNode")?(e=k(hc,a),wi(o,"bpmn:SubProcess")&&!Ci(o)&&(e=k(e,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(r,e)):[]},vc.prototype.getHeaderEntries=function(e){var t=[];return wi(e,"bpmn:Activity")&&!Ti(e)&&(t=t.concat(this._getLoopEntries(e))),!wi(e,"bpmn:SubProcess")||wi(e,"bpmn:Transaction")||Ti(e)||t.push(this._getAdHocEntry(e)),t},vc.prototype._createEntries=function(n,e){var i=[],r=this;return M(e,function(e){var t=r._createMenuEntry(e,n);i.push(t)}),i},vc.prototype._createSequenceFlowEntries=function(t,e){var n=Si(t),i=[],r=this._modeling,o=this._moddle,a=this;return M(e,function(e){switch(e.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&wi(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(e,t,function(){var e=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(t,{conditionExpression:e})}));break;default:if(wi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t,{conditionExpression:void 0})}));if((wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:void 0})}))}}),i},vc.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:i(e.label),className:e.className,id:e.actionName,action:n}},vc.prototype._getLoopEntries=function(i){var r=this,e=this._translate;function t(e,t){var n;t.active?n=void 0:(n=r._moddle.create(t.options.loopCharacteristics),t.options.isSequential&&(n.isSequential=t.options.isSequential)),r._modeling.updateProperties(i,{loopCharacteristics:n})}var n,o,a,s=Si(i).loopCharacteristics;return s&&(n=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:e("Parallel Multi Instance"),active:a,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:e("Sequential Multi Instance"),active:n,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:e("Loop"),active:o,action:t,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},vc.prototype._getAdHocEntry=function(n){var e=this._translate,i=wi(Si(n),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:e("Ad-hoc"),active:i,action:function(e,t){return r(n,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var gc={__depends__:[Us,ic],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",vc]},bc=Math.max,xc=Math.min,_c=20;function Ec(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return l(r)&&(i=(/top|left/.test(e)?xc:bc)(i,r)),l(o)&&(i=(/top|left/.test(e)?bc:xc)(i,o)),i}function Sc(e,t){return void 0!==e?e:_c}function Cc(e){return!e.waypoints&&"label"!==e.type}function Tc(e,t){var n,i,r,o,a,s,c;if((n=void 0===e.length?k(e.children,Cc):e).length)return i=ft(n),"object"==typeof(r=t)?(o=Sc(r.left),a=Sc(r.right),s=Sc(r.top),c=Sc(r.bottom)):o=a=s=c=Sc(r),{x:i.x-o,y:i.y-s,width:i.width+o+a,height:i.height+s+c}}var Rc=Math.abs;var Ac=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function Pc(e,t){return t=t||[],e.children.filter(function(e){wi(e,"bpmn:Lane")&&(Pc(e,t),t.push(e))}),t}function kc(e){return e.children.filter(function(e){return wi(e,"bpmn:Lane")})}function Mc(e){return function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(da(e,t))return e;return null}(e,Ac)||e}function Dc(c,e){var t,n=Mc(c),i=Pc(n,wi(n,"bpmn:Process")?[]:[n]),p=Fr(c),l=Fr(e),u=(t=c,Ec(Fr(e),Fr(t))),h=[];return i.forEach(function(e){if(e!==c){var t,n,i=0,r=u.right,o=0,a=u.left,s=Fr(e);u.top&&(Rc(s.bottom-p.top)<10&&(o=l.top-s.bottom),Rc(s.top-p.top)<5&&(i=l.top-s.top)),u.bottom&&(Rc(s.top-p.bottom)<10&&(i=l.bottom-s.top),Rc(s.bottom-p.bottom)<5&&(o=l.bottom-s.bottom)),(i||r||o||a)&&h.push({shape:e,newBounds:(t=e,n={top:i,right:r,bottom:o,left:a},{x:t.x+(n.left||0),y:t.y+(n.top||0),width:t.width-(n.left||0)+(n.right||0),height:t.height-(n.top||0)+(n.bottom||0)})})}}),h}function Nc(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(e){var t=e.context.shape;if(eo(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function Bc(e,t,n){var i=e.$instanceOf(t),r=!1;return M(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}Nc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],Nc.prototype.getContextPadEntries=function(t){var p=this._contextPad,i=this._modeling,o=this._elementFactory,n=this._connect,a=this._create,l=this._popupMenu,u=this._canvas,e=this._rules,s=this._autoPlace,c=this._translate,r={};if("label"===t.type)return r;var h=t.businessObject;function d(e,t){n.start(e,t)}function m(i,e,t,r){function n(e,t){var n=o.createShape($({type:i},r));a.start(e,n,t)}return"string"!=typeof t&&(r=t,t=c("Append {type}",{type:i.replace(/^bpmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:s?function(e,t){var n=o.createShape($({type:i},r));s.append(t,n)}:n}}}function f(n){return function(e,t){i.splitLane(t,n),p.open(t,!0)}}if(da(h,["bpmn:Lane","bpmn:Participant"])&&Ci(h)){var y=kc(t);$(r,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add Lane above"),action:{click:function(e,t){i.addLane(t,"top")}}}}),y.length<2&&(120<=t.height&&$(r,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two Lanes"),action:{click:f(2)}}}),180<=t.height&&$(r,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:f(3)}}})),$(r,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add Lane below"),action:{click:function(e,t){i.addLane(t,"bottom")}}}})}wi(h,"bpmn:FlowNode")&&(wi(h,"bpmn:EventBasedGateway")?$(r,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Bc(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?$(r,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):wi(h,"bpmn:EndEvent")||h.isForCompensation||Bc(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Ti(h)||$(r,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),l.isEmpty(t,"bpmn-replace")||$(r,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,t){var n,i,r,o,a,s,c=$((n=t,i=u.getContainer(),r=p.getPad(n).html,o=i.getBoundingClientRect(),a=r.getBoundingClientRect(),s=a.top-o.top,{x:a.left-o.left,y:s+a.height+5}),{cursor:{x:e.x,y:e.y}});l.open(t,"bpmn-replace",c)}}}}),da(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&$(r,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using "+(h.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:d,dragstart:d}}}),da(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&$(r,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using DataInputAssociation"),action:{click:d,dragstart:d}}});var v=e.allowed("elements.delete",{elements:[t]});return g(v)&&(v=v[0]===t),v&&$(r,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(e){i.removeElements([t])}}}}),r};var Oc={__depends__:[Ms,Ns,lo,Is,Ws,gc],__init__:["contextPadProvider"],contextPadProvider:["type",Nc]};function Lc(){}Lc.prototype.get=function(){return this._data},Lc.prototype.set=function(e){this._data=e},Lc.prototype.clear=function(){var e=this._data;return delete this._data,e},Lc.prototype.isEmpty=function(){return!this._data};var Ic={clipboard:["type",Lc]};function jc(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,n){return n.priority=1,n.id=e.id,e.parent&&(n.parent=e.parent.id),e.labelTarget&&(n.priority=4,n.labelTarget=e.labelTarget.id),e.host&&(n.priority=2,n.host=e.host.id),"number"==typeof e.x&&(n.x=e.x,n.y=e.y),e.width&&(n.width=e.width,n.height=e.height),e.waypoints&&(n.priority=3,n.waypoints=[],M(e.waypoints,function(e){var t={x:e.x,y:e.y};e.original&&(t.original={x:e.original.x,y:e.original.y}),n.waypoints.push(t)})),e.source&&e.target&&(n.source=e.source.id,n.target=e.target.id),n})}jc.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],jc.prototype.copy=function(e){var t,r,n=this._clipboard;if(g(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),r=this._bbox=Ho(ft(t.allShapes)),delete t.allShapes,M(t,function(i){M(i,function(e){var n,t;e.labelTarget?(t=A(i,D({id:e.labelTarget})),n=t.waypoints?Wo(e,t.waypoints[0]):Wo(e,t)):3===e.priority?(n=[],M(e.waypoints,function(e){var t=Wo(e,r);n.push(t)})):n=Wo(e,r),e.delta=n})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?n.clear():n.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},jc.prototype.paste=function(e){var t,n=this._clipboard,i=this._modeling,r=this._eventBus,o=this._rules,a=n.get(),s=e.element,c=e.point;n.isEmpty()||(t=x(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)||(e[i]=t),e},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},jc.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Wo(t,t.labelTarget):(3===t.priority?(i=[],M(t.waypoints,function(e){var t=Wo(e,n);i.push(t)})):i=Wo(t,n),i)},jc.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=A(e,D({id:t.source.id})),i=A(e,D({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!A(e,D({id:t.labelTarget.id})))},jc.prototype.registerDescriptor=function(e){if("function"!=typeof e)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(e))throw new Error("this descriptor is already registered");this._descriptors.push(e)},jc.prototype._executeDescriptors=function(t){return t.descriptor||(t.descriptor={}),M(this._descriptors,function(e){t.descriptor=e(t.element,t.descriptor)}),t},jc.prototype.createTree=function(e){var r,n,i,t,o,a=this._rules,s=this,c={},p=[],l=(n={},i=[],t=[],o=[],M(e,function(e){var t=e.parent;n[t.id]||(n[t.id]=[]),-1===i.indexOf(t.id)&&i.push(t.id),n[t.id].push(e)}),M(i,function(e){M(n[e],function(e){n[e.id]&&o.push(e.id)})}),M(i,function(e){-1===o.indexOf(e)&&(t=t.concat(n[e]))}),t);function u(e){var t=m(p,D({element:e.element}));if(-1===t)return p.push(e);p[t].depth<e.depth&&(p.splice(t,1),p.push(e))}return c.allShapes=[],dt(l,function(e,t,n){var i=e.children;if(!e.labelTarget)return M(e.labels,function(e){u({element:e,depth:n})}),M([e.attachers,e.incoming,e.outgoing],function(e){e&&e.length&&M(e,function(e){M(e.labels,function(e){u({element:e,depth:n})}),u({element:e,depth:n})})}),u({element:e,depth:n}),i||void 0}),p=R(p=b(p,function(e){return s._executeDescriptors(e)}),function(e){return e.descriptor.priority}),r=b(p,function(e){return e.element}),M(p,function(e){var t,n,i=e.depth;s.hasRelations(c.allShapes,e.element)&&(t=r,n=e.element,a.allowed("element.copy",{collection:t,element:n})&&(c.allShapes.push(e.element),c[i]||(c[i]=[]),c[i].push(e.descriptor)))}),c};var zc={__depends__:[Ic,Ua,$a],__init__:["copyPaste"],copyPaste:["type",jc]};function Fc(t,n,e){M(e,function(e){void 0!==n[e]&&(t[e]=n[e])})}function $c(h,e,t,n,d,m){var f=new Qs(e,h);t.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Si(e),i={};return t.type=e.type,Fc(t,n.di,["isExpanded"]),Fc(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type||(Fc(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id)),t}),e.on("element.paste",function(e){var t,n,i,r,o=e.descriptor,a=e.createdElements,s=o.parent,c=d.getRootElement(),p=o.oldBusinessObject;t=h.create(p.$type);var l,u=Zs(p.$descriptor);(u=k(u,function(e){return-1===Xs.indexOf(e.replace(/bpmn:/,""))}),o.businessObject=f.clone(p,t,u),"label"!==o.type)&&(wi(s,"bpmn:Process")&&(o.parent=wi(c,"bpmn:Collaboration")?c:s),"bpmn:DataOutputAssociation"!==o.type&&"bpmn:DataInputAssociation"!==o.type&&"bpmn:MessageFlow"!==o.type||(o.parent=c),wi(s,"bpmn:Lane")&&(o.parent=s.parent),o.waypoints&&(n=a[o.source],i=a[o.target],n&&i&&(n=n.element,i=i.element),(r=m.canConnect(n,i))&&(o.type=r.type)),delete t.id,h._ensureId(t),"bpmn:Participant"===o.type&&o.processRef&&(o.processRef=t.processRef=h.create("bpmn:Process")),Fc(t,o,["isExpanded","triggeredByEvent"]),l=o,M(["triggeredByEvent"],function(e){l[e]&&delete l[e]}))})}$c.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Hc={__depends__:[zc],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",$c]},Wc={horizontal:["x","width"],vertical:["y","height"]};function Gc(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return M(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),k(e,function(e){return e[n]<i+50})})}Gc.$inject=["modeling"],Gc.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Gc.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Gc.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(e){r=e(r,n,i)}),r):e},Gc.prototype._createGroups=function(e){var o=[],a=this,s=this._axis,c=this._dimension;if(!s)throw new Error('must have a defined "axis" and "dimension"');return M(R(e,s),function(e,t){var n,i=a._findRange(e,s,c),r=o[o.length-1];r&&a._hasIntersection(r.range,i)?o[o.length-1].elements.push(e):(n={range:i,elements:[e]},o.push(n))}),o},Gc.prototype._setOrientation=function(e){var t=Wc[e];this._axis=t[0],this._dimension=t[1]},Gc.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Gc.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Vc={__init__:["distributeElements"],distributeElements:["type",Gc]};function Uc(e){e.registerFilter(function(e){return k(e,function(e){var t=da(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}Uc.$inject=["distributeElements"];var qc={__depends__:[Vc],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Uc]},Kc="is not a registered action";function Yc(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function Xc(e,t){return new Error(e+" "+t)}Yc.$inject=["eventBus","injector"],Yc.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),i=e.get("modeling",!1),r=e.get("selection",!1),n=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("mouseTracking",!1),p=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var e=r.get();o.copy(e)}),c&&o&&this.register("paste",function(){var e=c.getHoverContext();o.paste(e)}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),i&&r&&s&&this.register("removeSelection",function(){var e=r.get();if(e.length){var t,n=s.allowed("elements.delete",{elements:e});!1!==n&&(t=g(n)?n:e).length&&i.removeElements(t.slice())}}),p&&this.register("moveCanvas",function(e){p.moveCanvas(e)}),l&&this.register("moveSelection",function(e){l.moveSelection(e.direction,e.accelerated)})},Yc.prototype.trigger=function(e,t){if(!this._actions[e])throw Xc(e,Kc);return this._actions[e](t)},Yc.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);M(e,function(e,t){n._registerAction(t,e)})},Yc.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Xc(e,"is already registered");this._actions[e]=t},Yc.prototype.unregister=function(e){if(!this.isRegistered(e))throw Xc(e,Kc);this._actions[e]=void 0},Yc.prototype.getActions=function(){return Object.keys(this._actions)},Yc.prototype.isRegistered=function(e){return!!this._actions[e]};var Zc={__init__:["editorActions"],editorActions:["type",Yc]};function Qc(e){e.invoke(Yc,this)}t(Qc,Yc),Qc.$inject=["injector"],Qc.prototype._registerDefaultActions=function(e){Yc.prototype._registerDefaultActions.call(this,e);var i=e.get("canvas",!1),r=e.get("elementRegistry",!1),o=e.get("selection",!1),t=e.get("spaceTool",!1),n=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1);i&&r&&o&&this._registerAction("selectElements",function(){var t=i.getRootElement(),e=r.filter(function(e){return e!==t});return o.select(e),e}),t&&this._registerAction("spaceTool",function(){t.toggle()}),n&&this._registerAction("lassoTool",function(){n.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),o&&c&&this._registerAction("distributeElements",function(e){var t=o.get(),n=e.type;t.length&&c.trigger(t,n)}),o&&p&&this._registerAction("alignElements",function(e){var t=o.get(),n=[],i=e.type;t.length&&(n=k(t,function(e){return!wi(e,"bpmn:Lane")}),p.trigger(n,i))}),o&&h&&this._registerAction("setColor",function(e){var t=o.get();t.length&&h.setColor(t,e)}),o&&l&&this._registerAction("directEditing",function(){var e=o.get();e.length&&l.activate(e[0])}),u&&this._registerAction("find",function(){u.toggle()}),i&&h&&this._registerAction("moveToOrigin",function(){var e,t,n=i.getRootElement();e=ft(t=wi(n,"bpmn:Collaboration")?r.filter(function(e){return wi(e.parent,"bpmn:Collaboration")}):r.filter(function(e){return e!==n&&!wi(e.parent,"bpmn:SubProcess")})),h.moveElements(t,{x:-e.x,y:-e.y},n)})};var Jc={__depends__:[Zc],editorActions:["type",Qc]};function ep(e){e.invoke(Do,this)}t(ep,Do),ep.$inject=["injector"],ep.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}Do.prototype.registerBindings.call(this,n,i),e("selectElements",function(e){var t=e.keyEvent;if(n.isKey(["a","A"],t)&&n.isCmd(t))return i.trigger("selectElements"),!0}),e("find",function(e){var t=e.keyEvent;if(n.isKey(["f","F"],t)&&n.isCmd(t))return i.trigger("find"),!0}),e("spaceTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["s","S"],t)?(i.trigger("spaceTool"),!0):void 0}),e("lassoTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["l","L"],t)?(i.trigger("lassoTool"),!0):void 0}),e("handTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["h","H"],t)?(i.trigger("handTool"),!0):void 0}),e("globalConnectTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["c","C"],t)?(i.trigger("globalConnectTool"),!0):void 0}),e("directEditing",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["e","E"],t)?(i.trigger("directEditing"),!0):void 0})};var tp={__depends__:[No],__init__:["keyboardBindings"],keyboardBindings:["type",ep]},np={moveSpeed:1,moveSpeedAccelerated:10},ip={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},rp={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function op(e,r,o,a){var s=this;this._config=$({},np,e||{}),r.addListener(1500,function(e){var t=e.keyEvent,n=ip[t.key];if(n&&!r.isCmd(t)){var i=r.isShift(t);return s.moveSelection(n,i),!0}}),this.moveSelection=function(e,t){var n=a.get();if(n.length){var i=this._config[t?"moveSpeedAccelerated":"moveSpeed"],r=rp[e](i);o.moveElements(n,r)}}}op.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var ap={__depends__:[No,lo],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",op]};function sp(n,i,r,o){n.on("element.changed",function(e){var t=e.element;(t.parent||t===i.getRootElement())&&(e.gfx=r.getGraphics(t)),e.gfx&&n.fire(yt(t)+".changed",e)}),n.on("elements.changed",function(e){var t=e.elements;t.forEach(function(e){n.fire("element.changed",{element:e})}),o.updateContainments(t)}),n.on("shape.changed",function(e){o.update("shape",e.element,e.gfx)}),n.on("connection.changed",function(e){o.update("connection",e.element,e.gfx)})}sp.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var cp={__init__:["changeSupport"],changeSupport:["type",sp]};function pp(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}pp.$inject=["elementRegistry","canvas","styles"],pp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pp.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=n.cloneNode(!0),r=n.getBoundingClientRect();return e.waypoints&&function t(e){e.children&&M(e.children,function(e){t(e)});e.style.markerStart="";e.style.markerEnd=""}(i),_e(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ve(t,i),i},pp.prototype.addFrame=function(e,t){var n=Ne("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ve(t,n),n};var lp={__init__:["previewSupport"],previewSupport:["type",pp]};function up(e,t,o,n){this._dragging=n,this._rules=t;var a=this;function i(e,t){var n,i=e.shape,r=e.direction,o=e.resizeConstraints;n=function(e,t,n){var i=n.x,r=n.y;switch(t){case"nw":return{x:e.x+i,y:e.y+r,width:e.width-i,height:e.height-r};case"sw":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height+r};case"ne":return{x:e.x,y:e.y+r,width:e.width+i,height:e.height-r};case"se":return{x:e.x,y:e.y,width:e.width+i,height:e.height+r};default:throw new Error("unrecognized direction: "+t)}}(i,r,e.delta=t),e.newBounds=function(e,t){if(!t)return e;var n=Fr(e);return $r({top:wc("top",n,t),right:wc("right",n,t),bottom:wc("bottom",n,t),left:wc("left",n,t)})}(n,o),e.canExecute=a.canResize(e)}e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=a.computeMinResizeBox(t)),t.resizeConstraints={min:Fr(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};i(e.context,t)}),e.on("resize.end",function(e){var t,n,i,r;t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds,i&&(r=jr(r),o.resizeShape(n,r))})}up.prototype.canResize=function(e){var t=this._rules,n=F(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},up.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=$({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");var a={x:/w/.test(r)?t.x:t.x+t.width,y:/n/.test(r)?t.y:t.y+t.height};o.init(e,a,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},up.prototype.computeMinResizeBox=function(e){var t,n,i,r,o,a,s,c,p=e.shape,l=e.direction;return t=e.minDimensions||{width:10,height:10},n=Tc(p,e.childrenBoxPadding),i=l,r=t,o=n,a=Fr(p),s={top:/n/.test(i)?a.bottom-r.height:a.top,left:/w/.test(i)?a.right-r.width:a.left,bottom:/s/.test(i)?a.top+r.height:a.bottom,right:/e/.test(i)?a.left+r.width:a.right},c=o?Fr(o):s,$r({top:xc(s.top,c.top),left:xc(s.left,c.left),bottom:bc(s.bottom,c.bottom),right:bc(s.right,c.right)})},up.$inject=["eventBus","rules","modeling","dragging"];var hp="djs-resizing",dp="resize-not-ok";function mp(e,o,a){e.on("resize.move",500,function(e){var t,n,i,r;t=e.context,n=t.shape,i=t.newBounds,(r=t.frame)||(r=t.frame=a.addFrame(n,o.getDefaultLayer()),o.addMarker(n,hp)),5<i.width&&_e(r,{x:i.x,width:i.width}),5<i.height&&_e(r,{y:i.y,height:i.height}),t.canExecute?Te(r).remove(dp):Te(r).add(dp)}),e.on("resize.cleanup",function(e){var t,n;t=e.context,n=t.shape,t.frame&&Ae(t.frame),o.removeMarker(n,hp)})}mp.$inject=["eventBus","canvas","previewSupport"];var fp="djs-resizer";function yp(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&M(t,j(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}yp.prototype.makeDraggable=function(t,e,n){var i=this._resize;function r(e){Jr(e)&&i.activate(e,t,n)}re.bind(e,"mousedown",r),re.bind(e,"touchstart",r)},yp.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=Ne("g");Te(a).add(fp),Te(a).add(fp+"-"+e.id),Te(a).add(fp+"-"+r),ve(o,a);var s=Ne("rect");_e(s,{x:-7,y:-7,width:5,height:5}),Te(s).add(fp+"-visual"),ve(a,s);var c=Ne("rect");return _e(c,{x:-7,y:-7,width:20,height:20}),Te(c).add(fp+"-hit"),ve(a,c),qt(a,t,n,i),a},yp.prototype.createResizer=function(e,t){var n,i=Fr(e);n="nw"===t?this._createResizer(e,i.left,i.top,0,t):"ne"===t?this._createResizer(e,i.right,i.top,90,t):"se"===t?this._createResizer(e,i.right,i.bottom,180,t):this._createResizer(e,i.left,i.bottom,270,t),this.makeDraggable(e,n,t)},yp.prototype.addResizer=function(e){this._resize.canResize({shape:e})&&(this.createResizer(e,"nw"),this.createResizer(e,"ne"),this.createResizer(e,"se"),this.createResizer(e,"sw"))},yp.prototype.removeResizers=function(){Pe(this._getResizersParent())},yp.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},yp.$inject=["eventBus","canvas","selection","resize"];var vp={__depends__:[Ua,za,lp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",up],resizePreview:["type",mp],resizeHandles:["type",yp]};function gp(e){return wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Participant")||wi(e,"bpmn:Lane")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")?"name":wi(e,"bpmn:TextAnnotation")?"text":void 0}function bp(e){var t=e.businessObject,n=gp(t);if(n)return t[n]||""}function xp(e,t,n,i,r,o){function a(e,t){(t||da(e,["bpmn:Task","bpmn:TextAnnotation"])||_p(e))&&n.activate(e)}this._canvas=t,this._modeling=i,this._textRenderer=o,n.registerProvider(this),e.on("element.dblclick",function(e){a(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace","popupMenu.open"],function(e){n.isActive()&&n.complete()}),e.on(["commandStack.changed"],function(e){n.isActive()&&n.cancel()}),e.on("directEditing.activate",function(e){r.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&a(t)}),e.on("autoPlace.end",500,function(e){a(e.shape)})}function _p(e){return wi(e,"bpmn:SubProcess")&&!Ci(e)}xp.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],xp.prototype.activate=function(e){var t=bp(e);if(void 0!==t){var n={text:t};$(n,this.getEditingBBox(e));var i={};return(da(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||_p(e))&&$(i,{centerVertically:!0}),Yi(e)&&$(i,{autoResize:!0}),wi(e,"bpmn:TextAnnotation")&&$(i,{resizable:!0,autoResize:!0}),$(n,{options:i}),n}},xp.prototype.getEditingBBox=function(e){var t,n,i,r=this._canvas,o=e.label||e,a=r.getAbsoluteBBox(o),s=a.x+a.width/2,c=a.y+a.height/2,p={x:a.x,y:a.y},l=r.zoom(),u=this._textRenderer.getDefaultStyle(),h=this._textRenderer.getExternalStyle(),d=h.fontSize*l,m=h.lineHeight,f=u.fontSize*l,y=u.lineHeight,v={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(wi(e,"bpmn:Lane")||wi(t=e,"bpmn:Participant")&&Ci(t))&&($(p,{width:a.height,height:30*l,x:a.x-a.height/2+15*l,y:c-30*l/2}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px",transform:"rotate(-90deg)"})),(da(e,["bpmn:Task","bpmn:CallActivity"])||wi(n=e,"bpmn:Participant")&&!Ci(n)||_p(e))&&($(p,{width:a.width,height:a.height}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"})),wi(i=e,"bpmn:SubProcess")&&Ci(i)&&($(p,{width:a.width,x:a.x}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));var g=90*l,b=7*l,x=4*l;if(o.labelTarget&&($(p,{width:g,height:a.height+b+x,x:s-g/2,y:a.y-b}),$(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})),Yi(o)&&!Xi(o)&&!Ji(o)){var _=Qi(e),E=r.getAbsoluteBBox({x:_.x,y:_.y,width:0,height:0}),w=d+b+x;$(p,{width:g,height:w,x:E.x-g/2,y:E.y-w/2}),$(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})}return wi(e,"bpmn:TextAnnotation")&&($(p,{width:a.width,height:a.height,minWidth:30*l,minHeight:10*l}),$(v,{textAlign:"left",paddingTop:5*l+"px",paddingBottom:7*l+"px",paddingLeft:7*l+"px",paddingRight:5*l+"px",fontSize:f+"px",lineHeight:y})),{bounds:p,style:v}},xp.prototype.update=function(e,t,n,i){var r,o,a;wi(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Ep="djs-element-hidden",wp="djs-label-hidden";function Sp(e,a,t,s){var c,p,l,u=this,h=a.getDefaultLayer();e.on("directEditing.activate",function(e){var t,n,i=e.active;if(wi(c=i.element.label||i.element,"bpmn:TextAnnotation")){p=a.getAbsoluteBBox(c),l=Ne("g");var r=s.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:c.width,containerHeight:c.height,position:{mx:0,my:0}}),o=u.path=Ne("path");_e(o,{d:r,strokeWidth:2,stroke:(t=c,Si(t).di.get("stroke")||n||"black")}),ve(l,o),ve(h,l),Kt(l,c.x,c.y)}wi(c,"bpmn:TextAnnotation")||c.labelTarget?a.addMarker(c,Ep):(wi(c,"bpmn:Task")||wi(c,"bpmn:CallActivity")||wi(c,"bpmn:SubProcess")||wi(c,"bpmn:Participant"))&&a.addMarker(c,wp)}),e.on("directEditing.resize",function(e){if(wi(c,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,i=Math.max(c.height/p.height*(t+n),0),r=s.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:c.width,containerHeight:i,position:{mx:0,my:0}});_e(u.path,{d:r})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var t=e.active;t&&(a.removeMarker(t.element.label||t.element,Ep),a.removeMarker(c,wp)),p=c=void 0,l&&(Ae(l),l=void 0)})}Sp.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Cp={__depends__:[cp,vp,Ms],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",xp],labelEditingPreview:["type",Sp]};function Tp(e,c){function r(e){if(Xi(e)){var t=function(e){var t=Hr(e.label),n=Hr(e),i=Ap(n,t);if(r=i,-1===Rp.indexOf(r))return;var r;var o=[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return Ap(n,e)}),a=Rp.filter(function(e){return-1===o.indexOf(e)});return-1===a.indexOf(i)?a[0]:void 0}(e);t&&function(e,t){var n,i=Hr(e),r=e.label,o=Hr(r),a=Fr(e);switch(t){case"top":n={x:i.x,y:a.top-p-r.height/2};break;case"left":n={x:a.left-p-r.width/2,y:i.y};break;case"bottom":n={x:i.x,y:a.bottom+p+r.height/2};break;case"right":n={x:a.right+p+r.width/2,y:i.y}}var s=Wo(n,o);c.moveShape(r,s)}(e,t)}}Ra.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(e){var t=e.context.connection,n=t.source,i=t.target;r(n),r(i)}),this.postExecuted(["label.create"],function(e){r(e.context.shape.labelTarget)});var p=10}t(Tp,Ra),Tp.$inject=["eventBus","modeling"];var Rp=["top","bottom","left","right"];function Ap(e,t){return Wr(t,e,5)}function Pp(e,t,n){Ra.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(wi(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})},!0)}function kp(e,r){function o(e){return k(e.attachers,function(e){return wi(e,"bpmn:BoundaryEvent")})}Ra.call(this,e),this.postExecute("connection.create",function(e){var t=e.context.source,n=e.context.target,i=o(n);wi(t,"bpmn:EventBasedGateway")&&wi(n,"bpmn:ReceiveTask")&&0<i.length&&r.removeElements(i)}),this.postExecute("connection.reconnectStart",function(e){var t=e.context.oldSource,n=e.context.newSource;wi(t,"bpmn:Gateway")&&wi(n,"bpmn:EventBasedGateway")&&M(n.outgoing,function(e){var t=e.target,n=o(t);wi(t,"bpmn:ReceiveTask")&&0<n.length&&r.removeElements(n)})})}function Mp(e,a,n){Ra.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),wi(t,"bpmn:Lane"))for(;wi(t=e.topParent=t.parent,"bpmn:Lane")||!wi(t,"bpmn:Participant"););},!0),this.postExecute("elements.paste",function(e){var o=e.tree.createdElements;M(o,function(e){var t,n=e.element,i=n.businessObject,r=e.descriptor;(wi(i,"bpmn:ExclusiveGateway")||wi(i,"bpmn:InclusiveGateway")||wi(i,"bpmn:Activity"))&&r.default&&(t=(t=o[r.default])?t.element:void 0,delete n.default,a.updateProperties(n,{default:t}))})},!0)}function Dp(e,t,o,a){Ra.call(this,e),this.preExecute("shape.create",function(e){var t,n=e.shape,i=e.host,r={cancelActivity:!0};i&&wi(n,"bpmn:IntermediateThrowEvent")&&(r.attachedToRef=i.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:a.create("bpmn:BoundaryEvent",r)},e.shape=o.createShape(t))},!0)}function Np(e,i,t){Ra.call(this,e),this.preExecute("shape.create",function(e){var t=e.context.shape;if(wi(t,"bpmn:DataObjectReference")&&"label"!==t.type){var n=i.create("bpmn:DataObject");t.businessObject.dataObjectRef=n}})}function Bp(e,a,t,n,s){Ra.call(this,e),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape,i=e.position,r=s.getRootElement();if(wi(t,"bpmn:Process")&&wi(n,"bpmn:Participant")&&!wi(r,"bpmn:Collaboration")){var o=a.makeCollaboration();e.position=i,e.parent=o,e.processRoot=t}},!0),this.execute("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var t=e.processRoot,n=e.shape;if(t){var i=t.children.slice();a.moveElements(i,{x:0,y:0},n)}},!0)}t(Pp,Ra),Pp.$inject=["eventBus","elementFactory","bpmnRules"],kp.$inject=["eventBus","modeling"],t(kp,Ra),Mp.$inject=["eventBus","modeling","canvas"],t(Mp,Ra),Dp.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],t(Dp,Ra),Np.$inject=["eventBus","bpmnFactory","moddle"],t(Np,Ra),Bp.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],t(Bp,Ra);var Op="__targetRef_placeholder";function Lp(e,r){function u(e,t){var n=e.get("properties"),i=A(n,function(e){return e.name===Op});return!i&&t&&lt(n,i=r.create("bpmn:Property",{name:Op})),i}function h(e,t){var n,i,r=u(e);r&&(n=r,i=t,A(e.get("dataInputAssociations"),function(e){return e!==i&&e.targetRef===n})||pt(e.get("properties"),r))}function t(e){var t=e.context,n=t.connection,i=n.businessObject,r=n.target,o=r&&r.businessObject,a=t.newTarget,s=a&&a.businessObject,c=t.oldTarget||t.target,p=c&&c.businessObject,l=n.businessObject;p&&p!==o&&h(p,i),s&&s!==o&&h(s,i),l.targetRef=o?u(o,!0):null}Ra.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Ip(t)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Ip(t))}function Ip(t){return function(e){if(wi(e.context.connection,"bpmn:DataInputAssociation"))return t(e)}}function jp(e){this._bpmnUpdater=e}function zp(i,r,o,e){function a(e){return e.children.filter(function(e){return wi(e,"bpmn:DataStoreReference")&&!e.labelTarget})}function s(e,t){var n=e.businessObject||e;if(t=t||o.filter(function(e){return wi(e,"bpmn:Participant")})[0]){var i=t.businessObject||t;r.execute("dataStore.updateContainment",{dataStoreBo:n,newSemanticParent:i.processRef||i,newDiParent:i.di})}}Ra.call(this,e),r.registerHandler("dataStore.updateContainment",jp),this.preExecute("shape.create",function(e){var t=e.context,n=t.shape;wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)}),this.preExecute("elements.move",function(e){var t=e.context,n=t.shapes;n.filter(function(e){return wi(e,"bpmn:DataStoreReference")}).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter(function(e){return!wi(e,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(e){var t=e.context.shape,n=t.parent;wi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&wi(n,"bpmn:Collaboration")&&s(t)}),this.postExecute("shape.move",function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;wi(i,"bpmn:Collaboration")||wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&wi(r,"bpmn:Collaboration")&&s(n,wi(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(wi(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))}),this.postExecute("shape.delete",function(e){var t=e.context.shape,n=i.getRootElement();da(t,["bpmn:Participant","bpmn:SubProcess"])&&wi(n,"bpmn:Collaboration")&&a(n).filter(function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,t)}).forEach(function(e){s(e)})}),this.postExecute("canvas.updateRoot",function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;a(n).forEach(function(e){wi(i,"bpmn:Process")&&s(e,i)})})}Lp.$inject=["eventBus","bpmnFactory"],t(Lp,Ra),jp.$inject=["bpmnUpdater"],jp.prototype.execute=function(e){var t=e.dataStoreBo,n=e.newSemanticParent,i=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=t.di.$parent,this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},jp.prototype.revert=function(e){var t=e.dataStoreBo,n=e.oldSemanticParent,i=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},zp.$inject=["canvas","commandStack","elementRegistry","eventBus"],t(zp,Ra);function Fp(e,t,h){Ra.call(this,e),this.postExecuted("shape.delete",500,function(e){var t,n,i,r,o,a,s,c=e.context,p=c.hints,l=c.shape,u=c.oldParent;wi(l,"bpmn:Lane")&&(p&&p.nested||(t=l,o=kc(u),a=[],s=[],dt(o,function(e){return e.y>t.y?s.push(e):a.push(e),e.children}),o.length&&(n=s.length&&a.length?t.height/2:t.height,a.length&&(i=h.calculateAdjustments(a,"y",n,t.y-10),h.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:n},"s")),s.length&&(r=h.calculateAdjustments(s,"y",-n,t.y+t.height+10),h.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:-n},"n")))))})}function $p(e,f,y){function r(e,t,n){var i,r,o,a,s,c,p,l=t.waypoints,u=e.outgoing.slice(),h=e.incoming.slice(),d=is(l,n);if(d){if(i=l.slice(0,d.index),r=l.slice(d.index+(d.bendpoint?1:0)),!i.length||!r.length)return;o=d.bendpoint?l[d.index]:n,Hp(e,i[i.length-1])||i.push(Wp(o)),Hp(e,r[0])||r.unshift(Wp(o))}a=t.source,s=t.target,f.canConnect(a,e,t)&&(y.reconnectEnd(t,e,i||n),c=t),f.canConnect(e,s,t)&&(p=c?y.connect(e,s,{type:t.type,waypoints:r}):(y.reconnectStart(t,e,r||n),t));var m=[].concat(c&&k(h,function(e){return e.source===c.source})||[],p&&k(u,function(e){return e.source===p.source})||[]);m.length&&y.removeElements(m)}Ra.call(this,e),this.preExecute("elements.move",function(e){var t=e.newParent,n=e.shapes,i=e.delta,r=n[0];if(r&&t){t&&t.waypoints&&(e.newParent=t=t.parent);var o,a=(o=r,{x:Math.round(o.x+o.width/2),y:Math.round(o.y+o.height/2)}),s={x:a.x+i.x,y:a.y+i.y},c=A(t.children,function(e){return f.canInsert(n,e)&&is(e.waypoints,s)});c&&(e.targetFlow=c,e.position=s)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape;f.canInsert(n,t)&&(e.targetFlow=t,e.parent=t.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}function Hp(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Wp(e){return $({},e)}function Gp(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Vp(e){function r(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Gp(e,t,n,r),s=Gp(e,t,n,o);i=a&&s?Up(a,n)>Up(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var t,n,i=e.element;i.waypoints&&(r((n=(t=i).waypoints)[0],n[1],Hr(t.source)),r(n[n.length-1],n[n.length-2],Hr(t.target)))})}function Up(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qp(e){Ra.call(this,e);var n=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(e){var t=Si(e.context.shape);da(t,n)&&!t.di.get("isHorizontal")&&t.di.set("isHorizontal",!0)})}function Kp(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Yp(e,t){return n={x:e.x-t.x,y:e.y-t.y},Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2));var n}Fp.$inject=["eventBus","modeling","spaceTool"],t(Fp,Ra),t($p,Ra),$p.$inject=["eventBus","bpmnRules","modeling"],Vp.$inject=["eventBus"],qp.$inject=["eventBus"],t(qp,Ra);var Xp=Math.sqrt,Zp=Math.min,Qp=Math.max,Jp=Math.abs;function el(e){return Math.pow(e,2)}function tl(e,t){return Xp(el(e.x-t.x)+el(e.y-t.y))}function nl(r,o,e,t){var n=o.x-r.x,i=o.y-r.y,a=e.x-r.x,s=e.y-r.y,c=n*n+i*i,p=(n*a+i*s)/c,l=p*p-(a*a+s*s-t*t)/c;if(l<0&&-1e-6<l&&(l=0),l<0)return[];var u=Xp(l),h=-p+u,d=-p-u,m={x:r.x-n*h,y:r.y-i*h};return 0===l?[m]:[m,{x:r.x-n*d,y:r.y-i*d}].filter(function(e){return n=r,i=o,il((t=e).x,n.x,i.x)&&il(t.y,n.y,i.y);var t,n,i})}function il(e,t,n){return e>=Zp(t,n)-rl&&e<=Qp(t,n)+rl}var rl=.1;function ol(e,t){return Jp(e.x-t.x)<=rl&&Jp(e.y-t.y)<=rl}function al(e,t,n,i){var r,o=0,a=0,s={x:(r=e).x+r.width/2,y:r.y+r.height/2},c=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m<t.length-1;m++){if((s=ol(n=t[m],i=t[m+1])?[n]:(r=tl(e,n),o=tl(e,i),nl(n,i,e,Zp(r,o)))).length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:ol(n,s[0])?m:m+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:m,relativeLocation:tl(n,a)/tl(n,i)}),p=tl(c.position,e),(!u||p<l)&&(u=c,l=p)}return u}(s,n),p=c.segmentIndex,l=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:s<=r?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;return 0===o?r:(l<=r&&(c=p?r+1:r-1),r<l&&(c=r,p&&"bendpoint"!==n.type&&l-1===r&&sl(t,l)<n.relativeLocation&&c++),c)}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}(n,t,c,i);if(null===l)return{x:o,y:a};if(l<0||l>t.length-2)return{x:o,y:a};var u,h,d,m,f,y,v=cl(n,p),g=cl(t,l),b=c.position,x=(m=b,f=Yp((d=v)[0],d[1]),y=Yp(d[0],m),0===f?0:y/f),_=(u=g,h=Kp(v),Kp(u)-h);if("bendpoint"===c.type){var E=t.length-n.length,w=c.bendpointIndex,S=n[w];if(-1!==t.indexOf(S))return{x:o,y:a};if(0===E){var C=t[w];return{x:C.x-c.position.x,y:C.y-c.position.y}}E<0&&0!==w&&w<n.length-1&&(x=sl(n,w))}var T,R,A=(g[1].x-g[0].x)*x+g[0].x,P=(g[1].y-g[0].y)*x+g[0].y,k=(T={x:s.x-b.x,y:s.y-b.y},(R=_)?{x:Math.cos(R)*T.x-Math.sin(R)*T.y,y:Math.sin(R)*T.x+Math.cos(R)*T.y}:T);return zr({x:o=A+k.x-s.x,y:a=P+k.y-s.y})}function sl(e,t){var n=Yp(e[t-1],e[t]);return n/(n+Yp(e[t],e[t+1]))}function cl(e,t){return[e[t],e[t+1]]}var pl={width:90,height:20};function ll(e,p,i,a){Ra.call(this,e),this.postExecute("element.updateProperties",function(e){var t=e.context,n=t.element,i=t.properties;if("name"in i&&p.updateLabel(n,i.name),"text"in i&&wi(n,"bpmn:TextAnnotation")){var r=a.getTextAnnotationBounds({x:n.x,y:n.y,width:n.width,height:n.height},i.text||"");p.updateLabel(n,i.text,r)}}),this.postExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=n.businessObject;if(Yi(n)&&i.name){var r=Qi(n),o=a.getExternalLabelBounds(pl,i.name||"");p.createLabel(n,r,{id:i.id+"_label",businessObject:i,width:o.width,height:o.height})}}),this.postExecute("shape.delete",function(e){var t=e.context,n=t.labelTarget,i=t.hints||{};n&&!1!==i.unsetLabel&&p.updateLabel(n,null,null,{removeShape:!1})}),this.postExecute(["label.create"],function(e){var t,n=e.context.shape;n.labelTarget&&wi(n.labelTarget||n,"bpmn:BaseElement")&&((t=n.businessObject.di).label||(t.label=i.create("bpmndi:BPMNLabel",{bounds:i.create("dc:Bounds")})),$(t.label.bounds,{x:n.x,y:n.y,width:n.width,height:n.height}))}),this.postExecute(["connection.layout","connection.updateWaypoints"],function(e){var t,n,i,r,o,a,s,c=e.context.connection.label;c&&(n=e.context,i=n.connection,r=i.label,o=$({},n.hints),a=n.newWaypoints||i.waypoints,s=n.oldWaypoints,void 0===o.startChanged&&(o.startChanged=!!o.connectionStart),void 0===o.endChanged&&(o.endChanged=!!o.connectionEnd),t=al(r,a,s,o),p.moveShape(c,t))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Si(n);r&&Yi(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})}t(ll,Ra),ll.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];var ul="flow elements must be children of pools/participants";function hl(e,i,r){function o(e,t,n){i.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:n||2e3,html:"<div>"+t+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,n=t.shape;wi(t.target,"bpmn:Collaboration")&&wi(n,"bpmn:FlowNode")&&o(e,r(ul))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,n=t.position,i=t.target;wi(i,"bpmn:Collaboration")&&o(n,r(ul)),wi(i,"bpmn:Process")&&o(n,r("participants cannot be pasted onto a non-empty process diagram"),3e3)})}function dl(e,a,o){function t(e){var t,n,i=e.source,r=e.target;e.parent&&(wi(e,"bpmn:SequenceFlow")&&(o.canConnectSequenceFlow(i,r)||(n=!0),o.canConnectMessageFlow(i,r)&&(t="bpmn:MessageFlow")),wi(e,"bpmn:MessageFlow")&&(o.canConnectMessageFlow(i,r)||(n=!0),o.canConnectSequenceFlow(i,r)&&(t="bpmn:SequenceFlow")),wi(e,"bpmn:Association")&&!o.canConnectAssociation(i,r)&&(n=!0),n&&a.removeConnection(e),t&&a.connect(i,r,{type:t,waypoints:e.waypoints.slice()}))}Ra.call(this,e),this.postExecuted("elements.move",function(e){M(e.closure.allConnections,t)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){t(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var t,n=e.context,i=n.properties,r=n.element,o=r.businessObject;i.default&&(t=A(r.outgoing,D({id:r.businessObject.default.id})))&&a.updateProperties(t,{conditionExpression:void 0}),i.conditionExpression&&o.sourceRef.default===o&&a.updateProperties(r.source,{default:void 0})})}function ml(e,n){Ra.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;wi(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var t=e.collaborationRoot;t&&!t.businessObject.participants.length&&n.makeProcess()},!0)}function fl(e,t,a,n,i,r){Ra.call(this,e),this._bpmnReplace=t,this._elementRegistry=n,this._selection=i,this._modeling=r,this.postExecuted(["elements.move"],500,function(e){var t=e.context,n=t.newParent,i=t.newHost,r=[];M(t.closure.topLevel,function(e){r=Ti(e)?r.concat(e.children):r.concat(e)}),1===r.length&&i&&(n=i);var o=a.canReplace(r,n);o&&this.replaceElements(r,o.replacements,i)},this),this.postExecute(["shape.replace"],1500,function(e){var t,n=e.context,i=n.oldShape,r=n.newShape,o=i.attachers;o&&o.length&&(t=a.canReplace(o,r),this.replaceElements(o,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})})}hl.$inject=["eventBus","tooltips","translate"],t(dl,Ra),dl.$inject=["eventBus","modeling","bpmnRules"],ml.$inject=["eventBus","modeling"],t(ml,Ra),t(fl,Ra),fl.prototype.replaceElements=function(r,e,o){var a=this._elementRegistry,s=this._bpmnReplace,t=this._selection,c=this._modeling;M(e,function(e){var t={type:e.newElementType},n=a.get(e.oldElementId);o&&wi(n,"bpmn:BoundaryEvent")&&c.updateAttachment(n,null);var i=r.indexOf(n);r[i]=s.replaceElement(n,t,{select:!1}),o&&wi(r[i],"bpmn:BoundaryEvent")&&c.updateAttachment(r[i],o)}),e&&t.select(r)},fl.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];function yl(e,o){e.on("resize.start",1501,function(e){var t=e.context,n=t.shape;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.balanced=!eo(e))}),e.on("resize.end",1001,function(e){var t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds;if(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))return i&&(r=jr(r),o.resizeLane(n,r,t.balanced)),!1})}function vl(e,c,p){Ra.call(this,e),this.preExecute("shape.delete",function(e){var t=e.context.shape;if(1===t.incoming.length&&1===t.outgoing.length){var n,i,r,o=t.incoming[0],a=t.outgoing[0];if(wi(o,"bpmn:SequenceFlow")&&wi(a,"bpmn:SequenceFlow"))if(c.canConnect(o.source,a.target,o)){var s=(n=o.waypoints,i=a.waypoints,(r=Gp(gl(n[n.length-2]),gl(n[n.length-1]),gl(i[1]),gl(i[0])))?[].concat(n.slice(0,n.length-1),[r],i.slice(1)):[gl(n[0]),gl(i[i.length-1])]);p.reconnectEnd(o,a.target,s)}}})}function gl(e){return e.original||e}yl.$inject=["eventBus","modeling"],t(vl,Ra),vl.$inject=["eventBus","bpmnRules","modeling"];function bl(e,h,d,t){Ra.call(this,e),this.executed(["shape.toggleCollapse"],500,function(e){var t,n=e.context.shape;wi(n,"bpmn:SubProcess")&&(n.collapsed?Si(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),Si(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;t.collapsed?Si(t).di.isExpanded=!1:Si(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],500,function(e){var t,n,i,r,o,a,s,c,p,l=e.context.shape,u=h._getDefaultSize(l);t=l.collapsed?(p=u,{x:(c=l).x+(c.width-p.width)/2,y:c.y+(c.height-p.height)/2,width:p.width,height:p.height}):(i=u,a=(n=l).children,s=i,r=Tc((o=a,o.filter(function(e){return!e.hidden})).concat([n])),s.y=r?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,r.y+(r.height-s.height)/2):(s.x=n.x+(n.width-s.width)/2,n.y+(n.height-s.height)/2),s),d.resizeShape(l,t)})}function xl(e,t){Ra.call(this,e),this.preExecute("elements.delete",function(e){M(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}t(bl,Ra),bl.$inject=["eventBus","elementFactory","modeling"],t(xl,Ra),xl.$inject=["eventBus","modeling"];function _l(e,t,i){var r;Ra.call(this,e);var n=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(n,5e3,function(e){(r=r||new El).enter()}),this.postExecuted(n,500,function(e){!function(){if(!r)throw new Error(i("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=function(){if(!r)throw new Error(i("out of bounds release"));return r}();t.labelTarget||(wi(t,"bpmn:Lane")&&n.addLane(t),wi(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function El(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function wl(e,i){Ra.call(this,e),this.preExecute("connection.delete",function(e){var t=e.context.connection,n=t.source;(function(e,t){if(!wi(e,"bpmn:SequenceFlow"))return!1;var n=Si(t),i=Si(e);return n.get("default")===i})(t,n)&&i.updateProperties(n,{default:null})})}_l.$inject=["eventBus","modeling","translate"],t(_l,Ra),t(wl,Ra),wl.$inject=["eventBus","modeling"];var Sl={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","boundaryEventBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","dataStoreBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","isHorizontalFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",Tp],appendBehavior:["type",Pp],boundaryEventBehavior:["type",kp],copyPasteBehavior:["type",Mp],createBoundaryEventBehavior:["type",Dp],createDataObjectBehavior:["type",Np],createParticipantBehavior:["type",Bp],dataInputAssociationBehavior:["type",Lp],dataStoreBehavior:["type",zp],deleteLaneBehavior:["type",Fp],dropOnFlowBehavior:["type",$p],importDockingFix:["type",Vp],isHorizontalFix:["type",qp],labelBehavior:["type",ll],modelingFeedback:["type",hl],replaceConnectionBehavior:["type",dl],removeParticipantBehavior:["type",ml],replaceElementBehaviour:["type",fl],resizeLaneBehavior:["type",yl],removeElementBehavior:["type",vl],toggleElementCollapseBehaviour:["type",bl],unclaimIdBehavior:["type",xl],updateFlowNodeRefsBehavior:["type",_l],unsetDefaultFlowBehavior:["type",wl]};function Cl(e,t){var n=Wr(e,t,-15);return"intersect"!==n?n:null}var Tl=Math.abs,Rl=Math.min,Al=Math.max;function Pl(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function kl(e,t,n){return Pl(e,t,n,Rl)}function Ml(e,t,n){return Pl(e,t,n,Al)}var Dl=60,Nl=300,Bl=20,Ol=50,Ll=20,Il=20;function jl(e){ka.call(this,e)}function zl(e){return!e||Ji(e)}function Fl(e){do{if(wi(e,"bpmn:Process"))return Si(e);if(wi(e,"bpmn:Participant"))return Si(e).processRef||Si(e)}while(e=e.parent)}function $l(e){return wi(e,"bpmn:TextAnnotation")}function Hl(e){return wi(e,"bpmn:BoundaryEvent")&&Vl(e,"bpmn:CompensateEventDefinition")}function Wl(e){return Si(e).isForCompensation}function Gl(e){for(var t=e;t=t.parent;){if(wi(t,"bpmn:FlowElementsContainer"))return Si(t);if(wi(t,"bpmn:Participant"))return Si(t).processRef}return null}function Vl(e,t){return!!A(Si(e).eventDefinitions||[],function(e){return wi(e,t)})}function Ul(e,t){return(Si(e).eventDefinitions||[]).every(function(e){return wi(e,t)})}function ql(e){return e.waypoints}function Kl(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function Yl(e,t,n){if(zl(e)||zl(t))return null;if(!wi(n,"bpmn:DataAssociation")){if(ou(e,t))return{type:"bpmn:MessageFlow"};if(au(e,t))return{type:"bpmn:SequenceFlow"}}var i=su(e,t);return i||(Hl(e)&&Wl(t)?{type:"bpmn:Association",associationDirection:"One"}:!!ru(e,t)&&{type:"bpmn:Association"})}function Xl(e,t,n){return!!Ji(e)||!(wi(t,"bpmn:Participant")&&!Ci(t))&&(wi(e,"bpmn:Participant")?wi(t,"bpmn:Process")||wi(t,"bpmn:Collaboration"):da(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:wi(e,"bpmn:Lane")?wi(t,"bpmn:Participant")||wi(t,"bpmn:Lane"):!wi(e,"bpmn:BoundaryEvent")&&(wi(e,"bpmn:FlowElement")&&!wi(e,"bpmn:DataStoreReference")?wi(t,"bpmn:FlowElementsContainer")?Ci(t):da(t,["bpmn:Participant","bpmn:Lane"]):da(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?da(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!wi(e,"bpmn:MessageFlow")&&(wi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Zl(e){return!Ji(e)&&wi(e,"bpmn:BoundaryEvent")}function Ql(e){return wi(e,"bpmn:Lane")}function Jl(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r,o,a=e[0];return!Ji(a)&&(!!(Zl(r=a)||wi(r,"bpmn:IntermediateThrowEvent")&&!r.parent)&&(!t||!Ti(t)&&(!(!wi(t,"bpmn:Activity")||Wl(t))&&(!(i&&!Cl(i,t))&&((!wi(o=t,"bpmn:ReceiveTask")||!A(o.incoming,function(e){return wi(e.source,"bpmn:EventBasedGateway")}))&&"attach")))))}function eu(e,n,i){if(!n)return!1;var r={replacements:[]};return M(e,function(e){var t;Ti(n)||wi(e,"bpmn:StartEvent")&&"label"!==e.type&&Xl(e,n)&&((t=e)&&!1!==Si(t).isInterrupting||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(Ri(e,"bpmn:ErrorEventDefinition")||Ri(e,"bpmn:EscalationEventDefinition")||Ri(e,"bpmn:CompensateEventDefinition"))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),wi(n,"bpmn:Transaction")||Vl(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(wi(e,"bpmn:EndEvent")&&Xl(e,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),wi(e,"bpmn:BoundaryEvent")&&Jl(e,n,null,i)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!r.replacements.length&&r}function tu(e,t){return!v(e,Zl)&&(!v(e,Ql)&&(!t||e.every(function(e){return Xl(e,t)})))}function nu(e,t,n,i){return!!t&&(Ji(t)?null:n!==t&&((!n||!Kl(n,t))&&(Xl(e,t)||cu(e,t,i))))}function iu(e,t){return wi(e,"bpmn:SubProcess")?Ci(e)&&(!t||100<=t.width&&80<=t.height):wi(e,"bpmn:Lane")?!t||130<=t.width&&60<=t.height:wi(e,"bpmn:Participant")?!t||250<=t.width&&50<=t.height:!!$l(e)}function ru(e,t){return!ql(e)&&!ql(t)&&(!(!Hl(e)||!Wl(t))||!Kl(t,e)&&!Kl(e,t)&&(n=t,i=$l(e),r=$l(n),(i||r)&&i!==r));var n,i,r}function ou(e,t){return wi(r=e,"bpmn:InteractionNode")&&(!wi(r,"bpmn:Event")||wi(r,"bpmn:ThrowEvent")&&Ul(r,"bpmn:MessageEventDefinition"))&&(wi(i=t,"bpmn:InteractionNode")&&!Wl(i)&&(!wi(i,"bpmn:Event")||wi(i,"bpmn:CatchEvent")&&Ul(i,"bpmn:MessageEventDefinition")))&&(n=t,!(Fl(e)===Fl(n)));var n,i,r}function au(e,t){return wi(s=e,"bpmn:FlowNode")&&!wi(s,"bpmn:EndEvent")&&!Ti(s)&&!(wi(s,"bpmn:IntermediateThrowEvent")&&Vl(s,"bpmn:LinkEventDefinition"))&&!Hl(s)&&!Wl(s)&&(wi(a=t,"bpmn:FlowNode")&&!wi(a,"bpmn:StartEvent")&&!wi(a,"bpmn:BoundaryEvent")&&!Ti(a)&&!(wi(a,"bpmn:IntermediateCatchEvent")&&Vl(a,"bpmn:LinkEventDefinition"))&&!Wl(a))&&(i=t,r=Gl(e),o=Gl(i),r&&r===o)&&!(wi(e,"bpmn:EventBasedGateway")&&!(wi(n=t,"bpmn:ReceiveTask")||wi(n,"bpmn:IntermediateCatchEvent")&&(Vl(n,"bpmn:MessageEventDefinition")||Vl(n,"bpmn:TimerEventDefinition")||Vl(n,"bpmn:ConditionalEventDefinition")||Vl(n,"bpmn:SignalEventDefinition"))));var n,i,r,o,a,s}function su(e,t){return da(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&da(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!da(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!da(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function cu(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(da(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ji(t)&&wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:BoundaryEvent")&&Xl(e,t.parent))}function pu(e,t){return e&&t&&-1!==e.indexOf(t)}function lu(e,t){return!(wi(t,"bpmn:Lane")&&!pu(e,t.parent))&&!(wi(t,"bpmn:BoundaryEvent")&&!pu(e,t.host))}t(jl,ka),jl.$inject=["eventBus"],jl.prototype.init=function(){this.addRule("connection.start",function(e){return function(e){if(zl(e))return null;return da(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])}(e.source)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return Yl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return Yl(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return Yl(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return iu(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return Jl(n,t,null,i)||eu(n,t,i)||tu(n,t)||cu(n,t,i)}),this.addRule("shape.create",function(e){return nu(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Jl(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return lu(e.collection,e.element)}),this.addRule("element.paste",function(e){var t=e.parent,n=e.element,i=e.position,r=e.source,o=e.target;return r||o?Yl(r,o):Jl([n],t,null,i)||nu(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(wi(t,"bpmn:Collaboration"))return y(n,function(e){return"bpmn:Participant"===e.type});if(wi(t,"bpmn:Process"))return!(v(n,function(e){return"bpmn:Participant"===e.type})&&0<t.children.length);if(wi(t,"bpmn:Participant")&&!Ci(t))return!1;if(wi(t,"bpmn:FlowElementsContainer"))return Ci(t);return da(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)})},jl.prototype.canConnectMessageFlow=ou,jl.prototype.canConnectSequenceFlow=au,jl.prototype.canConnectDataAssociation=su,jl.prototype.canConnectAssociation=ru,jl.prototype.canMove=tu,jl.prototype.canAttach=Jl,jl.prototype.canReplace=eu,jl.prototype.canDrop=Xl,jl.prototype.canInsert=cu,jl.prototype.canCreate=nu,jl.prototype.canConnect=Yl,jl.prototype.canResize=iu,jl.prototype.canCopy=lu;var uu={__depends__:[Ua],__init__:["bpmnRules"],bpmnRules:["type",jl]};function hu(e){Ra.call(this,e);var o=this;this.preExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=t.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.parent=r.parent),t.parentIndex=r.index)}),this.preExecute(["shape.move","connection.move"],function(e){var t=e.context,n=t.shape||t.connection,i=t.newParent||n.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.newParent=r.parent),t.newParentIndex=r.index)})}function du(e,o,a){hu.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:3,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function s(e){var t=e.order;return t||(e.order=t=function(t){if(t.labelTarget)return{level:10};var e=A(n,function(e){return da(t,[e.type])});return e&&e.order||{level:1}}(e)),t}this.getOrdering=function(t,e){if(t.labelTarget)return{parent:o.getRootElement(),index:-1};var n=s(t);n.containers&&(e=function(e,t,n){for(var i=t;i&&!da(i,n);)i=i.parent;if(!i)throw new Error(a("no parent for {element} in {parent}",{element:e.id,parent:t.id}));return i}(t,e,n.containers));var i=e.children.indexOf(t),r=m(e.children,function(e){return!(!t.labelTarget&&e.labelTarget)&&n.level<s(e).level});return-1!==r&&-1!==i&&i<r&&(r-=1),{index:r,parent:e}}}hu.prototype.getOrdering=function(e,t){return null},t(hu,Ra),du.$inject=["eventBus","canvas","translate"],t(du,hu);var mu={__depends__:[Ui],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",du]};function fu(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}fu.$inject=["eventBus","injector"],fu.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},fu.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},fu.prototype.clear=function(e){this._stack.length=0,!(this._stackIdx=-1)!==e&&this._fire("changed")},fu.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},fu.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},fu.prototype.register=function(e,t){this._setHandler(e,t)},fu.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},fu.prototype.canUndo=function(){return!!this._getUndoAction()},fu.prototype.canRedo=function(){return!!this._getRedoAction()},fu.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},fu.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},fu.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)})},fu.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},fu.prototype._createId=function(){return this._uid++},fu.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},fu.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo(function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)}),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},fu.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},fu.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:C("id",n)}),n.length=0,this._fire("changed"))},fu.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=g(e)?e:[e],t.dirty=t.dirty.concat(e))},fu.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},fu.prototype._revertedAction=function(e){this._stackIdx--},fu.prototype._getHandler=function(e){return this._handlerMap[e]},fu.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var yu={commandStack:["type",fu]},vu=new uo("tt");function gu(e,t){e.style.display=!1===t?"none":""}var bu="djs-tooltip",xu="."+bu;function _u(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=vu,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=se('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;ae.bind(this._tooltipRoot,xu,"mousedown",function(e){e.stopPropagation()}),ae.bind(this._tooltipRoot,xu,"mouseover",function(e){r.trigger("mouseover",e)}),ae.bind(this._tooltipRoot,xu,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}_u.$inject=["eventBus","canvas"],_u.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=$({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},_u.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(H(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},_u.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},_u.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},_u.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},_u.prototype.remove=function(e){var t=this.get(e);t&&(fe(t.html),fe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},_u.prototype.show=function(){gu(this._tooltipRoot)},_u.prototype.hide=function(){gu(this._tooltipRoot,!1)},_u.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},_u.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=se(i)),(t=se('<div data-tooltip-id="'+n+'" class="'+bu+'" style="position: absolute">')).appendChild(i),e.type&&q(t).add("djs-tooltip-"+e.type),e.className&&q(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},_u.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,$(t.style,{left:n+"px",top:i+"px"})},_u.prototype._updateTooltipVisibilty=function(r){M(this._tooltips,function(e){var t=e.show,n=e.htmlContainer,i=!0;t&&((t.minZoom>r.scale||t.maxZoom<r.scale)&&(i=!1),gu(n,i))})},_u.prototype._init=function(){var n=this;this._eventBus.on("canvas.viewbox.changing",function(e){n.hide()}),this._eventBus.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,n._updateRoot(t),n._updateTooltipVisibilty(t),n.show()})};var Eu={__init__:["tooltips"],tooltips:["type",_u]};function wu(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function Su(e,t,n){Ra.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Cu(n),t.validatedShapes=Cu(i)}),r&&t.on("shape.move.start",250,function(e){var n=e.context,t=n.shapes,i=[];M(t,function(t){M(t.labels,function(e){e.hidden||-1!==n.shapes.indexOf(e)||i.push(e),t.labelTarget&&i.push(t)})}),M(i,function(e){r.makeDraggable(n,e,!0)})}),this.preExecuted("elements.move",1400,function(e){var t=e.context.closure,n=t.enclosedElements,i=[];M(n,function(e){M(e.labels,function(e){n[e.id]||i.push(e)})}),t.addAll(i)}),this.preExecute(["connection.delete","shape.delete"],function(e){var t=e.context;wu((t.connection||t.shape).labels,function(e){n.removeShape(e,{nested:!0})})}),this.execute("shape.delete",function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=ut(i.labels,n),t.labelTarget=i,n.labelTarget=null)}),this.revert("shape.delete",function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(lt(i.labels,n,r),n.labelTarget=i)})}function Cu(t){return k(t,function(e){return-1===t.indexOf(e.labelTarget)})}t(Su,Ra),Su.$inject=["injector","eventBus","modeling"];var Tu={__init__:["labelSupport"],labelSupport:["type",Su]};function Ru(e,t,n){var i=Ho(t),r=Ho(n),o=Wo(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return zr({x:r.x+a,y:r.y+s})}function Au(e,t,n){var i=Ho(e),r=Ho(t),o=Ho(n),a=Wo(e,i),s=Wo(i,r),c=s.x*(n.width/t.width),p=s.y*(n.height/t.height),l=o.x+c,u=o.y+p;return zr({x:l+a.x-e.x,y:u+a.y-e.y})}function Pu(e,t,r,o){Ra.call(this,t);var n=e.get("movePreview",!1);t.on("shape.move.start",1401,function(e){var t,n,i,r,o=e.context,a=o.shapes,s=o.validatedShapes;o.shapes=(n=ku(t=a),T("id",t,n)),o.validatedShapes=(r=S(i=s,"id"),k(i,function(e){for(;e;){if(e.host&&r[e.host.id])return!1;e=e.parent}return!0}))}),n&&t.on("shape.move.start",251,function(e){var t=e.context;M(ku(t.shapes),function(e){n.makeDraggable(t,e,!0),M(e.labels,function(e){n.makeDraggable(t,e,!0)})})}),this.preExecuted("elements.move",1401,function(e){var t=e.context,n=t.closure;M(ku(t.shapes),function(e){n.add(e,n.topLevel[e.host.id])})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.shapes,i=t.newHost;1<n.length||M(i?n:k(n,function(e){return!!e.host}),function(e){o.updateAttachment(e,i)})}),this.postExecuted("elements.move",function(e){M(e.context.shapes,function(e){M(e.attachers,function(e){M(e.outgoing.slice(),function(e){r.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)}),M(e.incoming.slice(),function(e){r.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,i=t.host;i&&o.updateAttachment(n,i)}),this.postExecute("shape.replace",function(e){var t=e.context,n=t.oldShape,i=t.newShape;wu(n.attachers,function(e){"attach"===r.allowed("elements.move",{target:i,shapes:[e]})?o.updateAttachment(e,i):o.removeShape(e)}),i.attachers.length&&M(i.attachers,function(e){var t=Au(e,n,i);o.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,i=t.oldBounds,r=t.newBounds;M(n.attachers,function(e){var t=Au(e,i,r);o.moveShape(e,t,e.parent),M(e.labels,function(e){o.moveShape(e,t,e.parent)})})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;wu(t.attachers,function(e){o.removeShape(e)}),t.host&&o.updateAttachment(t,null)}),t.on("spaceTool.move",function(e){var t=e.context,n=t.initialized,i=t.attachSupportInitialized;if(n&&!i){var r=t.movingShapes;M(k(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)}),function(t){pt(r,t),M(t.labels,function(e){pt(r,t.label)})}),t.attachSupportInitialized=!0}})}function ku(e){return h(b(e,function(e){return e.attachers||[]}))}t(Pu,Ra),Pu.$inject=["injector","eventBus","rules","modeling"];var Mu={__depends__:[Ua],__init__:["attachSupport"],attachSupport:["type",Pu]};function Du(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Du.$inject=["eventBus","dragging"],Du.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Du.prototype.isActive=function(e){return e&&this._active===e},Du.prototype.length=function(e){return this._tools.length},Du.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Du.prototype.bindEvents=function(t,e){var n=this._eventBus,i=this._dragging,r=[];n.on(e.tool+".init",function(e){if(!e.context.reactivate&&this.isActive(t))return this.setActive(null),void i.cancel();this.setActive(t)},this),M(e,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;this._active&&(t&&ee(t.target,'.group[data-group="tools"]')||this.setActive(null))},this)};var Nu={__depends__:[za],__init__:["toolManager"],toolManager:["type",Du]};var Bu=Math.abs,Ou=Math.round,Lu="crosshair",Iu={x:"width",y:"height"},ju={x:"y",y:"x"};function zu(c,e,t,n,i,r){this._canvas=t,this._dragging=e,this._modeling=n,this._rules=i,this._toolManager=r;var p=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),c.on("spaceTool.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&c.once("spaceTool.selection.ended",function(){p.activateMakeSpace(e.originalEvent)})}),c.on("spaceTool.move",1500,function(e){var t=e.context;t.initialized||(t.initialized=p.initializeMakeSpace(e,t))}),c.on("spaceTool.end",function(t){var e=t.context,n=e.axis,i=e.direction,r=e.movingShapes,o=e.resizingShapes;if(e.initialized){var a={x:Ou(t.dx),y:Ou(t.dy)},s=!(a[ju[n]]=0);M(o,function(e){("w"===i&&t.x>e.x+e.width||"e"===i&&t.x<e.x||"n"===i&&t.y>e.y+e.height||"s"===i&&t.y<e.y)&&(s=!1)}),s&&p.makeSpace(r,o,a,i),c.once("spaceTool.ended",function(e){p.activateSelection(e.originalEvent,!0,!0)})}})}zu.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"],zu.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:Lu,autoActivate:t,data:{context:{reactivate:n}}})},zu.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Lu,data:{context:{}}})},zu.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},zu.prototype.initializeMakeSpace=function(e,t){var n=Bu(e.dx)>Bu(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Bu(i)<5)return!1;i<0&&(i*=-1),eo(e)&&(i*=-1);var o=mt(this._canvas.getRootElement(),!0);return $(t,this.calculateAdjustments(o,n,i,r),{axis:n,direction:function(e,t){if("x"===e){if(0<t)return"e";if(t<0)return"w"}if("y"===e){if(0<t)return"s";if(t<0)return"n"}return null}(n,i)}),jo("resize-"+("x"===n?"ew":"ns")),!0},zu.prototype.calculateAdjustments=function(e,i,r,o){var a=[],s=[],c=this._rules;return e.forEach(function(e){var t=e[i],n=t+e[Iu[i]];if(e.parent&&!e.waypoints)return 0<r&&o<t?a.push(e):r<0&&n<o?a.push(e):t<o&&o<n&&c.allowed("shape.resize",{shape:e})?s.push(e):void 0}),{movingShapes:a,resizingShapes:s}},zu.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},zu.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var Fu="djs-dragging",$u="djs-resizing";function Hu(e,u,h,d,m){function f(e,t){M(e,function(e){m.addDragger(e,t),h.addMarker(e,Fu)})}e.on("spaceTool.selection.start",function(e){var t=h.getLayer("space"),n=e.context,i="M 0,-10000 L 0,10000",r="M -10000,0 L 10000,0",o=Ne("g");_e(o,d.cls("djs-crosshair-group",["no-events"])),ve(t,o);var a=Ne("path");_e(a,"d",i),Te(a).add("djs-crosshair"),ve(o,a);var s=Ne("path");_e(s,"d",r),Te(s).add("djs-crosshair"),ve(o,s),n.crosshairGroup=o}),e.on("spaceTool.selection.move",function(e){Kt(e.context.crosshairGroup,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&Ae(t)}),e.on("spaceTool.move",250,function(e){var t=e.context,n=t.line,i=t.axis,a=t.movingShapes,s=t.resizingShapes;if(t.initialized){if(!t.dragGroup){var r=h.getLayer("space");_e(n=Ne("path"),"d","M0,0 L0,0"),Te(n).add("djs-crosshair"),ve(r,n),t.line=n;var o=Ne("g");_e(o,d.cls("djs-drag-group",["no-events"])),ve(h.getDefaultLayer(),o),f(a,o),f(t.movingConnections=u.filter(function(t){var n=!1;M(a,function(e){M(e.outgoing,function(e){t===e&&(n=!0)})});var i=!1;M(a,function(e){M(e.incoming,function(e){t===e&&(i=!0)})});var r=!1;M(s,function(e){M(e.outgoing,function(e){t===e&&(r=!0)})});var o=!1;return M(s,function(e){M(e.incoming,function(e){t===e&&(o=!0)})}),t.waypoints&&(n||r)&&(i||o)}),o),t.dragGroup=o}if(!t.frameGroup){var c=Ne("g");_e(c,d.cls("djs-frame-group",["no-events"])),ve(h.getDefaultLayer(),c);var p=[];M(s,function(e){var t=m.addFrame(e,c);p.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),h.addMarker(e,$u)}),t.frameGroup=c,t.frames=p}_e(n,{path:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[i],display:""});var l={x:e.dx,y:e.dy};l[{x:"y",y:"x"}[t.axis]]=0,Kt(t.dragGroup,l.x,l.y),M(t.frames,function(e){5<e.initialWidth+l.x&&_e(e.element,{width:e.initialWidth+l.x}),5<e.initialHeight+l.y&&_e(e.element,{height:e.initialHeight+l.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,n=t.movingShapes,i=t.movingConnections,r=t.resizingShapes,o=t.line,a=t.dragGroup,s=t.frameGroup;M(n,function(e){h.removeMarker(e,Fu)}),M(i,function(e){h.removeMarker(e,Fu)}),a&&(Ae(o),Ae(a)),M(r,function(e){h.removeMarker(e,$u)}),s&&Ae(s)})}Hu.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Wu={__init__:["spaceToolPreview"],__depends__:[za,Ua,Nu,lp],spaceTool:["type",zu],spaceToolPreview:["type",Hu]};function Gu(e){this._model=e}function Vu(e,t,i,n){Ra.call(this,e),this._bpmnFactory=t,this._translate=n;var r=this;function o(e){M(e.context.oldRoot.children,function(e){wi(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;wi(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function c(e){r.updateConnectionWaypoints(e.context.connection)}function p(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],function(e){var t,n=e.context;n.cropped||((t=n.connection).waypoints=i.getCroppedWaypoints(t),n.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Uu(function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)})),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Uu(function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)})),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Uu(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],Uu(function(e){"label"!==e.context.shape.type&&a(e)})),e.on("shape.changed",function(e){"label"===e.element.type&&a({context:{shape:e.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],Uu(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],Uu(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Uu(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Uu(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],Uu(function(e){var t=e.context,n=t.connection,i=Si(n),r=Si(t.oldSource),o=Si(t.oldTarget),a=Si(n.source),s=Si(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(wi(s,"bpmn:Activity")||wi(s,"bpmn:EndEvent")||wi(s,"bpmn:Gateway")||wi(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!wi(a,"bpmn:Activity")&&!wi(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(wi(s,"bpmn:Activity")||wi(s,"bpmn:EndEvent")||wi(s,"bpmn:Gateway")||wi(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],Uu(function(e){var t=e.context,n=t.connection,i=Si(n),r=Si(n.source);t.default&&(wi(r,"bpmn:ExclusiveGateway")||wi(r,"bpmn:InclusiveGateway")||wi(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&wi(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],Uu(p)),this.reverted(["element.updateAttachment"],Uu(p))}function Uu(n){return function(e){var t=e.context;wi(t.shape||t.connection,"bpmn:BaseElement")&&n(e)}}function qu(e,t,n){Ht.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Ku(e,t,n){e[n]=t[n],delete t[n]}function Yu(e){this._modeling=e}Gu.$inject=["moddle"],Gu.prototype._needsId=function(e){return da(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property"])},Gu.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Gu.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Gu.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Gu.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",$({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Gu.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Gu.prototype.createDiWaypoints=function(e){var t=this;return b(e,function(e){return t.createDiWaypoint(e)})},Gu.prototype.createDiWaypoint=function(e){return this.create("dc:Point",F(e,["x","y"]))},Gu.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",$({bpmnElement:e},n))},Gu.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})},t(Vu,Ra),Vu.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Vu.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Vu.prototype.updateParent=function(e,t){if(!(e instanceof zt||wi(e,"bpmn:DataStoreReference")&&e.parent&&wi(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;wi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),wi(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),wi(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),wi(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},Vu.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof zt?this._getLabel(t):t,i=n.bounds;i||(i=this._bpmnFactory.createDiBounds(),n.set("bounds",i)),$(i,{x:e.x,y:e.y,width:e.width,height:e.height})},Vu.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(wi(n,"bpmn:Lane")&&pt(n.get("flowNodeRef"),e),wi(t,"bpmn:Lane")&&lt(t.get("flowNodeRef"),e))},Vu.prototype.updateDiConnection=function(e,t,n){e.sourceElement&&e.sourceElement.bpmnElement!==t&&(e.sourceElement=t&&t.di),e.targetElement&&e.targetElement.bpmnElement!==n&&(e.targetElement=n&&n.di)},Vu.prototype.updateDiParent=function(e,t){if(t&&!wi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");e.$parent=t?(n.push(e),t):(pt(n,e),null)}},Vu.prototype.getLaneSet=function(e){var t,n;return wi(e,"bpmn:Lane")?(t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),(e.childLaneSet=t).$parent=e):(wi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t))),t},Vu.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&!((wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput"))&&(wi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(wi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(wi(e,"bpmn:FlowElement")){if(t)if(wi(t,"bpmn:Participant"))t=t.processRef;else if(wi(t,"bpmn:Lane"))for(;wi(t=t.$parent.$parent,"bpmn:Lane"););i="flowElements"}else if(wi(e,"bpmn:Artifact")){for(;t&&!wi(t,"bpmn:Process")&&!wi(t,"bpmn:SubProcess")&&!wi(t,"bpmn:Collaboration");){if(wi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(wi(e,"bpmn:MessageFlow"))i="messageFlows";else if(wi(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!wi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(pt(o.get("rootElements"),a),a.$parent=null),t&&(lt(o.get("rootElements"),a),a.$parent=o))}else wi(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":wi(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&pt(s=e.$parent.get(i),e),e.$parent=t?((s=t.get(i)).push(e),t):null,n){var c=n.get(i);pt(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Vu.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Vu.prototype.updateConnection=function(e){var t,n=e.connection,i=Si(n),r=Si(n.source),o=Si(n.target);if(wi(i,"bpmn:DataAssociation"))wi(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):wi(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=wi(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(pt(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(pt(i.targetRef&&i.targetRef.get("incoming"),i),o&&o.get("incoming")&&o.get("incoming").push(i)),i.targetRef=o)}this.updateConnectionWaypoints(n),this.updateDiConnection(i.di,r,o)},Vu.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},t(qu,Ht),qu.$inject=["bpmnFactory","moddle","translate"],qu.prototype.baseCreate=Ht.prototype.create,qu.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,$({type:"label"},qi,t)):this.createBpmnElement(e,t)},qu.prototype.createBpmnElement=function(e,t){var n,i,r,o,a,s=this._translate,c=(t=t||{}).businessObject;if(!c){if(!t.type)throw new Error(s("no shape type specified"));c=this._bpmnFactory.create(t.type)}return c.di||(c.di="root"===e?this._bpmnFactory.createDiPlane(c,[],{id:c.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(c,[],{id:c.id+"_di"}):this._bpmnFactory.createDiShape(c,{},{id:c.id+"_di"})),t.colors&&($(c.di,t.colors),delete t.colors),i=c,r=t,M(["processRef","isInterrupting","associationDirection","isForCompensation"],function(e){void 0!==r[e]&&Ku(i,r,e)}),t.isExpanded&&Ku(c.di,t,"isExpanded"),wi(c,"bpmn:ExclusiveGateway")&&(c.di.isMarkerVisible=!0),t.eventDefinitionType&&(o=c.get("eventDefinitions")||[],a=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(a.condition=this._moddle.create("bpmn:FormalExpression")),o.push(a),(a.$parent=c).eventDefinitions=o,delete t.eventDefinitionType),n=this._getDefaultSize(c),t=$({businessObject:c,id:c.id},n,t),this.baseCreate(e,t)},qu.prototype._getDefaultSize=function(e){return wi(e,"bpmn:SubProcess")?Ci(e)?{width:350,height:200}:{width:100,height:80}:wi(e,"bpmn:Task")?{width:100,height:80}:wi(e,"bpmn:Gateway")?{width:50,height:50}:wi(e,"bpmn:Event")?{width:36,height:36}:wi(e,"bpmn:Participant")?Ci(e)?{width:600,height:250}:{width:400,height:100}:wi(e,"bpmn:Lane")?{width:400,height:100}:wi(e,"bpmn:DataObjectReference")?{width:36,height:50}:wi(e,"bpmn:DataStoreReference")?{width:50,height:50}:wi(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},qu.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)},Yu.$inject=["modeling"],Yu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape;i=e.shape=this._modeling.createShape(i,e.position,n,{attach:e.attach}),e.shape=i},Yu.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,v(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)};var Xu=Math.round;function Zu(e){this._canvas=e}function Qu(e,t){this._canvas=e,this._modeling=t}function Ju(e,t,n){var i=rh(e)[0];return Ru(i.original||i,n,t)}function eh(e,t,n){var i=rh(e),r=i[i.length-1];return Ru(r.original||r,n,t)}function th(e,t,n){return Ju(e,t,ih(t,n))}function nh(e,t,n){return eh(e,t,ih(t,n))}function ih(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function rh(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function oh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function ah(e){this._modeling=e}function sh(e){this._modeling=e,this._helper=new ah(e)}function ch(e){this._modeling=e}function ph(e,t){this._modeling=e,this._rules=t}function lh(e){this._modeling=e}function uh(e){this._modeling=e}function hh(e){Zu.call(this,e)}Zu.$inject=["canvas"],Zu.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?$(t,n):$(t,{x:n.x-Xu(t.width/2),y:n.y-Xu(t.height/2)}),this._canvas.addShape(t,i,r),t},Zu.prototype.revert=function(e){this._canvas.removeShape(e.shape)},Qu.$inject=["canvas","modeling"],Qu.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;wu(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),wu(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),wu(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},Qu.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ut(i.children,n),t.removeShape(n),n},Qu.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return lt(i.children,n,r),t.addShape(n,i),n},oh.prototype.add=function(e,t){return this.addAll([e],t)},oh.prototype.addAll=function(e,t){return $(this,function(e,t,n){p(t)&&(t=!0),P(t)&&(n=t,t=!0);var i=vt((n=n||{}).allShapes),r=vt(n.allConnections),o=vt(n.enclosedElements),a=vt(n.enclosedConnections),s=vt(n.topLevel,t&&S(e,function(e){return e.id}));function c(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return dt(e,function(e){if(!(o[e.id]=e).waypoints)return M((i[e.id]=e).incoming,c),M(e.outgoing,c),e.children;a[e.id]=r[e.id]=e}),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},ah.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ah.prototype.moveClosure=function(e,i,r,t,n){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;n&&n.parent===r&&(l=!0),M(a,function(e){o.moveShape(e,i,p[e.id]&&!l&&r,{recurse:!1,layout:!1})}),M(s,function(e){var t=!!a[e.source.id],n=!!a[e.target.id];c[e.id]&&t&&n?o.moveConnection(e,i,p[e.id]&&!l&&r):o.layoutConnection(e,{connectionStart:t&&th(e,e.source,i),connectionEnd:n&&nh(e,e.target,i)})})},ah.prototype.getClosure=function(e){return(new oh).addAll(e,!0)},sh.$inject=["modeling"],sh.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=F(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=pt(o.children,t),lt(i.children,t,r),$(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},sh.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(M(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:nh(e,t,n)})}),M(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:th(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},sh.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return lt(n.children,t,i),$(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},sh.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},sh.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},ch.$inject=["modeling"],ch.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},$(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ch.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;M(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:eh(e,t,n)})}),M(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Ju(e,t,n)})})},ch.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return $(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ph.$inject=["modeling","rules"],ph.prototype.preExecute=function(e){var i,r=this,t=this._modeling,o=this._rules,n=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return o.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};i=e.newShape=e.newShape||r.createShape(a,l,n.parent,s),n.host&&t.updateAttachment(i,n.host),!1!==s.moveChildren&&(p=n.children.slice(),t.moveElements(p,{x:0,y:0},i));var u=n.incoming.slice(),h=n.outgoing.slice();M(u,function(e){var t=e.waypoints,n=t[t.length-1];c("connection.reconnectEnd",e.source,i,e)&&r.reconnectEnd(e,i,n)}),M(h,function(e){var t=e.waypoints[0],n=e.target;c("connection.reconnectStart",i,n,e)&&r.reconnectStart(e,i,t)})},ph.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;M(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),M(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},ph.prototype.execute=function(e){},ph.prototype.revert=function(e){},ph.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ph.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},ph.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)},lh.$inject=["modeling"],lh.prototype.execute=function(e){var t,n,i,r=e.shape,o=r.children;return e.oldChildrenVisibility=(t={},o.forEach(function(e){t[e.id]=e.hidden}),t),r.collapsed=!r.collapsed,n=o,i=r.collapsed,n.forEach(function(e){e.hidden=i}),[r].concat(o)},lh.prototype.revert=function(e){var t,n=e.shape,i=e.oldChildrenVisibility,r=n.children;return t=i,r.forEach(function(e){e.hidden=t[e.id]}),n.collapsed=!n.collapsed,[n].concat(r)},uh.$inject=["modeling"],uh.prototype.preExecute=function(e){var n=this._modeling,t=e.resizingShapes,i=e.delta,r=e.direction;M(t,function(e){var t=function(e,t,n){var i=n.x,r=n.y;switch(t){case"n":return{x:e.x,y:e.y+r,width:e.width,height:e.height-r};case"s":return{x:e.x,y:e.y,width:e.width,height:e.height+r};case"w":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height};case"e":return{x:e.x,y:e.y,width:e.width+i,height:e.height};default:throw new Error("unrecognized direction: "+t)}}(e,r,i);n.resizeShape(e,t)})},uh.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},uh.prototype.execute=function(e){},uh.prototype.revert=function(e){},t(hh,Zu),hh.$inject=["canvas"];var dh=Zu.prototype.execute;hh.prototype.execute=function(e){var t,n=e.shape;return t=n,["width","height"].forEach(function(e){void 0===t[e]&&(t[e]=0)}),n.labelTarget=e.labelTarget,dh.call(this,e)};var mh=Zu.prototype.revert;function fh(e,t){this._canvas=e,this._layouter=t}function yh(e,t){this._canvas=e,this._modeling=t}function vh(){}function gh(e,t){this._layouter=e,this._canvas=t}function bh(){}function xh(e){this._modeling=e}function _h(e){this._helper=new ah(e)}function Eh(e,t){this._modeling=e,this._elementRegistry=t}function wh(e){this._modeling=e}hh.prototype.revert=function(e){return e.shape.labelTarget=null,mh.call(this,e)},fh.$inject=["canvas","layouter"],fh.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},fh.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null},yh.$inject=["canvas","modeling"],yh.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ut(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},yh.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,lt(n.children,t,i),this._canvas.addConnection(t,n),t},vh.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=pt(o.children,t),lt(i.children,t,r),t.parent=i,M(t.waypoints,function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)}),t},vh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return pt(n.children,t),lt(i.children,t,r),t.parent=i,M(t.waypoints,function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)}),t},gh.$inject=["layouter","canvas"],gh.prototype.execute=function(e){var t=e.connection;return $(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},gh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},bh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},bh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},xh.$inject=["modeling"],xh.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget are required");if(t&&n)throw new Error("must specify either newSource or newTarget");return g(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},xh.prototype.postExecute=function(e){var t,n,i=e.connection,r=e.dockingOrPoints,o=e.newSource,a=o?"connectionStart":"connectionEnd",s={};t=g(r)?o?r[0]:r[r.length-1]:r,s[a]=(n=t).original||n,this._modeling.layoutConnection(i,s)},xh.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},_h.$inject=["modeling"],_h.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},_h.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},Eh.$inject=["modeling","elementRegistry"],Eh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;M(e.elements,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})},wh.$inject=["modeling"];var Sh={x:"y",y:"x"};function Ch(e,t){this._modeling=e,this._canvas=t}function Th(e){this._modeling=e}function Rh(e,t){return pt(e&&e.attachers,t)}function Ah(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),lt(i,t,n)}}function Ph(t,e){M(e,function(e){t[e]&&delete t[e]})}function kh(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}function Mh(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}wh.prototype.preExecute=function(e){var o=this._modeling,a=e.groups,s=e.axis,c=e.dimension;function p(e,t){e.range.min=Math.min(t[s],e.range.min),e.range.max=Math.max(t[s]+t[c],e.range.max)}function l(e){return e[s]+e[c]/2}function u(e){return e.length-1}function h(e){return e.max-e.min}var d,t,m=a[0],f=u(a),y=a[f],v=0;M(a,function(i,e){var t,n,r;i.elements.length<2?e&&e!==a.length-1&&(p(i,i.elements[0]),v+=h(i.range)):(n=(t=R(i.elements,s))[0],e===f&&(n=t[u(t)]),r=l(n),i.range=null,M(t,function(e){var t,n;(n={y:0})[s]=r-l(t=e),n[s]&&(n[Sh[s]]=0,o.moveElements([t],n,t.parent)),null!==i.range?p(i,e):i.range={min:e[s],max:e[s]+e[c]}}),e&&e!==a.length-1&&(v+=h(i.range)))}),t=Math.abs(y.range.min-m.range.max),(d=Math.round((t-v)/(a.length-1)))<a.length-1||M(a,function(n,e){var i,r={};n!==m&&n!==y&&(i=a[e-1],n.range.max=0,M(n.elements,function(e,t){r[Sh[s]]=0,r[s]=i.range.max-e[s]+d,n.range.min!==e[s]&&(r[s]+=e[s]-n.range.min),r[s]&&o.moveElements([e],r,e.parent),n.range.max=Math.max(e[s]+e[c],t?n.range.max:0)}))})},wh.prototype.postExecute=function(e){},Ch.$inject=["modeling","canvas"],Ch.prototype.preExecute=function(e){var n=this._modeling,t=e.elements,i=e.alignment;M(t,function(e){var t={x:0,y:0};i.left?t.x=i.left-e.x:i.right?t.x=i.right-e.width-e.x:i.center?t.x=i.center-Math.round(e.width/2)-e.x:i.top?t.y=i.top-e.y:i.bottom?t.y=i.bottom-e.height-e.y:i.middle&&(t.y=i.middle-Math.round(e.height/2)-e.y),n.moveElements([e],t,e.parent)})},Ch.prototype.postExecute=function(e){},Th.$inject=["modeling"],Th.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Rh(i,t),Ah(n,t),t.host=n,t},Th.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Rh(n,t),Ah(i,t,r),t},kh.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"],kh.prototype.preExecute=function(e){var s=this._eventBus,c=this,p=e.tree,l=e.topParent,u=e.position;p.createdElements={},p.labels=[],M(p,function(e,t){var a=parseInt(t,10);isNaN(a)||(a||(e=b(e,function(e){return e.parent=l,e})),M(e=R(e,"priority"),function(e){var t,n=e.id,i=e.parent,r={},o=$({},e);if(a&&(o.parent=c._getCreatedElement(i,p)),i)if(s.fire("element.paste",{createdElements:p.createdElements,descriptor:o}),i=o.parent,o.waypoints)(o=c._createConnection(o,i,u,p))&&(p.createdElements[n]={element:o,descriptor:e});else{if(o.parent!==l&&(r.root=!1),o.host&&(r.attach=!0,i=c._getCreatedElement(o.host,p)),o.labelTarget)return p.labels.push(o);t={x:Math.round(u.x+o.delta.x+o.width/2),y:Math.round(u.y+o.delta.y+o.height/2)},Ph(o,["id","parent","delta","host","priority"]),(o=c._createShape(o,i,t,r))&&(p.createdElements[n]={element:o,descriptor:e})}}))})},kh.prototype.postExecute=function(e){var o=this._modeling,t=this._selection,a=this,s=e.tree,n=s.labels,i=[];M(n,function(t){var e,n,i,r=a._getCreatedElement(t.labelTarget,s);r&&(e=r.labels)&&e.length&&(n={x:r.x,y:r.y},r.waypoints&&(n=r.waypoints[0]),M(e,function(e){i={x:Math.round(n.x-e.x+t.delta.x),y:Math.round(n.y-e.y+t.delta.y)},o.moveShape(e,i,r.parent)}))}),M(s[0],function(e){var t=e.id,n=s.createdElements[t];n&&i.push(n.element)}),t.select(i)},kh.prototype._createConnection=function(n,e,i,t){var r,o,a=this._modeling,s=this._rules;return n.waypoints=b(n.waypoints,function(e,t){return{x:Math.round(i.x+n.delta[t].x),y:Math.round(i.y+n.delta[t].y)}}),r=this._getCreatedElement(n.source,t),o=this._getCreatedElement(n.target,t),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Ph(n,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,n,e)):null},kh.prototype._createShape=function(e,t,n,i,r){var o=this._modeling,a=this._elementFactory;if(!this._rules.allowed("element.paste",{element:e,position:n,parent:t}))return null;var s=a.createShape(e);return o.createShape(s,n,t,i,r),s},kh.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element},Mh.$inject=["eventBus","elementFactory","commandStack"],Mh.prototype.getHandlers=function(){return{"shape.append":Yu,"shape.create":Zu,"shape.delete":Qu,"shape.move":sh,"shape.resize":ch,"shape.replace":ph,"shape.toggleCollapse":lh,spaceTool:uh,"label.create":hh,"connection.create":fh,"connection.delete":yh,"connection.move":vh,"connection.layout":gh,"connection.updateWaypoints":bh,"connection.reconnectStart":xh,"connection.reconnectEnd":xh,"elements.move":_h,"elements.delete":Eh,"elements.distribute":wh,"elements.align":Ch,"element.updateAttachment":Th,"elements.paste":kh}},Mh.prototype.registerHandlers=function(n){M(this.getHandlers(),function(e,t){n.registerHandler(t,e)})},Mh.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Mh.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Mh.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?a=(r=n).parent:!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Mh.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Mh.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Mh.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Mh.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Mh.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Mh.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,attach:r.attach};return this._commandStack.execute("shape.append",o),o.shape},Mh.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Mh.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Mh.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Mh.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Mh.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Mh.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},Mh.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Mh.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},Mh.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Mh.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Mh.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},Mh.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},Mh.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Mh.prototype._create=function(e,t){return t instanceof Lt?t:this._elementFactory.create(e,t)},Mh.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};var Dh="default",Nh="id",Bh={width:0,height:0};function Oh(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function Lh(e,t){return Nh in e&&e.id!==t.id}function Ih(i,e){M(e,function(e,t){var n;"di"!==t?i.set(t,e):i.di&&(n=i.di,M(e,function(e,t){n.set(t,e)}))})}Oh.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Oh.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r,o,a,s,c=this._elementRegistry,p=this._moddle.ids,l=t.businessObject,u=(a=e.properties,s=$({},a),jh.forEach(function(e){e in a&&(s[e]=Si(s[e]))}),s),h=e.oldProperties||(r=l,x(E(o=u),function(e,t){var n;return e[t]="di"!==t?r.get(t):(n=r.di,x(E(o.di),function(e,t){return e[t]=n.get(t),e},{})),e},{}));return Lh(u,l)&&(p.unclaim(l.id),c.updateId(t,u.id),p.claim(u.id,l)),Dh in u&&(u[Dh]&&n.push(c.get(u[Dh].id)),l[Dh]&&n.push(c.get(l[Dh].id))),Ih(l,u),e.oldProperties=h,e.changed=n},Oh.prototype.postExecute=function(e){var t=e.element.label,n=t&&Si(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,Bh)}},Oh.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Ih(r,i),Lh(n,r)&&(a.unclaim(n.id),o.updateId(t,i.id),a.claim(i.id,r)),e.changed};var jh=["default"];function zh(e,t){this._canvas=e,this._modeling=t}function Fh(e,t){this._modeling=e,this._spaceTool=t}function $h(e,t){this._modeling=e,this._translate=t}function Hh(e,t){this._modeling=e,this._spaceTool=t}zh.$inject=["canvas","modeling"],zh.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=o.di;t.setRootElement(n,!0),lt(a.rootElements,i),pt((i.$parent=a).rootElements,o),o.$parent=null,o.di=null,(s.bpmnElement=i).di=s,e.oldRoot=r},zh.prototype.revert=function(e){var t=this._canvas,n=e.newRoot.businessObject,i=e.oldRoot,r=i.businessObject,o=n.$parent,a=n.di;t.setRootElement(i,!0),pt(o.rootElements,n),n.$parent=null,lt(o.rootElements,r),r.$parent=o,n.di=null,(a.bpmnElement=r).di=a},Fh.$inject=["modeling","spaceTool"],Fh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Mc(i),a=o===i,s=a?i:i.parent;kc(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+30,y:i.y,width:i.width-30,height:i.height},s);var c=[];dt(o,function(e){return c.push(e),e===i?[]:k(e.children,function(e){return e!==i})});var p="top"===r?-120:120,l="top"===r?i.y:i.y+i.height,u=l+("top"===r?10:-10),h="top"===r?"n":"s",d=t.calculateAdjustments(c,"y",p,u);t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?30:0),y:l-("top"===r?120:0),width:i.width-(a?30:0),height:120},s)},$h.$inject=["modeling","translate"],$h.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=kc(i),a=o.length;if(r<a)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+30,y:s,width:i.width-30,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},Hh.$inject=["modeling","spaceTool"],Hh.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Hh.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Dc(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Hh.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=Fr(e),p=Ec(Fr(t),c),l=Mc(e),u=[],h=[];dt(l,function(e){return u.push(e),(wi(e,"bpmn:Lane")||wi(e,"bpmn:Participant"))&&h.push(e),e.children}),(p.bottom||p.top)&&(n=p.bottom||p.top,i=e.y+(p.bottom?e.height:0)+(p.bottom?-10:10),r=p.bottom?"s":"n",o=0<p.top||p.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(p.left||p.right)&&(n=p.right||p.left,i=e.x+(p.right?e.width:0)+(p.right?-10:100),r=p.right?"e":"w",o=0<p.left||p.right<0?-n:n,a=s.calculateAdjustments(h,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var Wh="flowNodeRef",Gh="lanes";function Vh(e){this._elementRegistry=e}function Uh(e){this._moddle=e}Vh.$inject=["elementRegistry"],Vh.prototype.computeUpdates=function(e,t){var n={},r=[],i={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(o){return o.parent?(e=Mc(o),i[e.id]||(i[e.id]=Pc(e)),i[e.id]).filter(function(e){return t=o,n=Fr(e),i=t.x+t.width/2,r=t.y+t.height/2,i>n.left&&i<n.right&&r>n.top&&r<n.bottom;var t,n,i,r}).map(function(e){return e.businessObject}):[];var e}return t.forEach(function(e){var t=Mc(e);t&&!n[t.id]&&(t.children.filter(function(e){return wi(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get(Gh).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get(Wh).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},Vh.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get(Gh);e.remove.forEach(function(e){pt(n,e),pt(e.get(Wh),t)}),e.add.forEach(function(e){lt(n,e),lt(e.get(Wh),t)})})},Vh.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get(Gh);e.add.forEach(function(e){pt(n,e),pt(e.get(Wh),t)}),e.remove.forEach(function(e){lt(n,e),lt(e.get(Wh),t)})})},Uh.$inject=["moddle"],Uh.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Uh.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var qh={fill:void 0,stroke:void 0};function Kh(e){this._commandStack=e}Kh.$inject=["commandStack"],Kh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||qh,i=this,r={};"fill"in n&&$(r,{fill:n.fill}),"stroke"in n&&$(r,{stroke:n.stroke}),M(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var Yh={width:0,height:0};function Xh(c,p){function t(e,t){var n,i,r,o=e.label||e,a=e.labelTarget||e;return n=t,i=o.businessObject,(r=gp(i))&&(i[r]=n),[o,a]}this.preExecute=function(e){var t=e.element,n=t.businessObject,i=e.newLabel;if(!Ji(t)&&Yi(t)&&!Xi(t)&&!Zh(i)){var r=Qi(t);r={x:r.x,y:r.y+7},c.createLabel(t,r,{id:n.id+"_label",businessObject:n})}},this.execute=function(e){return e.oldLabel=bp(e.element),t(e.element,e.newLabel)},this.revert=function(e){return t(e.element,e.oldLabel)},this.postExecute=function(e){var t=e.element,n=t.label||t,i=e.newLabel,r=e.newBounds,o=e.hints||{};if(Ji(n)&&Zh(i))!1!==o.removeShape&&c.removeShape(n,{unsetLabel:!1});else if(Yi(t)||wi(t,"bpmn:TextAnnotation")){var a=Si(n),s=a.name||a.text;s&&(void 0===r&&(r=p.getExternalLabelBounds(n,s)),r&&c.resizeShape(n,r,Yh))}}}function Zh(e){return!e||!e.trim()}function Qh(e,t,n,i){Mh.call(this,e,t,n),this._bpmnRules=i}function Jh(){}Xh.$inject=["modeling","textRenderer"],t(Qh,Mh),Qh.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Qh.prototype.getHandlers=function(){var e=Mh.prototype.getHandlers.call(this);return e["element.updateProperties"]=Oh,e["canvas.updateRoot"]=zh,e["lane.add"]=Fh,e["lane.resize"]=Hh,e["lane.split"]=$h,e["lane.updateRefs"]=Vh,e["id.updateClaim"]=Uh,e["element.setColor"]=Kh,e["element.updateLabel"]=Xh,e},Qh.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Qh.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},Qh.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Qh.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Qh.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Qh.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Qh.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Qh.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Qh.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},Qh.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Qh.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Qh.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Jh.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Hr(e.source),t.connectionEnd||Hr(e.target)]};var ed=20,td=5,nd=Math.round,id=20,rd={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function od(e,t,n){var i,r,o,a,s=Wr(t,e,td),c=n.split(":")[0],p=nd((t.x-e.x)/2+e.x),l=nd((t.y-e.y)/2+e.y),u=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[c].test(o)),h=/h|r|l/.test(c),d=!1;return u?(i=h?{x:p,y:e.y}:{x:e.x,y:l},r=h?"h:h":"v:v"):(a=s,r=h?"h:v":"v:h",i=!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[c].test(a)?h?(d=l===e.y,{x:e.x+ed*(/l/.test(c)?-1:1),y:d?l+ed:l}):{x:(d=p===e.x)?p+ed:p,y:e.y+ed*(/t/.test(c)?-1:1)}:{x:p,y:l}),{waypoints:sd(e,i,r).concat(i),directions:r,turnNextDirections:d}}function ad(e){return e.split(":").reverse().join(":")}function sd(e,t,n){if(!(i=n=n||"h:h")||!/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(i))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");var i,r;if(hd(n)){var o=od(e,t,n),a={waypoints:(r=od(t,e,ad(n))).waypoints.slice().reverse(),directions:ad(r.directions),turnNextDirections:r.turnNextDirections},s=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:sd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(o,a);return[].concat(o.waypoints,s.waypoints,a.waypoints)}return function(e,t,n){var i=nd((t.x-e.x)/2+e.x),r=nd((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function cd(e,t,n,i,r){var o=f(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=Wr(e,t,rd[o]||0),s=function(e,t){if(hd(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(a,o);n=n||Hr(e),i=i||Hr(t);var c,p,l,u=s.split(":"),h=dd(n,e,u[0],{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[a]),d=dd(i,t,u[1],a);return(l=sd(c=h,p=d,s)).unshift(c),l.push(p),md(l)}function pd(e,t,n,i,r,o){var a,s,c,p,l;return g(n)&&(r=n,o=i,n=Hr(e),i=Hr(t)),r=r||[],(a=-1!==(o=$({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=Wr(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===r.preserveDocking?ld(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:ld(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null}(e,t,n,i,o))?a:(a=o.connectionEnd&&(s=t,c=e,p=i,l=r.slice().reverse(),(l=ud(s,c,p,l))?l.reverse():null))?a:(a=o.connectionStart&&ud(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:cd(e,t,n,i,o))}function ld(e,t,n){var i,r,o;return i=t[e],r=n[e],o=n[e]+n[{x:"width",y:"height"}[e]],r<=i&&i<=o}function ud(e,t,n,i){if((r=i).length<3||!(4<r.length)&&A(r,function(e,t){var n=r[t-1];return n&&er(e,n)<3}))return null;var r,o,a=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(ir(t,e)){case"v":return{x:e.x,y:n.y};case"h":return{x:n.x,y:e.y}}return{x:e.x,y:e.y}}(s[1],a,n),(o=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(rr(e[i],t,id)||rr(e[i],n,id))return e.slice(i);return e}(s,e,t))!==s?ud(e,t,n,o):s}function hd(e){return e&&/t|r|b|l/.test(e)}function dd(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function md(i){return i.reduce(function(e,t,n){return tr(e[e.length-1],i[n+1],t,0)||e.push(t),e},[])}function fd(){}function yd(e,t){return e?e.original||e:Hr(t)}function vd(e){var t=e.source,n=e.target;return wi(n,"bpmn:Activity")&&wi(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function gd(e){return wi(e,"bpmn:SubProcess")&&Ci(e)}function bd(e,t){return e===t}t(fd,Jh),fd.prototype.layoutConnection=function(e,t){t=t||{};var n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v,g,b,x,_,E,w,S,C,T,R,A,P,k,M,D,N,B,O,L=e.source,I=e.target,j=e.waypoints,z=t.connectionStart,F=t.connectionEnd;return z||(z=yd(j&&j[0],L)),F||(F=yd(j&&j[j.length-1],I)),(wi(e,"bpmn:Association")||wi(e,"bpmn:DataAssociation"))&&j&&!vd(e)?[].concat([z],j.slice(1,-1),[F]):(wi(e,"bpmn:MessageFlow")?n={preferredLayouts:["straight","v:v"],preserveDocking:(B=L,O=I,wi(O,"bpmn:Participant")?"source":wi(B,"bpmn:Participant")?"target":gd(O)?"source":gd(B)?"target":wi(O,"bpmn:Event")?"target":wi(B,"bpmn:Event")?"source":null)}:(wi(e,"bpmn:SequenceFlow")||vd(e))&&(n=L===I?{preferredLayouts:["b:l"]}:wi(L,"bpmn:BoundaryEvent")?{preferredLayouts:(r=L,o=I,c=Hr(r),p=Hr(o),y=r,v=y.host,l=Wr(Hr(y),v,-10),u=bd(r.host,o),m=l,f=["top","right","bottom","left"],h=-1!==f.indexOf(m),d=Wr(p,c,{x:r.width/2+o.width/2,y:r.height/2+o.height/2}),A=l,P=d,k=h,M=u,a=k?_d[A]:M||bd(wd(A),wd(P))||(D=Ed(A),N=Ed(P),xd[D]===N)?_d[wd(A)]:_d[Ed(A)],g=l,b=d,x=h,_=u,s=x?Sd(g)?_||(C=b,T=Ed(g),R=xd[T],-1!==C.indexOf(R))||bd(g,b)?"h":"v":_||(E=b,w=wd(g),S=xd[w],-1!==E.indexOf(S))||bd(g,b)?"v":"h":Sd(b)||bd(wd(g),wd(b))&&Ed(b)?"h":"v",[a+":"+s])}:wi(L,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:wi(I,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=md(pd(L,I,z,F,j,n=$(n,t)))),i||[z,F])};var xd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},_d={top:"t",right:"r",bottom:"b",left:"l"};function Ed(e){var t=/right|left/.exec(e);return t&&t[0]}function wd(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Sd(e){return"right"===e||"left"===e}function Cd(e){return $({original:e.point.original||e.point},e.actual)}function Td(e,t){this._elementRegistry=e,this._graphicsFactory=t}Td.$inject=["elementRegistry","graphicsFactory"],Td.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Cd(i)),o.push(Cd(r)),o},Td.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},Td.prototype._getIntersection=function(e,t,n){return Gr(this._getShapePath(e),this._getConnectionPath(t),n)},Td.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Td.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Td.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Rd={__init__:["modeling","bpmnUpdater"],__depends__:[Sl,uu,mu,ic,yu,Eu,Tu,Mu,lo,cp,Wu],bpmnFactory:["type",Gu],bpmnUpdater:["type",Vu],elementFactory:["type",qu],modeling:["type",Qh],layouter:["type",fd],connectionDocking:["type",Td]},Ad=Math.round;function Pd(e,o,a,s,r){function c(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function n(e,t,n){if(!t.waypoints&&t.parent){var i,r={x:(i=t).x+Ad(i.width/2),y:i.y+Ad(i.height/2)};return o.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:n,data:{shape:t,context:{}}}),!0}}e.on("shape.move.start",1500,function(e){var t,n,i=e.context,r=e.shape,o=s.get().slice();-1===o.indexOf(r)&&(o=[r]),n=S(t=o,"id"),$(i,{shapes:o=k(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),validatedShapes:o,shape:r})}),e.on("shape.move.start",1250,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=c(n)))return!1}),e.on("shape.move.move",500,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,o={x:e.dx,y:e.dy};t=c(i,o,{x:e.x,y:e.y},r),n.delta=o,null!==(n.canExecute=t)?n.target=r:n.target=null}),e.on("shape.move.end",function(e){var t=e.context,n=t.delta,i=t.canExecute,r="attach"===i,o=t.shapes;if(!i)return!1;n.x=Ad(n.x),n.y=Ad(n.y),a.moveElements(o,n,t.target,{primaryShape:t.shape,attach:r})}),e.on("element.mousedown",function(e){var t=Xr(e);if(!t)throw new Error("must supply DOM mousedown event");return n(t,e.element)}),this.start=n}Pd.$inject=["eventBus","dragging","modeling","selection","rules"];var kd="djs-dragging",Md="drop-ok",Dd="drop-not-ok",Nd="new-parent",Bd="attach-ok";function Od(e,t,a,s,c){function p(e){var t,n=l(e);return k(t=n,function(e){return!e.waypoints||A(t,D({id:e.source.id}))&&A(t,D({id:e.target.id}))})}function l(e){var t=mt(e,!0),n=b(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return h(t.concat(n))}function u(t,n){[Bd,Md,Dd,Nd].forEach(function(e){e===n?a.addMarker(t,e):a.removeMarker(t,e)})}e.on("shape.move.start",499,function(e){var t=e.context,n=t.shapes,i=t.allDraggedElements,r=p(n);if(!t.dragGroup){var o=Ne("g");_e(o,s.cls("djs-drag-group",["no-events"])),ve(a.getDefaultLayer(),o),t.dragGroup=o}r.forEach(function(e){c.addDragger(e,t.dragGroup)}),M(i=i?h([i,l(n)]):l(n),function(e){a.addMarker(e,kd)}),t.allDraggedElements=i,t.differentParents=1!==E(S(n,function(e){return e.parent&&e.parent.id})).length}),e.on("shape.move.move",499,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?u(i,Bd):t.canExecute&&i&&i.id!==r.id?u(i,Nd):u(i,t.canExecute?Md:Dd)),Kt(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&u(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,n=t.allDraggedElements,i=t.dragGroup;M(n,function(e){a.removeMarker(e,kd)}),i&&Pe(i)}),this.makeDraggable=function(e,t,n){c.addDragger(t,e.dragGroup),n&&a.addMarker(t,kd),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}Od.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Ld={__depends__:[io,lo,oo,Ua,za,lp],__init__:["move","movePreview"],move:["type",Pd],movePreview:["type",Od]},Id=".djs-palette-toggle";function jd(e,t){this._eventBus=e,this._canvas=t,this._providers=[];var n=this;e.on("tool-manager.update",function(e){var t=e.tool;n.updateToolHighlight(t)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._providers.length&&(n._init(),n._update())})}jd.$inject=["eventBus","canvas"],jd.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},jd.prototype.getEntries=function(){var n={};return M(this._providers,function(e){M(e.getPaletteEntries(),function(e,t){n[t]=e})}),n},jd.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=se(jd.HTML_MARKUP),r=this;n.appendChild(i),ae.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(he(t,Id))return r.toggle();r.trigger("click",e)}),re.bind(i,"mousedown",function(e){e.stopPropagation()}),ae.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},jd.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=q(i);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle("two-column",t),"open"in e&&o.toggle("open",e.open),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},jd.prototype._update=function(){var p=de(".djs-palette-entries",this._container),e=this._entries=this.getEntries();Y(p),M(e,function(e,t){var n=e.group||"default",i=de("[data-group="+n+"]",p);i||(i=se('<div class="group" data-group="'+n+'"></div>'),p.appendChild(i));var r,o,a,s=e.html||(e.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=se(s);i.appendChild(c),e.separator||(H(c,"data-action",t),e.title&&H(c,"title",e.title),e.className&&(r=c,o=e.className,a=q(r),(g(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.imageUrl&&c.appendChild(se('<img src="'+e.imageUrl+'">')))}),this.open()},jd.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(i=a[H(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,u(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},jd.prototype._layoutChanged=function(){this._toggleState({})},jd.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},jd.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},jd.prototype.open=function(){this._toggleState({open:!0})},jd.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},jd.prototype.isActiveTool=function(e){return e&&this._activeTool===e},jd.prototype.updateToolHighlight=function(i){var e;this._toolsContainer||(e=de(".djs-palette-entries",this._container),this._toolsContainer=de("[data-group=tools]",e)),M(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");if(t){var n=q(e);t=t.replace("-tool",""),n.contains("entry")&&t===i?n.add("highlighted-entry"):n.remove("highlighted-entry")}})},jd.prototype.isOpen=function(){return q(this._container).has("open")},jd.prototype._getParentContainer=function(){return this._canvas.getContainer()},jd.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var zd={__init__:["palette"],palette:["type",jd]},Fd="crosshair";function $d(n,i,e,r,t,o){this._selection=t,this._dragging=e;var a=this,s=function(e){var t,n=i.getDefaultLayer();_e(t=e.frame=Ne("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(n,t)},c=function(e){var t=e.frame,n=e.bbox;_e(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ae(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&n.once("lasso.selection.ended",function(){a.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=Hd(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=Hd(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=Hd(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;p(t)}),n.on("element.mousedown",1500,function(e){if(n=Xr(t=e)||t,Jr(t)&&n.shiftKey)return a.activateLasso(e.originalEvent),!0;var t,n})}function Hd(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:n.x<=t.x&&t.y<n.y||n.x<t.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&n.y<t.y||t.x<n.x&&n.y<=t.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:n.x<=t.x&&n.y<t.y||n.x<t.x&&n.y<=t.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}$d.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],$d.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Fd,data:{context:{}}})},$d.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:Fd,data:{context:{}}})},$d.prototype.select=function(e,t){var n,i,r=(n=t,i={},M(e,function(e){var t=e;t.waypoints&&(t=ft(t)),!l(n.y)&&t.x>n.x&&(i[e.id]=e),!l(n.x)&&t.y>n.y&&(i[e.id]=e),t.x>n.x&&t.y>n.y&&(l(n.width)&&l(n.height)&&t.width+t.x<n.width+n.x&&t.height+t.y<n.height+n.y?i[e.id]=e:l(n.width)&&l(n.height)||(i[e.id]=e))}),i);this._selection.select(w(r))},$d.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},$d.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Wd={__depends__:[Nu],__init__:["lassoTool"],lassoTool:["type",$d]};function Gd(n,i,e,t){this._dragging=e,t.registerTool("hand",{tool:"hand",dragging:"hand.move"}),n.on("element.mousedown",1500,function(e){if(eo(e))return this.activateMove(e.originalEvent),!1},this),n.on("hand.end",function(e){var t=e.originalEvent.target;if(!(e.hover||t instanceof SVGElement))return!1;n.once("hand.ended",function(){this.activateMove(e.originalEvent,{reactivate:!0})},this)},this),n.on("hand.move.move",function(e){var t=i.viewbox().scale;i.scroll({dx:e.dx*t,dy:e.dy*t})}),n.on("hand.move.end",function(e){var t=e.context.reactivate;return!eo(e)&&t&&n.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Gd.$inject=["eventBus","canvas","dragging","toolManager"],Gd.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:"grab",data:{context:n||{}}})},Gd.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Gd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Gd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var Vd={__depends__:[Nu],__init__:["handTool"],handTool:["type",Gd]},Ud="connect-ok",qd="connect-not-ok";function Kd(i,e,r,o,t,n){var a=this;this._dragging=e,this._rules=n,t.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),i.on("global-connect.hover",function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,o.addMarker(n,i?Ud:qd))}),i.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&o.removeMarker(t,n?Ud:qd)}),i.on(["global-connect.ended"],function(e){var t=e.context.startTarget,n={x:e.x,y:e.y};if(a.canStartConnect(t))return i.once("element.out",function(){i.once(["connect.ended","connect.canceled"],function(){i.fire("global-connect.drag.ended")}),r.start(null,t,n)}),!1})}Kd.$inject=["eventBus","dragging","connect","canvas","toolManager","rules"],Kd.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Kd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Kd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Kd.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Yd={__depends__:[Is,Ua,za,Nu],globalConnect:["type",Kd]};function Xd(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Xd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Xd.prototype.getPaletteEntries=function(e){var t={},s=this._create,c=this._elementFactory,n=this._spaceTool,i=this._lassoTool,r=this._handTool,o=this._globalConnect,p=this._translate;function a(n,e,t,i,r){function o(e){var t=c.createShape($({type:n},r));r&&(t.businessObject.di.isExpanded=r.isExpanded),s.start(e,t)}var a=n.replace(/^bpmn:/,"");return{group:e,className:t,title:i||p("Create {type}",{type:a}),action:{dragstart:o,click:o}}}function l(e,t){s.start(e,c.createParticipantShape(t))}return $(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:p("Activate the hand tool"),action:{click:function(e){r.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:p("Activate the lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:p("Activate the create/remove space tool"),action:{click:function(e){n.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:p("Activate the global connect tool"),action:{click:function(e){o.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":a("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":a("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",p("Create Intermediate/Boundary Event")),"create.end-event":a("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":a("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":a("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":a("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":a("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":a("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",p("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:p("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Zd={__depends__:[zd,Ws,Wu,Wd,Vd,Yd,Ui],__init__:["paletteProvider"],paletteProvider:["type",Xd]};function Qd(e,c,p,l,u){Ra.call(this,e),e.on("shape.move.move",250,function(e){var i,r,s,t=e.context,n=t.canExecute;t.visualReplacements||(t.visualReplacements={}),n.replacements?M((s=t).canExecute.replacements,function(e){var t=e.oldElementId,n={type:e.newElementType};if(!s.visualReplacements[t]){var i=c.get(t);$(n,{x:i.x,y:i.y});var r=p.createShape(n);l.addShape(r,i.parent);var o=de('[data-element-id="'+Za(i.id)+'"]',s.dragGroup);o&&_e(o,{display:"none"});var a=u.addDragger(r,s.dragGroup);s.visualReplacements[t]=a,l.removeShape(r)}}):M(r=(i=t).visualReplacements,function(e,t){var n=de('[data-element-id="'+Za(t)+'"]',i.dragGroup);n&&_e(n,{display:"inline"}),e.remove(),r[t]&&delete r[t]})})}Qd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],t(Qd,Ra);var Jd={__depends__:[lp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Qd]},em=Math.abs,tm=Math.round;function nm(e){return{x:e.x,y:e.y}}function im(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:tm(e.x+e.width/2),y:tm(e.y+e.height/2)}}function rm(e){return{x:e.x+e.width,y:e.y+e.height}}function om(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function am(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function sm(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function cm(e){this._snapValues={}}sm.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},sm.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},sm.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},sm.prototype.getSnapLocations=function(){return this._snapLocations},sm.prototype.setSnapLocations=function(e){this._snapLocations=e},sm.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new cm).initDefaults(this._defaultSnaps),n},cm.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},cm.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],em(r-e)<=n)return r}(e[n],r[n],i)},cm.prototype.initDefaults=function(e){var n=this;M(e||{},function(e,t){M(e,function(e){n.add(t,e)})})};var pm=1250;function lm(e,t){this._canvas=t;var n=this;e.on(["shape.move.start","create.start"],function(e){n.initSnap(e)}),e.on(["shape.move.move","shape.move.end","create.move","create.end"],pm,function(e){e.originalEvent&&e.originalEvent.ctrlKey||om(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=I(j(this.hide,this),1e3)}lm.$inject=["eventBus","canvas"],lm.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new sm);var r=im(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},lm.prototype.snap=function(o){var e=o.context,t=e.snapContext,n=e.shape,i=e.target,r=t.getSnapLocations();if(i){var a=t.pointsForTarget(i);a.initialized||(this.addTargetSnaps(a,n,i),a.initialized=!0);var s={x:om(o,"x"),y:om(o,"y")};M(r,function(n){var i=t.getSnapOrigin(n),r={x:o.x+i.x,y:o.y+i.y};if(M(["x","y"],function(e){var t;s[e]||void 0!==(t=a.snap(r,n,e,7))&&(s[e]={value:t,originValue:t-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),M(["x","y"],function(e){var t=s[e];"object"==typeof t&&am(o,e,t.originValue)})}},lm.prototype._createLine=function(t){var e=this._canvas.getLayer("snap"),n=Ne("path");return _e(n,{d:"M0,0 L0,0"}),Te(n).add("djs-snap-line"),ve(e,n),{update:function(e){_e(n,"number"!=typeof e?{display:"none"}:"horizontal"===t?{d:"M-100000,"+e+" L+100000,"+e,display:""}:{d:"M "+e+",-100000 L "+e+", +100000",display:""})}}},lm.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},lm.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},lm.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},lm.prototype.hide=function(){M(this._snapLines,function(e){e.update()})},lm.prototype.addTargetSnaps=function(t,e,n){M(this.getSiblings(e,n),function(e){t.add("mid",im(e))})},lm.prototype.getSiblings=function(t,e){return e&&k(e.children,function(e){return!e.hidden&&!e.labelTarget&&e.host!==t&&e!==t})};var um=Math.round,hm=1500;function dm(e,r,s,i){lm.call(this,e,r),e.on("create.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();wi(n,"bpmn:Participant")&&wi(i,"bpmn:Process")&&mm(t,n,i.children)}),e.on(["create.move","create.end"],hm,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!om(e)&&i&&function(e,t,n,i){i=i||0;var r=t.width/2-i,o=t.height/2,a={x:n.x-r-i,y:n.y-o},s={x:n.x+r+i,y:n.y+o},c=e,p=rm(e);a.x>=c.x?am(n,"x",c.x+i+r):s.x<=p.x&&am(n,"x",p.x-i-r);a.y>=c.y?am(n,"y",c.y+o):s.y<=p.y&&am(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();wi(n,"bpmn:Participant")&&wi(i,"bpmn:Process")&&mm(t,n,i.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],hm,function(e){var t,n,i,r=e.context,o=r.target,a=r.shape;o&&!om(e)&&(t=a,n=o,i=e,"attach"===s.canAttach([t],n,null,i))&&function(e,t,n){var i=Fr(n),r=Cl(e,n);/top/.test(r)?am(e,"y",i.top):/bottom/.test(r)&&am(e,"y",i.bottom);/left/.test(r)?am(e,"x",i.left):/right/.test(r)&&am(e,"x",i.right)}(e,0,o)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],hm,function(e){var t=e.context.shape,n=e.hover;wi(n,"bpmn:Lane")&&!da(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=Mc(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],hm,function(e){var t,n,i=e.context,r=i.source,o=i.target,a=(t=r,n=o,s.canConnect(t,n)||{});i.initialSourcePosition||(i.initialSourcePosition=i.sourcePosition),!o||"bpmn:Association"!==a.type&&"bpmn:DataOutputAssociation"!==a.type&&"bpmn:DataInputAssociation"!==a.type&&"bpmn:SequenceFlow"!==a.type?"bpmn:MessageFlow"===a.type?(wi(r,"bpmn:Event")&&(i.sourcePosition=im(r)),wi(o,"bpmn:Event")&&fm(e,im(o))):i.sourcePosition=i.initialSourcePosition:(i.sourcePosition=im(r),fm(e,im(o)))}),e.on("resize.start",hm,function(e){var t,n,i,r,o,a,s,c,p,l,u=e.context,h=u.shape;wi(h,"bpmn:SubProcess")&&Ci(h)&&(u.minDimensions={width:140,height:120}),wi(h,"bpmn:Participant")&&(u.minDimensions={width:300,height:150}),(wi(h,"bpmn:Lane")||wi(h,"bpmn:Participant"))&&(u.resizeConstraints=(t=h,n=u.direction,i=u.balanced,r=Mc(t),a=o=!0,s=Pc(r,[r]),c=Fr(t),p={},l={},/e/.test(n)?l.right=c.left+Nl:/w/.test(n)&&(l.left=c.right-Nl),s.forEach(function(e){var t=Fr(e);/n/.test(n)&&(t.top<c.top-10&&(o=!1),i&&Tl(c.top-t.bottom)<10&&Ml(p,"top",t.top+Dl),Tl(c.top-t.top)<5&&kl(l,"top",t.bottom-Dl)),/s/.test(n)&&(t.bottom>c.bottom+10&&(a=!1),i&&Tl(c.bottom-t.top)<10&&kl(p,"bottom",t.bottom-Dl),Tl(c.bottom-t.bottom)<5&&Ml(l,"bottom",t.top+Dl))}),r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Artifact"))}).forEach(function(e){var t=Fr(e);o&&/n/.test(n)&&kl(l,"top",t.top-Ll),/e/.test(n)&&Ml(l,"right",t.right+Bl),a&&/s/.test(n)&&Ml(l,"bottom",t.bottom+Il),/w/.test(n)&&kl(l,"left",t.left-Ol)}),{min:l,max:p})),wi(h,"bpmn:TextAnnotation")&&(u.minDimensions={width:50,height:30})})}function mm(e,t,n){if(n.length){var i=ft(n.filter(function(e){return!e.labelTarget&&!e.waypoints}));i.x-=50,i.y-=20,i.width+=70,i.height+=40,t.width=Math.max(t.width,i.width),t.height=Math.max(t.height,i.height),e.participantSnapBox=i}}function fm(e,t){am(e,"x",t.x),am(e,"y",t.y)}t(dm,lm),dm.$inject=["eventBus","canvas","bpmnRules","elementRegistry"],dm.prototype.initSnap=function(n){var e,t,i,r,o,a=n.context,s=n.shape;o=lm.prototype.initSnap.call(this,n),wi(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(e=im(s,n),i=nm(t={width:s.width,height:s.height,x:isNaN(s.x)?um(e.x-s.width/2):s.x,y:isNaN(s.y)?um(e.y-s.height/2):s.y}),r=rm(t),o.setSnapOrigin("top-left",{x:i.x-n.x,y:i.y-n.y}),o.setSnapOrigin("bottom-right",{x:r.x-n.x,y:r.y-n.y}),M(s.outgoing,function(e){var t=e.waypoints[0];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),M(s.incoming,function(e){var t=e.waypoints[e.waypoints.length-1];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}));var c=a.source;c&&o.addDefaultSnap("mid",im(c))},dm.prototype.addTargetSnaps=function(o,e,t){wi(e,"bpmn:BoundaryEvent")&&"label"!==e.type&&(t=t.parent),wi(t,"bpmn:SequenceFlow")&&this.addTargetSnaps(o,e,t.parent);var n=this.getSiblings(e,t)||[];M(n,function(r){wi(r,"bpmn:Lane")||(r.waypoints?M(r.waypoints.slice(1,-1),function(e,t){var n=r.waypoints[t+2],i=r.waypoints[t];if(!n||!i)throw new Error("waypoints must exist");n.x!==e.x&&n.y!==e.y&&i.x!==e.x&&i.y!==e.y||o.add("mid",e)}):(o.add("mid",im(r)),wi(r,"bpmn:Participant")&&(o.add("top-left",nm(r)),o.add("bottom-right",rm(r)))))}),M(e.incoming,function(e){-1===n.indexOf(e.source)&&o.add("mid",im(e.source));var t=e.waypoints[0];o.add(e.id+"-docking",t.original||t)}),M(e.outgoing,function(e){-1===n.indexOf(e.target)&&o.add("mid",im(e.target));var t=e.waypoints[e.waypoints.length-1];o.add(e.id+"-docking",t.original||t)})};var ym={__init__:["snapping"],snapping:["type",dm]};function vm(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=se(vm.BOX_HTML),this._searchInput=de(vm.INPUT_SELECTOR,this._container),this._resultsContainer=de(vm.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function gm(e,t,n){var i,r=(i="",t.forEach(function(e){e.matched?i+='<strong class="'+vm.RESULT_HIGHLIGHT_CLASS+'">'+Ja(e.matched)+"</strong>":i+=Ja(e.normal)}),""!==i?i:null),o=se(n);o.innerHTML=r,e.appendChild(o)}vm.$inject=["canvas","eventBus","overlays","selection"],vm.prototype._bindEvents=function(){var r=this;function e(e,t,n,i){r._eventMaps.push({el:e,type:n,listener:ae.bind(e,t,n,i)})}e(document,"html","click",function(e){r.close()}),e(this._container,vm.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),e(this._container,vm.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),r._scrollToNode(e.delegateTarget),r._preselect(e.delegateTarget)}),e(this._container,vm.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),r._select(e.delegateTarget)}),e(this._container,vm.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),e(this._container,vm.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return r.close();if(13!==e.keyCode)return 38===e.keyCode?r._scrollToDirection(!0):40===e.keyCode?r._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&r._search(e.delegateTarget.value));var t=r._getCurrentResult();return t?r._select(t):r.close()})},vm.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ae.unbind(e.el,e.type,e.listener)})},vm.prototype._search=function(e){var i=this;if(this._clearResults(),e&&""!==e){var t=this._searchProvider.find(e);if(t.length){t.forEach(function(e){var t=e.element.id,n=i._createResultNode(e,t);i._results[t]={element:e.element,node:n}});var n=de(vm.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(n),this._preselect(n)}}},vm.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},vm.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},vm.prototype._clearResults=function(){Y(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},vm.prototype._getCurrentResult=function(){return de(vm.RESULT_SELECTED_SELECTOR,this._resultsContainer)},vm.prototype._createResultNode=function(e,t){var n=se(vm.RESULT_HTML);return 0<e.primaryTokens.length&&gm(n,e.primaryTokens,vm.RESULT_PRIMARY_HTML),gm(n,e.secondaryTokens,vm.RESULT_SECONDARY_HTML),H(n,vm.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},vm.prototype.registerProvider=function(e){this._searchProvider=e},vm.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,q(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},vm.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,q(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},vm.prototype.toggle=function(){this.isOpen()?this.close():this.open()},vm.prototype.isOpen=function(){return this._open},vm.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&q(t).remove(vm.RESULT_SELECTED_CLASS);var n=H(e,vm.RESULT_ID_ATTRIBUTE),i=this._results[n].element;q(e).add(vm.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},vm.prototype._select=function(e){var t=H(e,vm.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._centerViewbox(n),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},vm.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=ft(e),i={x:n.x+n.width/2-t.outer.width/2,y:n.y+n.height/2-t.outer.height/2,width:t.outer.width,height:t.outer.height};this._canvas.viewbox(i),this._canvas.zoom(t.scale)},vm.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=ft(e),n=(r=(i=t).width+12,o=i.height+12,a=["width: "+r+"px","height: "+o+"px"].join("; "),{position:{bottom:o-6,right:r-6},show:!0,html:'<div style="'+a+'" class="'+vm.OVERLAY_CLASS+'"></div>'});this._overlayId=this._overlays.add(e,n)}var i,r,o,a},vm.CONTAINER_SELECTOR=".djs-search-container",vm.INPUT_SELECTOR=".djs-search-input input",vm.RESULTS_CONTAINER_SELECTOR=".djs-search-results",vm.RESULT_SELECTOR=".djs-search-result",vm.RESULT_SELECTED_SELECTOR="."+(vm.RESULT_SELECTED_CLASS="djs-search-result-selected"),vm.RESULT_ID_ATTRIBUTE="data-result-id",vm.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",vm.OVERLAY_CLASS="djs-search-overlay",vm.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',vm.RESULT_HTML='<div class="djs-search-result"></div>',vm.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',vm.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var bm={__depends__:[go,lo],searchPad:["type",vm]};function xm(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function _m(e){return 0<k(e,function(e){return!!e.matched}).length}function Em(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return-1<r?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}xm.$inject=["elementRegistry","searchPad","canvas"],xm.prototype.find=function(t){var n=this._canvas.getRootElement(),e=this._elementRegistry.filter(function(e){return!e.labelTarget});return e=R(e=k(e=b(e=k(e,function(e){return e!==n}),function(e){return{primaryTokens:Em(bp(e),t),secondaryTokens:Em(e.id,t),element:e}}),function(e){return _m(e.primaryTokens)||_m(e.secondaryTokens)}),function(e){return bp(e.element)+e.element.id})};var wm={__depends__:[bm],__init__:["bpmnSearch"],bpmnSearch:["type",xm]};function Sm(e){Co.call(this,e),this.on("import.parse.complete",function(e){e.error||this._collectIds(e.definitions,e.context)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}return t(Sm,Co),Sm.Viewer=Co,Sm.NavigatedViewer=Qo,Sm.prototype.createDiagram=function(e){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>',e)},Sm.prototype._createModdle=function(e){var t=Co.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Sm.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},Sm.prototype._modules=[].concat(Sm.prototype._modules,Sm.prototype._interactionModules=[Lo,Vo,aa,Zo],Sm.prototype._modelingModules=[ha,Ta,Ga,Na,Ss,Oc,Hc,qc,Jc,tp,ap,Cp,Rd,Ld,Zd,Jd,vp,ym,wm]),Sm});