28 lines
444 KiB
JavaScript
28 lines
444 KiB
JavaScript
/*! bpmn-js - bpmn-modeler v4.0.4 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).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}});var n,r=(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}}(n={exports:{}},n.exports),n.exports);function o(e){if(!(this instanceof o))return new o(e);e=e||[128,36,1],this._seed=e.length?r.rack(e[0],e[1],e[2]):e}function h(e){return Array.prototype.concat.apply([],e)}o.prototype.next=function(e){return this._seed(e||!0)},o.prototype.nextPrefixed=function(e,t){for(var n;n=e+this.next(!0),this.assigned(n););return this.claim(n,t),n},o.prototype.claim=function(e,t){this._seed.set(e,t||!0)},o.prototype.assigned=function(e){return this._seed.get(e)||!1},o.prototype.unclaim=function(e){delete this._seed.hats[e]},o.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){var t=a.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}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=N(n),M(e,function(e,t){if(n(e,t))return i=e,!1}),i}function m(e,n){n=N(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){var n;if(!p(e)){var i=g(e)?L:O;for(var r in e)if(_(e,r)&&!1===t(n=e[r],i(r)))return n}}function f(e,n){return p(e)?[]:(function(e){if(!g(e))throw new Error("must supply array")}(e),n=N(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=B(i),M(e,function(e){var t=i(e)||"_",n=r[t];n||(n=r[t]=[]),n.push(e)}),r}function C(t){t=B(t);for(var n={},e=arguments.length,i=new 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=B(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 B(t){return u(t)?t:function(e){return e[t]}}function N(t){return u(t)?t:function(e){return e===t}}function O(e){return e}function L(e){return Number(e)}function j(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=new Array(e),n=0;n<e;n++)t[n]=arguments[n];o=t,a=this,r||c(i)}}function I(e,t){return e.bind(t)}function z(){return(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}).apply(this,arguments)}function F(e){for(var t=arguments.length,n=new 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 M(e,function(e){e in i&&(n[e]=t[e])}),n}function G(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var H=[].indexOf,V=function(e,t){if(H)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},W=/\s+/,U=Object.prototype.toString;function q(e){return new Y(e)}function Y(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function K(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}Y.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~V(t,e)||t.push(e),this.el.className=t.join(" "),this},Y.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=V(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},Y.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},Y.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},Y.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(W);return""===e[0]&&e.shift(),e},Y.prototype.has=Y.prototype.contains=function(e){return this.list?this.list.contains(e):!!~V(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),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}function ke(e){return e.cloneNode(!0)}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 Me={svg:"http://www.w3.org/2000/svg"},De='<svg xmlns="'+Me.svg+'"';function Be(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Me.svg)&&(e=De+e.substring(4)):(e=De+">"+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=Be(e).firstChild,document.importNode(n,!0)):document.createElementNS(Me.svg,e),t&&_e(n,t),n}var Oe=Ne("svg");function Le(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function je(e){return e?Oe.createSVGTransformFromMatrix(e):Oe.createSVGTransform()}var Ie=/([&<>]{1})/g,ze=/([\n\r"]{1})/g,Fe={"&":"&","<":"<",">":">",'"':"'"};function $e(e,t){return e.replace(t,function(e,t){return Fe[t]||t})}function Ge(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push($e(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,'="',$e(o.value,ze),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)Ge(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",$e(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=Be(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 Ve(e,t){if(void 0===t)return function(e){for(var t=e.firstChild,n=[];t;)Ge(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 We(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 Ue=/^class /;function qe(e){return"[object Array]"===Object.prototype.toString.call(e)}function Ye(){var e=Array.prototype.slice.call(arguments);1===e.length&&qe(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Ke=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Xe=/^function\s*[^(]*\(\s*([^)]*)\)/m,Ze=/\/\*([^*]*)\*\//m;function Qe(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t,n=e.toString().match((t=e,Ue.test(t.toString())?Ke:Xe));return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(Ze))?n[1].trim():e.trim()})||[]}var Je="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 et(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 tt(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(nt(s,t))return s[t];if(nt(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(!qe(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Ye(e.slice())}return{fn:e,dependencies:(e.$inject||Qe(e)).map(function(e){return nt(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(et(n))))},i=function(e,t,n){var i=p(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(et(r)))},m=function(t){return Ye(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&&qe(t)&&(t=Ye(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":Je(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 tt((i.__modules__||[]).concat([e]),d),n=Ye(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 tt(e,d)}}function nt(e,t){return Object.hasOwnProperty.call(e,t)}var it=1e3;function rt(e,t){var o=this;t=t||it,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 ot(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function at(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function st(e,t){var n=Ne("polyline");return _e(n,{points:at(e)}),t&&_e(n,t),n}function ct(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function pt(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&&pt(n,i,r+1)})}function lt(e,t){return r=!t,o=-1,a=[],s=[],pt(e,function(e,t,n){ct(a,e,r);var i=e.children;if((-1===o||n<o)&&i&&ct(s,i,r))return i}),a;var r,o,a,s}function ut(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=ut(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 ht(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function dt(e){return!(!e||!e.isFrame)}function mt(e,t){return F({},e||{},t||{})}rt.prototype.canRender=function(){},rt.prototype.drawShape=function(){},rt.prototype.drawConnection=function(){},rt.prototype.getShapePath=function(){},rt.prototype.getConnectionPath=function(){};function ft(e,t){rt.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}t(ft,rt),ft.prototype.canRender=function(){return!0},ft.prototype.drawShape=function(e,t){var n=Ne("rect");return _e(n,{x:0,y:0,width:t.width||0,height:t.height||0}),dt(t)?_e(n,this.FRAME_STYLE):_e(n,this.SHAPE_STYLE),ve(e,n),n},ft.prototype.drawConnection=function(e,t){var n=st(t.waypoints,this.CONNECTION_STYLE);return ve(e,n),n},ft.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return ot([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},ft.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 ot(r)},ft.$inject=["eventBus","styles"];var yt={__init__:["defaultRenderer"],defaultRenderer:["type",ft],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=x(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 vt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function gt(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 bt(e,t){return e&&t?e.indexOf(t):-1}function xt(e,t){return Math.round(e*t)/t}function _t(e){return l(e)?e+"px":e}function Et(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 wt={shape:["x","y","width","height"],connection:["waypoints"]};function St(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function Ct(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}St.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],St.prototype._init=function(e){var t,n,i,r=this._eventBus,o=this._container=(n=(t=F({},{width:"100%",height:"100%"},t=e)).container||document.body,(i=document.createElement("div")).setAttribute("class","djs-container"),F(i.style,{position:"relative",overflow:"hidden",width:_t(t.width),height:_t(t.height)}),n.appendChild(i),i),a=this._svg=Ne("svg");_e(a,{width:"100%",height:"100%"}),ve(o,a);var s=this._viewport=Et(a,"viewport");!(this._layers={})!==e.deferUpdate&&(this._viewboxChanged=j(I(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)},St.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},St.prototype._clear=function(){var n=this;this._elementRegistry.getAll().forEach(function(e){var t=ht(e);"root"===t?n.setRootElement(null,!0):n._removeElement(e,t)}),delete this._cachedViewbox},St.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},St.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},St.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:Et(this._viewport,"layer-"+e,t),index:n}},St.prototype.getContainer=function(){return this._container},St.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}))},St.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},St.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},St.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Te(this.getGraphics(e)).has(t)},St.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},St.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},St.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},St.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=wt[e];if(!y(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},St.prototype._setParent=function(e,t,n){gt(t.children,e,n),e.parent=t},St.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},St.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},St.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},St.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),vt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},St.prototype.removeShape=function(e){return this._removeElement(e,"shape")},St.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},St.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},St.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},St.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},St.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);We(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=We(s))?i.matrix:function(e,t,n,i,r,o){var a=Oe.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Le(a,e);case 6:return Le(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=xt(n.a,1e3),o=xt(-n.e||0,1e3),a=xt(-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})},St.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),Ct(t,n)}),{x:n.e,y:n.f}},St.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)}),xt(i.a,1e3)):this.viewbox(e).scale;var n,i},St.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},St.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),Ct(this._viewport,o),o},St.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},St.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}},St.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Tt="data-element-id";function Rt(e){this._elements={},this._eventBus=e}Rt.$inject=["eventBus"],Rt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),_e(t,Tt,i),n&&_e(n,Tt,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Rt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(_e(i.gfx,Tt,""),i.secondaryGfx&&_e(i.secondaryGfx,Tt,""),delete t[n])},Rt.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)},Rt.prototype.get=function(e){var t;t="string"==typeof e?e:e&&_e(e,Tt);var n=this._elements[t];return n&&n.element},Rt.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},Rt.prototype.getAll=function(){return this.filter(function(e){return e})},Rt.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)})},Rt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Rt.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 At={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 Pt(t,n,i){var e=At.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 kt(e,t){if(!(this instanceof kt))return new kt(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}kt.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?Pt(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)}}}))},kt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return At.isExtended(n)||Pt(this,t,e),n},kt.prototype.ensureBound=function(e,t){var n,i;n=e,i=t,Object.prototype.hasOwnProperty.call(n,i.name||i)||this.bind(e,t)},kt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},kt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Mt=kt,Dt=At;Mt.Collection=Dt;var Bt=new Mt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Nt=new Mt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ot=new Mt({name:"attachers",collection:!0},{name:"host"}),Lt=new Mt({name:"outgoing",collection:!0},{name:"source"}),jt=new Mt({name:"incoming",collection:!0},{name:"target"});function It(){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)}}),Bt.bind(this,"parent"),Nt.bind(this,"labels"),Lt.bind(this,"outgoing"),jt.bind(this,"incoming")}function zt(){It.call(this),Bt.bind(this,"children"),Ot.bind(this,"host"),Ot.bind(this,"attachers")}function Ft(){zt.call(this)}function $t(){zt.call(this),Nt.bind(this,"labelTarget")}function Gt(){It.call(this),Lt.bind(this,"source"),jt.bind(this,"target")}t(zt,It),t(Ft,zt),t($t,zt),t(Gt,It);var Ht={connection:Gt,shape:zt,label:$t,root:Ft};function Vt(){this._uid=12}Vt.prototype.createRoot=function(e){return this.create("root",e)},Vt.prototype.createLabel=function(e){return this.create("label",e)},Vt.prototype.createShape=function(e){return this.create("shape",e)},Vt.prototype.createConnection=function(e){return this.create("connection",e)},Vt.prototype.create=function(e,t){return(t=F({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Ht[e];if(!n)throw new Error("unknown type: <"+e+">");return F(new n,t)}(e,t)};var Wt="__fn",Ut=Array.prototype.slice;function qt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Yt(){}function Kt(e){return de(".djs-visual",e)}function Xt(e,t,n,i,r){var o=je();o.setTranslate(t,n);var a=je();a.setRotate(i,0,0);var s=je();s.setScale(r||1,r||1),We(e,[o,a,s])}function Zt(e,t,n){var i=je();i.setTranslate(t,n),We(e,i)}function Qt(e,t){var n=je();n.setRotate(t,0,0),We(e,n)}function Jt(e,t){this._eventBus=e,this._elementRegistry=t}function en(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}qt.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=I(n,i))[Wt]=n[Wt]||n);var o=this;e.forEach(function(e){o._addListener(e,{priority:t,callback:r,next:null})})},qt.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)},qt.prototype.off=function(e,t){e=g(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},qt.prototype.createEvent=function(e){var t=new Yt;return t.init(e),t},qt.prototype.fire=function(e,t){var n,i,r,o;if(o=Ut.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 Yt?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}},qt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},qt.prototype._destroy=function(){this._listeners={}},qt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},qt.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},qt.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)},qt.prototype._getListeners=function(e){return this._listeners[e]},qt.prototype._setListeners=function(e,t){this._listeners[e]=t},qt.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)},Yt.prototype.stopPropagation=function(){this.cancelBubble=!0},Yt.prototype.preventDefault=function(){this.defaultPrevented=!0},Yt.prototype.init=function(e){F(this,e||{})},Jt.$inject=["eventBus","elementRegistry"],Jt.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},Jt.prototype._clear=function(e){var t=Kt(e);return K(t),t},Jt.prototype._createContainer=function(e,t,n,i){var r=Ne("g");Te(r).add("djs-group"),void 0!==n?en(r,t,t.childNodes[n]):ve(t,r);var o=Ne("g");Te(o).add("djs-element"),Te(o).add("djs-"+e),i&&Te(o).add("djs-frame"),ve(r,o);var a=Ne("g");return Te(a).add("djs-visual"),ve(o,a),o},Jt.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n,dt(t))},Jt.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){en(r.getGraphics(e).parentNode,n)})}})},Jt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Jt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Jt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Jt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Jt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Zt(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")}},Jt.prototype.remove=function(e){Ae(this._elementRegistry.getGraphics(e).parentNode)};var tn={__depends__:[yt],__init__:["canvas"],canvas:["type",St],elementRegistry:["type",Rt],elementFactory:["type",Vt],eventBus:["type",qt],graphicsFactory:["type",Jt]};function nn(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 tt(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 rn(e,t){var n;this.injector=t=t||nn([{config:["value",n=(n=e)||{}]},tn].concat(n.modules||[])),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function on(){}function an(e,t){this.model=e,this.properties=t}rn.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},rn.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},on.prototype.get=function(e){return this.$model.properties.get(this,e)},on.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},an.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(on.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,I(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 sn={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},cn={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 pn(e,t){var n=cn[e];return n?n(t):t}function ln(e){return!!sn[e]}function un(e){return!!cn[e]}function hn(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 dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,M(e,I(this.registerPackage,this))}function fn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function yn(e){this.model=e}function vn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function gn(e){this.properties=new yn(this),this.factory=new an(this,this.properties),this.registry=new mn(e,this.properties),this.typeCache={}}dn.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},dn.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)},dn.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},dn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=hn(r[0],i),a=hn(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},dn.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},dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},dn.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},dn.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},dn.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")},dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},dn.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(M(i.properties,I(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)},mn.prototype.getPackage=function(e){return this.packageMap[e]},mn.prototype.getPackages=function(){return this.packages},mn.prototype.registerPackage=function(t){t=F({},t);var e=this.packageMap;fn(e,t,"prefix"),fn(e,t,"uri"),M(t.types,I(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},mn.prototype.registerType=function(e,t){var i=hn((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={};M(e.properties,I(function(e){var t=hn(e.name,i.prefix),n=t.name;ln(e.type)||(e.type=hn(e.type,t.prefix).name),F(e,{ns:t,name:n}),r[n]=e},this)),F(e,{ns:i,name:n,propertiesByName:r}),M(e.extends,I(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},mn.prototype.mapTypes=function(i,r,e){var t=ln(i.name)?{name:i.name}:this.typeMap[i.name],o=this;function n(e){return a(e,!0)}function a(e,t){var n=hn(e,ln(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)},mn.prototype.getEffectiveDescriptor=function(e){var t=hn(e),n=new dn(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},mn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},yn.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:vn(e,i,n):e.$attrs[t]=n},yn.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&&vn(e,n,[]),e[i]},yn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},yn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},yn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},gn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},gn.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},gn.prototype.createAny=function(e,t,n){var i=hn(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},gn.prototype.getPackage=function(e){return this.registry.getPackage(e)},gn.prototype.getPackages=function(){return this.registry.getPackages()},gn.prototype.getElementDescriptor=function(e){return e.$descriptor},gn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},gn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},gn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var bn=String.fromCharCode,xn=Object.prototype.hasOwnProperty,_n=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,En={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function wn(e,t,n,i){return i?xn.call(En,i)?En[i]:"&"+i+";":bn(t||parseInt(n,16))}function Sn(e){return 3<e.length&&-1!==e.indexOf("&")?e.replace(_n,wn):e}Object.keys(En).forEach(function(e){En[e.toUpperCase()]=En[e]});var Cn="http://www.w3.org/2001/XMLSchema-instance",Tn="xsi",Rn="xsi:type",An="non-whitespace outside of root node";function Pn(e){return new Error(e)}function kn(e){return"missing namespace for prefix <"+e+">"}function Mn(e){return{get:e,enumerable:!0}}function Dn(e){var t,n={};for(t in e)n[t]=e[t];return n}function Bn(e){return e+"$uri"}function Nn(){return{line:0,column:0}}function On(e){throw e}function Ln(e){if(!this)return new Ln(e);var v,w,S,C,n,T,R,A,P,k=e&&e.proxy,i=On,M=Nn,D=!1,B=!1,t=null,N=!1;function O(e){e instanceof Error||(e=Pn(e)),i(t=e,M)}function L(e){n&&(e instanceof Error||(e=Pn(e)),n(e,M))}this.on=function(e,t){if("function"!=typeof t)throw Pn("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 Pn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Pn("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[Cn]=Tn,B=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw Pn("required args <xml=string>");return t=null,function(a){var e,t,n,i,r,o,s,c,p,g,l=B?[]:null,b=B?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Bn(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=B&&b.xmlns,h=B&&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,B)if(D){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Sn(o),t=Bn(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=Dn(b),i=!0),b[r]=a,"xmlns"===r&&(b[Bn(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))===Rn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o),y[s]=o):L(kn(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(kn(s.substring(0,p)));continue}(s=u===n?s.substr(p+1):n+s.substr(p))===Rn&&(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:Mn(function(){return s}),originalName:Mn(function(){return c}),attrs:Mn(y),ns:Mn(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(An);if(f!==m)if(u.length){if(v&&(v(a.substring(f,m),Sn,M),N))return}else if(a.substring(f,m).trim()&&(L(An),N))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(B){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,Sn,d,M):w(s,y,Sn,d,M),N)))return;if(d){if(S&&(S(k?p:s,Sn,h,M),N))return;B&&(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),N))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),N))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),Sn,M),N))return;f+=3;continue}if(-1===(f=a.indexOf(">",m+1)))return O("unclosed tag");if(A&&(A(a.substring(m,f+1),Sn,M),N))return;f+=1}}}(e),M=Nn,N=!1,t},this.stop=function(){N=!0}}function jn(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var In={xsi:"http://www.w3.org/2001/XMLSchema-instance"},zn="xsi:type";function Fn(e){return e.xml&&e.xml.serialize}function $n(e){return Fn(e)===zn}function Gn(e,t){return jn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Hn(e){return new Error(e)}function Vn(e){return e.$descriptor}function Wn(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 Hn("expected element");var t,n=this.elementsById,i=Vn(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Hn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Un(){}function qn(){}function Yn(){}function Kn(e,t){this.property=e,this.context=t}function Xn(e,t){this.element=t,this.propertyDesc=e}function Zn(){}function Qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Jn(e,t,n){Qn.call(this,e,t,n)}function ei(e,t,n){this.model=e,this.context=n}function ti(e){e instanceof gn&&(e={model:e}),F(this,{lax:!1},e)}Un.prototype.handleEnd=function(){},Un.prototype.handleText=function(){},Un.prototype.handleNode=function(){},(qn.prototype=Object.create(Un.prototype)).handleNode=function(){return this},(Yn.prototype=Object.create(Un.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Kn.prototype=Object.create(Yn.prototype)).handleNode=function(e){if(this.element)throw Hn("expected no sub nodes");return this.element=this.createReference(e),this},Kn.prototype.handleEnd=function(){this.element.id=this.body},Kn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(Xn.prototype=Object.create(Yn.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=pn(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Zn.prototype=Object.create(Yn.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},(Qn.prototype=Object.create(Zn.prototype)).addReference=function(e){this.context.addReference(e)},Qn.prototype.handleText=function(e){if(!Vn(this.element).bodyProperty)throw Hn("unexpected body text <"+e+">");Yn.prototype.handleText.call(this,e)},Qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Vn(t).bodyProperty;n&&void 0!==e&&(e=pn(n.type,e),t.set(n.name,e))},Qn.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=Vn(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=pn(n.type,e):"xmlns"!==t&&(i=hn(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},Qn.prototype.getPropertyForNode=function(e){var t,n,i,r,o,a,s,c,p,l,u=hn(e.name),h=this.type,d=this.model,m=Vn(h),f=u.name,y=m.propertiesByName[f];if(y)return $n(y)&&(t=e.attributes[zn])?(i=d,p=hn(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,F({},y,{effectiveType:Vn(n=d.getType(t)).name})):y;var v=d.getPackage(u.prefix);if(v){if(t=Gn(u,v),n=d.getType(t),y=A(m.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return F({},y,{effectiveType:Vn(n).name})}else if(y=A(m.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return y;throw Hn("unrecognized element <"+u.name+">")},Qn.prototype.toString=function(){return"ElementDescriptor["+Vn(this.type).name+"]"},Qn.prototype.valueHandler=function(e,t){return new Xn(e,t)},Qn.prototype.referenceHandler=function(e){return new Kn(e,this.context)},Qn.prototype.handler=function(e){return"Element"===e?new ei(this.model,e,this.context):new Qn(this.model,e,this.context)},Qn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,un(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},(Jn.prototype=Object.create(Qn.prototype)).createElement=function(e){var t=e.name,n=hn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Gn(n,o)||t;if(!r.hasType(a))throw Hn("unexpected element <"+e.originalName+">");return Qn.prototype.createElement.call(this,e)},(ei.prototype=Object.create(Zn.prototype)).createElement=function(e){var t=e.name,n=hn(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},ei.prototype.handleChild=function(e){var t=new ei(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},ei.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ti.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof Qn?(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 Wn(F({},e,{rootHandler:r})),s=new Ln({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 Hn(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 qn)}}({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=Vn(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=Hn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)},0)},ti.prototype.handler=function(e){return new Jn(this.model,e)};var ni=/<|>|'|"|&|\n\r|\n/g,ii=/<|>|&/g;function ri(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 oi(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ai(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function si(e,t){return t.isGeneric?F({localName:t.ns.localName},e):F({localName:(n=t.ns.localName,i=t.$pkg,jn(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var ci={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},pi={"<":"lt",">":"gt","&":"amp"};function li(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function ui(e){this.tagName=e}function hi(){}function di(e){this.tagName=e}function mi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function fi(e,t){mi.call(this,e,t)}function yi(){this.value="",this.write=function(e){this.value+=e}}function vi(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 gi(r){return r=F({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new yi,i=new vi(n,r.format);if(r.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new mi).build(e).serializeTo(i),!t)return n.value}}}function bi(e,t){gn.call(this,e,t)}ui.prototype.build=function(e){return this.element=e,this},ui.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},hi.prototype.serializeValue=hi.prototype.serializeTo=function(e){e.append(this.escape?li(this.value,ii,pi):this.value)},hi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ii)&&(this.escape=!0),this},oi(di,hi),di.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},mi.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},mi.prototype.nsTagName=function(e){return si(this.logNamespaceUsed(e.ns),e)},mi.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,F({localName:e.ns.localName},t)},mi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},mi.prototype.nsAttributeName=function(e){var t;if(t=d(e)?hn(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)},mi.prototype.parseGeneric=function(n){var i=this,r=this.body,o=[];return M(n,function(e,t){"$body"===t?r.push((new hi).build({type:"String"},e)):"$children"===t?M(e,function(e){r.push(new mi(i).build(e))}):0!==t.indexOf("$")&&i.parseNsAttribute(n,t,e)&&o.push({name:t,value:e})}),o},mi.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=hn(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)}},mi.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},mi.prototype.parseGenericAttributes=function(n,e){var i=this;M(e,function(t){if(t.name!==zn)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},mi.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 hi).build(n,e[0]));else if(un(n.type))M(e,function(e){a.push(new di(o.addTagName(o.nsPropertyTagName(n))).build(n,e))});else if(t)M(e,function(e){a.push(new ui(o.addTagName(o.nsPropertyTagName(n))).build(e))});else{var i=$n(n),r="property"===Fn(n);M(e,function(e){var t;t=i?new fi(o,n):r?new mi(o,n):new mi(o),a.push(t.build(e))})}})},mi.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ri(t):n=t),n},mi.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},mi.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=In[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},mi.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)})},mi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ai(e)},mi.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=li(t,ni,ci)),n.push({name:e,value:t})},mi.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(ai(e.name)).append('="').append(e.value).append('"')})},mi.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==hi;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()},oi(fi,mi),fi.prototype.parseNsAttributes=function(e){var t=mi.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(zn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},fi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(bi.prototype=Object.create(gn.prototype)).fromXML=function(e,t,n,i){d(t)||(i=n,n=t,t="bpmn:Definitions"),u(n)&&(i=n,n={});var r=new ti(F({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)};bi.prototype.toXML=function(e,t,n){u(t)&&(n=t,t={});var i,r,o=new gi(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var xi={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 _i(e,t){return new bi(F({},xi,e),t)}function Ei(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var wi=new Mt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function Si(e,t){return e.$instanceOf(t)}function Ci(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:Ei(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:Ei(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:Ei(t)}),{element:t}):(wi.bind(t,"di"),t.di=e):y(h("no bpmnElement referenced in {element}",{element:Ei(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){Si(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;Si(e,"bpmn:SequenceFlow")?m.push(function(){o(e,r)}):Si(e,"bpmn:BoundaryEvent")?m.unshift(function(){o(e,r)}):Si(e,"bpmn:FlowNode")?(i=o(t=e,n=r),Si(t,"bpmn:SubProcess")&&l(t,i||n),Si(t,"bpmn:Activity")&&p(t.ioSpecification,n),m.push(function(){M(t.dataInputAssociations,f(a,n)),M(t.dataOutputAssociations,f(a,n))})):Si(e,"bpmn:DataObject")||(Si(e,"bpmn:DataStoreReference")?w(e,r):Si(e,"bpmn:DataObjectReference")?w(e,r):y(h("unrecognized flowElement {element} in context {context}",{element:Ei(e),context:r?Ei(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:Ei(t)}));var r=i.bpmnElement;if(!r){if(!(r=A(e.rootElements,function(e){return Si(e,"bpmn:Process")||Si(e,"bpmn:Collaboration")})))throw new Error(h("no process or collaboration to display"));y(h("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Ei(i),rootElement:Ei(r)})),i.bpmnElement=r,v(i)}var o,a,s,c,p,l=(o=r,a=i,u.root(o,a));if(Si(r,"bpmn:Process"))x(r,l);else{if(!Si(r,"bpmn:Collaboration"))throw new Error(h("unsupported bpmnElement for {plane}: {rootElement}",{plane:Ei(i),rootElement:Ei(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]&&Si(e,"bpmn:Process")&&e.laneSets}).forEach(f(x,c))}b()},handleSubProcess:l,registerDi:v}}function Ti(e,t){var n=Ri(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ri(e){return e&&e.businessObject||e}function Ai(e){return!Ti(e,"bpmn:CallActivity")&&(Ti(e,"bpmn:SubProcess")?!!Ri(e).di.isExpanded:!Ti(e,"bpmn:Participant")||!!Ri(e).processRef)}function Pi(e){return e&&!!Ri(e).triggeredByEvent}function ki(e,t){var n=Ri(e),i=!1;return n.eventDefinitions&&M(n.eventDefinitions,function(e){Ti(e,t)&&(i=!0)}),i}function Mi(e){return Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Participant")||Ti(e,"bpmn:Lane")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")?"name":Ti(e,"bpmn:TextAnnotation")?"text":Ti(e,"bpmn:Group")?"categoryValueRef":void 0}function Di(e){var t,n=e.businessObject,i=Mi(n);if(i)return"categoryValueRef"===i?(t=n.categoryValueRef)&&t.value||"":n[i]||""}function Bi(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 Ni(e){return e.businessObject.di}function Oi(e){return e.businessObject}function Li(e,t){return Ni(e).get("bioc:fill")||t||"white"}function ji(e,t){return Ni(e).get("bioc:stroke")||t||"black"}var Ii=new o;function zi(e,t,r,l,s,o,n){rt.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,a=Ii.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=st(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,i=Oi(e),r="bpmn:IntermediateThrowEvent"===(n=i).$type||"bpmn:EndEvent"===n.$type;return i.eventDefinitions&&1<i.eventDefinitions.length?i.parallelMultiple?_("bpmn:ParallelMultipleEventDefinition")(t,e,r):_("bpmn:MultipleEventDefinition")(t,e,r):Bi(i,"bpmn:MessageEventDefinition")?_("bpmn:MessageEventDefinition")(t,e,r):Bi(i,"bpmn:TimerEventDefinition")?_("bpmn:TimerEventDefinition")(t,e,r):Bi(i,"bpmn:ConditionalEventDefinition")?_("bpmn:ConditionalEventDefinition")(t,e):Bi(i,"bpmn:SignalEventDefinition")?_("bpmn:SignalEventDefinition")(t,e,r):Bi(i,"bpmn:EscalationEventDefinition")?_("bpmn:EscalationEventDefinition")(t,e,r):Bi(i,"bpmn:LinkEventDefinition")?_("bpmn:LinkEventDefinition")(t,e,r):Bi(i,"bpmn:ErrorEventDefinition")?_("bpmn:ErrorEventDefinition")(t,e,r):Bi(i,"bpmn:CancelEventDefinition")?_("bpmn:CancelEventDefinition")(t,e,r):Bi(i,"bpmn:CompensateEventDefinition")?_("bpmn:CompensateEventDefinition")(t,e,r):Bi(i,"bpmn:TerminateEventDefinition")?_("bpmn:TerminateEventDefinition")(t,e,r):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,Oi(t).name,{box:t,align:n,padding:5,style:{fill:ji(t,h)}})}function C(e,t,n){Xt(w(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:ji(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:Li(t,u),stroke:ji(t,h)};Oi(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Li(t,u),stroke:ji(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?ji(t,h):Li(t,u),stroke:n?Li(t,u):ji(t,h)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Li(t,u),stroke:ji(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:ji(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:ji(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?ji(t,h):"none",stroke:ji(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:ji(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?ji(t,h):"none",stroke:ji(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?ji(t,h):"none",stroke:ji(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?ji(t,h):"none",stroke:ji(t,h)});return Qt(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?ji(t,h):"none",stroke:ji(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?ji(t,h):"none",stroke:ji(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?ji(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:ji(t,h),stroke:ji(t,h)})},"bpmn:EndEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:4,fill:Li(t,u),stroke:ji(t,h)});return E(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:ji(t,h),stroke:ji(t,h)})},"bpmn:IntermediateEvent":function(e,t){var n=_("bpmn:Event")(e,t,{strokeWidth:1,fill:Li(t,u),stroke:ji(t,h)});return y(e,t.width,t.height,3,{strokeWidth:1,fill:Li(t,"none"),stroke:ji(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:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(t,h)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Li(t,u)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Li(t,u),stroke:ji(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:ji(t,h),stroke:ji(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:Li(t,u),stroke:ji(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:ji(t,h),stroke:Li(t,u)}),n},"bpmn:ReceiveTask":function(e,t){var n=Oi(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:Li(t,u),stroke:ji(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:ji(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:Li(t,"#aaaaaa"),stroke:ji(t,h)}),_e(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:ji(t,h)}),n},"bpmn:SubProcess":function(e,t,n){n=F({fill:Li(t,u),stroke:ji(t,h)},n);var i=_("bpmn:Activity")(e,t,n),r=Ai(t);return Pi(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:ji(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:Li(t,u),stroke:ji(t,h)},i=_("bpmn:Lane")(e,t,n);Ai(t)?(g(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:ji(t,h)}),C(e,Oi(t).name,t)):w(e,Oi(t).name,{box:t,align:"center-middle",style:{fill:ji(t,h)}});return!!Oi(t).participantMultiplicity&&_("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=v(e,t.width,t.height,0,F({fill:Li(t,u),fillOpacity:.35,stroke:ji(t,h)},n)),r=Oi(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:Li(t,u),stroke:ji(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 Ni(t).isMarkerVisible&&b(e,i,{strokeWidth:1,fill:ji(t,h),stroke:ji(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:ji(t,h),stroke:ji(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:ji(t,h),stroke:ji(t,h)}),n},"bpmn:EventBasedGateway":function(e,t){var n=Oi(t),i=_("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:ji(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:ji(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:Li(t,"none"),stroke:ji(t,h)},b(e,r,o)}return i},"bpmn:Gateway":function(e,t){var n={fill:Li(t,u),fillOpacity:.95,stroke:ji(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=Li(t,u),o=ji(t,h),a=b(e,i,{strokeLinejoin:"round",markerEnd:f("sequenceflow-end",r,o),stroke:ji(t,h)}),s=Oi(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=Oi(t),r=Li(t,u),o=ji(t,h);return n=F({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:ji(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=Li(t,u),i=ji(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Li(t,u),i=ji(t,h);return _("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=Oi(t),i=Ni(t),r=Li(t,u),o=ji(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:ji(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:Li(t,u),fillOpacity:.95,stroke:ji(t,h)}),p=Oi(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:Li(t,u),fillOpacity:.95,stroke:ji(t,h)})},"bpmn:BoundaryEvent":function(e,t){var n=Oi(t).cancelActivity,i={strokeWidth:1,fill:Li(t,u),stroke:ji(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){return v(e,t.width,t.height,10,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return n=e,r={width:90,height:30,x:(i=t).width/2+i.x,y:i.height/2+i.y},w(n,Di(i),{box:r,fitBox:!0,style:F({},o.getExternalStyle(),{fill:ji(i,h)})});var n,i,r},"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:ji(t,h)}),w(e,Oi(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:ji(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:Li(t,u),stroke:ji(t,h)})},SubProcessMarker:function(e,t){Zt(v(e,14,14,0,{strokeWidth:1,fill:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(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:Li(t,u),stroke:ji(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:ji(t,h),stroke:ji(t,h)})}};function A(t,n,e){var i,r=Oi(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(zi,rt),zi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],zi.prototype.canRender=function(e){return Ti(e,"bpmn:BaseElement")},zi.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},zi.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},zi.prototype.getShapePath=function(e){return Ti(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,ot([["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"]])):Ti(e,"bpmn:Activity")?(a=10,s=(o=e).x,c=o.y,p=o.width,l=o.height,ot([["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"]])):Ti(e,"bpmn:Gateway")?(h=(u=e).width/2,d=u.height/2,ot([["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,ot([["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 Fi=0,$i={width:150,height:50};function Gi(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 Hi(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Gi(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Vi(e,o,r,i);o=Wi(o,i.width,t)}}function Vi(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 Wi(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 Ui(e){this._config=F({},{size:$i,padding:Fi,style:{},align:"center-top"},e||{})}Ui.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ui.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ui.prototype.layoutText=function(e,t){var n,i,r,o,a=F({},this._config.size,t.box),s=F({},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)?F({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(Hi(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 qi(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 Ui({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}}qi.$inject=["config.textRenderer"];var Yi=/\{([^}]+)\}/g,Ki=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Xi={__init__:["bpmnRenderer"],bpmnRenderer:["type",zi],textRenderer:["type",qi],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(Yi,function(e,t){return n=e,o=i=a,t.replace(Ki,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 Zi={translate:["value",function(e,n){return n=n||{},e.replace(/{([^}]+)}/g,function(e,t){return n[t]||"{"+t+"}"})}]},Qi={width:90,height:20},Ji=15;function er(e){return Ti(e,"bpmn:Event")||Ti(e,"bpmn:Gateway")||Ti(e,"bpmn:DataStoreReference")||Ti(e,"bpmn:DataObjectReference")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:Group")}function tr(e){return rr(e.label)}function nr(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-=Ji:l+=Ji,{x:l,y:u}}function ir(e){return e.waypoints?nr(e.waypoints):Ti(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Qi.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Qi.height/2}}function rr(e){return e&&!!e.labelTarget}function or(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function ar(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=or(e,t);return Math.abs(r/o)<=i}var sr=2;function cr(e,t){return Math.abs(e.x-t.x)<=sr?"v":Math.abs(e.y-t.y)<=sr&&"h"}function pr(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 lr(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}
|
||
/**
|
||
* This file contains portions that got extraced from Snap.svg (licensed Apache-2.0).
|
||
*
|
||
* @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
|
||
*/var ur="hasOwnProperty",hr=/,?([a-z]),?/gi,dr=parseFloat,mr=Math,fr=mr.PI,yr=mr.min,vr=mr.max,gr=mr.pow,br=mr.abs,xr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,_r=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function Er(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 wr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[ur](n)&&(t[n]=wr(e[n]));return t}function Sr(t){var n=Sr.ps=Sr.ps||{};return n[t]?n[t].sleep=100:n[t]={sleep:100},setTimeout(function(){for(var e in n)n[ur](e)&&e!=t&&(n[e].sleep--,!n[e].sleep&&delete n[e])}),n[t]}function Cr(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:mr.min(n,i)/2,r2:mr.max(n,i)/2,r0:mr.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=Tr,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function Tr(){return this.join(",").replace(hr,"$1")}function Rr(e){var t=wr(e);return t.toString=Tr,t}function Ar(e,t,n,i,r,o,a,s,c){var p=1-c,l=gr(p,3),u=gr(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*mr.atan2(m-y,f-v)/fr}}function Pr(e,t,n,i,r,o,a,s){Er(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),br(c)<1e-12){if(br(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=mr.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:yr.apply(0,v[0]),y:yr.apply(0,v[1])},max:{x:vr.apply(0,v[0]),y:vr.apply(0,v[1])}}}.apply(null,e);return Cr(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function kr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Mr(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 Dr(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=Mr(m,e,n,r,a),y=Mr(m,t,i,o,s),v=f*f+y*y;h+=u[d]*mr.sqrt(v)}return p*h}function Br(e,t,n,i,r,o,a,s){if(!(vr(e,n)<yr(r,a)||yr(e,n)>vr(r,a)||vr(t,i)<yr(o,s)||yr(t,i)>vr(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<+yr(e,n).toFixed(2)||u>+vr(e,n).toFixed(2)||u<+yr(r,a).toFixed(2)||u>+vr(r,a).toFixed(2)||h<+yr(t,i).toFixed(2)||h>+vr(t,i).toFixed(2)||h<+yr(o,s).toFixed(2)||h>+vr(o,s).toFixed(2)))return{x:p,y:l}}}}function Nr(e,t,n){var i,r,o=Pr(e),a=Pr(t);if(r=a,i=Cr(i=o),!(kr(r=Cr(r),i.x,i.y)||kr(r,i.x2,i.y)||kr(r,i.x,i.y2)||kr(r,i.x2,i.y2)||kr(i,r.x,r.y)||kr(i,r.x2,r.y)||kr(i,r.x,r.y2)||kr(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=~~(Dr.apply(0,e)/5),c=~~(Dr.apply(0,t)/5),p=[],l=[],u={},h=n?0:[],d=0;d<s+1;d++){var m=Ar.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=Ar.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=br(v.x-y.x)<.01?"y":"x",_=br(b.x-g.x)<.01?"y":"x",E=Br(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+br((E[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),S=g.t+br((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 Or(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=Tr,c}function Lr(e){var t=Sr(e);if(t.abs)return Rr(t.abs);if(Er(e,"array")&&Er(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=Sr(e);if(t.arr)return wr(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 Er(e,"array")&&Er(e[0],"array")&&(a=wr(e)),a.length||String(e).replace(xr,function(e,t,n){var i=[],r=t.toLowerCase();if(n.replace(_r,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=Sr.toString,t.arr=wr(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(Fr(m,u));break;case"O":i.pop(),(m=Or(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(Or(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(Fr(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=Or(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(Or(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=Tr,t.abs=Rr(i),i}function jr(e,t,n,i){return[e,t,n,i,n,i]}function Ir(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 zr(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*fr/180,f=fr/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*mr.cos(n)-t*mr.sin(n),y:e*mr.sin(n)+t*mr.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[ur](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=mr.sqrt(x),i*=x);var _=n*n,E=i*i,w=(o==a?-1:1)*mr.sqrt(br((_*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=mr.asin(((t-C)/i).toFixed(9)),R=mr.asin(((c-C)/i).toFixed(9));(T=e<S?fr-T:T)<0&&(T=2*fr+T),(R=s<S?fr-R:R)<0&&(R=2*fr+R),a&&R<T&&(T-=2*fr),!a&&T<R&&(R-=2*fr)}var A=R-T;if(br(A)>m){var P=R,k=s,M=c;R=T+m*(a&&T<R?1:-1),y=zr(s=S+n*mr.cos(R),c=C+i*mr.sin(R),n,i,r,0,a,k,M,[R,P,S,C])}A=R-T;var D=mr.cos(T),B=mr.sin(T),N=mr.cos(R),O=mr.sin(R),L=mr.tan(A/4),j=4/3*n*L,I=4/3*i*L,z=[e,t],F=[e+j*B,t-I*D],$=[s+j*O,c-I*N],G=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,G].concat(y);for(var H=[],V=0,W=(y=[F,$,G].concat(y).join().split(",")).length;V<W;V++)H[V]=V%2?v(y[V-1],y[V],f).y:v(y[V],y[V+1],f).x;return H}function Fr(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 $r(e,t){var n=!t&&Sr(e);if(!t&&n.curve)return Rr(n.curve);for(var o=Lr(e),a=t&&Lr(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(zr.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(Ir(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(Ir(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(jr(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(jr(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(jr(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(jr(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=vr(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=vr(o.length,a&&a.length||0))},l=[],u=[],h="",d="",m=0,f=vr(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=dr(y[g-4])||i.x,i.by=dr(y[g-3])||i.y,r.bx=a&&(dr(v[b-4])||r.x),r.by=a&&(dr(v[b-3])||r.y),r.x=a&&v[b-2],r.y=a&&v[b-1]}return a||(n.curve=Rr(o)),a?[o,a]:o}var Gr=function(e,t,n){e=$r(e),t=$r(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=Nr(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 Hr(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Vr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Wr(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ur(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function qr(e){return Vr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Yr(e,t,n){P(n=n||0)||(n={x:n,y:n});var i=Wr(e),r=Wr(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 Kr(e,t,n){var i=Gr(e,t);return 1===i.length?Vr(i[0]):2===i.length&&or(i[0],i[1])<1?Vr(i[0]):1<i.length?Vr((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 Xr(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===or(t,i=e[r+1])||ar(n,i,t)?e.splice(r,1):r++;return e}function Zr(e,t){return F({id:e.id,type:e.$type,businessObject:e},t)}function Qr(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:Ei(n),referenced:Ei(t),property:i}))}function Jr(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}Jr.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Jr.prototype.add=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d=e.di,m=this._translate;if(Ti(d,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Zr(e)),this._canvas.setRootElement(n);else if(Ti(d,"bpmndi:BPMNShape")){var f=!Ai(e);i=t&&(t.hidden||t.collapsed);var y=e.di.bounds;n=this._elementFactory.createShape(Zr(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)})),Ti(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ti(e,"bpmn:Lane")&&(r=0),Ti(e,"bpmn:DataStoreReference")&&(p=t,l=qr(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(!Ti(d,"bpmndi:BPMNEdge"))throw new Error(m("unknown di {di} for element {semantic}",{di:Ei(d),semantic:Ei(e)}));var v=this._getSource(e),g=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Zr(e,{hidden:i,source:v,target:g,waypoints:(o=e,a=v,s=g,c=o.di.waypoint,!c||c.length<2?[qr(a),qr(s)]:c.map(function(e){return{x:e.x,y:e.y}}))})),Ti(e,"bpmn:DataAssociation")&&(t=null),Ti(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return er(e)&&Di(n)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Jr.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Ei(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Qr(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Jr.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=ir(o),s=Qi),n=F({x:a.x-s.width/2,y:a.y-s.height/2},s),(i=Di(t))&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(Zr(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!Di(t),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)},Jr.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?Qr(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Ei(e),side:t}))},Jr.prototype._getSource=function(e){return this._getEnd(e,"source")},Jr.prototype._getTarget=function(e){return this._getEnd(e,"target")},Jr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var eo={__depends__:[Xi,{__depends__:[Zi],bpmnImporter:["type",Jr]}]};function to(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function no(e){return e.originalEvent||e.srcEvent}function io(e,t){to(e),to(no(e))}function ro(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 oo(e){return!(no(e)||e).button}function ao(e){var t=no(e)||e;return!!oo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function so(e){return!0}function co(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]||oo)(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",mousemove:"element.mousemove",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":so};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=st(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:at(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}co.$inject=["eventBus","elementRegistry","styles"];var po={__init__:["interactionEvents"],interactionEvents:["type",co]};function lo(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)})}lo.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})},lo.prototype.updateConnectionOutline=function(e,t){var n=ut(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})},lo.$inject=["eventBus","styles","elementRegistry"];var uo={__init__:["outline"],outline:["type",lo]};function ho(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)})}ho.$inject=["eventBus"],ho.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})}},ho.prototype.get=function(){return this._selectedElements},ho.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},ho.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 mo="selected";function fo(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,mo)}),M(n,function(e){-1===t.indexOf(e)&&r(e,mo)})})}function yo(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=ao(e);if(n&&i)return r?o.deselect(t):o.select(t);n?o.deselect(t):o.select(t,r)})}fo.$inject=["eventBus","canvas","selection","styles"],yo.$inject=["eventBus","selection","canvas","elementRegistry"];var vo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[po,uo],selection:["type",ho],selectionVisuals:["type",fo],selectionBehavior:["type",yo]};function go(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}go.prototype.next=function(){return this._prefix+ ++this._counter};var bo=new go("ov");function xo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=bo,this._overlayDefaults=F({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 _o(e,t,n){F(e.style,{left:t+"px",top:n+"px"})}function Eo(e,t){e.style.display=!1===t?"none":""}function wo(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}xo.$inject=["config.overlays","eventBus","canvas","elementRegistry"],xo.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},xo.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},xo.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)}})},xo.prototype.show=function(){Eo(this._overlayRoot)},xo.prototype.hide=function(){Eo(this._overlayRoot,!1)},xo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],K(this._overlayRoot)},xo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ut(t);i=o.x,r=o.y}_o(n,i,r),G(e.html,"data-container-id",t.id)},xo.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?ut(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?ut(o).height:o.height,s=-1*i.bottom+n);_o(r,a||0,s||0)},xo.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},xo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";wo(this._overlayRoot,n)},xo.prototype._getOverlayContainer=function(t,e){var n=A(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},xo.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())},xo.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),Eo(o,a)),this._updateOverlayScale(e,t)},xo.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+")"),wo(a,s)},xo.prototype._updateOverlaysVisibilty=function(t){var n=this;M(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},xo.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 So={__init__:["overlays"],overlays:["type",xo]},Co='<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>'))+'" />';
|
||
/**
|
||
* This file must not be changed or exchanged.
|
||
*
|
||
* @see http://bpmn.io/license for more information.
|
||
*/function To(e){return e.join(";")}var Ro,Ao='<div class="bjs-powered-by-lightbox" style="'+To(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+To(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+To(["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">'+Co+'</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 Po={width:"100%",height:"100%",position:"relative"};function ko(e){return e+(l(e)?"px":"")}function Mo(e){
|
||
/**
|
||
* Adds the project logo to the diagram container as
|
||
* required by the bpmn.io license.
|
||
*
|
||
* @see http://bpmn.io/license
|
||
*
|
||
* @param {Element} container
|
||
*/
|
||
var t,n;e=F({},Po,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">'+Co+"</a>"),t.appendChild(n),re.bind(n,"click",function(e){Ro||(Ro=se(Ao),ae.bind(Ro,".backdrop","click",function(e){document.body.removeChild(Ro)})),document.body.appendChild(Ro),e.preventDefault()}),this._init(this._container,this._moddle,e)}function Do(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Bo(e,t){return-1<(e=g(e)?e:[e]).indexOf(t.key)}function No(e){return e.shiftKey}t(Mo,rn),Mo.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)})})},Mo.prototype.importDefinitions=function(e,t,n){return u(t)&&(n=t,t=null),n=n||function(){},this._setDefinitions(e),this.open(t,n)},Mo.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 Ci({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)},Mo.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)})},Mo.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=Ve(o),c=a?"<defs>"+Ve(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)},Mo.prototype._setDefinitions=function(e){this._definitions=e},Mo.prototype.getModules=function(){return this._modules},Mo.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),rn.prototype.clear.call(this)},Mo.prototype.destroy=function(){rn.prototype.destroy.call(this),fe(this._container)},Mo.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Mo.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Mo.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()},Mo.prototype.getDefinitions=function(){return this._definitions},Mo.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Mo.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=F((i=["additionalModules"],r={},M(Object(n),function(e,t){-1===i.indexOf(t)&&(r[t]=e)}),r),{canvas:F({},n.canvas,{container:e}),modules:s});rn.call(this,c),n&&n.container&&this.attachTo(n.container)},Mo.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Mo.prototype._createContainer=function(e){var t=se('<div class="bjs-container"></div>');return F(t.style,{width:ko(e.width),height:ko(e.height),position:e.position}),t},Mo.prototype._createModdle=function(e){return new _i(F({},this._moddleExtensions,e.moddleExtensions))},Mo.prototype._modules=[eo,Zi,vo,So],Mo.prototype._moddleExtensions={};var Oo="keyboard.keydown";function Lo(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}Lo.$inject=["config.keyboard","eventBus"],Lo.prototype._keydownHandler=function(e){this._keyHandler(e,Oo)},Lo.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Lo.prototype._keyHandler=function(e,t){var n=e.target;if(!(i=n)||!he(i,"input, textarea")&&"true"!==i.contentEditable){var i,r={keyEvent:e};this._eventBus.fire(t||Oo,r)&&e.preventDefault()}},Lo.prototype.bind=function(e){this.unbind(),this._node=e,re.bind(e,"keydown",this._keydownHandler,!0),re.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},Lo.prototype.getBinding=function(){return this._node},Lo.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),re.unbind(e,"keydown",this._keydownHandler,!0),re.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},Lo.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Lo.prototype.addListener=function(e,t,n){u(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Oo,e,t)},Lo.prototype.removeListener=function(e,t){this._eventBus.off(t||Oo,e)},Lo.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Lo.prototype.isCmd=Do,Lo.prototype.isShift=No,Lo.prototype.isKey=Bo;var jo=500;function Io(e,n){var i=this;e.on("editorActions.init",jo,function(e){var t=e.editorActions;i.registerBindings(n,t)})}Io.$inject=["eventBus","keyboard"],Io.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(Do(t)&&!No(t)&&Bo(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(Do(t)&&(Bo(["y","Y"],t)||Bo(["z","Z"],t)&&No(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(Do(t)&&Bo(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(Do(t)&&Bo(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Bo(["+","Add"],t)&&Do(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Bo(["-","Subtract"],t)&&Do(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Bo("0",t)&&Do(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Bo(["Delete","Del"],e.keyEvent))return i.trigger("removeSelection"),!0})};var zo={__init__:["keyboard","keyboardBindings"],keyboard:["type",Lo],keyboardBindings:["type",Io]},Fo={moveSpeed:50,moveSpeedAccelerated:200};function $o(e,o,r){var a=this;this._config=F({},Fo,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})}}$o.$inject=["config.keyboardMove","keyboard","canvas"];var Go={__depends__:[zo],__init__:["keyboardMove"],keyboardMove:["type",$o]},Ho=/^djs-cursor-.*$/;function Vo(e){var t=q(document.body);t.removeMatching(Ho),e&&t.add("djs-cursor-"+e)}function Wo(){Vo(null)}var Uo=5e3;function qo(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Uo,n),function(){e.off(t,n)}}function Yo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ko(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xo(o,a){var s;function t(e){var t,n=s.start,i=ro(e),r=Ko(i,n);(!s.dragging&&(t=r,15<Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)))&&(s.dragging=!0,qo(o),Vo("grab")),s.dragging)&&(r=Ko(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,Wo()}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:ro(e)},re.bind(document,"mousemove",t),re.bind(document,"mouseup",n),!0}(e.originalEvent)})}Xo.$inject=["eventBus","canvas"];var Zo={__init__:["moveCanvas"],moveCanvas:["type",Xo]};function Qo(e){return Math.log(e)/Math.log(10)}function Jo(e,t){var n=Qo(e.min),i=Qo(e.max);return(Math.abs(n)+Math.abs(i))/t}var ea=Math.sign||function(e){return 0<=e?1:-1},ta={min:.2,max:4};function na(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=I(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)})}na.$inject=["config.zoomScroll","eventBus","canvas"],na.prototype.scroll=function(e){this._canvas.scroll(e)},na.prototype.reset=function(){this._canvas.zoom("fit-viewport")},na.prototype.zoom=function(e,t){var n=Jo(ta,20);this._totalDelta+=e,.1<Math.abs(this._totalDelta)&&(this._zoom(e,t,n),this._totalDelta=0)},na.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))*ea(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)}},na.prototype.stepZoom=function(e,t){var n=Jo(ta,10);this._zoom(e,t,n)},na.prototype._zoom=function(e,t,n){var i=this._canvas,r=0<e?1:-1,o=Qo(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s,c,p=Math.pow(10,a);i.zoom((s=ta,c=p,Math.max(s.min,Math.min(s.max,c))),t)},na.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},na.prototype._init=function(e){this.toggle(e)};var ia={__init__:["zoomScroll"],zoomScroll:["type",na]};function ra(e){Mo.call(this,e)}t(ra,Mo),ra.prototype._modules=[].concat(ra.prototype._modules,ra.prototype._navigationModules=[Go,Zo,ia]);var oa=e(function(Ve){
|
||
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
||
* http://hammerjs.github.io/
|
||
*
|
||
* Copyright (c) 2016 Jorik Tangelder;
|
||
* Licensed under the MIT license */
|
||
!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,B=P(o,"PointerEvent")!==f,N=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O="touch",L=25,j=1,I=4,z=8,F=1,$=2,G=4,H=8,V=16,W=$|G,U=H|V,q=W|U,Y=["x","y"],K=["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&j&&i-r==0,a=t&(I|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!==j&&o.eventType!==I||(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],K)/ne(h[0],h[1],K)):1,t.rotation=a?(l=a.pointers,u=i,ie(u[1],u[0],K)+ie(l[1],l[0],K)):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?$:G:t<0?H:V}function ne(e,t,n){n||(n=Y);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=Y);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:j,mousemove:2,mouseup:I},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&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=I),this.pressed&&(t&I&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:j,pointermove:2,pointerup:I,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&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(I|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:j,touchmove:2,touchend:I,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===j&&(this.started=!0),this.started){var n=function(e,t){var n=R(e.touches),i=R(e.changedTouches);t&(I|z)&&(n=A(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(I|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:j,touchmove:2,touchend:I,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|j)&&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===j)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&(I|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&j?(this.primaryTouch=t.changedPointers[0].identifier,xe.call(this,t)):e&(I|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&W||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==V?"down":e==H?"up":e==$?"left":e==G?"right":""}function Be(e,t){var n=t.manager;return n?n.get(e):e}function Ne(){ke.apply(this,arguments)}function Oe(){Ne.apply(this,arguments),this.pX=null,this.pY=null}function Le(){Ne.apply(this,arguments)}function je(){ke.apply(this,arguments),this._timer=null,this._input=null}function Ie(){Ne.apply(this,arguments)}function ze(){Ne.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 Ge(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=Be(e,this)).id]||(t[e.id]=e).recognizeWith(this),this},dropRecognizeWith:function(e){return i(e,"dropRecognizeWith",this)||(e=Be(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=Be(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(i(e,"dropRequireFailure",this))return this;e=Be(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(Ne,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&I?8|t:2&t?4|t:2:32}}),m(Oe,Ne,{defaults:{event:"pan",threshold:10,pointers:1,direction:q},getTouchAction:function(){var e=this.options.direction,t=[];return e&W&&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&W?(r=0===o?F:o<0?$:G,n=o!=this.pX,Math.abs(e.deltaX)):(r=0===a?F:a<0?H:V,n=a!=this.pY,Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Ne.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,Ne,{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(je,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&(I|z)&&!r)this.reset();else if(e.eventType&j)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&I)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&I?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=v(),this.manager.emit(this.options.event,this._input)))}}),m(Ie,Ne,{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,Ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:W|U,pointers:1},getTouchAction:function(){return Oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(W|U)?t=e.overallVelocity:n&W?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&I},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&j&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=I)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:[[Ie,{enable:!1}],[Le,{enable:!1},["rotate"]],[ze,{direction:W}],[Oe,{direction:W},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[je]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ge(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||(B?he:N?ve:D?be:se))(n,Z),this.touchAction=new Ae(this,this.options.touchAction),He(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 He(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={}))}Ge.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&&He(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},a($e,{INPUT_START:j,INPUT_MOVE:2,INPUT_END:I,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:G,DIRECTION_UP:H,DIRECTION_DOWN:V,DIRECTION_HORIZONTAL:W,DIRECTION_VERTICAL:U,DIRECTION_ALL:q,Manager:Ge,Input:X,TouchAction:Ae,TouchInput:ve,MouseInput:se,PointerEventInput:he,TouchMouseInput:be,SingleTouchInput:me,Recognizer:ke,AttrRecognizer:Ne,Tap:Fe,Pan:Oe,Swipe:ze,Pinch:Le,Rotate:Ie,Press:je,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}):Ve.exports?Ve.exports=$e:o.Hammer=$e}(window,document)}),aa=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function sa(e,t){return t.get(e,!1)}function ca(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function pa(t){function e(e){setTimeout(function(){M(aa,function(e){re.unbind(t,e,ca,!0)})},500)}re.bind(t,"touchstart",function(e){M(aa,function(e){re.bind(t,e,ca,!0)})},!0),re.bind(t,"touchend",e,!0),re.bind(t,"touchcancel",e,!0);var r=new oa.Manager(t,{inputClass:oa.TouchInput,recognizers:[]}),n=new oa.Tap,i=new oa.Pan({threshold:10}),o=new oa.Press,a=new oa.Pinch,s=new oa.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 la(e,o,t,a,n){var s,c=sa("dragging",e),i=sa("move",e),r=sa("contextPad",e),p=sa("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=pa(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),ca(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=ro(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=pa(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=pa(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 ua(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}la.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],ua.$inject=["canvas","eventBus"],ua.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 ha={__depends__:[{__depends__:[po],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",la],touchFix:["type",ua]}]};function da(e){return e&&e[e.length-1]}function ma(e){return e.y}function fa(e){return e.x}var ya={left:fa,center:fa,right:function(e){return e.x+e.width},top:ma,middle:ma,bottom:function(e){return e.y+e.height}};function va(e){this._modeling=e}va.$inject=["modeling"],va.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},va.prototype._isType=function(e,t){return-1!==t.indexOf(e)},va.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=da(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]=da(n).center,l;i=t[0],r=da(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},va.prototype.trigger=function(e,t){var n=this._modeling,i=R(k(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),ya[t]),r=this._alignmentPosition(t,i);n.alignElements(i,r)};var ga={__init__:["alignElements"],alignElements:["type",va]};function ba(t,e){return v(e,function(e){return Ti(t,e)})}var xa=50,_a=250,Ea=10;function wa(e,t){return Ti(t,"bpmn:TextAnnotation")?(i=t,r=Wr(n=e),o={x:r.right+i.width/2,y:r.top-50-i.height/2},Ca(n,i,o,{y:{margin:-30,rowSize:20}})):ba(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?(s=t,c=Wr(a=e),p={x:c.right-10+s.width/2,y:c.bottom+40+s.width/2},Ca(a,s,p,{x:{margin:30,rowSize:30}})):Ti(t,"bpmn:FlowNode")?function(e,t){var n=Wr(e),i=qr(e),r=function(e,t){var n=Wr(e);function i(e){return Ti(e,"bpmn:SequenceFlow")}var r=x(x([].concat(Pa(e,i).map((a=5,function(e){return{shape:e,weight:a,distanceTo:function(e){var t=Wr(e);return t.left-n.right}}})),Aa(e,i).map((o=1,function(e){return{shape:e,weight:o,distanceTo:function(e){var t=Wr(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||_a<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:xa}(e),o="left",a=30;Ti(e,"bpmn:BoundaryEvent")&&-1!==(o=Yr(e,e.host,-25)).indexOf("top")&&(a*=-1);var s={x:n.right+r+t.width/2,y:i.y+(c=o,-1!=c.indexOf("top")?-80:-1!=c.indexOf("bottom")?80:0)};var c;return Ca(e,t,s,{y:{margin:a,rowSize:80}})}(e,t):(u=t,h=Wr(l=e),d=qr(l),{x:h.right+xa+u.width/2,y:d.y});var n,i,r,o,a,s,c,p,l,u,h,d}function Sa(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=Ra(i=e),i.host&&(r=r.concat(Ra(i.host))),i.attachers&&(r=r.concat(i.attachers.reduce(function(e,t){return e.concat(Ra(t))},[]))),r),function(e){return e!==n&&"intersect"===Yr(e,o,Ea)})}function Ca(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=Sa(e,c,s);)c=t(l);return c}function Ta(){return!0}function Ra(e,t){return[].concat(Pa(e,t),Aa(e,t))}function Aa(e,t){return t||(t=Ta),e.incoming.filter(t).map(function(e){return e.source})}function Pa(e,t){return t||(t=Ta),e.outgoing.filter(t).map(function(e){return e.target})}function ka(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=wa(e,t));var i=r.appendShape(e,t,n,e.parent);return o("autoPlace.end",{shape:i}),i}}function Ma(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}ka.$inject=["eventBus","modeling"],Ma.$inject=["eventBus","selection"];var Da={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ka],autoPlaceSelectionBehavior:["type",Ma]};function Ba(e){this._eventBus=e}Ba.$inject=["eventBus"],Ba.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 Na(e,t,n,i){Ba.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 Oa(e){e.invoke(Na,this)}function La(e){Ba.call(this,e),this.init()}function ja(e){La.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}function Ia(e,t){ja.call(this,e),this._modeling=t}M(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(o){Ba.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)}}),Na.$inject=["eventBus","elementRegistry","modeling","rules"],t(Na,Ba),Na.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Wr(ut(e)),o=Wr(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),Ur(F({},o,a))},Na.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,o=function(e,t){var n="";e=Wr(e),t=Wr(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:o});var a=t.parent;a&&this._expand([t],a)}}},Na.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Na.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Na.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Oa.$inject=["injector"],t(Oa,Na),Oa.prototype.resize=function(e,t,n){Ti(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},La.$inject=["eventBus"],t(La,Ba),La.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)})},La.prototype.init=function(){},ja.$inject=["eventBus"],t(ja,La),ja.prototype.canResize=function(e,t){return!1},t(Ia,ja),Ia.$inject=["eventBus","modeling"],Ia.prototype.canResize=function(e,t){if(!Ti(t,"bpmn:Participant")&&!Ti(t,"bpmn:Lane")&&!Ti(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(e){(Ti(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var za={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Oa],bpmnAutoResizeProvider:["type",Ia]},Fa=Math.round,$a="djs-drag-active";function Ga(e){e.preventDefault()}function Ha(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(F({},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=ro(e),s=Ko(a,o),c=m.localStart,p=y(a),l=Ko(p,c);if(!m.active&&(t||(n=s,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))>m.threshold))){if(F(i,{x:Fa(c.x+r.x),y:Fa(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&&Vo(m.cursor),h.addMarker(h.getRootElement(),$a)}io(e),m.active&&(F(i,{x:Fa(p.x+r.x),y:Fa(p.y+r.y),dx:Fa(l.x),dy:Fa(l.y)},{originalEvent:e}),v("move"))}function b(e){var t=!0;m.active&&(e&&io(m.payload.originalEvent=e),t=v("end")),!1===t&&v("rejected"),v("ended",i(!0!==t))}function x(e){27===e.which&&(Ga(e),C())}function _(e){var t;m.active&&(t=qo(u),setTimeout(t,400),Ga(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"),Wo(),n=m.trapClick?_:b,re.unbind(document,"mousemove",g),re.unbind(document,"dragstart",Ga),re.unbind(document,"selectstart",Ga),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(),$a);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({},f,i||{})).data||{};s=i.trapClick?_:b,e?(r=no(e)||e,o=ro(e),io(e),"dragstart"===r.type&&Ga(r)):(r=null,o={x:0,y:0}),a=y(o),t||(t=a),p=r,c="undefined"!=typeof TouchEvent&&p instanceof TouchEvent,m=F({prefix:n,data:l,payload:{},globalStart:o,displacement:Ko(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",Ga),re.bind(document,"selectstart",Ga),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(f,e)}}Ha.$inject=["eventBus","canvas","selection"];function Va(o,a,s){var t=this;o.on("drag.start",function(e){o.once("drag.move",function(){o.once("drag.move",function(e){t.ensureHover(e)})})}),o.on("drag.init",function(){var n,i;function e(e){n=e.hover,i=e.hoverGfx}function t(){i=n=null}function r(){if(n){var e=n,t=i;i=n=null,a.out({element:e,gfx:t})}}o.on("drag.hover",e),o.on("element.out",t),o.on("element.hover",1500,r),o.once("drag.cleanup",function(){o.off("drag.hover",e),o.off("element.out",t),o.off("element.hover",r)})}),this.ensureHover=function(e){if(!e.hover){var t,n,i,r,o=e.originalEvent;if(o instanceof MouseEvent)t=ro(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}))}}}Va.$inject=["eventBus","dragging","elementRegistry"];var Wa={__init__:["hoverFix"],__depends__:[vo],dragging:["type",Ha],hoverFix:["type",Va]};function Ua(e,t){this._eventBus=e,this._canvas=t,this._init()}Ua.$inject=["eventBus","canvas"],Ua.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)}}},Ua.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=I(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)},Ua.prototype._setHoverElement=function(e){this._hoverElement=e.element},Ua.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var qa={__init__:["mouseTracking"],mouseTracking:["type",Ua]};function Ya(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 Ka(e,t,n){return t<e&&e<n}Ya.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"],Ya.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++)Ka(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))},Ya.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ya.prototype.setOptions=function(e){this._opts=F({},this._opts,e)},Ya.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ro(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Xa={__depends__:[Wa,qa],__init__:["autoScroll"],autoScroll:["type",Ya]};function Za(e){this._commandStack=e.get("commandStack",!1)}Za.$inject=["injector"],Za.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Qa={__init__:["rules"],rules:["type",Za]},Ja=Math.round,es=Math.max;var ts=10;function ns(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(or(i,t)<=ts)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||(n=e,s=Gr((o=ts,[["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=es(c.segment2,p.segment2)-1],bendpoint:!0,index:a}:{point:{x:Ja(c.x+p.x)/2,y:Ja(c.y+p.y)/2},index:c.segment2}:{point:{x:Ja(c.x),y:Ja(c.y)},index:c.segment2}:null);var n,i,r,o,a,s,c,p}var is="djs-bendpoint",rs="djs-segment-dragger";function os(e,t,n){return ns(t,function(e,t){var n,i=ro(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}}(e,n))}function as(e,t){var n=Ne("g");Te(n).add(is),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 ss(e,t,n,i){var r=Ne("g");ve(e,r);var o,a,s,c,p,l=(o=t,s=i,c=(a=n).x-o.x,p=a.y-o.y,ps("h"===s?c:p)),u=Ne("rect");_e(u,{x:-7,y:-1.5,width:14,height:3}),Te(u).add("djs-visual"),ve(r,u);var h=Ne("rect");return _e(h,{x:-l/2,y:-4.5,width:l,height:9}),Te(h).add("djs-hit"),ve(r,h),Qt(r,"v"===i?90:0),r}function cs(e,t,n){var i=Ne("g"),r=lr(t,n),o=cr(t,n);return ve(e,i),ss(i,t,n,o),Te(i).add(rs),Te(i).add("h"===o?"horizontal":"vertical"),Zt(i,r.x,r.y),i}function ps(e){return Math.abs(Math.round(2*e/3))}var ls=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+="<22>";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t}(n)}),us={"&":"&","<":"<",">":">",'"':""","'":"'"};function hs(e){return(e=""+e)&&e.replace(/[&<>"']/g,function(e){return us[e]})}function ds(e,x,i,_,E){function r(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v,g=t.waypoints,b=os(x,g,e);if(b)return i=b,a=t.waypoints,n=i.index<=0||i.bendpoint?null:(o=cr((r={start:a[i.index-1],end:a[i.index]}).start,r.end))?ps("h"===o?r.end.x-r.start.x:r.end.y-r.start.y)/2:null,c=g,p=n,y=(s=b).index,v=s.point,!(y<=0||s.bendpoint)&&(h=lr(l=c[y-1],u=c[y]),d=cr(l,u),m=Math.abs(v.x-h.x),f=Math.abs(v.y-h.y),d&&m<=p&&f<=p)?E.start(e,t,b.index):_.start(e,t,b.index,!b.bendpoint),!0}function s(e,t,n){re.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function b(e,t){var n=x.getLayer("overlays"),i=de('.djs-bendpoints[data-element-id="'+ls(e.id)+'"]',n);return!i&&t&&(_e(i=Ne("g"),{"data-element-id":e.id}),Te(i).add("djs-bendpoints"),ve(n,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function w(e,t){return de('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function n(i,e){e.waypoints.forEach(function(e,t){var n=as(i);ve(i,n),Zt(n,e.x,e.y)}),as(i,"floating")}function o(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)cr(n=o[a-1],i=o[a])&&(_e(r=cs(e,n,i),{"data-segment-idx":a}),s(r,"mousemove",t))}function a(e){var t=b(e);return t||(n(t=b(e,!0),e),o(t,e)),t}function t(e){var t=b(e);t&&(M(me("."+rs,t),function(e){Ae(e)}),M(me("."+is,t),function(e){Ae(e)}),o(t,e),n(t,e))}e.on("connection.changed",function(e){t(e.element)}),e.on("connection.remove",function(e){var t=b(e.element);t&&Ae(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=a(n),e.add?Te(t).add(e.marker):Te(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v=e.element,g=v.waypoints;if(g){if(t=b(v,!0),!(n=os(x,g,e.originalEvent)))return;m=n,f=de(".floating",t),y=m.point,f&&Zt(f,y.x,y.y),n.bendpoint||(i=t,o=g,c=w((r=n).index,i),p=o[r.index-1],l=o[r.index],u=r.point,h=lr(p,l),d=cr(p,l),c&&(a=Kt(c),s={x:u.x-h.x,y:u.y-h.y},"v"===d&&(s={x:s.y,y:s.x}),Zt(a,s.x,s.y)))}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element;if(n.waypoints)return r(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&a(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(a(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=b(t);i&&_e(i,{"data-element-id":n})}}),this.addHandles=a,this.updateHandles=t,this.getBendpointsContainer=b,this.getSegmentDragger=w}ds.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var ms="connection.updateWaypoints",fs="connection.reconnectStart",ys="connection.reconnectEnd",vs=Math.round;function gs(e,t,s,c,p,l){var u=e.get("connectionDocking",!1);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?ms:ys:fs})!==(r.allowed=p.allowed(r.type,r))&&c.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:a,context:r}})},t.on("bendpoint.move.hover",function(e){var t=e.context;(t.hover=e.hover,e.hover)&&((t.allowed=p.allowed(t.type,t))&&(t.target=t.hover))}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context;t.target=null,t.allowed=!1}),t.on("bendpoint.move.end",function(e){var t,n,i=e.context,r=i.connection,o=r.waypoints,a=o.slice(),s=i.bendpointIndex,c=i.allowed,p=i.insert;if(t={x:vs(e.x),y:vs(e.y)},c&&i.type===fs)l.reconnectStart(i.connection,i.target,t);else if(c&&i.type===ys)l.reconnectEnd(i.connection,i.target,t);else{if(!1===c||i.type!==ms)return!1;p?a.splice(s,0,t):a[s]=t,n={bendpointMove:{insert:p,bendpointIndex:s}},u&&(r.waypoints=a,r.waypoints=u.getCroppedWaypoints(r),a=r.waypoints,r.waypoints=o),l.updateWaypoints(i.connection,Xr(a),n)}})}gs.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];var bs="connect-ok",xs="connect-not-ok",_s="connect-hover",Es="djs-updating",ws="djs-element-hidden",Ss="connection.reconnectStart",Cs="connection.reconnectEnd";function Ts(e,t,s){var c=e.get("connectionPreview",!1),p=e.get("connectionDocking",!1);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,{x:e.x,y:e.y}),n.waypoints=r,t.draggerGfx=as(s.getLayer("overlays")),Te(t.draggerGfx).add("djs-dragging"),s.addMarker(n,Es),s.addMarker(n,ws)}),t.on("bendpoint.move.hover",function(e){var t=e.context,n=t.allowed,i=t.hover,r=t.type;if(e.hover){if(s.addMarker(i,_s),r!==Ss&&r!==Cs)return;n?(s.removeMarker(i,xs),s.addMarker(i,bs)):!1===n&&(s.removeMarker(i,bs),s.addMarker(i,xs))}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,function(e){var t=e.context.hover;t&&(s.removeMarker(t,_s),s.removeMarker(t,e.context.target?bs:xs))}),t.on("bendpoint.move.move",function(e){var t,n=e.context,i=n.type,r=e.connection,o=r.waypoints,a=o.slice(),s={x:e.x,y:e.y};c&&(t={source:r.source,target:r.target},i===Ss?(t.source=n.target,t.connectionStart=s):i===Cs?(t.target=n.target,t.connectionEnd=s):(t.noCropping=!0,t.noLayout=!0,a[n.bendpointIndex]=s),p&&(r.waypoints=a,r.waypoints=p.getCroppedWaypoints(r),a=r.waypoints,r.waypoints=o),t.waypoints=Xr(a),c.drawPreview(n,n.allowed,t)),Zt(n.draggerGfx,e.x,e.y)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,function(e){var t=e.context,n=t.hover,i=t.connection;i.waypoints=t.originalWaypoints,Ae(t.draggerGfx),s.removeMarker(i,Es),s.removeMarker(i,ws),n&&(s.removeMarker(n,bs),s.removeMarker(n,t.target?bs:xs)),c&&c.cleanUp(t)})}Ts.$inject=["injector","eventBus","canvas"];var Rs="connect-hover",As="djs-updating";function Ps(e,t,n){return ks(e,t,e[t]+n)}function ks(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Ms(e){return"x"===e?"y":"x"}function Ds(e,t,n){var i,r;return e.original?e.original:(i=qr(t),ks(e,r=Ms(n),i[r]))}function Bs(e,t,m,f,n,h){var r=e.get("connectionDocking",!1);function y(e,t){if(!r)return t;var n,i=e.waypoints;return e.waypoints=t,n=r.getCroppedWaypoints(e),e.waypoints=i,n}function v(e){n.update("connection",e.connection,e.connectionGfx)}function g(e,t,n){var i,r,o,a,s,c,p=e.newWaypoints,l=p[e.segmentStartIndex+t],u=p[e.segmentEndIndex+t],h=Ms(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]),ks(r,a,Math.min(Math.max(c+20,i[a]),s-20)));Zt(e.draggerGfx,d.x,d.y)}this.start=function(e,t,n){var i,r,o,a,s=m.getGraphics(t),c=n-1,p=n,l=t.waypoints,u=l[c],h=l[p],d=os(m,l,e);(r=cr(u,h))&&(o="v"===r?"x":"y",0===c&&(u=Ds(u,t.source,o)),p===l.length-1&&(h=Ds(h,t.target,o)),i={connection:t,segmentStartIndex:c,segmentEndIndex:p,segmentStart:u,segmentEnd:h,axis:o,dragPosition:a=d?d.point:{x:(u.x+h.x)/2,y:(u.y+h.y)/2}},f.init(e,a,"connectionSegment.move",{cursor:"x"===o?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:s,context:i}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,n=e.connection,i=m.getLayer("overlays");t.originalWaypoints=n.waypoints.slice(),t.draggerGfx=cs(i,t.segmentStart,t.segmentEnd),Te(t.draggerGfx).add("djs-dragging"),m.addMarker(n,As)}),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=Ps(s,p,e["d"+p]),h=Ps(c,p,e["d"+p]),d=l.length,m=0;l[o]=u,l[a]=h,o<2&&(t=Yr(r.source,u),1===o?"intersect"===t&&(l.shift(),l[0]=u,m--):"intersect"!==t&&(l.unshift(s),m++)),d-3<a&&(n=Yr(r.target,h),a===d-2?"intersect"===n&&(l.pop(),l[l.length-1]=h):"intersect"!==n&&l.push(c)),i.newWaypoints=r.waypoints=y(r,l),g(i,m,e),i.newSegmentStartIndex=o+m,v(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,m.addMarker(e.hover,Rs)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&m.removeMarker(t,Rs)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,n=t.connection;t.draggerGfx&&Ae(t.draggerGfx),m.removeMarker(n,As)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,v(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!ar(o[t-1],o[t+1],e)||(s=t<=a?s-1:s,!1)}),segmentOffset:s}),p=y(n,c.waypoints),l=c.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+l}};h.updateWaypoints(n,p,u)})}Bs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Ns=Math.abs,Os=Math.round;function Ls(e){return{x:e.x,y:e.y}}function js(e){return{x:e.x+e.width,y:e.y+e.height}}function Is(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Os(e.x+e.width/2),y:Os(e.y+e.height/2)}}function zs(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Fs(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 $s(e){return e.children||[]}var Gs=Math.abs,Hs=Math.round;function Vs(e){function u(e,t){if(g(e)){for(var n=e.length;n--;)if(Gs(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 h(e){if(e.width)return{x:Hs(e.width/2+e.x),y:Hs(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(h(n.source)),s>i.length-3&&p.unshift(h(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=u(i.vertical,r)),s=o-(n=u(i.horizontal,o));F(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n}),(a||-1!==i.vertical.indexOf(r))&&Fs(e,"x",t),(s||-1!==i.horizontal.indexOf(o))&&Fs(e,"y",n)}}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(e){var t,n,i=e.context,r=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}(i),o=i.target,a=o&&h(o),s=e.x,c=e.y;if(r){var p=s-(t=u(a?r.vertical.concat([a.x]):r.vertical,s)),l=c-(n=u(a?r.horizontal.concat([a.y]):r.horizontal,c));F(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l}),(p||-1!==r.vertical.indexOf(s))&&Fs(e,"x",t),(l||-1!==r.horizontal.indexOf(c))&&Fs(e,"y",n)}})}Vs.$inject=["eventBus"];var Ws={__depends__:[Wa,Qa],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ds],bendpointMove:["type",gs],bendpointMovePreview:["type",Ts],connectionSegmentMove:["type",Bs],bendpointSnapping:["type",Vs]};function Us(e,r,p,n){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",function(e){var t=e.context,n=t.source,i=e.hover;null!==(t.canExecute=l(n,i))&&(t.target=i)}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target=null,t.canExecute=!1}),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=qr(t)),r.init(e,"connect",{autoActivate:i,data:{shape:t,context:{source:t,sourcePosition:n}}})}}Us.$inject=["eventBus","dragging","modeling","rules"];var qs="connect-ok",Ys="connect-not-ok";function Ks(e,t,r){var a=e.get("connectionPreview",!1);t.on("connect.move",function(e){var t=e.context,n=t.source,i=t.target,r=t.canExecute,o={x:e.x,y:e.y};a&&a.drawPreview(t,r,{source:n,target:i,connectionEnd:o})}),t.on("connect.hover",900,function(e){var t=e.context,n=e.hover,i=t.canExecute;null!==i&&r.addMarker(n,i?qs:Ys)}),t.on(["connect.out","connect.cleanup"],1100,function(e){var t=e.context;t.target&&r.removeMarker(t.target,t.canExecute?qs:Ys)}),t.on("connect.cleanup",function(e){a&&a.cleanUp(e.context)})}Ks.$inject=["injector","eventBus","canvas"];var Xs={__depends__:[vo,Qa,Wa],__init__:["connectPreview"],connect:["type",Us],connectPreview:["type",Ks]};function Zs(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Zs.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zs.prototype.drawPreview=function(e,t,n){n=n||{};var i,r,o,a=e.connectionPreviewGfx,s=e.getConnection,c=n.source,p=n.target,l=n.waypoints,u=n.connectionStart,h=n.connectionEnd,d=n.noLayout,m=n.noCropping,f=n.noNoop,y=this;a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Pe(a),s||(s=e.getConnection=(r=function(e,t,n){return y.getConnection(e,t,n)},o={},function(e){var t=JSON.stringify(e),n=o[t];return n||(n=o[t]=r.apply(null,arguments)),n})),t&&(i=s(t,c,p)),i?(i.waypoints=l||[],this._layouter&&!d&&(i.waypoints=this._layouter.layoutConnection(i,{source:c,target:p,connectionStart:u,connectionEnd:h})),i.waypoints&&i.waypoints.length||(i.waypoints=[c?qr(c):u,p?qr(p):h]),this._connectionDocking&&(c||p)&&!m&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,c,p)),this._graphicsFactory.drawConnection(a,i)):!f&&this.drawNoopPreview(a,n)},Zs.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||qr(n),o=t.connectionEnd||qr(i),a=this.cropWaypoints(r,o,n,i);ve(e,this.createNoopConnection(a[0],a[1]))},Zs.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return[e=n&&Kr(o,s,!0)||e,t=i&&Kr(a,s,!1)||t]},Zs.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ae(e.connectionPreviewGfx)},Zs.prototype.getConnection=function(e){var t,n=P(t=e)?t:{};return this._elementFactory.createConnection(n)},Zs.prototype.createConnectionPreviewGfx=function(){var e=Ne("g");return _e(e,{pointerEvents:"none"}),Te(e).add("djs-connection-preview"),ve(this._canvas.getDefaultLayer(),e),e},Zs.prototype.createNoopConnection=function(e,t){var n=Ne("polyline");return _e(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),_e(n,{points:[e.x,e.y,t.x,t.y]}),n};var Qs={__init__:["connectionPreview"],connectionPreview:["type",Zs]},Js=Math.min,ec=Math.max;function tc(e){e.preventDefault()}function nc(e){e.stopPropagation()}function ic(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=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function rc(e,t){this._eventBus=e,this._providers=[],this._textbox=new ic({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}ic.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",nc),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},ic.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)}},ic.prototype.insertText=function(e){document.execCommand("insertText",!1,e)||this._insertTextIE(e)},ic.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)})},ic.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})}},ic.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){tc(e),nc(e);var t=Js(ec(u+e.clientX-p,o),s),n=Js(ec(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){tc(e),nc(e),re.unbind(document,"mousemove",n,!1),re.unbind(document,"mouseup",d,!1)};re.bind(e,"mousedown",function(e){tc(e),nc(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)},ic.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",nc),re.unbind(t,"input",this.autoResize),re.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),fe(n)),fe(e)},ic.prototype.getValue=function(){return this.content.innerText.trim()},ic.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},ic.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)},rc.$inject=["eventBus","canvas"],rc.prototype.registerProvider=function(e){this._providers.push(e)},rc.prototype.isActive=function(){return!!this._active},rc.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},rc.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},rc.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},rc.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()}},rc.prototype.getValue=function(){return this._textbox.getValue()},rc.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())},rc.prototype._handleResize=function(e){this._fire("resize",e)},rc.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 oc={__depends__:[po],__init__:["directEditing"],directEditing:["type",rc]};function ac(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()}ac.$inject=["config.contextPad","eventBus","overlays"],ac.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)})},ac.prototype.registerProvider=function(e){this._providers.push(e)},ac.prototype.getEntries=function(t){var n={};return M(this._providers,function(e){M(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},ac.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[G(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()},ac.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ac.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>');G(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&&G(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})},ac.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},ac.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ac.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var sc={__depends__:[po,So],contextPad:["type",ac]},cc="drop-ok",pc="drop-not-ok",lc="attach-ok",uc="new-parent";function hc(e,r,s,l,o,a,c){function p(t,n){[lc,cc,pc,uc].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;dc(e);var a={x:e.x,y:e.y};t=n.canExecute=i&&function(e,t,n,i){if(!t)return!1;var r,o,a={source:n,shape:e,target:t,position:i};return(o=s.allowed("shape.attach",a))||(r=s.allowed("shape.create",a)),r||o?{attach:o,connect:n&&s.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:o}})}:(null===r||null===o)&&null}(r,i,o,a),i&&null!==t&&(n.target=i,t&&t.attach?p(i,lc):p(i,t?uc:pc))}),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),Zt(n,e.width/-2,e.height/-2);var r=Ne("g");return Te(r).add("djs-visual"),ve(n,r),i=r,c.drawShape(i,e),t}(n)),Zt(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&p(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,i=t.hints,r=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect;if(!1===a||!o)return!1;dc(e);var p={x:e.x,y:e.y};r=c?l.appendShape(n,r,p,o,{attach:s,connection:!0===c?{}:c}):l.createShape(r,p,o,F({},i,{attach:s})),t.shape=r}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),this.start=function(e,t,n){var i;i=!n||n instanceof zt?{hints:{},shape:t,source:n}:F({hints:{},shape:t},n),r.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:i}})}}function dc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}hc.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var mc={__depends__:[Wa,vo,Qa],create:["type",hc]},fc="data-id";function yc(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={}}yc.$inject=["config.popupMenu","eventBus","canvas"],yc.prototype.registerProvider=function(e,t){this._providers[e]=t},yc.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},yc.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)},yc.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindHandlers(),fe(this._current.container),this._current.container=null)},yc.prototype.isOpen=function(){return!!this._current.container},yc.prototype.trigger=function(e){e.preventDefault();var t=G(e.delegateTarget||e.target,fc),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},yc.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},yc.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},yc.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},yc.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()},yc.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})},yc.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})},yc.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},yc.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)}),G(t,fc,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},yc.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)},yc.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 vc={__init__:["popupMenu"],popupMenu:["type",yc]},gc=Math.round;function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=gc(e.x+(t.width||e.width)/2),t.y=gc(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var xc={__init__:["replace"],replace:["type",bc]},_c=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"];function Ec(e,t){var n=[];return M(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n}function wc(e,t){this._eventBus=e,this._bpmnFactory=t}wc.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},wc.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===_c.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 Sc=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Cc(f,y,v,g,b,e){var x=new wc(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:!Ai(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=Ec(s.$descriptor),h=Ec(p.$descriptor,!0),d=(c=h,u.filter(function(e){return-1!==c.indexOf(e)}));F(p,$(i,Sc));var m=k(d,function(e){var t=e.replace(/bpmn:/,"");return"eventDefinitions"===t?Rc(n,i.eventDefinitionType):"loopCharacteristics"===t?!Pi(p):!(e in p||"processRef"===t&&!1===i.isExpanded||"triggeredByEvent"===t||-1!==_c.indexOf(t))});return p=x.clone(s,p,m),i.eventDefinitionType&&(Rc(p,i.eventDefinitionType)||(l.eventDefinitionType=i.eventDefinitionType)),Ti(s,"bpmn:Activity")&&(Tc(s)?l.isExpanded=Ai(s):i&&_(i,"isExpanded")&&(l.isExpanded=i.isExpanded),Ai(s)&&!Ti(s,"bpmn:Task")&&l.isExpanded&&(l.width=n.width,l.height=n.height)),Tc(s)&&!Tc(p)&&(e.moveChildren=!1),Ti(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,ba(s,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ba(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=s.default),i.host&&!Ti(s,"bpmn:BoundaryEvent")&&Ti(p,"bpmn:BoundaryEvent")&&(l.host=i.host),("fill"in s.di||"stroke"in s.di)&&F(l,{colors:$(s.di,["fill","stroke"])}),l=v.replaceElement(n,l,e),!1!==e.select&&g.select(l),l}}function Tc(e){return Ti(e,"bpmn:SubProcess")}function Rc(e,t){var n=Ri(e);return t&&n.get("eventDefinitions").some(function(e){return Ti(e,t)})}Cc.$inject=["bpmnFactory","elementFactory","replace","selection","modeling","eventBus"];var Ac={__depends__:[vo,xc],bpmnReplace:["type",Cc]};function Pc(c){return function(e){var t=e.target,n=Ri(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===Ai(n);return!(r&&o&&a&&s)}}var kc=[{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"}}],Mc=[{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"}}],Dc=[{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"}}],Bc=[{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"}}],Nc=[{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}}],Oc=[{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}}],Lc=[{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}}],jc=[{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}}],Ic=[{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}}],zc=[{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"}],$c=[{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 Gc(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()}Gc.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Gc.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Gc.prototype.getEntries=function(r){var e,o=r.businessObject;if(!this._rules.allowed("shape.replace",{element:r}))return[];var a=Pc(r);return Ti(o,"bpmn:StartEvent")&&!Pi(o.$parent)?(e=k(kc,a),this._createEntries(r,e)):Ti(o,"bpmn:Participant")?(e=k($c,function(e){return Ai(o)!==e.target.isExpanded}),this._createEntries(r,e)):Ti(o,"bpmn:StartEvent")&&Pi(o.$parent)?(e=k(zc,function(e){var t=!1!==e.target.isInterrupting,n=Ri(r).isInterrupting===t;return a(e)||!a(e)&&!n}),this._createEntries(r,e)):Ti(o,"bpmn:EndEvent")?(e=k(Dc,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Ti(o.$parent,"bpmn:Transaction"))&&a(e)}),this._createEntries(r,e)):Ti(o,"bpmn:BoundaryEvent")?(e=k(Ic,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Ti(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)):Ti(o,"bpmn:IntermediateCatchEvent")||Ti(o,"bpmn:IntermediateThrowEvent")?(e=k(Mc,a),this._createEntries(r,e)):Ti(o,"bpmn:Gateway")?(e=k(Bc,a),this._createEntries(r,e)):Ti(o,"bpmn:Transaction")?(e=k(Oc,a),this._createEntries(r,e)):Pi(o)&&Ai(o)?(e=k(Lc,a),this._createEntries(r,e)):Ti(o,"bpmn:SubProcess")&&Ai(o)?(e=k(Nc,a),this._createEntries(r,e)):Ti(o,"bpmn:AdHocSubProcess")&&!Ai(o)?(e=k(jc,function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return Pc(r)&&(!n||i)}),this._createEntries(r,e)):Ti(o,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(r,Fc):Ti(o,"bpmn:FlowNode")?(e=k(jc,a),Ti(o,"bpmn:SubProcess")&&!Ai(o)&&(e=k(e,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(r,e)):[]},Gc.prototype.getHeaderEntries=function(e){var t=[];return Ti(e,"bpmn:Activity")&&!Pi(e)&&(t=t.concat(this._getLoopEntries(e))),!Ti(e,"bpmn:SubProcess")||Ti(e,"bpmn:Transaction")||Pi(e)||t.push(this._getAdHocEntry(e)),t},Gc.prototype._createEntries=function(n,e){var i=[],r=this;return M(e,function(e){var t=r._createMenuEntry(e,n);i.push(t)}),i},Gc.prototype._createSequenceFlowEntries=function(t,e){var n=Ri(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&&(Ti(n.sourceRef,"bpmn:ExclusiveGateway")||Ti(n.sourceRef,"bpmn:InclusiveGateway")||Ti(n.sourceRef,"bpmn:ComplexGateway")||Ti(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&&Ti(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(Ti(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t,{conditionExpression:void 0})}));if((Ti(n.sourceRef,"bpmn:ExclusiveGateway")||Ti(n.sourceRef,"bpmn:InclusiveGateway")||Ti(n.sourceRef,"bpmn:ComplexGateway")||Ti(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:void 0})}))}}),i},Gc.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}},Gc.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=Ri(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"}}]},Gc.prototype._getAdHocEntry=function(n){var e=this._translate,i=Ti(Ri(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 Hc={__depends__:[vc,Ac],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Gc]},Vc=Math.max,Wc=Math.min,Uc=20;function qc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Yc(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)?Wc:Vc)(i,r)),l(o)&&(i=(/top|left/.test(e)?Vc:Wc)(i,o)),i}function Kc(e,t){return void 0!==e?e:Uc}function Xc(e){return!e.waypoints&&"label"!==e.type}function Zc(e,t){var n,i,r,o,a,s,c;if((n=void 0===e.length?k(e.children,Xc):e).length)return i=ut(n),"object"==typeof(r=t)?(o=Kc(r.left),a=Kc(r.right),s=Kc(r.top),c=Kc(r.bottom)):o=a=s=c=Kc(r),{x:i.x-o,y:i.y-s,width:i.width+o+a,height:i.height+s+c}}var Qc=Math.abs;var Jc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function ep(e,t){return t=t||[],e.children.filter(function(e){Ti(e,"bpmn:Lane")&&(ep(e,t),t.push(e))}),t}function tp(e){return e.children.filter(function(e){return Ti(e,"bpmn:Lane")})}function np(e){return function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(ba(e,t))return e;return null}(e,Jc)||e}function ip(c,e){var t,n=np(c),i=ep(n,Ti(n,"bpmn:Process")?[]:[n]),p=Wr(c),l=Wr(e),u=(t=c,qc(Wr(e),Wr(t))),h=[];return i.forEach(function(e){if(e!==c){var t,n,i=0,r=u.right,o=0,a=u.left,s=Wr(e);u.top&&(Qc(s.bottom-p.top)<10&&(o=l.top-s.bottom),Qc(s.top-p.top)<5&&(i=l.top-s.top)),u.bottom&&(Qc(s.top-p.bottom)<10&&(i=l.bottom-s.top),Qc(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 rp(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(ao(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function op(e,t,n){var i=e.$instanceOf(t),r=!1;return M(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}rp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],rp.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(F({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(F({type:i},r));s.append(t,n)}:n}}}function f(n){return function(e,t){i.splitLane(t,n),p.open(t,!0)}}if(ba(h,["bpmn:Lane","bpmn:Participant"])&&Ai(h)){var y=tp(t);F(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&&F(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&&F(r,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:f(3)}}})),F(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")}}}})}Ti(h,"bpmn:FlowNode")&&(Ti(h,"bpmn:EventBasedGateway")?F(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"})}):op(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?F(r,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):Ti(h,"bpmn:EndEvent")||h.isForCompensation||op(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Pi(h)||F(r,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append EndEvent")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append Task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),l.isEmpty(t,"bpmn-replace")||F(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=F((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)}}}}),ba(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(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}}}),ba(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(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&&F(r,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(e){i.removeElements([t])}}}}),r};var ap={__depends__:[oc,sc,vo,Xs,mc,Hc],__init__:["contextPadProvider"],contextPadProvider:["type",rp]};function sp(){}sp.prototype.get=function(){return this._data},sp.prototype.set=function(e){this._data=e},sp.prototype.clear=function(){var e=this._data;return delete this._data,e},sp.prototype.isEmpty=function(){return!this._data};var cp={clipboard:["type",sp]};function pp(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})}pp.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],pp.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=Yo(ut(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?Ko(e,t.waypoints[0]):Ko(e,t)):3===e.priority?(n=[],M(e.waypoints,function(e){var t=Ko(e,r);n.push(t)})):n=Ko(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},pp.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}}))},pp.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Ko(t,t.labelTarget):(3===t.priority?(i=[],M(t.waypoints,function(e){var t=Ko(e,n);i.push(t)})):i=Ko(t,n),i)},pp.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})))},pp.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)},pp.prototype._executeDescriptors=function(t){return t.descriptor||(t.descriptor={}),M(this._descriptors,function(e){t.descriptor=e(t.element,t.descriptor)}),t},pp.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=[],pt(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 lp={__depends__:[cp,Qa,qa],__init__:["copyPaste"],copyPaste:["type",pp]};function up(t,n,e){M(e,function(e){void 0!==n[e]&&(t[e]=n[e])})}function hp(h,e,t,n,d,m){var f=new wc(e,h);t.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Ri(e),i={};return t.type=e.type,up(t,n.di,["isExpanded"]),up(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type||(up(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=Ec(p.$descriptor);(u=k(u,function(e){return-1===_c.indexOf(e.replace(/bpmn:/,""))}),o.businessObject=f.clone(p,t,u),"label"!==o.type)&&(Ti(s,"bpmn:Process")&&(o.parent=Ti(c,"bpmn:Collaboration")?c:s),"bpmn:DataOutputAssociation"!==o.type&&"bpmn:DataInputAssociation"!==o.type&&"bpmn:MessageFlow"!==o.type||(o.parent=c),Ti(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")),up(t,o,["isExpanded","triggeredByEvent"]),l=o,M(["triggeredByEvent"],function(e){l[e]&&delete l[e]}))})}hp.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var dp={__depends__:[lp],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",hp]},mp={horizontal:["x","width"],vertical:["y","height"]};function fp(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})})}fp.$inject=["modeling"],fp.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},fp.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},fp.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},fp.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},fp.prototype._setOrientation=function(e){var t=mp[e];this._axis=t[0],this._dimension=t[1]},fp.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)},fp.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var yp={__init__:["distributeElements"],distributeElements:["type",fp]};function vp(e){e.registerFilter(function(e){return k(e,function(e){var t=ba(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}vp.$inject=["distributeElements"];var gp={__depends__:[yp],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",vp]},bp="is not a registered action";function xp(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function _p(e,t){return new Error(e+" "+t)}xp.$inject=["eventBus","injector"],xp.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)})},xp.prototype.trigger=function(e,t){if(!this._actions[e])throw _p(e,bp);return this._actions[e](t)},xp.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)})},xp.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw _p(e,"is already registered");this._actions[e]=t},xp.prototype.unregister=function(e){if(!this.isRegistered(e))throw _p(e,bp);this._actions[e]=void 0},xp.prototype.getActions=function(){return Object.keys(this._actions)},xp.prototype.isRegistered=function(e){return!!this._actions[e]};var Ep={__init__:["editorActions"],editorActions:["type",xp]};function wp(e){e.invoke(xp,this)}t(wp,xp),wp.$inject=["injector"],wp.prototype._registerDefaultActions=function(e){xp.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!Ti(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=ut(t=Ti(n,"bpmn:Collaboration")?r.filter(function(e){return Ti(e.parent,"bpmn:Collaboration")}):r.filter(function(e){return e!==n&&!Ti(e.parent,"bpmn:SubProcess")})),h.moveElements(t,{x:-e.x,y:-e.y},n)})};var Sp={__depends__:[Ep],editorActions:["type",wp]};function Cp(e){e.on(["create.init","shape.move.init"],function(e){var t=e.context;ba(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")})}Cp.$inject=["eventBus"];function Tp(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Rp(e,t){var n=!t||!1!==t.active;this._eventBus=e;var o=this;e.on("diagram.init",800,function(){o.setActive(n)}),e.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,function(i){var e=i.originalEvent;if(!(!o.active||e&&Do(e))){var r=i.context;["x","y"].forEach(function(e){var t={};r.gridSnappingContext&&r.gridSnappingContext.snapLocation&&F(t,{offset:function(e,t){var n=e.context,i=e.shape,r=(n.gridSnappingContext||{}).snapLocation;if(!i||!r)return 0;if("x"===t){if(/left/.test(r))return-i.width/2;if(/right/.test(r))return i.width/2}else{if(/top/.test(r))return-i.height/2;if(/bottom/.test(r))return i.height/2}return 0}(i,e)});var n=function(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.direction,a=null;i&&(a={},Ap(t)?(a.min=i.left,a.max=i.right):(a.min=i.top,a.max=i.bottom));var s=r.min,c=r.max;s&&(a={},Ap(t)?kp(o)?a.max=s.left:a.min=s.right:Pp(o)?a.max=s.top:a.min=s.bottom);c&&(a={},Ap(t)?kp(o)?a.min=c.left:a.max=c.right:Pp(o)?a.min=c.top:a.max=c.bottom);return a}(i,e);n&&F(t,n),zs(i,e)||o.snapEvent(i,e,t)})}})}function Ap(e){return"x"===e}function Pp(e){return"n"===e.charAt(0)}function kp(e){return"w"===e.charAt(1)}Rp.prototype.snapEvent=function(e,t,n){Fs(e,t,this.snapValue(e[t],n))},Rp.prototype.getGridSpacing=function(){return 10},Rp.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=Tp(e+=r,10),t&&t.min&&l(n=t.min)&&(n=Tp(n+r,10,"ceil"),e=Math.max(e,n)),t&&t.max&&l(i=t.max)&&(i=Tp(i+r,10,"floor"),e=Math.min(e,i)),e-=r},Rp.prototype.isActive=function(){return this.active},Rp.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Rp.prototype.toggleActive=function(){this.setActive(!this.active)},Rp.$inject=["eventBus","config.gridSnapping"];function Mp(e,o){Ba.call(this,e),this.preExecute("elements.paste",2e3,function(e){var t=e.context,n=t.position,i=t.tree;if(i[0]){var r=qr(ut(i[0]));n.x=o.snapValue(n.x)+r.x%10,n.y=o.snapValue(n.y)+r.y%10}})}function Dp(e,t){Ba.call(this,e),this._gridSnapping=t;var o=this;this.preExecute("shape.resize",function(e){var t=e.context,n=(t.hints||{}).autoResize;if(n){var i=t.shape,r=t.newBounds;d(n)?t.newBounds=o.snapComplex(r,n):t.newBounds=o.snapSimple(i,r)}})}Mp.$inject=["eventBus","gridSnapping"],t(Mp,Ba),Dp.$inject=["eventBus","gridSnapping","modeling"],t(Dp,Ba),Dp.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Dp.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Dp.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),F(e,o),e},Dp.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),F(e,o),e};function Bp(e,n){e.on(["spaceTool.move","spaceTool.end"],2e3,function(e){var t=e.context;t.initialized&&("x"===t.axis?e.dx=n.snapValue(e.dx):e.dy=n.snapValue(e.dy))})}Bp.$inject=["eventBus","gridSnapping"];var Np={__depends__:[{__init__:["gridSnappingPasteBehavior","gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingPasteBehavior:["type",Mp],gridSnappingResizeBehavior:["type",Dp],gridSnappingSpaceToolBehavior:["type",Bp]}],__init__:["gridSnapping"],gridSnapping:["type",Rp]};function Op(e,a){e.on("autoPlace",function(e){var t=e.source,i=qr(t),r=e.shape,o=wa(t,r);return["x","y"].forEach(function(e){var t,n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],Ti(r,"bpmn:TextAnnotation")&&(t=e,n.offset="x"===t?-r.width/2:-r.height/2),o[e]=a.snapValue(o[e],n))}),o})}Op.$inject=["eventBus","gridSnapping"];function Lp(r,e,o){e.on(["create.start","shape.move.start"],1750,function(e){var t=e.context,n=t.shape,i=r.getRootElement();Ti(n,"bpmn:Participant")&&Ti(i,"bpmn:Process")&&i.children.length&&(t.createConstraints&&(n.width=o.snapValue(n.width,{min:n.width}),n.height=o.snapValue(n.height,{min:n.height})))})}Lp.$inject=["canvas","eventBus","gridSnapping"];function jp(e,t,o){Ba.call(this,e),this._gridSnapping=t;var a=this;this.postExecuted(["connection.create","connection.layout"],3e3,function(e){var t=e.context,n=t.connection,i=t.hints||{},r=n.waypoints;i.connectionStart||i.connectionEnd||3<r.length&&o.updateWaypoints(n,a.snapMiddleSegments(r))})}function Ip(e,t,n){var i=cr(t,n),r={};return"h"===i&&(r.y=e.snapValue(t.y)),"v"===i&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=F({},t,r),n=F({},n,r)),[t,n]}jp.$inject=["eventBus","gridSnapping","modeling"],t(jp,Ba),jp.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=Ip(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var zp={__depends__:[Np,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingCreateParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Op],gridSnappingCreateParticipantBehavior:["type",Lp],gridSnappingLayoutConnectionBehavior:["type",jp]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Cp]};function Fp(e){e.invoke(Io,this)}t(Fp,Io),Fp.$inject=["injector"],Fp.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}Io.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 $p={__depends__:[zo],__init__:["keyboardBindings"],keyboardBindings:["type",Fp]},Gp={moveSpeed:1,moveSpeedAccelerated:10},Hp={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},Vp={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 Wp(e,r,o,a){var s=this;this._config=F({},Gp,e||{}),r.addListener(1500,function(e){var t=e.keyEvent,n=Hp[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=Vp[e](i);o.moveElements(n,r)}}}Wp.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var Up={__depends__:[zo,vo],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Wp]};function qp(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(ht(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)})}qp.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Yp={__init__:["changeSupport"],changeSupport:["type",qp]},Kp=["marker-start","marker-mid","marker-end"],Xp=["circle","ellipse","line","path","polygon","polyline","rect"];function Zp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",function(){M(r._clonedMarkers,function(e){Ae(e)}),r._clonedMarkers={}})}Zp.$inject=["elementRegistry","eventBus","canvas","styles"],Zp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Zp.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=ke(n),r=n.getBoundingClientRect();return this._cloneMarkers(Kt(i)),_e(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ve(t,i),i},Zp.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},Zp.prototype._cloneMarkers=function(o){var e,a=this;if(o.childNodes)for(var t=0;t<o.childNodes.length;t++)a._cloneMarkers(o.childNodes[t]);(e=o,-1!==Xp.indexOf(e.nodeName))&&Kp.forEach(function(e){if(_e(o,e)){var t=(n=o,i=e,r=a._canvas.getContainer(),de("marker#"+_e(n,i).match(/url\(['"]?#([^'"]*)['"]?\)/)[1],r||document));a._cloneMarker(o,t,e)}var n,i,r})},Zp.prototype._cloneMarker=function(e,t,n){var i=t.id,r=this._clonedMarkers[i];if(!r){var o=i+"-clone";(r=ke(t)).id=o,Te(r).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[i]=r;var a=de("defs",this._canvas._svg);a||(a=Ne("defs"),ve(this._canvas._svg,a)),ve(a,r)}_e(e,n,"url(#"+this._clonedMarkers[i].id+")")};var Qp={__init__:["previewSupport"],previewSupport:["type",Zp]};function Jp(e,t,a,n){this._dragging=n,this._rules=t;var s=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=Wr(e);return Ur({top:Yc("top",n,t),right:Yc("right",n,t),bottom:Yc("bottom",n,t),left:Yc("left",n,t)})}(n,o),e.canExecute=s.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=s.computeMinResizeBox(t)),t.resizeConstraints={min:Wr(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){!function(e){var t,n,i=e.shape,r=e.canExecute,o=e.newBounds;if(r){if(o=Hr(o),n=o,(t=i).x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height)return;a.resizeShape(i,o)}}(e.context)})}Jp.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Jp.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}})},Jp.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=Zc(p,e.childrenBoxPadding),i=l,r=t,o=n,a=Wr(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?Wr(o):s,Ur({top:Wc(s.top,c.top),left:Wc(s.left,c.left),bottom:Vc(s.bottom,c.bottom),right:Vc(s.right,c.right)})},Jp.$inject=["eventBus","rules","modeling","dragging"];var el="djs-resizing",tl="resize-not-ok";function nl(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,el)),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(tl):Te(r).add(tl)}),e.on("resize.cleanup",function(e){var t,n;t=e.context,n=t.shape,t.frame&&Ae(t.frame),o.removeMarker(n,el)})}nl.$inject=["eventBus","canvas","previewSupport"];var il="djs-resizer";function rl(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,I(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}rl.prototype.makeDraggable=function(t,e,n){var i=this._resize;function r(e){oo(e)&&i.activate(e,t,n)}re.bind(e,"mousedown",r),re.bind(e,"touchstart",r)},rl.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=Ne("g");Te(a).add(il),Te(a).add(il+"-"+e.id),Te(a).add(il+"-"+r),ve(o,a);var s=Ne("rect");_e(s,{x:-7,y:-7,width:5,height:5}),Te(s).add(il+"-visual"),ve(a,s);var c=Ne("rect");return _e(c,{x:-7,y:-7,width:20,height:20}),Te(c).add(il+"-hit"),ve(a,c),Xt(a,t,n,i),a},rl.prototype.createResizer=function(e,t){var n,i=Wr(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)},rl.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"))},rl.prototype.removeResizers=function(){Pe(this._getResizersParent())},rl.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},rl.$inject=["eventBus","canvas","selection","resize"];var ol={__depends__:[Qa,Wa,Qp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Jp],resizePreview:["type",nl],resizeHandles:["type",rl]};function al(e,t){var n=t.create("bpmn:CategoryValue"),i=t.create("bpmn:Category",{categoryValue:[n]});return gt(e.get("rootElements"),i),Ri(i).$parent=e,Ri(n).$parent=i,n}function sl(e,t,n,i,r,o,a){function s(e,t){(t||ba(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Group"])||cl(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(e){s(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace","popupMenu.open"],function(e){i.isActive()&&i.complete()}),e.on(["commandStack.changed"],function(e){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(e){o.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&s(t)}),e.on("autoPlace.end",500,function(e){s(e.shape)})}function cl(e){return Ti(e,"bpmn:SubProcess")&&!Ai(e)}sl.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],sl.prototype.activate=function(e){var t=Di(e);if(void 0!==t){var n={text:t};F(n,this.getEditingBBox(e));var i={};return(ba(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||cl(e))&&F(i,{centerVertically:!0}),er(e)&&F(i,{autoResize:!0}),Ti(e,"bpmn:TextAnnotation")&&F(i,{resizable:!0,autoResize:!0}),F(n,{options:i}),n}},sl.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};(Ti(e,"bpmn:Lane")||Ti(t=e,"bpmn:Participant")&&Ai(t))&&(F(p,{width:a.height,height:30*l,x:a.x-a.height/2+15*l,y:c-30*l/2}),F(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)"})),(ba(e,["bpmn:Task","bpmn:CallActivity"])||Ti(n=e,"bpmn:Participant")&&!Ai(n)||cl(e))&&(F(p,{width:a.width,height:a.height}),F(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"})),Ti(i=e,"bpmn:SubProcess")&&Ai(i)&&(F(p,{width:a.width,x:a.x}),F(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&&(F(p,{width:g,height:a.height+b+x,x:s-g/2,y:a.y-b}),F(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})),er(o)&&!tr(o)&&!rr(o)){var _=ir(e),E=r.getAbsoluteBBox({x:_.x,y:_.y,width:0,height:0}),w=d+b+x;F(p,{width:g,height:w,x:E.x-g/2,y:E.y-w/2}),F(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})}return Ti(e,"bpmn:TextAnnotation")&&(F(p,{width:a.width,height:a.height,minWidth:30*l,minHeight:10*l}),F(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}},sl.prototype.update=function(e,t,n,i){var r,o,a;if((Ti(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}),Ti(e,"bpmn:Group"))&&!Ri(e).categoryValueRef){var s=al(Ri(this._canvas.getRootElement()).$parent,this._bpmnFactory);Ri(e).categoryValueRef=s}(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var pl="djs-element-hidden",ll="djs-label-hidden";function ul(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(Ti(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,Ri(t).di.get("stroke")||n||"black")}),ve(l,o),ve(h,l),Zt(l,c.x,c.y)}Ti(c,"bpmn:TextAnnotation")||c.labelTarget?a.addMarker(c,pl):(Ti(c,"bpmn:Task")||Ti(c,"bpmn:CallActivity")||Ti(c,"bpmn:SubProcess")||Ti(c,"bpmn:Participant"))&&a.addMarker(c,ll)}),e.on("directEditing.resize",function(e){if(Ti(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,pl),a.removeMarker(c,ll)),p=c=void 0,l&&(Ae(l),l=void 0)})}ul.$inject=["eventBus","canvas","elementRegistry","pathMap"];var hl={__depends__:[Yp,ol,oc],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",sl],labelEditingPreview:["type",ul]},dl=["top","bottom","left","right"];function ml(e,c){function r(e){if(tr(e)){var t=function(e){var t=qr(e.label),n=fl(qr(e),t);if(i=n,-1===dl.indexOf(i))return;var i;var r=(o=e,a=qr(o),[].concat(o.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),o.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return fl(a,e)}));var o,a;if(e.host){var s=function(e){var t,n=e.host,i=Yr(qr(e),n);t=0<=i.indexOf("-")?i.split("-"):[i];return dl.filter(function(e){return-1===t.indexOf(e)})}(e);r=r.concat(s)}var c=dl.filter(function(e){return-1===r.indexOf(e)});return-1===c.indexOf(n)?c[0]:void 0}(e);t&&function(e,t){var n,i=qr(e),r=e.label,o=qr(r),a=Wr(e);switch(t){case"top":n={x:i.x,y:a.top-10-r.height/2};break;case"left":n={x:a.left-10-r.width/2,y:i.y};break;case"bottom":n={x:i.x,y:a.bottom+10+r.height/2};break;case"right":n={x:a.right+10+r.width/2,y:i.y}}var s=Ko(n,o);c.moveShape(r,s)}(e,t)}}Ba.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)})}function fl(e,t){return Yr(t,e,5)}function yl(e,t,n){Ba.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(Ti(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 vl(e,c){Ba.call(this,e),this.preExecute("elements.move",function(e){var t,n,i,r,o,a=e.shapes,s=e.newHost;1===a.length&&(t=a[0],s&&ba(t,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&(i={type:"bpmn:BoundaryEvent",host:s},(n=(o=Ri(t))&&o.eventDefinitions&&o.eventDefinitions[0])&&(i.eventDefinitionType=n.$type),r=c.replaceElement(t,i,{layoutConnection:!1}),e.shapes=[r]))},!0)}function gl(e,r){function o(e){return k(e.attachers,function(e){return Ti(e,"bpmn:BoundaryEvent")})}Ba.call(this,e),this.postExecute("connection.create",function(e){var t=e.context.source,n=e.context.target,i=o(n);Ti(t,"bpmn:EventBasedGateway")&&Ti(n,"bpmn:ReceiveTask")&&0<i.length&&r.removeElements(i)}),this.postExecute("connection.reconnectStart",function(e){var t=e.context.oldSource,n=e.context.newSource;Ti(t,"bpmn:Gateway")&&Ti(n,"bpmn:EventBasedGateway")&&M(n.outgoing,function(e){var t=e.target,n=o(t);Ti(t,"bpmn:ReceiveTask")&&0<n.length&&r.removeElements(n)})})}function bl(e,a,n){Ba.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Ti(t,"bpmn:Lane"))for(;Ti(t=e.topParent=t.parent,"bpmn:Lane")||!Ti(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;(Ti(i,"bpmn:ExclusiveGateway")||Ti(i,"bpmn:InclusiveGateway")||Ti(i,"bpmn:Activity"))&&r.default&&(t=(t=o[r.default])?t.element:void 0,delete n.default,a.updateProperties(n,{default:t}))})},!0)}t(ml,Ba),ml.$inject=["eventBus","modeling"],t(yl,Ba),yl.$inject=["eventBus","elementFactory","bpmnRules"],vl.$inject=["eventBus","bpmnReplace"],t(vl,Ba),gl.$inject=["eventBus","modeling"],t(gl,Ba),bl.$inject=["eventBus","modeling","canvas"],t(bl,Ba);function xl(r,e,o){e.on(["create.hover","create.move","create.end","shape.move.hover","shape.move.move","shape.move.end"],1500,function(e){var t=e.context.shape||e.shape,n=e.hover;Ti(n,"bpmn:Lane")&&!ba(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=np(n),e.hoverGfx=r.getGraphics(e.hover));var i=o.getRootElement();n!==i&&(t.labelTarget||Ti(t,"bpmn:Group"))&&(e.hover=i,e.hoverGfx=r.getGraphics(e.hover))}),e.on(["connect.hover","global-connect.hover"],1500,function(e){var t=e.hover;Ti(t,"bpmn:Lane")&&(e.hover=np(t)||t,e.hoverGfx=r.getGraphics(e.hover))}),e.on(["bendpoint.move.hover"],1500,function(e){var t=e.context.type,n=e.hover;Ti(n,"bpmn:Lane")&&/reconnect/.test(t)&&(e.hover=np(n)||n,e.hoverGfx=r.getGraphics(e.hover))}),e.on(["connect.start"],1500,function(e){var t=e.context,n=t.source;Ti(n,"bpmn:Lane")&&(t.source=np(n)||n)}),e.on("shape.move.start",2e3,function(e){var t=e.shape;Ti(t,"bpmn:Lane")&&(e.shape=np(t)||t)})}function _l(e,t,o,a){Ba.call(this,e),this.preExecute("shape.create",function(e){var t,n=e.shape,i=e.host,r={cancelActivity:!0};i&&Ti(n,"bpmn:IntermediateThrowEvent")&&(r.attachedToRef=i.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:a.create("bpmn:BoundaryEvent",r)},e.shape=o.createShape(t))},!0)}function El(e,i,t){Ba.call(this,e),this.preExecute("shape.create",function(e){var t=e.context.shape;if(Ti(t,"bpmn:DataObjectReference")&&"label"!==t.type){var n=i.create("bpmn:DataObject");t.businessObject.dataObjectRef=n}})}xl.$inject=["elementRegistry","eventBus","canvas"],_l.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],t(_l,Ba),El.$inject=["eventBus","bpmnFactory","moddle"],t(El,Ba);var wl=20,Sl=20,Cl=30;function Tl(l,o,a){Ba.call(this,o),o.on(["create.start","shape.move.start"],2e3,function(e){var t=e.context,n=t.shape,i=l.getRootElement();if(Ti(n,"bpmn:Participant")&&Ti(i,"bpmn:Process")&&i.children.length){var r=i.children.filter(function(e){return!Ti(e,"bpmn:Group")&&!rr(e)&&!e.waypoints});if(r.length){var o,a,s,c,p=ut(r);F(n,(o=n,a={width:(a=p).width+2*wl+Cl,height:a.height+2*Sl},{width:Math.max(o.width,a.width),height:Math.max(o.height,a.height)})),t.createConstraints=(s=n,{bottom:(c=Wr(c=p)).top+s.height/2-Sl,left:c.right-s.width/2+wl,top:c.bottom-s.height/2+Sl,right:c.left+s.width/2-wl-Cl})}}}),o.on("create.start",2e3,function(e){var t=e.context.shape,n=l.getRootElement(),i=l.getGraphics(n);function r(e){e.element=n,e.gfx=i}Ti(t,"bpmn:Participant")&&Ti(n,"bpmn:Process")&&(o.on("element.hover",2e3,r),o.once("create.cleanup",function(){o.off("element.hover",r)}))}),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape,i=e.position,r=l.getRootElement();if(Ti(t,"bpmn:Process")&&Ti(n,"bpmn:Participant")&&!Ti(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)}Tl.$inject=["canvas","eventBus","modeling"],t(Tl,Ba);var Rl="__targetRef_placeholder";function Al(e,r){function u(e,t){var n=e.get("properties"),i=A(n,function(e){return e.name===Rl});return!i&&t&>(n,i=r.create("bpmn:Property",{name:Rl})),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})||vt(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}Ba.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Pl(t)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Pl(t))}function Pl(t){return function(e){if(Ti(e.context.connection,"bpmn:DataInputAssociation"))return t(e)}}function kl(e){this._bpmnUpdater=e}function Ml(i,r,o,e){function a(e){return e.children.filter(function(e){return Ti(e,"bpmn:DataStoreReference")&&!e.labelTarget})}function s(e,t){var n=e.businessObject||e;if(t=t||o.filter(function(e){return Ti(e,"bpmn:Participant")})[0]){var i=t.businessObject||t;r.execute("dataStore.updateContainment",{dataStoreBo:n,newSemanticParent:i.processRef||i,newDiParent:i.di})}}Ba.call(this,e),r.registerHandler("dataStore.updateContainment",kl),this.preExecute("shape.create",function(e){var t=e.context,n=t.shape;Ti(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 Ti(e,"bpmn:DataStoreReference")}).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter(function(e){return!Ti(e,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(e){var t=e.context.shape,n=t.parent;Ti(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Ti(n,"bpmn:Collaboration")&&s(t)}),this.postExecute("shape.move",function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Ti(i,"bpmn:Collaboration")||Ti(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Ti(r,"bpmn:Collaboration")&&s(n,Ti(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Ti(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();ba(t,["bpmn:Participant","bpmn:SubProcess"])&&Ti(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){Ti(i,"bpmn:Process")&&s(e,i)})})}Al.$inject=["eventBus","bpmnFactory"],t(Al,Ba),kl.$inject=["bpmnUpdater"],kl.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)},kl.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)},Ml.$inject=["canvas","commandStack","elementRegistry","eventBus"],t(Ml,Ba);function Dl(e,t,h){Ba.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;Ti(l,"bpmn:Lane")&&(p&&p.nested||(t=l,o=tp(u),a=[],s=[],pt(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 Bl(e,c){Ba.call(this,e),this.preExecute("elements.move",function(e){var t,n,i,r,o,a=e.shapes,s=e.newHost;1===a.length&&(rr(t=a[0])||s||!Ti(t,"bpmn:BoundaryEvent")||(i=(n=(o=Ri(t))&&o.eventDefinitions&&o.eventDefinitions[0])?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:n.$type}:{type:"bpmn:IntermediateThrowEvent"},r=c.replaceElement(t,i,{layoutConnection:!1}),e.shapes=[r]))},!0)}function Nl(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=ns(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,Ol(e,i[i.length-1])||i.push(Ll(o)),Ol(e,r[0])||r.unshift(Ll(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)}Ba.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)&&ns(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 Ol(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 Ll(e){return F({},e)}function jl(e,r){Ba.call(this,e),this.preExecuted("connection.create",function(e){var t=e.context.source,n=e.context.target,i=n.incoming.slice();Ti(t,"bpmn:EventBasedGateway")&&n.incoming.length&&i.filter(Il).forEach(function(e){r.removeConnection(e)})}),this.preExecuted("shape.replace",function(e){var t=e.context.newShape;Ti(t,"bpmn:EventBasedGateway")&&t.outgoing.filter(Il).map(function(e){return e.target}).reduce(function(e,t){var n=t.incoming.filter(Il);return e.concat(n)},[]).forEach(function(e){e.source!==t&&r.removeConnection(e)})})}function Il(e){return Ti(e,"bpmn:SequenceFlow")}function zl(e,o,t,a){function s(){return Ri(t.getRootElement()).$parent}function c(e){var t,n=Ri(e).categoryValueRef,i=n.$parent;n&&(vt(i.categoryValue,n),i&&!i.categoryValue.length&&(t=i,vt(s().get("rootElements"),t)))}Ba.call(this,e),this.executed("shape.delete",function(e){var n,t=e.context.shape;if(Ti(t,"bpmn:Group")){var i=Ri(t).categoryValueRef,r=a.filter(function(e){return Ti(e,"bpmn:Group")});n=i,r.some(function(e){var t=Ri(e);return t.categoryValueRef&&t.categoryValueRef===n})||c(t)}}),this.reverted("shape.delete",function(e){var t=e.context.shape;if(Ti(t,"bpmn:Group")){var n=Ri(t).categoryValueRef,i=s(),r=n?n.$parent:null;gt(r.get("categoryValue"),n),gt(i.get("rootElements"),r)}}),this.execute("shape.create",function(e){var t=e.context.shape,n=Ri(t),i=t.oldBusinessObject;if(Ti(n,"bpmn:Group")&&!n.categoryValueRef){var r=al(s(),o);i&&i.categoryValueRef&&(r.value=i.categoryValueRef.value),n.categoryValueRef=r}}),this.revert("shape.create",function(e){var t=e.context.shape;Ti(t,"bpmn:Group")&&(c(t),delete Ri(t).categoryValueRef)})}function Fl(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 $l(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=Fl(e,t,n,r),s=Fl(e,t,n,o);i=a&&s?Gl(a,n)>Gl(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],qr(t.source)),r(n[n.length-1],n[n.length-2],qr(t.target)))})}function Gl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hl(e){Ba.call(this,e);var n=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(e){var t=Ri(e.context.shape);ba(t,n)&&!t.di.get("isHorizontal")&&t.di.set("isHorizontal",!0)})}function Vl(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wl(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Ul(e,t){var n,i,r,o,a=t[0],s=t[1],c={x:s.x-a.x,y:s.y-a.y},p=(n=[a.x,a.y],i=[c.x,c.y],r=[e.x,e.y],-((o=[{n:n[0]-r[0],lambda:i[0]},{n:n[1]-r[1],lambda:i[1]}])[0].n*i[0]+o[1].n*i[1])/(o[0].lambda*i[0]+o[1].lambda*i[1]));return{x:a.x+p*c.x,y:a.y+p*c.y}}function ql(e,t){return Vl({x:e.x-t.x,y:e.y-t.y})}Dl.$inject=["eventBus","modeling","spaceTool"],t(Dl,Ba),Bl.$inject=["eventBus","bpmnReplace"],t(Bl,Ba),t(Nl,Ba),Nl.$inject=["eventBus","bpmnRules","modeling"],jl.$inject=["eventBus","modeling"],t(jl,Ba),zl.$inject=["eventBus","bpmnFactory","canvas","elementRegistry"],t(zl,Ba),$l.$inject=["eventBus"],Hl.$inject=["eventBus"],t(Hl,Ba);var Yl=Math.sqrt,Kl=Math.min,Xl=Math.max,Zl=Math.abs;function Ql(e){return Math.pow(e,2)}function Jl(e,t){return Yl(Ql(e.x-t.x)+Ql(e.y-t.y))}function eu(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=Yl(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,tu((t=e).x,n.x,i.x)&&tu(t.y,n.y,i.y);var t,n,i})}function tu(e,t,n){return e>=Kl(t,n)-nu&&e<=Xl(t,n)+nu}var nu=.1;function iu(e,t){return Zl(e.x-t.x)<=nu&&Zl(e.y-t.y)<=nu}function ru(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=iu(n=t[m],i=t[m+1])?[n]:(r=Jl(e,n),o=Jl(e,i),eu(n,i,e,Kl(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:iu(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:Jl(n,a)/Jl(n,i)}),p=Jl(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&&ou(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=au(n,p),g=au(t,l),b=c.position,x=(m=b,f=ql((d=v)[0],d[1]),y=ql(d[0],m),0===f?0:y/f),_=(u=g,h=Wl(v),Wl(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=ou(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 Vr({x:o=A+k.x-s.x,y:a=P+k.y-s.y})}function ou(e,t){var n=ql(e[t-1],e[t]);return n/(n+ql(e[t],e[t+1]))}function au(e,t){return[e[t],e[t+1]]}function su(e,t,n){var i=Yo(t),r=Yo(n),o=Ko(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return Vr({x:r.x+a,y:r.y+s})}function cu(e,t,n){var i=Yo(e),r=Yo(t),o=Yo(n),a=Ko(e,i),s=Ko(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 Vr({x:l+a.x-e.x,y:u+a.y-e.y})}var pu={width:90,height:20};function lu(e,l,i,a){Ba.call(this,e),this.postExecute("element.updateProperties",function(e){var t=e.context,n=t.element,i=t.properties;if("name"in i&&l.updateLabel(n,i.name),"text"in i&&Ti(n,"bpmn:TextAnnotation")){var r=a.getTextAnnotationBounds({x:n.x,y:n.y,width:n.width,height:n.height},i.text||"");l.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(er(n)&&Di(n)){var r=ir(n),o=a.getExternalLabelBounds(pu,Di(n));l.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&&l.updateLabel(n,null,null,{removeShape:!1})}),this.postExecute(["label.create"],function(e){var t,n=e.context.shape;n.labelTarget&&Ti(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,i,r,o,a,s,c=e.context.connection.label;c&&(n=e.context,i=n.connection,r=i.label,o=F({},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=ru(r,a,s,o),l.moveShape(c,t))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Ri(n);r&&er(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)}),this.postExecute("shape.resize",function(e){var t,n,i=e.context,r=i.shape,o=i.newBounds,a=i.oldBounds;if(tr(r)){var s=r.label,c=function(e,t){if(!t.length)return;var n=(r=e,i=t,R(i.map(function(e){return{line:e,distance:(t=r,n=e,i=Ul(t,n),Vl({x:i.x-t.x,y:i.y-t.y}))};var t,n,i}),"distance")[0].line);var r,i;return Ul(e,n)}(qr(s),[[{x:(n=a).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),p=Vr(Ko(su(t=c,a,o),t));l.moveShape(s,p)}})}t(lu,Ba),lu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];var uu="flow elements must be children of pools/participants";function hu(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;Ti(t.target,"bpmn:Collaboration")&&Ti(n,"bpmn:FlowNode")&&o(e,r(uu))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,n=t.position,i=t.target;Ti(i,"bpmn:Collaboration")&&o(n,r(uu)),Ti(i,"bpmn:Process")&&o(n,r("participants cannot be pasted onto a non-empty process diagram"),3e3)})}function du(e,h,d,t){Ba.call(this,e);var m=t.get("dragging",!1);function n(e){var t,n,i=e.source,r=e.target;e.parent&&(Ti(e,"bpmn:SequenceFlow")&&(d.canConnectSequenceFlow(i,r)||(n=!0),d.canConnectMessageFlow(i,r)&&(t="bpmn:MessageFlow")),Ti(e,"bpmn:MessageFlow")&&(d.canConnectMessageFlow(i,r)||(n=!0),d.canConnectSequenceFlow(i,r)&&(t="bpmn:SequenceFlow")),Ti(e,"bpmn:Association")&&!d.canConnectAssociation(i,r)&&(n=!0),n&&h.removeConnection(e),t&&h.connect(i,r,{type:t,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",function(e){M(e.closure.allConnections,n)},!0),this.preExecute(["connection.reconnectStart","connection.reconnectEnd"],function(e){var t,n,i=e.context,r=i.connection,o=i.newSource||r.source,a=i.newTarget||r.target;(t=d.canConnect(o,a))&&t.type!==r.type&&(n=h.connect(o,a,{type:t.type,waypoints:r.waypoints.slice()}),h.removeConnection(r),i.connection=n,m&&(s=r,c=n,l=m.context(),u=l&&l.payload.previousSelection,u&&u.length&&-1!==(p=u.indexOf(s))&&u.splice(p,1,c)));var s,c,p,l,u}),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})))&&h.updateProperties(t,{conditionExpression:void 0}),i.conditionExpression&&o.sourceRef.default===o&&h.updateProperties(r.source,{default:void 0})})}function mu(e,n){Ba.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Ti(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 fu(e,t,a,n,i,r){Ba.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=Pi(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})})}hu.$inject=["eventBus","tooltips","translate"],t(du,Ba),du.$inject=["eventBus","modeling","bpmnRules","injector"],mu.$inject=["eventBus","modeling"],t(mu,Ba),t(fu,Ba),fu.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&&Ti(n,"bpmn:BoundaryEvent")&&c.updateAttachment(n,null);var i=r.indexOf(n);r[i]=s.replaceElement(n,t,{select:!1}),o&&Ti(r[i],"bpmn:BoundaryEvent")&&c.updateAttachment(r[i],o)}),e&&t.select(r)},fu.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var yu=Math.abs,vu=Math.min,gu=Math.max;function bu(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function xu(e,t,n){return bu(e,t,n,vu)}function _u(e,t,n){return bu(e,t,n,gu)}var Eu=60,wu=300,Su=20,Cu=50,Tu=20,Ru=20;var Au={width:300,height:150},Pu={width:140,height:120},ku={width:50,height:30};function Mu(e){e.on("resize.start",1500,function(e){var t,n,i,r,o,a,s,c,p,l,u=e.context,h=u.shape,d=u.direction,m=u.balanced;(Ti(h,"bpmn:Lane")||Ti(h,"bpmn:Participant"))&&(u.resizeConstraints=(n=d,i=m,r=np(t=h),a=o=!0,s=ep(r,[r]),c=Wr(t),p={},l={},/e/.test(n)?l.right=c.left+wu:/w/.test(n)&&(l.left=c.right-wu),s.forEach(function(e){var t=Wr(e);/n/.test(n)&&(t.top<c.top-10&&(o=!1),i&&yu(c.top-t.bottom)<10&&_u(p,"top",t.top+Eu),yu(c.top-t.top)<5&&xu(l,"top",t.bottom-Eu)),/s/.test(n)&&(t.bottom>c.bottom+10&&(a=!1),i&&yu(c.bottom-t.top)<10&&xu(p,"bottom",t.bottom-Eu),yu(c.bottom-t.bottom)<5&&_u(l,"bottom",t.top+Eu))}),r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Artifact"))}).forEach(function(e){var t=Wr(e);o&&/n/.test(n)&&xu(l,"top",t.top-Tu),/e/.test(n)&&_u(l,"right",t.right+Su),a&&/s/.test(n)&&_u(l,"bottom",t.bottom+Ru),/w/.test(n)&&xu(l,"left",t.left-Cu)}),{min:l,max:p})),Ti(h,"bpmn:Participant")&&(u.minDimensions=Au),Ti(h,"bpmn:SubProcess")&&Ai(h)&&(u.minDimensions=Pu),Ti(h,"bpmn:TextAnnotation")&&(u.minDimensions=ku)})}Mu.$inject=["eventBus"];function Du(e,o){e.on("resize.start",1501,function(e){var t=e.context,n=t.shape;(Ti(n,"bpmn:Lane")||Ti(n,"bpmn:Participant"))&&(t.balanced=!ao(e))}),e.on("resize.end",1001,function(e){var t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds;if(Ti(n,"bpmn:Lane")||Ti(n,"bpmn:Participant"))return i&&(r=Hr(r),o.resizeLane(n,r,t.balanced)),!1})}function Bu(e,c,p){Ba.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(Ti(o,"bpmn:SequenceFlow")&&Ti(a,"bpmn:SequenceFlow"))if(c.canConnect(o.source,a.target,o)){var s=(n=o.waypoints,i=a.waypoints,(r=Fl(Nu(n[n.length-2]),Nu(n[n.length-1]),Nu(i[1]),Nu(i[0])))?[].concat(n.slice(0,n.length-1),[r],i.slice(1)):[Nu(n[0]),Nu(i[i.length-1])]);p.reconnectEnd(o,a.target,s)}}})}function Nu(e){return e.original||e}function Ou(e,r){Ba.call(this,e),e.on("create.start",function(e){var t=e.context.shape;e.context.hints.shouldAddStartEvent=Ti(t,"bpmn:SubProcess")&&Ai(t)}),this.postExecuted("shape.create",function(e){var t,n=e.context.shape;e.context.hints.shouldAddStartEvent&&(t=Lu(n),r.createShape({type:"bpmn:StartEvent"},t,n))}),this.postExecuted("shape.replace",function(e){var t,n=e.context.oldShape,i=e.context.newShape;Ti(i,"bpmn:SubProcess")&&Ti(n,"bpmn:Task")&&Ai(i)&&(t=Lu(i),r.createShape({type:"bpmn:StartEvent"},t,i))})}function Lu(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}Du.$inject=["eventBus","modeling"],t(Bu,Ba),Bu.$inject=["eventBus","bpmnRules","modeling"],Ou.$inject=["eventBus","modeling"],t(Ou,Ba);function ju(e,h,d,t){Ba.call(this,e),this.executed(["shape.toggleCollapse"],500,function(e){var t,n=e.context.shape;Ti(n,"bpmn:SubProcess")&&(n.collapsed?Ri(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),Ri(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;t.collapsed?Ri(t).di.isExpanded=!1:Ri(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=Zc((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,null,{autoResize:!l.collapsed&&"nwse"})})}function Iu(e,t){Ba.call(this,e),this.preExecute("elements.delete",function(e){M(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}t(ju,Ba),ju.$inject=["eventBus","elementFactory","modeling"],t(Iu,Ba),Iu.$inject=["eventBus","modeling"];function zu(e,t,i){var r;Ba.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 Fu).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||(Ti(t,"bpmn:Lane")&&n.addLane(t),Ti(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function Fu(){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 $u(e,i){Ba.call(this,e),this.preExecute("connection.delete",function(e){var t=e.context.connection,n=t.source;(function(e,t){if(!Ti(e,"bpmn:SequenceFlow"))return!1;var n=Ri(t),i=Ri(e);return n.get("default")===i})(t,n)&&i.updateProperties(n,{default:null})})}zu.$inject=["eventBus","modeling","translate"],t(zu,Ba),t($u,Ba),$u.$inject=["eventBus","modeling"];var Gu={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","attachEventBehavior","boundaryEventBehavior","copyPasteBehavior","fixHoverBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataStoreBehavior","dataInputAssociationBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","toggleElementCollapseBehaviour","subProcessStartEventBehavior","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",ml],appendBehavior:["type",yl],attachEventBehavior:["type",vl],boundaryEventBehavior:["type",gl],copyPasteBehavior:["type",bl],fixHoverBehavior:["type",xl],createBoundaryEventBehavior:["type",_l],createDataObjectBehavior:["type",El],createParticipantBehavior:["type",Tl],dataInputAssociationBehavior:["type",Al],dataStoreBehavior:["type",Ml],deleteLaneBehavior:["type",Dl],detachEventBehavior:["type",Bl],dropOnFlowBehavior:["type",Nl],eventBasedGatewayBehavior:["type",jl],groupBehavior:["type",zl],importDockingFix:["type",$l],isHorizontalFix:["type",Hl],labelBehavior:["type",lu],modelingFeedback:["type",hu],replaceConnectionBehavior:["type",du],removeParticipantBehavior:["type",mu],replaceElementBehaviour:["type",fu],resizeBehavior:["type",Mu],resizeLaneBehavior:["type",Du],removeElementBehavior:["type",Bu],toggleElementCollapseBehaviour:["type",ju],subProcessStartEventBehavior:["type",Ou],unclaimIdBehavior:["type",Iu],updateFlowNodeRefsBehavior:["type",zu],unsetDefaultFlowBehavior:["type",$u]};function Hu(e,t){var n=Yr(e,t,-15);return"intersect"!==n?n:null}function Vu(e){La.call(this,e)}function Wu(e){return!e||rr(e)}function Uu(e){do{if(Ti(e,"bpmn:Process"))return Ri(e);if(Ti(e,"bpmn:Participant"))return Ri(e).processRef||Ri(e)}while(e=e.parent)}function qu(e){return Ti(e,"bpmn:TextAnnotation")}function Yu(e){return Ti(e,"bpmn:Group")&&!e.labelTarget}function Ku(e){return Ti(e,"bpmn:BoundaryEvent")&&Qu(e,"bpmn:CompensateEventDefinition")}function Xu(e){return Ri(e).isForCompensation}function Zu(e){for(var t=e;t=t.parent;){if(Ti(t,"bpmn:FlowElementsContainer"))return Ri(t);if(Ti(t,"bpmn:Participant"))return Ri(t).processRef}return null}function Qu(e,t){return!!A(Ri(e).eventDefinitions||[],function(e){return Ti(e,t)})}function Ju(e,t){return(Ri(e).eventDefinitions||[]).every(function(e){return Ti(e,t)})}function eh(e){return Ti(e,"bpmn:ReceiveTask")||Ti(e,"bpmn:IntermediateCatchEvent")&&(Qu(e,"bpmn:MessageEventDefinition")||Qu(e,"bpmn:TimerEventDefinition")||Qu(e,"bpmn:ConditionalEventDefinition")||Qu(e,"bpmn:SignalEventDefinition"))}function th(e){return e.waypoints}function nh(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function ih(e,t,n){if(Wu(e)||Wu(t))return null;if(!Ti(n,"bpmn:DataAssociation")){if(fh(e,t))return{type:"bpmn:MessageFlow"};if(yh(e,t))return{type:"bpmn:SequenceFlow"}}var i=vh(e,t);return i||(Ku(e)&&Xu(t)?{type:"bpmn:Association",associationDirection:"One"}:!!mh(e,t)&&{type:"bpmn:Association"})}function rh(e,t,n){return!(!rr(e)&&!Yu(e))||!(Ti(t,"bpmn:Participant")&&!Ai(t))&&(Ti(e,"bpmn:Participant")?Ti(t,"bpmn:Process")||Ti(t,"bpmn:Collaboration"):ba(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Ti(e,"bpmn:Lane")?Ti(t,"bpmn:Participant")||Ti(t,"bpmn:Lane"):!(Ti(e,"bpmn:BoundaryEvent")&&(!Ri(i=e).cancelActivity||!sh(i)&&!ch(i)))&&(Ti(e,"bpmn:FlowElement")&&!Ti(e,"bpmn:DataStoreReference")?Ti(t,"bpmn:FlowElementsContainer")?Ai(t):ba(t,["bpmn:Participant","bpmn:Lane"]):ba(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ba(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Ti(e,"bpmn:MessageFlow")&&(Ti(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var i}function oh(e){return Ti(e,"bpmn:Lane")}function ah(e){return!(rr(t=e)||!Ti(t,"bpmn:BoundaryEvent"))||(!(!Ti(e,"bpmn:IntermediateThrowEvent")||!sh(e))||Ti(e,"bpmn:IntermediateCatchEvent")&&ch(e));var t}function sh(e){var t=Ri(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ch(e){return t=e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"].some(function(e){return Qu(t,e)});var t}function ph(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r,o=e[0];return!rr(o)&&(!!ah(o)&&(!Pi(t)&&(!(!Ti(t,"bpmn:Activity")||Xu(t))&&(!(i&&!Hu(i,t))&&((!Ti(r=t,"bpmn:ReceiveTask")||!A(r.incoming,function(e){return Ti(e.source,"bpmn:EventBasedGateway")}))&&"attach")))))}function lh(e,n,i){if(!n)return!1;var r={replacements:[]};return M(e,function(e){var t;Pi(n)||Ti(e,"bpmn:StartEvent")&&"label"!==e.type&&rh(e,n)&&((t=e)&&!1!==Ri(t).isInterrupting||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(ki(e,"bpmn:ErrorEventDefinition")||ki(e,"bpmn:EscalationEventDefinition")||ki(e,"bpmn:CompensateEventDefinition"))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Ti(n,"bpmn:Transaction")||Qu(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Ti(e,"bpmn:EndEvent")&&rh(e,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Ti(e,"bpmn:BoundaryEvent")&&ph(e,n,0,i)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!r.replacements.length&&r}function uh(e,t){return!v(e,oh)&&(!t||e.every(function(e){return rh(e,t)}))}function hh(e,t,n,i){return!!t&&(!(!rr(e)&&!Yu(e))||n!==t&&((!n||!nh(n,t))&&(rh(e,t)||gh(e,t))))}function dh(e,t){return Ti(e,"bpmn:SubProcess")?Ai(e)&&(!t||100<=t.width&&80<=t.height):Ti(e,"bpmn:Lane")?!t||130<=t.width&&60<=t.height:Ti(e,"bpmn:Participant")?!t||250<=t.width&&50<=t.height:!!qu(e)||!!Yu(e)}function mh(e,t){return!th(e)&&!th(t)&&(!(!Ku(e)||!Xu(t))||!nh(t,e)&&!nh(e,t)&&(n=t,i=qu(e),r=qu(n),(i||r)&&i!==r));var n,i,r}function fh(e,t){return!!t.parent&&(Ti(r=e,"bpmn:InteractionNode")&&(!Ti(r,"bpmn:Event")||Ti(r,"bpmn:ThrowEvent")&&Ju(r,"bpmn:MessageEventDefinition"))&&(Ti(i=t,"bpmn:InteractionNode")&&!Xu(i)&&(!Ti(i,"bpmn:Event")||Ti(i,"bpmn:CatchEvent")&&Ju(i,"bpmn:MessageEventDefinition")))&&(n=t,!(Uu(e)===Uu(n))));var n,i,r}function yh(e,t){return!(eh(t)&&0<t.incoming.length&&(t.incoming||[]).some(_h)&&!Ti(e,"bpmn:EventBasedGateway"))&&(Ti(a=e,"bpmn:FlowNode")&&!Ti(a,"bpmn:EndEvent")&&!Pi(a)&&!(Ti(a,"bpmn:IntermediateThrowEvent")&&Qu(a,"bpmn:LinkEventDefinition"))&&!Ku(a)&&!Xu(a)&&(Ti(o=t,"bpmn:FlowNode")&&!Ti(o,"bpmn:StartEvent")&&!Ti(o,"bpmn:BoundaryEvent")&&!Pi(o)&&!(Ti(o,"bpmn:IntermediateCatchEvent")&&Qu(o,"bpmn:LinkEventDefinition"))&&!Xu(o))&&(n=t,i=Zu(e),r=Zu(n),i&&i===r)&&!(Ti(e,"bpmn:EventBasedGateway")&&!eh(t)));var n,i,r,o,a}function vh(e,t){return ba(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ba(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!ba(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!ba(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function gh(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&&(ba(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!rr(t)&&Ti(e,"bpmn:FlowNode")&&!Ti(e,"bpmn:BoundaryEvent")&&rh(e,t.parent))}function bh(e,t){return e&&t&&-1!==e.indexOf(t)}function xh(e,t){return!(Ti(t,"bpmn:Lane")&&!bh(e,t.parent))&&!(Ti(t,"bpmn:BoundaryEvent")&&!bh(e,t.host))}function _h(e){if(e&&e.source)return Ti(e.source,"bpmn:EventBasedGateway")}t(Vu,La),Vu.$inject=["eventBus"],Vu.prototype.init=function(){this.addRule("connection.start",function(e){return function(e){if(Wu(e))return null;return ba(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 ih(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return ih(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return ih(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){return dh(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return ph(n,t,null,i)||lh(n,t,i)||uh(n,t)||gh(n,t)}),this.addRule("shape.create",function(e){return hh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ph(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return xh(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?ih(r,o):ph([n],t,null,i)||hh(n,t,null)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(Ti(t,"bpmn:Collaboration"))return y(n,function(e){return"bpmn:Participant"===e.type});if(Ti(t,"bpmn:Process"))return!(v(n,function(e){return"bpmn:Participant"===e.type})&&0<t.children.length);if(Ti(t,"bpmn:Participant")&&!Ai(t))return!1;if(Ti(t,"bpmn:FlowElementsContainer"))return Ai(t);return ba(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)})},Vu.prototype.canConnectMessageFlow=fh,Vu.prototype.canConnectSequenceFlow=yh,Vu.prototype.canConnectDataAssociation=vh,Vu.prototype.canConnectAssociation=mh,Vu.prototype.canMove=uh,Vu.prototype.canAttach=ph,Vu.prototype.canReplace=lh,Vu.prototype.canDrop=rh,Vu.prototype.canInsert=gh,Vu.prototype.canCreate=hh,Vu.prototype.canConnect=ih,Vu.prototype.canResize=dh,Vu.prototype.canCopy=xh;var Eh={__depends__:[Qa],__init__:["bpmnRules"],bpmnRules:["type",Vu]};function wh(e){Ba.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 Sh(e,o,a){wh.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:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:Process"]}},{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 ba(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&&!ba(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}}}wh.prototype.getOrdering=function(e,t){return null},t(wh,Ba),Sh.$inject=["eventBus","canvas","translate"],t(Sh,wh);var Ch={__depends__:[Zi],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Sh]};function Th(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)}Th.$inject=["eventBus","injector"],Th.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)},Th.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},Th.prototype.clear=function(e){this._stack.length=0,!(this._stackIdx=-1)!==e&&this._fire("changed")},Th.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()}},Th.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()}},Th.prototype.register=function(e,t){this._setHandler(e,t)},Th.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)},Th.prototype.canUndo=function(){return!!this._getUndoAction()},Th.prototype.canRedo=function(){return!!this._getRedoAction()},Th.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Th.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Th.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)})},Th.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},Th.prototype._createId=function(){return this._uid++},Th.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Th.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)},Th.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)},Th.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"))},Th.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=g(e)?e:[e],t.dirty=t.dirty.concat(e))},Th.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Th.prototype._revertedAction=function(e){this._stackIdx--},Th.prototype._getHandler=function(e){return this._handlerMap[e]},Th.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 Rh={commandStack:["type",Th]},Ah=new go("tt");function Ph(e,t){e.style.display=!1===t?"none":""}var kh="djs-tooltip",Mh="."+kh;function Dh(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Ah,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,Mh,"mousedown",function(e){e.stopPropagation()}),ae.bind(this._tooltipRoot,Mh,"mouseover",function(e){r.trigger("mouseover",e)}),ae.bind(this._tooltipRoot,Mh,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Dh.$inject=["eventBus","canvas"],Dh.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},Dh.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(G(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Dh.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Dh.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Dh.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Dh.prototype.remove=function(e){var t=this.get(e);t&&(fe(t.html),fe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Dh.prototype.show=function(){Ph(this._tooltipRoot)},Dh.prototype.hide=function(){Ph(this._tooltipRoot,!1)},Dh.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},Dh.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="'+kh+'" 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)},Dh.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,F(t.style,{left:n+"px",top:i+"px"})},Dh.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),Ph(n,i))})},Dh.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 Bh={__init__:["tooltips"],tooltips:["type",Dh]};function Nh(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 Oh(e,t,n){Ba.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=Lh(n),t.validatedShapes=Lh(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;Nh((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=bt(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&&(gt(i.labels,n,r),n.labelTarget=i)})}function Lh(t){return k(t,function(e){return-1===t.indexOf(e.labelTarget)})}t(Oh,Ba),Oh.$inject=["injector","eventBus","modeling"];var jh={__init__:["labelSupport"],labelSupport:["type",Oh]},Ih="attach-ok";function zh(e,i,r,o,a){Ba.call(this,i);var n=e.get("movePreview",!1);i.on("shape.move.start",1401,function(e){var t,n,i,r,o=e.context,a=o.shapes,s=o.validatedShapes;o.shapes=(n=Fh(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&&i.on("shape.move.start",251,function(e){var t=e.context;M(Fh(t.shapes),function(e){n.makeDraggable(t,e,!0),M(e.labels,function(e){n.makeDraggable(t,e,!0)})})}),n&&i.on("shape.move.start",function(e){var t=e.context.shapes;if(1===t.length){var n=t[0].host;n&&(r.addMarker(n,Ih),i.once(["shape.move.out","shape.move.cleanup"],function(){r.removeMarker(n,Ih)}))}}),this.preExecuted("elements.move",1401,function(e){var t=e.context,n=t.closure;M(Fh(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){a.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){o.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||a.removeConnection(e)}),M(e.incoming.slice(),function(e){o.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||a.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,i=t.host;i&&a.updateAttachment(n,i)}),this.postExecute("shape.replace",function(e){var t=e.context,n=t.oldShape,i=t.newShape;Nh(n.attachers,function(e){"attach"===o.allowed("elements.move",{target:i,shapes:[e]})?a.updateAttachment(e,i):a.removeShape(e)}),i.attachers.length&&M(i.attachers,function(e){var t=cu(e,n,i);a.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=cu(e,i,r);a.moveShape(e,t,e.parent),M(e.labels,function(e){a.moveShape(e,t,e.parent)})})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;Nh(t.attachers,function(e){a.removeShape(e)}),t.host&&a.updateAttachment(t,null)}),i.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){vt(r,t),M(t.labels,function(e){vt(r,t.label)})}),t.attachSupportInitialized=!0}})}function Fh(e){return h(b(e,function(e){return e.attachers||[]}))}t(zh,Ba),zh.$inject=["injector","eventBus","canvas","rules","modeling"];var $h={__depends__:[Qa],__init__:["attachSupport"],attachSupport:["type",zh]};function Gh(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Gh.$inject=["eventBus","dragging"],Gh.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)},Gh.prototype.isActive=function(e){return e&&this._active===e},Gh.prototype.length=function(e){return this._tools.length},Gh.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Gh.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 Hh={__depends__:[Wa],__init__:["toolManager"],toolManager:["type",Gh]};var Vh=Math.abs,Wh=Math.round,Uh="crosshair",qh={x:"width",y:"height"},Yh={x:"y",y:"x"};function Kh(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:Wh(t.dx),y:Wh(t.dy)},s=!(a[Yh[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)})}})}Kh.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"],Kh.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:Uh,autoActivate:t,data:{context:{reactivate:n}}})},Kh.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Uh,data:{context:{}}})},Kh.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},Kh.prototype.initializeMakeSpace=function(e,t){var n=Vh(e.dx)>Vh(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Vh(i)<5)return!1;i<0&&(i*=-1),ao(e)&&(i*=-1);var o=lt(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)}),Vo("resize-"+("x"===n?"ew":"ns")),!0},Kh.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[qh[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}},Kh.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Kh.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var Xh="djs-dragging",Zh="djs-resizing",Qh=Math.max;function Jh(e,u,h,d,m){function f(e,t){M(e,function(e){m.addDragger(e,t),h.addMarker(e,Xh)})}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){Zt(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 o=e.context,t=o.line,n=o.axis,a=o.movingShapes,s=o.resizingShapes;if(o.initialized){if(!o.dragGroup){var i=h.getLayer("space");_e(t=Ne("path"),"d","M0,0 L0,0"),Te(t).add("djs-crosshair"),ve(i,t),o.line=t;var r=Ne("g");_e(r,d.cls("djs-drag-group",["no-events"])),ve(h.getDefaultLayer(),r),f(a,r),f(o.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)}),r),o.dragGroup=r}if(!o.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),n=t.getBBox();p.push({element:t,initialBounds:n}),h.addMarker(e,Zh)}),o.frameGroup=c,o.frames=p}_e(t,{path:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[n],display:""});var l={x:e.dx,y:e.dy};l[{x:"y",y:"x"}[o.axis]]=0,Zt(o.dragGroup,l.x,l.y),M(o.frames,function(e){var t,n,i=e.element,r=e.initialBounds;"e"===o.direction?_e(i,{width:Qh(r.width+l.x,5)}):_e(i,{width:t=Qh(r.width-l.x,5),x:r.x+r.width-t}),"s"===o.direction?_e(i,{height:Qh(r.height+l.y,5)}):_e(i,{height:n=Qh(r.height-l.y,5),y:r.y+r.height-n})})}}),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,Xh)}),M(i,function(e){h.removeMarker(e,Xh)}),a&&(Ae(o),Ae(a)),M(r,function(e){h.removeMarker(e,Zh)}),s&&Ae(s)})}Jh.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var ed={__init__:["spaceToolPreview"],__depends__:[Wa,Qa,Hh,Qp],spaceTool:["type",Kh],spaceToolPreview:["type",Jh]};function td(e){this._model=e}function nd(e,t,i,n){Ba.call(this,e),this._bpmnFactory=t,this._translate=n;var r=this;function o(e){M(e.context.oldRoot.children,function(e){Ti(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;Ti(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"],id(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"],id(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"],id(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],id(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"],id(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],id(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],id(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],id(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],id(function(e){var t=e.context,n=t.connection,i=Ri(n),r=Ri(t.oldSource),o=Ri(t.oldTarget),a=Ri(n.source),s=Ri(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(Ti(s,"bpmn:Activity")||Ti(s,"bpmn:EndEvent")||Ti(s,"bpmn:Gateway")||Ti(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!Ti(a,"bpmn:Activity")&&!Ti(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(Ti(s,"bpmn:Activity")||Ti(s,"bpmn:EndEvent")||Ti(s,"bpmn:Gateway")||Ti(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],id(function(e){var t=e.context,n=t.connection,i=Ri(n),r=Ri(n.source);t.default&&(Ti(r,"bpmn:ExclusiveGateway")||Ti(r,"bpmn:InclusiveGateway")||Ti(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&Ti(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],id(p)),this.reverted(["element.updateAttachment"],id(p))}function id(n){return function(e){var t=e.context;Ti(t.shape||t.connection,"bpmn:BaseElement")&&n(e)}}function rd(e,t,n){Vt.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function od(e,t,n){e[n]=t[n],delete t[n]}function ad(e){this._modeling=e}td.$inject=["moddle"],td.prototype._needsId=function(e){return ba(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","bpmn:CategoryValue"])},td.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},td.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},td.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},td.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",F({bpmnElement:e,bounds:this.createDiBounds(t)},n))},td.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},td.prototype.createDiWaypoints=function(e){var t=this;return b(e,function(e){return t.createDiWaypoint(e)})},td.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},td.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",F({bpmnElement:e},n))},td.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})},t(nd,Ba),nd.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],nd.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},nd.prototype.updateParent=function(e,t){if(!(e instanceof $t||Ti(e,"bpmn:DataStoreReference")&&e.parent&&Ti(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;Ti(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),Ti(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),Ti(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),Ti(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},nd.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof $t?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})},nd.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Ti(n,"bpmn:Lane")&&vt(n.get("flowNodeRef"),e),Ti(t,"bpmn:Lane")&>(t.get("flowNodeRef"),e))},nd.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)},nd.prototype.updateDiParent=function(e,t){if(t&&!Ti(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");e.$parent=t?(n.push(e),t):(vt(n,e),null)}},nd.prototype.getLaneSet=function(e){var t,n;return Ti(e,"bpmn:Lane")?(t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),(e.childLaneSet=t).$parent=e):(Ti(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t))),t},nd.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&!((Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput"))&&(Ti(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(Ti(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Ti(e,"bpmn:FlowElement")){if(t)if(Ti(t,"bpmn:Participant"))t=t.processRef;else if(Ti(t,"bpmn:Lane"))for(;Ti(t=t.$parent.$parent,"bpmn:Lane"););i="flowElements"}else if(Ti(e,"bpmn:Artifact")){for(;t&&!Ti(t,"bpmn:Process")&&!Ti(t,"bpmn:SubProcess")&&!Ti(t,"bpmn:Collaboration");){if(Ti(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Ti(e,"bpmn:MessageFlow"))i="messageFlows";else if(Ti(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!Ti(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(vt(o.get("rootElements"),a),a.$parent=null),t&&(gt(o.get("rootElements"),a),a.$parent=o))}else Ti(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Ti(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&&vt(s=e.$parent.get(i),e),e.$parent=t?((s=t.get(i)).push(e),t):null,n){var c=n.get(i);vt(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},nd.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},nd.prototype.updateConnection=function(e){var t,n=e.connection,i=Ri(n),r=Ri(n.source),o=Ri(n.target);if(Ti(i,"bpmn:DataAssociation"))Ti(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t)):Ti(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=Ti(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(vt(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(vt(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)},nd.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},t(rd,Vt),rd.$inject=["bpmnFactory","moddle","translate"],rd.prototype.baseCreate=Vt.prototype.create,rd.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,F({type:"label"},Qi,t)):this.createBpmnElement(e,t)},rd.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"})),Ti(c,"bpmn:Group")&&(t=F({isFrame:!0},t)),t.colors&&(F(c.di,t.colors),delete t.colors),i=c,r=t,M(["processRef","isInterrupting","associationDirection","isForCompensation"],function(e){void 0!==r[e]&&od(i,r,e)}),t.isExpanded&&od(c.di,t,"isExpanded"),Ti(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=F({businessObject:c,id:c.id},n,t),this.baseCreate(e,t)},rd.prototype._getDefaultSize=function(e){return Ti(e,"bpmn:SubProcess")?Ai(e)?{width:350,height:200}:{width:100,height:80}:Ti(e,"bpmn:Task")?{width:100,height:80}:Ti(e,"bpmn:Gateway")?{width:50,height:50}:Ti(e,"bpmn:Event")?{width:36,height:36}:Ti(e,"bpmn:Participant")?Ai(e)?{width:600,height:250}:{width:400,height:60}:Ti(e,"bpmn:Lane")?{width:400,height:100}:Ti(e,"bpmn:DataObjectReference")?{width:36,height:50}:Ti(e,"bpmn:DataStoreReference")?{width:50,height:50}:Ti(e,"bpmn:TextAnnotation")?{width:100,height:30}:Ti(e,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},rd.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)},ad.$inject=["modeling"],ad.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},ad.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 sd=Math.round;function cd(e){this._canvas=e}function pd(e,t){this._canvas=e,this._modeling=t}function ld(e,t,n){var i=fd(e)[0];return su(i.original||i,n,t)}function ud(e,t,n){var i=fd(e),r=i[i.length-1];return su(r.original||r,n,t)}function hd(e,t,n){return ld(e,t,md(t,n))}function dd(e,t,n){return ud(e,t,md(t,n))}function md(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function yd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function vd(e){this._modeling=e}function gd(e){this._modeling=e,this._helper=new vd(e)}function bd(e){this._modeling=e}function xd(e,t){this._modeling=e,this._rules=t}function _d(e){this._modeling=e}function Ed(e){this._modeling=e}function wd(e){cd.call(this,e)}cd.$inject=["canvas"],cd.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-sd(t.width/2),y:n.y-sd(t.height/2)}),this._canvas.addShape(t,i,r),t},cd.prototype.revert=function(e){this._canvas.removeShape(e.shape)},pd.$inject=["canvas","modeling"],pd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Nh(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),Nh(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),Nh(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},pd.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=bt(i.children,n),t.removeShape(n),n},pd.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return gt(i.children,n,r),t.addShape(n,i),n},yd.prototype.add=function(e,t){return this.addAll([e],t)},yd.prototype.addAll=function(e,t){return F(this,function(e,t,n){p(t)&&(t=!0),P(t)&&(n=t,t=!0);var i=mt((n=n||{}).allShapes),r=mt(n.allConnections),o=mt(n.enclosedElements),a=mt(n.enclosedConnections),s=mt(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 pt(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},vd.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},vd.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&&hd(e,e.source,i),connectionEnd:n&&dd(e,e.target,i)})})},vd.prototype.getClosure=function(e){return(new yd).addAll(e,!0)},gd.$inject=["modeling"],gd.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=vt(o.children,t),gt(i.children,t,r),F(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},gd.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:dd(e,t,n)})}),M(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:hd(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},gd.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return gt(n.children,t,i),F(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},gd.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},gd.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},bd.$inject=["modeling"],bd.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},bd.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;M(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:ud(e,t,n)})}),M(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:ld(e,t,n)})})},bd.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},xd.$inject=["modeling","rules"],xd.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,{layoutConnection:s.layoutConnection})}),M(h,function(e){var t=e.waypoints[0],n=e.target;c("connection.reconnectStart",i,n,e)&&r.reconnectStart(e,i,t,{layoutConnection:s.layoutConnection})})},xd.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;!1!==e.hints.layoutConnection&&(M(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),M(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})})),t.removeShape(n)},xd.prototype.execute=function(e){},xd.prototype.revert=function(e){},xd.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},xd.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},xd.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},_d.$inject=["modeling"],_d.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)},_d.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)},Ed.$inject=["modeling"],Ed.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)})},Ed.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},Ed.prototype.execute=function(e){},Ed.prototype.revert=function(e){},t(wd,cd),wd.$inject=["canvas"];var Sd=cd.prototype.execute;wd.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,Sd.call(this,e)};var Cd=cd.prototype.revert;function Td(e,t){this._canvas=e,this._layouter=t}function Rd(e,t){this._canvas=e,this._modeling=t}function Ad(){}function Pd(e,t){this._layouter=e,this._canvas=t}function kd(){}function Md(e){this._modeling=e}function Dd(e){this._helper=new vd(e)}function Bd(e,t){this._modeling=e,this._elementRegistry=t}function Nd(e){this._modeling=e}wd.prototype.revert=function(e){return e.shape.labelTarget=null,Cd.call(this,e)},Td.$inject=["canvas","layouter"],Td.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},Td.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null},Rd.$inject=["canvas","modeling"],Rd.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=bt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Rd.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,gt(n.children,t,i),this._canvas.addConnection(t,n),t},Ad.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=vt(o.children,t),gt(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},Ad.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return vt(n.children,t),gt(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},Pd.$inject=["layouter","canvas"],Pd.prototype.execute=function(e){var t=e.connection;return F(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pd.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},kd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Md.$inject=["modeling"],Md.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},Md.prototype.postExecute=function(e){var t,n,i=e.connection,r=e.dockingOrPoints,o=e.newSource,a=o?"connectionStart":"connectionEnd",s={};!1!==e.hints.layoutConnection&&(t=g(r)?o?r[0]:r[r.length-1]:r,s[a]=(n=t).original||n,this._modeling.layoutConnection(i,s))},Md.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},Dd.$inject=["modeling"],Dd.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Dd.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)},Bd.$inject=["modeling","elementRegistry"],Bd.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))})},Nd.$inject=["modeling"];var Od={x:"y",y:"x"};function Ld(e,t){this._modeling=e,this._canvas=t}function jd(e){this._modeling=e}function Id(e,t){return vt(e&&e.attachers,t)}function zd(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),gt(i,t,n)}}function Fd(t,e){M(e,function(e){t[e]&&delete t[e]})}function $d(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 Gd(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Nd.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[Od[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[Od[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)}))})},Nd.prototype.postExecute=function(e){},Ld.$inject=["modeling","canvas"],Ld.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)})},Ld.prototype.postExecute=function(e){},jd.$inject=["modeling"],jd.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Id(i,t),zd(n,t),t.host=n,t},jd.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Id(n,t),zd(i,t,r),t},$d.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"],$d.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=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)},Fd(o,["id","parent","delta","host","priority"]),(o=c._createShape(o,i,t,r))&&(p.createdElements[n]={element:o,descriptor:e})}}))})},$d.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)},$d.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})?(Fd(n,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,n,e)):null},$d.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},$d.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element},Gd.$inject=["eventBus","elementFactory","commandStack"],Gd.prototype.getHandlers=function(){return{"shape.append":ad,"shape.create":cd,"shape.delete":pd,"shape.move":gd,"shape.resize":bd,"shape.replace":xd,"shape.toggleCollapse":_d,spaceTool:Ed,"label.create":wd,"connection.create":Td,"connection.delete":Rd,"connection.move":Ad,"connection.layout":Pd,"connection.updateWaypoints":kd,"connection.reconnectStart":Md,"connection.reconnectEnd":Md,"elements.move":Dd,"elements.delete":Bd,"elements.distribute":Nd,"elements.align":Ld,"element.updateAttachment":jd,"elements.paste":$d}},Gd.prototype.registerHandlers=function(n){M(this.getHandlers(),function(e,t){n.registerHandler(t,e)})},Gd.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)},Gd.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Gd.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)},Gd.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)},Gd.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Gd.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},Gd.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},Gd.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},Gd.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},Gd.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Gd.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Gd.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Gd.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Gd.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Gd.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},Gd.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Gd.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Gd.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Gd.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Gd.prototype.reconnectStart=function(e,t,n,i){var r={connection:e,newSource:t,dockingOrPoints:n,hints:i||{}};this._commandStack.execute("connection.reconnectStart",r)},Gd.prototype.reconnectEnd=function(e,t,n,i){var r={connection:e,newTarget:t,dockingOrPoints:n,hints:i||{}};this._commandStack.execute("connection.reconnectEnd",r)},Gd.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Gd.prototype._create=function(e,t){return t instanceof It?t:this._elementFactory.create(e,t)},Gd.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};var Hd="default",Vd="id",Wd={width:0,height:0};function Ud(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function qd(e,t){return Vd in e&&e.id!==t.id}function Yd(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)}))})}Ud.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Ud.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=F({},a),Kd.forEach(function(e){e in a&&(s[e]=Ri(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 qd(u,l)&&(p.unclaim(l.id),c.updateId(t,u.id),p.claim(u.id,l)),Hd in u&&(u[Hd]&&n.push(c.get(u[Hd].id)),l[Hd]&&n.push(c.get(l[Hd].id))),Yd(l,u),e.oldProperties=h,e.changed=n},Ud.prototype.postExecute=function(e){var t=e.element.label,n=t&&Ri(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,Wd)}},Ud.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 Yd(r,i),qd(n,r)&&(a.unclaim(n.id),o.updateId(t,i.id),a.claim(i.id,r)),e.changed};var Kd=["default"];function Xd(e,t){this._canvas=e,this._modeling=t}function Zd(e,t){this._modeling=e,this._spaceTool=t}function Qd(e,t){this._modeling=e,this._translate=t}function Jd(e,t){this._modeling=e,this._spaceTool=t}Xd.$inject=["canvas","modeling"],Xd.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),gt(a.rootElements,i),vt((i.$parent=a).rootElements,o),o.$parent=null,o.di=null,(s.bpmnElement=i).di=s,e.oldRoot=r},Xd.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),vt(o.rootElements,n),n.$parent=null,gt(o.rootElements,r),r.$parent=o,n.di=null,(a.bpmnElement=r).di=a},Zd.$inject=["modeling","spaceTool"],Zd.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=np(i),a=o===i,s=a?i:i.parent;tp(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+30,y:i.y,width:i.width-30,height:i.height},s);var c=[];pt(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)},Qd.$inject=["modeling","translate"],Qd.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=tp(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))},Jd.$inject=["modeling","spaceTool"],Jd.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Jd.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ip(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Jd.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=Wr(e),p=qc(Wr(t),c),l=np(e),u=[],h=[];pt(l,function(e){return u.push(e),(Ti(e,"bpmn:Lane")||Ti(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 em="flowNodeRef",tm="lanes";function nm(e){this._elementRegistry=e}function im(e){this._moddle=e}nm.$inject=["elementRegistry"],nm.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=np(o),i[e.id]||(i[e.id]=ep(e)),i[e.id]).filter(function(e){return t=o,n=Wr(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=np(e);t&&!n[t.id]&&(t.children.filter(function(e){return Ti(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get(tm).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get(em).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},nm.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(tm);e.remove.forEach(function(e){vt(n,e),vt(e.get(em),t)}),e.add.forEach(function(e){gt(n,e),gt(e.get(em),t)})})},nm.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get(tm);e.add.forEach(function(e){vt(n,e),vt(e.get(em),t)}),e.remove.forEach(function(e){gt(n,e),gt(e.get(em),t)})})},im.$inject=["moddle"],im.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},im.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 rm={fill:void 0,stroke:void 0};function om(e){this._commandStack=e}om.$inject=["commandStack"],om.prototype.postExecute=function(e){var t=e.elements,n=e.colors||rm,i=this,r={};"fill"in n&&F(r,{fill:n.fill}),"stroke"in n&&F(r,{stroke:n.stroke}),M(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var am={width:0,height:0};function sm(s,c){function t(e,t){var n,i,r,o=e.label||e,a=e.labelTarget||e;return n=t,i=o.businessObject,(r=Mi(i))&&("categoryValueRef"===r?i.categoryValueRef.value=n:i[r]=n),[o,a]}this.preExecute=function(e){var t=e.element,n=t.businessObject,i=e.newLabel;if(!rr(t)&&er(t)&&!tr(t)&&!cm(i)){var r=ir(t);r={x:r.x,y:r.y+7},s.createLabel(t,r,{id:n.id+"_label",businessObject:n})}},this.execute=function(e){return e.oldLabel=Di(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(rr(n)&&cm(i))!1!==o.removeShape&&s.removeShape(n,{unsetLabel:!1});else if(er(t)||Ti(t,"bpmn:TextAnnotation")){var a=Di(n);a&&(void 0===r&&(r=c.getExternalLabelBounds(n,a)),r&&s.resizeShape(n,r,am))}}}function cm(e){return!e||!e.trim()}function pm(e,t,n,i){Gd.call(this,e,t,n),this._bpmnRules=i}function lm(){}sm.$inject=["modeling","textRenderer"],t(pm,Gd),pm.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pm.prototype.getHandlers=function(){var e=Gd.prototype.getHandlers.call(this);return e["element.updateProperties"]=Ud,e["canvas.updateRoot"]=Xd,e["lane.add"]=Zd,e["lane.resize"]=Jd,e["lane.split"]=Qd,e["lane.updateRefs"]=nm,e["id.updateClaim"]=im,e["element.setColor"]=om,e["element.updateLabel"]=sm,e},pm.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pm.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)},pm.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pm.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pm.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pm.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pm.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pm.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pm.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},pm.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pm.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pm.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},lm.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||qr(t.source||e.source),t.connectionEnd||qr(t.target||e.target)]};var um=20,hm=5,dm=Math.round,mm=20,fm={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ym(e,t,n){var i,r,o,a,s=Yr(t,e,hm),c=n.split(":")[0],p=dm((t.x-e.x)/2+e.x),l=dm((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+um*(/l/.test(c)?-1:1),y:d?l+um:l}):{x:(d=p===e.x)?p+um:p,y:e.y+um*(/t/.test(c)?-1:1)}:{x:p,y:l}),{waypoints:gm(e,i,r).concat(i),directions:r,turnNextDirections:d}}function vm(e){return e.split(":").reverse().join(":")}function gm(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(wm(n)){var o=ym(e,t,n),a={waypoints:(r=ym(t,e,vm(n))).waypoints.slice().reverse(),directions:vm(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:gm(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=dm((t.x-e.x)/2+e.x),r=dm((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 bm(e,t,n,i,r){var o=f(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=Yr(e,t,fm[o]||0),s=function(e,t){if(wm(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||qr(e),i=i||qr(t);var c,p,l,u=s.split(":"),h=Sm(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=Sm(i,t,u[1],a);return(l=gm(c=h,p=d,s)).unshift(c),l.push(p),Cm(l)}function xm(e,t,n,i,r,o){var a,s,c,p,l;return g(n)&&(r=n,o=i,n=qr(e),i=qr(t)),r=r||[],(a=-1!==(o=F({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=Yr(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?_m(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:_m(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=Em(s,c,p,l))?l.reverse():null))?a:(a=o.connectionStart&&Em(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:bm(e,t,n,i,o))}function _m(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 Em(e,t,n,i){if((r=i).length<3||!(4<r.length)&&A(r,function(e,t){var n=r[t-1];return n&&or(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(cr(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.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(pr(e[i],t,mm)||pr(e[i],n,mm))return e.slice(i);return e}(s,e,t))!==s?Em(e,t,n,o):s}function wm(e){return e&&/t|r|b|l/.test(e)}function Sm(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 Cm(i){return i.reduce(function(e,t,n){return ar(e[e.length-1],i[n+1],t,0)||e.push(t),e},[])}var Tm=40;function Rm(){}function Am(e,t){return e?e.original||e:qr(t)}function Pm(e,t){return Ti(t,"bpmn:Activity")&&Ti(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function km(e){return Ti(e,"bpmn:SubProcess")&&Ai(e)}function Mm(e,t){return e===t}t(Rm,lm),Rm.prototype.layoutConnection=function(e,t){var n,i,r,o,a=(t=t||{}).source||e.source,s=t.target||e.target,c=e.waypoints,p=t.connectionStart,l=t.connectionEnd;return p||(p=Am(c&&c[0],a)),l||(l=Am(c&&c[c.length-1],s)),(Ti(e,"bpmn:Association")||Ti(e,"bpmn:DataAssociation"))&&c&&!Pm(a,s)?[].concat([p],c.slice(1,-1),[l]):(Ti(e,"bpmn:MessageFlow")?n={preferredLayouts:["straight","v:v"],preserveDocking:(r=a,o=s,Ti(o,"bpmn:Participant")?"source":Ti(r,"bpmn:Participant")?"target":km(o)?"source":km(r)?"target":Ti(o,"bpmn:Event")?"target":Ti(r,"bpmn:Event")?"source":null)}:(Ti(e,"bpmn:SequenceFlow")||Pm(a,s))&&(n=a===s?{preferredLayouts:["b:l"]}:Ti(a,"bpmn:BoundaryEvent")?{preferredLayouts:function(e,t,n){var i,r,o=qr(e),a=qr(t),s=(d=e,m=d.host,Yr(qr(d),m,-10)),c=Mm(e.host,t),p=(u=s,h=["top","right","bottom","left"],-1!==h.indexOf(u)),l=Yr(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});var u,h;var d,m;if(c)return function(e,t,n,i,r){var o,a=Bm[t?e:Om(e)];o=t?Lm(e)?jm("y",n,i,r)?"h":"b":jm("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(s,p,e,t,n);return S=s,C=l,T=p,i=T?Bm[S]:Mm(Om(S),Om(C))||(R=Nm(S),A=Nm(C),Dm[R]===A)?Bm[Om(S)]:Bm[Nm(S)],f=s,y=l,v=p,r=v?Lm(f)?(_=y,E=Nm(f),w=Dm[E],-1!==_.indexOf(w)||Mm(f,y)?"h":"v"):(g=y,b=Om(f),x=Dm[b],-1!==g.indexOf(x)||Mm(f,y)?"v":"h"):Lm(y)||Mm(Om(f),Om(y))&&Nm(y)?"h":"v",[i+":"+r];var f,y,v,g,b,x,_,E,w;var S,C,T,R,A}(a,s,l)}:Ti(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Ti(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=Cm(xm(a,s,p,l,c,n=F(n,t)))),i||[p,l])};var Dm={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Bm={top:"t",right:"r",bottom:"b",left:"l"};function Nm(e){var t=/right|left/.exec(e);return t&&t[0]}function Om(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Lm(e){return"right"===e||"left"===e}function jm(e,t,n,i){var r=Tm;return!(Im(e,i,n,r)||Im(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Im(e,i,qr(t),r))}function Im(e,t,n,i){return Math.abs(t[e]-n[e])<i}function zm(e){return F({original:e.point.original||e.point},e.actual)}function Fm(e,t){this._elementRegistry=e,this._graphicsFactory=t}Fm.$inject=["elementRegistry","graphicsFactory"],Fm.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(zm(i)),o.push(zm(r)),o},Fm.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}},Fm.prototype._getIntersection=function(e,t,n){return Kr(this._getShapePath(e),this._getConnectionPath(t),n)},Fm.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Fm.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Fm.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var $m={__init__:["modeling","bpmnUpdater"],__depends__:[Gu,Eh,Ch,Ac,Rh,Bh,jh,$h,vo,Yp,ed],bpmnFactory:["type",td],bpmnUpdater:["type",nd],elementFactory:["type",rd],modeling:["type",pm],layouter:["type",Rm],connectionDocking:["type",Fm]},Gm=Math.round;function Hm(e,a,s,c,r){function p(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function n(e,t,n,i){if(P(n)&&(i=n,n=!1),!t.waypoints&&t.parent){var r,o={x:(r=t).x+Gm(r.width/2),y:r.y+Gm(r.height/2)};return a.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:n,data:{shape:t,context:i||{}}}),!0}}e.on("shape.move.start",1500,function(e){var t,n,i=e.context,r=e.shape,o=c.get().slice();-1===o.indexOf(r)&&(o=[r]),n=S(t=o,"id"),F(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=p(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=p(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(!1===i)return!1;n.x=Gm(n.x),n.y=Gm(n.y),0===n.x&&0===n.y||s.moveElements(o,n,t.target,{primaryShape:t.shape,attach:r})}),e.on("element.mousedown",function(e){var t=no(e);if(!t)throw new Error("must supply DOM mousedown event");return n(t,e.element)}),this.start=n}Hm.$inject=["eventBus","dragging","modeling","selection","rules"];var Vm="djs-dragging",Wm="drop-ok",Um="drop-not-ok",qm="new-parent",Ym="attach-ok";function Km(e,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=lt(e,!0),n=b(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return h(t.concat(n))}function u(t,n){[Ym,Wm,Um,qm].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,Vm)}),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,Ym):t.canExecute&&i&&i.id!==r.id?u(i,qm):u(i,t.canExecute?Wm:Um)),Zt(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,Vm)}),i&&Ae(i)}),this.makeDraggable=function(e,t,n){c.addDragger(t,e.dragGroup),n&&a.addMarker(t,Vm),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}Km.$inject=["eventBus","canvas","styles","previewSupport"];var Xm={__depends__:[po,vo,uo,Qa,Wa,Qp],__init__:["move","movePreview"],move:["type",Hm],movePreview:["type",Km]},Zm=".djs-palette-toggle";function Qm(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())})}Qm.$inject=["eventBus","canvas"],Qm.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},Qm.prototype.getEntries=function(){var n={};return M(this._providers,function(e){M(e.getPaletteEntries(),function(e,t){n[t]=e})}),n},Qm.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=se(Qm.HTML_MARKUP),r=this;n.appendChild(i),ae.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(he(t,Zm))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})},Qm.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()})},Qm.prototype._update=function(){var p=de(".djs-palette-entries",this._container),e=this._entries=this.getEntries();K(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||(G(c,"data-action",t),e.title&&G(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()},Qm.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[G(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())},Qm.prototype._layoutChanged=function(){this._toggleState({})},Qm.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Qm.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Qm.prototype.open=function(){this._toggleState({open:!0})},Qm.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Qm.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Qm.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")}})},Qm.prototype.isOpen=function(){return q(this._container).has("open")},Qm.prototype._getParentContainer=function(){return this._canvas.getContainer()},Qm.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Jm={__init__:["palette"],palette:["type",Qm]},ef="crosshair";function tf(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=nf(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=nf(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=nf(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;p(t)}),n.on("element.mousedown",1500,function(e){if(n=no(t=e)||t,oo(t)&&n.shiftKey)return a.activateLasso(e.originalEvent),!0;var t,n})}function nf(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}}tf.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],tf.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ef,data:{context:{}}})},tf.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:ef,data:{context:{}}})},tf.prototype.select=function(e,t){var n,i,r=(n=t,i={},M(e,function(e){var t=e;t.waypoints&&(t=ut(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))},tf.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},tf.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var rf={__depends__:[Hh],__init__:["lassoTool"],lassoTool:["type",tf]};function of(n,i,r,e,t){this._dragging=r;var o=this,a=e.get("keyboard",!1);t.registerTool("hand",{tool:"hand",dragging:"hand.move"}),n.on("element.mousedown",1500,function(e){if(ao(e))return this.activateMove(e.originalEvent),!1},this),a&&a.addListener(1500,function(e){function n(e){o.activateMove(e),window.removeEventListener("mousemove",n)}af(e.keyEvent)&&(o.isActive()||(window.addEventListener("mousemove",n),a.addListener(1500,function e(t){af(t.keyEvent)&&(window.removeEventListener("mousemove",n),a.removeListener(e,"keyboard.keyup"),r.cancel())},"keyboard.keyup")))},"keyboard.keydown"),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!ao(e)&&t&&n.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}function af(e){return Bo(" ",e)}of.$inject=["eventBus","canvas","dragging","injector","toolManager"],of.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||{}}})},of.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},of.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},of.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var sf={__depends__:[Hh],__init__:["handTool"],handTool:["type",of]},cf="connect-ok",pf="connect-not-ok";function lf(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?cf:pf))}),i.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&o.removeMarker(t,n?cf:pf)}),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})}lf.$inject=["eventBus","dragging","connect","canvas","toolManager","rules"],lf.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},lf.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},lf.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},lf.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var uf={__depends__:[Xs,Qa,Wa,Hh],globalConnect:["type",lf]};function hf(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)}hf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],hf.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",p("Create StartEvent")),"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",p("Create EndEvent")),"create.exclusive-gateway":a("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":a("bpmn:Task","activity","bpmn-icon-task",p("Create Task")),"create.data-object":a("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",p("Create DataObjectReference")),"create.data-store":a("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",p("Create DataStoreReference")),"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}},"create.group":a("bpmn:Group","artifact","bpmn-icon-group")}),t};var df={__depends__:[Jm,mc,ed,rf,sf,uf,Zi],__init__:["paletteProvider"],paletteProvider:["type",hf]};function mf(e,c,p,l,u){Ba.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&&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);F(n,{x:i.x,y:i.y});var r=p.createShape(n);l.addShape(r,i.parent);var o=de('[data-element-id="'+ls(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="'+ls(t)+'"]',i.dragGroup);n&&_e(n,{display:"inline"}),e.remove(),r[t]&&delete r[t]})})}mf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],t(mf,Ba);var ff={__depends__:[Qp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",mf]},yf=40,vf=20,gf=20,bf=["x","y"],xf=Math.abs;function _f(e,u){e.on(["connect.hover","connect.move","connect.end"],1250,function(e){var t=e.context,n=t.source,i=t.target;if(!e.originalEvent||!Do(e.originalEvent)){t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition);var r,o,a,s,c,p,l=u.allowed("connection.create",{source:n,target:i});i&&l&&(r=e,a=Ti(o=i,"bpmn:Task")?10:vf,bf.forEach(function(e){var t,n=Sf(e,o);r[e]<o[e]+a?t=o[e]+a:r[e]>o[e]+n-a&&(t=o[e]+n-a),t&&Fs(r,e,t)})),i&&(p=l,v(["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"],function(e){return wf(p,e)}))?(t.sourcePosition=Is(n),ba(i,["bpmn:Event","bpmn:Gateway"])&&Ef(e,Is(i)),Ti(i,"bpmn:Task")&&(s=e,c=i,y(bf,function(e){var t=s[e],n=Sf(e,c);return t>c[e]+gf&&t<c[e]+n-gf})&&Ef(s,Is(c))),Ti(n,"bpmn:BoundaryEvent")&&i===n.host&&function(i,e,t){var r=Is(e),n=Yr(r,t,-10),o=[];/top|bottom/.test(n)&&o.push("x");/left|right/.test(n)&&o.push("y");o.forEach(function(e){var t,n=i[e];xf(n-r[e])<yf&&(t=n>r[e]?r[e]+yf:r[e]-yf,Fs(i,e,t))})}(e,n,i)):wf(l,"bpmn:MessageFlow")?(Ti(n,"bpmn:Event")&&(t.sourcePosition=Is(n)),Ti(i,"bpmn:Event")&&Ef(e,Is(i))):t.sourcePosition=t.initialSourcePosition}})}function Ef(e,t){Fs(e,"x",t.x),Fs(e,"y",t.y)}function wf(e,t){return e&&e.type===t}function Sf(e,t){return"x"===e?t.width:t.height}function Cf(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Tf(e){this._snapValues={}}_f.$inject=["eventBus","rules"],Cf.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cf.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Cf.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cf.prototype.getSnapLocations=function(){return this._snapLocations},Cf.prototype.setSnapLocations=function(e){this._snapLocations=e},Cf.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Tf).initDefaults(this._defaultSnaps),n},Tf.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)},Tf.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],Ns(r-e)<=n)return r}(e[n],r[n],i)},Tf.prototype.initDefaults=function(e){var n=this;M(e||{},function(e,t){M(e,function(e){n.add(t,e)})})};var Rf=1250;function Af(e,a){var s=this;e.on(["create.start","shape.move.start"],function(e){s.initSnap(e)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Rf,function(e){var t=e.context,n=t.shape,i=t.snapContext,r=t.target;if((!e.originalEvent||!Do(e.originalEvent))&&!zs(e)&&r){var o=i.pointsForTarget(r);o.initialized||((o=s.addSnapTargetPoints(o,n,r)).initialized=!0),a.snap(e,o)}}),e.on(["create.cleanup","shape.move.cleanup"],function(){a.hide()})}function Pf(e){return!!e.labelTarget}Af.$inject=["eventBus","snapping"],Af.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new Cf);var r=Is(n,e),o=r.x-n.width/2,a=r.y-n.height/2,s=r.x+n.width/2,c=r.y+n.height/2;return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Pf(n)||(i.setSnapOrigin("top-left",{x:o-e.x,y:a-e.y}),i.setSnapOrigin("bottom-right",{x:s-e.x,y:c-e.y})),i},Af.prototype.addSnapTargetPoints=function(t,n,e){return M(this.getSnapTargets(n,e),function(e){if(Pf(e))Pf(n)&&t.add("mid",Is(e));else if(e.waypoints){if(e.waypoints.length<3)return;M(e.waypoints.slice(1,-1),function(e){t.add("mid",e)})}else{t.add("mid",Is(e))}}),l(n.x)&&l(n.y)&&t.add("mid",Is(n)),t},Af.prototype.getSnapTargets=function(e,t){return $s(t).filter(function(e){return!e.hidden})};function kf(s,e,t){t.invoke(Af,this),e.on(["create.move","create.end"],1500,Mf),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,function(e){var t,n,i,r=e.context,o=r.target,a=r.shape;o&&(t=a,n=o,i=e,"attach"===s.canAttach([t],n,null,i))&&!zs(e)&&function(e,t){var n=Wr(t),i=Hu(e,t);/top/.test(i)?Fs(e,"y",n.top):/bottom/.test(i)&&Fs(e,"y",n.bottom);/left/.test(i)?Fs(e,"x",n.left):/right/.test(i)&&Fs(e,"x",n.right)}(e,o)})}function Mf(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&Fs(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Fs(e,"y",e.y)}}function Df(e,t){return-1!==e.indexOf(t)}t(kf,Af),kf.$inject=["bpmnRules","eventBus","injector"],kf.prototype.initSnap=function(n){var i=Af.prototype.initSnap.call(this,n),e=n.shape;return M(e.outgoing,function(e){var t=e.waypoints[0];t=t.original||t,i.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),M(e.incoming,function(e){var t=e.waypoints[e.waypoints.length-1];t=t.original||t,i.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),Ti(e,"bpmn:Participant")&&i.setSnapLocations(["top-left","bottom-right","mid"]),i},kf.prototype.addSnapTargetPoints=function(n,i,e){Af.prototype.addSnapTargetPoints.call(this,n,i,e);var r=this.getSnapTargets(i,e);return M(r,function(e){var t;(function(e){if(Ti(e,"bpmn:SubProcess")&&Ai(e))return!0;return Ti(e,"bpmn:Participant")}(e)||(t="bpmn:TextAnnotation",[i,e].every(function(e){return Ti(e,t)})))&&(n.add("top-left",Ls(e)),n.add("bottom-right",js(e)))}),M(i.incoming,function(e){Df(r,e.source)||n.add("mid",qr(e.source));var t=e.waypoints[0];n.add(e.id+"-docking",t.original||t)}),M(i.outgoing,function(e){Df(r,e.target)||n.add("mid",qr(e.target));var t=e.waypoints[e.waypoints.length-1];n.add(e.id+"-docking",t.original||t)}),Ti(e,"bpmn:SequenceFlow")&&(n=this.addSnapTargetPoints(n,i,e.parent)),n},kf.prototype.getSnapTargets=function(e,t){return Af.prototype.getSnapTargets.call(this,e,t).filter(function(e){return!Ti(e,"bpmn:Lane")})};function Bf(e,s){var c=this;e.on(["resize.start"],function(e){c.initSnap(e)}),e.on(["resize.move","resize.end"],1250,function(e){var t=e.context,n=t.shape,i=n.parent,r=t.direction,o=t.snapContext;if(!(e.originalEvent&&Do(e.originalEvent)||zs(e))){var a=o.pointsForTarget(i);a.initialized||((a=c.addSnapTargetPoints(a,n,i,r)).initialized=!0),s.snap(e,a)}}),e.on(["resize.cleanup"],function(){s.hide()})}function Nf(e,t){return"nw"===t?Ls(e):"ne"===t?{x:(i=e).x+i.width,y:i.y}:"sw"===t?{x:(n=e).x,y:n.y+n.height}:js(e);var n,i}Bf.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cf);var o=Nf(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Bf.prototype.addSnapTargetPoints=function(t,e,n,i){return M(this.getSnapTargets(e,n),function(e){t.add("corner",js(e)),t.add("corner",Ls(e))}),t.add("corner",Nf(e,i)),t},Bf.$inject=["eventBus","snapping"],Bf.prototype.getSnapTargets=function(n,e){return $s(e).filter(function(e){return!(t=n,e.host===t||e.waypoints||e.hidden||e.labelTarget);var t})};function Of(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}Of.$inject=["canvas"],Of.prototype.snap=function(o,a){var e=o.context.snapContext,t=e.getSnapLocations(),s={x:zs(o,"x"),y:zs(o,"y")};M(t,function(n){var i=e.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];P(t)&&Fs(o,e,t.originValue)})},Of.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){l(e)?_e(n,"horizontal"===t?{d:"M-100000,"+e+" L+100000,"+e,display:""}:{d:"M "+e+",-100000 L "+e+", +100000",display:""}):_e(n,{display:"none"})}}},Of.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Of.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Of.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Of.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};var Lf={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Af],resizeSnapping:["type",Bf],snapping:["type",Of]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",_f],createMoveSnapping:["type",kf]};function jf(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(jf.BOX_HTML),this._searchInput=de(jf.INPUT_SELECTOR,this._container),this._resultsContainer=de(jf.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function If(e,t,n){var i,r=(i="",t.forEach(function(e){e.matched?i+='<strong class="'+jf.RESULT_HIGHLIGHT_CLASS+'">'+hs(e.matched)+"</strong>":i+=hs(e.normal)}),""!==i?i:null),o=se(n);o.innerHTML=r,e.appendChild(o)}jf.$inject=["canvas","eventBus","overlays","selection"],jf.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,jf.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),e(this._container,jf.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),r._scrollToNode(e.delegateTarget),r._preselect(e.delegateTarget)}),e(this._container,jf.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),r._select(e.delegateTarget)}),e(this._container,jf.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),e(this._container,jf.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()})},jf.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ae.unbind(e.el,e.type,e.listener)})},jf.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(jf.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(n),this._preselect(n)}}},jf.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},jf.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)}},jf.prototype._clearResults=function(){K(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},jf.prototype._getCurrentResult=function(){return de(jf.RESULT_SELECTED_SELECTOR,this._resultsContainer)},jf.prototype._createResultNode=function(e,t){var n=se(jf.RESULT_HTML);return 0<e.primaryTokens.length&&If(n,e.primaryTokens,jf.RESULT_PRIMARY_HTML),If(n,e.secondaryTokens,jf.RESULT_SECONDARY_HTML),G(n,jf.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},jf.prototype.registerProvider=function(e){this._searchProvider=e},jf.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"))},jf.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"))},jf.prototype.toggle=function(){this.isOpen()?this.close():this.open()},jf.prototype.isOpen=function(){return this._open},jf.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&q(t).remove(jf.RESULT_SELECTED_CLASS);var n=G(e,jf.RESULT_ID_ATTRIBUTE),i=this._results[n].element;q(e).add(jf.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},jf.prototype._select=function(e){var t=G(e,jf.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)},jf.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=ut(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)},jf.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=ut(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="'+jf.OVERLAY_CLASS+'"></div>'});this._overlayId=this._overlays.add(e,n)}var i,r,o,a},jf.CONTAINER_SELECTOR=".djs-search-container",jf.INPUT_SELECTOR=".djs-search-input input",jf.RESULTS_CONTAINER_SELECTOR=".djs-search-results",jf.RESULT_SELECTOR=".djs-search-result",jf.RESULT_SELECTED_SELECTOR="."+(jf.RESULT_SELECTED_CLASS="djs-search-result-selected"),jf.RESULT_ID_ATTRIBUTE="data-result-id",jf.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",jf.OVERLAY_CLASS="djs-search-overlay",jf.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>',jf.RESULT_HTML='<div class="djs-search-result"></div>',jf.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',jf.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var zf={__depends__:[So,vo],searchPad:["type",jf]};function Ff(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function $f(e){return 0<k(e,function(e){return!!e.matched}).length}function Gf(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}Ff.$inject=["elementRegistry","searchPad","canvas"],Ff.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:Gf(Di(e),t),secondaryTokens:Gf(e.id,t),element:e}}),function(e){return $f(e.primaryTokens)||$f(e.secondaryTokens)}),function(e){return Di(e.element)+e.element.id})};var Hf={__depends__:[zf],__init__:["bpmnSearch"],bpmnSearch:["type",Ff]};function Vf(e){Mo.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(Vf,Mo),Vf.Viewer=Mo,Vf.NavigatedViewer=ra,Vf.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)},Vf.prototype._createModdle=function(e){var t=Mo.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Vf.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},Vf.prototype._modules=[].concat(Vf.prototype._modules,Vf.prototype._interactionModules=[Go,Zo,ha,ia],Vf.prototype._modelingModules=[ga,Da,Xa,za,Ws,Xs,Qs,ap,dp,mc,gp,Sp,zp,$p,Up,hl,$m,Xm,df,ff,ol,Lf,Hf]),Vf});
|