camunda-bpmn-js 0.13.0-alpha.3 → 0.13.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BpmnModeler=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}function n(e){var t={exports:{}};return e(t,t.exports),t.exports}var r=n((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var r=Math.log(Math.pow(2,e))/Math.log(n),i=2;r===1/0;i*=2)r=Math.log(Math.pow(2,e/i))/Math.log(n)*i;var o=r-Math.floor(r),a="";for(i=0;i<Math.floor(r);i++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var p=parseInt(a,n);return p!==1/0&&p>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,r){var i=function(i){var a=0;do{if(a++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=n||16,i}}));function o(e){if(!(this instanceof o))return new o(e);e=e||[128,36,1],this._seed=e.length?i.rack(e[0],e[1],e[2]):e}function a(e){return Array.prototype.concat.apply([],e)}o.prototype.next=function(e){return this._seed(e||!0)},o.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(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 s=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function l(e){return void 0===e}function c(e){return void 0!==e}function u(e){return null==e}function d(e){return"[object Array]"===s.call(e)}function h(e){return"[object Object]"===s.call(e)}function m(e){return"[object Number]"===s.call(e)}function f(e){var t=s.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function y(e){return"[object String]"===s.call(e)}function g(e){if(!d(e))throw new Error("must supply array")}function v(e,t){return p.call(e,t)}function b(e,t){var n;return t=B(t),_(e,(function(e,r){if(t(e,r))return n=e,!1})),n}function x(e,t){t=B(t);var n=d(e)?-1:void 0;return _(e,(function(e,r){if(t(e,r))return n=r,!1})),n}function w(e,t){var n=[];return _(e,(function(e,r){t(e,r)&&n.push(e)})),n}function _(e,t){var n;if(!l(e)){var r=d(e)?L:I;for(var i in e)if(v(e,i)&&!1===t(n=e[i],r(i)))return n}}function E(e,t){return l(e)?[]:(g(e),t=B(t),e.filter((function(e,n){return!t(e,n)})))}function P(e,t,n){return _(e,(function(e,r){n=t(n,e,r)})),n}function O(e,t){return!!P(e,(function(e,n,r){return e&&t(n,r)}),!0)}function S(e,t){return!!b(e,t)}function k(e,t){var n=[];return _(e,(function(e,r){n.push(t(e,r))})),n}function C(e){return e&&Object.keys(e)||[]}function T(e){return C(e).length}function M(e){return k(e,(function(e){return e}))}function A(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=N(t),_(e,(function(e){var r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function R(e){e=N(e);for(var t={},n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];_(r,(function(n){return A(n,e,t)}));var o=k(t,(function(e,t){return e[0]}));return o}var D=R;function z(e,t){t=N(t);var n=[];return _(e,(function(e,r){for(var i=t(e,r),o={d:i,v:e},a=0;a<n.length;a++){if(i<n[a].d)return void n.splice(a,0,o)}n.push(o)})),k(n,(function(e){return e.v}))}function j(e){return function(t){return O(e,(function(e,n){return t[n]===e}))}}function N(e){return f(e)?e:function(t){return t[e]}}function B(e){return f(e)?e:function(t){return t===e}}function I(e){return e}function L(e){return Number(e)}function $(e,t){var n,r,i,o;function a(n){var a=Date.now(),l=n?0:o+t-a;if(l>0)return s(l);e.apply(i,r),p()}function s(e){n=setTimeout(a,e)}function p(){n&&clearTimeout(n),n=o=r=i=void 0}function l(){o=Date.now();for(var e=arguments.length,a=new Array(e),p=0;p<e;p++)a[p]=arguments[p];r=a,i=this,n||s(t)}return l.flush=function(){n&&a(!0),p()},l.cancel=p,l}function F(e,t){return e.bind(t)}function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function q(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return H.apply(void 0,[e].concat(n))}function U(e,t,n){var r=e;return _(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+V(e)+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");var o=t[i+1],a=r[e];c(o)&&u(a)&&(a=r[e]=isNaN(+o)?{}:[]),l(o)?l(n)?delete r[e]:r[e]=n:r=a})),e}function G(e,t,n){var r=e;return _(t,(function(e){if(u(r))return r=void 0,!1;r=r[e]})),l(r)?n:r}function W(e,t){var n={},r=Object(e);return _(t,(function(t){t in r&&(n[t]=e[t])})),n}function K(e,t){var n={};return _(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}var X=Object.freeze({__proto__:null,assign:q,bind:F,debounce:$,ensureArray:g,every:O,filter:w,find:b,findIndex:x,flatten:a,forEach:_,get:G,groupBy:A,has:v,isArray:d,isDefined:c,isFunction:f,isNil:u,isNumber:m,isObject:h,isString:y,isUndefined:l,keys:C,map:k,matchPattern:j,merge:function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.length?(_(r,(function(n){n&&h(n)&&_(n,(function(n,r){if("__proto__"!==r){var i=t[r];h(n)?(h(i)||(i={}),t[r]=e(i,n)):t[r]=n}}))})),t):t},omit:K,pick:W,reduce:P,set:U,size:T,some:S,sortBy:z,throttle:function(e,t){var n=!1;return function(){n||(e.apply(void 0,arguments),n=!0,setTimeout((function(){n=!1}),t))}},unionBy:D,uniqueBy:R,values:M,without:E});function Y(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var Z=[].indexOf,J=function(e,t){if(Z)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},Q=/\s+/,ee=Object.prototype.toString;function te(e){return new ne(e)}function ne(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function re(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}ne.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~J(t,e)||t.push(e),this.el.className=t.join(" "),this},ne.prototype.remove=function(e){if("[object RegExp]"==ee.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=J(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},ne.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},ne.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},ne.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Q);return""===e[0]&&e.shift(),e},ne.prototype.has=ne.prototype.contains=function(e){return this.list?this.list.contains(e):!!~J(this.array(),e)};var ie="undefined"!=typeof Element?Element.prototype:{},oe=ie.matches||ie.matchesSelector||ie.webkitMatchesSelector||ie.mozMatchesSelector||ie.msMatchesSelector||ie.oMatchesSelector,ae=function(e,t){if(!e||1!==e.nodeType)return!1;if(oe)return oe.call(e,t);for(var n=e.parentNode.querySelectorAll(t),r=0;r<n.length;r++)if(n[r]==e)return!0;return!1};function se(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(ae(r,t))return r;r=r.parentNode}return ae(r,t)?r:null}var pe=window.addEventListener?"addEventListener":"attachEvent",le=window.removeEventListener?"removeEventListener":"detachEvent",ce="addEventListener"!==pe?"on":"",ue={bind:function(e,t,n,r){return e[pe](ce+t,n,r||!1),n},unbind:function(e,t,n,r){return e[le](ce+t,n,r||!1),n}},de=["focus","blur"];var he,me={bind:function(e,t,n,r,i){return-1!==de.indexOf(n)&&(i=!0),ue.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=se(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==de.indexOf(t)&&(r=!0),ue.unbind(e,t,n,r)}},fe=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,o=ge[r]||ge._default,a=o[0],s=o[1],p=o[2];(i=t.createElement("div")).innerHTML=s+e+p;for(;a--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var l=t.createDocumentFragment();for(;i.firstChild;)l.appendChild(i.removeChild(i.firstChild));return l},ye=!1;"undefined"!=typeof document&&((he=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',ye=!he.getElementsByTagName("link").length,he=void 0);var ge={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:ye?[1,"X<div>","</div>"]:[0,"",""]};function ve(e,t){return(t=t||document).querySelector(e)}function be(e,t){return(t=t||document).querySelectorAll(e)}function xe(e){e.parentNode&&e.parentNode.removeChild(e)}function we(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 _e(e,t){return we(t,e),e}ge.td=ge.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],ge.option=ge.optgroup=[1,'<select multiple="multiple">',"</select>"],ge.thead=ge.tbody=ge.colgroup=ge.caption=ge.tfoot=[1,"<table>","</table>"],ge.polyline=ge.ellipse=ge.polygon=ge.circle=ge.text=ge.line=ge.path=ge.rect=ge.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Ee={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":2,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Pe(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Ee[r];i?(2===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function Oe(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return Ee[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);Pe(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Pe(e,r,t[r])}(e,t);return e}function Se(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 ke=/\s+/,Ce=Object.prototype.toString;function Te(e){return void 0!==e}function Me(e){return new Ae(e)}function Ae(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Re(e){var t=e.parentNode;return t&&t.removeChild(e),e}function De(e){for(var t;t=e.firstChild;)Re(t);return e}function ze(e){return e.cloneNode(!0)}Ae.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Se(t,e)||t.push(e),Te(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Ae.prototype.remove=function(e){if("[object RegExp]"===Ce.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Se(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Ae.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},Ae.prototype.toggle=function(e,t){return this.list?(Te(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Te(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Ae.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(ke);return""===e[0]&&e.shift(),e},Ae.prototype.has=Ae.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Se(this.array(),e)};var je="http://www.w3.org/2000/svg",Ne='<svg xmlns="'+je+'"';function Be(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(je)&&(e=Ne+e.substring(4)):(e=Ne+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function Ie(e,t){var n;return"<"===e.charAt(0)?(n=Be(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(je,e),t&&Oe(n,t),n}var Le=Ie("svg");function $e(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function Fe(e){return e?Le.createSVGTransformFromMatrix(e):Le.createSVGTransform()}var Ve=/([&<>]{1})/g,He=/([\n\r"]{1})/g,qe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Ue(e,t){return e.replace(t,(function(e,t){return qe[t]||t}))}function Ge(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Ue(e.textContent,Ve));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,r=(i=e.attributes).length;n<r;++n)o=i.item(n),t.push(" ",o.name,'="',Ue(o.value,He),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(a=e.childNodes).length;n<r;++n)Ge(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Ue(e.nodeValue,Ve),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function We(e,t){var n=Be(t);if(De(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var r,i=(r=n.childNodes,Array.prototype.slice.call(r)),o=0;o<i.length;o++)we(i[o],e)}}function Ke(e,t){if(void 0!==t){try{We(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)Ge(t,n),t=t.nextSibling;return n.join("")}(e)}function Xe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ye(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,r;for(e.clear(),n=0;r=t[n];n++)e.appendItem(Xe(e,r))}(n,t)),n.consolidate()}var Ze=/^class /;function Je(e){return"[object Array]"===Object.prototype.toString.call(e)}function Qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function et(){var e=Array.prototype.slice.call(arguments);1===e.length&&Je(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var tt=/constructor\s*[^(]*\(\s*([^)]*)\)/m,nt=/^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m,rt=/\/\*([^*]*)\*\//m;function it(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return Ze.test(e.toString())}(e)?tt:nt);return t&&t[1]&&t[1].split(",").map((function(e){return(t=e.match(rt))?t[1].trim():e.trim()}))||[]}function ot(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}function at(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'+e+'"!')}};var n=[],r=this._providers=Object.create(t._providers||null),i=this._instances=Object.create(null),o=i.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?e+" (Resolving: "+t+")":e)},s=function(e,o){if(!r[e]&&-1!==e.indexOf(".")){for(var p=e.split("."),l=s(p.shift());p.length;)l=l[p.shift()];return l}if(Qe(i,e))return i[e];if(Qe(r,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),i[e]=r[e][0](r[e][1]),n.pop(),i[e]}return t.get(e,o)},p=function(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Je(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=et(e.slice())}return{fn:e,dependencies:(e.$inject||it(e)).map((function(e){return Qe(t,e)?t[e]:s(e)}))}},l=function(e){var t=p(e),n=t.fn,r=t.dependencies;return new(Function.prototype.bind.apply(n,[null].concat(r)))},c=function(e,t,n){var r=p(e,n),i=r.fn,o=r.dependencies;return i.apply(t,o)},u=function(e){return et((function(t){return e.get(t)}))},d={factory:c,type:l,value:function(e){return e}};e.forEach((function(e){function t(e,t){return"value"!==e&&Je(t)&&(t=et(t.slice())),t}if(e instanceof ot)e.forEach((function(e){var n=e[0],i=e[1],o=e[2];r[n]=[d[i],t(i,o),i]}));else if("object"==typeof e)if(e.__exports__){var n=Object.keys(e).reduce((function(t,n){return"__"!==n.substring(0,2)&&(t[n]=e[n]),t}),Object.create(null)),i=new at((e.__modules__||[]).concat([n]),o),a=et((function(e){return i.get(e)}));e.__exports__.forEach((function(e){r[e]=[a,e,"private",i]}))}else Object.keys(e).forEach((function(n){if("private"!==e[n][2]){var i=e[n][0],o=e[n][1];r[n]=[d[i],t(i,o),i]}else r[n]=e[n]}))})),this.get=s,this.invoke=c,this.instantiate=l,this.createChild=function(e,t){if(t&&t.length){var n,i,a,s,p=Object.create(null),l=Object.create(null),c=[],d=[],h=[];for(var m in r)n=r[m],-1!==t.indexOf(m)&&("private"===n[2]?-1===(i=c.indexOf(n[3]))?(a=n[3].createChild([],t),s=u(a),c.push(n[3]),d.push(a),h.push(s),p[m]=[s,m,"private",a]):p[m]=[h[i],m,"private",d[i]]:p[m]=[n[2],n[1]],l[m]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(e){-1!==n[1].$scope.indexOf(e)&&(p[m]=[n[2],n[1]],l[e]=!0)}));t.forEach((function(e){if(!l[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(p)}return new at(e,o)}}function st(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,a=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,a):n.drawConnection(o,i,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function pt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function lt(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function ct(e,t){var n=Ie("polyline");return Oe(n,{points:lt(e)}),t&&Oe(n,t),n}function ut(e){return w(e,(function(t){return!b(e,(function(e){return e!==t&&dt(t,e)}))}))}function dt(e,t){if(t){if(e===t)return t;if(e.parent)return dt(e.parent,t)}}function ht(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function mt(e,t,n){n=n||0,d(e)||(e=[e]),_(e,(function(e,r){var i=t(e,r,n);d(i)&&i.length&&mt(i,t,n+1)}))}function ft(e,t){return function(e,t,n){var r=[],i=[];return mt(e,(function(e,o,a){ht(r,e,t);var s=e.children;if((-1===n||a<n)&&s&&ht(i,s,t))return s})),r}(e,!t,-1)}function yt(e,t){var n,r,i,o;return t=!!t,d(e)||(e=[e]),_(e,(function(e){var a=e;e.waypoints&&!t&&(a=yt(e.waypoints,!0));var s=a.x,p=a.y,l=a.height||0,c=a.width||0;(s<n||void 0===n)&&(n=s),(p<r||void 0===r)&&(r=p),(s+c>i||void 0===i)&&(i=s+c),(p+l>o||void 0===o)&&(o=p+l)})),{x:n,y:r,height:o-r,width:i-n}}function gt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function vt(e){return!(!e||!e.isFrame)}function bt(e,t){return q({},e||{},t||{})}st.prototype.canRender=function(){},st.prototype.drawShape=function(){},st.prototype.drawConnection=function(){},st.prototype.getShapePath=function(){},st.prototype.getConnectionPath=function(){};function xt(e,t){st.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})}r(xt,st),xt.prototype.canRender=function(){return!0},xt.prototype.drawShape=function(e,t,n){var r=Ie("rect");return Oe(r,{x:0,y:0,width:t.width||0,height:t.height||0}),vt(t)?Oe(r,q({},this.FRAME_STYLE,n||{})):Oe(r,q({},this.SHAPE_STYLE,n||{})),_e(e,r),r},xt.prototype.drawConnection=function(e,t,n){var r=ct(t.waypoints,q({},this.CONNECTION_STYLE,n||{}));return _e(e,r),r},xt.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return pt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},xt.prototype.getConnectionPath=function(e){var t,n,r=e.waypoints,i=[];for(t=0;n=r[t];t++)n=n.original||n,i.push([0===t?"M":"L",n.x,n.y]);return pt(i)},xt.$inject=["eventBus","styles"];var wt={__init__:["defaultRenderer"],defaultRenderer:["type",xt],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return q(this.style(t,n),{class:e})},this.style=function(t,n){d(t)||n||(n=t,t=[]);var r=P(t,(function(t,n){return q(t,e[n]||{})}),{});return n?q(r,n):r},this.computeStyle=function(e,n,r){return d(n)||(r=n,n=[]),t.style(n||[],q({},r,e||{}))}}]};function _t(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Et(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var r=e.indexOf(t);if(-1!==r){if(r===n)return;if(-1===n)return;e.splice(r,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Pt(e,t){return e&&t?e.indexOf(t):-1}function Ot(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function St(e,t,n,r){if(void 0===r&&(r=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Ot(e,t);return Math.abs(i/o)<=r}function kt(e,t){var n;return function(e,t){var n;n=d(e)?e:[e,t];var r=n.slice().shift();return O(n,(function(e){return Math.abs(r.y-e.y)<=2}))}(n=d(e)?e:[e,t])?"h":!!function(e,t){var n;n=d(e)?e:[e,t];var r=n.slice().shift();return O(n,(function(e){return Math.abs(r.x-e.x)<=2}))}(n)&&"v"}function Ct(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 Tt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Mt=/,?([a-z]),?/gi,At=parseFloat,Rt=Math,Dt=Rt.PI,zt=Rt.min,jt=Rt.max,Nt=Rt.pow,Bt=Rt.abs,It=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Lt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,$t=Array.isArray||function(e){return e instanceof Array};function Ft(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Vt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Ft(e,n)&&(t[n]=Vt(e[n]));return t}function Ht(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function qt(e){var t=qt.ps=qt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Ft(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Ut(e,t,n,r){return 1===arguments.length&&(t=e.y,n=e.width,r=e.height,e=e.x),{x:e,y:t,width:n,height:r,x2:e+n,y2:t+r}}function Gt(){return this.join(",").replace(Mt,"$1")}function Wt(e){var t=Vt(e);return t.toString=Gt,t}function Kt(e,t,n,r,i,o,a,s,p){var l=1-p,c=Nt(l,3),u=Nt(l,2),d=p*p*p,h=c*t+3*u*p*r+3*l*p*p*o+d*s;return{x:en(c*e+3*u*p*n+3*l*p*p*i+d*a),y:en(h)}}function Xt(e){var t=pn.apply(null,e);return Ut(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yt(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Zt(e,t,n,r,i){return e*(e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r)-3*t+3*n}function Jt(e,t,n,r,i,o,a,s,p){null==p&&(p=1);for(var l=(p=p>1?1:p<0?0:p)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<12;h++){var m=l*c[h]+l,f=Zt(m,e,n,i,a),y=Zt(m,t,r,o,s),g=f*f+y*y;d+=u[h]*Rt.sqrt(g)}return l*d}function Qt(e,t,n,r,i,o,a,s){if(!(jt(e,n)<zt(i,a)||zt(e,n)>jt(i,a)||jt(t,r)<zt(o,s)||zt(t,r)>jt(o,s))){var p=(e*r-t*n)*(o-s)-(t-r)*(i*s-o*a),l=(e-n)*(o-s)-(t-r)*(i-a);if(l){var c=en(((e*r-t*n)*(i-a)-(e-n)*(i*s-o*a))/l),u=en(p/l),d=+c.toFixed(2),h=+u.toFixed(2);if(!(d<+zt(e,n).toFixed(2)||d>+jt(e,n).toFixed(2)||d<+zt(i,a).toFixed(2)||d>+jt(i,a).toFixed(2)||h<+zt(t,r).toFixed(2)||h>+jt(t,r).toFixed(2)||h<+zt(o,s).toFixed(2)||h>+jt(o,s).toFixed(2)))return{x:c,y:u}}}}function en(e){return Math.round(1e11*e)/1e11}function tn(e,t,n){if(!function(e,t){return e=Ut(e),Yt(t=Ut(t),e.x,e.y)||Yt(t,e.x2,e.y)||Yt(t,e.x,e.y2)||Yt(t,e.x2,e.y2)||Yt(e,t.x,t.y)||Yt(e,t.x2,t.y)||Yt(e,t.x,t.y2)||Yt(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(Xt(e),Xt(t)))return n?0:[];for(var r=Jt.apply(0,e),i=Jt.apply(0,t),o=rn(e)?1:~~(r/5)||1,a=rn(t)?1:~~(i/5)||1,s=[],p=[],l={},c=n?0:[],u=0;u<o+1;u++){var d=Kt.apply(0,e.concat(u/o));s.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<a+1;u++)d=Kt.apply(0,t.concat(u/a)),p.push({x:d.x,y:d.y,t:u/a});for(u=0;u<o;u++)for(var h=0;h<a;h++){var m,f=s[u],y=s[u+1],g=p[h],v=p[h+1],b=Bt(y.x-f.x)<.01?"y":"x",x=Bt(v.x-g.x)<.01?"y":"x",w=Qt(f.x,f.y,y.x,y.y,g.x,g.y,v.x,v.y);if(w){if(l[m=w.x.toFixed(9)+"#"+w.y.toFixed(9)])continue;l[m]=!0;var _=f.t+Bt((w[b]-f[b])/(y[b]-f[b]))*(y.t-f.t),E=g.t+Bt((w[x]-g[x])/(v[x]-g[x]))*(v.t-g.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?c++:c.push({x:w.x,y:w.y,t1:_,t2:E}))}}return c}function nn(e){var t=qt(e);if(t.abs)return Wt(t.abs);if($t(e)&&$t(e&&e[0])||(e=function(e){if(!e)return null;var t=qt(e);if(t.arr)return Vt(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return $t(e)&&$t(e[0])&&(r=Vt(e)),r.length||String(e).replace(It,(function(e,t,i){var o=[],a=t.toLowerCase();for(i.replace(Lt,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(r.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");o.length>=n[a]&&(r.push([t].concat(o.splice(0,n[a]))),n[a]););})),r.toString=qt.toString,t.arr=Vt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,a=0,s=0,p=0;"M"==e[0][0]&&(a=i=+e[0][1],s=o=+e[0][2],p++,r[0]=["M",i,o]);for(var l,c,u=p,d=e.length;u<d;u++){if(r.push(l=[]),(n=(c=e[u])[0])!=n.toUpperCase())switch(l[0]=n.toUpperCase(),l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+c[6]+i,l[7]=+c[7]+o;break;case"V":l[1]=+c[1]+o;break;case"H":l[1]=+c[1]+i;break;case"M":a=+c[1]+i,s=+c[2]+o;default:for(var h=1,m=c.length;h<m;h++)l[h]=+c[h]+(h%2?i:o)}else for(var f=0,y=c.length;f<y;f++)l[f]=c[f];switch(n=n.toUpperCase(),l[0]){case"Z":i=+a,o=+s;break;case"H":i=l[1];break;case"V":o=l[1];break;case"M":a=l[l.length-2],s=l[l.length-1];default:i=l[l.length-2],o=l[l.length-1]}}return r.toString=Gt,t.abs=Wt(r),r}function rn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function on(e,t,n,r){return[e,t,n,r,n,r]}function an(e,t,n,r,i,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*r,a*i+s*n,a*o+s*r,i,o]}function sn(e,t,n,r,i,o,a,s,p,l){var c,u=120*Dt/180,d=Dt/180*(+i||0),h=[],m=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0),r=n.join("␀"),i=t.cache=t.cache||{},o=t.count=t.count||[];return Ft(i,r)?(Ht(o,r),i[r]):(o.length>=1e3&&delete i[o.shift()],o.push(r),i[r]=e.apply(0,n),i[r])}}((function(e,t,n){return{x:e*Rt.cos(n)-t*Rt.sin(n),y:e*Rt.sin(n)+t*Rt.cos(n)}}));if(l)E=l[0],P=l[1],w=l[2],_=l[3];else{e=(c=m(e,t,-d)).x,t=c.y;var f=(e-(s=(c=m(s,p,-d)).x))/2,y=(t-(p=c.y))/2,g=f*f/(n*n)+y*y/(r*r);g>1&&(n*=g=Rt.sqrt(g),r*=g);var v=n*n,b=r*r,x=(o==a?-1:1)*Rt.sqrt(Bt((v*b-v*y*y-b*f*f)/(v*y*y+b*f*f))),w=x*n*y/r+(e+s)/2,_=x*-r*f/n+(t+p)/2,E=Rt.asin(((t-_)/r).toFixed(9)),P=Rt.asin(((p-_)/r).toFixed(9));(E=e<w?Dt-E:E)<0&&(E=2*Dt+E),(P=s<w?Dt-P:P)<0&&(P=2*Dt+P),a&&E>P&&(E-=2*Dt),!a&&P>E&&(P-=2*Dt)}var O=P-E;if(Bt(O)>u){var S=P,k=s,C=p;P=E+u*(a&&P>E?1:-1),h=sn(s=w+n*Rt.cos(P),p=_+r*Rt.sin(P),n,r,i,0,a,k,C,[P,S,w,_])}O=P-E;var T=Rt.cos(E),M=Rt.sin(E),A=Rt.cos(P),R=Rt.sin(P),D=Rt.tan(O/4),z=4/3*n*D,j=4/3*r*D,N=[e,t],B=[e+z*M,t-j*T],I=[s+z*R,p-j*A],L=[s,p];if(B[0]=2*N[0]-B[0],B[1]=2*N[1]-B[1],l)return[B,I,L].concat(h);for(var $=[],F=0,V=(h=[B,I,L].concat(h).join().split(",")).length;F<V;F++)$[F]=F%2?m(h[F-1],h[F],d).y:m(h[F],h[F+1],d).x;return $}function pn(e,t,n,r,i,o,a,s){for(var p,l,c,u,d,h,m,f,y=[],g=[[],[]],v=0;v<2;++v)if(0==v?(l=6*e-12*n+6*i,p=-3*e+9*n-9*i+3*a,c=3*n-3*e):(l=6*t-12*r+6*o,p=-3*t+9*r-9*o+3*s,c=3*r-3*t),Bt(p)<1e-12){if(Bt(l)<1e-12)continue;0<(u=-c/l)&&u<1&&y.push(u)}else m=l*l-4*c*p,f=Rt.sqrt(m),m<0||(0<(d=(-l+f)/(2*p))&&d<1&&y.push(d),0<(h=(-l-f)/(2*p))&&h<1&&y.push(h));for(var b,x=y.length,w=x;x--;)b=1-(u=y[x]),g[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*a,g[1][x]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*s;return g[0][w]=e,g[1][w]=t,g[0][w+1]=a,g[1][w+1]=s,g[0].length=g[1].length=w+2,{x0:zt.apply(0,g[0]),y0:zt.apply(0,g[1]),x1:jt.apply(0,g[0]),y1:jt.apply(0,g[1])}}function ln(e){var t=qt(e);if(t.curve)return Wt(t.curve);for(var n=nn(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(e,t,n){var r,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(sn.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),e=["C",r,i].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(an(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(an(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(on(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(on(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(on(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(on(t.x,t.y,t.X,t.Y))}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)a[t]="A",e.splice(t++,0,["C"].concat(r.splice(0,6)));e.splice(t,1),c=n.length}},a=[],s="",p="",l=0,c=n.length;l<c;l++){n[l]&&(s=n[l][0]),"C"!=s&&(a[l]=s,l&&(p=a[l-1])),n[l]=i(n[l],r,p),"A"!=a[l]&&"C"==s&&(a[l]="C"),o(n,l);var u=n[l],d=u.length;r.x=u[d-2],r.y=u[d-1],r.bx=At(u[d-4])||r.x,r.by=At(u[d-3])||r.y}return t.curve=Wt(n),n}var cn=function(e,t,n){e=ln(e),t=ln(t);for(var r,i,o,a,s,p,l,c,u,d,h=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])r=s=y[1],i=p=y[2];else{"C"==y[0]?(u=[r,i].concat(y.slice(1)),r=u[6],i=u[7]):(u=[r,i,r,i,s,p,s,p],r=s,i=p);for(var g=0,v=t.length;g<v;g++){var b=t[g];if("M"==b[0])o=l=b[1],a=c=b[2];else{"C"==b[0]?(d=[o,a].concat(b.slice(1)),o=d[6],a=d[7]):(d=[o,a,o,a,l,c,l,c],o=l,a=c);var x=tn(u,d,n);if(n)h+=x;else{for(var w=0,_=x.length;w<_;w++)x[w].segment1=m,x[w].segment2=g,x[w].bez1=u,x[w].bez2=d;h=h.concat(x)}}}}}return h};function un(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function dn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function hn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function mn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function fn(e){return dn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function yn(e,t,n){h(n=n||0)||(n={x:n,y:n});var r=hn(e),i=hn(t),o=r.bottom+n.y<=i.top,a=r.left-n.x>=i.right,s=r.top-n.y>=i.bottom,p=o?"top":s?"bottom":null,l=r.right+n.x<=i.left?"left":a?"right":null;return l&&p?p+"-"+l:l||p||"intersect"}function gn(e,t,n){var r=function(e,t){return cn(e,t)}(e,t);return 1===r.length||2===r.length&&Ot(r[0],r[1])<1?dn(r[0]):r.length>1?dn((r=z(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})))[n?0:r.length-1]):null}function vn(e,t){return Math.round(e*t)/t}function bn(e){return m(e)?e+"px":e}function xn(e,t,n){var r=Ie("g");Me(r).add(t);var i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var wn={shape:["x","y","width","height"],connection:["waypoints"]};function _n(e,t,n,r){this._eventBus=t,this._elementRegistry=r,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function En(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}_n.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],_n.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=q({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),q(n.style,{position:"relative",overflow:"hidden",width:bn(e.width),height:bn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ie("svg");Oe(r,{width:"100%",height:"100%"}),_e(n,r);var i=this._viewport=xn(r,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=$(F(this._viewboxChanged,this),300)),t.on("diagram.init",(function(){t.fire("canvas.init",{svg:r,viewport:i})}),this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(function(){delete this._cachedViewbox}),this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},_n.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},_n.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=gt(t);"root"===n?e.removeRootElement(t):e._removeElement(t,n)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},_n.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},_n.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},_n.prototype._createLayer=function(e,t){void 0===t&&(t=1);var n=P(this._layers,(function(e,n){return t>=n.index&&e++,e}),0);return{group:xn(this._viewport,"layer-"+e,n),index:t}},_n.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],Re(t.group))},_n.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},_n.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),e)return(this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{}).rootElement},_n.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},_n.prototype._findPlaneForRoot=function(e){return b(this._planes,(function(t){return t.rootElement===e}))},_n.prototype.getContainer=function(){return this._container},_n.prototype._updateMarker=function(e,t,n){var r;e.id||(e=this._elementRegistry.get(e)),(r=this._elementRegistry._elements[e.id])&&(_([r.gfx,r.secondaryGfx],(function(e){e&&(n?Me(e).add(t):Me(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},_n.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},_n.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},_n.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Me(this.getGraphics(e)).has(t)},_n.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},_n.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},_n.prototype.addRootElement=function(e){var t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});var n=e.layer="root-"+t;this._ensureValid("root",e);var r=this.getLayer(n,0);return Oe(r,"display","none"),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},_n.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},_n.prototype.setRootElement=function(e,t){if(c(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},_n.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},_n.prototype._addRoot=function(e,t){var n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},_n.prototype._setRoot=function(e,t){var n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),Oe(this._findPlaneForRoot(n).layer,"display","none")),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),Oe(t,"display",null)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},_n.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");var n=wn[e];if(!O(n,(function(e){return void 0!==t[e]})))throw new Error("must supply { "+n.join(", ")+" } with "+e)},_n.prototype._setParent=function(e,t,n){Et(t.children,e,n),e.parent=t},_n.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();var i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);var a=o.create(e,t,r);return this._elementRegistry.add(t,a),o.update(e,t,a),i.fire(e+".added",{element:t,gfx:a}),t},_n.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},_n.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},_n.prototype._removeElement=function(e,t){var n=this._elementRegistry,r=this._graphicsFactory,i=this._eventBus;if(e=n.get(e.id||e))return i.fire(t+".remove",{element:e}),r.remove(e),_t(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},_n.prototype.removeShape=function(e){return this._removeElement(e,"shape")},_n.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},_n.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},_n.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},_n.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},_n.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,r,i,o,a,s,p=this._viewport,l=this.getSize();return e?(this._changeViewbox((function(){o=Math.min(l.width/e.width,l.height/e.height);var t=this._svg.createSVGMatrix().scale(o).translate(-e.x,-e.y);Ye(p,t)})),e):(t=(r=this._rootElement?this.getActiveLayer():null)&&r.getBBox()||{},n=(i=Ye(p))?i.matrix:function(e,t,n,r,i,o){var a=Le.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return $e(a,e);case 6:return $e(a,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),o=vn(n.a,1e3),a=vn(-n.e||0,1e3),s=vn(-n.f||0,1e3),e=this._cachedViewbox={x:a?a/o:0,y:s?s/o:0,width:l.width/o,height:l.height/o,scale:o,inner:{width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0},outer:l})},_n.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),En(t,n)})),{x:n.e,y:n.f}},_n.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var r=this.findRoot(e);r!==this.getRootElement()&&this.setRootElement(r),t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var i,o,a=yt(e),s=hn(a),p=this.viewbox(),l=this.zoom();p.y+=t.top/l,p.x+=t.left/l,p.width-=(t.right+t.left)/l,p.height-=(t.bottom+t.top)/l;var c=hn(p);if(a.width<p.width&&a.height<p.height){var u=Math.max(0,s.right-c.right),d=Math.min(0,s.left-c.left),h=Math.max(0,s.bottom-c.bottom),m=Math.min(0,s.top-c.top);i=u||d,o=h||m}else i=a.x-p.x,o=a.y-p.y;this.scroll({dx:-i*l,dy:-o*l})},_n.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),vn(r.a,1e3)):this.viewbox(e).scale;var n,r},_n.prototype._fitViewport=function(e){var t,n,r=this.viewbox(),i=r.outer,o=r.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=i.width&&o.y+o.height<=i.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,i.width),height:Math.max(o.height+o.y,i.height)}:(t=Math.min(1,i.width/o.width,i.height/o.height),n={x:o.x+(e?o.width/2-i.width/t/2:0),y:o.y+(e?o.height/2-i.height/t/2:0),width:i.width/t,height:i.height/t}),this.viewbox(n),this.viewbox(!1).scale},_n.prototype._setZoom=function(e,t){var n,r,i,o,a=this._svg,s=this._viewport,p=a.createSVGMatrix(),l=a.createSVGPoint(),c=(r=s.getCTM()).a;return t?(n=q(l,t).matrixTransform(r.inverse()),i=p.translate(n.x,n.y).scale(1/c*e).translate(-n.x,-n.y),o=r.multiply(i)):o=p.scale(e),En(this._viewport,o),o},_n.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},_n.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}},_n.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Pn="data-element-id";function On(e){this._elements={},this._eventBus=e}On.$inject=["eventBus"],On.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),Oe(t,Pn,r),n&&Oe(n,Pn,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},On.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(Oe(r.gfx,Pn,""),r.secondaryGfx&&Oe(r.secondaryGfx,Pn,""),delete t[n])},On.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),r=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,r)},On.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&Oe(t,Pn,r),t},On.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Oe(e,Pn);var n=this._elements[t];return n&&n.element},On.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},On.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r<n.length;r++){var i=t[n[r]],o=i.element;if(e(o,i.gfx))return o}},On.prototype.getAll=function(){return this.filter((function(e){return e}))},On.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var r=t[n],i=r.element,o=r.gfx;return e(i,o)}))},On.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},On.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 Sn={extend:function(e,t,n,r){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,i,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,i,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function kn(e,t,n){var r=Sn.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(r){e.set(r,t.inverse,n)}))}function Cn(e,t){if(!(this instanceof Cn))return new Cn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Cn.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?kn(this,t,e):function(e,t,n){var r=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(t){if(t!==i){var o=i;i=null,o&&e.unset(o,r,n),i=t,e.set(i,r,n)}}})}(this,t,e)},Cn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Sn.isExtended(n)||kn(this,t,e),n},Cn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Cn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Cn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Tn=Cn,Mn=Sn;Tn.Collection=Mn;var An=new Tn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Rn=new Tn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Dn=new Tn({name:"attachers",collection:!0},{name:"host"}),zn=new Tn({name:"outgoing",collection:!0},{name:"source"}),jn=new Tn({name:"incoming",collection:!0},{name:"target"});function Nn(){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)}}),An.bind(this,"parent"),Rn.bind(this,"labels"),zn.bind(this,"outgoing"),jn.bind(this,"incoming")}function Bn(){Nn.call(this),An.bind(this,"children"),Dn.bind(this,"host"),Dn.bind(this,"attachers")}function In(){Bn.call(this)}function Ln(){Bn.call(this),Rn.bind(this,"labelTarget")}function $n(){Nn.call(this),zn.bind(this,"source"),jn.bind(this,"target")}r(Bn,Nn),r(In,Bn),r(Ln,Bn),r($n,Nn);var Fn={connection:$n,shape:Bn,label:Ln,root:In};function Vn(){this._uid=12}Vn.prototype.createRoot=function(e){return this.create("root",e)},Vn.prototype.createLabel=function(e){return this.create("label",e)},Vn.prototype.createShape=function(e){return this.create("shape",e)},Vn.prototype.createConnection=function(e){return this.create("connection",e)},Vn.prototype.create=function(e,t){return(t=q({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Fn[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}(e,t)};var Hn=Array.prototype.slice;function qn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Un(){}function Gn(e){return e.childNodes[0]}function Wn(e,t,n,r,i){var o=Fe();o.setTranslate(t,n);var a=Fe();a.setRotate(r||0,0,0);var s=Fe();s.setScale(i||1,i||1),Ye(e,[o,a,s])}function Kn(e,t,n){var r=Fe();r.setTranslate(t,n),Ye(e,r)}function Xn(e,t){var n=Fe();n.setRotate(t,0,0),Ye(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}function Zn(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}qn.prototype.on=function(e,t,n,r){if(e=d(e)?e:[e],f(t)&&(r=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");var i=n;r&&((i=F(n,r)).__fn=n.__fn||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},qn.prototype.once=function(e,t,n,r){var i=this;if(f(t)&&(r=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(r,arguments);return i.off(e,o),t}o.__fn=n,this.on(e,t,o)},qn.prototype.off=function(e,t){e=d(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},qn.prototype.createEvent=function(e){var t=new Un;return t.init(e),t},qn.prototype.fire=function(e,t){var n,r,i,o;if(o=Hn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof Un?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==a&&(n.type=a)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},qn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},qn.prototype._destroy=function(){this._listeners={}},qn.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},qn.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{void 0!==(r=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=r,e.stopPropagation()),!1===r&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return r},qn.prototype._addListener=function(e,t){var n,r=this._getListeners(e);if(r){for(;r;){if(r.priority<t.priority)return t.next=r,void(n?n.next=t:this._setListeners(e,t));n=r,r=r.next}n.next=t}else this._setListeners(e,t)},qn.prototype._getListeners=function(e){return this._listeners[e]},qn.prototype._setListeners=function(e,t){this._listeners[e]=t},qn.prototype._removeListener=function(e,t){var n,r,i,o=this._getListeners(e);if(t)for(;o;)n=o.next,(i=o.callback)!==t&&i.__fn!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},Un.prototype.stopPropagation=function(){this.cancelBubble=!0},Un.prototype.preventDefault=function(){this.defaultPrevented=!0},Un.prototype.init=function(e){q(this,e||{})},Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Me(t=Ie("g")).add("djs-children"),_e(n.parentNode,t)):t=n,t},Yn.prototype._clear=function(e){var t=Gn(e);return re(t),t},Yn.prototype._createContainer=function(e,t,n,r){var i=Ie("g");Me(i).add("djs-group"),void 0!==n?Zn(i,t,t.childNodes[n]):_e(t,i);var o=Ie("g");Me(o).add("djs-element"),Me(o).add("djs-"+e),r&&Me(o).add("djs-frame"),_e(i,o);var a=Ie("g");return Me(a).add("djs-visual"),_e(o,a),o},Yn.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,vt(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;_(P(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),(function(e){var r=e.children;if(r){var i=t._getChildrenContainer(e);_(r.slice().reverse(),(function(e){Zn(n.getGraphics(e).parentNode,i)}))}}))},Yn.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Yn.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Yn.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),Kn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?Oe(n,"display","none"):Oe(n,"display","block")}},Yn.prototype.remove=function(e){Re(this._elementRegistry.getGraphics(e).parentNode)};var Jn={__depends__:[wt],__init__:["canvas"],canvas:["type",_n],elementRegistry:["type",On],elementFactory:["type",Vn],eventBus:["type",qn],graphicsFactory:["type",Yn]};function Qn(e){var t=[],n=[];function r(e){return t.indexOf(e)>=0}e.forEach((function e(i){r(i)||((i.__depends__||[]).forEach(e),r(i)||(!function(e){t.push(e)}(i),(i.__init__||[]).forEach((function(e){n.push(e)}))))}));var i=new at(t);return n.forEach((function(e){try{i["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}})),i}function er(e,t){this.injector=t=t||function(e){return Qn([{config:["value",e=e||{}]},Jn].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function tr(){}function nr(e,t){this.model=e,this.properties=t}er.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},er.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},tr.prototype.get=function(e){return this.$model.properties.get(this,e)},tr.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},nr.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(tr.prototype);_(e.properties,(function(e){e.isMany||void 0===e.default||(r[e.name]=e.default)})),n.defineModel(r,t),n.defineDescriptor(r,e);var i=e.ns.name;function o(e){n.define(this,"$type",{value:i,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),_(e,F((function(e,t){this.set(t,e)}),this))}return o.prototype=r,o.hasType=r.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var rr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},ir={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function or(e,t){var n=ir[e];return n?n(t):t}function ar(e){return!!rr[e]}function sr(e){return!!ir[e]}function pr(e,t){var n,r,i=e.split(/:/);if(1===i.length)n=e,r=t;else{if(2!==i.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=i[1],r=i[0]}return{name:e=(r?r+":":"")+n,prefix:r,localName:n}}function lr(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function cr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,_(e,F(this.registerPackage,this))}function ur(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function dr(e){this.model=e}function hr(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function mr(e){this.properties=new dr(this),this.factory=new nr(this,this.properties),this.registry=new cr(e,this.properties),this.typeCache={}}lr.prototype.build=function(){return W(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},lr.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var r=this.properties;void 0!==t?r.splice(t,0,e):r.push(e)},lr.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=i.indexOf(e);if(-1===s)throw new Error("property <"+r.name+"> not found in property list");i.splice(s,1),this.addProperty(t,n?void 0:s,a),o[r.name]=o[r.localName]=t},lr.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=pr(i[0],r),a=pr(i[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},lr.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e},lr.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},lr.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},lr.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},lr.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},lr.prototype.hasProperty=function(e){return this.propertiesByName[e]},lr.prototype.addTrait=function(e,t){var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(_(e.properties,F((function(n){n=q({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var r=n.replaces,i=n.redefines;r||i?this.redefineProperty(n,r||i,r):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),r.push(e),n[i]=e)},cr.prototype.getPackage=function(e){return this.packageMap[e]},cr.prototype.getPackages=function(){return this.packages},cr.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;ur(t,e,"prefix"),ur(t,e,"uri"),_(e.types,F((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},cr.prototype.registerType=function(e,t){var n=pr((e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q(e.meta||{})})).name,t.prefix),r=n.name,i={};_(e.properties,F((function(e){var t=pr(e.name,n.prefix),r=t.name;ar(e.type)||(e.type=pr(e.type,t.prefix).name),q(e,{ns:t,name:r}),i[r]=e}),this)),q(e,{ns:n,name:r,propertiesByName:i}),_(e.extends,F((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},cr.prototype.mapTypes=function(e,t,n){var r=ar(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(e){return a(e,!0)}function a(n,r){var o=pr(n,ar(n)?"":e.prefix);i.mapTypes(o,t,r)}if(!r)throw new Error("unknown type <"+e.name+">");_(r.superClass,n?o:a),t(r,!n),_(r.traits,o)},cr.prototype.getEffectiveDescriptor=function(e){var t=pr(e),n=new lr(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var r=n.build();return this.definePackage(r,r.allTypes[r.allTypes.length-1].$pkg),r},cr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},dr.prototype.set=function(e,t,n){var r=this.model.getPropertyDescriptor(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[t]:r?i in e?e[i]=n:hr(e,r,n):e.$attrs[t]=n},dr.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var r=n.name;return!e[r]&&n.isMany&&hr(e,n,[]),e[r]},dr.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=q({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},dr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},dr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},mr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},mr.prototype.getType=function(e){var t=this.typeCache,n=y(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},mr.prototype.createAny=function(e,t,n){var r=pr(e),i={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(i,o),this.properties.defineModel(i,this),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),_(n,(function(e,t){h(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},mr.prototype.getPackage=function(e){return this.registry.getPackage(e)},mr.prototype.getPackages=function(){return this.registry.getPackages()},mr.prototype.getElementDescriptor=function(e){return e.$descriptor},mr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},mr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},mr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var fr=String.fromCharCode,yr=Object.prototype.hasOwnProperty,gr=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,vr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function br(e,t,n,r){return r?yr.call(vr,r)?vr[r]:"&"+r+";":fr(t||parseInt(n,16))}function xr(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(gr,br):e}Object.keys(vr).forEach((function(e){vr[e.toUpperCase()]=vr[e]}));var wr="xsi:type",_r="non-whitespace outside of root node";function Er(e){return new Error(e)}function Pr(e){return"missing namespace for prefix <"+e+">"}function Or(e){return{get:e,enumerable:!0}}function Sr(e){var t,n={};for(t in e)n[t]=e[t];return n}function kr(e){return e+"$uri"}function Cr(){return{line:0,column:0}}function Tr(e){throw e}function Mr(e){if(!this)return new Mr(e);var t,n,r,i,o,a,s,p,l,c=e&&e.proxy,u=Tr,d=Cr,h=!1,m=!1,f=null,y=!1;function g(e){e instanceof Error||(e=Er(e)),f=e,u(e,d)}function v(e){o&&(e instanceof Error||(e=Er(e)),o(e,d))}this.on=function(e,l){if("function"!=typeof l)throw Er("required args <name, cb>");switch(e){case"openTag":n=l;break;case"text":t=l;break;case"closeTag":r=l;break;case"error":u=l;break;case"warn":o=l;break;case"cdata":i=l;break;case"attention":p=l;break;case"question":s=l;break;case"comment":a=l;break;default:throw Er("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Er("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",m=!0,l=n,this},this.parse=function(e){if("string"!=typeof e)throw Er("required args <xml=string>");return f=null,function(e){var o,u,f,b,x,w,_,E,P,O,S,k=m?[]:null,C=m?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[kr(n)]=t;return r}(l):null,T=[],M=0,A=!1,R=!1,D=0,z=0,j="",N=0;function B(){if(null!==S)return S;var e,t,n,r,i,o,a,s,p,c,u,d=m&&C.xmlns,f=m&&h?[]:null,y=N,g=j,b=g.length,x={},w={};e:for(;y<b;y++)if(p=!1,!(32===(c=g.charCodeAt(y))||c<14&&c>8)){for((c<65||c>122||c>90&&c<97)&&95!==c&&58!==c&&(v("illegal first char attribute name"),p=!0),u=y+1;u<b;u++)if(!((c=g.charCodeAt(u))>96&&c<123||c>64&&c<91||c>47&&c<59||46===c||45===c||95===c)){if(32===c||c<14&&c>8){v("missing attribute value"),y=u;continue e}if(61===c)break;v("illegal attribute name char"),p=!0}if("xmlns:xmlns"===(s=g.substring(y,u))&&(v("illegal declaration of xmlns"),p=!0),34===(c=g.charCodeAt(u+1)))-1===(u=g.indexOf('"',y=u+2))&&-1!==(u=g.indexOf("'",y))&&(v("attribute value quote missmatch"),p=!0);else if(39===c)-1===(u=g.indexOf("'",y=u+2))&&-1!==(u=g.indexOf('"',y))&&(v("attribute value quote missmatch"),p=!0);else for(v("missing attribute value quotes"),p=!0,u+=1;u<b&&!(32===(c=g.charCodeAt(u+1))||c<14&&c>8);u++);for(-1===u&&(v("missing closing quotes"),u=b,p=!0),p||(o=g.substring(y,u)),y=u;u+1<b&&!(32===(c=g.charCodeAt(u+1))||c<14&&c>8);u++)y===u&&(v("illegal character after attribute end"),p=!0);if(y=u+1,!p)if(s in w)v("attribute <"+s+"> already defined");else if(w[s]=!0,m)if(h){if(null!==(i="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=xr(o),t=kr(i),!(a=l[e])){if("xmlns"===i||t in C&&C[t]!==e)do{a="ns"+M++}while(void 0!==C[a]);else a=i;l[e]=a}C[i]!==a&&(r||(C=Sr(C),r=!0),C[i]=a,"xmlns"===i&&(C[kr(a)]=e,d=a),C[t]=e),x[s]=o;continue}f.push(s,o)}else-1!==(c=s.indexOf(":"))?(n=C[s.substring(0,c)])?((s=d===n?s.substr(c+1):n+s.substr(c))===wr&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=C[n]||n)+o.substring(c)):o=d+":"+o),x[s]=o):v(Pr(s.substring(0,c))):x[s]=o;else x[s]=o}if(h)for(y=0,b=f.length;y<b;y++){if(s=f[y++],o=f[y],-1!==(c=s.indexOf(":"))){if(!(n=C[s.substring(0,c)])){v(Pr(s.substring(0,c)));continue}(s=d===n?s.substr(c+1):n+s.substr(c))===wr&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=C[n]||n)+o.substring(c)):o=d+":"+o)}x[s]=o}return S=x}function I(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,a=0,s=z;D>=a&&(t=r.exec(e))&&!((s=t[0].length+t.index)>D);)i+=1,a=s;return-1==D?(o=s,n=e.substring(z)):0===z?n=e.substring(z,D):(o=D-a,n=-1==z?e.substring(D):e.substring(D,z+1)),{data:n,line:i,column:o}}d=I,c&&(O=Object.create({},{name:Or((function(){return E})),originalName:Or((function(){return P})),attrs:Or(B),ns:Or((function(){return C}))}));for(;-1!==z;){if(-1===(D=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return T.length?g("unexpected end of file"):0===z?g("missing start tag"):void(z<e.length&&e.substring(z).trim()&&v(_r));if(z!==D)if(T.length){if(t&&(t(e.substring(z,D),xr,d),y))return}else if(e.substring(z,D).trim()&&(v(_r),y))return;if(33===(x=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(z=e.indexOf("]]>",D)))return g("unclosed cdata");if(i&&(i(e.substring(D+9,z),d),y))return;z+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(z=e.indexOf("--\x3e",D)))return g("unclosed comment");if(a&&(a(e.substring(D+4,z),xr,d),y))return;z+=3;continue}}if(63!==x){for(u=D+1;;u++){if(w=e.charCodeAt(u),isNaN(w))return z=-1,g("unclosed tag");if(34===w)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===w)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===w){z=u;break}}if(33!==x){if(S={},47===x){if(A=!1,R=!0,!T.length)return g("missing open tag");if(u=E=T.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return g("closing tag mismatch");for(;b<z;b++)if(!(32===(x=e.charCodeAt(b))||x>8&&x<14))return g("close tag")}else{if(47===e.charCodeAt(z-1)?(u=E=e.substring(D+1,z-1),A=!0,R=!0):(u=E=e.substring(D+1,z),A=!0,R=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return g("illegal first char nodeName");for(b=1,f=u.length;b<f;b++)if(!((x=u.charCodeAt(b))>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),S=null;break}return g("invalid nodeName")}R||T.push(E)}if(m){if(o=C,A&&(R||k.push(o),null===S&&(h=-1!==u.indexOf("xmlns",b))&&(N=b,j=u,B(),h=!1)),P=E,-1!==(x=E.indexOf(":"))){if(!(_=C[E.substring(0,x)]))return g("missing namespace on <"+P+">");E=E.substr(x+1)}else _=C.xmlns;_&&(E=_+":"+E)}if(A&&(N=b,j=u,n&&(c?n(O,xr,R,d):n(E,B,xr,R,d),y)))return;if(R){if(r&&(r(c?O:E,xr,A,d),y))return;m&&(C=A?o:k.pop())}z+=1}else{if(p&&(p(e.substring(D,z+1),xr,d),y))return;z+=1}}else{if(-1===(z=e.indexOf("?>",D)))return g("unclosed question");if(s&&(s(e.substring(D,z+2),d),y))return;z+=2}}}(e),d=Cr,y=!1,f},this.stop=function(){y=!0}}function Ar(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Rr={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Dr="xsi:type";function zr(e){return e.xml&&e.xml.serialize}function jr(e){return zr(e)===Dr}function Nr(e,t){return Ar(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Br(e){return new Error(e)}function Ir(e){return e.$descriptor}function Lr(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Br("expected element");var t,n=this.elementsById,r=Ir(e).idProperty;if(r&&(t=e.get(r.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Br("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function $r(){}function Fr(){}function Vr(){}function Hr(e,t){this.property=e,this.context=t}function qr(e,t){this.element=t,this.propertyDesc=e}function Ur(){}function Gr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Wr(e,t,n){Gr.call(this,e,t,n)}function Kr(e,t,n){this.model=e,this.context=n}function Xr(e){e instanceof mr&&(e={model:e}),q(this,{lax:!1},e)}$r.prototype.handleEnd=function(){},$r.prototype.handleText=function(){},$r.prototype.handleNode=function(){},Fr.prototype=Object.create($r.prototype),Fr.prototype.handleNode=function(){return this},Vr.prototype=Object.create($r.prototype),Vr.prototype.handleText=function(e){this.body=(this.body||"")+e},Hr.prototype=Object.create(Vr.prototype),Hr.prototype.handleNode=function(e){if(this.element)throw Br("expected no sub nodes");return this.element=this.createReference(e),this},Hr.prototype.handleEnd=function(){this.element.id=this.body},Hr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},qr.prototype=Object.create(Vr.prototype),qr.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=or(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ur.prototype=Object.create(Vr.prototype),Ur.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},Gr.prototype=Object.create(Ur.prototype),Gr.prototype.addReference=function(e){this.context.addReference(e)},Gr.prototype.handleText=function(e){if(!Ir(this.element).bodyProperty)throw Br("unexpected body text <"+e+">");Vr.prototype.handleText.call(this,e)},Gr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ir(t).bodyProperty;n&&void 0!==e&&(e=or(n.type,e),t.set(n.name,e))},Gr.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Ir(r),o=this.context,a=new r({}),s=this.model;return _(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?_(e.split(" "),(function(e){o.addReference({element:a,property:r.ns.name,id:e})})):o.addReference({element:a,property:r.ns.name,id:e}):(r?e=or(r.type,e):"xmlns"!==n&&(t=pr(n,i.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},Gr.prototype.getPropertyForNode=function(e){var t,n,r=pr(e.name),i=this.type,o=this.model,a=Ir(i),s=r.name,p=a.propertiesByName[s];if(p&&!p.isAttr)return jr(p)&&(t=e.attributes[Dr])?(t=function(e,t){var n=pr(e);return function(e,t){var n=e.name,r=e.localName,i=t.xml&&t.xml.typePrefix;return i&&0===r.indexOf(i)?e.prefix+":"+r.slice(i.length):n}(n,t.getPackage(n.prefix))}(t,o),q({},p,{effectiveType:Ir(n=o.getType(t)).name})):p;var l=o.getPackage(r.prefix);if(l){if(t=Nr(r,l),n=o.getType(t),p=b(a.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})))return q({},p,{effectiveType:Ir(n).name})}else if(p=b(a.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})))return p;throw Br("unrecognized element <"+r.name+">")},Gr.prototype.toString=function(){return"ElementDescriptor["+Ir(this.type).name+"]"},Gr.prototype.valueHandler=function(e,t){return new qr(e,t)},Gr.prototype.referenceHandler=function(e){return new Hr(e,this.context)},Gr.prototype.handler=function(e){return"Element"===e?new Kr(this.model,e,this.context):new Gr(this.model,e,this.context)},Gr.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,sr(n=t.effectiveType||t.type))return this.valueHandler(t,r);var o=(i=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?r.get(t.name).push(o):r.set(t.name,o),t.isReference?(q(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},Wr.prototype=Object.create(Gr.prototype),Wr.prototype.createElement=function(e){var t=e.name,n=pr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&Nr(n,o)||t;if(!i.hasType(a))throw Br("unexpected element <"+e.originalName+">");return Gr.prototype.createElement.call(this,e)},Kr.prototype=Object.create(Ur.prototype),Kr.prototype.createElement=function(e){var t=e.name,n=pr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},Kr.prototype.handleChild=function(e){var t=new Kr(this.model,"Element",this.context).handleNode(e),n=this.element,r=t.element;return void 0!==r&&((n.$children=n.$children||[]).push(r),r.$parent=n),t},Kr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Xr.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof Gr?(r=t,t={}):"string"==typeof t?(r=this.handler(t),t={}):"string"==typeof r&&(r=this.handler(r));var i=this.model,o=this.lax,a=new Lr(q({},t,{rootHandler:r})),s=new Mr({proxy:!0}),p=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function l(e,t,n){var r=t(),i=r.line,o=r.column,s=r.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var p="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:p,error:e}),!0;throw Br(p)}function c(e,t){return l(e,t,!0)}r.context=a,p.push(r);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(e,t){try{p.peek().handleText(e)}catch(e){c(e,t)}}var f=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(f).on("openTag",(function(e,t,n,r){var i=e.attrs||{},a=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=p.peek();try{p.push(n.handleNode(e))}catch(e){l(e,t,o)&&p.push(new Fr)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){p.pop().handleEnd()})).on("cdata",m).on("text",(function(e,t,n){!function(e,t){e.trim()&&m(e,t)}(t(e),n)})).on("error",l).on("warn",c),new Promise((function(t,n){var i;try{s.parse(e),function(){var e,t,n=a.elementsById,r=a.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],s=Ir(i).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var p=i.get(s.name),l=p.indexOf(t);-1===l&&(l=p.length),o?p[l]=o:p.splice(l,1)}else i.set(s.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Br("failed to parse document as <"+r.type.$descriptor.name+">"));var p=a.warnings,l=a.references,c=a.elementsById;return i?(i.warnings=p,n(i)):t({rootElement:o,elementsById:c,references:l,warnings:p})}))},Xr.prototype.handler=function(e){return new Wr(this.model,e)};var Yr=/<|>|'|"|&|\n\r|\n/g,Zr=/<|>|&/g;function Jr(e){var t={},n={},r={},i=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?i.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,i=this.getNSKey(t);r[i]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(i,o).filter((function(e){var n=t.getNSKey(e);return r[n]}))}}function Qr(e,t){return Ar(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function ei(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ti(e){return y(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var ni={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ri={"<":"lt",">":"gt","&":"amp"};function ii(e,t,n){return(e=y(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function oi(e){this.tagName=e}function ai(){}function si(e){this.tagName=e}function pi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function li(e,t){pi.call(this,e,t)}function ci(){this.value="",this.write=function(e){this.value+=e}}function ui(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function di(e){return e=q({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new ci,i=new ui(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new pi).build(t).serializeTo(i),!n)return r.value}}}function hi(e,t){mr.call(this,e,t)}oi.prototype.build=function(e){return this.element=e,this},oi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},ai.prototype.serializeValue=ai.prototype.serializeTo=function(e){e.append(this.escape?ii(this.value,Zr,ri):this.value)},ai.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Zr)&&(this.escape=!0),this},ei(si,ai),si.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},pi.prototype.build=function(e){this.element=e;var t,n,r=e.$descriptor,i=this.propertyDescriptor,o=r.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=i?this.nsPropertyTagName(i):this.nsTagName(r),this.tagName=this.addTagName(this.ns),o||(n=function(e){return w(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!v(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(w(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return w(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},pi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?q({localName:t.ns.localName},e):q({localName:Qr(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},pi.prototype.nsPropertyTagName=function(e){return function(e,t){return q({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},pi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},pi.prototype.nsAttributeName=function(e){var t;if(t=y(e)?pr(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}:q({localName:t.localName},n)},pi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return _(e,(function(i,o){"$body"===o?n.push((new ai).build({type:"String"},i)):"$children"===o?_(i,(function(e){n.push(new pi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},pi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=pr(t);if("xmlns"===o.prefix&&(r={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},pi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return _(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},pi.prototype.parseGenericAttributes=function(e,t){var n=this;_(t,(function(t){if(t.name!==Dr)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},pi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;_(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new ai).build(e,i[0]));else if(sr(e.type))_(i,(function(r){n.push(new si(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)_(i,(function(r){n.push(new oi(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var a=jr(e),s=function(e){return"property"===zr(e)}(e);_(i,(function(r){var i;i=a?new li(t,e):s?new pi(t,e):new pi(t),n.push(i.build(r))}))}}))},pi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new Jr(t):n=t),n},pi.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),i=e.uri,o=e.prefix;return r.byUri(i)&&!n||r.add(e,t),r.mapPrefix(o,i),e},pi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,p=e.uri;if(!s&&!p)return{localName:e.localName};if(i=Rr[s]||o&&(o.getPackage(s)||{}).uri,!(p=p||i||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(p))){for(n=s,r=1;a.uriByPrefix(n);)n=s+"_"+r++;e=this.logNamespace({prefix:n,uri:p},i===p)}return s&&a.mapPrefix(s,p),e},pi.prototype.parseAttributes=function(e){var t=this,n=this.element;_(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];_(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},pi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ti(e)},pi.prototype.addAttribute=function(e,t){var n=this.attrs;y(t)&&(t=ii(t,Yr,ni)),n.push({name:e,value:t})},pi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),_(t,(function(t){e.append(" ").append(ti(t.name)).append('="').append(t.value).append('"')}))},pi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ai;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),_(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},ei(li,pi),li.prototype.parseNsAttributes=function(e){var t=pi.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var i=e.$model.getPackage(r.uri),o=i.xml&&i.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Dr),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},li.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},hi.prototype=Object.create(mr.prototype),hi.prototype.fromXML=function(e,t,n){y(t)||(n=t,t="bpmn:Definitions");var r=new Xr(q({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},hi.prototype.toXML=function(e,t){var n=new di(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var mi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",prefix:"bpmn",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",prefix:"bpmndi",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",prefix:"dc",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",prefix:"di",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]},color:{name:"BPMN in Color",uri:"http://www.omg.org/spec/BPMN/non-normative/color/1.0",prefix:"color",types:[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function fi(e,t){return new hi(q({},mi,e),t)}function yi(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function gi(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&f(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+e.name+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var r=Array.prototype.slice.call(arguments,0,-1);e.apply(this,r).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}function vi(e){v(e,"di")||Object.defineProperty(e,"di",{get:function(){throw new Error("Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472")}})}function bi(e,t){return e.$instanceOf(t)}function xi(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function a(e){n[e.id]=e}function s(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:yi(n)}));return e.element(n,i[n.id],r)}(n,r);return a(n),o}catch(e){p(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:yi(n)})),console.error(e)}}function p(t,n){e.error(t,n)}function l(e){var n=e.bpmnElement;n?i[n.id]?p(t("multiple DI elements defined for {element}",{element:yi(n)}),{element:n}):(i[n.id]=e,vi(n)):p(t("no bpmnElement referenced in {element}",{element:yi(e)}),{element:e})}function c(e){var t;l(t=e.plane),_(t.planeElement,u)}function u(e){l(e)}function d(){for(;r.length;)r.shift()()}function h(e,t){T(e,t),E(e.ioSpecification,t),x(e.artifacts,t),a(e)}function m(e,t){s(e,t)}function f(e,t){s(e,t)}function y(e,t){s(e,t)}function g(e,t){s(e,t)}function v(e,t){s(e,t)}function x(e,t){_(e,(function(e){bi(e,"bpmn:Association")?r.push((function(){v(e,t)})):v(e,t)}))}function E(e,t){e&&(_(e.dataInputs,o(y,t)),_(e.dataOutputs,o(g,t)))}function P(e,t){T(e,t),x(e.artifacts,t)}function O(e,t){var n=s(e,t);bi(e,"bpmn:SubProcess")&&P(e,n||t),bi(e,"bpmn:Activity")&&E(e.ioSpecification,t),r.push((function(){_(e.dataInputAssociations,o(f,t)),_(e.dataOutputAssociations,o(f,t))}))}function S(e,t){s(e,t)}function k(e,t){r.push((function(){var n=s(e,t);e.childLaneSet&&C(e.childLaneSet,n||t),function(e){_(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function C(e,t){_(e.lanes,o(k,t))}function T(e,n){!function(e,n){_(e,(function(e){bi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){s(e,t)}(e,n)})):bi(e,"bpmn:BoundaryEvent")?r.unshift((function(){O(e,n)})):bi(e,"bpmn:FlowNode")?O(e,n):bi(e,"bpmn:DataObject")||(bi(e,"bpmn:DataStoreReference")||bi(e,"bpmn:DataObjectReference")?S(e,n):p(t("unrecognized flowElement {element} in context {context}",{element:yi(e),context:n?yi(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){_(e,o(C,t))}(e.laneSets,n)}function M(e,t){var n=s(e,t),r=e.processRef;r&&h(r,n||t)}return{handleDeferred:d,handleDefinitions:function(a,s){var u=a.diagrams;if(s&&-1===u.indexOf(s))throw new Error(t("diagram not part of bpmn:Definitions"));if(!s&&u&&u.length&&(s=u[0]),!s)throw new Error(t("no diagram to display"));i={},c(s);var f=s.plane;if(!f)throw new Error(t("no plane for {element}",{element:yi(s)}));var y=f.bpmnElement;if(!y){if(!(y=function(e){return b(e.rootElements,(function(e){return bi(e,"bpmn:Process")||bi(e,"bpmn:Collaboration")}))}(a)))throw new Error(t("no process or collaboration to display"));p(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:yi(f),rootElement:yi(y)})),f.bpmnElement=y,l(f)}var g,v,E=function(t,n){return e.root(t,i[t.id],n)}(y,f);if(bi(y,"bpmn:Process")||bi(y,"bpmn:SubProcess"))h(y,E);else{if(!bi(y,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:yi(f),rootElement:yi(y)}));v=E,_((g=y).participants,o(M,v)),x(g.artifacts,v),r.push((function(){!function(e,t){_(e,o(m,t))}(g.messageFlows,v)})),function(e,t){w(e,(function(e){return!n[e.id]&&bi(e,"bpmn:Process")&&e.laneSets})).forEach(o(h,t))}(a.rootElements,E)}d()},handleSubProcess:P,registerDi:l}}function wi(e,t){var n=Ei(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function _i(e,t){return S(t,(function(t){return wi(e,t)}))}function Ei(e){return e&&e.businessObject||e}function Pi(e){return e&&e.di}function Oi(e,t,n){var r,i,o,a,s=[];function p(e,t){var n=new xi({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){s.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var i=function(e,t){if(!t)return;var n,r=t.plane.bpmnElement,i=r;wi(r,"bpmn:Process")||wi(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(wi(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=wi(i,"bpmn:Collaboration")?i:b(e.rootElements,(function(e){if(wi(e,"bpmn:Collaboration"))return b(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var a=Si(o),s=[t],p=[r];return _(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==a.indexOf(t)&&-1===p.indexOf(t)&&(s.push(e),p.push(t))})),s}(e,t);if(!i)throw new Error(o("no diagram to display"));_(i,(function(t){n.handleDefinitions(e,t)}));var p=t.plane.bpmnElement.id;a.setRootElement(a.findRoot(p+"_plane")||a.findRoot(p))}return new Promise((function(l,c){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),i.fire("import.render.start",{definitions:t}),p(t,n),i.fire("import.render.complete",{error:undefined,warnings:s}),l({warnings:s})}catch(e){return e.warnings=s,c(e)}}))}function Si(e){var t=[];return _(e,(function(e){e&&(t.push(e),t=t.concat(Si(e.flowElements)))})),t}var ki='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';function Ci(e){return e.join(";")}var Ti,Mi=Ci(["color: #404040"]),Ai='<div class="bjs-powered-by-lightbox" style="'+Ci(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Ci(["width: 100%","height: 100%","background: rgba(40,40,40,0.2)"])+'"></div><div class="notice" style="'+Ci(["position: absolute","left: 50%","top: 40%","transform: translate(-50%)","width: 260px","padding: 10px","background: white","box-shadow: 0 1px 4px rgba(0,0,0,0.3)","font-family: Helvetica, Arial, sans-serif","font-size: 14px","display: flex","line-height: 1.3"])+'"><a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;'+Mi+'">'+ki+'</a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';function Ri(e){var t,n;e=q({},zi,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=fe('<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; '+Mi+'">'+ki+"</a>"),t.appendChild(n),ue.bind(n,"click",(function(e){Ti||(Ti=fe(Ai),me.bind(Ti,".backdrop","click",(function(e){document.body.removeChild(Ti)}))),document.body.appendChild(Ti),e.preventDefault()})),this._init(this._container,this._moddle,e)}function Di(e,t){return e.warnings=t,e}r(Ri,er),Ri.prototype.importXML=gi((function(e,t){var n=this;return new Promise((function(r,i){e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"bpmn:Definitions").then((function(e){var o,a,s=e.rootElement,p=e.references,l=e.warnings,c=e.elementsById;s=n._emit("import.parse.complete",(o={error:null,definitions:s,elementsById:c,references:p,warnings:l},a=n.get("eventBus").createEvent(o),Object.defineProperty(a,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:o.warnings,references:o.references,elementsById:o.elementsById}}}),a))||s,n.importDefinitions(s,t).then((function(e){var t=[].concat(l,e.warnings||[]);return n._emit("import.done",{error:null,warnings:t}),r({warnings:t})})).catch((function(e){var t=[].concat(l,e.warnings||[]);return n._emit("import.done",{error:e,warnings:t}),i(Di(e,t))}))})).catch((function(e){return n._emit("import.parse.complete",{error:e}),e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]);return e}(e),n._emit("import.done",{error:e,warnings:e.warnings}),i(e)}))}))})),Ri.prototype.importDefinitions=gi((function(e,t){var n=this;return new Promise((function(r,i){n._setDefinitions(e),n.open(t).then((function(e){var t=e.warnings;return r({warnings:t})})).catch((function(e){return i(e)}))}))})),Ri.prototype.open=gi((function(e){var t=this._definitions,n=e,r=this;return new Promise((function(i,o){if(!t){var a=new Error("no XML imported");return o(Di(a,[]))}if("string"==typeof e&&!(n=function(e,t){if(!t)return null;return b(e.diagrams,(function(e){return e.id===t}))||null}(t,e))){var s=new Error("BPMNDiagram <"+e+"> not found");return o(Di(s,[]))}try{r.clear()}catch(e){return o(Di(e,[]))}Oi(r,t,n).then((function(e){var t=e.warnings;return i({warnings:t})})).catch((function(e){return o(e)}))}))})),Ri.prototype.saveXML=gi((function(e){e=e||{};var t=this,n=this._definitions;return new Promise((function(r){if(!n)return r({error:new Error("no definitions loaded")});n=t._emit("saveXML.start",{definitions:n})||n,t._moddle.toXML(n,e).then((function(e){var n=e.xml;return n=t._emit("saveXML.serialized",{xml:n})||n,r({xml:n})}))})).catch((function(e){return{error:e}})).then((function(e){t._emit("saveXML.done",e);var n=e.error;return n?Promise.reject(n):e}))})),Ri.prototype.saveSVG=gi((function(e){var t=this;return new Promise((function(e,n){var r,i;t._emit("saveSVG.start");try{var o=t.get("canvas"),a=o.getActiveLayer(),s=ve("defs",o._svg),p=Ke(a),l=s?"<defs>"+Ke(s)+"</defs>":"",c=a.getBBox();r='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+c.width+'" height="'+c.height+'" viewBox="'+c.x+" "+c.y+" "+c.width+" "+c.height+'" version="1.1">'+l+p+"</svg>"}catch(e){i=e}return t._emit("saveSVG.done",{error:i,svg:r}),i?n(i):e({svg:r})}))})),Ri.prototype._setDefinitions=function(e){this._definitions=e},Ri.prototype.getModules=function(){return this._modules},Ri.prototype.clear=function(){this.getDefinitions()&&er.prototype.clear.call(this)},Ri.prototype.destroy=function(){er.prototype.destroy.call(this),xe(this._container)},Ri.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Ri.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ri.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=ve(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ri.prototype.getDefinitions=function(){return this._definitions},Ri.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ri.prototype._init=function(e,t,n){var r=n.modules||this.getModules(),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),a=q(K(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:o});er.call(this,a),n&&n.container&&this.attachTo(n.container)},Ri.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ri.prototype._createContainer=function(e){var t=fe('<div class="bjs-container"></div>');return q(t.style,{width:ji(e.width),height:ji(e.height),position:e.position}),t},Ri.prototype._createModdle=function(e){return new fi(q({},this._moddleExtensions,e.moddleExtensions))},Ri.prototype._modules=[];var zi={width:"100%",height:"100%",position:"relative"};function ji(e){return e+(m(e)?"px":"")}function Ni(e){Ri.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function Bi(e,t){return!wi(e,"bpmn:CallActivity")&&(wi(e,"bpmn:SubProcess")?!(!(t=t||Pi(e))||!wi(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!wi(e,"bpmn:Participant")||!!Ei(e).processRef)}function Ii(e){return e&&!1!==Ei(e).isInterrupting}function Li(e){return e&&!!Ei(e).triggeredByEvent}function $i(e,t){var n=Ei(e),r=!1;return n.eventDefinitions&&_(n.eventDefinitions,(function(e){wi(e,t)&&(r=!0)})),r}function Fi(e){return wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Participant")||wi(e,"bpmn:Lane")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")?"name":wi(e,"bpmn:TextAnnotation")?"text":wi(e,"bpmn:Group")?"categoryValueRef":void 0}function Vi(e){var t=e.businessObject,n=Fi(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function Hi(e,t,n){return S(e.eventDefinitions,(function(r){return r.$type===t&&function(e,t){return O(t,(function(t,n){return e[n]==t}))}(e,n)}))}function qi(e){return e.businessObject}function Ui(e,t){var n=Pi(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function Gi(e,t){var n=Pi(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||"black"}function Wi(e,t,n){var r=Pi(e).get("label");return r&&r.get("color:color")||t||Gi(e,n)}r(Ni,Ri),Ni.prototype._createModdle=function(e){var t=Ri.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Ni.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var Ki=new o,Xi=.95;function Yi(e,t,n,r,i,o,a){st.call(this,t,a);var s=e&&e.defaultFillColor,p=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor,c=Ki.next(),u={},d=n.computeStyle;function m(e,t){var n=q({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=Ie("marker");Oe(t.element,n),_e(a,t.element),Oe(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var s=ve("defs",i._svg);s||(s=Ie("defs"),_e(i._svg,s)),_e(s,a),u[e]=a}function f(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function y(e,t,n){var r=e+"-"+f(t)+"-"+f(n)+"-"+c;return u[r]||function(e,t,n,r){if("sequenceflow-end"===t){var i=Ie("path");Oe(i,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(e,{element:i,ref:{x:11,y:10},scale:.5,attrs:{fill:r,stroke:r}})}if("messageflow-start"===t){var o=Ie("circle");Oe(o,{cx:6,cy:6,r:3.5}),m(e,{element:o,attrs:{fill:n,stroke:r},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ie("path");Oe(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(e,{element:a,attrs:{fill:n,stroke:r,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ie("path");Oe(s,{d:"M 11 5 L 1 10 L 11 15"}),m(e,{element:s,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var p=Ie("path");Oe(p,{d:"M 1 5 L 11 10 L 1 15"}),m(e,{element:p,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var l=Ie("path");Oe(l,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(e,{element:l,attrs:{fill:n,stroke:r},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var c=Ie("path");Oe(c,{d:"M 6 4 L 10 16"}),m(e,{element:c,attrs:{stroke:r},ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function g(e,t,n,r,i){h(r)&&(i=r,r=0),r=r||0,"none"===(i=d(i,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete i.fillOpacity;var o=t/2,a=n/2,s=Ie("circle");return Oe(s,{cx:o,cy:a,r:Math.round((t+n)/4-r)}),Oe(s,i),_e(e,s),s}function v(e,t,n,r,i,o){h(i)&&(o=i,i=0),i=i||0,o=d(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Ie("rect");return Oe(a,{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r}),Oe(a,o),_e(e,a),a}function b(e,t,n){var r=ct(t,n=d(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return _e(e,r),r}function x(e,t,n){n=d(n,["no-fill"],{strokeWidth:2,stroke:"black"});var r=Ie("path");return Oe(r,{d:t}),Oe(r,n),_e(e,r),r}function w(e,t,n,r){return x(t,n,q({"data-marker":e},r))}function E(e){return M[e]}function P(e){return function(t,n){return E(e)(t,n)}}function O(e,t){var n=qi(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?E("bpmn:ParallelMultipleEventDefinition")(t,e,r):E("bpmn:MultipleEventDefinition")(t,e,r):Hi(n,"bpmn:MessageEventDefinition")?E("bpmn:MessageEventDefinition")(t,e,r):Hi(n,"bpmn:TimerEventDefinition")?E("bpmn:TimerEventDefinition")(t,e,r):Hi(n,"bpmn:ConditionalEventDefinition")?E("bpmn:ConditionalEventDefinition")(t,e):Hi(n,"bpmn:SignalEventDefinition")?E("bpmn:SignalEventDefinition")(t,e,r):Hi(n,"bpmn:EscalationEventDefinition")?E("bpmn:EscalationEventDefinition")(t,e,r):Hi(n,"bpmn:LinkEventDefinition")?E("bpmn:LinkEventDefinition")(t,e,r):Hi(n,"bpmn:ErrorEventDefinition")?E("bpmn:ErrorEventDefinition")(t,e,r):Hi(n,"bpmn:CancelEventDefinition")?E("bpmn:CancelEventDefinition")(t,e,r):Hi(n,"bpmn:CompensateEventDefinition")?E("bpmn:CompensateEventDefinition")(t,e,r):Hi(n,"bpmn:TerminateEventDefinition")?E("bpmn:TerminateEventDefinition")(t,e,r):null}function S(e,t,n){n=q({size:{width:100}},n);var r=o.createText(t||"",n);return Me(r).add("djs-label"),_e(e,r),r}function k(e,t,n){return S(e,qi(t).name,{box:t,align:n,padding:5,style:{fill:Wi(t,l,p)}})}function C(e,t,n){Wn(S(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Wi(n,l,p)}}),0,-(-1*n.height),270)}function T(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,r=1;r<t.length;r++)n+="L"+t[r].x+","+t[r].y+" ";return n}var M=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=Xi),g(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Ui(t,s),stroke:Gi(t,p)};qi(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Ui(t,s),stroke:Gi(t,p)});var r=E("bpmn:Event")(e,t,n);return O(t,e),r},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Gi(t,p):Ui(t,s),stroke:n?Ui(t,s):Gi(t,p)})},"bpmn:TimerEventDefinition":function(e,t){var n=g(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Ui(t,s),stroke:Gi(t,p)});x(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Gi(t,p)});for(var i=0;i<12;i++){var o=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+a+")",stroke:Gi(t,p)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Gi(t,p)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=x(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)});return Xn(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Gi(t,p):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)})},"bpmn:EndEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:4,fill:Ui(t,s),stroke:Gi(t,p)});return O(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return g(e,t.width,t.height,8,{strokeWidth:4,fill:Gi(t,p),stroke:Gi(t,p)})},"bpmn:IntermediateEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)});return g(e,t.width,t.height,3,{strokeWidth:1,fill:Ui(t,"none"),stroke:Gi(t,p)}),O(t,e),n},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=Xi),v(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Ui(t,s),stroke:Gi(t,p)},r=E("bpmn:Activity")(e,t,n);return k(e,t,"center-middle"),A(e,t),r},"bpmn:ServiceTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Ui(t,s)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:UserTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ManualTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:SendTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Gi(t,p),stroke:Ui(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,i=qi(t),o=E("bpmn:Task")(e,t);return i.instantiate?(g(e,28,28,4.4,{strokeWidth:1}),n=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(e,n,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),o},"bpmn:ScriptTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Gi(t,p)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=E("bpmn:Task")(e,t);return Oe(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Ui(t,"#aaaaaa"),stroke:Gi(t,p)}),Oe(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Gi(t,p)}),n},"bpmn:SubProcess":function(e,t,n){n=q({fill:Ui(t,s),stroke:Gi(t,p)},n);var r=E("bpmn:Activity")(e,t,n),i=Bi(t);return Li(t)&&Oe(r,{strokeDasharray:"1,2"}),k(e,t,i?"center-top":"center-middle"),i?A(e,t):A(e,t,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return E("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var r=E("bpmn:SubProcess")(e,t),i=n.style(["no-fill","no-events"],{stroke:Gi(t,p)});return v(e,t.width,t.height,8,3,i),r},"bpmn:CallActivity":function(e,t){return E("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:Xi,fill:Ui(t,s),stroke:Gi(t,p)},r=E("bpmn:Lane")(e,t,n);Bi(t)?(b(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Gi(t,p)}),C(e,qi(t).name,t)):S(e,qi(t).name,{box:t,align:"center-middle",style:{fill:Wi(t,l,p)}});return!!qi(t).participantMultiplicity&&E("ParticipantMultiplicityMarker")(e,t),r},"bpmn:Lane":function(e,t,n){var r=v(e,t.width,t.height,0,q({fill:Ui(t,s),fillOpacity:.35,stroke:Gi(t,p)},n)),i=qi(t);"bpmn:Lane"===i.$type&&C(e,i.name,t);return r},"bpmn:InclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return g(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t),i=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Pi(t).isMarkerVisible&&x(e,i,{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ComplexGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ParallelGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:EventBasedGateway":function(e,t){var n=qi(t),i=E("bpmn:Gateway")(e,t);g(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Gi(t,p)});var o=n.eventGatewayType,a=!!n.instantiate;if("Parallel"===o){var s=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});Oe(x(e,s),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a)Oe(g(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Gi(t,p)});!function(){var n=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),i={strokeWidth:2,fill:Ui(t,"none"),stroke:Gi(t,p)};x(e,n,i)}()}return i},"bpmn:Gateway":function(e,t){var n={fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)};return function(e,t,n,r){var i=t/2,o=n/2,a=[{x:i,y:0},{x:t,y:o},{x:i,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");r=d(r,{stroke:"black",strokeWidth:2,fill:"white"});var s=Ie("polygon");return Oe(s,{points:a}),Oe(s,r),_e(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,r=T(t),i=Ui(t,s),o=Gi(t,p),a=x(e,r,{strokeLinejoin:"round",markerEnd:y("sequenceflow-end",i,o),stroke:Gi(t,p)}),l=qi(t);return t.source&&(n=t.source.businessObject,l.conditionExpression&&n.$instanceOf("bpmn:Activity")&&Oe(a,{markerStart:y("conditional-flow-marker",i,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===l&&Oe(a,{markerStart:y("conditional-default-flow-marker",i,o)})),a},"bpmn:Association":function(e,t,n){var r=qi(t),i=Ui(t,s),o=Gi(t,p);return n=q({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Gi(t,p)},n||{}),"One"!==r.associationDirection&&"Both"!==r.associationDirection||(n.markerEnd=y("association-end",i,o)),"Both"===r.associationDirection&&(n.markerStart=y("association-start",i,o)),b(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Ui(t,s),r=Gi(t,p);return E("bpmn:Association")(e,t,{markerEnd:y("association-end",n,r)})},"bpmn:DataOutputAssociation":function(e,t){var n=Ui(t,s),r=Gi(t,p);return E("bpmn:Association")(e,t,{markerEnd:y("association-end",n,r)})},"bpmn:MessageFlow":function(e,t){var n=qi(t),i=Pi(t),o=Ui(t,s),a=Gi(t,p),c=x(e,T(t),{markerEnd:y("messageflow-end",o,a),markerStart:y("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Gi(t,p)});if(n.messageRef){var u=c.getPointAtLength(c.getTotalLength()/2),d=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),h={strokeWidth:1};"initiating"===i.messageVisibleKind?(h.fill="white",h.stroke="black"):(h.fill="#888",h.stroke="white");var m=x(e,d,h),f=S(e,n.messageRef.name,{align:"center-top",fitBox:!0,style:{fill:Gi(t,l)}}),g=m.getBBox(),v=f.getBBox();Wn(f,u.x-v.width/2,u.y+g.height/2+10,0)}return c},"bpmn:DataObject":function(e,t){var n=x(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(qi(t))&&function(e,t){var n=(t.height-18)/t.height,i=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:n}});x(e,i,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return x(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)})},"bpmn:BoundaryEvent":function(e,t){var n=qi(t).cancelActivity,r={strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)};n||(r.strokeDasharray="6",r.strokeLinecap="round");var i=q({},r,{fillOpacity:1}),o=q({},r,{fill:"none"}),a=E("bpmn:Event")(e,t,i);return g(e,t.width,t.height,3,o),O(t,e),a},"bpmn:Group":function(e,t){return v(e,t.width,t.height,10,{stroke:Gi(t,p),strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return S(e,Vi(t),{box:n,fitBox:!0,style:q({},o.getExternalStyle(),{fill:Wi(t,l,p)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Gi(t,p)}),S(e,qi(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Wi(t,l,p)}}),n},ParticipantMultiplicityMarker:function(e,t){w("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:2,fill:Ui(t,s),stroke:Gi(t,p)})},SubProcessMarker:function(e,t){Kn(v(e,14,14,0,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),t.width/2-7.5,t.height-20),w("sub-process",e,r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},ParallelMarker:function(e,t,n){w("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},SequentialMarker:function(e,t,n){w("sequential",e,r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},CompensationMarker:function(e,t,n){w("compensation",e,r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)})},LoopMarker:function(e,t,n){w("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){w("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)})}};function A(e,t,n){var r,i=qi(t),o=n&&-1!==n.indexOf("SubProcessMarker");r=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},_(n,(function(n){E(n)(e,t,r)})),i.isForCompensation&&E("CompensationMarker")(e,t,r),"bpmn:AdHocSubProcess"===i.$type&&E("AdhocMarker")(e,t,r);var a=i.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&E("LoopMarker")(e,t,r),!1===s&&E("ParallelMarker")(e,t,r),!0===s&&E("SequentialMarker")(e,t,r))}this._drawPath=x,this._renderer=E}r(Yi,st),Yi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Yi.prototype.canRender=function(e){return wi(e,"bpmn:BaseElement")},Yi.prototype.drawShape=function(e,t){var n=t.type;return this._renderer(n)(e,t)},Yi.prototype.drawConnection=function(e,t){var n=t.type;return this._renderer(n)(e,t)},Yi.prototype.getShapePath=function(e){return wi(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,pt([["M",n,r],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])):wi(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return pt([["M",n+t,r],["l",i-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-i,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):wi(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return pt([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,r=e.width;return pt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var Zi={width:150,height:50};function Ji(e,t){var n;t.textContent=e;try{var r,i=""===e;return t.textContent=i?"dummy":e,r={width:(n=t.getBBox()).width+2*n.x,height:n.height},i&&(r.width=0),r}catch(e){return{width:0,height:0}}}function Qi(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=Ji(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return eo(e,o,i,r);o=to(o,r.width,t)}}function eo(e,t,n,r){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:r.width,height:r.height,text:t}}function to(e,t,n){var r=Math.max(e.length*(n/t),1),i=function(e,t){var n,r=e.split(/(\s|-|\u00AD)/g),i=[],o=0;if(r.length>1)for(;n=r.shift();){if(!(n.length+o<t)){"-"!==n&&"­"!==n||i.pop();break}i.push(n),o+=n.length}var a=i[i.length-1];return a&&"­"===a&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function no(e){this._config=q({},{size:Zi,padding:0,style:{},align:"center-top"},e||{})}no.prototype.createText=function(e,t){return this.layoutText(e,t).element},no.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},no.prototype.layoutText=function(e,t){var n=q({},this._config.size,t.box),r=q({},this._config.style,t.style),i=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return h(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),p=e.split(/\u00AD?\r?\n/),l=[],c=n.width-o.left-o.right,u=Ie("text");for(Oe(u,{x:0,y:0}),Oe(u,r),_e(function(){var e=document.getElementById("helper-svg");return e||(Oe(e=Ie("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}(),u);p.length;)l.push(Qi(p,c,u));"middle"===i.vertical&&(o.top=o.bottom=0);var d=P(l,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,m=P(l,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===i.vertical&&(f+=(n.height-d)/2),f-=(s||l[0].height)/4;var y=Ie("text");return Oe(y,r),_(l,(function(e){var t;switch(f+=s||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(a?m:c)-o.right-e.width;break;default:t=Math.max(((a?m:c)-e.width)/2+o.left,0)}var n=Ie("tspan");Oe(n,{x:t,y:f}),n.textContent=e.text,_e(y,n)})),Re(u),{dimensions:{width:m,height:d},element:y}};function ro(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=q({},t,{fontSize:n},e&&e.externalStyle||{}),i=new no({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var r=i.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(r.height))}},this.createText=function(e,t){return i.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}ro.$inject=["config.textRenderer"];var io=/\{([^{}]+)\}/g,oo=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var ao={__init__:["bpmnRenderer"],bpmnRenderer:["type",Yi],textRenderer:["type",ro],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,r,i=this.pathMap[e];t.abspos?(n=t.abspos.x,r=t.abspos.y):(n=t.containerWidth*t.position.mx,r=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var p=t.containerHeight/i.height*t.yScaleFactor,l=t.containerWidth/i.width*t.xScaleFactor,c=0;c<i.heightElements.length;c++)s["y"+c]=i.heightElements[c]*p;for(var u=0;u<i.widthElements.length;u++)s["x"+u]=i.widthElements[u]*l}return o=i.d,a={mx:n,my:r,e:s},String(o).replace(io,(function(e,t){return function(e,t,n){var r=n;return t.replace(oo,(function(e,t,n,i,o){t=t||i,r&&(t in r&&(r=r[t]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?e:r)+""}(e,t,a)}))}}]};var so={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]},po={width:90,height:20};function lo(e){return wi(e,"bpmn:Event")||wi(e,"bpmn:Gateway")||wi(e,"bpmn:DataStoreReference")||wi(e,"bpmn:DataObjectReference")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:Group")}function co(e){return mo(e.label)}function uo(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=function(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)];return{x:n.x+(r.x-n.x)/2,y:n.y+(r.y-n.y)/2}}(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o)<Math.PI/2?s-=15:a+=15,{x:a,y:s}}function ho(e){return e.waypoints?uo(e.waypoints):wi(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+po.height/2}:{x:e.x+e.width/2,y:e.y+e.height+po.height/2}}function mo(e){return e&&!!e.labelTarget}function fo(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function yo(e,t,n){var r=e.waypoint;return!r||r.length<2?[fn(t),fn(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function go(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:yi(n),referenced:yi(t),property:r}))}function vo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}vo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],vo.prototype.add=function(e,t,n){var r,i,o,a=this._translate;if(wi(t,"bpmndi:BPMNPlane")){var s=wi(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(fo(e,t,s)),this._canvas.addRootElement(r)}else if(wi(t,"bpmndi:BPMNShape")){var p=!Bi(e,t),l=function(e){return wi(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var c=t.bounds;r=this._elementFactory.createShape(fo(e,t,{collapsed:p,hidden:i,x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height),isFrame:l})),wi(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),wi(e,"bpmn:Lane")&&(o=0),wi(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}(n,fn(c))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!wi(t,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:yi(t),semantic:yi(e)}));var u=this._getSource(e),d=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(fo(e,t,{hidden:i,source:u,target:d,waypoints:yo(t,u,d)})),wi(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),wi(e,"bpmn:SequenceFlow")&&(o=0),this._canvas.addConnection(r,n,o)}return lo(e)&&Vi(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},vo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:yi(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw go(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},vo.prototype.addLabel=function(e,t,n){var r,i,o;return r=function(e,t){var n,r,i,o=e.label;return o&&o.bounds?(i=o.bounds,r={width:Math.max(po.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=ho(t),r=po),q({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=Vi(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(fo(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Vi(n),x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)})),this._canvas.addShape(o,n.parent)},vo.prototype._getEnd=function(e,t){var n,r,i=e.$type,o=this._translate;if(r=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===i&&(r=r&&r[0]),("source"===t&&"bpmn:DataOutputAssociation"===i||"target"===t&&"bpmn:DataInputAssociation"===i)&&(r=e.$parent),n=r&&this._getElement(r))return n;throw r?go(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:yi(e),side:t}))},vo.prototype._getSource=function(e){return this._getEnd(e,"source")},vo.prototype._getTarget=function(e){return this._getEnd(e,"target")},vo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var bo={__depends__:[ao,{__depends__:[so],bpmnImporter:["type",vo]}]};function xo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function wo(e){return e.originalEvent||e.srcEvent}function _o(e,t){xo(e),xo(wo(e))}function Eo(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 Po(e,t){return(wo(e)||e).button===t}function Oo(e){return Po(e,0)}function So(e){var t=wo(e)||e;return!!Oo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function ko(e){var t=wo(e)||e;return Oo(e)&&t.shiftKey}function Co(e){return!0}function To(e){return Oo(e)||function(e){return Po(e,1)}(e)}function Mo(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(p[e]||Oo)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":Co,"element.mousedown":To,"element.mouseup":To,"element.click":To,"element.dblclick":To};function l(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(p[n]=r),a.$delegate=me.bind(e,"svg, .djs-element",t,a)}function c(e,t,n){var r=a(n);r&&me.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,_(s,(function(e,n){c(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,_(s,(function(e,n){l(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),h={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:u};function m(e,t){return t=q({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return Oe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){_(be(".djs-hit",e),Re)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=ct(t);return f(n,"stroke"),y(e,n),n},this.createBoxHit=function(e,t,n){n=q({x:0,y:0},n);var r=Ie("rect");return f(r,t),Oe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?function(e,t){Oe(e,{points:lt(t)})}(n,e.waypoints):Oe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=c}Mo.$inject=["eventBus","elementRegistry","styles"];var Ao={__init__:["interactionEvents"],interactionEvents:["type",Mo]};function Ro(e,t,n){this.offset=6;var r=t.cls("djs-outline",["no-fill"]),i=this;function o(e,t){var n=Ie("rect");return Oe(n,q({x:10,y:10,width:100,height:100},r)),_e(e,n),n}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,r=ve(".djs-outline",n);r||(r=o(n)),i.updateShapeOutline(r,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,r=ve(".djs-outline",n);r||(r=o(n)),i.updateConnectionOutline(r,t)}))}Ro.prototype.updateShapeOutline=function(e,t){Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ro.prototype.updateConnectionOutline=function(e,t){var n=yt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ro.$inject=["eventBus","styles","elementRegistry"];var Do={__init__:["outline"],outline:["type",Ro]};function zo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}zo.$inject=["eventBus","canvas"],zo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var r=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:t})}},zo.prototype.get=function(){return this._selectedElements},zo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},zo.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();d(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter((function(e){var t=i.findRoot(e);return o===t})),t?_(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var jo="hover",No="selected";function Bo(e,t,n,r){function i(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",(function(e){i(e.element,jo)})),e.on("element.out",(function(e){o(e.element,jo)})),e.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;_(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,No)}(e)})),_(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,No)}(e)}))}))}function Io(e,t,n,r){e.on("create.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.elements,o=(n.hints||{}).autoSelect;if(r){if(!1===o)return;d(o)?t.select(o):t.select(i.filter(Lo))}})),e.on("connect.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.hover;r&&i&&t.select(i)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);b(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Oo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,a=So(e)||ko(e);if(i&&o)return a?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,a)}}))}function Lo(e){return!e.hidden}Bo.$inject=["eventBus","canvas","selection","styles"],Io.$inject=["eventBus","selection","canvas","elementRegistry"];var $o={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ao,Do],selection:["type",zo],selectionVisuals:["type",Bo],selectionBehavior:["type",Io]};function Fo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}Fo.prototype.next=function(){return this._prefix+ ++this._counter};var Vo=new Fo("ov");function Ho(e,t,n,r){var i,o;this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=Vo,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(i=n.getContainer(),o=fe('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),i.insertBefore(o,i.firstChild),o),this._init()}function qo(e,t,n){q(e.style,{left:t+"px",top:n+"px"})}function Uo(e,t){e.style.display=!1===t?"none":""}function Go(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}Ho.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ho.prototype.get=function(e){if(y(e)&&(e={id:e}),y(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?w(t.overlays,j({type:e.type})):t.overlays.slice():[]}return e.type?w(this._overlays,j({type:e.type})):e.id?this._overlays[e.id]:null},Ho.prototype.add=function(e,t,n){if(h(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=q({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},Ho.prototype.remove=function(e){var t=this.get(e)||[];d(t)||(t=[t]);var n=this;_(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(xe(e.html),xe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var r=t.overlays.indexOf(e);-1!==r&&t.overlays.splice(r,1)}}))},Ho.prototype.show=function(){Uo(this._overlayRoot)},Ho.prototype.hide=function(){Uo(this._overlayRoot,!1)},Ho.prototype.clear=function(){this._overlays={},this._overlayContainers=[],re(this._overlayRoot)},Ho.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=yt(t);r=o.x,i=o.y}qo(n,r,i),Y(e.html,"data-container-id",t.id)},Ho.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,a=r.left,s=r.top;void 0!==r.right&&(t=o.waypoints?yt(o).width:o.width,a=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?yt(o).height:o.height,s=-1*r.bottom+n);qo(i,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ho.prototype._createOverlayContainer=function(e){var t=fe('<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},Ho.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Go(this._overlayRoot,n)},Ho.prototype._getOverlayContainer=function(e,t){var n=b(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},Ho.prototype._addOverlay=function(e){var t,n,r=e.id,i=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),y(o)&&(o=fe(o)),n=this._getOverlayContainer(i),(t=fe('<div class="djs-overlay" data-overlay-id="'+r+'" style="position: absolute">')).appendChild(o),e.type&&te(t).add("djs-overlay-"+e.type),Uo(t,this._canvas.findRoot(i)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[r]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ho.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=!0;(r!==this._canvas.getRootElement()||n&&(c(i)&&i>t.scale||c(o)&&o<t.scale))&&(s=!1),Uo(a,s),this._updateOverlayScale(e,t)},Ho.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),c(n)&&t.scale<n&&(i=(1/t.scale||1)*n),c(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),c(i)&&(s="scale("+i+","+i+")"),Go(a,s)},Ho.prototype._updateOverlaysVisibilty=function(e){var t=this;_(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},Ho.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;_(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){xe(r.html);var i=t._overlayContainers.indexOf(r);-1!==i&&t._overlayContainers.splice(i,1)}})),e.on("element.changed",500,(function(e){var n=e.element,r=t._getOverlayContainer(n,!0);r&&(_(r.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(r))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&te(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var Wo={__init__:["overlays"],overlays:["type",Ho]};function Ko(e,t,n,r){e.on("element.changed",(function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=n.getGraphics(i)),r.gfx&&e.fire(gt(i)+".changed",r)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),r.updateContainments(n)})),e.on("shape.changed",(function(e){r.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){r.update("connection",e.element,e.gfx)}))}Ko.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Xo={__init__:["changeSupport"],changeSupport:["type",Ko]};function Yo(e){this._eventBus=e}Yo.$inject=["eventBus"],Yo.prototype.on=function(e,t,n,r,i,o){if((f(t)||m(t))&&(o=i,i=r,r=n,n=t,t=null),f(n)&&(o=i,i=r,r=n,n=1e3),h(i)&&(o=i,i=!1),!f(r))throw new Error("handlerFn must be a function");d(e)||(e=[e]);var a=this._eventBus;_(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))};function Zo(e,t){t.invoke(Yo,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}_(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],(function(e){Yo.prototype[e]=function(t,n,r,i,o){(f(t)||m(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}})),r(Zo,Yo),Zo.$inject=["canvas","injector"];var Jo={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Zo]},Qo=n((function(t,n){var r;r=e,t.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),r=n.length,i=-1,o="",a=n.charCodeAt(0);++i<r;)0!=(t=n.charCodeAt(i))?o+=t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==i&&1==r&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(r)})),ea={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BpmnModeler=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}function n(e){var t={exports:{}};return e(t,t.exports),t.exports}var r=n((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var r=Math.log(Math.pow(2,e))/Math.log(n),i=2;r===1/0;i*=2)r=Math.log(Math.pow(2,e/i))/Math.log(n)*i;var o=r-Math.floor(r),a="";for(i=0;i<Math.floor(r);i++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var p=parseInt(a,n);return p!==1/0&&p>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,r){var i=function(i){var a=0;do{if(a++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=n||16,i}}));function o(e){if(!(this instanceof o))return new o(e);e=e||[128,36,1],this._seed=e.length?i.rack(e[0],e[1],e[2]):e}function a(e){return Array.prototype.concat.apply([],e)}o.prototype.next=function(e){return this._seed(e||!0)},o.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(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 s=Object.prototype.toString,p=Object.prototype.hasOwnProperty;function l(e){return void 0===e}function c(e){return void 0!==e}function u(e){return null==e}function d(e){return"[object Array]"===s.call(e)}function h(e){return"[object Object]"===s.call(e)}function m(e){return"[object Number]"===s.call(e)}function f(e){var t=s.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function y(e){return"[object String]"===s.call(e)}function g(e){if(!d(e))throw new Error("must supply array")}function v(e,t){return p.call(e,t)}function b(e,t){var n;return t=B(t),_(e,(function(e,r){if(t(e,r))return n=e,!1})),n}function x(e,t){t=B(t);var n=d(e)?-1:void 0;return _(e,(function(e,r){if(t(e,r))return n=r,!1})),n}function w(e,t){var n=[];return _(e,(function(e,r){t(e,r)&&n.push(e)})),n}function _(e,t){var n;if(!l(e)){var r=d(e)?L:I;for(var i in e)if(v(e,i)&&!1===t(n=e[i],r(i)))return n}}function E(e,t){return l(e)?[]:(g(e),t=B(t),e.filter((function(e,n){return!t(e,n)})))}function P(e,t,n){return _(e,(function(e,r){n=t(n,e,r)})),n}function O(e,t){return!!P(e,(function(e,n,r){return e&&t(n,r)}),!0)}function S(e,t){return!!b(e,t)}function k(e,t){var n=[];return _(e,(function(e,r){n.push(t(e,r))})),n}function C(e){return e&&Object.keys(e)||[]}function T(e){return C(e).length}function M(e){return k(e,(function(e){return e}))}function A(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=N(t),_(e,(function(e){var r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function R(e){e=N(e);for(var t={},n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];_(r,(function(n){return A(n,e,t)}));var o=k(t,(function(e,t){return e[0]}));return o}var D=R;function z(e,t){t=N(t);var n=[];return _(e,(function(e,r){for(var i=t(e,r),o={d:i,v:e},a=0;a<n.length;a++){if(i<n[a].d)return void n.splice(a,0,o)}n.push(o)})),k(n,(function(e){return e.v}))}function j(e){return function(t){return O(e,(function(e,n){return t[n]===e}))}}function N(e){return f(e)?e:function(t){return t[e]}}function B(e){return f(e)?e:function(t){return t===e}}function I(e){return e}function L(e){return Number(e)}function $(e,t){var n,r,i,o;function a(n){var a=Date.now(),l=n?0:o+t-a;if(l>0)return s(l);e.apply(i,r),p()}function s(e){n=setTimeout(a,e)}function p(){n&&clearTimeout(n),n=o=r=i=void 0}function l(){o=Date.now();for(var e=arguments.length,a=new Array(e),p=0;p<e;p++)a[p]=arguments[p];r=a,i=this,n||s(t)}return l.flush=function(){n&&a(!0),p()},l.cancel=p,l}function F(e,t){return e.bind(t)}function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function q(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return H.apply(void 0,[e].concat(n))}function U(e,t,n){var r=e;return _(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+V(e)+". Key should be of type number or string.");if("constructor"===e)throw new Error("illegal key: constructor");if("__proto__"===e)throw new Error("illegal key: __proto__");var o=t[i+1],a=r[e];c(o)&&u(a)&&(a=r[e]=isNaN(+o)?{}:[]),l(o)?l(n)?delete r[e]:r[e]=n:r=a})),e}function G(e,t,n){var r=e;return _(t,(function(e){if(u(r))return r=void 0,!1;r=r[e]})),l(r)?n:r}function W(e,t){var n={},r=Object(e);return _(t,(function(t){t in r&&(n[t]=e[t])})),n}function K(e,t){var n={};return _(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}var X=Object.freeze({__proto__:null,assign:q,bind:F,debounce:$,ensureArray:g,every:O,filter:w,find:b,findIndex:x,flatten:a,forEach:_,get:G,groupBy:A,has:v,isArray:d,isDefined:c,isFunction:f,isNil:u,isNumber:m,isObject:h,isString:y,isUndefined:l,keys:C,map:k,matchPattern:j,merge:function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.length?(_(r,(function(n){n&&h(n)&&_(n,(function(n,r){if("__proto__"!==r){var i=t[r];h(n)?(h(i)||(i={}),t[r]=e(i,n)):t[r]=n}}))})),t):t},omit:K,pick:W,reduce:P,set:U,size:T,some:S,sortBy:z,throttle:function(e,t){var n=!1;return function(){n||(e.apply(void 0,arguments),n=!0,setTimeout((function(){n=!1}),t))}},unionBy:D,uniqueBy:R,values:M,without:E});function Y(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var Z=[].indexOf,J=function(e,t){if(Z)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},Q=/\s+/,ee=Object.prototype.toString;function te(e){return new ne(e)}function ne(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function re(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}ne.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~J(t,e)||t.push(e),this.el.className=t.join(" "),this},ne.prototype.remove=function(e){if("[object RegExp]"==ee.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=J(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},ne.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},ne.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},ne.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Q);return""===e[0]&&e.shift(),e},ne.prototype.has=ne.prototype.contains=function(e){return this.list?this.list.contains(e):!!~J(this.array(),e)};var ie="undefined"!=typeof Element?Element.prototype:{},oe=ie.matches||ie.matchesSelector||ie.webkitMatchesSelector||ie.mozMatchesSelector||ie.msMatchesSelector||ie.oMatchesSelector,ae=function(e,t){if(!e||1!==e.nodeType)return!1;if(oe)return oe.call(e,t);for(var n=e.parentNode.querySelectorAll(t),r=0;r<n.length;r++)if(n[r]==e)return!0;return!1};function se(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(ae(r,t))return r;r=r.parentNode}return ae(r,t)?r:null}var pe=window.addEventListener?"addEventListener":"attachEvent",le=window.removeEventListener?"removeEventListener":"detachEvent",ce="addEventListener"!==pe?"on":"",ue={bind:function(e,t,n,r){return e[pe](ce+t,n,r||!1),n},unbind:function(e,t,n,r){return e[le](ce+t,n,r||!1),n}},de=["focus","blur"];var he,me={bind:function(e,t,n,r,i){return-1!==de.indexOf(n)&&(i=!0),ue.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=se(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==de.indexOf(t)&&(r=!0),ue.unbind(e,t,n,r)}},fe=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,o=ge[r]||ge._default,a=o[0],s=o[1],p=o[2];(i=t.createElement("div")).innerHTML=s+e+p;for(;a--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var l=t.createDocumentFragment();for(;i.firstChild;)l.appendChild(i.removeChild(i.firstChild));return l},ye=!1;"undefined"!=typeof document&&((he=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',ye=!he.getElementsByTagName("link").length,he=void 0);var ge={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:ye?[1,"X<div>","</div>"]:[0,"",""]};function ve(e,t){return(t=t||document).querySelector(e)}function be(e,t){return(t=t||document).querySelectorAll(e)}function xe(e){e.parentNode&&e.parentNode.removeChild(e)}function we(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 _e(e,t){return we(t,e),e}ge.td=ge.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],ge.option=ge.optgroup=[1,'<select multiple="multiple">',"</select>"],ge.thead=ge.tbody=ge.colgroup=ge.caption=ge.tfoot=[1,"<table>","</table>"],ge.polyline=ge.ellipse=ge.polygon=ge.circle=ge.text=ge.line=ge.path=ge.rect=ge.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Ee={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":2,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Pe(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Ee[r];i?(2===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function Oe(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return Ee[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);Pe(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Pe(e,r,t[r])}(e,t);return e}function Se(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 ke=/\s+/,Ce=Object.prototype.toString;function Te(e){return void 0!==e}function Me(e){return new Ae(e)}function Ae(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Re(e){var t=e.parentNode;return t&&t.removeChild(e),e}function De(e){for(var t;t=e.firstChild;)Re(t);return e}function ze(e){return e.cloneNode(!0)}Ae.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Se(t,e)||t.push(e),Te(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Ae.prototype.remove=function(e){if("[object RegExp]"===Ce.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Se(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Ae.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},Ae.prototype.toggle=function(e,t){return this.list?(Te(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Te(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Ae.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(ke);return""===e[0]&&e.shift(),e},Ae.prototype.has=Ae.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Se(this.array(),e)};var je="http://www.w3.org/2000/svg",Ne='<svg xmlns="'+je+'"';function Be(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(je)&&(e=Ne+e.substring(4)):(e=Ne+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var r=document.createDocumentFragment(),i=n.firstChild;i.firstChild;)r.appendChild(i.firstChild);return r}function Ie(e,t){var n;return"<"===e.charAt(0)?(n=Be(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(je,e),t&&Oe(n,t),n}var Le=Ie("svg");function $e(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function Fe(e){return e?Le.createSVGTransformFromMatrix(e):Le.createSVGTransform()}var Ve=/([&<>]{1})/g,He=/([\n\r"]{1})/g,qe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Ue(e,t){return e.replace(t,(function(e,t){return qe[t]||t}))}function Ge(e,t){var n,r,i,o,a;switch(e.nodeType){case 3:t.push(Ue(e.textContent,Ve));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,r=(i=e.attributes).length;n<r;++n)o=i.item(n),t.push(" ",o.name,'="',Ue(o.value,He),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(a=e.childNodes).length;n<r;++n)Ge(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Ue(e.nodeValue,Ve),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function We(e,t){var n=Be(t);if(De(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var r,i=(r=n.childNodes,Array.prototype.slice.call(r)),o=0;o<i.length;o++)we(i[o],e)}}function Ke(e,t){if(void 0!==t){try{We(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)Ge(t,n),t=t.nextSibling;return n.join("")}(e)}function Xe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ye(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,r;for(e.clear(),n=0;r=t[n];n++)e.appendItem(Xe(e,r))}(n,t)),n.consolidate()}var Ze=/^class /;function Je(e){return"[object Array]"===Object.prototype.toString.call(e)}function Qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function et(){var e=Array.prototype.slice.call(arguments);1===e.length&&Je(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var tt=/constructor\s*[^(]*\(\s*([^)]*)\)/m,nt=/^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m,rt=/\/\*([^*]*)\*\//m;function it(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return Ze.test(e.toString())}(e)?tt:nt);return t&&t[1]&&t[1].split(",").map((function(e){return(t=e.match(rt))?t[1].trim():e.trim()}))||[]}function ot(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}function at(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'+e+'"!')}};var n=[],r=this._providers=Object.create(t._providers||null),i=this._instances=Object.create(null),o=i.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?e+" (Resolving: "+t+")":e)},s=function(e,o){if(!r[e]&&-1!==e.indexOf(".")){for(var p=e.split("."),l=s(p.shift());p.length;)l=l[p.shift()];return l}if(Qe(i,e))return i[e];if(Qe(r,e)){if(-1!==n.indexOf(e))throw n.push(e),a("Cannot resolve circular dependency!");return n.push(e),i[e]=r[e][0](r[e][1]),n.pop(),i[e]}return t.get(e,o)},p=function(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Je(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=et(e.slice())}return{fn:e,dependencies:(e.$inject||it(e)).map((function(e){return Qe(t,e)?t[e]:s(e)}))}},l=function(e){var t=p(e),n=t.fn,r=t.dependencies;return new(Function.prototype.bind.apply(n,[null].concat(r)))},c=function(e,t,n){var r=p(e,n),i=r.fn,o=r.dependencies;return i.apply(t,o)},u=function(e){return et((function(t){return e.get(t)}))},d={factory:c,type:l,value:function(e){return e}};e.forEach((function(e){function t(e,t){return"value"!==e&&Je(t)&&(t=et(t.slice())),t}if(e instanceof ot)e.forEach((function(e){var n=e[0],i=e[1],o=e[2];r[n]=[d[i],t(i,o),i]}));else if("object"==typeof e)if(e.__exports__){var n=Object.keys(e).reduce((function(t,n){return"__"!==n.substring(0,2)&&(t[n]=e[n]),t}),Object.create(null)),i=new at((e.__modules__||[]).concat([n]),o),a=et((function(e){return i.get(e)}));e.__exports__.forEach((function(e){r[e]=[a,e,"private",i]}))}else Object.keys(e).forEach((function(n){if("private"!==e[n][2]){var i=e[n][0],o=e[n][1];r[n]=[d[i],t(i,o),i]}else r[n]=e[n]}))})),this.get=s,this.invoke=c,this.instantiate=l,this.createChild=function(e,t){if(t&&t.length){var n,i,a,s,p=Object.create(null),l=Object.create(null),c=[],d=[],h=[];for(var m in r)n=r[m],-1!==t.indexOf(m)&&("private"===n[2]?-1===(i=c.indexOf(n[3]))?(a=n[3].createChild([],t),s=u(a),c.push(n[3]),d.push(a),h.push(s),p[m]=[s,m,"private",a]):p[m]=[h[i],m,"private",d[i]]:p[m]=[n[2],n[1]],l[m]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(e){-1!==n[1].$scope.indexOf(e)&&(p[m]=[n[2],n[1]],l[e]=!0)}));t.forEach((function(e){if(!l[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(p)}return new at(e,o)}}function st(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,a=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,a):n.drawConnection(o,i,a)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function pt(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function lt(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function ct(e,t){var n=Ie("polyline");return Oe(n,{points:lt(e)}),t&&Oe(n,t),n}function ut(e){return w(e,(function(t){return!b(e,(function(e){return e!==t&&dt(t,e)}))}))}function dt(e,t){if(t){if(e===t)return t;if(e.parent)return dt(e.parent,t)}}function ht(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function mt(e,t,n){n=n||0,d(e)||(e=[e]),_(e,(function(e,r){var i=t(e,r,n);d(i)&&i.length&&mt(i,t,n+1)}))}function ft(e,t){return function(e,t,n){var r=[],i=[];return mt(e,(function(e,o,a){ht(r,e,t);var s=e.children;if((-1===n||a<n)&&s&&ht(i,s,t))return s})),r}(e,!t,-1)}function yt(e,t){var n,r,i,o;return t=!!t,d(e)||(e=[e]),_(e,(function(e){var a=e;e.waypoints&&!t&&(a=yt(e.waypoints,!0));var s=a.x,p=a.y,l=a.height||0,c=a.width||0;(s<n||void 0===n)&&(n=s),(p<r||void 0===r)&&(r=p),(s+c>i||void 0===i)&&(i=s+c),(p+l>o||void 0===o)&&(o=p+l)})),{x:n,y:r,height:o-r,width:i-n}}function gt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function vt(e){return!(!e||!e.isFrame)}function bt(e,t){return q({},e||{},t||{})}st.prototype.canRender=function(){},st.prototype.drawShape=function(){},st.prototype.drawConnection=function(){},st.prototype.getShapePath=function(){},st.prototype.getConnectionPath=function(){};function xt(e,t){st.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})}r(xt,st),xt.prototype.canRender=function(){return!0},xt.prototype.drawShape=function(e,t,n){var r=Ie("rect");return Oe(r,{x:0,y:0,width:t.width||0,height:t.height||0}),vt(t)?Oe(r,q({},this.FRAME_STYLE,n||{})):Oe(r,q({},this.SHAPE_STYLE,n||{})),_e(e,r),r},xt.prototype.drawConnection=function(e,t,n){var r=ct(t.waypoints,q({},this.CONNECTION_STYLE,n||{}));return _e(e,r),r},xt.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return pt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},xt.prototype.getConnectionPath=function(e){var t,n,r=e.waypoints,i=[];for(t=0;n=r[t];t++)n=n.original||n,i.push([0===t?"M":"L",n.x,n.y]);return pt(i)},xt.$inject=["eventBus","styles"];var wt={__init__:["defaultRenderer"],defaultRenderer:["type",xt],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return q(this.style(t,n),{class:e})},this.style=function(t,n){d(t)||n||(n=t,t=[]);var r=P(t,(function(t,n){return q(t,e[n]||{})}),{});return n?q(r,n):r},this.computeStyle=function(e,n,r){return d(n)||(r=n,n=[]),t.style(n||[],q({},r,e||{}))}}]};function _t(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function Et(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var r=e.indexOf(t);if(-1!==r){if(r===n)return;if(-1===n)return;e.splice(r,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function Pt(e,t){return e&&t?e.indexOf(t):-1}function Ot(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function St(e,t,n,r){if(void 0===r&&(r=5),!e||!t||!n)return!1;var i=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Ot(e,t);return Math.abs(i/o)<=r}function kt(e,t){var n;return function(e,t){var n;n=d(e)?e:[e,t];var r=n.slice().shift();return O(n,(function(e){return Math.abs(r.y-e.y)<=2}))}(n=d(e)?e:[e,t])?"h":!!function(e,t){var n;n=d(e)?e:[e,t];var r=n.slice().shift();return O(n,(function(e){return Math.abs(r.x-e.x)<=2}))}(n)&&"v"}function Ct(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 Tt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Mt=/,?([a-z]),?/gi,At=parseFloat,Rt=Math,Dt=Rt.PI,zt=Rt.min,jt=Rt.max,Nt=Rt.pow,Bt=Rt.abs,It=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Lt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,$t=Array.isArray||function(e){return e instanceof Array};function Ft(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Vt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Ft(e,n)&&(t[n]=Vt(e[n]));return t}function Ht(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function qt(e){var t=qt.ps=qt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Ft(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Ut(e,t,n,r){return 1===arguments.length&&(t=e.y,n=e.width,r=e.height,e=e.x),{x:e,y:t,width:n,height:r,x2:e+n,y2:t+r}}function Gt(){return this.join(",").replace(Mt,"$1")}function Wt(e){var t=Vt(e);return t.toString=Gt,t}function Kt(e,t,n,r,i,o,a,s,p){var l=1-p,c=Nt(l,3),u=Nt(l,2),d=p*p*p,h=c*t+3*u*p*r+3*l*p*p*o+d*s;return{x:en(c*e+3*u*p*n+3*l*p*p*i+d*a),y:en(h)}}function Xt(e){var t=pn.apply(null,e);return Ut(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yt(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Zt(e,t,n,r,i){return e*(e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r)-3*t+3*n}function Jt(e,t,n,r,i,o,a,s,p){null==p&&(p=1);for(var l=(p=p>1?1:p<0?0:p)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<12;h++){var m=l*c[h]+l,f=Zt(m,e,n,i,a),y=Zt(m,t,r,o,s),g=f*f+y*y;d+=u[h]*Rt.sqrt(g)}return l*d}function Qt(e,t,n,r,i,o,a,s){if(!(jt(e,n)<zt(i,a)||zt(e,n)>jt(i,a)||jt(t,r)<zt(o,s)||zt(t,r)>jt(o,s))){var p=(e*r-t*n)*(o-s)-(t-r)*(i*s-o*a),l=(e-n)*(o-s)-(t-r)*(i-a);if(l){var c=en(((e*r-t*n)*(i-a)-(e-n)*(i*s-o*a))/l),u=en(p/l),d=+c.toFixed(2),h=+u.toFixed(2);if(!(d<+zt(e,n).toFixed(2)||d>+jt(e,n).toFixed(2)||d<+zt(i,a).toFixed(2)||d>+jt(i,a).toFixed(2)||h<+zt(t,r).toFixed(2)||h>+jt(t,r).toFixed(2)||h<+zt(o,s).toFixed(2)||h>+jt(o,s).toFixed(2)))return{x:c,y:u}}}}function en(e){return Math.round(1e11*e)/1e11}function tn(e,t,n){if(!function(e,t){return e=Ut(e),Yt(t=Ut(t),e.x,e.y)||Yt(t,e.x2,e.y)||Yt(t,e.x,e.y2)||Yt(t,e.x2,e.y2)||Yt(e,t.x,t.y)||Yt(e,t.x2,t.y)||Yt(e,t.x,t.y2)||Yt(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(Xt(e),Xt(t)))return n?0:[];for(var r=Jt.apply(0,e),i=Jt.apply(0,t),o=rn(e)?1:~~(r/5)||1,a=rn(t)?1:~~(i/5)||1,s=[],p=[],l={},c=n?0:[],u=0;u<o+1;u++){var d=Kt.apply(0,e.concat(u/o));s.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<a+1;u++)d=Kt.apply(0,t.concat(u/a)),p.push({x:d.x,y:d.y,t:u/a});for(u=0;u<o;u++)for(var h=0;h<a;h++){var m,f=s[u],y=s[u+1],g=p[h],v=p[h+1],b=Bt(y.x-f.x)<.01?"y":"x",x=Bt(v.x-g.x)<.01?"y":"x",w=Qt(f.x,f.y,y.x,y.y,g.x,g.y,v.x,v.y);if(w){if(l[m=w.x.toFixed(9)+"#"+w.y.toFixed(9)])continue;l[m]=!0;var _=f.t+Bt((w[b]-f[b])/(y[b]-f[b]))*(y.t-f.t),E=g.t+Bt((w[x]-g[x])/(v[x]-g[x]))*(v.t-g.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?c++:c.push({x:w.x,y:w.y,t1:_,t2:E}))}}return c}function nn(e){var t=qt(e);if(t.abs)return Wt(t.abs);if($t(e)&&$t(e&&e[0])||(e=function(e){if(!e)return null;var t=qt(e);if(t.arr)return Vt(t.arr);var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return $t(e)&&$t(e[0])&&(r=Vt(e)),r.length||String(e).replace(It,(function(e,t,i){var o=[],a=t.toLowerCase();for(i.replace(Lt,(function(e,t){t&&o.push(+t)})),"m"==a&&o.length>2&&(r.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L");o.length>=n[a]&&(r.push([t].concat(o.splice(0,n[a]))),n[a]););})),r.toString=qt.toString,t.arr=Vt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,a=0,s=0,p=0;"M"==e[0][0]&&(a=i=+e[0][1],s=o=+e[0][2],p++,r[0]=["M",i,o]);for(var l,c,u=p,d=e.length;u<d;u++){if(r.push(l=[]),(n=(c=e[u])[0])!=n.toUpperCase())switch(l[0]=n.toUpperCase(),l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+c[6]+i,l[7]=+c[7]+o;break;case"V":l[1]=+c[1]+o;break;case"H":l[1]=+c[1]+i;break;case"M":a=+c[1]+i,s=+c[2]+o;default:for(var h=1,m=c.length;h<m;h++)l[h]=+c[h]+(h%2?i:o)}else for(var f=0,y=c.length;f<y;f++)l[f]=c[f];switch(n=n.toUpperCase(),l[0]){case"Z":i=+a,o=+s;break;case"H":i=l[1];break;case"V":o=l[1];break;case"M":a=l[l.length-2],s=l[l.length-1];default:i=l[l.length-2],o=l[l.length-1]}}return r.toString=Gt,t.abs=Wt(r),r}function rn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function on(e,t,n,r){return[e,t,n,r,n,r]}function an(e,t,n,r,i,o){var a=1/3,s=2/3;return[a*e+s*n,a*t+s*r,a*i+s*n,a*o+s*r,i,o]}function sn(e,t,n,r,i,o,a,s,p,l){var c,u=120*Dt/180,d=Dt/180*(+i||0),h=[],m=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0),r=n.join("␀"),i=t.cache=t.cache||{},o=t.count=t.count||[];return Ft(i,r)?(Ht(o,r),i[r]):(o.length>=1e3&&delete i[o.shift()],o.push(r),i[r]=e.apply(0,n),i[r])}}((function(e,t,n){return{x:e*Rt.cos(n)-t*Rt.sin(n),y:e*Rt.sin(n)+t*Rt.cos(n)}}));if(l)E=l[0],P=l[1],w=l[2],_=l[3];else{e=(c=m(e,t,-d)).x,t=c.y;var f=(e-(s=(c=m(s,p,-d)).x))/2,y=(t-(p=c.y))/2,g=f*f/(n*n)+y*y/(r*r);g>1&&(n*=g=Rt.sqrt(g),r*=g);var v=n*n,b=r*r,x=(o==a?-1:1)*Rt.sqrt(Bt((v*b-v*y*y-b*f*f)/(v*y*y+b*f*f))),w=x*n*y/r+(e+s)/2,_=x*-r*f/n+(t+p)/2,E=Rt.asin(((t-_)/r).toFixed(9)),P=Rt.asin(((p-_)/r).toFixed(9));(E=e<w?Dt-E:E)<0&&(E=2*Dt+E),(P=s<w?Dt-P:P)<0&&(P=2*Dt+P),a&&E>P&&(E-=2*Dt),!a&&P>E&&(P-=2*Dt)}var O=P-E;if(Bt(O)>u){var S=P,k=s,C=p;P=E+u*(a&&P>E?1:-1),h=sn(s=w+n*Rt.cos(P),p=_+r*Rt.sin(P),n,r,i,0,a,k,C,[P,S,w,_])}O=P-E;var T=Rt.cos(E),M=Rt.sin(E),A=Rt.cos(P),R=Rt.sin(P),D=Rt.tan(O/4),z=4/3*n*D,j=4/3*r*D,N=[e,t],B=[e+z*M,t-j*T],I=[s+z*R,p-j*A],L=[s,p];if(B[0]=2*N[0]-B[0],B[1]=2*N[1]-B[1],l)return[B,I,L].concat(h);for(var $=[],F=0,V=(h=[B,I,L].concat(h).join().split(",")).length;F<V;F++)$[F]=F%2?m(h[F-1],h[F],d).y:m(h[F],h[F+1],d).x;return $}function pn(e,t,n,r,i,o,a,s){for(var p,l,c,u,d,h,m,f,y=[],g=[[],[]],v=0;v<2;++v)if(0==v?(l=6*e-12*n+6*i,p=-3*e+9*n-9*i+3*a,c=3*n-3*e):(l=6*t-12*r+6*o,p=-3*t+9*r-9*o+3*s,c=3*r-3*t),Bt(p)<1e-12){if(Bt(l)<1e-12)continue;0<(u=-c/l)&&u<1&&y.push(u)}else m=l*l-4*c*p,f=Rt.sqrt(m),m<0||(0<(d=(-l+f)/(2*p))&&d<1&&y.push(d),0<(h=(-l-f)/(2*p))&&h<1&&y.push(h));for(var b,x=y.length,w=x;x--;)b=1-(u=y[x]),g[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*a,g[1][x]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*s;return g[0][w]=e,g[1][w]=t,g[0][w+1]=a,g[1][w+1]=s,g[0].length=g[1].length=w+2,{x0:zt.apply(0,g[0]),y0:zt.apply(0,g[1]),x1:jt.apply(0,g[0]),y1:jt.apply(0,g[1])}}function ln(e){var t=qt(e);if(t.curve)return Wt(t.curve);for(var n=nn(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(e,t,n){var r,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(sn.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*t.x-t.bx,i=2*t.y-t.by):(r=t.x,i=t.y),e=["C",r,i].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(an(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(an(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(on(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(on(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(on(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(on(t.x,t.y,t.X,t.Y))}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)a[t]="A",e.splice(t++,0,["C"].concat(r.splice(0,6)));e.splice(t,1),c=n.length}},a=[],s="",p="",l=0,c=n.length;l<c;l++){n[l]&&(s=n[l][0]),"C"!=s&&(a[l]=s,l&&(p=a[l-1])),n[l]=i(n[l],r,p),"A"!=a[l]&&"C"==s&&(a[l]="C"),o(n,l);var u=n[l],d=u.length;r.x=u[d-2],r.y=u[d-1],r.bx=At(u[d-4])||r.x,r.by=At(u[d-3])||r.y}return t.curve=Wt(n),n}var cn=function(e,t,n){e=ln(e),t=ln(t);for(var r,i,o,a,s,p,l,c,u,d,h=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])r=s=y[1],i=p=y[2];else{"C"==y[0]?(u=[r,i].concat(y.slice(1)),r=u[6],i=u[7]):(u=[r,i,r,i,s,p,s,p],r=s,i=p);for(var g=0,v=t.length;g<v;g++){var b=t[g];if("M"==b[0])o=l=b[1],a=c=b[2];else{"C"==b[0]?(d=[o,a].concat(b.slice(1)),o=d[6],a=d[7]):(d=[o,a,o,a,l,c,l,c],o=l,a=c);var x=tn(u,d,n);if(n)h+=x;else{for(var w=0,_=x.length;w<_;w++)x[w].segment1=m,x[w].segment2=g,x[w].bez1=u,x[w].bez2=d;h=h.concat(x)}}}}}return h};function un(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function dn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function hn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function mn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function fn(e){return dn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function yn(e,t,n){h(n=n||0)||(n={x:n,y:n});var r=hn(e),i=hn(t),o=r.bottom+n.y<=i.top,a=r.left-n.x>=i.right,s=r.top-n.y>=i.bottom,p=o?"top":s?"bottom":null,l=r.right+n.x<=i.left?"left":a?"right":null;return l&&p?p+"-"+l:l||p||"intersect"}function gn(e,t,n){var r=function(e,t){return cn(e,t)}(e,t);return 1===r.length||2===r.length&&Ot(r[0],r[1])<1?dn(r[0]):r.length>1?dn((r=z(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})))[n?0:r.length-1]):null}function vn(e,t){return Math.round(e*t)/t}function bn(e){return m(e)?e+"px":e}function xn(e,t,n){var r=Ie("g");Me(r).add(t);var i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}var wn={shape:["x","y","width","height"],connection:["waypoints"]};function _n(e,t,n,r){this._eventBus=t,this._elementRegistry=r,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function En(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}_n.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],_n.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=q({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),q(n.style,{position:"relative",overflow:"hidden",width:bn(e.width),height:bn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ie("svg");Oe(r,{width:"100%",height:"100%"}),_e(n,r);var i=this._viewport=xn(r,"viewport");!1!==e.deferUpdate&&(this._viewboxChanged=$(F(this._viewboxChanged,this),300)),t.on("diagram.init",(function(){t.fire("canvas.init",{svg:r,viewport:i})}),this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(function(){delete this._cachedViewbox}),this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},_n.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},_n.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=gt(t);"root"===n?e.removeRootElement(t):e._removeElement(t,n)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},_n.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},_n.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},_n.prototype._getChildIndex=function(e){return P(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},_n.prototype._createLayer=function(e,t){void 0===t&&(t=1);var n=this._getChildIndex(t);return{group:xn(this._viewport,"layer-"+e,n),index:t,visible:!0}},_n.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;var o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r},_n.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");var t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");var n=t.group;return t.visible?(Re(n),t.visible=!1,n):n},_n.prototype._removeLayer=function(e){var t=this._layers[e];t&&(delete this._layers[e],Re(t.group))},_n.prototype.getActiveLayer=function(){var e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},_n.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),e)return(this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{}).rootElement},_n.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},_n.prototype._findPlaneForRoot=function(e){return b(this._planes,(function(t){return t.rootElement===e}))},_n.prototype.getContainer=function(){return this._container},_n.prototype._updateMarker=function(e,t,n){var r;e.id||(e=this._elementRegistry.get(e)),(r=this._elementRegistry._elements[e.id])&&(_([r.gfx,r.secondaryGfx],(function(e){e&&(n?Me(e).add(t):Me(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},_n.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},_n.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},_n.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Me(this.getGraphics(e)).has(t)},_n.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},_n.prototype.getRootElement=function(){var e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},_n.prototype.addRootElement=function(e){var t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});var n=e.layer="root-"+t;this._ensureValid("root",e);var r=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},_n.prototype.removeRootElement=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter((function(t){return t.rootElement!==e})),this._rootElement===e&&(this._rootElement=null),e},_n.prototype.setRootElement=function(e,t){if(c(t))throw new Error("override not supported");if(e!==this._rootElement){if(!e)throw new Error("rootElement required");return this._findPlaneForRoot(e)||(e=this.addRootElement(e)),this._setRoot(e),e}},_n.prototype._removeRoot=function(e){var t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},_n.prototype._addRoot=function(e,t){var n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},_n.prototype._setRoot=function(e,t){var n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},_n.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");var n=wn[e];if(!O(n,(function(e){return void 0!==t[e]})))throw new Error("must supply { "+n.join(", ")+" } with "+e)},_n.prototype._setParent=function(e,t,n){Et(t.children,e,n),e.parent=t},_n.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();var i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);var a=o.create(e,t,r);return this._elementRegistry.add(t,a),o.update(e,t,a),i.fire(e+".added",{element:t,gfx:a}),t},_n.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},_n.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},_n.prototype._removeElement=function(e,t){var n=this._elementRegistry,r=this._graphicsFactory,i=this._eventBus;if(e=n.get(e.id||e))return i.fire(t+".remove",{element:e}),r.remove(e),_t(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},_n.prototype.removeShape=function(e){return this._removeElement(e,"shape")},_n.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},_n.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},_n.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},_n.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},_n.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,r,i,o,a,s,p=this._viewport,l=this.getSize();return e?(this._changeViewbox((function(){o=Math.min(l.width/e.width,l.height/e.height);var t=this._svg.createSVGMatrix().scale(o).translate(-e.x,-e.y);Ye(p,t)})),e):(t=(r=this._rootElement?this.getActiveLayer():null)&&r.getBBox()||{},n=(i=Ye(p))?i.matrix:function(e,t,n,r,i,o){var a=Le.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return $e(a,e);case 6:return $e(a,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),o=vn(n.a,1e3),a=vn(-n.e||0,1e3),s=vn(-n.f||0,1e3),e=this._cachedViewbox={x:a?a/o:0,y:s?s/o:0,width:l.width/o,height:l.height/o,scale:o,inner:{width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0},outer:l})},_n.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),En(t,n)})),{x:n.e,y:n.f}},_n.prototype.scrollToElement=function(e,t){var n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));var r=this.findRoot(e);r!==this.getRootElement()&&this.setRootElement(r),t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};var i,o,a=yt(e),s=hn(a),p=this.viewbox(),l=this.zoom();p.y+=t.top/l,p.x+=t.left/l,p.width-=(t.right+t.left)/l,p.height-=(t.bottom+t.top)/l;var c=hn(p);if(a.width<p.width&&a.height<p.height){var u=Math.max(0,s.right-c.right),d=Math.min(0,s.left-c.left),h=Math.max(0,s.bottom-c.bottom),m=Math.min(0,s.top-c.top);i=u||d,o=h||m}else i=a.x-p.x,o=a.y-p.y;this.scroll({dx:-i*l,dy:-o*l})},_n.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),vn(r.a,1e3)):this.viewbox(e).scale;var n,r},_n.prototype._fitViewport=function(e){var t,n,r=this.viewbox(),i=r.outer,o=r.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=i.width&&o.y+o.height<=i.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,i.width),height:Math.max(o.height+o.y,i.height)}:(t=Math.min(1,i.width/o.width,i.height/o.height),n={x:o.x+(e?o.width/2-i.width/t/2:0),y:o.y+(e?o.height/2-i.height/t/2:0),width:i.width/t,height:i.height/t}),this.viewbox(n),this.viewbox(!1).scale},_n.prototype._setZoom=function(e,t){var n,r,i,o,a=this._svg,s=this._viewport,p=a.createSVGMatrix(),l=a.createSVGPoint(),c=(r=s.getCTM()).a;return t?(n=q(l,t).matrixTransform(r.inverse()),i=p.translate(n.x,n.y).scale(1/c*e).translate(-n.x,-n.y),o=r.multiply(i)):o=p.scale(e),En(this._viewport,o),o},_n.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},_n.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}},_n.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Pn="data-element-id";function On(e){this._elements={},this._eventBus=e}On.$inject=["eventBus"],On.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),Oe(t,Pn,r),n&&Oe(n,Pn,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},On.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(Oe(r.gfx,Pn,""),r.secondaryGfx&&Oe(r.secondaryGfx,Pn,""),delete t[n])},On.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),r=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,r)},On.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&Oe(t,Pn,r),t},On.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Oe(e,Pn);var n=this._elements[t];return n&&n.element},On.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},On.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),r=0;r<n.length;r++){var i=t[n[r]],o=i.element;if(e(o,i.gfx))return o}},On.prototype.getAll=function(){return this.filter((function(e){return e}))},On.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var r=t[n],i=r.element,o=r.gfx;return e(i,o)}))},On.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},On.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 Sn={extend:function(e,t,n,r){var i=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,i,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,i,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function kn(e,t,n){var r=Sn.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:r}),r.length&&r.forEach((function(r){e.set(r,t.inverse,n)}))}function Cn(e,t){if(!(this instanceof Cn))return new Cn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Cn.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?kn(this,t,e):function(e,t,n){var r=t.inverse,i=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(t){if(t!==i){var o=i;i=null,o&&e.unset(o,r,n),i=t,e.set(i,r,n)}}})}(this,t,e)},Cn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Sn.isExtended(n)||kn(this,t,e),n},Cn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Cn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Cn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Tn=Cn,Mn=Sn;Tn.Collection=Mn;var An=new Tn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Rn=new Tn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Dn=new Tn({name:"attachers",collection:!0},{name:"host"}),zn=new Tn({name:"outgoing",collection:!0},{name:"source"}),jn=new Tn({name:"incoming",collection:!0},{name:"target"});function Nn(){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)}}),An.bind(this,"parent"),Rn.bind(this,"labels"),zn.bind(this,"outgoing"),jn.bind(this,"incoming")}function Bn(){Nn.call(this),An.bind(this,"children"),Dn.bind(this,"host"),Dn.bind(this,"attachers")}function In(){Bn.call(this)}function Ln(){Bn.call(this),Rn.bind(this,"labelTarget")}function $n(){Nn.call(this),zn.bind(this,"source"),jn.bind(this,"target")}r(Bn,Nn),r(In,Bn),r(Ln,Bn),r($n,Nn);var Fn={connection:$n,shape:Bn,label:Ln,root:In};function Vn(){this._uid=12}Vn.prototype.createRoot=function(e){return this.create("root",e)},Vn.prototype.createLabel=function(e){return this.create("label",e)},Vn.prototype.createShape=function(e){return this.create("shape",e)},Vn.prototype.createConnection=function(e){return this.create("connection",e)},Vn.prototype.create=function(e,t){return(t=q({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Fn[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}(e,t)};var Hn=Array.prototype.slice;function qn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Un(){}function Gn(e){return e.childNodes[0]}function Wn(e,t,n,r,i){var o=Fe();o.setTranslate(t,n);var a=Fe();a.setRotate(r||0,0,0);var s=Fe();s.setScale(i||1,i||1),Ye(e,[o,a,s])}function Kn(e,t,n){var r=Fe();r.setTranslate(t,n),Ye(e,r)}function Xn(e,t){var n=Fe();n.setRotate(t,0,0),Ye(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}function Zn(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}qn.prototype.on=function(e,t,n,r){if(e=d(e)?e:[e],f(t)&&(r=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");var i=n;r&&((i=F(n,r)).__fn=n.__fn||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},qn.prototype.once=function(e,t,n,r){var i=this;if(f(t)&&(r=n,n=t,t=1e3),!m(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(r,arguments);return i.off(e,o),t}o.__fn=n,this.on(e,t,o)},qn.prototype.off=function(e,t){e=d(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},qn.prototype.createEvent=function(e){var t=new Un;return t.init(e),t},qn.prototype.fire=function(e,t){var n,r,i,o;if(o=Hn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof Un?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==a&&(n.type=a)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},qn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},qn.prototype._destroy=function(){this._listeners={}},qn.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},qn.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{void 0!==(r=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=r,e.stopPropagation()),!1===r&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return r},qn.prototype._addListener=function(e,t){var n,r=this._getListeners(e);if(r){for(;r;){if(r.priority<t.priority)return t.next=r,void(n?n.next=t:this._setListeners(e,t));n=r,r=r.next}n.next=t}else this._setListeners(e,t)},qn.prototype._getListeners=function(e){return this._listeners[e]},qn.prototype._setListeners=function(e,t){this._listeners[e]=t},qn.prototype._removeListener=function(e,t){var n,r,i,o=this._getListeners(e);if(t)for(;o;)n=o.next,(i=o.callback)!==t&&i.__fn!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},Un.prototype.stopPropagation=function(){this.cancelBubble=!0},Un.prototype.preventDefault=function(){this.defaultPrevented=!0},Un.prototype.init=function(e){q(this,e||{})},Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Me(t=Ie("g")).add("djs-children"),_e(n.parentNode,t)):t=n,t},Yn.prototype._clear=function(e){var t=Gn(e);return re(t),t},Yn.prototype._createContainer=function(e,t,n,r){var i=Ie("g");Me(i).add("djs-group"),void 0!==n?Zn(i,t,t.childNodes[n]):_e(t,i);var o=Ie("g");Me(o).add("djs-element"),Me(o).add("djs-"+e),r&&Me(o).add("djs-frame"),_e(i,o);var a=Ie("g");return Me(a).add("djs-visual"),_e(o,a),o},Yn.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,vt(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;_(P(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),(function(e){var r=e.children;if(r){var i=t._getChildrenContainer(e);_(r.slice().reverse(),(function(e){Zn(n.getGraphics(e).parentNode,i)}))}}))},Yn.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Yn.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Yn.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),Kn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?Oe(n,"display","none"):Oe(n,"display","block")}},Yn.prototype.remove=function(e){Re(this._elementRegistry.getGraphics(e).parentNode)};var Jn={__depends__:[wt],__init__:["canvas"],canvas:["type",_n],elementRegistry:["type",On],elementFactory:["type",Vn],eventBus:["type",qn],graphicsFactory:["type",Yn]};function Qn(e){var t=[],n=[];function r(e){return t.indexOf(e)>=0}e.forEach((function e(i){r(i)||((i.__depends__||[]).forEach(e),r(i)||(!function(e){t.push(e)}(i),(i.__init__||[]).forEach((function(e){n.push(e)}))))}));var i=new at(t);return n.forEach((function(e){try{i["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}})),i}function er(e,t){this.injector=t=t||function(e){return Qn([{config:["value",e=e||{}]},Jn].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function tr(){}function nr(e,t){this.model=e,this.properties=t}er.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},er.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},tr.prototype.get=function(e){return this.$model.properties.get(this,e)},tr.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},nr.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(tr.prototype);_(e.properties,(function(e){e.isMany||void 0===e.default||(r[e.name]=e.default)})),n.defineModel(r,t),n.defineDescriptor(r,e);var i=e.ns.name;function o(e){n.define(this,"$type",{value:i,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),_(e,F((function(e,t){this.set(t,e)}),this))}return o.prototype=r,o.hasType=r.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var rr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},ir={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}};function or(e,t){var n=ir[e];return n?n(t):t}function ar(e){return!!rr[e]}function sr(e){return!!ir[e]}function pr(e,t){var n,r,i=e.split(/:/);if(1===i.length)n=e,r=t;else{if(2!==i.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=i[1],r=i[0]}return{name:e=(r?r+":":"")+n,prefix:r,localName:n}}function lr(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function cr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,_(e,F(this.registerPackage,this))}function ur(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function dr(e){this.model=e}function hr(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function mr(e){this.properties=new dr(this),this.factory=new nr(this,this.properties),this.registry=new cr(e,this.properties),this.typeCache={}}lr.prototype.build=function(){return W(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},lr.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var r=this.properties;void 0!==t?r.splice(t,0,e):r.push(e)},lr.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=i.indexOf(e);if(-1===s)throw new Error("property <"+r.name+"> not found in property list");i.splice(s,1),this.addProperty(t,n?void 0:s,a),o[r.name]=o[r.localName]=t},lr.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=pr(i[0],r),a=pr(i[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},lr.prototype.addNamedProperty=function(e,t){var n=e.ns,r=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),r[n.name]=r[n.localName]=e},lr.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},lr.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},lr.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},lr.prototype.assertNotDefined=function(e,t){var n=e.name,r=this.propertiesByName[n];if(r)throw new Error("property <"+n+"> already defined; override of <"+r.definedBy.ns.name+"#"+r.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},lr.prototype.hasProperty=function(e){return this.propertiesByName[e]},lr.prototype.addTrait=function(e,t){var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(_(e.properties,F((function(n){n=q({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var r=n.replaces,i=n.redefines;r||i?this.redefineProperty(n,r||i,r):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),r.push(e),n[i]=e)},cr.prototype.getPackage=function(e){return this.packageMap[e]},cr.prototype.getPackages=function(){return this.packages},cr.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;ur(t,e,"prefix"),ur(t,e,"uri"),_(e.types,F((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},cr.prototype.registerType=function(e,t){var n=pr((e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q(e.meta||{})})).name,t.prefix),r=n.name,i={};_(e.properties,F((function(e){var t=pr(e.name,n.prefix),r=t.name;ar(e.type)||(e.type=pr(e.type,t.prefix).name),q(e,{ns:t,name:r}),i[r]=e}),this)),q(e,{ns:n,name:r,propertiesByName:i}),_(e.extends,F((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},cr.prototype.mapTypes=function(e,t,n){var r=ar(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(e){return a(e,!0)}function a(n,r){var o=pr(n,ar(n)?"":e.prefix);i.mapTypes(o,t,r)}if(!r)throw new Error("unknown type <"+e.name+">");_(r.superClass,n?o:a),t(r,!n),_(r.traits,o)},cr.prototype.getEffectiveDescriptor=function(e){var t=pr(e),n=new lr(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var r=n.build();return this.definePackage(r,r.allTypes[r.allTypes.length-1].$pkg),r},cr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},dr.prototype.set=function(e,t,n){var r=this.model.getPropertyDescriptor(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[t]:r?i in e?e[i]=n:hr(e,r,n):e.$attrs[t]=n},dr.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var r=n.name;return!e[r]&&n.isMany&&hr(e,n,[]),e[r]},dr.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=q({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},dr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},dr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},mr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},mr.prototype.getType=function(e){var t=this.typeCache,n=y(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},mr.prototype.createAny=function(e,t,n){var r=pr(e),i={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:r.prefix,localName:r.localName,uri:t}};return this.properties.defineDescriptor(i,o),this.properties.defineModel(i,this),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),_(n,(function(e,t){h(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},mr.prototype.getPackage=function(e){return this.registry.getPackage(e)},mr.prototype.getPackages=function(){return this.registry.getPackages()},mr.prototype.getElementDescriptor=function(e){return e.$descriptor},mr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},mr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},mr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var fr=String.fromCharCode,yr=Object.prototype.hasOwnProperty,gr=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,vr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function br(e,t,n,r){return r?yr.call(vr,r)?vr[r]:"&"+r+";":fr(t||parseInt(n,16))}function xr(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(gr,br):e}Object.keys(vr).forEach((function(e){vr[e.toUpperCase()]=vr[e]}));var wr="xsi:type",_r="non-whitespace outside of root node";function Er(e){return new Error(e)}function Pr(e){return"missing namespace for prefix <"+e+">"}function Or(e){return{get:e,enumerable:!0}}function Sr(e){var t,n={};for(t in e)n[t]=e[t];return n}function kr(e){return e+"$uri"}function Cr(){return{line:0,column:0}}function Tr(e){throw e}function Mr(e){if(!this)return new Mr(e);var t,n,r,i,o,a,s,p,l,c=e&&e.proxy,u=Tr,d=Cr,h=!1,m=!1,f=null,y=!1;function g(e){e instanceof Error||(e=Er(e)),f=e,u(e,d)}function v(e){o&&(e instanceof Error||(e=Er(e)),o(e,d))}this.on=function(e,l){if("function"!=typeof l)throw Er("required args <name, cb>");switch(e){case"openTag":n=l;break;case"text":t=l;break;case"closeTag":r=l;break;case"error":u=l;break;case"warn":o=l;break;case"cdata":i=l;break;case"attention":p=l;break;case"question":s=l;break;case"comment":a=l;break;default:throw Er("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Er("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",m=!0,l=n,this},this.parse=function(e){if("string"!=typeof e)throw Er("required args <xml=string>");return f=null,function(e){var o,u,f,b,x,w,_,E,P,O,S,k=m?[]:null,C=m?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[kr(n)]=t;return r}(l):null,T=[],M=0,A=!1,R=!1,D=0,z=0,j="",N=0;function B(){if(null!==S)return S;var e,t,n,r,i,o,a,s,p,c,u,d=m&&C.xmlns,f=m&&h?[]:null,y=N,g=j,b=g.length,x={},w={};e:for(;y<b;y++)if(p=!1,!(32===(c=g.charCodeAt(y))||c<14&&c>8)){for((c<65||c>122||c>90&&c<97)&&95!==c&&58!==c&&(v("illegal first char attribute name"),p=!0),u=y+1;u<b;u++)if(!((c=g.charCodeAt(u))>96&&c<123||c>64&&c<91||c>47&&c<59||46===c||45===c||95===c)){if(32===c||c<14&&c>8){v("missing attribute value"),y=u;continue e}if(61===c)break;v("illegal attribute name char"),p=!0}if("xmlns:xmlns"===(s=g.substring(y,u))&&(v("illegal declaration of xmlns"),p=!0),34===(c=g.charCodeAt(u+1)))-1===(u=g.indexOf('"',y=u+2))&&-1!==(u=g.indexOf("'",y))&&(v("attribute value quote missmatch"),p=!0);else if(39===c)-1===(u=g.indexOf("'",y=u+2))&&-1!==(u=g.indexOf('"',y))&&(v("attribute value quote missmatch"),p=!0);else for(v("missing attribute value quotes"),p=!0,u+=1;u<b&&!(32===(c=g.charCodeAt(u+1))||c<14&&c>8);u++);for(-1===u&&(v("missing closing quotes"),u=b,p=!0),p||(o=g.substring(y,u)),y=u;u+1<b&&!(32===(c=g.charCodeAt(u+1))||c<14&&c>8);u++)y===u&&(v("illegal character after attribute end"),p=!0);if(y=u+1,!p)if(s in w)v("attribute <"+s+"> already defined");else if(w[s]=!0,m)if(h){if(null!==(i="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=xr(o),t=kr(i),!(a=l[e])){if("xmlns"===i||t in C&&C[t]!==e)do{a="ns"+M++}while(void 0!==C[a]);else a=i;l[e]=a}C[i]!==a&&(r||(C=Sr(C),r=!0),C[i]=a,"xmlns"===i&&(C[kr(a)]=e,d=a),C[t]=e),x[s]=o;continue}f.push(s,o)}else-1!==(c=s.indexOf(":"))?(n=C[s.substring(0,c)])?((s=d===n?s.substr(c+1):n+s.substr(c))===wr&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=C[n]||n)+o.substring(c)):o=d+":"+o),x[s]=o):v(Pr(s.substring(0,c))):x[s]=o;else x[s]=o}if(h)for(y=0,b=f.length;y<b;y++){if(s=f[y++],o=f[y],-1!==(c=s.indexOf(":"))){if(!(n=C[s.substring(0,c)])){v(Pr(s.substring(0,c)));continue}(s=d===n?s.substr(c+1):n+s.substr(c))===wr&&(-1!==(c=o.indexOf(":"))?(n=o.substring(0,c),o=(n=C[n]||n)+o.substring(c)):o=d+":"+o)}x[s]=o}return S=x}function I(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,a=0,s=z;D>=a&&(t=r.exec(e))&&!((s=t[0].length+t.index)>D);)i+=1,a=s;return-1==D?(o=s,n=e.substring(z)):0===z?n=e.substring(z,D):(o=D-a,n=-1==z?e.substring(D):e.substring(D,z+1)),{data:n,line:i,column:o}}d=I,c&&(O=Object.create({},{name:Or((function(){return E})),originalName:Or((function(){return P})),attrs:Or(B),ns:Or((function(){return C}))}));for(;-1!==z;){if(-1===(D=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return T.length?g("unexpected end of file"):0===z?g("missing start tag"):void(z<e.length&&e.substring(z).trim()&&v(_r));if(z!==D)if(T.length){if(t&&(t(e.substring(z,D),xr,d),y))return}else if(e.substring(z,D).trim()&&(v(_r),y))return;if(33===(x=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(z=e.indexOf("]]>",D)))return g("unclosed cdata");if(i&&(i(e.substring(D+9,z),d),y))return;z+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(z=e.indexOf("--\x3e",D)))return g("unclosed comment");if(a&&(a(e.substring(D+4,z),xr,d),y))return;z+=3;continue}}if(63!==x){for(u=D+1;;u++){if(w=e.charCodeAt(u),isNaN(w))return z=-1,g("unclosed tag");if(34===w)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===w)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===w){z=u;break}}if(33!==x){if(S={},47===x){if(A=!1,R=!0,!T.length)return g("missing open tag");if(u=E=T.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return g("closing tag mismatch");for(;b<z;b++)if(!(32===(x=e.charCodeAt(b))||x>8&&x<14))return g("close tag")}else{if(47===e.charCodeAt(z-1)?(u=E=e.substring(D+1,z-1),A=!0,R=!0):(u=E=e.substring(D+1,z),A=!0,R=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return g("illegal first char nodeName");for(b=1,f=u.length;b<f;b++)if(!((x=u.charCodeAt(b))>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),S=null;break}return g("invalid nodeName")}R||T.push(E)}if(m){if(o=C,A&&(R||k.push(o),null===S&&(h=-1!==u.indexOf("xmlns",b))&&(N=b,j=u,B(),h=!1)),P=E,-1!==(x=E.indexOf(":"))){if(!(_=C[E.substring(0,x)]))return g("missing namespace on <"+P+">");E=E.substr(x+1)}else _=C.xmlns;_&&(E=_+":"+E)}if(A&&(N=b,j=u,n&&(c?n(O,xr,R,d):n(E,B,xr,R,d),y)))return;if(R){if(r&&(r(c?O:E,xr,A,d),y))return;m&&(C=A?o:k.pop())}z+=1}else{if(p&&(p(e.substring(D,z+1),xr,d),y))return;z+=1}}else{if(-1===(z=e.indexOf("?>",D)))return g("unclosed question");if(s&&(s(e.substring(D,z+2),d),y))return;z+=2}}}(e),d=Cr,y=!1,f},this.stop=function(){y=!0}}function Ar(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Rr={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Dr="xsi:type";function zr(e){return e.xml&&e.xml.serialize}function jr(e){return zr(e)===Dr}function Nr(e,t){return Ar(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Br(e){return new Error(e)}function Ir(e){return e.$descriptor}function Lr(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Br("expected element");var t,n=this.elementsById,r=Ir(e).idProperty;if(r&&(t=e.get(r.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Br("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function $r(){}function Fr(){}function Vr(){}function Hr(e,t){this.property=e,this.context=t}function qr(e,t){this.element=t,this.propertyDesc=e}function Ur(){}function Gr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Wr(e,t,n){Gr.call(this,e,t,n)}function Kr(e,t,n){this.model=e,this.context=n}function Xr(e){e instanceof mr&&(e={model:e}),q(this,{lax:!1},e)}$r.prototype.handleEnd=function(){},$r.prototype.handleText=function(){},$r.prototype.handleNode=function(){},Fr.prototype=Object.create($r.prototype),Fr.prototype.handleNode=function(){return this},Vr.prototype=Object.create($r.prototype),Vr.prototype.handleText=function(e){this.body=(this.body||"")+e},Hr.prototype=Object.create(Vr.prototype),Hr.prototype.handleNode=function(e){if(this.element)throw Br("expected no sub nodes");return this.element=this.createReference(e),this},Hr.prototype.handleEnd=function(){this.element.id=this.body},Hr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},qr.prototype=Object.create(Vr.prototype),qr.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=or(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ur.prototype=Object.create(Vr.prototype),Ur.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},Gr.prototype=Object.create(Ur.prototype),Gr.prototype.addReference=function(e){this.context.addReference(e)},Gr.prototype.handleText=function(e){if(!Ir(this.element).bodyProperty)throw Br("unexpected body text <"+e+">");Vr.prototype.handleText.call(this,e)},Gr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ir(t).bodyProperty;n&&void 0!==e&&(e=or(n.type,e),t.set(n.name,e))},Gr.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Ir(r),o=this.context,a=new r({}),s=this.model;return _(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?_(e.split(" "),(function(e){o.addReference({element:a,property:r.ns.name,id:e})})):o.addReference({element:a,property:r.ns.name,id:e}):(r?e=or(r.type,e):"xmlns"!==n&&(t=pr(n,i.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))})),a},Gr.prototype.getPropertyForNode=function(e){var t,n,r=pr(e.name),i=this.type,o=this.model,a=Ir(i),s=r.name,p=a.propertiesByName[s];if(p&&!p.isAttr)return jr(p)&&(t=e.attributes[Dr])?(t=function(e,t){var n=pr(e);return function(e,t){var n=e.name,r=e.localName,i=t.xml&&t.xml.typePrefix;return i&&0===r.indexOf(i)?e.prefix+":"+r.slice(i.length):n}(n,t.getPackage(n.prefix))}(t,o),q({},p,{effectiveType:Ir(n=o.getType(t)).name})):p;var l=o.getPackage(r.prefix);if(l){if(t=Nr(r,l),n=o.getType(t),p=b(a.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})))return q({},p,{effectiveType:Ir(n).name})}else if(p=b(a.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})))return p;throw Br("unrecognized element <"+r.name+">")},Gr.prototype.toString=function(){return"ElementDescriptor["+Ir(this.type).name+"]"},Gr.prototype.valueHandler=function(e,t){return new qr(e,t)},Gr.prototype.referenceHandler=function(e){return new Hr(e,this.context)},Gr.prototype.handler=function(e){return"Element"===e?new Kr(this.model,e,this.context):new Gr(this.model,e,this.context)},Gr.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,sr(n=t.effectiveType||t.type))return this.valueHandler(t,r);var o=(i=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?r.get(t.name).push(o):r.set(t.name,o),t.isReference?(q(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},Wr.prototype=Object.create(Gr.prototype),Wr.prototype.createElement=function(e){var t=e.name,n=pr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),a=o&&Nr(n,o)||t;if(!i.hasType(a))throw Br("unexpected element <"+e.originalName+">");return Gr.prototype.createElement.call(this,e)},Kr.prototype=Object.create(Ur.prototype),Kr.prototype.createElement=function(e){var t=e.name,n=pr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},Kr.prototype.handleChild=function(e){var t=new Kr(this.model,"Element",this.context).handleNode(e),n=this.element,r=t.element;return void 0!==r&&((n.$children=n.$children||[]).push(r),r.$parent=n),t},Kr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Xr.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof Gr?(r=t,t={}):"string"==typeof t?(r=this.handler(t),t={}):"string"==typeof r&&(r=this.handler(r));var i=this.model,o=this.lax,a=new Lr(q({},t,{rootHandler:r})),s=new Mr({proxy:!0}),p=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function l(e,t,n){var r=t(),i=r.line,o=r.column,s=r.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var p="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:p,error:e}),!0;throw Br(p)}function c(e,t){return l(e,t,!0)}r.context=a,p.push(r);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(e,t){try{p.peek().handleText(e)}catch(e){c(e,t)}}var f=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return s.ns(f).on("openTag",(function(e,t,n,r){var i=e.attrs||{},a=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=p.peek();try{p.push(n.handleNode(e))}catch(e){l(e,t,o)&&p.push(new Fr)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){p.pop().handleEnd()})).on("cdata",m).on("text",(function(e,t,n){!function(e,t){e.trim()&&m(e,t)}(t(e),n)})).on("error",l).on("warn",c),new Promise((function(t,n){var i;try{s.parse(e),function(){var e,t,n=a.elementsById,r=a.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],s=Ir(i).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var p=i.get(s.name),l=p.indexOf(t);-1===l&&(l=p.length),o?p[l]=o:p.splice(l,1)}else i.set(s.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Br("failed to parse document as <"+r.type.$descriptor.name+">"));var p=a.warnings,l=a.references,c=a.elementsById;return i?(i.warnings=p,n(i)):t({rootElement:o,elementsById:c,references:l,warnings:p})}))},Xr.prototype.handler=function(e){return new Wr(this.model,e)};var Yr=/<|>|'|"|&|\n\r|\n/g,Zr=/<|>|&/g;function Jr(e){var t={},n={},r={},i=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?i.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.getNSKey=function(e){return void 0!==e.prefix?e.uri+"|"+e.prefix:e.uri},this.logUsed=function(t){var n=t.uri,i=this.getNSKey(t);r[i]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(i,o).filter((function(e){var n=t.getNSKey(e);return r[n]}))}}function Qr(e,t){return Ar(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function ei(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ti(e){return y(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var ni={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ri={"<":"lt",">":"gt","&":"amp"};function ii(e,t,n){return(e=y(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function oi(e){this.tagName=e}function ai(){}function si(e){this.tagName=e}function pi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function li(e,t){pi.call(this,e,t)}function ci(){this.value="",this.write=function(e){this.value+=e}}function ui(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function di(e){return e=q({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new ci,i=new ui(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new pi).build(t).serializeTo(i),!n)return r.value}}}function hi(e,t){mr.call(this,e,t)}oi.prototype.build=function(e){return this.element=e,this},oi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},ai.prototype.serializeValue=ai.prototype.serializeTo=function(e){e.append(this.escape?ii(this.value,Zr,ri):this.value)},ai.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Zr)&&(this.escape=!0),this},ei(si,ai),si.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},pi.prototype.build=function(e){this.element=e;var t,n,r=e.$descriptor,i=this.propertyDescriptor,o=r.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=i?this.nsPropertyTagName(i):this.nsTagName(r),this.tagName=this.addTagName(this.ns),o||(n=function(e){return w(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!v(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(w(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return w(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},pi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?q({localName:t.ns.localName},e):q({localName:Qr(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},pi.prototype.nsPropertyTagName=function(e){return function(e,t){return q({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},pi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},pi.prototype.nsAttributeName=function(e){var t;if(t=y(e)?pr(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}:q({localName:t.localName},n)},pi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return _(e,(function(i,o){"$body"===o?n.push((new ai).build({type:"String"},i)):"$children"===o?_(i,(function(e){n.push(new pi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},pi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=pr(t);if("xmlns"===o.prefix&&(r={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},pi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return _(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},pi.prototype.parseGenericAttributes=function(e,t){var n=this;_(t,(function(t){if(t.name!==Dr)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},pi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;_(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new ai).build(e,i[0]));else if(sr(e.type))_(i,(function(r){n.push(new si(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)_(i,(function(r){n.push(new oi(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var a=jr(e),s=function(e){return"property"===zr(e)}(e);_(i,(function(r){var i;i=a?new li(t,e):s?new pi(t,e):new pi(t),n.push(i.build(r))}))}}))},pi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new Jr(t):n=t),n},pi.prototype.logNamespace=function(e,t,n){var r=this.getNamespaces(n),i=e.uri,o=e.prefix;return r.byUri(i)&&!n||r.add(e,t),r.mapPrefix(o,i),e},pi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,p=e.uri;if(!s&&!p)return{localName:e.localName};if(i=Rr[s]||o&&(o.getPackage(s)||{}).uri,!(p=p||i||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(p))){for(n=s,r=1;a.uriByPrefix(n);)n=s+"_"+r++;e=this.logNamespace({prefix:n,uri:p},i===p)}return s&&a.mapPrefix(s,p),e},pi.prototype.parseAttributes=function(e){var t=this,n=this.element;_(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];_(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},pi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ti(e)},pi.prototype.addAttribute=function(e,t){var n=this.attrs;y(t)&&(t=ii(t,Yr,ni)),n.push({name:e,value:t})},pi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return e.getUsed().filter((function(e){return"xml"!==e.prefix})).map((function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}}))}(n).concat(t)),_(t,(function(t){e.append(" ").append(ti(t.name)).append('="').append(t.value).append('"')}))},pi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ai;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),_(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},ei(li,pi),li.prototype.parseNsAttributes=function(e){var t=pi.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var r=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var i=e.$model.getPackage(r.uri),o=i.xml&&i.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Dr),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},li.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},hi.prototype=Object.create(mr.prototype),hi.prototype.fromXML=function(e,t,n){y(t)||(n=t,t="bpmn:Definitions");var r=new Xr(q({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},hi.prototype.toXML=function(e,t){var n=new di(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var mi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",prefix:"bpmn",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",prefix:"bpmndi",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[]},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",prefix:"dc",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",prefix:"di",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],associations:[],xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]},color:{name:"BPMN in Color",uri:"http://www.omg.org/spec/BPMN/non-normative/color/1.0",prefix:"color",types:[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function fi(e,t){return new hi(q({},mi,e),t)}function yi(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function gi(e){return function(){if(!window.Promise)throw new Error("Promises is not supported in this environment. Please polyfill Promise.");var t=arguments.length;if(!(t>=1&&f(arguments[t-1])))return e.apply(this,arguments);var n=arguments[t-1];console.warn(new Error("Passing callbacks to "+e.name+" is deprecated and will be removed in a future major release. Please switch to promises: https://bpmn.io/l/moving-to-promises.html"));var r=Array.prototype.slice.call(arguments,0,-1);e.apply(this,r).then((function(e){var t=Object.keys(e)[0];return n(null,e[t])}),(function(e){return n(e,e.warnings)}))}}function vi(e){v(e,"di")||Object.defineProperty(e,"di",{get:function(){throw new Error("Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472")}})}function bi(e,t){return e.$instanceOf(t)}function xi(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function a(e){n[e.id]=e}function s(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:yi(n)}));return e.element(n,i[n.id],r)}(n,r);return a(n),o}catch(e){p(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:yi(n)})),console.error(e)}}function p(t,n){e.error(t,n)}function l(e){var n=e.bpmnElement;n?i[n.id]?p(t("multiple DI elements defined for {element}",{element:yi(n)}),{element:n}):(i[n.id]=e,vi(n)):p(t("no bpmnElement referenced in {element}",{element:yi(e)}),{element:e})}function c(e){var t;l(t=e.plane),_(t.planeElement,u)}function u(e){l(e)}function d(){for(;r.length;)r.shift()()}function h(e,t){T(e,t),E(e.ioSpecification,t),x(e.artifacts,t),a(e)}function m(e,t){s(e,t)}function f(e,t){s(e,t)}function y(e,t){s(e,t)}function g(e,t){s(e,t)}function v(e,t){s(e,t)}function x(e,t){_(e,(function(e){bi(e,"bpmn:Association")?r.push((function(){v(e,t)})):v(e,t)}))}function E(e,t){e&&(_(e.dataInputs,o(y,t)),_(e.dataOutputs,o(g,t)))}function P(e,t){T(e,t),x(e.artifacts,t)}function O(e,t){var n=s(e,t);bi(e,"bpmn:SubProcess")&&P(e,n||t),bi(e,"bpmn:Activity")&&E(e.ioSpecification,t),r.push((function(){_(e.dataInputAssociations,o(f,t)),_(e.dataOutputAssociations,o(f,t))}))}function S(e,t){s(e,t)}function k(e,t){r.push((function(){var n=s(e,t);e.childLaneSet&&C(e.childLaneSet,n||t),function(e){_(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function C(e,t){_(e.lanes,o(k,t))}function T(e,n){!function(e,n){_(e,(function(e){bi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){s(e,t)}(e,n)})):bi(e,"bpmn:BoundaryEvent")?r.unshift((function(){O(e,n)})):bi(e,"bpmn:FlowNode")?O(e,n):bi(e,"bpmn:DataObject")||(bi(e,"bpmn:DataStoreReference")||bi(e,"bpmn:DataObjectReference")?S(e,n):p(t("unrecognized flowElement {element} in context {context}",{element:yi(e),context:n?yi(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){_(e,o(C,t))}(e.laneSets,n)}function M(e,t){var n=s(e,t),r=e.processRef;r&&h(r,n||t)}return{handleDeferred:d,handleDefinitions:function(a,s){var u=a.diagrams;if(s&&-1===u.indexOf(s))throw new Error(t("diagram not part of bpmn:Definitions"));if(!s&&u&&u.length&&(s=u[0]),!s)throw new Error(t("no diagram to display"));i={},c(s);var f=s.plane;if(!f)throw new Error(t("no plane for {element}",{element:yi(s)}));var y=f.bpmnElement;if(!y){if(!(y=function(e){return b(e.rootElements,(function(e){return bi(e,"bpmn:Process")||bi(e,"bpmn:Collaboration")}))}(a)))throw new Error(t("no process or collaboration to display"));p(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:yi(f),rootElement:yi(y)})),f.bpmnElement=y,l(f)}var g,v,E=function(t,n){return e.root(t,i[t.id],n)}(y,f);if(bi(y,"bpmn:Process")||bi(y,"bpmn:SubProcess"))h(y,E);else{if(!bi(y,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:yi(f),rootElement:yi(y)}));v=E,_((g=y).participants,o(M,v)),x(g.artifacts,v),r.push((function(){!function(e,t){_(e,o(m,t))}(g.messageFlows,v)})),function(e,t){w(e,(function(e){return!n[e.id]&&bi(e,"bpmn:Process")&&e.laneSets})).forEach(o(h,t))}(a.rootElements,E)}d()},handleSubProcess:P,registerDi:l}}function wi(e,t){var n=Ei(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function _i(e,t){return S(t,(function(t){return wi(e,t)}))}function Ei(e){return e&&e.businessObject||e}function Pi(e){return e&&e.di}function Oi(e,t,n){var r,i,o,a,s=[];function p(e,t){var n=new xi({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){s.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var i=function(e,t){if(!t)return;var n,r=t.plane.bpmnElement,i=r;wi(r,"bpmn:Process")||wi(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(wi(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=wi(i,"bpmn:Collaboration")?i:b(e.rootElements,(function(e){if(wi(e,"bpmn:Collaboration"))return b(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var a=Si(o),s=[t],p=[r];return _(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==a.indexOf(t)&&-1===p.indexOf(t)&&(s.push(e),p.push(t))})),s}(e,t);if(!i)throw new Error(o("no diagram to display"));_(i,(function(t){n.handleDefinitions(e,t)}));var p=t.plane.bpmnElement.id;a.setRootElement(a.findRoot(p+"_plane")||a.findRoot(p))}return new Promise((function(l,c){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),a=e.get("canvas"),i.fire("import.render.start",{definitions:t}),p(t,n),i.fire("import.render.complete",{error:undefined,warnings:s}),l({warnings:s})}catch(e){return e.warnings=s,c(e)}}))}function Si(e){var t=[];return _(e,(function(e){e&&(t.push(e),t=t.concat(Si(e.flowElements)))})),t}var ki='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';function Ci(e){return e.join(";")}var Ti,Mi=Ci(["color: #404040"]),Ai='<div class="bjs-powered-by-lightbox" style="'+Ci(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Ci(["width: 100%","height: 100%","background: rgba(40,40,40,0.2)"])+'"></div><div class="notice" style="'+Ci(["position: absolute","left: 50%","top: 40%","transform: translate(-50%)","width: 260px","padding: 10px","background: white","box-shadow: 0 1px 4px rgba(0,0,0,0.3)","font-family: Helvetica, Arial, sans-serif","font-size: 14px","display: flex","line-height: 1.3"])+'"><a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;'+Mi+'">'+ki+'</a><span>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';function Ri(e){var t,n;e=q({},zi,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=fe('<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; '+Mi+'">'+ki+"</a>"),t.appendChild(n),ue.bind(n,"click",(function(e){Ti||(Ti=fe(Ai),me.bind(Ti,".backdrop","click",(function(e){document.body.removeChild(Ti)}))),document.body.appendChild(Ti),e.preventDefault()})),this._init(this._container,this._moddle,e)}function Di(e,t){return e.warnings=t,e}r(Ri,er),Ri.prototype.importXML=gi((function(e,t){var n=this;return new Promise((function(r,i){e=n._emit("import.parse.start",{xml:e})||e,n._moddle.fromXML(e,"bpmn:Definitions").then((function(e){var o,a,s=e.rootElement,p=e.references,l=e.warnings,c=e.elementsById;s=n._emit("import.parse.complete",(o={error:null,definitions:s,elementsById:c,references:p,warnings:l},a=n.get("eventBus").createEvent(o),Object.defineProperty(a,"context",{enumerable:!0,get:function(){return console.warn(new Error("import.parse.complete <context> is deprecated and will be removed in future library versions")),{warnings:o.warnings,references:o.references,elementsById:o.elementsById}}}),a))||s,n.importDefinitions(s,t).then((function(e){var t=[].concat(l,e.warnings||[]);return n._emit("import.done",{error:null,warnings:t}),r({warnings:t})})).catch((function(e){var t=[].concat(l,e.warnings||[]);return n._emit("import.done",{error:e,warnings:t}),i(Di(e,t))}))})).catch((function(e){return n._emit("import.parse.complete",{error:e}),e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]);return e}(e),n._emit("import.done",{error:e,warnings:e.warnings}),i(e)}))}))})),Ri.prototype.importDefinitions=gi((function(e,t){var n=this;return new Promise((function(r,i){n._setDefinitions(e),n.open(t).then((function(e){var t=e.warnings;return r({warnings:t})})).catch((function(e){return i(e)}))}))})),Ri.prototype.open=gi((function(e){var t=this._definitions,n=e,r=this;return new Promise((function(i,o){if(!t){var a=new Error("no XML imported");return o(Di(a,[]))}if("string"==typeof e&&!(n=function(e,t){if(!t)return null;return b(e.diagrams,(function(e){return e.id===t}))||null}(t,e))){var s=new Error("BPMNDiagram <"+e+"> not found");return o(Di(s,[]))}try{r.clear()}catch(e){return o(Di(e,[]))}Oi(r,t,n).then((function(e){var t=e.warnings;return i({warnings:t})})).catch((function(e){return o(e)}))}))})),Ri.prototype.saveXML=gi((function(e){e=e||{};var t=this,n=this._definitions;return new Promise((function(r){if(!n)return r({error:new Error("no definitions loaded")});n=t._emit("saveXML.start",{definitions:n})||n,t._moddle.toXML(n,e).then((function(e){var n=e.xml;return n=t._emit("saveXML.serialized",{xml:n})||n,r({xml:n})}))})).catch((function(e){return{error:e}})).then((function(e){t._emit("saveXML.done",e);var n=e.error;return n?Promise.reject(n):e}))})),Ri.prototype.saveSVG=gi((function(e){var t=this;return new Promise((function(e,n){var r,i;t._emit("saveSVG.start");try{var o=t.get("canvas"),a=o.getActiveLayer(),s=ve("defs",o._svg),p=Ke(a),l=s?"<defs>"+Ke(s)+"</defs>":"",c=a.getBBox();r='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+c.width+'" height="'+c.height+'" viewBox="'+c.x+" "+c.y+" "+c.width+" "+c.height+'" version="1.1">'+l+p+"</svg>"}catch(e){i=e}return t._emit("saveSVG.done",{error:i,svg:r}),i?n(i):e({svg:r})}))})),Ri.prototype._setDefinitions=function(e){this._definitions=e},Ri.prototype.getModules=function(){return this._modules},Ri.prototype.clear=function(){this.getDefinitions()&&er.prototype.clear.call(this)},Ri.prototype.destroy=function(){er.prototype.destroy.call(this),xe(this._container)},Ri.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Ri.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ri.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=ve(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ri.prototype.getDefinitions=function(){return this._definitions},Ri.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ri.prototype._init=function(e,t,n){var r=n.modules||this.getModules(),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),a=q(K(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:o});er.call(this,a),n&&n.container&&this.attachTo(n.container)},Ri.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ri.prototype._createContainer=function(e){var t=fe('<div class="bjs-container"></div>');return q(t.style,{width:ji(e.width),height:ji(e.height),position:e.position}),t},Ri.prototype._createModdle=function(e){return new fi(q({},this._moddleExtensions,e.moddleExtensions))},Ri.prototype._modules=[];var zi={width:"100%",height:"100%",position:"relative"};function ji(e){return e+(m(e)?"px":"")}function Ni(e){Ri.call(this,e),this.on("import.parse.complete",(function(e){e.error||this._collectIds(e.definitions,e.elementsById)}),this),this.on("diagram.destroy",(function(){this.get("moddle").ids.clear()}),this)}function Bi(e,t){return!wi(e,"bpmn:CallActivity")&&(wi(e,"bpmn:SubProcess")?!(!(t=t||Pi(e))||!wi(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!wi(e,"bpmn:Participant")||!!Ei(e).processRef)}function Ii(e){return e&&!1!==Ei(e).isInterrupting}function Li(e){return e&&!!Ei(e).triggeredByEvent}function $i(e,t){var n=Ei(e),r=!1;return n.eventDefinitions&&_(n.eventDefinitions,(function(e){wi(e,t)&&(r=!0)})),r}function Fi(e){return wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Participant")||wi(e,"bpmn:Lane")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")?"name":wi(e,"bpmn:TextAnnotation")?"text":wi(e,"bpmn:Group")?"categoryValueRef":void 0}function Vi(e){var t=e.businessObject,n=Fi(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function Hi(e,t,n){return S(e.eventDefinitions,(function(r){return r.$type===t&&function(e,t){return O(t,(function(t,n){return e[n]==t}))}(e,n)}))}function qi(e){return e.businessObject}function Ui(e,t){var n=Pi(e);return n.get("color:background-color")||n.get("bioc:fill")||t||"white"}function Gi(e,t){var n=Pi(e);return n.get("color:border-color")||n.get("bioc:stroke")||t||"black"}function Wi(e,t,n){var r=Pi(e).get("label");return r&&r.get("color:color")||t||Gi(e,n)}r(Ni,Ri),Ni.prototype._createModdle=function(e){var t=Ri.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Ni.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var Ki=new o,Xi=.95;function Yi(e,t,n,r,i,o,a){st.call(this,t,a);var s=e&&e.defaultFillColor,p=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor,c=Ki.next(),u={},d=n.computeStyle;function m(e,t){var n=q({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=Ie("marker");Oe(t.element,n),_e(a,t.element),Oe(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var s=ve("defs",i._svg);s||(s=Ie("defs"),_e(i._svg,s)),_e(s,a),u[e]=a}function f(e){return e.replace(/[^0-9a-zA-z]+/g,"_")}function y(e,t,n){var r=e+"-"+f(t)+"-"+f(n)+"-"+c;return u[r]||function(e,t,n,r){if("sequenceflow-end"===t){var i=Ie("path");Oe(i,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(e,{element:i,ref:{x:11,y:10},scale:.5,attrs:{fill:r,stroke:r}})}if("messageflow-start"===t){var o=Ie("circle");Oe(o,{cx:6,cy:6,r:3.5}),m(e,{element:o,attrs:{fill:n,stroke:r},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ie("path");Oe(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(e,{element:a,attrs:{fill:n,stroke:r,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ie("path");Oe(s,{d:"M 11 5 L 1 10 L 11 15"}),m(e,{element:s,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var p=Ie("path");Oe(p,{d:"M 1 5 L 11 10 L 1 15"}),m(e,{element:p,attrs:{fill:"none",stroke:r,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var l=Ie("path");Oe(l,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(e,{element:l,attrs:{fill:n,stroke:r},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var c=Ie("path");Oe(c,{d:"M 6 4 L 10 16"}),m(e,{element:c,attrs:{stroke:r},ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function g(e,t,n,r,i){h(r)&&(i=r,r=0),r=r||0,"none"===(i=d(i,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete i.fillOpacity;var o=t/2,a=n/2,s=Ie("circle");return Oe(s,{cx:o,cy:a,r:Math.round((t+n)/4-r)}),Oe(s,i),_e(e,s),s}function v(e,t,n,r,i,o){h(i)&&(o=i,i=0),i=i||0,o=d(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Ie("rect");return Oe(a,{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r}),Oe(a,o),_e(e,a),a}function b(e,t,n){var r=ct(t,n=d(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return _e(e,r),r}function x(e,t,n){n=d(n,["no-fill"],{strokeWidth:2,stroke:"black"});var r=Ie("path");return Oe(r,{d:t}),Oe(r,n),_e(e,r),r}function w(e,t,n,r){return x(t,n,q({"data-marker":e},r))}function E(e){return M[e]}function P(e){return function(t,n){return E(e)(t,n)}}function O(e,t){var n=qi(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?E("bpmn:ParallelMultipleEventDefinition")(t,e,r):E("bpmn:MultipleEventDefinition")(t,e,r):Hi(n,"bpmn:MessageEventDefinition")?E("bpmn:MessageEventDefinition")(t,e,r):Hi(n,"bpmn:TimerEventDefinition")?E("bpmn:TimerEventDefinition")(t,e,r):Hi(n,"bpmn:ConditionalEventDefinition")?E("bpmn:ConditionalEventDefinition")(t,e):Hi(n,"bpmn:SignalEventDefinition")?E("bpmn:SignalEventDefinition")(t,e,r):Hi(n,"bpmn:EscalationEventDefinition")?E("bpmn:EscalationEventDefinition")(t,e,r):Hi(n,"bpmn:LinkEventDefinition")?E("bpmn:LinkEventDefinition")(t,e,r):Hi(n,"bpmn:ErrorEventDefinition")?E("bpmn:ErrorEventDefinition")(t,e,r):Hi(n,"bpmn:CancelEventDefinition")?E("bpmn:CancelEventDefinition")(t,e,r):Hi(n,"bpmn:CompensateEventDefinition")?E("bpmn:CompensateEventDefinition")(t,e,r):Hi(n,"bpmn:TerminateEventDefinition")?E("bpmn:TerminateEventDefinition")(t,e,r):null}function S(e,t,n){n=q({size:{width:100}},n);var r=o.createText(t||"",n);return Me(r).add("djs-label"),_e(e,r),r}function k(e,t,n){return S(e,qi(t).name,{box:t,align:n,padding:5,style:{fill:Wi(t,l,p)}})}function C(e,t,n){Wn(S(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Wi(n,l,p)}}),0,-(-1*n.height),270)}function T(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,r=1;r<t.length;r++)n+="L"+t[r].x+","+t[r].y+" ";return n}var M=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=Xi),g(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Ui(t,s),stroke:Gi(t,p)};qi(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Ui(t,s),stroke:Gi(t,p)});var r=E("bpmn:Event")(e,t,n);return O(t,e),r},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Gi(t,p):Ui(t,s),stroke:n?Ui(t,s):Gi(t,p)})},"bpmn:TimerEventDefinition":function(e,t){var n=g(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Ui(t,s),stroke:Gi(t,p)});x(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Gi(t,p)});for(var i=0;i<12;i++){var o=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+a+")",stroke:Gi(t,p)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Gi(t,p)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=x(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)});return Xn(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Gi(t,p):"none",stroke:Gi(t,p)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Gi(t,p):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)})},"bpmn:EndEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:4,fill:Ui(t,s),stroke:Gi(t,p)});return O(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return g(e,t.width,t.height,8,{strokeWidth:4,fill:Gi(t,p),stroke:Gi(t,p)})},"bpmn:IntermediateEvent":function(e,t){var n=E("bpmn:Event")(e,t,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)});return g(e,t.width,t.height,3,{strokeWidth:1,fill:Ui(t,"none"),stroke:Gi(t,p)}),O(t,e),n},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=Xi),v(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Ui(t,s),stroke:Gi(t,p)},r=E("bpmn:Activity")(e,t,n);return k(e,t,"center-middle"),A(e,t),r},"bpmn:ServiceTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Ui(t,s)}),x(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:UserTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),x(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ManualTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:SendTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Gi(t,p),stroke:Ui(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,i=qi(t),o=E("bpmn:Task")(e,t);return i.instantiate?(g(e,28,28,4.4,{strokeWidth:1}),n=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(e,n,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),o},"bpmn:ScriptTask":function(e,t){var n=E("bpmn:Task")(e,t);return x(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Gi(t,p)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=E("bpmn:Task")(e,t);return Oe(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Ui(t,"#aaaaaa"),stroke:Gi(t,p)}),Oe(x(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Gi(t,p)}),n},"bpmn:SubProcess":function(e,t,n){n=q({fill:Ui(t,s),stroke:Gi(t,p)},n);var r=E("bpmn:Activity")(e,t,n),i=Bi(t);return Li(t)&&Oe(r,{strokeDasharray:"1,2"}),k(e,t,i?"center-top":"center-middle"),i?A(e,t):A(e,t,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return E("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var r=E("bpmn:SubProcess")(e,t),i=n.style(["no-fill","no-events"],{stroke:Gi(t,p)});return v(e,t.width,t.height,8,3,i),r},"bpmn:CallActivity":function(e,t){return E("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:Xi,fill:Ui(t,s),stroke:Gi(t,p)},r=E("bpmn:Lane")(e,t,n);Bi(t)?(b(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Gi(t,p)}),C(e,qi(t).name,t)):S(e,qi(t).name,{box:t,align:"center-middle",style:{fill:Wi(t,l,p)}});return!!qi(t).participantMultiplicity&&E("ParticipantMultiplicityMarker")(e,t),r},"bpmn:Lane":function(e,t,n){var r=v(e,t.width,t.height,0,q({fill:Ui(t,s),fillOpacity:.35,stroke:Gi(t,p)},n)),i=qi(t);"bpmn:Lane"===i.$type&&C(e,i.name,t);return r},"bpmn:InclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return g(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Ui(t,s),stroke:Gi(t,p)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=E("bpmn:Gateway")(e,t),i=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Pi(t).isMarkerVisible&&x(e,i,{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ComplexGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:ParallelGateway":function(e,t){var n=E("bpmn:Gateway")(e,t);return x(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)}),n},"bpmn:EventBasedGateway":function(e,t){var n=qi(t),i=E("bpmn:Gateway")(e,t);g(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Gi(t,p)});var o=n.eventGatewayType,a=!!n.instantiate;if("Parallel"===o){var s=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});Oe(x(e,s),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a)Oe(g(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Gi(t,p)});!function(){var n=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),i={strokeWidth:2,fill:Ui(t,"none"),stroke:Gi(t,p)};x(e,n,i)}()}return i},"bpmn:Gateway":function(e,t){var n={fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)};return function(e,t,n,r){var i=t/2,o=n/2,a=[{x:i,y:0},{x:t,y:o},{x:i,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");r=d(r,{stroke:"black",strokeWidth:2,fill:"white"});var s=Ie("polygon");return Oe(s,{points:a}),Oe(s,r),_e(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,r=T(t),i=Ui(t,s),o=Gi(t,p),a=x(e,r,{strokeLinejoin:"round",markerEnd:y("sequenceflow-end",i,o),stroke:Gi(t,p)}),l=qi(t);return t.source&&(n=t.source.businessObject,l.conditionExpression&&n.$instanceOf("bpmn:Activity")&&Oe(a,{markerStart:y("conditional-flow-marker",i,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===l&&Oe(a,{markerStart:y("conditional-default-flow-marker",i,o)})),a},"bpmn:Association":function(e,t,n){var r=qi(t),i=Ui(t,s),o=Gi(t,p);return n=q({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Gi(t,p)},n||{}),"One"!==r.associationDirection&&"Both"!==r.associationDirection||(n.markerEnd=y("association-end",i,o)),"Both"===r.associationDirection&&(n.markerStart=y("association-start",i,o)),b(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Ui(t,s),r=Gi(t,p);return E("bpmn:Association")(e,t,{markerEnd:y("association-end",n,r)})},"bpmn:DataOutputAssociation":function(e,t){var n=Ui(t,s),r=Gi(t,p);return E("bpmn:Association")(e,t,{markerEnd:y("association-end",n,r)})},"bpmn:MessageFlow":function(e,t){var n=qi(t),i=Pi(t),o=Ui(t,s),a=Gi(t,p),c=x(e,T(t),{markerEnd:y("messageflow-end",o,a),markerStart:y("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Gi(t,p)});if(n.messageRef){var u=c.getPointAtLength(c.getTotalLength()/2),d=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),h={strokeWidth:1};"initiating"===i.messageVisibleKind?(h.fill="white",h.stroke="black"):(h.fill="#888",h.stroke="white");var m=x(e,d,h),f=S(e,n.messageRef.name,{align:"center-top",fitBox:!0,style:{fill:Gi(t,l)}}),g=m.getBBox(),v=f.getBBox();Wn(f,u.x-v.width/2,u.y+g.height/2+10,0)}return c},"bpmn:DataObject":function(e,t){var n=x(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(qi(t))&&function(e,t){var n=(t.height-18)/t.height,i=r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:n}});x(e,i,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=r.getRawPath("DATA_ARROW"),i=E("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return x(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Ui(t,s),fillOpacity:Xi,stroke:Gi(t,p)})},"bpmn:BoundaryEvent":function(e,t){var n=qi(t).cancelActivity,r={strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)};n||(r.strokeDasharray="6",r.strokeLinecap="round");var i=q({},r,{fillOpacity:1}),o=q({},r,{fill:"none"}),a=E("bpmn:Event")(e,t,i);return g(e,t.width,t.height,3,o),O(t,e),a},"bpmn:Group":function(e,t){return v(e,t.width,t.height,10,{stroke:Gi(t,p),strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return S(e,Vi(t),{box:n,fitBox:!0,style:q({},o.getExternalStyle(),{fill:Wi(t,l,p)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Gi(t,p)}),S(e,qi(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Wi(t,l,p)}}),n},ParticipantMultiplicityMarker:function(e,t){w("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:2,fill:Ui(t,s),stroke:Gi(t,p)})},SubProcessMarker:function(e,t){Kn(v(e,14,14,0,{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)}),t.width/2-7.5,t.height-20),w("sub-process",e,r.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},ParallelMarker:function(e,t,n){w("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},SequentialMarker:function(e,t,n){w("sequential",e,r.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:Ui(t,s),stroke:Gi(t,p)})},CompensationMarker:function(e,t,n){w("compensation",e,r.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p)})},LoopMarker:function(e,t,n){w("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:Ui(t,s),stroke:Gi(t,p),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){w("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:Gi(t,p),stroke:Gi(t,p)})}};function A(e,t,n){var r,i=qi(t),o=n&&-1!==n.indexOf("SubProcessMarker");r=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},_(n,(function(n){E(n)(e,t,r)})),i.isForCompensation&&E("CompensationMarker")(e,t,r),"bpmn:AdHocSubProcess"===i.$type&&E("AdhocMarker")(e,t,r);var a=i.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&E("LoopMarker")(e,t,r),!1===s&&E("ParallelMarker")(e,t,r),!0===s&&E("SequentialMarker")(e,t,r))}this._drawPath=x,this._renderer=E}r(Yi,st),Yi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Yi.prototype.canRender=function(e){return wi(e,"bpmn:BaseElement")},Yi.prototype.drawShape=function(e,t){var n=t.type;return this._renderer(n)(e,t)},Yi.prototype.drawConnection=function(e,t){var n=t.type;return this._renderer(n)(e,t)},Yi.prototype.getShapePath=function(e){return wi(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,pt([["M",n,r],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])):wi(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return pt([["M",n+t,r],["l",i-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-i,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):wi(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return pt([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,r=e.width;return pt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var Zi={width:150,height:50};function Ji(e,t){var n;t.textContent=e;try{var r,i=""===e;return t.textContent=i?"dummy":e,r={width:(n=t.getBBox()).width+2*n.x,height:n.height},i&&(r.width=0),r}catch(e){return{width:0,height:0}}}function Qi(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=Ji(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return eo(e,o,i,r);o=to(o,r.width,t)}}function eo(e,t,n,r){if(t.length<n.length){var i=n.slice(t.length).trim();e.unshift(i)}return{width:r.width,height:r.height,text:t}}function to(e,t,n){var r=Math.max(e.length*(n/t),1),i=function(e,t){var n,r=e.split(/(\s|-|\u00AD)/g),i=[],o=0;if(r.length>1)for(;n=r.shift();){if(!(n.length+o<t)){"-"!==n&&"­"!==n||i.pop();break}i.push(n),o+=n.length}var a=i[i.length-1];return a&&"­"===a&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function no(e){this._config=q({},{size:Zi,padding:0,style:{},align:"center-top"},e||{})}no.prototype.createText=function(e,t){return this.layoutText(e,t).element},no.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},no.prototype.layoutText=function(e,t){var n=q({},this._config.size,t.box),r=q({},this._config.style,t.style),i=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return h(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),p=e.split(/\u00AD?\r?\n/),l=[],c=n.width-o.left-o.right,u=Ie("text");for(Oe(u,{x:0,y:0}),Oe(u,r),_e(function(){var e=document.getElementById("helper-svg");return e||(Oe(e=Ie("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}(),u);p.length;)l.push(Qi(p,c,u));"middle"===i.vertical&&(o.top=o.bottom=0);var d=P(l,(function(e,t,n){return e+(s||t.height)}),0)+o.top+o.bottom,m=P(l,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===i.vertical&&(f+=(n.height-d)/2),f-=(s||l[0].height)/4;var y=Ie("text");return Oe(y,r),_(l,(function(e){var t;switch(f+=s||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(a?m:c)-o.right-e.width;break;default:t=Math.max(((a?m:c)-e.width)/2+o.left,0)}var n=Ie("tspan");Oe(n,{x:t,y:f}),n.textContent=e.text,_e(y,n)})),Re(u),{dimensions:{width:m,height:d},element:y}};function ro(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=q({},t,{fontSize:n},e&&e.externalStyle||{}),i=new no({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var r=i.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(r.height))}},this.createText=function(e,t){return i.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return r}}ro.$inject=["config.textRenderer"];var io=/\{([^{}]+)\}/g,oo=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var ao={__init__:["bpmnRenderer"],bpmnRenderer:["type",Yi],textRenderer:["type",ro],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,r,i=this.pathMap[e];t.abspos?(n=t.abspos.x,r=t.abspos.y):(n=t.containerWidth*t.position.mx,r=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var p=t.containerHeight/i.height*t.yScaleFactor,l=t.containerWidth/i.width*t.xScaleFactor,c=0;c<i.heightElements.length;c++)s["y"+c]=i.heightElements[c]*p;for(var u=0;u<i.widthElements.length;u++)s["x"+u]=i.widthElements[u]*l}return o=i.d,a={mx:n,my:r,e:s},String(o).replace(io,(function(e,t){return function(e,t,n){var r=n;return t.replace(oo,(function(e,t,n,i,o){t=t||i,r&&(t in r&&(r=r[t]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?e:r)+""}(e,t,a)}))}}]};var so={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]},po={width:90,height:20};function lo(e){return wi(e,"bpmn:Event")||wi(e,"bpmn:Gateway")||wi(e,"bpmn:DataStoreReference")||wi(e,"bpmn:DataObjectReference")||wi(e,"bpmn:DataInput")||wi(e,"bpmn:DataOutput")||wi(e,"bpmn:SequenceFlow")||wi(e,"bpmn:MessageFlow")||wi(e,"bpmn:Group")}function co(e){return mo(e.label)}function uo(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)],i=function(e){var t=e.length/2-1,n=e[Math.floor(t)],r=e[Math.ceil(t+.01)];return{x:n.x+(r.x-n.x)/2,y:n.y+(r.y-n.y)/2}}(e),o=Math.atan((r.y-n.y)/(r.x-n.x)),a=i.x,s=i.y;return Math.abs(o)<Math.PI/2?s-=15:a+=15,{x:a,y:s}}function ho(e){return e.waypoints?uo(e.waypoints):wi(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+po.height/2}:{x:e.x+e.width/2,y:e.y+e.height+po.height/2}}function mo(e){return e&&!!e.labelTarget}function fo(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function yo(e,t,n){var r=e.waypoint;return!r||r.length<2?[fn(t),fn(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function go(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:yi(n),referenced:yi(t),property:r}))}function vo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}vo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],vo.prototype.add=function(e,t,n){var r,i,o,a=this._translate;if(wi(t,"bpmndi:BPMNPlane")){var s=wi(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(fo(e,t,s)),this._canvas.addRootElement(r)}else if(wi(t,"bpmndi:BPMNShape")){var p=!Bi(e,t),l=function(e){return wi(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var c=t.bounds;r=this._elementFactory.createShape(fo(e,t,{collapsed:p,hidden:i,x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height),isFrame:l})),wi(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),wi(e,"bpmn:Lane")&&(o=0),wi(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}(n,fn(c))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!wi(t,"bpmndi:BPMNEdge"))throw new Error(a("unknown di {di} for element {semantic}",{di:yi(t),semantic:yi(e)}));var u=this._getSource(e),d=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(fo(e,t,{hidden:i,source:u,target:d,waypoints:yo(t,u,d)})),wi(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),wi(e,"bpmn:SequenceFlow")&&(o=0),this._canvas.addConnection(r,n,o)}return lo(e)&&Vi(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},vo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:yi(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw go(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},vo.prototype.addLabel=function(e,t,n){var r,i,o;return r=function(e,t){var n,r,i,o=e.label;return o&&o.bounds?(i=o.bounds,r={width:Math.max(po.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=ho(t),r=po),q({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=Vi(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(fo(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Vi(n),x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)})),this._canvas.addShape(o,n.parent)},vo.prototype._getEnd=function(e,t){var n,r,i=e.$type,o=this._translate;if(r=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===i&&(r=r&&r[0]),("source"===t&&"bpmn:DataOutputAssociation"===i||"target"===t&&"bpmn:DataInputAssociation"===i)&&(r=e.$parent),n=r&&this._getElement(r))return n;throw r?go(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:yi(e),side:t}))},vo.prototype._getSource=function(e){return this._getEnd(e,"source")},vo.prototype._getTarget=function(e){return this._getEnd(e,"target")},vo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var bo={__depends__:[ao,{__depends__:[so],bpmnImporter:["type",vo]}]};function xo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function wo(e){return e.originalEvent||e.srcEvent}function _o(e,t){xo(e),xo(wo(e))}function Eo(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 Po(e,t){return(wo(e)||e).button===t}function Oo(e){return Po(e,0)}function So(e){var t=wo(e)||e;return!!Oo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function ko(e){var t=wo(e)||e;return Oo(e)&&t.shiftKey}function Co(e){return!0}function To(e){return Oo(e)||function(e){return Po(e,1)}(e)}function Mo(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(p[e]||Oo)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":Co,"element.mousedown":To,"element.mouseup":To,"element.click":To,"element.dblclick":To};function l(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(p[n]=r),a.$delegate=me.bind(e,"svg, .djs-element",t,a)}function c(e,t,n){var r=a(n);r&&me.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,_(s,(function(e,n){c(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,_(s,(function(e,n){l(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),h={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:u};function m(e,t){return t=q({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return Oe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){_(be(".djs-hit",e),Re)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=ct(t);return f(n,"stroke"),y(e,n),n},this.createBoxHit=function(e,t,n){n=q({x:0,y:0},n);var r=Ie("rect");return f(r,t),Oe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?function(e,t){Oe(e,{points:lt(t)})}(n,e.waypoints):Oe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=c}Mo.$inject=["eventBus","elementRegistry","styles"];var Ao={__init__:["interactionEvents"],interactionEvents:["type",Mo]};function Ro(e,t,n){this.offset=6;var r=t.cls("djs-outline",["no-fill"]),i=this;function o(e,t){var n=Ie("rect");return Oe(n,q({x:10,y:10,width:100,height:100},r)),_e(e,n),n}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,r=ve(".djs-outline",n);r||(r=o(n)),i.updateShapeOutline(r,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,r=ve(".djs-outline",n);r||(r=o(n)),i.updateConnectionOutline(r,t)}))}Ro.prototype.updateShapeOutline=function(e,t){Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ro.prototype.updateConnectionOutline=function(e,t){var n=yt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ro.$inject=["eventBus","styles","elementRegistry"];var Do={__init__:["outline"],outline:["type",Ro]};function zo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],(function(e){var t=e.element;n.deselect(t)})),e.on(["diagram.clear","root.set"],(function(e){n.select(null)}))}zo.$inject=["eventBus","canvas"],zo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var r=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:t})}},zo.prototype.get=function(){return this._selectedElements},zo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},zo.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();d(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter((function(e){var t=i.findRoot(e);return o===t})),t?_(e,(function(e){-1===n.indexOf(e)&&n.push(e)})):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:r,newSelection:n})};var jo="hover",No="selected";function Bo(e,t,n,r){function i(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",(function(e){i(e.element,jo)})),e.on("element.out",(function(e){o(e.element,jo)})),e.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;_(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,No)}(e)})),_(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,No)}(e)}))}))}function Io(e,t,n,r){e.on("create.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.elements,o=(n.hints||{}).autoSelect;if(r){if(!1===o)return;d(o)?t.select(o):t.select(i.filter(Lo))}})),e.on("connect.end",500,(function(e){var n=e.context,r=n.canExecute,i=n.hover;r&&i&&t.select(i)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);b(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Oo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,a=So(e)||ko(e);if(i&&o)return a?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,a)}}))}function Lo(e){return!e.hidden}Bo.$inject=["eventBus","canvas","selection","styles"],Io.$inject=["eventBus","selection","canvas","elementRegistry"];var $o={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ao,Do],selection:["type",zo],selectionVisuals:["type",Bo],selectionBehavior:["type",Io]};function Fo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}Fo.prototype.next=function(){return this._prefix+ ++this._counter};var Vo=new Fo("ov");function Ho(e,t,n,r){var i,o;this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=Vo,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(i=n.getContainer(),o=fe('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),i.insertBefore(o,i.firstChild),o),this._init()}function qo(e,t,n){q(e.style,{left:t+"px",top:n+"px"})}function Uo(e,t){e.style.display=!1===t?"none":""}function Go(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}Ho.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ho.prototype.get=function(e){if(y(e)&&(e={id:e}),y(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?w(t.overlays,j({type:e.type})):t.overlays.slice():[]}return e.type?w(this._overlays,j({type:e.type})):e.id?this._overlays[e.id]:null},Ho.prototype.add=function(e,t,n){if(h(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=q({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},Ho.prototype.remove=function(e){var t=this.get(e)||[];d(t)||(t=[t]);var n=this;_(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(xe(e.html),xe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var r=t.overlays.indexOf(e);-1!==r&&t.overlays.splice(r,1)}}))},Ho.prototype.show=function(){Uo(this._overlayRoot)},Ho.prototype.hide=function(){Uo(this._overlayRoot,!1)},Ho.prototype.clear=function(){this._overlays={},this._overlayContainers=[],re(this._overlayRoot)},Ho.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=yt(t);r=o.x,i=o.y}qo(n,r,i),Y(e.html,"data-container-id",t.id)},Ho.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,a=r.left,s=r.top;void 0!==r.right&&(t=o.waypoints?yt(o).width:o.width,a=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?yt(o).height:o.height,s=-1*r.bottom+n);qo(i,a||0,s||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ho.prototype._createOverlayContainer=function(e){var t=fe('<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},Ho.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Go(this._overlayRoot,n)},Ho.prototype._getOverlayContainer=function(e,t){var n=b(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},Ho.prototype._addOverlay=function(e){var t,n,r=e.id,i=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),y(o)&&(o=fe(o)),n=this._getOverlayContainer(i),(t=fe('<div class="djs-overlay" data-overlay-id="'+r+'" style="position: absolute">')).appendChild(o),e.type&&te(t).add("djs-overlay-"+e.type),Uo(t,this._canvas.findRoot(i)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[r]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ho.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=!0;(r!==this._canvas.getRootElement()||n&&(c(i)&&i>t.scale||c(o)&&o<t.scale))&&(s=!1),Uo(a,s),this._updateOverlayScale(e,t)},Ho.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),c(n)&&t.scale<n&&(i=(1/t.scale||1)*n),c(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),c(i)&&(s="scale("+i+","+i+")"),Go(a,s)},Ho.prototype._updateOverlaysVisibilty=function(e){var t=this;_(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},Ho.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",(function(e){t.hide()})),e.on("canvas.viewbox.changed",(function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()})),e.on(["shape.remove","connection.remove"],(function(e){var n=e.element;_(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){xe(r.html);var i=t._overlayContainers.indexOf(r);-1!==i&&t._overlayContainers.splice(i,1)}})),e.on("element.changed",500,(function(e){var n=e.element,r=t._getOverlayContainer(n,!0);r&&(_(r.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(r))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&te(n.html)[e.add?"add":"remove"](e.marker)})),e.on("root.set",(function(){t._updateOverlaysVisibilty(t._canvas.viewbox())})),e.on("diagram.clear",this.clear,this)};var Wo={__init__:["overlays"],overlays:["type",Ho]};function Ko(e,t,n,r){e.on("element.changed",(function(r){var i=r.element;(i.parent||i===t.getRootElement())&&(r.gfx=n.getGraphics(i)),r.gfx&&e.fire(gt(i)+".changed",r)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),r.updateContainments(n)})),e.on("shape.changed",(function(e){r.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){r.update("connection",e.element,e.gfx)}))}Ko.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Xo={__init__:["changeSupport"],changeSupport:["type",Ko]};function Yo(e){this._eventBus=e}Yo.$inject=["eventBus"],Yo.prototype.on=function(e,t,n,r,i,o){if((f(t)||m(t))&&(o=i,i=r,r=n,n=t,t=null),f(n)&&(o=i,i=r,r=n,n=1e3),h(i)&&(o=i,i=!1),!f(r))throw new Error("handlerFn must be a function");d(e)||(e=[e]);var a=this._eventBus;_(e,(function(e){var s=["commandStack",e,t].filter((function(e){return e})).join(".");a.on(s,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))};function Zo(e,t){t.invoke(Yo,this),this.executed((function(t){var n=t.context;n.rootElement?e.setRootElement(n.rootElement):n.rootElement=e.getRootElement()})),this.revert((function(t){var n=t.context;n.rootElement&&e.setRootElement(n.rootElement)}))}_(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],(function(e){Yo.prototype[e]=function(t,n,r,i,o){(f(t)||m(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}})),r(Zo,Yo),Zo.$inject=["canvas","injector"];var Jo={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Zo]},Qo=n((function(t,n){var r;r=e,t.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),r=n.length,i=-1,o="",a=n.charCodeAt(0);++i<r;)0!=(t=n.charCodeAt(i))?o+=t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==i&&1==r&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(i):n.charAt(i):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(r)})),ea={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};
2
2
  /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */function ta(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return ea[e]}))}var na="_plane";function ra(e){return function(e){return e.replace(new RegExp("_plane$"),"")}(e.id)}function ia(e){var t=e.id;return wi(e,"bpmn:SubProcess")?sa(t):t}function oa(e){return sa(e)}function aa(e){return wi(Pi(e),"bpmndi:BPMNPlane")}function sa(e){return e+na}function pa(e,t,n,r){var i=fe('<ul class="bjs-breadcrumbs"></ul>'),o=r.getContainer(),a=te(o);o.appendChild(i);var s=[];function p(e){e&&(s=function(e){for(var t=Ei(e),n=[],r=t;r;r=r.$parent)(wi(r,"bpmn:SubProcess")||wi(r,"bpmn:Process"))&&n.push(r);return n.reverse()}(e));var n=s.map((function(e){var n=ta(e.name||e.id),i=fe('<li><span class="bjs-crumb"><a title="'+n+'">'+n+"</a></span></li>"),o=r.findRoot(ia(e))||r.findRoot(e.id);if(!o&&wi(e,"bpmn:Process")){var a=t.find((function(t){var n=Ei(t);return n&&n.processRef&&n.processRef===e}));o=r.findRoot(a.id)}return i.addEventListener("click",(function(){r.setRootElement(o)})),i}));i.innerHTML="";var o=n.length>1;a.toggle("bjs-breadcrumbs-shown",o),n.forEach((function(e){i.appendChild(e)}))}e.on("element.changed",(function(e){var t=Ei(e.element);b(s,(function(e){return e===t}))&&p()})),e.on("root.set",(function(e){p(e.element)}))}function la(e,t){var n=null,r=new ca;e.on("root.set",(function(e){var i=e.element,o=t.viewbox(),a=r.get(i);if(r.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=i,!wi(i,"bpmn:Collaboration")||a){a=a||{x:0,y:0,zoom:1};var s=(o.x-a.x)*o.scale,p=(o.y-a.y)*o.scale;0===s&&0===p||t.scroll({dx:s,dy:p}),a.zoom!==o.scale&&t.zoom(a.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){r.clear(),n=null}))}function ca(){this._entries=[],this.set=function(e,t){var n=!1;for(var r in this._entries)if(this._entries[r][0]===e){this._entries[r][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}-1!==t&&this._entries.splice(t,1)}}pa.$inject=["eventBus","elementRegistry","overlays","canvas"],la.$inject=["eventBus","canvas"];var ua=180,da=160;function ha(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,(function(e,t){n.handleImport(t.definitions)}))}function ma(e){return wi(e,"bpmndi:BPMNDiagram")?e:ma(e.$parent)}ha.prototype.handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach((function(e){e.plane&&e.plane.bpmnElement&&(t._processToDiagramMap[e.plane.bpmnElement.id]=e)}));var n=[];e.diagrams.forEach((function(e){var r=t.createNewDiagrams(e.plane);Array.prototype.push.apply(n,r)})),n.forEach((function(e){t.movePlaneElementsToOrigin(e.plane)}))}},ha.prototype.createNewDiagrams=function(e){var t=this,n=[],r=[];e.get("planeElement").forEach((function(t){var i=t.bpmnElement;if(i){var o=i.$parent;wi(i,"bpmn:SubProcess")&&!t.isExpanded&&n.push(i),wi(o,"bpmn:SubProcess")&&o!==e.bpmnElement&&r.push({diElement:t,parent:o})}}));var i=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t.createDiagram(e);t._processToDiagramMap[e.id]=n,i.push(n)}})),r.forEach((function(e){for(var r=e.diElement,i=e.parent;i&&-1===n.indexOf(i);)i=i.$parent;if(i){var o=t._processToDiagramMap[i.id];t.moveToDiPlane(r,o.plane)}})),i},ha.prototype.movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=function(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach((function(e){if(e.bounds){var n=hn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),mn(t)}(e),r=n.x-ua,i=n.y-da;t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-r,e.y=e.y-i})):e.bounds&&(e.bounds.x=e.bounds.x-r,e.bounds.y=e.bounds.y-i)}))},ha.prototype.moveToDiPlane=function(e,t){var n=ma(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},ha.prototype.createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},ha.$inject=["eventBus","moddle"];var fa=250;function ya(e,t,n,r){Yo.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=r;var i=this;this.executed("shape.toggleCollapse",fa,(function(e){var t=e.shape;i.canDrillDown(t)?i.addOverlay(t):i.removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",fa,(function(e){var t=e.shape;i.canDrillDown(t)?i.addOverlay(t):i.removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],fa,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i.canDrillDown(r)&&i.addOverlay(r),i.updateDrilldownOverlay(t),i.updateDrilldownOverlay(n),i.updateDrilldownOverlay(r)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],fa,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i.canDrillDown(r)&&i.addOverlay(r),i.updateDrilldownOverlay(t),i.updateDrilldownOverlay(n),i.updateDrilldownOverlay(r)}),!0),t.on("import.done",(function(){n.filter((function(e){return i.canDrillDown(e)})).map((function(e){i.addOverlay(e)}))}))}r(ya,Yo),ya.prototype.updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this.updateOverlayVisibility(n)}},ya.prototype.canDrillDown=function(e){var t=this._canvas;return wi(e,"bpmn:SubProcess")&&t.findRoot(ia(e))},ya.prototype.updateOverlayVisibility=function(e){var t=this._overlays,n=e.businessObject,r=t.get({element:n.id,type:"drilldown"})[0];if(r){var i=n&&n.flowElements&&n.flowElements.length;te(r.html).toggle("bjs-drilldown-empty",!i)}},ya.prototype.addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this.removeOverlay(e);var r=fe('<button class="bjs-drilldown"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg></button>');r.addEventListener("click",(function(){t.setRootElement(t.findRoot(ia(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this.updateOverlayVisibility(e)},ya.prototype.removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},ya.$inject=["canvas","eventBus","elementRegistry","overlays"];var ga={__depends__:[Wo,Xo,Jo],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",pa],drilldownCentering:["type",la],drilldownOverlayBehavior:["type",ya],subprocessCompatibility:["type",ha]};function va(e){Ri.call(this,e)}function ba(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function xa(e,t){return-1!==(e=d(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.keyCode)}function wa(e){return e.shiftKey}r(va,Ri),va.prototype._modules=[bo,so,$o,Wo,ga],va.prototype._moddleExtensions={};var _a="keyboard.keydown",Ea="input-handle-modified-keys";function Pa(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()}))}Pa.$inject=["config.keyboard","eventBus"],Pa.prototype._keydownHandler=function(e){this._keyHandler(e,_a)},Pa.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Pa.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||_a,n)&&e.preventDefault()}},Pa.prototype._isEventIgnored=function(e){return(t=e.target)&&(ae(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},Pa.prototype._isModifiedKeyIgnored=function(e){return!ba(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Pa.prototype._getAllowedModifiers=function(e){var t=se(e,"[input-handle-modified-keys]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Ea).split(",")},Pa.prototype.bind=function(e){this.unbind(),this._node=e,ue.bind(e,"keydown",this._keydownHandler,!0),ue.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},Pa.prototype.getBinding=function(){return this._node},Pa.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ue.unbind(e,"keydown",this._keydownHandler,!0),ue.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},Pa.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Pa.prototype.addListener=function(e,t,n){f(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||_a,e,t)},Pa.prototype.removeListener=function(e,t){this._eventBus.off(t||_a,e)},Pa.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Pa.prototype.isCmd=ba,Pa.prototype.isShift=wa,Pa.prototype.isKey=xa;var Oa=["c","C",67],Sa=["v","V",86],ka=["y","Y",89],Ca=["z","Z",90];function Ta(e,t){var n=this;e.on("editorActions.init",500,(function(e){var r=e.editorActions;n.registerBindings(t,r)}))}Ta.$inject=["eventBus","keyboard"],Ta.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n("undo",(function(e){var n=e.keyEvent;if(ba(n)&&!wa(n)&&xa(Ca,n))return t.trigger("undo"),!0})),n("redo",(function(e){var n=e.keyEvent;if(ba(n)&&(xa(ka,n)||xa(Ca,n)&&wa(n)))return t.trigger("redo"),!0})),n("copy",(function(e){var n=e.keyEvent;if(ba(n)&&xa(Oa,n))return t.trigger("copy"),!0})),n("paste",(function(e){var n=e.keyEvent;if(ba(n)&&xa(Sa,n))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(xa(["+","Add","="],n)&&ba(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(xa(["-","Subtract"],n)&&ba(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(xa("0",n)&&ba(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(xa(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var Ma={__init__:["keyboard","keyboardBindings"],keyboard:["type",Pa],keyboardBindings:["type",Ta]},Aa={moveSpeed:50,moveSpeedAccelerated:200};function Ra(e,t,n){var r=this;this._config=q({},Aa,e||{}),t.addListener((function(e){var n=e.keyEvent,i=r._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,a=t.isShift(n)?i.moveSpeedAccelerated:i.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return r.moveCanvas({speed:a,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,r=0,i=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":r=i;break;case"right":t=-i;break;case"down":r=-i}n.scroll({dx:t,dy:r})}}Ra.$inject=["config.keyboardMove","keyboard","canvas"];var Da={__depends__:[Ma],__init__:["keyboardMove"],keyboardMove:["type",Ra]},za=/^djs-cursor-.*$/;function ja(e){var t=te(document.body);t.removeMatching(za),e&&t.add("djs-cursor-"+e)}function Na(){ja(null)}function Ba(e,t){function n(){return!1}return t=t||"element.click",e.once(t,5e3,n),function(){e.off(t,n)}}function Ia(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function La(e,t){return{x:e.x-t.x,y:e.y-t.y}}function $a(e,t){var n;function r(r){var i,o=n.start,a=n.button,s=Eo(r),p=La(s,o);(!n.dragging&&(i=p,Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))>15)&&(n.dragging=!0,0===a&&Ba(e),ja("grab")),n.dragging)&&(p=La(s,n.last||n.start),t.scroll({dx:p.x,dy:p.y}),n.last=s);r.preventDefault()}function i(e){ue.unbind(document,"mousemove",r),ue.unbind(document,"mouseup",i),n=null,Na()}e.on("element.mousedown",500,(function(e){return function(e){if(se(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Eo(e)},ue.bind(document,"mousemove",r),ue.bind(document,"mouseup",i),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}$a.$inject=["eventBus","canvas"];var Fa={__init__:["moveCanvas"],moveCanvas:["type",$a]};function Va(e){return Math.log(e)/Math.log(10)}function Ha(e,t){var n=Va(e.min),r=Va(e.max);return(Math.abs(n)+Math.abs(r))/t}var qa=Math.sign||function(e){return e>=0?1:-1},Ua={min:.2,max:4};function Ga(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=F(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var r=this;t.on("canvas.init",(function(t){r._init(!1!==e.enabled)}))}Ga.$inject=["config.zoomScroll","eventBus","canvas"],Ga.prototype.scroll=function(e){this._canvas.scroll(e)},Ga.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ga.prototype.zoom=function(e,t){var n=Ha(Ua,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Ga.prototype._handleWheel=function(e){if(!se(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,r=e.ctrlKey,i=e.shiftKey,o=-1*this._scale;if(o*=r?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,r){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*qa(e.deltaY)*o,this.zoom(n,s)}else n=i?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Ga.prototype.stepZoom=function(e,t){var n=Ha(Ua,10);this._zoom(e,t,n)},Ga.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=Va(r.zoom()),a=Math.round(o/n)*n;a+=n*i;var s=Math.pow(10,a);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ua,s),t)},Ga.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return void 0===e&&(e=!r),r!==e&&ue[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Ga.prototype._init=function(e){this.toggle(e)};var Wa={__init__:["zoomScroll"],zoomScroll:["type",Ga]};function Ka(e){va.call(this,e)}r(Ka,va),Ka.prototype._navigationModules=[Da,Fa,Wa],Ka.prototype._modules=[].concat(va.prototype._modules,Ka.prototype._navigationModules);
3
3
  /*! Hammer.JS - v2.0.7 - 2016-04-22
4
4
  * http://hammerjs.github.io/
5
5
  *
6
6
  * Copyright (c) 2016 Jorik Tangelder;
7
7
  * Licensed under the MIT license */
8
- var Xa=n((function(e){!function(t,n,r,i){var o,a=["","webkit","Moz","MS","ms","o"],s=n.createElement("div"),p=Math.round,l=Math.abs,c=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return!!Array.isArray(e)&&(h(e,n[t],n),!0)}function h(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(e,n,r){var i="DEPRECATED METHOD: "+n+"\n"+r+" AT \n";return function(){var n=new Error("get-stack-trace"),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,i,r),e.apply(this,arguments)}}o="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m((function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),y=m((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function g(e,t,n){var r,i=t.prototype;(r=e.prototype=Object.create(i)).constructor=e,r._super=i,n&&o(r,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return"function"==typeof e?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function w(e,t,n){h(O(t),(function(t){e.addEventListener(t,n,!1)}))}function _(e,t,n){h(O(t),(function(t){e.removeEventListener(t,n,!1)}))}function E(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function P(e,t){return e.indexOf(t)>-1}function O(e){return e.trim().split(/\s+/g)}function S(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function k(e){return Array.prototype.slice.call(e,0)}function C(e,t,n){for(var r=[],i=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];S(i,a)<0&&r.push(e[o]),i[o]=a,o++}return n&&(r=t?r.sort((function(e,n){return e[t]>n[t]})):r.sort()),r}function T(e,t){for(var n,r,o=t[0].toUpperCase()+t.slice(1),s=0;s<a.length;){if((r=(n=a[s])?n+o:t)in e)return r;s++}return i}var M=1;function A(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}var R="ontouchstart"in t,D=T(t,"PointerEvent")!==i,z=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),j="touch",N="mouse",B=24,I=["x","y"],L=["clientX","clientY"];function $(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function F(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=1&t&&r-o==0,s=12&t&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=V(t));o>1&&!n.firstMultiple?n.firstMultiple=V(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,p=s?s.center:a.center,u=t.center=H(r);t.timeStamp=c(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=W(p,u),t.distance=G(p,u),function(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y});t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}(n,t),t.offsetDirection=U(t.deltaX,t.deltaY);var d=q(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=l(d.x)>l(d.y)?d.x:d.y,t.scale=s?(h=s.pointers,m=r,G(m[0],m[1],L)/G(h[0],h[1],L)):1,t.rotation=s?function(e,t){return W(t[1],t[0],L)+W(e[1],e[0],L)}(s.pointers,r):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,r,o,a,s=e.lastInterval||t,p=t.timeStamp-s.timeStamp;if(8!=t.eventType&&(p>25||s.velocity===i)){var c=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,d=q(p,c,u);r=d.x,o=d.y,n=l(d.x)>l(d.y)?d.x:d.y,a=U(c,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var h,m;var f=e.element;E(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function V(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:c(),pointers:t,center:H(t),deltaX:e.deltaX,deltaY:e.deltaY}}function H(e){var t=e.length;if(1===t)return{x:p(e[0].clientX),y:p(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:p(n/t),y:p(r/t)}}function q(e,t,n){return{x:t/e||0,y:n/e||0}}function U(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function G(e,t,n){n||(n=I);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function W(e,t,n){n||(n=I);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}$.prototype={handler:function(){},init:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(A(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4},X="mousedown",Y="mousemove mouseup";function Z(){this.evEl=X,this.evWin=Y,this.pressed=!1,$.apply(this,arguments)}g(Z,$,{handler:function(e){var t=K[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:j,3:"pen",4:N,5:"kinect"},ee="pointerdown",te="pointermove pointerup pointercancel";function ne(){this.evEl=ee,this.evWin=te,$.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(ee="MSPointerDown",te="MSPointerMove MSPointerUp MSPointerCancel"),g(ne,$,{handler:function(e){var t=this.store,n=!1,r=e.type.toLowerCase().replace("ms",""),i=J[r],o=Q[e.pointerType]||e.pointerType,a=o==j,s=S(t,e.pointerId,"pointerId");1&i&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):12&i&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var re={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",oe="touchstart touchmove touchend touchcancel";function ae(){this.evTarget=ie,this.evWin=oe,this.started=!1,$.apply(this,arguments)}function se(e,t){var n=k(e.touches),r=k(e.changedTouches);return 12&t&&(n=C(n.concat(r),"identifier",!0)),[n,r]}g(ae,$,{handler:function(e){var t=re[e.type];if(1===t&&(this.started=!0),this.started){var n=se.call(this,e,t);12&t&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:e})}}});var pe={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function ce(){this.evTarget=le,this.targetIds={},$.apply(this,arguments)}function ue(e,t){var n=k(e.touches),r=this.targetIds;if(3&t&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(e.changedTouches),s=[],p=this.target;if(o=n.filter((function(e){return E(e.target,p)})),1===t)for(i=0;i<o.length;)r[o[i].identifier]=!0,i++;for(i=0;i<a.length;)r[a[i].identifier]&&s.push(a[i]),12&t&&delete r[a[i].identifier],i++;return s.length?[C(o.concat(s),"identifier",!0),s]:void 0}g(ce,$,{handler:function(e){var t=pe[e.type],n=ue.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:e})}});function de(){$.apply(this,arguments);var e=v(this.handler,this);this.touch=new ce(this.manager,e),this.mouse=new Z(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function he(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,me.call(this,t)):12&e&&me.call(this,t)}function me(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout((function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],o=Math.abs(t-i.x),a=Math.abs(n-i.y);if(o<=25&&a<=25)return!0}return!1}g(de,$,{handler:function(e,t,n){var r=n.pointerType==j,i=n.pointerType==N;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)he.call(this,t,n);else if(i&&fe.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ye=T(s.style,"touchAction"),ge=ye!==i,ve="compute",be="auto",xe="manipulation",we="none",_e="pan-x",Ee="pan-y",Pe=function(){if(!ge)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(r){e[r]=!n||t.CSS.supports("touch-action",r)})),e}();function Oe(e,t){this.manager=e,this.set(t)}Oe.prototype={set:function(e){e==ve&&(e=this.compute()),ge&&this.manager.element.style&&Pe[e]&&(this.manager.element.style[ye]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return h(this.manager.recognizers,(function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(P(e,we))return we;var t=P(e,_e),n=P(e,Ee);if(t&&n)return we;if(t||n)return t?_e:Ee;if(P(e,xe))return xe;return be}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,i=P(r,we)&&!Pe.none,o=P(r,Ee)&&!Pe["pan-y"],a=P(r,_e)&&!Pe["pan-x"];if(i){var s=1===e.pointers.length,p=e.distance<2,l=e.deltaTime<250;if(s&&p&&l)return}if(!a||!o)return i||o&&6&n||a&&n&B?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function ke(e){this.options=o({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Ce(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Te(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Me(e,t){var n=t.manager;return n?n.get(e):e}function Ae(){ke.apply(this,arguments)}function Re(){Ae.apply(this,arguments),this.pX=null,this.pY=null}function De(){Ae.apply(this,arguments)}function ze(){ke.apply(this,arguments),this._timer=null,this._input=null}function je(){Ae.apply(this,arguments)}function Ne(){Ae.apply(this,arguments)}function Be(){ke.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ie(e,t){return(t=t||{}).recognizers=x(t.recognizers,Ie.defaults.preset),new Le(e,t)}ke.prototype={defaults:{},set:function(e){return o(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Me(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,"dropRecognizeWith",this)||(e=Me(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(d(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Me(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,"dropRequireFailure",this))return this;e=Me(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<8&&r(t.options.event+Ce(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=8&&r(t.options.event+Ce(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=o({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},g(Ae,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,r=6&t,i=this.attrTest(e);return r&&(8&n||!i)?16|t:r||i?4&n?8|t:2&t?4|t:2:Se}}),g(Re,Ae,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(Ee),e&B&&t.push(_e),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,o=e.deltaX,a=e.deltaY;return i&t.direction||(6&t.direction?(i=0===o?1:o<0?2:4,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?1:a<0?8:16,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return Ae.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=Te(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(De,Ae,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[we]},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)}}),g(ze,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[be]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||12&e.eventType&&!i)this.reset();else if(1&e.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}}),g(je,Ae,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(Ne,Ae,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return 30&n?t=e.overallVelocity:6&n?t=e.overallVelocityX:n&B&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Te(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Be,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(r&&i&&n){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||G(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=u((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=u((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ie.VERSION="2.0.7",Ie.defaults={domEvents:!1,touchAction:ve,enable:!0,inputTarget:null,inputClass:null,preset:[[je,{enable:!1}],[De,{enable:!1},["rotate"]],[Ne,{direction:6}],[Re,{direction:6},["swipe"]],[Be],[Be,{event:"doubletap",taps:2},["tap"]],[ze]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Le(e,t){var n;this.options=o({},Ie.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||(D?ne:z?ce:R?de:Z))(n,F),this.touchAction=new Oe(this,this.options.touchAction),$e(this,!0),h(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 $e(e,t){var n,r=e.element;r.style&&(h(e.options.cssProps,(function(i,o){n=T(r.style,o),t?(e.oldCssProps[n]=r.style[n],r.style[n]=i):r.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}Le.prototype={set:function(e){return o(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 r=this.recognizers,i=t.curRecognizer;(!i||i&&8&i.state)&&(i=t.curRecognizer=null);for(var o=0;o<r.length;)n=r[o],2===t.stopped||i&&n!=i&&!n.canRecognizeWith(i)?n.reset():n.recognize(e),!i&&14&n.state&&(i=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(d(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=S(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return h(O(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==i){var n=this.handlers;return h(O(e),(function(e){t?n[e]&&n[e].splice(S(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var r=n.createEvent("Event");r.initEvent(e,!0,!0),r.gesture=t,t.target.dispatchEvent(r)}(e,t);var r=this.handlers[e]&&this.handlers[e].slice();if(r&&r.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var i=0;i<r.length;)r[i](t),i++}},destroy:function(){this.element&&$e(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},o(Ie,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:B,DIRECTION_ALL:30,Manager:Le,Input:$,TouchAction:Oe,TouchInput:ce,MouseInput:Z,PointerEventInput:ne,TouchMouseInput:de,SingleTouchInput:ae,Recognizer:ke,AttrRecognizer:Ae,Tap:Be,Pan:Re,Swipe:Ne,Pinch:De,Rotate:je,Press:ze,on:w,off:_,each:h,merge:y,extend:f,assign:o,inherit:g,bindFn:v,prefixed:T}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=Ie,e.exports?e.exports=Ie:t.Hammer=Ie}(window,document)})),Ya=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function Za(e,t){return t.get(e,!1)}function Ja(e){e.preventDefault(),"function"==typeof e.stopPropagation?e.stopPropagation():e.srcEvent&&"function"==typeof e.srcEvent.stopPropagation&&e.srcEvent.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function Qa(e){function t(t){setTimeout((function(){_(Ya,(function(t){ue.unbind(e,t,Ja,!0)}))}),500)}ue.bind(e,"touchstart",(function(t){_(Ya,(function(t){ue.bind(e,t,Ja,!0)}))}),!0),ue.bind(e,"touchend",t,!0),ue.bind(e,"touchcancel",t,!0);var n=new Xa.Manager(e,{inputClass:Xa.TouchInput,recognizers:[],domEvents:!0}),r=new Xa.Tap,i=new Xa.Pan({threshold:10}),o=new Xa.Press,a=new Xa.Pinch,s=new Xa.Tap({event:"doubletap",taps:2});return a.requireFailure(i),a.requireFailure(o),n.add([i,o,a,s,r]),n.reset=function(e){var t=this.recognizers,r=this.session;r.stopped||(n.stop(e),setTimeout((function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;r.curRecognizer=null}),0))},n.on("hammer.input",(function(e){e.srcEvent.defaultPrevented&&n.reset(!0)})),n}function es(e,t,n,r,i){var o,a=Za("dragging",e),s=Za("move",e),p=Za("contextPad",e),l=Za("palette",e);function c(e,t){return function(n){var o=u(n.target),a=o&&r.get(o);return t&&(n.srcEvent.button=t),i.fire(e,n,a)}}function u(e){return se(e,"svg, .djs-element",!0)}function d(e){function n(e){var n=u(e.target),i=n&&r.get(n);if(s&&t.getRootElement()!==i)return s.start(e,i,!0);!function(e){var n=0,r=0;function i(e){var i=e.deltaX-n,o=e.deltaY-r;t.scroll({dx:i,dy:o}),n=e.deltaX,r=e.deltaY}function a(e){o.off("panmove",i),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",i),o.on("panend",a),o.on("pancancel",a)}()}(o=Qa(e)).on("tap",c("element.click")),o.on("doubletap",c("element.dblclick",1)),o.on("panstart",n),o.on("press",n),o.on("pinchstart",(function(e){var n=t.zoom(),r=e.center;function i(e){var i=1-(1-e.scale)/1.5,o=Math.max(.2,Math.min(4,i*n));t.zoom(o,r),Ja(e)}function a(e){o.off("pinchmove",i),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",i),o.on("pinchend",a),o.on("pinchcancel",a)}))}a&&n.on("drag.move",(function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Eo(t),i=u(document.elementFromPoint(n.x,n.y)),o=i&&r.get(i);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:i}),e.hover=o,e.hoverGfx=i))}})),p&&n.on("contextPad.create",(function(e){var t=Qa(e.pad.html);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)}))})),l&&n.on("palette.create",(function(e){var t=Qa(e.container);t.on("panstart",(function(e){l.trigger("dragstart",e,!0)})),t.on("press",(function(e){l.trigger("dragstart",e,!0)})),t.on("tap",(function(e){l.trigger("click",e)}))})),n.on("canvas.init",(function(e){d(e.svg)}))}function ts(e,t){var n=this;t.on("canvas.init",(function(e){n.addBBoxMarker(e.svg)}))}es.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],ts.$inject=["canvas","eventBus"],ts.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Ie("rect");Oe(n,{x:-1e4,y:1e4,width:10,height:10}),Oe(n,t),_e(e,n);var r=Ie("rect");Oe(r,{x:1e4,y:1e4,width:10,height:10}),Oe(r,t),_e(e,r)};var ns={__depends__:[{__depends__:[Ao],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",es],touchFix:["type",ts]}]};function rs(e){return e&&e[e.length-1]}function is(e){return e.y}function os(e){return e.x}var as={left:os,center:os,right:function(e){return e.x+e.width},top:is,middle:is,bottom:function(e){return e.y+e.height}};function ss(e){this._modeling=e}ss.$inject=["modeling"],ss.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ss.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ss.prototype._alignmentPosition=function(e,t){var n,r,i,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,p={},l={},c=!1;if(this._isType(e,["left","top"]))p[e]=t[0][a];else if(this._isType(e,["right","bottom"]))i=rs(t),p[e]=i[a]+i[s];else if(this._isType(e,["center","middle"])){if(_(t,(function(e){var t=e[a]+Math.round(e[s]/2);l[t]?l[t].elements.push(e):l[t]={elements:[e],center:t}})),n=z(l,(function(e){return e.elements.length>1&&(c=!0),e.elements.length})),c)return p[e]=rs(n).center,p;r=t[0],i=rs(t=z(t,(function(e){return e[a]+e[s]}))),p[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(r,i)}return p},ss.prototype.trigger=function(e,t){var n=this._modeling,r=w(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(!(r.length<2)){var i=z(r,as[t]),o=this._alignmentPosition(t,i);n.alignElements(i,o)}};var ps={__init__:["alignElements"],alignElements:["type",ss]};function ls(e,t,n,r){for(var i;i=us(e,n,t);)n=r(t,n,i);return n}function cs(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var a=e[o];if(a){var s="x"===o?"width":"height",p=a.margin,l=a.minDistance;i[o]=p<0?Math.min(r[o]+p-t[s]/2,n[o]-l+p):Math.max(r[o]+r[s]+p+t[s]/2,n[o]+l+p)}})),i}}function us(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return b(function(e){var t=ds(e);e.host&&(t=t.concat(ds(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(ds(t))}),[])));return t}(e),(function(e){return e!==n&&"intersect"===yn(e,r,10)}))}function ds(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function hs(){return!0}function ms(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||50,i=fn(e);return{x:hn(e).right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),a=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:a}),a}}function fs(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ms.$inject=["eventBus","modeling","canvas"],fs.$inject=["eventBus","selection"];var ys={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ms],autoPlaceSelectionBehavior:["type",fs]};function gs(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(_i(e,t))return e;return null}function vs(e,t){return wi(t,"bpmn:TextAnnotation")?function(e,t){var n=hn(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};return ls(e,t,r,cs({y:{margin:-30,minDistance:20}}))}(e,t):_i(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=hn(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return ls(e,t,r,cs({x:{margin:30,minDistance:30}}))}(e,t):wi(t,"bpmn:FlowNode")?function(e,t){var n=hn(e),r=fn(e),i=function(e,t){t||(t={});var n=t.defaultDistance||50,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},a=t.maxDistance||250,s=t.reference||"start";function p(e,t){return"n"===r?"start"===s?hn(e).top-hn(t).bottom:"center"===s?hn(e).top-fn(t).y:hn(e).top-hn(t).top:"w"===r?"start"===s?hn(e).left-hn(t).right:"center"===s?hn(e).left-fn(t).x:hn(e).left-hn(t).left:"s"===r?"start"===s?hn(t).top-hn(e).bottom:"center"===s?fn(t).y-hn(e).bottom:hn(t).bottom-hn(e).bottom:"start"===s?hn(t).left-hn(e).right:"center"===s?fn(t).x-hn(e).right:hn(t).right-hn(e).right}i||(i=hs);var l=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?p(t.source,e):p(e,t.source);return{id:t.source.id,distance:r,weight:n}})),c=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?p(e,t.target):p(t.target,e);return{id:t.target.id,distance:r,weight:n}}));return P(l.concat(c).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>a||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{}).distance||n}(e,{filter:function(e){return wi(e,"bpmn:SequenceFlow")}}),o=30,a=80,s="left";wi(e,"bpmn:BoundaryEvent")&&-1!==(s=yn(e,e.host,-25)).indexOf("top")&&(o*=-1);var p={x:n.right+i+t.width/2,y:r.y+bs(s,a)};return ls(e,t,p,cs({y:{margin:o,minDistance:a}}))}(e,t):void 0}function bs(e,t){return-1!=e.indexOf("top")?-1*t:-1!=e.indexOf("bottom")?t:0}function xs(e){e.on("autoPlace",(function(e){var t=e.shape;return vs(e.source,t)}))}xs.$inject=["eventBus"];var ws={__depends__:[ys],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",xs]};function _s(e,t,n,r){Yo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var i=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,o=t.parent||t.newParent;!1!==n.autoResize&&i._expand([r],o)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=a(M(t.closure.topLevel)),r=t.hints,o=!r||r.autoResize;!1!==o&&_(A(n,(function(e){return e.parent.id})),(function(e,t){d(o)&&(e=e.filter((function(e){return b(o,j({id:e.id}))}))),i._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||i._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,o=r.parent;n&&!1===n.autoResize||o&&i._expand([r],o)}))}function Es(e){e.invoke(_s,this)}function Ps(e){Yo.call(this,e),this.init()}function Os(e){Ps.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Ss(e,t){Os.call(this,e),this._modeling=t}_s.$inject=["eventBus","elementRegistry","modeling","rules"],r(_s,Yo),_s.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=hn(yt(e)),o=hn(t),a={};return i.top-o.top<r.top&&(a.top=i.top-n.top),i.left-o.left<r.left&&(a.left=i.left-n.left),o.right-i.right<r.right&&(a.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(a.bottom=i.bottom+n.bottom),mn(q({},o,a))},_s.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=hn(e),t=hn(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}(W(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},_s.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},_s.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},_s.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Es.$inject=["injector"],r(Es,_s),Es.prototype.resize=function(e,t,n){wi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},Ps.$inject=["eventBus"],r(Ps,Yo),Ps.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},Ps.prototype.init=function(){},Os.$inject=["eventBus"],r(Os,Ps),Os.prototype.canResize=function(e,t){return!1},r(Ss,Os),Ss.$inject=["eventBus","modeling"],Ss.prototype.canResize=function(e,t){if(wi(t.di,"bpmndi:BPMNPlane"))return!1;if(!wi(t,"bpmn:Participant")&&!wi(t,"bpmn:Lane")&&!wi(t,"bpmn:SubProcess"))return!1;var n=!0;return _(e,(function(e){(wi(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)})),n};var ks={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Es],bpmnAutoResizeProvider:["type",Ss]};function Cs(e,t,n){var r,i,o=this,a=n.get("dragging",!1);a&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),a.hover({element:i,gfx:r}),a.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=Eo(e),function(e){return se(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Cs.$inject=["elementRegistry","eventBus","injector"];var Ts={__init__:["hoverFix"],hoverFix:["type",Cs]},Ms=Math.round,As="djs-drag-active";function Rs(e){e.preventDefault()}function Ds(e,t,n,r){var i,o={threshold:5,trapClick:!0};function a(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function s(t,n){n=n||i;var r=e.createEvent(q({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function p(e,r){var o,p=i.payload,l=i.displacement,c=i.globalStart,u=Eo(e),d=La(u,c),h=i.localStart,m=a(u),y=La(m,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(q(p,{x:Ms(h.x+l.x),y:Ms(h.y+l.y),dx:0,dy:0},{originalEvent:e}),!1===s("start"))return f();i.active=!0,i.keepSelection||(p.previousSelection=n.get(),n.select(null)),i.cursor&&ja(i.cursor),t.addMarker(t.getRootElement(),As)}_o(e),i.active&&(q(p,{x:Ms(m.x+l.x),y:Ms(m.y+l.y),dx:Ms(y.x),dy:Ms(y.y)},{originalEvent:e}),s("move"))}function l(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,_o(e)),t=s("end")),!1===t&&s("rejected"),s("ended",y(!0!==t))}function c(e){27===e.which&&(Rs(e),f())}function u(t){var n;i.active&&(n=Ba(e),setTimeout(n,400),Rs(t)),l(t)}function d(e){p(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,s("hover")}function m(e){s("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function f(e){var t;if(i){var n=i.active;n&&s("cancel"),t=y(e),n&&s("canceled",t)}}function y(o){var a,y;s("cleanup"),Na(),y=i.trapClick?u:l,ue.unbind(document,"mousemove",p),ue.unbind(document,"dragstart",Rs),ue.unbind(document,"selectstart",Rs),ue.unbind(document,"mousedown",y,!0),ue.unbind(document,"mouseup",y,!0),ue.unbind(document,"keyup",c),ue.unbind(document,"touchstart",d,!0),ue.unbind(document,"touchcancel",f,!0),ue.unbind(document,"touchmove",p,!0),ue.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),As);var g=i.payload.previousSelection;return!1!==o&&g&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(g),a=i,i=null,a}e.on("diagram.destroy",f),this.init=function(t,n,r,y){i&&f(!1),"string"==typeof n&&(y=r,r=n,n=null);var g,v,b,x,w,_=(y=q({},o,y||{})).data||{};x=y.trapClick?u:l,t?(g=wo(t)||t,v=Eo(t),_o(t),"dragstart"===g.type&&Rs(g)):(g=null,v={x:0,y:0}),b=a(v),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(g),i=q({prefix:r,data:_,payload:{},globalStart:v,displacement:La(n,b),localStart:b,isTouch:w},y),y.manual||(w?(ue.bind(document,"touchstart",d,!0),ue.bind(document,"touchcancel",f,!0),ue.bind(document,"touchmove",p,!0),ue.bind(document,"touchend",l,!0)):(ue.bind(document,"mousemove",p),ue.bind(document,"dragstart",Rs),ue.bind(document,"selectstart",Rs),ue.bind(document,"mousedown",x,!0),ue.bind(document,"mouseup",x,!0)),ue.bind(document,"keyup",c),e.on("element.hover",h),e.on("element.out",m)),s("init"),y.autoActivate&&p(t,!0)},this.move=p,this.hover=h,this.out=m,this.end=l,this.cancel=f,this.context=function(){return i},this.setOptions=function(e){q(o,e)}}Ds.$inject=["eventBus","canvas","selection","elementRegistry"];var zs={__depends__:[Ts,$o],dragging:["type",Ds]};function js(e,t,n){this._canvas=n,this._opts=q({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 Ns(e,t,n){return t<e&&e<n}js.$inject=["config.autoScroll","eventBus","canvas"],js.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var a=0,s=0,p=0;p<4;p++)Ns(o[p],n.scrollThresholdOut[p],n.scrollThresholdIn[p])&&(0===p?a=n.scrollStep:1==p?s=n.scrollStep:2==p?a=-n.scrollStep:3==p&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},js.prototype.stopScroll=function(){clearTimeout(this._scrolling)},js.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},js.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Eo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Bs={__depends__:[zs],__init__:["autoScroll"],autoScroll:["type",js]};function Is(e){this._commandStack=e.get("commandStack",!1)}Is.$inject=["injector"],Is.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Ls={__init__:["rules"],rules:["type",Is]},$s=Math.round,Fs=Math.max;function Vs(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Ot(r,t)<=10)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=cn(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,10),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],a=i[i.length-1];return o?o!==a?o.segment2!==a.segment2?{point:e[r=Fs(o.segment2,a.segment2)-1],bendpoint:!0,index:r}:{point:{x:$s(o.x+a.x)/2,y:$s(o.y+a.y)/2},index:o.segment2}:{point:{x:$s(o.x),y:$s(o.y)},index:o.segment2}:null}(e,t)}var Hs="djs-bendpoint",qs="djs-segment-dragger";function Us(e,t,n){return Vs(t,function(e,t){var n,r=Eo(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n))}function Gs(e,t){var n=Ie("g");Me(n).add(Hs),_e(e,n);var r=Ie("circle");Oe(r,{cx:0,cy:0,r:4}),Me(r).add("djs-visual"),_e(n,r);var i=Ie("circle");return Oe(i,{cx:0,cy:0,r:10}),Me(i).add("djs-hit"),_e(n,i),t&&Me(n).add(t),n}function Ws(e,t,n,r){var i=Ie("g");_e(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Xs("h"===n?r:i)}(t,n,r),a=Ie("rect");Oe(a,{x:-7,y:-1.5,width:14,height:3}),Me(a).add("djs-visual"),_e(i,a);var s=Ie("rect");return Oe(s,{x:-o/2,y:-7,width:o,height:14}),Me(s).add("djs-hit"),_e(i,s),Xn(i,"v"===r?90:0),i}function Ks(e,t,n){var r=Ie("g"),i=Tt(t,n),o=kt(t,n);return _e(e,r),Ws(r,t,n,o),Me(r).add(qs),Me(r).add("h"===o?"horizontal":"vertical"),Kn(r,i.x,i.y),r}function Xs(e){return Math.abs(Math.round(2*e/3))}function Ys(e,t,n,r,i){function o(e,n){var o=n.waypoints,a=Us(t,o,e);if(a)return!function(e,t,n){var r,i,o,a,s,p,l=e.index,c=e.point;return!(l<=0||e.bendpoint)&&(o=Tt(r=t[l-1],i=t[l]),a=kt(r,i),s=Math.abs(c.x-o.x),p=Math.abs(c.y-o.y),a&&s<=n&&p<=n)}(a,o,function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=kt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Xs("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a))?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function a(e,t,r){ue.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function s(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Qo(e.id)+'"]',r);return!i&&n&&(Oe(i=Ie("g"),{"data-element-id":e.id}),Me(i).add("djs-bendpoints"),_e(r,i),a(i,"mousedown",e),a(i,"click",e),a(i,"dblclick",e)),i}function p(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function l(e,t){t.waypoints.forEach((function(t,n){var r=Gs(e);_e(e,r),Kn(r,t.x,t.y)})),Gs(e,"floating")}function c(e,t){for(var n,r,i,o=t.waypoints,s=1;s<o.length;s++)kt(n=o[s-1],r=o[s])&&(Oe(i=Ks(e,n,r),{"data-segment-idx":s}),a(i,"mousemove",t))}function u(e){var t=s(e);return t||(l(t=s(e,!0),e),c(t,e)),t}function d(e){var t=s(e);t&&(!function(e){_(be(".djs-segment-dragger",e),(function(e){Re(e)}))}(t),function(e){_(be(".djs-bendpoint",e),(function(e){Re(e)}))}(t),c(t,e),l(t,e))}function h(e,t,n){var r,i,o=p(t.index,e),a=n[t.index-1],s=n[t.index],l=t.point,c=Tt(a,s),u=kt(a,s);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:l.x-c.x,y:l.y-c.y},"v"===u&&(i={x:i.y,y:i.x}),Kn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=s(e.element);t&&Re(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Me(t).add(e.marker):Me(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=s(i,!0),!(r=Us(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Kn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(Oo(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=s(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=s,this.getSegmentDragger=p}Ys.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Zs=Math.round,Js="reconnectStart",Qs="reconnectEnd",ep="updateWaypoints";function tp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,a){var s,p=n.getGraphics(t),l=t.source,c=t.target,u=t.waypoints,d=(s=a||0!==o?a||o!==u.length-1?ep:Qs:Js)===ep?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:l,target:c});!1===h&&(h=i.allowed(d,{connection:t,source:c,target:l})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:p,context:{allowed:h,bendpointIndex:o,connection:t,source:l,target:c,insert:a,type:s}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,a=r.target,s=e.hover,p=n.type;if(n.hover=s,s){var l=p===ep?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(l,{connection:r,source:p===Js?s:o,target:p===Qs?s:a}))return n.source=p===Js?s:o,void(n.target=p===Qs?s:a);!1===t&&(t=n.allowed=i.allowed(l,{connection:r,source:p===Qs?s:a,target:p===Js?s:o})),t&&(n.source=p===Qs?s:a,n.target=p===Js?s:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==ep&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,a=t.insert,s=i.waypoints.slice(),p=t.source,l=t.target,c=t.type,u=t.hints||{},d={x:Zs(e.x),y:Zs(e.y)};if(!n)return!1;c===ep?(a?s.splice(r,0,d):s[r]=d,u.bendpointMove={insert:a,bendpointIndex:r},s=this.cropWaypoints(i,s),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===Ot(t,r=e[i+1])||St(n,r,t)?e.splice(i,1):i++;return e}(s),u)):(c===Js?(u.docking="source",np(t)&&(u.docking="target",u.newWaypoints=s.reverse())):c===Qs&&(u.docking="target",np(t)&&(u.docking="source",u.newWaypoints=s.reverse())),o.reconnect(i,p,l,d,u))}),this)}function np(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===Js?t&&r&&t===r&&n!==r:i===Qs?t&&n&&t===n&&n!==r:void 0}tp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],tp.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var rp="updateWaypoints",ip="connect-ok",op="connect-not-ok",ap="connect-hover",sp="djs-updating",pp="djs-element-hidden";function lp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,a=i.waypoints,s=a.slice();t.waypoints=a,o&&s.splice(n,0,{x:e.x,y:e.y}),i.waypoints=s,Me(t.draggerGfx=Gs(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,pp),r.addMarker(i,sp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,ap),o===rp)return;n?(r.removeMarker(i,op),r.addMarker(i,ip)):!1===n&&(r.removeMarker(i,ip),r.addMarker(i,op))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,ap),r.removeMarker(n,i?ip:op))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,a=n.draggerGfx,s=n.hover,p=n.type,l=n.connection,c=l.source,u=l.target,d=l.waypoints.slice(),h={x:t.x,y:t.y},m=n.hints||{},f={};i&&(m.connectionStart&&(f.connectionStart=m.connectionStart),m.connectionEnd&&(f.connectionEnd=m.connectionEnd),"reconnectStart"===p?np(n)?(f.connectionEnd=f.connectionEnd||h,f.source=u,f.target=s||c,d=d.reverse()):(f.connectionStart=f.connectionStart||h,f.source=s||c,f.target=u):"reconnectEnd"===p?np(n)?(f.connectionStart=f.connectionStart||h,f.source=s||u,f.target=c,d=d.reverse()):(f.connectionEnd=f.connectionEnd||h,f.source=c,f.target=s||u):(f.noCropping=!0,f.noLayout=!0,d[o]=h),p===rp&&(d=e.cropWaypoints(l,d)),f.waypoints=d,i.drawPreview(n,r,f)),Kn(a,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,a=t.hover,s=t.target,p=t.waypoints;n.waypoints=p,Re(o),r.removeMarker(n,sp),r.removeMarker(n,pp),a&&(r.removeMarker(a,ip),r.removeMarker(a,s?ip:op)),i&&i.cleanUp(t)}))}lp.$inject=["bendpointMove","injector","eventBus","canvas"];var cp="connect-hover",up="djs-updating";function dp(e,t,n){return hp(e,t,e[t]+n)}function hp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function mp(e){return"x"===e?"y":"x"}function fp(e,t,n){var r,i;return e.original?e.original:(r=fn(t),hp(e,i=mp(n),r[i]))}function yp(e,t,n,r,i,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,r=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=r,n}function p(e){i.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return hp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],mp(e.axis));Kn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,a,s,p,l=n.getGraphics(t),c=i-1,u=i,d=t.waypoints,h=d[c],m=d[u],f=Us(n,d,e);(a=kt(h,m))&&(s="v"===a?"x":"y",0===c&&(h=fp(h,t.source,s)),u===d.length-1&&(m=fp(m,t.target,s)),o={connection:t,segmentStartIndex:c,segmentEndIndex:u,segmentStart:h,segmentEnd:m,axis:s,dragPosition:p=f?f.point:{x:(h.x+m.x)/2,y:(h.y+m.y)/2}},r.init(e,p,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:l,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Ks(i,t.segmentStart,t.segmentEnd),Me(t.draggerGfx).add("djs-dragging"),n.addMarker(r,up)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,a=r.segmentEndIndex,c=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),m=dp(c,d,e["d"+d]),f=dp(u,d,e["d"+d]),y=h.length,g=0;h[o]=m,h[a]=f,o<2&&(t=yn(i.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,g--):"intersect"!==t&&(h.unshift(c),g++)),a>y-3&&(n=yn(i.target,f),a===y-2?"intersect"===n&&(h.pop(),h[h.length-1]=f):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=s(i,h),l(r,g,e),r.newSegmentStartIndex=o+g,p(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,cp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,cp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Re(t.draggerGfx),n.removeMarker(r,up)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex,a=function(e,t){var n=0;return{waypoints:e.filter((function(r,i){return!St(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)})),segmentOffset:n}}(r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}})),i),p=s(n,a.waypoints),l=a.segmentOffset,c={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+l}};o.updateWaypoints(n,p,c)}))}yp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var gp=Math.abs,vp=Math.round;function bp(e){return{x:e.x,y:e.y}}function xp(e){return{x:e.x+e.width,y:e.y+e.height}}function wp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:vp(e.x+e.width/2),y:vp(e.y+e.height/2)}}function _p(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Ep(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 r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Pp(e){return e.children||[]}var Op=Math.abs,Sp=Math.round;function kp(e){function t(e,t){if(d(e)){for(var n=e.length;n--;)if(Op(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e){if(e.width)return{x:Sp(e.width/2+e.x),y:Sp(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.snapPoints,r=e.connection,i=r.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,p=e.segmentEndIndex,l=e.axis;if(t)return t;var c=[i[a-1],o,s,i[p+1]];return a<2&&c.unshift(n(r.source)),p>i.length-3&&c.unshift(n(r.target)),e.snapPoints=t={horizontal:[],vertical:[]},_(c,(function(e){e&&(e=e.original||e,"y"===l&&t.horizontal.push(e.y),"x"===l&&t.vertical.push(e.x))})),t}(e.context),a=e.x,s=e.y;if(o){var p=a-(r=t(o.vertical,a)),l=s-(i=t(o.horizontal,s));q(e,{dx:e.dx-p,dy:e.dy-l,x:r,y:i}),(p||-1!==o.vertical.indexOf(a))&&Ep(e,"x",r),(l||-1!==o.horizontal.indexOf(s))&&Ep(e,"y",i)}})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,a=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},_(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),s=o.hover,p=s&&n(s),l=e.x,c=e.y;if(a){var u=l-(r=t(p?a.vertical.concat([p.x]):a.vertical,l)),d=c-(i=t(p?a.horizontal.concat([p.y]):a.horizontal,c));q(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==a.vertical.indexOf(l))&&Ep(e,"x",r),(d||-1!==a.horizontal.indexOf(c))&&Ep(e,"y",i)}}))}kp.$inject=["eventBus"];var Cp={__depends__:[zs,Ls],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ys],bendpointMove:["type",tp],bendpointMovePreview:["type",lp],connectionSegmentMove:["type",yp],bendpointSnapping:["type",kp]};function Tp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!u(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);u(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},a=t.source,s=t.target;if(!r)return!1;var p=null,l={connectionStart:Mp(t)?o:i,connectionEnd:Mp(t)?i:o};h(r)&&(p=r),n.connect(a,s,p,l)})),this.start=function(e,n,r,i){h(r)||(i=r,r=fn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Mp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Tp.$inject=["eventBus","dragging","modeling","rules"];var Ap="connect-ok",Rp="connect-not-ok";function Dp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,a=t.start,s=t.startPosition,p=t.target,l=t.connectionStart||s,c=t.connectionEnd||{x:e.x,y:e.y},u=l,d=c;Mp(t)&&(u=c,d=l),r.drawPreview(t,n,{source:o||a,target:p||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Ap:Rp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Ap),n.removeMarker(t,Rp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}Dp.$inject=["injector","eventBus","canvas"];var zp={__depends__:[$o,Ls,zs],__init__:["connectPreview"],connect:["type",Tp],connectPreview:["type",Dp]};function jp(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}jp.$inject=["injector","canvas","graphicsFactory","elementFactory"],jp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,a=n.source,s=n.target,p=n.waypoints,l=n.connectionStart,c=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,m=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),De(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return m.getConnection(e,t,n)}))),t&&(r=o(t,a,s)),r?(r.waypoints=p||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:a,target:s,connectionStart:l,connectionEnd:c,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[a?fn(a):l,s?fn(s):c]),this._connectionDocking&&(a||s)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,a,s)),this._graphicsFactory.drawConnection(i,r)):!h&&this.drawNoopPreview(i,n)},jp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||fn(n),o=t.connectionEnd||fn(r),a=this.cropWaypoints(i,o,n,r);_e(e,this.createNoopConnection(a[0],a[1]))},jp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),a=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return[e=n&&gn(o,s,!0)||e,t=r&&gn(a,s,!1)||t]},jp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Re(e.connectionPreviewGfx)},jp.prototype.getConnection=function(e){var t=function(e){return h(e)?e:{}}(e);return this._elementFactory.createConnection(t)},jp.prototype.createConnectionPreviewGfx=function(){var e=Ie("g");return Oe(e,{pointerEvents:"none"}),Me(e).add("djs-connection-preview"),_e(this._canvas.getActiveLayer(),e),e},jp.prototype.createNoopConnection=function(e,t){var n=Ie("polyline");return Oe(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),Oe(n,{points:[e.x,e.y,t.x,t.y]}),n};var Np={__init__:["connectionPreview"],connectionPreview:["type",jp]};function Bp(e,t){return(function(e){return e.originalEvent||e.srcEvent}(e)||e).button===t}function Ip(e){return Bp(e,0)}function Lp(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function $p(e){return!0}function Fp(e){return Ip(e)||function(e){return Bp(e,1)}(e)}function Vp(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(p[e]||Ip)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":$p,"element.mousedown":Fp,"element.mouseup":Fp,"element.click":Fp,"element.dblclick":Fp};function l(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(p[n]=r),a.$delegate=me.bind(e,"svg, .djs-element",t,a)}function c(e,t,n){var r=a(n);r&&me.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,_(s,(function(e,n){c(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,_(s,(function(e,n){l(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),h={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:u};function m(e,t){return t=q({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return Oe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){_(be(".djs-hit",e),Re)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n,r,i,o=(n=t,Oe(i=Ie("polyline"),{points:Lp(n)}),r&&Oe(i,r),i);return f(o,"stroke"),y(e,o),o},this.createBoxHit=function(e,t,n){n=q({x:0,y:0},n);var r=Ie("rect");return f(r,t),Oe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?function(e,t){Oe(e,{points:Lp(t)})}(n,e.waypoints):Oe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=c}Vp.$inject=["eventBus","elementRegistry","styles"];var Hp={__init__:["interactionEvents"],interactionEvents:["type",Vp]},qp=Math.min,Up=Math.max;function Gp(e){e.preventDefault()}function Wp(e){e.stopPropagation()}function Kp(e){this.container=e.container,this.parent=fe('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=F(this.autoResize,this),this.handlePaste=F(this.handlePaste,this)}function Xp(e,t){this._eventBus=e,this._providers=[],this._textbox=new Kp({container:t.getContainer(),keyHandler:F(this._handleKey,this),resizeHandler:F(this._handleResize,this)})}Kp.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,a=this.container;r=this.options=r||{};var s=W(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(i.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 p=W(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),r.centerVertically&&q(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),o.innerText=n,ue.bind(o,"keydown",this.keyHandler),ue.bind(o,"mousedown",Wp),ue.bind(o,"paste",this.handlePaste),r.autoResize&&ue.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),a.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Kp.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Kp.prototype.insertText=function(e){e=e.replace(/\r\n|\r|\n/g,"\n"),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Kp.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,a=i.endContainer,s=i.startOffset,p=i.endOffset,l=i.commonAncestorContainer,c=(t=l.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(l)){var u=o.textContent;o.textContent=u.substring(0,s)+e+u.substring(p),n=o,r=s+e.length}else if(o===this.content&&a===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,c[s]),n=d,r=d.textContent.length}else{var h=c.indexOf(o),m=c.indexOf(a);c.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,s)+e+a.textContent.substring(p):n>h&&n<=m&&xe(t)})),n=o,r=s+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Kp.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 r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Kp.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,p,l,c;n=this.resizeHandle=fe('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Gp(n),Wp(n);var u=qp(Up(l+n.clientX-s,r),o),d=qp(Up(c+n.clientY-p,i),a);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:l,height:c,dx:n.clientX-s,dy:n.clientY-p})},d=function(e){Gp(e),Wp(e),ue.unbind(document,"mousemove",u,!1),ue.unbind(document,"mouseup",d,!1)};ue.bind(n,"mousedown",(function(e){Gp(e),Wp(e),s=e.clientX,p=e.clientY;var n=t.getBoundingClientRect();l=n.width,c=n.height,ue.bind(document,"mousemove",u),ue.bind(document,"mouseup",d)}))}q(n.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"}),t.appendChild(n)},Kp.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ue.unbind(t,"keydown",this.keyHandler),ue.unbind(t,"mousedown",Wp),ue.unbind(t,"input",this.autoResize),ue.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),xe(n)),xe(e)},Kp.prototype.getValue=function(){return this.content.innerText.trim()},Kp.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Kp.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Xp.$inject=["eventBus","canvas"],Xp.prototype.registerProvider=function(e){this._providers.push(e)},Xp.prototype.isActive=function(){return!!this._active},Xp.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Xp.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Xp.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Xp.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Xp.prototype.getValue=function(){return this._textbox.getValue()},Xp.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())},Xp.prototype._handleResize=function(e){this._fire("resize",e)},Xp.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=b(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Yp={__depends__:[Hp],__init__:["directEditing"],directEditing:["type",Xp]},Zp=".entry";function Jp(e,t,n){this._eventBus=t,this._overlays=n;var r=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:r},this._current=null,this._init()}Jp.$inject=["config.contextPad","eventBus","overlays"],Jp.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",(function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()})),e.on("elements.delete",(function(e){_(e.elements,(function(e){t.isOpen(e)&&t.close()}))})),e.on("element.changed",(function(e){var n=e.element,r=t._current;r&&r.element===n&&t.open(n,!0)}))},Jp.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Jp.prototype.getEntries=function(e){var t=this._getProviders(),n={};return _(t,(function(t){var r=t.getContextPadEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))})),n},Jp.prototype.trigger=function(e,t,n){var r,i,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(r=a[Y(s,"data-action")].action,i=t.originalEvent||t,f(r)){if("click"===e)return r(i,o,n)}else if(r[e])return r[e](i,o,n);t.preventDefault()},Jp.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Jp.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Jp.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),r=n.html;_(t,(function(e,t){var n,i=e.group||"default",o=fe(e.html||'<div class="entry" draggable="true"></div>');Y(o,"data-action",t),(n=ve("[data-group="+i+"]",r))||(n=fe('<div class="group" data-group="'+i+'"></div>'),r.appendChild(n)),n.appendChild(o),e.className&&function(e,t){var n=te(e);(d(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(o,e.className),e.title&&Y(o,"title",e.title),e.imageUrl&&o.appendChild(fe('<img src="'+e.imageUrl+'">'))})),te(r).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},Jp.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,r=fe('<div class="djs-context-pad"></div>'),i=q({html:r},this._overlaysConfig);me.bind(r,Zp,"click",(function(e){t.trigger("click",e)})),me.bind(r,Zp,"dragstart",(function(e){t.trigger("dragstart",e)})),ue.bind(r,"mousedown",(function(e){e.stopPropagation()})),this._overlayId=n.add(e,"context-pad",i);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},Jp.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Jp.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Qp={__depends__:[Ao,Wo],contextPad:["type",Jp]},el=["marker-start","marker-mid","marker-end"],tl=["circle","ellipse","line","path","polygon","polyline","rect"];function nl(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){_(i._clonedMarkers,(function(e){Re(e)})),i._clonedMarkers={}}))}nl.$inject=["elementRegistry","eventBus","canvas","styles"],nl.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},nl.prototype.addDragger=function(e,t,n){var r=ze(n=n||this.getGfx(e)),i=n.getBoundingClientRect();return this._cloneMarkers(Gn(r)),Oe(r,this._styles.cls("djs-dragger",[],{x:i.top,y:i.left})),_e(t,r),r},nl.prototype.addFrame=function(e,t){var n=Ie("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return _e(t,n),n},nl.prototype._cloneMarkers=function(e){var t=this;if(e.childNodes)for(var n=0;n<e.childNodes.length;n++)t._cloneMarkers(e.childNodes[n]);(function(e){return-1!==tl.indexOf(e.nodeName)})(e)&&el.forEach((function(n){if(Oe(e,n)){var r=function(e,t,n){return ve("marker#"+(r=Oe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]),n||document);var r}(e,n,t._canvas.getContainer());t._cloneMarker(e,r,n)}}))},nl.prototype._cloneMarker=function(e,t,n){var r=t.id,i=this._clonedMarkers[r];if(!i){var o=r+"-clone";(i=ze(t)).id=o,Me(i).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[r]=i;var a=ve("defs",this._canvas._svg);a||(a=Ie("defs"),_e(this._canvas._svg,a)),_e(a,i)}Oe(e,n,"url(#"+this._clonedMarkers[r].id+")")};var rl={__init__:["previewSupport"],previewSupport:["type",nl]},il="drop-ok",ol="drop-not-ok",al="attach-ok",sl="new-parent",pl="create";function ll(e,t,n,r,i){function o(t,n){[al,il,ol,sl].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function a(){var e=t.context();e&&e.prefix===pl&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,a=t.source,s=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);cl(e);var p={x:e.x,y:e.y},l=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var a=b(e=w(e,(function(t){var n=t.labelTarget;return!(t.parent||function(e){return!!e.labelTarget}(t)&&-1!==e.indexOf(n))})),(function(e){return!ul(e)})),s=!1,p=!1,l=!1;dl(e)&&(s=i.allowed("shape.attach",{position:n,shape:a,target:t})),s||(l=dl(e)?i.allowed("shape.create",{position:n,shape:a,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var c=o.connectionTarget;return l||s?(a&&r&&(p=i.allowed("connection.create",{source:c===r?a:r,target:c===r?r:a,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:p}):(null===l||null===s)&&null}(n,r,p,a,s);r&&null!==l&&(t.target=r,l&&l.attach?o(r,al):o(r,l?sl:ol))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,a=t.target,s=t.canExecute,p=s&&s.attach,l=s&&s.connect,c=t.hints||{};if(!1===s||!a)return!1;cl(e);var u={x:e.x,y:e.y};i=l?r.appendShape(n,i,u,a,{attach:p,connection:!0===l?{}:l,connectionTarget:c.connectionTarget}):b(o=r.createElements(o,u,a,q({},c,{attach:p})),(function(e){return!ul(e)})),q(t,{elements:o,shape:i}),q(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",a),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",a)}))})),this.start=function(e,n,r){d(n)||(n=[n]);var i=b(n,(function(e){return!ul(e)}));if(i){r=q({elements:n,hints:{},shape:i},r||{}),_(n,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var o=yt(w(n,(function(e){return!e.hidden})));_(n,(function(e){ul(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),q(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,pl,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function cl(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)))}function ul(e){return!!e.waypoints}function dl(e){return e&&1===e.length&&!ul(e[0])}ll.$inject=["canvas","dragging","eventBus","modeling","rules"];function hl(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,a=t.context,s=a.elements,p=a.dragGroup;p||(p=a.dragGroup=function(e){var t=Ie("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Ie("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Gn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Gn(i),e),Kn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(s)),o?(p.parentNode||_e(e.getActiveLayer(),p),Kn(p,t.x,t.y)):Re(p)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Re(t)}))}hl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ml={__depends__:[zs,rl,Ls,$o],__init__:["create","createPreview"],create:["type",ll],createPreview:["type",hl]},fl="data-id",yl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function gl(e,t,n){var r=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:r},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}gl.$inject=["config.popupMenu","eventBus","canvas"],gl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},gl.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._getProviders(t);if(!n)return!0;var r=this._getEntries(e,n),i=this._getHeaderEntries(e,n),o=T(r)>0,a=i&&T(i)>0;return!o&&!a},gl.prototype.open=function(e,t,n){var r=this._getProviders(t);if(!e)throw new Error("Element is missing");if(!r||!r.length)throw new Error("No registered providers for: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close(),this._emit("open");var i=this._current={className:t,element:e,position:n},o=this._getEntries(e,r),a=this._getHeaderEntries(e,r);i.entries=q({},o,a),i.container=this._createContainer(),T(a)&&i.container.appendChild(this._createEntries(a,"djs-popup-header")),T(o)&&i.container.appendChild(this._createEntries(o,"djs-popup-body"));var s=this._canvas.getContainer();this._attachContainer(i.container,s,n.cursor),this._bindAutoClose()},gl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindAutoClose(),xe(this._current.container),this._current.container=null)},gl.prototype.isOpen=function(){return!!this._current.container},gl.prototype.trigger=function(e){e.preventDefault();var t=Y(e.delegateTarget||e.target,fl),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},gl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},gl.prototype._getEntries=function(e,t){var n={};return _(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))}else _(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=K(e,["id"])}))})),n},gl.prototype._getHeaderEntries=function(e,t){var n={};return _(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;_(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=K(e,["id"])}))}})),n},gl.prototype._getEntry=function(e){var t=this._current.entries[e];if(!t)throw new Error("entry not found");return t},gl.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},gl.prototype._createContainer=function(){var e=fe('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return q(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),te(e).add(n),e},gl.prototype._attachContainer=function(e,t,n){var r=this;me.bind(e,".entry","click",(function(e){r.trigger(e)})),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n)},gl.prototype._updateScale=function(e){var t,n,r=this._canvas.zoom(),i=this._config.scale,o=r;!0!==i&&(!1===i?(t=1,n=1):(t=i.min,n=i.max),c(t)&&r<t&&(o=t),c(n)&&r>n&&(o=n)),function(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}(e,"scale("+o+")")},gl.prototype._assureIsInbounds=function(e,t){var n,r,i=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,p=e.scrollHeight,l={},c=t.x-i.left,u=t.y-i.top;o+s>i.width&&(l.x=!0),a+p>i.height&&(l.y=!0),l.x&&l.y?(n=c-s+"px",r=u-p+"px"):l.x?(n=c-s+"px",r=u+"px"):l.y&&u<p?(n=c+"px",r="10px"):l.y&&(n=c+"px",r=u-p+"px"),q(e.style,{left:n,top:r},{visibility:"visible","z-index":1e3})},gl.prototype._createEntries=function(e,t){var n=fe("<div>"),r=this;return te(n).add(t),_(e,(function(e,t){var i=r._createEntry(e,t);n.appendChild(i)})),n},gl.prototype._createEntry=function(e,t){var n=fe("<div>"),r=te(n);if(r.add("entry"),e.className&&e.className.split(" ").forEach((function(e){r.add(e)})),Y(n,fl,t),e.label){var i=fe("<span>");i.textContent=e.label,n.appendChild(i)}return e.imageUrl&&n.appendChild(fe('<img src="'+e.imageUrl+'" />')),!0===e.active&&r.add("active"),!0===e.disabled&&r.add("disabled"),e.title&&(n.title=e.title),n},gl.prototype._bindAutoClose=function(){this._eventBus.once(yl,this.close,this)},gl.prototype._unbindAutoClose=function(){this._eventBus.off(yl,this.close,this)};var vl={__init__:["popupMenu"],popupMenu:["type",gl]};function bl(){}bl.prototype.get=function(){return this._data},bl.prototype.set=function(e){this._data=e},bl.prototype.clear=function(){var e=this._data;return delete this._data,e},bl.prototype.isEmpty=function(){return!this._data};var xl={clipboard:["type",bl]};function wl(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}wl.$inject=["eventBus"],wl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,a=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,a,!1,!1,!1,!1,0,null);return n}(0,0)};var _l={__init__:["mouse"],mouse:["type",wl]};function El(e,t,n,r,i,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=a,this._rules=s,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id,b(r,(function(e){return e===n.parent}))&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),Pl(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return k(e.waypoints,(function(e){return(e=Sl(e)).original&&(e.original=Sl(e.original)),e}))}(n)),Ol(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),_(["x","y","width","height"],(function(e){m(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){q(e.hints,{createElementsBehavior:!1})}))}function Pl(e){return!!e.waypoints}function Ol(e){return!!e.labelTarget}function Sl(e){return q({},e)}function kl(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}El.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],El.prototype.copy=function(e){var t,n;return d(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(d(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},El.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},El.prototype._paste=function(e,t,n,r){_(e,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var i=yt(e);return _(e,(function(e){Pl(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),q(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,q({},r))},El.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return _(e,(function(e,o){_(e=z(e,"priority"),(function(e){var o,a=q({},K(e,["priority"]));return r[e.parent]?a.parent=r[e.parent]:delete a.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:a}),Pl(a)?(a.source=r[e.source],a.target=r[e.target],o=r[e.id]=t.createConnection(a),void i.push(o)):Ol(a)?(a.labelTarget=r[a.labelTarget],o=r[e.id]=t.createLabel(a),void i.push(o)):(a.host&&(a.host=r[a.host]),o=r[e.id]=t.createShape(a),void i.push(o))}))})),i},El.prototype.createConnection=function(e){return this._elementFactory.createConnection(K(e,["id"]))},El.prototype.createLabel=function(e){return this._elementFactory.createLabel(K(e,["id"]))},El.prototype.createShape=function(e){return this._elementFactory.createShape(K(e,["id"]))},El.prototype.hasRelations=function(e,t){var n,r;return!(Pl(e)&&(n=b(t,j({id:e.source.id})),r=b(t,j({id:e.target.id})),!n||!r))&&!(Ol(e)&&!b(t,j({id:e.labelTarget.id})))},El.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=b(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i)).push({element:n.element,depth:t}):i.push({element:e,depth:t})}return mt(ut(e),(function(e,t,r){if(!Ol(e)){_(e.labels,(function(e){o(e,r)})),_([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&_(e,(function(e){_(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=k(i,(function(e){return e.element})),i=z(i=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),_(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?kl(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):kl(i.element,e)})),r};var Cl={__depends__:[xl,ml,_l,Ls],__init__:["copyPaste"],copyPaste:["type",El]};function Tl(e,t,n){d(n)||(n=[n]),_(n,(function(n){l(e[n])||(t[n]=e[n])}))}function Ml(e,t,n){var r;t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=t.oldBusinessObject=Ei(n),i=t.oldDi=Pi(n);if(t.type=n.type,Tl(r,t,"name"),Tl(i,t,"isExpanded"),Al(t))return t;r.default&&(t.default=r.default.id)})),t.on("moddleCopy.canCopyProperty",(function(t){var r,i=t.parent,o=t.property;if("processRef"===t.propertyName&&wi(i,"bpmn:Participant")&&wi(o,"bpmn:Process"))return r=e.create("bpmn:Process"),n.copyElement(o,r)})),t.on("copyPaste.pasteElements",(function(){r={}})),t.on("copyPaste.pasteElement",(function(t){var i,o,a,s,p=t.cache,l=t.descriptor,c=l.oldBusinessObject,u=l.oldDi;if(Al(l))return l.businessObject=Ei(p[l.labelTarget]),void(l.di=Pi(p[l.labelTarget]));i=e.create(c.$type),l.businessObject=n.copyElement(c,i),(o=e.create(u.$type)).bpmnElement=i,l.di=n.copyElement(u,o),function(e,t){var n=Ei(e);e.default&&(r[e.default]={element:n,property:"default"}),e.host&&(Ei(e).attachedToRef=Ei(t[e.host])),r=K(r,P(r,(function(t,r,i){var o=r.element,a=r.property;return i===e.id&&(o[a]=n,t.push(e.id)),t}),[]))}(l,p),Tl(l,i,["isExpanded","name"]),a=l,d(s="oldBusinessObject")||(s=[s]),_(s,(function(e){a[e]&&delete a[e]}))}))}function Al(e){return!!e.labelTarget}Ml.$inject=["bpmnFactory","eventBus","moddleCopy"];var Rl=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing"];function Dl(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return z(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=h(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Rl.indexOf(r))&&(!(r&&n&&!b(n.properties,j({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,r=e.property;if(n="bpmn:ExtensionElements",(t=r)&&"function"==typeof t.$instanceOf&&t.$instanceOf(n)&&(!r.values||!r.values.length))return!1}))}function zl(e,t){return P(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Dl.$inject=["eventBus","bpmnFactory","moddle"],Dl.prototype.copyElement=function(e,t,n){var r=this;n&&!d(n)&&(n=[n]),n=n||zl(e.$descriptor);var i=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t});return!1===i||(d(i)&&(n=i),_(n,(function(n){var i;v(e,n)&&(i=e.get(n));var o=r.copyProperty(i,t,n);!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:o,propertyName:n})&&c(o)&&t.set(n,o)}))),t},Dl.prototype.copyProperty=function(e,t,n){var r=this,i=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n});if(!1!==i){if(i)return h(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;var o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference){if(o.isId)return this._copyId(e,t);if(d(e))return P(e,(function(e,o){return(i=r.copyProperty(o,t,n))?(i.$parent=t,e.concat(i)):e}),[]);if(h(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(i=r._bpmnFactory.create(e.$type)).$parent=t,i=r.copyElement(e,i)}return e}}},Dl.prototype._copyId=function(e,t){return this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var jl={__depends__:[Cl],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ml],moddleCopy:["type",Dl]},Nl=Math.round;function Bl(e){this._modeling=e}Bl.$inject=["modeling"],Bl.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=t.width||e.width,o=t.height||e.height,a=t.x||e.x,s=t.y||e.y,p=Nl(a+i/2),l=Nl(s+o/2);return r.replaceShape(e,q({},t,{x:p,y:l,width:i,height:o}),n)};var Il={__init__:["replace"],replace:["type",Bl]};var Ll=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function $l(e,t,n,r,i,o,a){this.replaceElement=function(s,p,c){c=c||{};var u=p.type,h=s.businessObject;if(Fl(h)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&v(e,"collapsed")?e.collapsed:!Bi(e);return n!==(t&&(v(t,"collapsed")||v(t,"isExpanded"))?v(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(s,p))return r.toggleCollapse(s),s;var m=e.create(u),f={type:u,businessObject:m,di:{}};!function(e,t,n){d(n)||(n=[n]),_(n,(function(n){l(e[n])||(t[n]=e[n])}))}(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var y,g=zl(h.$descriptor),b=zl(m.$descriptor,!0),x=(y=b,g.filter((function(e){return-1!==y.indexOf(e)})));q(m,W(p,Ll));var E=w(x,(function(e){return"eventDefinitions"===e?Vl(s,p.eventDefinitionType):"loopCharacteristics"===e?!Li(m):!v(m,e)&&(("processRef"!==e||!1!==p.isExpanded)&&"triggeredByEvent"!==e)}));return m=n.copyElement(h,m,E),p.eventDefinitionType&&(Vl(m,p.eventDefinitionType)||(f.eventDefinitionType=p.eventDefinitionType,f.eventDefinitionAttrs=p.eventDefinitionAttrs)),wi(h,"bpmn:Activity")&&(Fl(h)?f.isExpanded=Bi(s):p&&v(p,"isExpanded")&&(f.isExpanded=p.isExpanded),Bi(s)&&!wi(h,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)),Fl(h)&&!Fl(m)&&(c.moveChildren=!1),wi(h,"bpmn:Participant")&&(!0===p.isExpanded?m.processRef=e.create("bpmn:Process"):c.moveChildren=!1,f.width=s.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:m})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),m.name=h.name,_i(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&_i(m,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(m.default=h.default),p.host&&!wi(h,"bpmn:BoundaryEvent")&&wi(m,"bpmn:BoundaryEvent")&&(f.host=p.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=s.x+(s.width-f.width)/2),f=i.replaceElement(s,f,c),!1!==c.select&&a.select(f),f}}function Fl(e){return wi(e,"bpmn:SubProcess")}function Vl(e,t){var n=Ei(e);return t&&n.get("eventDefinitions").some((function(e){return wi(e,t)}))}$l.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules","selection"];var Hl={__depends__:[jl,Il,$o],bpmnReplace:["type",$l]};function ql(e){return function(t){var n=t.target,r=Ei(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,a=(i&&i.$type)===n.eventDefinitionType,s=r.triggeredByEvent===n.triggeredByEvent,p=void 0===n.isExpanded||n.isExpanded===Bi(e);return!(o&&a&&s&&p)}}var Ul=[{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"}}],Gl=[{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"}}],Wl=[{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",eventDefinitionAttrs:{name:""}}},{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",eventDefinitionAttrs:{name:""}}},{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"}}],Kl=[{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"}}],Xl=[{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"}}],Yl=[{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}}],Zl=[{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}}],Jl=[{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}}],Ql=[{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}}],ec=[{label:"Data Store Reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],tc=[{label:"Data Object Reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],nc=[{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}}],rc=[{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}}],ic=[{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"}],oc=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty Pool";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function ac(e,t,n,r,i,o,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=a,this.register()}ac.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate"],ac.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ac.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var r=ql(e);return wi(n,"bpmn:DataObjectReference")?this._createEntries(e,ec):wi(n,"bpmn:DataStoreReference")&&!wi(e.parent,"bpmn:Collaboration")?this._createEntries(e,tc):wi(n,"bpmn:StartEvent")&&!wi(n.$parent,"bpmn:SubProcess")?(t=w(Ul,r),this._createEntries(e,t)):wi(n,"bpmn:Participant")?(t=w(oc,(function(t){return Bi(e)!==t.target.isExpanded})),this._createEntries(e,t)):wi(n,"bpmn:StartEvent")&&Li(n.$parent)?(t=w(rc,(function(t){var n=!1!==t.target.isInterrupting,i=Ei(e).isInterrupting===n;return r(t)||!r(t)&&!i})),this._createEntries(e,t)):wi(n,"bpmn:StartEvent")&&!Li(n.$parent)&&wi(n.$parent,"bpmn:SubProcess")?(t=w(Gl,r),this._createEntries(e,t)):wi(n,"bpmn:EndEvent")?(t=w(Kl,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!wi(n.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,t)):wi(n,"bpmn:BoundaryEvent")?(t=w(nc,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!wi(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,o=n.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,t)):wi(n,"bpmn:IntermediateCatchEvent")||wi(n,"bpmn:IntermediateThrowEvent")?(t=w(Wl,r),this._createEntries(e,t)):wi(n,"bpmn:Gateway")?(t=w(Xl,r),this._createEntries(e,t)):wi(n,"bpmn:Transaction")?(t=w(Zl,r),this._createEntries(e,t)):Li(n)&&Bi(e)?(t=w(Jl,r),this._createEntries(e,t)):wi(n,"bpmn:SubProcess")&&Bi(e)?(t=w(Yl,r),this._createEntries(e,t)):wi(n,"bpmn:AdHocSubProcess")&&!Bi(e)?(t=w(Ql,(function(t){var n=t.target,r="bpmn:SubProcess"===n.type,i=!0===n.isExpanded;return ql(e)&&(!r||i)})),this._createEntries(e,t)):wi(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ic):wi(n,"bpmn:FlowNode")?(t=w(Ql,r),wi(n,"bpmn:SubProcess")&&!Bi(e)&&(t=w(t,(function(e){return"Sub Process (collapsed)"!==e.label}))),this._createEntries(e,t)):[]},ac.prototype.getHeaderEntries=function(e){var t=[];return wi(e,"bpmn:Activity")&&!Li(e)&&(t=t.concat(this._getLoopEntries(e))),wi(e,"bpmn:DataObjectReference")&&(t=t.concat(this._getDataObjectIsCollection(e))),wi(e,"bpmn:Participant")&&(t=t.concat(this._getParticipantMultiplicity(e))),!wi(e,"bpmn:SubProcess")||wi(e,"bpmn:Transaction")||Li(e)||t.push(this._getAdHocEntry(e)),t},ac.prototype._createEntries=function(e,t){var n=[],r=this;return _(t,(function(t){var i=r._createMenuEntry(t,e);n.push(i)})),n},ac.prototype._createSequenceFlowEntries=function(e,t){var n=Ei(e),r=[],i=this._modeling,o=this._moddle,a=this;return _(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e.source,{default:n})})));break;case"replace-with-conditional-flow":!n.conditionExpression&&wi(n.sourceRef,"bpmn:Activity")&&r.push(a._createMenuEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})})));break;default:if(wi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})})));if((wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})})))}})),r},ac.prototype._createMenuEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,id:e.actionName,action:n}},ac.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function r(n,r){var i;r.active?i=void 0:(i=t._moddle.create(r.options.loopCharacteristics),r.options.isSequential&&(i.isSequential=r.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:i})}var i,o,a,s=Ei(e).loopCharacteristics;return s&&(i=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:n("Parallel Multi Instance"),active:a,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},ac.prototype._getDataObjectIsCollection=function(e){var t=this,n=this._translate;var r=e.businessObject.dataObjectRef,i=r.isCollection;return[{id:"toggle-is-collection",className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}]},ac.prototype._getParticipantMultiplicity=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return[{id:"toggle-participant-multiplicity",className:"bpmn-icon-parallel-mi-marker",title:r("Participant Multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}]},ac.prototype._getAdHocEntry=function(e){var t=this._translate,n=wi(Ei(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,i){return r(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}};var sc={__depends__:[vl,Hl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ac]},pc=Math.max,lc=Math.min;function cc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function uc(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return m(i)&&(r=(/top|left/.test(e)?lc:pc)(r,i)),m(o)&&(r=(/top|left/.test(e)?pc:lc)(r,o)),r}function dc(e,t){return void 0!==e?e:20}function hc(e){return!e.waypoints&&"label"!==e.type}function mc(e,t){var n;if((n=void 0===e.length?w(e.children,hc):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=dc(t.left),r=dc(t.right),i=dc(t.top),o=dc(t.bottom)):n=r=i=o=dc(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(yt(n),t)}var fc=Math.abs;var yc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],gc=30;function vc(e,t){return t=t||[],e.children.filter((function(e){wi(e,"bpmn:Lane")&&(vc(e,t),t.push(e))})),t}function bc(e){return e.children.filter((function(e){return wi(e,"bpmn:Lane")}))}function xc(e){return gs(e,yc)||e}function wc(e,t){var n=xc(e),r=vc(n,wi(n,"bpmn:Process")?[]:[n]),i=hn(e),o=hn(t),a=function(e,t){return cc(hn(t),hn(e))}(e,t),s=[];return r.forEach((function(t){if(t!==e){var n,r,p=0,l=a.right,c=0,u=a.left,d=hn(t);a.top&&(fc(d.bottom-i.top)<10&&(c=o.top-d.bottom),fc(d.top-i.top)<5&&(p=o.top-d.top)),a.bottom&&(fc(d.top-i.bottom)<10&&(p=o.bottom-d.top),fc(d.bottom-i.bottom)<5&&(c=o.bottom-d.bottom)),(p||l||c||u)&&s.push({shape:t,newBounds:(n=t,r={top:p,right:l,bottom:c,left:u},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),s}function _c(e,t,n,r,i,o,a,s,p,l,c,u){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=p,this._canvas=l,this._rules=c,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(So(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ec(e,t,n){var r=e.$instanceOf(t),i=!1;return _(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],_c.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,p=this._rules,l=this._autoPlace,c=this._translate,u={};if("label"===e.type)return u;var h=e.businessObject;function m(e,t){i.start(e,t)}function f(e,t,n,i){function a(t,n){var a=r.createShape(q({type:e},i));o.start(t,a,{source:n})}return"string"!=typeof n&&(i=n,n=c("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:l?function(t,n){var o=r.createShape(q({type:e},i));l.append(n,o)}:a}}}function y(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(_i(h,["bpmn:Lane","bpmn:Participant"])&&Bi(e)){var g=bc(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),g.length<2&&(e.height>=120&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:y(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}wi(h,"bpmn:FlowNode")&&(wi(h,"bpmn:EventBasedGateway")?q(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append ReceiveTask")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ec(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):wi(h,"bpmn:EndEvent")||h.isForCompensation||Ec(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Li(h)||q(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append EndEvent")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",c("Append Task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),a.isEmpty(e,"bpmn-replace")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,n){var r=q(function(e){var n=s.getContainer(),r=t.getPad(e).html,i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),a=o.top-i.top;return{x:o.left-i.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}});a.open(n,"bpmn-replace",r)}}}}),_i(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{"append.text-annotation":f("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:m,dragstart:m}}}),wi(h,"bpmn:TextAnnotation")&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using Association"),action:{click:m,dragstart:m}}}),_i(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}}),wi(h,"bpmn:Group")&&q(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation")});var v=p.allowed("elements.delete",{elements:[e]});return d(v)&&(v=v[0]===e),v&&q(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var Pc={__depends__:[Yp,Qp,$o,zp,ml,sc],__init__:["contextPadProvider"],contextPadProvider:["type",_c]},Oc={horizontal:["x","width"],vertical:["y","height"]};function Sc(e){this._modeling=e,this._filters=[],this.registerFilter((function(e,t,n){var r,i=0,o=0;return _(e,(function(e){e.waypoints||e.labelTarget||(i+=e[n],o+=1)})),r=Math.round(i/o),w(e,(function(e){return e[n]<r+50}))}))}Sc.$inject=["modeling"],Sc.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Sc.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Sc.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(_(t,(function(e){i=e(i,n,r)})),i):e},Sc.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return _(z(e,r),(function(e,o){var a,s=n._findRange(e,r,i),p=t[t.length-1];p&&n._hasIntersection(p.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))})),t},Sc.prototype._setOrientation=function(e){var t=Oc[e];this._axis=t[0],this._dimension=t[1]},Sc.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)},Sc.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var kc={__init__:["distributeElements"],distributeElements:["type",Sc]};function Cc(e){e.registerFilter((function(e){return w(e,(function(e){var t=_i(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)}))}))}Cc.$inject=["distributeElements"];var Tc={__depends__:[kc],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Cc]},Mc="is not a registered action";function Ac(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Rc(e,t){return new Error(e+" "+t)}Ac.$inject=["eventBus","injector"],Ac.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!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)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),a&&this.register("zoom",(function(e){a.zoom(e.value)})),n&&r&&s&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=s.allowed("elements.delete",{elements:e});!1!==i&&(t=d(i)?i:e).length&&n.removeElements(t.slice())}})),p&&this.register("moveCanvas",(function(e){p.moveCanvas(e)})),l&&this.register("moveSelection",(function(e){l.moveSelection(e.direction,e.accelerated)}))},Ac.prototype.trigger=function(e,t){if(!this._actions[e])throw Rc(e,Mc);return this._actions[e](t)},Ac.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);_(e,(function(e,t){n._registerAction(t,e)}))},Ac.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Rc(e,"is already registered");this._actions[e]=t},Ac.prototype.unregister=function(e){if(!this.isRegistered(e))throw Rc(e,Mc);this._actions[e]=void 0},Ac.prototype.getActions=function(){return Object.keys(this._actions)},Ac.prototype.isRegistered=function(e){return!!this._actions[e]};var Dc={__init__:["editorActions"],editorActions:["type",Ac]};function zc(e){e.invoke(Ac,this)}r(zc,Ac),zc.$inject=["injector"],zc.prototype._registerDefaultActions=function(e){Ac.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),p=e.get("distributeElements",!1),l=e.get("alignElements",!1),c=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),a&&this._registerAction("handTool",(function(){a.toggle()})),s&&this._registerAction("globalConnectTool",(function(){s.toggle()})),r&&p&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&p.trigger(t,n)})),r&&l&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=w(t,(function(e){return!wi(e,"bpmn:Lane")})),l.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&c&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&c.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=yt(r=wi(i,"bpmn:Collaboration")?n.filter((function(e){return wi(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!wi(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)}))};var jc={__depends__:[Dc],editorActions:["type",zc]};function Nc(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;_i(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Nc.$inject=["eventBus"];function Bc(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Ic(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.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(t){var n=t.originalEvent;if(!(!i.active||n&&ba(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;if(s&&m(s[t]))return s[t];s||(s=o.snapOffset={});m(s[t])||(s[t]=0);if(!i)return s[t];n.get(i.id)||(Lc(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2);if(!a)return s[t];"x"===t?/left/.test(a)?s[t]-=i.width/2:/right/.test(a)&&(s[t]+=i.width/2):/top/.test(a)?s[t]-=i.height/2:/bottom/.test(a)&&(s[t]+=i.height/2);return s[t]}(t,n,e);o&&(r.offset=o);var a=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={});a[t]||(a[t]={});var s=n.direction;r&&(Lc(t)?(a.x.min=r.left,a.x.max=r.right):(a.y.min=r.top,a.y.max=r.bottom));var p=i.min,l=i.max;p&&(Lc(t)?Fc(s)?a.x.max=p.left:a.x.min=p.right:$c(s)?a.y.max=p.top:a.y.min=p.bottom);l&&(Lc(t)?Fc(s)?a.x.min=l.left:a.x.max=l.right:$c(s)?a.y.min=l.top:a.y.max=l.bottom);return a[t]}(t,n);a&&q(r,a),_p(t,n)||i.snapEvent(t,n,r)}))}}))}function Lc(e){return"x"===e}function $c(e){return-1!==e.indexOf("n")}function Fc(e){return-1!==e.indexOf("w")}function Vc(e,t){Yo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;y(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}Ic.prototype.snapEvent=function(e,t,n){Ep(e,t,this.snapValue(e[t],n))},Ic.prototype.getGridSpacing=function(){return 10},Ic.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=Bc(e+=i,10),t&&t.min&&m(n=t.min)&&(n=Bc(n+i,10,"ceil"),e=Math.max(e,n)),t&&t.max&&m(r=t.max)&&(r=Bc(r+i,10,"floor"),e=Math.min(e,r)),e-=i},Ic.prototype.isActive=function(){return this.active},Ic.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ic.prototype.toggleActive=function(){this.setActive(!this.active)},Ic.$inject=["elementRegistry","eventBus","config.gridSnapping"],Vc.$inject=["eventBus","gridSnapping","modeling"],r(Vc,Yo),Vc.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},Vc.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},Vc.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(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),q(e,o),e},Vc.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(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),q(e,o),e};function Hc(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}Hc.$inject=["eventBus","gridSnapping"];var qc={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Vc],gridSnappingSpaceToolBehavior:["type",Hc]}],__init__:["gridSnapping"],gridSnapping:["type",Ic]};function Uc(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=fn(n),i=e.shape,o=vs(n,i);return["x","y"].forEach((function(e){var n={};o[e]!==r[e]&&(o[e]>r[e]?n.min=o[e]:n.max=o[e],wi(i,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-i.height/2:n.offset=-i.width/2),o[e]=t.snapValue(o[e],n))})),o}))}Uc.$inject=["eventBus","gridSnapping"];function Gc(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();wi(i,"bpmn:Participant")&&wi(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}Gc.$inject=["canvas","eventBus","gridSnapping"];function Wc(e,t,n){Yo.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},a=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(a)&&n.updateWaypoints(i,r.snapMiddleSegments(a))}))}function Kc(e,t,n){var r=kt(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=q({},t,i),n=q({},n,i)),[t,n]}Wc.$inject=["eventBus","gridSnapping","modeling"],r(Wc,Yo),Wc.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Kc(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var Xc={__depends__:[qc,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingCreateParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Uc],gridSnappingCreateParticipantBehavior:["type",Gc],gridSnappingLayoutConnectionBehavior:["type",Wc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Nc]};function Yc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return wi(t,"bpmn:Lane")?n.createParticipantHit(t,r):wi(t,"bpmn:Participant")?Bi(t)?n.createParticipantHit(t,r):n.createDefaultHit(t,r):wi(t,"bpmn:SubProcess")?Bi(t)?n.createSubProcessHit(t,r):n.createDefaultHit(t,r):void 0}))}Yc.$inject=["eventBus","interactionEvents"],Yc.prototype.createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Yc.prototype.createParticipantHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:30,height:e.height}),!0},Yc.prototype.createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var Zc={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Yc]};function Jc(e){e.invoke(Ta,this)}r(Jc,Ta),Jc.$inject=["injector"],Jc.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Ta.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0}))};var Qc={__depends__:[Ma],__init__:["keyboardBindings"],keyboardBindings:["type",Jc]},eu={moveSpeed:1,moveSpeedAccelerated:10},tu="left",nu="right",ru="down",iu={ArrowLeft:tu,Left:tu,ArrowUp:"up",Up:"up",ArrowRight:nu,Right:nu,ArrowDown:ru,Down:ru},ou={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 au(e,t,n,r,i){var o=this;this._config=q({},eu,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=iu[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var a=this._config[t?"moveSpeedAccelerated":"moveSpeed"],s=ou[e](a);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,s)}}}au.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var su={__depends__:[Ma,$o],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",au]};function pu(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=hn(e);return mn({top:uc("top",n,t),right:uc("right",n,t),bottom:uc("bottom",n,t),left:uc("left",n,t)})}(n,a),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:hn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=un(i)))return;n.resizeShape(t,i)}}(e.context)}))}function lu(e,t){var n=fn(e),r=hn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function cu(e){return"n"===e||"s"===e?"resize-ns":"e"===e||"w"===e?"resize-ew":"nw"===e||"se"===e?"resize-nwse":"resize-nesw"}pu.prototype.canResize=function(e){var t=this._rules,n=W(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},pu.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=q({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,lu(t,i),"resize",{autoActivate:!0,cursor:cu(i),data:{shape:t,context:r}})},pu.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=hn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},a=r?hn(r):o;return mn({top:lc(o.top,a.top),left:lc(o.left,a.left),bottom:pc(o.bottom,a.bottom),right:pc(o.right,a.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},mc(t,e.childrenBoxPadding))},pu.$inject=["eventBus","rules","modeling","dragging"];var uu="djs-resizing",du="resize-not-ok";function hu(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,a;r=e.context,i=r.shape,o=r.newBounds,(a=r.frame)||(a=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,uu)),o.width>5&&Oe(a,{x:o.x,width:o.width}),o.height>5&&Oe(a,{y:o.y,height:o.height}),r.canExecute?Me(a).remove(du):Me(a).add(du)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Re(n.frame),t.removeMarker(r,uu)}))}hu.$inject=["eventBus","canvas","previewSupport"];var mu=-6,fu="djs-resizer",yu=["n","w","s","e","nw","ne","se","sw"];function gu(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&_(t,F(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}gu.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Oo(t)&&r.activate(t,e,n)}ue.bind(t,"mousedown",i),ue.bind(t,"touchstart",i)},gu.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=mu);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=mu);return t}(r),a=Ie("g");Me(a).add(fu),Me(a).add("djs-resizer-"+e.id),Me(a).add("djs-resizer-"+r),_e(i,a);var s=Ie("rect");Oe(s,{x:-2+o.x,y:-2+o.y,width:4,height:4}),Me(s).add("djs-resizer-visual"),_e(a,s);var p=Ie("rect");return Oe(p,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Me(p).add("djs-resizer-hit"),_e(a,p),Wn(a,t,n),a},gu.prototype.createResizer=function(e,t){var n=lu(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},gu.prototype.addResizer=function(e){var t=this;this._resize.canResize({shape:e})&&_(yu,(function(n){t.createResizer(e,n)}))},gu.prototype.removeResizers=function(){De(this._getResizersParent())},gu.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gu.$inject=["eventBus","canvas","selection","resize"];var vu={__depends__:[Ls,zs,rl],__init__:["resize","resizePreview","resizeHandles"],resize:["type",pu],resizePreview:["type",hu],resizeHandles:["type",gu]};function bu(e,t){var n=t.create("bpmn:CategoryValue"),r=t.create("bpmn:Category",{categoryValue:[n]});return Et(e.get("rootElements"),r),Ei(r).$parent=e,Ei(n).$parent=r,n}function xu(e,t,n,r,i,o,a){function s(e,t){(t||_i(e,["bpmn:Task","bpmn:TextAnnotation"])||wu(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=a,r.registerProvider(this),e.on("element.dblclick",(function(e){s(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],(function(e){r.isActive()&&r.complete()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||s(n))})),e.on("autoPlace.end",500,(function(e){s(e.shape)}))}function wu(e){return wi(e,"bpmn:SubProcess")&&!Bi(e)}xu.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],xu.prototype.activate=function(e){var t=Vi(e);if(void 0!==t){var n={text:t};q(n,this.getEditingBBox(e));var r={};return(_i(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||wu(e))&&q(r,{centerVertically:!0}),lo(e)&&q(r,{autoResize:!0}),wi(e,"bpmn:TextAnnotation")&&q(r,{resizable:!0,autoResize:!0}),q(n,{options:r}),n}},xu.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,a={x:r.x,y:r.y},s=t.zoom(),p=this._textRenderer.getDefaultStyle(),l=this._textRenderer.getExternalStyle(),c=l.fontSize*s,u=l.lineHeight,d=p.fontSize*s,h=p.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(wi(e,"bpmn:Lane")||function(e){return wi(e,"bpmn:Participant")&&Bi(e)}(e))&&(q(a,{width:r.height,height:30*s,x:r.x-r.height/2+15*s,y:o-30*s/2}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(_i(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return wi(e,"bpmn:Participant")&&!Bi(e)}(e)||wu(e))&&(q(a,{width:r.width,height:r.height}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return wi(e,"bpmn:SubProcess")&&Bi(e)}(e)&&(q(a,{width:r.width,x:r.x}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"}));var f=90*s,y=7*s,g=4*s;if(n.labelTarget&&(q(a,{width:f,height:r.height+y+g,x:i-f/2,y:r.y-y}),q(m,{fontSize:c+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:g+"px"})),lo(n)&&!co(n)&&!mo(n)){var v=ho(e),b=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),x=c+y+g;q(a,{width:f,height:x,x:b.x-f/2,y:b.y-x/2}),q(m,{fontSize:c+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:g+"px"})}return wi(e,"bpmn:TextAnnotation")&&(q(a,{width:r.width,height:r.height,minWidth:30*s,minHeight:10*s}),q(m,{textAlign:"left",paddingTop:5*s+"px",paddingBottom:7*s+"px",paddingLeft:7*s+"px",paddingRight:5*s+"px",fontSize:d+"px",lineHeight:h})),{bounds:a,style:m}},xu.prototype.update=function(e,t,n,r){var i,o,a;if((wi(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),wi(e,"bpmn:Group"))&&!Ei(e).categoryValueRef){var s=bu(Ei(this._canvas.getRootElement()).$parent,this._bpmnFactory);Ei(e).categoryValueRef=s}(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var _u="djs-element-hidden",Eu="djs-label-hidden";function Pu(e,t,n,r){var i,o,a,s=this,p=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var n=e.active;if(wi(i=n.element.label||n.element,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(i),a=Ie("g");var l=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),c=s.path=Ie("path");Oe(c,{d:l,strokeWidth:2,stroke:Ou(i)}),_e(a,c),_e(p,a),Kn(a,i.x,i.y)}wi(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,_u):(wi(i,"bpmn:Task")||wi(i,"bpmn:CallActivity")||wi(i,"bpmn:SubProcess")||wi(i,"bpmn:Participant"))&&t.addMarker(i,Eu)})),e.on("directEditing.resize",(function(e){if(wi(i,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(i.height/o.height*(t+n),0),p=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:p})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,_u),t.removeMarker(i,Eu)),i=void 0,o=void 0,a&&(Re(a),a=void 0)}))}function Ou(e,t){return Pi(e).get("stroke")||t||"black"}Pu.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Su={__depends__:[Xo,vu,Yp],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",xu],labelEditingPreview:["type",Pu]},ku=["top","bottom","left","right"],Cu=10;function Tu(e,t){function n(e){if(co(e)){var n=function(e){var t=fn(e.label),n=Mu(fn(e),t);if(r=n,-1===ku.indexOf(r))return;var r;var i=function(e){var t=fn(e);return[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Mu(t,e)}))}(e);if(e.host){var o=function(e){var t,n=e.host,r=yn(fn(e),n);t=r.indexOf("-")>=0?r.split("-"):[r];return ku.filter((function(e){return-1===t.indexOf(e)}))}(e);i=i.concat(o)}var a=ku.filter((function(e){return-1===i.indexOf(e)}));if(-1!==a.indexOf(n))return;return a[0]}(e);n&&function(e,n){var r=fn(e),i=e.label,o=fn(i);if(!i.parent)return;var a,s=hn(e);switch(n){case"top":a={x:r.x,y:s.top-Cu-i.height/2};break;case"left":a={x:s.left-Cu-i.width/2,y:r.y};break;case"bottom":a={x:r.x,y:s.bottom+Cu+i.height/2};break;case"right":a={x:s.right+Cu+i.width/2,y:r.y}}var p=La(a,o);t.moveShape(i,p)}(e,n)}}Yo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function Mu(e,t){return yn(t,e,5)}function Au(e,t,n){Yo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(wi(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function Ru(e,t){e.invoke(Yo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;_(w(r.incoming.concat(r.outgoing),(function(e){return wi(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}r(Tu,Yo),Tu.$inject=["eventBus","modeling"],r(Au,Yo),Au.$inject=["eventBus","elementFactory","bpmnRules"],r(Ru,Yo),Ru.$inject=["injector","modeling"];function Du(e,t){t.invoke(Yo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return zu(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n.replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];zu(i,r)&&(e.shapes=[n.replaceShape(i,r)])}}),!0)}function zu(e,t){return!mo(e)&&_i(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}Du.$inject=["bpmnReplace","injector"],r(Du,Yo),Du.prototype.replaceShape=function(e,t){var n,r=(n=Ei(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function ju(e,t,n){function r(e){return w(e.attachers,(function(e){return wi(e,"bpmn:BoundaryEvent")}))}Yo.call(this,e),this.postExecute("connection.create",(function(e){var t=e.context.source,i=e.context.target,o=r(i);wi(t,"bpmn:EventBasedGateway")&&wi(i,"bpmn:ReceiveTask")&&o.length>0&&n.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var t=e.context.oldSource,i=e.context.newSource;wi(t,"bpmn:Gateway")&&wi(i,"bpmn:EventBasedGateway")&&_(i.outgoing,(function(e){var t=e.target,i=r(t);wi(t,"bpmn:ReceiveTask")&&i.length>0&&n.removeElements(i)}))})),e.on("moddleCopy.canCopyProperty",2e3,(function(e){var n=e.parent,r=e.property,i=e.propertyName,o=t.getPropertyDescriptor(n,i);o&&o.isReference&&wi(r,"bpmn:RootElement")&&n.set(i,r)}))}function Nu(e){e.invoke(Yo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;wi(n,"bpmn:Lane")&&!wi(r,"bpmn:Lane")&&(t.parent=gs(n,"bpmn:Participant"))}))}function Bu(e,t,n){Yo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(wi(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}ju.$inject=["eventBus","moddle","modeling"],r(ju,Yo),Nu.$inject=["injector"],r(Nu,Yo),Bu.$inject=["eventBus","bpmnFactory","moddle"],r(Bu,Yo);var Iu=20,Lu=20,$u=2e3;function Fu(e,t,n){function r(){var t=e.getRootElement();return wi(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Yo.call(this,t),t.on(["create.start","shape.move.start"],$u,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(wi(r,"bpmn:Participant")&&wi(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!wi(e,"bpmn:Group")&&!mo(e)&&!function(e){return!!e.waypoints}(e)}));if(o.length){var a=yt(o);q(r,function(e,t){t={width:t.width+40+30,height:t.height+40};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,a)),n.createConstraints=function(e,t){return{bottom:(t=hn(t)).top+e.height/2-Lu,left:t.right-e.width/2+Iu,top:t.bottom-e.height/2+Lu,right:t.left+e.width/2-Iu-30}}(r,a)}}})),t.on("create.start",$u,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function a(e){e.element=i,e.gfx=o}wi(r,"bpmn:Participant")&&wi(i,"bpmn:Process")&&(t.on("element.hover",$u,a),t.once("create.cleanup",(function(){t.off("element.hover",a)})))})),this.preExecute("elements.create",$u,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return b(e,(function(e){return wi(e,"bpmn:Participant")}))}(n);o&&wi(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Ei(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;wi(n,"bpmn:Participant")&&wi(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Ei(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Ei(r).set("processRef",Ei(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Ei(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var a=r.children.slice();o?i===o&&n.moveElements(a,{x:0,y:0},o):n.moveElements(a,{x:0,y:0},i)}}),!0)}Fu.$inject=["canvas","eventBus","modeling"],r(Fu,Yo);var Vu="__targetRef_placeholder";function Hu(e,t){function n(e,n){var r=e.get("properties"),i=b(r,(function(e){return e.name===Vu}));return!i&&n&&Et(r,i=t.create("bpmn:Property",{name:Vu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return b(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||_t(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,a=o.businessObject,s=o.target,p=s&&s.businessObject,l=i.newTarget,c=l&&l.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==p&&r(d,a),c&&c!==p&&r(c,a),p?(t=n(p,!0),h.targetRef=t):h.targetRef=null}Yo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],qu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],qu(i))}function qu(e){return function(t){if(wi(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function Uu(e){this._bpmnUpdater=e}function Gu(e,t,n,r){function i(e){return e.children.filter((function(e){return wi(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return wi(e,"bpmn:Participant")&&Ei(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Pi(e),newSemanticParent:o.processRef||o,newDiParent:Pi(r)})}}Yo.call(this,r),t.registerHandler("dataStore.updateContainment",Uu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return wi(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!wi(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;wi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&wi(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;wi(r,"bpmn:Collaboration")||wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&wi(i,"bpmn:Collaboration")&&o(n,wi(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(wi(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();_i(n,["bpmn:Participant","bpmn:SubProcess"])&&wi(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){wi(r,"bpmn:Process")&&o(e,r)}))}))}Hu.$inject=["eventBus","bpmnFactory"],r(Hu,Yo),Uu.$inject=["bpmnUpdater"],Uu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i)},Uu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i)},Gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],r(Gu,Yo);function Wu(e,t,n){Yo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var t=e.context,r=t.hints,i=t.shape,o=t.oldParent;wi(i,"bpmn:Lane")&&(r&&r.nested||function(e,t){var r,i,o,a=bc(t),s=[],p=[];mt(a,(function(t){return t.y>e.y?p.push(t):s.push(t),t.children})),a.length&&(r=p.length&&s.length?e.height/2:e.height,s.length&&(i=n.calculateAdjustments(s,"y",r,e.y-10),n.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),p.length&&(o=n.calculateAdjustments(p,"y",-r,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")))}(i,o))}))}Wu.$inject=["eventBus","modeling","spaceTool"],r(Wu,Yo);function Ku(e,t){t.invoke(Yo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Xu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n.replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,a=e.host;Xu(e,(o=a,-1!==t.indexOf(o)?a:r))&&(t[i]=n.replaceShape(e))}))}),!0)}function Xu(e,t){return!mo(e)&&wi(e,"bpmn:BoundaryEvent")&&!t}function Yu(e,t,n){function r(e,r,i){var o,a,s,p,l,c,u,d,h=r.waypoints,f=e.outgoing.slice(),y=e.incoming.slice(),g=Vs(h,d=m(i.width)?fn(i):i);if(g){if(o=h.slice(0,g.index),a=h.slice(g.index+(g.bendpoint?1:0)),!o.length||!a.length)return;s=g.bendpoint?h[g.index]:d,1!==o.length&&Zu(e,o[o.length-1])||o.push(Ju(s)),1!==a.length&&Zu(e,a[0])||a.unshift(Ju(s))}p=r.source,l=r.target,t.canConnect(p,e,r)&&(n.reconnectEnd(r,e,o||d),c=r),t.canConnect(e,l,r)&&(c?u=n.connect(e,l,{type:r.type,waypoints:a}):(n.reconnectStart(r,e,a||d),u=r));var v=[].concat(c&&w(y,(function(e){return e.source===c.source}))||[],u&&w(f,(function(e){return e.target===u.target}))||[]);v.length&&n.removeElements(v)}Yo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a=fn(o),s={x:a.x+i.x,y:a.y+i.y},p=b(n.children,(function(e){return t.canInsert(r,e)&&Vs(e.waypoints,s)}));p&&(e.targetFlow=p,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 n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.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 Zu(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function Ju(e){return q({},e)}function Qu(e,t){Yo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.source,i=n.target,o=i.incoming.slice();n.hints&&!1===n.hints.createElementsBehavior||wi(r,"bpmn:EventBasedGateway")&&i.incoming.length&&o.filter(ed).forEach((function(e){t.removeConnection(e)}))})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;wi(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ed).map((function(e){return e.target})).reduce((function(e,t){var n=t.incoming.filter(ed);return e.concat(n)}),[]).forEach((function(e){e.source!==n&&t.removeConnection(e)}))}))}function ed(e){return wi(e,"bpmn:SequenceFlow")}Ku.$inject=["bpmnReplace","injector"],r(Ku,Yo),Ku.prototype.replaceShape=function(e){var t,n,r=(n=Ei(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},r(Yu,Yo),Yu.$inject=["eventBus","bpmnRules","modeling"],Qu.$inject=["eventBus","modeling"],r(Qu,Yo);var td=1500;function nd(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],td,(function(t){var r=t.context.shape||t.shape,i=t.hover;wi(i,"bpmn:Lane")&&!_i(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=xc(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||wi(r,"bpmn:Group"))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],td,(function(t){var n=t.hover;wi(n,"bpmn:Lane")&&(t.hover=xc(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],td,(function(t){var n=t.context,r=t.hover,i=n.type;wi(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=xc(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],td,(function(e){var t=e.context,n=t.start;wi(n,"bpmn:Lane")&&(t.start=xc(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;wi(t,"bpmn:Lane")&&(e.shape=xc(t)||t)}))}nd.$inject=["elementRegistry","eventBus","canvas"];function rd(e,t,n,r,i,o){function a(e){var n=Ei(e).categoryValueRef;if(n){var r=n.$parent;n&&(_t(r.categoryValue,n),r&&!r.categoryValue.length&&function(e){_t(t.getDefinitions().get("rootElements"),e)}(r))}}i.invoke(Yo,this),this.executed("shape.delete",(function(e){var t,r=e.context.shape;if(wi(r,"bpmn:Group")){var i=Ei(r).categoryValueRef,o=n.filter((function(e){return wi(e,"bpmn:Group")}));t=i,o.some((function(e){var n=Ei(e);return n.categoryValueRef&&n.categoryValueRef===t}))||a(r)}})),this.reverted("shape.delete",(function(e){var n=e.context.shape;if(wi(n,"bpmn:Group")){var r=Ei(n).categoryValueRef,i=t.getDefinitions(),o=r?r.$parent:null;Et(o.get("categoryValue"),r),Et(i.get("rootElements"),o)}})),this.execute("shape.create",(function(n){var r=Ei(n.context.shape);if(wi(r,"bpmn:Group")&&!r.categoryValueRef){var i=bu(t.getDefinitions(),e);r.categoryValueRef=i}})),this.revert("shape.create",(function(e){var t=e.context.shape;wi(t,"bpmn:Group")&&(a(t),delete Ei(t).categoryValueRef)})),r.on("moddleCopy.canCopyProperty",2e3,(function(n){var r,i=n.property;if(wi(i,"bpmn:CategoryValue"))return r=bu(t.getDefinitions(),e),o.copyElement(i,r)}))}function id(e,t,n,r){var i,o,a,s;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((r.x-n.x)*o-(r.y-n.y)*a)/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function od(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=id(e,t,n,i),s=id(e,t,n,o);r=a&&s?ad(a,n)>ad(s,n)?s:a:a||s,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],fn(n.source)),t(r[r.length-1],r[r.length-2],fn(n.target)))}))}function ad(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sd(e){Yo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Ei(n),i=Pi(n);_i(r,t)&&!i.get("isHorizontal")&&i.set("isHorizontal",!0)}))}function pd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ld(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function cd(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function ud(e,t){var n=cd(e,t);return pd({x:n.x-e.x,y:n.y-e.y})}function dd(e,t){return pd({x:e.x-t.x,y:e.y-t.y})}rd.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],r(rd,Yo),od.$inject=["eventBus"],sd.$inject=["eventBus"],r(sd,Yo);var hd=Math.sqrt,md=Math.min,fd=Math.max,yd=Math.abs;function gd(e){return Math.pow(e,2)}function vd(e,t){return hd(gd(e.x-t.x)+gd(e.y-t.y))}function bd(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,p=i*i+o*o,l=(i*a+o*s)/p,c=l*l-(a*a+s*s-r*r)/p;if(c<0&&c>-1e-6&&(c=0),c<0)return[];var u=hd(c),d=-l+u,h=-l-u,m={x:e.x-i*d,y:e.y-o*d};return 0===c?[m]:[m,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return xd(e.x,t.x,n.x)&&xd(e.y,t.y,n.y)}(n,e,t)}))}function xd(e,t,n){return e>=md(t,n)-wd&&e<=fd(t,n)+wd}var wd=.1;function _d(e,t){return yd(e.x-t.x)<=wd&&yd(e.y-t.y)<=wd}function Ed(e,t,n,r){var i=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=function(e,t){var n,r,i,o,a,s,p,l,c,u,d,h,m=0;for(m=0;m<t.length-1;m++){if(_d(n=t[m],r=t[m+1])?s=[n]:(i=vd(e,n),o=vd(e,r),s=bd(n,r,e,md(i,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(p={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:_d(n,s[0])?m:m+1}),2===s.length&&(d=s[0],h=s[1],p={type:"segment",position:a={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:m,relativeLocation:vd(n,a)/vd(n,r)}),l=vd(p.position,e),(!u||c>l)&&(u=p,c=l)}return u}(a,n),p=s.segmentIndex,l=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var a=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===a?s:i>=s?i+o<s?s:i+o:i}if(r.bendpointMove){var p,l=r.bendpointMove.insert,c=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=c&&(p=l?i+1:i-1),i<c&&(p=i,l&&"bendpoint"!==n.type&&c-1===i&&Pd(t,c)<n.relativeLocation&&p++),p)}return 0===o?i:r.connectionStart?0===i?0:null:r.connectionEnd&&i===e.length-2?t.length-2:null}(n,t,s,r);if(null===l)return{x:i,y:o};if(l<0||l>t.length-2)return{x:i,y:o};var c,u,d=Od(n,p),h=Od(t,l),m=s.position,f=function(e,t){var n=dd(e[0],e[1]),r=dd(e[0],t);return 0===n?0:r/n}(d,m),y=(c=h,u=ld(d),ld(c)-u);if("bendpoint"===s.type){var g=t.length-n.length,v=s.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return{x:i,y:o};if(0===g){var x=t[v];return{x:x.x-s.position.x,y:x.y-s.position.y}}g<0&&0!==v&&v<n.length-1&&(f=Pd(n,v))}var w,_,E=(h[1].x-h[0].x)*f+h[0].x,P=(h[1].y-h[0].y)*f+h[0].y,O=(w={x:a.x-m.x,y:a.y-m.y},(_=y)?{x:Math.cos(_)*w.x-Math.sin(_)*w.y,y:Math.sin(_)*w.x+Math.cos(_)*w.y}:w);return dn({x:i=E+O.x-a.x,y:o=P+O.y-a.y})}function Pd(e,t){var n=dd(e[t-1],e[t]);return n/(n+dd(e[t],e[t+1]))}function Od(e,t){return[e[t],e[t+1]]}function Sd(e,t,n){var r=Ia(t),i=Ia(n),o=La(e,r),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return dn({x:i.x+a,y:i.y+s})}function kd(e,t,n){var r=Ia(e),i=Ia(t),o=Ia(n),a=La(e,r),s=La(r,i),p=function(e,t,n){var r=hn(t),i=hn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,a,s=yn(t,e);if("top"===s)o={x:0,y:i.bottom-r.bottom};else if("bottom"===s)o={x:0,y:i.top-r.top};else if("right"===s)o={x:i.left-r.left,y:0};else{if("left"!==s)return null;o={x:i.right-r.right,y:0}}if(a={x:e.x+o.x,y:e.y+o.y},yn(n,a)!==s)return null;return o}(r,t,n);if(p)return p;var l=s.x*(n.width/t.width),c=s.y*(n.height/t.height),u=o.x+l,d=o.y+c;return dn({x:u+a.x-e.x,y:d+a.y-e.y})}var Cd={width:90,height:20},Td="name",Md="text";function Ad(e,t,n,r){Yo.call(this,e),this.postExecute("element.updateProperties",(function(e){var n=e.context,i=n.element,o=n.properties;if(Td in o&&t.updateLabel(i,o.name),Md in o&&wi(i,"bpmn:TextAnnotation")){var a=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o.text||"");t.updateLabel(i,o.text,a)}})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection,o=i.businessObject;if(!mo(i)&&lo(i)&&Vi(i)){var a=ho(i),s=r.getExternalLabelBounds(Cd,Vi(i));t.createLabel(i,a,{id:o.id+"_label",businessObject:o,width:s.width,height:s.height})}}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["label.create"],(function(e){var t,r=e.context,i=r.shape,o=r.labelTarget;o&&wi(o,"bpmn:BaseElement")&&((t=Pi(o)).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")}),i.di=t),q(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=function(e){var t=e.context,n=t.connection,r=n.label,i=q({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),Ed(r,o,a,i)}(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Ei(n);i&&lo(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,a=r.oldBounds;if(co(i)){var s=i.label,p=Rd(function(e,t){if(!t.length)return;var n=function(e,t){return z(t.map((function(t){return{line:t,distance:ud(e,t)}})),"distance")[0].line}(e,t);return cd(e,n)}(fn(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)}]]),a,o);t.moveShape(s,p)}}))}function Rd(e,t,n){return dn(La(Sd(e,t,n),e))}function Dd(e,t,n){var r=Id(e),i=Ld(r,t),o=r[0];return i.length?i[i.length-1]:Sd(o.original||o,n,t)}function zd(e,t,n){var r=Id(e),i=Ld(r,t),o=r[r.length-1];return i.length?i[0]:Sd(o.original||o,n,t)}function jd(e,t,n){var r=Id(e),i=Bd(t,n),o=r[0];return Sd(o.original||o,i,t)}function Nd(e,t,n){var r=Id(e),i=Bd(t,n),o=r[r.length-1];return Sd(o.original||o,i,t)}function Bd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Id(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Ld(e,t){return w(k(e,$d),(function(e){return function(e,t){return"intersect"===yn(t,e,1)}(e,t)}))}function $d(e){return e.original||e}function Fd(e,t){Yo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return wi(e,"bpmn:Participant")&&Bi(e)&&wi(t,"bpmn:Participant")&&!Bi(t)}(n,r)){var i,o,a,s,p=(o=ft([i=n],!1),a=[],s=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){wi(e,"bpmn:MessageFlow")&&a.push(e)})),e.outgoing.forEach((function(e){wi(e,"bpmn:MessageFlow")&&s.push(e)})))}),[]),{incoming:a,outgoing:s});p.incoming.forEach((function(e){var i=zd(e,r,n);t.reconnectEnd(e,r,i)})),p.outgoing.forEach((function(e){var i=Dd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}r(Ad,Yo),Ad.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],Fd.$inject=["eventBus","modeling"],r(Fd,Yo);function Vd(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,a=e.context,s=a.shape;wi(a.target,"bpmn:Collaboration")&&wi(s,"bpmn:FlowNode")&&(r=e,i=n("flow elements must be children of pools/participants"),t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:o||2e3,html:"<div>"+i+"</div>"}))}))}function Hd(e,t){Yo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Pi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function qd(e,t,n){Yo.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(wi(i,"bpmn:SequenceFlow")&&wi(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var a=function(e,t){var n=id(Ud(e[e.length-2]),Ud(e[e.length-1]),Ud(t[1]),Ud(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ud(e[0]),Ud(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,a)}}}))}function Ud(e){return e.original||e}function Gd(e,t){Yo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;wi(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function Wd(e,t,n,r){Yo.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,a=e.target;e.parent&&(wi(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(i=!0),n.canConnectMessageFlow(o,a)&&(r="bpmn:MessageFlow")),wi(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(i=!0),n.canConnectSequenceFlow(o,a)&&(r="bpmn:SequenceFlow")),wi(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(i=!0),i&&t.removeConnection(e),r&&t.connect(o,a,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){_(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,a=e.context,s=a.connection,p=a.newSource||s.source,l=a.newTarget||s.target;(r=n.canConnect(p,l))&&r.type!==s.type&&(o=t.connect(p,l,{type:r.type,waypoints:s.waypoints.slice()}),t.removeConnection(s),a.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(-1===(n=o.indexOf(e)))return;o.splice(n,1,t)}(s,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,a=o.businessObject;i.default&&(n=b(o.outgoing,j({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})}))}function Kd(e,t,n,r,i,o){r.invoke(Yo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=t.canReplace(i,r);o&&this.replaceElements(i,o.replacements)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];_(n.closure.topLevel,(function(e){o=Li(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var a=t.canReplace(o,r);a&&this.replaceElements(o,a.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,a=i.attachers;a&&a.length&&(n=t.canReplace(a,o),this.replaceElements(a,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Vd.$inject=["eventBus","tooltips","translate"],r(Hd,Yo),Hd.$inject=["eventBus","modeling"],r(qd,Yo),qd.$inject=["eventBus","bpmnRules","modeling"],Gd.$inject=["eventBus","modeling"],r(Gd,Yo),r(Wd,Yo),Wd.$inject=["eventBus","modeling","bpmnRules","injector"],r(Kd,Yo),Kd.prototype.replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;_(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),a=e.indexOf(o);e[a]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Kd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Xd=300,Yd=60,Zd={width:300,height:150},Jd={width:140,height:120},Qd={width:50,height:30};function eh(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=xc(e),i=!0,o=!0,a=vc(r,[r]),s=hn(e),p={},l={};/e/.test(t)?l.right=s.left+Xd:/w/.test(t)&&(l.left=s.right-Xd);return a.forEach((function(e){var r=hn(e);/n/.test(t)&&(r.top<s.top-10&&(i=!1),n&&th(s.top-r.bottom)<10&&ah(p,"top",r.top+Yd),th(s.top-r.top)<5&&oh(l,"top",r.bottom-Yd)),/s/.test(t)&&(r.bottom>s.bottom+10&&(o=!1),n&&th(s.bottom-r.top)<10&&oh(p,"bottom",r.bottom-Yd),th(s.bottom-r.bottom)<5&&ah(l,"bottom",r.top+Yd))})),r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Artifact"))})).forEach((function(e){var n=hn(e);i&&/n/.test(t)&&oh(l,"top",n.top-20),/e/.test(t)&&ah(l,"right",n.right+20),o&&/s/.test(t)&&ah(l,"bottom",n.bottom+20),/w/.test(t)&&oh(l,"left",n.left-50)})),{min:l,max:p}}(n,r,i)),wi(n,"bpmn:Participant")&&(t.minDimensions=Zd),wi(n,"bpmn:SubProcess")&&Bi(n)&&(t.minDimensions=Jd),wi(n,"bpmn:TextAnnotation")&&(t.minDimensions=Qd)}))}eh.$inject=["eventBus"];var th=Math.abs,nh=Math.min,rh=Math.max;function ih(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function oh(e,t,n){return ih(e,t,n,nh)}function ah(e,t,n){return ih(e,t,n,rh)}function sh(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.balanced=!So(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(wi(r,"bpmn:Lane")||wi(r,"bpmn:Participant"))return i&&(o=un(o),t.resizeLane(r,o,n.balanced)),!1}))}sh.$inject=["eventBus","modeling"];function ph(e,t,n,r,i){function o(e){return _i(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){d(t)||(t=[t]);return S(t,(function(t){return $i(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(t){return!!b(e.getDefinitions().get("rootElements"),j({id:t.id}))}function s(e){return wi(e,"bpmn:ErrorEventDefinition")?"errorRef":wi(e,"bpmn:EscalationEventDefinition")?"escalationRef":wi(e,"bpmn:MessageEventDefinition")?"messageRef":wi(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function p(e){if(_i(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(s(t))}n.invoke(Yo,this),this.executed("shape.create",(function(t){var n=t.shape;if(o(n)){var r=p(Ei(n));r&&!a(r)&&(Et(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted("shape.create",(function(t){var n=t.addedRootElement;n&&_t(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(o(n)){var r=p(Ei(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject;if(o(n)){var p=t.referencedRootElement;p&&(a(p)||(p=r.copyElement(p,i.create(p.$type))),function(e,t){if(_i(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(s(n),t)}(n,p))}}))}ph.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],r(ph,Yo);var lh=Math.max;function ch(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return _(t,(function(e){var t=e.id;wi(e,"bpmn:Participant")&&(!function(e){return"x"===e}(n)?i[t]={width:Zd.width,height:uh(e,r)}:i[t]=Zd),wi(e,"bpmn:SubProcess")&&Bi(e)&&(i[t]=Jd),wi(e,"bpmn:TextAnnotation")&&(i[t]=Qd)})),i}))}function uh(e,t){var n;return bc(e).length?(n=function(e,t){var n,r=bc(e);return n=dh(r,t),e.height-n.height+Yd}(e,t),lh(Zd.height,n)):Zd.height}function dh(e,t){var n,r,i;for(n=0;n<e.length;n++)if(t>=(r=e[n]).y&&t<=r.y+r.height)return(i=bc(r)).length?dh(i,t):r}ch.$inject=["eventBus"];var hh=180,mh=160;function fh(e,t,n,r,i,o,a){Yo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=a;var s=this;function p(e){return wi(e,"bpmn:SubProcess")&&!Bi(e)}function l(t){var n=t.shape,r=t.newRootElement,i=Ei(n);r=s._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function c(t){var n=Ei(t.shape);s._removeDiagram(n);var r=t.newRootElement=a.get(ia(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){p(e.shape)&&l(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(s._showRecursively(t.children),s._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){p(e.shape)&&c(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(p(t)){var r=a.get(ia(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){p(e.shape)&&c(e)}),!0),this.reverted("shape.delete",(function(e){p(e.shape)&&l(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;p(n)&&p(r)&&(t.oldRoot=e.removeRootElement(ia(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(ia(r));if(i&&o){var a=i.children;n.moveElements(a,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(wi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(aa(t))return a.updateId(t,oa(i)),void a.updateId(r,i);a.get(oa(r))&&a.updateId(oa(r),oa(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(wi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(aa(t))return a.updateId(t,oa(r)),void a.updateId(i,r);var o=a.get(oa(i));o&&a.updateId(o,oa(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(aa(n)){var r=n,i=a.get(ra(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;wi(t,"bpmn:SubProcess")&&(Bi(t)?c(e):(l(e),s._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;wi(t,"bpmn:SubProcess")&&(Bi(t)?c(e):(l(e),s._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(wi(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Bi(t)?s._moveChildrenToShape(n,t):s._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(p(t)){var r=ia(t),i=a.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(wi(Pi(i),"bpmndi:BPMNPlane")){var o=ra(i),a=b(r,(function(e){return e.id===o}));a&&(t.parent=a.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(p(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function yh(e,t){e.invoke(Yo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(wi(r,"bpmn:SubProcess")&&wi(n,"bpmn:Task")&&Bi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function gh(e,t){Yo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Bi(n)){var r=ft(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();_(t,(function(e){i(e,!0)})),_(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,fn(n)):t.reconnectStart(e,n,fn(n)))}}),!0)}r(fh,Yo),fh.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=i.filter((function(e){return!e.hidden}));if(o.length){var a=yt(o);if(t.x){var s=fn(t),p=fn(a);n={x:s.x-p.x,y:s.y-p.y}}else n={x:hh-a.x,y:mh-a.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},fh.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},fh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},fh.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:ia(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},fh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=b(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},fh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],yh.$inject=["injector","modeling"],r(yh,Yo),r(gh,Yo),gh.$inject=["eventBus","modeling"];function vh(e,t,n,r){Yo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;wi(n,"bpmn:SubProcess")&&(n.collapsed?Pi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Pi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Pi(t).isExpanded=!1:Pi(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i=e.children,o=t;return(n=mc((r=i,r.filter((function(e){return!e.hidden}))).concat([e])))?(o.width=Math.max(n.width,o.width),o.height=Math.max(n.height,o.height),o.x=n.x+(n.width-o.width)/2,o.y=n.y+(n.height-o.height)/2):(o.x=e.x+(e.width-o.width)/2,o.y=e.y+(e.height-o.height)/2),o}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function bh(e,t,n,r){t.invoke(Yo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;mo(t)||(wi(t,"bpmn:Participant")&&Bi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;wi(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function xh(e,t){Yo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!wi(e,"bpmn:SequenceFlow"))return!1;var n=Ei(t),r=Ei(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}r(vh,Yo),vh.$inject=["eventBus","elementFactory","modeling"],r(bh,Yo),bh.$inject=["canvas","injector","moddle","modeling"],r(xh,Yo),xh.$inject=["eventBus","modeling"];function wh(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}Yo.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,5e3,(function(e){(r=r||new _h).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!r)throw new Error(n("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=i();t.labelTarget||(wi(t,"bpmn:Lane")&&n.addLane(t),wi(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function _h(){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}}wh.$inject=["eventBus","modeling","translate"],r(wh,Yo);var Eh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","messageFlowBehavior","modelingFeedback","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Tu],appendBehavior:["type",Au],associationBehavior:["type",Ru],attachEventBehavior:["type",Du],boundaryEventBehavior:["type",ju],createBehavior:["type",Nu],createDataObjectBehavior:["type",Bu],createParticipantBehavior:["type",Fu],dataInputAssociationBehavior:["type",Hu],dataStoreBehavior:["type",Gu],deleteLaneBehavior:["type",Wu],detachEventBehavior:["type",Ku],dropOnFlowBehavior:["type",Yu],eventBasedGatewayBehavior:["type",Qu],fixHoverBehavior:["type",nd],groupBehavior:["type",rd],importDockingFix:["type",od],isHorizontalFix:["type",sd],labelBehavior:["type",Ad],messageFlowBehavior:["type",Fd],modelingFeedback:["type",Vd],removeElementBehavior:["type",qd],removeEmbeddedLabelBoundsBehavior:["type",Hd],removeParticipantBehavior:["type",Gd],replaceConnectionBehavior:["type",Wd],replaceElementBehaviour:["type",Kd],resizeBehavior:["type",eh],resizeLaneBehavior:["type",sh],rootElementReferenceBehavior:["type",ph],spaceToolBehavior:["type",ch],subProcessPlaneBehavior:["type",fh],subProcessStartEventBehavior:["type",yh],toggleCollapseConnectionBehaviour:["type",gh],toggleElementCollapseBehaviour:["type",vh],unclaimIdBehavior:["type",bh],unsetDefaultFlowBehavior:["type",xh],updateFlowNodeRefsBehavior:["type",wh]};function Ph(e,t){var n=yn(e,t,-15);return"intersect"!==n?n:null}function Oh(e){Ps.call(this,e)}function Sh(e){return!e||mo(e)}function kh(e){do{if(wi(e,"bpmn:Process"))return Ei(e);if(wi(e,"bpmn:Participant"))return Ei(e).processRef||Ei(e)}while(e=e.parent)}function Ch(e){return wi(e,"bpmn:TextAnnotation")}function Th(e){return wi(e,"bpmn:Group")&&!e.labelTarget}function Mh(e){return wi(e,"bpmn:BoundaryEvent")&&Dh(e,"bpmn:CompensateEventDefinition")}function Ah(e){return Ei(e).isForCompensation}function Rh(e){for(var t=e;t=t.parent;){if(wi(t,"bpmn:FlowElementsContainer"))return Ei(t);if(wi(t,"bpmn:Participant"))return Ei(t).processRef}return null}function Dh(e,t){return!!b(Ei(e).eventDefinitions||[],(function(e){return wi(e,t)}))}function zh(e,t){return(Ei(e).eventDefinitions||[]).every((function(e){return wi(e,t)}))}function jh(e){return wi(e,"bpmn:ReceiveTask")||wi(e,"bpmn:IntermediateCatchEvent")&&(Dh(e,"bpmn:MessageEventDefinition")||Dh(e,"bpmn:TimerEventDefinition")||Dh(e,"bpmn:ConditionalEventDefinition")||Dh(e,"bpmn:SignalEventDefinition"))}function Nh(e){return e.waypoints}function Bh(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(Sh(e)||Sh(t))return null;if(!wi(n,"bpmn:DataAssociation")){if(Zh(e,t))return{type:"bpmn:MessageFlow"};if(Jh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Qh(e,t);return r||(Mh(e)&&Ah(t)?{type:"bpmn:Association",associationDirection:"One"}:!!Yh(e,t)&&{type:"bpmn:Association"})}function Lh(e,t,n){return!(!mo(e)&&!Th(e))||!(wi(t,"bpmn:Participant")&&!Bi(t))&&(wi(e,"bpmn:Participant")?wi(t,"bpmn:Process")||wi(t,"bpmn:Collaboration"):_i(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:wi(e,"bpmn:Lane")?wi(t,"bpmn:Participant")||wi(t,"bpmn:Lane"):!(wi(e,"bpmn:BoundaryEvent")&&(r=e,!Ei(r).cancelActivity||!Vh(r)&&!Hh(r)))&&(wi(e,"bpmn:FlowElement")&&!wi(e,"bpmn:DataStoreReference")?wi(t,"bpmn:FlowElementsContainer")?Bi(t):_i(t,["bpmn:Participant","bpmn:Lane"]):wi(e,"bpmn:DataStoreReference")&&wi(t,"bpmn:Collaboration")?S(Ei(t).get("participants"),(function(e){return!!e.get("processRef")})):_i(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?_i(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!wi(e,"bpmn:MessageFlow")&&(wi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var r}function $h(e){return wi(e,"bpmn:Lane")}function Fh(e){return!!function(e){return!mo(e)&&wi(e,"bpmn:BoundaryEvent")}(e)||(!(!wi(e,"bpmn:IntermediateThrowEvent")||!Vh(e))||wi(e,"bpmn:IntermediateCatchEvent")&&Hh(e))}function Vh(e){var t=Ei(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Hh(e){return qh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function qh(e,t){return t.some((function(t){return Dh(e,t)}))}function Uh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!mo(i)&&(!!Fh(i)&&(!Li(t)&&(!(!wi(t,"bpmn:Activity")||Ah(t))&&(!(r&&!Ph(r,t))&&(!function(e){return wi(e,"bpmn:ReceiveTask")&&b(e.incoming,(function(e){return wi(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Gh(e,t,n){if(!t)return!1;var r={replacements:[]};return _(e,(function(e){Li(t)||wi(e,"bpmn:StartEvent")&&"label"!==e.type&&Lh(e,t)&&(Ii(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return $i(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return $i(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return $i(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),qh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&wi(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),wi(t,"bpmn:Transaction")||Dh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(wi(e,"bpmn:EndEvent")&&Lh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),wi(e,"bpmn:BoundaryEvent")&&Uh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Wh(e,t){return!S(e,$h)&&(!t||e.every((function(e){return Lh(e,t)})))}function Kh(e,t,n,r){return!!t&&(!(!mo(e)&&!Th(e))||!function(e,t){return e===t}(n,t)&&((!n||!Bh(n,t))&&(Lh(e,t)||em(e,t))))}function Xh(e,t){return wi(e,"bpmn:SubProcess")?Bi(e)&&(!t||t.width>=100&&t.height>=80):wi(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:wi(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!Ch(e)||!!Th(e)}function Yh(e,t){return!Nh(e)&&!Nh(t)&&(!(!Mh(e)||!Ah(t))||!Bh(t,e)&&!Bh(e,t)&&(!!function(e,t){var n=Ch(e),r=Ch(t);return(n||r)&&n!==r}(e,t)||!!Qh(e,t)))}function Zh(e,t){return!(rm(e)&&!rm(t))&&(wi(n=e,"bpmn:InteractionNode")&&!wi(n,"bpmn:BoundaryEvent")&&(!wi(n,"bpmn:Event")||wi(n,"bpmn:ThrowEvent")&&zh(n,"bpmn:MessageEventDefinition"))&&function(e){return wi(e,"bpmn:InteractionNode")&&!Ah(e)&&(!wi(e,"bpmn:Event")||wi(e,"bpmn:CatchEvent")&&zh(e,"bpmn:MessageEventDefinition"))&&!(wi(e,"bpmn:BoundaryEvent")&&!Dh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Jh(e,t){return!(jh(t)&&t.incoming.length>0&&(n=t.incoming,(n=n||[]).some(nm))&&!wi(e,"bpmn:EventBasedGateway"))&&(wi(r=e,"bpmn:FlowNode")&&!wi(r,"bpmn:EndEvent")&&!Li(r)&&!(wi(r,"bpmn:IntermediateThrowEvent")&&Dh(r,"bpmn:LinkEventDefinition"))&&!Mh(r)&&!Ah(r)&&function(e){return wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:StartEvent")&&!wi(e,"bpmn:BoundaryEvent")&&!Li(e)&&!(wi(e,"bpmn:IntermediateCatchEvent")&&Dh(e,"bpmn:LinkEventDefinition"))&&!Ah(e)}(t)&&function(e,t){return Rh(e)===Rh(t)}(e,t)&&!(wi(e,"bpmn:EventBasedGateway")&&!jh(t)));var n,r}function Qh(e,t){return _i(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&_i(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!_i(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!_i(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function em(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&&(_i(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mo(t)&&wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:BoundaryEvent")&&Lh(e,t.parent))}function tm(e,t){return!!mo(t)||!(wi(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function nm(e){if(e&&e.source)return wi(e.source,"bpmn:EventBasedGateway")}function rm(e){return gs(e,"bpmn:Process")||gs(e,"bpmn:Collaboration")}r(Oh,Ps),Oh.$inject=["eventBus"],Oh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Sh(e))return null;return _i(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Ih(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Ih(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Xh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(Nh(r)&&!em(t,r))&&O(t,(function(e){return Nh(e)?Ih(e.source,e.target,e):e.host?Uh(e,e.host,null,n):Kh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Uh(n,t,null,r)||Gh(n,t,r)||Wh(n,t)||em(n,t)})),this.addRule("shape.create",(function(e){return Kh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Uh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return tm(e.elements,t)}))},Oh.prototype.canConnectMessageFlow=Zh,Oh.prototype.canConnectSequenceFlow=Jh,Oh.prototype.canConnectDataAssociation=Qh,Oh.prototype.canConnectAssociation=Yh,Oh.prototype.canMove=Wh,Oh.prototype.canAttach=Uh,Oh.prototype.canReplace=Gh,Oh.prototype.canDrop=Lh,Oh.prototype.canInsert=em,Oh.prototype.canCreate=Kh,Oh.prototype.canConnect=Ih,Oh.prototype.canResize=Xh,Oh.prototype.canCopy=tm;var im={__depends__:[Ls],__init__:["bpmnRules"],bpmnRules:["type",Oh]};function om(e,t){e.on("saveXML.start",2e3,(function(){_(t.getRootElements(),(function(e){var t,n=Pi(e);t=k(w(ft([e],!1),(function(t){return t!==e&&!t.labelTarget})),Pi),n.set("planeElement",t)}))}))}om.$inject=["eventBus","canvas"];var am={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",om]};function sm(e){Yo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function pm(e,t,n){sm.call(this,e);var r=[{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:FlowElementsContainer"]}},{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:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=b(r,(function(t){return _i(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error("no order for <"+e.id+">");return t}this.getOrdering=function(e,n){if(e.labelTarget)return{parent:t.findRoot(e.labelTarget)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!_i(r,n);)r=r.parent;if(!r)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return r}(e,n,r.containers));var o=n.children.indexOf(e),a=x(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}sm.prototype.getOrdering=function(e,t){return null},r(sm,Yo),pm.$inject=["eventBus","canvas","translate"],r(pm,sm);var lm={__depends__:[so],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",pm]};function cm(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}cm.$inject=["eventBus","injector"],cm.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},cm.prototype.canExecute=function(e,t){var n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},cm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},cm.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},cm.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},cm.prototype.register=function(e,t){this._setHandler(e,t)},cm.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)},cm.prototype.canUndo=function(){return!!this._getUndoAction()},cm.prototype.canRedo=function(){return!!this._getRedoAction()},cm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},cm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},cm.prototype._internalUndo=function(e){var t=this,n=e.command,r=e.context,i=this._getHandler(n);this._atomicDo((function(){t._fire(n,"revert",e),i.revert&&t._markDirty(i.revert(r)),t._revertedAction(e),t._fire(n,"reverted",e)}))},cm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var r,i,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),r=0;(i=a[r])&&(o=this._eventBus.fire("commandStack."+i,n),!n.cancelBubble);r++);return o},cm.prototype._createId=function(){return this._uid++},cm.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},cm.prototype._internalExecute=function(e,t){var n=this,r=e.command,i=e.context,o=this._getHandler(r);if(!o)throw new Error("no command handler registered for <"+r+">");this._pushAction(e),t||(this._fire(r,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(r,"preExecuted",e)),this._atomicDo((function(){n._fire(r,"execute",e),o.execute&&n._markDirty(o.execute(i)),n._executedAction(e,t),n._fire(r,"executed",e)})),t||(this._fire(r,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(r,"postExecuted",e)),this._popAction(e)},cm.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},cm.prototype._popAction=function(){var e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:R("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},cm.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=d(e)?e:[e],t.dirty=t.dirty.concat(e))},cm.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},cm.prototype._revertedAction=function(e){this._stackIdx--},cm.prototype._getHandler=function(e){return this._handlerMap[e]},cm.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 um={commandStack:["type",cm]},dm=new Fo("tt");function hm(e,t){e.style.display=!1===t?"none":""}var mm=".djs-tooltip";function fm(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=dm,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),r=fe('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(r,n.firstChild),r);var i=this;me.bind(this._tooltipRoot,mm,"mousedown",(function(e){e.stopPropagation()})),me.bind(this._tooltipRoot,mm,"mouseover",(function(e){i.trigger("mouseover",e)})),me.bind(this._tooltipRoot,mm,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}fm.$inject=["eventBus","canvas"],fm.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=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},fm.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Y(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},fm.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},fm.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},fm.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},fm.prototype.remove=function(e){var t=this.get(e);t&&(xe(t.html),xe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},fm.prototype.show=function(){hm(this._tooltipRoot)},fm.prototype.hide=function(){hm(this._tooltipRoot,!1)},fm.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},fm.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),y(r)&&(r=fe(r)),(t=fe('<div data-tooltip-id="'+n+'" class="'+'djs-tooltip" style="position: absolute">')).appendChild(r),e.type&&te(t).add("djs-tooltip-"+e.type),e.className&&te(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},fm.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){q(e.style,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},fm.prototype._updateTooltipVisibilty=function(e){_(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),hm(r,i))}))},fm.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",(function(t){e.hide()})),this._eventBus.on("canvas.viewbox.changed",(function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}))};var ym={__init__:["tooltips"],tooltips:["type",fm]};function gm(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 vm(e,t,n){Yo.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=bm(n),t.validatedShapes=bm(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];_(n,(function(e){_(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),_(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];_(n,(function(e){_(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;gm((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,r=n.labelTarget;r&&(t.labelTargetIndex=Pt(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Et(r.labels,n,i),n.labelTarget=r)}))}function bm(e){return w(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}r(vm,Yo),vm.$inject=["injector","eventBus","modeling"];var xm={__init__:["labelSupport"],labelSupport:["type",vm]},wm="attach-ok";function _m(e,t,n,r,i){Yo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=Em(t=i),D("id",t,n)),r.validatedShapes=function(e){var t=A(e,"id");return w(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;_(Em(t.shapes),(function(e){o.makeDraggable(t,e,!0),_(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,wm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,wm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;_(Em(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,r=t.newHost;r&&1!==n.length||_(r?n:w(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){_(e.context.shapes,(function(e){_(e.attachers,(function(e){_(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),_(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;gm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&_(o.attachers,(function(e){var t=kd(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;!1!==(t.hints||{}).attachSupport&&_(a,(function(e){var t=kd(e,r,o);i.moveShape(e,t,e.parent),_(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;gm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function Em(e){return a(k(e,(function(e){return e.attachers||[]})))}r(_m,Yo),_m.$inject=["injector","eventBus","canvas","rules","modeling"];var Pm={__depends__:[Ls],__init__:["attachSupport"],attachSupport:["type",_m]};function Om(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Om.$inject=["eventBus","dragging"],Om.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)},Om.prototype.isActive=function(e){return e&&this._active===e},Om.prototype.length=function(e){return this._tools.length},Om.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Om.prototype.bindEvents=function(e,t){var n=this._eventBus,r=this._dragging,i=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void r.cancel();this.setActive(e)}),this),_(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&se(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Sm={__depends__:[zs],__init__:["toolManager"],toolManager:["type",Om]};function km(e,t){return-1!==e.indexOf(t)}var Cm=Math.abs,Tm=Math.round,Mm={x:"width",y:"height"},Am="crosshair",Rm={n:"top",w:"left",s:"bottom",e:"right"},Dm={n:"s",w:"e",s:"n",e:"w"};function zm(e,t,n,r,i,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){s.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",1500,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=s.init(e,t)),n&&Nm(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,a=t.resizingShapes,p=t.start;if(t.initialized){Nm(e);var l={x:0,y:0};l[r]=Tm(e["d"+r]),s.makeSpace(o,a,l,i,p),n.once("spaceTool.ended",(function(e){s.activateSelection(e.originalEvent,!0,!0)}))}}))}function jm(e){return{top:e.top-20,right:e.right+20,bottom:e.bottom+20,left:e.left-20}}function Nm(e){var t,n,r=e.context.spaceToolConstraints;r&&(m(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),m(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),m(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),m(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Bm(e,t){return-1!==e.indexOf(t)}function Im(e){return!!e.waypoints}function Lm(e){return!!e.labelTarget}zm.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],zm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Am,data:{context:{reactivate:n}},trapClick:!1})},zm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Am,data:{context:{}}})},zm.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},zm.prototype.init=function(e,t){var n=Cm(e.dx)>Cm(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Cm(r)<5)return!1;r<0&&(r*=-1),So(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),a=ft(this._canvas.getRootElement(),!0),s=this.calculateAdjustments(a,n,r,i);return q(t,s,{axis:n,direction:o,spaceToolConstraints:function(e,t,n,r,i){var o=e.movingShapes,a=e.resizingShapes;if(!a.length)return;var s,p,l={};return _(a,(function(e){var c,u,d,h=hn(e),f=w(e.children,(function(e){return!(Im(e)||Lm(e)||Bm(o,e)||Bm(a,e))})),y=w(e.children,(function(e){return!Im(e)&&!Lm(e)&&Bm(o,e)}));f.length&&(u=jm(hn(yt(f))),c=r-h[Rm[n]]+u[Rm[n]],"n"===n?l.bottom=p=m(p)?Math.min(p,c):c:"w"===n?l.right=p=m(p)?Math.min(p,c):c:"s"===n?l.top=s=m(s)?Math.max(s,c):c:"e"===n&&(l.left=s=m(s)?Math.max(s,c):c)),y.length&&(d=jm(hn(yt(y))),c=r-d[Rm[Dm[n]]]+h[Rm[Dm[n]]],"n"===n?l.bottom=p=m(p)?Math.min(p,c):c:"w"===n?l.right=p=m(p)?Math.min(p,c):c:"s"===n?l.top=s=m(s)?Math.max(s,c):c:"e"===n&&(l.left=s=m(s)?Math.max(s,c):c));var g=i&&i[e.id];g&&("n"===n?(c=r+e[Mm[t]]-g[Mm[t]],l.bottom=p=m(p)?Math.min(p,c):c):"w"===n?(c=r+e[Mm[t]]-g[Mm[t]],l.right=p=m(p)?Math.min(p,c):c):"s"===n?(c=r-e[Mm[t]]+g[Mm[t]],l.top=s=m(s)?Math.max(s,c):c):"e"===n&&(c=r-e[Mm[t]]+g[Mm[t]],l.left=s=m(s)?Math.max(s,c):c))})),l}(s,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:s.resizingShapes,start:i})),start:i}),ja("resize-"+("x"===n?"ew":"ns")),!0},zm.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],a=[];return _(e,(function(e){if(e.parent&&!Im(e)){var s=e[t],p=s+e[Mm[t]];return n>0&&s>r||n<0&&p<r?o.push(e):s<r&&p>r&&i.allowed("shape.resize",{shape:e})?a.push(e):void 0}})),{movingShapes:o,resizingShapes:a}},zm.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},zm.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var $m="djs-dragging",Fm="djs-resizing",Vm=Math.max;function Hm(e,t,n,r,i){function o(e,t){_(e,(function(e){i.addDragger(e,t),n.addMarker(e,$m)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=Ie("g");Oe(s,r.cls("djs-crosshair-group",["no-events"])),_e(t,s);var p=Ie("path");Oe(p,"d",o),Me(p).add("djs-crosshair"),_e(s,p);var l=Ie("path");Oe(l,"d",a),Me(l).add("djs-crosshair"),_e(s,l),i.crosshairGroup=s})),e.on("spaceTool.selection.move",(function(e){Kn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Re(t)})),e.on("spaceTool.move",250,(function(e){var a=e.context,s=a.line,p=a.axis,l=a.movingShapes,c=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");Oe(s=Ie("path"),"d","M0,0 L0,0"),Me(s).add("djs-crosshair"),_e(u,s),a.line=s;var d=Ie("g");Oe(d,r.cls("djs-drag-group",["no-events"])),_e(n.getActiveLayer(),d),o(l,d),o(a.movingConnections=t.filter((function(e){var t=!1;_(l,(function(n){_(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;_(l,(function(t){_(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;_(c,(function(t){_(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return _(c,(function(t){_(t.incoming,(function(t){e===t&&(i=!0)}))})),function(e){return e.waypoints}(e)&&(t||r)&&(n||i)})),d),a.dragGroup=d}if(!a.frameGroup){var h=Ie("g");Oe(h,r.cls("djs-frame-group",["no-events"])),_e(n.getActiveLayer(),h);var m=[];_(c,(function(e){var t=i.addFrame(e,h),r=t.getBBox();m.push({element:t,initialBounds:r}),n.addMarker(e,Fm)})),a.frameGroup=h,a.frames=m}Oe(s,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[p]});var f={x:e.dx,y:e.dy};f[{x:"y",y:"x"}[a.axis]]=0,Kn(a.dragGroup,f.x,f.y),_(a.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===a.direction?Oe(r,{width:Vm(i.width+f.x,5)}):Oe(r,{width:t=Vm(i.width-f.x,5),x:i.x+i.width-t}),"s"===a.direction?Oe(r,{height:Vm(i.height+f.y,5)}):Oe(r,{height:n=Vm(i.height-f.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,p=t.frameGroup;_(r,(function(e){n.removeMarker(e,$m)})),_(i,(function(e){n.removeMarker(e,$m)})),s&&(Re(a),Re(s)),_(o,(function(e){n.removeMarker(e,Fm)})),p&&Re(p)}))}Hm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var qm={__init__:["spaceToolPreview"],__depends__:[zs,Ls,Sm,rl,_l],spaceTool:["type",zm],spaceToolPreview:["type",Hm]};function Um(e){this._model=e}function Gm(e,t,n,r){Yo.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){_(e.context.oldRoot.children,(function(e){wi(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function a(e){var t=e.context.shape;wi(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function p(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.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"],Wm((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Wm((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Wm((function(e){"label"!==e.context.shape.type&&a(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],Wm((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.reconnect"],Wm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Wm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Wm(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Wm(p)),this.executed("connection.reconnect",Wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ei(n),a=Ei(r),s=Ei(i);o.conditionExpression&&!_i(s,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&a.default===o&&(t.oldDefault=a.default,delete a.default)}))),this.reverted("connection.reconnect",Wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ei(n),a=Ei(r),s=Ei(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(a.default=t.oldDefault,delete s.default)}))),this.executed(["element.updateAttachment"],Wm(l)),this.reverted(["element.updateAttachment"],Wm(l))}function Wm(e){return function(t){var n=t.context;wi(n.shape||n.connection,"bpmn:BaseElement")&&e(t)}}function Km(e,t,n){Vn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Xm(e,t,n){e[n]=t[n],delete t[n]}function Ym(e,t){this._modeling=e,this._canvas=t}function Zm(e){this._modeling=e}function Jm(e,t){this._canvas=e,this._layouter=t}Um.$inject=["moddle"],Um.prototype._needsId=function(e){return _i(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"])},Um.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=wi(e,"bpmn:Activity")?"Activity":wi(e,"bpmn:Event")?"Event":wi(e,"bpmn:Gateway")?"Gateway":_i(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},Um.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Um.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Um.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Um.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Um.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},Um.prototype.createDiWaypoint=function(e){return this.create("dc:Point",W(e,["x","y"]))},Um.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Um.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))},r(Gm,Yo),Gm.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Gm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},Gm.prototype.updateParent=function(e,t){if(!(e instanceof Ln||wi(e,"bpmn:DataStoreReference")&&e.parent&&wi(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Pi(e),o=n&&n.businessObject,a=Pi(n);wi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),wi(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),wi(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),wi(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,a)}},Gm.prototype.updateBounds=function(e){var t=Pi(e),n=function(e){if(!wi(e,"bpmn:Activity"))return;var t=Pi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=La(n,t.get("bounds"));q(n,{x:e.x+r.x,y:e.y+r.y})}var i=e instanceof Ln?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),q(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Gm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(wi(n,"bpmn:Lane")&&_t(n.get("flowNodeRef"),e),wi(t,"bpmn:Lane")&&Et(t.get("flowNodeRef"),e))},Gm.prototype.updateDiConnection=function(e,t,n){var r=Pi(e),i=Pi(t),o=Pi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Ei(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Ei(n)&&(r.targetElement=n&&o)},Gm.prototype.updateDiParent=function(e,t){if(t&&!wi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(_t(n,e),e.$parent=null)}},Gm.prototype.getLaneSet=function(e){var t,n;return wi(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(wi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},Gm.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!wi(e,"bpmn:DataInput")&&!wi(e,"bpmn:DataOutput")||(wi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(wi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(wi(e,"bpmn:FlowElement")){if(t)if(wi(t,"bpmn:Participant"))t=t.processRef;else if(wi(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(wi(t,"bpmn:Lane"));r="flowElements"}else if(wi(e,"bpmn:Artifact")){for(;t&&!wi(t,"bpmn:Process")&&!wi(t,"bpmn:SubProcess")&&!wi(t,"bpmn:Collaboration");){if(wi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(wi(e,"bpmn:MessageFlow"))r="messageFlows";else if(wi(e,"bpmn:Participant")){r="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!wi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(_t(o.get("rootElements"),a),a.$parent=null),t&&(Et(o.get("rootElements"),a),a.$parent=o))}else wi(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":wi(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&_t(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var p=n.get(r);_t(s,e),t&&(p||(p=[],t.set(r,p)),p.push(e))}}},Gm.prototype.updateConnectionWaypoints=function(e){Pi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Gm.prototype.updateConnection=function(e){var t,n=e.connection,r=Ei(n),i=n.source,o=Ei(i),a=n.target,s=Ei(n.target);if(wi(r,"bpmn:DataAssociation"))wi(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||s,this.updateSemanticParent(r,s,t)):wi(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=s);else{var p=wi(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(p&&(_t(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==s&&(p&&(_t(r.targetRef&&r.targetRef.get("incoming"),r),s&&s.get("incoming")&&s.get("incoming").push(r)),r.targetRef=s)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,a)},Gm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},r(Km,Vn),Km.$inject=["bpmnFactory","moddle","translate"],Km.prototype.baseCreate=Vn.prototype.create,Km.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this.baseCreate(e,q({type:"label",di:n},po,t))}return this.createBpmnElement(e,t)},Km.prototype.createBpmnElement=function(e,t){var n,r,i,o=this._translate,a=(t=t||{}).businessObject,s=t.di;if(!a){if(!t.type)throw new Error(o("no shape type specified"));vi(a=this._bpmnFactory.create(t.type))}if(!_i(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var p=q(s||{},{id:a.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(a,p):"connection"===e?this._bpmnFactory.createDiEdge(a,p):this._bpmnFactory.createDiShape(a,p)}return wi(a,"bpmn:Group")&&(t=q({isFrame:!0},t)),function(e,t,n){_(n,(function(n){void 0!==t[n]&&Xm(e,t,n)}))}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&Xm(s,t,"isExpanded"),wi(a,"bpmn:SubProcess")&&(t.collapsed=!Bi(a,s)),wi(a,"bpmn:ExclusiveGateway")&&(s.isMarkerVisible=!0),t.eventDefinitionType&&(r=a.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=a,a.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(a,s),t=q({id:a.id},n,t,{businessObject:a,di:s}),this.baseCreate(e,t)},Km.prototype.getDefaultSize=function(e,t){var n=Ei(e);return t=t||Pi(e),wi(n,"bpmn:SubProcess")?Bi(n,t)?{width:350,height:200}:{width:100,height:80}:wi(n,"bpmn:Task")?{width:100,height:80}:wi(n,"bpmn:Gateway")?{width:50,height:50}:wi(n,"bpmn:Event")?{width:36,height:36}:wi(n,"bpmn:Participant")?Bi(n,t)?{width:600,height:250}:{width:400,height:60}:wi(n,"bpmn:Lane")?{width:400,height:100}:wi(n,"bpmn:DataObjectReference")?{width:36,height:50}:wi(n,"bpmn:DataStoreReference")?{width:50,height:50}:wi(n,"bpmn:TextAnnotation")?{width:100,height:30}:wi(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Km.prototype.createParticipantShape=function(e){return h(e)||(e={isExpanded:e}),!1!==(e=q({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Ym.$inject=["modeling","canvas"],Ym.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;_(n,(function(e){var n={x:0,y:0};r.left?n.x=r.left-e.x:r.right?n.x=r.right-e.width-e.x:r.center?n.x=r.center-Math.round(e.width/2)-e.x:r.top?n.y=r.top-e.y:r.bottom?n.y=r.bottom-e.height-e.y:r.middle&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},Ym.prototype.postExecute=function(e){},Zm.$inject=["modeling"],Zm.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},Zm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,S(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Jm.$inject=["canvas","layouter"],Jm.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,a=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,i,o),t},Jm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Qm=Math.round;function ef(e){this._modeling=e}function tf(e){return!!e.waypoints}ef.$inject=["modeling"],ef.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,a=this._modeling;_(t,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var s=yt(w(t,(function(e){return!e.hidden})));_(t,(function(e){tf(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:Qm(e.x-s.x-s.width/2+i.x),y:Qm(e.y-s.y-s.height/2+i.y)}}))),q(e,{x:Qm(e.x-s.x-s.width/2+i.x),y:Qm(e.y-s.y-s.height/2+i.y)})}));var p=ut(t),l={};_(t,(function(e){if(tf(e))l[e.id]=m(r)?a.createConnection(l[e.source.id],l[e.target.id],r,e,e.parent||n,o):a.createConnection(l[e.source.id],l[e.target.id],e,e.parent||n,o);else{var t=q({},o);-1===p.indexOf(e)&&(t.autoResize=!1),l[e.id]=m(r)?a.createShape(e,W(e,["x","y","width","height"]),e.parent||n,r,t):a.createShape(e,W(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=M(l)};var nf=Math.round;function rf(e){this._canvas=e}function of(e){rf.call(this,e)}rf.$inject=["canvas"],rf.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?q(t,n):q(t,{x:n.x-nf(t.width/2),y:n.y-nf(t.height/2)}),this._canvas.addShape(t,r,i),t},rf.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},r(of,rf),of.$inject=["canvas"];var af=rf.prototype.execute;of.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,af.call(this,e)};var sf=rf.prototype.revert;function pf(e,t){this._canvas=e,this._modeling=t}function lf(e,t){this._modeling=e,this._elementRegistry=t}function cf(e,t){this._canvas=e,this._modeling=t}function uf(e){this._modeling=e}of.prototype.revert=function(e){return e.shape.labelTarget=null,sf.call(this,e)},pf.$inject=["canvas","modeling"],pf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},pf.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Et(n.children,t,r),this._canvas.addConnection(t,n),t},lf.$inject=["modeling","elementRegistry"],lf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;_(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},cf.$inject=["canvas","modeling"],cf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;gm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),gm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),gm(n.children,(function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},cf.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pt(r.children,n),t.removeShape(n),n},cf.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Et(r.children,n,i),t.addShape(n,r),n},uf.$inject=["modeling"];var df={x:"y",y:"x"};function hf(e,t){this._layouter=e,this._canvas=t}function mf(){}function ff(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function yf(e){this._modeling=e}function gf(e){this._helper=new yf(e)}function vf(e){this._modeling=e,this._helper=new yf(e)}function bf(e){this._modeling=e}function xf(e){return e.original||e}function wf(e,t){this._modeling=e,this._rules=t}function _f(e){this._modeling=e}function Ef(e){this._modeling=e}function Pf(e){return q({},e)}function Of(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Sf(e,t,n){var r=Of(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function kf(e,t){return-1!==e.indexOf(t)}function Cf(e){this._modeling=e}function Tf(e){var t={};return _(e,(function(e){t[e.id]=e.hidden,e.children&&(t=q({},t,Tf(e.children)))})),t}function Mf(e,t){var n=[];return _(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Mf(e.children,e.collapsed||t)))})),n}function Af(e,t){var n=[];return _(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Af(e.children,t)))})),n}function Rf(e){this._modeling=e}function Df(e,t){return _t(e&&e.attachers,t)}function zf(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Et(r,t,n)}}function jf(){}function Nf(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function Bf(e){this._elementRegistry=e}function If(e,t){_(t,(function(t,n){e.set(n,t)}))}uf.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function a(e){return e[r]+e[i]/2}function s(e){return e.length-1}function p(e){return e.max-e.min}var l,c,u=n[0],d=s(n),h=n[d],m=0;_(n,(function(e,l){var c,u,h;e.elements.length<2?l&&l!==n.length-1&&(o(e,e.elements[0]),m+=p(e.range)):(u=(c=z(e.elements,r))[0],l===d&&(u=c[s(c)]),h=a(u),e.range=null,_(c,(function(n){!function(e,n){var i={y:0};i[r]=e-a(n),i[r]&&(i[df[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),l&&l!==n.length-1&&(m+=p(e.range)))})),c=Math.abs(h.range.min-u.range.max),(l=Math.round((c-m)/(n.length-1)))<n.length-1||_(n,(function(e,o){var a,s={};e!==u&&e!==h&&(a=n[o-1],e.range.max=0,_(e.elements,(function(n,o){s[df[r]]=0,s[r]=a.range.max-n[r]+l,e.range.min!==n[r]&&(s[r]+=n[r]-e.range.min),s[r]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},uf.prototype.postExecute=function(e){},hf.$inject=["layouter","canvas"],hf.prototype.execute=function(e){var t=e.connection;return q(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},hf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},mf.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(r.children,t,i),t.parent=r,_(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},mf.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return _t(n.children,t),Et(r.children,t,i),t.parent=r,_(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},ff.prototype.add=function(e,t){return this.addAll([e],t)},ff.prototype.addAll=function(e,t){return q(this,function(e,t,n){l(t)&&(t=!0),h(t)&&(n=t,t=!0);var r=bt((n=n||{}).allShapes),i=bt(n.allConnections),o=bt(n.enclosedElements),a=bt(n.enclosedConnections),s=bt(n.topLevel,t&&A(e,(function(e){return e.id})));function p(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return mt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,_(e.incoming,p),_(e.outgoing,p),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},yf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},yf.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,a=e.allShapes,s=e.allConnections,p=e.enclosedConnections,l=e.topLevel,c=!1;i&&i.parent===n&&(c=!0),_(a,(function(e){o.moveShape(e,t,l[e.id]&&!c&&n,{recurse:!1,layout:!1})})),_(s,(function(e){var r=!!a[e.source.id],i=!!a[e.target.id];p[e.id]&&r&&i?o.moveConnection(e,t,l[e.id]&&!c&&n):o.layoutConnection(e,{connectionStart:r&&jd(e,e.source,t),connectionEnd:i&&Nd(e,e.target,t)})}))},yf.prototype.getClosure=function(e){return(new ff).addAll(e,!0)},gf.$inject=["modeling"],gf.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},gf.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)},vf.$inject=["modeling"],vf.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=W(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(r.children,t,i),q(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},vf.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(_(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:Nd(e,t,n)})})),_(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:jd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},vf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Et(n.children,t,r),q(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},vf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},vf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},bf.$inject=["modeling"],bf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return d(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},bf.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(a.connectionStart=a.connectionStart||xf(d(i)?i[0]:i)),!r||n&&"target"!==o.docking||(a.connectionEnd=a.connectionEnd||xf(d(i)?i[i.length-1]:i)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},bf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},wf.$inject=["modeling","rules"],wf.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,a=e.newData,s=e.hints||{};function p(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var l,c={x:a.x,y:a.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(a,c,o.parent,s),o.host&&r.updateAttachment(t,o.host),!1!==s.moveChildren&&(l=o.children.slice(),r.moveElements(l,{x:0,y:0},t,s));var d=o.incoming.slice(),h=o.outgoing.slice();_(d,(function(e){p(e.source,t,e)&&n.reconnectEnd(e,t,zd(e,t,u),s)})),_(h,(function(e){var r=e.target;p(t,r,e)&&n.reconnectStart(e,t,Dd(e,t,u),s)}))},wf.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},wf.prototype.execute=function(e){},wf.prototype.revert=function(e){},wf.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},wf.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},wf.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},_f.$inject=["modeling"],_f.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=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(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&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},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},_f.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(_(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:zd(e,n,r)})})),_(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Dd(e,n,r)})})))},_f.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ef.$inject=["modeling"],Ef.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,a={};this.moveShapes(r,t),_(i,(function(e){a[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return _(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;_(i.concat(o),(function(r){var i=r.source,o=r.target;(km(e,i)||km(e,o)||km(t,i)||km(t,o))&&(km(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,a)},Ef.prototype.execute=function(){},Ef.prototype.revert=function(){},Ef.prototype.moveShapes=function(e,t){var n=this;_(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Ef.prototype.resizeShapes=function(e,t,n){var r=this;_(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,a=e.height,s=n.x,p=n.y;switch(t){case"n":return{x:r,y:i+p,width:o,height:a-p};case"s":return{x:r,y:i,width:o,height:a+p};case"w":return{x:r+s,y:i,width:o-s,height:a};case"e":return{x:r,y:i,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Ef.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,a){var s=this,p=i.concat(o);_(e,(function(e){var l=e.source,c=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=Pf(e)).original&&(e.original=Pf(e.original)),e}))}(e),d=Of(n),h={labelBehavior:!1};kf(p,l)&&kf(p,c)?(u=k(u,(function(e){return Sf(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Sf(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(kf(p,l)||kf(p,c))&&(kf(i,l)?h.connectionStart=jd(e,l,t):kf(i,c)?h.connectionEnd=Nd(e,c,t):kf(o,l)?h.connectionStart=Dd(e,l,a[l.id]):kf(o,c)&&(h.connectionEnd=zd(e,c,a[c.id])),s._modeling.layoutConnection(e,h))}))},Cf.$inject=["modeling"],Cf.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Tf(n),t.collapsed=!t.collapsed;var r=Mf(n,t.collapsed);return[t].concat(r)},Cf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=Af(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},Rf.$inject=["modeling"],Rf.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Df(r,t),zf(n,t),t.host=n,t},Rf.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Df(n,t),zf(r,t,i),t},jf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},jf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Nf.$inject=["eventBus","elementFactory","commandStack"],Nf.prototype.getHandlers=function(){return{"shape.append":Zm,"shape.create":rf,"shape.delete":cf,"shape.move":vf,"shape.resize":_f,"shape.replace":wf,"shape.toggleCollapse":Cf,spaceTool:Ef,"label.create":of,"connection.create":Jm,"connection.delete":pf,"connection.move":mf,"connection.layout":hf,"connection.updateWaypoints":jf,"connection.reconnect":bf,"elements.create":ef,"elements.move":gf,"elements.delete":lf,"elements.distribute":uf,"elements.align":Ym,"element.updateAttachment":Rf}},Nf.prototype.registerHandlers=function(e){_(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Nf.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},Nf.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Nf.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,a=n;!0===o?(i=n,a=n.parent):!1===o&&(i=null);var s={shapes:e,delta:t,newParent:a,newHost:i,hints:r};this._commandStack.execute("elements.move",s)},Nf.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},Nf.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Nf.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var a={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Nf.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,a,s=(i=i||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var p={position:t,shape:e,parent:o,parentIndex:r,host:a,hints:i};return this._commandStack.execute("shape.create",p),p.shape},Nf.prototype.createElements=function(e,t,n,r,i){d(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},Nf.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},Nf.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},Nf.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Nf.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},Nf.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Nf.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Nf.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},Nf.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Nf.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},Nf.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},Nf.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},Nf.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},Nf.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,q(r,{docking:"source"}))},Nf.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,q(r,{docking:"target"}))},Nf.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},Nf.prototype._create=function(e,t){return t instanceof Nn?t:this._elementFactory.create(e,t)},Nf.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Bf.$inject=["elementRegistry"],Bf.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this.getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return P(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,C(r));return If(n,r),e.oldProperties=o,e.changed=i,i},Bf.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return If(n,t),r},Bf.prototype.getVisualReferences=function(e){var t=this._elementRegistry;return wi(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return wi(t,"bpmn:DataObjectReference")&&Ei(t).dataObjectRef===e}))}(e,t):[]};var Lf="default",$f="id",Ff="di",Vf={width:0,height:0};function Hf(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function qf(e,t){return $f in e&&e.id!==t.id}function Uf(e,t){var n=e.businessObject,r=Pi(e);_(t,(function(e,t){t!==Ff?n.set(t,e):r&&function(e,t){_(t,(function(t,n){e.set(n,t)}))}(r,e)}))}Hf.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Hf.prototype.execute=function(e){var t=e.element,n=[t],r=this._translate;if(!t)throw new Error(r("element required"));var i=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=q({},e);return Gf.forEach((function(n){n in e&&(t[n]=Ei(t[n]))})),t}(e.properties),p=e.oldProperties||function(e,t){var n=C(t),r=e.businessObject,i=Pi(e);return P(n,(function(e,n){return e[n]=n!==Ff?r.get(n):function(e,t){return P(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,C(t.di)),e}),{})}(t,s);return qf(s,a)&&(o.unclaim(a.id),i.updateId(t,s.id),o.claim(s.id,a)),Lf in s&&(s.default&&n.push(i.get(s.default.id)),a.default&&n.push(i.get(a.default.id))),Uf(t,s),e.oldProperties=p,e.changed=n,n},Hf.prototype.postExecute=function(e){var t=e.element.label,n=t&&Ei(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,Vf)}},Hf.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Uf(t,r),qf(n,i)&&(a.unclaim(n.id),o.updateId(t,r.id),a.claim(r.id,i)),e.changed};var Gf=["default"];function Wf(e,t){this._canvas=e,this._modeling=t}function Kf(e,t){this._modeling=e,this._spaceTool=t}function Xf(e,t){this._modeling=e,this._translate=t}function Yf(e,t){this._modeling=e,this._spaceTool=t}Wf.$inject=["canvas","modeling"],Wf.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,a=o.$parent,s=Pi(i);t.setRootElement(n),t.removeRootElement(i),Et(a.rootElements,r),r.$parent=a,_t(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i},Wf.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,a=r.$parent,s=Pi(n);t.setRootElement(i),t.removeRootElement(n),_t(a.rootElements,r),r.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s},Kf.$inject=["modeling","spaceTool"],Kf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=xc(r),a=o===r,s=a?r:r.parent;bc(s).length||n.createShape({type:"bpmn:Lane"},{x:r.x+gc,y:r.y,width:r.width-gc,height:r.height},s);var p=[];mt(o,(function(e){return p.push(e),e.label&&p.push(e.label),e===r?[]:w(e.children,(function(e){return e!==r}))}));var l="top"===i?-120:120,c="top"===i?r.y:r.y+r.height,u=c+("top"===i?10:-10),d="top"===i?"n":"s",h=t.calculateAdjustments(p,"y",l,u);t.makeSpace(h.movingShapes,h.resizingShapes,{x:0,y:l},d,u),e.newLane=n.createShape({type:"bpmn:Lane"},{x:r.x+(a?gc:0),y:c-("top"===i?120:0),width:r.width-(a?gc:0),height:120},s)},Xf.$inject=["modeling","translate"],Xf.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=bc(r),a=o.length;if(a>i)throw new Error(n("more than {count} child lanes",{count:i}));var s,p,l,c,u,d=Math.round(r.height/i);for(u=0;u<i;u++)s=r.y+u*d,p=u===i-1?r.height-d*u:d,l={x:r.x+gc,y:s,width:r.width-gc,height:p},u<a?t.resizeShape(o[u],l):(c={type:"bpmn:Lane"},t.createShape(c,l,r))},Yf.$inject=["modeling","spaceTool"],Yf.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Yf.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=wc(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},Yf.prototype.resizeSpace=function(e,t){var n,r,i,o,a,s=this._spaceTool,p=hn(e),l=cc(hn(t),p),c=xc(e),u=[],d=[];mt(c,(function(e){return u.push(e),(wi(e,"bpmn:Lane")||wi(e,"bpmn:Participant"))&&d.push(e),e.children})),(l.bottom||l.top)&&(n=l.bottom||l.top,r=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),i=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,r),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},i)),(l.left||l.right)&&(n=l.right||l.left,r=e.x+(l.right?e.width:0)+(l.right?-10:100),i=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,r),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},i))};var Zf="flowNodeRef",Jf="lanes";function Qf(e){this._elementRegistry=e}function ey(e){this._moddle=e}Qf.$inject=["elementRegistry"],Qf.prototype.computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function a(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function s(e){return e.parent?function(e){var t=xc(e);return i[t.id]||(i[t.id]=vc(t)),i[t.id]}(e).filter((function(t){return n=e,r=hn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject})):[]}return t.forEach((function(e){var t=xc(e);t&&-1===n.indexOf(t)&&(t.children.filter((function(e){return wi(e,"bpmn:FlowNode")})).forEach(a),n.push(t))})),e.forEach(a),o.forEach((function(e){var t=e.businessObject,n=t.get(Jf).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(Zf).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},Qf.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(Jf);e.remove.forEach((function(e){_t(n,e),_t(e.get(Zf),t)})),e.add.forEach((function(e){Et(n,e),Et(e.get(Zf),t)}))}))},Qf.prototype.revert=function(e){e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Jf);e.add.forEach((function(e){_t(n,e),_t(e.get(Zf),t)})),e.remove.forEach((function(e){Et(n,e),Et(e.get(Zf),t)}))}))},ey.$inject=["moddle"],ey.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;e.claiming?t.claim(n,r):t.unclaim(n)},ey.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;e.claiming?t.unclaim(n):t.claim(n,r)};var ty={fill:void 0,stroke:void 0};function ny(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(y(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error("invalid color value: "+e)}}}ny.$inject=["commandStack"],ny.prototype.postExecute=function(e){var t=e.elements,n=e.colors||ty,r=this,i={};"fill"in n&&q(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(i,{"border-color":this._normalizeColor(n.stroke)}),_(t,(function(e){var t=function(e){return!!e.waypoints}(e)?W(i,["border-color"]):i;!function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),e.labelTarget?r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:Pi(e).label,properties:{color:i["background-color"]}}):r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}))};var ry={width:0,height:0};function iy(e,t,n){function r(e,t){var r=e.label||e,i=e.labelTarget||e;return function(e,t,n){var r=e.businessObject,i=Fi(r);i&&("categoryValueRef"===i?r.categoryValueRef.value=t:r[i]=t)}(r,t),function(e,t){if(!lo(e)){var r=Pi(e);t&&!r.label&&(r.label=n.create("bpmndi:BPMNLabel")),!t&&r.label&&(r.label=null)}}(e,t),[r,i]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!mo(n)&&lo(n)&&!co(n)&&!oy(i)){var o=ho(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=Vi(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,a=n.newBounds,s=n.hints||{};if(mo(i)||wi(i,"bpmn:TextAnnotation"))if(mo(i)&&oy(o))!1!==s.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var p=Vi(i);void 0===a&&(a=t.getExternalLabelBounds(i,p)),a&&e.resizeShape(i,a,ry)}}}function oy(e){return!e||!e.trim()}function ay(e,t,n,r){Nf.call(this,e,t,n),this._bpmnRules=r}function sy(){}iy.$inject=["modeling","textRenderer","bpmnFactory"],r(ay,Nf),ay.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ay.prototype.getHandlers=function(){var e=Nf.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Bf,e["element.updateProperties"]=Hf,e["canvas.updateRoot"]=Wf,e["lane.add"]=Kf,e["lane.resize"]=Yf,e["lane.split"]=Xf,e["lane.updateRefs"]=Qf,e["id.updateClaim"]=ey,e["element.setColor"]=ny,e["element.updateLabel"]=iy,e},ay.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},ay.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},ay.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},ay.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ay.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ay.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ay.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ay.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ay.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ay.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},ay.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ay.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ay.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},sy.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||fn(t.source||e.source),t.connectionEnd||fn(t.target||e.target)]};var py=Math.round,ly={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function cy(e,t,n){var r,i,o,a=yn(t,e,5),s=n.split(":")[0],p=py((t.x-e.x)/2+e.x),l=py((t.y-e.y)/2+e.y),c=(o=a,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[s].test(o)),u=/h|r|l/.test(s),d=!1;return c?(r=u?{x:p,y:e.y}:{x:e.x,y:l},i=u?"h:h":"v:v"):(i=u?"h:v":"v:h",function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(a,s)?u?(d=l===e.y,r={x:e.x+20*(/l/.test(s)?-1:1),y:d?l+20:l}):r={x:(d=p===e.x)?p+20:p,y:e.y+20*(/t/.test(s)?-1:1)}:r={x:p,y:l}),{waypoints:dy(e,r,i).concat(r),directions:i,turnNextDirections:d}}function uy(e){return e.split(":").reverse().join(":")}function dy(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(gy(n)){var r=function(e,t,n){return cy(e,t,n)}(e,t,n),i=function(e,t,n){var r=cy(t,e,uy(n));return{waypoints:r.waypoints.slice().reverse(),directions:uy(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:dy(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=py((t.x-e.x)/2+e.x),i=py((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:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function hy(e,t,n,r,i){var o=E(i&&i.preferredLayouts||[],"straight")[0]||"h:h",a=yn(e,t,ly[o]||0),s=function(e,t){if(gy(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||fn(e),r=r||fn(t);var p=s.split(":");return function(e,t,n){var r=dy(e,t,n);return r.unshift(e),r.push(t),by(r)}(vy(n,e,p[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(a)),vy(r,t,p[1],a),s)}function my(e,t,n,r,i,o){var a;return d(n)&&(i=n,o=r,n=fn(e),r=fn(t)),i=i||[],(a=-1!==(o=q({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,a,s={};if(a=yn(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===i.preserveDocking?fy(o,r,e)?(s[o]=r[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:r.x,y:r.y}]):null:fy(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:r.x,y:void 0!==s.y?s.y:r.y,original:{x:void 0!==s.x?s.x:r.x,y:void 0!==s.y?s.y:r.y}}]):null}(e,t,n,r,o))||(a=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return(i=yy(e,t,n,i))?i.reverse():null}(t,e,r,i))?a:(a=o.connectionStart&&yy(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:hy(e,t,n,r,o))}function fy(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function yy(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!b(e,(function(t,n){var r=e[n-1];return r&&Ot(t,r)<3}))}(r))return null;var i,o=r[0],a=r.slice();return a[0]=n,a[1]=function(e,t,n){switch(kt(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}}(a[1],o,n),(i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Ct(e[r],t,20)||Ct(e[r],n,20))return e.slice(r);return e}(a,e,t))!==a&&(a=yy(e,t,n,i)),a&&kt(a)?null:a}function gy(e){return e&&/t|r|b|l/.test(e)}function vy(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"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 by(e){return e.reduce((function(t,n,r){return St(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var xy={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},wy={top:"t",right:"r",bottom:"b",left:"l"};function _y(){}function Ey(e,t){return wi(t,"bpmn:Participant")?"source":wi(e,"bpmn:Participant")?"target":ky(t)?"source":ky(e)||wi(t,"bpmn:Event")?"target":wi(e,"bpmn:Event")?"source":null}function Py(e){return ky(e)?"target":"source"}function Oy(e,t){return e?e.original||e:fn(t)}function Sy(e,t){return wi(t,"bpmn:Activity")&&wi(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ky(e){return wi(e,"bpmn:SubProcess")&&Bi(e)}function Cy(e,t){return e===t}function Ty(e){var t=/right|left/.exec(e);return t&&t[0]}function My(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ay(e){return"right"===e||"left"===e}function Ry(e,t){var n=t.waypoints,r=n&&n.length&&yn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function Dy(e,t,n){var r,i,o=fn(e),a=fn(t),s=(i=(r=e).host,yn(fn(r),i,-10)),p=Cy(e.host,t),l=-1!==["top","right","bottom","left"].indexOf(s),c=yn(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,a=t?e:My(e),s=wy[a];o=t?Ay(e)?zy("y",n,r,i)?"h":"b":zy("x",n,r,i)?"v":"l":"v";return[s+":"+o]}(s,l,e,t,n):[function(e,t,n){if(n)return wy[e];if(Cy(My(e),My(t))||function(e,t){return xy[e]===t}(Ty(e),Ty(t)))return wy[My(e)];return wy[Ty(e)]}(s,c,l)+":"+function(e,t,n){if(n)return Ay(e)?function(e,t){var n=Ty(e),r=xy[n];return-1!==t.indexOf(r)}(e,t)||Cy(e,t)?"h":"v":function(e,t){var n=My(e),r=xy[n];return-1!==t.indexOf(r)}(e,t)||Cy(e,t)?"v":"h";return Ay(t)||Cy(My(e),My(t))&&Ty(t)?"h":"v"}(s,c,l)]}function zy(e,t,n,r){return!(jy(e,r,n,40)||jy(e,r,{x:n.x+n.width,y:n.y+n.height},40)||jy(e,r,fn(t),40))}function jy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function Ny(e){return q({original:e.point.original||e.point},e.actual)}function By(e,t){this._elementRegistry=e,this._graphicsFactory=t}r(_y,sy),_y.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,a=t.waypoints||e.waypoints,s=t.connectionStart,p=t.connectionEnd;return s||(s=Oy(a&&a[0],i)),p||(p=Oy(a&&a[a.length-1],o)),(wi(e,"bpmn:Association")||wi(e,"bpmn:DataAssociation"))&&a&&!Sy(i,o)?[].concat([s],a.slice(1,-1),[p]):(wi(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:Ey(e,t)}}(i,o):(wi(e,"bpmn:SequenceFlow")||Sy(i,o))&&(n=i===o?{preferredLayouts:Ry(i,e)}:wi(i,"bpmn:BoundaryEvent")?{preferredLayouts:Dy(i,o,p)}:ky(i)||ky(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:Py(e)}}(i):wi(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:wi(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=by(my(i,o,s,p,a,n=q(n,t)))),r||[s,p])},By.$inject=["elementRegistry","graphicsFactory"],By.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(Ny(r)),o.push(Ny(i)),o},By.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},By.prototype._getIntersection=function(e,t,n){return gn(this._getShapePath(e),this._getConnectionPath(t),n)},By.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},By.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},By.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Iy={__init__:["modeling","bpmnUpdater"],__depends__:[Eh,im,am,lm,Hl,um,ym,xm,Pm,$o,Xo,qm],bpmnFactory:["type",Um],bpmnUpdater:["type",Gm],elementFactory:["type",Km],modeling:["type",ay],layouter:["type",_y],connectionDocking:["type",By]},Ly=Math.round;function $y(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function a(e,n,r,i){if(h(r)&&(i=r,r=!1),!n.waypoints&&n.parent){var o=function(e){return{x:e.x+Ly(e.width/2),y:e.y+Ly(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),q(t,{shapes:i=function(e){var t=A(e,"id");return w(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,a={x:e.dx,y:e.dy};t=o(r,a,{x:e.x,y:e.y},i),n.delta=a,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,a=t.shapes;if(!1===i)return!1;r.x=Ly(r.x),r.y=Ly(r.y),0===r.x&&0===r.y||n.moveElements(a,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Oo(e)){var t=wo(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}})),this.start=a}$y.$inject=["eventBus","dragging","modeling","selection","rules"];var Fy="djs-dragging",Vy="drop-ok",Hy="drop-not-ok",qy="new-parent",Uy="attach-ok";function Gy(e,t,n,r){function i(e){return function(e){return w(e,(function(t){return!function(e){return e.waypoints}(t)||b(e,j({id:t.source.id}))&&b(e,j({id:t.target.id}))}))}(o(e))}function o(e){var t=ft(e,!0),n=k(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return a(t.concat(n))}function s(e,n){[Uy,Vy,Hy,qy].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var s=e.context,p=s.shapes,l=s.allDraggedElements,c=i(p);if(!s.dragGroup){var u=Ie("g");Oe(u,n.cls("djs-drag-group",["no-events"])),_e(t.getActiveLayer(),u),s.dragGroup=u}c.forEach((function(e){r.addDragger(e,s.dragGroup)})),_(l=l?a([l,o(p)]):o(p),(function(e){t.addMarker(e,Fy)})),s.allDraggedElements=l,s.differentParents=1!==T(A(p,(function(e){return e.parent&&e.parent.id})))})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?s(r,Uy):t.canExecute&&r&&r.id!==i.id?s(r,qy):s(r,t.canExecute?Vy:Hy)),Kn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&s(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;_(r,(function(e){t.removeMarker(e,Fy)})),i&&Re(i)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Fy),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}Gy.$inject=["eventBus","canvas","styles","previewSupport"];var Wy={__depends__:[Ao,$o,Do,Ls,zs,rl],__init__:["move","movePreview"],move:["type",$y],movePreview:["type",Gy]},Ky=".djs-palette-toggle",Xy=".entry",Yy="open",Zy="two-column";function Jy(e,t){this._eventBus=e,this._canvas=t;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._rebuild()}))}function Qy(e,t){var n=t.getPaletteEntries();return f(n)?n(e):(_(n,(function(t,n){e[n]=t})),e)}Jy.$inject=["eventBus","canvas"],Jy.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Jy.prototype.getEntries=function(){return this._getProviders().reduce(Qy,{})},Jy.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Jy.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=fe(Jy.HTML_MARKUP);n.appendChild(r),te(n).add("djs-palette-shown"),me.bind(r,".djs-palette-toggle, .entry","click",(function(t){var n=t.delegateTarget;if(ae(n,Ky))return e.toggle();e.trigger("click",t)})),ue.bind(r,"mousedown",(function(e){e.stopPropagation()})),me.bind(r,Xy,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Jy.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Jy.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=te(r),a=te(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Zy,t),a.toggle("djs-palette-two-column",t),"open"in e&&(o.toggle(Yy,e.open),a.toggle("djs-palette-open",e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Jy.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();re(e),_(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+r+"]",e);i||(i=fe('<div class="group" data-group="'+r+'"></div>'),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=fe(o);i.appendChild(a),t.separator||(Y(a,"data-action",n),t.title&&Y(a,"title",t.title),t.className&&function(e,t){var n=te(e);(d(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(a,t.className),t.imageUrl&&a.appendChild(fe('<img src="'+t.imageUrl+'">')))})),this.open()},Jy.prototype.trigger=function(e,t,n){var r,i,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(r=a[Y(s,"data-action")])&&(i=r.action,o=t.originalEvent||t,f(i)?"click"===e&&i(o,n):i[e]&&i[e](o,n),t.preventDefault())},Jy.prototype._layoutChanged=function(){this._toggleState({})},Jy.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Jy.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Jy.prototype.open=function(){this._toggleState({open:!0})},Jy.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Jy.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Jy.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),_(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=te(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Jy.prototype.isOpen=function(){return te(this._container).has(Yy)},Jy.prototype._getParentContainer=function(){return this._canvas.getContainer()},Jy.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var eg={__init__:["palette"],palette:["type",Jy]},tg="crosshair";function ng(e,t,n,r,i,o,a){this._selection=i,this._dragging=n,this._mouse=a;var s=this,p=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Ie("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),_e(r,n)},l=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},c=function(e){e.frame&&Re(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){s.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=rg(e),n=r.filter((function(e){return e}));s.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=rg(e),p(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=rg(e),l(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;c(t)})),e.on("element.mousedown",1500,(function(e){if(ko(e))return s.activateLasso(e.originalEvent),!0}))}function rg(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}:t.x>=n.x&&t.y<n.y||t.x>n.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&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.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}}ng.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],ng.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tg,data:{context:{}}})},ng.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tg,data:{context:{}}})},ng.prototype.select=function(e,t){var n=function(e,t){var n={};return _(e,(function(e){var r=e;r.waypoints&&(r=yt(r)),!m(t.y)&&r.x>t.x&&(n[e.id]=e),!m(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(m(t.width)&&m(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:m(t.width)&&m(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select(M(n))},ng.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ng.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var ig={__depends__:[Sm,_l],__init__:["lassoTool"],lassoTool:["type",ng]},og=1500,ag="grab";function sg(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var a=this,s=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",og,(function(e){if(So(e))return a.activateMove(e.originalEvent,!0),!1})),s&&s.addListener(og,(function(e){if(pg(e.keyEvent)&&!a.isActive()){var t=a._mouse.getLastMoveEvent();a.activateMove(t,!!t)}}),"keyboard.keydown"),s&&s.addListener(og,(function(e){pg(e.keyEvent)&&a.isActive()&&a.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",(function(){a.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context.reactivate;return!So(t)&&n&&e.once("hand.move.ended",(function(e){a.activateHand(e.originalEvent,!0,!0)})),!1}))}function pg(e){return xa(" ",e)}sg.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],sg.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ag,data:{context:n||{}}})},sg.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ag,data:{context:{reactivate:n}}})},sg.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},sg.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var lg={__depends__:[Sm,_l],__init__:["handTool"],handTool:["type",sg]},cg="connect-ok",ug="connect-not-ok";function dg(e,t,n,r,i,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=s.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?cg:ug))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?cg:ug)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(s.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}dg.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],dg.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},dg.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},dg.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},dg.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var hg={__depends__:[zp,Ls,zs,Sm,_l],globalConnect:["type",dg]};function mg(e,t,n,r,i,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}mg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],mg.prototype.getPaletteEntries=function(e){var t={},n=this._create,r=this._elementFactory,i=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,p=this._translate;function l(e,t,i,o,a){function s(t){var i=r.createShape(q({type:e},a));a&&(Pi(i).isExpanded=a.isExpanded);n.start(t,i)}var l=e.replace(/^bpmn:/,"");return{group:t,className:i,title:o||p("Create {type}",{type:l}),action:{dragstart:s,click:s}}}function c(e){var t=r.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=r.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:t});n.start(e,[t,i],{hints:{autoSelect:[t]}})}function u(e){n.start(e,r.createParticipantShape())}return q(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:p("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:p("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:p("Activate the create/remove space tool"),action:{click:function(e){i.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:p("Activate the global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",p("Create StartEvent")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",p("Create Intermediate/Boundary Event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",p("Create EndEvent")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",p("Create Task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",p("Create DataObjectReference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",p("Create DataStoreReference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:p("Create expanded SubProcess"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:p("Create Pool/Participant"),action:{dragstart:u,click:u}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",p("Create Group"))}),t};var fg={__depends__:[eg,ml,qm,ig,lg,hg,so],__init__:["paletteProvider"],paletteProvider:["type",mg]};function yg(e,t,n,r,i){Yo.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a&&a.replacements?function(e){_(e.canExecute.replacements,(function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var p=t.get(a);q(s,{x:p.x,y:p.y});var l=n.createShape(s);r.addShape(l,p.parent);var c=ve('[data-element-id="'+Qo(p.id)+'"]',e.dragGroup);c&&Oe(c,{display:"none"});var u=i.addDragger(l,e.dragGroup);e.visualReplacements[a]=u,r.removeShape(l)}}))}(o):function(e){var t=e.visualReplacements;_(t,(function(n,r){var i=ve('[data-element-id="'+Qo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}yg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],r(yg,Yo);var gg={__depends__:[rl],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",yg]},vg=40,bg=["x","y"],xg=Math.abs;function wg(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,a=t.target;e.originalEvent&&ba(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){bg.forEach((function(r){var i=Pg(r,t);e[r]<t[r]+n?Ep(e,r,t[r]+n):e[r]>t[r]+i-n&&Ep(e,r,t[r]+i-n)}))}(e,i,function(e){return wi(e,"bpmn:Task")?10:20}(i)),i&&function(e,t){return S(t,(function(t){return Eg(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=wp(r),_i(i,["bpmn:Event","bpmn:Gateway"])&&_g(e,wp(i)),_i(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=wp(t);bg.forEach((function(r){(function(e,t,n){return e[n]>t[n]+20&&e[n]<t[n]+Pg(n,t)-20})(e,t,r)&&Ep(e,r,n[r])}))}(e,i),wi(o,"bpmn:BoundaryEvent")&&a===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=wp(n),o=yn(i,r,-10),a=[];/top|bottom/.test(o)&&a.push("x");/left|right/.test(o)&&a.push("y");a.forEach((function(t){var n,r=e[t];xg(r-i[t])<vg&&(n=r>i[t]?i[t]+vg:i[t]-vg,Ep(e,t,n))}))}(e)):Eg(n,"bpmn:MessageFlow")?(wi(r,"bpmn:Event")&&(t.connectionStart=wp(r)),wi(i,"bpmn:Event")&&_g(e,wp(i))):t.connectionStart=t.initialConnectionStart)}))}function _g(e,t){Ep(e,"x",t.x),Ep(e,"y",t.y)}function Eg(e,t){return e&&e.type===t}function Pg(e,t){return"x"===e?t.width:t.height}function Og(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Sg(e){this._snapValues={}}wg.$inject=["eventBus"],Og.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Og.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Og.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Og.prototype.getSnapLocations=function(){return this._snapLocations},Og.prototype.setSnapLocations=function(e){this._snapLocations=e},Og.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Sg).initDefaults(this._defaultSnaps),n},Sg.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)},Sg.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],gp(i-e)<=n)return i}(e[n],i[n],r)},Sg.prototype.initDefaults=function(e){var t=this;_(e||{},(function(e,n){_(e,(function(e){t.add(n,e)}))}))};function kg(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],1250,(function(e){var t=e.context,i=t.shape,o=t.snapContext,a=t.target;if((!e.originalEvent||!ba(e.originalEvent))&&!_p(e)&&a){var s=o.pointsForTarget(a);s.initialized||((s=r.addSnapTargetPoints(s,i,a)).initialized=!0),n.snap(e,s)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}function Cg(e){return!!e.labelTarget}kg.$inject=["elementRegistry","eventBus","snapping"],kg.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new Og);var a=(t=n.get(i.id)?wp(i,e):{x:e.x+wp(i).x,y:e.y+wp(i).y}).x-i.width/2,s=t.y-i.height/2,p=t.x+i.width/2,l=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),Cg(i)||(o.setSnapOrigin("top-left",{x:a-e.x,y:s-e.y}),o.setSnapOrigin("bottom-right",{x:p-e.x,y:l-e.y})),o},kg.prototype.addSnapTargetPoints=function(e,t,n){return _(this.getSnapTargets(t,n),(function(n){if(Cg(n))Cg(t)&&e.add("mid",wp(n));else if(n.waypoints){if(n.waypoints.length<3)return;_(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else{e.add("mid",wp(n))}})),m(t.x)&&m(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",wp(t)),e):e},kg.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function Tg(e,t){t.invoke(kg,this),e.on(["create.move","create.end"],1500,Mg),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!_p(e)&&function(e,t){var n,r=hn(t),i=Ph(e,t),o=e.context.shape;n=o.parent?{x:0,y:0}:fn(o);/top/.test(i)?Ep(e,"y",r.top-n.y):/bottom/.test(i)&&Ep(e,"y",r.bottom-n.y);/left/.test(i)?Ep(e,"x",r.left-n.x):/right/.test(i)&&Ep(e,"x",r.right-n.x)}(e,r)}))}function Mg(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Ep(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Ep(e,"y",e.y)}}function Ag(e,t){return-1!==e.indexOf(t)}function Rg(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}r(Tg,kg),Tg.$inject=["eventBus","injector"],Tg.prototype.initSnap=function(e){var t=kg.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return _(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",Rg(i,r,e))})),_(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",Rg(i,r,e))})),wi(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Tg.prototype.addSnapTargetPoints=function(e,t,n){kg.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);_(r,(function(n){var r;(function(e){if(wi(e,"bpmn:SubProcess")&&Bi(e))return!0;return wi(e,"bpmn:Participant")}(n)||(r="bpmn:TextAnnotation",[t,n].every((function(e){return wi(e,r)}))))&&(e.add("top-left",bp(n)),e.add("bottom-right",xp(n)))}));var i=this._elementRegistry;return _(t.incoming,(function(n){if(i.get(t.id)){Ag(r,n.source)||e.add("mid",fn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),_(t.outgoing,(function(n){if(i.get(t.id)){Ag(r,n.target)||e.add("mid",fn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),wi(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Tg.prototype.getSnapTargets=function(e,t){return kg.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!wi(e,"bpmn:Lane")}))};function Dg(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,a=r.direction,s=r.snapContext;if(!(e.originalEvent&&ba(e.originalEvent)||_p(e))){var p=s.pointsForTarget(o);p.initialized||((p=n.addSnapTargetPoints(p,i,o,a)).initialized=!0),function(e){return"n"===e||"s"===e}(a)&&Ep(e,"x",e.x),function(e){return"e"===e||"w"===e}(a)&&Ep(e,"y",e.y),t.snap(e,p)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function zg(e,t){var n=fn(e),r=hn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}Dg.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new Og);var o=zg(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},Dg.prototype.addSnapTargetPoints=function(e,t,n,r){return _(this.getSnapTargets(t,n),(function(t){e.add("corner",xp(t)),e.add("corner",bp(t))})),e.add("corner",zg(t,r)),e},Dg.$inject=["eventBus","snapping"],Dg.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,r=e,n.host===r||function(e){return!!e.waypoints}(t)||function(e){return!!e.hidden}(t)||function(e){return!!e.labelTarget}(t));var n,r}))};function jg(e){this._canvas=e,this._asyncHide=$(F(this.hide,this),1e3)}jg.$inject=["canvas"],jg.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:_p(e,"x"),y:_p(e,"y")};_(r,(function(r){var o=n.getSnapOrigin(r),a={x:e.x+o.x,y:e.y+o.y};if(_(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(a,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),_(["x","y"],(function(t){var n=i[t];h(n)&&Ep(e,t,n.originValue)}))},jg.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ie("path");return Oe(n,{d:"M0,0 L0,0"}),Me(n).add("djs-snap-line"),_e(t,n),{update:function(t){m(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},jg.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},jg.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},jg.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},jg.prototype.hide=function(){_(this._snapLines,(function(e){e.update()}))};var Ng={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",kg],resizeSnapping:["type",Dg],snapping:["type",jg]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",wg],createMoveSnapping:["type",Tg]};function Bg(e,t,n,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=r,this._container=fe(Bg.BOX_HTML),this._searchInput=ve(Bg.INPUT_SELECTOR,this._container),this._resultsContainer=ve(Bg.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function Ig(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+Bg.RESULT_HIGHLIGHT_CLASS+'">'+ta(e.matched)+"</strong>":t+=ta(e.normal)})),""!==t?t:null}(t),i=fe(n);i.innerHTML=r,e.appendChild(i)}Bg.$inject=["canvas","eventBus","overlays","selection"],Bg.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:me.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,Bg.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,Bg.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,Bg.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,Bg.INPUT_SELECTOR,"keydown",(function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()})),t(this._container,Bg.INPUT_SELECTOR,"keyup",(function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))}))},Bg.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){me.unbind(e.el,e.type,e.listener)}))},Bg.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(Bg.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},Bg.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Bg.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},Bg.prototype._clearResults=function(){re(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},Bg.prototype._getCurrentResult=function(){return ve(Bg.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Bg.prototype._createResultNode=function(e,t){var n=fe(Bg.RESULT_HTML);return e.primaryTokens.length>0&&Ig(n,e.primaryTokens,Bg.RESULT_PRIMARY_HTML),Ig(n,e.secondaryTokens,Bg.RESULT_SECONDARY_HTML),Y(n,Bg.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Bg.prototype.registerProvider=function(e){this._searchProvider=e},Bg.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,te(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Bg.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,te(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},Bg.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Bg.prototype.isOpen=function(){return this._open},Bg.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&te(t).remove(Bg.RESULT_SELECTED_CLASS);var n=Y(e,Bg.RESULT_ID_ATTRIBUTE),r=this._results[n].element;te(e).add(Bg.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},Bg.prototype._select=function(e){var t=Y(e,Bg.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Bg.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=6,n=e.width+2*t,r=e.height+2*t,i=["width: "+n+"px","height: "+r+"px"].join("; ");return{position:{bottom:r-t,right:n-t},show:!0,html:'<div style="'+i+'" class="'+Bg.OVERLAY_CLASS+'"></div>'}}(yt(e));this._overlayId=this._overlays.add(e,t)}},Bg.CONTAINER_SELECTOR=".djs-search-container",Bg.INPUT_SELECTOR=".djs-search-input input",Bg.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Bg.RESULT_SELECTOR=".djs-search-result",Bg.RESULT_SELECTED_CLASS="djs-search-result-selected",Bg.RESULT_SELECTED_SELECTOR="."+Bg.RESULT_SELECTED_CLASS,Bg.RESULT_ID_ATTRIBUTE="data-result-id",Bg.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Bg.OVERLAY_CLASS="djs-search-overlay",Bg.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>',Bg.RESULT_HTML='<div class="djs-search-result"></div>',Bg.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Bg.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var Lg={__depends__:[Wo,$o],searchPad:["type",Bg]};function $g(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function Fg(e){return w(e,(function(e){return!!e.matched})).length>0}function Vg(e,t){var n=[],r=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var i=e.indexOf(t);return i>-1?(0!==i&&n.push({normal:r.substr(0,i)}),n.push({matched:r.substr(i,t.length)}),t.length+i<e.length&&n.push({normal:r.substr(t.length+i,e.length)})):n.push({normal:r}),n}$g.$inject=["elementRegistry","searchPad","canvas"],$g.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=w(n,(function(e){return e!==t})),n=z(n=w(n=k(n,(function(t){return{primaryTokens:Vg(Vi(t),e),secondaryTokens:Vg(t.id,e),element:t}})),(function(e){return Fg(e.primaryTokens)||Fg(e.secondaryTokens)})),(function(e){return Vi(e.element)+e.element.id}))};var Hg={__depends__:[Lg],__init__:["bpmnSearch"],bpmnSearch:["type",$g]};function qg(e){Ni.call(this,e)}r(qg,Ni),qg.Viewer=va,qg.NavigatedViewer=Ka,qg.prototype.createDiagram=gi((function(){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>')})),qg.prototype._interactionModules=[Da,Fa,ns,Wa],qg.prototype._modelingModules=[ps,ws,Bs,ks,Cp,zp,Np,Pc,jl,ml,Tc,jc,Xc,Zc,Qc,su,Su,Iy,Wy,fg,gg,vu,Ng,Hg],qg.prototype._modules=[].concat(va.prototype._modules,qg.prototype._interactionModules,qg.prototype._modelingModules);var Ug={min:.2,max:4};function Gg(e,t,n,r,i){var o=this;function a(e){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Kg(Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function s(e){return function(t){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&a(t);var n=Wg({x:t.clientX-o._state._svgClientRect.left,y:t.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox),i=r.viewbox(),s=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(n,i),c=o._viewportDom.getBoundingClientRect(),u={x:t.clientX-c.left+1,y:t.clientY-c.top+1};q(o._state,{cachedViewbox:i,initialDragPosition:{x:t.clientX,y:t.clientY},isDragging:!0,offsetViewport:s,offsetViewportDom:u,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ue.bind(document,"mousemove",p),ue.bind(document,"mouseup",l)}}function p(e){if(o._state.isDragging){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var t=o._state.offsetViewportDom,n=o._state.viewportClientRect,r=o._state.parentClientRect;q(o._viewportDom.style,{top:e.clientY-t.y-r.top+"px",left:e.clientX-t.x-r.left+"px"});var i=Qg(r,{top:e.clientY-t.y-r.top,left:e.clientX-t.x-r.left,width:n.width,height:n.height});q(o._overlay.style,{clipPath:i});var a=Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Kg({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function l(e){o._state.isDragging&&(o._state.initialDragPosition.x===e.clientX&&o._state.initialDragPosition.y===e.clientY&&a(e),o._update(),q(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ue.unbind(document,"mousemove",p),ue.unbind(document,"mouseup",l))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._init(),this.toggle(e&&e.open||!1),ue.bind(this._svg,"click",(function(e){e.preventDefault(),e.stopPropagation(),a(e)})),ue.bind(this._viewportDom,"mousedown",s(!1)),ue.bind(this._svg,"mousedown",s(!0)),ue.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i=0===e.deltaMode?.02:.32,a=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Jg(e.deltaY)*-i;if(o._state.zoomDelta+=a,Math.abs(o._state.zoomDelta)>.1){var s=a>0?1:-1,p=Math.log(r.zoom())/Math.log(10),l=function(e,t){var n=Math.log(e.min)/Math.log(10),r=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(r))/t}(Ug,20),c=Math.round(p/l)*l;c+=l*s;var u=Math.pow(10,c);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ug,u),d),o._state.zoomDelta=0;var d=Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Kg(d,o._canvas),o._update()}}})),ue.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on("root.set",(function(e){o._clear(),e.element.children.forEach((function(e){o._addElement(e)})),o._update()}))}function Wg(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=q({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);q(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;q(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Xg(e.x,0,r.width,i.x,i.x+i.width),y:Xg(e.y,0,r.height,i.y,i.y+i.height)}}function Kg(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Xg(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Yg(e,t,n){var r=function(e){var t=ve(".children",e);t||_e(e,t=Ie("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function Zg(e){return 0===e.width&&0===e.height}Gg.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Gg.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");te(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");te(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");te(r).add("map"),t.appendChild(r);var i=this._svg=Ie("svg");Oe(i,{width:"100%",height:"100%"}),_e(r,i),_e(i,this._elementsGroup=Ie("g"));var o=this._viewportGroup=Ie("g");_e(i,o);var a=this._viewport=Ie("rect");Me(a).add("viewport"),_e(o,a),ue.bind(t,"mousedown",(function(e){e.stopPropagation()}));var s=this._viewportDom=document.createElement("div");te(s).add("viewport-dom"),this._parent.appendChild(s);var p=this._overlay=document.createElement("div");te(p).add("overlay"),this._parent.appendChild(p)},Gg.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(tv(e)){var r,i,o,a,s=n.width-t.width,p=n.height-t.height;t.width<n.width?(r=t.x-s/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-p/2,a=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,a=t.height),r-=50,i-=50,o+=100,a+=100,this._lastViewbox={x:r,y:i,width:o,height:a},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+a}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),c=this._viewport.getBoundingClientRect(),u={top:c.top-l.top,left:c.left-l.left,width:c.width,height:c.height};q(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Qg(l,u);q(this._overlay.style,{clipPath:d})}},Gg.prototype.open=function(){q(this._state,{isOpen:!0}),te(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};Y(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Gg.prototype.close=function(){q(this._state,{isOpen:!1}),te(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};Y(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Gg.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Gg.prototype.isOpen=function(){return this._state.isOpen},Gg.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Gg.prototype._updateElementId=function(e,t){try{var n=ve("#"+Qo(e.id),this._elementsGroup);n&&(n.id=t)}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Gg.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this._canvas.findRoot(e)===this._canvas.getRootElement()){var n,r,i,o=this._createElement(e),a=ve("#"+Qo(e.parent.id),this._elementsGroup);if(o){var s=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==s&&a?a.childNodes.length>s?Yg(o,a,s):Yg(o,a,a.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,a&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Gg.prototype._removeElement=function(e){var t=this._svg.getElementById(e.id);t&&Re(t)},Gg.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=function(e){return e.childNodes[0]}(n))){var r=ze(t);return Oe(r,{id:e.id}),r}},Gg.prototype._clear=function(){De(this._elementsGroup)};var Jg=Math.sign||function(e){return e>=0?1:-1};function Qg(e,t){return"polygon("+[ev(t.left,t.top),ev(t.left+t.width,t.top),ev(t.left+t.width,t.top+t.height),ev(t.left,t.top+t.height),ev(t.left,e.height),ev(e.width,e.height),ev(e.width,0),ev(0,0),ev(0,e.height),ev(t.left,e.height)].join(", ")+")"}function ev(e,t){return e+"px "+t+"px"}function tv(e){return O(e,(function(e){return h(e)?tv(e):m(e)&&isFinite(e)}))}var nv={__init__:["minimap"],minimap:["type",Gg]};function rv(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",a=-1;_e(t.getLayer("djs-origin",-1),n=av("g",{"pointer-events":"none"})),!1!==e.showBorder&&_e(n,av("path",{class:ov("border"),d:iv(["M",-22,a,"H",-1e3,"M",22,a,"H",6e3,"M",a,-22,"V",-1e3,"M",a,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),_e(n,av("path",{d:iv(["M",-15,a,"H",15,"M",a,-15,"V",15]),class:ov("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=av("text",{x:-40,y:-10,fill:o,class:ov("label")})).textContent="(0, 0)",_e(n,r)}function iv(e){return e.join(" ")}function ov(e){return"djs-origin-"+e}function av(e,t){var n=Ie(e);return Oe(n,t),n}rv.$inject=["config.origin","canvas"];var sv={__init__:[rv]},pv={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function lv(e,t,n,r,i,o){function a(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var a=-e[n]+r[n],s=t.get("gridSnapping",!1);s&&(a=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(a,s.getGridSpacing())),o[n]=Math.abs(a)<i?0:a})),o}function s(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=a(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function p(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var l,c,u;e=function(e){var t=q({},pv,e||{});return m(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:p(-1),revert:p(1)}),e.alignOnSave&&(l=t.get("_parent",!1),c=n,((u=l&&l._eventBus)||c).on("saveXML.start",1250,s),u&&c.on("diagram.destroy",(function(){u.off("saveXML.start",s)}))),this.align=s,this.computeAdjustment=a,this._config=e}lv.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var cv={__init__:["alignToOrigin"],alignToOrigin:["type",lv]};function uv(e){function t(e){if(!e.labelTarget){var t=Ei(e);wi(t,"bpmn:Participant")&&(t=t.processRef),wi(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}uv.$inject=["eventBus"];var dv,hv,mv,fv,yv,gv={__init__:[uv]},vv={},bv=[],xv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function wv(e,t){for(var n in t)e[n]=t[n];return e}function _v(e){var t=e.parentNode;t&&t.removeChild(e)}function Ev(e,t,n){var r,i,o,a=arguments,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>3)for(n=[n],o=3;o<arguments.length;o++)n.push(a[o]);if(null!=n&&(s.children=n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Pv(e,s,r,i,null)}function Pv(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++dv.__v:i};return null!=dv.vnode&&dv.vnode(o),o}function Ov(e){return e.children}function Sv(e,t){this.props=e,this.context=t}function kv(e,t){if(null==t)return e.__?kv(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?kv(e):null}function Cv(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Cv(e)}}function Tv(e){(!e.__d&&(e.__d=!0)&&hv.push(e)&&!Mv.__r++||fv!==dv.debounceRendering)&&((fv=dv.debounceRendering)||mv)(Mv)}function Mv(){for(var e;Mv.__r=hv.length;)e=hv.sort((function(e,t){return e.__v.__b-t.__v.__b})),hv=[],e.some((function(e){var t,n,r,i,o,a;e.__d&&(o=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=wv({},i)).__v=i.__v+1,Lv(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?kv(i):o,i.__h),$v(n,i),i.__e!=o&&Cv(i)))}))}function Av(e,t,n,r,i,o,a,s,p,l){var c,u,d,h,m,f,y,g=r&&r.__k||bv,v=g.length;for(n.__k=[],c=0;c<t.length;c++)if(null!=(h=n.__k[c]=null==(h=t[c])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?Pv(null,h,null,null,h):Array.isArray(h)?Pv(Ov,{children:h},null,null,null):h.__b>0?Pv(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(d=g[c])||d&&h.key==d.key&&h.type===d.type)g[c]=void 0;else for(u=0;u<v;u++){if((d=g[u])&&h.key==d.key&&h.type===d.type){g[u]=void 0;break}d=null}Lv(e,h,d=d||vv,i,o,a,s,p,l),m=h.__e,(u=h.ref)&&d.ref!=u&&(y||(y=[]),d.ref&&y.push(d.ref,null,h),y.push(u,h.__c||m,h)),null!=m?(null==f&&(f=m),"function"==typeof h.type&&null!=h.__k&&h.__k===d.__k?h.__d=p=Rv(h,p,e):p=zv(e,h,d,g,m,p),l||"option"!==n.type?"function"==typeof n.type&&(n.__d=p):e.value=""):p&&d.__e==p&&p.parentNode!=e&&(p=kv(d))}for(n.__e=f,c=v;c--;)null!=g[c]&&("function"==typeof n.type&&null!=g[c].__e&&g[c].__e==n.__d&&(n.__d=kv(r,c+1)),Hv(g[c],g[c]));if(y)for(c=0;c<y.length;c++)Vv(y[c],y[++c],y[++c])}function Rv(e,t,n){var r,i;for(r=0;r<e.__k.length;r++)(i=e.__k[r])&&(i.__=e,t="function"==typeof i.type?Rv(i,t,n):zv(n,i,i,e.__k,i.__e,t));return t}function Dv(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){Dv(e,t)})):t.push(e)),t}function zv(e,t,n,r,i,o){var a,s,p;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(null==n||i!=o||null==i.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,p=0;(s=s.nextSibling)&&p<r.length;p+=2)if(s==i)break e;e.insertBefore(i,o),a=o}return void 0!==a?a:i.nextSibling}function jv(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||xv.test(t)?n:n+"px"}function Nv(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||jv(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||jv(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?Iv:Bv,o):e.removeEventListener(t,o?Iv:Bv,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null!=n&&(!1!==n||"a"===t[0]&&"r"===t[1])?e.setAttribute(t,n):e.removeAttribute(t))}}function Bv(e){this.l[e.type+!1](dv.event?dv.event(e):e)}function Iv(e){this.l[e.type+!0](dv.event?dv.event(e):e)}function Lv(e,t,n,r,i,o,a,s,p){var l,c,u,d,h,m,f,y,g,v,b,x=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(p=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(l=dv.__b)&&l(t);try{e:if("function"==typeof x){if(y=t.props,g=(l=x.contextType)&&r[l.__c],v=l?g?g.props.value:l.__:r,n.__c?f=(c=t.__c=n.__c).__=c.__E:("prototype"in x&&x.prototype.render?t.__c=c=new x(y,v):(t.__c=c=new Sv(y,v),c.constructor=x,c.render=qv),g&&g.sub(c),c.props=y,c.state||(c.state={}),c.context=v,c.__n=r,u=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=x.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=wv({},c.__s)),wv(c.__s,x.getDerivedStateFromProps(y,c.__s))),d=c.props,h=c.state,u)null==x.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==x.getDerivedStateFromProps&&y!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(y,v),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(y,c.__s,v)||t.__v===n.__v){c.props=y,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),c.__h.length&&a.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(y,c.__s,v),null!=c.componentDidUpdate&&c.__h.push((function(){c.componentDidUpdate(d,h,m)}))}c.context=v,c.props=y,c.state=c.__s,(l=dv.__r)&&l(t),c.__d=!1,c.__v=t,c.__P=e,l=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=wv(wv({},r),c.getChildContext())),u||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(d,h)),b=null!=l&&l.type===Ov&&null==l.key?l.props.children:l,Av(e,Array.isArray(b)?b:[b],t,n,r,i,o,a,s,p),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),f&&(c.__E=c.__=null),c.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fv(n.__e,t,n,r,i,o,a,p);(l=dv.diffed)&&l(t)}catch(e){t.__v=null,(p||null!=o)&&(t.__e=s,t.__h=!!p,o[o.indexOf(s)]=null),dv.__e(e,t,n)}}function $v(e,t){dv.__c&&dv.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){dv.__e(e,t.__v)}}))}function Fv(e,t,n,r,i,o,a,s){var p,l,c,u,d=n.props,h=t.props,m=t.type,f=0;if("svg"===m&&(i=!0),null!=o)for(;f<o.length;f++)if((p=o[f])&&(p===e||(m?p.localName==m:3==p.nodeType))){e=p,o[f]=null;break}if(null==e){if(null===m)return document.createTextNode(h);e=i?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,h.is&&h),o=null,s=!1}if(null===m)d===h||s&&e.data===h||(e.data=h);else{if(o=o&&bv.slice.call(e.childNodes),l=(d=n.props||vv).dangerouslySetInnerHTML,c=h.dangerouslySetInnerHTML,!s){if(null!=o)for(d={},u=0;u<e.attributes.length;u++)d[e.attributes[u].name]=e.attributes[u].value;(c||l)&&(c&&(l&&c.__html==l.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||Nv(e,o,null,n[o],r);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||Nv(e,o,t[o],n[o],r)}(e,h,d,i,s),c)t.__k=[];else if(f=t.props.children,Av(e,Array.isArray(f)?f:[f],t,n,r,i&&"foreignObject"!==m,o,a,e.firstChild,s),null!=o)for(f=o.length;f--;)null!=o[f]&&_v(o[f]);s||("value"in h&&void 0!==(f=h.value)&&(f!==e.value||"progress"===m&&!f)&&Nv(e,"value",f,d.value,!1),"checked"in h&&void 0!==(f=h.checked)&&f!==e.checked&&Nv(e,"checked",f,d.checked,!1))}return e}function Vv(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){dv.__e(e,n)}}function Hv(e,t,n){var r,i,o;if(dv.unmount&&dv.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Vv(r,null,t)),n||"function"==typeof e.type||(n=null!=(i=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){dv.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Hv(r[o],t,n);null!=i&&_v(i)}function qv(e,t,n){return this.constructor(e,n)}function Uv(e,t,n){var r,i,o;dv.__&&dv.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],Lv(t,e=(!r&&n||t).__k=Ev(Ov,null,[e]),i||vv,vv,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?bv.slice.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),$v(o,e)}function Gv(e,t){var n={__c:t="__cC"+yv++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(Tv)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}dv={__e:function(e,t){for(var n,r,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),i=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),i=n.__d),i)return n.__E=n}catch(t){e=t}throw e},__v:0},Sv.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=wv({},this.state),"function"==typeof e&&(e=e(wv({},n),this.props)),e&&wv(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),Tv(this))},Sv.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Tv(this))},Sv.prototype.render=Ov,hv=[],mv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mv.__r=0,yv=0;var Wv,Kv,Xv,Yv=0,Zv=[],Jv=dv.__b,Qv=dv.__r,eb=dv.diffed,tb=dv.__c,nb=dv.unmount;function rb(e,t){dv.__h&&dv.__h(Kv,e,Yv||t),Yv=0;var n=Kv.__H||(Kv.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ib(e){return Yv=1,ob(fb,e)}function ob(e,t,n){var r=rb(Wv++,2);return r.t=e,r.__c||(r.__=[n?n(t):fb(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=Kv),r.__}function ab(e,t){var n=rb(Wv++,3);!dv.__s&&mb(n.__H,t)&&(n.__=e,n.__H=t,Kv.__H.__h.push(n))}function sb(e){return Yv=5,pb((function(){return{current:e}}),[])}function pb(e,t){var n=rb(Wv++,7);return mb(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function lb(e){var t=Kv.context[e.__c],n=rb(Wv++,9);return n.__c=e,t?(null==n.__&&(n.__=!0,t.sub(Kv)),t.props.value):e.__}function cb(){Zv.forEach((function(e){if(e.__P)try{e.__H.__h.forEach(db),e.__H.__h.forEach(hb),e.__H.__h=[]}catch(t){e.__H.__h=[],dv.__e(t,e.__v)}})),Zv=[]}dv.__b=function(e){Kv=null,Jv&&Jv(e)},dv.__r=function(e){Qv&&Qv(e),Wv=0;var t=(Kv=e.__c).__H;t&&(t.__h.forEach(db),t.__h.forEach(hb),t.__h=[])},dv.diffed=function(e){eb&&eb(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==Zv.push(t)&&Xv===dv.requestAnimationFrame||((Xv=dv.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),ub&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ub&&(t=requestAnimationFrame(n))})(cb)),Kv=void 0},dv.__c=function(e,t){t.some((function(e){try{e.__h.forEach(db),e.__h=e.__h.filter((function(e){return!e.__||hb(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],dv.__e(n,e.__v)}})),tb&&tb(e,t)},dv.unmount=function(e){nb&&nb(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(db)}catch(e){dv.__e(e,t.__v)}};var ub="function"==typeof requestAnimationFrame;function db(e){var t=Kv;"function"==typeof e.__c&&e.__c(),Kv=t}function hb(e){var t=Kv;e.__c=e.__(),Kv=t}function mb(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function fb(e,t){return"function"==typeof t?t(e):t}
8
+ var Xa=n((function(e){!function(t,n,r,i){var o,a=["","webkit","Moz","MS","ms","o"],s=n.createElement("div"),p=Math.round,l=Math.abs,c=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return!!Array.isArray(e)&&(h(e,n[t],n),!0)}function h(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(e,n,r){var i="DEPRECATED METHOD: "+n+"\n"+r+" AT \n";return function(){var n=new Error("get-stack-trace"),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,i,r),e.apply(this,arguments)}}o="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m((function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),y=m((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function g(e,t,n){var r,i=t.prototype;(r=e.prototype=Object.create(i)).constructor=e,r._super=i,n&&o(r,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return"function"==typeof e?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function w(e,t,n){h(O(t),(function(t){e.addEventListener(t,n,!1)}))}function _(e,t,n){h(O(t),(function(t){e.removeEventListener(t,n,!1)}))}function E(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function P(e,t){return e.indexOf(t)>-1}function O(e){return e.trim().split(/\s+/g)}function S(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function k(e){return Array.prototype.slice.call(e,0)}function C(e,t,n){for(var r=[],i=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];S(i,a)<0&&r.push(e[o]),i[o]=a,o++}return n&&(r=t?r.sort((function(e,n){return e[t]>n[t]})):r.sort()),r}function T(e,t){for(var n,r,o=t[0].toUpperCase()+t.slice(1),s=0;s<a.length;){if((r=(n=a[s])?n+o:t)in e)return r;s++}return i}var M=1;function A(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}var R="ontouchstart"in t,D=T(t,"PointerEvent")!==i,z=R&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),j="touch",N="mouse",B=24,I=["x","y"],L=["clientX","clientY"];function $(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function F(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=1&t&&r-o==0,s=12&t&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=V(t));o>1&&!n.firstMultiple?n.firstMultiple=V(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,p=s?s.center:a.center,u=t.center=H(r);t.timeStamp=c(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=W(p,u),t.distance=G(p,u),function(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y});t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}(n,t),t.offsetDirection=U(t.deltaX,t.deltaY);var d=q(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=l(d.x)>l(d.y)?d.x:d.y,t.scale=s?(h=s.pointers,m=r,G(m[0],m[1],L)/G(h[0],h[1],L)):1,t.rotation=s?function(e,t){return W(t[1],t[0],L)+W(e[1],e[0],L)}(s.pointers,r):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,r,o,a,s=e.lastInterval||t,p=t.timeStamp-s.timeStamp;if(8!=t.eventType&&(p>25||s.velocity===i)){var c=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,d=q(p,c,u);r=d.x,o=d.y,n=l(d.x)>l(d.y)?d.x:d.y,a=U(c,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var h,m;var f=e.element;E(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function V(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:c(),pointers:t,center:H(t),deltaX:e.deltaX,deltaY:e.deltaY}}function H(e){var t=e.length;if(1===t)return{x:p(e[0].clientX),y:p(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:p(n/t),y:p(r/t)}}function q(e,t,n){return{x:t/e||0,y:n/e||0}}function U(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function G(e,t,n){n||(n=I);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function W(e,t,n){n||(n=I);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}$.prototype={handler:function(){},init:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(A(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4},X="mousedown",Y="mousemove mouseup";function Z(){this.evEl=X,this.evWin=Y,this.pressed=!1,$.apply(this,arguments)}g(Z,$,{handler:function(e){var t=K[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:j,3:"pen",4:N,5:"kinect"},ee="pointerdown",te="pointermove pointerup pointercancel";function ne(){this.evEl=ee,this.evWin=te,$.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(ee="MSPointerDown",te="MSPointerMove MSPointerUp MSPointerCancel"),g(ne,$,{handler:function(e){var t=this.store,n=!1,r=e.type.toLowerCase().replace("ms",""),i=J[r],o=Q[e.pointerType]||e.pointerType,a=o==j,s=S(t,e.pointerId,"pointerId");1&i&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):12&i&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var re={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",oe="touchstart touchmove touchend touchcancel";function ae(){this.evTarget=ie,this.evWin=oe,this.started=!1,$.apply(this,arguments)}function se(e,t){var n=k(e.touches),r=k(e.changedTouches);return 12&t&&(n=C(n.concat(r),"identifier",!0)),[n,r]}g(ae,$,{handler:function(e){var t=re[e.type];if(1===t&&(this.started=!0),this.started){var n=se.call(this,e,t);12&t&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:e})}}});var pe={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function ce(){this.evTarget=le,this.targetIds={},$.apply(this,arguments)}function ue(e,t){var n=k(e.touches),r=this.targetIds;if(3&t&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(e.changedTouches),s=[],p=this.target;if(o=n.filter((function(e){return E(e.target,p)})),1===t)for(i=0;i<o.length;)r[o[i].identifier]=!0,i++;for(i=0;i<a.length;)r[a[i].identifier]&&s.push(a[i]),12&t&&delete r[a[i].identifier],i++;return s.length?[C(o.concat(s),"identifier",!0),s]:void 0}g(ce,$,{handler:function(e){var t=pe[e.type],n=ue.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:e})}});function de(){$.apply(this,arguments);var e=v(this.handler,this);this.touch=new ce(this.manager,e),this.mouse=new Z(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function he(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,me.call(this,t)):12&e&&me.call(this,t)}function me(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout((function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],o=Math.abs(t-i.x),a=Math.abs(n-i.y);if(o<=25&&a<=25)return!0}return!1}g(de,$,{handler:function(e,t,n){var r=n.pointerType==j,i=n.pointerType==N;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)he.call(this,t,n);else if(i&&fe.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ye=T(s.style,"touchAction"),ge=ye!==i,ve="compute",be="auto",xe="manipulation",we="none",_e="pan-x",Ee="pan-y",Pe=function(){if(!ge)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(r){e[r]=!n||t.CSS.supports("touch-action",r)})),e}();function Oe(e,t){this.manager=e,this.set(t)}Oe.prototype={set:function(e){e==ve&&(e=this.compute()),ge&&this.manager.element.style&&Pe[e]&&(this.manager.element.style[ye]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return h(this.manager.recognizers,(function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(P(e,we))return we;var t=P(e,_e),n=P(e,Ee);if(t&&n)return we;if(t||n)return t?_e:Ee;if(P(e,xe))return xe;return be}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,i=P(r,we)&&!Pe.none,o=P(r,Ee)&&!Pe["pan-y"],a=P(r,_e)&&!Pe["pan-x"];if(i){var s=1===e.pointers.length,p=e.distance<2,l=e.deltaTime<250;if(s&&p&&l)return}if(!a||!o)return i||o&&6&n||a&&n&B?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function ke(e){this.options=o({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Ce(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Te(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Me(e,t){var n=t.manager;return n?n.get(e):e}function Ae(){ke.apply(this,arguments)}function Re(){Ae.apply(this,arguments),this.pX=null,this.pY=null}function De(){Ae.apply(this,arguments)}function ze(){ke.apply(this,arguments),this._timer=null,this._input=null}function je(){Ae.apply(this,arguments)}function Ne(){Ae.apply(this,arguments)}function Be(){ke.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ie(e,t){return(t=t||{}).recognizers=x(t.recognizers,Ie.defaults.preset),new Le(e,t)}ke.prototype={defaults:{},set:function(e){return o(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Me(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,"dropRecognizeWith",this)||(e=Me(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(d(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Me(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,"dropRequireFailure",this))return this;e=Me(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<8&&r(t.options.event+Ce(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=8&&r(t.options.event+Ce(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=o({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},g(Ae,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,r=6&t,i=this.attrTest(e);return r&&(8&n||!i)?16|t:r||i?4&n?8|t:2&t?4|t:2:Se}}),g(Re,Ae,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(Ee),e&B&&t.push(_e),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,o=e.deltaX,a=e.deltaY;return i&t.direction||(6&t.direction?(i=0===o?1:o<0?2:4,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?1:a<0?8:16,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return Ae.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=Te(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(De,Ae,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[we]},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)}}),g(ze,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[be]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||12&e.eventType&&!i)this.reset();else if(1&e.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}}),g(je,Ae,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),g(Ne,Ae,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Re.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return 30&n?t=e.overallVelocity:6&n?t=e.overallVelocityX:n&B&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Te(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Be,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(r&&i&&n){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||G(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=u((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=u((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ie.VERSION="2.0.7",Ie.defaults={domEvents:!1,touchAction:ve,enable:!0,inputTarget:null,inputClass:null,preset:[[je,{enable:!1}],[De,{enable:!1},["rotate"]],[Ne,{direction:6}],[Re,{direction:6},["swipe"]],[Be],[Be,{event:"doubletap",taps:2},["tap"]],[ze]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Le(e,t){var n;this.options=o({},Ie.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||(D?ne:z?ce:R?de:Z))(n,F),this.touchAction=new Oe(this,this.options.touchAction),$e(this,!0),h(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 $e(e,t){var n,r=e.element;r.style&&(h(e.options.cssProps,(function(i,o){n=T(r.style,o),t?(e.oldCssProps[n]=r.style[n],r.style[n]=i):r.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}Le.prototype={set:function(e){return o(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 r=this.recognizers,i=t.curRecognizer;(!i||i&&8&i.state)&&(i=t.curRecognizer=null);for(var o=0;o<r.length;)n=r[o],2===t.stopped||i&&n!=i&&!n.canRecognizeWith(i)?n.reset():n.recognize(e),!i&&14&n.state&&(i=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(d(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=S(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return h(O(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==i){var n=this.handlers;return h(O(e),(function(e){t?n[e]&&n[e].splice(S(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var r=n.createEvent("Event");r.initEvent(e,!0,!0),r.gesture=t,t.target.dispatchEvent(r)}(e,t);var r=this.handlers[e]&&this.handlers[e].slice();if(r&&r.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var i=0;i<r.length;)r[i](t),i++}},destroy:function(){this.element&&$e(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},o(Ie,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:B,DIRECTION_ALL:30,Manager:Le,Input:$,TouchAction:Oe,TouchInput:ce,MouseInput:Z,PointerEventInput:ne,TouchMouseInput:de,SingleTouchInput:ae,Recognizer:ke,AttrRecognizer:Ae,Tap:Be,Pan:Re,Swipe:Ne,Pinch:De,Rotate:je,Press:ze,on:w,off:_,each:h,merge:y,extend:f,assign:o,inherit:g,bindFn:v,prefixed:T}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=Ie,e.exports?e.exports=Ie:t.Hammer=Ie}(window,document)})),Ya=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function Za(e,t){return t.get(e,!1)}function Ja(e){e.preventDefault(),"function"==typeof e.stopPropagation?e.stopPropagation():e.srcEvent&&"function"==typeof e.srcEvent.stopPropagation&&e.srcEvent.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function Qa(e){function t(t){setTimeout((function(){_(Ya,(function(t){ue.unbind(e,t,Ja,!0)}))}),500)}ue.bind(e,"touchstart",(function(t){_(Ya,(function(t){ue.bind(e,t,Ja,!0)}))}),!0),ue.bind(e,"touchend",t,!0),ue.bind(e,"touchcancel",t,!0);var n=new Xa.Manager(e,{inputClass:Xa.TouchInput,recognizers:[],domEvents:!0}),r=new Xa.Tap,i=new Xa.Pan({threshold:10}),o=new Xa.Press,a=new Xa.Pinch,s=new Xa.Tap({event:"doubletap",taps:2});return a.requireFailure(i),a.requireFailure(o),n.add([i,o,a,s,r]),n.reset=function(e){var t=this.recognizers,r=this.session;r.stopped||(n.stop(e),setTimeout((function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;r.curRecognizer=null}),0))},n.on("hammer.input",(function(e){e.srcEvent.defaultPrevented&&n.reset(!0)})),n}function es(e,t,n,r,i){var o,a=Za("dragging",e),s=Za("move",e),p=Za("contextPad",e),l=Za("palette",e);function c(e,t){return function(n){var o=u(n.target),a=o&&r.get(o);return t&&(n.srcEvent.button=t),i.fire(e,n,a)}}function u(e){return se(e,"svg, .djs-element",!0)}function d(e){function n(e){var n=u(e.target),i=n&&r.get(n);if(s&&t.getRootElement()!==i)return s.start(e,i,!0);!function(e){var n=0,r=0;function i(e){var i=e.deltaX-n,o=e.deltaY-r;t.scroll({dx:i,dy:o}),n=e.deltaX,r=e.deltaY}function a(e){o.off("panmove",i),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",i),o.on("panend",a),o.on("pancancel",a)}()}(o=Qa(e)).on("tap",c("element.click")),o.on("doubletap",c("element.dblclick",1)),o.on("panstart",n),o.on("press",n),o.on("pinchstart",(function(e){var n=t.zoom(),r=e.center;function i(e){var i=1-(1-e.scale)/1.5,o=Math.max(.2,Math.min(4,i*n));t.zoom(o,r),Ja(e)}function a(e){o.off("pinchmove",i),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",i),o.on("pinchend",a),o.on("pinchcancel",a)}))}a&&n.on("drag.move",(function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=Eo(t),i=u(document.elementFromPoint(n.x,n.y)),o=i&&r.get(i);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:i}),e.hover=o,e.hoverGfx=i))}})),p&&n.on("contextPad.create",(function(e){var t=Qa(e.pad.html);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)}))})),l&&n.on("palette.create",(function(e){var t=Qa(e.container);t.on("panstart",(function(e){l.trigger("dragstart",e,!0)})),t.on("press",(function(e){l.trigger("dragstart",e,!0)})),t.on("tap",(function(e){l.trigger("click",e)}))})),n.on("canvas.init",(function(e){d(e.svg)}))}function ts(e,t){var n=this;t.on("canvas.init",(function(e){n.addBBoxMarker(e.svg)}))}es.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],ts.$inject=["canvas","eventBus"],ts.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Ie("rect");Oe(n,{x:-1e4,y:1e4,width:10,height:10}),Oe(n,t),_e(e,n);var r=Ie("rect");Oe(r,{x:1e4,y:1e4,width:10,height:10}),Oe(r,t),_e(e,r)};var ns={__depends__:[{__depends__:[Ao],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",es],touchFix:["type",ts]}]};function rs(e){return e&&e[e.length-1]}function is(e){return e.y}function os(e){return e.x}var as={left:os,center:os,right:function(e){return e.x+e.width},top:is,middle:is,bottom:function(e){return e.y+e.height}};function ss(e){this._modeling=e}ss.$inject=["modeling"],ss.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ss.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ss.prototype._alignmentPosition=function(e,t){var n,r,i,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,p={},l={},c=!1;if(this._isType(e,["left","top"]))p[e]=t[0][a];else if(this._isType(e,["right","bottom"]))i=rs(t),p[e]=i[a]+i[s];else if(this._isType(e,["center","middle"])){if(_(t,(function(e){var t=e[a]+Math.round(e[s]/2);l[t]?l[t].elements.push(e):l[t]={elements:[e],center:t}})),n=z(l,(function(e){return e.elements.length>1&&(c=!0),e.elements.length})),c)return p[e]=rs(n).center,p;r=t[0],i=rs(t=z(t,(function(e){return e[a]+e[s]}))),p[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(r,i)}return p},ss.prototype.trigger=function(e,t){var n=this._modeling,r=w(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(!(r.length<2)){var i=z(r,as[t]),o=this._alignmentPosition(t,i);n.alignElements(i,o)}};var ps={__init__:["alignElements"],alignElements:["type",ss]};function ls(e,t,n,r){for(var i;i=us(e,n,t);)n=r(t,n,i);return n}function cs(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var a=e[o];if(a){var s="x"===o?"width":"height",p=a.margin,l=a.minDistance;i[o]=p<0?Math.min(r[o]+p-t[s]/2,n[o]-l+p):Math.max(r[o]+r[s]+p+t[s]/2,n[o]+l+p)}})),i}}function us(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return b(function(e){var t=ds(e);e.host&&(t=t.concat(ds(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(ds(t))}),[])));return t}(e),(function(e){return e!==n&&"intersect"===yn(e,r,10)}))}function ds(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function hs(){return!0}function ms(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||50,i=fn(e);return{x:hn(e).right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),a=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:a}),a}}function fs(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ms.$inject=["eventBus","modeling","canvas"],fs.$inject=["eventBus","selection"];var ys={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ms],autoPlaceSelectionBehavior:["type",fs]};function gs(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(_i(e,t))return e;return null}function vs(e,t){return wi(t,"bpmn:TextAnnotation")?function(e,t){var n=hn(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};return ls(e,t,r,cs({y:{margin:-30,minDistance:20}}))}(e,t):_i(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=hn(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return ls(e,t,r,cs({x:{margin:30,minDistance:30}}))}(e,t):wi(t,"bpmn:FlowNode")?function(e,t){var n=hn(e),r=fn(e),i=function(e,t){t||(t={});var n=t.defaultDistance||50,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},a=t.maxDistance||250,s=t.reference||"start";function p(e,t){return"n"===r?"start"===s?hn(e).top-hn(t).bottom:"center"===s?hn(e).top-fn(t).y:hn(e).top-hn(t).top:"w"===r?"start"===s?hn(e).left-hn(t).right:"center"===s?hn(e).left-fn(t).x:hn(e).left-hn(t).left:"s"===r?"start"===s?hn(t).top-hn(e).bottom:"center"===s?fn(t).y-hn(e).bottom:hn(t).bottom-hn(e).bottom:"start"===s?hn(t).left-hn(e).right:"center"===s?fn(t).x-hn(e).right:hn(t).right-hn(e).right}i||(i=hs);var l=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?p(t.source,e):p(e,t.source);return{id:t.source.id,distance:r,weight:n}})),c=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?p(e,t.target):p(t.target,e);return{id:t.target.id,distance:r,weight:n}}));return P(l.concat(c).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>a||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{}).distance||n}(e,{filter:function(e){return wi(e,"bpmn:SequenceFlow")}}),o=30,a=80,s="left";wi(e,"bpmn:BoundaryEvent")&&-1!==(s=yn(e,e.host,-25)).indexOf("top")&&(o*=-1);var p={x:n.right+i+t.width/2,y:r.y+bs(s,a)};return ls(e,t,p,cs({y:{margin:o,minDistance:a}}))}(e,t):void 0}function bs(e,t){return-1!=e.indexOf("top")?-1*t:-1!=e.indexOf("bottom")?t:0}function xs(e){e.on("autoPlace",(function(e){var t=e.shape;return vs(e.source,t)}))}xs.$inject=["eventBus"];var ws={__depends__:[ys],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",xs]};function _s(e,t,n,r){Yo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var i=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,o=t.parent||t.newParent;!1!==n.autoResize&&i._expand([r],o)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=a(M(t.closure.topLevel)),r=t.hints,o=!r||r.autoResize;!1!==o&&_(A(n,(function(e){return e.parent.id})),(function(e,t){d(o)&&(e=e.filter((function(e){return b(o,j({id:e.id}))}))),i._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||i._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,o=r.parent;n&&!1===n.autoResize||o&&i._expand([r],o)}))}function Es(e){e.invoke(_s,this)}function Ps(e){Yo.call(this,e),this.init()}function Os(e){Ps.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Ss(e,t){Os.call(this,e),this._modeling=t}_s.$inject=["eventBus","elementRegistry","modeling","rules"],r(_s,Yo),_s.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=hn(yt(e)),o=hn(t),a={};return i.top-o.top<r.top&&(a.top=i.top-n.top),i.left-o.left<r.left&&(a.left=i.left-n.left),o.right-i.right<r.right&&(a.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(a.bottom=i.bottom+n.bottom),mn(q({},o,a))},_s.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=hn(e),t=hn(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}(W(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},_s.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},_s.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},_s.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Es.$inject=["injector"],r(Es,_s),Es.prototype.resize=function(e,t,n){wi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},Ps.$inject=["eventBus"],r(Ps,Yo),Ps.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},Ps.prototype.init=function(){},Os.$inject=["eventBus"],r(Os,Ps),Os.prototype.canResize=function(e,t){return!1},r(Ss,Os),Ss.$inject=["eventBus","modeling"],Ss.prototype.canResize=function(e,t){if(wi(t.di,"bpmndi:BPMNPlane"))return!1;if(!wi(t,"bpmn:Participant")&&!wi(t,"bpmn:Lane")&&!wi(t,"bpmn:SubProcess"))return!1;var n=!0;return _(e,(function(e){(wi(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)})),n};var ks={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Es],bpmnAutoResizeProvider:["type",Ss]};function Cs(e,t,n){var r,i,o=this,a=n.get("dragging",!1);a&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),a.hover({element:i,gfx:r}),a.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=Eo(e),function(e){return se(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Cs.$inject=["elementRegistry","eventBus","injector"];var Ts={__init__:["hoverFix"],hoverFix:["type",Cs]},Ms=Math.round,As="djs-drag-active";function Rs(e){e.preventDefault()}function Ds(e,t,n,r){var i,o={threshold:5,trapClick:!0};function a(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function s(t,n){n=n||i;var r=e.createEvent(q({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function p(e,r){var o,p=i.payload,l=i.displacement,c=i.globalStart,u=Eo(e),d=La(u,c),h=i.localStart,m=a(u),y=La(m,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(q(p,{x:Ms(h.x+l.x),y:Ms(h.y+l.y),dx:0,dy:0},{originalEvent:e}),!1===s("start"))return f();i.active=!0,i.keepSelection||(p.previousSelection=n.get(),n.select(null)),i.cursor&&ja(i.cursor),t.addMarker(t.getRootElement(),As)}_o(e),i.active&&(q(p,{x:Ms(m.x+l.x),y:Ms(m.y+l.y),dx:Ms(y.x),dy:Ms(y.y)},{originalEvent:e}),s("move"))}function l(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,_o(e)),t=s("end")),!1===t&&s("rejected"),s("ended",y(!0!==t))}function c(e){27===e.which&&(Rs(e),f())}function u(t){var n;i.active&&(n=Ba(e),setTimeout(n,400),Rs(t)),l(t)}function d(e){p(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,s("hover")}function m(e){s("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function f(e){var t;if(i){var n=i.active;n&&s("cancel"),t=y(e),n&&s("canceled",t)}}function y(o){var a,y;s("cleanup"),Na(),y=i.trapClick?u:l,ue.unbind(document,"mousemove",p),ue.unbind(document,"dragstart",Rs),ue.unbind(document,"selectstart",Rs),ue.unbind(document,"mousedown",y,!0),ue.unbind(document,"mouseup",y,!0),ue.unbind(document,"keyup",c),ue.unbind(document,"touchstart",d,!0),ue.unbind(document,"touchcancel",f,!0),ue.unbind(document,"touchmove",p,!0),ue.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),As);var g=i.payload.previousSelection;return!1!==o&&g&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(g),a=i,i=null,a}e.on("diagram.destroy",f),this.init=function(t,n,r,y){i&&f(!1),"string"==typeof n&&(y=r,r=n,n=null);var g,v,b,x,w,_=(y=q({},o,y||{})).data||{};x=y.trapClick?u:l,t?(g=wo(t)||t,v=Eo(t),_o(t),"dragstart"===g.type&&Rs(g)):(g=null,v={x:0,y:0}),b=a(v),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(g),i=q({prefix:r,data:_,payload:{},globalStart:v,displacement:La(n,b),localStart:b,isTouch:w},y),y.manual||(w?(ue.bind(document,"touchstart",d,!0),ue.bind(document,"touchcancel",f,!0),ue.bind(document,"touchmove",p,!0),ue.bind(document,"touchend",l,!0)):(ue.bind(document,"mousemove",p),ue.bind(document,"dragstart",Rs),ue.bind(document,"selectstart",Rs),ue.bind(document,"mousedown",x,!0),ue.bind(document,"mouseup",x,!0)),ue.bind(document,"keyup",c),e.on("element.hover",h),e.on("element.out",m)),s("init"),y.autoActivate&&p(t,!0)},this.move=p,this.hover=h,this.out=m,this.end=l,this.cancel=f,this.context=function(){return i},this.setOptions=function(e){q(o,e)}}Ds.$inject=["eventBus","canvas","selection","elementRegistry"];var zs={__depends__:[Ts,$o],dragging:["type",Ds]};function js(e,t,n){this._canvas=n,this._opts=q({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 Ns(e,t,n){return t<e&&e<n}js.$inject=["config.autoScroll","eventBus","canvas"],js.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var a=0,s=0,p=0;p<4;p++)Ns(o[p],n.scrollThresholdOut[p],n.scrollThresholdIn[p])&&(0===p?a=n.scrollStep:1==p?s=n.scrollStep:2==p?a=-n.scrollStep:3==p&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},js.prototype.stopScroll=function(){clearTimeout(this._scrolling)},js.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},js.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Eo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Bs={__depends__:[zs],__init__:["autoScroll"],autoScroll:["type",js]};function Is(e){this._commandStack=e.get("commandStack",!1)}Is.$inject=["injector"],Is.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Ls={__init__:["rules"],rules:["type",Is]},$s=Math.round,Fs=Math.max;function Vs(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Ot(r,t)<=10)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=cn(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,10),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],a=i[i.length-1];return o?o!==a?o.segment2!==a.segment2?{point:e[r=Fs(o.segment2,a.segment2)-1],bendpoint:!0,index:r}:{point:{x:$s(o.x+a.x)/2,y:$s(o.y+a.y)/2},index:o.segment2}:{point:{x:$s(o.x),y:$s(o.y)},index:o.segment2}:null}(e,t)}var Hs="djs-bendpoint",qs="djs-segment-dragger";function Us(e,t,n){return Vs(t,function(e,t){var n,r=Eo(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n))}function Gs(e,t){var n=Ie("g");Me(n).add(Hs),_e(e,n);var r=Ie("circle");Oe(r,{cx:0,cy:0,r:4}),Me(r).add("djs-visual"),_e(n,r);var i=Ie("circle");return Oe(i,{cx:0,cy:0,r:10}),Me(i).add("djs-hit"),_e(n,i),t&&Me(n).add(t),n}function Ws(e,t,n,r){var i=Ie("g");_e(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Xs("h"===n?r:i)}(t,n,r),a=Ie("rect");Oe(a,{x:-7,y:-1.5,width:14,height:3}),Me(a).add("djs-visual"),_e(i,a);var s=Ie("rect");return Oe(s,{x:-o/2,y:-7,width:o,height:14}),Me(s).add("djs-hit"),_e(i,s),Xn(i,"v"===r?90:0),i}function Ks(e,t,n){var r=Ie("g"),i=Tt(t,n),o=kt(t,n);return _e(e,r),Ws(r,t,n,o),Me(r).add(qs),Me(r).add("h"===o?"horizontal":"vertical"),Kn(r,i.x,i.y),r}function Xs(e){return Math.abs(Math.round(2*e/3))}function Ys(e,t,n,r,i){function o(e,n){var o=n.waypoints,a=Us(t,o,e);if(a)return!function(e,t,n){var r,i,o,a,s,p,l=e.index,c=e.point;return!(l<=0||e.bendpoint)&&(o=Tt(r=t[l-1],i=t[l]),a=kt(r,i),s=Math.abs(c.x-o.x),p=Math.abs(c.y-o.y),a&&s<=n&&p<=n)}(a,o,function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=kt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Xs("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a))?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function a(e,t,r){ue.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function s(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Qo(e.id)+'"]',r);return!i&&n&&(Oe(i=Ie("g"),{"data-element-id":e.id}),Me(i).add("djs-bendpoints"),_e(r,i),a(i,"mousedown",e),a(i,"click",e),a(i,"dblclick",e)),i}function p(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function l(e,t){t.waypoints.forEach((function(t,n){var r=Gs(e);_e(e,r),Kn(r,t.x,t.y)})),Gs(e,"floating")}function c(e,t){for(var n,r,i,o=t.waypoints,s=1;s<o.length;s++)kt(n=o[s-1],r=o[s])&&(Oe(i=Ks(e,n,r),{"data-segment-idx":s}),a(i,"mousemove",t))}function u(e){var t=s(e);return t||(l(t=s(e,!0),e),c(t,e)),t}function d(e){var t=s(e);t&&(!function(e){_(be(".djs-segment-dragger",e),(function(e){Re(e)}))}(t),function(e){_(be(".djs-bendpoint",e),(function(e){Re(e)}))}(t),c(t,e),l(t,e))}function h(e,t,n){var r,i,o=p(t.index,e),a=n[t.index-1],s=n[t.index],l=t.point,c=Tt(a,s),u=kt(a,s);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:l.x-c.x,y:l.y-c.y},"v"===u&&(i={x:i.y,y:i.x}),Kn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=s(e.element);t&&Re(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Me(t).add(e.marker):Me(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=s(i,!0),!(r=Us(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Kn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(Oo(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=s(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=s,this.getSegmentDragger=p}Ys.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Zs=Math.round,Js="reconnectStart",Qs="reconnectEnd",ep="updateWaypoints";function tp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,a){var s,p=n.getGraphics(t),l=t.source,c=t.target,u=t.waypoints,d=(s=a||0!==o?a||o!==u.length-1?ep:Qs:Js)===ep?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:l,target:c});!1===h&&(h=i.allowed(d,{connection:t,source:c,target:l})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:p,context:{allowed:h,bendpointIndex:o,connection:t,source:l,target:c,insert:a,type:s}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,a=r.target,s=e.hover,p=n.type;if(n.hover=s,s){var l=p===ep?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(l,{connection:r,source:p===Js?s:o,target:p===Qs?s:a}))return n.source=p===Js?s:o,void(n.target=p===Qs?s:a);!1===t&&(t=n.allowed=i.allowed(l,{connection:r,source:p===Qs?s:a,target:p===Js?s:o})),t&&(n.source=p===Qs?s:a,n.target=p===Js?s:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==ep&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,a=t.insert,s=i.waypoints.slice(),p=t.source,l=t.target,c=t.type,u=t.hints||{},d={x:Zs(e.x),y:Zs(e.y)};if(!n)return!1;c===ep?(a?s.splice(r,0,d):s[r]=d,u.bendpointMove={insert:a,bendpointIndex:r},s=this.cropWaypoints(i,s),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===Ot(t,r=e[i+1])||St(n,r,t)?e.splice(i,1):i++;return e}(s),u)):(c===Js?(u.docking="source",np(t)&&(u.docking="target",u.newWaypoints=s.reverse())):c===Qs&&(u.docking="target",np(t)&&(u.docking="source",u.newWaypoints=s.reverse())),o.reconnect(i,p,l,d,u))}),this)}function np(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===Js?t&&r&&t===r&&n!==r:i===Qs?t&&n&&t===n&&n!==r:void 0}tp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],tp.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var rp="updateWaypoints",ip="connect-ok",op="connect-not-ok",ap="connect-hover",sp="djs-updating",pp="djs-element-hidden";function lp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,a=i.waypoints,s=a.slice();t.waypoints=a,o&&s.splice(n,0,{x:e.x,y:e.y}),i.waypoints=s,Me(t.draggerGfx=Gs(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,pp),r.addMarker(i,sp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,ap),o===rp)return;n?(r.removeMarker(i,op),r.addMarker(i,ip)):!1===n&&(r.removeMarker(i,ip),r.addMarker(i,op))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,ap),r.removeMarker(n,i?ip:op))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,a=n.draggerGfx,s=n.hover,p=n.type,l=n.connection,c=l.source,u=l.target,d=l.waypoints.slice(),h={x:t.x,y:t.y},m=n.hints||{},f={};i&&(m.connectionStart&&(f.connectionStart=m.connectionStart),m.connectionEnd&&(f.connectionEnd=m.connectionEnd),"reconnectStart"===p?np(n)?(f.connectionEnd=f.connectionEnd||h,f.source=u,f.target=s||c,d=d.reverse()):(f.connectionStart=f.connectionStart||h,f.source=s||c,f.target=u):"reconnectEnd"===p?np(n)?(f.connectionStart=f.connectionStart||h,f.source=s||u,f.target=c,d=d.reverse()):(f.connectionEnd=f.connectionEnd||h,f.source=c,f.target=s||u):(f.noCropping=!0,f.noLayout=!0,d[o]=h),p===rp&&(d=e.cropWaypoints(l,d)),f.waypoints=d,i.drawPreview(n,r,f)),Kn(a,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,a=t.hover,s=t.target,p=t.waypoints;n.waypoints=p,Re(o),r.removeMarker(n,sp),r.removeMarker(n,pp),a&&(r.removeMarker(a,ip),r.removeMarker(a,s?ip:op)),i&&i.cleanUp(t)}))}lp.$inject=["bendpointMove","injector","eventBus","canvas"];var cp="connect-hover",up="djs-updating";function dp(e,t,n){return hp(e,t,e[t]+n)}function hp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function mp(e){return"x"===e?"y":"x"}function fp(e,t,n){var r,i;return e.original?e.original:(r=fn(t),hp(e,i=mp(n),r[i]))}function yp(e,t,n,r,i,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,r=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=r,n}function p(e){i.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return hp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],mp(e.axis));Kn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,a,s,p,l=n.getGraphics(t),c=i-1,u=i,d=t.waypoints,h=d[c],m=d[u],f=Us(n,d,e);(a=kt(h,m))&&(s="v"===a?"x":"y",0===c&&(h=fp(h,t.source,s)),u===d.length-1&&(m=fp(m,t.target,s)),o={connection:t,segmentStartIndex:c,segmentEndIndex:u,segmentStart:h,segmentEnd:m,axis:s,dragPosition:p=f?f.point:{x:(h.x+m.x)/2,y:(h.y+m.y)/2}},r.init(e,p,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:l,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Ks(i,t.segmentStart,t.segmentEnd),Me(t.draggerGfx).add("djs-dragging"),n.addMarker(r,up)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,a=r.segmentEndIndex,c=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),m=dp(c,d,e["d"+d]),f=dp(u,d,e["d"+d]),y=h.length,g=0;h[o]=m,h[a]=f,o<2&&(t=yn(i.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,g--):"intersect"!==t&&(h.unshift(c),g++)),a>y-3&&(n=yn(i.target,f),a===y-2?"intersect"===n&&(h.pop(),h[h.length-1]=f):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=s(i,h),l(r,g,e),r.newSegmentStartIndex=o+g,p(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,cp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,cp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Re(t.draggerGfx),n.removeMarker(r,up)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex,a=function(e,t){var n=0;return{waypoints:e.filter((function(r,i){return!St(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)})),segmentOffset:n}}(r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}})),i),p=s(n,a.waypoints),l=a.segmentOffset,c={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+l}};o.updateWaypoints(n,p,c)}))}yp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var gp=Math.abs,vp=Math.round;function bp(e){return{x:e.x,y:e.y}}function xp(e){return{x:e.x+e.width,y:e.y+e.height}}function wp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:vp(e.x+e.width/2),y:vp(e.y+e.height/2)}}function _p(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Ep(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 r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Pp(e){return e.children||[]}var Op=Math.abs,Sp=Math.round;function kp(e){function t(e,t){if(d(e)){for(var n=e.length;n--;)if(Op(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e){if(e.width)return{x:Sp(e.width/2+e.x),y:Sp(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.snapPoints,r=e.connection,i=r.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,p=e.segmentEndIndex,l=e.axis;if(t)return t;var c=[i[a-1],o,s,i[p+1]];return a<2&&c.unshift(n(r.source)),p>i.length-3&&c.unshift(n(r.target)),e.snapPoints=t={horizontal:[],vertical:[]},_(c,(function(e){e&&(e=e.original||e,"y"===l&&t.horizontal.push(e.y),"x"===l&&t.vertical.push(e.x))})),t}(e.context),a=e.x,s=e.y;if(o){var p=a-(r=t(o.vertical,a)),l=s-(i=t(o.horizontal,s));q(e,{dx:e.dx-p,dy:e.dy-l,x:r,y:i}),(p||-1!==o.vertical.indexOf(a))&&Ep(e,"x",r),(l||-1!==o.horizontal.indexOf(s))&&Ep(e,"y",i)}})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,a=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},_(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),s=o.hover,p=s&&n(s),l=e.x,c=e.y;if(a){var u=l-(r=t(p?a.vertical.concat([p.x]):a.vertical,l)),d=c-(i=t(p?a.horizontal.concat([p.y]):a.horizontal,c));q(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==a.vertical.indexOf(l))&&Ep(e,"x",r),(d||-1!==a.horizontal.indexOf(c))&&Ep(e,"y",i)}}))}kp.$inject=["eventBus"];var Cp={__depends__:[zs,Ls],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ys],bendpointMove:["type",tp],bendpointMovePreview:["type",lp],connectionSegmentMove:["type",yp],bendpointSnapping:["type",kp]};function Tp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!u(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);u(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},a=t.source,s=t.target;if(!r)return!1;var p=null,l={connectionStart:Mp(t)?o:i,connectionEnd:Mp(t)?i:o};h(r)&&(p=r),n.connect(a,s,p,l)})),this.start=function(e,n,r,i){h(r)||(i=r,r=fn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Mp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Tp.$inject=["eventBus","dragging","modeling","rules"];var Ap="connect-ok",Rp="connect-not-ok";function Dp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,a=t.start,s=t.startPosition,p=t.target,l=t.connectionStart||s,c=t.connectionEnd||{x:e.x,y:e.y},u=l,d=c;Mp(t)&&(u=c,d=l),r.drawPreview(t,n,{source:o||a,target:p||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Ap:Rp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Ap),n.removeMarker(t,Rp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}Dp.$inject=["injector","eventBus","canvas"];var zp={__depends__:[$o,Ls,zs],__init__:["connectPreview"],connect:["type",Tp],connectPreview:["type",Dp]};function jp(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}jp.$inject=["injector","canvas","graphicsFactory","elementFactory"],jp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,a=n.source,s=n.target,p=n.waypoints,l=n.connectionStart,c=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,m=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),De(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return m.getConnection(e,t,n)}))),t&&(r=o(t,a,s)),r?(r.waypoints=p||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:a,target:s,connectionStart:l,connectionEnd:c,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[a?fn(a):l,s?fn(s):c]),this._connectionDocking&&(a||s)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,a,s)),this._graphicsFactory.drawConnection(i,r)):!h&&this.drawNoopPreview(i,n)},jp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||fn(n),o=t.connectionEnd||fn(r),a=this.cropWaypoints(i,o,n,r);_e(e,this.createNoopConnection(a[0],a[1]))},jp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),a=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return[e=n&&gn(o,s,!0)||e,t=r&&gn(a,s,!1)||t]},jp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Re(e.connectionPreviewGfx)},jp.prototype.getConnection=function(e){var t=function(e){return h(e)?e:{}}(e);return this._elementFactory.createConnection(t)},jp.prototype.createConnectionPreviewGfx=function(){var e=Ie("g");return Oe(e,{pointerEvents:"none"}),Me(e).add("djs-connection-preview"),_e(this._canvas.getActiveLayer(),e),e},jp.prototype.createNoopConnection=function(e,t){var n=Ie("polyline");return Oe(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),Oe(n,{points:[e.x,e.y,t.x,t.y]}),n};var Np={__init__:["connectionPreview"],connectionPreview:["type",jp]};function Bp(e,t){return(function(e){return e.originalEvent||e.srcEvent}(e)||e).button===t}function Ip(e){return Bp(e,0)}function Lp(e){for(var t,n="",r=0;t=e[r];r++)n+=t.x+","+t.y+" ";return n}function $p(e){return!0}function Fp(e){return Ip(e)||function(e){return Bp(e,1)}(e)}function Vp(e,t,n){var r=this;function i(n,r,i){var o,a;(function(e,t){return!(p[e]||Ip)(t)})(n,r)||(i?a=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(a=o,i=t.get(a)),a&&i&&!1===e.fire(n,{element:i,gfx:a,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},p={"element.contextmenu":$p,"element.mousedown":Fp,"element.mouseup":Fp,"element.click":Fp,"element.dblclick":Fp};function l(e,t,n,r){var a=o[n]=function(e){i(n,e)};r&&(p[n]=r),a.$delegate=me.bind(e,"svg, .djs-element",t,a)}function c(e,t,n){var r=a(n);r&&me.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){var t;t=e.svg,_(s,(function(e,n){c(t,n,e)}))})),e.on("canvas.init",(function(e){var t;t=e.svg,_(s,(function(e,n){l(t,n,e)}))})),e.on(["shape.added","connection.added"],(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:r})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,r=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:r})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;r.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;r.updateDefaultHit(t,n)}));var u=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),h={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:u};function m(e,t){return t=q({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function f(e,t){var n=h[t];if(!n)throw new Error("invalid hit type <"+t+">");return Oe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){_(be(".djs-hit",e),Re)},this.createDefaultHit=function(e,t){var n,r=e.waypoints,i=e.isFrame;return r?this.createWaypointsHit(t,r):(n=i?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n,r,i,o=(n=t,Oe(i=Ie("polyline"),{points:Lp(n)}),r&&Oe(i,r),i);return f(o,"stroke"),y(e,o),o},this.createBoxHit=function(e,t,n){n=q({x:0,y:0},n);var r=Ie("rect");return f(r,t),Oe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?function(e,t){Oe(e,{points:Lp(t)})}(n,e.waypoints):Oe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=s[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=c}Vp.$inject=["eventBus","elementRegistry","styles"];var Hp={__init__:["interactionEvents"],interactionEvents:["type",Vp]},qp=Math.min,Up=Math.max;function Gp(e){e.preventDefault()}function Wp(e){e.stopPropagation()}function Kp(e){this.container=e.container,this.parent=fe('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=F(this.autoResize,this),this.handlePaste=F(this.handlePaste,this)}function Xp(e,t){this._eventBus=e,this._providers=[],this._textbox=new Kp({container:t.getContainer(),keyHandler:F(this._handleKey,this),resizeHandler:F(this._handleResize,this)})}Kp.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,a=this.container;r=this.options=r||{};var s=W(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(i.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 p=W(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},p),r.centerVertically&&q(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},p),o.innerText=n,ue.bind(o,"keydown",this.keyHandler),ue.bind(o,"mousedown",Wp),ue.bind(o,"paste",this.handlePaste),r.autoResize&&ue.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),a.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Kp.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Kp.prototype.insertText=function(e){e=e.replace(/\r\n|\r|\n/g,"\n"),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Kp.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,a=i.endContainer,s=i.startOffset,p=i.endOffset,l=i.commonAncestorContainer,c=(t=l.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(l)){var u=o.textContent;o.textContent=u.substring(0,s)+e+u.substring(p),n=o,r=s+e.length}else if(o===this.content&&a===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,c[s]),n=d,r=d.textContent.length}else{var h=c.indexOf(o),m=c.indexOf(a);c.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,s)+e+a.textContent.substring(p):n>h&&n<=m&&xe(t)})),n=o,r=s+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Kp.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 r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Kp.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,p,l,c;n=this.resizeHandle=fe('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Gp(n),Wp(n);var u=qp(Up(l+n.clientX-s,r),o),d=qp(Up(c+n.clientY-p,i),a);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:l,height:c,dx:n.clientX-s,dy:n.clientY-p})},d=function(e){Gp(e),Wp(e),ue.unbind(document,"mousemove",u,!1),ue.unbind(document,"mouseup",d,!1)};ue.bind(n,"mousedown",(function(e){Gp(e),Wp(e),s=e.clientX,p=e.clientY;var n=t.getBoundingClientRect();l=n.width,c=n.height,ue.bind(document,"mousemove",u),ue.bind(document,"mouseup",d)}))}q(n.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"}),t.appendChild(n)},Kp.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ue.unbind(t,"keydown",this.keyHandler),ue.unbind(t,"mousedown",Wp),ue.unbind(t,"input",this.autoResize),ue.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),xe(n)),xe(e)},Kp.prototype.getValue=function(){return this.content.innerText.trim()},Kp.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Kp.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Xp.$inject=["eventBus","canvas"],Xp.prototype.registerProvider=function(e){this._providers.push(e)},Xp.prototype.isActive=function(){return!!this._active},Xp.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Xp.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Xp.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Xp.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Xp.prototype.getValue=function(){return this._textbox.getValue()},Xp.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())},Xp.prototype._handleResize=function(e){this._fire("resize",e)},Xp.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=b(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Yp={__depends__:[Hp],__init__:["directEditing"],directEditing:["type",Xp]},Zp=".entry";function Jp(e,t,n){this._eventBus=t,this._overlays=n;var r=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:r},this._current=null,this._init()}Jp.$inject=["config.contextPad","eventBus","overlays"],Jp.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",(function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()})),e.on("elements.delete",(function(e){_(e.elements,(function(e){t.isOpen(e)&&t.close()}))})),e.on("element.changed",(function(e){var n=e.element,r=t._current;r&&r.element===n&&t.open(n,!0)}))},Jp.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Jp.prototype.getEntries=function(e){var t=this._getProviders(),n={};return _(t,(function(t){var r=t.getContextPadEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))})),n},Jp.prototype.trigger=function(e,t,n){var r,i,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(r=a[Y(s,"data-action")].action,i=t.originalEvent||t,f(r)){if("click"===e)return r(i,o,n)}else if(r[e])return r[e](i,o,n);t.preventDefault()},Jp.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Jp.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Jp.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),r=n.html;_(t,(function(e,t){var n,i=e.group||"default",o=fe(e.html||'<div class="entry" draggable="true"></div>');Y(o,"data-action",t),(n=ve("[data-group="+i+"]",r))||(n=fe('<div class="group" data-group="'+i+'"></div>'),r.appendChild(n)),n.appendChild(o),e.className&&function(e,t){var n=te(e);(d(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(o,e.className),e.title&&Y(o,"title",e.title),e.imageUrl&&o.appendChild(fe('<img src="'+e.imageUrl+'">'))})),te(r).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},Jp.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,r=fe('<div class="djs-context-pad"></div>'),i=q({html:r},this._overlaysConfig);me.bind(r,Zp,"click",(function(e){t.trigger("click",e)})),me.bind(r,Zp,"dragstart",(function(e){t.trigger("dragstart",e)})),ue.bind(r,"mousedown",(function(e){e.stopPropagation()})),this._overlayId=n.add(e,"context-pad",i);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},Jp.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Jp.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Qp={__depends__:[Ao,Wo],contextPad:["type",Jp]},el=["marker-start","marker-mid","marker-end"],tl=["circle","ellipse","line","path","polygon","polyline","rect"];function nl(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){_(i._clonedMarkers,(function(e){Re(e)})),i._clonedMarkers={}}))}nl.$inject=["elementRegistry","eventBus","canvas","styles"],nl.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},nl.prototype.addDragger=function(e,t,n){var r=ze(n=n||this.getGfx(e)),i=n.getBoundingClientRect();return this._cloneMarkers(Gn(r)),Oe(r,this._styles.cls("djs-dragger",[],{x:i.top,y:i.left})),_e(t,r),r},nl.prototype.addFrame=function(e,t){var n=Ie("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return _e(t,n),n},nl.prototype._cloneMarkers=function(e){var t=this;if(e.childNodes)for(var n=0;n<e.childNodes.length;n++)t._cloneMarkers(e.childNodes[n]);(function(e){return-1!==tl.indexOf(e.nodeName)})(e)&&el.forEach((function(n){if(Oe(e,n)){var r=function(e,t,n){return ve("marker#"+(r=Oe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]),n||document);var r}(e,n,t._canvas.getContainer());t._cloneMarker(e,r,n)}}))},nl.prototype._cloneMarker=function(e,t,n){var r=t.id,i=this._clonedMarkers[r];if(!i){var o=r+"-clone";(i=ze(t)).id=o,Me(i).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[r]=i;var a=ve("defs",this._canvas._svg);a||(a=Ie("defs"),_e(this._canvas._svg,a)),_e(a,i)}Oe(e,n,"url(#"+this._clonedMarkers[r].id+")")};var rl={__init__:["previewSupport"],previewSupport:["type",nl]},il="drop-ok",ol="drop-not-ok",al="attach-ok",sl="new-parent",pl="create";function ll(e,t,n,r,i){function o(t,n){[al,il,ol,sl].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function a(){var e=t.context();e&&e.prefix===pl&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,a=t.source,s=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);cl(e);var p={x:e.x,y:e.y},l=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var a=b(e=w(e,(function(t){var n=t.labelTarget;return!(t.parent||function(e){return!!e.labelTarget}(t)&&-1!==e.indexOf(n))})),(function(e){return!ul(e)})),s=!1,p=!1,l=!1;dl(e)&&(s=i.allowed("shape.attach",{position:n,shape:a,target:t})),s||(l=dl(e)?i.allowed("shape.create",{position:n,shape:a,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var c=o.connectionTarget;return l||s?(a&&r&&(p=i.allowed("connection.create",{source:c===r?a:r,target:c===r?r:a,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:p}):(null===l||null===s)&&null}(n,r,p,a,s);r&&null!==l&&(t.target=r,l&&l.attach?o(r,al):o(r,l?sl:ol))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,a=t.target,s=t.canExecute,p=s&&s.attach,l=s&&s.connect,c=t.hints||{};if(!1===s||!a)return!1;cl(e);var u={x:e.x,y:e.y};i=l?r.appendShape(n,i,u,a,{attach:p,connection:!0===l?{}:l,connectionTarget:c.connectionTarget}):b(o=r.createElements(o,u,a,q({},c,{attach:p})),(function(e){return!ul(e)})),q(t,{elements:o,shape:i}),q(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",a),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",a)}))})),this.start=function(e,n,r){d(n)||(n=[n]);var i=b(n,(function(e){return!ul(e)}));if(i){r=q({elements:n,hints:{},shape:i},r||{}),_(n,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var o=yt(w(n,(function(e){return!e.hidden})));_(n,(function(e){ul(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),q(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,pl,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function cl(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)))}function ul(e){return!!e.waypoints}function dl(e){return e&&1===e.length&&!ul(e[0])}ll.$inject=["canvas","dragging","eventBus","modeling","rules"];function hl(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,a=t.context,s=a.elements,p=a.dragGroup;p||(p=a.dragGroup=function(e){var t=Ie("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Ie("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Gn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Gn(i),e),Kn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(s)),o?(p.parentNode||_e(e.getActiveLayer(),p),Kn(p,t.x,t.y)):Re(p)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Re(t)}))}hl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var ml={__depends__:[zs,rl,Ls,$o],__init__:["create","createPreview"],create:["type",ll],createPreview:["type",hl]},fl="data-id",yl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function gl(e,t,n){var r=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:r},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}gl.$inject=["config.popupMenu","eventBus","canvas"],gl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},gl.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._getProviders(t);if(!n)return!0;var r=this._getEntries(e,n),i=this._getHeaderEntries(e,n),o=T(r)>0,a=i&&T(i)>0;return!o&&!a},gl.prototype.open=function(e,t,n){var r=this._getProviders(t);if(!e)throw new Error("Element is missing");if(!r||!r.length)throw new Error("No registered providers for: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close(),this._emit("open");var i=this._current={className:t,element:e,position:n},o=this._getEntries(e,r),a=this._getHeaderEntries(e,r);i.entries=q({},o,a),i.container=this._createContainer(),T(a)&&i.container.appendChild(this._createEntries(a,"djs-popup-header")),T(o)&&i.container.appendChild(this._createEntries(o,"djs-popup-body"));var s=this._canvas.getContainer();this._attachContainer(i.container,s,n.cursor),this._bindAutoClose()},gl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindAutoClose(),xe(this._current.container),this._current.container=null)},gl.prototype.isOpen=function(){return!!this._current.container},gl.prototype.trigger=function(e){e.preventDefault();var t=Y(e.delegateTarget||e.target,fl),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},gl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},gl.prototype._getEntries=function(e,t){var n={};return _(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))}else _(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=K(e,["id"])}))})),n},gl.prototype._getHeaderEntries=function(e,t){var n={};return _(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);f(r)?n=r(n):_(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;_(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("every entry must have the id property set");n[t]=K(e,["id"])}))}})),n},gl.prototype._getEntry=function(e){var t=this._current.entries[e];if(!t)throw new Error("entry not found");return t},gl.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},gl.prototype._createContainer=function(){var e=fe('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return q(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),te(e).add(n),e},gl.prototype._attachContainer=function(e,t,n){var r=this;me.bind(e,".entry","click",(function(e){r.trigger(e)})),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n)},gl.prototype._updateScale=function(e){var t,n,r=this._canvas.zoom(),i=this._config.scale,o=r;!0!==i&&(!1===i?(t=1,n=1):(t=i.min,n=i.max),c(t)&&r<t&&(o=t),c(n)&&r>n&&(o=n)),function(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}(e,"scale("+o+")")},gl.prototype._assureIsInbounds=function(e,t){var n,r,i=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,p=e.scrollHeight,l={},c=t.x-i.left,u=t.y-i.top;o+s>i.width&&(l.x=!0),a+p>i.height&&(l.y=!0),l.x&&l.y?(n=c-s+"px",r=u-p+"px"):l.x?(n=c-s+"px",r=u+"px"):l.y&&u<p?(n=c+"px",r="10px"):l.y&&(n=c+"px",r=u-p+"px"),q(e.style,{left:n,top:r},{visibility:"visible","z-index":1e3})},gl.prototype._createEntries=function(e,t){var n=fe("<div>"),r=this;return te(n).add(t),_(e,(function(e,t){var i=r._createEntry(e,t);n.appendChild(i)})),n},gl.prototype._createEntry=function(e,t){var n=fe("<div>"),r=te(n);if(r.add("entry"),e.className&&e.className.split(" ").forEach((function(e){r.add(e)})),Y(n,fl,t),e.label){var i=fe("<span>");i.textContent=e.label,n.appendChild(i)}return e.imageUrl&&n.appendChild(fe('<img src="'+e.imageUrl+'" />')),!0===e.active&&r.add("active"),!0===e.disabled&&r.add("disabled"),e.title&&(n.title=e.title),n},gl.prototype._bindAutoClose=function(){this._eventBus.once(yl,this.close,this)},gl.prototype._unbindAutoClose=function(){this._eventBus.off(yl,this.close,this)};var vl={__init__:["popupMenu"],popupMenu:["type",gl]};function bl(){}bl.prototype.get=function(){return this._data},bl.prototype.set=function(e){this._data=e},bl.prototype.clear=function(){var e=this._data;return delete this._data,e},bl.prototype.isEmpty=function(){return!this._data};var xl={clipboard:["type",bl]};function wl(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}wl.$inject=["eventBus"],wl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,a=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,a,!1,!1,!1,!1,0,null);return n}(0,0)};var _l={__init__:["mouse"],mouse:["type",wl]};function El(e,t,n,r,i,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=a,this._rules=s,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id,b(r,(function(e){return e===n.parent}))&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),Pl(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return k(e.waypoints,(function(e){return(e=Sl(e)).original&&(e.original=Sl(e.original)),e}))}(n)),Ol(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),_(["x","y","width","height"],(function(e){m(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){q(e.hints,{createElementsBehavior:!1})}))}function Pl(e){return!!e.waypoints}function Ol(e){return!!e.labelTarget}function Sl(e){return q({},e)}function kl(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}El.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],El.prototype.copy=function(e){var t,n;return d(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(d(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},El.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},El.prototype._paste=function(e,t,n,r){_(e,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var i=yt(e);return _(e,(function(e){Pl(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),q(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,q({},r))},El.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return _(e,(function(e,o){_(e=z(e,"priority"),(function(e){var o,a=q({},K(e,["priority"]));return r[e.parent]?a.parent=r[e.parent]:delete a.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:a}),Pl(a)?(a.source=r[e.source],a.target=r[e.target],o=r[e.id]=t.createConnection(a),void i.push(o)):Ol(a)?(a.labelTarget=r[a.labelTarget],o=r[e.id]=t.createLabel(a),void i.push(o)):(a.host&&(a.host=r[a.host]),o=r[e.id]=t.createShape(a),void i.push(o))}))})),i},El.prototype.createConnection=function(e){return this._elementFactory.createConnection(K(e,["id"]))},El.prototype.createLabel=function(e){return this._elementFactory.createLabel(K(e,["id"]))},El.prototype.createShape=function(e){return this._elementFactory.createShape(K(e,["id"]))},El.prototype.hasRelations=function(e,t){var n,r;return!(Pl(e)&&(n=b(t,j({id:e.source.id})),r=b(t,j({id:e.target.id})),!n||!r))&&!(Ol(e)&&!b(t,j({id:e.labelTarget.id})))},El.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=b(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i)).push({element:n.element,depth:t}):i.push({element:e,depth:t})}return mt(ut(e),(function(e,t,r){if(!Ol(e)){_(e.labels,(function(e){o(e,r)})),_([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&_(e,(function(e){_(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=k(i,(function(e){return e.element})),i=z(i=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),_(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?kl(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):kl(i.element,e)})),r};var Cl={__depends__:[xl,ml,_l,Ls],__init__:["copyPaste"],copyPaste:["type",El]};function Tl(e,t,n){d(n)||(n=[n]),_(n,(function(n){l(e[n])||(t[n]=e[n])}))}function Ml(e,t,n){var r;t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=t.oldBusinessObject=Ei(n),i=t.oldDi=Pi(n);if(t.type=n.type,Tl(r,t,"name"),Tl(i,t,"isExpanded"),Al(t))return t;r.default&&(t.default=r.default.id)})),t.on("moddleCopy.canCopyProperty",(function(t){var r,i=t.parent,o=t.property;if("processRef"===t.propertyName&&wi(i,"bpmn:Participant")&&wi(o,"bpmn:Process"))return r=e.create("bpmn:Process"),n.copyElement(o,r)})),t.on("copyPaste.pasteElements",(function(){r={}})),t.on("copyPaste.pasteElement",(function(t){var i,o,a,s,p=t.cache,l=t.descriptor,c=l.oldBusinessObject,u=l.oldDi;if(Al(l))return l.businessObject=Ei(p[l.labelTarget]),void(l.di=Pi(p[l.labelTarget]));i=e.create(c.$type),l.businessObject=n.copyElement(c,i),(o=e.create(u.$type)).bpmnElement=i,l.di=n.copyElement(u,o),function(e,t){var n=Ei(e);e.default&&(r[e.default]={element:n,property:"default"}),e.host&&(Ei(e).attachedToRef=Ei(t[e.host])),r=K(r,P(r,(function(t,r,i){var o=r.element,a=r.property;return i===e.id&&(o[a]=n,t.push(e.id)),t}),[]))}(l,p),Tl(l,i,["isExpanded","name"]),a=l,d(s="oldBusinessObject")||(s=[s]),_(s,(function(e){a[e]&&delete a[e]}))}))}function Al(e){return!!e.labelTarget}Ml.$inject=["bpmnFactory","eventBus","moddleCopy"];var Rl=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing"];function Dl(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return z(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=h(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Rl.indexOf(r))&&(!(r&&n&&!b(n.properties,j({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,r=e.property;if(n="bpmn:ExtensionElements",(t=r)&&"function"==typeof t.$instanceOf&&t.$instanceOf(n)&&(!r.values||!r.values.length))return!1}))}function zl(e,t){return P(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Dl.$inject=["eventBus","bpmnFactory","moddle"],Dl.prototype.copyElement=function(e,t,n){var r=this;n&&!d(n)&&(n=[n]),n=n||zl(e.$descriptor);var i=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t});return!1===i||(d(i)&&(n=i),_(n,(function(n){var i;v(e,n)&&(i=e.get(n));var o=r.copyProperty(i,t,n);!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:o,propertyName:n})&&c(o)&&t.set(n,o)}))),t},Dl.prototype.copyProperty=function(e,t,n){var r=this,i=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n});if(!1!==i){if(i)return h(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;var o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference){if(o.isId)return this._copyId(e,t);if(d(e))return P(e,(function(e,o){return(i=r.copyProperty(o,t,n))?(i.$parent=t,e.concat(i)):e}),[]);if(h(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(i=r._bpmnFactory.create(e.$type)).$parent=t,i=r.copyElement(e,i)}return e}}},Dl.prototype._copyId=function(e,t){return this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var jl={__depends__:[Cl],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ml],moddleCopy:["type",Dl]},Nl=Math.round;function Bl(e){this._modeling=e}Bl.$inject=["modeling"],Bl.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=t.width||e.width,o=t.height||e.height,a=t.x||e.x,s=t.y||e.y,p=Nl(a+i/2),l=Nl(s+o/2);return r.replaceShape(e,q({},t,{x:p,y:l,width:i,height:o}),n)};var Il={__init__:["replace"],replace:["type",Bl]};var Ll=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function $l(e,t,n,r,i,o,a){this.replaceElement=function(s,p,c){c=c||{};var u=p.type,h=s.businessObject;if(Fl(h)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&v(e,"collapsed")?e.collapsed:!Bi(e);return n!==(t&&(v(t,"collapsed")||v(t,"isExpanded"))?v(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(s,p))return r.toggleCollapse(s),s;var m=e.create(u),f={type:u,businessObject:m,di:{}};!function(e,t,n){d(n)||(n=[n]),_(n,(function(n){l(e[n])||(t[n]=e[n])}))}(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var y,g=zl(h.$descriptor),b=zl(m.$descriptor,!0),x=(y=b,g.filter((function(e){return-1!==y.indexOf(e)})));q(m,W(p,Ll));var E=w(x,(function(e){return"eventDefinitions"===e?Vl(s,p.eventDefinitionType):"loopCharacteristics"===e?!Li(m):!v(m,e)&&(("processRef"!==e||!1!==p.isExpanded)&&"triggeredByEvent"!==e)}));return m=n.copyElement(h,m,E),p.eventDefinitionType&&(Vl(m,p.eventDefinitionType)||(f.eventDefinitionType=p.eventDefinitionType,f.eventDefinitionAttrs=p.eventDefinitionAttrs)),wi(h,"bpmn:Activity")&&(Fl(h)?f.isExpanded=Bi(s):p&&v(p,"isExpanded")&&(f.isExpanded=p.isExpanded),Bi(s)&&!wi(h,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)),Fl(h)&&!Fl(m)&&(c.moveChildren=!1),wi(h,"bpmn:Participant")&&(!0===p.isExpanded?m.processRef=e.create("bpmn:Process"):c.moveChildren=!1,f.width=s.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:m})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),m.name=h.name,_i(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&_i(m,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(m.default=h.default),p.host&&!wi(h,"bpmn:BoundaryEvent")&&wi(m,"bpmn:BoundaryEvent")&&(f.host=p.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=s.x+(s.width-f.width)/2),f=i.replaceElement(s,f,c),!1!==c.select&&a.select(f),f}}function Fl(e){return wi(e,"bpmn:SubProcess")}function Vl(e,t){var n=Ei(e);return t&&n.get("eventDefinitions").some((function(e){return wi(e,t)}))}$l.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules","selection"];var Hl={__depends__:[jl,Il,$o],bpmnReplace:["type",$l]};function ql(e){return function(t){var n=t.target,r=Ei(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,a=(i&&i.$type)===n.eventDefinitionType,s=r.triggeredByEvent===n.triggeredByEvent,p=void 0===n.isExpanded||n.isExpanded===Bi(e);return!(o&&a&&s&&p)}}var Ul=[{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"}}],Gl=[{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"}}],Wl=[{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",eventDefinitionAttrs:{name:""}}},{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",eventDefinitionAttrs:{name:""}}},{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"}}],Kl=[{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"}}],Xl=[{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"}}],Yl=[{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}}],Zl=[{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}}],Jl=[{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}}],Ql=[{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}}],ec=[{label:"Data Store Reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],tc=[{label:"Data Object Reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],nc=[{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}}],rc=[{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}}],ic=[{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"}],oc=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty Pool";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function ac(e,t,n,r,i,o,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=a,this.register()}ac.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate"],ac.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ac.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var r=ql(e);return wi(n,"bpmn:DataObjectReference")?this._createEntries(e,ec):wi(n,"bpmn:DataStoreReference")&&!wi(e.parent,"bpmn:Collaboration")?this._createEntries(e,tc):wi(n,"bpmn:StartEvent")&&!wi(n.$parent,"bpmn:SubProcess")?(t=w(Ul,r),this._createEntries(e,t)):wi(n,"bpmn:Participant")?(t=w(oc,(function(t){return Bi(e)!==t.target.isExpanded})),this._createEntries(e,t)):wi(n,"bpmn:StartEvent")&&Li(n.$parent)?(t=w(rc,(function(t){var n=!1!==t.target.isInterrupting,i=Ei(e).isInterrupting===n;return r(t)||!r(t)&&!i})),this._createEntries(e,t)):wi(n,"bpmn:StartEvent")&&!Li(n.$parent)&&wi(n.$parent,"bpmn:SubProcess")?(t=w(Gl,r),this._createEntries(e,t)):wi(n,"bpmn:EndEvent")?(t=w(Kl,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!wi(n.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,t)):wi(n,"bpmn:BoundaryEvent")?(t=w(nc,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!wi(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,o=n.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,t)):wi(n,"bpmn:IntermediateCatchEvent")||wi(n,"bpmn:IntermediateThrowEvent")?(t=w(Wl,r),this._createEntries(e,t)):wi(n,"bpmn:Gateway")?(t=w(Xl,r),this._createEntries(e,t)):wi(n,"bpmn:Transaction")?(t=w(Zl,r),this._createEntries(e,t)):Li(n)&&Bi(e)?(t=w(Jl,r),this._createEntries(e,t)):wi(n,"bpmn:SubProcess")&&Bi(e)?(t=w(Yl,r),this._createEntries(e,t)):wi(n,"bpmn:AdHocSubProcess")&&!Bi(e)?(t=w(Ql,(function(t){var n=t.target,r="bpmn:SubProcess"===n.type,i=!0===n.isExpanded;return ql(e)&&(!r||i)})),this._createEntries(e,t)):wi(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ic):wi(n,"bpmn:FlowNode")?(t=w(Ql,r),wi(n,"bpmn:SubProcess")&&!Bi(e)&&(t=w(t,(function(e){return"Sub Process (collapsed)"!==e.label}))),this._createEntries(e,t)):[]},ac.prototype.getHeaderEntries=function(e){var t=[];return wi(e,"bpmn:Activity")&&!Li(e)&&(t=t.concat(this._getLoopEntries(e))),wi(e,"bpmn:DataObjectReference")&&(t=t.concat(this._getDataObjectIsCollection(e))),wi(e,"bpmn:Participant")&&(t=t.concat(this._getParticipantMultiplicity(e))),!wi(e,"bpmn:SubProcess")||wi(e,"bpmn:Transaction")||Li(e)||t.push(this._getAdHocEntry(e)),t},ac.prototype._createEntries=function(e,t){var n=[],r=this;return _(t,(function(t){var i=r._createMenuEntry(t,e);n.push(i)})),n},ac.prototype._createSequenceFlowEntries=function(e,t){var n=Ei(e),r=[],i=this._modeling,o=this._moddle,a=this;return _(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e.source,{default:n})})));break;case"replace-with-conditional-flow":!n.conditionExpression&&wi(n.sourceRef,"bpmn:Activity")&&r.push(a._createMenuEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})})));break;default:if(wi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})})));if((wi(n.sourceRef,"bpmn:ExclusiveGateway")||wi(n.sourceRef,"bpmn:InclusiveGateway")||wi(n.sourceRef,"bpmn:ComplexGateway")||wi(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return r.push(a._createMenuEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})})))}})),r},ac.prototype._createMenuEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,id:e.actionName,action:n}},ac.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function r(n,r){var i;r.active?i=void 0:(i=t._moddle.create(r.options.loopCharacteristics),r.options.isSequential&&(i.isSequential=r.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:i})}var i,o,a,s=Ei(e).loopCharacteristics;return s&&(i=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:n("Parallel Multi Instance"),active:a,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},ac.prototype._getDataObjectIsCollection=function(e){var t=this,n=this._translate;var r=e.businessObject.dataObjectRef,i=r.isCollection;return[{id:"toggle-is-collection",className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}]},ac.prototype._getParticipantMultiplicity=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return[{id:"toggle-participant-multiplicity",className:"bpmn-icon-parallel-mi-marker",title:r("Participant Multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}]},ac.prototype._getAdHocEntry=function(e){var t=this._translate,n=wi(Ei(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,i){return r(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}};var sc={__depends__:[vl,Hl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ac]},pc=Math.max,lc=Math.min;function cc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function uc(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return m(i)&&(r=(/top|left/.test(e)?lc:pc)(r,i)),m(o)&&(r=(/top|left/.test(e)?pc:lc)(r,o)),r}function dc(e,t){return void 0!==e?e:20}function hc(e){return!e.waypoints&&"label"!==e.type}function mc(e,t){var n;if((n=void 0===e.length?w(e.children,hc):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=dc(t.left),r=dc(t.right),i=dc(t.top),o=dc(t.bottom)):n=r=i=o=dc(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(yt(n),t)}var fc=Math.abs;var yc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],gc=30;function vc(e,t){return t=t||[],e.children.filter((function(e){wi(e,"bpmn:Lane")&&(vc(e,t),t.push(e))})),t}function bc(e){return e.children.filter((function(e){return wi(e,"bpmn:Lane")}))}function xc(e){return gs(e,yc)||e}function wc(e,t){var n=xc(e),r=vc(n,wi(n,"bpmn:Process")?[]:[n]),i=hn(e),o=hn(t),a=function(e,t){return cc(hn(t),hn(e))}(e,t),s=[];return r.forEach((function(t){if(t!==e){var n,r,p=0,l=a.right,c=0,u=a.left,d=hn(t);a.top&&(fc(d.bottom-i.top)<10&&(c=o.top-d.bottom),fc(d.top-i.top)<5&&(p=o.top-d.top)),a.bottom&&(fc(d.top-i.bottom)<10&&(p=o.bottom-d.top),fc(d.bottom-i.bottom)<5&&(c=o.bottom-d.bottom)),(p||l||c||u)&&s.push({shape:t,newBounds:(n=t,r={top:p,right:l,bottom:c,left:u},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),s}function _c(e,t,n,r,i,o,a,s,p,l,c,u){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=p,this._canvas=l,this._rules=c,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(So(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ec(e,t,n){var r=e.$instanceOf(t),i=!1;return _(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],_c.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,p=this._rules,l=this._autoPlace,c=this._translate,u={};if("label"===e.type)return u;var h=e.businessObject;function m(e,t){i.start(e,t)}function f(e,t,n,i){function a(t,n){var a=r.createShape(q({type:e},i));o.start(t,a,{source:n})}return"string"!=typeof n&&(i=n,n=c("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:l?function(t,n){var o=r.createShape(q({type:e},i));l.append(n,o)}:a}}}function y(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(_i(h,["bpmn:Lane","bpmn:Participant"])&&Bi(e)){var g=bc(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),g.length<2&&(e.height>=120&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:y(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}wi(h,"bpmn:FlowNode")&&(wi(h,"bpmn:EventBasedGateway")?q(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append ReceiveTask")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ec(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):wi(h,"bpmn:EndEvent")||h.isForCompensation||Ec(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Li(h)||q(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append EndEvent")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",c("Append Task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),a.isEmpty(e,"bpmn-replace")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,n){var r=q(function(e){var n=s.getContainer(),r=t.getPad(e).html,i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),a=o.top-i.top;return{x:o.left-i.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}});a.open(n,"bpmn-replace",r)}}}}),_i(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{"append.text-annotation":f("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:m,dragstart:m}}}),wi(h,"bpmn:TextAnnotation")&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using Association"),action:{click:m,dragstart:m}}}),_i(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}}),wi(h,"bpmn:Group")&&q(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation")});var v=p.allowed("elements.delete",{elements:[e]});return d(v)&&(v=v[0]===e),v&&q(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var Pc={__depends__:[Yp,Qp,$o,zp,ml,sc],__init__:["contextPadProvider"],contextPadProvider:["type",_c]},Oc={horizontal:["x","width"],vertical:["y","height"]};function Sc(e){this._modeling=e,this._filters=[],this.registerFilter((function(e,t,n){var r,i=0,o=0;return _(e,(function(e){e.waypoints||e.labelTarget||(i+=e[n],o+=1)})),r=Math.round(i/o),w(e,(function(e){return e[n]<r+50}))}))}Sc.$inject=["modeling"],Sc.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Sc.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Sc.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(_(t,(function(e){i=e(i,n,r)})),i):e},Sc.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return _(z(e,r),(function(e,o){var a,s=n._findRange(e,r,i),p=t[t.length-1];p&&n._hasIntersection(p.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))})),t},Sc.prototype._setOrientation=function(e){var t=Oc[e];this._axis=t[0],this._dimension=t[1]},Sc.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)},Sc.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var kc={__init__:["distributeElements"],distributeElements:["type",Sc]};function Cc(e){e.registerFilter((function(e){return w(e,(function(e){var t=_i(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)}))}))}Cc.$inject=["distributeElements"];var Tc={__depends__:[kc],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Cc]},Mc="is not a registered action";function Ac(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Rc(e,t){return new Error(e+" "+t)}Ac.$inject=["eventBus","injector"],Ac.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!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)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),a&&this.register("zoom",(function(e){a.zoom(e.value)})),n&&r&&s&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=s.allowed("elements.delete",{elements:e});!1!==i&&(t=d(i)?i:e).length&&n.removeElements(t.slice())}})),p&&this.register("moveCanvas",(function(e){p.moveCanvas(e)})),l&&this.register("moveSelection",(function(e){l.moveSelection(e.direction,e.accelerated)}))},Ac.prototype.trigger=function(e,t){if(!this._actions[e])throw Rc(e,Mc);return this._actions[e](t)},Ac.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);_(e,(function(e,t){n._registerAction(t,e)}))},Ac.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Rc(e,"is already registered");this._actions[e]=t},Ac.prototype.unregister=function(e){if(!this.isRegistered(e))throw Rc(e,Mc);this._actions[e]=void 0},Ac.prototype.getActions=function(){return Object.keys(this._actions)},Ac.prototype.isRegistered=function(e){return!!this._actions[e]};var Dc={__init__:["editorActions"],editorActions:["type",Ac]};function zc(e){e.invoke(Ac,this)}r(zc,Ac),zc.$inject=["injector"],zc.prototype._registerDefaultActions=function(e){Ac.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),p=e.get("distributeElements",!1),l=e.get("alignElements",!1),c=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),a&&this._registerAction("handTool",(function(){a.toggle()})),s&&this._registerAction("globalConnectTool",(function(){s.toggle()})),r&&p&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&p.trigger(t,n)})),r&&l&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=w(t,(function(e){return!wi(e,"bpmn:Lane")})),l.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&c&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&c.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=yt(r=wi(i,"bpmn:Collaboration")?n.filter((function(e){return wi(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!wi(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)}))};var jc={__depends__:[Dc],editorActions:["type",zc]};function Nc(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;_i(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Nc.$inject=["eventBus"];function Bc(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Ic(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.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(t){var n=t.originalEvent;if(!(!i.active||n&&ba(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;if(s&&m(s[t]))return s[t];s||(s=o.snapOffset={});m(s[t])||(s[t]=0);if(!i)return s[t];n.get(i.id)||(Lc(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2);if(!a)return s[t];"x"===t?/left/.test(a)?s[t]-=i.width/2:/right/.test(a)&&(s[t]+=i.width/2):/top/.test(a)?s[t]-=i.height/2:/bottom/.test(a)&&(s[t]+=i.height/2);return s[t]}(t,n,e);o&&(r.offset=o);var a=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={});a[t]||(a[t]={});var s=n.direction;r&&(Lc(t)?(a.x.min=r.left,a.x.max=r.right):(a.y.min=r.top,a.y.max=r.bottom));var p=i.min,l=i.max;p&&(Lc(t)?Fc(s)?a.x.max=p.left:a.x.min=p.right:$c(s)?a.y.max=p.top:a.y.min=p.bottom);l&&(Lc(t)?Fc(s)?a.x.min=l.left:a.x.max=l.right:$c(s)?a.y.min=l.top:a.y.max=l.bottom);return a[t]}(t,n);a&&q(r,a),_p(t,n)||i.snapEvent(t,n,r)}))}}))}function Lc(e){return"x"===e}function $c(e){return-1!==e.indexOf("n")}function Fc(e){return-1!==e.indexOf("w")}function Vc(e,t){Yo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;y(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}Ic.prototype.snapEvent=function(e,t,n){Ep(e,t,this.snapValue(e[t],n))},Ic.prototype.getGridSpacing=function(){return 10},Ic.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=Bc(e+=i,10),t&&t.min&&m(n=t.min)&&(n=Bc(n+i,10,"ceil"),e=Math.max(e,n)),t&&t.max&&m(r=t.max)&&(r=Bc(r+i,10,"floor"),e=Math.min(e,r)),e-=i},Ic.prototype.isActive=function(){return this.active},Ic.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ic.prototype.toggleActive=function(){this.setActive(!this.active)},Ic.$inject=["elementRegistry","eventBus","config.gridSnapping"],Vc.$inject=["eventBus","gridSnapping","modeling"],r(Vc,Yo),Vc.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},Vc.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},Vc.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(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),q(e,o),e},Vc.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(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),q(e,o),e};function Hc(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}Hc.$inject=["eventBus","gridSnapping"];var qc={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Vc],gridSnappingSpaceToolBehavior:["type",Hc]}],__init__:["gridSnapping"],gridSnapping:["type",Ic]};function Uc(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=fn(n),i=e.shape,o=vs(n,i);return["x","y"].forEach((function(e){var n={};o[e]!==r[e]&&(o[e]>r[e]?n.min=o[e]:n.max=o[e],wi(i,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-i.height/2:n.offset=-i.width/2),o[e]=t.snapValue(o[e],n))})),o}))}Uc.$inject=["eventBus","gridSnapping"];function Gc(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();wi(i,"bpmn:Participant")&&wi(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}Gc.$inject=["canvas","eventBus","gridSnapping"];function Wc(e,t,n){Yo.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},a=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(a)&&n.updateWaypoints(i,r.snapMiddleSegments(a))}))}function Kc(e,t,n){var r=kt(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=q({},t,i),n=q({},n,i)),[t,n]}Wc.$inject=["eventBus","gridSnapping","modeling"],r(Wc,Yo),Wc.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Kc(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var Xc={__depends__:[qc,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingCreateParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Uc],gridSnappingCreateParticipantBehavior:["type",Gc],gridSnappingLayoutConnectionBehavior:["type",Wc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Nc]};function Yc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return wi(t,"bpmn:Lane")?n.createParticipantHit(t,r):wi(t,"bpmn:Participant")?Bi(t)?n.createParticipantHit(t,r):n.createDefaultHit(t,r):wi(t,"bpmn:SubProcess")?Bi(t)?n.createSubProcessHit(t,r):n.createDefaultHit(t,r):void 0}))}Yc.$inject=["eventBus","interactionEvents"],Yc.prototype.createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Yc.prototype.createParticipantHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:30,height:e.height}),!0},Yc.prototype.createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var Zc={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Yc]};function Jc(e){e.invoke(Ta,this)}r(Jc,Ta),Jc.$inject=["injector"],Jc.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Ta.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0}))};var Qc={__depends__:[Ma],__init__:["keyboardBindings"],keyboardBindings:["type",Jc]},eu={moveSpeed:1,moveSpeedAccelerated:10},tu="left",nu="right",ru="down",iu={ArrowLeft:tu,Left:tu,ArrowUp:"up",Up:"up",ArrowRight:nu,Right:nu,ArrowDown:ru,Down:ru},ou={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 au(e,t,n,r,i){var o=this;this._config=q({},eu,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=iu[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var a=this._config[t?"moveSpeedAccelerated":"moveSpeed"],s=ou[e](a);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,s)}}}au.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var su={__depends__:[Ma,$o],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",au]};function pu(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=hn(e);return mn({top:uc("top",n,t),right:uc("right",n,t),bottom:uc("bottom",n,t),left:uc("left",n,t)})}(n,a),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:hn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=un(i)))return;n.resizeShape(t,i)}}(e.context)}))}function lu(e,t){var n=fn(e),r=hn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function cu(e){return"n"===e||"s"===e?"resize-ns":"e"===e||"w"===e?"resize-ew":"nw"===e||"se"===e?"resize-nwse":"resize-nesw"}pu.prototype.canResize=function(e){var t=this._rules,n=W(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},pu.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=q({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,lu(t,i),"resize",{autoActivate:!0,cursor:cu(i),data:{shape:t,context:r}})},pu.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=hn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},a=r?hn(r):o;return mn({top:lc(o.top,a.top),left:lc(o.left,a.left),bottom:pc(o.bottom,a.bottom),right:pc(o.right,a.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},mc(t,e.childrenBoxPadding))},pu.$inject=["eventBus","rules","modeling","dragging"];var uu="djs-resizing",du="resize-not-ok";function hu(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,a;r=e.context,i=r.shape,o=r.newBounds,(a=r.frame)||(a=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,uu)),o.width>5&&Oe(a,{x:o.x,width:o.width}),o.height>5&&Oe(a,{y:o.y,height:o.height}),r.canExecute?Me(a).remove(du):Me(a).add(du)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Re(n.frame),t.removeMarker(r,uu)}))}hu.$inject=["eventBus","canvas","previewSupport"];var mu=-6,fu="djs-resizer",yu=["n","w","s","e","nw","ne","se","sw"];function gu(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&_(t,F(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}gu.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Oo(t)&&r.activate(t,e,n)}ue.bind(t,"mousedown",i),ue.bind(t,"touchstart",i)},gu.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=mu);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=mu);return t}(r),a=Ie("g");Me(a).add(fu),Me(a).add("djs-resizer-"+e.id),Me(a).add("djs-resizer-"+r),_e(i,a);var s=Ie("rect");Oe(s,{x:-2+o.x,y:-2+o.y,width:4,height:4}),Me(s).add("djs-resizer-visual"),_e(a,s);var p=Ie("rect");return Oe(p,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Me(p).add("djs-resizer-hit"),_e(a,p),Wn(a,t,n),a},gu.prototype.createResizer=function(e,t){var n=lu(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},gu.prototype.addResizer=function(e){var t=this;this._resize.canResize({shape:e})&&_(yu,(function(n){t.createResizer(e,n)}))},gu.prototype.removeResizers=function(){De(this._getResizersParent())},gu.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gu.$inject=["eventBus","canvas","selection","resize"];var vu={__depends__:[Ls,zs,rl],__init__:["resize","resizePreview","resizeHandles"],resize:["type",pu],resizePreview:["type",hu],resizeHandles:["type",gu]};function bu(e,t){var n=t.create("bpmn:CategoryValue"),r=t.create("bpmn:Category",{categoryValue:[n]});return Et(e.get("rootElements"),r),Ei(r).$parent=e,Ei(n).$parent=r,n}function xu(e,t,n,r,i,o,a){function s(e,t){(t||_i(e,["bpmn:Task","bpmn:TextAnnotation"])||wu(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=a,r.registerProvider(this),e.on("element.dblclick",(function(e){s(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set"],(function(e){r.isActive()&&r.complete()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||s(n))})),e.on("autoPlace.end",500,(function(e){s(e.shape)}))}function wu(e){return wi(e,"bpmn:SubProcess")&&!Bi(e)}xu.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],xu.prototype.activate=function(e){var t=Vi(e);if(void 0!==t){var n={text:t};q(n,this.getEditingBBox(e));var r={};return(_i(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||wu(e))&&q(r,{centerVertically:!0}),lo(e)&&q(r,{autoResize:!0}),wi(e,"bpmn:TextAnnotation")&&q(r,{resizable:!0,autoResize:!0}),q(n,{options:r}),n}},xu.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,a={x:r.x,y:r.y},s=t.zoom(),p=this._textRenderer.getDefaultStyle(),l=this._textRenderer.getExternalStyle(),c=l.fontSize*s,u=l.lineHeight,d=p.fontSize*s,h=p.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(wi(e,"bpmn:Lane")||function(e){return wi(e,"bpmn:Participant")&&Bi(e)}(e))&&(q(a,{width:r.height,height:30*s,x:r.x-r.height/2+15*s,y:o-30*s/2}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(_i(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return wi(e,"bpmn:Participant")&&!Bi(e)}(e)||wu(e))&&(q(a,{width:r.width,height:r.height}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return wi(e,"bpmn:SubProcess")&&Bi(e)}(e)&&(q(a,{width:r.width,x:r.x}),q(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"}));var f=90*s,y=7*s,g=4*s;if(n.labelTarget&&(q(a,{width:f,height:r.height+y+g,x:i-f/2,y:r.y-y}),q(m,{fontSize:c+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:g+"px"})),lo(n)&&!co(n)&&!mo(n)){var v=ho(e),b=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),x=c+y+g;q(a,{width:f,height:x,x:b.x-f/2,y:b.y-x/2}),q(m,{fontSize:c+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:g+"px"})}return wi(e,"bpmn:TextAnnotation")&&(q(a,{width:r.width,height:r.height,minWidth:30*s,minHeight:10*s}),q(m,{textAlign:"left",paddingTop:5*s+"px",paddingBottom:7*s+"px",paddingLeft:7*s+"px",paddingRight:5*s+"px",fontSize:d+"px",lineHeight:h})),{bounds:a,style:m}},xu.prototype.update=function(e,t,n,r){var i,o,a;if((wi(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),wi(e,"bpmn:Group"))&&!Ei(e).categoryValueRef){var s=bu(Ei(this._canvas.getRootElement()).$parent,this._bpmnFactory);Ei(e).categoryValueRef=s}(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var _u="djs-element-hidden",Eu="djs-label-hidden";function Pu(e,t,n,r){var i,o,a,s=this,p=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var n=e.active;if(wi(i=n.element.label||n.element,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(i),a=Ie("g");var l=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),c=s.path=Ie("path");Oe(c,{d:l,strokeWidth:2,stroke:Ou(i)}),_e(a,c),_e(p,a),Kn(a,i.x,i.y)}wi(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,_u):(wi(i,"bpmn:Task")||wi(i,"bpmn:CallActivity")||wi(i,"bpmn:SubProcess")||wi(i,"bpmn:Participant"))&&t.addMarker(i,Eu)})),e.on("directEditing.resize",(function(e){if(wi(i,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(i.height/o.height*(t+n),0),p=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:p})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,_u),t.removeMarker(i,Eu)),i=void 0,o=void 0,a&&(Re(a),a=void 0)}))}function Ou(e,t){return Pi(e).get("stroke")||t||"black"}Pu.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Su={__depends__:[Xo,vu,Yp],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",xu],labelEditingPreview:["type",Pu]},ku=["top","bottom","left","right"],Cu=10;function Tu(e,t){function n(e){if(co(e)){var n=function(e){var t=fn(e.label),n=Mu(fn(e),t);if(r=n,-1===ku.indexOf(r))return;var r;var i=function(e){var t=fn(e);return[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Mu(t,e)}))}(e);if(e.host){var o=function(e){var t,n=e.host,r=yn(fn(e),n);t=r.indexOf("-")>=0?r.split("-"):[r];return ku.filter((function(e){return-1===t.indexOf(e)}))}(e);i=i.concat(o)}var a=ku.filter((function(e){return-1===i.indexOf(e)}));if(-1!==a.indexOf(n))return;return a[0]}(e);n&&function(e,n){var r=fn(e),i=e.label,o=fn(i);if(!i.parent)return;var a,s=hn(e);switch(n){case"top":a={x:r.x,y:s.top-Cu-i.height/2};break;case"left":a={x:s.left-Cu-i.width/2,y:r.y};break;case"bottom":a={x:r.x,y:s.bottom+Cu+i.height/2};break;case"right":a={x:s.right+Cu+i.width/2,y:r.y}}var p=La(a,o);t.moveShape(i,p)}(e,n)}}Yo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function Mu(e,t){return yn(t,e,5)}function Au(e,t,n){Yo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(wi(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function Ru(e,t){e.invoke(Yo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;_(w(r.incoming.concat(r.outgoing),(function(e){return wi(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}r(Tu,Yo),Tu.$inject=["eventBus","modeling"],r(Au,Yo),Au.$inject=["eventBus","elementFactory","bpmnRules"],r(Ru,Yo),Ru.$inject=["injector","modeling"];function Du(e,t){t.invoke(Yo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return zu(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n.replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];zu(i,r)&&(e.shapes=[n.replaceShape(i,r)])}}),!0)}function zu(e,t){return!mo(e)&&_i(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}Du.$inject=["bpmnReplace","injector"],r(Du,Yo),Du.prototype.replaceShape=function(e,t){var n,r=(n=Ei(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function ju(e,t,n){function r(e){return w(e.attachers,(function(e){return wi(e,"bpmn:BoundaryEvent")}))}Yo.call(this,e),this.postExecute("connection.create",(function(e){var t=e.context.source,i=e.context.target,o=r(i);wi(t,"bpmn:EventBasedGateway")&&wi(i,"bpmn:ReceiveTask")&&o.length>0&&n.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var t=e.context.oldSource,i=e.context.newSource;wi(t,"bpmn:Gateway")&&wi(i,"bpmn:EventBasedGateway")&&_(i.outgoing,(function(e){var t=e.target,i=r(t);wi(t,"bpmn:ReceiveTask")&&i.length>0&&n.removeElements(i)}))})),e.on("moddleCopy.canCopyProperty",2e3,(function(e){var n=e.parent,r=e.property,i=e.propertyName,o=t.getPropertyDescriptor(n,i);o&&o.isReference&&wi(r,"bpmn:RootElement")&&n.set(i,r)}))}function Nu(e){e.invoke(Yo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;wi(n,"bpmn:Lane")&&!wi(r,"bpmn:Lane")&&(t.parent=gs(n,"bpmn:Participant"))}))}function Bu(e,t,n){Yo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(wi(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}ju.$inject=["eventBus","moddle","modeling"],r(ju,Yo),Nu.$inject=["injector"],r(Nu,Yo),Bu.$inject=["eventBus","bpmnFactory","moddle"],r(Bu,Yo);var Iu=20,Lu=20,$u=2e3;function Fu(e,t,n){function r(){var t=e.getRootElement();return wi(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Yo.call(this,t),t.on(["create.start","shape.move.start"],$u,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(wi(r,"bpmn:Participant")&&wi(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!wi(e,"bpmn:Group")&&!mo(e)&&!function(e){return!!e.waypoints}(e)}));if(o.length){var a=yt(o);q(r,function(e,t){t={width:t.width+40+30,height:t.height+40};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,a)),n.createConstraints=function(e,t){return{bottom:(t=hn(t)).top+e.height/2-Lu,left:t.right-e.width/2+Iu,top:t.bottom-e.height/2+Lu,right:t.left+e.width/2-Iu-30}}(r,a)}}})),t.on("create.start",$u,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function a(e){e.element=i,e.gfx=o}wi(r,"bpmn:Participant")&&wi(i,"bpmn:Process")&&(t.on("element.hover",$u,a),t.once("create.cleanup",(function(){t.off("element.hover",a)})))})),this.preExecute("elements.create",$u,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return b(e,(function(e){return wi(e,"bpmn:Participant")}))}(n);o&&wi(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Ei(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;wi(n,"bpmn:Participant")&&wi(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Ei(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Ei(r).set("processRef",Ei(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Ei(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var a=r.children.slice();o?i===o&&n.moveElements(a,{x:0,y:0},o):n.moveElements(a,{x:0,y:0},i)}}),!0)}Fu.$inject=["canvas","eventBus","modeling"],r(Fu,Yo);var Vu="__targetRef_placeholder";function Hu(e,t){function n(e,n){var r=e.get("properties"),i=b(r,(function(e){return e.name===Vu}));return!i&&n&&Et(r,i=t.create("bpmn:Property",{name:Vu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return b(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||_t(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,a=o.businessObject,s=o.target,p=s&&s.businessObject,l=i.newTarget,c=l&&l.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==p&&r(d,a),c&&c!==p&&r(c,a),p?(t=n(p,!0),h.targetRef=t):h.targetRef=null}Yo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],qu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],qu(i))}function qu(e){return function(t){if(wi(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function Uu(e){this._bpmnUpdater=e}function Gu(e,t,n,r){function i(e){return e.children.filter((function(e){return wi(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return wi(e,"bpmn:Participant")&&Ei(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Pi(e),newSemanticParent:o.processRef||o,newDiParent:Pi(r)})}}Yo.call(this,r),t.registerHandler("dataStore.updateContainment",Uu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return wi(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!wi(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;wi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&wi(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;wi(r,"bpmn:Collaboration")||wi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&wi(i,"bpmn:Collaboration")&&o(n,wi(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(wi(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();_i(n,["bpmn:Participant","bpmn:SubProcess"])&&wi(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){wi(r,"bpmn:Process")&&o(e,r)}))}))}Hu.$inject=["eventBus","bpmnFactory"],r(Hu,Yo),Uu.$inject=["bpmnUpdater"],Uu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i)},Uu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i)},Gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],r(Gu,Yo);function Wu(e,t,n){Yo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var t=e.context,r=t.hints,i=t.shape,o=t.oldParent;wi(i,"bpmn:Lane")&&(r&&r.nested||function(e,t){var r,i,o,a=bc(t),s=[],p=[];mt(a,(function(t){return t.y>e.y?p.push(t):s.push(t),t.children})),a.length&&(r=p.length&&s.length?e.height/2:e.height,s.length&&(i=n.calculateAdjustments(s,"y",r,e.y-10),n.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),p.length&&(o=n.calculateAdjustments(p,"y",-r,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")))}(i,o))}))}Wu.$inject=["eventBus","modeling","spaceTool"],r(Wu,Yo);function Ku(e,t){t.invoke(Yo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Xu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n.replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,a=e.host;Xu(e,(o=a,-1!==t.indexOf(o)?a:r))&&(t[i]=n.replaceShape(e))}))}),!0)}function Xu(e,t){return!mo(e)&&wi(e,"bpmn:BoundaryEvent")&&!t}function Yu(e,t,n){function r(e,r,i){var o,a,s,p,l,c,u,d,h=r.waypoints,f=e.outgoing.slice(),y=e.incoming.slice(),g=Vs(h,d=m(i.width)?fn(i):i);if(g){if(o=h.slice(0,g.index),a=h.slice(g.index+(g.bendpoint?1:0)),!o.length||!a.length)return;s=g.bendpoint?h[g.index]:d,1!==o.length&&Zu(e,o[o.length-1])||o.push(Ju(s)),1!==a.length&&Zu(e,a[0])||a.unshift(Ju(s))}p=r.source,l=r.target,t.canConnect(p,e,r)&&(n.reconnectEnd(r,e,o||d),c=r),t.canConnect(e,l,r)&&(c?u=n.connect(e,l,{type:r.type,waypoints:a}):(n.reconnectStart(r,e,a||d),u=r));var v=[].concat(c&&w(y,(function(e){return e.source===c.source}))||[],u&&w(f,(function(e){return e.target===u.target}))||[]);v.length&&n.removeElements(v)}Yo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a=fn(o),s={x:a.x+i.x,y:a.y+i.y},p=b(n.children,(function(e){return t.canInsert(r,e)&&Vs(e.waypoints,s)}));p&&(e.targetFlow=p,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 n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.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 Zu(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function Ju(e){return q({},e)}function Qu(e,t){Yo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.source,i=n.target,o=i.incoming.slice();n.hints&&!1===n.hints.createElementsBehavior||wi(r,"bpmn:EventBasedGateway")&&i.incoming.length&&o.filter(ed).forEach((function(e){t.removeConnection(e)}))})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;wi(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ed).map((function(e){return e.target})).reduce((function(e,t){var n=t.incoming.filter(ed);return e.concat(n)}),[]).forEach((function(e){e.source!==n&&t.removeConnection(e)}))}))}function ed(e){return wi(e,"bpmn:SequenceFlow")}Ku.$inject=["bpmnReplace","injector"],r(Ku,Yo),Ku.prototype.replaceShape=function(e){var t,n,r=(n=Ei(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},r(Yu,Yo),Yu.$inject=["eventBus","bpmnRules","modeling"],Qu.$inject=["eventBus","modeling"],r(Qu,Yo);var td=1500;function nd(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],td,(function(t){var r=t.context.shape||t.shape,i=t.hover;wi(i,"bpmn:Lane")&&!_i(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=xc(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||wi(r,"bpmn:Group"))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],td,(function(t){var n=t.hover;wi(n,"bpmn:Lane")&&(t.hover=xc(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],td,(function(t){var n=t.context,r=t.hover,i=n.type;wi(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=xc(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],td,(function(e){var t=e.context,n=t.start;wi(n,"bpmn:Lane")&&(t.start=xc(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;wi(t,"bpmn:Lane")&&(e.shape=xc(t)||t)}))}nd.$inject=["elementRegistry","eventBus","canvas"];function rd(e,t,n,r,i,o){function a(e){var n=Ei(e).categoryValueRef;if(n){var r=n.$parent;n&&(_t(r.categoryValue,n),r&&!r.categoryValue.length&&function(e){_t(t.getDefinitions().get("rootElements"),e)}(r))}}i.invoke(Yo,this),this.executed("shape.delete",(function(e){var t,r=e.context.shape;if(wi(r,"bpmn:Group")){var i=Ei(r).categoryValueRef,o=n.filter((function(e){return wi(e,"bpmn:Group")}));t=i,o.some((function(e){var n=Ei(e);return n.categoryValueRef&&n.categoryValueRef===t}))||a(r)}})),this.reverted("shape.delete",(function(e){var n=e.context.shape;if(wi(n,"bpmn:Group")){var r=Ei(n).categoryValueRef,i=t.getDefinitions(),o=r?r.$parent:null;Et(o.get("categoryValue"),r),Et(i.get("rootElements"),o)}})),this.execute("shape.create",(function(n){var r=Ei(n.context.shape);if(wi(r,"bpmn:Group")&&!r.categoryValueRef){var i=bu(t.getDefinitions(),e);r.categoryValueRef=i}})),this.revert("shape.create",(function(e){var t=e.context.shape;wi(t,"bpmn:Group")&&(a(t),delete Ei(t).categoryValueRef)})),r.on("moddleCopy.canCopyProperty",2e3,(function(n){var r,i=n.property;if(wi(i,"bpmn:CategoryValue"))return r=bu(t.getDefinitions(),e),o.copyElement(i,r)}))}function id(e,t,n,r){var i,o,a,s;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((r.x-n.x)*o-(r.y-n.y)*a)/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function od(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=id(e,t,n,i),s=id(e,t,n,o);r=a&&s?ad(a,n)>ad(s,n)?s:a:a||s,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],fn(n.source)),t(r[r.length-1],r[r.length-2],fn(n.target)))}))}function ad(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sd(e){Yo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Ei(n),i=Pi(n);_i(r,t)&&!i.get("isHorizontal")&&i.set("isHorizontal",!0)}))}function pd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ld(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function cd(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function ud(e,t){var n=cd(e,t);return pd({x:n.x-e.x,y:n.y-e.y})}function dd(e,t){return pd({x:e.x-t.x,y:e.y-t.y})}rd.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],r(rd,Yo),od.$inject=["eventBus"],sd.$inject=["eventBus"],r(sd,Yo);var hd=Math.sqrt,md=Math.min,fd=Math.max,yd=Math.abs;function gd(e){return Math.pow(e,2)}function vd(e,t){return hd(gd(e.x-t.x)+gd(e.y-t.y))}function bd(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,p=i*i+o*o,l=(i*a+o*s)/p,c=l*l-(a*a+s*s-r*r)/p;if(c<0&&c>-1e-6&&(c=0),c<0)return[];var u=hd(c),d=-l+u,h=-l-u,m={x:e.x-i*d,y:e.y-o*d};return 0===c?[m]:[m,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return xd(e.x,t.x,n.x)&&xd(e.y,t.y,n.y)}(n,e,t)}))}function xd(e,t,n){return e>=md(t,n)-wd&&e<=fd(t,n)+wd}var wd=.1;function _d(e,t){return yd(e.x-t.x)<=wd&&yd(e.y-t.y)<=wd}function Ed(e,t,n,r){var i=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=function(e,t){var n,r,i,o,a,s,p,l,c,u,d,h,m=0;for(m=0;m<t.length-1;m++){if(_d(n=t[m],r=t[m+1])?s=[n]:(i=vd(e,n),o=vd(e,r),s=bd(n,r,e,md(i,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(p={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:_d(n,s[0])?m:m+1}),2===s.length&&(d=s[0],h=s[1],p={type:"segment",position:a={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:m,relativeLocation:vd(n,a)/vd(n,r)}),l=vd(p.position,e),(!u||c>l)&&(u=p,c=l)}return u}(a,n),p=s.segmentIndex,l=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var a=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===a?s:i>=s?i+o<s?s:i+o:i}if(r.bendpointMove){var p,l=r.bendpointMove.insert,c=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=c&&(p=l?i+1:i-1),i<c&&(p=i,l&&"bendpoint"!==n.type&&c-1===i&&Pd(t,c)<n.relativeLocation&&p++),p)}return 0===o?i:r.connectionStart?0===i?0:null:r.connectionEnd&&i===e.length-2?t.length-2:null}(n,t,s,r);if(null===l)return{x:i,y:o};if(l<0||l>t.length-2)return{x:i,y:o};var c,u,d=Od(n,p),h=Od(t,l),m=s.position,f=function(e,t){var n=dd(e[0],e[1]),r=dd(e[0],t);return 0===n?0:r/n}(d,m),y=(c=h,u=ld(d),ld(c)-u);if("bendpoint"===s.type){var g=t.length-n.length,v=s.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return{x:i,y:o};if(0===g){var x=t[v];return{x:x.x-s.position.x,y:x.y-s.position.y}}g<0&&0!==v&&v<n.length-1&&(f=Pd(n,v))}var w,_,E=(h[1].x-h[0].x)*f+h[0].x,P=(h[1].y-h[0].y)*f+h[0].y,O=(w={x:a.x-m.x,y:a.y-m.y},(_=y)?{x:Math.cos(_)*w.x-Math.sin(_)*w.y,y:Math.sin(_)*w.x+Math.cos(_)*w.y}:w);return dn({x:i=E+O.x-a.x,y:o=P+O.y-a.y})}function Pd(e,t){var n=dd(e[t-1],e[t]);return n/(n+dd(e[t],e[t+1]))}function Od(e,t){return[e[t],e[t+1]]}function Sd(e,t,n){var r=Ia(t),i=Ia(n),o=La(e,r),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return dn({x:i.x+a,y:i.y+s})}function kd(e,t,n){var r=Ia(e),i=Ia(t),o=Ia(n),a=La(e,r),s=La(r,i),p=function(e,t,n){var r=hn(t),i=hn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,a,s=yn(t,e);if("top"===s)o={x:0,y:i.bottom-r.bottom};else if("bottom"===s)o={x:0,y:i.top-r.top};else if("right"===s)o={x:i.left-r.left,y:0};else{if("left"!==s)return null;o={x:i.right-r.right,y:0}}if(a={x:e.x+o.x,y:e.y+o.y},yn(n,a)!==s)return null;return o}(r,t,n);if(p)return p;var l=s.x*(n.width/t.width),c=s.y*(n.height/t.height),u=o.x+l,d=o.y+c;return dn({x:u+a.x-e.x,y:d+a.y-e.y})}var Cd={width:90,height:20},Td="name",Md="text";function Ad(e,t,n,r){Yo.call(this,e),this.postExecute("element.updateProperties",(function(e){var n=e.context,i=n.element,o=n.properties;if(Td in o&&t.updateLabel(i,o.name),Md in o&&wi(i,"bpmn:TextAnnotation")){var a=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o.text||"");t.updateLabel(i,o.text,a)}})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection,o=i.businessObject;if(!mo(i)&&lo(i)&&Vi(i)){var a=ho(i),s=r.getExternalLabelBounds(Cd,Vi(i));t.createLabel(i,a,{id:o.id+"_label",businessObject:o,width:s.width,height:s.height})}}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["label.create"],(function(e){var t,r=e.context,i=r.shape,o=r.labelTarget;o&&wi(o,"bpmn:BaseElement")&&((t=Pi(o)).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")}),i.di=t),q(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=function(e){var t=e.context,n=t.connection,r=n.label,i=q({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),Ed(r,o,a,i)}(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Ei(n);i&&lo(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,a=r.oldBounds;if(co(i)){var s=i.label,p=Rd(function(e,t){if(!t.length)return;var n=function(e,t){return z(t.map((function(t){return{line:t,distance:ud(e,t)}})),"distance")[0].line}(e,t);return cd(e,n)}(fn(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)}]]),a,o);t.moveShape(s,p)}}))}function Rd(e,t,n){return dn(La(Sd(e,t,n),e))}function Dd(e,t,n){var r=Id(e),i=Ld(r,t),o=r[0];return i.length?i[i.length-1]:Sd(o.original||o,n,t)}function zd(e,t,n){var r=Id(e),i=Ld(r,t),o=r[r.length-1];return i.length?i[0]:Sd(o.original||o,n,t)}function jd(e,t,n){var r=Id(e),i=Bd(t,n),o=r[0];return Sd(o.original||o,i,t)}function Nd(e,t,n){var r=Id(e),i=Bd(t,n),o=r[r.length-1];return Sd(o.original||o,i,t)}function Bd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Id(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Ld(e,t){return w(k(e,$d),(function(e){return function(e,t){return"intersect"===yn(t,e,1)}(e,t)}))}function $d(e){return e.original||e}function Fd(e,t){Yo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return wi(e,"bpmn:Participant")&&Bi(e)&&wi(t,"bpmn:Participant")&&!Bi(t)}(n,r)){var i,o,a,s,p=(o=ft([i=n],!1),a=[],s=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){wi(e,"bpmn:MessageFlow")&&a.push(e)})),e.outgoing.forEach((function(e){wi(e,"bpmn:MessageFlow")&&s.push(e)})))}),[]),{incoming:a,outgoing:s});p.incoming.forEach((function(e){var i=zd(e,r,n);t.reconnectEnd(e,r,i)})),p.outgoing.forEach((function(e){var i=Dd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}r(Ad,Yo),Ad.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],Fd.$inject=["eventBus","modeling"],r(Fd,Yo);function Vd(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,a=e.context,s=a.shape;wi(a.target,"bpmn:Collaboration")&&wi(s,"bpmn:FlowNode")&&(r=e,i=n("flow elements must be children of pools/participants"),t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:o||2e3,html:"<div>"+i+"</div>"}))}))}function Hd(e,t){Yo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Pi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function qd(e,t,n){Yo.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(wi(i,"bpmn:SequenceFlow")&&wi(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var a=function(e,t){var n=id(Ud(e[e.length-2]),Ud(e[e.length-1]),Ud(t[1]),Ud(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ud(e[0]),Ud(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,a)}}}))}function Ud(e){return e.original||e}function Gd(e,t){Yo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;wi(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function Wd(e,t,n,r){Yo.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,a=e.target;e.parent&&(wi(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(i=!0),n.canConnectMessageFlow(o,a)&&(r="bpmn:MessageFlow")),wi(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(i=!0),n.canConnectSequenceFlow(o,a)&&(r="bpmn:SequenceFlow")),wi(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(i=!0),i&&t.removeConnection(e),r&&t.connect(o,a,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){_(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,a=e.context,s=a.connection,p=a.newSource||s.source,l=a.newTarget||s.target;(r=n.canConnect(p,l))&&r.type!==s.type&&(o=t.connect(p,l,{type:r.type,waypoints:s.waypoints.slice()}),t.removeConnection(s),a.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(-1===(n=o.indexOf(e)))return;o.splice(n,1,t)}(s,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,a=o.businessObject;i.default&&(n=b(o.outgoing,j({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})}))}function Kd(e,t,n,r,i,o){r.invoke(Yo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=t.canReplace(i,r);o&&this.replaceElements(i,o.replacements)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];_(n.closure.topLevel,(function(e){o=Li(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var a=t.canReplace(o,r);a&&this.replaceElements(o,a.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,a=i.attachers;a&&a.length&&(n=t.canReplace(a,o),this.replaceElements(a,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Vd.$inject=["eventBus","tooltips","translate"],r(Hd,Yo),Hd.$inject=["eventBus","modeling"],r(qd,Yo),qd.$inject=["eventBus","bpmnRules","modeling"],Gd.$inject=["eventBus","modeling"],r(Gd,Yo),r(Wd,Yo),Wd.$inject=["eventBus","modeling","bpmnRules","injector"],r(Kd,Yo),Kd.prototype.replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;_(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),a=e.indexOf(o);e[a]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Kd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Xd=300,Yd=60,Zd={width:300,height:150},Jd={width:140,height:120},Qd={width:50,height:30};function eh(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=xc(e),i=!0,o=!0,a=vc(r,[r]),s=hn(e),p={},l={};/e/.test(t)?l.right=s.left+Xd:/w/.test(t)&&(l.left=s.right-Xd);return a.forEach((function(e){var r=hn(e);/n/.test(t)&&(r.top<s.top-10&&(i=!1),n&&th(s.top-r.bottom)<10&&ah(p,"top",r.top+Yd),th(s.top-r.top)<5&&oh(l,"top",r.bottom-Yd)),/s/.test(t)&&(r.bottom>s.bottom+10&&(o=!1),n&&th(s.bottom-r.top)<10&&oh(p,"bottom",r.bottom-Yd),th(s.bottom-r.bottom)<5&&ah(l,"bottom",r.top+Yd))})),r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(wi(e,"bpmn:FlowElement")||wi(e,"bpmn:Artifact"))})).forEach((function(e){var n=hn(e);i&&/n/.test(t)&&oh(l,"top",n.top-20),/e/.test(t)&&ah(l,"right",n.right+20),o&&/s/.test(t)&&ah(l,"bottom",n.bottom+20),/w/.test(t)&&oh(l,"left",n.left-50)})),{min:l,max:p}}(n,r,i)),wi(n,"bpmn:Participant")&&(t.minDimensions=Zd),wi(n,"bpmn:SubProcess")&&Bi(n)&&(t.minDimensions=Jd),wi(n,"bpmn:TextAnnotation")&&(t.minDimensions=Qd)}))}eh.$inject=["eventBus"];var th=Math.abs,nh=Math.min,rh=Math.max;function ih(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function oh(e,t,n){return ih(e,t,n,nh)}function ah(e,t,n){return ih(e,t,n,rh)}function sh(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(wi(n,"bpmn:Lane")||wi(n,"bpmn:Participant"))&&(t.balanced=!So(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(wi(r,"bpmn:Lane")||wi(r,"bpmn:Participant"))return i&&(o=un(o),t.resizeLane(r,o,n.balanced)),!1}))}sh.$inject=["eventBus","modeling"];function ph(e,t,n,r,i){function o(e){return _i(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){d(t)||(t=[t]);return S(t,(function(t){return $i(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(t){return!!b(e.getDefinitions().get("rootElements"),j({id:t.id}))}function s(e){return wi(e,"bpmn:ErrorEventDefinition")?"errorRef":wi(e,"bpmn:EscalationEventDefinition")?"escalationRef":wi(e,"bpmn:MessageEventDefinition")?"messageRef":wi(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function p(e){if(_i(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(s(t))}n.invoke(Yo,this),this.executed("shape.create",(function(t){var n=t.shape;if(o(n)){var r=p(Ei(n));r&&!a(r)&&(Et(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted("shape.create",(function(t){var n=t.addedRootElement;n&&_t(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(o(n)){var r=p(Ei(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject;if(o(n)){var p=t.referencedRootElement;p&&(a(p)||(p=r.copyElement(p,i.create(p.$type))),function(e,t){if(_i(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(s(n),t)}(n,p))}}))}ph.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],r(ph,Yo);var lh=Math.max;function ch(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return _(t,(function(e){var t=e.id;wi(e,"bpmn:Participant")&&(!function(e){return"x"===e}(n)?i[t]={width:Zd.width,height:uh(e,r)}:i[t]=Zd),wi(e,"bpmn:SubProcess")&&Bi(e)&&(i[t]=Jd),wi(e,"bpmn:TextAnnotation")&&(i[t]=Qd)})),i}))}function uh(e,t){var n;return bc(e).length?(n=function(e,t){var n,r=bc(e);return n=dh(r,t),e.height-n.height+Yd}(e,t),lh(Zd.height,n)):Zd.height}function dh(e,t){var n,r,i;for(n=0;n<e.length;n++)if(t>=(r=e[n]).y&&t<=r.y+r.height)return(i=bc(r)).length?dh(i,t):r}ch.$inject=["eventBus"];var hh=180,mh=160;function fh(e,t,n,r,i,o,a){Yo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=a;var s=this;function p(e){return wi(e,"bpmn:SubProcess")&&!Bi(e)}function l(t){var n=t.shape,r=t.newRootElement,i=Ei(n);r=s._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function c(t){var n=Ei(t.shape);s._removeDiagram(n);var r=t.newRootElement=a.get(ia(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){p(e.shape)&&l(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(s._showRecursively(t.children),s._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){p(e.shape)&&c(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(p(t)){var r=a.get(ia(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){p(e.shape)&&c(e)}),!0),this.reverted("shape.delete",(function(e){p(e.shape)&&l(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;p(n)&&p(r)&&(t.oldRoot=e.removeRootElement(ia(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(ia(r));if(i&&o){var a=i.children;n.moveElements(a,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(wi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(aa(t))return a.updateId(t,oa(i)),void a.updateId(r,i);a.get(oa(r))&&a.updateId(oa(r),oa(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(wi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(aa(t))return a.updateId(t,oa(r)),void a.updateId(i,r);var o=a.get(oa(i));o&&a.updateId(o,oa(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(aa(n)){var r=n,i=a.get(ra(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;wi(t,"bpmn:SubProcess")&&(Bi(t)?c(e):(l(e),s._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;wi(t,"bpmn:SubProcess")&&(Bi(t)?c(e):(l(e),s._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(wi(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Bi(t)?s._moveChildrenToShape(n,t):s._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(p(t)){var r=ia(t),i=a.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(wi(Pi(i),"bpmndi:BPMNPlane")){var o=ra(i),a=b(r,(function(e){return e.id===o}));a&&(t.parent=a.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(p(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function yh(e,t){e.invoke(Yo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(wi(r,"bpmn:SubProcess")&&wi(n,"bpmn:Task")&&Bi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function gh(e,t){Yo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Bi(n)){var r=ft(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();_(t,(function(e){i(e,!0)})),_(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,fn(n)):t.reconnectStart(e,n,fn(n)))}}),!0)}r(fh,Yo),fh.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=i.filter((function(e){return!e.hidden}));if(o.length){var a=yt(o);if(t.x){var s=fn(t),p=fn(a);n={x:s.x-p.x,y:s.y-p.y}}else n={x:hh-a.x,y:mh-a.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},fh.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},fh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},fh.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:ia(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},fh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=b(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},fh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],yh.$inject=["injector","modeling"],r(yh,Yo),r(gh,Yo),gh.$inject=["eventBus","modeling"];function vh(e,t,n,r){Yo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;wi(n,"bpmn:SubProcess")&&(n.collapsed?Pi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Pi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Pi(t).isExpanded=!1:Pi(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i=e.children,o=t;return(n=mc((r=i,r.filter((function(e){return!e.hidden}))).concat([e])))?(o.width=Math.max(n.width,o.width),o.height=Math.max(n.height,o.height),o.x=n.x+(n.width-o.width)/2,o.y=n.y+(n.height-o.height)/2):(o.x=e.x+(e.width-o.width)/2,o.y=e.y+(e.height-o.height)/2),o}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function bh(e,t,n,r){t.invoke(Yo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;mo(t)||(wi(t,"bpmn:Participant")&&Bi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;wi(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function xh(e,t){Yo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!wi(e,"bpmn:SequenceFlow"))return!1;var n=Ei(t),r=Ei(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}r(vh,Yo),vh.$inject=["eventBus","elementFactory","modeling"],r(bh,Yo),bh.$inject=["canvas","injector","moddle","modeling"],r(xh,Yo),xh.$inject=["eventBus","modeling"];function wh(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}Yo.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,5e3,(function(e){(r=r||new _h).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!r)throw new Error(n("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=i();t.labelTarget||(wi(t,"bpmn:Lane")&&n.addLane(t),wi(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function _h(){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}}wh.$inject=["eventBus","modeling","translate"],r(wh,Yo);var Eh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","messageFlowBehavior","modelingFeedback","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Tu],appendBehavior:["type",Au],associationBehavior:["type",Ru],attachEventBehavior:["type",Du],boundaryEventBehavior:["type",ju],createBehavior:["type",Nu],createDataObjectBehavior:["type",Bu],createParticipantBehavior:["type",Fu],dataInputAssociationBehavior:["type",Hu],dataStoreBehavior:["type",Gu],deleteLaneBehavior:["type",Wu],detachEventBehavior:["type",Ku],dropOnFlowBehavior:["type",Yu],eventBasedGatewayBehavior:["type",Qu],fixHoverBehavior:["type",nd],groupBehavior:["type",rd],importDockingFix:["type",od],isHorizontalFix:["type",sd],labelBehavior:["type",Ad],messageFlowBehavior:["type",Fd],modelingFeedback:["type",Vd],removeElementBehavior:["type",qd],removeEmbeddedLabelBoundsBehavior:["type",Hd],removeParticipantBehavior:["type",Gd],replaceConnectionBehavior:["type",Wd],replaceElementBehaviour:["type",Kd],resizeBehavior:["type",eh],resizeLaneBehavior:["type",sh],rootElementReferenceBehavior:["type",ph],spaceToolBehavior:["type",ch],subProcessPlaneBehavior:["type",fh],subProcessStartEventBehavior:["type",yh],toggleCollapseConnectionBehaviour:["type",gh],toggleElementCollapseBehaviour:["type",vh],unclaimIdBehavior:["type",bh],unsetDefaultFlowBehavior:["type",xh],updateFlowNodeRefsBehavior:["type",wh]};function Ph(e,t){var n=yn(e,t,-15);return"intersect"!==n?n:null}function Oh(e){Ps.call(this,e)}function Sh(e){return!e||mo(e)}function kh(e){do{if(wi(e,"bpmn:Process"))return Ei(e);if(wi(e,"bpmn:Participant"))return Ei(e).processRef||Ei(e)}while(e=e.parent)}function Ch(e){return wi(e,"bpmn:TextAnnotation")}function Th(e){return wi(e,"bpmn:Group")&&!e.labelTarget}function Mh(e){return wi(e,"bpmn:BoundaryEvent")&&Dh(e,"bpmn:CompensateEventDefinition")}function Ah(e){return Ei(e).isForCompensation}function Rh(e){for(var t=e;t=t.parent;){if(wi(t,"bpmn:FlowElementsContainer"))return Ei(t);if(wi(t,"bpmn:Participant"))return Ei(t).processRef}return null}function Dh(e,t){return!!b(Ei(e).eventDefinitions||[],(function(e){return wi(e,t)}))}function zh(e,t){return(Ei(e).eventDefinitions||[]).every((function(e){return wi(e,t)}))}function jh(e){return wi(e,"bpmn:ReceiveTask")||wi(e,"bpmn:IntermediateCatchEvent")&&(Dh(e,"bpmn:MessageEventDefinition")||Dh(e,"bpmn:TimerEventDefinition")||Dh(e,"bpmn:ConditionalEventDefinition")||Dh(e,"bpmn:SignalEventDefinition"))}function Nh(e){return e.waypoints}function Bh(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(Sh(e)||Sh(t))return null;if(!wi(n,"bpmn:DataAssociation")){if(Zh(e,t))return{type:"bpmn:MessageFlow"};if(Jh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Qh(e,t);return r||(Mh(e)&&Ah(t)?{type:"bpmn:Association",associationDirection:"One"}:!!Yh(e,t)&&{type:"bpmn:Association"})}function Lh(e,t,n){return!(!mo(e)&&!Th(e))||!(wi(t,"bpmn:Participant")&&!Bi(t))&&(wi(e,"bpmn:Participant")?wi(t,"bpmn:Process")||wi(t,"bpmn:Collaboration"):_i(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:wi(e,"bpmn:Lane")?wi(t,"bpmn:Participant")||wi(t,"bpmn:Lane"):!(wi(e,"bpmn:BoundaryEvent")&&(r=e,!Ei(r).cancelActivity||!Vh(r)&&!Hh(r)))&&(wi(e,"bpmn:FlowElement")&&!wi(e,"bpmn:DataStoreReference")?wi(t,"bpmn:FlowElementsContainer")?Bi(t):_i(t,["bpmn:Participant","bpmn:Lane"]):wi(e,"bpmn:DataStoreReference")&&wi(t,"bpmn:Collaboration")?S(Ei(t).get("participants"),(function(e){return!!e.get("processRef")})):_i(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?_i(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!wi(e,"bpmn:MessageFlow")&&(wi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var r}function $h(e){return wi(e,"bpmn:Lane")}function Fh(e){return!!function(e){return!mo(e)&&wi(e,"bpmn:BoundaryEvent")}(e)||(!(!wi(e,"bpmn:IntermediateThrowEvent")||!Vh(e))||wi(e,"bpmn:IntermediateCatchEvent")&&Hh(e))}function Vh(e){var t=Ei(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Hh(e){return qh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function qh(e,t){return t.some((function(t){return Dh(e,t)}))}function Uh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!mo(i)&&(!!Fh(i)&&(!Li(t)&&(!(!wi(t,"bpmn:Activity")||Ah(t))&&(!(r&&!Ph(r,t))&&(!function(e){return wi(e,"bpmn:ReceiveTask")&&b(e.incoming,(function(e){return wi(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Gh(e,t,n){if(!t)return!1;var r={replacements:[]};return _(e,(function(e){Li(t)||wi(e,"bpmn:StartEvent")&&"label"!==e.type&&Lh(e,t)&&(Ii(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return $i(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return $i(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return $i(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),qh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&wi(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),wi(t,"bpmn:Transaction")||Dh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(wi(e,"bpmn:EndEvent")&&Lh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),wi(e,"bpmn:BoundaryEvent")&&Uh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Wh(e,t){return!S(e,$h)&&(!t||e.every((function(e){return Lh(e,t)})))}function Kh(e,t,n,r){return!!t&&(!(!mo(e)&&!Th(e))||!function(e,t){return e===t}(n,t)&&((!n||!Bh(n,t))&&(Lh(e,t)||em(e,t))))}function Xh(e,t){return wi(e,"bpmn:SubProcess")?Bi(e)&&(!t||t.width>=100&&t.height>=80):wi(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:wi(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!Ch(e)||!!Th(e)}function Yh(e,t){return!Nh(e)&&!Nh(t)&&(!(!Mh(e)||!Ah(t))||!Bh(t,e)&&!Bh(e,t)&&(!!function(e,t){var n=Ch(e),r=Ch(t);return(n||r)&&n!==r}(e,t)||!!Qh(e,t)))}function Zh(e,t){return!(rm(e)&&!rm(t))&&(wi(n=e,"bpmn:InteractionNode")&&!wi(n,"bpmn:BoundaryEvent")&&(!wi(n,"bpmn:Event")||wi(n,"bpmn:ThrowEvent")&&zh(n,"bpmn:MessageEventDefinition"))&&function(e){return wi(e,"bpmn:InteractionNode")&&!Ah(e)&&(!wi(e,"bpmn:Event")||wi(e,"bpmn:CatchEvent")&&zh(e,"bpmn:MessageEventDefinition"))&&!(wi(e,"bpmn:BoundaryEvent")&&!Dh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Jh(e,t){return!(jh(t)&&t.incoming.length>0&&(n=t.incoming,(n=n||[]).some(nm))&&!wi(e,"bpmn:EventBasedGateway"))&&(wi(r=e,"bpmn:FlowNode")&&!wi(r,"bpmn:EndEvent")&&!Li(r)&&!(wi(r,"bpmn:IntermediateThrowEvent")&&Dh(r,"bpmn:LinkEventDefinition"))&&!Mh(r)&&!Ah(r)&&function(e){return wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:StartEvent")&&!wi(e,"bpmn:BoundaryEvent")&&!Li(e)&&!(wi(e,"bpmn:IntermediateCatchEvent")&&Dh(e,"bpmn:LinkEventDefinition"))&&!Ah(e)}(t)&&function(e,t){return Rh(e)===Rh(t)}(e,t)&&!(wi(e,"bpmn:EventBasedGateway")&&!jh(t)));var n,r}function Qh(e,t){return _i(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&_i(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!_i(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!_i(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function em(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&&(_i(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mo(t)&&wi(e,"bpmn:FlowNode")&&!wi(e,"bpmn:BoundaryEvent")&&Lh(e,t.parent))}function tm(e,t){return!!mo(t)||!(wi(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function nm(e){if(e&&e.source)return wi(e.source,"bpmn:EventBasedGateway")}function rm(e){return gs(e,"bpmn:Process")||gs(e,"bpmn:Collaboration")}r(Oh,Ps),Oh.$inject=["eventBus"],Oh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Sh(e))return null;return _i(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Ih(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Ih(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Xh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(Nh(r)&&!em(t,r))&&O(t,(function(e){return Nh(e)?Ih(e.source,e.target,e):e.host?Uh(e,e.host,null,n):Kh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Uh(n,t,null,r)||Gh(n,t,r)||Wh(n,t)||em(n,t)})),this.addRule("shape.create",(function(e){return Kh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Uh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return tm(e.elements,t)}))},Oh.prototype.canConnectMessageFlow=Zh,Oh.prototype.canConnectSequenceFlow=Jh,Oh.prototype.canConnectDataAssociation=Qh,Oh.prototype.canConnectAssociation=Yh,Oh.prototype.canMove=Wh,Oh.prototype.canAttach=Uh,Oh.prototype.canReplace=Gh,Oh.prototype.canDrop=Lh,Oh.prototype.canInsert=em,Oh.prototype.canCreate=Kh,Oh.prototype.canConnect=Ih,Oh.prototype.canResize=Xh,Oh.prototype.canCopy=tm;var im={__depends__:[Ls],__init__:["bpmnRules"],bpmnRules:["type",Oh]};function om(e,t){e.on("saveXML.start",2e3,(function(){_(t.getRootElements(),(function(e){var t,n=Pi(e);t=k(w(ft([e],!1),(function(t){return t!==e&&!t.labelTarget})),Pi),n.set("planeElement",t)}))}))}om.$inject=["eventBus","canvas"];var am={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",om]};function sm(e){Yo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function pm(e,t,n){sm.call(this,e);var r=[{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:FlowElementsContainer"]}},{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:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=b(r,(function(t){return _i(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error("no order for <"+e.id+">");return t}this.getOrdering=function(e,n){if(e.labelTarget)return{parent:t.findRoot(e.labelTarget)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!_i(r,n);)r=r.parent;if(!r)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return r}(e,n,r.containers));var o=n.children.indexOf(e),a=x(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}sm.prototype.getOrdering=function(e,t){return null},r(sm,Yo),pm.$inject=["eventBus","canvas","translate"],r(pm,sm);var lm={__depends__:[so],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",pm]};function cm(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}cm.$inject=["eventBus","injector"],cm.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},cm.prototype.canExecute=function(e,t){var n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},cm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},cm.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},cm.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},cm.prototype.register=function(e,t){this._setHandler(e,t)},cm.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)},cm.prototype.canUndo=function(){return!!this._getUndoAction()},cm.prototype.canRedo=function(){return!!this._getRedoAction()},cm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},cm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},cm.prototype._internalUndo=function(e){var t=this,n=e.command,r=e.context,i=this._getHandler(n);this._atomicDo((function(){t._fire(n,"revert",e),i.revert&&t._markDirty(i.revert(r)),t._revertedAction(e),t._fire(n,"reverted",e)}))},cm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var r,i,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),r=0;(i=a[r])&&(o=this._eventBus.fire("commandStack."+i,n),!n.cancelBubble);r++);return o},cm.prototype._createId=function(){return this._uid++},cm.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},cm.prototype._internalExecute=function(e,t){var n=this,r=e.command,i=e.context,o=this._getHandler(r);if(!o)throw new Error("no command handler registered for <"+r+">");this._pushAction(e),t||(this._fire(r,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(r,"preExecuted",e)),this._atomicDo((function(){n._fire(r,"execute",e),o.execute&&n._markDirty(o.execute(i)),n._executedAction(e,t),n._fire(r,"executed",e)})),t||(this._fire(r,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(r,"postExecuted",e)),this._popAction(e)},cm.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},cm.prototype._popAction=function(){var e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:R("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},cm.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=d(e)?e:[e],t.dirty=t.dirty.concat(e))},cm.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},cm.prototype._revertedAction=function(e){this._stackIdx--},cm.prototype._getHandler=function(e){return this._handlerMap[e]},cm.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 um={commandStack:["type",cm]},dm=new Fo("tt");function hm(e,t){e.style.display=!1===t?"none":""}var mm=".djs-tooltip";function fm(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=dm,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),r=fe('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(r,n.firstChild),r);var i=this;me.bind(this._tooltipRoot,mm,"mousedown",(function(e){e.stopPropagation()})),me.bind(this._tooltipRoot,mm,"mouseover",(function(e){i.trigger("mouseover",e)})),me.bind(this._tooltipRoot,mm,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}fm.$inject=["eventBus","canvas"],fm.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=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},fm.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Y(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},fm.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},fm.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},fm.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},fm.prototype.remove=function(e){var t=this.get(e);t&&(xe(t.html),xe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},fm.prototype.show=function(){hm(this._tooltipRoot)},fm.prototype.hide=function(){hm(this._tooltipRoot,!1)},fm.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},fm.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),y(r)&&(r=fe(r)),(t=fe('<div data-tooltip-id="'+n+'" class="'+'djs-tooltip" style="position: absolute">')).appendChild(r),e.type&&te(t).add("djs-tooltip-"+e.type),e.className&&te(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},fm.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){q(e.style,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},fm.prototype._updateTooltipVisibilty=function(e){_(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),hm(r,i))}))},fm.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",(function(t){e.hide()})),this._eventBus.on("canvas.viewbox.changed",(function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}))};var ym={__init__:["tooltips"],tooltips:["type",fm]};function gm(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 vm(e,t,n){Yo.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=bm(n),t.validatedShapes=bm(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];_(n,(function(e){_(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),_(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];_(n,(function(e){_(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;gm((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,r=n.labelTarget;r&&(t.labelTargetIndex=Pt(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Et(r.labels,n,i),n.labelTarget=r)}))}function bm(e){return w(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}r(vm,Yo),vm.$inject=["injector","eventBus","modeling"];var xm={__init__:["labelSupport"],labelSupport:["type",vm]},wm="attach-ok";function _m(e,t,n,r,i){Yo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=Em(t=i),D("id",t,n)),r.validatedShapes=function(e){var t=A(e,"id");return w(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;_(Em(t.shapes),(function(e){o.makeDraggable(t,e,!0),_(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,wm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,wm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;_(Em(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,r=t.newHost;r&&1!==n.length||_(r?n:w(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){_(e.context.shapes,(function(e){_(e.attachers,(function(e){_(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),_(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;gm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&_(o.attachers,(function(e){var t=kd(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;!1!==(t.hints||{}).attachSupport&&_(a,(function(e){var t=kd(e,r,o);i.moveShape(e,t,e.parent),_(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;gm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function Em(e){return a(k(e,(function(e){return e.attachers||[]})))}r(_m,Yo),_m.$inject=["injector","eventBus","canvas","rules","modeling"];var Pm={__depends__:[Ls],__init__:["attachSupport"],attachSupport:["type",_m]};function Om(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Om.$inject=["eventBus","dragging"],Om.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)},Om.prototype.isActive=function(e){return e&&this._active===e},Om.prototype.length=function(e){return this._tools.length},Om.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Om.prototype.bindEvents=function(e,t){var n=this._eventBus,r=this._dragging,i=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void r.cancel();this.setActive(e)}),this),_(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&se(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Sm={__depends__:[zs],__init__:["toolManager"],toolManager:["type",Om]};function km(e,t){return-1!==e.indexOf(t)}var Cm=Math.abs,Tm=Math.round,Mm={x:"width",y:"height"},Am="crosshair",Rm={n:"top",w:"left",s:"bottom",e:"right"},Dm={n:"s",w:"e",s:"n",e:"w"};function zm(e,t,n,r,i,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){s.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",1500,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=s.init(e,t)),n&&Nm(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,a=t.resizingShapes,p=t.start;if(t.initialized){Nm(e);var l={x:0,y:0};l[r]=Tm(e["d"+r]),s.makeSpace(o,a,l,i,p),n.once("spaceTool.ended",(function(e){s.activateSelection(e.originalEvent,!0,!0)}))}}))}function jm(e){return{top:e.top-20,right:e.right+20,bottom:e.bottom+20,left:e.left-20}}function Nm(e){var t,n,r=e.context.spaceToolConstraints;r&&(m(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),m(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),m(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),m(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Bm(e,t){return-1!==e.indexOf(t)}function Im(e){return!!e.waypoints}function Lm(e){return!!e.labelTarget}zm.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],zm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Am,data:{context:{reactivate:n}},trapClick:!1})},zm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Am,data:{context:{}}})},zm.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},zm.prototype.init=function(e,t){var n=Cm(e.dx)>Cm(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Cm(r)<5)return!1;r<0&&(r*=-1),So(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),a=ft(this._canvas.getRootElement(),!0),s=this.calculateAdjustments(a,n,r,i);return q(t,s,{axis:n,direction:o,spaceToolConstraints:function(e,t,n,r,i){var o=e.movingShapes,a=e.resizingShapes;if(!a.length)return;var s,p,l={};return _(a,(function(e){var c,u,d,h=hn(e),f=w(e.children,(function(e){return!(Im(e)||Lm(e)||Bm(o,e)||Bm(a,e))})),y=w(e.children,(function(e){return!Im(e)&&!Lm(e)&&Bm(o,e)}));f.length&&(u=jm(hn(yt(f))),c=r-h[Rm[n]]+u[Rm[n]],"n"===n?l.bottom=p=m(p)?Math.min(p,c):c:"w"===n?l.right=p=m(p)?Math.min(p,c):c:"s"===n?l.top=s=m(s)?Math.max(s,c):c:"e"===n&&(l.left=s=m(s)?Math.max(s,c):c)),y.length&&(d=jm(hn(yt(y))),c=r-d[Rm[Dm[n]]]+h[Rm[Dm[n]]],"n"===n?l.bottom=p=m(p)?Math.min(p,c):c:"w"===n?l.right=p=m(p)?Math.min(p,c):c:"s"===n?l.top=s=m(s)?Math.max(s,c):c:"e"===n&&(l.left=s=m(s)?Math.max(s,c):c));var g=i&&i[e.id];g&&("n"===n?(c=r+e[Mm[t]]-g[Mm[t]],l.bottom=p=m(p)?Math.min(p,c):c):"w"===n?(c=r+e[Mm[t]]-g[Mm[t]],l.right=p=m(p)?Math.min(p,c):c):"s"===n?(c=r-e[Mm[t]]+g[Mm[t]],l.top=s=m(s)?Math.max(s,c):c):"e"===n&&(c=r-e[Mm[t]]+g[Mm[t]],l.left=s=m(s)?Math.max(s,c):c))})),l}(s,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:s.resizingShapes,start:i})),start:i}),ja("resize-"+("x"===n?"ew":"ns")),!0},zm.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],a=[];return _(e,(function(e){if(e.parent&&!Im(e)){var s=e[t],p=s+e[Mm[t]];return n>0&&s>r||n<0&&p<r?o.push(e):s<r&&p>r&&i.allowed("shape.resize",{shape:e})?a.push(e):void 0}})),{movingShapes:o,resizingShapes:a}},zm.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},zm.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var $m="djs-dragging",Fm="djs-resizing",Vm=Math.max;function Hm(e,t,n,r,i){function o(e,t){_(e,(function(e){i.addDragger(e,t),n.addMarker(e,$m)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=Ie("g");Oe(s,r.cls("djs-crosshair-group",["no-events"])),_e(t,s);var p=Ie("path");Oe(p,"d",o),Me(p).add("djs-crosshair"),_e(s,p);var l=Ie("path");Oe(l,"d",a),Me(l).add("djs-crosshair"),_e(s,l),i.crosshairGroup=s})),e.on("spaceTool.selection.move",(function(e){Kn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Re(t)})),e.on("spaceTool.move",250,(function(e){var a=e.context,s=a.line,p=a.axis,l=a.movingShapes,c=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");Oe(s=Ie("path"),"d","M0,0 L0,0"),Me(s).add("djs-crosshair"),_e(u,s),a.line=s;var d=Ie("g");Oe(d,r.cls("djs-drag-group",["no-events"])),_e(n.getActiveLayer(),d),o(l,d),o(a.movingConnections=t.filter((function(e){var t=!1;_(l,(function(n){_(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;_(l,(function(t){_(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;_(c,(function(t){_(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return _(c,(function(t){_(t.incoming,(function(t){e===t&&(i=!0)}))})),function(e){return e.waypoints}(e)&&(t||r)&&(n||i)})),d),a.dragGroup=d}if(!a.frameGroup){var h=Ie("g");Oe(h,r.cls("djs-frame-group",["no-events"])),_e(n.getActiveLayer(),h);var m=[];_(c,(function(e){var t=i.addFrame(e,h),r=t.getBBox();m.push({element:t,initialBounds:r}),n.addMarker(e,Fm)})),a.frameGroup=h,a.frames=m}Oe(s,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[p]});var f={x:e.dx,y:e.dy};f[{x:"y",y:"x"}[a.axis]]=0,Kn(a.dragGroup,f.x,f.y),_(a.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===a.direction?Oe(r,{width:Vm(i.width+f.x,5)}):Oe(r,{width:t=Vm(i.width-f.x,5),x:i.x+i.width-t}),"s"===a.direction?Oe(r,{height:Vm(i.height+f.y,5)}):Oe(r,{height:n=Vm(i.height-f.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,p=t.frameGroup;_(r,(function(e){n.removeMarker(e,$m)})),_(i,(function(e){n.removeMarker(e,$m)})),s&&(Re(a),Re(s)),_(o,(function(e){n.removeMarker(e,Fm)})),p&&Re(p)}))}Hm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var qm={__init__:["spaceToolPreview"],__depends__:[zs,Ls,Sm,rl,_l],spaceTool:["type",zm],spaceToolPreview:["type",Hm]};function Um(e){this._model=e}function Gm(e,t,n,r){Yo.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){_(e.context.oldRoot.children,(function(e){wi(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function a(e){var t=e.context.shape;wi(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function p(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.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"],Wm((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Wm((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Wm((function(e){"label"!==e.context.shape.type&&a(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],Wm((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.reconnect"],Wm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Wm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Wm(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Wm(p)),this.executed("connection.reconnect",Wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ei(n),a=Ei(r),s=Ei(i);o.conditionExpression&&!_i(s,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&a.default===o&&(t.oldDefault=a.default,delete a.default)}))),this.reverted("connection.reconnect",Wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ei(n),a=Ei(r),s=Ei(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(a.default=t.oldDefault,delete s.default)}))),this.executed(["element.updateAttachment"],Wm(l)),this.reverted(["element.updateAttachment"],Wm(l))}function Wm(e){return function(t){var n=t.context;wi(n.shape||n.connection,"bpmn:BaseElement")&&e(t)}}function Km(e,t,n){Vn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Xm(e,t,n){e[n]=t[n],delete t[n]}function Ym(e,t){this._modeling=e,this._canvas=t}function Zm(e){this._modeling=e}function Jm(e,t){this._canvas=e,this._layouter=t}Um.$inject=["moddle"],Um.prototype._needsId=function(e){return _i(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"])},Um.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=wi(e,"bpmn:Activity")?"Activity":wi(e,"bpmn:Event")?"Event":wi(e,"bpmn:Gateway")?"Gateway":_i(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},Um.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Um.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Um.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Um.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Um.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},Um.prototype.createDiWaypoint=function(e){return this.create("dc:Point",W(e,["x","y"]))},Um.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Um.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))},r(Gm,Yo),Gm.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Gm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},Gm.prototype.updateParent=function(e,t){if(!(e instanceof Ln||wi(e,"bpmn:DataStoreReference")&&e.parent&&wi(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Pi(e),o=n&&n.businessObject,a=Pi(n);wi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),wi(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),wi(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),wi(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,a)}},Gm.prototype.updateBounds=function(e){var t=Pi(e),n=function(e){if(!wi(e,"bpmn:Activity"))return;var t=Pi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=La(n,t.get("bounds"));q(n,{x:e.x+r.x,y:e.y+r.y})}var i=e instanceof Ln?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),q(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Gm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(wi(n,"bpmn:Lane")&&_t(n.get("flowNodeRef"),e),wi(t,"bpmn:Lane")&&Et(t.get("flowNodeRef"),e))},Gm.prototype.updateDiConnection=function(e,t,n){var r=Pi(e),i=Pi(t),o=Pi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Ei(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Ei(n)&&(r.targetElement=n&&o)},Gm.prototype.updateDiParent=function(e,t){if(t&&!wi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(_t(n,e),e.$parent=null)}},Gm.prototype.getLaneSet=function(e){var t,n;return wi(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(wi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},Gm.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!wi(e,"bpmn:DataInput")&&!wi(e,"bpmn:DataOutput")||(wi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(wi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(wi(e,"bpmn:FlowElement")){if(t)if(wi(t,"bpmn:Participant"))t=t.processRef;else if(wi(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(wi(t,"bpmn:Lane"));r="flowElements"}else if(wi(e,"bpmn:Artifact")){for(;t&&!wi(t,"bpmn:Process")&&!wi(t,"bpmn:SubProcess")&&!wi(t,"bpmn:Collaboration");){if(wi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(wi(e,"bpmn:MessageFlow"))r="messageFlows";else if(wi(e,"bpmn:Participant")){r="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!wi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(_t(o.get("rootElements"),a),a.$parent=null),t&&(Et(o.get("rootElements"),a),a.$parent=o))}else wi(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":wi(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&_t(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var p=n.get(r);_t(s,e),t&&(p||(p=[],t.set(r,p)),p.push(e))}}},Gm.prototype.updateConnectionWaypoints=function(e){Pi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Gm.prototype.updateConnection=function(e){var t,n=e.connection,r=Ei(n),i=n.source,o=Ei(i),a=n.target,s=Ei(n.target);if(wi(r,"bpmn:DataAssociation"))wi(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||s,this.updateSemanticParent(r,s,t)):wi(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=s);else{var p=wi(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(p&&(_t(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==s&&(p&&(_t(r.targetRef&&r.targetRef.get("incoming"),r),s&&s.get("incoming")&&s.get("incoming").push(r)),r.targetRef=s)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,a)},Gm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},r(Km,Vn),Km.$inject=["bpmnFactory","moddle","translate"],Km.prototype.baseCreate=Vn.prototype.create,Km.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this.baseCreate(e,q({type:"label",di:n},po,t))}return this.createBpmnElement(e,t)},Km.prototype.createBpmnElement=function(e,t){var n,r,i,o=this._translate,a=(t=t||{}).businessObject,s=t.di;if(!a){if(!t.type)throw new Error(o("no shape type specified"));vi(a=this._bpmnFactory.create(t.type))}if(!_i(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var p=q(s||{},{id:a.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(a,p):"connection"===e?this._bpmnFactory.createDiEdge(a,p):this._bpmnFactory.createDiShape(a,p)}return wi(a,"bpmn:Group")&&(t=q({isFrame:!0},t)),function(e,t,n){_(n,(function(n){void 0!==t[n]&&Xm(e,t,n)}))}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&Xm(s,t,"isExpanded"),wi(a,"bpmn:SubProcess")&&(t.collapsed=!Bi(a,s)),wi(a,"bpmn:ExclusiveGateway")&&(s.isMarkerVisible=!0),t.eventDefinitionType&&(r=a.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=a,a.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(a,s),t=q({id:a.id},n,t,{businessObject:a,di:s}),this.baseCreate(e,t)},Km.prototype.getDefaultSize=function(e,t){var n=Ei(e);return t=t||Pi(e),wi(n,"bpmn:SubProcess")?Bi(n,t)?{width:350,height:200}:{width:100,height:80}:wi(n,"bpmn:Task")?{width:100,height:80}:wi(n,"bpmn:Gateway")?{width:50,height:50}:wi(n,"bpmn:Event")?{width:36,height:36}:wi(n,"bpmn:Participant")?Bi(n,t)?{width:600,height:250}:{width:400,height:60}:wi(n,"bpmn:Lane")?{width:400,height:100}:wi(n,"bpmn:DataObjectReference")?{width:36,height:50}:wi(n,"bpmn:DataStoreReference")?{width:50,height:50}:wi(n,"bpmn:TextAnnotation")?{width:100,height:30}:wi(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Km.prototype.createParticipantShape=function(e){return h(e)||(e={isExpanded:e}),!1!==(e=q({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Ym.$inject=["modeling","canvas"],Ym.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;_(n,(function(e){var n={x:0,y:0};r.left?n.x=r.left-e.x:r.right?n.x=r.right-e.width-e.x:r.center?n.x=r.center-Math.round(e.width/2)-e.x:r.top?n.y=r.top-e.y:r.bottom?n.y=r.bottom-e.height-e.y:r.middle&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},Ym.prototype.postExecute=function(e){},Zm.$inject=["modeling"],Zm.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},Zm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,S(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Jm.$inject=["canvas","layouter"],Jm.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,a=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,i,o),t},Jm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Qm=Math.round;function ef(e){this._modeling=e}function tf(e){return!!e.waypoints}ef.$inject=["modeling"],ef.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,a=this._modeling;_(t,(function(e){m(e.x)||(e.x=0),m(e.y)||(e.y=0)}));var s=yt(w(t,(function(e){return!e.hidden})));_(t,(function(e){tf(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:Qm(e.x-s.x-s.width/2+i.x),y:Qm(e.y-s.y-s.height/2+i.y)}}))),q(e,{x:Qm(e.x-s.x-s.width/2+i.x),y:Qm(e.y-s.y-s.height/2+i.y)})}));var p=ut(t),l={};_(t,(function(e){if(tf(e))l[e.id]=m(r)?a.createConnection(l[e.source.id],l[e.target.id],r,e,e.parent||n,o):a.createConnection(l[e.source.id],l[e.target.id],e,e.parent||n,o);else{var t=q({},o);-1===p.indexOf(e)&&(t.autoResize=!1),l[e.id]=m(r)?a.createShape(e,W(e,["x","y","width","height"]),e.parent||n,r,t):a.createShape(e,W(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=M(l)};var nf=Math.round;function rf(e){this._canvas=e}function of(e){rf.call(this,e)}rf.$inject=["canvas"],rf.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?q(t,n):q(t,{x:n.x-nf(t.width/2),y:n.y-nf(t.height/2)}),this._canvas.addShape(t,r,i),t},rf.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},r(of,rf),of.$inject=["canvas"];var af=rf.prototype.execute;of.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,af.call(this,e)};var sf=rf.prototype.revert;function pf(e,t){this._canvas=e,this._modeling=t}function lf(e,t){this._modeling=e,this._elementRegistry=t}function cf(e,t){this._canvas=e,this._modeling=t}function uf(e){this._modeling=e}of.prototype.revert=function(e){return e.shape.labelTarget=null,sf.call(this,e)},pf.$inject=["canvas","modeling"],pf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},pf.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Et(n.children,t,r),this._canvas.addConnection(t,n),t},lf.$inject=["modeling","elementRegistry"],lf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;_(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},cf.$inject=["canvas","modeling"],cf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;gm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),gm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),gm(n.children,(function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},cf.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pt(r.children,n),t.removeShape(n),n},cf.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Et(r.children,n,i),t.addShape(n,r),n},uf.$inject=["modeling"];var df={x:"y",y:"x"};function hf(e,t){this._layouter=e,this._canvas=t}function mf(){}function ff(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function yf(e){this._modeling=e}function gf(e){this._helper=new yf(e)}function vf(e){this._modeling=e,this._helper=new yf(e)}function bf(e){this._modeling=e}function xf(e){return e.original||e}function wf(e,t){this._modeling=e,this._rules=t}function _f(e){this._modeling=e}function Ef(e){this._modeling=e}function Pf(e){return q({},e)}function Of(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Sf(e,t,n){var r=Of(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function kf(e,t){return-1!==e.indexOf(t)}function Cf(e){this._modeling=e}function Tf(e){var t={};return _(e,(function(e){t[e.id]=e.hidden,e.children&&(t=q({},t,Tf(e.children)))})),t}function Mf(e,t){var n=[];return _(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Mf(e.children,e.collapsed||t)))})),n}function Af(e,t){var n=[];return _(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Af(e.children,t)))})),n}function Rf(e){this._modeling=e}function Df(e,t){return _t(e&&e.attachers,t)}function zf(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Et(r,t,n)}}function jf(){}function Nf(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function Bf(e){this._elementRegistry=e}function If(e,t){_(t,(function(t,n){e.set(n,t)}))}uf.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function a(e){return e[r]+e[i]/2}function s(e){return e.length-1}function p(e){return e.max-e.min}var l,c,u=n[0],d=s(n),h=n[d],m=0;_(n,(function(e,l){var c,u,h;e.elements.length<2?l&&l!==n.length-1&&(o(e,e.elements[0]),m+=p(e.range)):(u=(c=z(e.elements,r))[0],l===d&&(u=c[s(c)]),h=a(u),e.range=null,_(c,(function(n){!function(e,n){var i={y:0};i[r]=e-a(n),i[r]&&(i[df[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),l&&l!==n.length-1&&(m+=p(e.range)))})),c=Math.abs(h.range.min-u.range.max),(l=Math.round((c-m)/(n.length-1)))<n.length-1||_(n,(function(e,o){var a,s={};e!==u&&e!==h&&(a=n[o-1],e.range.max=0,_(e.elements,(function(n,o){s[df[r]]=0,s[r]=a.range.max-n[r]+l,e.range.min!==n[r]&&(s[r]+=n[r]-e.range.min),s[r]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},uf.prototype.postExecute=function(e){},hf.$inject=["layouter","canvas"],hf.prototype.execute=function(e){var t=e.connection;return q(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},hf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},mf.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(r.children,t,i),t.parent=r,_(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},mf.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return _t(n.children,t),Et(r.children,t,i),t.parent=r,_(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},ff.prototype.add=function(e,t){return this.addAll([e],t)},ff.prototype.addAll=function(e,t){return q(this,function(e,t,n){l(t)&&(t=!0),h(t)&&(n=t,t=!0);var r=bt((n=n||{}).allShapes),i=bt(n.allConnections),o=bt(n.enclosedElements),a=bt(n.enclosedConnections),s=bt(n.topLevel,t&&A(e,(function(e){return e.id})));function p(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return mt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,_(e.incoming,p),_(e.outgoing,p),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},yf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},yf.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,a=e.allShapes,s=e.allConnections,p=e.enclosedConnections,l=e.topLevel,c=!1;i&&i.parent===n&&(c=!0),_(a,(function(e){o.moveShape(e,t,l[e.id]&&!c&&n,{recurse:!1,layout:!1})})),_(s,(function(e){var r=!!a[e.source.id],i=!!a[e.target.id];p[e.id]&&r&&i?o.moveConnection(e,t,l[e.id]&&!c&&n):o.layoutConnection(e,{connectionStart:r&&jd(e,e.source,t),connectionEnd:i&&Nd(e,e.target,t)})}))},yf.prototype.getClosure=function(e){return(new ff).addAll(e,!0)},gf.$inject=["modeling"],gf.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},gf.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)},vf.$inject=["modeling"],vf.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=W(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(r.children,t,i),q(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},vf.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(_(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:Nd(e,t,n)})})),_(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:jd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},vf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Et(n.children,t,r),q(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},vf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},vf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},bf.$inject=["modeling"],bf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return d(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},bf.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(a.connectionStart=a.connectionStart||xf(d(i)?i[0]:i)),!r||n&&"target"!==o.docking||(a.connectionEnd=a.connectionEnd||xf(d(i)?i[i.length-1]:i)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},bf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},wf.$inject=["modeling","rules"],wf.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,a=e.newData,s=e.hints||{};function p(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var l,c={x:a.x,y:a.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(a,c,o.parent,s),o.host&&r.updateAttachment(t,o.host),!1!==s.moveChildren&&(l=o.children.slice(),r.moveElements(l,{x:0,y:0},t,s));var d=o.incoming.slice(),h=o.outgoing.slice();_(d,(function(e){p(e.source,t,e)&&n.reconnectEnd(e,t,zd(e,t,u),s)})),_(h,(function(e){var r=e.target;p(t,r,e)&&n.reconnectStart(e,t,Dd(e,t,u),s)}))},wf.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},wf.prototype.execute=function(e){},wf.prototype.revert=function(e){},wf.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},wf.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},wf.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},_f.$inject=["modeling"],_f.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=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(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&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},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},_f.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(_(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:zd(e,n,r)})})),_(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Dd(e,n,r)})})))},_f.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ef.$inject=["modeling"],Ef.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,a={};this.moveShapes(r,t),_(i,(function(e){a[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return _(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;_(i.concat(o),(function(r){var i=r.source,o=r.target;(km(e,i)||km(e,o)||km(t,i)||km(t,o))&&(km(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,a)},Ef.prototype.execute=function(){},Ef.prototype.revert=function(){},Ef.prototype.moveShapes=function(e,t){var n=this;_(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Ef.prototype.resizeShapes=function(e,t,n){var r=this;_(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,a=e.height,s=n.x,p=n.y;switch(t){case"n":return{x:r,y:i+p,width:o,height:a-p};case"s":return{x:r,y:i,width:o,height:a+p};case"w":return{x:r+s,y:i,width:o-s,height:a};case"e":return{x:r,y:i,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Ef.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,a){var s=this,p=i.concat(o);_(e,(function(e){var l=e.source,c=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=Pf(e)).original&&(e.original=Pf(e.original)),e}))}(e),d=Of(n),h={labelBehavior:!1};kf(p,l)&&kf(p,c)?(u=k(u,(function(e){return Sf(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Sf(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(kf(p,l)||kf(p,c))&&(kf(i,l)?h.connectionStart=jd(e,l,t):kf(i,c)?h.connectionEnd=Nd(e,c,t):kf(o,l)?h.connectionStart=Dd(e,l,a[l.id]):kf(o,c)&&(h.connectionEnd=zd(e,c,a[c.id])),s._modeling.layoutConnection(e,h))}))},Cf.$inject=["modeling"],Cf.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Tf(n),t.collapsed=!t.collapsed;var r=Mf(n,t.collapsed);return[t].concat(r)},Cf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=Af(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},Rf.$inject=["modeling"],Rf.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Df(r,t),zf(n,t),t.host=n,t},Rf.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Df(n,t),zf(r,t,i),t},jf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},jf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Nf.$inject=["eventBus","elementFactory","commandStack"],Nf.prototype.getHandlers=function(){return{"shape.append":Zm,"shape.create":rf,"shape.delete":cf,"shape.move":vf,"shape.resize":_f,"shape.replace":wf,"shape.toggleCollapse":Cf,spaceTool:Ef,"label.create":of,"connection.create":Jm,"connection.delete":pf,"connection.move":mf,"connection.layout":hf,"connection.updateWaypoints":jf,"connection.reconnect":bf,"elements.create":ef,"elements.move":gf,"elements.delete":lf,"elements.distribute":uf,"elements.align":Ym,"element.updateAttachment":Rf}},Nf.prototype.registerHandlers=function(e){_(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Nf.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},Nf.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Nf.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,a=n;!0===o?(i=n,a=n.parent):!1===o&&(i=null);var s={shapes:e,delta:t,newParent:a,newHost:i,hints:r};this._commandStack.execute("elements.move",s)},Nf.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},Nf.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Nf.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var a={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Nf.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,a,s=(i=i||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var p={position:t,shape:e,parent:o,parentIndex:r,host:a,hints:i};return this._commandStack.execute("shape.create",p),p.shape},Nf.prototype.createElements=function(e,t,n,r,i){d(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},Nf.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},Nf.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},Nf.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Nf.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},Nf.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Nf.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Nf.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},Nf.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Nf.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},Nf.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},Nf.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},Nf.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},Nf.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,q(r,{docking:"source"}))},Nf.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,q(r,{docking:"target"}))},Nf.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},Nf.prototype._create=function(e,t){return t instanceof Nn?t:this._elementFactory.create(e,t)},Nf.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Bf.$inject=["elementRegistry"],Bf.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this.getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return P(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,C(r));return If(n,r),e.oldProperties=o,e.changed=i,i},Bf.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return If(n,t),r},Bf.prototype.getVisualReferences=function(e){var t=this._elementRegistry;return wi(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return wi(t,"bpmn:DataObjectReference")&&Ei(t).dataObjectRef===e}))}(e,t):[]};var Lf="default",$f="id",Ff="di",Vf={width:0,height:0};function Hf(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function qf(e,t){return $f in e&&e.id!==t.id}function Uf(e,t){var n=e.businessObject,r=Pi(e);_(t,(function(e,t){t!==Ff?n.set(t,e):r&&function(e,t){_(t,(function(t,n){e.set(n,t)}))}(r,e)}))}Hf.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Hf.prototype.execute=function(e){var t=e.element,n=[t],r=this._translate;if(!t)throw new Error(r("element required"));var i=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=q({},e);return Gf.forEach((function(n){n in e&&(t[n]=Ei(t[n]))})),t}(e.properties),p=e.oldProperties||function(e,t){var n=C(t),r=e.businessObject,i=Pi(e);return P(n,(function(e,n){return e[n]=n!==Ff?r.get(n):function(e,t){return P(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,C(t.di)),e}),{})}(t,s);return qf(s,a)&&(o.unclaim(a.id),i.updateId(t,s.id),o.claim(s.id,a)),Lf in s&&(s.default&&n.push(i.get(s.default.id)),a.default&&n.push(i.get(a.default.id))),Uf(t,s),e.oldProperties=p,e.changed=n,n},Hf.prototype.postExecute=function(e){var t=e.element.label,n=t&&Ei(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,Vf)}},Hf.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Uf(t,r),qf(n,i)&&(a.unclaim(n.id),o.updateId(t,r.id),a.claim(r.id,i)),e.changed};var Gf=["default"];function Wf(e,t){this._canvas=e,this._modeling=t}function Kf(e,t){this._modeling=e,this._spaceTool=t}function Xf(e,t){this._modeling=e,this._translate=t}function Yf(e,t){this._modeling=e,this._spaceTool=t}Wf.$inject=["canvas","modeling"],Wf.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,a=o.$parent,s=Pi(i);t.setRootElement(n),t.removeRootElement(i),Et(a.rootElements,r),r.$parent=a,_t(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i},Wf.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,a=r.$parent,s=Pi(n);t.setRootElement(i),t.removeRootElement(n),_t(a.rootElements,r),r.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s},Kf.$inject=["modeling","spaceTool"],Kf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=xc(r),a=o===r,s=a?r:r.parent;bc(s).length||n.createShape({type:"bpmn:Lane"},{x:r.x+gc,y:r.y,width:r.width-gc,height:r.height},s);var p=[];mt(o,(function(e){return p.push(e),e.label&&p.push(e.label),e===r?[]:w(e.children,(function(e){return e!==r}))}));var l="top"===i?-120:120,c="top"===i?r.y:r.y+r.height,u=c+("top"===i?10:-10),d="top"===i?"n":"s",h=t.calculateAdjustments(p,"y",l,u);t.makeSpace(h.movingShapes,h.resizingShapes,{x:0,y:l},d,u),e.newLane=n.createShape({type:"bpmn:Lane"},{x:r.x+(a?gc:0),y:c-("top"===i?120:0),width:r.width-(a?gc:0),height:120},s)},Xf.$inject=["modeling","translate"],Xf.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=bc(r),a=o.length;if(a>i)throw new Error(n("more than {count} child lanes",{count:i}));var s,p,l,c,u,d=Math.round(r.height/i);for(u=0;u<i;u++)s=r.y+u*d,p=u===i-1?r.height-d*u:d,l={x:r.x+gc,y:s,width:r.width-gc,height:p},u<a?t.resizeShape(o[u],l):(c={type:"bpmn:Lane"},t.createShape(c,l,r))},Yf.$inject=["modeling","spaceTool"],Yf.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Yf.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=wc(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},Yf.prototype.resizeSpace=function(e,t){var n,r,i,o,a,s=this._spaceTool,p=hn(e),l=cc(hn(t),p),c=xc(e),u=[],d=[];mt(c,(function(e){return u.push(e),(wi(e,"bpmn:Lane")||wi(e,"bpmn:Participant"))&&d.push(e),e.children})),(l.bottom||l.top)&&(n=l.bottom||l.top,r=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),i=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,r),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},i)),(l.left||l.right)&&(n=l.right||l.left,r=e.x+(l.right?e.width:0)+(l.right?-10:100),i=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,r),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},i))};var Zf="flowNodeRef",Jf="lanes";function Qf(e){this._elementRegistry=e}function ey(e){this._moddle=e}Qf.$inject=["elementRegistry"],Qf.prototype.computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function a(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function s(e){return e.parent?function(e){var t=xc(e);return i[t.id]||(i[t.id]=vc(t)),i[t.id]}(e).filter((function(t){return n=e,r=hn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject})):[]}return t.forEach((function(e){var t=xc(e);t&&-1===n.indexOf(t)&&(t.children.filter((function(e){return wi(e,"bpmn:FlowNode")})).forEach(a),n.push(t))})),e.forEach(a),o.forEach((function(e){var t=e.businessObject,n=t.get(Jf).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(Zf).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},Qf.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(Jf);e.remove.forEach((function(e){_t(n,e),_t(e.get(Zf),t)})),e.add.forEach((function(e){Et(n,e),Et(e.get(Zf),t)}))}))},Qf.prototype.revert=function(e){e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Jf);e.add.forEach((function(e){_t(n,e),_t(e.get(Zf),t)})),e.remove.forEach((function(e){Et(n,e),Et(e.get(Zf),t)}))}))},ey.$inject=["moddle"],ey.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;e.claiming?t.claim(n,r):t.unclaim(n)},ey.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;e.claiming?t.unclaim(n):t.claim(n,r)};var ty={fill:void 0,stroke:void 0};function ny(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(y(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error("invalid color value: "+e)}}}ny.$inject=["commandStack"],ny.prototype.postExecute=function(e){var t=e.elements,n=e.colors||ty,r=this,i={};"fill"in n&&q(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(i,{"border-color":this._normalizeColor(n.stroke)}),_(t,(function(e){var t=function(e){return!!e.waypoints}(e)?W(i,["border-color"]):i;!function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),e.labelTarget?r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:Pi(e).label,properties:{color:i["background-color"]}}):r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}))};var ry={width:0,height:0};function iy(e,t,n){function r(e,t){var r=e.label||e,i=e.labelTarget||e;return function(e,t,n){var r=e.businessObject,i=Fi(r);i&&("categoryValueRef"===i?r.categoryValueRef.value=t:r[i]=t)}(r,t),function(e,t){if(!lo(e)){var r=Pi(e);t&&!r.label&&(r.label=n.create("bpmndi:BPMNLabel")),!t&&r.label&&(r.label=null)}}(e,t),[r,i]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!mo(n)&&lo(n)&&!co(n)&&!oy(i)){var o=ho(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=Vi(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,a=n.newBounds,s=n.hints||{};if(mo(i)||wi(i,"bpmn:TextAnnotation"))if(mo(i)&&oy(o))!1!==s.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var p=Vi(i);void 0===a&&(a=t.getExternalLabelBounds(i,p)),a&&e.resizeShape(i,a,ry)}}}function oy(e){return!e||!e.trim()}function ay(e,t,n,r){Nf.call(this,e,t,n),this._bpmnRules=r}function sy(){}iy.$inject=["modeling","textRenderer","bpmnFactory"],r(ay,Nf),ay.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ay.prototype.getHandlers=function(){var e=Nf.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Bf,e["element.updateProperties"]=Hf,e["canvas.updateRoot"]=Wf,e["lane.add"]=Kf,e["lane.resize"]=Yf,e["lane.split"]=Xf,e["lane.updateRefs"]=Qf,e["id.updateClaim"]=ey,e["element.setColor"]=ny,e["element.updateLabel"]=iy,e},ay.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},ay.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},ay.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},ay.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ay.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ay.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ay.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ay.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ay.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ay.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},ay.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ay.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ay.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},sy.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||fn(t.source||e.source),t.connectionEnd||fn(t.target||e.target)]};var py=Math.round,ly={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function cy(e,t,n){var r,i,o,a=yn(t,e,5),s=n.split(":")[0],p=py((t.x-e.x)/2+e.x),l=py((t.y-e.y)/2+e.y),c=(o=a,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[s].test(o)),u=/h|r|l/.test(s),d=!1;return c?(r=u?{x:p,y:e.y}:{x:e.x,y:l},i=u?"h:h":"v:v"):(i=u?"h:v":"v:h",function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(a,s)?u?(d=l===e.y,r={x:e.x+20*(/l/.test(s)?-1:1),y:d?l+20:l}):r={x:(d=p===e.x)?p+20:p,y:e.y+20*(/t/.test(s)?-1:1)}:r={x:p,y:l}),{waypoints:dy(e,r,i).concat(r),directions:i,turnNextDirections:d}}function uy(e){return e.split(":").reverse().join(":")}function dy(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(gy(n)){var r=function(e,t,n){return cy(e,t,n)}(e,t,n),i=function(e,t,n){var r=cy(t,e,uy(n));return{waypoints:r.waypoints.slice().reverse(),directions:uy(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:dy(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=py((t.x-e.x)/2+e.x),i=py((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:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function hy(e,t,n,r,i){var o=E(i&&i.preferredLayouts||[],"straight")[0]||"h:h",a=yn(e,t,ly[o]||0),s=function(e,t){if(gy(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||fn(e),r=r||fn(t);var p=s.split(":");return function(e,t,n){var r=dy(e,t,n);return r.unshift(e),r.push(t),by(r)}(vy(n,e,p[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(a)),vy(r,t,p[1],a),s)}function my(e,t,n,r,i,o){var a;return d(n)&&(i=n,o=r,n=fn(e),r=fn(t)),i=i||[],(a=-1!==(o=q({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,a,s={};if(a=yn(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===i.preserveDocking?fy(o,r,e)?(s[o]=r[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:r.x,y:r.y}]):null:fy(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:r.x,y:void 0!==s.y?s.y:r.y,original:{x:void 0!==s.x?s.x:r.x,y:void 0!==s.y?s.y:r.y}}]):null}(e,t,n,r,o))||(a=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return(i=yy(e,t,n,i))?i.reverse():null}(t,e,r,i))?a:(a=o.connectionStart&&yy(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:hy(e,t,n,r,o))}function fy(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function yy(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!b(e,(function(t,n){var r=e[n-1];return r&&Ot(t,r)<3}))}(r))return null;var i,o=r[0],a=r.slice();return a[0]=n,a[1]=function(e,t,n){switch(kt(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}}(a[1],o,n),(i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Ct(e[r],t,20)||Ct(e[r],n,20))return e.slice(r);return e}(a,e,t))!==a&&(a=yy(e,t,n,i)),a&&kt(a)?null:a}function gy(e){return e&&/t|r|b|l/.test(e)}function vy(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"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 by(e){return e.reduce((function(t,n,r){return St(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var xy={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},wy={top:"t",right:"r",bottom:"b",left:"l"};function _y(){}function Ey(e,t){return wi(t,"bpmn:Participant")?"source":wi(e,"bpmn:Participant")?"target":ky(t)?"source":ky(e)||wi(t,"bpmn:Event")?"target":wi(e,"bpmn:Event")?"source":null}function Py(e){return ky(e)?"target":"source"}function Oy(e,t){return e?e.original||e:fn(t)}function Sy(e,t){return wi(t,"bpmn:Activity")&&wi(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ky(e){return wi(e,"bpmn:SubProcess")&&Bi(e)}function Cy(e,t){return e===t}function Ty(e){var t=/right|left/.exec(e);return t&&t[0]}function My(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ay(e){return"right"===e||"left"===e}function Ry(e,t){var n=t.waypoints,r=n&&n.length&&yn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function Dy(e,t,n){var r,i,o=fn(e),a=fn(t),s=(i=(r=e).host,yn(fn(r),i,-10)),p=Cy(e.host,t),l=-1!==["top","right","bottom","left"].indexOf(s),c=yn(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,a=t?e:My(e),s=wy[a];o=t?Ay(e)?zy("y",n,r,i)?"h":"b":zy("x",n,r,i)?"v":"l":"v";return[s+":"+o]}(s,l,e,t,n):[function(e,t,n){if(n)return wy[e];if(Cy(My(e),My(t))||function(e,t){return xy[e]===t}(Ty(e),Ty(t)))return wy[My(e)];return wy[Ty(e)]}(s,c,l)+":"+function(e,t,n){if(n)return Ay(e)?function(e,t){var n=Ty(e),r=xy[n];return-1!==t.indexOf(r)}(e,t)||Cy(e,t)?"h":"v":function(e,t){var n=My(e),r=xy[n];return-1!==t.indexOf(r)}(e,t)||Cy(e,t)?"v":"h";return Ay(t)||Cy(My(e),My(t))&&Ty(t)?"h":"v"}(s,c,l)]}function zy(e,t,n,r){return!(jy(e,r,n,40)||jy(e,r,{x:n.x+n.width,y:n.y+n.height},40)||jy(e,r,fn(t),40))}function jy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function Ny(e){return q({original:e.point.original||e.point},e.actual)}function By(e,t){this._elementRegistry=e,this._graphicsFactory=t}r(_y,sy),_y.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,a=t.waypoints||e.waypoints,s=t.connectionStart,p=t.connectionEnd;return s||(s=Oy(a&&a[0],i)),p||(p=Oy(a&&a[a.length-1],o)),(wi(e,"bpmn:Association")||wi(e,"bpmn:DataAssociation"))&&a&&!Sy(i,o)?[].concat([s],a.slice(1,-1),[p]):(wi(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:Ey(e,t)}}(i,o):(wi(e,"bpmn:SequenceFlow")||Sy(i,o))&&(n=i===o?{preferredLayouts:Ry(i,e)}:wi(i,"bpmn:BoundaryEvent")?{preferredLayouts:Dy(i,o,p)}:ky(i)||ky(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:Py(e)}}(i):wi(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:wi(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=by(my(i,o,s,p,a,n=q(n,t)))),r||[s,p])},By.$inject=["elementRegistry","graphicsFactory"],By.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(Ny(r)),o.push(Ny(i)),o},By.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},By.prototype._getIntersection=function(e,t,n){return gn(this._getShapePath(e),this._getConnectionPath(t),n)},By.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},By.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},By.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Iy={__init__:["modeling","bpmnUpdater"],__depends__:[Eh,im,am,lm,Hl,um,ym,xm,Pm,$o,Xo,qm],bpmnFactory:["type",Um],bpmnUpdater:["type",Gm],elementFactory:["type",Km],modeling:["type",ay],layouter:["type",_y],connectionDocking:["type",By]},Ly=Math.round;function $y(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function a(e,n,r,i){if(h(r)&&(i=r,r=!1),!n.waypoints&&n.parent){var o=function(e){return{x:e.x+Ly(e.width/2),y:e.y+Ly(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),q(t,{shapes:i=function(e){var t=A(e,"id");return w(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,a={x:e.dx,y:e.dy};t=o(r,a,{x:e.x,y:e.y},i),n.delta=a,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,a=t.shapes;if(!1===i)return!1;r.x=Ly(r.x),r.y=Ly(r.y),0===r.x&&0===r.y||n.moveElements(a,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Oo(e)){var t=wo(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}})),this.start=a}$y.$inject=["eventBus","dragging","modeling","selection","rules"];var Fy="djs-dragging",Vy="drop-ok",Hy="drop-not-ok",qy="new-parent",Uy="attach-ok";function Gy(e,t,n,r){function i(e){return function(e){return w(e,(function(t){return!function(e){return e.waypoints}(t)||b(e,j({id:t.source.id}))&&b(e,j({id:t.target.id}))}))}(o(e))}function o(e){var t=ft(e,!0),n=k(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return a(t.concat(n))}function s(e,n){[Uy,Vy,Hy,qy].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var s=e.context,p=s.shapes,l=s.allDraggedElements,c=i(p);if(!s.dragGroup){var u=Ie("g");Oe(u,n.cls("djs-drag-group",["no-events"])),_e(t.getActiveLayer(),u),s.dragGroup=u}c.forEach((function(e){r.addDragger(e,s.dragGroup)})),_(l=l?a([l,o(p)]):o(p),(function(e){t.addMarker(e,Fy)})),s.allDraggedElements=l,s.differentParents=1!==T(A(p,(function(e){return e.parent&&e.parent.id})))})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?s(r,Uy):t.canExecute&&r&&r.id!==i.id?s(r,qy):s(r,t.canExecute?Vy:Hy)),Kn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&s(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;_(r,(function(e){t.removeMarker(e,Fy)})),i&&Re(i)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Fy),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}Gy.$inject=["eventBus","canvas","styles","previewSupport"];var Wy={__depends__:[Ao,$o,Do,Ls,zs,rl],__init__:["move","movePreview"],move:["type",$y],movePreview:["type",Gy]},Ky=".djs-palette-toggle",Xy=".entry",Yy="open",Zy="two-column";function Jy(e,t){this._eventBus=e,this._canvas=t;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._rebuild()}))}function Qy(e,t){var n=t.getPaletteEntries();return f(n)?n(e):(_(n,(function(t,n){e[n]=t})),e)}Jy.$inject=["eventBus","canvas"],Jy.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Jy.prototype.getEntries=function(){return this._getProviders().reduce(Qy,{})},Jy.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Jy.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=fe(Jy.HTML_MARKUP);n.appendChild(r),te(n).add("djs-palette-shown"),me.bind(r,".djs-palette-toggle, .entry","click",(function(t){var n=t.delegateTarget;if(ae(n,Ky))return e.toggle();e.trigger("click",t)})),ue.bind(r,"mousedown",(function(e){e.stopPropagation()})),me.bind(r,Xy,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Jy.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Jy.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=te(r),a=te(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Zy,t),a.toggle("djs-palette-two-column",t),"open"in e&&(o.toggle(Yy,e.open),a.toggle("djs-palette-open",e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Jy.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();re(e),_(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+r+"]",e);i||(i=fe('<div class="group" data-group="'+r+'"></div>'),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=fe(o);i.appendChild(a),t.separator||(Y(a,"data-action",n),t.title&&Y(a,"title",t.title),t.className&&function(e,t){var n=te(e);(d(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(a,t.className),t.imageUrl&&a.appendChild(fe('<img src="'+t.imageUrl+'">')))})),this.open()},Jy.prototype.trigger=function(e,t,n){var r,i,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(r=a[Y(s,"data-action")])&&(i=r.action,o=t.originalEvent||t,f(i)?"click"===e&&i(o,n):i[e]&&i[e](o,n),t.preventDefault())},Jy.prototype._layoutChanged=function(){this._toggleState({})},Jy.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Jy.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Jy.prototype.open=function(){this._toggleState({open:!0})},Jy.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Jy.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Jy.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),_(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=te(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Jy.prototype.isOpen=function(){return te(this._container).has(Yy)},Jy.prototype._getParentContainer=function(){return this._canvas.getContainer()},Jy.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var eg={__init__:["palette"],palette:["type",Jy]},tg="crosshair";function ng(e,t,n,r,i,o,a){this._selection=i,this._dragging=n,this._mouse=a;var s=this,p=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Ie("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),_e(r,n)},l=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},c=function(e){e.frame&&Re(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){s.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=rg(e),n=r.filter((function(e){return e}));s.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=rg(e),p(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=rg(e),l(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;c(t)})),e.on("element.mousedown",1500,(function(e){if(ko(e))return s.activateLasso(e.originalEvent),!0}))}function rg(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}:t.x>=n.x&&t.y<n.y||t.x>n.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&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.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}}ng.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],ng.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tg,data:{context:{}}})},ng.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tg,data:{context:{}}})},ng.prototype.select=function(e,t){var n=function(e,t){var n={};return _(e,(function(e){var r=e;r.waypoints&&(r=yt(r)),!m(t.y)&&r.x>t.x&&(n[e.id]=e),!m(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(m(t.width)&&m(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:m(t.width)&&m(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select(M(n))},ng.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ng.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var ig={__depends__:[Sm,_l],__init__:["lassoTool"],lassoTool:["type",ng]},og=1500,ag="grab";function sg(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var a=this,s=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",og,(function(e){if(So(e))return a.activateMove(e.originalEvent,!0),!1})),s&&s.addListener(og,(function(e){if(pg(e.keyEvent)&&!a.isActive()){var t=a._mouse.getLastMoveEvent();a.activateMove(t,!!t)}}),"keyboard.keydown"),s&&s.addListener(og,(function(e){pg(e.keyEvent)&&a.isActive()&&a.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",(function(){a.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context.reactivate;return!So(t)&&n&&e.once("hand.move.ended",(function(e){a.activateHand(e.originalEvent,!0,!0)})),!1}))}function pg(e){return xa(" ",e)}sg.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],sg.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ag,data:{context:n||{}}})},sg.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ag,data:{context:{reactivate:n}}})},sg.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},sg.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var lg={__depends__:[Sm,_l],__init__:["handTool"],handTool:["type",sg]},cg="connect-ok",ug="connect-not-ok";function dg(e,t,n,r,i,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=s.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?cg:ug))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?cg:ug)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(s.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}dg.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],dg.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},dg.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},dg.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},dg.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var hg={__depends__:[zp,Ls,zs,Sm,_l],globalConnect:["type",dg]};function mg(e,t,n,r,i,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}mg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],mg.prototype.getPaletteEntries=function(e){var t={},n=this._create,r=this._elementFactory,i=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,p=this._translate;function l(e,t,i,o,a){function s(t){var i=r.createShape(q({type:e},a));a&&(Pi(i).isExpanded=a.isExpanded);n.start(t,i)}var l=e.replace(/^bpmn:/,"");return{group:t,className:i,title:o||p("Create {type}",{type:l}),action:{dragstart:s,click:s}}}function c(e){var t=r.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=r.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:t});n.start(e,[t,i],{hints:{autoSelect:[t]}})}function u(e){n.start(e,r.createParticipantShape())}return q(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:p("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:p("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:p("Activate the create/remove space tool"),action:{click:function(e){i.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:p("Activate the global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",p("Create StartEvent")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",p("Create Intermediate/Boundary Event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",p("Create EndEvent")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",p("Create Task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",p("Create DataObjectReference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",p("Create DataStoreReference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:p("Create expanded SubProcess"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:p("Create Pool/Participant"),action:{dragstart:u,click:u}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",p("Create Group"))}),t};var fg={__depends__:[eg,ml,qm,ig,lg,hg,so],__init__:["paletteProvider"],paletteProvider:["type",mg]};function yg(e,t,n,r,i){Yo.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a&&a.replacements?function(e){_(e.canExecute.replacements,(function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var p=t.get(a);q(s,{x:p.x,y:p.y});var l=n.createShape(s);r.addShape(l,p.parent);var c=ve('[data-element-id="'+Qo(p.id)+'"]',e.dragGroup);c&&Oe(c,{display:"none"});var u=i.addDragger(l,e.dragGroup);e.visualReplacements[a]=u,r.removeShape(l)}}))}(o):function(e){var t=e.visualReplacements;_(t,(function(n,r){var i=ve('[data-element-id="'+Qo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}yg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],r(yg,Yo);var gg={__depends__:[rl],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",yg]},vg=40,bg=["x","y"],xg=Math.abs;function wg(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,a=t.target;e.originalEvent&&ba(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){bg.forEach((function(r){var i=Pg(r,t);e[r]<t[r]+n?Ep(e,r,t[r]+n):e[r]>t[r]+i-n&&Ep(e,r,t[r]+i-n)}))}(e,i,function(e){return wi(e,"bpmn:Task")?10:20}(i)),i&&function(e,t){return S(t,(function(t){return Eg(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=wp(r),_i(i,["bpmn:Event","bpmn:Gateway"])&&_g(e,wp(i)),_i(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=wp(t);bg.forEach((function(r){(function(e,t,n){return e[n]>t[n]+20&&e[n]<t[n]+Pg(n,t)-20})(e,t,r)&&Ep(e,r,n[r])}))}(e,i),wi(o,"bpmn:BoundaryEvent")&&a===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=wp(n),o=yn(i,r,-10),a=[];/top|bottom/.test(o)&&a.push("x");/left|right/.test(o)&&a.push("y");a.forEach((function(t){var n,r=e[t];xg(r-i[t])<vg&&(n=r>i[t]?i[t]+vg:i[t]-vg,Ep(e,t,n))}))}(e)):Eg(n,"bpmn:MessageFlow")?(wi(r,"bpmn:Event")&&(t.connectionStart=wp(r)),wi(i,"bpmn:Event")&&_g(e,wp(i))):t.connectionStart=t.initialConnectionStart)}))}function _g(e,t){Ep(e,"x",t.x),Ep(e,"y",t.y)}function Eg(e,t){return e&&e.type===t}function Pg(e,t){return"x"===e?t.width:t.height}function Og(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Sg(e){this._snapValues={}}wg.$inject=["eventBus"],Og.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Og.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Og.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Og.prototype.getSnapLocations=function(){return this._snapLocations},Og.prototype.setSnapLocations=function(e){this._snapLocations=e},Og.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Sg).initDefaults(this._defaultSnaps),n},Sg.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)},Sg.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],gp(i-e)<=n)return i}(e[n],i[n],r)},Sg.prototype.initDefaults=function(e){var t=this;_(e||{},(function(e,n){_(e,(function(e){t.add(n,e)}))}))};function kg(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],1250,(function(e){var t=e.context,i=t.shape,o=t.snapContext,a=t.target;if((!e.originalEvent||!ba(e.originalEvent))&&!_p(e)&&a){var s=o.pointsForTarget(a);s.initialized||((s=r.addSnapTargetPoints(s,i,a)).initialized=!0),n.snap(e,s)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}function Cg(e){return!!e.labelTarget}kg.$inject=["elementRegistry","eventBus","snapping"],kg.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new Og);var a=(t=n.get(i.id)?wp(i,e):{x:e.x+wp(i).x,y:e.y+wp(i).y}).x-i.width/2,s=t.y-i.height/2,p=t.x+i.width/2,l=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),Cg(i)||(o.setSnapOrigin("top-left",{x:a-e.x,y:s-e.y}),o.setSnapOrigin("bottom-right",{x:p-e.x,y:l-e.y})),o},kg.prototype.addSnapTargetPoints=function(e,t,n){return _(this.getSnapTargets(t,n),(function(n){if(Cg(n))Cg(t)&&e.add("mid",wp(n));else if(n.waypoints){if(n.waypoints.length<3)return;_(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else{e.add("mid",wp(n))}})),m(t.x)&&m(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",wp(t)),e):e},kg.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function Tg(e,t){t.invoke(kg,this),e.on(["create.move","create.end"],1500,Mg),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!_p(e)&&function(e,t){var n,r=hn(t),i=Ph(e,t),o=e.context.shape;n=o.parent?{x:0,y:0}:fn(o);/top/.test(i)?Ep(e,"y",r.top-n.y):/bottom/.test(i)&&Ep(e,"y",r.bottom-n.y);/left/.test(i)?Ep(e,"x",r.left-n.x):/right/.test(i)&&Ep(e,"x",r.right-n.x)}(e,r)}))}function Mg(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Ep(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Ep(e,"y",e.y)}}function Ag(e,t){return-1!==e.indexOf(t)}function Rg(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}r(Tg,kg),Tg.$inject=["eventBus","injector"],Tg.prototype.initSnap=function(e){var t=kg.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return _(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",Rg(i,r,e))})),_(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",Rg(i,r,e))})),wi(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Tg.prototype.addSnapTargetPoints=function(e,t,n){kg.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);_(r,(function(n){var r;(function(e){if(wi(e,"bpmn:SubProcess")&&Bi(e))return!0;return wi(e,"bpmn:Participant")}(n)||(r="bpmn:TextAnnotation",[t,n].every((function(e){return wi(e,r)}))))&&(e.add("top-left",bp(n)),e.add("bottom-right",xp(n)))}));var i=this._elementRegistry;return _(t.incoming,(function(n){if(i.get(t.id)){Ag(r,n.source)||e.add("mid",fn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),_(t.outgoing,(function(n){if(i.get(t.id)){Ag(r,n.target)||e.add("mid",fn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),wi(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Tg.prototype.getSnapTargets=function(e,t){return kg.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!wi(e,"bpmn:Lane")}))};function Dg(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,a=r.direction,s=r.snapContext;if(!(e.originalEvent&&ba(e.originalEvent)||_p(e))){var p=s.pointsForTarget(o);p.initialized||((p=n.addSnapTargetPoints(p,i,o,a)).initialized=!0),function(e){return"n"===e||"s"===e}(a)&&Ep(e,"x",e.x),function(e){return"e"===e||"w"===e}(a)&&Ep(e,"y",e.y),t.snap(e,p)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function zg(e,t){var n=fn(e),r=hn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}Dg.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new Og);var o=zg(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},Dg.prototype.addSnapTargetPoints=function(e,t,n,r){return _(this.getSnapTargets(t,n),(function(t){e.add("corner",xp(t)),e.add("corner",bp(t))})),e.add("corner",zg(t,r)),e},Dg.$inject=["eventBus","snapping"],Dg.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,r=e,n.host===r||function(e){return!!e.waypoints}(t)||function(e){return!!e.hidden}(t)||function(e){return!!e.labelTarget}(t));var n,r}))};function jg(e){this._canvas=e,this._asyncHide=$(F(this.hide,this),1e3)}jg.$inject=["canvas"],jg.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:_p(e,"x"),y:_p(e,"y")};_(r,(function(r){var o=n.getSnapOrigin(r),a={x:e.x+o.x,y:e.y+o.y};if(_(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(a,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),_(["x","y"],(function(t){var n=i[t];h(n)&&Ep(e,t,n.originValue)}))},jg.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ie("path");return Oe(n,{d:"M0,0 L0,0"}),Me(n).add("djs-snap-line"),_e(t,n),{update:function(t){m(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},jg.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},jg.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},jg.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},jg.prototype.hide=function(){_(this._snapLines,(function(e){e.update()}))};var Ng={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",kg],resizeSnapping:["type",Dg],snapping:["type",jg]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",wg],createMoveSnapping:["type",Tg]};function Bg(e,t,n,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=r,this._container=fe(Bg.BOX_HTML),this._searchInput=ve(Bg.INPUT_SELECTOR,this._container),this._resultsContainer=ve(Bg.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function Ig(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+Bg.RESULT_HIGHLIGHT_CLASS+'">'+ta(e.matched)+"</strong>":t+=ta(e.normal)})),""!==t?t:null}(t),i=fe(n);i.innerHTML=r,e.appendChild(i)}Bg.$inject=["canvas","eventBus","overlays","selection"],Bg.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:me.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,Bg.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,Bg.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,Bg.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,Bg.INPUT_SELECTOR,"keydown",(function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()})),t(this._container,Bg.INPUT_SELECTOR,"keyup",(function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))}))},Bg.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){me.unbind(e.el,e.type,e.listener)}))},Bg.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(Bg.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},Bg.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Bg.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},Bg.prototype._clearResults=function(){re(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},Bg.prototype._getCurrentResult=function(){return ve(Bg.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Bg.prototype._createResultNode=function(e,t){var n=fe(Bg.RESULT_HTML);return e.primaryTokens.length>0&&Ig(n,e.primaryTokens,Bg.RESULT_PRIMARY_HTML),Ig(n,e.secondaryTokens,Bg.RESULT_SECONDARY_HTML),Y(n,Bg.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Bg.prototype.registerProvider=function(e){this._searchProvider=e},Bg.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,te(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Bg.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,te(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},Bg.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Bg.prototype.isOpen=function(){return this._open},Bg.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&te(t).remove(Bg.RESULT_SELECTED_CLASS);var n=Y(e,Bg.RESULT_ID_ATTRIBUTE),r=this._results[n].element;te(e).add(Bg.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},Bg.prototype._select=function(e){var t=Y(e,Bg.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Bg.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=6,n=e.width+2*t,r=e.height+2*t,i=["width: "+n+"px","height: "+r+"px"].join("; ");return{position:{bottom:r-t,right:n-t},show:!0,html:'<div style="'+i+'" class="'+Bg.OVERLAY_CLASS+'"></div>'}}(yt(e));this._overlayId=this._overlays.add(e,t)}},Bg.CONTAINER_SELECTOR=".djs-search-container",Bg.INPUT_SELECTOR=".djs-search-input input",Bg.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Bg.RESULT_SELECTOR=".djs-search-result",Bg.RESULT_SELECTED_CLASS="djs-search-result-selected",Bg.RESULT_SELECTED_SELECTOR="."+Bg.RESULT_SELECTED_CLASS,Bg.RESULT_ID_ATTRIBUTE="data-result-id",Bg.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Bg.OVERLAY_CLASS="djs-search-overlay",Bg.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>',Bg.RESULT_HTML='<div class="djs-search-result"></div>',Bg.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Bg.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var Lg={__depends__:[Wo,$o],searchPad:["type",Bg]};function $g(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function Fg(e){return w(e,(function(e){return!!e.matched})).length>0}function Vg(e,t){var n=[],r=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var i=e.indexOf(t);return i>-1?(0!==i&&n.push({normal:r.substr(0,i)}),n.push({matched:r.substr(i,t.length)}),t.length+i<e.length&&n.push({normal:r.substr(t.length+i,e.length)})):n.push({normal:r}),n}$g.$inject=["elementRegistry","searchPad","canvas"],$g.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=w(n,(function(e){return e!==t})),n=z(n=w(n=k(n,(function(t){return{primaryTokens:Vg(Vi(t),e),secondaryTokens:Vg(t.id,e),element:t}})),(function(e){return Fg(e.primaryTokens)||Fg(e.secondaryTokens)})),(function(e){return Vi(e.element)+e.element.id}))};var Hg={__depends__:[Lg],__init__:["bpmnSearch"],bpmnSearch:["type",$g]};function qg(e){Ni.call(this,e)}r(qg,Ni),qg.Viewer=va,qg.NavigatedViewer=Ka,qg.prototype.createDiagram=gi((function(){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>')})),qg.prototype._interactionModules=[Da,Fa,ns,Wa],qg.prototype._modelingModules=[ps,ws,Bs,ks,Cp,zp,Np,Pc,jl,ml,Tc,jc,Xc,Zc,Qc,su,Su,Iy,Wy,fg,gg,vu,Ng,Hg],qg.prototype._modules=[].concat(va.prototype._modules,qg.prototype._interactionModules,qg.prototype._modelingModules);var Ug={min:.2,max:4};function Gg(e,t,n,r,i){var o=this;function a(e){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Kg(Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function s(e){return function(t){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&a(t);var n=Wg({x:t.clientX-o._state._svgClientRect.left,y:t.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox),i=r.viewbox(),s=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(n,i),c=o._viewportDom.getBoundingClientRect(),u={x:t.clientX-c.left+1,y:t.clientY-c.top+1};q(o._state,{cachedViewbox:i,initialDragPosition:{x:t.clientX,y:t.clientY},isDragging:!0,offsetViewport:s,offsetViewportDom:u,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ue.bind(document,"mousemove",p),ue.bind(document,"mouseup",l)}}function p(e){if(o._state.isDragging){o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var t=o._state.offsetViewportDom,n=o._state.viewportClientRect,r=o._state.parentClientRect;q(o._viewportDom.style,{top:e.clientY-t.y-r.top+"px",left:e.clientX-t.x-r.left+"px"});var i=Qg(r,{top:e.clientY-t.y-r.top,left:e.clientX-t.x-r.left,width:n.width,height:n.height});q(o._overlay.style,{clipPath:i});var a=Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Kg({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function l(e){o._state.isDragging&&(o._state.initialDragPosition.x===e.clientX&&o._state.initialDragPosition.y===e.clientY&&a(e),o._update(),q(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ue.unbind(document,"mousemove",p),ue.unbind(document,"mouseup",l))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._init(),this.toggle(e&&e.open||!1),ue.bind(this._svg,"click",(function(e){e.preventDefault(),e.stopPropagation(),a(e)})),ue.bind(this._viewportDom,"mousedown",s(!1)),ue.bind(this._svg,"mousedown",s(!0)),ue.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Zg(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i=0===e.deltaMode?.02:.32,a=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Jg(e.deltaY)*-i;if(o._state.zoomDelta+=a,Math.abs(o._state.zoomDelta)>.1){var s=a>0?1:-1,p=Math.log(r.zoom())/Math.log(10),l=function(e,t){var n=Math.log(e.min)/Math.log(10),r=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(r))/t}(Ug,20),c=Math.round(p/l)*l;c+=l*s;var u=Math.pow(10,c);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ug,u),d),o._state.zoomDelta=0;var d=Wg({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Kg(d,o._canvas),o._update()}}})),ue.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on("root.set",(function(e){o._clear(),e.element.children.forEach((function(e){o._addElement(e)})),o._update()}))}function Wg(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=q({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);q(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;q(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Xg(e.x,0,r.width,i.x,i.x+i.width),y:Xg(e.y,0,r.height,i.y,i.y+i.height)}}function Kg(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Xg(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Yg(e,t,n){var r=function(e){var t=ve(".children",e);t||_e(e,t=Ie("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function Zg(e){return 0===e.width&&0===e.height}Gg.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Gg.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");te(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");te(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");te(r).add("map"),t.appendChild(r);var i=this._svg=Ie("svg");Oe(i,{width:"100%",height:"100%"}),_e(r,i),_e(i,this._elementsGroup=Ie("g"));var o=this._viewportGroup=Ie("g");_e(i,o);var a=this._viewport=Ie("rect");Me(a).add("viewport"),_e(o,a),ue.bind(t,"mousedown",(function(e){e.stopPropagation()}));var s=this._viewportDom=document.createElement("div");te(s).add("viewport-dom"),this._parent.appendChild(s);var p=this._overlay=document.createElement("div");te(p).add("overlay"),this._parent.appendChild(p)},Gg.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(tv(e)){var r,i,o,a,s=n.width-t.width,p=n.height-t.height;t.width<n.width?(r=t.x-s/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-p/2,a=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,a=t.height),r-=50,i-=50,o+=100,a+=100,this._lastViewbox={x:r,y:i,width:o,height:a},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+a}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),c=this._viewport.getBoundingClientRect(),u={top:c.top-l.top,left:c.left-l.left,width:c.width,height:c.height};q(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Qg(l,u);q(this._overlay.style,{clipPath:d})}},Gg.prototype.open=function(){q(this._state,{isOpen:!0}),te(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};Y(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Gg.prototype.close=function(){q(this._state,{isOpen:!1}),te(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};Y(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Gg.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Gg.prototype.isOpen=function(){return this._state.isOpen},Gg.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Gg.prototype._updateElementId=function(e,t){try{var n=ve("#"+Qo(e.id),this._elementsGroup);n&&(n.id=t)}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Gg.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this._canvas.findRoot(e)===this._canvas.getRootElement()){var n,r,i,o=this._createElement(e),a=ve("#"+Qo(e.parent.id),this._elementsGroup);if(o){var s=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==s&&a?a.childNodes.length>s?Yg(o,a,s):Yg(o,a,a.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,a&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Gg.prototype._removeElement=function(e){var t=this._svg.getElementById(e.id);t&&Re(t)},Gg.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=function(e){return e.childNodes[0]}(n))){var r=ze(t);return Oe(r,{id:e.id}),r}},Gg.prototype._clear=function(){De(this._elementsGroup)};var Jg=Math.sign||function(e){return e>=0?1:-1};function Qg(e,t){return"polygon("+[ev(t.left,t.top),ev(t.left+t.width,t.top),ev(t.left+t.width,t.top+t.height),ev(t.left,t.top+t.height),ev(t.left,e.height),ev(e.width,e.height),ev(e.width,0),ev(0,0),ev(0,e.height),ev(t.left,e.height)].join(", ")+")"}function ev(e,t){return e+"px "+t+"px"}function tv(e){return O(e,(function(e){return h(e)?tv(e):m(e)&&isFinite(e)}))}var nv={__init__:["minimap"],minimap:["type",Gg]};function rv(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",a=-1;_e(t.getLayer("djs-origin",-1),n=av("g",{"pointer-events":"none"})),!1!==e.showBorder&&_e(n,av("path",{class:ov("border"),d:iv(["M",-22,a,"H",-1e3,"M",22,a,"H",6e3,"M",a,-22,"V",-1e3,"M",a,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),_e(n,av("path",{d:iv(["M",-15,a,"H",15,"M",a,-15,"V",15]),class:ov("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=av("text",{x:-40,y:-10,fill:o,class:ov("label")})).textContent="(0, 0)",_e(n,r)}function iv(e){return e.join(" ")}function ov(e){return"djs-origin-"+e}function av(e,t){var n=Ie(e);return Oe(n,t),n}rv.$inject=["config.origin","canvas"];var sv={__init__:[rv]},pv={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function lv(e,t,n,r,i,o){function a(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var a=-e[n]+r[n],s=t.get("gridSnapping",!1);s&&(a=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(a,s.getGridSpacing())),o[n]=Math.abs(a)<i?0:a})),o}function s(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=a(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function p(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var l,c,u;e=function(e){var t=q({},pv,e||{});return m(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:p(-1),revert:p(1)}),e.alignOnSave&&(l=t.get("_parent",!1),c=n,((u=l&&l._eventBus)||c).on("saveXML.start",1250,s),u&&c.on("diagram.destroy",(function(){u.off("saveXML.start",s)}))),this.align=s,this.computeAdjustment=a,this._config=e}lv.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var cv={__init__:["alignToOrigin"],alignToOrigin:["type",lv]};function uv(e){function t(e){if(!e.labelTarget){var t=Ei(e);wi(t,"bpmn:Participant")&&(t=t.processRef),wi(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}uv.$inject=["eventBus"];var dv,hv,mv,fv,yv,gv={__init__:[uv]},vv={},bv=[],xv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function wv(e,t){for(var n in t)e[n]=t[n];return e}function _v(e){var t=e.parentNode;t&&t.removeChild(e)}function Ev(e,t,n){var r,i,o,a=arguments,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>3)for(n=[n],o=3;o<arguments.length;o++)n.push(a[o]);if(null!=n&&(s.children=n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Pv(e,s,r,i,null)}function Pv(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++dv.__v:i};return null!=dv.vnode&&dv.vnode(o),o}function Ov(e){return e.children}function Sv(e,t){this.props=e,this.context=t}function kv(e,t){if(null==t)return e.__?kv(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?kv(e):null}function Cv(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Cv(e)}}function Tv(e){(!e.__d&&(e.__d=!0)&&hv.push(e)&&!Mv.__r++||fv!==dv.debounceRendering)&&((fv=dv.debounceRendering)||mv)(Mv)}function Mv(){for(var e;Mv.__r=hv.length;)e=hv.sort((function(e,t){return e.__v.__b-t.__v.__b})),hv=[],e.some((function(e){var t,n,r,i,o,a;e.__d&&(o=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=wv({},i)).__v=i.__v+1,Lv(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?kv(i):o,i.__h),$v(n,i),i.__e!=o&&Cv(i)))}))}function Av(e,t,n,r,i,o,a,s,p,l){var c,u,d,h,m,f,y,g=r&&r.__k||bv,v=g.length;for(n.__k=[],c=0;c<t.length;c++)if(null!=(h=n.__k[c]=null==(h=t[c])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?Pv(null,h,null,null,h):Array.isArray(h)?Pv(Ov,{children:h},null,null,null):h.__b>0?Pv(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(d=g[c])||d&&h.key==d.key&&h.type===d.type)g[c]=void 0;else for(u=0;u<v;u++){if((d=g[u])&&h.key==d.key&&h.type===d.type){g[u]=void 0;break}d=null}Lv(e,h,d=d||vv,i,o,a,s,p,l),m=h.__e,(u=h.ref)&&d.ref!=u&&(y||(y=[]),d.ref&&y.push(d.ref,null,h),y.push(u,h.__c||m,h)),null!=m?(null==f&&(f=m),"function"==typeof h.type&&null!=h.__k&&h.__k===d.__k?h.__d=p=Rv(h,p,e):p=zv(e,h,d,g,m,p),l||"option"!==n.type?"function"==typeof n.type&&(n.__d=p):e.value=""):p&&d.__e==p&&p.parentNode!=e&&(p=kv(d))}for(n.__e=f,c=v;c--;)null!=g[c]&&("function"==typeof n.type&&null!=g[c].__e&&g[c].__e==n.__d&&(n.__d=kv(r,c+1)),Hv(g[c],g[c]));if(y)for(c=0;c<y.length;c++)Vv(y[c],y[++c],y[++c])}function Rv(e,t,n){var r,i;for(r=0;r<e.__k.length;r++)(i=e.__k[r])&&(i.__=e,t="function"==typeof i.type?Rv(i,t,n):zv(n,i,i,e.__k,i.__e,t));return t}function Dv(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){Dv(e,t)})):t.push(e)),t}function zv(e,t,n,r,i,o){var a,s,p;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(null==n||i!=o||null==i.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,p=0;(s=s.nextSibling)&&p<r.length;p+=2)if(s==i)break e;e.insertBefore(i,o),a=o}return void 0!==a?a:i.nextSibling}function jv(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||xv.test(t)?n:n+"px"}function Nv(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||jv(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||jv(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?Iv:Bv,o):e.removeEventListener(t,o?Iv:Bv,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null!=n&&(!1!==n||"a"===t[0]&&"r"===t[1])?e.setAttribute(t,n):e.removeAttribute(t))}}function Bv(e){this.l[e.type+!1](dv.event?dv.event(e):e)}function Iv(e){this.l[e.type+!0](dv.event?dv.event(e):e)}function Lv(e,t,n,r,i,o,a,s,p){var l,c,u,d,h,m,f,y,g,v,b,x=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(p=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(l=dv.__b)&&l(t);try{e:if("function"==typeof x){if(y=t.props,g=(l=x.contextType)&&r[l.__c],v=l?g?g.props.value:l.__:r,n.__c?f=(c=t.__c=n.__c).__=c.__E:("prototype"in x&&x.prototype.render?t.__c=c=new x(y,v):(t.__c=c=new Sv(y,v),c.constructor=x,c.render=qv),g&&g.sub(c),c.props=y,c.state||(c.state={}),c.context=v,c.__n=r,u=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=x.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=wv({},c.__s)),wv(c.__s,x.getDerivedStateFromProps(y,c.__s))),d=c.props,h=c.state,u)null==x.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==x.getDerivedStateFromProps&&y!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(y,v),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(y,c.__s,v)||t.__v===n.__v){c.props=y,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),c.__h.length&&a.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(y,c.__s,v),null!=c.componentDidUpdate&&c.__h.push((function(){c.componentDidUpdate(d,h,m)}))}c.context=v,c.props=y,c.state=c.__s,(l=dv.__r)&&l(t),c.__d=!1,c.__v=t,c.__P=e,l=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=wv(wv({},r),c.getChildContext())),u||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(d,h)),b=null!=l&&l.type===Ov&&null==l.key?l.props.children:l,Av(e,Array.isArray(b)?b:[b],t,n,r,i,o,a,s,p),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),f&&(c.__E=c.__=null),c.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fv(n.__e,t,n,r,i,o,a,p);(l=dv.diffed)&&l(t)}catch(e){t.__v=null,(p||null!=o)&&(t.__e=s,t.__h=!!p,o[o.indexOf(s)]=null),dv.__e(e,t,n)}}function $v(e,t){dv.__c&&dv.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){dv.__e(e,t.__v)}}))}function Fv(e,t,n,r,i,o,a,s){var p,l,c,u,d=n.props,h=t.props,m=t.type,f=0;if("svg"===m&&(i=!0),null!=o)for(;f<o.length;f++)if((p=o[f])&&(p===e||(m?p.localName==m:3==p.nodeType))){e=p,o[f]=null;break}if(null==e){if(null===m)return document.createTextNode(h);e=i?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,h.is&&h),o=null,s=!1}if(null===m)d===h||s&&e.data===h||(e.data=h);else{if(o=o&&bv.slice.call(e.childNodes),l=(d=n.props||vv).dangerouslySetInnerHTML,c=h.dangerouslySetInnerHTML,!s){if(null!=o)for(d={},u=0;u<e.attributes.length;u++)d[e.attributes[u].name]=e.attributes[u].value;(c||l)&&(c&&(l&&c.__html==l.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||Nv(e,o,null,n[o],r);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||Nv(e,o,t[o],n[o],r)}(e,h,d,i,s),c)t.__k=[];else if(f=t.props.children,Av(e,Array.isArray(f)?f:[f],t,n,r,i&&"foreignObject"!==m,o,a,e.firstChild,s),null!=o)for(f=o.length;f--;)null!=o[f]&&_v(o[f]);s||("value"in h&&void 0!==(f=h.value)&&(f!==e.value||"progress"===m&&!f)&&Nv(e,"value",f,d.value,!1),"checked"in h&&void 0!==(f=h.checked)&&f!==e.checked&&Nv(e,"checked",f,d.checked,!1))}return e}function Vv(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){dv.__e(e,n)}}function Hv(e,t,n){var r,i,o;if(dv.unmount&&dv.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Vv(r,null,t)),n||"function"==typeof e.type||(n=null!=(i=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){dv.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Hv(r[o],t,n);null!=i&&_v(i)}function qv(e,t,n){return this.constructor(e,n)}function Uv(e,t,n){var r,i,o;dv.__&&dv.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],Lv(t,e=(!r&&n||t).__k=Ev(Ov,null,[e]),i||vv,vv,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?bv.slice.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),$v(o,e)}function Gv(e,t){var n={__c:t="__cC"+yv++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(Tv)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}dv={__e:function(e,t){for(var n,r,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),i=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),i=n.__d),i)return n.__E=n}catch(t){e=t}throw e},__v:0},Sv.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=wv({},this.state),"function"==typeof e&&(e=e(wv({},n),this.props)),e&&wv(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),Tv(this))},Sv.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Tv(this))},Sv.prototype.render=Ov,hv=[],mv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mv.__r=0,yv=0;var Wv,Kv,Xv,Yv=0,Zv=[],Jv=dv.__b,Qv=dv.__r,eb=dv.diffed,tb=dv.__c,nb=dv.unmount;function rb(e,t){dv.__h&&dv.__h(Kv,e,Yv||t),Yv=0;var n=Kv.__H||(Kv.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ib(e){return Yv=1,ob(fb,e)}function ob(e,t,n){var r=rb(Wv++,2);return r.t=e,r.__c||(r.__=[n?n(t):fb(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=Kv),r.__}function ab(e,t){var n=rb(Wv++,3);!dv.__s&&mb(n.__H,t)&&(n.__=e,n.__H=t,Kv.__H.__h.push(n))}function sb(e){return Yv=5,pb((function(){return{current:e}}),[])}function pb(e,t){var n=rb(Wv++,7);return mb(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function lb(e){var t=Kv.context[e.__c],n=rb(Wv++,9);return n.__c=e,t?(null==n.__&&(n.__=!0,t.sub(Kv)),t.props.value):e.__}function cb(){Zv.forEach((function(e){if(e.__P)try{e.__H.__h.forEach(db),e.__H.__h.forEach(hb),e.__H.__h=[]}catch(t){e.__H.__h=[],dv.__e(t,e.__v)}})),Zv=[]}dv.__b=function(e){Kv=null,Jv&&Jv(e)},dv.__r=function(e){Qv&&Qv(e),Wv=0;var t=(Kv=e.__c).__H;t&&(t.__h.forEach(db),t.__h.forEach(hb),t.__h=[])},dv.diffed=function(e){eb&&eb(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==Zv.push(t)&&Xv===dv.requestAnimationFrame||((Xv=dv.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),ub&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ub&&(t=requestAnimationFrame(n))})(cb)),Kv=void 0},dv.__c=function(e,t){t.some((function(e){try{e.__h.forEach(db),e.__h=e.__h.filter((function(e){return!e.__||hb(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],dv.__e(n,e.__v)}})),tb&&tb(e,t)},dv.unmount=function(e){nb&&nb(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(db)}catch(e){dv.__e(e,t.__v)}};var ub="function"==typeof requestAnimationFrame;function db(e){var t=Kv;"function"==typeof e.__c&&e.__c(),Kv=t}function hb(e){var t=Kv;e.__c=e.__(),Kv=t}function mb(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function fb(e,t){return"function"==typeof t?t(e):t}
9
9
  /*!
10
10
  Copyright (c) 2018 Jed Watson.
11
11
  Licensed under the MIT License (MIT), see