camunda-bpmn-js 4.3.3 → 4.4.1
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.
- package/dist/assets/diagram-js.css +16 -20
- package/dist/base-modeler.development.js +331 -174
- package/dist/base-modeler.production.min.js +32 -34
- package/dist/base-navigated-viewer.development.js +177 -60
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +160 -52
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +305 -148
- package/dist/camunda-cloud-modeler.production.min.js +32 -34
- package/dist/camunda-cloud-navigated-viewer.development.js +177 -60
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +160 -52
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +305 -148
- package/dist/camunda-platform-modeler.production.min.js +32 -34
- package/dist/camunda-platform-navigated-viewer.development.js +177 -60
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +160 -52
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,16 @@
|
|
|
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";function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var t=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),s="";for(i=0;i<Math.floor(r);i++){s=Math.floor(Math.random()*n).toString(n)+s}if(o){var a=Math.pow(n,o);s=Math.floor(Math.random()*a).toString(n)+s}var l=parseInt(s,n);return l!==1/0&&l>=Math.pow(2,e)?t(e,n):s};t.rack=function(e,n,r){var i=function(i){var s=0;do{if(s++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var a=t(e,n)}while(Object.hasOwnProperty.call(o,a));return o[a]=i,a},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 n(e){if(!(this instanceof n))return new n(e);e=e||[128,36,1],this._seed=e.length?t.rack(e[0],e[1],e[2]):e}function r(e){return Array.prototype.concat.apply([],e)}n.prototype.next=function(e){return this._seed(e||!0)},n.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},n.prototype.claim=function(e,t){this._seed.set(e,t||!0)},n.prototype.assigned=function(e){return this._seed.get(e)||!1},n.prototype.unclaim=function(e){delete this._seed.hats[e]},n.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};const i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;function s(e){return void 0===e}function a(e){return void 0!==e}function l(e){return null==e}function c(e){return"[object Array]"===i.call(e)}function p(e){return"[object Object]"===i.call(e)}function u(e){return"[object Number]"===i.call(e)}function h(e){const t=i.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function d(e){return"[object String]"===i.call(e)}function f(e,t){return o.call(e,t)}function m(e,t){const n=D(t);let r;return v(e,(function(e,t){if(n(e,t))return r=e,!1})),r}function g(e,t){const n=D(t);let r=c(e)?-1:void 0;return v(e,(function(e,t){if(n(e,t))return r=t,!1})),r}function y(e,t){const n=D(t);let r=[];return v(e,(function(e,t){n(e,t)&&r.push(e)})),r}function v(e,t){let n,r;if(s(e))return;const i=c(e)?R:N;for(let o in e)if(f(e,o)&&(n=e[o],r=t(n,i(o)),!1===r))return n}function b(e,t){if(s(e))return[];!function(e){if(!c(e))throw new Error("must supply array")}(e);const n=D(t);return e.filter((function(e,t){return!n(e,t)}))}function w(e,t,n){return v(e,(function(e,r){n=t(n,e,r)})),n}function x(e,t){return!!w(e,(function(e,n,r){return e&&t(n,r)}),!0)}function _(e,t){return!!m(e,t)}function k(e,t){let n=[];return v(e,(function(e,r){n.push(t(e,r))})),n}function E(e){return e&&Object.keys(e)||[]}function O(e){return k(e,(e=>e))}function P(e,t,n={}){return t=A(t),v(e,(function(e){let r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function S(e,...t){e=A(e);let n={};return v(t,(t=>P(t,e,n))),k(n,(function(e,t){return e[0]}))}const C=S;function T(e,t){t=A(t);let n=[];return v(e,(function(e,r){let i=t(e,r),o={d:i,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(i<e)return void n.splice(s,0,o)}n.push(o)})),k(n,(e=>e.v))}function M(e){return function(t){return x(e,(function(e,n){return t[n]===e}))}}function A(e){return h(e)?e:t=>t[e]}function D(e){return h(e)?e:t=>t===e}function N(e){return e}function R(e){return Number(e)}function j(e,t){let n,r,i,o;function s(n){let s=Date.now(),c=n?0:o+t-s;if(c>0)return a(c);e.apply(i,r),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=o=r=i=void 0}function c(...e){o=Date.now(),r=e,i=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function I(e,t){return e.bind(t)}function L(e,...t){return Object.assign(e,...t)}function z(e,t,n){let r=e;return v(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+typeof 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__");let o=t[i+1],c=r[e];a(o)&&l(c)&&(c=r[e]=isNaN(+o)?{}:[]),s(o)?s(n)?delete r[e]:r[e]=n:r=c})),e}function B(e,t,n){let r=e;return v(t,(function(e){if(l(r))return r=void 0,!1;r=r[e]})),s(r)?n:r}function $(e,t){let n={},r=Object(e);return v(t,(function(t){t in r&&(n[t]=e[t])})),n}function q(e,t){let n={};return v(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}function F(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const V=Object.prototype.toString,H=Object.prototype.hasOwnProperty;function U(e,t){return H.call(e,t)}function W(e,t){let n,r;if(void 0===e)return;const i=function(e){return"[object Array]"===V.call(e)}(e)?Q:G;for(let o in e)if(U(e,o)&&(n=e[o],r=t(n,i(o)),!1===r))return n}function G(e){return e}function Q(e){return Number(e)}function X(e,...t){const n=e.style;return W(t,(function(e){e&&W(e,(function(e,t){n[t]=e}))})),e}function Z(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Y=Object.prototype.toString;function K(e){return new J(e)}function J(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ee(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function te(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function ne(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(te(r,t))return r;r=r.parentNode}return te(r,t)?r:null}J.prototype.add=function(e){return this.list.add(e),this},J.prototype.remove=function(e){return"[object RegExp]"==Y.call(e)?this.removeMatching(e):(this.list.remove(e),this)},J.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},J.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},J.prototype.array=function(){return Array.from(this.list)},J.prototype.has=J.prototype.contains=function(e){return this.list.contains(e)};var re,ie,oe,se={};function ae(){re=window.addEventListener?"addEventListener":"attachEvent",ie=window.removeEventListener?"removeEventListener":"detachEvent",oe="addEventListener"!==re?"on":""}var le=se.bind=function(e,t,n,r){return re||ae(),e[re](oe+t,n,r||!1),n},ce=se.unbind=function(e,t,n,r){return ie||ae(),e[ie](oe+t,n,r||!1),n},pe=F({__proto__:null,bind:le,unbind:ce,default:se},[se]),ue=["focus","blur"];var he,de={bind:function(e,t,n,r,i){return-1!==ue.indexOf(n)&&(i=!0),pe.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=ne(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==ue.indexOf(t)&&(r=!0),pe.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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var i=Object.prototype.hasOwnProperty.call(ge,r)?ge[r]:ge._default,o=i[0],s=i[1],a=i[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;o--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},me=!1;"undefined"!=typeof document&&((he=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',me=!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:me?[1,"X<div>","</div>"]:[0,"",""]};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 ye=fe;function ve(e,t){return(t=t||document).querySelector(e)}function be(e,t){return(t=t||document).querySelectorAll(e)}function we(e){e.parentNode&&e.parentNode.removeChild(e)}function xe(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 xe(t,e),e}var ke=2,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":ke,"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":ke,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Oe(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Ee[r];i?(i===ke&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function Pe(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);Oe(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Oe(e,r,t[r])}(e,t);return e}const Se=Object.prototype.toString;function Ce(e){return new Te(e)}function Te(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Me(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ae(e){for(var t;t=e.firstChild;)Me(t);return e}function De(e){return e.cloneNode(!0)}Te.prototype.add=function(e){return this.list.add(e),this},Te.prototype.remove=function(e){return"[object RegExp]"==Se.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Te.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Te.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Te.prototype.array=function(){return Array.from(this.list)},Te.prototype.has=Te.prototype.contains=function(e){return this.list.contains(e)};var Ne={svg:"http://www.w3.org/2000/svg"},Re='<svg xmlns="'+Ne.svg+'"';function je(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Ne.svg)&&(e=Re+e.substring(4)):(e=Re+">"+e+"</svg>",t=!0);var n=function(e){var t;return t=new DOMParser,t.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=je(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ne.svg,e),t&&Pe(n,t),n}var Le=null;function ze(){return null===Le&&(Le=Ie("svg")),Le}function Be(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function $e(e){return e?ze().createSVGTransformFromMatrix(e):ze().createSVGTransform()}var qe=/([&<>]{1})/g,Fe=/([\n\r"]{1})/g,Ve={"&":"&","<":"<",">":">",'"':"'"};function He(e,t){return e.replace(t,(function(e,t){return Ve[t]||t}))}function Ue(e,t){var n,r,i,o,s;switch(e.nodeType){case 3:t.push(He(e.textContent,qe));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,'="',He(o.value,Fe),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(s=e.childNodes).length;n<r;++n)Ue(s.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",He(e.nodeValue,qe),"--\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=je(t);if(Ae(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++)xe(i[o],e)}}function Ge(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;)Ue(t,n),t=t.nextSibling;return n.join("")}(e)}function Qe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Xe(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(Qe(e,r))}(n,t)),n.consolidate()}const Ze=/^class[ {]/;function Ye(e){return Array.isArray(e)}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Je(...e){1===e.length&&Ye(e[0])&&(e=e[0]);const t=(e=[...e]).pop();return t.$inject=e,t}const et=/constructor\s*[^(]*\(\s*([^)]*)\)/m,tt=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,nt=/\/\*([^*]*)\*\//m;function rt(e){if("function"!=typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(function(e){return Ze.test(e.toString())}(e)?et:tt);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map((e=>{const t=e.match(nt);return(t&&t[1]||e).trim()}))||[]}function it(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw s(`No provider for "${e}"!`)}};const n=[],r=this._providers=Object.create(t._providers||null),i=this._instances=Object.create(null),o=i.injector=this,s=function(e){const t=n.join(" -> ");return n.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function a(e,o){if(!r[e]&&-1!==e.indexOf(".")){const t=e.split(".");let n=a(t.shift());for(;t.length;)n=n[t.shift()];return n}if(Ke(i,e))return i[e];if(Ke(r,e)){if(-1!==n.indexOf(e))throw n.push(e),s("Cannot resolve circular dependency!");return n.push(e),i[e]=r[e][0](r[e][1]),n.pop(),i[e]}return t.get(e,o)}function l(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Ye(e))throw s(`Cannot invoke "${e}". Expected a function!`);e=Je(e.slice())}return{fn:e,dependencies:(e.$inject||rt(e)).map((e=>Ke(t,e)?t[e]:a(e)))}}function c(e){const{fn:t,dependencies:n}=l(e);return new(Function.prototype.bind.apply(t,[null].concat(n)))}function p(e,t,n){const{fn:r,dependencies:i}=l(e,n);return r.apply(t,i)}function u(e){return Je((t=>e.get(t)))}function h(e,t){if(t&&t.length){const n=Object.create(null),i=Object.create(null),o=[],s=[],a=[];let l,c,p,h;for(let e in r)l=r[e],-1!==t.indexOf(e)&&("private"===l[2]?(c=o.indexOf(l[3]),-1===c?(p=l[3].createChild([],t),h=u(p),o.push(l[3]),s.push(p),a.push(h),n[e]=[h,e,"private",p]):n[e]=[a[c],e,"private",s[c]]):n[e]=[l[2],l[1]],i[e]=!0),"factory"!==l[2]&&"type"!==l[2]||!l[1].$scope||t.forEach((t=>{-1!==l[1].$scope.indexOf(t)&&(n[e]=[l[2],l[1]],i[t]=!0)}));t.forEach((e=>{if(!i[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(n)}return new it(e,o)}const d={factory:p,type:c,value:function(e){return e}};function f(e,t){const n=e.__init__||[];return function(){n.forEach((e=>{"string"==typeof e?t.get(e):t.invoke(e)}))}}function m(e){const t=e.__exports__;if(t){const n=e.__modules__,i=Object.keys(e).reduce(((t,n)=>("__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t)),Object.create(null)),o=h((n||[]).concat(i)),s=Je((function(e){return o.get(e)}));t.forEach((function(e){r[e]=[s,e,"private",o]}));const a=(e.__init__||[]).slice();return a.unshift((function(){o.init()})),f(e=Object.assign({},e,{__init__:a}),o)}return Object.keys(e).forEach((function(t){if("__init__"===t||"__depends__"===t)return;if("private"===e[t][2])return void(r[t]=e[t]);const n=e[t][0],i=e[t][1];r[t]=[d[n],ot(n,i),n]})),f(e,o)}function g(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(g,e)).indexOf(t)?e:e.concat(t)}this.get=a,this.invoke=p,this.instantiate=c,this.createChild=h,this.init=function(e){const t=e.reduce(g,[]).map(m);let n=!1;return function(){n||(n=!0,t.forEach((e=>e())))}}(e)}function ot(e,t){return"value"!==e&&Ye(t)&&(t=Je(t.slice())),t}var st=1e3;function at(e,t){var n=this;t=t||st,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,s=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,s):n.drawConnection(o,i,s)})),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 lt(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function ct(e){return["L",e.x,e.y]}function pt(e,t){const n=e.length,r=[(i=e[0],["M",i.x,i.y])];var i,o,s,a;for(let i=1;i<n;i++){const n=e[i-1],l=e[i],c=e[i+1];if(!c||!t){r.push(ct(l));continue}const p=Math.min(t,ht(l.x-n.x,l.y-n.y),ht(c.x-l.x,c.y-l.y));if(!p){r.push(ct(l));continue}const u=ut(l,n,p),h=ut(l,n,.5*p),d=ut(l,c,p),f=ut(l,c,.5*p);r.push(ct(u)),r.push((s=f,a=d,["C",(o=h).x,o.y,s.x,s.y,a.x,a.y]))}return r}function ut(e,t,n){const r=t.x-e.x,i=t.y-e.y,o=n/ht(r,i);return{x:e.x+r*o,y:e.y+i*o}}function ht(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function dt(e,t,n){u(t)&&(n=t,t=null),t||(t={});const r=Ie("path",t);return u(n)&&(r.dataset.cornerRadius=String(n)),ft(r,e)}function ft(e,t){return Pe(e,{d:lt(pt(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function mt(e){return y(e,(function(t){return!m(e,(function(e){return e!==t&>(t,e)}))}))}function gt(e,t){if(t){if(e===t)return t;if(e.parent)return gt(e.parent,t)}}function yt(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function vt(e,t,n){n=n||0,c(e)||(e=[e]),v(e,(function(e,r){var i=t(e,r,n);c(i)&&i.length&&vt(i,t,n+1)}))}function bt(e,t){return function(e,t,n){var r=[],i=[];return vt(e,(function(e,o,s){yt(r,e,t);var a=e.children;if((-1===n||s<n)&&a&&yt(i,a,t))return a})),r}(e,!t,-1)}function wt(e,t){var n,r,i,o;return t=!!t,c(e)||(e=[e]),v(e,(function(e){var s=e;e.waypoints&&!t&&(s=wt(e.waypoints,!0));var a=s.x,l=s.y,c=s.height||0,p=s.width||0;(a<n||void 0===n)&&(n=a),(l<r||void 0===r)&&(r=l),(a+p>i||void 0===i)&&(i=a+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:r,height:o-r,width:i-n}}function xt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function _t(e){return!(!e||!e.isFrame)}function kt(e,t){return L({},e||{},t||{})}at.prototype.canRender=function(e){},at.prototype.drawShape=function(e,t){},at.prototype.drawConnection=function(e,t){},at.prototype.getShapePath=function(e){},at.prototype.getConnectionPath=function(e){};function Et(e,t){at.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})}e(Et,at),Et.prototype.canRender=function(){return!0},Et.prototype.drawShape=function(e,t,n){var r=Ie("rect");return Pe(r,{x:0,y:0,width:t.width||0,height:t.height||0}),_t(t)?Pe(r,L({},this.FRAME_STYLE,n||{})):Pe(r,L({},this.SHAPE_STYLE,n||{})),_e(e,r),r},Et.prototype.drawConnection=function(e,t,n){var r=dt(t.waypoints,L({},this.CONNECTION_STYLE,n||{}));return _e(e,r),r},Et.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return lt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},Et.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 lt(i)},Et.$inject=["eventBus","styles"];var Ot={__init__:["defaultRenderer"],defaultRenderer:["type",Et],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 L(this.style(t,n),{class:e})},this.style=function(t,n){c(t)||n||(n=t,t=[]);var r=w(t,(function(t,n){return L(t,e[n]||{})}),{});return n?L(r,n):r},this.computeStyle=function(e,n,r){return c(n)||(r=n,n=[]),t.style(n||[],L({},r,e||{}))}}]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function St(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 Ct(e,t){return e&&t?e.indexOf(t):-1}function Tt(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function Mt(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=Tt(e,t);return Math.abs(i/o)<=r}var At=2;function Dt(e,t){var n=Array.from(arguments).flat();const r={x:"v",y:"h"};for(const[e,t]of Object.entries(r))if(Nt(e,n))return t;return!1}function Nt(e,t){const n=t[0];return x(t,(function(t){return Math.abs(n[e]-t[e])<=At}))}function Rt(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 jt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var It=/,?([a-z]),?/gi,Lt=parseFloat,zt=Math,Bt=zt.PI,$t=zt.min,qt=zt.max,Ft=zt.pow,Vt=zt.abs,Ht=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Ut=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Wt=Array.isArray||function(e){return e instanceof Array};function Gt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Qt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Gt(e,n)&&(t[n]=Qt(e[n]));return t}function Xt(e){var t=Xt.ps=Xt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Gt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Zt(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 Yt(){return this.join(",").replace(It,"$1")}function Kt(e){var t=Qt(e);return t.toString=Yt,t}function Jt(e,t,n,r,i,o,s,a,l){var c=1-l,p=Ft(c,3),u=Ft(c,2),h=l*l*l,d=p*t+3*u*l*r+3*c*l*l*o+h*a;return{x:sn(p*e+3*u*l*n+3*c*l*l*i+h*s),y:sn(d)}}function en(e){var t=function(e,t,n,r,i,o,s,a){for(var l,c,p,u,h,d,f,m,g=[],y=[[],[]],v=0;v<2;++v)if(0==v?(c=6*e-12*n+6*i,l=-3*e+9*n-9*i+3*s,p=3*n-3*e):(c=6*t-12*r+6*o,l=-3*t+9*r-9*o+3*a,p=3*r-3*t),Vt(l)<1e-12){if(Vt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else f=c*c-4*p*l,m=zt.sqrt(f),f<0||(0<(h=(-c+m)/(2*l))&&h<1&&g.push(h),0<(d=(-c-m)/(2*l))&&d<1&&g.push(d));var b,w=g.length,x=w;for(;w--;)b=1-(u=g[w]),y[0][w]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*s,y[1][w]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*a;return y[0][x]=e,y[1][x]=t,y[0][x+1]=s,y[1][x+1]=a,y[0].length=y[1].length=x+2,{x0:$t(...y[0]),y0:$t(...y[1]),x1:qt(...y[0]),y1:qt(...y[1])}}(...e);return Zt(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tn(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function nn(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 rn(e,t,n,r,i,o,s,a,l){null==l&&(l=1);for(var c=(l=l>1?1:l<0?0:l)/2,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var f=c*p[d]+c,m=nn(f,e,n,i,s),g=nn(f,t,r,o,a),y=m*m+g*g;h+=u[d]*zt.sqrt(y)}return c*h}function on(e,t,n,r,i,o,s,a){if(!(qt(e,n)<$t(i,s)||$t(e,n)>qt(i,s)||qt(t,r)<$t(o,a)||$t(t,r)>qt(o,a))){var l=(e*r-t*n)*(o-a)-(t-r)*(i*a-o*s),c=(e-n)*(o-a)-(t-r)*(i-s);if(c){var p=sn(((e*r-t*n)*(i-s)-(e-n)*(i*a-o*s))/c),u=sn(l/c),h=+p.toFixed(2),d=+u.toFixed(2);if(!(h<+$t(e,n).toFixed(2)||h>+qt(e,n).toFixed(2)||h<+$t(i,s).toFixed(2)||h>+qt(i,s).toFixed(2)||d<+$t(t,r).toFixed(2)||d>+qt(t,r).toFixed(2)||d<+$t(o,a).toFixed(2)||d>+qt(o,a).toFixed(2)))return{x:p,y:u}}}}function sn(e){return Math.round(1e11*e)/1e11}function an(e,t,n){if(!function(e,t){return e=Zt(e),tn(t=Zt(t),e.x,e.y)||tn(t,e.x2,e.y)||tn(t,e.x,e.y2)||tn(t,e.x2,e.y2)||tn(e,t.x,t.y)||tn(e,t.x2,t.y)||tn(e,t.x,t.y2)||tn(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)}(en(e),en(t)))return n?0:[];for(var r=rn(...e),i=rn(...t),o=pn(e)?1:~~(r/5)||1,s=pn(t)?1:~~(i/5)||1,a=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var h=Jt(...e,u/o);a.push({x:h.x,y:h.y,t:u/o})}for(u=0;u<s+1;u++)h=Jt(...t,u/s),l.push({x:h.x,y:h.y,t:u/s});for(u=0;u<o;u++)for(var d=0;d<s;d++){var f,m=a[u],g=a[u+1],y=l[d],v=l[d+1],b=Vt(g.x-m.x)<.01?"y":"x",w=Vt(v.x-y.x)<.01?"y":"x",x=on(m.x,m.y,g.x,g.y,y.x,y.y,v.x,v.y);if(x){if(c[f=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[f]=!0;var _=m.t+Vt((x[b]-m[b])/(g[b]-m[b]))*(g.t-m.t),k=y.t+Vt((x[w]-y[w])/(v[w]-y[w]))*(v.t-y.t);_>=0&&_<=1&&k>=0&&k<=1&&(n?p++:p.push({x:x.x,y:x.y,t1:_,t2:k}))}}return p}function ln(e,t,n){e=fn(e),t=fn(t);for(var r,i,o,s,a,l,c,p,u,h,d=n?0:[],f=0,m=e.length;f<m;f++){var g=e[f];if("M"==g[0])r=a=g[1],i=l=g[2];else{"C"==g[0]?(r=(u=[r,i,...g.slice(1)])[6],i=u[7]):(u=[r,i,r,i,a,l,a,l],r=a,i=l);for(var y=0,v=t.length;y<v;y++){var b=t[y];if("M"==b[0])o=c=b[1],s=p=b[2];else{"C"==b[0]?(o=(h=[o,s,...b.slice(1)])[6],s=h[7]):(h=[o,s,o,s,c,p,c,p],o=c,s=p);var w=an(u,h,n);if(n)d+=w;else{for(var x=0,_=w.length;x<_;x++)w[x].segment1=f,w[x].segment2=y,w[x].bez1=u,w[x].bez2=h;d=d.concat(w)}}}}}return d}function cn(e){var t=Xt(e);if(t.abs)return Kt(t.abs);if(Wt(e)&&Wt(e&&e[0])||(e=function(e){if(!e)return null;var t=Xt(e);if(t.arr)return Qt(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 Wt(e)&&Wt(e[0])&&(r=Qt(e)),r.length||String(e).replace(Ht,(function(e,t,i){var o=[],s=t.toLowerCase();for(i.replace(Ut,(function(e,t){t&&o.push(+t)})),"m"==s&&o.length>2&&(r.push([t,...o.splice(0,2)]),s="l",t="m"==t?"l":"L");o.length>=n[s]&&(r.push([t,...o.splice(0,n[s])]),n[s]););})),r.toString=Xt.toString,t.arr=Qt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=i=+e[0][1],a=o=+e[0][2],l++,r[0]=["M",i,o]);for(var c,p,u=l,h=e.length;u<h;u++){if(r.push(c=[]),(n=(p=e[u])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=+p[6]+i,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+i;break;case"M":s=+p[1]+i,a=+p[2]+o;default:for(var d=1,f=p.length;d<f;d++)c[d]=+p[d]+(d%2?i:o)}else for(var m=0,g=p.length;m<g;m++)c[m]=p[m];switch(n=n.toUpperCase(),c[0]){case"Z":i=+s,o=+a;break;case"H":i=c[1];break;case"V":o=c[1];break;case"M":s=c[c.length-2],a=c[c.length-1];default:i=c[c.length-2],o=c[c.length-1]}}return r.toString=Yt,t.abs=Kt(r),r}function pn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function un(e,t,n,r){return[e,t,n,r,n,r]}function hn(e,t,n,r,i,o){var s=1/3,a=2/3;return[s*e+a*n,s*t+a*r,s*i+a*n,s*o+a*r,i,o]}function dn(e,t,n,r,i,o,s,a,l,c){var p,u=120*Bt/180,h=Bt/180*(+i||0),d=[],f=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),r=t.cache=t.cache||{},i=t.count=t.count||[];return Gt(r,n)?(function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(i,n),r[n]):(i.length>=1e3&&delete r[i.shift()],i.push(n),r[n]=e(...arguments),r[n])}}((function(e,t,n){return{x:e*zt.cos(n)-t*zt.sin(n),y:e*zt.sin(n)+t*zt.cos(n)}}));if(c)k=c[0],E=c[1],x=c[2],_=c[3];else{e=(p=f(e,t,-h)).x,t=p.y;var m=(e-(a=(p=f(a,l,-h)).x))/2,g=(t-(l=p.y))/2,y=m*m/(n*n)+g*g/(r*r);y>1&&(n*=y=zt.sqrt(y),r*=y);var v=n*n,b=r*r,w=(o==s?-1:1)*zt.sqrt(Vt((v*b-v*g*g-b*m*m)/(v*g*g+b*m*m))),x=w*n*g/r+(e+a)/2,_=w*-r*m/n+(t+l)/2,k=zt.asin(((t-_)/r).toFixed(9)),E=zt.asin(((l-_)/r).toFixed(9));(k=e<x?Bt-k:k)<0&&(k=2*Bt+k),(E=a<x?Bt-E:E)<0&&(E=2*Bt+E),s&&k>E&&(k-=2*Bt),!s&&E>k&&(E-=2*Bt)}var O=E-k;if(Vt(O)>u){var P=E,S=a,C=l;E=k+u*(s&&E>k?1:-1),d=dn(a=x+n*zt.cos(E),l=_+r*zt.sin(E),n,r,i,0,s,S,C,[E,P,x,_])}O=E-k;var T=zt.cos(k),M=zt.sin(k),A=zt.cos(E),D=zt.sin(E),N=zt.tan(O/4),R=4/3*n*N,j=4/3*r*N,I=[e,t],L=[e+R*M,t-j*T],z=[a+R*D,l-j*A],B=[a,l];if(L[0]=2*I[0]-L[0],L[1]=2*I[1]-L[1],c)return[L,z,B].concat(d);for(var $=[],q=0,F=(d=[L,z,B].concat(d).join().split(",")).length;q<F;q++)$[q]=q%2?f(d[q-1],d[q],h).y:f(d[q],d[q+1],h).x;return $}function fn(e){var t=Xt(e);if(t.curve)return Kt(t.curve);for(var n=cn(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",...dn(t.x,t.y,...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,...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",...hn(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",...hn(t.x,t.y,e[1],e[2],e[3],e[4])];break;case"L":e=["C",...un(t.x,t.y,e[1],e[2])];break;case"H":e=["C",...un(t.x,t.y,e[1],t.y)];break;case"V":e=["C",...un(t.x,t.y,t.x,e[1])];break;case"Z":e=["C",...un(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;)s[t]="A",e.splice(t++,0,["C",...r.splice(0,6)]);e.splice(t,1),p=n.length}},s=[],a="",l="",c=0,p=n.length;c<p;c++){n[c]&&(a=n[c][0]),"C"!=a&&(s[c]=a,c&&(l=s[c-1])),n[c]=i(n[c],r,l),"A"!=s[c]&&"C"==a&&(s[c]="C"),o(n,c);var u=n[c],h=u.length;r.x=u[h-2],r.y=u[h-1],r.bx=Lt(u[h-4])||r.x,r.by=Lt(u[h-3])||r.y}return t.curve=Kt(n),n}function mn(e){return p(e)&&f(e,"waypoints")}function gn(e){return p(e)&&f(e,"labelTarget")}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function vn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function bn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function xn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,r){var i=t[r-1];if(i){var o=e[e.length-1],s=o&&o.endLength||0,a=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(i,n);e.push({start:i,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),r=n.reduce((function(e,t){return e+t.length}),0),i=r/2,o=0,s=n[o];s.endLength<i;)s=n[++o];var a=(i-s.startLength)/s.length;return{x:s.start.x+(s.end.x-s.start.x)*a,y:s.start.y+(s.end.y-s.start.y)*a}}function _n(e){return mn(e)?xn(e):vn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function kn(e,t,n){p(n=n||0)||(n={x:n,y:n});var r=bn(e),i=bn(t),o=r.bottom+n.y<=i.top,s=r.left-n.x>=i.right,a=r.top-n.y>=i.bottom,l=o?"top":a?"bottom":null,c=r.right+n.x<=i.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function En(e,t,n){var r=function(e,t){return ln(e,t)}(e,t);return 1===r.length||2===r.length&&Tt(r[0],r[1])<1?vn(r[0]):r.length>1?(r=T(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),vn(r[n?0:r.length-1])):null}function On(e,t){return Math.round(e*t)/t}function Pn(e){return u(e)?e+"px":e}function Sn(e,t,n){const r=Ie("g");Ce(r).add(t);const i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}const Cn={shape:["x","y","width","height"],connection:["waypoints"]};function Tn(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 Mn(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Tn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Tn.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=L({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),X(n,{position:"relative",overflow:"hidden",width:Pn(e.width),height:Pn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ie("svg");Pe(r,{width:"100%",height:"100%"}),_e(n,r);const i=this._viewport=Sn(r,"viewport");e.deferUpdate&&(this._viewboxChanged=j(I(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:r,viewport:i})})),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(()=>{delete this._cachedViewbox})),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Tn.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Tn.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=xt(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Tn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Tn.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let 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},Tn.prototype._getChildIndex=function(e){return w(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Tn.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:Sn(this._viewport,"layer-"+e,n),index:t,visible:!0}},Tn.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;const o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r},Tn.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(Me(n),t.visible=!1,n):n},Tn.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Me(t.group))},Tn.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Tn.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement},Tn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Tn.prototype._findPlaneForRoot=function(e){return m(this._planes,(function(t){return t.rootElement===e}))},Tn.prototype.getContainer=function(){return this._container},Tn.prototype._updateMarker=function(e,t,n){let r;e.id||(e=this._elementRegistry.get(e)),r=this._elementRegistry._elements[e.id],r&&(v([r.gfx,r.secondaryGfx],(function(e){e&&(n?Ce(e).add(t):Ce(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},Tn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Tn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Tn.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));return Ce(this.getGraphics(e)).has(t)},Tn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Tn.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Tn.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const r=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},Tn.prototype.removeRootElement=function(e){"string"==typeof e&&(e=this._elementRegistry.get(e));if(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},Tn.prototype.setRootElement=function(e){if(e===this._rootElement)return;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Tn.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Tn.prototype._addRoot=function(e,t){const n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},Tn.prototype._setRoot=function(e,t){const 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})},Tn.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");const n=Cn[e],r=x(n,(function(e){return void 0!==t[e]}));if(!r)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Tn.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},Tn.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();const i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);const s=o.create(e,t,r);return this._elementRegistry.add(t,s),o.update(e,t,s),i.fire(e+".added",{element:t,gfx:s}),t},Tn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Tn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Tn.prototype._removeElement=function(e,t){const 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),Pt(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},Tn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Tn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Tn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Tn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Tn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Tn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let r,i,o,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const r=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Xe(t,r)})),e):(o=this._rootElement?this.getActiveLayer():null,r=o&&o.getBBox()||{},s=Xe(t),i=s?s.matrix:function(e,t,n,r,i,o){var s=ze().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return Be(s,e);case 6:return Be(s,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),a=On(i.a,1e3),l=On(-i.e||0,1e3),c=On(-i.f||0,1e3),e=this._cachedViewbox={x:l?l/a:0,y:c?c/a:0,width:n.width/a,height:n.height/a,scale:a,inner:{width:r.width||0,height:r.height||0,x:r.x||0,y:r.y||0},outer:n})},Tn.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=L({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Mn(t,n)})),{x:n.e,y:n.f}},Tn.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const r=this.findRoot(e);if(r!==this.getRootElement()&&this.setRootElement(r),r===e)return;t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const i=wt(e),o=bn(i),s=this.viewbox(),a=this.zoom();let l,c;s.y+=t.top/a,s.x+=t.left/a,s.width-=(t.right+t.left)/a,s.height-=(t.bottom+t.top)/a;const p=bn(s);if(i.width<s.width&&i.height<s.height){const e=Math.max(0,o.right-p.right),t=Math.min(0,o.left-p.left),n=Math.max(0,o.bottom-p.bottom),r=Math.min(0,o.top-p.top);l=e||t,c=n||r}else l=i.x-s.x,c=i.y-s.y;this.scroll({dx:-l*a,dy:-c*a})},Tn.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,r;return this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),On(r.a,1e3)},Tn.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,r=t.inner;let i,o;return r.x>=0&&r.y>=0&&r.x+r.width<=n.width&&r.y+r.height<=n.height&&!e?o={x:0,y:0,width:Math.max(r.width+r.x,n.width),height:Math.max(r.height+r.y,n.height)}:(i=Math.min(1,n.width/r.width,n.height/r.height),o={x:r.x+(e?r.width/2-n.width/i/2:0),y:r.y+(e?r.height/2-n.height/i/2:0),width:n.width/i,height:n.height/i}),this.viewbox(o),this.viewbox(!1).scale},Tn.prototype._setZoom=function(e,t){const n=this._svg,r=this._viewport,i=n.createSVGMatrix(),o=n.createSVGPoint();let s,a,l,c,p;l=r.getCTM();const u=l.a;return t?(s=L(o,t),a=s.matrixTransform(l.inverse()),c=i.translate(a.x,a.y).scale(1/u*e).translate(-a.x,-a.y),p=l.multiply(c)):p=i.scale(e),Mn(this._viewport,p),p},Tn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Tn.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;if(e.waypoints){n=this.getGraphics(e).getBBox()}else n=e;return{x:n.x*t.scale-t.x*t.scale,y:n.y*t.scale-t.y*t.scale,width:n.width*t.scale,height:n.height*t.scale}},Tn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var An="data-element-id";function Dn(e){this._elements={},this._eventBus=e}function Nn(e,t,n){var r=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}(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 Rn(e,t){if(!(this instanceof Rn))return new Rn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Dn.$inject=["eventBus"],Dn.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),Pe(t,An,r),n&&Pe(n,An,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},Dn.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(Pe(r.gfx,An,""),r.secondaryGfx&&Pe(r.secondaryGfx,An,""),delete t[n])},Dn.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)},Dn.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&Pe(t,An,r),t},Dn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Pe(e,An);var n=this._elements[t];return n&&n.element},Dn.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},Dn.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}},Dn.prototype.getAll=function(){return this.filter((function(e){return e}))},Dn.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)}))},Dn.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},Dn.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")},Rn.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?Nn(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)},Rn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return function(e){return!0===e.__refs_collection}(n)||Nn(this,t,e),n},Rn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Rn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Rn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var jn=new Rn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),In=new Rn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ln=new Rn({name:"attachers",collection:!0},{name:"host"}),zn=new Rn({name:"outgoing",collection:!0},{name:"source"}),Bn=new Rn({name:"incoming",collection:!0},{name:"target"});function $n(){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)}}),jn.bind(this,"parent"),In.bind(this,"labels"),zn.bind(this,"outgoing"),Bn.bind(this,"incoming")}function qn(){$n.call(this),jn.bind(this,"children"),Ln.bind(this,"host"),Ln.bind(this,"attachers")}function Fn(){$n.call(this),jn.bind(this,"children")}function Vn(){qn.call(this),In.bind(this,"labelTarget")}function Hn(){$n.call(this),zn.bind(this,"source"),Bn.bind(this,"target")}e(qn,$n),e(Fn,qn),e(Vn,qn),e(Hn,$n);var Un={connection:Hn,shape:qn,label:Vn,root:Fn};function Wn(){this._uid=12}Wn.prototype.createRoot=function(e){return this.create("root",e)},Wn.prototype.createLabel=function(e){return this.create("label",e)},Wn.prototype.createShape=function(e){return this.create("shape",e)},Wn.prototype.createConnection=function(e){return this.create("connection",e)},Wn.prototype.create=function(e,t){return(t=L({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Un[e];if(!n)throw new Error("unknown type: <"+e+">");return L(new n,t)}(e,t)};var Gn="__fn",Qn=Array.prototype.slice;function Xn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Zn(){}function Yn(e){return e.childNodes[0]}function Kn(e,t,n,r,i){var o=$e();o.setTranslate(t,n);var s=$e();s.setRotate(r||0,0,0);var a=$e();a.setScale(i||1,i||1),Xe(e,[o,s,a])}function Jn(e,t,n){var r=$e();r.setTranslate(t,n),Xe(e,r)}function er(e,t){var n=$e();n.setRotate(t,0,0),Xe(e,n)}function tr(e,t){this._eventBus=e,this._elementRegistry=t}function nr(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}Xn.prototype.on=function(e,t,n,r){if(e=c(e)?e:[e],h(t)&&(r=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");var i=n;r&&((i=I(n,r))[Gn]=n[Gn]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},Xn.prototype.once=function(e,t,n,r){var i=this;if(h(t)&&(r=n,n=t,t=1e3),!u(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[Gn]=n,this.on(e,t,o)},Xn.prototype.off=function(e,t){e=c(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Xn.prototype.createEvent=function(e){var t=new Zn;return t.init(e),t},Xn.prototype.fire=function(e,t){var n,r,i,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof Zn?t:this.createEvent(t),o[0]=n;var s=n.type;e!==s&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==s&&(n.type=s)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},Xn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Xn.prototype._destroy=function(){this._listeners={}},Xn.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},Xn.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{r=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==r&&(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},Xn.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)},Xn.prototype._getListeners=function(e){return this._listeners[e]},Xn.prototype._setListeners=function(e,t){this._listeners[e]=t},Xn.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[Gn]!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},Zn.prototype.stopPropagation=function(){this.cancelBubble=!0},Zn.prototype.preventDefault=function(){this.defaultPrevented=!0},Zn.prototype.init=function(e){L(this,e||{})},tr.$inject=["eventBus","elementRegistry"],tr.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(Ce(t=Ie("g")).add("djs-children"),_e(n.parentNode,t))):t=n,t},tr.prototype._clear=function(e){var t=Yn(e);return ee(t),t},tr.prototype._createContainer=function(e,t,n,r){var i=Ie("g");Ce(i).add("djs-group"),void 0!==n?nr(i,t,t.childNodes[n]):_e(t,i);var o=Ie("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),r&&Ce(o).add("djs-frame"),_e(i,o);var s=Ie("g");return Ce(s).add("djs-visual"),_e(o,s),o},tr.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,_t(t))},tr.prototype.updateContainments=function(e){var t,n=this,r=this._elementRegistry;t=w(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),v(t,(function(e){var t=e.children;if(t){var i=n._getChildrenContainer(e);v(t.slice().reverse(),(function(e){nr(r.getGraphics(e).parentNode,i)}))}}))},tr.prototype.drawShape=function(e,t,n={}){return this._eventBus.fire("render.shape",{gfx:e,element:t,attrs:n})},tr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},tr.prototype.drawConnection=function(e,t,n={}){return this._eventBus.fire("render.connection",{gfx:e,element:t,attrs:n})},tr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},tr.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),Jn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},tr.prototype.remove=function(e){Me(this._elementRegistry.getGraphics(e).parentNode)};var rr={__depends__:[Ot],__init__:["canvas"],canvas:["type",Tn],elementRegistry:["type",Dn],elementFactory:["type",Wn],eventBus:["type",Xn],graphicsFactory:["type",tr]};function ir(e){return function(e){var t=new it(e);return t.init(),t}([{config:["value",e=e||{}]},rr].concat(e.modules||[]))}function or(e,t){this._injector=t=t||ir(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function sr(){}function ar(e,t){this.model=e,this.properties=t}or.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},or.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},sr.prototype.get=function(e){return this.$model.properties.get(this,e)},sr.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},ar.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(sr.prototype);v(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}),v(e,I((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 lr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},cr={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 pr(e,t){var n=cr[e];return n?n(t):t}function ur(e){return!!lr[e]}function hr(e){return!!cr[e]}function dr(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 fr(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,v(e,I(this.registerPackage,this))}function gr(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function yr(e){this.model=e}function vr(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function br(e){return e.replace(/^:/,"")}function wr(e,t={}){this.properties=new yr(this),this.factory=new ar(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache={},this.config=t}fr.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fr.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)},fr.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,s=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 a=i.indexOf(e);if(-1===a)throw new Error("property <"+r.name+"> not found in property list");i.splice(a,1),this.addProperty(t,n?void 0:a,s),o[r.name]=o[r.localName]=t},fr.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=dr(i[0],r),s=dr(i[1],o.prefix).name,a=this.propertiesByName[s];if(!a)throw new Error("refined property <"+s+"> not found");this.replaceProperty(a,e,n),delete e.redefines},fr.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},fr.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fr.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},fr.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},fr.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fr.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")},fr.prototype.hasProperty=function(e){return this.propertiesByName[e]},fr.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(v(e.properties,I((function(n){n=L({},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)},mr.prototype.getPackage=function(e){return this.packageMap[e]},mr.prototype.getPackages=function(){return this.packages},mr.prototype.registerPackage=function(e){e=L({},e);var t=this.packageMap;gr(t,e,"prefix"),gr(t,e,"uri"),v(e.types,I((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mr.prototype.registerType=function(e,t){var n=dr((e=L({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:L(e.meta||{})})).name,t.prefix),r=n.name,i={};v(e.properties,I((function(e){var t=dr(e.name,n.prefix),r=t.name;ur(e.type)||(e.type=dr(e.type,t.prefix).name),L(e,{ns:t,name:r}),i[r]=e}),this)),L(e,{ns:n,name:r,propertiesByName:i}),v(e.extends,I((function(e){var t=dr(e,n.prefix),i=this.typeMap[t.name];i.traits=i.traits||[],i.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},mr.prototype.mapTypes=function(e,t,n){var r=ur(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(n,r){var o=dr(n,ur(n)?"":e.prefix);i.mapTypes(o,t,r)}function s(e){return o(e,!0)}if(!r)throw new Error("unknown type <"+e.name+">");v(r.superClass,n?s:function(e){return o(e,!1)}),t(r,!n),v(r.traits,s)},mr.prototype.getEffectiveDescriptor=function(e){var t=dr(e),n=new fr(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},mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},yr.prototype.set=function(e,t,n){if(!d(t)||!t.length)throw new TypeError("property name must be a non-empty string");var r=this.getProperty(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[br(t)]:r?i in e?e[i]=n:vr(e,r,n):e.$attrs[br(t)]=n},yr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[br(t)];var r=n.name;return!e[r]&&n.isMany&&vr(e,n,[]),e[r]},yr.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=L({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},yr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},yr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},yr.prototype.getProperty=function(e,t){var n=this.model,r=n.getPropertyDescriptor(e,t);if(r)return r;if(t.includes(":"))return null;const i=n.config.strict;if(void 0!==i){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(i)throw n;"undefined"!=typeof console&&console.warn(n)}return null},wr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wr.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},wr.prototype.createAny=function(e,t,n){var r=dr(e),i={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){z(this,[e],t)}},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,"get",{enumerable:!1,writable:!0}),this.properties.define(i,"set",{enumerable:!1,writable:!0}),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),v(n,(function(e,t){p(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},wr.prototype.getPackage=function(e){return this.registry.getPackage(e)},wr.prototype.getPackages=function(){return this.registry.getPackages()},wr.prototype.getElementDescriptor=function(e){return e.$descriptor},wr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},wr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var xr=String.fromCharCode,_r=Object.prototype.hasOwnProperty,kr=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Er={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Or(e,t,n,r){return r?_r.call(Er,r)?Er[r]:"&"+r+";":xr(t||parseInt(n,16))}function Pr(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(kr,Or):e}Object.keys(Er).forEach((function(e){Er[e.toUpperCase()]=Er[e]}));var Sr="xsi:type",Cr="non-whitespace outside of root node";function Tr(e){return new Error(e)}function Mr(e){return"missing namespace for prefix <"+e+">"}function Ar(e){return{get:e,enumerable:!0}}function Dr(e){var t,n={};for(t in e)n[t]=e[t];return n}function Nr(e){return e+"$uri"}function Rr(){return{line:0,column:0}}function jr(e){throw e}function Ir(e){if(!this)return new Ir(e);var t,n,r,i,o,s,a,l,c,p=e&&e.proxy,u=jr,h=Rr,d=!1,f=!1,m=null,g=!1;function y(e){e instanceof Error||(e=Tr(e)),m=e,u(e,h)}function v(e){o&&(e instanceof Error||(e=Tr(e)),o(e,h))}this.on=function(e,c){if("function"!=typeof c)throw Tr("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":r=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":i=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw Tr("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Tr("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",f=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Tr("required args <xml=string>");return m=null,function(e){var o,u,m,b,w,x,_,k,E,O,P,S=f?[]:null,C=f?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[Nr(n)]=t;return r}(c):null,T=[],M=0,A=!1,D=!1,N=0,R=0,j="",I=0;function L(){if(null!==P)return P;var e,t,n,r,i,o,s,a,l,p,u,h=f&&C.xmlns,m=f&&d?[]:null,g=I,y=j,b=y.length,w={},x={};e:for(;g<b;g++)if(l=!1,!(32===(p=y.charCodeAt(g))||p<14&&p>8)){for((p<65||p>122||p>90&&p<97)&&95!==p&&58!==p&&(v("illegal first char attribute name"),l=!0),u=g+1;u<b;u++)if(!((p=y.charCodeAt(u))>96&&p<123||p>64&&p<91||p>47&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&p>8){v("missing attribute value"),g=u;continue e}if(61===p)break;v("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(a=y.substring(g,u))&&(v("illegal declaration of xmlns"),l=!0),34===(p=y.charCodeAt(u+1)))-1===(u=y.indexOf('"',g=u+2))&&-1!==(u=y.indexOf("'",g))&&(v("attribute value quote missmatch"),l=!0);else if(39===p)-1===(u=y.indexOf("'",g=u+2))&&-1!==(u=y.indexOf('"',g))&&(v("attribute value quote missmatch"),l=!0);else for(v("missing attribute value quotes"),l=!0,u+=1;u<b&&!(32===(p=y.charCodeAt(u+1))||p<14&&p>8);u++);for(-1===u&&(v("missing closing quotes"),u=b,l=!0),l||(o=y.substring(g,u)),g=u;u+1<b&&!(32===(p=y.charCodeAt(u+1))||p<14&&p>8);u++)g===u&&(v("illegal character after attribute end"),l=!0);if(g=u+1,!l)if(a in x)v("attribute <"+a+"> already defined");else if(x[a]=!0,f)if(d){if(null!==(i="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=Pr(o),t=Nr(i),!(s=c[e])){if("xmlns"===i||t in C&&C[t]!==e)do{s="ns"+M++}while(void 0!==C[s]);else s=i;c[e]=s}C[i]!==s&&(r||(C=Dr(C),r=!0),C[i]=s,"xmlns"===i&&(C[Nr(s)]=e,h=s),C[t]=e),w[a]=o;continue}m.push(a,o)}else-1!==(p=a.indexOf(":"))?(n=C[a.substring(0,p)])?((a=h===n?a.substr(p+1):n+a.substr(p))===Sr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=h+":"+o),w[a]=o):v(Mr(a.substring(0,p))):w[a]=o;else w[a]=o}if(d)for(g=0,b=m.length;g<b;g++){if(a=m[g++],o=m[g],-1!==(p=a.indexOf(":"))){if(!(n=C[a.substring(0,p)])){v(Mr(a.substring(0,p)));continue}(a=h===n?a.substr(p+1):n+a.substr(p))===Sr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=h+":"+o)}w[a]=o}return P=w}function z(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,s=0,a=R;N>=s&&(t=r.exec(e))&&!((a=t[0].length+t.index)>N);)i+=1,s=a;return-1==N?(o=a,n=e.substring(R)):0===R?n=e.substring(R,N):(o=N-s,n=-1==R?e.substring(N):e.substring(N,R+1)),{data:n,line:i,column:o}}h=z,p&&(O=Object.create({},{name:Ar((function(){return k})),originalName:Ar((function(){return E})),attrs:Ar(L),ns:Ar((function(){return C}))}));for(;-1!==R;){if(-1===(N=60===e.charCodeAt(R)?R:e.indexOf("<",R)))return T.length?y("unexpected end of file"):0===R?y("missing start tag"):void(R<e.length&&e.substring(R).trim()&&v(Cr));if(R!==N)if(T.length){if(t&&(t(e.substring(R,N),Pr,h),g))return}else if(e.substring(R,N).trim()&&(v(Cr),g))return;if(33===(w=e.charCodeAt(N+1))){if(91===(b=e.charCodeAt(N+2))&&"CDATA["===e.substr(N+3,6)){if(-1===(R=e.indexOf("]]>",N)))return y("unclosed cdata");if(i&&(i(e.substring(N+9,R),h),g))return;R+=3;continue}if(45===b&&45===e.charCodeAt(N+3)){if(-1===(R=e.indexOf("--\x3e",N)))return y("unclosed comment");if(s&&(s(e.substring(N+4,R),Pr,h),g))return;R+=3;continue}}if(63!==w){for(u=N+1;;u++){if(x=e.charCodeAt(u),isNaN(x))return R=-1,y("unclosed tag");if(34===x)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===x)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===x){R=u;break}}if(33!==w){if(P={},47===w){if(A=!1,D=!0,!T.length)return y("missing open tag");if(u=k=T.pop(),b=N+2+u.length,e.substring(N+2,b)!==u)return y("closing tag mismatch");for(;b<R;b++)if(!(32===(w=e.charCodeAt(b))||w>8&&w<14))return y("close tag")}else{if(47===e.charCodeAt(R-1)?(u=k=e.substring(N+1,R-1),A=!0,D=!0):(u=k=e.substring(N+1,R),A=!0,D=!1),!(w>96&&w<123||w>64&&w<91||95===w||58===w))return y("illegal first char nodeName");for(b=1,m=u.length;b<m;b++)if(!((w=u.charCodeAt(b))>96&&w<123||w>64&&w<91||w>47&&w<59||45===w||95===w||46==w)){if(32===w||w<14&&w>8){k=u.substring(0,b),P=null;break}return y("invalid nodeName")}D||T.push(k)}if(f){if(o=C,A&&(D||S.push(o),null===P&&(d=-1!==u.indexOf("xmlns",b))&&(I=b,j=u,L(),d=!1)),E=k,-1!==(w=k.indexOf(":"))){if(!(_=C[k.substring(0,w)]))return y("missing namespace on <"+E+">");k=k.substr(w+1)}else _=C.xmlns;_&&(k=_+":"+k)}if(A&&(I=b,j=u,n&&(p?n(O,Pr,D,h):n(k,L,Pr,D,h),g)))return;if(D){if(r&&(r(p?O:k,Pr,A,h),g))return;f&&(C=A?o:S.pop())}R+=1}else{if(l&&(l(e.substring(N,R+1),Pr,h),g))return;R+=1}}else{if(-1===(R=e.indexOf("?>",N)))return y("unclosed question");if(a&&(a(e.substring(N,R+2),h),g))return;R+=2}}}(e),h=Rr,g=!1,m},this.stop=function(){g=!0}}function Lr(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var zr={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Br="xsi:type";function $r(e){return e.xml&&e.xml.serialize}function qr(e){return $r(e)===Br}function Fr(e,t){return Lr(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Vr(e){return new Error(e)}function Hr(e){return e.$descriptor}function Ur(e){L(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Vr("expected element");var t,n=this.elementsById,r=Hr(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 Vr("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Wr(){}function Gr(){}function Qr(){}function Xr(e,t){this.property=e,this.context=t}function Zr(e,t){this.element=t,this.propertyDesc=e}function Yr(){}function Kr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Jr(e,t,n){Kr.call(this,e,t,n)}function ei(e,t,n){this.model=e,this.context=n}function ti(e){e instanceof wr&&(e={model:e}),L(this,{lax:!1},e)}Wr.prototype.handleEnd=function(){},Wr.prototype.handleText=function(){},Wr.prototype.handleNode=function(){},Gr.prototype=Object.create(Wr.prototype),Gr.prototype.handleNode=function(){return this},Qr.prototype=Object.create(Wr.prototype),Qr.prototype.handleText=function(e){this.body=(this.body||"")+e},Xr.prototype=Object.create(Qr.prototype),Xr.prototype.handleNode=function(e){if(this.element)throw Vr("expected no sub nodes");return this.element=this.createReference(e),this},Xr.prototype.handleEnd=function(){this.element.id=this.body},Xr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Zr.prototype=Object.create(Qr.prototype),Zr.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=pr(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Yr.prototype=Object.create(Qr.prototype),Yr.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},Kr.prototype=Object.create(Yr.prototype),Kr.prototype.addReference=function(e){this.context.addReference(e)},Kr.prototype.handleText=function(e){if(!Hr(this.element).bodyProperty)throw Vr("unexpected body text <"+e+">");Qr.prototype.handleText.call(this,e)},Kr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Hr(t).bodyProperty;n&&void 0!==e&&(e=pr(n.type,e),t.set(n.name,e))},Kr.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Hr(r),o=this.context,s=new r({}),a=this.model;return v(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?v(e.split(" "),(function(e){o.addReference({element:s,property:r.ns.name,id:e})})):o.addReference({element:s,property:r.ns.name,id:e}):(r?e=pr(r.type,e):"xmlns"!==n&&(t=dr(n,i.ns.prefix),a.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},Kr.prototype.getPropertyForNode=function(e){var t,n,r=dr(e.name),i=this.type,o=this.model,s=Hr(i),a=r.name,l=s.propertiesByName[a];if(l&&!l.isAttr)return qr(l)&&(t=e.attributes[Br])?(t=function(e,t){var n=dr(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),L({},l,{effectiveType:Hr(n=o.getType(t)).name})):l;var c=o.getPackage(r.prefix);if(c){if(t=Fr(r,c),n=o.getType(t),l=m(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),l)return L({},l,{effectiveType:Hr(n).name})}else if(l=m(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),l)return l;throw Vr("unrecognized element <"+r.name+">")},Kr.prototype.toString=function(){return"ElementDescriptor["+Hr(this.type).name+"]"},Kr.prototype.valueHandler=function(e,t){return new Zr(e,t)},Kr.prototype.referenceHandler=function(e){return new Xr(e,this.context)},Kr.prototype.handler=function(e){return"Element"===e?new ei(this.model,e,this.context):new Kr(this.model,e,this.context)},Kr.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,hr(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?(L(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},Jr.prototype=Object.create(Kr.prototype),Jr.prototype.createElement=function(e){var t=e.name,n=dr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),s=o&&Fr(n,o)||t;if(!i.hasType(s))throw Vr("unexpected element <"+e.originalName+">");return Kr.prototype.createElement.call(this,e)},ei.prototype=Object.create(Yr.prototype),ei.prototype.createElement=function(e){var t=e.name,n=dr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},ei.prototype.handleChild=function(e){var t=new ei(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},ei.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ti.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof Kr?(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,s=new Ur(L({},t,{rootHandler:r})),a=new Ir({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var r=t(),i=r.line,o=r.column,a=r.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Vr(l)}function p(e,t){return c(e,t,!0)}r.context=s,l.push(r);var u=/^<\?xml /i,h=/ encoding="([^"]+)"/i,d=/^utf-8$/i;function f(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var m=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return a.ns(m).on("openTag",(function(e,t,n,r){var i=e.attrs||{},s=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Gr)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=h.exec(e),n=t&&t[1];n&&!d.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",f).on("text",(function(e,t,n){!function(e,t){e.trim()&&f(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var i;try{a.parse(e),function(){var e,t,n=s.elementsById,r=s.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],a=Hr(i).propertiesByName[t.property];if(o||s.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var l=i.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else i.set(a.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Vr("failed to parse document as <"+r.type.$descriptor.name+">"));var l=s.warnings,c=s.references,p=s.elementsById;return i?(i.warnings=l,n(i)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},ti.prototype.handler=function(e){return new Jr(this.model,e)};var ni=/<|>|'|"|&|\n\r|\n/g,ri=/<|>|&/g;function ii(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 oi(e,t){return Lr(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function si(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ai(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var li={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ci={"<":"lt",">":"gt","&":"amp"};function pi(e,t,n){return(e=d(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function ui(e){this.tagName=e}function hi(){}function di(e){this.tagName=e}function fi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function mi(e,t){fi.call(this,e,t)}function gi(){this.value="",this.write=function(e){this.value+=e}}function yi(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 vi(e){return e=L({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new gi,i=new yi(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new fi).build(t).serializeTo(i),!n)return r.value}}}function bi(e,t){wr.call(this,e,t)}ui.prototype.build=function(e){return this.element=e,this},ui.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},hi.prototype.serializeValue=hi.prototype.serializeTo=function(e){e.append(this.escape?pi(this.value,ri,ci):this.value)},hi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ri)&&(this.escape=!0),this},si(di,hi),di.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},fi.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 y(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!f(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(y(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return y(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},fi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?L({localName:t.ns.localName},e):L({localName:oi(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},fi.prototype.nsPropertyTagName=function(e){return function(e,t){return L({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},fi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},fi.prototype.nsAttributeName=function(e){var t;if(t=d(e)?dr(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}:L({localName:t.localName},n)},fi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return v(e,(function(i,o){"$body"===o?n.push((new hi).build({type:"String"},i)):"$children"===o?v(i,(function(e){n.push(new fi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},fi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=dr(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 s=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(s)}},fi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return v(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},fi.prototype.parseGenericAttributes=function(e,t){var n=this;v(t,(function(t){if(t.name!==Br)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},fi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;v(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new hi).build(e,i[0]));else if(hr(e.type))v(i,(function(r){n.push(new di(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)v(i,(function(r){n.push(new ui(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var s=qr(e),a=function(e){return"property"===$r(e)}(e);v(i,(function(r){var i;i=s?new mi(t,e):a?new fi(t,e):new fi(t),n.push(i.build(r))}))}}))},fi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new ii(t):n=t),n},fi.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},fi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,s=this.getNamespaces(t),a=e.prefix,l=e.uri;if(!a&&!l)return{localName:e.localName};if(i=zr[a]||o&&(o.getPackage(a)||{}).uri,!(l=l||i||s.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=s.byUri(l))){for(n=a,r=1;s.uriByPrefix(n);)n=a+"_"+r++;e=this.logNamespace({prefix:n,uri:l},i===l)}return a&&s.mapPrefix(a,l),e},fi.prototype.parseAttributes=function(e){var t=this,n=this.element;v(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];v(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},fi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ai(e)},fi.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=pi(t,ni,li));var r=g(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),i={name:e,value:t};-1!==r?n.splice(r,1,i):n.push(i)},fi.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)),v(t,(function(t){e.append(" ").append(ai(t.name)).append('="').append(t.value).append('"')}))},fi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==hi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),v(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},si(mi,fi),mi.prototype.parseNsAttributes=function(e){var t=fi.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(Br),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},mi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},bi.prototype=Object.create(wr.prototype),bi.prototype.fromXML=function(e,t,n){d(t)||(n=t,t="bpmn:Definitions");var r=new ti(L({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},bi.prototype.toXML=function(e,t){var n=new vi(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var wi={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",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 xi(e,t){return new bi(L({},wi,e),t)}function _i(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var ki="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 Ei(e){f(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(ki)}})}function Oi(e,t){return e.$instanceOf(t)}function Pi(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function s(e){n[e.id]=e}function a(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:_i(n)}));return e.element(n,i[n.id],r)}(n,r);return s(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:_i(n)})),console.error(e)}}function l(t,n){e.error(t,n)}var c=this.registerDi=function(e){var n=e.bpmnElement;n?i[n.id]?l(t("multiple DI elements defined for {element}",{element:_i(n)}),{element:n}):(i[n.id]=e,Ei(n)):l(t("no bpmnElement referenced in {element}",{element:_i(e)}),{element:e})};function p(e){var t;t=e.plane,c(t),v(t.planeElement,u)}function u(e){c(e)}this.handleDefinitions=function(s,a){var u=s.diagrams;if(a&&-1===u.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&u&&u.length&&(a=u[0]),!a)throw new Error(t("no diagram to display"));i={},p(a);var g=a.plane;if(!g)throw new Error(t("no plane for {element}",{element:_i(a)}));var b=g.bpmnElement;if(!b){if(b=function(e){return m(e.rootElements,(function(e){return Oi(e,"bpmn:Process")||Oi(e,"bpmn:Collaboration")}))}(s),!b)throw new Error(t("no process or collaboration to display"));l(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:_i(g),rootElement:_i(b)})),g.bpmnElement=b,c(g)}var w,x,k=function(t,n){return e.root(t,i[t.id],n)}(b,g);if(Oi(b,"bpmn:Process")||Oi(b,"bpmn:SubProcess"))d(b,k);else{if(!Oi(b,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:_i(g),rootElement:_i(b)}));x=k,v((w=b).participants,o(M,x)),_(w.artifacts,x),r.push((function(){!function(e,t){v(e,o(f,t))}(w.messageFlows,x)})),function(e,t){var r=y(e,(function(e){return!n[e.id]&&Oi(e,"bpmn:Process")&&e.laneSets}));r.forEach(o(d,t))}(s.rootElements,k)}h(r)};var h=this.handleDeferred=function(){for(;r.length;)r.shift()()};function d(e,t){T(e,t),k(e.ioSpecification,t),_(e.artifacts,t),s(e)}function f(e,t){a(e,t)}function g(e,t){a(e,t)}function b(e,t){a(e,t)}function w(e,t){a(e,t)}function x(e,t){a(e,t)}function _(e,t){v(e,(function(e){Oi(e,"bpmn:Association")?r.push((function(){x(e,t)})):x(e,t)}))}function k(e,t){e&&(v(e.dataInputs,o(b,t)),v(e.dataOutputs,o(w,t)))}var E=this.handleSubProcess=function(e,t){T(e,t),_(e.artifacts,t)};function O(e,t){var n=a(e,t);Oi(e,"bpmn:SubProcess")&&E(e,n||t),Oi(e,"bpmn:Activity")&&k(e.ioSpecification,t),r.push((function(){v(e.dataInputAssociations,o(g,t)),v(e.dataOutputAssociations,o(g,t))}))}function P(e,t){a(e,t)}function S(e,t){r.push((function(){var n=a(e,t);e.childLaneSet&&C(e.childLaneSet,n||t),function(e){v(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function C(e,t){v(e.lanes,o(S,t))}function T(e,n){!function(e,n){v(e,(function(e){Oi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){a(e,t)}(e,n)})):Oi(e,"bpmn:BoundaryEvent")?r.unshift((function(){O(e,n)})):Oi(e,"bpmn:FlowNode")?O(e,n):Oi(e,"bpmn:DataObject")||(Oi(e,"bpmn:DataStoreReference")||Oi(e,"bpmn:DataObjectReference")?P(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:_i(e),context:n?_i(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){v(e,o(C,t))}(e.laneSets,n)}function M(e,t){var n=a(e,t),r=e.processRef;r&&d(r,n||t)}}function Si(e,t){var n=Ti(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ci(e,t){return _(t,(function(t){return Si(e,t)}))}function Ti(e){return e&&e.businessObject||e}function Mi(e){return e&&e.di}function Ai(e,t,n){var r,i,o,s,a=[];function l(e,t){var n=new Pi({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){a.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;Si(r,"bpmn:Process")||Si(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(Si(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=Si(i,"bpmn:Collaboration")?i:m(e.rootElements,(function(e){if(Si(e,"bpmn:Collaboration"))return m(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var s=Di(o),a=[t],l=[r];return v(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==s.indexOf(t)&&-1===l.indexOf(t)&&(a.push(e),l.push(t))})),a}(e,t);if(!i)throw new Error(o("no diagram to display"));v(i,(function(t){n.handleDefinitions(e,t)}));var l=t.plane.bpmnElement.id;s.setRootElement(s.findRoot(l+"_plane")||s.findRoot(l))}return new Promise((function(c,p){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),s=e.get("canvas"),i.fire("import.render.start",{definitions:t}),l(t,n),i.fire("import.render.complete",{error:undefined,warnings:a}),c({warnings:a})}catch(e){return e.warnings=a,p(e)}}))}function Di(e){var t=[];return v(e,(function(e){e&&(t.push(e),t=t.concat(Di(e.flowElements)))})),t}var Ni,Ri='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ji={verticalAlign:"middle"},Ii={color:"#404040"},Li={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},zi={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Bi={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},$i='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ri+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';function qi(){Ni||(X(Ni=ye($i),Li),X(ve("svg",Ni),ji),X(ve(".backdrop",Ni),zi),X(ve(".notice",Ni),Bi),X(ve(".link",Ni),Ii,{margin:"15px 20px 15px 10px",alignSelf:"center"}),de.bind(Ni,".backdrop","click",(function(e){document.body.removeChild(Ni)}))),document.body.appendChild(Ni)}function Fi(e){e=L({},Hi,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),function(e){const t=ye('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ri+"</a>");X(ve("svg",t),ji),X(t,Ii,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(t),pe.bind(t,"click",(function(e){qi(),e.preventDefault()}))}(this._container),this._init(this._container,this._moddle,e)}function Vi(e,t){return e.warnings=t,e}e(Fi,or),Fi.prototype.importXML=async function(e,t){const n=this;let r=[];try{let o;e=this._emit("import.parse.start",{xml:e})||e;try{o=await this._moddle.fromXML(e,"bpmn:Definitions")}catch(e){throw this._emit("import.parse.complete",{error:e}),e}let s=o.rootElement;const a=o.references,l=o.warnings,c=o.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",(i={error:null,definitions:s,elementsById:c,references:a,warnings:r},n.get("eventBus").createEvent(i)))||s;const p=await this.importDefinitions(s,t);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(e){let t=e;throw r=r.concat(t.warnings||[]),Vi(t,r),t=function(e){const 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}(t),this._emit("import.done",{error:t,warnings:t.warnings}),t}var i},Fi.prototype.importDefinitions=async function(e,t){this._setDefinitions(e);return{warnings:(await this.open(t)).warnings}},Fi.prototype.open=async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw Vi(e,[]),e}if("string"==typeof e&&(n=function(e,t){if(!t)return null;return m(e.diagrams,(function(e){return e.id===t}))||null}(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw Vi(t,[]),t}try{this.clear()}catch(e){throw Vi(e,[]),e}const{warnings:r}=await Ai(this,t,n);return{warnings:r}},Fi.prototype.saveXML=async function(e){e=e||{};let t,n,r=this._definitions;try{if(!r)throw new Error("no definitions loaded");r=this._emit("saveXML.start",{definitions:r})||r;n=(await this._moddle.toXML(r,e)).xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(e){t=e}const i=t?{error:t}:{xml:n};if(this._emit("saveXML.done",i),t)throw t;return i},Fi.prototype.saveSVG=async function(){let e,t;this._emit("saveSVG.start");try{const t=this.get("canvas"),n=t.getActiveLayer(),r=ve("defs",t._svg),i=Ge(n),o=r?"<defs>"+Ge(r)+"</defs>":"",s=n.getBBox();e='<?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="'+s.width+'" height="'+s.height+'" viewBox="'+s.x+" "+s.y+" "+s.width+" "+s.height+'" version="1.1">'+o+i+"</svg>"}catch(e){t=e}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}},Fi.prototype._setDefinitions=function(e){this._definitions=e},Fi.prototype.getModules=function(){return this._modules},Fi.prototype.clear=function(){this.getDefinitions()&&or.prototype.clear.call(this)},Fi.prototype.destroy=function(){or.prototype.destroy.call(this),we(this._container)},Fi.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Fi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Fi.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()},Fi.prototype.getDefinitions=function(){return this._definitions},Fi.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Fi.prototype._init=function(e,t,n){const r=n.modules||this.getModules(n),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),s=L(q(n,["additionalModules"]),{canvas:L({},n.canvas,{container:e}),modules:o});or.call(this,s),n&&n.container&&this.attachTo(n.container)},Fi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Fi.prototype._createContainer=function(e){const t=ye('<div class="bjs-container"></div>');return X(t,{width:Ui(e.width),height:Ui(e.height),position:e.position}),t},Fi.prototype._createModdle=function(e){return new xi(L({},this._moddleExtensions,e.moddleExtensions))},Fi.prototype._modules=[];const Hi={width:"100%",height:"100%",position:"relative"};function Ui(e){return e+(u(e)?"px":"")}function Wi(e){Fi.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 Gi(e,t){return!Si(e,"bpmn:CallActivity")&&(Si(e,"bpmn:SubProcess")?!(!(t=t||Mi(e))||!Si(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!Si(e,"bpmn:Participant")||!!Ti(e).processRef)}function Qi(e){if(Si(e,"bpmn:Participant")||Si(e,"bpmn:Lane")){var t=Mi(e).isHorizontal;return void 0===t||t}}function Xi(e){return e&&!1!==Ti(e).isInterrupting}function Zi(e){return e&&!!Ti(e).triggeredByEvent}function Yi(e,t){return _(Ti(e).eventDefinitions,(function(e){return Si(e,t)}))}e(Wi,Fi),Wi.prototype._createModdle=function(e){var t=Fi.prototype._createModdle.call(this,e);return t.ids=new n([32,36,1]),t},Wi.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var Ki={width:90,height:20},Ji=15;function eo(e){return Si(e,"bpmn:Event")||Si(e,"bpmn:Gateway")||Si(e,"bpmn:DataStoreReference")||Si(e,"bpmn:DataObjectReference")||Si(e,"bpmn:DataInput")||Si(e,"bpmn:DataOutput")||Si(e,"bpmn:SequenceFlow")||Si(e,"bpmn:MessageFlow")||Si(e,"bpmn:Group")}function to(e){return gn(e.label)}function no(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)),s=i.x,a=i.y;return Math.abs(o)<Math.PI/2?a-=Ji:s+=Ji,{x:s,y:a}}function ro(e){return e.waypoints?no(e.waypoints):Si(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ki.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ki.height/2}}function io(e){return Si(e,"bpmn:FlowElement")||Si(e,"bpmn:Participant")||Si(e,"bpmn:Lane")||Si(e,"bpmn:SequenceFlow")||Si(e,"bpmn:MessageFlow")||Si(e,"bpmn:DataInput")||Si(e,"bpmn:DataOutput")?"name":Si(e,"bpmn:TextAnnotation")?"text":Si(e,"bpmn:Group")?"categoryValueRef":void 0}function oo(e){var t=e.businessObject,n=io(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function so(e,t){var n=e.businessObject,r=io(n);return r&&("categoryValueRef"===r?n.categoryValueRef.value=t:n[r]=t),e}var ao="hsl(225, 10%, 15%)",lo="white";function co(e,t){return _(e.eventDefinitions,(function(e){return e.$type===t}))}function po(e,t,n){var r=Mi(e);return n||r.get("color:background-color")||r.get("bioc:fill")||t||lo}function uo(e,t,n){var r=Mi(e);return n||r.get("color:border-color")||r.get("bioc:stroke")||t||ao}function ho(e,t,n,r){var i=Mi(e).get("label");return r||i&&i.get("color:color")||t||uo(e,n)}function fo(e,t={}){return{width:mo(e,t),height:go(e,t)}}function mo(e,t={}){return f(t,"width")?t.width:e.width}function go(e,t={}){return f(t,"height")?t.height:e.height}var yo=new n,vo=.95;function bo(e,t,n,r,i,o,s){at.call(this,t,s);var a=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,u=yo.next(),h={};function d(e){return n.computeStyle(e,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ao,strokeWidth:2,fill:"white"})}function f(e){return n.computeStyle(e,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ao,strokeWidth:2})}function m(e,t){var{ref:n={x:0,y:0},scale:r=1,element:o}=t,s=Ie("marker",{id:e,viewBox:"0 0 20 20",refX:n.x,refY:n.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});_e(s,o);var a=ve("defs",i._svg);a||(a=Ie("defs"),_e(i._svg,a)),_e(a,s),h[e]=s}function g(e){return e.replace(/[^0-9a-zA-Z]+/g,"_")}function y(e,t,n){var r=e+"-"+g(t)+"-"+g(n)+"-"+u;return h[r]||function(e,t,n,r){if("sequenceflow-end"===t){m(e,{element:Ie("path",{d:"M 1 5 L 11 10 L 1 15 Z",...d({fill:r,stroke:r,strokeWidth:1})}),ref:{x:11,y:10},scale:.5})}if("messageflow-start"===t){m(e,{element:Ie("circle",{cx:6,cy:6,r:3.5,...d({fill:n,stroke:r,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6}})}if("messageflow-end"===t){m(e,{element:Ie("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...d({fill:n,stroke:r,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5}})}if("association-start"===t){m(e,{element:Ie("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:r,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5})}if("association-end"===t){m(e,{element:Ie("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:r,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5})}if("conditional-flow-marker"===t){m(e,{element:Ie("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...d({fill:n,stroke:r})}),ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){m(e,{element:Ie("path",{d:"M 6 4 L 10 16",...d({stroke:r})}),ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function b(e,t,n,r,i={}){p(r)&&(i=r,r=0),r=r||0,i=d(i);var o=Ie("circle",{cx:t/2,cy:n/2,r:Math.round((t+n)/4-r),...i});return _e(e,o),o}function w(e,t,n,r,i,o){p(i)&&(o=i,i=0),i=i||0,o=d(o);var s=Ie("rect",{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r,...o});return _e(e,s),s}function x(e,t,n,r){var i=dt(t,n=f(n),r);return _e(e,i),i}function _(e,t,n){return x(e,t,n,5)}function k(e,t,n){n=f(n);var r=Ie("path",{...n,d:t});return _e(e,r),r}function E(e,t,n,r){return k(t,n,L({"data-marker":e},r))}function O(e){return te[e]}function P(e){return function(t,n,r){return O(e)(t,n,r)}}var S=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:i?po(t,a,n.fill):uo(t,l,n.stroke),strokeWidth:1})},C=function(e,t,n={}){var i=b(e,t.width,t.height,.2*t.height,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:2});k(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{stroke:uo(t,l,n.stroke),strokeWidth:2});for(var o=0;o<12;o++){var s=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),c=t.width/2,p=t.height/2;k(e,s,{strokeWidth:1,stroke:uo(t,l,n.stroke),transform:"rotate("+30*o+","+p+","+c+")"})}return i},T=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},M=function(e,t,n={}){return k(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},A=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},D=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},N=function(e,t,n={},i){var o=k(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{fill:i?uo(t,l,n.stroke):"none",stroke:uo(t,l,n.stroke),strokeWidth:1});return er(o,45),o},R=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},j=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},I=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),strokeWidth:1})},z=function(e,t,n={}){return k(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},B=function(e,t,n={}){return b(e,t.width,t.height,8,{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:4})};function $(e,t,n={}){var r=Ti(e),i=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(r);return r.get("eventDefinitions")&&r.get("eventDefinitions").length>1?r.get("parallelMultiple")?z(t,e,n,i):I(t,e,n,i):co(r,"bpmn:MessageEventDefinition")?S(t,e,n,i):co(r,"bpmn:TimerEventDefinition")?C(t,e,n,i):co(r,"bpmn:ConditionalEventDefinition")?M(t,e,n,i):co(r,"bpmn:SignalEventDefinition")?j(t,e,n,i):co(r,"bpmn:EscalationEventDefinition")?T(t,e,n,i):co(r,"bpmn:LinkEventDefinition")?A(t,e,n,i):co(r,"bpmn:ErrorEventDefinition")?D(t,e,n,i):co(r,"bpmn:CancelEventDefinition")?N(t,e,n,i):co(r,"bpmn:CompensateEventDefinition")?R(t,e,n,i):co(r,"bpmn:TerminateEventDefinition")?B(t,e,n,i):null}var q={ParticipantMultiplicityMarker:function(e,t,n={}){var i=mo(t,n),o=go(t,n);E("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2-6)/i,my:(o-15)/o}}),{strokeWidth:2,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},SubProcessMarker:function(e,t,n={}){Jn(w(e,14,14,0,{strokeWidth:1,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)}),t.width/2-7.5,t.height-20),E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},ParallelMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.parallel)/i,my:(o-20)/o}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},SequentialMarker:function(e,t,n){E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},CompensationMarker:function(e,t,n){E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},LoopMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.loop)/i,my:(o-7)/o}}),{strokeWidth:1.5,fill:"none",stroke:uo(t,l,n.stroke),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.adhoc)/i,my:(o-15)/o}}),{strokeWidth:1,fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke)})}};function F(e,t,n,r){q[e](t,n,r)}function V(e,t,n,r={}){r={fill:r.fill,stroke:r.stroke,width:mo(t,r),height:go(t,r)};var i=Ti(t),o=n&&n.includes("SubProcessMarker");r=o?{...r,seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{...r,seq:-5,parallel:-6,compensation:-27,loop:0,adhoc:10},v(n,(function(n){F(n,e,t,r)})),i.get("isForCompensation")&&F("CompensationMarker",e,t,r),Si(i,"bpmn:AdHocSubProcess")&&F("AdhocMarker",e,t,r);var s=i.get("loopCharacteristics"),a=s&&s.get("isSequential");s&&(void 0===a&&F("LoopMarker",e,t,r),!1===a&&F("ParallelMarker",e,t,r),!0===a&&F("SequentialMarker",e,t,r))}function H(e,t,n={}){n=L({size:{width:100}},n);var r=o.createText(t||"",n);return Ce(r).add("djs-label"),_e(e,r),r}function U(e,t,n,r={}){var i=Ti(t),o=fo({x:t.x,y:t.y,width:t.width,height:t.height},r);return H(e,i.name,{align:n,box:o,padding:7,style:{fill:ho(t,c,l,r.stroke)}})}function W(e,t,n,r={}){var i=Qi(n),o=H(e,t,{box:{height:30,width:i?go(n,r):mo(n,r)},align:"center-middle",style:{fill:ho(n,c,l,r.stroke)}});i&&Kn(o,0,-(-1*go(n,r)),270)}function G(e,t,n={}){var{width:r,height:i}=fo(t,n);return w(e,r,i,10,{...n,fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke)})}function Q(e,t,n={}){var r=Ti(t),i=po(t,a,n.fill),o=uo(t,l,n.stroke);return"One"!==r.get("associationDirection")&&"Both"!==r.get("associationDirection")||(n.markerEnd=y("association-end",i,o)),"Both"===r.get("associationDirection")&&(n.markerStart=y("association-start",i,o)),n=wo(n,["markerStart","markerEnd"]),_(e,t.waypoints,{...n,stroke:o,strokeDasharray:"0, 5"})}function X(e,t,n={}){var i=po(t,a,n.fill),o=uo(t,l,n.stroke),s=k(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:i,fillOpacity:vo,stroke:o});(function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection})(Ti(t))&&k(e,r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:(t.height-18)/t.height}}),{strokeWidth:2,fill:i,stroke:o});return s}function Z(e,t,n={}){return b(e,t.width,t.height,{fillOpacity:vo,...n,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})}function Y(e,t,n={}){return function(e,t,n,r){var i=t/2,o=n/2,s=[{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);var a=Ie("polygon",{...r,points:s});return _e(e,a),a}(e,t.width,t.height,{fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke)})}function K(e,t,n={}){var r=w(e,mo(t,n),go(t,n),0,{fill:po(t,a,n.fill),fillOpacity:n.fillOpacity||vo,stroke:uo(t,l,n.stroke),strokeWidth:1.5}),i=Ti(t);Si(i,"bpmn:Lane")&&W(e,i.get("name"),t,n);return r}function J(e,t,n={}){var r=G(e,t,n);Zi(t)&&Pe(r,{strokeDasharray:"0, 5.5",strokeWidth:2.5});var i=Gi(t);return U(e,t,i?"center-top":"center-middle",n),V(e,t,i?void 0:["SubProcessMarker"],n),r}function ee(e,t,n={}){var r=G(e,t,n);return U(e,t,"center-middle",n),V(e,t,void 0,n),r}var te=this.handlers={"bpmn:AdHocSubProcess":function(e,t,n={}){return J(e,t,n=Gi(t)?wo(n,["fill","stroke","width","height"]):wo(n,["fill","stroke"]))},"bpmn:Association":function(e,t,n={}){return Q(e,t,n=wo(n,["fill","stroke"]))},"bpmn:BoundaryEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Ti(t).get("cancelActivity");n={strokeWidth:1.5,fill:po(t,a,n.fill),fillOpacity:1,stroke:uo(t,l,n.stroke)},i||(n.strokeDasharray="6");var o=Z(e,t,n);return b(e,t.width,t.height,3,{...n,fill:"none"}),r&&$(t,e,n),o},"bpmn:BusinessRuleTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return Pe(k(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),Pe(k(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:CallActivity":function(e,t,n={}){return n=wo(n,["fill","stroke"]),J(e,t,{strokeWidth:5,...n})},"bpmn:ComplexGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:DataInput":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=r.getRawPath("DATA_ARROW"),o=X(e,t,n);return k(e,i,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1}),o},"bpmn:DataInputAssociation":function(e,t,n={}){return n=wo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",po(t,a,n.fill),uo(t,l,n.stroke))})},"bpmn:DataObject":function(e,t,n={}){return X(e,t,n=wo(n,["fill","stroke"]))},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=r.getRawPath("DATA_ARROW"),o=X(e,t,n);return k(e,i,{strokeWidth:1,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)}),o},"bpmn:DataOutputAssociation":function(e,t,n={}){return n=wo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",po(t,a,n.fill),uo(t,l,n.stroke))})},"bpmn:DataStoreReference":function(e,t,n={}){return n=wo(n,["fill","stroke"]),k(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke),strokeWidth:2})},"bpmn:EndEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Z(e,t,{...n,strokeWidth:4});return r&&$(t,e,n),i},"bpmn:EventBasedGateway":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=Ti(t),o=Y(e,t,n);b(e,t.width,t.height,.2*t.height,{fill:po(t,"none",n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1});var s=i.get("eventGatewayType"),a=!!i.get("instantiate");if("Parallel"===s){var c=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});k(e,c,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1})}else"Exclusive"===s&&(a||b(e,t.width,t.height,.26*t.height,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1}),function(){var i=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});k(e,i,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:2})}());return o},"bpmn:ExclusiveGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"])),o=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Mi(t).get("isMarkerVisible")&&k(e,o,{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:Gateway":function(e,t,n={}){return Y(e,t,n=wo(n,["fill","stroke"]))},"bpmn:Group":function(e,t,n={}){return n=wo(n,["fill","stroke","width","height"]),w(e,t.width,t.height,10,{stroke:uo(t,l,n.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:mo(t,n),height:go(t,n)})},"bpmn:InclusiveGateway":function(e,t,n={}){var r=Y(e,t,n=wo(n,["fill","stroke"]));return b(e,t.width,t.height,.24*t.height,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:2.5}),r},"bpmn:IntermediateEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Z(e,t,{...n,strokeWidth:1.5});return b(e,t.width,t.height,3,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1.5}),r&&$(t,e,n),i},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(e,t,n={}){return n=wo(n,["fill","stroke","width","height"]),K(e,t,{...n,fillOpacity:.25})},"bpmn:ManualTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),i},"bpmn:MessageFlow":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=Ti(t),o=Mi(t),s=po(t,a,n.fill),c=uo(t,l,n.stroke),p=_(e,t.waypoints,{markerEnd:y("messageflow-end",s,c),markerStart:y("messageflow-start",s,c),stroke:c,strokeDasharray:"10, 11",strokeWidth:1.5});if(i.get("messageRef")){var u=p.getPointAtLength(p.getTotalLength()/2),h=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),d={strokeWidth:1};"initiating"===o.get("messageVisibleKind")?(d.fill=s,d.stroke=c):(d.fill=c,d.stroke=s);var f=k(e,h,d),m=H(e,i.get("messageRef").get("name"),{align:"center-top",fitBox:!0,style:{fill:c}}),g=f.getBBox(),v=m.getBBox();Kn(m,u.x-v.width/2,u.y+g.height/2+10,0)}return p},"bpmn:ParallelGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:Participant":function(e,t,n={}){var r=K(e,t,n=wo(n,["fill","stroke","width","height"])),i=Gi(t),o=Qi(t),s=Ti(t),a=s.get("name");if(i){x(e,o?[{x:30,y:0},{x:30,y:go(t,n)}]:[{x:0,y:30},{x:mo(t,n),y:30}],{stroke:uo(t,l,n.stroke),strokeWidth:1.5}),W(e,a,t,n)}else{var p=fo(t,n);o||(p.height=mo(t,n),p.width=go(t,n));var u=H(e,a,{box:p,align:"center-middle",style:{fill:ho(t,c,l,n.stroke)}});if(!o)Kn(u,0,-(-1*go(t,n)),270)}return s.get("participantMultiplicity")&&F("ParticipantMultiplicityMarker",e,t,n),r},"bpmn:ReceiveTask":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i,o=Ti(t),s=ee(e,t,n);return o.get("instantiate")?(b(e,28,28,4.4,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):i=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),k(e,i,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),s},"bpmn:ScriptTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:SendTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{fill:uo(t,l,n.stroke),stroke:po(t,a,n.fill),strokeWidth:1}),i},"bpmn:SequenceFlow":function(e,t,n={}){n=wo(n,["fill","stroke"]);var r=po(t,a,n.fill),i=uo(t,l,n.stroke),o=_(e,t.waypoints,{markerEnd:y("sequenceflow-end",r,i),stroke:i}),s=Ti(t),{source:c}=t;if(c){var p=Ti(c);s.get("conditionExpression")&&Si(p,"bpmn:Activity")&&Pe(o,{markerStart:y("conditional-flow-marker",r,i)}),p.get("default")&&(Si(p,"bpmn:Gateway")||Si(p,"bpmn:Activity"))&&p.get("default")===s&&Pe(o,{markerStart:y("conditional-default-flow-marker",r,i)})}return o},"bpmn:ServiceTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return b(e,10,10,{fill:po(t,a,n.fill),stroke:"none",transform:"translate(6, 6)"}),k(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),b(e,10,10,{fill:po(t,a,n.fill),stroke:"none",transform:"translate(11, 10)"}),k(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:StartEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]),Ti(t).get("isInterrupting")||(n={...n,strokeDasharray:"6"});var i=Z(e,t,n);return r&&$(t,e,n),i},"bpmn:SubProcess":function(e,t,n={}){return J(e,t,n=Gi(t)?wo(n,["fill","stroke","width","height"]):wo(n,["fill","stroke"]))},"bpmn:Task":function(e,t,n={}){return ee(e,t,n=wo(n,["fill","stroke"]))},"bpmn:TextAnnotation":function(e,t,n={}){n=wo(n,["fill","stroke","width","height"]);var{width:i,height:o}=fo(t,n),s=w(e,i,o,0,0,{fill:"none",stroke:"none"});return k(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:0,my:0}}),{stroke:uo(t,l,n.stroke)}),H(e,Ti(t).get("text")||"",{align:"left-top",box:fo(t,n),padding:7,style:{fill:ho(t,c,l,n.stroke)}}),s},"bpmn:Transaction":function(e,t,r={}){r=Gi(t)?wo(r,["fill","stroke","width","height"]):wo(r,["fill","stroke"]);var i=J(e,t,{strokeWidth:1.5,...r}),o=n.style(["no-fill","no-events"],{stroke:uo(t,l,r.stroke),strokeWidth:1.5});return Gi(t)||(r={}),w(e,mo(t,r),go(t,r),7,3,o),i},"bpmn:UserTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),k(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),k(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:.5}),i},label:function(e,t,n={}){return function(e,t,n={}){var r={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return H(e,oo(t),{box:r,fitBox:!0,style:L({},o.getExternalStyle(),{fill:ho(t,c,l,n.stroke)})})}(e,t,n)}};this._drawPath=k,this._renderer=O}function wo(e,t=[]){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}e(bo,at),bo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],bo.prototype.canRender=function(e){return Si(e,"bpmn:BaseElement")},bo.prototype.drawShape=function(e,t,n={}){var{type:r}=t;return this._renderer(r)(e,t,n)},bo.prototype.drawConnection=function(e,t,n={}){var{type:r}=t;return this._renderer(r)(e,t,n)},bo.prototype.getShapePath=function(e){return Si(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,lt([["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"]])):Si(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return lt([["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):Si(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return lt([["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 lt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var xo=0,_o={width:150,height:50};function ko(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 Eo(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=ko(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return Oo(e,o,i,r);o=So(o,r.width,t)}}function Oo(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}}var Po="";function So(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!==Po||i.pop();break}i.push(n),o+=n.length}var s=i[i.length-1];return s&&s===Po&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function Co(e){this._config=L({},{size:_o,padding:xo,style:{},align:"center-top"},e||{})}Co.prototype.createText=function(e,t){return this.layoutText(e,t).element},Co.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Co.prototype.layoutText=function(e,t){var n=L({},this._config.size,t.box),r=L({},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 p(e)?L({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),s=t.fitBox||!1,a=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),l=e.split(/\u00AD?\r?\n/),c=[],u=n.width-o.left-o.right,h=Ie("text");for(Pe(h,{x:0,y:0}),Pe(h,r),_e(function(){var e=document.getElementById("helper-svg");return e||(Pe(e=Ie("svg"),{id:"helper-svg"}),X(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),h);l.length;)c.push(Eo(l,u,h));"middle"===i.vertical&&(o.top=o.bottom=0);var d=w(c,(function(e,t,n){return e+(a||t.height)}),0)+o.top+o.bottom,f=w(c,(function(e,t,n){return t.width>e?t.width:e}),0),m=o.top;"middle"===i.vertical&&(m+=(n.height-d)/2),m-=(a||c[0].height)/4;var g=Ie("text");return Pe(g,r),v(c,(function(e){var t;switch(m+=a||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(s?f:u)-o.right-e.width;break;default:t=Math.max(((s?f:u)-e.width)/2+o.left,0)}var n=Ie("tspan");Pe(n,{x:t,y:m}),n.textContent=e.text,_e(g,n)})),Me(h),{dimensions:{width:f,height:d},element:g}};function To(e){var t=L({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=L({},t,{fontSize:n},e&&e.externalStyle||{}),i=new Co({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30},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}}To.$inject=["config.textRenderer"];var Mo=/\{([^{}]+)\}/g,Ao=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Do={__init__:["bpmnRenderer"],bpmnRenderer:["type",bo],textRenderer:["type",To],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={};if(t.position){for(var s=t.containerHeight/i.height*t.yScaleFactor,a=t.containerWidth/i.width*t.xScaleFactor,l=0;l<i.heightElements.length;l++)o["y"+l]=i.heightElements[l]*s;for(var c=0;c<i.widthElements.length;c++)o["x"+c]=i.widthElements[c]*a}var p,u,h=(p=i.d,u={mx:n,my:r,e:o},String(p).replace(Mo,(function(e,t){return function(e,t,n){var r=n;return t.replace(Ao,(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,u)})));return h}}]};var No={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function Ro(e,t,n){return L({id:e.id,type:e.$type,businessObject:e,di:t},n)}function jo(e,t,n){var r=e.waypoint;return!r||r.length<2?[_n(t),_n(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function Io(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:_i(n),referenced:_i(t),property:r}))}function Lo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}Lo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Lo.prototype.add=function(e,t,n){var r,i,o,s=this._translate;if(Si(t,"bpmndi:BPMNPlane")){var a=Si(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(Ro(e,t,a)),this._canvas.addRootElement(r)}else if(Si(t,"bpmndi:BPMNShape")){var l=!Gi(e,t),c=function(e){return Si(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var p=t.bounds;r=this._elementFactory.createShape(Ro(e,t,{collapsed:l,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),Si(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),Si(e,"bpmn:Lane")&&(o=0),Si(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,_n(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!Si(t,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:_i(t),semantic:_i(e)}));var u=this._getSource(e),h=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(Ro(e,t,{hidden:i,source:u,target:h,waypoints:jo(t,u,h)})),Si(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(r,n,o)}return eo(e)&&oo(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},Lo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:_i(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw Io(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Lo.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(Ki.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=ro(t),r=Ki),L({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=oo(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(Ro(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oo(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)},Lo.prototype._getConnectedElement=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?Io(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:_i(e),side:t}))},Lo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Lo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Lo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var zo={__depends__:[Do,{__depends__:[No],bpmnImporter:["type",Lo]}]};function Bo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function $o(e){return e.originalEvent||e.srcEvent}function qo(e){Bo(e),Bo($o(e))}function Fo(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 Vo(){return/mac/i.test(navigator.platform)}function Ho(e,t){return($o(e)||e).button===t}function Uo(e){return Ho(e,0)}function Wo(e){var t=$o(e)||e;return!!Uo(e)&&(Vo()?t.metaKey:t.ctrlKey)}function Go(e){var t=$o(e)||e;return Uo(e)&&t.shiftKey}function Qo(e){return!0}function Xo(e){return Uo(e)||function(e){return Ho(e,1)}(e)}function Zo(e,t,n){var r=this;function i(n,r,i){var o,s;(function(e,t){var n=l[e]||Uo;return!n(t)})(n,r)||(i?s=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(s=o,i=t.get(s)),s&&i&&!1===e.fire(n,{element:i,gfx:s,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function s(e){return o[e]}var a={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":Qo,"element.mousedown":Xo,"element.mouseup":Xo,"element.click":Xo,"element.dblclick":Xo};var c="svg, .djs-element";function p(e,t,n,r){var s=o[n]=function(e){i(n,e)};r&&(l[n]=r),s.$delegate=de.bind(e,c,t,s)}function u(e,t,n){var r=s(n);r&&de.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){!function(e){v(a,(function(t,n){u(e,n,t)}))}(e.svg)})),e.on("canvas.init",(function(e){!function(e){v(a,(function(t,n){p(e,n,t)}))}(e.svg)})),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 h=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),f={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:h,"no-move":m("djs-hit djs-hit-no-move")};function m(e,t){return t=L({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=f[t];if(!n)throw new Error("invalid hit type <"+t+">");return Pe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){v(be(".djs-hit",e),Me)},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=dt(t);return g(n,"stroke"),y(e,n),n},this.createBoxHit=function(e,t,n){n=L({x:0,y:0},n);var r=Ie("rect");return g(r,t),Pe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?ft(n,e.waypoints):Pe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=a[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=s,this.registerEvent=p,this.unregisterEvent=u}Zo.$inject=["eventBus","elementRegistry","styles"];var Yo={__init__:["interactionEvents"],interactionEvents:["type",Zo]};function Ko(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Ie("rect");return Pe(t,L({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||_e(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||_e(n,o=i()),r.updateConnectionOutline(o,t)}))}Ko.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Pe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ko.prototype.updateConnectionOutline=function(e,t){var n=wt(t);Pe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ko.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},Ko.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ko.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){h(n.getOutline)&&(t=t||n.getOutline(e))})),t},Ko.$inject=["eventBus","styles","elementRegistry"];var Jo={__init__:["outline"],outline:["type",Ko]};function es(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)}))}es.$inject=["eventBus","canvas"],es.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})}},es.prototype.get=function(){return this._selectedElements},es.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},es.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();c(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?v(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 ts="hover",ns="selected";function rs(e,t,n){this._canvas=e;var r=this;function i(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){i(e.element,ts)})),t.on("element.out",(function(e){o(e.element,ts)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;v(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,ns)}(e)})),v(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,ns)}(e)})),r._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateSelectionOutline(n.get())}))}function is(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;c(o)?t.select(o):t.select(i.filter(os))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);m(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Uo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,s=Go(e);if(i&&o)return s?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,s)}}))}function os(e){return!e.hidden}rs.$inject=["canvas","eventBus","selection"],rs.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ae(t);var n=e.length>1;if(Ce(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(wt(e)),i=Ie("rect");Pe(i,L({rx:3},r)),Ce(i).add("djs-selection-outline"),_e(t,i)}},is.$inject=["eventBus","selection","canvas","elementRegistry"];var ss={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Yo,Jo],selection:["type",es],selectionVisuals:["type",rs],selectionBehavior:["type",is]};function as(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}as.prototype.next=function(){return this._prefix+ ++this._counter};var ls=new as("ov");function cs(e,t,n,r){this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=ls,this._overlayDefaults=L({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=function(e){var t=ye('<div class="djs-overlay-container" />');return X(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}(n.getContainer()),this._init()}function ps(e,t,n){X(e,{left:t+"px",top:n+"px"})}function us(e,t){e.style.display=!1===t?"none":""}function hs(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}cs.$inject=["config.overlays","eventBus","canvas","elementRegistry"],cs.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?y(t.overlays,M({type:e.type})):t.overlays.slice():[]}return e.type?y(this._overlays,M({type:e.type})):e.id?this._overlays[e.id]:null},cs.prototype.add=function(e,t,n){if(p(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=L({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},cs.prototype.remove=function(e){var t=this.get(e)||[];c(t)||(t=[t]);var n=this;v(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(we(e.html),we(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)}}))},cs.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},cs.prototype.show=function(){us(this._overlayRoot)},cs.prototype.hide=function(){us(this._overlayRoot,!1)},cs.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ee(this._overlayRoot)},cs.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=wt(t);r=o.x,i=o.y}ps(n,r,i),Z(e.html,"data-container-id",t.id)},cs.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,s=r.left,a=r.top;void 0!==r.right&&(t=o.waypoints?wt(o).width:o.width,s=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?wt(o).height:o.height,a=-1*r.bottom+n);ps(i,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},cs.prototype._createOverlayContainer=function(e){var t=ye('<div class="djs-overlays" />');X(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},cs.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";hs(this._overlayRoot,n)},cs.prototype._getOverlayContainer=function(e,t){var n=m(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},cs.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)),d(o)&&(o=ye(o)),n=this._getOverlayContainer(i),X(t=ye('<div class="djs-overlay" data-overlay-id="'+r+'">'),{position:"absolute"}),t.appendChild(o),e.type&&K(t).add("djs-overlay-"+e.type),us(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())},cs.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,s=e.htmlContainer,l=!0;(r!==this._canvas.getRootElement()||n&&(a(i)&&i>t.scale||a(o)&&o<t.scale))&&(l=!1),us(s,l),this._updateOverlayScale(e,t)},cs.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,s=e.htmlContainer,l="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),a(n)&&t.scale<n&&(i=(1/t.scale||1)*n),a(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),a(i)&&(l="scale("+i+","+i+")"),hs(s,l)},cs.prototype._updateOverlaysVisibilty=function(e){var t=this;v(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},cs.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;v(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){we(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&&(v(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&&K(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 ds={__init__:["overlays"],overlays:["type",cs]};function fs(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(xt(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)}))}fs.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ms={__init__:["changeSupport"],changeSupport:["type",fs]};function gs(e){this._eventBus=e}function ys(e){return function(t,n,r,i,o){(h(t)||u(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}}function vs(e,t){t.invoke(gs,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)}))}gs.$inject=["eventBus"],gs.prototype.on=function(e,t,n,r,i,o){if((h(t)||u(t))&&(o=i,i=r,r=n,n=t,t=null),h(n)&&(o=i,i=r,r=n,n=1e3),p(i)&&(o=i,i=!1),!h(r))throw new Error("handlerFn must be a function");c(e)||(e=[e]);var s=this._eventBus;v(e,(function(e){var a=["commandStack",e,t].filter((function(e){return e})).join(".");s.on(a,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))},gs.prototype.canExecute=ys("canExecute"),gs.prototype.preExecute=ys("preExecute"),gs.prototype.preExecuted=ys("preExecuted"),gs.prototype.execute=ys("execute"),gs.prototype.executed=ys("executed"),gs.prototype.postExecute=ys("postExecute"),gs.prototype.postExecuted=ys("postExecuted"),gs.prototype.revert=ys("revert"),gs.prototype.reverted=ys("reverted"),e(vs,gs),vs.$inject=["canvas","injector"];var bs={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",vs]};function ws(e){return CSS.escape(e)}var xs={"&":"&","<":"<",">":">",'"':""","'":"'"};function _s(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return xs[e]}))}var ks="_plane";function Es(e){return function(e){return e.replace(new RegExp(ks+"$"),"")}(e.id)}function Os(e){var t=e.id;return Si(e,"bpmn:SubProcess")?Cs(t):t}function Ps(e){return Cs(e)}function Ss(e){return Si(Mi(e),"bpmndi:BPMNPlane")}function Cs(e){return e+ks}function Ts(e,t,n){var r=ye('<ul class="bjs-breadcrumbs"></ul>'),i=n.getContainer(),o=K(i);i.appendChild(r);var s=[];function a(e){e&&(s=function(e){for(var t=Ti(e),n=[],r=t;r;r=r.$parent)(Si(r,"bpmn:SubProcess")||Si(r,"bpmn:Process"))&&n.push(r);return n.reverse()}(e));var i=s.map((function(e){var r=_s(e.name||e.id),i=ye('<li><span class="bjs-crumb"><a title="'+r+'">'+r+"</a></span></li>"),o=n.findRoot(Os(e))||n.findRoot(e.id);if(!o&&Si(e,"bpmn:Process")){var s=t.find((function(t){var n=Ti(t);return n&&n.get("processRef")&&n.get("processRef")===e}));o=n.findRoot(s.id)}return i.addEventListener("click",(function(){n.setRootElement(o)})),i}));r.innerHTML="";var a=i.length>1;o.toggle("bjs-breadcrumbs-shown",a),i.forEach((function(e){r.appendChild(e)}))}e.on("element.changed",(function(e){var t=Ti(e.element);m(s,(function(e){return e===t}))&&a()})),e.on("root.set",(function(e){a(e.element)}))}function Ms(e,t){var n=null,r=new As;e.on("root.set",(function(e){var i=e.element,o=t.viewbox(),s=r.get(i);if(r.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=i,!Si(i,"bpmn:Collaboration")||s){s=s||{x:0,y:0,zoom:1};var a=(o.x-s.x)*o.scale,l=(o.y-s.y)*o.scale;0===a&&0===l||t.scroll({dx:a,dy:l}),s.zoom!==o.scale&&t.zoom(s.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){r.clear(),n=null}))}function As(){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)}}Ts.$inject=["eventBus","elementRegistry","canvas"],Ms.$inject=["eventBus","canvas"];var Ds=180,Ns=160;function Rs(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 js(e){return Si(e,"bpmndi:BPMNDiagram")?e:js(e.$parent)}Rs.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)}))}},Rs.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;Si(i,"bpmn:SubProcess")&&!t.isExpanded&&n.push(i),function(e,t){var n=e.$parent;if(!Si(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Ci(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(i,e)&&r.push({diElement:t,parent:o})}}));var i=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t._createDiagram(e);t._processToDiagramMap[e.id]=n,i.push(n)}})),r.forEach((function(e){for(var r=e.diElement,i=e.parent;i&&-1===n.indexOf(i);)i=i.$parent;if(i){var o=t._processToDiagramMap[i.id];t._moveToDiPlane(r,o.plane)}})),i},Rs.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=bn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),wn(t)}(e),r=n.x-Ds,i=n.y-Ns;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)}))},Rs.prototype._moveToDiPlane=function(e,t){var n=js(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Rs.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},Rs.$inject=["eventBus","moddle"];var Is=250;function Ls(e,t,n,r){gs.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=r;var i=this;this.executed("shape.toggleCollapse",Is,(function(e){var t=e.shape;i._canDrillDown(t)?i._addOverlay(t):i._removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Is,(function(e){var t=e.shape;i._canDrillDown(t)?i._addOverlay(t):i._removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Is,(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"],Is,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i._canDrillDown(r)&&i._addOverlay(r),i._updateDrilldownOverlay(t),i._updateDrilldownOverlay(n),i._updateDrilldownOverlay(r)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return i._canDrillDown(e)})).map((function(e){i._addOverlay(e)}))}))}e(Ls,gs),Ls.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ls.prototype._canDrillDown=function(e){var t=this._canvas;return Si(e,"bpmn:SubProcess")&&t.findRoot(Os(e))},Ls.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ti(e),r=t.get({element:n.id,type:"drilldown"})[0];if(r){var i=n&&n.get("flowElements")&&n.get("flowElements").length;K(r.html).toggle("bjs-drilldown-empty",!i)}},Ls.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this._removeOverlay(e);var r=ye('<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(Os(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},Ls.prototype._removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},Ls.$inject=["canvas","eventBus","elementRegistry","overlays"];var zs={__depends__:[ds,ms,bs],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Ts],drilldownCentering:["type",Ms],drilldownOverlayBehavior:["type",Ls],subprocessCompatibility:["type",Rs]};function Bs(e){Fi.call(this,e)}e(Bs,Fi),Bs.prototype._modules=[zo,No,ss,ds,zs],Bs.prototype._moddleExtensions={};var $s=["c","C"],qs=["v","V"],Fs=["y","Y"],Vs=["z","Z"];function Hs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Us(e,t){return-1!==(e=c(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Ws(e){return e.shiftKey}function Gs(e){return Hs(e)&&!Ws(e)&&Us(Vs,e)}function Qs(e){return Hs(e)&&(Us(Fs,e)||Us(Vs,e)&&Ws(e))}var Xs="keyboard.keydown",Zs="input-handle-modified-keys";function Ys(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()}))}Ys.$inject=["config.keyboard","eventBus"],Ys.prototype._keydownHandler=function(e){this._keyHandler(e,Xs)},Ys.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Ys.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Xs,n)&&e.preventDefault()}},Ys.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||(t=e.target)&&(te(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},Ys.prototype._isModifiedKeyIgnored=function(e){return!Hs(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Ys.prototype._getAllowedModifiers=function(e){var t=ne(e,"["+Zs+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Zs).split(",")},Ys.prototype.bind=function(e){this.unbind(),this._node=e,pe.bind(e,"keydown",this._keydownHandler),pe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ys.prototype.getBinding=function(){return this._node},Ys.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),pe.unbind(e,"keydown",this._keydownHandler),pe.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ys.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ys.prototype.addListener=function(e,t,n){h(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Xs,e,t)},Ys.prototype.removeListener=function(e,t){this._eventBus.off(t||Xs,e)},Ys.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Ys.prototype.isCmd=Hs,Ys.prototype.isShift=Ws,Ys.prototype.isKey=Us;var Ks=500;function Js(e,t){var n=this;e.on("editorActions.init",Ks,(function(e){var r=e.editorActions;n.registerBindings(t,r)}))}Js.$inject=["eventBus","keyboard"],Js.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n("undo",(function(e){if(Gs(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(Qs(e.keyEvent))return t.trigger("redo"),!0})),n("copy",(function(e){if(function(e){return Hs(e)&&Us($s,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return Hs(e)&&Us(qs,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Us(["+","Add","="],n)&&Hs(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Us(["-","Subtract"],n)&&Hs(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Us("0",n)&&Hs(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Us(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var ea={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ys],keyboardBindings:["type",Js]},ta={moveSpeed:50,moveSpeedAccelerated:200};function na(e,t,n){var r=this;this._config=L({},ta,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,s=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:s,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})}}na.$inject=["config.keyboardMove","keyboard","canvas"];var ra={__depends__:[ea],__init__:["keyboardMove"],keyboardMove:["type",na]},ia=/^djs-cursor-.*$/;function oa(e){var t=K(document.body);t.removeMatching(ia),e&&t.add("djs-cursor-"+e)}function sa(){oa(null)}var aa=5e3;function la(e,t){function n(){return!1}return t=t||"element.click",e.once(t,aa,n),function(){e.off(t,n)}}function ca(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pa(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ua(e,t){var n;function r(r){var i,o=n.start,s=n.button,a=Fo(r),l=pa(a,o);(!n.dragging&&(i=l,Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))>15)&&(n.dragging=!0,0===s&&la(e),oa("grab")),n.dragging)&&(l=pa(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);r.preventDefault()}function i(e){pe.unbind(document,"mousemove",r),pe.unbind(document,"mouseup",i),n=null,sa()}e.on("element.mousedown",500,(function(e){return function(e){if(ne(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Fo(e)},pe.bind(document,"mousemove",r),pe.bind(document,"mouseup",i),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}ua.$inject=["eventBus","canvas"];var ha={__init__:["moveCanvas"],moveCanvas:["type",ua]};function da(e){return Math.log(e)/Math.log(10)}function fa(e,t){var n=da(e.min),r=da(e.max);return(Math.abs(n)+Math.abs(r))/t}var ma=Math.sign||function(e){return e>=0?1:-1},ga={min:.2,max:4};function ya(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=I(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)}))}ya.$inject=["config.zoomScroll","eventBus","canvas"],ya.prototype.scroll=function(e){this._canvas.scroll(e)},ya.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ya.prototype.zoom=function(e,t){var n=fa(ga,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},ya.prototype._handleWheel=function(e){if(!ne(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,r=e.ctrlKey||Vo()&&e.metaKey,i=e.shiftKey,o=-1*this._scale;if(o*=r?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,r){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*ma(e.deltaY)*o,this.zoom(n,a)}else n=i?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},ya.prototype.stepZoom=function(e,t){var n=fa(ga,10);this._zoom(e,t,n)},ya.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=da(r.zoom()),s=Math.round(o/n)*n;s+=n*i;var a,l,c=Math.pow(10,s);r.zoom((a=ga,l=c,Math.max(a.min,Math.min(a.max,l))),t)},ya.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return void 0===e&&(e=!r),r!==e&&pe[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},ya.prototype._init=function(e){this.toggle(e)};var va={__init__:["zoomScroll"],zoomScroll:["type",ya]};function ba(e){Bs.call(this,e)}function wa(e){return e&&e[e.length-1]}function xa(e){return e.y}function _a(e){return e.x}e(ba,Bs),ba.prototype._navigationModules=[ra,ha,va],ba.prototype._modules=[].concat(Bs.prototype._modules,ba.prototype._navigationModules);var ka={left:_a,center:_a,right:function(e){return e.x+e.width},top:xa,middle:xa,bottom:function(e){return e.y+e.height}};function Ea(e,t){this._modeling=e,this._rules=t}Ea.$inject=["modeling","rules"],Ea.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Ea.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Ea.prototype._alignmentPosition=function(e,t){var n,r,i,o=this._getOrientationDetails(e),s=o.axis,a=o.dimension,l={},c={},p=!1;if(this._isType(e,["left","top"]))l[e]=t[0][s];else if(this._isType(e,["right","bottom"]))i=wa(t),l[e]=i[s]+i[a];else if(this._isType(e,["center","middle"])){if(v(t,(function(e){var t=e[s]+Math.round(e[a]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=T(c,(function(e){return e.elements.length>1&&(p=!0),e.elements.length})),p)return l[e]=wa(n).center,l;r=t[0],i=wa(t=T(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(r,i)}return l},Ea.prototype.trigger=function(e,t){var n,r=this._modeling,i=y(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(c(n=this._rules.allowed("elements.align",{elements:i}))&&(i=n),!(i.length<2)&&n){var o=T(i,ka[t]),s=this._alignmentPosition(t,o);r.alignElements(o,s)}};var Oa={__init__:["alignElements"],alignElements:["type",Ea]},Pa=".entry";function Sa(e,t,n,r){this._canvas=e,this._eventBus=n,this._overlays=r;var i=a(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:i},this._current=null,this._init()}function Ca(e,t){return-1!==e.indexOf(t)}Sa.$inject=["canvas","config.contextPad","eventBus","overlays"],Sa.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,r=n.length?1===n.length?n[0]:n:null;r?e.open(r,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,r=e._current;if(r){var i=r.target;_(c(i)?i:[i],(function(e){return Ca(n,e)}))&&e.open(i,!0)}}))},Sa.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Sa.prototype.getEntries=function(e){var t=this._getProviders(),n=c(e)?"getMultiElementContextPadEntries":"getContextPadEntries",r={};return v(t,(function(t){if(h(t[n])){var i=t[n](e);h(i)?r=i(r):v(i,(function(e,t){r[t]=e}))}})),r},Sa.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Z(o,"data-action"),i=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(r,"hover",i,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(r,e,i,n)):t.preventDefault()},Sa.prototype.triggerEntry=function(e,t,n,r){if(this.isShown()){var i=this._current.target,o=this._current.entries[e];if(o){var s=o.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:o,event:n})){if(h(s)){if("click"===t)return s(n,i,r)}else if(s[t])return s[t](n,i,r);n.preventDefault()}}}},Sa.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Sa.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Sa.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),r=this.getPad(e),i=r.html;v(n,(function(e,n){var r,o=e.group||"default",s=ye(e.html||'<div class="entry" draggable="true"></div>');Z(s,"data-action",n),(r=ve("[data-group="+ws(o)+"]",i))||(Z(r=ye('<div class="group"></div>'),"data-group",o),i.appendChild(r)),r.appendChild(s),e.className&&function(e,t){var n=K(e);t=c(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}(s,e.className),e.title&&Z(s,"title",e.title),e.imageUrl&&(Z(t=ye("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),K(i).add("open"),this._current={target:e,entries:n,pad:r},this._eventBus.fire("contextPad.open",{current:this._current})},Sa.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,r=ye('<div class="djs-context-pad"></div>'),i=this._getPosition(e),o=L({html:r},this._overlaysConfig,i);de.bind(r,Pa,"click",(function(e){t.trigger("click",e)})),de.bind(r,Pa,"dragstart",(function(e){t.trigger("dragstart",e)})),de.bind(r,Pa,"mouseover",(function(e){t.trigger("mouseover",e)})),de.bind(r,Pa,"mouseout",(function(e){t.trigger("mouseout",e)})),pe.bind(r,"mousedown",(function(e){e.stopPropagation()}));var s=this._canvas.getRootElement();this._overlayId=n.add(s,"context-pad",o);var a=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:a}),a},Sa.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Sa.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return c(e)===c(n)&&(c(e)?e.length===n.length&&x(e,(function(e){return Ca(n,e)})):n===e)},Sa.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},Sa.prototype._getPosition=function(e){var t,n=wt(c(e=mn(e)?(t=e).waypoints[t.waypoints.length-1]:e)?e:[e]);return{position:{left:n.x+n.width+12,top:n.y-6}}};var Ta,Ma,Aa,Da,Na,Ra,ja={__depends__:[Yo,ds],contextPad:["type",Sa]},Ia={},La=[],za=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Ba(e,t){for(var n in t)e[n]=t[n];return e}function $a(e){var t=e.parentNode;t&&t.removeChild(e)}function qa(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ta.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Fa(e,s,r,i,null)}function Fa(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?++Aa:i};return null==i&&null!=Ma.vnode&&Ma.vnode(o),o}function Va(e){return e.children}function Ha(e,t){this.props=e,this.context=t}function Ua(e,t){if(null==t)return e.__?Ua(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?Ua(e):null}function Wa(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 Wa(e)}}function Ga(e){(!e.__d&&(e.__d=!0)&&Da.push(e)&&!Qa.__r++||Na!==Ma.debounceRendering)&&((Na=Ma.debounceRendering)||setTimeout)(Qa)}function Qa(){for(var e;Qa.__r=Da.length;)e=Da.sort((function(e,t){return e.__v.__b-t.__v.__b})),Da=[],e.some((function(e){var t,n,r,i,o,s;e.__d&&(o=(i=(t=e).__v).__e,(s=t.__P)&&(n=[],(r=Ba({},i)).__v=i.__v+1,rl(s,i,r,t.__n,void 0!==s.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?Ua(i):o,i.__h),il(n,i),i.__e!=o&&Wa(i)))}))}function Xa(e,t,n,r,i,o,s,a,l,c){var p,u,h,d,f,m,g,y=r&&r.__k||La,v=y.length;for(n.__k=[],p=0;p<t.length;p++)if(null!=(d=n.__k[p]=null==(d=t[p])||"boolean"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?Fa(null,d,null,null,d):Array.isArray(d)?Fa(Va,{children:d},null,null,null):d.__b>0?Fa(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(h=y[p])||h&&d.key==h.key&&d.type===h.type)y[p]=void 0;else for(u=0;u<v;u++){if((h=y[u])&&d.key==h.key&&d.type===h.type){y[u]=void 0;break}h=null}rl(e,d,h=h||Ia,i,o,s,a,l,c),f=d.__e,(u=d.ref)&&h.ref!=u&&(g||(g=[]),h.ref&&g.push(h.ref,null,d),g.push(u,d.__c||f,d)),null!=f?(null==m&&(m=f),"function"==typeof d.type&&d.__k===h.__k?d.__d=l=Za(d,l,e):l=Ka(e,d,h,y,f,l),"function"==typeof n.type&&(n.__d=l)):l&&h.__e==l&&l.parentNode!=e&&(l=Ua(h))}for(n.__e=m,p=v;p--;)null!=y[p]&&sl(y[p],y[p]);if(g)for(p=0;p<g.length;p++)ol(g[p],g[++p],g[++p])}function Za(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t="function"==typeof r.type?Za(r,t,n):Ka(n,r,r,i,r.__e,t));return t}function Ya(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){Ya(e,t)})):t.push(e)),t}function Ka(e,t,n,r,i,o){var s,a,l;if(void 0!==t.__d)s=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),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<r.length;l+=1)if(a==i)break e;e.insertBefore(i,o),s=o}return void 0!==s?s:i.nextSibling}function Ja(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||za.test(t)?n:n+"px"}function el(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||Ja(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Ja(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?nl:tl,o):e.removeEventListener(t,o?nl:tl,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&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,n))}}function tl(e){this.l[e.type+!1](Ma.event?Ma.event(e):e)}function nl(e){this.l[e.type+!0](Ma.event?Ma.event(e):e)}function rl(e,t,n,r,i,o,s,a,l){var c,p,u,h,d,f,m,g,y,v,b,w,x,_,k,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,o=[a]),(c=Ma.__b)&&c(t);try{e:if("function"==typeof E){if(g=t.props,y=(c=E.contextType)&&r[c.__c],v=c?y?y.props.value:c.__:r,n.__c?m=(p=t.__c=n.__c).__=p.__E:("prototype"in E&&E.prototype.render?t.__c=p=new E(g,v):(t.__c=p=new Ha(g,v),p.constructor=E,p.render=al),y&&y.sub(p),p.props=g,p.state||(p.state={}),p.context=v,p.__n=r,u=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Ba({},p.__s)),Ba(p.__s,E.getDerivedStateFromProps(g,p.__s))),h=p.props,d=p.state,u)null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==E.getDerivedStateFromProps&&g!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,v),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,v)||t.__v===n.__v){for(p.props=g,p.state=p.__s,t.__v!==n.__v&&(p.__d=!1),p.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<p._sb.length;b++)p.__h.push(p._sb[b]);p._sb=[],p.__h.length&&s.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,v),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(h,d,f)}))}if(p.context=v,p.props=g,p.__v=t,p.__P=e,w=Ma.__r,x=0,"prototype"in E&&E.prototype.render){for(p.state=p.__s,p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),_=0;_<p._sb.length;_++)p.__h.push(p._sb[_]);p._sb=[]}else do{p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++x<25);p.state=p.__s,null!=p.getChildContext&&(r=Ba(Ba({},r),p.getChildContext())),u||null==p.getSnapshotBeforeUpdate||(f=p.getSnapshotBeforeUpdate(h,d)),k=null!=c&&c.type===Va&&null==c.key?c.props.children:c,Xa(e,Array.isArray(k)?k:[k],t,n,r,i,o,s,a,l),p.base=t.__e,t.__h=null,p.__h.length&&s.push(p),m&&(p.__E=p.__=null),p.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a){var l,c,p,u=n.props,h=t.props,d=t.type,f=0;if("svg"===d&&(i=!0),null!=o)for(;f<o.length;f++)if((l=o[f])&&"setAttribute"in l==!!d&&(d?l.localName===d:3===l.nodeType)){e=l,o[f]=null;break}if(null==e){if(null===d)return document.createTextNode(h);e=i?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,h.is&&h),o=null,a=!1}if(null===d)u===h||a&&e.data===h||(e.data=h);else{if(o=o&&Ta.call(e.childNodes),c=(u=n.props||Ia).dangerouslySetInnerHTML,p=h.dangerouslySetInnerHTML,!a){if(null!=o)for(u={},f=0;f<e.attributes.length;f++)u[e.attributes[f].name]=e.attributes[f].value;(p||c)&&(p&&(c&&p.__html==c.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||el(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]||el(e,o,t[o],n[o],r)}(e,h,u,i,a),p)t.__k=[];else if(f=t.props.children,Xa(e,Array.isArray(f)?f:[f],t,n,r,i&&"foreignObject"!==d,o,s,o?o[0]:n.__k&&Ua(n,0),a),null!=o)for(f=o.length;f--;)null!=o[f]&&$a(o[f]);a||("value"in h&&void 0!==(f=h.value)&&(f!==e.value||"progress"===d&&!f||"option"===d&&f!==u.value)&&el(e,"value",f,u.value,!1),"checked"in h&&void 0!==(f=h.checked)&&f!==e.checked&&el(e,"checked",f,u.checked,!1))}return e}(n.__e,t,n,r,i,o,s,l);(c=Ma.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=o)&&(t.__e=a,t.__h=!!l,o[o.indexOf(a)]=null),Ma.__e(e,t,n)}}function il(e,t){Ma.__c&&Ma.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ma.__e(e,t.__v)}}))}function ol(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Ma.__e(e,n)}}function sl(e,t,n){var r,i;if(Ma.unmount&&Ma.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ol(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ma.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&sl(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||$a(e.__e),e.__=e.__e=e.__d=void 0}function al(e,t,n){return this.constructor(e,n)}function ll(e,t,n){var r,i,o;Ma.__&&Ma.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],rl(t,e=(!r&&n||t).__k=qa(Va,null,[e]),i||Ia,Ia,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Ta.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),il(o,e)}function cl(e,t){var n={__c:t="__cC"+Ra++,__: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(Ga)},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}Ta=La.slice,Ma={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},Aa=0,Ha.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Ba({},this.state),"function"==typeof e&&(e=e(Ba({},n),this.props)),e&&Ba(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ga(this))},Ha.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ga(this))},Ha.prototype.render=Va,Da=[],Qa.__r=0,Ra=0;var pl=function(e,t,n,r){var i;t[0]=0;for(var o=1;o<t.length;o++){var s=t[o++],a=t[o]?(t[0]|=s?1:2,n[t[o++]]):t[++o];3===s?r[0]=a:4===s?r[1]=Object.assign(r[1]||{},a):5===s?(r[1]=r[1]||{})[t[++o]]=a:6===s?r[1][t[++o]]+=a+"":s?(i=e.apply(a,pl(e,a,n,["",null])),r.push(i),a[0]?t[0]|=2:(t[o-2]=0,t[o]=i)):r.push(a)}return r},ul=new Map;var hl,dl,fl,ml,gl=function(e){var t=ul.get(this);return t||(t=new Map,ul.set(this,t)),(t=pl(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i="",o="",s=[0],a=function(e){1===r&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,i):3===r&&(e||i)?(s.push(3,e,i),r=2):2===r&&"..."===i&&e?s.push(4,e,0):2===r&&i&&!e?s.push(5,0,!0,i):r>=5&&((i||!e&&5===r)&&(s.push(r,0,i,n),r=6),e&&(s.push(r,e,0,n),r=6)),i=""},l=0;l<e.length;l++){l&&(1===r&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===r?"<"===t?(a(),s=[s],r=3):i+=t:4===r?"--"===i&&">"===t?(r=1,i=""):i=t+i[0]:o?t===o?o="":i+=t:'"'===t||"'"===t?o=t:">"===t?(a(),r=1):r&&("="===t?(r=5,n=i,i=""):"/"===t&&(r<5||">"===e[l][c+1])?(a(),3===r&&(s=s[0]),r=s,(s=s[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),r=2):i+=t),3===r&&"!--"===i&&(r=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(qa),yl=0,vl=[],bl=[],wl=Ma.__b,xl=Ma.__r,_l=Ma.diffed,kl=Ma.__c,El=Ma.unmount;function Ol(e,t){Ma.__h&&Ma.__h(dl,e,yl||t),yl=0;var n=dl.__H||(dl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:bl}),n.__[e]}function Pl(e){return yl=1,function(e,t,n){var r=Ol(hl++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Bl(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=dl,!dl.u)){dl.u=!0;var i=dl.shouldComponentUpdate;dl.shouldComponentUpdate=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))}}return r.__N||r.__}(Bl,e)}function Sl(e,t){var n=Ol(hl++,3);!Ma.__s&&zl(n.__H,t)&&(n.__=e,n.i=t,dl.__H.__h.push(n))}function Cl(e,t){var n=Ol(hl++,4);!Ma.__s&&zl(n.__H,t)&&(n.__=e,n.i=t,dl.__h.push(n))}function Tl(e){return yl=5,Ml((function(){return{current:e}}),[])}function Ml(e,t){var n=Ol(hl++,7);return zl(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Al(e,t){return yl=8,Ml((function(){return e}),t)}function Dl(e){var t=dl.context[e.__c],n=Ol(hl++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(dl)),t.props.value):e.__}function Nl(){for(var e;e=vl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Il),e.__H.__h.forEach(Ll),e.__H.__h=[]}catch(t){e.__H.__h=[],Ma.__e(t,e.__v)}}Ma.__b=function(e){dl=null,wl&&wl(e)},Ma.__r=function(e){xl&&xl(e),hl=0;var t=(dl=e.__c).__H;t&&(fl===dl?(t.__h=[],dl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=bl,e.__N=e.i=void 0}))):(t.__h.forEach(Il),t.__h.forEach(Ll),t.__h=[])),fl=dl},Ma.diffed=function(e){_l&&_l(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vl.push(t)&&ml===Ma.requestAnimationFrame||((ml=Ma.requestAnimationFrame)||jl)(Nl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==bl&&(e.__=e.__V),e.i=void 0,e.__V=bl}))),fl=dl=null},Ma.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Il),e.__h=e.__h.filter((function(e){return!e.__||Ll(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Ma.__e(n,e.__v)}})),kl&&kl(e,t)},Ma.unmount=function(e){El&&El(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Il(e)}catch(e){t=e}})),n.__H=void 0,t&&Ma.__e(t,n.__v))};var Rl="function"==typeof requestAnimationFrame;function jl(e){var t,n=function(){clearTimeout(r),Rl&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Rl&&(t=requestAnimationFrame(n))}function Il(e){var t=dl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),dl=t}function Ll(e){var t=dl;e.__c=e.__(),dl=t}function zl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Bl(e,t){return"function"==typeof t?t(e):t}function $l(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=$l(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ql(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$l(e))&&(r&&(r+=" "),r+=t);return r}function Fl(e){const{entry:t,selected:n,onMouseEnter:r,onMouseLeave:i,onAction:o}=e;return gl`
|
|
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";function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var t=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),s="";for(i=0;i<Math.floor(r);i++){s=Math.floor(Math.random()*n).toString(n)+s}if(o){var a=Math.pow(n,o);s=Math.floor(Math.random()*a).toString(n)+s}var l=parseInt(s,n);return l!==1/0&&l>=Math.pow(2,e)?t(e,n):s};t.rack=function(e,n,r){var i=function(i){var s=0;do{if(s++>10){if(!r)throw new Error("too many ID collisions, use more bits");e+=r}var a=t(e,n)}while(Object.hasOwnProperty.call(o,a));return o[a]=i,a},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 n(e){if(!(this instanceof n))return new n(e);e=e||[128,36,1],this._seed=e.length?t.rack(e[0],e[1],e[2]):e}function r(e){return Array.prototype.concat.apply([],e)}n.prototype.next=function(e){return this._seed(e||!0)},n.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},n.prototype.claim=function(e,t){this._seed.set(e,t||!0)},n.prototype.assigned=function(e){return this._seed.get(e)||!1},n.prototype.unclaim=function(e){delete this._seed.hats[e]},n.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};const i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;function s(e){return void 0===e}function a(e){return void 0!==e}function l(e){return null==e}function c(e){return"[object Array]"===i.call(e)}function p(e){return"[object Object]"===i.call(e)}function u(e){return"[object Number]"===i.call(e)}function h(e){const t=i.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function d(e){return"[object String]"===i.call(e)}function f(e,t){return o.call(e,t)}function m(e,t){const n=D(t);let r;return v(e,(function(e,t){if(n(e,t))return r=e,!1})),r}function g(e,t){const n=D(t);let r=c(e)?-1:void 0;return v(e,(function(e,t){if(n(e,t))return r=t,!1})),r}function y(e,t){const n=D(t);let r=[];return v(e,(function(e,t){n(e,t)&&r.push(e)})),r}function v(e,t){let n,r;if(s(e))return;const i=c(e)?R:N;for(let o in e)if(f(e,o)&&(n=e[o],r=t(n,i(o)),!1===r))return n}function b(e,t){if(s(e))return[];!function(e){if(!c(e))throw new Error("must supply array")}(e);const n=D(t);return e.filter((function(e,t){return!n(e,t)}))}function w(e,t,n){return v(e,(function(e,r){n=t(n,e,r)})),n}function x(e,t){return!!w(e,(function(e,n,r){return e&&t(n,r)}),!0)}function _(e,t){return!!m(e,t)}function k(e,t){let n=[];return v(e,(function(e,r){n.push(t(e,r))})),n}function E(e){return e&&Object.keys(e)||[]}function O(e){return k(e,(e=>e))}function P(e,t,n={}){return t=A(t),v(e,(function(e){let r=t(e)||"_",i=n[r];i||(i=n[r]=[]),i.push(e)})),n}function S(e,...t){e=A(e);let n={};return v(t,(t=>P(t,e,n))),k(n,(function(e,t){return e[0]}))}const C=S;function T(e,t){t=A(t);let n=[];return v(e,(function(e,r){let i=t(e,r),o={d:i,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(i<e)return void n.splice(s,0,o)}n.push(o)})),k(n,(e=>e.v))}function M(e){return function(t){return x(e,(function(e,n){return t[n]===e}))}}function A(e){return h(e)?e:t=>t[e]}function D(e){return h(e)?e:t=>t===e}function N(e){return e}function R(e){return Number(e)}function j(e,t){let n,r,i,o;function s(n){let s=Date.now(),c=n?0:o+t-s;if(c>0)return a(c);e.apply(i,r),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=o=r=i=void 0}function c(...e){o=Date.now(),r=e,i=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function I(e,t){return e.bind(t)}function L(e,...t){return Object.assign(e,...t)}function z(e,t,n){let r=e;return v(t,(function(e,i){if("number"!=typeof e&&"string"!=typeof e)throw new Error("illegal key type: "+typeof 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__");let o=t[i+1],c=r[e];a(o)&&l(c)&&(c=r[e]=isNaN(+o)?{}:[]),s(o)?s(n)?delete r[e]:r[e]=n:r=c})),e}function B(e,t,n){let r=e;return v(t,(function(e){if(l(r))return r=void 0,!1;r=r[e]})),s(r)?n:r}function $(e,t){let n={},r=Object(e);return v(t,(function(t){t in r&&(n[t]=e[t])})),n}function q(e,t){let n={};return v(Object(e),(function(e,r){-1===t.indexOf(r)&&(n[r]=e)})),n}function F(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const V=Object.prototype.toString,H=Object.prototype.hasOwnProperty;function U(e,t){return H.call(e,t)}function W(e,t){let n,r;if(void 0===e)return;const i=function(e){return"[object Array]"===V.call(e)}(e)?Q:G;for(let o in e)if(U(e,o)&&(n=e[o],r=t(n,i(o)),!1===r))return n}function G(e){return e}function Q(e){return Number(e)}function X(e,...t){const n=e.style;return W(t,(function(e){e&&W(e,(function(e,t){n[t]=e}))})),e}function Z(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Y=Object.prototype.toString;function K(e){return new J(e)}function J(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function ee(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function te(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function ne(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(te(r,t))return r;r=r.parentNode}return te(r,t)?r:null}J.prototype.add=function(e){return this.list.add(e),this},J.prototype.remove=function(e){return"[object RegExp]"==Y.call(e)?this.removeMatching(e):(this.list.remove(e),this)},J.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},J.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},J.prototype.array=function(){return Array.from(this.list)},J.prototype.has=J.prototype.contains=function(e){return this.list.contains(e)};var re,ie,oe,se={};function ae(){re=window.addEventListener?"addEventListener":"attachEvent",ie=window.removeEventListener?"removeEventListener":"detachEvent",oe="addEventListener"!==re?"on":""}var le=se.bind=function(e,t,n,r){return re||ae(),e[re](oe+t,n,r||!1),n},ce=se.unbind=function(e,t,n,r){return ie||ae(),e[ie](oe+t,n,r||!1),n},pe=F({__proto__:null,bind:le,unbind:ce,default:se},[se]),ue=["focus","blur"];var he,de={bind:function(e,t,n,r,i){return-1!==ue.indexOf(n)&&(i=!0),pe.bind(e,n,(function(n){var i=n.target||n.srcElement;n.delegateTarget=ne(i,t,!0),n.delegateTarget&&r.call(e,n)}),i)},unbind:function(e,t,n,r){return-1!==ue.indexOf(t)&&(r=!0),pe.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(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var i=Object.prototype.hasOwnProperty.call(ge,r)?ge[r]:ge._default,o=i[0],s=i[1],a=i[2],l=t.createElement("div");l.innerHTML=s+e+a;for(;o--;)l=l.lastChild;if(l.firstChild==l.lastChild)return l.removeChild(l.firstChild);var c=t.createDocumentFragment();for(;l.firstChild;)c.appendChild(l.removeChild(l.firstChild));return c},me=!1;"undefined"!=typeof document&&((he=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',me=!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:me?[1,"X<div>","</div>"]:[0,"",""]};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 ye=fe;function ve(e,t){return(t=t||document).querySelector(e)}function be(e,t){return(t=t||document).querySelectorAll(e)}function we(e){e.parentNode&&e.parentNode.removeChild(e)}function xe(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 xe(t,e),e}var ke=2,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":ke,"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":ke,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Oe(e,t,n){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=Ee[r];i?(i===ke&&"number"==typeof n&&(n=String(n)+"px"),e.style[r]=n):e.setAttributeNS(null,t,n)}function Pe(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);Oe(e,t,n)}else!function(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)Oe(e,r,t[r])}(e,t);return e}const Se=Object.prototype.toString;function Ce(e){return new Te(e)}function Te(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Me(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ae(e){for(var t;t=e.firstChild;)Me(t);return e}function De(e){return e.cloneNode(!0)}Te.prototype.add=function(e){return this.list.add(e),this},Te.prototype.remove=function(e){return"[object RegExp]"==Se.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Te.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Te.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Te.prototype.array=function(){return Array.from(this.list)},Te.prototype.has=Te.prototype.contains=function(e){return this.list.contains(e)};var Ne={svg:"http://www.w3.org/2000/svg"},Re='<svg xmlns="'+Ne.svg+'"';function je(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Ne.svg)&&(e=Re+e.substring(4)):(e=Re+">"+e+"</svg>",t=!0);var n=function(e){var t;return t=new DOMParser,t.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=je(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ne.svg,e),t&&Pe(n,t),n}var Le=null;function ze(){return null===Le&&(Le=Ie("svg")),Le}function Be(e,t){var n,r,i=Object.keys(t);for(n=0;r=i[n];n++)e[r]=t[r];return e}function $e(e){return e?ze().createSVGTransformFromMatrix(e):ze().createSVGTransform()}var qe=/([&<>]{1})/g,Fe=/([\n\r"]{1})/g,Ve={"&":"&","<":"<",">":">",'"':"'"};function He(e,t){return e.replace(t,(function(e,t){return Ve[t]||t}))}function Ue(e,t){var n,r,i,o,s;switch(e.nodeType){case 3:t.push(He(e.textContent,qe));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,'="',He(o.value,Fe),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,r=(s=e.childNodes).length;n<r;++n)Ue(s.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",He(e.nodeValue,qe),"--\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=je(t);if(Ae(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++)xe(i[o],e)}}function Ge(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;)Ue(t,n),t=t.nextSibling;return n.join("")}(e)}function Qe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Xe(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(Qe(e,r))}(n,t)),n.consolidate()}const Ze=/^class[ {]/;function Ye(e){return Array.isArray(e)}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Je(...e){1===e.length&&Ye(e[0])&&(e=e[0]);const t=(e=[...e]).pop();return t.$inject=e,t}const et=/constructor\s*[^(]*\(\s*([^)]*)\)/m,tt=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,nt=/\/\*([^*]*)\*\//m;function rt(e){if("function"!=typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(function(e){return Ze.test(e.toString())}(e)?et:tt);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map((e=>{const t=e.match(nt);return(t&&t[1]||e).trim()}))||[]}function it(e,t){const n=t||{get:function(e,t){if(r.push(e),!1===t)return null;throw a(`No provider for "${e}"!`)}},r=[],i=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),s=o.injector=this,a=function(e){const t=r.join(" -> ");return r.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function l(e,t){if(!i[e]&&e.includes(".")){const t=e.split(".");let n=l(t.shift());for(;t.length;)n=n[t.shift()];return n}if(Ke(o,e))return o[e];if(Ke(i,e)){if(-1!==r.indexOf(e))throw r.push(e),a("Cannot resolve circular dependency!");return r.push(e),o[e]=i[e][0](i[e][1]),r.pop(),o[e]}return n.get(e,t)}function c(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Ye(e))throw a(`Cannot invoke "${e}". Expected a function!`);e=Je(e.slice())}return{fn:e,dependencies:(e.$inject||rt(e)).map((e=>Ke(t,e)?t[e]:l(e)))}}function p(e){const{fn:t,dependencies:n}=c(e);return new(Function.prototype.bind.call(t,null,...n))}function u(e,t,n){const{fn:r,dependencies:i}=c(e,n);return r.apply(t,i)}function h(e){return Je((t=>e.get(t)))}function d(e,t){if(t&&t.length){const n=Object.create(null),r=Object.create(null),o=[],s=[],a=[];let l,c,p,u;for(let e in i)l=i[e],-1!==t.indexOf(e)&&("private"===l[2]?(c=o.indexOf(l[3]),-1===c?(p=l[3].createChild([],t),u=h(p),o.push(l[3]),s.push(p),a.push(u),n[e]=[u,e,"private",p]):n[e]=[a[c],e,"private",s[c]]):n[e]=[l[2],l[1]],r[e]=!0),"factory"!==l[2]&&"type"!==l[2]||!l[1].$scope||t.forEach((t=>{-1!==l[1].$scope.indexOf(t)&&(n[e]=[l[2],l[1]],r[t]=!0)}));t.forEach((e=>{if(!r[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(n)}return new it(e,s)}const f={factory:u,type:p,value:function(e){return e}};function m(e,t){const n=e.__init__||[];return function(){n.forEach((e=>{"string"==typeof e?t.get(e):t.invoke(e)}))}}function g(e){const t=e.__exports__;if(t){const n=e.__modules__,r=Object.keys(e).reduce(((t,n)=>("__exports__"!==n&&"__modules__"!==n&&"__init__"!==n&&"__depends__"!==n&&(t[n]=e[n]),t)),Object.create(null)),o=d((n||[]).concat(r)),s=Je((function(e){return o.get(e)}));t.forEach((function(e){i[e]=[s,e,"private",o]}));const a=(e.__init__||[]).slice();return a.unshift((function(){o.init()})),m(e=Object.assign({},e,{__init__:a}),o)}return Object.keys(e).forEach((function(t){if("__init__"===t||"__depends__"===t)return;const n=e[t];if("private"===n[2])return void(i[t]=n);const r=n[0],o=n[1];i[t]=[f[r],ot(r,o),r]})),m(e,s)}function y(e,t){return-1!==e.indexOf(t)||-1!==(e=(t.__depends__||[]).reduce(y,e)).indexOf(t)?e:e.concat(t)}this.get=l,this.invoke=u,this.instantiate=p,this.createChild=d,this.init=function(e){const t=e.reduce(y,[]).map(g);let n=!1;return function(){n||(n=!0,t.forEach((e=>e())))}}(e)}function ot(e,t){return"value"!==e&&Ye(t)&&(t=Je(t.slice())),t}var st=1e3;function at(e,t){var n=this;t=t||st,e.on(["render.shape","render.connection"],t,(function(e,t){var r=e.type,i=t.element,o=t.gfx,s=t.attrs;if(n.canRender(i))return"render.shape"===r?n.drawShape(o,i,s):n.drawConnection(o,i,s)})),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 lt(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function ct(e){return["L",e.x,e.y]}function pt(e,t){const n=e.length,r=[(i=e[0],["M",i.x,i.y])];var i,o,s,a;for(let i=1;i<n;i++){const n=e[i-1],l=e[i],c=e[i+1];if(!c||!t){r.push(ct(l));continue}const p=Math.min(t,ht(l.x-n.x,l.y-n.y),ht(c.x-l.x,c.y-l.y));if(!p){r.push(ct(l));continue}const u=ut(l,n,p),h=ut(l,n,.5*p),d=ut(l,c,p),f=ut(l,c,.5*p);r.push(ct(u)),r.push((s=f,a=d,["C",(o=h).x,o.y,s.x,s.y,a.x,a.y]))}return r}function ut(e,t,n){const r=t.x-e.x,i=t.y-e.y,o=n/ht(r,i);return{x:e.x+r*o,y:e.y+i*o}}function ht(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function dt(e,t,n){u(t)&&(n=t,t=null),t||(t={});const r=Ie("path",t);return u(n)&&(r.dataset.cornerRadius=String(n)),ft(r,e)}function ft(e,t){return Pe(e,{d:lt(pt(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function mt(e){return y(e,(function(t){return!m(e,(function(e){return e!==t&>(t,e)}))}))}function gt(e,t){if(t){if(e===t)return t;if(e.parent)return gt(e.parent,t)}}function yt(e,t,n){var r=!n||-1===e.indexOf(t);return r&&e.push(t),r}function vt(e,t,n){n=n||0,c(e)||(e=[e]),v(e,(function(e,r){var i=t(e,r,n);c(i)&&i.length&&vt(i,t,n+1)}))}function bt(e,t){return function(e,t,n){var r=[],i=[];return vt(e,(function(e,o,s){yt(r,e,t);var a=e.children;if((-1===n||s<n)&&a&&yt(i,a,t))return a})),r}(e,!t,-1)}function wt(e,t){var n,r,i,o;return t=!!t,c(e)||(e=[e]),v(e,(function(e){var s=e;e.waypoints&&!t&&(s=wt(e.waypoints,!0));var a=s.x,l=s.y,c=s.height||0,p=s.width||0;(a<n||void 0===n)&&(n=a),(l<r||void 0===r)&&(r=l),(a+p>i||void 0===i)&&(i=a+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:r,height:o-r,width:i-n}}function xt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function _t(e){return!(!e||!e.isFrame)}function kt(e,t){return L({},e||{},t||{})}at.prototype.canRender=function(e){},at.prototype.drawShape=function(e,t){},at.prototype.drawConnection=function(e,t){},at.prototype.getShapePath=function(e){},at.prototype.getConnectionPath=function(e){};function Et(e,t){at.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})}e(Et,at),Et.prototype.canRender=function(){return!0},Et.prototype.drawShape=function(e,t,n){var r=Ie("rect");return Pe(r,{x:0,y:0,width:t.width||0,height:t.height||0}),_t(t)?Pe(r,L({},this.FRAME_STYLE,n||{})):Pe(r,L({},this.SHAPE_STYLE,n||{})),_e(e,r),r},Et.prototype.drawConnection=function(e,t,n){var r=dt(t.waypoints,L({},this.CONNECTION_STYLE,n||{}));return _e(e,r),r},Et.prototype.getShapePath=function(e){var t=e.x,n=e.y,r=e.width;return lt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])},Et.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 lt(i)},Et.$inject=["eventBus","styles"];var Ot={__init__:["defaultRenderer"],defaultRenderer:["type",Et],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 L(this.style(t,n),{class:e})},this.style=function(t,n){c(t)||n||(n=t,t=[]);var r=w(t,(function(t,n){return L(t,e[n]||{})}),{});return n?L(r,n):r},this.computeStyle=function(e,n,r){return c(n)||(r=n,n=[]),t.style(n||[],L({},r,e||{}))}}]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function St(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 Ct(e,t){return e&&t?e.indexOf(t):-1}function Tt(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function Mt(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=Tt(e,t);return Math.abs(i/o)<=r}var At=2;function Dt(e,t){var n=Array.from(arguments).flat();const r={x:"v",y:"h"};for(const[e,t]of Object.entries(r))if(Nt(e,n))return t;return!1}function Nt(e,t){const n=t[0];return x(t,(function(t){return Math.abs(n[e]-t[e])<=At}))}function Rt(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 jt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var It=/,?([a-z]),?/gi,Lt=parseFloat,zt=Math,Bt=zt.PI,$t=zt.min,qt=zt.max,Ft=zt.pow,Vt=zt.abs,Ht=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Ut=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Wt=Array.isArray||function(e){return e instanceof Array};function Gt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Qt(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)Gt(e,n)&&(t[n]=Qt(e[n]));return t}function Xt(e){var t=Xt.ps=Xt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Gt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Zt(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 Yt(){return this.join(",").replace(It,"$1")}function Kt(e){var t=Qt(e);return t.toString=Yt,t}function Jt(e,t,n,r,i,o,s,a,l){var c=1-l,p=Ft(c,3),u=Ft(c,2),h=l*l*l,d=p*t+3*u*l*r+3*c*l*l*o+h*a;return{x:sn(p*e+3*u*l*n+3*c*l*l*i+h*s),y:sn(d)}}function en(e){var t=function(e,t,n,r,i,o,s,a){for(var l,c,p,u,h,d,f,m,g=[],y=[[],[]],v=0;v<2;++v)if(0==v?(c=6*e-12*n+6*i,l=-3*e+9*n-9*i+3*s,p=3*n-3*e):(c=6*t-12*r+6*o,l=-3*t+9*r-9*o+3*a,p=3*r-3*t),Vt(l)<1e-12){if(Vt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else f=c*c-4*p*l,m=zt.sqrt(f),f<0||(0<(h=(-c+m)/(2*l))&&h<1&&g.push(h),0<(d=(-c-m)/(2*l))&&d<1&&g.push(d));var b,w=g.length,x=w;for(;w--;)b=1-(u=g[w]),y[0][w]=b*b*b*e+3*b*b*u*n+3*b*u*u*i+u*u*u*s,y[1][w]=b*b*b*t+3*b*b*u*r+3*b*u*u*o+u*u*u*a;return y[0][x]=e,y[1][x]=t,y[0][x+1]=s,y[1][x+1]=a,y[0].length=y[1].length=x+2,{x0:$t(...y[0]),y0:$t(...y[1]),x1:qt(...y[0]),y1:qt(...y[1])}}(...e);return Zt(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tn(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function nn(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 rn(e,t,n,r,i,o,s,a,l){null==l&&(l=1);for(var c=(l=l>1?1:l<0?0:l)/2,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var f=c*p[d]+c,m=nn(f,e,n,i,s),g=nn(f,t,r,o,a),y=m*m+g*g;h+=u[d]*zt.sqrt(y)}return c*h}function on(e,t,n,r,i,o,s,a){if(!(qt(e,n)<$t(i,s)||$t(e,n)>qt(i,s)||qt(t,r)<$t(o,a)||$t(t,r)>qt(o,a))){var l=(e*r-t*n)*(o-a)-(t-r)*(i*a-o*s),c=(e-n)*(o-a)-(t-r)*(i-s);if(c){var p=sn(((e*r-t*n)*(i-s)-(e-n)*(i*a-o*s))/c),u=sn(l/c),h=+p.toFixed(2),d=+u.toFixed(2);if(!(h<+$t(e,n).toFixed(2)||h>+qt(e,n).toFixed(2)||h<+$t(i,s).toFixed(2)||h>+qt(i,s).toFixed(2)||d<+$t(t,r).toFixed(2)||d>+qt(t,r).toFixed(2)||d<+$t(o,a).toFixed(2)||d>+qt(o,a).toFixed(2)))return{x:p,y:u}}}}function sn(e){return Math.round(1e11*e)/1e11}function an(e,t,n){if(!function(e,t){return e=Zt(e),tn(t=Zt(t),e.x,e.y)||tn(t,e.x2,e.y)||tn(t,e.x,e.y2)||tn(t,e.x2,e.y2)||tn(e,t.x,t.y)||tn(e,t.x2,t.y)||tn(e,t.x,t.y2)||tn(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)}(en(e),en(t)))return n?0:[];for(var r=rn(...e),i=rn(...t),o=pn(e)?1:~~(r/5)||1,s=pn(t)?1:~~(i/5)||1,a=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var h=Jt(...e,u/o);a.push({x:h.x,y:h.y,t:u/o})}for(u=0;u<s+1;u++)h=Jt(...t,u/s),l.push({x:h.x,y:h.y,t:u/s});for(u=0;u<o;u++)for(var d=0;d<s;d++){var f,m=a[u],g=a[u+1],y=l[d],v=l[d+1],b=Vt(g.x-m.x)<.01?"y":"x",w=Vt(v.x-y.x)<.01?"y":"x",x=on(m.x,m.y,g.x,g.y,y.x,y.y,v.x,v.y);if(x){if(c[f=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[f]=!0;var _=m.t+Vt((x[b]-m[b])/(g[b]-m[b]))*(g.t-m.t),k=y.t+Vt((x[w]-y[w])/(v[w]-y[w]))*(v.t-y.t);_>=0&&_<=1&&k>=0&&k<=1&&(n?p++:p.push({x:x.x,y:x.y,t1:_,t2:k}))}}return p}function ln(e,t,n){e=fn(e),t=fn(t);for(var r,i,o,s,a,l,c,p,u,h,d=n?0:[],f=0,m=e.length;f<m;f++){var g=e[f];if("M"==g[0])r=a=g[1],i=l=g[2];else{"C"==g[0]?(r=(u=[r,i,...g.slice(1)])[6],i=u[7]):(u=[r,i,r,i,a,l,a,l],r=a,i=l);for(var y=0,v=t.length;y<v;y++){var b=t[y];if("M"==b[0])o=c=b[1],s=p=b[2];else{"C"==b[0]?(o=(h=[o,s,...b.slice(1)])[6],s=h[7]):(h=[o,s,o,s,c,p,c,p],o=c,s=p);var w=an(u,h,n);if(n)d+=w;else{for(var x=0,_=w.length;x<_;x++)w[x].segment1=f,w[x].segment2=y,w[x].bez1=u,w[x].bez2=h;d=d.concat(w)}}}}}return d}function cn(e){var t=Xt(e);if(t.abs)return Kt(t.abs);if(Wt(e)&&Wt(e&&e[0])||(e=function(e){if(!e)return null;var t=Xt(e);if(t.arr)return Qt(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 Wt(e)&&Wt(e[0])&&(r=Qt(e)),r.length||String(e).replace(Ht,(function(e,t,i){var o=[],s=t.toLowerCase();for(i.replace(Ut,(function(e,t){t&&o.push(+t)})),"m"==s&&o.length>2&&(r.push([t,...o.splice(0,2)]),s="l",t="m"==t?"l":"L");o.length>=n[s]&&(r.push([t,...o.splice(0,n[s])]),n[s]););})),r.toString=Xt.toString,t.arr=Qt(r),r}(e)),!e||!e.length)return[["M",0,0]];var n,r=[],i=0,o=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=i=+e[0][1],a=o=+e[0][2],l++,r[0]=["M",i,o]);for(var c,p,u=l,h=e.length;u<h;u++){if(r.push(c=[]),(n=(p=e[u])[0])!=n.toUpperCase())switch(c[0]=n.toUpperCase(),c[0]){case"A":c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=+p[6]+i,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+i;break;case"M":s=+p[1]+i,a=+p[2]+o;default:for(var d=1,f=p.length;d<f;d++)c[d]=+p[d]+(d%2?i:o)}else for(var m=0,g=p.length;m<g;m++)c[m]=p[m];switch(n=n.toUpperCase(),c[0]){case"Z":i=+s,o=+a;break;case"H":i=c[1];break;case"V":o=c[1];break;case"M":s=c[c.length-2],a=c[c.length-1];default:i=c[c.length-2],o=c[c.length-1]}}return r.toString=Yt,t.abs=Kt(r),r}function pn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function un(e,t,n,r){return[e,t,n,r,n,r]}function hn(e,t,n,r,i,o){var s=1/3,a=2/3;return[s*e+a*n,s*t+a*r,s*i+a*n,s*o+a*r,i,o]}function dn(e,t,n,r,i,o,s,a,l,c){var p,u=120*Bt/180,h=Bt/180*(+i||0),d=[],f=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),r=t.cache=t.cache||{},i=t.count=t.count||[];return Gt(r,n)?(function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(i,n),r[n]):(i.length>=1e3&&delete r[i.shift()],i.push(n),r[n]=e(...arguments),r[n])}}((function(e,t,n){return{x:e*zt.cos(n)-t*zt.sin(n),y:e*zt.sin(n)+t*zt.cos(n)}}));if(c)k=c[0],E=c[1],x=c[2],_=c[3];else{e=(p=f(e,t,-h)).x,t=p.y;var m=(e-(a=(p=f(a,l,-h)).x))/2,g=(t-(l=p.y))/2,y=m*m/(n*n)+g*g/(r*r);y>1&&(n*=y=zt.sqrt(y),r*=y);var v=n*n,b=r*r,w=(o==s?-1:1)*zt.sqrt(Vt((v*b-v*g*g-b*m*m)/(v*g*g+b*m*m))),x=w*n*g/r+(e+a)/2,_=w*-r*m/n+(t+l)/2,k=zt.asin(((t-_)/r).toFixed(9)),E=zt.asin(((l-_)/r).toFixed(9));(k=e<x?Bt-k:k)<0&&(k=2*Bt+k),(E=a<x?Bt-E:E)<0&&(E=2*Bt+E),s&&k>E&&(k-=2*Bt),!s&&E>k&&(E-=2*Bt)}var O=E-k;if(Vt(O)>u){var P=E,S=a,C=l;E=k+u*(s&&E>k?1:-1),d=dn(a=x+n*zt.cos(E),l=_+r*zt.sin(E),n,r,i,0,s,S,C,[E,P,x,_])}O=E-k;var T=zt.cos(k),M=zt.sin(k),A=zt.cos(E),D=zt.sin(E),N=zt.tan(O/4),R=4/3*n*N,j=4/3*r*N,I=[e,t],L=[e+R*M,t-j*T],z=[a+R*D,l-j*A],B=[a,l];if(L[0]=2*I[0]-L[0],L[1]=2*I[1]-L[1],c)return[L,z,B].concat(d);for(var $=[],q=0,F=(d=[L,z,B].concat(d).join().split(",")).length;q<F;q++)$[q]=q%2?f(d[q-1],d[q],h).y:f(d[q],d[q+1],h).x;return $}function fn(e){var t=Xt(e);if(t.curve)return Kt(t.curve);for(var n=cn(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",...dn(t.x,t.y,...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,...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",...hn(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",...hn(t.x,t.y,e[1],e[2],e[3],e[4])];break;case"L":e=["C",...un(t.x,t.y,e[1],e[2])];break;case"H":e=["C",...un(t.x,t.y,e[1],t.y)];break;case"V":e=["C",...un(t.x,t.y,t.x,e[1])];break;case"Z":e=["C",...un(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;)s[t]="A",e.splice(t++,0,["C",...r.splice(0,6)]);e.splice(t,1),p=n.length}},s=[],a="",l="",c=0,p=n.length;c<p;c++){n[c]&&(a=n[c][0]),"C"!=a&&(s[c]=a,c&&(l=s[c-1])),n[c]=i(n[c],r,l),"A"!=s[c]&&"C"==a&&(s[c]="C"),o(n,c);var u=n[c],h=u.length;r.x=u[h-2],r.y=u[h-1],r.bx=Lt(u[h-4])||r.x,r.by=Lt(u[h-3])||r.y}return t.curve=Kt(n),n}function mn(e){return p(e)&&f(e,"waypoints")}function gn(e){return p(e)&&f(e,"labelTarget")}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function vn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function bn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function xn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,r){var i=t[r-1];if(i){var o=e[e.length-1],s=o&&o.endLength||0,a=function(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}(i,n);e.push({start:i,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),r=n.reduce((function(e,t){return e+t.length}),0),i=r/2,o=0,s=n[o];s.endLength<i;)s=n[++o];var a=(i-s.startLength)/s.length;return{x:s.start.x+(s.end.x-s.start.x)*a,y:s.start.y+(s.end.y-s.start.y)*a}}function _n(e){return mn(e)?xn(e):vn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function kn(e,t,n){p(n=n||0)||(n={x:n,y:n});var r=bn(e),i=bn(t),o=r.bottom+n.y<=i.top,s=r.left-n.x>=i.right,a=r.top-n.y>=i.bottom,l=o?"top":a?"bottom":null,c=r.right+n.x<=i.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function En(e,t,n){var r=function(e,t){return ln(e,t)}(e,t);return 1===r.length||2===r.length&&Tt(r[0],r[1])<1?vn(r[0]):r.length>1?(r=T(r,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),vn(r[n?0:r.length-1])):null}function On(e,t){return Math.round(e*t)/t}function Pn(e){return u(e)?e+"px":e}function Sn(e,t,n){const r=Ie("g");Ce(r).add(t);const i=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(r,e.childNodes[i]||null),r}const Cn={shape:["x","y","width","height"],connection:["waypoints"]};function Tn(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 Mn(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Tn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Tn.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=L({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),X(n,{position:"relative",overflow:"hidden",width:Pn(e.width),height:Pn(e.height)}),t.appendChild(n),n}(e),r=this._svg=Ie("svg");Pe(r,{width:"100%",height:"100%"}),_e(n,r);const i=this._viewport=Sn(r,"viewport");e.deferUpdate&&(this._viewboxChanged=j(I(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:r,viewport:i})})),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],(()=>{delete this._cachedViewbox})),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Tn.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Tn.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=xt(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Tn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Tn.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let 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},Tn.prototype._getChildIndex=function(e){return w(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Tn.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:Sn(this._viewport,"layer-"+e,n),index:t,visible:!0}},Tn.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,r=t.group,i=t.index;if(t.visible)return r;const o=this._getChildIndex(i);return n.insertBefore(r,n.childNodes[o]||null),t.visible=!0,r},Tn.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible?(Me(n),t.visible=!1,n):n},Tn.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Me(t.group))},Tn.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Tn.prototype.findRoot=function(e){if("string"==typeof e&&(e=this._elementRegistry.get(e)),!e)return;const t=this._findPlaneForRoot(function(e){for(;e.parent;)e=e.parent;return e}(e))||{};return t.rootElement},Tn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Tn.prototype._findPlaneForRoot=function(e){return m(this._planes,(function(t){return t.rootElement===e}))},Tn.prototype.getContainer=function(){return this._container},Tn.prototype._updateMarker=function(e,t,n){let r;e.id||(e=this._elementRegistry.get(e)),r=this._elementRegistry._elements[e.id],r&&(v([r.gfx,r.secondaryGfx],(function(e){e&&(n?Ce(e).add(t):Ce(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:r.gfx,marker:t,add:!!n}))},Tn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Tn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Tn.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));return Ce(this.getGraphics(e)).has(t)},Tn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Tn.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Tn.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const r=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,r),this._planes.push({rootElement:e,layer:r}),e},Tn.prototype.removeRootElement=function(e){"string"==typeof e&&(e=this._elementRegistry.get(e));if(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},Tn.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Tn.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Tn.prototype._addRoot=function(e,t){const n=this._elementRegistry,r=this._eventBus;r.fire("root.add",{element:e}),n.add(e,t),r.fire("root.added",{element:e,gfx:t})},Tn.prototype._setRoot=function(e,t){const 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})},Tn.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");const n=Cn[e],r=x(n,(function(e){return void 0!==t[e]}));if(!r)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Tn.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},Tn.prototype._addElement=function(e,t,n,r){n=n||this.getRootElement();const i=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),i.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,r);const s=o.create(e,t,r);return this._elementRegistry.add(t,s),o.update(e,t,s),i.fire(e+".added",{element:t,gfx:s}),t},Tn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Tn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Tn.prototype._removeElement=function(e,t){const 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),Pt(e.parent&&e.parent.children,e),e.parent=null,i.fire(t+".removed",{element:e}),n.remove(e),e},Tn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Tn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Tn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Tn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Tn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Tn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let r,i,o,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const r=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Xe(t,r)})),e):(o=this._rootElement?this.getActiveLayer():null,r=o&&o.getBBox()||{},s=Xe(t),i=s?s.matrix:function(e,t,n,r,i,o){var s=ze().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return Be(s,e);case 6:return Be(s,{a:e,b:t,c:n,d:r,e:i,f:o})}}(),a=On(i.a,1e3),l=On(-i.e||0,1e3),c=On(-i.f||0,1e3),e=this._cachedViewbox={x:l?l/a:0,y:c?c/a:0,width:n.width/a,height:n.height/a,scale:a,inner:{width:r.width||0,height:r.height||0,x:r.x||0,y:r.y||0},outer:n})},Tn.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=L({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Mn(t,n)})),{x:n.e,y:n.f}},Tn.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const r=this.findRoot(e);if(r!==this.getRootElement()&&this.setRootElement(r),r===e)return;t||(t={}),"number"==typeof t&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const i=wt(e),o=bn(i),s=this.viewbox(),a=this.zoom();let l,c;s.y+=t.top/a,s.x+=t.left/a,s.width-=(t.right+t.left)/a,s.height-=(t.bottom+t.top)/a;const p=bn(s);if(i.width<s.width&&i.height<s.height){const e=Math.max(0,o.right-p.right),t=Math.min(0,o.left-p.left),n=Math.max(0,o.bottom-p.bottom),r=Math.min(0,o.top-p.top);l=e||t,c=n||r}else l=i.x-s.x,c=i.y-s.y;this.scroll({dx:-l*a,dy:-c*a})},Tn.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,r;return this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),r=this._setZoom(e,t)})),On(r.a,1e3)},Tn.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,r=t.inner;let i,o;return r.x>=0&&r.y>=0&&r.x+r.width<=n.width&&r.y+r.height<=n.height&&!e?o={x:0,y:0,width:Math.max(r.width+r.x,n.width),height:Math.max(r.height+r.y,n.height)}:(i=Math.min(1,n.width/r.width,n.height/r.height),o={x:r.x+(e?r.width/2-n.width/i/2:0),y:r.y+(e?r.height/2-n.height/i/2:0),width:n.width/i,height:n.height/i}),this.viewbox(o),this.viewbox(!1).scale},Tn.prototype._setZoom=function(e,t){const n=this._svg,r=this._viewport,i=n.createSVGMatrix(),o=n.createSVGPoint();let s,a,l,c,p;l=r.getCTM();const u=l.a;return t?(s=L(o,t),a=s.matrixTransform(l.inverse()),c=i.translate(a.x,a.y).scale(1/u*e).translate(-a.x,-a.y),p=l.multiply(c)):p=i.scale(e),Mn(this._viewport,p),p},Tn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Tn.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;if(e.waypoints){n=this.getGraphics(e).getBBox()}else n=e;return{x:n.x*t.scale-t.x*t.scale,y:n.y*t.scale-t.y*t.scale,width:n.width*t.scale,height:n.height*t.scale}},Tn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var An="data-element-id";function Dn(e){this._elements={},this._eventBus=e}function Nn(e,t,n){var r=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}(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 Rn(e,t){if(!(this instanceof Rn))return new Rn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Dn.$inject=["eventBus"],Dn.prototype.add=function(e,t,n){var r=e.id;this._validateId(r),Pe(t,An,r),n&&Pe(n,An,r),this._elements[r]={element:e,gfx:t,secondaryGfx:n}},Dn.prototype.remove=function(e){var t=this._elements,n=e.id||e,r=n&&t[n];r&&(Pe(r.gfx,An,""),r.secondaryGfx&&Pe(r.secondaryGfx,An,""),delete t[n])},Dn.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)},Dn.prototype.updateGraphics=function(e,t,n){var r=e.id||e,i=this._elements[r];return n?i.secondaryGfx=t:i.gfx=t,t&&Pe(t,An,r),t},Dn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Pe(e,An);var n=this._elements[t];return n&&n.element},Dn.prototype.filter=function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(n)})),t},Dn.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}},Dn.prototype.getAll=function(){return this.filter((function(e){return e}))},Dn.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)}))},Dn.prototype.getGraphics=function(e,t){var n=e.id||e,r=this._elements[n];return r&&(t?r.secondaryGfx:r.gfx)},Dn.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")},Rn.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?Nn(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)},Rn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return function(e){return!0===e.__refs_collection}(n)||Nn(this,t,e),n},Rn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Rn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Rn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var jn=new Rn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),In=new Rn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ln=new Rn({name:"attachers",collection:!0},{name:"host"}),zn=new Rn({name:"outgoing",collection:!0},{name:"source"}),Bn=new Rn({name:"incoming",collection:!0},{name:"target"});function $n(){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)}}),jn.bind(this,"parent"),In.bind(this,"labels"),zn.bind(this,"outgoing"),Bn.bind(this,"incoming")}function qn(){$n.call(this),jn.bind(this,"children"),Ln.bind(this,"host"),Ln.bind(this,"attachers")}function Fn(){$n.call(this),jn.bind(this,"children")}function Vn(){qn.call(this),In.bind(this,"labelTarget")}function Hn(){$n.call(this),zn.bind(this,"source"),Bn.bind(this,"target")}e(qn,$n),e(Fn,qn),e(Vn,qn),e(Hn,$n);var Un={connection:Hn,shape:qn,label:Vn,root:Fn};function Wn(){this._uid=12}Wn.prototype.createRoot=function(e){return this.create("root",e)},Wn.prototype.createLabel=function(e){return this.create("label",e)},Wn.prototype.createShape=function(e){return this.create("shape",e)},Wn.prototype.createConnection=function(e){return this.create("connection",e)},Wn.prototype.create=function(e,t){return(t=L({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Un[e];if(!n)throw new Error("unknown type: <"+e+">");return L(new n,t)}(e,t)};var Gn="__fn",Qn=Array.prototype.slice;function Xn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Zn(){}function Yn(e){return e.childNodes[0]}function Kn(e,t,n,r,i){var o=$e();o.setTranslate(t,n);var s=$e();s.setRotate(r||0,0,0);var a=$e();a.setScale(i||1,i||1),Xe(e,[o,s,a])}function Jn(e,t,n){var r=$e();r.setTranslate(t,n),Xe(e,r)}function er(e,t){var n=$e();n.setRotate(t,0,0),Xe(e,n)}function tr(e,t){this._eventBus=e,this._elementRegistry=t}function nr(e,t,n){var r=n||t.firstChild;e!==r&&t.insertBefore(e,r)}Xn.prototype.on=function(e,t,n,r){if(e=c(e)?e:[e],h(t)&&(r=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");var i=n;r&&((i=I(n,r))[Gn]=n[Gn]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:i,next:null})}))},Xn.prototype.once=function(e,t,n,r){var i=this;if(h(t)&&(r=n,n=t,t=1e3),!u(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[Gn]=n,this.on(e,t,o)},Xn.prototype.off=function(e,t){e=c(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Xn.prototype.createEvent=function(e){var t=new Zn;return t.init(e),t},Xn.prototype.fire=function(e,t){var n,r,i,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(r=this._listeners[e]){n=t instanceof Zn?t:this.createEvent(t),o[0]=n;var s=n.type;e!==s&&(n.type=e);try{i=this._invokeListeners(n,o,r)}finally{e!==s&&(n.type=s)}return void 0===i&&n.defaultPrevented&&(i=!1),i}},Xn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Xn.prototype._destroy=function(){this._listeners={}},Xn.prototype._invokeListeners=function(e,t,n){for(var r;n&&!e.cancelBubble;)r=this._invokeListener(e,t,n),n=n.next;return r},Xn.prototype._invokeListener=function(e,t,n){var r;if(n.callback.__isTomb)return r;try{r=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==r&&(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},Xn.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)},Xn.prototype._getListeners=function(e){return this._listeners[e]},Xn.prototype._setListeners=function(e,t){this._listeners[e]=t},Xn.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[Gn]!==t||(r?r.next=n:this._setListeners(e,n)),r=o,o=n;else this._setListeners(e,null)},Zn.prototype.stopPropagation=function(){this.cancelBubble=!0},Zn.prototype.preventDefault=function(){this.defaultPrevented=!0},Zn.prototype.init=function(e){L(this,e||{})},tr.$inject=["eventBus","elementRegistry"],tr.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(Ce(t=Ie("g")).add("djs-children"),_e(n.parentNode,t))):t=n,t},tr.prototype._clear=function(e){var t=Yn(e);return ee(t),t},tr.prototype._createContainer=function(e,t,n,r){var i=Ie("g");Ce(i).add("djs-group"),void 0!==n?nr(i,t,t.childNodes[n]):_e(t,i);var o=Ie("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),r&&Ce(o).add("djs-frame"),_e(i,o);var s=Ie("g");return Ce(s).add("djs-visual"),_e(o,s),o},tr.prototype.create=function(e,t,n){var r=this._getChildrenContainer(t.parent);return this._createContainer(e,r,n,_t(t))},tr.prototype.updateContainments=function(e){var t,n=this,r=this._elementRegistry;t=w(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),v(t,(function(e){var t=e.children;if(t){var i=n._getChildrenContainer(e);v(t.slice().reverse(),(function(e){nr(r.getGraphics(e).parentNode,i)}))}}))},tr.prototype.drawShape=function(e,t,n={}){return this._eventBus.fire("render.shape",{gfx:e,element:t,attrs:n})},tr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},tr.prototype.drawConnection=function(e,t,n={}){return this._eventBus.fire("render.connection",{gfx:e,element:t,attrs:n})},tr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},tr.prototype.update=function(e,t,n){if(t.parent){var r=this._clear(n);if("shape"===e)this.drawShape(r,t),Jn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(r,t)}t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},tr.prototype.remove=function(e){Me(this._elementRegistry.getGraphics(e).parentNode)};var rr={__depends__:[Ot],__init__:["canvas"],canvas:["type",Tn],elementRegistry:["type",Dn],elementFactory:["type",Wn],eventBus:["type",Xn],graphicsFactory:["type",tr]};function ir(e){return function(e){var t=new it(e);return t.init(),t}([{config:["value",e=e||{}]},rr].concat(e.modules||[]))}function or(e,t){this._injector=t||ir(e),this.get("eventBus").fire("diagram.init")}function sr(){}function ar(e,t){this.model=e,this.properties=t}or.prototype.get=function(e,t){return this._injector.get(e,t)},or.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},or.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},or.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},sr.prototype.get=function(e){return this.$model.properties.get(this,e)},sr.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},ar.prototype.createType=function(e){var t=this.model,n=this.properties,r=Object.create(sr.prototype);v(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}),v(e,I((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 lr={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},cr={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 pr(e,t){var n=cr[e];return n?n(t):t}function ur(e){return!!lr[e]}function hr(e){return!!cr[e]}function dr(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 fr(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mr(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,v(e,I(this.registerPackage,this))}function gr(e,t,n){var r=t[n];if(r in e)throw new Error("package with "+n+" <"+r+"> already defined")}function yr(e){this.model=e}function vr(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function br(e){return e.replace(/^:/,"")}function wr(e,t={}){this.properties=new yr(this),this.factory=new ar(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache={},this.config=t}fr.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fr.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)},fr.prototype.replaceProperty=function(e,t,n){var r=e.ns,i=this.properties,o=this.propertiesByName,s=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 a=i.indexOf(e);if(-1===a)throw new Error("property <"+r.name+"> not found in property list");i.splice(a,1),this.addProperty(t,n?void 0:a,s),o[r.name]=o[r.localName]=t},fr.prototype.redefineProperty=function(e,t,n){var r=e.ns.prefix,i=t.split("#"),o=dr(i[0],r),s=dr(i[1],o.prefix).name,a=this.propertiesByName[s];if(!a)throw new Error("refined property <"+s+"> not found");this.replaceProperty(a,e,n),delete e.redefines},fr.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},fr.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fr.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},fr.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},fr.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fr.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")},fr.prototype.hasProperty=function(e){return this.propertiesByName[e]},fr.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,r=this.allTypes,i=e.name;i in n||(v(e.properties,I((function(n){n=L({},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)},mr.prototype.getPackage=function(e){return this.packageMap[e]},mr.prototype.getPackages=function(){return this.packages},mr.prototype.registerPackage=function(e){e=L({},e);var t=this.packageMap;gr(t,e,"prefix"),gr(t,e,"uri"),v(e.types,I((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mr.prototype.registerType=function(e,t){var n=dr((e=L({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:L(e.meta||{})})).name,t.prefix),r=n.name,i={};v(e.properties,I((function(e){var t=dr(e.name,n.prefix),r=t.name;ur(e.type)||(e.type=dr(e.type,t.prefix).name),L(e,{ns:t,name:r}),i[r]=e}),this)),L(e,{ns:n,name:r,propertiesByName:i}),v(e.extends,I((function(e){var t=dr(e,n.prefix),i=this.typeMap[t.name];i.traits=i.traits||[],i.traits.push(r)}),this)),this.definePackage(e,t),this.typeMap[r]=e},mr.prototype.mapTypes=function(e,t,n){var r=ur(e.name)?{name:e.name}:this.typeMap[e.name],i=this;function o(n,r){var o=dr(n,ur(n)?"":e.prefix);i.mapTypes(o,t,r)}function s(e){return o(e,!0)}if(!r)throw new Error("unknown type <"+e.name+">");v(r.superClass,n?s:function(e){return o(e,!1)}),t(r,!n),v(r.traits,s)},mr.prototype.getEffectiveDescriptor=function(e){var t=dr(e),n=new fr(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},mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},yr.prototype.set=function(e,t,n){if(!d(t)||!t.length)throw new TypeError("property name must be a non-empty string");var r=this.getProperty(e,t),i=r&&r.name;void 0===n?r?delete e[i]:delete e.$attrs[br(t)]:r?i in e?e[i]=n:vr(e,r,n):e.$attrs[br(t)]=n},yr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[br(t)];var r=n.name;return!e[r]&&n.isMany&&vr(e,n,[]),e[r]},yr.prototype.define=function(e,t,n){if(!n.writable){var r=n.value;delete(n=L({},n,{get:function(){return r}})).value}Object.defineProperty(e,t,n)},yr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},yr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},yr.prototype.getProperty=function(e,t){var n=this.model,r=n.getPropertyDescriptor(e,t);if(r)return r;if(t.includes(":"))return null;const i=n.config.strict;if(void 0!==i){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(i)throw n;"undefined"!=typeof console&&console.warn(n)}return null},wr.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wr.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,r=t[n];return r||(e=this.registry.getEffectiveDescriptor(n),r=t[n]=this.factory.createType(e)),r},wr.prototype.createAny=function(e,t,n){var r=dr(e),i={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){z(this,[e],t)}},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,"get",{enumerable:!1,writable:!0}),this.properties.define(i,"set",{enumerable:!1,writable:!0}),this.properties.define(i,"$parent",{enumerable:!1,writable:!0}),this.properties.define(i,"$instanceOf",{enumerable:!1,writable:!0}),v(n,(function(e,t){p(e)&&void 0!==e.value?i[e.name]=e.value:i[t]=e})),i},wr.prototype.getPackage=function(e){return this.registry.getPackage(e)},wr.prototype.getPackages=function(){return this.registry.getPackages()},wr.prototype.getElementDescriptor=function(e){return e.$descriptor},wr.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},wr.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wr.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var xr=String.fromCharCode,_r=Object.prototype.hasOwnProperty,kr=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Er={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Or(e,t,n,r){return r?_r.call(Er,r)?Er[r]:"&"+r+";":xr(t||parseInt(n,16))}function Pr(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(kr,Or):e}Object.keys(Er).forEach((function(e){Er[e.toUpperCase()]=Er[e]}));var Sr="xsi:type",Cr="non-whitespace outside of root node";function Tr(e){return new Error(e)}function Mr(e){return"missing namespace for prefix <"+e+">"}function Ar(e){return{get:e,enumerable:!0}}function Dr(e){var t,n={};for(t in e)n[t]=e[t];return n}function Nr(e){return e+"$uri"}function Rr(){return{line:0,column:0}}function jr(e){throw e}function Ir(e){if(!this)return new Ir(e);var t,n,r,i,o,s,a,l,c,p=e&&e.proxy,u=jr,h=Rr,d=!1,f=!1,m=null,g=!1;function y(e){e instanceof Error||(e=Tr(e)),m=e,u(e,h)}function v(e){o&&(e instanceof Error||(e=Tr(e)),o(e,h))}this.on=function(e,c){if("function"!=typeof c)throw Tr("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":r=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":i=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw Tr("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Tr("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",f=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Tr("required args <xml=string>");return m=null,function(e){var o,u,m,b,w,x,_,k,E,O,P,S=f?[]:null,C=f?function(e){var t,n,r={};for(t in e)r[n=e[t]]=n,r[Nr(n)]=t;return r}(c):null,T=[],M=0,A=!1,D=!1,N=0,R=0,j="",I=0;function L(){if(null!==P)return P;var e,t,n,r,i,o,s,a,l,p,u,h=f&&C.xmlns,m=f&&d?[]:null,g=I,y=j,b=y.length,w={},x={};e:for(;g<b;g++)if(l=!1,!(32===(p=y.charCodeAt(g))||p<14&&p>8)){for((p<65||p>122||p>90&&p<97)&&95!==p&&58!==p&&(v("illegal first char attribute name"),l=!0),u=g+1;u<b;u++)if(!((p=y.charCodeAt(u))>96&&p<123||p>64&&p<91||p>47&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&p>8){v("missing attribute value"),g=u;continue e}if(61===p)break;v("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(a=y.substring(g,u))&&(v("illegal declaration of xmlns"),l=!0),34===(p=y.charCodeAt(u+1)))-1===(u=y.indexOf('"',g=u+2))&&-1!==(u=y.indexOf("'",g))&&(v("attribute value quote missmatch"),l=!0);else if(39===p)-1===(u=y.indexOf("'",g=u+2))&&-1!==(u=y.indexOf('"',g))&&(v("attribute value quote missmatch"),l=!0);else for(v("missing attribute value quotes"),l=!0,u+=1;u<b&&!(32===(p=y.charCodeAt(u+1))||p<14&&p>8);u++);for(-1===u&&(v("missing closing quotes"),u=b,l=!0),l||(o=y.substring(g,u)),g=u;u+1<b&&!(32===(p=y.charCodeAt(u+1))||p<14&&p>8);u++)g===u&&(v("illegal character after attribute end"),l=!0);if(g=u+1,!l)if(a in x)v("attribute <"+a+"> already defined");else if(x[a]=!0,f)if(d){if(null!==(i="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=Pr(o),t=Nr(i),!(s=c[e])){if("xmlns"===i||t in C&&C[t]!==e)do{s="ns"+M++}while(void 0!==C[s]);else s=i;c[e]=s}C[i]!==s&&(r||(C=Dr(C),r=!0),C[i]=s,"xmlns"===i&&(C[Nr(s)]=e,h=s),C[t]=e),w[a]=o;continue}m.push(a,o)}else-1!==(p=a.indexOf(":"))?(n=C[a.substring(0,p)])?((a=h===n?a.substr(p+1):n+a.substr(p))===Sr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=h+":"+o),w[a]=o):v(Mr(a.substring(0,p))):w[a]=o;else w[a]=o}if(d)for(g=0,b=m.length;g<b;g++){if(a=m[g++],o=m[g],-1!==(p=a.indexOf(":"))){if(!(n=C[a.substring(0,p)])){v(Mr(a.substring(0,p)));continue}(a=h===n?a.substr(p+1):n+a.substr(p))===Sr&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=h+":"+o)}w[a]=o}return P=w}function z(){for(var t,n,r=/(\r\n|\r|\n)/g,i=0,o=0,s=0,a=R;N>=s&&(t=r.exec(e))&&!((a=t[0].length+t.index)>N);)i+=1,s=a;return-1==N?(o=a,n=e.substring(R)):0===R?n=e.substring(R,N):(o=N-s,n=-1==R?e.substring(N):e.substring(N,R+1)),{data:n,line:i,column:o}}h=z,p&&(O=Object.create({},{name:Ar((function(){return k})),originalName:Ar((function(){return E})),attrs:Ar(L),ns:Ar((function(){return C}))}));for(;-1!==R;){if(-1===(N=60===e.charCodeAt(R)?R:e.indexOf("<",R)))return T.length?y("unexpected end of file"):0===R?y("missing start tag"):void(R<e.length&&e.substring(R).trim()&&v(Cr));if(R!==N)if(T.length){if(t&&(t(e.substring(R,N),Pr,h),g))return}else if(e.substring(R,N).trim()&&(v(Cr),g))return;if(33===(w=e.charCodeAt(N+1))){if(91===(b=e.charCodeAt(N+2))&&"CDATA["===e.substr(N+3,6)){if(-1===(R=e.indexOf("]]>",N)))return y("unclosed cdata");if(i&&(i(e.substring(N+9,R),h),g))return;R+=3;continue}if(45===b&&45===e.charCodeAt(N+3)){if(-1===(R=e.indexOf("--\x3e",N)))return y("unclosed comment");if(s&&(s(e.substring(N+4,R),Pr,h),g))return;R+=3;continue}}if(63!==w){for(u=N+1;;u++){if(x=e.charCodeAt(u),isNaN(x))return R=-1,y("unclosed tag");if(34===x)u=-1!==(b=e.indexOf('"',u+1))?b:u;else if(39===x)u=-1!==(b=e.indexOf("'",u+1))?b:u;else if(62===x){R=u;break}}if(33!==w){if(P={},47===w){if(A=!1,D=!0,!T.length)return y("missing open tag");if(u=k=T.pop(),b=N+2+u.length,e.substring(N+2,b)!==u)return y("closing tag mismatch");for(;b<R;b++)if(!(32===(w=e.charCodeAt(b))||w>8&&w<14))return y("close tag")}else{if(47===e.charCodeAt(R-1)?(u=k=e.substring(N+1,R-1),A=!0,D=!0):(u=k=e.substring(N+1,R),A=!0,D=!1),!(w>96&&w<123||w>64&&w<91||95===w||58===w))return y("illegal first char nodeName");for(b=1,m=u.length;b<m;b++)if(!((w=u.charCodeAt(b))>96&&w<123||w>64&&w<91||w>47&&w<59||45===w||95===w||46==w)){if(32===w||w<14&&w>8){k=u.substring(0,b),P=null;break}return y("invalid nodeName")}D||T.push(k)}if(f){if(o=C,A&&(D||S.push(o),null===P&&(d=-1!==u.indexOf("xmlns",b))&&(I=b,j=u,L(),d=!1)),E=k,-1!==(w=k.indexOf(":"))){if(!(_=C[k.substring(0,w)]))return y("missing namespace on <"+E+">");k=k.substr(w+1)}else _=C.xmlns;_&&(k=_+":"+k)}if(A&&(I=b,j=u,n&&(p?n(O,Pr,D,h):n(k,L,Pr,D,h),g)))return;if(D){if(r&&(r(p?O:k,Pr,A,h),g))return;f&&(C=A?o:S.pop())}R+=1}else{if(l&&(l(e.substring(N,R+1),Pr,h),g))return;R+=1}}else{if(-1===(R=e.indexOf("?>",N)))return y("unclosed question");if(a&&(a(e.substring(N,R+2),h),g))return;R+=2}}}(e),h=Rr,g=!1,m},this.stop=function(){g=!0}}function Lr(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var zr={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Br="xsi:type";function $r(e){return e.xml&&e.xml.serialize}function qr(e){return $r(e)===Br}function Fr(e,t){return Lr(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Vr(e){return new Error(e)}function Hr(e){return e.$descriptor}function Ur(e){L(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Vr("expected element");var t,n=this.elementsById,r=Hr(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 Vr("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Wr(){}function Gr(){}function Qr(){}function Xr(e,t){this.property=e,this.context=t}function Zr(e,t){this.element=t,this.propertyDesc=e}function Yr(){}function Kr(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Jr(e,t,n){Kr.call(this,e,t,n)}function ei(e,t,n){this.model=e,this.context=n}function ti(e){e instanceof wr&&(e={model:e}),L(this,{lax:!1},e)}Wr.prototype.handleEnd=function(){},Wr.prototype.handleText=function(){},Wr.prototype.handleNode=function(){},Gr.prototype=Object.create(Wr.prototype),Gr.prototype.handleNode=function(){return this},Qr.prototype=Object.create(Wr.prototype),Qr.prototype.handleText=function(e){this.body=(this.body||"")+e},Xr.prototype=Object.create(Qr.prototype),Xr.prototype.handleNode=function(e){if(this.element)throw Vr("expected no sub nodes");return this.element=this.createReference(e),this},Xr.prototype.handleEnd=function(){this.element.id=this.body},Xr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Zr.prototype=Object.create(Qr.prototype),Zr.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=pr(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Yr.prototype=Object.create(Qr.prototype),Yr.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},Kr.prototype=Object.create(Yr.prototype),Kr.prototype.addReference=function(e){this.context.addReference(e)},Kr.prototype.handleText=function(e){if(!Hr(this.element).bodyProperty)throw Vr("unexpected body text <"+e+">");Qr.prototype.handleText.call(this,e)},Kr.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Hr(t).bodyProperty;n&&void 0!==e&&(e=pr(n.type,e),t.set(n.name,e))},Kr.prototype.createElement=function(e){var t,n=e.attributes,r=this.type,i=Hr(r),o=this.context,s=new r({}),a=this.model;return v(n,(function(e,n){var r=i.propertiesByName[n];r&&r.isReference?r.isMany?v(e.split(" "),(function(e){o.addReference({element:s,property:r.ns.name,id:e})})):o.addReference({element:s,property:r.ns.name,id:e}):(r?e=pr(r.type,e):"xmlns"!==n&&(t=dr(n,i.ns.prefix),a.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},Kr.prototype.getPropertyForNode=function(e){var t,n,r=dr(e.name),i=this.type,o=this.model,s=Hr(i),a=r.name,l=s.propertiesByName[a];if(l&&!l.isAttr)return qr(l)&&(t=e.attributes[Br])?(t=function(e,t){var n=dr(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),L({},l,{effectiveType:Hr(n=o.getType(t)).name})):l;var c=o.getPackage(r.prefix);if(c){if(t=Fr(r,c),n=o.getType(t),l=m(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),l)return L({},l,{effectiveType:Hr(n).name})}else if(l=m(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),l)return l;throw Vr("unrecognized element <"+r.name+">")},Kr.prototype.toString=function(){return"ElementDescriptor["+Hr(this.type).name+"]"},Kr.prototype.valueHandler=function(e,t){return new Zr(e,t)},Kr.prototype.referenceHandler=function(e){return new Xr(e,this.context)},Kr.prototype.handler=function(e){return"Element"===e?new ei(this.model,e,this.context):new Kr(this.model,e,this.context)},Kr.prototype.handleChild=function(e){var t,n,r,i;if(t=this.getPropertyForNode(e),r=this.element,hr(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?(L(o,{element:r}),this.context.addReference(o)):o.$parent=r),i},Jr.prototype=Object.create(Kr.prototype),Jr.prototype.createElement=function(e){var t=e.name,n=dr(t),r=this.model,i=this.type,o=r.getPackage(n.prefix),s=o&&Fr(n,o)||t;if(!i.hasType(s))throw Vr("unexpected element <"+e.originalName+">");return Kr.prototype.createElement.call(this,e)},ei.prototype=Object.create(Yr.prototype),ei.prototype.createElement=function(e){var t=e.name,n=dr(t).prefix,r=e.ns[n+"$uri"],i=e.attributes;return this.model.createAny(t,r,i)},ei.prototype.handleChild=function(e){var t=new ei(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},ei.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ti.prototype.fromXML=function(e,t,n){var r=t.rootHandler;t instanceof Kr?(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,s=new Ur(L({},t,{rootHandler:r})),a=new Ir({proxy:!0}),l=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function c(e,t,n){var r=t(),i=r.line,o=r.column,a=r.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+i+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Vr(l)}function p(e,t){return c(e,t,!0)}r.context=s,l.push(r);var u=/^<\?xml /i,h=/ encoding="([^"]+)"/i,d=/^utf-8$/i;function f(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var m=i.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return a.ns(m).on("openTag",(function(e,t,n,r){var i=e.attrs||{},s=Object.keys(i).reduce((function(e,n){var r=t(i[n]);return e[n]=r,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Gr)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},r)})).on("question",(function(e){if(u.test(e)){var t=h.exec(e),n=t&&t[1];n&&!d.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",f).on("text",(function(e,t,n){!function(e,t){e.trim()&&f(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var i;try{a.parse(e),function(){var e,t,n=s.elementsById,r=s.references;for(e=0;t=r[e];e++){var i=t.element,o=n[t.id],a=Hr(i).propertiesByName[t.property];if(o||s.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var l=i.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else i.set(a.name,o)}}()}catch(e){i=e}var o=r.element;i||o||(i=Vr("failed to parse document as <"+r.type.$descriptor.name+">"));var l=s.warnings,c=s.references,p=s.elementsById;return i?(i.warnings=l,n(i)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},ti.prototype.handler=function(e){return new Jr(this.model,e)};var ni=/<|>|'|"|&|\n\r|\n/g,ri=/<|>|&/g;function ii(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 oi(e,t){return Lr(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function si(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ai(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var li={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ci={"<":"lt",">":"gt","&":"amp"};function pi(e,t,n){return(e=d(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function ui(e){this.tagName=e}function hi(){}function di(e){this.tagName=e}function fi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function mi(e,t){fi.call(this,e,t)}function gi(){this.value="",this.write=function(e){this.value+=e}}function yi(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 vi(e){return e=L({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var r=n||new gi,i=new yi(r,e.format);if(e.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new fi).build(t).serializeTo(i),!n)return r.value}}}function bi(e,t){wr.call(this,e,t)}ui.prototype.build=function(e){return this.element=e,this},ui.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},hi.prototype.serializeValue=hi.prototype.serializeTo=function(e){e.append(this.escape?pi(this.value,ri,ci):this.value)},hi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ri)&&(this.escape=!0),this},si(di,hi),di.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},fi.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 y(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!f(e,n))return!1;var r=e[n];return r!==t.default&&null!==r&&(!t.isMany||r.length)}))}(e),this.parseAttributes(y(n,(function(e){return e.isAttr}))),this.parseContainments(function(e){return y(e,(function(e){return!e.isAttr}))}(n))),this.parseGenericAttributes(e,t),this},fi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?L({localName:t.ns.localName},e):L({localName:oi(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},fi.prototype.nsPropertyTagName=function(e){return function(e,t){return L({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},fi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},fi.prototype.nsAttributeName=function(e){var t;if(t=d(e)?dr(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}:L({localName:t.localName},n)},fi.prototype.parseGeneric=function(e){var t=this,n=this.body,r=[];return v(e,(function(i,o){"$body"===o?n.push((new hi).build({type:"String"},i)):"$children"===o?v(i,(function(e){n.push(new fi(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,i)&&r.push({name:o,value:i})})),r},fi.prototype.parseNsAttribute=function(e,t,n){var r,i=e.$model,o=dr(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 s=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(s)}},fi.prototype.parseNsAttributes=function(e,t){var n=this,r=e.$attrs,i=[];return v(r,(function(t,r){var o=n.parseNsAttribute(e,r,t);o&&i.push(o)})),i},fi.prototype.parseGenericAttributes=function(e,t){var n=this;v(t,(function(t){if(t.name!==Br)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},fi.prototype.parseContainments=function(e){var t=this,n=this.body,r=this.element;v(e,(function(e){var i=r.get(e.name),o=e.isReference;if(e.isMany||(i=[i]),e.isBody)n.push((new hi).build(e,i[0]));else if(hr(e.type))v(i,(function(r){n.push(new di(t.addTagName(t.nsPropertyTagName(e))).build(e,r))}));else if(o)v(i,(function(r){n.push(new ui(t.addTagName(t.nsPropertyTagName(e))).build(r))}));else{var s=qr(e),a=function(e){return"property"===$r(e)}(e);v(i,(function(r){var i;i=s?new mi(t,e):a?new fi(t,e):new fi(t),n.push(i.build(r))}))}}))},fi.prototype.getNamespaces=function(e){var t,n=this.namespaces,r=this.parent;return n||(t=r&&r.getNamespaces(),e||!t?this.namespaces=n=new ii(t):n=t),n},fi.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},fi.prototype.logNamespaceUsed=function(e,t){var n,r,i,o=this.element.$model,s=this.getNamespaces(t),a=e.prefix,l=e.uri;if(!a&&!l)return{localName:e.localName};if(i=zr[a]||o&&(o.getPackage(a)||{}).uri,!(l=l||i||s.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=s.byUri(l))){for(n=a,r=1;s.uriByPrefix(n);)n=a+"_"+r++;e=this.logNamespace({prefix:n,uri:l},i===l)}return a&&s.mapPrefix(a,l),e},fi.prototype.parseAttributes=function(e){var t=this,n=this.element;v(e,(function(e){var r=n.get(e.name);if(e.isReference)if(e.isMany){var i=[];v(r,(function(e){i.push(e.id)})),r=i.join(" ")}else r=r.id;t.addAttribute(t.nsAttributeName(e),r)}))},fi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ai(e)},fi.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=pi(t,ni,li));var r=g(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),i={name:e,value:t};-1!==r?n.splice(r,1,i):n.push(i)},fi.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)),v(t,(function(t){e.append(" ").append(ai(t.name)).append('="').append(t.value).append('"')}))},fi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==hi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),v(this.body,(function(t){t.serializeTo(e)})),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},si(mi,fi),mi.prototype.parseNsAttributes=function(e){var t=fi.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(Br),(r.prefix?r.prefix+":":"")+o+n.ns.localName),t},mi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},bi.prototype=Object.create(wr.prototype),bi.prototype.fromXML=function(e,t,n){d(t)||(n=t,t="bpmn:Definitions");var r=new ti(L({model:this,lax:!0},n)),i=r.handler(t);return r.fromXML(e,i)},bi.prototype.toXML=function(e,t){var n=new vi(t);return new Promise((function(t,r){try{return t({xml:n.toXML(e)})}catch(e){return r(e)}}))};var wi={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",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 xi(e,t){return new bi(L({},wi,e),t)}function _i(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var ki="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 Ei(e){f(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(ki)}})}function Oi(e,t){return e.$instanceOf(t)}function Pi(e,t){var n={},r=[],i={};function o(e,t){return function(n){e(n,t)}}function s(e){n[e.id]=e}function a(n,r){try{var o=i[n.id]&&function(n,r){if(n.gfx)throw new Error(t("already rendered {element}",{element:_i(n)}));return e.element(n,i[n.id],r)}(n,r);return s(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:_i(n)})),console.error(e)}}function l(t,n){e.error(t,n)}var c=this.registerDi=function(e){var n=e.bpmnElement;n?i[n.id]?l(t("multiple DI elements defined for {element}",{element:_i(n)}),{element:n}):(i[n.id]=e,Ei(n)):l(t("no bpmnElement referenced in {element}",{element:_i(e)}),{element:e})};function p(e){var t;t=e.plane,c(t),v(t.planeElement,u)}function u(e){c(e)}this.handleDefinitions=function(s,a){var u=s.diagrams;if(a&&-1===u.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&u&&u.length&&(a=u[0]),!a)throw new Error(t("no diagram to display"));i={},p(a);var g=a.plane;if(!g)throw new Error(t("no plane for {element}",{element:_i(a)}));var b=g.bpmnElement;if(!b){if(b=function(e){return m(e.rootElements,(function(e){return Oi(e,"bpmn:Process")||Oi(e,"bpmn:Collaboration")}))}(s),!b)throw new Error(t("no process or collaboration to display"));l(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:_i(g),rootElement:_i(b)})),g.bpmnElement=b,c(g)}var w,x,k=function(t,n){return e.root(t,i[t.id],n)}(b,g);if(Oi(b,"bpmn:Process")||Oi(b,"bpmn:SubProcess"))d(b,k);else{if(!Oi(b,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:_i(g),rootElement:_i(b)}));x=k,v((w=b).participants,o(M,x)),_(w.artifacts,x),r.push((function(){!function(e,t){v(e,o(f,t))}(w.messageFlows,x)})),function(e,t){var r=y(e,(function(e){return!n[e.id]&&Oi(e,"bpmn:Process")&&e.laneSets}));r.forEach(o(d,t))}(s.rootElements,k)}h(r)};var h=this.handleDeferred=function(){for(;r.length;)r.shift()()};function d(e,t){T(e,t),k(e.ioSpecification,t),_(e.artifacts,t),s(e)}function f(e,t){a(e,t)}function g(e,t){a(e,t)}function b(e,t){a(e,t)}function w(e,t){a(e,t)}function x(e,t){a(e,t)}function _(e,t){v(e,(function(e){Oi(e,"bpmn:Association")?r.push((function(){x(e,t)})):x(e,t)}))}function k(e,t){e&&(v(e.dataInputs,o(b,t)),v(e.dataOutputs,o(w,t)))}var E=this.handleSubProcess=function(e,t){T(e,t),_(e.artifacts,t)};function O(e,t){var n=a(e,t);Oi(e,"bpmn:SubProcess")&&E(e,n||t),Oi(e,"bpmn:Activity")&&k(e.ioSpecification,t),r.push((function(){v(e.dataInputAssociations,o(g,t)),v(e.dataOutputAssociations,o(g,t))}))}function P(e,t){a(e,t)}function S(e,t){r.push((function(){var n=a(e,t);e.childLaneSet&&C(e.childLaneSet,n||t),function(e){v(e.flowNodeRef,(function(t){var n=t.get("lanes");n&&n.push(e)}))}(e)}))}function C(e,t){v(e.lanes,o(S,t))}function T(e,n){!function(e,n){v(e,(function(e){Oi(e,"bpmn:SequenceFlow")?r.push((function(){!function(e,t){a(e,t)}(e,n)})):Oi(e,"bpmn:BoundaryEvent")?r.unshift((function(){O(e,n)})):Oi(e,"bpmn:FlowNode")?O(e,n):Oi(e,"bpmn:DataObject")||(Oi(e,"bpmn:DataStoreReference")||Oi(e,"bpmn:DataObjectReference")?P(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:_i(e),context:n?_i(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){v(e,o(C,t))}(e.laneSets,n)}function M(e,t){var n=a(e,t),r=e.processRef;r&&d(r,n||t)}}function Si(e,t){var n=Ti(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ci(e,t){return _(t,(function(t){return Si(e,t)}))}function Ti(e){return e&&e.businessObject||e}function Mi(e){return e&&e.di}function Ai(e,t,n){var r,i,o,s,a=[];function l(e,t){var n=new Pi({root:function(e,t){return r.add(e,t)},element:function(e,t,n){return r.add(e,t,n)},error:function(e,t){a.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;Si(r,"bpmn:Process")||Si(r,"bpmn:Collaboration")||(i=function(e){var t=e;for(;t;){if(Si(t,"bpmn:Process"))return t;t=t.$parent}}(r));n=Si(i,"bpmn:Collaboration")?i:m(e.rootElements,(function(e){if(Si(e,"bpmn:Collaboration"))return m(e.participants,(function(e){return e.processRef===i}))}));var o=[i];n&&(o=k(n.participants,(function(e){return e.processRef}))).push(n);var s=Di(o),a=[t],l=[r];return v(e.diagrams,(function(e){var t=e.plane.bpmnElement;-1!==s.indexOf(t)&&-1===l.indexOf(t)&&(a.push(e),l.push(t))})),a}(e,t);if(!i)throw new Error(o("no diagram to display"));v(i,(function(t){n.handleDefinitions(e,t)}));var l=t.plane.bpmnElement.id;s.setRootElement(s.findRoot(l+"_plane")||s.findRoot(l))}return new Promise((function(c,p){try{return r=e.get("bpmnImporter"),i=e.get("eventBus"),o=e.get("translate"),s=e.get("canvas"),i.fire("import.render.start",{definitions:t}),l(t,n),i.fire("import.render.complete",{error:undefined,warnings:a}),c({warnings:a})}catch(e){return e.warnings=a,p(e)}}))}function Di(e){var t=[];return v(e,(function(e){e&&(t.push(e),t=t.concat(Di(e.flowElements)))})),t}var Ni,Ri='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ji={verticalAlign:"middle"},Ii={color:"#404040"},Li={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},zi={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Bi={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},$i='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ri+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>';function qi(){Ni||(X(Ni=ye($i),Li),X(ve("svg",Ni),ji),X(ve(".backdrop",Ni),zi),X(ve(".notice",Ni),Bi),X(ve(".link",Ni),Ii,{margin:"15px 20px 15px 10px",alignSelf:"center"}),de.bind(Ni,".backdrop","click",(function(e){document.body.removeChild(Ni)}))),document.body.appendChild(Ni)}function Fi(e){e=L({},Hi,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),function(e){const t=ye('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ri+"</a>");X(ve("svg",t),ji),X(t,Ii,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(t),pe.bind(t,"click",(function(e){qi(),e.preventDefault()}))}(this._container),this._init(this._container,this._moddle,e)}function Vi(e,t){return e.warnings=t,e}e(Fi,or),Fi.prototype.importXML=async function(e,t){const n=this;let r=[];try{let o;e=this._emit("import.parse.start",{xml:e})||e;try{o=await this._moddle.fromXML(e,"bpmn:Definitions")}catch(e){throw this._emit("import.parse.complete",{error:e}),e}let s=o.rootElement;const a=o.references,l=o.warnings,c=o.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",(i={error:null,definitions:s,elementsById:c,references:a,warnings:r},n.get("eventBus").createEvent(i)))||s;const p=await this.importDefinitions(s,t);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(e){let t=e;throw r=r.concat(t.warnings||[]),Vi(t,r),t=function(e){const 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}(t),this._emit("import.done",{error:t,warnings:t.warnings}),t}var i},Fi.prototype.importDefinitions=async function(e,t){this._setDefinitions(e);return{warnings:(await this.open(t)).warnings}},Fi.prototype.open=async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw Vi(e,[]),e}if("string"==typeof e&&(n=function(e,t){if(!t)return null;return m(e.diagrams,(function(e){return e.id===t}))||null}(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw Vi(t,[]),t}try{this.clear()}catch(e){throw Vi(e,[]),e}const{warnings:r}=await Ai(this,t,n);return{warnings:r}},Fi.prototype.saveXML=async function(e){e=e||{};let t,n,r=this._definitions;try{if(!r)throw new Error("no definitions loaded");r=this._emit("saveXML.start",{definitions:r})||r;n=(await this._moddle.toXML(r,e)).xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(e){t=e}const i=t?{error:t}:{xml:n};if(this._emit("saveXML.done",i),t)throw t;return i},Fi.prototype.saveSVG=async function(){let e,t;this._emit("saveSVG.start");try{const t=this.get("canvas"),n=t.getActiveLayer(),r=ve("defs",t._svg),i=Ge(n),o=r?"<defs>"+Ge(r)+"</defs>":"",s=n.getBBox();e='<?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="'+s.width+'" height="'+s.height+'" viewBox="'+s.x+" "+s.y+" "+s.width+" "+s.height+'" version="1.1">'+o+i+"</svg>"}catch(e){t=e}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}},Fi.prototype._setDefinitions=function(e){this._definitions=e},Fi.prototype.getModules=function(){return this._modules},Fi.prototype.clear=function(){this.getDefinitions()&&or.prototype.clear.call(this)},Fi.prototype.destroy=function(){or.prototype.destroy.call(this),we(this._container)},Fi.prototype.on=function(e,t,n,r){return this.get("eventBus").on(e,t,n,r)},Fi.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Fi.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()},Fi.prototype.getDefinitions=function(){return this._definitions},Fi.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Fi.prototype._init=function(e,t,n){const r=n.modules||this.getModules(n),i=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],r,i),s=L(q(n,["additionalModules"]),{canvas:L({},n.canvas,{container:e}),modules:o});or.call(this,s),n&&n.container&&this.attachTo(n.container)},Fi.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Fi.prototype._createContainer=function(e){const t=ye('<div class="bjs-container"></div>');return X(t,{width:Ui(e.width),height:Ui(e.height),position:e.position}),t},Fi.prototype._createModdle=function(e){return new xi(L({},this._moddleExtensions,e.moddleExtensions))},Fi.prototype._modules=[];const Hi={width:"100%",height:"100%",position:"relative"};function Ui(e){return e+(u(e)?"px":"")}function Wi(e){Fi.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 Gi(e,t){return!Si(e,"bpmn:CallActivity")&&(Si(e,"bpmn:SubProcess")?!(!(t=t||Mi(e))||!Si(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!Si(e,"bpmn:Participant")||!!Ti(e).processRef)}function Qi(e){if(Si(e,"bpmn:Participant")||Si(e,"bpmn:Lane")){var t=Mi(e).isHorizontal;return void 0===t||t}}function Xi(e){return e&&!1!==Ti(e).isInterrupting}function Zi(e){return e&&!!Ti(e).triggeredByEvent}function Yi(e,t){return _(Ti(e).eventDefinitions,(function(e){return Si(e,t)}))}e(Wi,Fi),Wi.prototype._createModdle=function(e){var t=Fi.prototype._createModdle.call(this,e);return t.ids=new n([32,36,1]),t},Wi.prototype._collectIds=function(e,t){var n,r=e.$model.ids;for(n in r.clear(),t)r.claim(n,t[n])};var Ki={width:90,height:20},Ji=15;function eo(e){return Si(e,"bpmn:Event")||Si(e,"bpmn:Gateway")||Si(e,"bpmn:DataStoreReference")||Si(e,"bpmn:DataObjectReference")||Si(e,"bpmn:DataInput")||Si(e,"bpmn:DataOutput")||Si(e,"bpmn:SequenceFlow")||Si(e,"bpmn:MessageFlow")||Si(e,"bpmn:Group")}function to(e){return gn(e.label)}function no(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)),s=i.x,a=i.y;return Math.abs(o)<Math.PI/2?a-=Ji:s+=Ji,{x:s,y:a}}function ro(e){return e.waypoints?no(e.waypoints):Si(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ki.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ki.height/2}}function io(e){return Si(e,"bpmn:FlowElement")||Si(e,"bpmn:Participant")||Si(e,"bpmn:Lane")||Si(e,"bpmn:SequenceFlow")||Si(e,"bpmn:MessageFlow")||Si(e,"bpmn:DataInput")||Si(e,"bpmn:DataOutput")?"name":Si(e,"bpmn:TextAnnotation")?"text":Si(e,"bpmn:Group")?"categoryValueRef":void 0}function oo(e){var t=e.businessObject,n=io(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function so(e,t){var n=e.businessObject,r=io(n);return r&&("categoryValueRef"===r?n.categoryValueRef.value=t:n[r]=t),e}var ao="hsl(225, 10%, 15%)",lo="white";function co(e,t){return _(e.eventDefinitions,(function(e){return e.$type===t}))}function po(e,t,n){var r=Mi(e);return n||r.get("color:background-color")||r.get("bioc:fill")||t||lo}function uo(e,t,n){var r=Mi(e);return n||r.get("color:border-color")||r.get("bioc:stroke")||t||ao}function ho(e,t,n,r){var i=Mi(e).get("label");return r||i&&i.get("color:color")||t||uo(e,n)}function fo(e,t={}){return{width:mo(e,t),height:go(e,t)}}function mo(e,t={}){return f(t,"width")?t.width:e.width}function go(e,t={}){return f(t,"height")?t.height:e.height}var yo=new n,vo=.95;function bo(e,t,n,r,i,o,s){at.call(this,t,s);var a=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,u=yo.next(),h={};function d(e){return n.computeStyle(e,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ao,strokeWidth:2,fill:"white"})}function f(e){return n.computeStyle(e,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ao,strokeWidth:2})}function m(e,t){var{ref:n={x:0,y:0},scale:r=1,element:o}=t,s=Ie("marker",{id:e,viewBox:"0 0 20 20",refX:n.x,refY:n.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});_e(s,o);var a=ve("defs",i._svg);a||(a=Ie("defs"),_e(i._svg,a)),_e(a,s),h[e]=s}function g(e){return e.replace(/[^0-9a-zA-Z]+/g,"_")}function y(e,t,n){var r=e+"-"+g(t)+"-"+g(n)+"-"+u;return h[r]||function(e,t,n,r){if("sequenceflow-end"===t){m(e,{element:Ie("path",{d:"M 1 5 L 11 10 L 1 15 Z",...d({fill:r,stroke:r,strokeWidth:1})}),ref:{x:11,y:10},scale:.5})}if("messageflow-start"===t){m(e,{element:Ie("circle",{cx:6,cy:6,r:3.5,...d({fill:n,stroke:r,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6}})}if("messageflow-end"===t){m(e,{element:Ie("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...d({fill:n,stroke:r,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5}})}if("association-start"===t){m(e,{element:Ie("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:r,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5})}if("association-end"===t){m(e,{element:Ie("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:r,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5})}if("conditional-flow-marker"===t){m(e,{element:Ie("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...d({fill:n,stroke:r})}),ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){m(e,{element:Ie("path",{d:"M 6 4 L 10 16",...d({stroke:r})}),ref:{x:0,y:10},scale:.5})}}(r,e,t,n),"url(#"+r+")"}function b(e,t,n,r,i={}){p(r)&&(i=r,r=0),r=r||0,i=d(i);var o=Ie("circle",{cx:t/2,cy:n/2,r:Math.round((t+n)/4-r),...i});return _e(e,o),o}function w(e,t,n,r,i,o){p(i)&&(o=i,i=0),i=i||0,o=d(o);var s=Ie("rect",{x:i,y:i,width:t-2*i,height:n-2*i,rx:r,ry:r,...o});return _e(e,s),s}function x(e,t,n,r){var i=dt(t,n=f(n),r);return _e(e,i),i}function _(e,t,n){return x(e,t,n,5)}function k(e,t,n){n=f(n);var r=Ie("path",{...n,d:t});return _e(e,r),r}function E(e,t,n,r){return k(t,n,L({"data-marker":e},r))}function O(e){return te[e]}function P(e){return function(t,n,r){return O(e)(t,n,r)}}var S=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:i?po(t,a,n.fill):uo(t,l,n.stroke),strokeWidth:1})},C=function(e,t,n={}){var i=b(e,t.width,t.height,.2*t.height,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:2});k(e,r.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{stroke:uo(t,l,n.stroke),strokeWidth:2});for(var o=0;o<12;o++){var s=r.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),c=t.width/2,p=t.height/2;k(e,s,{strokeWidth:1,stroke:uo(t,l,n.stroke),transform:"rotate("+30*o+","+p+","+c+")"})}return i},T=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},M=function(e,t,n={}){return k(e,r.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},A=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},D=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},N=function(e,t,n={},i){var o=k(e,r.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{fill:i?uo(t,l,n.stroke):"none",stroke:uo(t,l,n.stroke),strokeWidth:1});return er(o,45),o},R=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},j=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?uo(t,l,n.stroke):po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},I=function(e,t,n={},i){return k(e,r.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{fill:i?uo(t,l,n.stroke):po(t,a,n.fill),strokeWidth:1})},z=function(e,t,n={}){return k(e,r.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1})},B=function(e,t,n={}){return b(e,t.width,t.height,8,{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:4})};function $(e,t,n={}){var r=Ti(e),i=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(r);return r.get("eventDefinitions")&&r.get("eventDefinitions").length>1?r.get("parallelMultiple")?z(t,e,n,i):I(t,e,n,i):co(r,"bpmn:MessageEventDefinition")?S(t,e,n,i):co(r,"bpmn:TimerEventDefinition")?C(t,e,n,i):co(r,"bpmn:ConditionalEventDefinition")?M(t,e,n,i):co(r,"bpmn:SignalEventDefinition")?j(t,e,n,i):co(r,"bpmn:EscalationEventDefinition")?T(t,e,n,i):co(r,"bpmn:LinkEventDefinition")?A(t,e,n,i):co(r,"bpmn:ErrorEventDefinition")?D(t,e,n,i):co(r,"bpmn:CancelEventDefinition")?N(t,e,n,i):co(r,"bpmn:CompensateEventDefinition")?R(t,e,n,i):co(r,"bpmn:TerminateEventDefinition")?B(t,e,n,i):null}var q={ParticipantMultiplicityMarker:function(e,t,n={}){var i=mo(t,n),o=go(t,n);E("participant-multiplicity",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2-6)/i,my:(o-15)/o}}),{strokeWidth:2,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},SubProcessMarker:function(e,t,n={}){Jn(w(e,14,14,0,{strokeWidth:1,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)}),t.width/2-7.5,t.height-20),E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},ParallelMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("parallel",e,r.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.parallel)/i,my:(o-20)/o}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},SequentialMarker:function(e,t,n){E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},CompensationMarker:function(e,t,n){E("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:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})},LoopMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("loop",e,r.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.loop)/i,my:(o-7)/o}}),{strokeWidth:1.5,fill:"none",stroke:uo(t,l,n.stroke),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var i=mo(t,n),o=go(t,n);E("adhoc",e,r.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:(i/2+n.adhoc)/i,my:(o-15)/o}}),{strokeWidth:1,fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke)})}};function F(e,t,n,r){q[e](t,n,r)}function V(e,t,n,r={}){r={fill:r.fill,stroke:r.stroke,width:mo(t,r),height:go(t,r)};var i=Ti(t),o=n&&n.includes("SubProcessMarker");r=o?{...r,seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{...r,seq:-5,parallel:-6,compensation:-27,loop:0,adhoc:10},v(n,(function(n){F(n,e,t,r)})),i.get("isForCompensation")&&F("CompensationMarker",e,t,r),Si(i,"bpmn:AdHocSubProcess")&&F("AdhocMarker",e,t,r);var s=i.get("loopCharacteristics"),a=s&&s.get("isSequential");s&&(void 0===a&&F("LoopMarker",e,t,r),!1===a&&F("ParallelMarker",e,t,r),!0===a&&F("SequentialMarker",e,t,r))}function H(e,t,n={}){n=L({size:{width:100}},n);var r=o.createText(t||"",n);return Ce(r).add("djs-label"),_e(e,r),r}function U(e,t,n,r={}){var i=Ti(t),o=fo({x:t.x,y:t.y,width:t.width,height:t.height},r);return H(e,i.name,{align:n,box:o,padding:7,style:{fill:ho(t,c,l,r.stroke)}})}function W(e,t,n,r={}){var i=Qi(n),o=H(e,t,{box:{height:30,width:i?go(n,r):mo(n,r)},align:"center-middle",style:{fill:ho(n,c,l,r.stroke)}});i&&Kn(o,0,-(-1*go(n,r)),270)}function G(e,t,n={}){var{width:r,height:i}=fo(t,n);return w(e,r,i,10,{...n,fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke)})}function Q(e,t,n={}){var r=Ti(t),i=po(t,a,n.fill),o=uo(t,l,n.stroke);return"One"!==r.get("associationDirection")&&"Both"!==r.get("associationDirection")||(n.markerEnd=y("association-end",i,o)),"Both"===r.get("associationDirection")&&(n.markerStart=y("association-start",i,o)),n=wo(n,["markerStart","markerEnd"]),_(e,t.waypoints,{...n,stroke:o,strokeDasharray:"0, 5"})}function X(e,t,n={}){var i=po(t,a,n.fill),o=uo(t,l,n.stroke),s=k(e,r.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:i,fillOpacity:vo,stroke:o});(function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection})(Ti(t))&&k(e,r.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.33,my:(t.height-18)/t.height}}),{strokeWidth:2,fill:i,stroke:o});return s}function Z(e,t,n={}){return b(e,t.width,t.height,{fillOpacity:vo,...n,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)})}function Y(e,t,n={}){return function(e,t,n,r){var i=t/2,o=n/2,s=[{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);var a=Ie("polygon",{...r,points:s});return _e(e,a),a}(e,t.width,t.height,{fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke)})}function K(e,t,n={}){var r=w(e,mo(t,n),go(t,n),0,{fill:po(t,a,n.fill),fillOpacity:n.fillOpacity||vo,stroke:uo(t,l,n.stroke),strokeWidth:1.5}),i=Ti(t);Si(i,"bpmn:Lane")&&W(e,i.get("name"),t,n);return r}function J(e,t,n={}){var r=G(e,t,n);Zi(t)&&Pe(r,{strokeDasharray:"0, 5.5",strokeWidth:2.5});var i=Gi(t);return U(e,t,i?"center-top":"center-middle",n),V(e,t,i?void 0:["SubProcessMarker"],n),r}function ee(e,t,n={}){var r=G(e,t,n);return U(e,t,"center-middle",n),V(e,t,void 0,n),r}var te=this.handlers={"bpmn:AdHocSubProcess":function(e,t,n={}){return J(e,t,n=Gi(t)?wo(n,["fill","stroke","width","height"]):wo(n,["fill","stroke"]))},"bpmn:Association":function(e,t,n={}){return Q(e,t,n=wo(n,["fill","stroke"]))},"bpmn:BoundaryEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Ti(t).get("cancelActivity");n={strokeWidth:1.5,fill:po(t,a,n.fill),fillOpacity:1,stroke:uo(t,l,n.stroke)},i||(n.strokeDasharray="6");var o=Z(e,t,n);return b(e,t.width,t.height,3,{...n,fill:"none"}),r&&$(t,e,n),o},"bpmn:BusinessRuleTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return Pe(k(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),Pe(k(e,r.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:CallActivity":function(e,t,n={}){return n=wo(n,["fill","stroke"]),J(e,t,{strokeWidth:5,...n})},"bpmn:ComplexGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:DataInput":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=r.getRawPath("DATA_ARROW"),o=X(e,t,n);return k(e,i,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1}),o},"bpmn:DataInputAssociation":function(e,t,n={}){return n=wo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",po(t,a,n.fill),uo(t,l,n.stroke))})},"bpmn:DataObject":function(e,t,n={}){return X(e,t,n=wo(n,["fill","stroke"]))},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=r.getRawPath("DATA_ARROW"),o=X(e,t,n);return k(e,i,{strokeWidth:1,fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke)}),o},"bpmn:DataOutputAssociation":function(e,t,n={}){return n=wo(n,["fill","stroke"]),Q(e,t,{...n,markerEnd:y("association-end",po(t,a,n.fill),uo(t,l,n.stroke))})},"bpmn:DataStoreReference":function(e,t,n={}){return n=wo(n,["fill","stroke"]),k(e,r.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{fill:po(t,a,n.fill),fillOpacity:vo,stroke:uo(t,l,n.stroke),strokeWidth:2})},"bpmn:EndEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Z(e,t,{...n,strokeWidth:4});return r&&$(t,e,n),i},"bpmn:EventBasedGateway":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=Ti(t),o=Y(e,t,n);b(e,t.width,t.height,.2*t.height,{fill:po(t,"none",n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1});var s=i.get("eventGatewayType"),a=!!i.get("instantiate");if("Parallel"===s){var c=r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});k(e,c,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1})}else"Exclusive"===s&&(a||b(e,t.width,t.height,.26*t.height,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1}),function(){var i=r.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});k(e,i,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:2})}());return o},"bpmn:ExclusiveGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"])),o=r.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Mi(t).get("isMarkerVisible")&&k(e,o,{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:Gateway":function(e,t,n={}){return Y(e,t,n=wo(n,["fill","stroke"]))},"bpmn:Group":function(e,t,n={}){return n=wo(n,["fill","stroke","width","height"]),w(e,t.width,t.height,10,{stroke:uo(t,l,n.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:mo(t,n),height:go(t,n)})},"bpmn:InclusiveGateway":function(e,t,n={}){var r=Y(e,t,n=wo(n,["fill","stroke"]));return b(e,t.width,t.height,.24*t.height,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:2.5}),r},"bpmn:IntermediateEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]);var i=Z(e,t,{...n,strokeWidth:1.5});return b(e,t.width,t.height,3,{fill:"none",stroke:uo(t,l,n.stroke),strokeWidth:1.5}),r&&$(t,e,n),i},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(e,t,n={}){return n=wo(n,["fill","stroke","width","height"]),K(e,t,{...n,fillOpacity:.25})},"bpmn:ManualTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),i},"bpmn:MessageFlow":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i=Ti(t),o=Mi(t),s=po(t,a,n.fill),c=uo(t,l,n.stroke),p=_(e,t.waypoints,{markerEnd:y("messageflow-end",s,c),markerStart:y("messageflow-start",s,c),stroke:c,strokeDasharray:"10, 11",strokeWidth:1.5});if(i.get("messageRef")){var u=p.getPointAtLength(p.getTotalLength()/2),h=r.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),d={strokeWidth:1};"initiating"===o.get("messageVisibleKind")?(d.fill=s,d.stroke=c):(d.fill=c,d.stroke=s);var f=k(e,h,d),m=H(e,i.get("messageRef").get("name"),{align:"center-top",fitBox:!0,style:{fill:c}}),g=f.getBBox(),v=m.getBBox();Kn(m,u.x-v.width/2,u.y+g.height/2+10,0)}return p},"bpmn:ParallelGateway":function(e,t,n={}){var i=Y(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:Participant":function(e,t,n={}){var r=K(e,t,n=wo(n,["fill","stroke","width","height"])),i=Gi(t),o=Qi(t),s=Ti(t),a=s.get("name");if(i){x(e,o?[{x:30,y:0},{x:30,y:go(t,n)}]:[{x:0,y:30},{x:mo(t,n),y:30}],{stroke:uo(t,l,n.stroke),strokeWidth:1.5}),W(e,a,t,n)}else{var p=fo(t,n);o||(p.height=mo(t,n),p.width=go(t,n));var u=H(e,a,{box:p,align:"center-middle",style:{fill:ho(t,c,l,n.stroke)}});if(!o)Kn(u,0,-(-1*go(t,n)),270)}return s.get("participantMultiplicity")&&F("ParticipantMultiplicityMarker",e,t,n),r},"bpmn:ReceiveTask":function(e,t,n={}){n=wo(n,["fill","stroke"]);var i,o=Ti(t),s=ee(e,t,n);return o.get("instantiate")?(b(e,28,28,4.4,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i=r.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):i=r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),k(e,i,{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),s},"bpmn:ScriptTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:SendTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{fill:uo(t,l,n.stroke),stroke:po(t,a,n.fill),strokeWidth:1}),i},"bpmn:SequenceFlow":function(e,t,n={}){n=wo(n,["fill","stroke"]);var r=po(t,a,n.fill),i=uo(t,l,n.stroke),o=_(e,t.waypoints,{markerEnd:y("sequenceflow-end",r,i),stroke:i}),s=Ti(t),{source:c}=t;if(c){var p=Ti(c);s.get("conditionExpression")&&Si(p,"bpmn:Activity")&&Pe(o,{markerStart:y("conditional-flow-marker",r,i)}),p.get("default")&&(Si(p,"bpmn:Gateway")||Si(p,"bpmn:Activity"))&&p.get("default")===s&&Pe(o,{markerStart:y("conditional-default-flow-marker",r,i)})}return o},"bpmn:ServiceTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return b(e,10,10,{fill:po(t,a,n.fill),stroke:"none",transform:"translate(6, 6)"}),k(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),b(e,10,10,{fill:po(t,a,n.fill),stroke:"none",transform:"translate(11, 10)"}),k(e,r.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:1}),i},"bpmn:StartEvent":function(e,t,n={}){var{renderIcon:r=!0}=n;n=wo(n,["fill","stroke"]),Ti(t).get("isInterrupting")||(n={...n,strokeDasharray:"6"});var i=Z(e,t,n);return r&&$(t,e,n),i},"bpmn:SubProcess":function(e,t,n={}){return J(e,t,n=Gi(t)?wo(n,["fill","stroke","width","height"]):wo(n,["fill","stroke"]))},"bpmn:Task":function(e,t,n={}){return ee(e,t,n=wo(n,["fill","stroke"]))},"bpmn:TextAnnotation":function(e,t,n={}){n=wo(n,["fill","stroke","width","height"]);var{width:i,height:o}=fo(t,n),s=w(e,i,o,0,0,{fill:"none",stroke:"none"});return k(e,r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i,containerHeight:o,position:{mx:0,my:0}}),{stroke:uo(t,l,n.stroke)}),H(e,Ti(t).get("text")||"",{align:"left-top",box:fo(t,n),padding:7,style:{fill:ho(t,c,l,n.stroke)}}),s},"bpmn:Transaction":function(e,t,r={}){r=Gi(t)?wo(r,["fill","stroke","width","height"]):wo(r,["fill","stroke"]);var i=J(e,t,{strokeWidth:1.5,...r}),o=n.style(["no-fill","no-events"],{stroke:uo(t,l,r.stroke),strokeWidth:1.5});return Gi(t)||(r={}),w(e,mo(t,r),go(t,r),7,3,o),i},"bpmn:UserTask":function(e,t,n={}){var i=ee(e,t,n=wo(n,["fill","stroke"]));return k(e,r.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),k(e,r.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{fill:po(t,a,n.fill),stroke:uo(t,l,n.stroke),strokeWidth:.5}),k(e,r.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{fill:uo(t,l,n.stroke),stroke:uo(t,l,n.stroke),strokeWidth:.5}),i},label:function(e,t,n={}){return function(e,t,n={}){var r={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return H(e,oo(t),{box:r,fitBox:!0,style:L({},o.getExternalStyle(),{fill:ho(t,c,l,n.stroke)})})}(e,t,n)}};this._drawPath=k,this._renderer=O}function wo(e,t=[]){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}e(bo,at),bo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],bo.prototype.canRender=function(e){return Si(e,"bpmn:BaseElement")},bo.prototype.drawShape=function(e,t,n={}){var{type:r}=t;return this._renderer(r)(e,t,n)},bo.prototype.drawConnection=function(e,t,n={}){var{type:r}=t;return this._renderer(r)(e,t,n)},bo.prototype.getShapePath=function(e){return Si(e,"bpmn:Event")?(n=(t=e).x+t.width/2,r=t.y+t.height/2,i=t.width/2,lt([["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"]])):Si(e,"bpmn:Activity")?function(e,t){var n=e.x,r=e.y,i=e.width,o=e.height;return lt([["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):Si(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return lt([["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 lt([["M",t,n],["l",r,0],["l",0,e.height],["l",-r,0],["z"]])}(e);var t,n,r,i};var xo=0,_o={width:150,height:50};function ko(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 Eo(e,t,n){for(var r,i=e.shift(),o=i;;){if((r=ko(o,n)).width=o?r.width:0," "===o||""===o||r.width<Math.round(t)||o.length<2)return Oo(e,o,i,r);o=So(o,r.width,t)}}function Oo(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}}var Po="";function So(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!==Po||i.pop();break}i.push(n),o+=n.length}var s=i[i.length-1];return s&&s===Po&&(i[i.length-1]="-"),i.join("")}(e,r);return i||(i=e.slice(0,Math.max(Math.round(r-1),1))),i}function Co(e){this._config=L({},{size:_o,padding:xo,style:{},align:"center-top"},e||{})}Co.prototype.createText=function(e,t){return this.layoutText(e,t).element},Co.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Co.prototype.layoutText=function(e,t){var n=L({},this._config.size,t.box),r=L({},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 p(e)?L({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),s=t.fitBox||!1,a=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(r),l=e.split(/\u00AD?\r?\n/),c=[],u=n.width-o.left-o.right,h=Ie("text");for(Pe(h,{x:0,y:0}),Pe(h,r),_e(function(){var e=document.getElementById("helper-svg");return e||(Pe(e=Ie("svg"),{id:"helper-svg"}),X(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),h);l.length;)c.push(Eo(l,u,h));"middle"===i.vertical&&(o.top=o.bottom=0);var d=w(c,(function(e,t,n){return e+(a||t.height)}),0)+o.top+o.bottom,f=w(c,(function(e,t,n){return t.width>e?t.width:e}),0),m=o.top;"middle"===i.vertical&&(m+=(n.height-d)/2),m-=(a||c[0].height)/4;var g=Ie("text");return Pe(g,r),v(c,(function(e){var t;switch(m+=a||e.height,i.horizontal){case"left":t=o.left;break;case"right":t=(s?f:u)-o.right-e.width;break;default:t=Math.max(((s?f:u)-e.width)/2+o.left,0)}var n=Ie("tspan");Pe(n,{x:t,y:m}),n.textContent=e.text,_e(g,n)})),Me(h),{dimensions:{width:f,height:d},element:g}};function To(e){var t=L({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,r=L({},t,{fontSize:n},e&&e.externalStyle||{}),i=new Co({style:t});this.getExternalLabelBounds=function(e,t){var n=i.getDimensions(t,{box:{width:90,height:30},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}}To.$inject=["config.textRenderer"];var Mo=/\{([^{}]+)\}/g,Ao=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Do={__init__:["bpmnRenderer"],bpmnRenderer:["type",bo],textRenderer:["type",To],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={};if(t.position){for(var s=t.containerHeight/i.height*t.yScaleFactor,a=t.containerWidth/i.width*t.xScaleFactor,l=0;l<i.heightElements.length;l++)o["y"+l]=i.heightElements[l]*s;for(var c=0;c<i.widthElements.length;c++)o["x"+c]=i.widthElements[c]*a}var p,u,h=(p=i.d,u={mx:n,my:r,e:o},String(p).replace(Mo,(function(e,t){return function(e,t,n){var r=n;return t.replace(Ao,(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,u)})));return h}}]};var No={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function Ro(e,t,n){return L({id:e.id,type:e.$type,businessObject:e,di:t},n)}function jo(e,t,n){var r=e.waypoint;return!r||r.length<2?[_n(t),_n(n)]:r.map((function(e){return{x:e.x,y:e.y}}))}function Io(e,t,n,r){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:_i(n),referenced:_i(t),property:r}))}function Lo(e,t,n,r,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=r,this._translate=i,this._textRenderer=o}Lo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Lo.prototype.add=function(e,t,n){var r,i,o,s=this._translate;if(Si(t,"bpmndi:BPMNPlane")){var a=Si(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};r=this._elementFactory.createRoot(Ro(e,t,a)),this._canvas.addRootElement(r)}else if(Si(t,"bpmndi:BPMNShape")){var l=!Gi(e,t),c=function(e){return Si(e,"bpmn:Group")}(e);i=n&&(n.hidden||n.collapsed);var p=t.bounds;r=this._elementFactory.createShape(Ro(e,t,{collapsed:l,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),Si(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,r),Si(e,"bpmn:Lane")&&(o=0),Si(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,_n(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(r,n,o)}else{if(!Si(t,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:_i(t),semantic:_i(e)}));var u=this._getSource(e),h=this._getTarget(e);i=n&&(n.hidden||n.collapsed),r=this._elementFactory.createConnection(Ro(e,t,{hidden:i,source:u,target:h,waypoints:jo(t,u,h)})),Si(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(r,n,o)}return eo(e)&&oo(r)&&this.addLabel(e,t,r),this._eventBus.fire("bpmnElement.added",{element:r}),r},Lo.prototype._attachBoundary=function(e,t){var n=this._translate,r=e.attachedToRef;if(!r)throw new Error(n("missing {semantic}#attachedToRef",{semantic:_i(e)}));var i=this._elementRegistry.get(r.id),o=i&&i.attachers;if(!i)throw Io(n,e,r,"attachedToRef");t.host=i,o||(i.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Lo.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(Ki.width,i.width),height:i.height},n={x:i.x+i.width/2,y:i.y+i.height/2}):(n=ro(t),r=Ki),L({x:n.x-r.width/2,y:n.y-r.height/2},r)}(t,n),(i=oo(n))&&(r=this._textRenderer.getExternalLabelBounds(r,i)),o=this._elementFactory.createLabel(Ro(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oo(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)},Lo.prototype._getConnectedElement=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?Io(o,e,r,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:_i(e),side:t}))},Lo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Lo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Lo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var zo={__depends__:[Do,{__depends__:[No],bpmnImporter:["type",Lo]}]};function Bo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function $o(e){return e.originalEvent||e.srcEvent}function qo(e){Bo(e),Bo($o(e))}function Fo(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 Vo(){return/mac/i.test(navigator.platform)}function Ho(e,t){return($o(e)||e).button===t}function Uo(e){return Ho(e,0)}function Wo(e){var t=$o(e)||e;return!!Uo(e)&&(Vo()?t.metaKey:t.ctrlKey)}function Go(e){var t=$o(e)||e;return Uo(e)&&t.shiftKey}function Qo(e){return!0}function Xo(e){return Uo(e)||function(e){return Ho(e,1)}(e)}function Zo(e,t,n){var r=this;function i(n,r,i){var o,s;(function(e,t){var n=l[e]||Uo;return!n(t)})(n,r)||(i?s=t.getGraphics(i):(o=r.delegateTarget||r.target)&&(s=o,i=t.get(s)),s&&i&&!1===e.fire(n,{element:i,gfx:s,originalEvent:r})&&(r.stopPropagation(),r.preventDefault()))}var o={};function s(e){return o[e]}var a={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":Qo,"element.mousedown":Xo,"element.mouseup":Xo,"element.click":Xo,"element.dblclick":Xo};var c="svg, .djs-element";function p(e,t,n,r){var s=o[n]=function(e){i(n,e)};r&&(l[n]=r),s.$delegate=de.bind(e,c,t,s)}function u(e,t,n){var r=s(n);r&&de.unbind(e,t,r.$delegate)}e.on("canvas.destroy",(function(e){!function(e){v(a,(function(t,n){u(e,n,t)}))}(e.svg)})),e.on("canvas.init",(function(e){!function(e){v(a,(function(t,n){p(e,n,t)}))}(e.svg)})),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 h=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),f={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:h,"no-move":m("djs-hit djs-hit-no-move")};function m(e,t){return t=L({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=f[t];if(!n)throw new Error("invalid hit type <"+t+">");return Pe(e,n),e}function y(e,t){_e(e,t)}this.removeHits=function(e){v(be(".djs-hit",e),Me)},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=dt(t);return g(n,"stroke"),y(e,n),n},this.createBoxHit=function(e,t,n){n=L({x:0,y:0},n);var r=Ie("rect");return g(r,t),Pe(r,n),y(e,r),r},this.updateDefaultHit=function(e,t){var n=ve(".djs-hit",t);if(n)return e.waypoints?ft(n,e.waypoints):Pe(n,{width:e.width,height:e.height}),n},this.fire=i,this.triggerMouseEvent=function(e,t,n){var r=a[e];if(!r)throw new Error("unmapped DOM event name <"+e+">");return i(r,t,n)},this.mouseHandler=s,this.registerEvent=p,this.unregisterEvent=u}Zo.$inject=["eventBus","elementRegistry","styles"];var Yo={__init__:["interactionEvents"],interactionEvents:["type",Zo]};function Ko(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Ie("rect");return Pe(t,L({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||_e(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||_e(n,o=i()),r.updateConnectionOutline(o,t)}))}Ko.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Pe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Ko.prototype.updateConnectionOutline=function(e,t){var n=wt(t);Pe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},Ko.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},Ko.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ko.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){h(n.getOutline)&&(t=t||n.getOutline(e))})),t},Ko.$inject=["eventBus","styles","elementRegistry"];var Jo={__init__:["outline"],outline:["type",Ko]};function es(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)}))}es.$inject=["eventBus","canvas"],es.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})}},es.prototype.get=function(){return this._selectedElements},es.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},es.prototype.select=function(e,t){var n=this._selectedElements,r=n.slice();c(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?v(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 ts="hover",ns="selected";function rs(e,t,n){this._canvas=e;var r=this;function i(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){i(e.element,ts)})),t.on("element.out",(function(e){o(e.element,ts)})),t.on("selection.changed",(function(e){var t=e.oldSelection,n=e.newSelection;v(t,(function(e){-1===n.indexOf(e)&&function(e){o(e,ns)}(e)})),v(n,(function(e){-1===t.indexOf(e)&&function(e){i(e,ns)}(e)})),r._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateSelectionOutline(n.get())}))}function is(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;c(o)?t.select(o):t.select(i.filter(os))}})),e.on("connect.end",500,(function(e){var n=e.context.connection;n&&t.select(n)})),e.on("shape.move.end",500,(function(e){var n=e.previousSelection||[],i=r.get(e.context.shape.id);m(n,(function(e){return i.id===e.id}))||t.select(i)})),e.on("element.click",(function(e){if(Uo(e)){var r=e.element;r===n.getRootElement()&&(r=null);var i=t.isSelected(r),o=t.get().length>1,s=Go(e);if(i&&o)return s?t.deselect(r):t.select(r);i?t.deselect(r):t.select(r,s)}}))}function os(e){return!e.hidden}rs.$inject=["canvas","eventBus","selection"],rs.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ae(t);var n=e.length>1;if(Ce(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(wt(e)),i=Ie("rect");Pe(i,L({rx:3},r)),Ce(i).add("djs-selection-outline"),_e(t,i)}},is.$inject=["eventBus","selection","canvas","elementRegistry"];var ss={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Yo,Jo],selection:["type",es],selectionVisuals:["type",rs],selectionBehavior:["type",is]};function as(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}as.prototype.next=function(){return this._prefix+ ++this._counter};var ls=new as("ov");function cs(e,t,n,r){this._eventBus=t,this._canvas=n,this._elementRegistry=r,this._ids=ls,this._overlayDefaults=L({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=function(e){var t=ye('<div class="djs-overlay-container" />');return X(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}(n.getContainer()),this._init()}function ps(e,t,n){X(e,{left:t+"px",top:n+"px"})}function us(e,t){e.style.display=!1===t?"none":""}function hs(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}cs.$inject=["config.overlays","eventBus","canvas","elementRegistry"],cs.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?y(t.overlays,M({type:e.type})):t.overlays.slice():[]}return e.type?y(this._overlays,M({type:e.type})):e.id?this._overlays[e.id]:null},cs.prototype.add=function(e,t,n){if(p(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var r=this._ids.next();return n=L({},this._overlayDefaults,n,{id:r,type:t,element:e,html:n.html}),this._addOverlay(n),r},cs.prototype.remove=function(e){var t=this.get(e)||[];c(t)||(t=[t]);var n=this;v(t,(function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(we(e.html),we(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)}}))},cs.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},cs.prototype.show=function(){us(this._overlayRoot)},cs.prototype.hide=function(){us(this._overlayRoot,!1)},cs.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ee(this._overlayRoot)},cs.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,r=t.x,i=t.y;if(t.waypoints){var o=wt(t);r=o.x,i=o.y}ps(n,r,i),Z(e.html,"data-container-id",t.id)},cs.prototype._updateOverlay=function(e){var t,n,r=e.position,i=e.htmlContainer,o=e.element,s=r.left,a=r.top;void 0!==r.right&&(t=o.waypoints?wt(o).width:o.width,s=-1*r.right+t);void 0!==r.bottom&&(n=o.waypoints?wt(o).height:o.height,a=-1*r.bottom+n);ps(i,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},cs.prototype._createOverlayContainer=function(e){var t=ye('<div class="djs-overlays" />');X(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},cs.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";hs(this._overlayRoot,n)},cs.prototype._getOverlayContainer=function(e,t){var n=m(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},cs.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)),d(o)&&(o=ye(o)),n=this._getOverlayContainer(i),X(t=ye('<div class="djs-overlay" data-overlay-id="'+r+'">'),{position:"absolute"}),t.appendChild(o),e.type&&K(t).add("djs-overlay-"+e.type),us(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())},cs.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,r=this._canvas.findRoot(e.element),i=n&&n.minZoom,o=n&&n.maxZoom,s=e.htmlContainer,l=!0;(r!==this._canvas.getRootElement()||n&&(a(i)&&i>t.scale||a(o)&&o<t.scale))&&(l=!1),us(s,l),this._updateOverlayScale(e,t)},cs.prototype._updateOverlayScale=function(e,t){var n,r,i,o=e.scale,s=e.htmlContainer,l="";!0!==o&&(!1===o?(n=1,r=1):(n=o.min,r=o.max),a(n)&&t.scale<n&&(i=(1/t.scale||1)*n),a(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),a(i)&&(l="scale("+i+","+i+")"),hs(s,l)},cs.prototype._updateOverlaysVisibilty=function(e){var t=this;v(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},cs.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;v(t.get({element:n}),(function(e){t.remove(e.id)}));var r=t._getOverlayContainer(n);if(r){we(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&&(v(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&&K(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 ds={__init__:["overlays"],overlays:["type",cs]};function fs(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(xt(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)}))}fs.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ms={__init__:["changeSupport"],changeSupport:["type",fs]};function gs(e){this._eventBus=e}function ys(e){return function(t,n,r,i,o){(h(t)||u(t))&&(o=i,i=r,r=n,n=t,t=null),this.on(t,e,n,r,i,o)}}function vs(e,t){t.invoke(gs,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)}))}gs.$inject=["eventBus"],gs.prototype.on=function(e,t,n,r,i,o){if((h(t)||u(t))&&(o=i,i=r,r=n,n=t,t=null),h(n)&&(o=i,i=r,r=n,n=1e3),p(i)&&(o=i,i=!1),!h(r))throw new Error("handlerFn must be a function");c(e)||(e=[e]);var s=this._eventBus;v(e,(function(e){var a=["commandStack",e,t].filter((function(e){return e})).join(".");s.on(a,n,i?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(r,o):r,o)}))},gs.prototype.canExecute=ys("canExecute"),gs.prototype.preExecute=ys("preExecute"),gs.prototype.preExecuted=ys("preExecuted"),gs.prototype.execute=ys("execute"),gs.prototype.executed=ys("executed"),gs.prototype.postExecute=ys("postExecute"),gs.prototype.postExecuted=ys("postExecuted"),gs.prototype.revert=ys("revert"),gs.prototype.reverted=ys("reverted"),e(vs,gs),vs.$inject=["canvas","injector"];var bs={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",vs]};function ws(e){return CSS.escape(e)}var xs={"&":"&","<":"<",">":">",'"':""","'":"'"};function _s(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return xs[e]}))}var ks="_plane";function Es(e){return function(e){return e.replace(new RegExp(ks+"$"),"")}(e.id)}function Os(e){var t=e.id;return Si(e,"bpmn:SubProcess")?Cs(t):t}function Ps(e){return Cs(e)}function Ss(e){return Si(Mi(e),"bpmndi:BPMNPlane")}function Cs(e){return e+ks}function Ts(e,t,n){var r=ye('<ul class="bjs-breadcrumbs"></ul>'),i=n.getContainer(),o=K(i);i.appendChild(r);var s=[];function a(e){e&&(s=function(e){for(var t=Ti(e),n=[],r=t;r;r=r.$parent)(Si(r,"bpmn:SubProcess")||Si(r,"bpmn:Process"))&&n.push(r);return n.reverse()}(e));var i=s.map((function(e){var r=_s(e.name||e.id),i=ye('<li><span class="bjs-crumb"><a title="'+r+'">'+r+"</a></span></li>"),o=n.findRoot(Os(e))||n.findRoot(e.id);if(!o&&Si(e,"bpmn:Process")){var s=t.find((function(t){var n=Ti(t);return n&&n.get("processRef")&&n.get("processRef")===e}));o=n.findRoot(s.id)}return i.addEventListener("click",(function(){n.setRootElement(o)})),i}));r.innerHTML="";var a=i.length>1;o.toggle("bjs-breadcrumbs-shown",a),i.forEach((function(e){r.appendChild(e)}))}e.on("element.changed",(function(e){var t=Ti(e.element);m(s,(function(e){return e===t}))&&a()})),e.on("root.set",(function(e){a(e.element)}))}function Ms(e,t){var n=null,r=new As;e.on("root.set",(function(e){var i=e.element,o=t.viewbox(),s=r.get(i);if(r.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=i,!Si(i,"bpmn:Collaboration")||s){s=s||{x:0,y:0,zoom:1};var a=(o.x-s.x)*o.scale,l=(o.y-s.y)*o.scale;0===a&&0===l||t.scroll({dx:a,dy:l}),s.zoom!==o.scale&&t.zoom(s.zoom,{x:0,y:0})}})),e.on("diagram.clear",(function(){r.clear(),n=null}))}function As(){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)}}Ts.$inject=["eventBus","elementRegistry","canvas"],Ms.$inject=["eventBus","canvas"];var Ds=180,Ns=160;function Rs(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 js(e){return Si(e,"bpmndi:BPMNDiagram")?e:js(e.$parent)}Rs.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)}))}},Rs.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;Si(i,"bpmn:SubProcess")&&!t.isExpanded&&n.push(i),function(e,t){var n=e.$parent;if(!Si(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Ci(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(i,e)&&r.push({diElement:t,parent:o})}}));var i=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t._createDiagram(e);t._processToDiagramMap[e.id]=n,i.push(n)}})),r.forEach((function(e){for(var r=e.diElement,i=e.parent;i&&-1===n.indexOf(i);)i=i.$parent;if(i){var o=t._processToDiagramMap[i.id];t._moveToDiPlane(r,o.plane)}})),i},Rs.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=bn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),wn(t)}(e),r=n.x-Ds,i=n.y-Ns;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)}))},Rs.prototype._moveToDiPlane=function(e,t){var n=js(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Rs.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},Rs.$inject=["eventBus","moddle"];var Is=250;function Ls(e,t,n,r){gs.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=r;var i=this;this.executed("shape.toggleCollapse",Is,(function(e){var t=e.shape;i._canDrillDown(t)?i._addOverlay(t):i._removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Is,(function(e){var t=e.shape;i._canDrillDown(t)?i._addOverlay(t):i._removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Is,(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"],Is,(function(e){var t=e.oldParent,n=e.newParent||e.parent,r=e.shape;i._canDrillDown(r)&&i._addOverlay(r),i._updateDrilldownOverlay(t),i._updateDrilldownOverlay(n),i._updateDrilldownOverlay(r)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return i._canDrillDown(e)})).map((function(e){i._addOverlay(e)}))}))}e(Ls,gs),Ls.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ls.prototype._canDrillDown=function(e){var t=this._canvas;return Si(e,"bpmn:SubProcess")&&t.findRoot(Os(e))},Ls.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ti(e),r=t.get({element:n.id,type:"drilldown"})[0];if(r){var i=n&&n.get("flowElements")&&n.get("flowElements").length;K(r.html).toggle("bjs-drilldown-empty",!i)}},Ls.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this._removeOverlay(e);var r=ye('<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(Os(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},Ls.prototype._removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},Ls.$inject=["canvas","eventBus","elementRegistry","overlays"];var zs={__depends__:[ds,ms,bs],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Ts],drilldownCentering:["type",Ms],drilldownOverlayBehavior:["type",Ls],subprocessCompatibility:["type",Rs]};function Bs(e){Fi.call(this,e)}e(Bs,Fi),Bs.prototype._modules=[zo,No,ss,ds,zs],Bs.prototype._moddleExtensions={};var $s=["c","C"],qs=["v","V"],Fs=["y","Y"],Vs=["z","Z"];function Hs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Us(e,t){return-1!==(e=c(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Ws(e){return e.shiftKey}function Gs(e){return Hs(e)&&!Ws(e)&&Us(Vs,e)}function Qs(e){return Hs(e)&&(Us(Fs,e)||Us(Vs,e)&&Ws(e))}var Xs="keyboard.keydown",Zs="input-handle-modified-keys";function Ys(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()}))}Ys.$inject=["config.keyboard","eventBus"],Ys.prototype._keydownHandler=function(e){this._keyHandler(e,Xs)},Ys.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Ys.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Xs,n)&&e.preventDefault()}},Ys.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||((t=e.target)&&(te(t,"input, textarea")||"true"===t.contentEditable)||function(e){return e&&te(e,"button, input[type=submit], input[type=button], a[href], [aria-role=button]")}(e.target)&&Us([" ","Enter"],e))&&this._isModifiedKeyIgnored(e);var t},Ys.prototype._isModifiedKeyIgnored=function(e){return!Hs(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Ys.prototype._getAllowedModifiers=function(e){var t=ne(e,"["+Zs+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Zs).split(",")},Ys.prototype.bind=function(e){this.unbind(),this._node=e,pe.bind(e,"keydown",this._keydownHandler),pe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ys.prototype.getBinding=function(){return this._node},Ys.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),pe.unbind(e,"keydown",this._keydownHandler),pe.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ys.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ys.prototype.addListener=function(e,t,n){h(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Xs,e,t)},Ys.prototype.removeListener=function(e,t){this._eventBus.off(t||Xs,e)},Ys.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Ys.prototype.isCmd=Hs,Ys.prototype.isShift=Ws,Ys.prototype.isKey=Us;var Ks=500;function Js(e,t){var n=this;e.on("editorActions.init",Ks,(function(e){var r=e.editorActions;n.registerBindings(t,r)}))}Js.$inject=["eventBus","keyboard"],Js.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n("undo",(function(e){if(Gs(e.keyEvent))return t.trigger("undo"),!0})),n("redo",(function(e){if(Qs(e.keyEvent))return t.trigger("redo"),!0})),n("copy",(function(e){if(function(e){return Hs(e)&&Us($s,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return Hs(e)&&Us(qs,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Us(["+","Add","="],n)&&Hs(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Us(["-","Subtract"],n)&&Hs(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Us("0",n)&&Hs(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Us(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var ea={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ys],keyboardBindings:["type",Js]},ta={moveSpeed:50,moveSpeedAccelerated:200};function na(e,t,n){var r=this;this._config=L({},ta,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,s=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:s,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})}}na.$inject=["config.keyboardMove","keyboard","canvas"];var ra={__depends__:[ea],__init__:["keyboardMove"],keyboardMove:["type",na]},ia=/^djs-cursor-.*$/;function oa(e){var t=K(document.body);t.removeMatching(ia),e&&t.add("djs-cursor-"+e)}function sa(){oa(null)}var aa=5e3;function la(e,t){function n(){return!1}return t=t||"element.click",e.once(t,aa,n),function(){e.off(t,n)}}function ca(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pa(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ua(e,t){var n;function r(r){var i,o=n.start,s=n.button,a=Fo(r),l=pa(a,o);(!n.dragging&&(i=l,Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))>15)&&(n.dragging=!0,0===s&&la(e),oa("grab")),n.dragging)&&(l=pa(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);r.preventDefault()}function i(e){pe.unbind(document,"mousemove",r),pe.unbind(document,"mouseup",i),n=null,sa()}e.on("element.mousedown",500,(function(e){return function(e){if(ne(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:Fo(e)},pe.bind(document,"mousemove",r),pe.bind(document,"mouseup",i),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}ua.$inject=["eventBus","canvas"];var ha={__init__:["moveCanvas"],moveCanvas:["type",ua]};function da(e){return Math.log(e)/Math.log(10)}function fa(e,t){var n=da(e.min),r=da(e.max);return(Math.abs(n)+Math.abs(r))/t}var ma=Math.sign||function(e){return e>=0?1:-1},ga={min:.2,max:4};function ya(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=I(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)}))}ya.$inject=["config.zoomScroll","eventBus","canvas"],ya.prototype.scroll=function(e){this._canvas.scroll(e)},ya.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ya.prototype.zoom=function(e,t){var n=fa(ga,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},ya.prototype._handleWheel=function(e){if(!ne(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,r=e.ctrlKey||Vo()&&e.metaKey,i=e.shiftKey,o=-1*this._scale;if(o*=r?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,r){var s=t.getBoundingClientRect(),a={x:e.clientX-s.left,y:e.clientY-s.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*ma(e.deltaY)*o,this.zoom(n,a)}else n=i?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},ya.prototype.stepZoom=function(e,t){var n=fa(ga,10);this._zoom(e,t,n)},ya.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,o=da(r.zoom()),s=Math.round(o/n)*n;s+=n*i;var a,l,c=Math.pow(10,s);r.zoom((a=ga,l=c,Math.max(a.min,Math.min(a.max,l))),t)},ya.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return void 0===e&&(e=!r),r!==e&&pe[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},ya.prototype._init=function(e){this.toggle(e)};var va={__init__:["zoomScroll"],zoomScroll:["type",ya]};function ba(e){Bs.call(this,e)}function wa(e){return e&&e[e.length-1]}function xa(e){return e.y}function _a(e){return e.x}e(ba,Bs),ba.prototype._navigationModules=[ra,ha,va],ba.prototype._modules=[].concat(Bs.prototype._modules,ba.prototype._navigationModules);var ka={left:_a,center:_a,right:function(e){return e.x+e.width},top:xa,middle:xa,bottom:function(e){return e.y+e.height}};function Ea(e,t){this._modeling=e,this._rules=t}Ea.$inject=["modeling","rules"],Ea.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Ea.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Ea.prototype._alignmentPosition=function(e,t){var n,r,i,o=this._getOrientationDetails(e),s=o.axis,a=o.dimension,l={},c={},p=!1;if(this._isType(e,["left","top"]))l[e]=t[0][s];else if(this._isType(e,["right","bottom"]))i=wa(t),l[e]=i[s]+i[a];else if(this._isType(e,["center","middle"])){if(v(t,(function(e){var t=e[s]+Math.round(e[a]/2);c[t]?c[t].elements.push(e):c[t]={elements:[e],center:t}})),n=T(c,(function(e){return e.elements.length>1&&(p=!0),e.elements.length})),p)return l[e]=wa(n).center,l;r=t[0],i=wa(t=T(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(r,i)}return l},Ea.prototype.trigger=function(e,t){var n,r=this._modeling,i=y(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(c(n=this._rules.allowed("elements.align",{elements:i}))&&(i=n),!(i.length<2)&&n){var o=T(i,ka[t]),s=this._alignmentPosition(t,o);r.alignElements(o,s)}};var Oa={__init__:["alignElements"],alignElements:["type",Ea]},Pa=".entry";function Sa(e,t,n,r){this._canvas=e,this._eventBus=n,this._overlays=r;var i=a(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:i},this._current=null,this._init()}function Ca(e,t){return-1!==e.indexOf(t)}Sa.$inject=["canvas","config.contextPad","eventBus","overlays"],Sa.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,r=n.length?1===n.length?n[0]:n:null;r?e.open(r,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,r=e._current;if(r){var i=r.target;_(c(i)?i:[i],(function(e){return Ca(n,e)}))&&e.open(i,!0)}}))},Sa.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},Sa.prototype.getEntries=function(e){var t=this._getProviders(),n=c(e)?"getMultiElementContextPadEntries":"getContextPadEntries",r={};return v(t,(function(t){if(h(t[n])){var i=t[n](e);h(i)?r=i(r):v(i,(function(e,t){r[t]=e}))}})),r},Sa.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Z(o,"data-action"),i=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(r,"hover",i,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(r,e,i,n)):t.preventDefault()},Sa.prototype.triggerEntry=function(e,t,n,r){if(this.isShown()){var i=this._current.target,o=this._current.entries[e];if(o){var s=o.action;if(!1!==this._eventBus.fire("contextPad.trigger",{entry:o,event:n})){if(h(s)){if("click"===t)return s(n,i,r)}else if(s[t])return s[t](n,i,r);n.preventDefault()}}}},Sa.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Sa.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Sa.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),r=this.getPad(e),i=r.html;v(n,(function(e,n){var r,o=e.group||"default",s=ye(e.html||'<div class="entry" draggable="true"></div>');Z(s,"data-action",n),(r=ve("[data-group="+ws(o)+"]",i))||(Z(r=ye('<div class="group"></div>'),"data-group",o),i.appendChild(r)),r.appendChild(s),e.className&&function(e,t){var n=K(e);t=c(t)?t:t.split(/\s+/g),t.forEach((function(e){n.add(e)}))}(s,e.className),e.title&&Z(s,"title",e.title),e.imageUrl&&(Z(t=ye("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),K(i).add("open"),this._current={target:e,entries:n,pad:r},this._eventBus.fire("contextPad.open",{current:this._current})},Sa.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,r=ye('<div class="djs-context-pad"></div>'),i=this._getPosition(e),o=L({html:r},this._overlaysConfig,i);de.bind(r,Pa,"click",(function(e){t.trigger("click",e)})),de.bind(r,Pa,"dragstart",(function(e){t.trigger("dragstart",e)})),de.bind(r,Pa,"mouseover",(function(e){t.trigger("mouseover",e)})),de.bind(r,Pa,"mouseout",(function(e){t.trigger("mouseout",e)})),pe.bind(r,"mousedown",(function(e){e.stopPropagation()}));var s=this._canvas.getRootElement();this._overlayId=n.add(s,"context-pad",o);var a=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{target:e,pad:a}),a},Sa.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Sa.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return c(e)===c(n)&&(c(e)?e.length===n.length&&x(e,(function(e){return Ca(n,e)})):n===e)},Sa.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},Sa.prototype._getPosition=function(e){var t,n=wt(c(e=mn(e)?(t=e).waypoints[t.waypoints.length-1]:e)?e:[e]);return{position:{left:n.x+n.width+12,top:n.y-6}}};var Ta,Ma,Aa,Da,Na,Ra,ja={__depends__:[Yo,ds],contextPad:["type",Sa]},Ia={},La=[],za=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Ba(e,t){for(var n in t)e[n]=t[n];return e}function $a(e){var t=e.parentNode;t&&t.removeChild(e)}function qa(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ta.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return Fa(e,s,r,i,null)}function Fa(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?++Aa:i};return null==i&&null!=Ma.vnode&&Ma.vnode(o),o}function Va(e){return e.children}function Ha(e,t){this.props=e,this.context=t}function Ua(e,t){if(null==t)return e.__?Ua(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?Ua(e):null}function Wa(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 Wa(e)}}function Ga(e){(!e.__d&&(e.__d=!0)&&Da.push(e)&&!Qa.__r++||Na!==Ma.debounceRendering)&&((Na=Ma.debounceRendering)||setTimeout)(Qa)}function Qa(){for(var e;Qa.__r=Da.length;)e=Da.sort((function(e,t){return e.__v.__b-t.__v.__b})),Da=[],e.some((function(e){var t,n,r,i,o,s;e.__d&&(o=(i=(t=e).__v).__e,(s=t.__P)&&(n=[],(r=Ba({},i)).__v=i.__v+1,rl(s,i,r,t.__n,void 0!==s.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?Ua(i):o,i.__h),il(n,i),i.__e!=o&&Wa(i)))}))}function Xa(e,t,n,r,i,o,s,a,l,c){var p,u,h,d,f,m,g,y=r&&r.__k||La,v=y.length;for(n.__k=[],p=0;p<t.length;p++)if(null!=(d=n.__k[p]=null==(d=t[p])||"boolean"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?Fa(null,d,null,null,d):Array.isArray(d)?Fa(Va,{children:d},null,null,null):d.__b>0?Fa(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(h=y[p])||h&&d.key==h.key&&d.type===h.type)y[p]=void 0;else for(u=0;u<v;u++){if((h=y[u])&&d.key==h.key&&d.type===h.type){y[u]=void 0;break}h=null}rl(e,d,h=h||Ia,i,o,s,a,l,c),f=d.__e,(u=d.ref)&&h.ref!=u&&(g||(g=[]),h.ref&&g.push(h.ref,null,d),g.push(u,d.__c||f,d)),null!=f?(null==m&&(m=f),"function"==typeof d.type&&d.__k===h.__k?d.__d=l=Za(d,l,e):l=Ka(e,d,h,y,f,l),"function"==typeof n.type&&(n.__d=l)):l&&h.__e==l&&l.parentNode!=e&&(l=Ua(h))}for(n.__e=m,p=v;p--;)null!=y[p]&&sl(y[p],y[p]);if(g)for(p=0;p<g.length;p++)ol(g[p],g[++p],g[++p])}function Za(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t="function"==typeof r.type?Za(r,t,n):Ka(n,r,r,i,r.__e,t));return t}function Ya(e,t){return t=t||[],null==e||"boolean"==typeof e||(Array.isArray(e)?e.some((function(e){Ya(e,t)})):t.push(e)),t}function Ka(e,t,n,r,i,o){var s,a,l;if(void 0!==t.__d)s=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),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<r.length;l+=1)if(a==i)break e;e.insertBefore(i,o),s=o}return void 0!==s?s:i.nextSibling}function Ja(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||za.test(t)?n:n+"px"}function el(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||Ja(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Ja(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?nl:tl,o):e.removeEventListener(t,o?nl:tl,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&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,n))}}function tl(e){this.l[e.type+!1](Ma.event?Ma.event(e):e)}function nl(e){this.l[e.type+!0](Ma.event?Ma.event(e):e)}function rl(e,t,n,r,i,o,s,a,l){var c,p,u,h,d,f,m,g,y,v,b,w,x,_,k,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,o=[a]),(c=Ma.__b)&&c(t);try{e:if("function"==typeof E){if(g=t.props,y=(c=E.contextType)&&r[c.__c],v=c?y?y.props.value:c.__:r,n.__c?m=(p=t.__c=n.__c).__=p.__E:("prototype"in E&&E.prototype.render?t.__c=p=new E(g,v):(t.__c=p=new Ha(g,v),p.constructor=E,p.render=al),y&&y.sub(p),p.props=g,p.state||(p.state={}),p.context=v,p.__n=r,u=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Ba({},p.__s)),Ba(p.__s,E.getDerivedStateFromProps(g,p.__s))),h=p.props,d=p.state,u)null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==E.getDerivedStateFromProps&&g!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,v),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,v)||t.__v===n.__v){for(p.props=g,p.state=p.__s,t.__v!==n.__v&&(p.__d=!1),p.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<p._sb.length;b++)p.__h.push(p._sb[b]);p._sb=[],p.__h.length&&s.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,v),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(h,d,f)}))}if(p.context=v,p.props=g,p.__v=t,p.__P=e,w=Ma.__r,x=0,"prototype"in E&&E.prototype.render){for(p.state=p.__s,p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),_=0;_<p._sb.length;_++)p.__h.push(p._sb[_]);p._sb=[]}else do{p.__d=!1,w&&w(t),c=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++x<25);p.state=p.__s,null!=p.getChildContext&&(r=Ba(Ba({},r),p.getChildContext())),u||null==p.getSnapshotBeforeUpdate||(f=p.getSnapshotBeforeUpdate(h,d)),k=null!=c&&c.type===Va&&null==c.key?c.props.children:c,Xa(e,Array.isArray(k)?k:[k],t,n,r,i,o,s,a,l),p.base=t.__e,t.__h=null,p.__h.length&&s.push(p),m&&(p.__E=p.__=null),p.__e=!1}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a){var l,c,p,u=n.props,h=t.props,d=t.type,f=0;if("svg"===d&&(i=!0),null!=o)for(;f<o.length;f++)if((l=o[f])&&"setAttribute"in l==!!d&&(d?l.localName===d:3===l.nodeType)){e=l,o[f]=null;break}if(null==e){if(null===d)return document.createTextNode(h);e=i?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,h.is&&h),o=null,a=!1}if(null===d)u===h||a&&e.data===h||(e.data=h);else{if(o=o&&Ta.call(e.childNodes),c=(u=n.props||Ia).dangerouslySetInnerHTML,p=h.dangerouslySetInnerHTML,!a){if(null!=o)for(u={},f=0;f<e.attributes.length;f++)u[e.attributes[f].name]=e.attributes[f].value;(p||c)&&(p&&(c&&p.__html==c.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||el(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]||el(e,o,t[o],n[o],r)}(e,h,u,i,a),p)t.__k=[];else if(f=t.props.children,Xa(e,Array.isArray(f)?f:[f],t,n,r,i&&"foreignObject"!==d,o,s,o?o[0]:n.__k&&Ua(n,0),a),null!=o)for(f=o.length;f--;)null!=o[f]&&$a(o[f]);a||("value"in h&&void 0!==(f=h.value)&&(f!==e.value||"progress"===d&&!f||"option"===d&&f!==u.value)&&el(e,"value",f,u.value,!1),"checked"in h&&void 0!==(f=h.checked)&&f!==e.checked&&el(e,"checked",f,u.checked,!1))}return e}(n.__e,t,n,r,i,o,s,l);(c=Ma.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=o)&&(t.__e=a,t.__h=!!l,o[o.indexOf(a)]=null),Ma.__e(e,t,n)}}function il(e,t){Ma.__c&&Ma.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ma.__e(e,t.__v)}}))}function ol(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Ma.__e(e,n)}}function sl(e,t,n){var r,i;if(Ma.unmount&&Ma.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ol(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ma.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&sl(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||$a(e.__e),e.__=e.__e=e.__d=void 0}function al(e,t,n){return this.constructor(e,n)}function ll(e,t,n){var r,i,o;Ma.__&&Ma.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],rl(t,e=(!r&&n||t).__k=qa(Va,null,[e]),i||Ia,Ia,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Ta.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),il(o,e)}function cl(e,t){var n={__c:t="__cC"+Ra++,__: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(Ga)},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}Ta=La.slice,Ma={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},Aa=0,Ha.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Ba({},this.state),"function"==typeof e&&(e=e(Ba({},n),this.props)),e&&Ba(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ga(this))},Ha.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ga(this))},Ha.prototype.render=Va,Da=[],Qa.__r=0,Ra=0;var pl=function(e,t,n,r){var i;t[0]=0;for(var o=1;o<t.length;o++){var s=t[o++],a=t[o]?(t[0]|=s?1:2,n[t[o++]]):t[++o];3===s?r[0]=a:4===s?r[1]=Object.assign(r[1]||{},a):5===s?(r[1]=r[1]||{})[t[++o]]=a:6===s?r[1][t[++o]]+=a+"":s?(i=e.apply(a,pl(e,a,n,["",null])),r.push(i),a[0]?t[0]|=2:(t[o-2]=0,t[o]=i)):r.push(a)}return r},ul=new Map;var hl,dl,fl,ml,gl=function(e){var t=ul.get(this);return t||(t=new Map,ul.set(this,t)),(t=pl(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i="",o="",s=[0],a=function(e){1===r&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,i):3===r&&(e||i)?(s.push(3,e,i),r=2):2===r&&"..."===i&&e?s.push(4,e,0):2===r&&i&&!e?s.push(5,0,!0,i):r>=5&&((i||!e&&5===r)&&(s.push(r,0,i,n),r=6),e&&(s.push(r,e,0,n),r=6)),i=""},l=0;l<e.length;l++){l&&(1===r&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===r?"<"===t?(a(),s=[s],r=3):i+=t:4===r?"--"===i&&">"===t?(r=1,i=""):i=t+i[0]:o?t===o?o="":i+=t:'"'===t||"'"===t?o=t:">"===t?(a(),r=1):r&&("="===t?(r=5,n=i,i=""):"/"===t&&(r<5||">"===e[l][c+1])?(a(),3===r&&(s=s[0]),r=s,(s=s[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),r=2):i+=t),3===r&&"!--"===i&&(r=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(qa),yl=0,vl=[],bl=[],wl=Ma.__b,xl=Ma.__r,_l=Ma.diffed,kl=Ma.__c,El=Ma.unmount;function Ol(e,t){Ma.__h&&Ma.__h(dl,e,yl||t),yl=0;var n=dl.__H||(dl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:bl}),n.__[e]}function Pl(e){return yl=1,function(e,t,n){var r=Ol(hl++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Bl(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=dl,!dl.u)){dl.u=!0;var i=dl.shouldComponentUpdate;dl.shouldComponentUpdate=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))}}return r.__N||r.__}(Bl,e)}function Sl(e,t){var n=Ol(hl++,3);!Ma.__s&&zl(n.__H,t)&&(n.__=e,n.i=t,dl.__H.__h.push(n))}function Cl(e,t){var n=Ol(hl++,4);!Ma.__s&&zl(n.__H,t)&&(n.__=e,n.i=t,dl.__h.push(n))}function Tl(e){return yl=5,Ml((function(){return{current:e}}),[])}function Ml(e,t){var n=Ol(hl++,7);return zl(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Al(e,t){return yl=8,Ml((function(){return e}),t)}function Dl(e){var t=dl.context[e.__c],n=Ol(hl++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(dl)),t.props.value):e.__}function Nl(){for(var e;e=vl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Il),e.__H.__h.forEach(Ll),e.__H.__h=[]}catch(t){e.__H.__h=[],Ma.__e(t,e.__v)}}Ma.__b=function(e){dl=null,wl&&wl(e)},Ma.__r=function(e){xl&&xl(e),hl=0;var t=(dl=e.__c).__H;t&&(fl===dl?(t.__h=[],dl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=bl,e.__N=e.i=void 0}))):(t.__h.forEach(Il),t.__h.forEach(Ll),t.__h=[])),fl=dl},Ma.diffed=function(e){_l&&_l(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==vl.push(t)&&ml===Ma.requestAnimationFrame||((ml=Ma.requestAnimationFrame)||jl)(Nl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==bl&&(e.__=e.__V),e.i=void 0,e.__V=bl}))),fl=dl=null},Ma.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Il),e.__h=e.__h.filter((function(e){return!e.__||Ll(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Ma.__e(n,e.__v)}})),kl&&kl(e,t)},Ma.unmount=function(e){El&&El(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Il(e)}catch(e){t=e}})),n.__H=void 0,t&&Ma.__e(t,n.__v))};var Rl="function"==typeof requestAnimationFrame;function jl(e){var t,n=function(){clearTimeout(r),Rl&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Rl&&(t=requestAnimationFrame(n))}function Il(e){var t=dl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),dl=t}function Ll(e){var t=dl;e.__c=e.__(),dl=t}function zl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Bl(e,t){return"function"==typeof t?t(e):t}function $l(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=$l(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ql(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$l(e))&&(r&&(r+=" "),r+=t);return r}function Fl(e){const{entry:t,selected:n,onMouseEnter:r,onMouseLeave:i,onAction:o}=e;return gl`
|
|
2
2
|
<li
|
|
3
3
|
class=${ql("entry",{selected:n})}
|
|
4
4
|
data-id=${t.id}
|
|
5
5
|
title=${t.title||t.label}
|
|
6
|
+
tabIndex="0"
|
|
6
7
|
onClick=${o}
|
|
8
|
+
onFocus=${r}
|
|
9
|
+
onBlur=${i}
|
|
7
10
|
onMouseEnter=${r}
|
|
8
11
|
onMouseLeave=${i}
|
|
9
12
|
onDragStart=${e=>o(e,t,"dragstart")}
|
|
13
|
+
aria-role="button"
|
|
10
14
|
draggable=${!0}
|
|
11
15
|
>
|
|
12
16
|
<div class="djs-popup-entry-content">
|
|
@@ -68,34 +72,36 @@
|
|
|
68
72
|
</ul>
|
|
69
73
|
`))}
|
|
70
74
|
</div>
|
|
71
|
-
`}function Hl(e){const{onClose:t,onSelect:n,className:r,headerEntries:i,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,entries:d,onOpened:f,onClosed:m}=e,g=Ml((()=>!!a(p)&&d.length>5),[p,d]),y
|
|
75
|
+
`}function Hl(e){const{onClose:t,onSelect:n,className:r,headerEntries:i,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,entries:d,onOpened:f,onClosed:m}=e,g=Ml((()=>!!a(p)&&d.length>5),[p,d]),[y,v]=Pl(""),b=Al(((e,t)=>{if(!g)return e;return e.filter((e=>{if(!t)return(e.rank||0)>=0;if(!1===e.searchable)return!1;const n=[e.description||"",e.label||"",e.search||""].map((e=>e.toLowerCase()));return t.toLowerCase().split(/\s/g).every((e=>n.some((t=>t.includes(e)))))}))}),[g]),[w,x]=Pl(b(d,y)),[_,k]=Pl(w[0]),E=Al((e=>{_&&e.includes(_)||k(e[0]),x(e)}),[_,x,k]);Sl((()=>{E(b(d,y))}),[y,d]);const O=Al((e=>{let t=w.indexOf(_)+e;t<0&&(t=w.length-1),t>=w.length&&(t=0),k(w[t])}),[w,_,k]),P=Al((e=>"Enter"===e.key&&_?n(e,_):"ArrowUp"===e.key?(O(-1),e.preventDefault()):"ArrowDown"===e.key?(O(1),e.preventDefault()):void 0),[n,_,O]),S=Al((e=>{te(e.target,"input")&&v((()=>e.target.value))}),[v]);Sl((()=>(f(),()=>{m()})),[]);const C=Ml((()=>s||i.length>0),[s,i]);return gl`
|
|
72
76
|
<${Ul}
|
|
73
77
|
onClose=${t}
|
|
74
|
-
onKeyup=${
|
|
75
|
-
onKeydown=${
|
|
78
|
+
onKeyup=${S}
|
|
79
|
+
onKeydown=${P}
|
|
76
80
|
className=${r}
|
|
77
81
|
position=${o}
|
|
78
82
|
width=${l}
|
|
79
83
|
scale=${c}
|
|
80
84
|
>
|
|
81
|
-
${
|
|
85
|
+
${C&&gl`
|
|
82
86
|
<div class="djs-popup-header">
|
|
83
87
|
<h3 class="djs-popup-title" title=${s}>${s}</h3>
|
|
84
88
|
${i.map((e=>gl`
|
|
85
|
-
|
|
86
|
-
class=${function(e,t){return ql("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}(e,e===
|
|
89
|
+
<${e.action?"button":"span"}
|
|
90
|
+
class=${function(e,t){return ql("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}(e,e===_)}
|
|
87
91
|
onClick=${t=>n(t,e)}
|
|
88
92
|
title=${e.title||e.label}
|
|
89
93
|
data-id=${e.id}
|
|
90
|
-
onMouseEnter=${()=>
|
|
91
|
-
onMouseLeave=${()=>
|
|
94
|
+
onMouseEnter=${()=>k(e)}
|
|
95
|
+
onMouseLeave=${()=>k(null)}
|
|
96
|
+
onFocus=${()=>k(e)}
|
|
97
|
+
onBlur=${()=>k(null)}
|
|
92
98
|
>
|
|
93
99
|
${e.imageUrl&&gl`<img class="djs-popup-entry-icon" src=${e.imageUrl} alt="" />`||e.imageHtml&&gl`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:e.imageHtml}} />`}
|
|
94
100
|
|
|
95
101
|
${e.label?gl`
|
|
96
102
|
<span class="djs-popup-label">${e.label}</span>
|
|
97
103
|
`:null}
|
|
98
|
-
|
|
104
|
+
</${e.action?"button":"span"}>
|
|
99
105
|
`))}
|
|
100
106
|
</div>
|
|
101
107
|
`}
|
|
@@ -107,40 +113,32 @@
|
|
|
107
113
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
108
114
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
109
115
|
</svg>
|
|
110
|
-
<input
|
|
111
|
-
ref=${y}
|
|
112
|
-
type="text"
|
|
113
|
-
/>
|
|
116
|
+
<input type="text" aria-label="${s}" />
|
|
114
117
|
</div>
|
|
115
118
|
`}
|
|
116
119
|
|
|
117
120
|
<${Vl}
|
|
118
|
-
entries=${
|
|
119
|
-
selectedEntry=${
|
|
120
|
-
setSelectedEntry=${
|
|
121
|
+
entries=${w}
|
|
122
|
+
selectedEntry=${_}
|
|
123
|
+
setSelectedEntry=${k}
|
|
121
124
|
onAction=${n}
|
|
122
125
|
/>
|
|
123
126
|
</div>
|
|
124
|
-
${u&&0===x.length&&gl`
|
|
125
|
-
<div class="djs-popup-no-results">${h(u)?u(v):u}</div>
|
|
126
|
-
`}
|
|
127
127
|
`}
|
|
128
|
+
${u&&0===w.length&&gl`
|
|
129
|
+
<div class="djs-popup-no-results">${h(u)?u(y):u}</div>
|
|
130
|
+
`}
|
|
128
131
|
</${Ul}>
|
|
129
|
-
`}function Ul(e){const{onClose:t,onKeydown:n,onKeyup:r,className:i,children:o,position:s}=e,a=Tl()
|
|
132
|
+
`}function Ul(e){const{onClose:t,onKeydown:n,onKeyup:r,className:i,children:o,position:s}=e,a=Tl();return Cl((()=>{if("function"!=typeof s)return;const e=a.current,t=s(e);e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}),[a.current,s]),Cl((()=>{const e=a.current;if(!e)return;(e.querySelector("input")||e).focus()}),[]),Sl((()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),t()},n=e=>{if(!ne(e.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",e),document.body.addEventListener("click",n),()=>{document.documentElement.removeEventListener("keydown",e),document.body.removeEventListener("click",n)}}),[]),gl`
|
|
130
133
|
<div
|
|
131
|
-
class
|
|
132
|
-
|
|
134
|
+
class=${ql("djs-popup",i)}
|
|
135
|
+
style=${function(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`}}(e)}
|
|
136
|
+
onKeydown=${n}
|
|
137
|
+
onKeyup=${r}
|
|
138
|
+
ref=${a}
|
|
139
|
+
tabIndex="-1"
|
|
133
140
|
>
|
|
134
|
-
|
|
135
|
-
class=${ql("djs-popup",i)}
|
|
136
|
-
style=${function(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`}}(e)}
|
|
137
|
-
onKeydown=${n}
|
|
138
|
-
onKeyup=${r}
|
|
139
|
-
ref=${a}
|
|
140
|
-
tabIndex="-1"
|
|
141
|
-
>
|
|
142
|
-
${o}
|
|
143
|
-
</div>
|
|
141
|
+
${o}
|
|
144
142
|
</div>
|
|
145
143
|
`}var Wl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Gl(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var r=a(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:r},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this.refresh()}))}Gl.$inject=["config.popupMenu","eventBus","canvas"],Gl.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:r,emptyPlaceholder:i,options:o}=this._current,s=Object.entries(n).map((([e,t])=>({id:e,...t}))),a=Object.entries(r).map((([e,t])=>({id:e,...t}))),l=e&&(t=>this._ensureVisible(t,e)),c=this._updateScale(this._current.container);ll(gl`
|
|
146
144
|
<${Hl}
|
|
@@ -156,7 +154,7 @@
|
|
|
156
154
|
onClosed=${this._onClosed.bind(this)}
|
|
157
155
|
...${{...o}}
|
|
158
156
|
/>
|
|
159
|
-
`,this._current.container)},Gl.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Gl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Gl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Gl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Gl.prototype.reset=function(){const e=this._current.container;ll(null,e),we(e)},Gl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Gl.prototype._onOpened=function(){this._emit("opened")},Gl.prototype._onClosed=function(){this._emit("closed")},Gl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ye(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Gl.prototype._bindAutoClose=function(){this._eventBus.once(Wl,this.close,this)},Gl.prototype._unbindAutoClose=function(){this._eventBus.off(Wl,this.close,this)},Gl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Gl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Gl.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},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._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 v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);h(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Gl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);h(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Gl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>h(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Gl.prototype.isOpen=function(){return!!this._current},Gl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=Z(ne(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(h(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Gl.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Ql={__init__:["popupMenu"],popupMenu:["type",Gl]},Xl={align:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">\n <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Zl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Zl.$inject=["contextPad","popupMenu","translate","canvas"],Zl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Zl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Zl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Xl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);L(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Zl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Yl=["left","center","right","top","middle","bottom"];function Kl(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function Jl(e){gs.call(this,e),this.init()}function ec(e){Jl.call(this,e)}Kl.$inject=["popupMenu","alignElements","translate","rules"],Kl.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Kl.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(Yl,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Xl[o],action:function(){t.trigger(e,o),r.close()}}})),i},Jl.$inject=["eventBus"],e(Jl,gs),Jl.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)}))},Jl.prototype.init=function(){},ec.$inject=["eventBus"],e(ec,Jl),ec.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=mt(t)).length<2)&&t}))};var tc={__depends__:[Oa,ja,Ql],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Zl],alignElementsMenuProvider:["type",Kl],bpmnAlignElements:["type",ec]},nc=10,rc=50,ic=250;function oc(e,t,n,r){for(var i;i=ac(e,n,t);)n=r(t,n,i);return n}function sc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function ac(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=lc(e);e.host&&(t=t.concat(lc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(lc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===kn(e,r,nc)}))}function lc(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 cc(){return!0}function pc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||rc,i=_n(e),o=bn(e);return{x:o.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}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function uc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}pc.$inject=["eventBus","modeling","canvas"],uc.$inject=["eventBus","selection"];var hc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",pc],autoPlaceSelectionBehavior:["type",uc]};function dc(e,t){for(d(t)&&(t=[t]);e=e.parent;)if(Ci(e,t))return e;return null}function fc(e,t){return Si(t,"bpmn:TextAnnotation")?function(e,t){var n=bn(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};mn(e)&&((r=_n(e)).x+=100,r.y-=50);return oc(e,t,r,sc({y:{margin:-30,minDistance:20}}))}(e,t):Ci(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=bn(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return oc(e,t,r,sc({x:{margin:30,minDistance:30}}))}(e,t):Si(t,"bpmn:FlowNode")?function(e,t){var n=bn(e),r=_n(e),i=function(e,t){t||(t={});var n=t.defaultDistance||rc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||ic,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?bn(e).top-bn(t).bottom:"center"===a?bn(e).top-_n(t).y:bn(e).top-bn(t).top:"w"===r?"start"===a?bn(e).left-bn(t).right:"center"===a?bn(e).left-_n(t).x:bn(e).left-bn(t).left:"s"===r?"start"===a?bn(t).top-bn(e).bottom:"center"===a?_n(t).y-bn(e).bottom:bn(t).bottom-bn(e).bottom:"start"===a?bn(t).left-bn(e).right:"center"===a?_n(t).x-bn(e).right:bn(t).right-bn(e).right}i||(i=cc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).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>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return Si(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";Si(e,"bpmn:BoundaryEvent")&&-1!==(a=kn(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+i+t.width/2,y:r.y+mc(a,s)};return oc(e,t,l,sc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function mc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function gc(e){e.on("autoPlace",(function(e){var t=e.shape;return fc(e.source,t)}))}gc.$inject=["eventBus"];var yc={__depends__:[hc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gc]};function vc(e,t,n,i){gs.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._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||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function bc(e){e.invoke(vc,this)}function wc(e){Jl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function xc(e,t){wc.call(this,e),this._modeling=t}vc.$inject=["eventBus","elementRegistry","modeling","rules"],e(vc,gs),vc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=bn(wt(e)),o=bn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),wn(L({},o,s))},vc.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=bn(e),t=bn(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},vc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},vc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},vc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},bc.$inject=["injector"],e(bc,vc),bc.prototype.resize=function(e,t,n){Si(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},wc.$inject=["eventBus"],e(wc,Jl),wc.prototype.canResize=function(e,t){return!1},e(xc,wc),xc.$inject=["eventBus","modeling"],xc.prototype.canResize=function(e,t){if(Si(t.di,"bpmndi:BPMNPlane"))return!1;if(!Si(t,"bpmn:Participant")&&!Si(t,"bpmn:Lane")&&!Si(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(Si(e,"bpmn:Lane")||gn(e))&&(n=!1)})),n};var _c={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",bc],bpmnAutoResizeProvider:["type",xc]};function kc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&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(),s.hover({element:i,gfx:r}),s.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=Fo(e),function(e){return ne(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}kc.$inject=["elementRegistry","eventBus","injector"];var Ec={__init__:["hoverFix"],hoverFix:["type",kc]},Oc=Math.round,Pc="djs-drag-active";function Sc(e){e.preventDefault()}function Cc(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(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 a(t,n){n=n||i;var r=e.createEvent(L({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=Fo(e),h=pa(u,p),d=i.localStart,f=s(u),g=pa(f,d);if(!i.active&&(r||(o=h,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(L(l,{x:Oc(d.x+c.x),y:Oc(d.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&oa(i.cursor),t.addMarker(t.getRootElement(),Pc)}qo(e),i.active&&(L(l,{x:Oc(f.x+c.x),y:Oc(f.y+c.y),dx:Oc(g.x),dy:Oc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,qo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Us("Escape",e)&&(Sc(e),m())}function u(t){var n;i.active&&(n=la(e),setTimeout(n,400),Sc(t)),c(t)}function h(e){l(e)}function d(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),sa(),g=i.trapClick?u:c,pe.unbind(document,"mousemove",l),pe.unbind(document,"dragstart",Sc),pe.unbind(document,"selectstart",Sc),pe.unbind(document,"mousedown",g,!0),pe.unbind(document,"mouseup",g,!0),pe.unbind(document,"keyup",p),pe.unbind(document,"touchstart",h,!0),pe.unbind(document,"touchcancel",m,!0),pe.unbind(document,"touchmove",l,!0),pe.unbind(document,"touchend",c,!0),e.off("element.hover",d),e.off("element.out",f),t.removeMarker(t.getRootElement(),Pc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=L({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=$o(t)||t,v=Fo(t),qo(t),"dragstart"===y.type&&Sc(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=L({prefix:r,data:_,payload:{},globalStart:v,displacement:pa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(pe.bind(document,"touchstart",h,!0),pe.bind(document,"touchcancel",m,!0),pe.bind(document,"touchmove",l,!0),pe.bind(document,"touchend",c,!0)):(pe.bind(document,"mousemove",l),pe.bind(document,"dragstart",Sc),pe.bind(document,"selectstart",Sc),pe.bind(document,"mousedown",w,!0),pe.bind(document,"mouseup",w,!0)),pe.bind(document,"keyup",p),e.on("element.hover",d),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=d,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){L(o,e)}}Cc.$inject=["eventBus","canvas","selection","elementRegistry"];var Tc={__depends__:[Ec,ss],dragging:["type",Cc]};function Mc(e,t,n){this._canvas=n,this._opts=L({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 Ac(e,t,n){return t<e&&e<n}Mc.$inject=["config.autoScroll","eventBus","canvas"],Mc.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 s=0,a=0,l=0;l<4;l++)Ac(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Mc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Mc.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},Mc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Fo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Dc={__depends__:[Tc],__init__:["autoScroll"],autoScroll:["type",Mc]};function Nc(e){this._commandStack=e.get("commandStack",!1)}Nc.$inject=["injector"],Nc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Rc={__init__:["rules"],rules:["type",Nc]},jc=Math.round,Ic=Math.max;var Lc=10;function zc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Tt(r,t)<=Lc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=ln(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,Lc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Ic(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:jc(o.x+s.x)/2,y:jc(o.y+s.y)/2},index:o.segment2}:{point:{x:jc(o.x),y:jc(o.y)},index:o.segment2}:null}(e,t)}function Bc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $c(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qc(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 Fc(e,t){var n=qc(e,t);return Bc({x:n.x-e.x,y:n.y-e.y})}function Vc(e,t){return Bc({x:e.x-t.x,y:e.y-t.y})}var Hc="djs-bendpoint",Uc="djs-segment-dragger";function Wc(e,t,n){var r=function(e,t){var n,r=Fo(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);return zc(t,r)}function Gc(e,t){var n=Ie("g");Ce(n).add(Hc),_e(e,n);var r=Ie("circle");Pe(r,{cx:0,cy:0,r:4}),Ce(r).add("djs-visual"),_e(n,r);var i=Ie("circle");return Pe(i,{cx:0,cy:0,r:10}),Ce(i).add("djs-hit"),_e(n,i),t&&Ce(n).add(t),n}function Qc(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 Zc("h"===n?r:i)}(t,n,r),s=Ie("rect");Pe(s,{x:-9,y:-3,width:18,height:6}),Ce(s).add("djs-visual"),_e(i,s);var a=Ie("rect");return Pe(a,{x:-o/2,y:-8.5,width:o,height:17}),Ce(a).add("djs-hit"),_e(i,a),er(i,"v"===r?90:0),i}function Xc(e,t,n){var r=Ie("g"),i=jt(t,n),o=Dt(t,n);return _e(e,r),Qc(r,t,n,o),Ce(r).add(Uc),Ce(r).add("h"===o?"horizontal":"vertical"),Jn(r,i.x,i.y),r}function Zc(e){return Math.abs(Math.round(2*e/3))}function Yc(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Fc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return qc(e,n)}function Kc(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Wc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=Dt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Zc("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=jt(r=t[c-1],i=t[c]),s=Dt(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){pe.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+ws(e.id)+'"]',r);return!i&&n&&(Pe(i=Ie("g"),{"data-element-id":e.id}),Ce(i).add("djs-bendpoints"),_e(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Gc(e);_e(e,r),Jn(r,t.x,t.y)})),Gc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)Dt(n=o[a-1],r=o[a])&&(Pe(i=Xc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function h(e){var t=a(e);t&&(!function(e){v(be("."+Uc,e),(function(e){Me(e)}))}(t),function(e){v(be("."+Hc,e),(function(e){Me(e)}))}(t),p(t,e),c(t,e))}function d(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=jt(s,a),u=Dt(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Jn(r,i.x,i.y))}e.on("connection.changed",(function(e){h(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Me(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Ce(t).add(e.marker):Ce(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Wc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Jn(n,r.x,r.y)}(n,r),r.bendpoint||d(n,r,o)}})),e.on("element.mousedown",(function(e){if(Uo(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=a(t);r&&Pe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=a,this.getSegmentDragger=l}Kc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Jc=Math.round,ep="reconnectStart",tp="reconnectEnd",np="updateWaypoints";function rp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,h=(a=s||0!==o?s||o!==u.length-1?np:tp:ep)===np?"connection.updateWaypoints":"connection.reconnect",d=i.allowed(h,{connection:t,source:c,target:p});!1===d&&(d=i.allowed(h,{connection:t,source:p,target:c})),!1!==d&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:d,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===np?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===ep?a:o,target:l===tp?a:s}))return n.source=l===ep?a:o,void(n.target=l===tp?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===tp?a:s,target:l===ep?a:o})),t&&(n.source=l===tp?a:s,n.target=l===ep?a: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!==np&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},h={x:Jc(e.x),y:Jc(e.y)};if(!n)return!1;p===np?(s?a.splice(r,0,h):a[r]=h,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),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===Tt(t,r=e[i+1])||Mt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===ep?(u.docking="source",ip(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===tp&&(u.docking="target",ip(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,h,u))}),this)}function ip(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===ep?t&&r&&t===r&&n!==r:i===tp?t&&n&&t===n&&n!==r:void 0}rp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],rp.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 op="updateWaypoints",sp="connect-ok",ap="connect-not-ok",lp="connect-hover",cp="djs-updating",pp="djs-dragging";function up(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,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Ce(t.draggerGfx=Gc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,pp),r.addMarker(i,cp)})),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,lp),o===op)return;n?(r.removeMarker(i,ap),r.addMarker(i,sp)):!1===n&&(r.removeMarker(i,sp),r.addMarker(i,ap))}})),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,lp),r.removeMarker(n,i?sp:ap))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,h=c.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?ip(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=a||p,h=h.reverse()):(m.connectionStart=m.connectionStart||d,m.source=a||p,m.target=u):"reconnectEnd"===l?ip(n)?(m.connectionStart=m.connectionStart||d,m.source=a||u,m.target=p,h=h.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,h[o]=d),l===op&&(h=e.cropWaypoints(c,h)),m.waypoints=h,i.drawPreview(n,r,m)),Jn(s,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,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Me(o),r.removeMarker(n,cp),r.removeMarker(n,pp),s&&(r.removeMarker(s,sp),r.removeMarker(s,a?sp:ap)),i&&i.cleanUp(t)}))}up.$inject=["bendpointMove","injector","eventBus","canvas"];var hp="connect-hover",dp="djs-updating";function fp(e,t,n){return mp(e,t,e[t]+n)}function mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function gp(e){return"x"===e?"y":"x"}function yp(e,t,n){var r,i;return e.original?e.original:(r=_n(t),mp(e,i=gp(n),r[i]))}function vp(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(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 mp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],gp(e.axis));Jn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,h=t.waypoints,d=h[p],f=h[u],m=Wc(n,h,e);(s=Dt(d,f))&&(a="v"===s?"x":"y",0===p&&(d=yp(d,t.source,a)),u===h.length-1&&(f=yp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,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=Xc(i,t.segmentStart,t.segmentEnd),Ce(t.draggerGfx).add("djs-dragging"),n.addMarker(r,dp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,h=r.axis,d=r.originalWaypoints.slice(),f=fp(p,h,e["d"+h]),m=fp(u,h,e["d"+h]),g=d.length,y=0;d[o]=f,d[s]=m,o<2&&(t=kn(i.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,y--):"intersect"!==t&&(d.unshift(p),y++)),s>g-3&&(n=kn(i.target,m),s===g-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),r.newWaypoints=i.waypoints=a(i,d),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,hp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,hp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Me(t.draggerGfx),n.removeMarker(r,dp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Mt(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}vp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var bp=Math.abs,wp=Math.round;function xp(e){return{x:e.x,y:e.y}}function _p(e){return{x:e.x+e.width,y:e.y+e.height}}function kp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:wp(e.x+e.width/2),y:wp(e.y+e.height/2)}}function Ep(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Op(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 Sp=Math.abs,Cp=Math.round;function Tp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Sp(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,t){return e.waypoints?Yc(t,e):e.width?{x:Cp(e.width/2+e.x),y:Cp(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));L(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Op(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Op(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);mn(t)&&r&&r.x&&r.y&&(Op(e,"x",r.x),Op(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=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:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),h=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));L(e,{dx:e.dx-u,dy:e.dy-h,x:e.x-u,y:e.y-h}),(u||-1!==s.vertical.indexOf(c))&&Op(e,"x",r),(h||-1!==s.horizontal.indexOf(p))&&Op(e,"y",i)}}))}Tp.$inject=["eventBus"];var Mp={__depends__:[Tc,Rc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Kc],bendpointMove:["type",rp],bendpointMovePreview:["type",up],connectionSegmentMove:["type",vp],bendpointSnapping:["type",Tp]};function Ap(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,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(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},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:Dp(t)?o:i,connectionEnd:Dp(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=_n(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Dp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Ap.$inject=["eventBus","dragging","modeling","rules"];var Np="connect-ok",Rp="connect-not-ok";function jp(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,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,h=p;Dp(t)&&(u=p,h=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:h})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Np:Rp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Np),n.removeMarker(t,Rp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}jp.$inject=["injector","eventBus","canvas"];var Ip={__depends__:[ss,Rc,Tc],__init__:["connectPreview"],connect:["type",Ap],connectPreview:["type",jp]};function Lp(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)}Lp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Lp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,h=n.noCropping,d=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ae(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 f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?_n(s):c,a?_n(a):p]),this._connectionDocking&&(s||a)&&!h&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!d&&this.drawNoopPreview(i,n)},Lp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||_n(n),o=t.connectionEnd||_n(r),s=this.cropWaypoints(i,o,n,r);_e(e,this.createNoopConnection(s[0],s[1]))},Lp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=r&&En(s,a,!1)||t]},Lp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Me(e.connectionPreviewGfx)},Lp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Lp.prototype.createConnectionPreviewGfx=function(){var e=Ie("g");return Pe(e,{pointerEvents:"none"}),Ce(e).add("djs-dragger"),_e(this._canvas.getActiveLayer(),e),e},Lp.prototype.createNoopConnection=function(e,t){return dt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var zp={__init__:["connectionPreview"],connectionPreview:["type",Lp]},Bp=["marker-start","marker-mid","marker-end"],$p=["circle","ellipse","line","path","polygon","polyline","path","rect"];function qp(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){i.cleanUp()}))}qp.$inject=["elementRegistry","eventBus","canvas","styles"],qp.prototype.cleanUp=function(){v(this._clonedMarkers,(function(e){Me(e)})),this._clonedMarkers={}},qp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},qp.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=De(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Yn(i),r),Pe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),_e(t,i),Pe(i,"data-preview-support-element-id",e.id),i},qp.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),Pe(n,"data-preview-support-element-id",e.id),n},qp.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var r=0;r<e.childNodes.length;r++)n._cloneMarkers(e.childNodes[r],t);(function(e){return-1!==$p.indexOf(e.nodeName)})(e)&&Bp.forEach((function(r){if(Pe(e,r)){var i=function(e,t,n){var r=(i=Pe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,r,n._canvas.getContainer());n._cloneMarker(e,i,r,t)}}))},qp.prototype._cloneMarker=function(e,t,n,r="djs-dragger"){var i=t.id+"-"+r,o=this._clonedMarkers[i];if(!o){var s=i+"-clone";(o=De(t)).id=s,Ce(o).add(r),this._clonedMarkers[i]=o;var a=ve("defs",this._canvas._svg);a||(a=Ie("defs"),_e(this._canvas._svg,a)),_e(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[i].id);Pe(e,n,l)};var Fp={__init__:["previewSupport"],previewSupport:["type",qp]};const Vp="complex-preview";class Hp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Vp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;mn(e)?(t=this._graphicsFactory._createContainer("connection",Ie("g")),this._graphicsFactory.drawConnection(Yn(t),e)):(t=this._graphicsFactory._createContainer("shape",Ie("g")),this._graphicsFactory.drawShape(Yn(t),e),Jn(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);mn(e)?Jn(n,t.x,t.y):Jn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Ie("g"));this._graphicsFactory.drawShape(Yn(n),e,{width:t.width,height:t.height}),Jn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Ae(this._canvas.getLayer(Vp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer(Vp)}hide(){this._canvas.hideLayer(Vp)}}Hp.$inject=["canvas","graphicsFactory","previewSupport"];var Up={__depends__:[Fp],__init__:["complexPreview"],complexPreview:["type",Hp]},Wp=["top","bottom","left","right"],Gp=10;function Qp(e,t){function n(e){if(to(e)){var n=function(e){var t=_n(e.label),n=_n(e),r=Xp(n,t);if(i=r,-1===Wp.indexOf(i))return;var i;var o=function(e){var t=_n(e),n=[].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 Xp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=_n(e),i=kn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Wp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=_n(e),i=e.label,o=_n(i);if(!i.parent)return;var s,a=bn(e);switch(n){case"top":s={x:r.x,y:a.top-Gp-i.height/2};break;case"left":s={x:a.left-Gp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Gp+i.height/2};break;case"right":s={x:a.right+Gp+i.width/2,y:r.y}}var l=pa(s,o);t.moveShape(i,l)}(e,n)}}gs.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 Xp(e,t){return kn(t,e,5)}function Zp(e){gs.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Si(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 Yp(e,t){e.invoke(gs,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return Si(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Qp,gs),Qp.$inject=["eventBus","modeling"],e(Zp,gs),Zp.$inject=["eventBus"],e(Yp,gs),Yp.$inject=["injector","modeling"];function Kp(e,t){t.invoke(gs,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 Jp(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];Jp(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function Jp(e,t){return!gn(e)&&Ci(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function eu(e,t){function n(e){return y(e.attachers,(function(e){return Si(e,"bpmn:BoundaryEvent")}))}gs.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);Si(r,"bpmn:EventBasedGateway")&&Si(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;Si(r,"bpmn:Gateway")&&Si(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);Si(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function tu(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}gs.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(ru(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>nu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!ru(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>iu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Si(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;ru(i)&&iu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>Si(e,"bpmn:Association"))),i=r.filter((e=>nu(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;ru(t)&&nu(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;nu(o)&&i(o),ru(e)&&iu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;nu(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):iu(r)&&function(e){const n=e.incoming.filter((e=>ru(e.source)));t.removeElements(n)}(r)}),!0)}function nu(e){const t=Ti(e);return t&&t.get("isForCompensation")}function ru(e){return e&&Si(e,"bpmn:BoundaryEvent")&&Yi(e,"bpmn:CompensateEventDefinition")}function iu(e){return e&&Si(e,"bpmn:Activity")&&!Zi(e)}function ou(e){e.invoke(gs,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;Si(n,"bpmn:Lane")&&!Si(r,"bpmn:Lane")&&(t.parent=dc(n,"bpmn:Participant"))}))}function su(e,t){gs.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Si(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}Kp.$inject=["bpmnReplace","injector"],e(Kp,gs),Kp.prototype._replaceShape=function(e,t){var n,r=(n=Ti(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},eu.$inject=["eventBus","modeling"],e(eu,gs),e(tu,gs),tu.$inject=["eventBus","modeling","bpmnRules"],ou.$inject=["injector"],e(ou,gs),su.$inject=["eventBus","bpmnFactory"],e(su,gs);var au=20,lu=20,cu=30,pu=2e3;function uu(e,t,n){function r(){var t=e.getRootElement();return Si(t,"bpmn:Collaboration")?t:n.makeCollaboration()}gs.call(this,t),t.on(["create.start","shape.move.start"],pu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(Si(r,"bpmn:Participant")&&Si(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!Si(e,"bpmn:Group")&&!gn(e)&&!mn(e)}));if(o.length){var s=wt(o),a=function(e,t){t={width:t.width+2*au+cu,height:t.height+2*lu};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,s);L(r,a),n.createConstraints=function(e,t){return t=bn(t),{bottom:t.top+e.height/2-lu,left:t.right-e.width/2+au,top:t.bottom-e.height/2+lu,right:t.left+e.width/2-au-cu}}(r,s)}}})),t.on("create.start",pu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}Si(r,"bpmn:Participant")&&Si(i,"bpmn:Process")&&(t.on("element.hover",pu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",pu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return Si(e,"bpmn:Participant")}))}(n);o&&Si(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Ti(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Si(n,"bpmn:Participant")&&Si(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Ti(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||Ti(r).set("processRef",Ti(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||Ti(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 s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}uu.$inject=["canvas","eventBus","modeling"],e(uu,gs);var hu="__targetRef_placeholder";function du(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===hu}));return!i&&n&&St(r,i=t.create("bpmn:Property",{name:hu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Pt(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==l&&r(h,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),d.targetRef=t):d.targetRef=null}gs.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],fu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],fu(i))}function fu(e){return function(t){if(Si(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function mu(e){this._bpmnUpdater=e}function gu(e,t,n,r){function i(e){return e.children.filter((function(e){return Si(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return Si(e,"bpmn:Participant")&&Ti(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Mi(e),newSemanticParent:o.processRef||o,newDiParent:Mi(r)})}}gs.call(this,r),t.registerHandler("dataStore.updateContainment",mu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Si(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 Si(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Si(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Si(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Si(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!Si(r,"bpmn:Collaboration")&&Si(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Si(i,"bpmn:Collaboration")){var s=Si(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(Si(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ci(n,["bpmn:Participant","bpmn:SubProcess"])&&Si(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){Si(r,"bpmn:Process")&&o(e,r)}))}))}du.$inject=["eventBus","bpmnFactory"],e(du,gs),mu.$inject=["bpmnUpdater"],mu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},mu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(gu,gs);var yu=Math.max,vu=Math.min,bu=20;function wu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?vu:yu)(r,i)),u(o)&&(r=(/top|left/.test(e)?yu:vu)(r,o)),r}function _u(e,t){return void 0!==e?e:bu}function ku(e){return!e.waypoints&&"label"!==e.type}function Eu(e,t){var n;if((n=void 0===e.length?y(e.children,ku):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=_u(t.left),r=_u(t.right),i=_u(t.top),o=_u(t.bottom)):n=r=i=o=_u(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(wt(n),t)}var Ou=Math.abs;var Pu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){Si(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Tu(e){return e.children.filter((function(e){return Si(e,"bpmn:Lane")}))}function Mu(e){return dc(e,Pu)||e}function Au(e,t){var n=Mu(e),r=Cu(n,Si(n,"bpmn:Process")?[]:[n]),i=bn(e),o=bn(t),s=function(e,t){return wu(bn(t),bn(e))}(e,t),a=[],l=Qi(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,h=l?s.left:0,d=bn(t);s.top&&(Ou(d.bottom-i.top)<10&&(u=o.top-d.bottom),Ou(d.top-i.top)<5&&(c=o.top-d.top)),s.left&&(Ou(d.right-i.left)<10&&(p=o.left-d.right),Ou(d.left-i.left)<5&&(h=o.left-d.left)),s.bottom&&(Ou(d.top-i.bottom)<10&&(c=o.bottom-d.top),Ou(d.bottom-i.bottom)<5&&(u=o.bottom-d.bottom)),s.right&&(Ou(d.left-i.right)<10&&(h=o.right-d.left),Ou(d.right-i.right)<5&&(p=o.right-d.right)),(c||p||u||h)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:h},{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)})})}})),a}function Du(e,t){gs.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;Si(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Qi(e),c=Tu(n),p=[],u=[],h=[],d=[];vt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?d.push(t):h.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:d.length&&h.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),h.length&&(s=t.calculateAdjustments(h,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),d.length&&(a=t.calculateAdjustments(d,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Du.$inject=["eventBus","spaceTool"],e(Du,gs);function Nu(e,t){t.invoke(gs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Ru(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,s=e.host;Ru(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function Ru(e,t){return!gn(e)&&Si(e,"bpmn:BoundaryEvent")&&!t}function ju(e,t,n){function r(e,r,i){var o,s,a,l,c,p,h,d,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=zc(f,d=u(i.width)?_n(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:d,1!==o.length&&Iu(e,o[o.length-1])||o.push(Lu(a)),1!==s.length&&Iu(e,s[0])||s.unshift(Lu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||d),p=r),t.canConnect(e,c,r)&&(p?h=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||d),h=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],h&&y(m,(function(e){return e.target===h.target}))||[]);b.length&&n.removeElements(b)}gs.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 s=_n(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&zc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)}),!0),this.preExecute("shape.create",(function(e){var 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 Iu(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 Lu(e){return L({},e)}function zu(e,t){gs.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Bu(r)){(Si(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Bu(e))):o.incoming.filter((e=>e!==r&&Bu(e)&&Si(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Si(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Bu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Bu).forEach((function(r){const i=e.incoming.filter(Bu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Bu(e){return Si(e,"bpmn:SequenceFlow")}Nu.$inject=["bpmnReplace","injector"],e(Nu,gs),Nu.prototype._replaceShape=function(e){var t,n,r=(n=Ti(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(ju,gs),ju.$inject=["eventBus","bpmnRules","modeling"],zu.$inject=["eventBus","modeling"],e(zu,gs);var $u=1500;function qu(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"],$u,(function(t){var r=t.context.shape||t.shape,i=t.hover;Si(i,"bpmn:Lane")&&!Ci(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Mu(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Ci(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(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"],$u,(function(t){var n=t.hover;Si(n,"bpmn:Lane")&&(t.hover=Mu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],$u,(function(t){var n=t.context,r=t.hover,i=n.type;Si(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Mu(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],$u,(function(e){var t=e.context,n=t.start;Si(n,"bpmn:Lane")&&(t.start=Mu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Si(t,"bpmn:Lane")&&(e.shape=Mu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Si(t,"bpmn:Lane")&&(e.hover=Mu(t))}))}qu.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return Si(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Ti(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Pt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Ti(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Pt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Ti(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Ti(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(gs,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Si(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Si(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Ti(n);if(Si(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Si(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Ti(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Si(n,"bpmn:Group")&&!n.labelTarget&&Ti(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Si(n,"bpmn:Group")&&!n.labelTarget&&Ti(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Si(n,"bpmn:Group")&&!n.labelTarget){var r=Ti(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Vu(e,t,n,r){var i,o,s,a;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,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Hu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Vu(e,t,n,i),a=Vu(e,t,n,o);r=s&&a?Uu(s,n)>Uu(a,n)?a:s:s||a,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],_n(n.source)),t(r[r.length-1],r[r.length-2],_n(n.target)))}))}function Uu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){gs.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=Ti(n),i=Mi(n);if(Ci(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,gs),Hu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,gs);var Gu=Math.sqrt,Qu=Math.min,Xu=Math.max,Zu=Math.abs;function Yu(e){return Math.pow(e,2)}function Ku(e,t){return Gu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Ju(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Gu(p),h=-c+u,d=-c-u,f={x:e.x-i*h,y:e.y-o*h};return 0===p?[f]:[f,{x:e.x-i*d,y:e.y-o*d}].filter((function(n){return function(e,t,n){return eh(e.x,t.x,n.x)&&eh(e.y,t.y,n.y)}(n,e,t)}))}function eh(e,t,n){return e>=Qu(t,n)-th&&e<=Xu(t,n)+th}var th=.1;function nh(e,t){return Zu(e.x-t.x)<=th&&Zu(e.y-t.y)<=th}function rh(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,h,d,f=0;for(f=0;f<t.length-1;f++){if(nh(n=t[f],r=t[f+1])?a=[n]:(i=Ku(e,n),o=Ku(e,r),a=Ju(n,r,e,Qu(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:nh(n,a[0])?f:f+1}),2===a.length&&(h=a[0],d=a[1],l={type:"segment",position:s={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:f,relativeLocation:Ku(n,s)/Ku(n,r)}),c=Ku(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&ih(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,h=oh(n,l),d=oh(t,c),f=a.position,m=function(e,t){var n=Vc(e[0],e[1]),r=Vc(e[0],t);return 0===n?0:r/n}(h,f),g=(p=d,u=$c(h),$c(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=ih(n,v))}var x,_,k={x:(d[1].x-d[0].x)*m+d[0].x,y:(d[1].y-d[0].y)*m+d[0].y},E=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=k.x+E.x-e.x,o=k.y+E.y-e.y,{point:vn(k),delta:vn({x:i,y:o})}}function ih(e,t){var n=Vc(e[t-1],e[t]);return n/(n+Vc(e[t],e[t+1]))}function oh(e,t){return[e[t],e[t+1]]}function sh(e,t,n){var r=ca(t),i=ca(n),o=pa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return vn({x:i.x+s,y:i.y+a})}function ah(e,t,n){var r=ca(e),i=ca(t),o=ca(n),s=pa(e,r),a=pa(r,i),l=function(e,t,n){var r=bn(t),i=bn(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,s,a,l=kn(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=kn(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,h=o.y+p;return vn({x:u+s.x-e.x,y:h+s.y-e.y})}var lh="name",ch="text";function ph(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(lh in o&&t.updateLabel(i,o[lh]),ch in o&&Si(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[ch]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=L({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return rh(_n(e),t,n,r).delta}(r,o,s,i)}gs.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Ti(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!gn(r)&&eo(r)&&oo(r)&&t.updateLabel(r,oo(r))}})),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(["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=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Ti(n);i&&eo(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,s=r.oldBounds;if(to(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Fc(e,t)}}));return T(n,"distance")[0].line}(e,t);return qc(e,n)}(_n(a),[[{x:(n=s).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)}]]),c=uh(l,s,o);t.moveShape(a,c)}}))}function uh(e,t,n){return vn(pa(sh(e,t,n),e))}function hh(e,t){function n(e,t){var n=e.context,r=n.connection,i=L({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return rh(e,t,n,r).point}(t,o,s,i)}gs.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function dh(e,t,n){var r=vh(e),i=bh(r,t),o=r[0];return i.length?i[i.length-1]:sh(o.original||o,n,t)}function fh(e,t,n){var r=vh(e),i=bh(r,t),o=r[r.length-1];return i.length?i[0]:sh(o.original||o,n,t)}function mh(e,t,n){var r=vh(e),i=yh(t,n),o=r[0];return sh(o.original||o,i,t)}function gh(e,t,n){var r=vh(e),i=yh(t,n),o=r[r.length-1];return sh(o.original||o,i,t)}function yh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vh(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bh(e,t){return y(k(e,wh),(function(e){return function(e,t){return"intersect"===kn(t,e,1)}(e,t)}))}function wh(e){return e.original||e}function xh(e,t){gs.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return Si(e,"bpmn:Participant")&&Gi(e)&&Si(t,"bpmn:Participant")&&!Gi(t)}(n,r)){var i,o,s,a,l=(o=bt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){Si(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Si(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=fh(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=dh(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(ph,gs),ph.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(hh,gs),hh.$inject=["eventBus","modeling"],xh.$inject=["eventBus","modeling"],e(xh,gs);const _h=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function kh(e){const t=Ti(e);if(!(Si(t,"bpmn:BoundaryEvent")||Si(t,"bpmn:StartEvent")&&Zi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&_h.some((e=>Si(n[0],e)))}function Eh(e){return Si(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Oh(e,t){e.invoke(gs,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!kh(r))return;const o=Eh(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Ti(n).get(o);s!==Ti(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Ph(e,t){gs.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Mi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Sh(e,t,n){gs.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(Si(i,"bpmn:SequenceFlow")&&Si(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Vu(Ch(e[e.length-2]),Ch(e[e.length-1]),Ch(t[1]),Ch(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ch(e[0]),Ch(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Ch(e){return e.original||e}function Th(e,t){gs.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Si(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 Mh(e,t,n,r){gs.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(Si(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),Si(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Ah(e,t,n,r,i,o){r.invoke(gs,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=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Zi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,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})}))}Oh.$inject=["injector","modeling"],e(Oh,gs),e(Ph,gs),Ph.$inject=["eventBus","modeling"],e(Sh,gs),Sh.$inject=["eventBus","bpmnRules","modeling"],Th.$inject=["eventBus","modeling"],e(Th,gs),e(Mh,gs),Mh.$inject=["eventBus","modeling","bpmnRules","injector"],e(Ah,gs),Ah.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Ah.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Dh={width:140,height:120},Nh={width:300,height:60},Rh={width:60,height:300},jh={width:300,height:150},Ih={width:150,height:300},Lh={width:140,height:120},zh={width:50,height:30};function Bh(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(Si(n,"bpmn:Lane")||Si(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Mu(e),i=!0,o=!0,s=Cu(r,[r]),a=bn(e),l={},c={},p=Qi(e),u=p?Nh:Rh;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=bn(e);/n/.test(t)&&(p&&r.top<a.top-10&&(i=!1),n&&$h(a.top-r.bottom)<10&&Uh(l,"top",r.top+u.height),$h(a.top-r.top)<5&&Hh(c,"top",r.bottom-u.height)),/e/.test(t)&&(!p&&r.right>a.right+10&&(o=!1),n&&$h(a.right-r.left)<10&&Hh(l,"right",r.right-u.width),$h(a.right-r.right)<5&&Uh(c,"right",r.left+u.width)),/s/.test(t)&&(p&&r.bottom>a.bottom+10&&(o=!1),n&&$h(a.bottom-r.top)<10&&Hh(l,"bottom",r.bottom-u.height),$h(a.bottom-r.bottom)<5&&Uh(c,"bottom",r.top+u.height)),/w/.test(t)&&(!p&&r.left<a.left-10&&(i=!1),n&&$h(a.left-r.right)<10&&Uh(l,"left",r.left+u.width),$h(a.left-r.left)<5&&Hh(c,"left",r.right-u.width))}));var h=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Si(e,"bpmn:FlowElement")||Si(e,"bpmn:Artifact"))})),d=p?Wh:Gh;return h.forEach((function(e){var n=bn(e);i&&/n/.test(t)&&Hh(c,"top",n.top-d.top),o&&/e/.test(t)&&Uh(c,"right",n.right+d.right),o&&/s/.test(t)&&Uh(c,"bottom",n.bottom+d.bottom),i&&/w/.test(t)&&Hh(c,"left",n.left-d.left)})),{min:c,max:l}}(n,r,i)),Si(n,"bpmn:SubProcess")&&Gi(n)&&(t.minDimensions=Lh),Si(n,"bpmn:TextAnnotation")&&(t.minDimensions=zh)}))}Bh.$inject=["eventBus"];var $h=Math.abs,qh=Math.min,Fh=Math.max;function Vh(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Hh(e,t,n){return Vh(e,t,n,qh)}function Uh(e,t,n){return Vh(e,t,n,Fh)}var Wh={top:20,left:50,right:20,bottom:20},Gh={top:50,left:20,right:20,bottom:20};function Qh(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Si(n,"bpmn:Lane")||Si(n,"bpmn:Participant"))&&(t.balanced=!Wo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(Si(r,"bpmn:Lane")||Si(r,"bpmn:Participant"))return i&&(o=yn(o),t.resizeLane(r,o,n.balanced)),!1}))}Qh.$inject=["eventBus","modeling"];function Xh(e,t,n,r,i){function o(e){return Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Yi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return Si(e,"bpmn:ErrorEventDefinition")?"errorRef":Si(e,"bpmn:EscalationEventDefinition")?"escalationRef":Si(e,"bpmn:MessageEventDefinition")?"messageRef":Si(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(gs,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Ti(n));r&&!s(r)&&(St(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Pt(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Ti(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(a(n),t)}(n,o),delete t.referencedRootElement)}))}Xh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xh,gs);var Zh=Math.max;function Yh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;Si(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Qi(e);if(i=e,!Tu(i).length)return r?jh:Ih;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?jh:{width:Jh(e,n,o),height:Ih.height}:r?{width:jh.width,height:Kh(e,n,o)}:Ih;return s}(e,n,r)),Si(e,"bpmn:Lane")&&(i[t]=Qi(e)?Nh:Rh),Si(e,"bpmn:SubProcess")&&Gi(e)&&(i[t]=Lh),Si(e,"bpmn:TextAnnotation")&&(i[t]=zh),Si(e,"bpmn:Group")&&(i[t]=Dh)})),i}))}function Kh(e,t,n){var r;return r=function(e,t,n){var r,i=Tu(e);return r=ed(i,t,n),e.height-r.height+Nh.height}(e,t,n),Zh(jh.height,r)}function Jh(e,t,n){var r;return r=function(e,t,n){var r,i=Tu(e);return r=ed(i,t,n),e.width-r.width+Rh.width}(e,t,n),Zh(Ih.width,r)}function ed(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Tu(i)).length?ed(o,t,n):i}Yh.$inject=["eventBus"];var td=180,nd=160;function rd(e,t,n,r,i,o,s){gs.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return Si(e,"bpmn:SubProcess")&&!Gi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Ti(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Ti(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Os(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(Os(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(Os(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Os(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Si(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ss(t))return s.updateId(t,Ps(i)),void s.updateId(r,i);s.get(Ps(r))&&s.updateId(Ps(r),Ps(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Si(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ss(t))return s.updateId(t,Ps(r)),void s.updateId(i,r);var o=s.get(Ps(i));o&&s.updateId(o,Ps(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(Ss(n)){var r=n,i=s.get(Es(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Si(t,"bpmn:SubProcess")&&(Gi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Si(t,"bpmn:SubProcess")&&(Gi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Si(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Gi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=Os(t),i=s.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(Si(Mi(i),"bpmndi:BPMNPlane")){var o=Es(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function id(e,t){e.invoke(gs,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(Si(r,"bpmn:SubProcess")&&(Si(n,"bpmn:Task")||Si(n,"bpmn:CallActivity"))&&Gi(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 od(e){gs.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;Si(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&Si(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function sd(e,t){gs.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Gi(n)){var r=bt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(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,_n(n)):t.reconnectStart(e,n,_n(n)))}}),!0)}e(rd,gs),rd.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=wt(o);if(t.x){var a=_n(t),l=_n(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:td-s.x,y:nd-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},rd.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},rd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},rd.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:Os(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},rd.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=m(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},rd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],id.$inject=["injector","modeling"],e(id,gs),e(od,gs),od.$inject=["eventBus"],e(sd,gs),sd.$inject=["eventBus","modeling"];function ad(e,t,n){gs.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Si(n,"bpmn:SubProcess")&&(n.collapsed?Mi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Mi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Mi(t).isExpanded=!1:Mi(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,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Eu(n))?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function ld(e,t,n,r){t.invoke(gs,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;gn(t)||(Si(t,"bpmn:Participant")&&Gi(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;Si(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function cd(e,t){gs.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!Si(e,"bpmn:SequenceFlow"))return!1;var n=Ti(t),r=Ti(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(ad,gs),ad.$inject=["eventBus","elementFactory","modeling"],e(ld,gs),ld.$inject=["canvas","injector","moddle","modeling"],e(cd,gs),cd.$inject=["eventBus","modeling"];function pd(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}gs.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 ud).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||(Si(t,"bpmn:Lane")&&n.addLane(t),Si(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function ud(){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}}pd.$inject=["eventBus","modeling","translate"],e(pd,gs);var hd={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Qp],appendBehavior:["type",Zp],associationBehavior:["type",Yp],attachEventBehavior:["type",Kp],boundaryEventBehavior:["type",eu],compensateBoundaryEventBehaviour:["type",tu],createBehavior:["type",ou],createDataObjectBehavior:["type",su],createParticipantBehavior:["type",uu],dataInputAssociationBehavior:["type",du],dataStoreBehavior:["type",gu],deleteLaneBehavior:["type",Du],detachEventBehavior:["type",Nu],dropOnFlowBehavior:["type",ju],eventBasedGatewayBehavior:["type",zu],fixHoverBehavior:["type",qu],groupBehavior:["type",Fu],importDockingFix:["type",Hu],isHorizontalFix:["type",Wu],labelBehavior:["type",ph],layoutConnectionBehavior:["type",hh],messageFlowBehavior:["type",xh],nonInterruptingBehavior:["type",Oh],removeElementBehavior:["type",Sh],removeEmbeddedLabelBoundsBehavior:["type",Ph],removeParticipantBehavior:["type",Th],replaceConnectionBehavior:["type",Mh],replaceElementBehaviour:["type",Ah],resizeBehavior:["type",Bh],resizeLaneBehavior:["type",Qh],rootElementReferenceBehavior:["type",Xh],spaceToolBehavior:["type",Yh],subProcessPlaneBehavior:["type",rd],subProcessStartEventBehavior:["type",id],textAnnotationBehavior:["type",od],toggleCollapseConnectionBehaviour:["type",sd],toggleElementCollapseBehaviour:["type",ad],unclaimIdBehavior:["type",ld],unsetDefaultFlowBehavior:["type",cd],updateFlowNodeRefsBehavior:["type",pd]};function dd(e,t){var n=kn(e,t,-15);return"intersect"!==n?n:null}function fd(e){Jl.call(this,e)}function md(e){return!e||gn(e)}function gd(e){do{if(Si(e,"bpmn:Process"))return Ti(e);if(Si(e,"bpmn:Participant"))return Ti(e).processRef||Ti(e)}while(e=e.parent)}function yd(e){return Si(e,"bpmn:TextAnnotation")}function vd(e){return Si(e,"bpmn:Group")&&!e.labelTarget}function bd(e){return Si(e,"bpmn:BoundaryEvent")&&kd(e,"bpmn:CompensateEventDefinition")}function wd(e){return Ti(e).isForCompensation}function xd(e){for(var t=e;t=t.parent;){if(Si(t,"bpmn:FlowElementsContainer"))return Ti(t);if(Si(t,"bpmn:Participant"))return Ti(t).processRef}return null}function _d(e,t){return xd(e)===xd(t)}function kd(e,t){return!!m(Ti(e).eventDefinitions||[],(function(e){return Si(e,t)}))}function Ed(e,t){return(Ti(e).eventDefinitions||[]).every((function(e){return Si(e,t)}))}function Od(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function Pd(e,t,n){if(md(e)||md(t))return null;if(!Si(n,"bpmn:DataAssociation")){if($d(e,t))return{type:"bpmn:MessageFlow"};if(qd(e,t))return{type:"bpmn:SequenceFlow"}}var r=Fd(e,t);return r||(Bd(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!zd(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Sd(e,t){return!(!gn(e)&&!vd(e))||!(Si(t,"bpmn:Participant")&&!Gi(t))&&(Si(e,"bpmn:Participant")?Si(t,"bpmn:Process")||Si(t,"bpmn:Collaboration"):Ci(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Si(e,"bpmn:Lane")?Si(t,"bpmn:Participant")||Si(t,"bpmn:Lane"):!(Si(e,"bpmn:BoundaryEvent")&&!function(e){return Ti(e).cancelActivity&&(Md(e)||Ad(e))}(e))&&(Si(e,"bpmn:FlowElement")&&!Si(e,"bpmn:DataStoreReference")?Si(t,"bpmn:FlowElementsContainer")?Gi(t):Ci(t,["bpmn:Participant","bpmn:Lane"]):Si(e,"bpmn:DataStoreReference")&&Si(t,"bpmn:Collaboration")?_(Ti(t).get("participants"),(function(e){return!!e.get("processRef")})):Ci(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ci(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Si(e,"bpmn:MessageFlow")&&(Si(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Cd(e){return Si(e,"bpmn:Lane")}function Td(e){return!!function(e){return!gn(e)&&Si(e,"bpmn:BoundaryEvent")}(e)||(!(!Si(e,"bpmn:IntermediateThrowEvent")||!Md(e))||Si(e,"bpmn:IntermediateCatchEvent")&&Ad(e))}function Md(e){var t=Ti(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ad(e){return Dd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dd(e,t){return t.some((function(t){return kd(e,t)}))}function Nd(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!gn(i)&&(!!Td(i)&&(!Zi(t)&&(!(!Si(t,"bpmn:Activity")||wd(t))&&(!(r&&!dd(r,t))&&(!function(e){return Si(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return Si(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Rd(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Zi(t)||Si(e,"bpmn:StartEvent")&&"label"!==e.type&&Sd(e,t)&&(Xi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Yi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Yi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Yi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Dd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Si(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Si(t,"bpmn:Transaction")||kd(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Si(e,"bpmn:EndEvent")&&Sd(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Si(e,"bpmn:BoundaryEvent")&&Nd(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function jd(e,t){return!_(e,Cd)&&(!t||e.every((function(e){return Sd(e,t)})))}function Id(e,t,n,r){return!!t&&(!(!gn(e)&&!vd(e))||!function(e,t){return e===t}(n,t)&&((!n||!Od(n,t))&&(Sd(e,t)||Vd(e,t))))}function Ld(e,t){return Si(e,"bpmn:SubProcess")?Gi(e)&&(!t||t.width>=100&&t.height>=80):!!Si(e,"bpmn:Lane")||(!!Si(e,"bpmn:Participant")||(!!yd(e)||!!vd(e)))}function zd(e,t){return!Od(t,e)&&!Od(e,t)&&(!!function(e,t){var n=yd(e),r=yd(t);return(n||r)&&n!==r}(e,t)||!!Fd(e,t))}function Bd(e,t){return _d(e,t)&&bd(e)&&Si(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Zi(t);var n}function $d(e,t){return!(Ud(e)&&!Ud(t))&&(Si(n=e,"bpmn:InteractionNode")&&!Si(n,"bpmn:BoundaryEvent")&&(!Si(n,"bpmn:Event")||Si(n,"bpmn:ThrowEvent")&&Ed(n,"bpmn:MessageEventDefinition"))&&function(e){return Si(e,"bpmn:InteractionNode")&&!wd(e)&&(!Si(e,"bpmn:Event")||Si(e,"bpmn:CatchEvent")&&Ed(e,"bpmn:MessageEventDefinition"))&&!(Si(e,"bpmn:BoundaryEvent")&&!kd(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return gd(e)===gd(t)}(e,t));var n}function qd(e,t){return Si(n=e,"bpmn:FlowNode")&&!Si(n,"bpmn:EndEvent")&&!Zi(n)&&!(Si(n,"bpmn:IntermediateThrowEvent")&&kd(n,"bpmn:LinkEventDefinition"))&&!bd(n)&&!wd(n)&&function(e){return Si(e,"bpmn:FlowNode")&&!Si(e,"bpmn:StartEvent")&&!Si(e,"bpmn:BoundaryEvent")&&!Zi(e)&&!(Si(e,"bpmn:IntermediateCatchEvent")&&kd(e,"bpmn:LinkEventDefinition"))&&!wd(e)}(t)&&_d(e,t)&&!(Si(e,"bpmn:EventBasedGateway")&&!function(e){return Si(e,"bpmn:ReceiveTask")||Si(e,"bpmn:IntermediateCatchEvent")&&(kd(e,"bpmn:MessageEventDefinition")||kd(e,"bpmn:TimerEventDefinition")||kd(e,"bpmn:ConditionalEventDefinition")||kd(e,"bpmn:SignalEventDefinition"))}(t));var n}function Fd(e,t){return Ci(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ci(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ci(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ci(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Vd(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&&(Ci(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!gn(t)&&Si(e,"bpmn:FlowNode")&&!Si(e,"bpmn:BoundaryEvent")&&Sd(e,t.parent))}function Hd(e,t){return!!gn(t)||!(Si(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Ud(e){return dc(e,"bpmn:Process")||dc(e,"bpmn:Collaboration")}e(fd,Jl),fd.$inject=["eventBus"],fd.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(md(e))return null;return Ci(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 Pd(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Pd(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Ld(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(mn(r)&&!Vd(t,r))&&x(t,(function(e){return mn(e)?Pd(e.source,e.target,e):e.host?Nd(e,e.host,null,n):Id(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Nd(n,t,null,r)||Rd(n,t,r)||jd(n,t)||Vd(n,t)})),this.addRule("shape.create",(function(e){return Id(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Nd(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Hd(e.elements,t)}))},fd.prototype.canConnectMessageFlow=$d,fd.prototype.canConnectSequenceFlow=qd,fd.prototype.canConnectDataAssociation=Fd,fd.prototype.canConnectAssociation=zd,fd.prototype.canConnectCompensationAssociation=Bd,fd.prototype.canMove=jd,fd.prototype.canAttach=Nd,fd.prototype.canReplace=Rd,fd.prototype.canDrop=Sd,fd.prototype.canInsert=Vd,fd.prototype.canCreate=Id,fd.prototype.canConnect=Pd,fd.prototype.canResize=Ld,fd.prototype.canCopy=Hd;var Wd={__depends__:[Rc],__init__:["bpmnRules"],bpmnRules:["type",fd]};function Gd(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Mi(e);t=k(y(bt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Mi),n.set("planeElement",t)}))}))}Gd.$inject=["eventBus","canvas"];var Qd={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gd]};function Xd(e){gs.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 Zd(e,t,n){Xd.call(this,e);var r=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{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=m(r,(function(t){return Ci(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||Si(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!Ci(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),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Xd.prototype.getOrdering=function(e,t){return null},e(Xd,gs),Zd.$inject=["eventBus","canvas","translate"],e(Zd,Xd);var Yd={__depends__:[No],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Zd]};function Kd(){}Kd.prototype.get=function(){return this._data},Kd.prototype.set=function(e){this._data=e},Kd.prototype.clear=function(){var e=this._data;return delete this._data,e},Kd.prototype.isEmpty=function(){return!this._data};var Jd={clipboard:["type",Kd]},ef="drop-ok",tf="drop-not-ok",nf="attach-ok",rf="new-parent",of="create";function sf(e,t,n,r,i){function o(t,n){[nf,ef,tf,rf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===of&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);af(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||gn(t)&&-1!==e.indexOf(n))})),(function(e){return!mn(e)})),a=!1,l=!1,c=!1;lf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=lf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,nf):o(r,c?rf:tf))})),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,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;af(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,L({},p,{attach:l})),(function(e){return!mn(e)})),L(t,{elements:o,shape:i}),L(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!mn(e)}));if(i){r=L({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=wt(y(n,(function(e){return!e.hidden})));v(n,(function(e){mn(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}}))),L(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,of,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function af(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 lf(e){return e&&1===e.length&&!mn(e[0])}sf.$inject=["canvas","dragging","eventBus","modeling","rules"];function cf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Ie("g");Pe(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(Yn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Yn(i),e),Jn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||_e(e.getActiveLayer(),l),Jn(l,t.x,t.y)):Me(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Me(t)}))}cf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var pf={__depends__:[Tc,Fp,Rc,ss],__init__:["create","createPreview"],create:["type",sf],createPreview:["type",cf]};function uf(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)}))}uf.$inject=["eventBus"],uf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var hf={__init__:["mouse"],mouse:["type",uf]};function df(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),mn(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=ff(e)).original&&(e.original=ff(e.original)),e}))}(n)),gn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){L(e.hints,{createElementsBehavior:!1})}))}function ff(e){return L({},e)}function mf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}df.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],df.prototype.copy=function(e){var t,n;return c(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(c(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},df.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||{}})}},df.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=wt(e);return v(e,(function(e){mn(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}}))),L(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,L({},r))},df.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=L({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),mn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):gn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},df.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},df.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},df.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},df.prototype.hasRelations=function(e,t){var n,r;return!(mn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(gn(e)&&!m(t,M({id:e.labelTarget.id})))},df.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(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),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return vt(mt(e),(function(e,t,r){if(!gn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(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=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),v(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)?mf(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):mf(i.element,e)})),r};var gf={__depends__:[Jd,pf,hf,Rc],__init__:["copyPaste"],copyPaste:["type",df]};function yf(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function vf(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Ti(n);if(gn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Mi(n),!0);s.bpmnElement=o,yf(o,t,"name"),yf(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(gn(n))return n.businessObject=Ti(t[n.labelTarget]),void(n.di=Mi(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,yf(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Si(n,"bpmn:Participant")){var i=Ti(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Ti(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Ti(e).attachedToRef=Ti(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}vf.$inject=["bpmnFactory","eventBus","moddleCopy"];var bf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function wf(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 T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===bf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&h(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function xf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}wf.$inject=["eventBus","bpmnFactory","moddle"],wf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||xf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},wf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},wf.prototype._copyId=function(e,t,n=!1){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var _f={__depends__:[gf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",vf],moddleCopy:["type",wf]},kf=Math.round;function Ef(e,t){this._modeling=e,this._eventBus=t}function Of(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Ef.$inject=["modeling","eventBus"],Ef.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=kf(a+o/2),p=kf(l+s/2),u=r.replaceShape(e,L({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Of.$inject=["selection","eventBus"];var Pf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Of],replace:["type",Ef]};var Sf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Cf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,h=a.businessObject;if(Tf(h)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Gi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var d=e.create(u),m={type:u,businessObject:d,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(xf(h.$descriptor),xf(d.$descriptor,!0));L(d,$(l,Sf));var b=y(g,(function(e){return"eventDefinitions"===e?Mf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Zi(d):!f(d,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Zi(d))))}));if(d=n.copyElement(h,d,b),l.eventDefinitionType&&(Mf(d,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),Si(h,"bpmn:Activity")){if(Tf(h))m.isExpanded=Gi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(d,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Gi(a)&&!Si(h,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}return Tf(h)&&!Tf(d)&&(p.moveChildren=!1),Si(h,"bpmn:Participant")&&(!0===l.isExpanded?d.processRef=e.create("bpmn:Process"):p.moveChildren=!1,m.width=a.width,m.height=t.getDefaultSize(m).height),o.allowed("shape.resize",{shape:d})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),d.name=h.name,Ci(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ci(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=h.default),l.host&&!Si(h,"bpmn:BoundaryEvent")&&Si(d,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Tf(e){return Si(e,"bpmn:SubProcess")}function Mf(e,t){var n=Ti(e);return t&&n.get("eventDefinitions").some((function(e){return Si(e,t)}))}Cf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Af={__depends__:[_f,Pf,ss],bpmnReplace:["type",Cf]};function Df(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Df.$inject=["eventBus","dragging"],Df.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)},Df.prototype.isActive=function(e){return e&&this._active===e},Df.prototype.length=function(e){return this._tools.length},Df.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Df.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),v(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&&ne(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Nf={__depends__:[Tc],__init__:["toolManager"],toolManager:["type",Df]};function Rf(e,t){return-1!==e.indexOf(t)}var jf=Math.abs,If=Math.round,Lf={x:"width",y:"height"},zf="crosshair",Bf={n:"top",w:"left",s:"bottom",e:"right"},$f=1500,qf={n:"s",w:"e",s:"n",e:"w"},Ff=20;function Vf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",$f,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Uf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Uf(e);var c={x:0,y:0};c[r]=If(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Hf(e){return{top:e.top-Ff,right:e.right+Ff,bottom:e.bottom+Ff,left:e.left-Ff}}function Uf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Wf(e,t){return-1!==e.indexOf(t)}Vf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Vf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:zf,data:{context:{reactivate:n}},trapClick:!1})},Vf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:zf,data:{context:{}}})},Vf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Vf.prototype.init=function(e,t){var n=jf(e.dx)>jf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(jf(r)<5)return!1;r<0&&(r*=-1),Wo(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),s=this._canvas.getRootElement();!Go(e)&&e.hover&&(s=e.hover);var a=[...bt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,h,d,f,m,g,v=e.attachers,b=e.children,w=bn(e),x=y(b,(function(e){return!(mn(e)||gn(e)||Wf(o,e)||Wf(s,e))})),_=y(b,(function(e){return!mn(e)&&!gn(e)&&Wf(o,e)})),k=[],E=[];x.length&&(h=Hf(bn(wt(x))),p=r-w[Bf[n]]+h[Bf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(d=Hf(bn(wt(_))),p=r-d[Bf[qf[n]]]+w[Bf[qf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){Wf(o,e)?k.push(e):E.push(e)})),k.length&&(f=bn(wt(k.map(_n))),m=w[Bf[qf[n]]]-(f[Bf[qf[n]]]-r)),E.length&&(g=bn(wt(E.map(_n)))[Bf[n]]-(w[Bf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Lf[t]]-O[Lf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Lf[t]]-O[Lf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Lf[t]]+O[Lf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Lf[t]]+O[Lf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return L(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),oa("resize-"+("x"===n?"ew":"ns")),!0},Vf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!gn(e))if(mn(e))l.push(e);else{var o=e[t],p=o+e[Lf[t]];if(function(e){return!!e.host}(e)&&(n>0&&_n(e)[t]>r||n<0&&_n(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;Wf(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;Wf(p,t)&&Wf(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Vf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Gf="djs-dragging",Qf="djs-resizing",Xf=Math.max;function Zf(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,Gf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Ie("g");Pe(a,r.cls("djs-crosshair-group",["no-events"])),_e(t,a);var l=Ie("path");Pe(l,"d",o),Ce(l).add("djs-crosshair"),_e(a,l);var c=Ie("path");Pe(c,"d",s),Ce(c).add("djs-crosshair"),_e(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Jn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Me(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Pe(a=Ie("path"),"d","M0,0 L0,0"),Ce(a).add("djs-crosshair"),_e(u,a),s.line=a;var h=Ie("g");Pe(h,r.cls("djs-drag-group",["no-events"])),_e(n.getActiveLayer(),h),o(c,h),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),mn(e)&&(t||r)&&(n||i)})),h),s.dragGroup=h}if(!s.frameGroup){var d=Ie("g");Pe(d,r.cls("djs-frame-group",["no-events"])),_e(n.getActiveLayer(),d);var f=[];v(p,(function(e){var t=i.addFrame(e,d),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,Qf)})),s.frameGroup=d,s.frames=f}Pe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Jn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Pe(r,{width:Xf(i.width+m.x,5)}):Pe(r,{width:t=Xf(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Pe(r,{height:Xf(i.height+m.y,5)}):Pe(r,{height:n=Xf(i.height-m.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,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,Gf)})),v(i,(function(e){n.removeMarker(e,Gf)})),a&&(Me(s),Me(a)),v(o,(function(e){n.removeMarker(e,Qf)})),l&&Me(l)}))}Zf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Yf={__init__:["spaceToolPreview"],__depends__:[Tc,Rc,Nf,Fp,hf],spaceTool:["type",Vf],spaceToolPreview:["type",Zf]};function Kf(e){e.invoke(Vf,this)}Kf.$inject=["injector"],e(Kf,Vf),Kf.prototype.calculateAdjustments=function(e,t,n,r){var i=Vf.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!Si(e,"bpmn:TextAnnotation")&&(!function(e){return Si(e,"bpmn:Participant")&&!Ti(e).processRef}(e)||!("y"===t&&Qi(e)||"x"===t&&!Qi(e)))})),i};var Jf={__depends__:[Yf],spaceTool:["type",Kf]};function em(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)}em.$inject=["eventBus","injector"],em.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},em.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},em.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},em.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},em.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},em.prototype.register=function(e,t){this._setHandler(e,t)},em.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},em.prototype.canUndo=function(){return!!this._getUndoAction()},em.prototype.canRedo=function(){return!!this._getRedoAction()},em.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},em.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},em.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},em.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},em.prototype._createId=function(){return this._uid++},em.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},em.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},em.prototype._pushAction=function(e){const 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)},em.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},em.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},em.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},em.prototype._revertedAction=function(e){this._stackIdx--},em.prototype._getHandler=function(e){return this._handlerMap[e]},em.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 tm={commandStack:["type",em]};function nm(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 rm(e,t,n){gs.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=im(n),t.validatedShapes=im(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(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;nm((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=Ct(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&&(St(r.labels,n,i),n.labelTarget=r)}))}function im(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(rm,gs),rm.$inject=["injector","eventBus","modeling"];var om={__init__:["labelSupport"],labelSupport:["type",rm]},sm="attach-ok";function am(e,t,n,r,i){gs.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=lm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(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;v(lm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(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,sm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,sm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(lm(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||v(r?n:y(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){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(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;nm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=ah(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,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=ah(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;nm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function lm(e){return r(k(e,(function(e){return e.attachers||[]})))}e(am,gs),am.$inject=["injector","eventBus","canvas","rules","modeling"];var cm={__depends__:[Rc],__init__:["attachSupport"],attachSupport:["type",am]};function pm(e){this._model=e}function um(e,t,n,r){gs.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){v(e.context.oldRoot.children,(function(e){Si(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function s(e){var t=e.context.shape;Si(t,"bpmn:BaseElement")&&i.updateBounds(t)}function a(e){i.updateConnection(e.context)}function l(e){i.updateConnectionWaypoints(e.context.connection)}function c(e){i.updateAttachment(e.context)}function p(e){const{element:n}=e.context,r=oo(n),i=Mi(n),o=i&&i.get("label");eo(n)||Ss(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}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"],hm((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"],hm((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"],hm((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],hm((function(e){"label"!==e.context.shape.type&&s(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&s({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],hm(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],hm(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],hm(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],hm(l)),this.executed("connection.reconnect",hm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ti(n),s=Ti(r),a=Ti(i);o.conditionExpression&&!Ci(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",hm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ti(n),s=Ti(r),a=Ti(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],hm(c)),this.reverted(["element.updateAttachment"],hm(c)),this.executed("element.updateLabel",hm(p)),this.reverted("element.updateLabel",hm(p))}function hm(e){return function(t){var n=t.context;Si(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function dm(e,t,n){Wn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function fm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function mm(e,t){this._modeling=e,this._canvas=t}function gm(e){this._modeling=e}function ym(e,t){this._canvas=e,this._layouter=t}pm.$inject=["moddle"],pm.prototype._needsId=function(e){return Ci(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"])},pm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Si(e,"bpmn:Activity")?"Activity":Si(e,"bpmn:Event")?"Event":Si(e,"bpmn:Gateway")?"Gateway":Ci(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},pm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},pm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},pm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},pm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},pm.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},pm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},pm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},pm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))},e(um,gs),um.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],um.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},um.prototype.updateParent=function(e,t){if(!(gn(e)||Si(e,"bpmn:DataStoreReference")&&e.parent&&Si(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Mi(e),o=n&&n.businessObject,s=Mi(n);Si(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),Si(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Si(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),Si(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},um.prototype.updateBounds=function(e){var t=Mi(e),n=function(e){if(!Si(e,"bpmn:Activity"))return;var t=Mi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=pa(n,t.get("bounds"));L(n,{x:e.x+r.x,y:e.y+r.y})}var i=gn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},um.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Si(n,"bpmn:Lane")&&Pt(n.get("flowNodeRef"),e),Si(t,"bpmn:Lane")&&St(t.get("flowNodeRef"),e))},um.prototype.updateDiConnection=function(e,t,n){var r=Mi(e),i=Mi(t),o=Mi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Ti(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Ti(n)&&(r.targetElement=n&&o)},um.prototype.updateDiParent=function(e,t){if(t&&!Si(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Pt(n,e),e.$parent=null)}},um.prototype.getLaneSet=function(e){var t,n;return Si(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Si(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},um.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!Si(e,"bpmn:DataInput")&&!Si(e,"bpmn:DataOutput")||(Si(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Si(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(Si(e,"bpmn:FlowElement")){if(t)if(Si(t,"bpmn:Participant"))t=t.processRef;else if(Si(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Si(t,"bpmn:Lane"));r="flowElements"}else if(Si(e,"bpmn:Artifact")){for(;t&&!Si(t,"bpmn:Process")&&!Si(t,"bpmn:SubProcess")&&!Si(t,"bpmn:Collaboration");){if(Si(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(Si(e,"bpmn:MessageFlow"))r="messageFlows";else if(Si(e,"bpmn:Participant")){r="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!Si(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),s),s.$parent=null),t&&(St(o.get("rootElements"),s),s.$parent=o))}else Si(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":Si(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Pt(a=e.$parent.get(r),e),t?((a=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(r);Pt(a,e),t&&(l||(l=[],t.set(r,l)),l.push(e))}}},um.prototype.updateConnectionWaypoints=function(e){Mi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},um.prototype.updateConnection=function(e){var t,n=e.connection,r=Ti(n),i=n.source,o=Ti(i),s=n.target,a=Ti(n.target);if(Si(r,"bpmn:DataAssociation"))Si(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):Si(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=Si(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Pt(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Pt(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},um.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(dm,Wn),dm.$inject=["bpmnFactory","moddle","translate"],dm.prototype._baseCreate=Wn.prototype.create,dm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Ki,t))}return this.createElement(e,t)},dm.prototype.createElement=function(e,t){var n,r,i,o=this._translate,s=(t=L({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Ei(s=this._bpmnFactory.create(t.type))}if(!Ci(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=L({},l||{},{id:s.id+"_di"});l="root"===e?this._bpmnFactory.createDiPlane(s,c):"connection"===e?this._bpmnFactory.createDiEdge(s,c):this._bpmnFactory.createDiShape(s,c)}return Si(s,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=fm(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=fm(l,t,"isExpanded")),Ci(s,["bpmn:Lane","bpmn:Participant"])&&(t=fm(l,t,"isHorizontal")),Si(s,"bpmn:SubProcess")&&(t.collapsed=!Gi(s,l)),Si(s,"bpmn:ExclusiveGateway")&&(f(l,"isMarkerVisible")?void 0===l.isMarkerVisible&&(l.isMarkerVisible=!1):l.isMarkerVisible=!0),a(t.triggeredByEvent)&&(s.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(s.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=s.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=s,s.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=L({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},dm.prototype.getDefaultSize=function(e,t){var n=Ti(e);return t=t||Mi(e),Si(n,"bpmn:SubProcess")?Gi(n,t)?{width:350,height:200}:{width:100,height:80}:Si(n,"bpmn:Task")?{width:100,height:80}:Si(n,"bpmn:Gateway")?{width:50,height:50}:Si(n,"bpmn:Event")?{width:36,height:36}:Si(n,"bpmn:Participant")?Gi(n,t)?{width:600,height:250}:{width:400,height:60}:Si(n,"bpmn:Lane")?{width:400,height:100}:Si(n,"bpmn:DataObjectReference")?{width:36,height:50}:Si(n,"bpmn:DataStoreReference")?{width:50,height:50}:Si(n,"bpmn:TextAnnotation")?{width:100,height:30}:Si(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=L({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},mm.$inject=["modeling","canvas"],mm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},mm.prototype.postExecute=function(e){},gm.$inject=["modeling"],gm.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},gm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(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))},ym.$inject=["canvas","layouter"],ym.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=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,s)),this._canvas.addConnection(t,i,o),t},ym.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var vm=Math.round;function bm(e){this._modeling=e}bm.$inject=["modeling"],bm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=wt(y(t,(function(e){return!e.hidden})));v(t,(function(e){mn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:vm(e.x-a.x-a.width/2+i.x),y:vm(e.y-a.y-a.height/2+i.y)}}))),L(e,{x:vm(e.x-a.x-a.width/2+i.x),y:vm(e.y-a.y-a.height/2+i.y)})}));var l=mt(t),c={};v(t,(function(e){if(mn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=L({},o);-1===l.indexOf(e)&&(t.autoResize=!1),gn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var wm=Math.round;function xm(e){this._canvas=e}function _m(e){xm.call(this,e)}xm.$inject=["canvas"],xm.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?L(t,n):L(t,{x:n.x-wm(t.width/2),y:n.y-wm(t.height/2)}),this._canvas.addShape(t,r,i),t},xm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(_m,xm),_m.$inject=["canvas"];var km=xm.prototype.execute;_m.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,km.call(this,e)};var Em=xm.prototype.revert;function Om(e,t){this._canvas=e,this._modeling=t}function Pm(e,t){this._modeling=e,this._elementRegistry=t}function Sm(e,t){this._canvas=e,this._modeling=t}function Cm(e){this._modeling=e}_m.prototype.revert=function(e){return e.shape.labelTarget=null,Em.call(this,e)},Om.$inject=["canvas","modeling"],Om.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;nm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Om.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ct(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Om.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,r),this._canvas.addConnection(t,n),t},Pm.$inject=["modeling","elementRegistry"],Pm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Sm.$inject=["canvas","modeling"],Sm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;nm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.children,(function(e){mn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Sm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Ct(r.children,n),t.removeShape(n),n},Sm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return St(r.children,n,i),t.addShape(n,r),n},Cm.$inject=["modeling"];var Tm={x:"y",y:"x"};function Mm(e,t){this._layouter=e,this._canvas=t}function Am(){}function Dm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Nm(e){this._modeling=e}function Rm(e){this._helper=new Nm(e)}function jm(e){this._modeling=e,this._helper=new Nm(e)}function Im(e){this._modeling=e}function Lm(e){return e.original||e}function zm(e,t){this._modeling=e,this._rules=t}function Bm(e){this._modeling=e}function $m(e){this._modeling=e}function qm(e){return L({},e)}function Fm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Vm(e,t,n){var r=Fm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Hm(e,t){return-1!==e.indexOf(t)}function Um(e){this._modeling=e}function Wm(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=L({},t,Wm(e.children)))})),t}function Gm(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Gm(e.children,e.collapsed||t)))})),n}function Qm(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Qm(e.children,t)))})),n}function Xm(e){this._modeling=e}function Zm(e,t){return Pt(e&&e.attachers,t)}function Ym(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),St(r,t,n)}}function Km(){}function Jm(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function eg(e){this._elementRegistry=e}function tg(e,t){v(t,(function(t,n){e.set(n,t)}))}Cm.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 s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],h=a(n),d=n[h],f=0;v(n,(function(e,c){var p,u,d;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===h&&(u=p[a(p)]),d=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Tm[r]]=0,t.moveElements([n],i,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(d.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==d&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Tm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},Cm.prototype.postExecute=function(e){},Mm.$inject=["layouter","canvas"],Mm.prototype.execute=function(e){var t=e.connection;return L(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Mm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Am.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=Pt(o.children,t),St(r.children,t,i),t.parent=r,v(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},Am.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Pt(n.children,t),St(r.children,t,i),t.parent=r,v(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},Dm.prototype.add=function(e,t){return this.addAll([e],t)},Dm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=kt((n=n||{}).allShapes),i=kt(n.allConnections),o=kt(n.enclosedElements),a=kt(n.enclosedConnections),l=kt(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return vt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return L(this,n),this},Nm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Nm.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&mh(e,e.source,t),connectionEnd:i&&gh(e,e.target,t)})}))},Nm.prototype.getClosure=function(e){return(new Dm).addAll(e,!0)},Rm.$inject=["modeling"],Rm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Rm.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)},jm.$inject=["modeling"],jm.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=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),St(r.children,t,i),L(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},jm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:gh(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:mh(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},jm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return St(n.children,t,r),L(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},jm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},jm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Im.$inject=["modeling"],Im.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 c(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},Im.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Lm(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Lm(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Im.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},zm.$inject=["modeling","rules"],zm.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var h=o.incoming.slice(),d=o.outgoing.slice();v(h,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,fh(e,t,u),a)})),v(d,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,dh(e,t,u),a)}))},zm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},zm.prototype.execute=function(e){},zm.prototype.revert=function(e){},zm.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},zm.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},zm.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Bm.$inject=["modeling"],Bm.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},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Bm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:fh(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:dh(e,n,r)})})))},Bm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},$m.$inject=["modeling"],$m.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[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 v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(Rf(e,i)||Rf(e,o)||Rf(t,i)||Rf(t,o))&&(Rf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},$m.prototype.execute=function(){},$m.prototype.revert=function(){},$m.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},$m.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},$m.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=qm(e)).original&&(e.original=qm(e.original)),e}))}(e),h=Fm(n),d={};Hm(l,c)&&Hm(l,p)?(u=k(u,(function(e){return Vm(e,r,n)&&(e[h]=e[h]+t[h]),e.original&&Vm(e.original,r,n)&&(e.original[h]=e.original[h]+t[h]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Hm(l,c)||Hm(l,p))&&(Hm(i,c)?d.connectionStart=mh(e,c,t):Hm(i,p)?d.connectionEnd=gh(e,p,t):Hm(o,c)?d.connectionStart=dh(e,c,s[c.id]):Hm(o,p)&&(d.connectionEnd=fh(e,p,s[p.id])),a._modeling.layoutConnection(e,d))}))},Um.$inject=["modeling"],Um.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Wm(n),t.collapsed=!t.collapsed;var r=Gm(n,t.collapsed);return[t].concat(r)},Um.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=Qm(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},Xm.$inject=["modeling"],Xm.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Zm(r,t),Ym(n,t),t.host=n,t},Xm.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Zm(n,t),Ym(r,t,i),t},Km.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Km.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Jm.$inject=["eventBus","elementFactory","commandStack"],Jm.prototype.getHandlers=function(){return{"shape.append":gm,"shape.create":xm,"shape.delete":Sm,"shape.move":jm,"shape.resize":Bm,"shape.replace":zm,"shape.toggleCollapse":Um,spaceTool:$m,"label.create":_m,"connection.create":ym,"connection.delete":Om,"connection.move":Am,"connection.layout":Mm,"connection.updateWaypoints":Km,"connection.reconnect":Im,"elements.create":bm,"elements.move":Rm,"elements.delete":Pm,"elements.distribute":Cm,"elements.align":mm,"element.updateAttachment":Xm}},Jm.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Jm.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)},Jm.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Jm.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},Jm.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)},Jm.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Jm.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},Jm.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},Jm.prototype.createElements=function(e,t,n,r,i){c(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},Jm.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},Jm.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},Jm.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Jm.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},Jm.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Jm.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Jm.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},Jm.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Jm.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},Jm.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)},Jm.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},Jm.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)},Jm.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,L(r,{docking:"source"}))},Jm.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,L(r,{docking:"target"}))},Jm.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},Jm.prototype._create=function(e,t){return t instanceof $n?t:this._elementFactory.create(e,t)},Jm.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},eg.$inject=["elementRegistry"],eg.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 w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,E(r));return tg(n,r),e.oldProperties=o,e.changed=i,i},eg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return tg(n,t),r},eg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Si(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Si(t,"bpmn:DataObjectReference")&&Ti(t).dataObjectRef===e}))}(e,t):[]};var ng="default",rg="id",ig="di",og={width:0,height:0};function sg(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function ag(e,t){return rg in e&&e[rg]!==t[rg]}function lg(e,t){var n=e.businessObject,r=Mi(e);v(t,(function(e,t){t!==ig?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}sg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],sg.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,s=t.businessObject,a=function(e){var t=L({},e);return cg.forEach((function(n){n in e&&(t[n]=Ti(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=E(t),r=e.businessObject,i=Mi(e);return w(n,(function(e,n){return e[n]=n!==ig?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,E(t.di)),e}),{})}(t,a);return ag(a,s)&&(o.unclaim(s[rg]),i.updateId(t,a[rg]),o.claim(a[rg],s)),ng in a&&(a[ng]&&n.push(i.get(a[ng].id)),s[ng]&&n.push(i.get(s[ng].id))),lg(t,a),e.oldProperties=l,e.changed=n,n},sg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Ti(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,og)}},sg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return lg(t,r),ag(n,i)&&(s.unclaim(n[rg]),o.updateId(t,r[rg]),s.claim(r[rg],i)),e.changed};var cg=["default"];function pg(e,t){this._canvas=e,this._modeling=t}function ug(e,t){this._modeling=e,this._spaceTool=t}function hg(e,t){this._modeling=e,this._translate=t}function dg(e,t){this._modeling=e,this._spaceTool=t}pg.$inject=["canvas","modeling"],pg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Mi(i);return t.setRootElement(n),t.removeRootElement(i),St(s.rootElements,r),r.$parent=s,Pt(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},pg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Mi(n);return t.setRootElement(i),t.removeRootElement(n),Pt(s.rootElements,r),r.$parent=null,St(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},ug.$inject=["modeling","spaceTool"],ug.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Mu(r),s=o===r,a=s?r:r.parent,l=Tu(a),c=Qi(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Su,y:r.y,width:r.width-Su,height:r.height}:{x:r.x,y:r.y+Su,width:r.width,height:r.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,h,d,f,m,g=[];vt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,d=(h=r.y)+10,f="n",m="y"):"left"===i?(u=-120,d=(h=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,d=(h=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,d=(h=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,d),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,d);var w=c?{x:r.x+(s?Su:0),y:h-("top"===i?120:0),width:r.width-(s?Su:0),height:120}:{x:h-("left"===i?120:0),y:r.y+(s?Su:0),width:120,height:r.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},hg.$inject=["modeling","translate"],hg.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=Tu(r),s=o.length;if(s>i)throw new Error(n("more than {count} child lanes",{count:i}));var a,l,c,p,u,h=Math.round(r.height/i);for(u=0;u<i;u++)a=r.y+u*h,l=u===i-1?r.height-h*u:h,c={x:r.x+Su,y:a,width:r.width-Su,height:l},u<s?t.resizeShape(o[u],c):(p={type:"bpmn:Lane"},t.createShape(p,c,r))},dg.$inject=["modeling","spaceTool"],dg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},dg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Au(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},dg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=bn(e),c=wu(bn(t),l),p=Mu(e),u=[],h=[];vt(p,(function(e){return u.push(e),(Si(e,"bpmn:Lane")||Si(e,"bpmn:Participant"))&&h.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(h,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var fg="flowNodeRef",mg="lanes";function gg(e){this._elementRegistry=e}function yg(e){this._moddle=e}gg.$inject=["elementRegistry"],gg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=Mu(e);return i[t.id]||(i[t.id]=Cu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=bn(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=Mu(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return Si(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(mg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(fg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},gg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(mg);e.remove.forEach((function(e){Pt(n,e),Pt(e.get(fg),t)})),e.add.forEach((function(e){St(n,e),St(e.get(fg),t)}))})),[]},gg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(mg);e.add.forEach((function(e){Pt(n,e),Pt(e.get(fg),t)})),e.remove.forEach((function(e){St(n,e),St(e.get(fg),t)}))})),[]},yg.$inject=["moddle"],yg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},yg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var vg={fill:void 0,stroke:void 0};function bg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(d(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)}}}bg.$inject=["commandStack"],bg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||vg,r=this,i={};"fill"in n&&L(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=mn(e)?$(i,["border-color"]):i,n=Mi(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),gn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ci(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var wg={width:0,height:0};function xg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return so(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!gn(n)&&eo(n)&&!to(n)&&!_g(i)){var o=ro(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=oo(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,s=n.newBounds,a=n.hints||{};if(gn(i)||Si(i,"bpmn:TextAnnotation"))if(gn(i)&&_g(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=oo(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,wg)}}}function _g(e){return!e||!e.trim()}function kg(e,t,n,r){Jm.call(this,e,t,n),this._bpmnRules=r}function Eg(){}xg.$inject=["modeling","textRenderer","bpmnFactory"],e(kg,Jm),kg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kg.prototype.getHandlers=function(){var e=Jm.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=eg,e["element.updateProperties"]=sg,e["canvas.updateRoot"]=pg,e["lane.add"]=ug,e["lane.resize"]=dg,e["lane.split"]=hg,e["lane.updateRefs"]=gg,e["id.updateClaim"]=yg,e["element.setColor"]=bg,e["element.updateLabel"]=xg,e},kg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},kg.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)},kg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},kg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Eg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||_n(t.source||e.source),t.connectionEnd||_n(t.target||e.target)]};var Og=20,Pg=5,Sg=Math.round,Cg=20,Tg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Mg(e,t,n){var r,i,o,s=kn(t,e,Pg),a=n.split(":")[0],l=Sg((t.x-e.x)/2+e.x),c=Sg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),h=!1,d=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(h=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",h?u?(d=c===e.y,r={x:e.x+Og*(/l/.test(a)?-1:1),y:d?c+Og:c}):r={x:(d=l===e.x)?l+Og:l,y:e.y+Og*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Dg(e,r,i).concat(r),directions:i,turnNextDirections:d}}function Ag(e){return e.split(":").reverse().join(":")}function Dg(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(Lg(n)){var r=function(e,t,n){return Mg(e,t,n)}(e,t,n),i=function(e,t,n){var r=Mg(t,e,Ag(n));return{waypoints:r.waypoints.slice().reverse(),directions:Ag(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:Dg(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=Sg((t.x-e.x)/2+e.x),i=Sg((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 Ng(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=kn(e,t,Tg[o]||0),a=function(e,t){if(Lg(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}}(s,o);n=n||_n(e),r=r||_n(t);var l=a.split(":"),c=zg(n,e,l[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]}(s));return function(e,t,n){var r=Dg(e,t,n);return r.unshift(e),r.push(t),Bg(r)}(c,zg(r,t,l[1],s),a)}function Rg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=_n(e),r=_n(t)),i=i||[],s=-1!==(o=L({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=kn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?jg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:jg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Ig(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Ig(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:Ng(e,t,n,r,o))))}function jg(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 Ig(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&Tt(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(Dt(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(s[1],o,n),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Rt(e[r],t,Cg)||Rt(e[r],n,Cg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Ig(e,t,n,i)),s&&Dt(s)?null:s}function Lg(e){return e&&/t|r|b|l/.test(e)}function zg(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 Bg(e){return e.reduce((function(t,n,r){return Mt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var $g=-10,qg=40,Fg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Vg={top:"t",right:"r",bottom:"b",left:"l"};function Hg(){}function Ug(e,t){return Si(t,"bpmn:Participant")?"source":Si(e,"bpmn:Participant")?"target":Xg(t)?"source":Xg(e)||Si(t,"bpmn:Event")?"target":Si(e,"bpmn:Event")?"source":null}function Wg(e){return Xg(e)?"target":"source"}function Gg(e,t){return e?e.original||e:_n(t)}function Qg(e,t){return Si(t,"bpmn:Activity")&&Si(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Xg(e){return Si(e,"bpmn:SubProcess")&&Gi(e)}function Zg(e,t){return e===t}function Yg(e){var t=/right|left/.exec(e);return t&&t[0]}function Kg(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Jg(e){return"right"===e||"left"===e}function ey(e,t){var n=t.waypoints,r=n&&n.length&&kn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function ty(e,t,n){var r,i,o,s,a=_n(e),l=_n(t),c=(s=(o=e).host,kn(_n(o),s,$g)),p=Zg(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),h=kn(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,s=t?e:Kg(e),a=Vg[s];o=t?Jg(e)?ny("y",n,r,i)?"h":"b":ny("x",n,r,i)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(r=function(e,t,n){if(n)return Vg[e];if(Zg(Kg(e),Kg(t))||function(e,t){return Fg[e]===t}(Yg(e),Yg(t)))return Vg[Kg(e)];return Vg[Yg(e)]}(c,h,u),i=function(e,t,n){if(n)return Jg(e)?function(e,t){var n=Yg(e),r=Fg[n];return-1!==t.indexOf(r)}(e,t)||Zg(e,t)?"h":"v":function(e,t){var n=Kg(e),r=Fg[n];return-1!==t.indexOf(r)}(e,t)||Zg(e,t)?"v":"h";return Jg(t)||Zg(Kg(e),Kg(t))&&Yg(t)?"h":"v"}(c,h,u),[r+":"+i])}function ny(e,t,n,r){var i=qg;return!(ry(e,r,n,i)||ry(e,r,{x:n.x+n.width,y:n.y+n.height},i)||ry(e,r,_n(t),i))}function ry(e,t,n,r){return Math.abs(t[e]-n[e])<r}function iy(e){return L({original:e.point.original||e.point},e.actual)}function oy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Hg,Eg),Hg.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd;return a||(a=Gg(s&&s[0],i)),l||(l=Gg(s&&s[s.length-1],o)),(Si(e,"bpmn:Association")||Si(e,"bpmn:DataAssociation"))&&s&&!Qg(i,o)?[].concat([a],s.slice(1,-1),[l]):(Si(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:Ug(e,t)}}(i,o):(Si(e,"bpmn:SequenceFlow")||Qg(i,o))&&(n=i===o?{preferredLayouts:ey(i,e)}:Si(i,"bpmn:BoundaryEvent")?{preferredLayouts:ty(i,o,l)}:Xg(i)||Xg(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:Wg(e)}}(i):Si(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Si(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=Bg(Rg(i,o,a,l,s,n=L(n,t)))),r||[a,l])},oy.$inject=["elementRegistry","graphicsFactory"],oy.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(iy(r)),o.push(iy(i)),o},oy.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}},oy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},oy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},oy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},oy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var sy={__init__:["modeling","bpmnUpdater"],__depends__:[hd,Wd,Qd,Yd,Af,tm,om,cm,ss,ms,Jf],bpmnFactory:["type",pm],bpmnUpdater:["type",um],elementFactory:["type",dm],modeling:["type",kg],layouter:["type",Hg],connectionDocking:["type",oy]};const ay=Math.round;function ly(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}ly.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(L({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;L(p,{x:u.x-ay(p.width/2),y:u.y-ay(p.height/2)});const h=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let d=null;h&&(d=o.createConnection(h),d.waypoints=a.layoutConnection(d,{source:e,target:p}),d.waypoints=i.getCroppedWaypoints(d,e,p)),r.create({created:[p,d].filter((e=>!l(e)))})},ly.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ly.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var cy={__depends__:[yc,Up,sy],__init__:["appendPreview"],appendPreview:["type",ly]},py=Math.min,uy=Math.max;function hy(e){e.preventDefault()}function dy(e){e.stopPropagation()}function fy(e){this.container=e.container,this.parent=ye('<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=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function my(e,t){this._eventBus=e,this._providers=[],this._textbox=new fy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}fy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(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"},a);var l=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&L(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,pe.bind(o,"keydown",this.keyHandler),pe.bind(o,"mousedown",dy),pe.bind(o,"paste",this.handlePaste),r.autoResize&&pe.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},fy.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)}},fy.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},fy.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var h=document.createTextNode(e);this.content.insertBefore(h,p[a]),n=h,r=h.textContent.length}else{var d=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===d?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>d&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},fy.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})}},fy.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,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ye('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){hy(n),dy(n);var u=py(uy(c+n.clientX-a,r),o),h=py(uy(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},h=function(e){hy(e),dy(e),pe.unbind(document,"mousemove",u,!1),pe.unbind(document,"mouseup",h,!1)};pe.bind(n,"mousedown",(function(e){hy(e),dy(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,pe.bind(document,"mousemove",u),pe.bind(document,"mouseup",h)}))}L(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)},fy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),pe.unbind(t,"keydown",this.keyHandler),pe.unbind(t,"mousedown",dy),pe.unbind(t,"input",this.autoResize),pe.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},fy.prototype.getValue=function(){return this.content.innerText.trim()},fy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},fy.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)},my.$inject=["eventBus","canvas"],my.prototype.registerProvider=function(e){this._providers.push(e)},my.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},my.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},my.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},my.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},my.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()}},my.prototype.getValue=function(){return this._textbox.getValue()},my.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())},my.prototype._handleResize=function(e){this._fire("resize",e)},my.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=m(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 gy={__depends__:[Yo],__init__:["directEditing"],directEditing:["type",my]};function yy(e){return function(t){var n=t.target,r=Ti(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,s=(i&&i.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!r.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Gi(e);return!(o&&s&&a&&l)}}var vy=[{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"}}],by=[{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"}}],wy=[{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"}}],xy=[{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"}}],_y=[{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"}}],ky=[{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}}],Ey=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{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}}],Oy=Ey,Py=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{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:"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:"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}}],Sy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Cy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Ty=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{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}}],My=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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}}],Ay=[{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"}],Dy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";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}}],Ny={"start-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)">\n <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>\n </g>\n </svg>',"intermediate-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">\n <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>\n <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>\n </g>\n </svg>'};function Ry(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Ry.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ry.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ry.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=yy(e);return Si(t,"bpmn:DataObjectReference")?this._createEntries(e,Sy):Si(t,"bpmn:DataStoreReference")&&!Si(e.parent,"bpmn:Collaboration")?this._createEntries(e,Cy):Si(t,"bpmn:StartEvent")&&!Si(t.$parent,"bpmn:SubProcess")?(r=y(vy,i),this._createEntries(e,r)):Si(t,"bpmn:Participant")?(r=y(Dy,(function(t){return Gi(e)!==t.target.isExpanded})),this._createEntries(e,r)):Si(t,"bpmn:StartEvent")&&Zi(t.$parent)?(r=y(My,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):Si(t,"bpmn:StartEvent")&&!Zi(t.$parent)&&Si(t.$parent,"bpmn:SubProcess")?(r=y(by,i),this._createEntries(e,r)):Si(t,"bpmn:EndEvent")?(r=y(xy,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Si(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):Si(t,"bpmn:BoundaryEvent")?(r=y(Ty,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!Si(t.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==n.cancelActivity,o=t.cancelActivity==r;return i(e)||!i(e)&&!o})),this._createEntries(e,r)):Si(t,"bpmn:IntermediateCatchEvent")||Si(t,"bpmn:IntermediateThrowEvent")?(r=y(wy,i),this._createEntries(e,r)):Si(t,"bpmn:Gateway")?(r=y(_y,i),this._createEntries(e,r)):Si(t,"bpmn:Transaction")?(r=y(Ey,i),this._createEntries(e,r)):Zi(t)&&Gi(e)?(r=y(Oy,i),this._createEntries(e,r)):Si(t,"bpmn:SubProcess")&&Gi(e)?(r=y(ky,i),this._createEntries(e,r)):Si(t,"bpmn:AdHocSubProcess")&&!Gi(e)?(r=y(Py,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return yy(t)&&(!n||r)})),this._createEntries(e,r)):Si(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Ay):Si(t,"bpmn:FlowNode")?(r=y(Py,i),Si(t,"bpmn:SubProcess")&&!Gi(e)&&(r=y(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Ry.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Si(e,"bpmn:Activity")&&!Zi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Si(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Si(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!Si(e,"bpmn:SubProcess")||Si(e,"bpmn:Transaction")||Zi(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),kh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ry.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Ry.prototype._createSequenceFlowEntries=function(e,t){var n=Ti(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Si(n.sourceRef,"bpmn:ExclusiveGateway")||Si(n.sourceRef,"bpmn:InclusiveGateway")||Si(n.sourceRef,"bpmn:ComplexGateway")||Si(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&Si(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:Si(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(Si(n.sourceRef,"bpmn:ExclusiveGateway")||Si(n.sourceRef,"bpmn:InclusiveGateway")||Si(n.sourceRef,"bpmn:ComplexGateway")||Si(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Ry.prototype._createEntry=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,action:n}},Ry.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const i=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(r.options.loopCharacteristics);i&&t._moddleCopy.copyElement(i,o),o.set("isSequential",r.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var i,o,s,a=Ti(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Ry.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"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})}}}},Ry.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"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})}}}},Ry.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=Si(Ti(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"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})}}}},Ry.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ti(e),r=this,i=Eh(e),o=Si(e,"bpmn:BoundaryEvent")?Ny["intermediate-event-non-interrupting"]:Ny["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var jy={__depends__:[Ql,Af,yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ry]};function Iy(e,t,n,r,i,o,s,a,l,c,p,u,h){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=h,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Wo(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ly(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Iy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Iy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Iy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(t,(function(e){return n=e,-1!==t.indexOf(n);var n})):t},Iy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,h={};if("label"===e.type)return h;var d=e.businessObject;function f(e,t){i.start(e,t)}function m(e,t,n,i){function s(t,n){var s=r.createShape(L({type:e},i));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=r.createShape(L({type:e},i));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,i),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ci(d,["bpmn:Lane","bpmn:Participant"])&&Gi(e)){var y=Tu(e);L(h,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&(e.height>=120&&L(h,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two lanes"),action:{click:g(2)}}}),e.height>=180&&L(h,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),L(h,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Si(d,"bpmn:FlowNode")&&(Si(d,"bpmn:EventBasedGateway")?L(h,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ly(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(h,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):Si(d,"bpmn:EndEvent")||d.isForCompensation||Ly(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Zi(d)||L(h,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||L(h,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change element"),action:{click:function(e,n){var r=L(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:p("Change element"),width:300,search:!0})}}}}),Si(d,"bpmn:SequenceFlow")&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))}),Ci(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect to other element"),action:{click:f,dragstart:f}}}),Si(d,"bpmn:TextAnnotation")&&L(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:f,dragstart:f}}}),Ci(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:f,dragstart:f}}}),Si(d,"bpmn:Group")&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))});var v=a.allowed("elements.delete",{elements:[e]});return c(v)&&(v=v[0]===e),v&&L(h,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Delete"),action:{click:function(e,t){n.removeElements([t])}}}}),h};var zy={__depends__:[cy,gy,ja,ss,Ip,pf,jy],__init__:["contextPadProvider"],contextPadProvider:["type",Iy]},By={horizontal:["x","width"],vertical:["y","height"]};function $y(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return c(n)?n:n?e:[]}))}$y.$inject=["modeling","rules"],$y.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},$y.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},$y.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},$y.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 v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},$y.prototype._setOrientation=function(e){var t=By[e];this._axis=t[0],this._dimension=t[1]},$y.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)},$y.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var qy={__init__:["distributeElements"],distributeElements:["type",$y]};function Fy(e){Jl.call(this,e)}Fy.$inject=["eventBus"],e(Fy,Jl),Fy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=mt(t=y(t,(function(e){var t=Ci(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})))).length<3)&&t}))};var Vy={horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Hy(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}Hy.$inject=["popupMenu","distributeElements","translate","rules"],Hy.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Hy.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Hy.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Vy.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Vy.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var Uy={__depends__:[Ql,qy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Fy],distributeElementsMenuProvider:["type",Hy]},Wy="is not a registered action";function Gy(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Qy(e,t){return new Error(e+" "+t)}Gy.$inject=["eventBus","injector"],Gy.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),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=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();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},Gy.prototype.trigger=function(e,t){if(!this._actions[e])throw Qy(e,Wy);return this._actions[e](t)},Gy.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},Gy.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Qy(e,"is already registered");this._actions[e]=t},Gy.prototype.unregister=function(e){if(!this.isRegistered(e))throw Qy(e,Wy);this._actions[e]=void 0},Gy.prototype.getActions=function(){return Object.keys(this._actions)},Gy.prototype.isRegistered=function(e){return!!this._actions[e]};var Xy={__init__:["editorActions"],editorActions:["type",Gy]};function Zy(e){e.invoke(Gy,this)}e(Zy,Gy),Zy.$inject=["injector"],Zy.prototype._registerDefaultActions=function(e){Gy.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),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1),d=e.get("contextPad",!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()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!Si(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&h&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&h.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&h&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=wt(r=Si(i,"bpmn:Collaboration")?n.filter((function(e){return Si(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!Si(e.parent,"bpmn:SubProcess")}))),h.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&d&&this._registerAction("replaceElement",(function(e){d.triggerEntry("replace","click",e)}))};var Yy={__depends__:[Xy],editorActions:["type",Zy]};function Ky(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ci(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Ky.$inject=["eventBus"];var Jy=10;function ev(e,t,n){return n||(n="round"),Math[n](e/t)*t}function tv(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&&Hs(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,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(nv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(nv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(nv(t)?iv(a)?s.x.max=l.left:s.x.min=l.right:rv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(nv(t)?iv(a)?s.x.min=c.left:s.x.max=c.right:rv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&L(r,s),Ep(t,n)||i.snapEvent(t,n,r)}))}}))}function nv(e){return"x"===e}function rv(e){return-1!==e.indexOf("n")}function iv(e){return-1!==e.indexOf("w")}function ov(e,t){gs.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;d(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}tv.prototype.snapEvent=function(e,t,n){Op(e,t,this.snapValue(e[t],n))},tv.prototype.getGridSpacing=function(){return Jy},tv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=ev(e+=i,Jy),t&&t.min&&u(n=t.min)&&(n=ev(n+i,Jy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=ev(r+i,Jy,"floor"),e=Math.min(e,r)),e-=i},tv.prototype.isActive=function(){return this.active},tv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},tv.prototype.toggleActive=function(){this.setActive(!this.active)},tv.$inject=["elementRegistry","eventBus","config.gridSnapping"],ov.$inject=["eventBus","gridSnapping","modeling"],e(ov,gs),ov.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},ov.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},ov.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),L(e,o),e},ov.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),L(e,o),e};function sv(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))}))}sv.$inject=["eventBus","gridSnapping"];var av={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ov],gridSnappingSpaceToolBehavior:["type",sv]}],__init__:["gridSnapping"],gridSnapping:["type",tv]};function lv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=_n(n),i=e.shape,o=fc(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],Si(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}))}lv.$inject=["eventBus","gridSnapping"];function cv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();Si(i,"bpmn:Participant")&&Si(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})))}))}cv.$inject=["canvas","eventBus","gridSnapping"];function pv(e,t,n){gs.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||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function uv(e,t,n){var r=Dt(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=L({},t,i),n=L({},n,i)),[t,n]}pv.$inject=["eventBus","gridSnapping","modeling"],e(pv,gs),pv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=uv(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var hv={__depends__:[av,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",lv],gridSnappingParticipantBehavior:["type",cv],gridSnappingLayoutConnectionBehavior:["type",pv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Ky]};function dv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return Si(t,"bpmn:Lane")?n._createParticipantHit(t,r):Si(t,"bpmn:Participant")?Gi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):Si(t,"bpmn:SubProcess")?Gi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}dv.$inject=["eventBus","interactionEvents"],dv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},dv.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Qi(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},dv.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var fv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",dv]};function mv(e){e.invoke(Js,this)}e(mv,Js),mv.$inject=["injector"],mv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Js.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})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var gv={__depends__:[ea],__init__:["keyboardBindings"],keyboardBindings:["type",mv]},yv={moveSpeed:1,moveSpeedAccelerated:10},vv="left",bv="right",wv="down",xv={ArrowLeft:vv,Left:vv,ArrowUp:"up",Up:"up",ArrowRight:bv,Right:bv,ArrowDown:wv,Down:wv},_v={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 kv(e,t,n,r,i){var o=this;this._config=L({},yv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=xv[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 s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=_v[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}kv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Ev={__depends__:[ea,ss],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",kv]};function Ov(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,s=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=bn(e);return wn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("left",n,t)})}(n,s),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:bn(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=yn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function Pv(e,t){var n=_n(e),r=bn(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 Sv(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Ov.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ov.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=L({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Pv(t,i),"resize",{autoActivate:!0,cursor:Sv(i),data:{shape:t,context:r}})},Ov.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=bn(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},s=r?bn(r):o;return wn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:yu(o.bottom,s.bottom),right:yu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Eu(t,e.childrenBoxPadding))},Ov.$inject=["eventBus","rules","modeling","dragging"];var Cv="djs-resizing",Tv="resize-not-ok";function Mv(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,Cv)),o.width>5&&Pe(s,{x:o.x,width:o.width}),o.height>5&&Pe(s,{y:o.y,height:o.height}),r.canExecute?Ce(s).remove(Tv):Ce(s).add(Tv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Me(n.frame),t.removeMarker(r,Cv)}))}Mv.$inject=["eventBus","canvas","previewSupport"];var Av=-6,Dv="djs-resizer",Nv=["n","w","s","e","nw","ne","se","sw"];function Rv(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&&v(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Rv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Uo(t)&&r.activate(t,e,n)}pe.bind(t,"mousedown",i),pe.bind(t,"touchstart",i)},Rv.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=Av);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Av);return t}(r),s=Ie("g");Ce(s).add(Dv),Ce(s).add(Dv+"-"+e.id),Ce(s).add(Dv+"-"+r),_e(i,s);var a=Ie("rect");Pe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Ce(a).add(Dv+"-visual"),_e(s,a);var l=Ie("rect");return Pe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Ce(l).add(Dv+"-hit"),_e(s,l),Kn(s,t,n),s},Rv.prototype.createResizer=function(e,t){var n=Pv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Rv.prototype.addResizer=function(e){var t=this;!mn(e)&&this._resize.canResize({shape:e})&&v(Nv,(function(n){t.createResizer(e,n)}))},Rv.prototype.removeResizers=function(){Ae(this._getResizersParent())},Rv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Rv.$inject=["eventBus","canvas","selection","resize"];var jv={__depends__:[Rc,Tc,Fp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ov],resizePreview:["type",Mv],resizeHandles:["type",Rv]};function Iv(e,t,n,r,i,o,s){function a(e,t){(t||Ci(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Lv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),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||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Lv(e){return Si(e,"bpmn:SubProcess")&&!Gi(e)}Iv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Iv.prototype.activate=function(e){var t=oo(e);if(void 0!==t){var n={text:t};L(n,this.getEditingBBox(e));var r={};return(Ci(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Lv(e))&&L(r,{centerVertically:!0}),eo(e)&&L(r,{autoResize:!0}),Si(e,"bpmn:TextAnnotation")&&L(r,{resizable:!0,autoResize:!0}),L(n,{options:r}),n}},Iv.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,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,h=l.fontSize*a,d=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Si(e,"bpmn:Lane")||function(e){return Si(e,"bpmn:Participant")&&Gi(e)}(e)){var m=Qi(e);L(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return Si(e,"bpmn:Participant")&&!Gi(e)}(e)){var g=Qi(e);L(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ci(e,["bpmn:Task","bpmn:CallActivity"])||Lv(e))&&(L(s,{width:r.width,height:r.height}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return Si(e,"bpmn:SubProcess")&&Gi(e)}(e)&&(L(s,{width:r.width,x:r.x}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(L(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),eo(n)&&!to(n)&&!gn(n)){var w=ro(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;L(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return Si(e,"bpmn:TextAnnotation")&&(L(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),L(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:h+"px",lineHeight:d})),{bounds:s,style:f}},Iv.prototype.update=function(e,t,n,r){var i,o,s;Si(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}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var zv="djs-element-hidden",Bv="djs-label-hidden";function $v(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Si(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Ie("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Ie("path");Pe(p,{d:c,strokeWidth:2,stroke:qv(r)}),_e(o,p),_e(a,o),Jn(o,r.x,r.y)}Si(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,zv):(Si(r,"bpmn:Task")||Si(r,"bpmn:CallActivity")||Si(r,"bpmn:SubProcess")||Si(r,"bpmn:Participant"))&&t.addMarker(r,Bv)})),e.on("directEditing.resize",(function(e){if(Si(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Pe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,zv),t.removeMarker(r,Bv)),r=void 0,i=void 0,o&&(Me(o),o=void 0)}))}function qv(e,t){return Mi(e).get("stroke")||t||"black"}$v.$inject=["eventBus","canvas","pathMap"];var Fv={__depends__:[ms,jv,gy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Iv],labelEditingPreview:["type",$v]},Vv=new as("tt");function Hv(e,t){e.style.display=!1===t?"none":""}var Uv="djs-tooltip",Wv="."+Uv;function Gv(e,t){this._eventBus=e,this._canvas=t,this._ids=Vv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=function(e){var t=ye('<div class="djs-tooltip-container" />');return X(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}(t.getContainer());var n=this;de.bind(this._tooltipRoot,Wv,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,Wv,"mouseover",(function(e){n.trigger("mouseover",e)})),de.bind(this._tooltipRoot,Wv,"mouseout",(function(e){n.trigger("mouseout",e)})),this._init()}Gv.$inject=["eventBus","canvas"],Gv.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=L({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Gv.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Z(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},Gv.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Gv.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Gv.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Gv.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Gv.prototype.show=function(){Hv(this._tooltipRoot)},Gv.prototype.hide=function(){Hv(this._tooltipRoot,!1)},Gv.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},Gv.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)),d(r)&&(r=ye(r)),X(t=ye('<div data-tooltip-id="'+n+'" class="'+Uv+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Gv.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){X(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Gv.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),Hv(r,i))}))},Gv.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 Qv={__init__:["tooltips"],tooltips:["type",Gv]};function Xv(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,s=e.context,a=s.shape;Si(s.target,"bpmn:Collaboration")&&Si(a,"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>"}))}))}Xv.$inject=["eventBus","tooltips","translate"];var Zv={__depends__:[Qv],__init__:["modelingFeedback"],modelingFeedback:["type",Xv]},Yv=Math.round;function Kv(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 s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Ce(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+Yv(e.width/2),y:e.y+Yv(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]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),L(t,{shapes: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,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,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,s=t.shapes;if(!1===i)return!1;r.x=Yv(r.x),r.y=Yv(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Uo(e)){var t=$o(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}Kv.$inject=["eventBus","dragging","modeling","selection","rules"];var Jv="djs-dragging",eb="drop-ok",tb="drop-not-ok",nb="new-parent",rb="attach-ok";function ib(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!mn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=bt(e,!0),n=k(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return r(t.concat(n))}function a(e,n){[rb,eb,tb,nb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var h=Ie("g");Pe(h,n.cls("djs-drag-group",["no-events"])),_e(t.getActiveLayer(),h),l.dragGroup=h}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,Jv)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),E(a).length)})),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?a(r,rb):t.canExecute&&r&&r.id!==i.id?a(r,nb):a(r,t.canExecute?eb:tb)),Jn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,Jv)})),i&&Me(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,Jv),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}ib.$inject=["eventBus","canvas","styles","previewSupport"];var ob={__depends__:[Yo,ss,Jo,Rc,Tc,Fp],__init__:["move","movePreview"],move:["type",Kv],movePreview:["type",ib]};const sb={width:36,height:50},ab={width:50,height:50};function lb(e,t,n){return Ie("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function cb(e,t){this._styles=t,e.registerProvider(this)}function pb(e,t){var n;return"bpmn:DataObjectReference"===t?n=sb:"bpmn:DataStoreReference"===t&&(n=ab),e.width===n.width&&e.height===n.height}cb.$inject=["outline","styles"],cb.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!gn(e))return Si(e,"bpmn:Gateway")?(L((n=Ie("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,L({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ci(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Pe(n=Ie("rect"),L({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Si(e,"bpmn:EndEvent")?Pe(n=Ie("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Si(e,"bpmn:Event")?Pe(n=Ie("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Si(e,"bpmn:DataObjectReference")&&pb(e,"bpmn:DataObjectReference")?n=lb("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):Si(e,"bpmn:DataStoreReference")&&pb(e,"bpmn:DataStoreReference")&&(n=lb("M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",{x:-6,y:-6},t)),n},cb.prototype.updateOutline=function(e,t){if(!gn(e))return Ci(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+10,height:e.height+10}),!0):!!Ci(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var ub={__depends__:[Jo],__init__:["outlineProvider"],outlineProvider:["type",cb]},hb=".djs-palette-toggle",db=".entry",fb=hb+", "+db,mb="djs-palette-",gb="open",yb="two-column";function vb(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 bb(e,t){var n=t.getPaletteEntries();return h(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}vb.$inject=["eventBus","canvas"],vb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},vb.prototype.getEntries=function(){return this._getProviders().reduce(bb,{})},vb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},vb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ye(vb.HTML_MARKUP);n.appendChild(r),K(n).add(mb+"shown"),de.bind(r,fb,"click",(function(t){if(te(t.delegateTarget,hb))return e.toggle();e.trigger("click",t)})),pe.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,db,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},vb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},vb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(yb,t),s.toggle(mb+yb,t),"open"in e&&(o.toggle(gb,e.open),s.toggle(mb+gb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},vb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+ws(r)+"]",e);i||(Z(i=ye('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ye(o);if(i.appendChild(s),!t.separator&&(Z(s,"data-action",n),t.title&&Z(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ye("<img>");Z(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},vb.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Z(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},vb.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(h(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},vb.prototype._layoutChanged=function(){this._toggleState({})},vb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},vb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},vb.prototype.open=function(){this._toggleState({open:!0})},vb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},vb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},vb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},vb.prototype.isOpen=function(){return K(this._container).has(gb)},vb.prototype._getParentContainer=function(){return this._canvas.getContainer()},vb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var wb={__init__:["palette"],palette:["type",vb]},xb="crosshair";function _b(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Pe(n=e.frame=Ie("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),_e(r,n)},c=function(e){var t=e.frame,n=e.bbox;Pe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Me(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(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=kb(e),i=r.filter((function(e){return e})),o=Go(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=kb(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=kb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Go(e))return a.activateLasso(e.originalEvent),!0}))}function kb(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}}_b.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],_b.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:xb,data:{context:{}}})},_b.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:xb,data:{context:{}},keepSelection:!0})},_b.prototype.select=function(e,t,n=[]){var r=function(e,t){var n={};return v(e,(function(e){var r=e;r.waypoints&&(r=wt(r)),!u(t.y)&&r.x>t.x&&(n[e.id]=e),!u(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(u(t.width)&&u(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:u(t.width)&&u(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select([...n,...O(r)])},_b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_b.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Eb={__depends__:[Nf,hf],__init__:["lassoTool"],lassoTool:["type",_b]},Ob=1500,Pb="grab";function Sb(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Ob,(function(e){if(Wo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ob,(function(e){if(Cb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ob,(function(e){Cb(e.keyEvent)&&s.isActive()&&s.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(){s.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!Wo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Cb(e){return Us("Space",e)}Sb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Sb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Pb,data:{context:n||{}}})},Sb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Pb,data:{context:{reactivate:n}}})},Sb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Sb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Tb={__depends__:[Nf,hf],__init__:["handTool"],handTool:["type",Sb]},Mb="connect-ok",Ab="connect-not-ok";function Db(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,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=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?Mb:Ab))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Mb:Ab)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.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}))}Db.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Db.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Db.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Db.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Db.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Ip,Rc,Tc,Nf,hf],globalConnect:["type",Db]};function Rb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Rb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Rb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(L({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return L(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate 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",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var jb={__depends__:[wb,pf,Jf,Eb,Tb,Nb,No],__init__:["paletteProvider"],paletteProvider:["type",Rb]};function Ib(e,t,n,r,i){gs.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);L(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+ws(l.id)+'"]',e.dragGroup);p&&Pe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+ws(r)+'"]',e.dragGroup);i&&Pe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Ib.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ib,gs);var Lb={__depends__:[Fp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ib]},zb=40,Bb=20,$b=10,qb=20,Fb=["x","y"],Vb=Math.abs;function Hb(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,s=t.target;e.originalEvent&&Hs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Fb.forEach((function(r){var i=Gb(r,t);e[r]<t[r]+n?Op(e,r,t[r]+n):e[r]>t[r]+i-n&&Op(e,r,t[r]+i-n)}))}(e,i,function(e){return Si(e,"bpmn:Task")?$b:Bb}(i)),i&&function(e,t){return _(t,(function(t){return Wb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=kp(r),Ci(i,["bpmn:Event","bpmn:Gateway"])&&Ub(e,kp(i)),Ci(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=kp(t);Fb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+qb&&e[n]<t[n]+Gb(n,t)-qb})(e,t,r)&&Op(e,r,n[r])}))}(e,i),Si(o,"bpmn:BoundaryEvent")&&s===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=kp(n),o=kn(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Vb(r-i[t])<zb&&(n=r>i[t]?i[t]+zb:i[t]-zb,Op(e,t,n))}))}(e)):Wb(n,"bpmn:MessageFlow")?(Si(r,"bpmn:Event")&&(t.connectionStart=kp(r)),Si(i,"bpmn:Event")&&Ub(e,kp(i))):t.connectionStart=t.initialConnectionStart)}))}function Ub(e,t){Op(e,"x",t.x),Op(e,"y",t.y)}function Wb(e,t){return e&&e.type===t}function Gb(e,t){return"x"===e?t.width:t.height}function Qb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Xb(){this._snapValues={}}Hb.$inject=["eventBus"],Qb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Qb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Qb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Qb.prototype.getSnapLocations=function(){return this._snapLocations},Qb.prototype.setSnapLocations=function(e){this._snapLocations=e},Qb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Xb).initDefaults(this._defaultSnaps),n},Xb.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)},Xb.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],bp(i-e)<=n)return i}(e[n],i[n],r)},Xb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var Zb=1250;function Yb(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"],Zb,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Hs(e.originalEvent))&&!Ep(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}Yb.$inject=["elementRegistry","eventBus","snapping"],Yb.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new Qb);var s=(t=n.get(i.id)?kp(i,e):{x:e.x+kp(i).x,y:e.y+kp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),gn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},Yb.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(gn(n))gn(t)&&e.add("mid",kp(n));else if(mn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",kp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",kp(t)),e):e},Yb.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function Kb(e,t){t.invoke(Yb,this),e.on(["create.move","create.end"],1500,Jb),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)&&!Ep(e)&&function(e,t){var n,r=bn(t),i=dd(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:_n(s);/top/.test(i)?Op(e,"y",r.top-n.y):/bottom/.test(i)&&Op(e,"y",r.bottom-n.y);/left/.test(i)?Op(e,"x",r.left-n.x):/right/.test(i)&&Op(e,"x",r.right-n.x)}(e,r)}))}function Jb(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)&&Op(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Op(e,"y",e.y)}}function ew(e,t){return-1!==e.indexOf(t)}function tw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(Kb,Yb),Kb.$inject=["eventBus","injector"],Kb.prototype.initSnap=function(e){var t=Yb.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",tw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",tw(i,r,e))})),Si(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Kb.prototype.addSnapTargetPoints=function(e,t,n){Yb.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(Si(e,"bpmn:SubProcess")&&Gi(e))return!0;return Si(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return Si(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",xp(n)),e.add("bottom-right",_p(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){ew(r,n.source)||e.add("mid",_n(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){ew(r,n.target)||e.add("mid",_n(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Si(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Kb.prototype.getSnapTargets=function(e,t){return Yb.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Si(e,"bpmn:Lane")}))};function nw(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,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&Hs(e.originalEvent)||Ep(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Op(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Op(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function rw(e,t){var n=_n(e),r=bn(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}nw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new Qb);var o=rw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},nw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",_p(t)),e.add("corner",xp(t))})),e.add("corner",rw(t,r)),e},nw.$inject=["eventBus","snapping"],nw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,r=e,n.host===r||mn(t)||function(e){return!!e.hidden}(t)||gn(t));var n,r}))};function iw(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}iw.$inject=["canvas"],iw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Ep(e,"x"),y:Ep(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,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),v(["x","y"],(function(t){var n=i[t];p(n)&&Op(e,t,n.originValue)}))},iw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ie("path");return Pe(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),_e(t,n),{update:function(t){u(t)?Pe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Pe(n,{display:"none"})}}},iw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},iw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},iw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},iw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var ow={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Yb],resizeSnapping:["type",nw],snapping:["type",iw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Hb],createMoveSnapping:["type",Kb]};function sw(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=ye(sw.BOX_HTML),this._searchInput=ve(sw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(sw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function aw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+sw.RESULT_HIGHLIGHT_CLASS+'">'+_s(e.matched)+"</strong>":t+=_s(e.normal)})),""!==t?t:null}(t),i=ye(n);i.innerHTML=r,e.appendChild(i)}sw.$inject=["canvas","eventBus","overlays","selection"],sw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,sw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,sw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,sw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,sw.INPUT_SELECTOR,"keydown",(function(e){Us("ArrowUp",e)&&e.preventDefault(),Us("ArrowDown",e)&&e.preventDefault()})),t(this._container,sw.INPUT_SELECTOR,"keyup",(function(t){if(Us("Escape",t))return e.close();if(Us("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Us("ArrowUp",t)?e._scrollToDirection(!0):Us("ArrowDown",t)?e._scrollToDirection():void(Us(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},sw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},sw.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(sw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},sw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},sw.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)}},sw.prototype._clearResults=function(){ee(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},sw.prototype._getCurrentResult=function(){return ve(sw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},sw.prototype._createResultNode=function(e,t){var n=ye(sw.RESULT_HTML);return e.primaryTokens.length>0&&aw(n,e.primaryTokens,sw.RESULT_PRIMARY_HTML),aw(n,e.secondaryTokens,sw.RESULT_SECONDARY_HTML),Z(n,sw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},sw.prototype.registerProvider=function(e){this._searchProvider=e},sw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,K(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},sw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,K(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},sw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},sw.prototype.isOpen=function(){return this._open},sw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(sw.RESULT_SELECTED_CLASS);var n=Z(e,sw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(sw.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},sw.prototype._select=function(e){var t=Z(e,sw.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)},sw.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"},o=ye('<div class="'+sw.OVERLAY_CLASS+'"></div>');return X(o,i),{position:{bottom:r-t,right:n-t},show:!0,html:o}}(wt(e));this._overlayId=this._overlays.add(e,t)}},sw.CONTAINER_SELECTOR=".djs-search-container",sw.INPUT_SELECTOR=".djs-search-input input",sw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",sw.RESULT_SELECTOR=".djs-search-result",sw.RESULT_SELECTED_CLASS="djs-search-result-selected",sw.RESULT_SELECTED_SELECTOR="."+sw.RESULT_SELECTED_CLASS,sw.RESULT_ID_ATTRIBUTE="data-result-id",sw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",sw.OVERLAY_CLASS="djs-search-overlay",sw.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>',sw.RESULT_HTML='<div class="djs-search-result"></div>',sw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',sw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var lw={__depends__:[ds,ss],searchPad:["type",sw]};function cw(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function pw(e){return y(e,(function(e){return!!e.matched})).length>0}function uw(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}cw.$inject=["elementRegistry","searchPad","canvas"],cw.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=y(n,(function(e){return e!==t})),n=T(n=y(n=k(n,(function(t){return{primaryTokens:uw(oo(t),e),secondaryTokens:uw(t.id,e),element:t}})),(function(e){return pw(e.primaryTokens)||pw(e.secondaryTokens)})),(function(e){return oo(e.element)+e.element.id}))};var hw={__depends__:[lw],__init__:["bpmnSearch"],bpmnSearch:["type",cw]};function dw(e){Wi.call(this,e)}e(dw,Wi),dw.Viewer=Bs,dw.NavigatedViewer=ba,dw.prototype.createDiagram=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>')},dw.prototype._interactionModules=[ra,ha,va],dw.prototype._modelingModules=[tc,yc,Dc,_c,Mp,Ip,zp,zy,_f,pf,Uy,Yy,hv,fv,gv,Ev,Fv,sy,Zv,ob,ub,jb,Lb,jv,ow,hw],dw.prototype._modules=[].concat(Bs.prototype._modules,dw.prototype._interactionModules,dw.prototype._modelingModules);var fw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function mw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gw={exports:{}};
|
|
157
|
+
`,this._current.container)},Gl.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Gl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Gl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Gl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Gl.prototype.reset=function(){const e=this._current.container;ll(null,e),we(e)},Gl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Gl.prototype._onOpened=function(){this._emit("opened")},Gl.prototype._onClosed=function(){this._emit("closed")},Gl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ye(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Gl.prototype._bindAutoClose=function(){this._eventBus.once(Wl,this.close,this)},Gl.prototype._unbindAutoClose=function(){this._eventBus.off(Wl,this.close,this)},Gl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Gl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Gl.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},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._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 v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);h(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Gl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);h(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Gl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>h(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Gl.prototype.isOpen=function(){return!!this._current},Gl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=Z(ne(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(h(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Gl.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Ql={__init__:["popupMenu"],popupMenu:["type",Gl]},Xl={align:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">\n <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Zl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Zl.$inject=["contextPad","popupMenu","translate","canvas"],Zl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Zl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Zl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Xl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);L(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Zl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Yl=["left","center","right","top","middle","bottom"];function Kl(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function Jl(e){gs.call(this,e),this.init()}function ec(e){Jl.call(this,e)}Kl.$inject=["popupMenu","alignElements","translate","rules"],Kl.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Kl.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(Yl,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Xl[o],action:function(){t.trigger(e,o),r.close()}}})),i},Jl.$inject=["eventBus"],e(Jl,gs),Jl.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)}))},Jl.prototype.init=function(){},ec.$inject=["eventBus"],e(ec,Jl),ec.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=mt(t)).length<2)&&t}))};var tc={__depends__:[Oa,ja,Ql],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Zl],alignElementsMenuProvider:["type",Kl],bpmnAlignElements:["type",ec]},nc=10,rc=50,ic=250;function oc(e,t,n,r){for(var i;i=ac(e,n,t);)n=r(t,n,i);return n}function sc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function ac(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=lc(e);e.host&&(t=t.concat(lc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(lc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===kn(e,r,nc)}))}function lc(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 cc(){return!0}function pc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||rc,i=_n(e),o=bn(e);return{x:o.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}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function uc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}pc.$inject=["eventBus","modeling","canvas"],uc.$inject=["eventBus","selection"];var hc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",pc],autoPlaceSelectionBehavior:["type",uc]};function dc(e,t){for(d(t)&&(t=[t]);e=e.parent;)if(Ci(e,t))return e;return null}function fc(e,t){return Si(t,"bpmn:TextAnnotation")?function(e,t){var n=bn(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};mn(e)&&((r=_n(e)).x+=100,r.y-=50);return oc(e,t,r,sc({y:{margin:-30,minDistance:20}}))}(e,t):Ci(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=bn(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return oc(e,t,r,sc({x:{margin:30,minDistance:30}}))}(e,t):Si(t,"bpmn:FlowNode")?function(e,t){var n=bn(e),r=_n(e),i=function(e,t){t||(t={});var n=t.defaultDistance||rc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||ic,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?bn(e).top-bn(t).bottom:"center"===a?bn(e).top-_n(t).y:bn(e).top-bn(t).top:"w"===r?"start"===a?bn(e).left-bn(t).right:"center"===a?bn(e).left-_n(t).x:bn(e).left-bn(t).left:"s"===r?"start"===a?bn(t).top-bn(e).bottom:"center"===a?_n(t).y-bn(e).bottom:bn(t).bottom-bn(e).bottom:"start"===a?bn(t).left-bn(e).right:"center"===a?_n(t).x-bn(e).right:bn(t).right-bn(e).right}i||(i=cc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).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>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return Si(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";Si(e,"bpmn:BoundaryEvent")&&-1!==(a=kn(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+i+t.width/2,y:r.y+mc(a,s)};return oc(e,t,l,sc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function mc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function gc(e){e.on("autoPlace",(function(e){var t=e.shape;return fc(e.source,t)}))}gc.$inject=["eventBus"];var yc={__depends__:[hc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gc]};function vc(e,t,n,i){gs.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._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||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function bc(e){e.invoke(vc,this)}function wc(e){Jl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function xc(e,t){wc.call(this,e),this._modeling=t}vc.$inject=["eventBus","elementRegistry","modeling","rules"],e(vc,gs),vc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=bn(wt(e)),o=bn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),wn(L({},o,s))},vc.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=bn(e),t=bn(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},vc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},vc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},vc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},bc.$inject=["injector"],e(bc,vc),bc.prototype.resize=function(e,t,n){Si(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},wc.$inject=["eventBus"],e(wc,Jl),wc.prototype.canResize=function(e,t){return!1},e(xc,wc),xc.$inject=["eventBus","modeling"],xc.prototype.canResize=function(e,t){if(Si(t.di,"bpmndi:BPMNPlane"))return!1;if(!Si(t,"bpmn:Participant")&&!Si(t,"bpmn:Lane")&&!Si(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(Si(e,"bpmn:Lane")||gn(e))&&(n=!1)})),n};var _c={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",bc],bpmnAutoResizeProvider:["type",xc]};function kc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&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(),s.hover({element:i,gfx:r}),s.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=Fo(e),function(e){return ne(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}kc.$inject=["elementRegistry","eventBus","injector"];var Ec={__init__:["hoverFix"],hoverFix:["type",kc]},Oc=Math.round,Pc="djs-drag-active";function Sc(e){e.preventDefault()}function Cc(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(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 a(t,n){n=n||i;var r=e.createEvent(L({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=Fo(e),h=pa(u,p),d=i.localStart,f=s(u),g=pa(f,d);if(!i.active&&(r||(o=h,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(L(l,{x:Oc(d.x+c.x),y:Oc(d.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&oa(i.cursor),t.addMarker(t.getRootElement(),Pc)}qo(e),i.active&&(L(l,{x:Oc(f.x+c.x),y:Oc(f.y+c.y),dx:Oc(g.x),dy:Oc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,qo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Us("Escape",e)&&(Sc(e),m())}function u(t){var n;i.active&&(n=la(e),setTimeout(n,400),Sc(t)),c(t)}function h(e){l(e)}function d(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),sa(),g=i.trapClick?u:c,pe.unbind(document,"mousemove",l),pe.unbind(document,"dragstart",Sc),pe.unbind(document,"selectstart",Sc),pe.unbind(document,"mousedown",g,!0),pe.unbind(document,"mouseup",g,!0),pe.unbind(document,"keyup",p),pe.unbind(document,"touchstart",h,!0),pe.unbind(document,"touchcancel",m,!0),pe.unbind(document,"touchmove",l,!0),pe.unbind(document,"touchend",c,!0),e.off("element.hover",d),e.off("element.out",f),t.removeMarker(t.getRootElement(),Pc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=L({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=$o(t)||t,v=Fo(t),qo(t),"dragstart"===y.type&&Sc(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=L({prefix:r,data:_,payload:{},globalStart:v,displacement:pa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(pe.bind(document,"touchstart",h,!0),pe.bind(document,"touchcancel",m,!0),pe.bind(document,"touchmove",l,!0),pe.bind(document,"touchend",c,!0)):(pe.bind(document,"mousemove",l),pe.bind(document,"dragstart",Sc),pe.bind(document,"selectstart",Sc),pe.bind(document,"mousedown",w,!0),pe.bind(document,"mouseup",w,!0)),pe.bind(document,"keyup",p),e.on("element.hover",d),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=d,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){L(o,e)}}Cc.$inject=["eventBus","canvas","selection","elementRegistry"];var Tc={__depends__:[Ec,ss],dragging:["type",Cc]};function Mc(e,t,n){this._canvas=n,this._opts=L({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 Ac(e,t,n){return t<e&&e<n}Mc.$inject=["config.autoScroll","eventBus","canvas"],Mc.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 s=0,a=0,l=0;l<4;l++)Ac(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Mc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Mc.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},Mc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Fo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Dc={__depends__:[Tc],__init__:["autoScroll"],autoScroll:["type",Mc]};function Nc(e){this._commandStack=e.get("commandStack",!1)}Nc.$inject=["injector"],Nc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Rc={__init__:["rules"],rules:["type",Nc]},jc=Math.round,Ic=Math.max;var Lc=10;function zc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Tt(r,t)<=Lc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=ln(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,Lc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Ic(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:jc(o.x+s.x)/2,y:jc(o.y+s.y)/2},index:o.segment2}:{point:{x:jc(o.x),y:jc(o.y)},index:o.segment2}:null}(e,t)}function Bc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $c(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qc(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 Fc(e,t){var n=qc(e,t);return Bc({x:n.x-e.x,y:n.y-e.y})}function Vc(e,t){return Bc({x:e.x-t.x,y:e.y-t.y})}var Hc="djs-bendpoint",Uc="djs-segment-dragger";function Wc(e,t,n){var r=function(e,t){var n,r=Fo(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);return zc(t,r)}function Gc(e,t){var n=Ie("g");Ce(n).add(Hc),_e(e,n);var r=Ie("circle");Pe(r,{cx:0,cy:0,r:4}),Ce(r).add("djs-visual"),_e(n,r);var i=Ie("circle");return Pe(i,{cx:0,cy:0,r:10}),Ce(i).add("djs-hit"),_e(n,i),t&&Ce(n).add(t),n}function Qc(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 Zc("h"===n?r:i)}(t,n,r),s=Ie("rect");Pe(s,{x:-9,y:-3,width:18,height:6}),Ce(s).add("djs-visual"),_e(i,s);var a=Ie("rect");return Pe(a,{x:-o/2,y:-8.5,width:o,height:17}),Ce(a).add("djs-hit"),_e(i,a),er(i,"v"===r?90:0),i}function Xc(e,t,n){var r=Ie("g"),i=jt(t,n),o=Dt(t,n);return _e(e,r),Qc(r,t,n,o),Ce(r).add(Uc),Ce(r).add("h"===o?"horizontal":"vertical"),Jn(r,i.x,i.y),r}function Zc(e){return Math.abs(Math.round(2*e/3))}function Yc(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Fc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return qc(e,n)}function Kc(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Wc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=Dt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Zc("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=jt(r=t[c-1],i=t[c]),s=Dt(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){pe.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+ws(e.id)+'"]',r);return!i&&n&&(Pe(i=Ie("g"),{"data-element-id":e.id}),Ce(i).add("djs-bendpoints"),_e(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Gc(e);_e(e,r),Jn(r,t.x,t.y)})),Gc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)Dt(n=o[a-1],r=o[a])&&(Pe(i=Xc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function h(e){var t=a(e);t&&(!function(e){v(be("."+Uc,e),(function(e){Me(e)}))}(t),function(e){v(be("."+Hc,e),(function(e){Me(e)}))}(t),p(t,e),c(t,e))}function d(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=jt(s,a),u=Dt(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Jn(r,i.x,i.y))}e.on("connection.changed",(function(e){h(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Me(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Ce(t).add(e.marker):Ce(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Wc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Jn(n,r.x,r.y)}(n,r),r.bendpoint||d(n,r,o)}})),e.on("element.mousedown",(function(e){if(Uo(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=a(t);r&&Pe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=a,this.getSegmentDragger=l}Kc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Jc=Math.round,ep="reconnectStart",tp="reconnectEnd",np="updateWaypoints";function rp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,h=(a=s||0!==o?s||o!==u.length-1?np:tp:ep)===np?"connection.updateWaypoints":"connection.reconnect",d=i.allowed(h,{connection:t,source:c,target:p});!1===d&&(d=i.allowed(h,{connection:t,source:p,target:c})),!1!==d&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:d,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===np?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===ep?a:o,target:l===tp?a:s}))return n.source=l===ep?a:o,void(n.target=l===tp?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===tp?a:s,target:l===ep?a:o})),t&&(n.source=l===tp?a:s,n.target=l===ep?a: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!==np&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},h={x:Jc(e.x),y:Jc(e.y)};if(!n)return!1;p===np?(s?a.splice(r,0,h):a[r]=h,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),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===Tt(t,r=e[i+1])||Mt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===ep?(u.docking="source",ip(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===tp&&(u.docking="target",ip(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,h,u))}),this)}function ip(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===ep?t&&r&&t===r&&n!==r:i===tp?t&&n&&t===n&&n!==r:void 0}rp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],rp.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 op="updateWaypoints",sp="connect-ok",ap="connect-not-ok",lp="connect-hover",cp="djs-updating",pp="djs-dragging";function up(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,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Ce(t.draggerGfx=Gc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,pp),r.addMarker(i,cp)})),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,lp),o===op)return;n?(r.removeMarker(i,ap),r.addMarker(i,sp)):!1===n&&(r.removeMarker(i,sp),r.addMarker(i,ap))}})),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,lp),r.removeMarker(n,i?sp:ap))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,h=c.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?ip(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=a||p,h=h.reverse()):(m.connectionStart=m.connectionStart||d,m.source=a||p,m.target=u):"reconnectEnd"===l?ip(n)?(m.connectionStart=m.connectionStart||d,m.source=a||u,m.target=p,h=h.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,h[o]=d),l===op&&(h=e.cropWaypoints(c,h)),m.waypoints=h,i.drawPreview(n,r,m)),Jn(s,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,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Me(o),r.removeMarker(n,cp),r.removeMarker(n,pp),s&&(r.removeMarker(s,sp),r.removeMarker(s,a?sp:ap)),i&&i.cleanUp(t)}))}up.$inject=["bendpointMove","injector","eventBus","canvas"];var hp="connect-hover",dp="djs-updating";function fp(e,t,n){return mp(e,t,e[t]+n)}function mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function gp(e){return"x"===e?"y":"x"}function yp(e,t,n){var r,i;return e.original?e.original:(r=_n(t),mp(e,i=gp(n),r[i]))}function vp(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(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 mp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],gp(e.axis));Jn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,h=t.waypoints,d=h[p],f=h[u],m=Wc(n,h,e);(s=Dt(d,f))&&(a="v"===s?"x":"y",0===p&&(d=yp(d,t.source,a)),u===h.length-1&&(f=yp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,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=Xc(i,t.segmentStart,t.segmentEnd),Ce(t.draggerGfx).add("djs-dragging"),n.addMarker(r,dp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,h=r.axis,d=r.originalWaypoints.slice(),f=fp(p,h,e["d"+h]),m=fp(u,h,e["d"+h]),g=d.length,y=0;d[o]=f,d[s]=m,o<2&&(t=kn(i.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,y--):"intersect"!==t&&(d.unshift(p),y++)),s>g-3&&(n=kn(i.target,m),s===g-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),r.newWaypoints=i.waypoints=a(i,d),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,hp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,hp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Me(t.draggerGfx),n.removeMarker(r,dp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Mt(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}vp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var bp=Math.abs,wp=Math.round;function xp(e){return{x:e.x,y:e.y}}function _p(e){return{x:e.x+e.width,y:e.y+e.height}}function kp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:wp(e.x+e.width/2),y:wp(e.y+e.height/2)}}function Ep(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Op(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 Sp=Math.abs,Cp=Math.round;function Tp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Sp(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,t){return e.waypoints?Yc(t,e):e.width?{x:Cp(e.width/2+e.x),y:Cp(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));L(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Op(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Op(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);mn(t)&&r&&r.x&&r.y&&(Op(e,"x",r.x),Op(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=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:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),h=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));L(e,{dx:e.dx-u,dy:e.dy-h,x:e.x-u,y:e.y-h}),(u||-1!==s.vertical.indexOf(c))&&Op(e,"x",r),(h||-1!==s.horizontal.indexOf(p))&&Op(e,"y",i)}}))}Tp.$inject=["eventBus"];var Mp={__depends__:[Tc,Rc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Kc],bendpointMove:["type",rp],bendpointMovePreview:["type",up],connectionSegmentMove:["type",vp],bendpointSnapping:["type",Tp]};function Ap(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,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(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},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:Dp(t)?o:i,connectionEnd:Dp(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=_n(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Dp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Ap.$inject=["eventBus","dragging","modeling","rules"];var Np="connect-ok",Rp="connect-not-ok";function jp(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,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,h=p;Dp(t)&&(u=p,h=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:h})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Np:Rp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Np),n.removeMarker(t,Rp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}jp.$inject=["injector","eventBus","canvas"];var Ip={__depends__:[ss,Rc,Tc],__init__:["connectPreview"],connect:["type",Ap],connectPreview:["type",jp]};function Lp(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)}Lp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Lp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,h=n.noCropping,d=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ae(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 f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?_n(s):c,a?_n(a):p]),this._connectionDocking&&(s||a)&&!h&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!d&&this.drawNoopPreview(i,n)},Lp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||_n(n),o=t.connectionEnd||_n(r),s=this.cropWaypoints(i,o,n,r);_e(e,this.createNoopConnection(s[0],s[1]))},Lp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=r&&En(s,a,!1)||t]},Lp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Me(e.connectionPreviewGfx)},Lp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Lp.prototype.createConnectionPreviewGfx=function(){var e=Ie("g");return Pe(e,{pointerEvents:"none"}),Ce(e).add("djs-dragger"),_e(this._canvas.getActiveLayer(),e),e},Lp.prototype.createNoopConnection=function(e,t){return dt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var zp={__init__:["connectionPreview"],connectionPreview:["type",Lp]},Bp=["marker-start","marker-mid","marker-end"],$p=["circle","ellipse","line","path","polygon","polyline","path","rect"];function qp(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){i.cleanUp()}))}qp.$inject=["elementRegistry","eventBus","canvas","styles"],qp.prototype.cleanUp=function(){v(this._clonedMarkers,(function(e){Me(e)})),this._clonedMarkers={}},qp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},qp.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=De(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Yn(i),r),Pe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),_e(t,i),Pe(i,"data-preview-support-element-id",e.id),i},qp.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),Pe(n,"data-preview-support-element-id",e.id),n},qp.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var r=0;r<e.childNodes.length;r++)n._cloneMarkers(e.childNodes[r],t);(function(e){return-1!==$p.indexOf(e.nodeName)})(e)&&Bp.forEach((function(r){if(Pe(e,r)){var i=function(e,t,n){var r=(i=Pe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,r,n._canvas.getContainer());n._cloneMarker(e,i,r,t)}}))},qp.prototype._cloneMarker=function(e,t,n,r="djs-dragger"){var i=t.id+"-"+r,o=this._clonedMarkers[i];if(!o){var s=i+"-clone";(o=De(t)).id=s,Ce(o).add(r),this._clonedMarkers[i]=o;var a=ve("defs",this._canvas._svg);a||(a=Ie("defs"),_e(this._canvas._svg,a)),_e(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[i].id);Pe(e,n,l)};var Fp={__init__:["previewSupport"],previewSupport:["type",qp]};const Vp="complex-preview";class Hp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Vp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;mn(e)?(t=this._graphicsFactory._createContainer("connection",Ie("g")),this._graphicsFactory.drawConnection(Yn(t),e)):(t=this._graphicsFactory._createContainer("shape",Ie("g")),this._graphicsFactory.drawShape(Yn(t),e),Jn(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);mn(e)?Jn(n,t.x,t.y):Jn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Ie("g"));this._graphicsFactory.drawShape(Yn(n),e,{width:t.width,height:t.height}),Jn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Ae(this._canvas.getLayer(Vp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer(Vp)}hide(){this._canvas.hideLayer(Vp)}}Hp.$inject=["canvas","graphicsFactory","previewSupport"];var Up={__depends__:[Fp],__init__:["complexPreview"],complexPreview:["type",Hp]},Wp=["top","bottom","left","right"],Gp=10;function Qp(e,t){function n(e){if(to(e)){var n=function(e){var t=_n(e.label),n=_n(e),r=Xp(n,t);if(i=r,-1===Wp.indexOf(i))return;var i;var o=function(e){var t=_n(e),n=[].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 Xp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=_n(e),i=kn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Wp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=_n(e),i=e.label,o=_n(i);if(!i.parent)return;var s,a=bn(e);switch(n){case"top":s={x:r.x,y:a.top-Gp-i.height/2};break;case"left":s={x:a.left-Gp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Gp+i.height/2};break;case"right":s={x:a.right+Gp+i.width/2,y:r.y}}var l=pa(s,o);t.moveShape(i,l)}(e,n)}}gs.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 Xp(e,t){return kn(t,e,5)}function Zp(e){gs.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Si(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 Yp(e,t){e.invoke(gs,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return Si(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Qp,gs),Qp.$inject=["eventBus","modeling"],e(Zp,gs),Zp.$inject=["eventBus"],e(Yp,gs),Yp.$inject=["injector","modeling"];function Kp(e,t){t.invoke(gs,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 Jp(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];Jp(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function Jp(e,t){return!gn(e)&&Ci(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function eu(e,t){function n(e){return y(e.attachers,(function(e){return Si(e,"bpmn:BoundaryEvent")}))}gs.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);Si(r,"bpmn:EventBasedGateway")&&Si(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;Si(r,"bpmn:Gateway")&&Si(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);Si(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function tu(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}gs.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(ru(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>nu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!ru(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>iu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Si(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;ru(i)&&iu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>Si(e,"bpmn:Association"))),i=r.filter((e=>nu(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;ru(t)&&nu(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;nu(o)&&i(o),ru(e)&&iu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;nu(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):iu(r)&&function(e){const n=e.incoming.filter((e=>ru(e.source)));t.removeElements(n)}(r)}),!0)}function nu(e){const t=Ti(e);return t&&t.get("isForCompensation")}function ru(e){return e&&Si(e,"bpmn:BoundaryEvent")&&Yi(e,"bpmn:CompensateEventDefinition")}function iu(e){return e&&Si(e,"bpmn:Activity")&&!Zi(e)}function ou(e){e.invoke(gs,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;Si(n,"bpmn:Lane")&&!Si(r,"bpmn:Lane")&&(t.parent=dc(n,"bpmn:Participant"))}))}function su(e,t){gs.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Si(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}Kp.$inject=["bpmnReplace","injector"],e(Kp,gs),Kp.prototype._replaceShape=function(e,t){var n,r=(n=Ti(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},eu.$inject=["eventBus","modeling"],e(eu,gs),e(tu,gs),tu.$inject=["eventBus","modeling","bpmnRules"],ou.$inject=["injector"],e(ou,gs),su.$inject=["eventBus","bpmnFactory"],e(su,gs);var au=20,lu=20,cu=30,pu=2e3;function uu(e,t,n){function r(){var t=e.getRootElement();return Si(t,"bpmn:Collaboration")?t:n.makeCollaboration()}gs.call(this,t),t.on(["create.start","shape.move.start"],pu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(Si(r,"bpmn:Participant")&&Si(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!Si(e,"bpmn:Group")&&!gn(e)&&!mn(e)}));if(o.length){var s=wt(o),a=function(e,t){t={width:t.width+2*au+cu,height:t.height+2*lu};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,s);L(r,a),n.createConstraints=function(e,t){return t=bn(t),{bottom:t.top+e.height/2-lu,left:t.right-e.width/2+au,top:t.bottom-e.height/2+lu,right:t.left+e.width/2-au-cu}}(r,s)}}})),t.on("create.start",pu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}Si(r,"bpmn:Participant")&&Si(i,"bpmn:Process")&&(t.on("element.hover",pu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",pu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return Si(e,"bpmn:Participant")}))}(n);o&&Si(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Ti(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Si(n,"bpmn:Participant")&&Si(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Ti(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||Ti(r).set("processRef",Ti(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||Ti(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 s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}uu.$inject=["canvas","eventBus","modeling"],e(uu,gs);var hu="__targetRef_placeholder";function du(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===hu}));return!i&&n&&St(r,i=t.create("bpmn:Property",{name:hu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Pt(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==l&&r(h,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),d.targetRef=t):d.targetRef=null}gs.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],fu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],fu(i))}function fu(e){return function(t){if(Si(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function mu(e){this._bpmnUpdater=e}function gu(e,t,n,r){function i(e){return e.children.filter((function(e){return Si(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return Si(e,"bpmn:Participant")&&Ti(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Mi(e),newSemanticParent:o.processRef||o,newDiParent:Mi(r)})}}gs.call(this,r),t.registerHandler("dataStore.updateContainment",mu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Si(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 Si(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Si(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Si(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Si(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!Si(r,"bpmn:Collaboration")&&Si(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Si(i,"bpmn:Collaboration")){var s=Si(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(Si(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ci(n,["bpmn:Participant","bpmn:SubProcess"])&&Si(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){Si(r,"bpmn:Process")&&o(e,r)}))}))}du.$inject=["eventBus","bpmnFactory"],e(du,gs),mu.$inject=["bpmnUpdater"],mu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},mu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(gu,gs);var yu=Math.max,vu=Math.min,bu=20;function wu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?vu:yu)(r,i)),u(o)&&(r=(/top|left/.test(e)?yu:vu)(r,o)),r}function _u(e,t){return void 0!==e?e:bu}function ku(e){return!e.waypoints&&"label"!==e.type}function Eu(e,t){var n;if((n=void 0===e.length?y(e.children,ku):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=_u(t.left),r=_u(t.right),i=_u(t.top),o=_u(t.bottom)):n=r=i=o=_u(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(wt(n),t)}var Ou=Math.abs;var Pu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){Si(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Tu(e){return e.children.filter((function(e){return Si(e,"bpmn:Lane")}))}function Mu(e){return dc(e,Pu)||e}function Au(e,t){var n=Mu(e),r=Cu(n,Si(n,"bpmn:Process")?[]:[n]),i=bn(e),o=bn(t),s=function(e,t){return wu(bn(t),bn(e))}(e,t),a=[],l=Qi(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,h=l?s.left:0,d=bn(t);s.top&&(Ou(d.bottom-i.top)<10&&(u=o.top-d.bottom),Ou(d.top-i.top)<5&&(c=o.top-d.top)),s.left&&(Ou(d.right-i.left)<10&&(p=o.left-d.right),Ou(d.left-i.left)<5&&(h=o.left-d.left)),s.bottom&&(Ou(d.top-i.bottom)<10&&(c=o.bottom-d.top),Ou(d.bottom-i.bottom)<5&&(u=o.bottom-d.bottom)),s.right&&(Ou(d.left-i.right)<10&&(h=o.right-d.left),Ou(d.right-i.right)<5&&(p=o.right-d.right)),(c||p||u||h)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:h},{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)})})}})),a}function Du(e,t){gs.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;Si(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Qi(e),c=Tu(n),p=[],u=[],h=[],d=[];vt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?d.push(t):h.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:d.length&&h.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),h.length&&(s=t.calculateAdjustments(h,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),d.length&&(a=t.calculateAdjustments(d,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Du.$inject=["eventBus","spaceTool"],e(Du,gs);function Nu(e,t){t.invoke(gs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Ru(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,s=e.host;Ru(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function Ru(e,t){return!gn(e)&&Si(e,"bpmn:BoundaryEvent")&&!t}function ju(e,t,n){function r(e,r,i){var o,s,a,l,c,p,h,d,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=zc(f,d=u(i.width)?_n(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:d,1!==o.length&&Iu(e,o[o.length-1])||o.push(Lu(a)),1!==s.length&&Iu(e,s[0])||s.unshift(Lu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||d),p=r),t.canConnect(e,c,r)&&(p?h=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||d),h=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],h&&y(m,(function(e){return e.target===h.target}))||[]);b.length&&n.removeElements(b)}gs.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 s=_n(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&zc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)}),!0),this.preExecute("shape.create",(function(e){var 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 Iu(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 Lu(e){return L({},e)}function zu(e,t){gs.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Bu(r)){(Si(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Bu(e))):o.incoming.filter((e=>e!==r&&Bu(e)&&Si(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Si(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Bu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Bu).forEach((function(r){const i=e.incoming.filter(Bu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Bu(e){return Si(e,"bpmn:SequenceFlow")}Nu.$inject=["bpmnReplace","injector"],e(Nu,gs),Nu.prototype._replaceShape=function(e){var t,n,r=(n=Ti(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(ju,gs),ju.$inject=["eventBus","bpmnRules","modeling"],zu.$inject=["eventBus","modeling"],e(zu,gs);var $u=1500;function qu(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"],$u,(function(t){var r=t.context.shape||t.shape,i=t.hover;Si(i,"bpmn:Lane")&&!Ci(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Mu(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Ci(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(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"],$u,(function(t){var n=t.hover;Si(n,"bpmn:Lane")&&(t.hover=Mu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],$u,(function(t){var n=t.context,r=t.hover,i=n.type;Si(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Mu(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],$u,(function(e){var t=e.context,n=t.start;Si(n,"bpmn:Lane")&&(t.start=Mu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Si(t,"bpmn:Lane")&&(e.shape=Mu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Si(t,"bpmn:Lane")&&(e.hover=Mu(t))}))}qu.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return Si(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Ti(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Pt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Ti(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Pt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Ti(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Ti(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(gs,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Si(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Si(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Ti(n);if(Si(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Si(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Ti(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Si(n,"bpmn:Group")&&!n.labelTarget&&Ti(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Si(n,"bpmn:Group")&&!n.labelTarget&&Ti(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Si(n,"bpmn:Group")&&!n.labelTarget){var r=Ti(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Vu(e,t,n,r){var i,o,s,a;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,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Hu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Vu(e,t,n,i),a=Vu(e,t,n,o);r=s&&a?Uu(s,n)>Uu(a,n)?a:s:s||a,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],_n(n.source)),t(r[r.length-1],r[r.length-2],_n(n.target)))}))}function Uu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){gs.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=Ti(n),i=Mi(n);if(Ci(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,gs),Hu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,gs);var Gu=Math.sqrt,Qu=Math.min,Xu=Math.max,Zu=Math.abs;function Yu(e){return Math.pow(e,2)}function Ku(e,t){return Gu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Ju(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Gu(p),h=-c+u,d=-c-u,f={x:e.x-i*h,y:e.y-o*h};return 0===p?[f]:[f,{x:e.x-i*d,y:e.y-o*d}].filter((function(n){return function(e,t,n){return eh(e.x,t.x,n.x)&&eh(e.y,t.y,n.y)}(n,e,t)}))}function eh(e,t,n){return e>=Qu(t,n)-th&&e<=Xu(t,n)+th}var th=.1;function nh(e,t){return Zu(e.x-t.x)<=th&&Zu(e.y-t.y)<=th}function rh(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,h,d,f=0;for(f=0;f<t.length-1;f++){if(nh(n=t[f],r=t[f+1])?a=[n]:(i=Ku(e,n),o=Ku(e,r),a=Ju(n,r,e,Qu(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:nh(n,a[0])?f:f+1}),2===a.length&&(h=a[0],d=a[1],l={type:"segment",position:s={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:f,relativeLocation:Ku(n,s)/Ku(n,r)}),c=Ku(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&ih(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,h=oh(n,l),d=oh(t,c),f=a.position,m=function(e,t){var n=Vc(e[0],e[1]),r=Vc(e[0],t);return 0===n?0:r/n}(h,f),g=(p=d,u=$c(h),$c(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=ih(n,v))}var x,_,k={x:(d[1].x-d[0].x)*m+d[0].x,y:(d[1].y-d[0].y)*m+d[0].y},E=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=k.x+E.x-e.x,o=k.y+E.y-e.y,{point:vn(k),delta:vn({x:i,y:o})}}function ih(e,t){var n=Vc(e[t-1],e[t]);return n/(n+Vc(e[t],e[t+1]))}function oh(e,t){return[e[t],e[t+1]]}function sh(e,t,n){var r=ca(t),i=ca(n),o=pa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return vn({x:i.x+s,y:i.y+a})}function ah(e,t,n){var r=ca(e),i=ca(t),o=ca(n),s=pa(e,r),a=pa(r,i),l=function(e,t,n){var r=bn(t),i=bn(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,s,a,l=kn(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=kn(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,h=o.y+p;return vn({x:u+s.x-e.x,y:h+s.y-e.y})}var lh="name",ch="text";function ph(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(lh in o&&t.updateLabel(i,o[lh]),ch in o&&Si(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[ch]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=L({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return rh(_n(e),t,n,r).delta}(r,o,s,i)}gs.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Ti(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!gn(r)&&eo(r)&&oo(r)&&t.updateLabel(r,oo(r))}})),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(["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=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Ti(n);i&&eo(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,s=r.oldBounds;if(to(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Fc(e,t)}}));return T(n,"distance")[0].line}(e,t);return qc(e,n)}(_n(a),[[{x:(n=s).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)}]]),c=uh(l,s,o);t.moveShape(a,c)}}))}function uh(e,t,n){return vn(pa(sh(e,t,n),e))}function hh(e,t){function n(e,t){var n=e.context,r=n.connection,i=L({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return rh(e,t,n,r).point}(t,o,s,i)}gs.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function dh(e,t,n){var r=vh(e),i=bh(r,t),o=r[0];return i.length?i[i.length-1]:sh(o.original||o,n,t)}function fh(e,t,n){var r=vh(e),i=bh(r,t),o=r[r.length-1];return i.length?i[0]:sh(o.original||o,n,t)}function mh(e,t,n){var r=vh(e),i=yh(t,n),o=r[0];return sh(o.original||o,i,t)}function gh(e,t,n){var r=vh(e),i=yh(t,n),o=r[r.length-1];return sh(o.original||o,i,t)}function yh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vh(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bh(e,t){return y(k(e,wh),(function(e){return function(e,t){return"intersect"===kn(t,e,1)}(e,t)}))}function wh(e){return e.original||e}function xh(e,t){gs.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return Si(e,"bpmn:Participant")&&Gi(e)&&Si(t,"bpmn:Participant")&&!Gi(t)}(n,r)){var i,o,s,a,l=(o=bt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){Si(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Si(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=fh(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=dh(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(ph,gs),ph.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(hh,gs),hh.$inject=["eventBus","modeling"],xh.$inject=["eventBus","modeling"],e(xh,gs);const _h=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function kh(e){const t=Ti(e);if(!(Si(t,"bpmn:BoundaryEvent")||Si(t,"bpmn:StartEvent")&&Zi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&_h.some((e=>Si(n[0],e)))}function Eh(e){return Si(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Oh(e,t){e.invoke(gs,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!kh(r))return;const o=Eh(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Ti(n).get(o);s!==Ti(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Ph(e,t){gs.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Mi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Sh(e,t,n){gs.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(Si(i,"bpmn:SequenceFlow")&&Si(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Vu(Ch(e[e.length-2]),Ch(e[e.length-1]),Ch(t[1]),Ch(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ch(e[0]),Ch(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Ch(e){return e.original||e}function Th(e,t){gs.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Si(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 Mh(e,t,n,r){gs.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(Si(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),Si(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Ah(e,t,n,r,i,o){r.invoke(gs,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=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Zi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,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})}))}Oh.$inject=["injector","modeling"],e(Oh,gs),e(Ph,gs),Ph.$inject=["eventBus","modeling"],e(Sh,gs),Sh.$inject=["eventBus","bpmnRules","modeling"],Th.$inject=["eventBus","modeling"],e(Th,gs),e(Mh,gs),Mh.$inject=["eventBus","modeling","bpmnRules","injector"],e(Ah,gs),Ah.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Ah.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Dh={width:140,height:120},Nh={width:300,height:60},Rh={width:60,height:300},jh={width:300,height:150},Ih={width:150,height:300},Lh={width:140,height:120},zh={width:50,height:30};function Bh(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(Si(n,"bpmn:Lane")||Si(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Mu(e),i=!0,o=!0,s=Cu(r,[r]),a=bn(e),l={},c={},p=Qi(e),u=p?Nh:Rh;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=bn(e);/n/.test(t)&&(p&&r.top<a.top-10&&(i=!1),n&&$h(a.top-r.bottom)<10&&Uh(l,"top",r.top+u.height),$h(a.top-r.top)<5&&Hh(c,"top",r.bottom-u.height)),/e/.test(t)&&(!p&&r.right>a.right+10&&(o=!1),n&&$h(a.right-r.left)<10&&Hh(l,"right",r.right-u.width),$h(a.right-r.right)<5&&Uh(c,"right",r.left+u.width)),/s/.test(t)&&(p&&r.bottom>a.bottom+10&&(o=!1),n&&$h(a.bottom-r.top)<10&&Hh(l,"bottom",r.bottom-u.height),$h(a.bottom-r.bottom)<5&&Uh(c,"bottom",r.top+u.height)),/w/.test(t)&&(!p&&r.left<a.left-10&&(i=!1),n&&$h(a.left-r.right)<10&&Uh(l,"left",r.left+u.width),$h(a.left-r.left)<5&&Hh(c,"left",r.right-u.width))}));var h=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Si(e,"bpmn:FlowElement")||Si(e,"bpmn:Artifact"))})),d=p?Wh:Gh;return h.forEach((function(e){var n=bn(e);i&&/n/.test(t)&&Hh(c,"top",n.top-d.top),o&&/e/.test(t)&&Uh(c,"right",n.right+d.right),o&&/s/.test(t)&&Uh(c,"bottom",n.bottom+d.bottom),i&&/w/.test(t)&&Hh(c,"left",n.left-d.left)})),{min:c,max:l}}(n,r,i)),Si(n,"bpmn:SubProcess")&&Gi(n)&&(t.minDimensions=Lh),Si(n,"bpmn:TextAnnotation")&&(t.minDimensions=zh)}))}Bh.$inject=["eventBus"];var $h=Math.abs,qh=Math.min,Fh=Math.max;function Vh(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Hh(e,t,n){return Vh(e,t,n,qh)}function Uh(e,t,n){return Vh(e,t,n,Fh)}var Wh={top:20,left:50,right:20,bottom:20},Gh={top:50,left:20,right:20,bottom:20};function Qh(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Si(n,"bpmn:Lane")||Si(n,"bpmn:Participant"))&&(t.balanced=!Wo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(Si(r,"bpmn:Lane")||Si(r,"bpmn:Participant"))return i&&(o=yn(o),t.resizeLane(r,o,n.balanced)),!1}))}Qh.$inject=["eventBus","modeling"];function Xh(e,t,n,r,i){function o(e){return Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Yi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return Si(e,"bpmn:ErrorEventDefinition")?"errorRef":Si(e,"bpmn:EscalationEventDefinition")?"escalationRef":Si(e,"bpmn:MessageEventDefinition")?"messageRef":Si(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(gs,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Ti(n));r&&!s(r)&&(St(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Pt(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Ti(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Ci(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(a(n),t)}(n,o),delete t.referencedRootElement)}))}Xh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xh,gs);var Zh=Math.max;function Yh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;Si(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Qi(e);if(i=e,!Tu(i).length)return r?jh:Ih;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?jh:{width:Jh(e,n,o),height:Ih.height}:r?{width:jh.width,height:Kh(e,n,o)}:Ih;return s}(e,n,r)),Si(e,"bpmn:Lane")&&(i[t]=Qi(e)?Nh:Rh),Si(e,"bpmn:SubProcess")&&Gi(e)&&(i[t]=Lh),Si(e,"bpmn:TextAnnotation")&&(i[t]=zh),Si(e,"bpmn:Group")&&(i[t]=Dh)})),i}))}function Kh(e,t,n){var r;return r=function(e,t,n){var r,i=Tu(e);return r=ed(i,t,n),e.height-r.height+Nh.height}(e,t,n),Zh(jh.height,r)}function Jh(e,t,n){var r;return r=function(e,t,n){var r,i=Tu(e);return r=ed(i,t,n),e.width-r.width+Rh.width}(e,t,n),Zh(Ih.width,r)}function ed(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Tu(i)).length?ed(o,t,n):i}Yh.$inject=["eventBus"];var td=180,nd=160;function rd(e,t,n,r,i,o,s){gs.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return Si(e,"bpmn:SubProcess")&&!Gi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Ti(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Ti(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Os(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(Os(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(Os(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Os(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Si(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ss(t))return s.updateId(t,Ps(i)),void s.updateId(r,i);s.get(Ps(r))&&s.updateId(Ps(r),Ps(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Si(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ss(t))return s.updateId(t,Ps(r)),void s.updateId(i,r);var o=s.get(Ps(i));o&&s.updateId(o,Ps(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(Ss(n)){var r=n,i=s.get(Es(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Si(t,"bpmn:SubProcess")&&(Gi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Si(t,"bpmn:SubProcess")&&(Gi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Si(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Gi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=Os(t),i=s.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(Si(Mi(i),"bpmndi:BPMNPlane")){var o=Es(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function id(e,t){e.invoke(gs,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(Si(r,"bpmn:SubProcess")&&(Si(n,"bpmn:Task")||Si(n,"bpmn:CallActivity"))&&Gi(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 od(e){gs.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;Si(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&Si(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function sd(e,t){gs.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Gi(n)){var r=bt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(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,_n(n)):t.reconnectStart(e,n,_n(n)))}}),!0)}e(rd,gs),rd.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=wt(o);if(t.x){var a=_n(t),l=_n(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:td-s.x,y:nd-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},rd.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},rd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},rd.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:Os(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},rd.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=m(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},rd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],id.$inject=["injector","modeling"],e(id,gs),e(od,gs),od.$inject=["eventBus"],e(sd,gs),sd.$inject=["eventBus","modeling"];function ad(e,t,n){gs.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Si(n,"bpmn:SubProcess")&&(n.collapsed?Mi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Mi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Mi(t).isExpanded=!1:Mi(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,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Eu(n))?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function ld(e,t,n,r){t.invoke(gs,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;gn(t)||(Si(t,"bpmn:Participant")&&Gi(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;Si(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function cd(e,t){gs.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!Si(e,"bpmn:SequenceFlow"))return!1;var n=Ti(t),r=Ti(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(ad,gs),ad.$inject=["eventBus","elementFactory","modeling"],e(ld,gs),ld.$inject=["canvas","injector","moddle","modeling"],e(cd,gs),cd.$inject=["eventBus","modeling"];function pd(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}gs.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 ud).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||(Si(t,"bpmn:Lane")&&n.addLane(t),Si(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function ud(){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}}pd.$inject=["eventBus","modeling","translate"],e(pd,gs);var hd={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",Qp],appendBehavior:["type",Zp],associationBehavior:["type",Yp],attachEventBehavior:["type",Kp],boundaryEventBehavior:["type",eu],compensateBoundaryEventBehaviour:["type",tu],createBehavior:["type",ou],createDataObjectBehavior:["type",su],createParticipantBehavior:["type",uu],dataInputAssociationBehavior:["type",du],dataStoreBehavior:["type",gu],deleteLaneBehavior:["type",Du],detachEventBehavior:["type",Nu],dropOnFlowBehavior:["type",ju],eventBasedGatewayBehavior:["type",zu],fixHoverBehavior:["type",qu],groupBehavior:["type",Fu],importDockingFix:["type",Hu],isHorizontalFix:["type",Wu],labelBehavior:["type",ph],layoutConnectionBehavior:["type",hh],messageFlowBehavior:["type",xh],nonInterruptingBehavior:["type",Oh],removeElementBehavior:["type",Sh],removeEmbeddedLabelBoundsBehavior:["type",Ph],removeParticipantBehavior:["type",Th],replaceConnectionBehavior:["type",Mh],replaceElementBehaviour:["type",Ah],resizeBehavior:["type",Bh],resizeLaneBehavior:["type",Qh],rootElementReferenceBehavior:["type",Xh],spaceToolBehavior:["type",Yh],subProcessPlaneBehavior:["type",rd],subProcessStartEventBehavior:["type",id],textAnnotationBehavior:["type",od],toggleCollapseConnectionBehaviour:["type",sd],toggleElementCollapseBehaviour:["type",ad],unclaimIdBehavior:["type",ld],unsetDefaultFlowBehavior:["type",cd],updateFlowNodeRefsBehavior:["type",pd]};function dd(e,t){var n=kn(e,t,-15);return"intersect"!==n?n:null}function fd(e){Jl.call(this,e)}function md(e){return!e||gn(e)}function gd(e){do{if(Si(e,"bpmn:Process"))return Ti(e);if(Si(e,"bpmn:Participant"))return Ti(e).processRef||Ti(e)}while(e=e.parent)}function yd(e){return Si(e,"bpmn:TextAnnotation")}function vd(e){return Si(e,"bpmn:Group")&&!e.labelTarget}function bd(e){return Si(e,"bpmn:BoundaryEvent")&&kd(e,"bpmn:CompensateEventDefinition")}function wd(e){return Ti(e).isForCompensation}function xd(e){for(var t=e;t=t.parent;){if(Si(t,"bpmn:FlowElementsContainer"))return Ti(t);if(Si(t,"bpmn:Participant"))return Ti(t).processRef}return null}function _d(e,t){return xd(e)===xd(t)}function kd(e,t){return!!m(Ti(e).eventDefinitions||[],(function(e){return Si(e,t)}))}function Ed(e,t){return(Ti(e).eventDefinitions||[]).every((function(e){return Si(e,t)}))}function Od(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function Pd(e,t,n){if(md(e)||md(t))return null;if(!Si(n,"bpmn:DataAssociation")){if($d(e,t))return{type:"bpmn:MessageFlow"};if(qd(e,t))return{type:"bpmn:SequenceFlow"}}var r=Fd(e,t);return r||(Bd(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!zd(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Sd(e,t){return!(!gn(e)&&!vd(e))||!(Si(t,"bpmn:Participant")&&!Gi(t))&&(Si(e,"bpmn:Participant")?Si(t,"bpmn:Process")||Si(t,"bpmn:Collaboration"):Ci(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Si(e,"bpmn:Lane")?Si(t,"bpmn:Participant")||Si(t,"bpmn:Lane"):!(Si(e,"bpmn:BoundaryEvent")&&!function(e){return Ti(e).cancelActivity&&(Md(e)||Ad(e))}(e))&&(Si(e,"bpmn:FlowElement")&&!Si(e,"bpmn:DataStoreReference")?Si(t,"bpmn:FlowElementsContainer")?Gi(t):Ci(t,["bpmn:Participant","bpmn:Lane"]):Si(e,"bpmn:DataStoreReference")&&Si(t,"bpmn:Collaboration")?_(Ti(t).get("participants"),(function(e){return!!e.get("processRef")})):Ci(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ci(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Si(e,"bpmn:MessageFlow")&&(Si(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Cd(e){return Si(e,"bpmn:Lane")}function Td(e){return!!function(e){return!gn(e)&&Si(e,"bpmn:BoundaryEvent")}(e)||(!(!Si(e,"bpmn:IntermediateThrowEvent")||!Md(e))||Si(e,"bpmn:IntermediateCatchEvent")&&Ad(e))}function Md(e){var t=Ti(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ad(e){return Dd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dd(e,t){return t.some((function(t){return kd(e,t)}))}function Nd(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!gn(i)&&(!!Td(i)&&(!Zi(t)&&(!(!Si(t,"bpmn:Activity")||wd(t))&&(!(r&&!dd(r,t))&&(!function(e){return Si(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return Si(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Rd(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Zi(t)||Si(e,"bpmn:StartEvent")&&"label"!==e.type&&Sd(e,t)&&(Xi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Yi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Yi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Yi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Dd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Si(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Si(t,"bpmn:Transaction")||kd(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Si(e,"bpmn:EndEvent")&&Sd(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Si(e,"bpmn:BoundaryEvent")&&Nd(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function jd(e,t){return!_(e,Cd)&&(!t||e.every((function(e){return Sd(e,t)})))}function Id(e,t,n,r){return!!t&&(!(!gn(e)&&!vd(e))||!function(e,t){return e===t}(n,t)&&((!n||!Od(n,t))&&(Sd(e,t)||Vd(e,t))))}function Ld(e,t){return Si(e,"bpmn:SubProcess")?Gi(e)&&(!t||t.width>=100&&t.height>=80):!!Si(e,"bpmn:Lane")||(!!Si(e,"bpmn:Participant")||(!!yd(e)||!!vd(e)))}function zd(e,t){return!Od(t,e)&&!Od(e,t)&&(!!function(e,t){var n=yd(e),r=yd(t);return(n||r)&&n!==r}(e,t)||!!Fd(e,t))}function Bd(e,t){return _d(e,t)&&bd(e)&&Si(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Zi(t);var n}function $d(e,t){return!(Ud(e)&&!Ud(t))&&(Si(n=e,"bpmn:InteractionNode")&&!Si(n,"bpmn:BoundaryEvent")&&(!Si(n,"bpmn:Event")||Si(n,"bpmn:ThrowEvent")&&Ed(n,"bpmn:MessageEventDefinition"))&&function(e){return Si(e,"bpmn:InteractionNode")&&!wd(e)&&(!Si(e,"bpmn:Event")||Si(e,"bpmn:CatchEvent")&&Ed(e,"bpmn:MessageEventDefinition"))&&!(Si(e,"bpmn:BoundaryEvent")&&!kd(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return gd(e)===gd(t)}(e,t));var n}function qd(e,t){return Si(n=e,"bpmn:FlowNode")&&!Si(n,"bpmn:EndEvent")&&!Zi(n)&&!(Si(n,"bpmn:IntermediateThrowEvent")&&kd(n,"bpmn:LinkEventDefinition"))&&!bd(n)&&!wd(n)&&function(e){return Si(e,"bpmn:FlowNode")&&!Si(e,"bpmn:StartEvent")&&!Si(e,"bpmn:BoundaryEvent")&&!Zi(e)&&!(Si(e,"bpmn:IntermediateCatchEvent")&&kd(e,"bpmn:LinkEventDefinition"))&&!wd(e)}(t)&&_d(e,t)&&!(Si(e,"bpmn:EventBasedGateway")&&!function(e){return Si(e,"bpmn:ReceiveTask")||Si(e,"bpmn:IntermediateCatchEvent")&&(kd(e,"bpmn:MessageEventDefinition")||kd(e,"bpmn:TimerEventDefinition")||kd(e,"bpmn:ConditionalEventDefinition")||kd(e,"bpmn:SignalEventDefinition"))}(t));var n}function Fd(e,t){return Ci(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ci(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ci(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ci(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Vd(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&&(Ci(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!gn(t)&&Si(e,"bpmn:FlowNode")&&!Si(e,"bpmn:BoundaryEvent")&&Sd(e,t.parent))}function Hd(e,t){return!!gn(t)||!(Si(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Ud(e){return dc(e,"bpmn:Process")||dc(e,"bpmn:Collaboration")}e(fd,Jl),fd.$inject=["eventBus"],fd.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(md(e))return null;return Ci(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 Pd(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Pd(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Ld(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(mn(r)&&!Vd(t,r))&&x(t,(function(e){return mn(e)?Pd(e.source,e.target,e):e.host?Nd(e,e.host,null,n):Id(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Nd(n,t,null,r)||Rd(n,t,r)||jd(n,t)||Vd(n,t)})),this.addRule("shape.create",(function(e){return Id(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Nd(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Hd(e.elements,t)}))},fd.prototype.canConnectMessageFlow=$d,fd.prototype.canConnectSequenceFlow=qd,fd.prototype.canConnectDataAssociation=Fd,fd.prototype.canConnectAssociation=zd,fd.prototype.canConnectCompensationAssociation=Bd,fd.prototype.canMove=jd,fd.prototype.canAttach=Nd,fd.prototype.canReplace=Rd,fd.prototype.canDrop=Sd,fd.prototype.canInsert=Vd,fd.prototype.canCreate=Id,fd.prototype.canConnect=Pd,fd.prototype.canResize=Ld,fd.prototype.canCopy=Hd;var Wd={__depends__:[Rc],__init__:["bpmnRules"],bpmnRules:["type",fd]};function Gd(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Mi(e);t=k(y(bt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Mi),n.set("planeElement",t)}))}))}Gd.$inject=["eventBus","canvas"];var Qd={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gd]};function Xd(e){gs.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 Zd(e,t,n){Xd.call(this,e);var r=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{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=m(r,(function(t){return Ci(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||Si(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!Ci(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),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Xd.prototype.getOrdering=function(e,t){return null},e(Xd,gs),Zd.$inject=["eventBus","canvas","translate"],e(Zd,Xd);var Yd={__depends__:[No],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Zd]};function Kd(){}Kd.prototype.get=function(){return this._data},Kd.prototype.set=function(e){this._data=e},Kd.prototype.clear=function(){var e=this._data;return delete this._data,e},Kd.prototype.isEmpty=function(){return!this._data};var Jd={clipboard:["type",Kd]},ef="drop-ok",tf="drop-not-ok",nf="attach-ok",rf="new-parent",of="create";function sf(e,t,n,r,i){function o(t,n){[nf,ef,tf,rf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===of&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);af(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||gn(t)&&-1!==e.indexOf(n))})),(function(e){return!mn(e)})),a=!1,l=!1,c=!1;lf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=lf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,nf):o(r,c?rf:tf))})),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,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;af(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,L({},p,{attach:l})),(function(e){return!mn(e)})),L(t,{elements:o,shape:i}),L(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!mn(e)}));if(i){r=L({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=wt(y(n,(function(e){return!e.hidden})));v(n,(function(e){mn(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}}))),L(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,of,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function af(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 lf(e){return e&&1===e.length&&!mn(e[0])}sf.$inject=["canvas","dragging","eventBus","modeling","rules"];function cf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Ie("g");Pe(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(Yn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Yn(i),e),Jn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||_e(e.getActiveLayer(),l),Jn(l,t.x,t.y)):Me(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Me(t)}))}cf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var pf={__depends__:[Tc,Fp,Rc,ss],__init__:["create","createPreview"],create:["type",sf],createPreview:["type",cf]};function uf(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)}))}uf.$inject=["eventBus"],uf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var hf={__init__:["mouse"],mouse:["type",uf]};function df(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),mn(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=ff(e)).original&&(e.original=ff(e.original)),e}))}(n)),gn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){L(e.hints,{createElementsBehavior:!1})}))}function ff(e){return L({},e)}function mf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}df.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],df.prototype.copy=function(e){var t,n;return c(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(c(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},df.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||{}})}},df.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=wt(e);return v(e,(function(e){mn(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}}))),L(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,L({},r))},df.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=L({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),mn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):gn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},df.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},df.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},df.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},df.prototype.hasRelations=function(e,t){var n,r;return!(mn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(gn(e)&&!m(t,M({id:e.labelTarget.id})))},df.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(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),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return vt(mt(e),(function(e,t,r){if(!gn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(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=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),v(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)?mf(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):mf(i.element,e)})),r};var gf={__depends__:[Jd,pf,hf,Rc],__init__:["copyPaste"],copyPaste:["type",df]};function yf(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function vf(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Ti(n);if(gn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Mi(n),!0);s.bpmnElement=o,yf(o,t,"name"),yf(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(gn(n))return n.businessObject=Ti(t[n.labelTarget]),void(n.di=Mi(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,yf(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Si(n,"bpmn:Participant")){var i=Ti(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Ti(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Ti(e).attachedToRef=Ti(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}vf.$inject=["bpmnFactory","eventBus","moddleCopy"];var bf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function wf(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 T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===bf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&h(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function xf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}wf.$inject=["eventBus","bpmnFactory","moddle"],wf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||xf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},wf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},wf.prototype._copyId=function(e,t,n=!1){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var _f={__depends__:[gf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",vf],moddleCopy:["type",wf]},kf=Math.round;function Ef(e,t){this._modeling=e,this._eventBus=t}function Of(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Ef.$inject=["modeling","eventBus"],Ef.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=kf(a+o/2),p=kf(l+s/2),u=r.replaceShape(e,L({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Of.$inject=["selection","eventBus"];var Pf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Of],replace:["type",Ef]};var Sf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Cf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,h=a.businessObject;if(Tf(h)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Gi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var d=e.create(u),m={type:u,businessObject:d,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(xf(h.$descriptor),xf(d.$descriptor,!0));L(d,$(l,Sf));var b=y(g,(function(e){return"eventDefinitions"===e?Mf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Zi(d):!f(d,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Zi(d))))}));if(d=n.copyElement(h,d,b),l.eventDefinitionType&&(Mf(d,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),Si(h,"bpmn:Activity")){if(Tf(h))m.isExpanded=Gi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(d,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Gi(a)&&!Si(h,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}return Tf(h)&&!Tf(d)&&(p.moveChildren=!1),Si(h,"bpmn:Participant")&&(!0===l.isExpanded?d.processRef=e.create("bpmn:Process"):p.moveChildren=!1,m.width=a.width,m.height=t.getDefaultSize(m).height),o.allowed("shape.resize",{shape:d})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),d.name=h.name,Ci(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ci(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=h.default),l.host&&!Si(h,"bpmn:BoundaryEvent")&&Si(d,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Tf(e){return Si(e,"bpmn:SubProcess")}function Mf(e,t){var n=Ti(e);return t&&n.get("eventDefinitions").some((function(e){return Si(e,t)}))}Cf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Af={__depends__:[_f,Pf,ss],bpmnReplace:["type",Cf]};function Df(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Df.$inject=["eventBus","dragging"],Df.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)},Df.prototype.isActive=function(e){return e&&this._active===e},Df.prototype.length=function(e){return this._tools.length},Df.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Df.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),v(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&&ne(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Nf={__depends__:[Tc],__init__:["toolManager"],toolManager:["type",Df]};function Rf(e,t){return-1!==e.indexOf(t)}var jf=Math.abs,If=Math.round,Lf={x:"width",y:"height"},zf="crosshair",Bf={n:"top",w:"left",s:"bottom",e:"right"},$f=1500,qf={n:"s",w:"e",s:"n",e:"w"},Ff=20;function Vf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",$f,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Uf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Uf(e);var c={x:0,y:0};c[r]=If(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Hf(e){return{top:e.top-Ff,right:e.right+Ff,bottom:e.bottom+Ff,left:e.left-Ff}}function Uf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Wf(e,t){return-1!==e.indexOf(t)}Vf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Vf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:zf,data:{context:{reactivate:n}},trapClick:!1})},Vf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:zf,data:{context:{}}})},Vf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Vf.prototype.init=function(e,t){var n=jf(e.dx)>jf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(jf(r)<5)return!1;r<0&&(r*=-1),Wo(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),s=this._canvas.getRootElement();!Go(e)&&e.hover&&(s=e.hover);var a=[...bt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,h,d,f,m,g,v=e.attachers,b=e.children,w=bn(e),x=y(b,(function(e){return!(mn(e)||gn(e)||Wf(o,e)||Wf(s,e))})),_=y(b,(function(e){return!mn(e)&&!gn(e)&&Wf(o,e)})),k=[],E=[];x.length&&(h=Hf(bn(wt(x))),p=r-w[Bf[n]]+h[Bf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(d=Hf(bn(wt(_))),p=r-d[Bf[qf[n]]]+w[Bf[qf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){Wf(o,e)?k.push(e):E.push(e)})),k.length&&(f=bn(wt(k.map(_n))),m=w[Bf[qf[n]]]-(f[Bf[qf[n]]]-r)),E.length&&(g=bn(wt(E.map(_n)))[Bf[n]]-(w[Bf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Lf[t]]-O[Lf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Lf[t]]-O[Lf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Lf[t]]+O[Lf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Lf[t]]+O[Lf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return L(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),oa("resize-"+("x"===n?"ew":"ns")),!0},Vf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!gn(e))if(mn(e))l.push(e);else{var o=e[t],p=o+e[Lf[t]];if(function(e){return!!e.host}(e)&&(n>0&&_n(e)[t]>r||n<0&&_n(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;Wf(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;Wf(p,t)&&Wf(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Vf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Gf="djs-dragging",Qf="djs-resizing",Xf=Math.max;function Zf(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,Gf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Ie("g");Pe(a,r.cls("djs-crosshair-group",["no-events"])),_e(t,a);var l=Ie("path");Pe(l,"d",o),Ce(l).add("djs-crosshair"),_e(a,l);var c=Ie("path");Pe(c,"d",s),Ce(c).add("djs-crosshair"),_e(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Jn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Me(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Pe(a=Ie("path"),"d","M0,0 L0,0"),Ce(a).add("djs-crosshair"),_e(u,a),s.line=a;var h=Ie("g");Pe(h,r.cls("djs-drag-group",["no-events"])),_e(n.getActiveLayer(),h),o(c,h),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),mn(e)&&(t||r)&&(n||i)})),h),s.dragGroup=h}if(!s.frameGroup){var d=Ie("g");Pe(d,r.cls("djs-frame-group",["no-events"])),_e(n.getActiveLayer(),d);var f=[];v(p,(function(e){var t=i.addFrame(e,d),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,Qf)})),s.frameGroup=d,s.frames=f}Pe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Jn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Pe(r,{width:Xf(i.width+m.x,5)}):Pe(r,{width:t=Xf(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Pe(r,{height:Xf(i.height+m.y,5)}):Pe(r,{height:n=Xf(i.height-m.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,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,Gf)})),v(i,(function(e){n.removeMarker(e,Gf)})),a&&(Me(s),Me(a)),v(o,(function(e){n.removeMarker(e,Qf)})),l&&Me(l)}))}Zf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Yf={__init__:["spaceToolPreview"],__depends__:[Tc,Rc,Nf,Fp,hf],spaceTool:["type",Vf],spaceToolPreview:["type",Zf]};function Kf(e){e.invoke(Vf,this)}Kf.$inject=["injector"],e(Kf,Vf),Kf.prototype.calculateAdjustments=function(e,t,n,r){var i=Vf.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!Si(e,"bpmn:TextAnnotation")&&(!function(e){return Si(e,"bpmn:Participant")&&!Ti(e).processRef}(e)||!("y"===t&&Qi(e)||"x"===t&&!Qi(e)))})),i};var Jf={__depends__:[Yf],spaceTool:["type",Kf]};function em(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)}em.$inject=["eventBus","injector"],em.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},em.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},em.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},em.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},em.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},em.prototype.register=function(e,t){this._setHandler(e,t)},em.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},em.prototype.canUndo=function(){return!!this._getUndoAction()},em.prototype.canRedo=function(){return!!this._getRedoAction()},em.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},em.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},em.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},em.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},em.prototype._createId=function(){return this._uid++},em.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},em.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},em.prototype._pushAction=function(e){const 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)},em.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},em.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},em.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},em.prototype._revertedAction=function(e){this._stackIdx--},em.prototype._getHandler=function(e){return this._handlerMap[e]},em.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 tm={commandStack:["type",em]};function nm(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 rm(e,t,n){gs.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=im(n),t.validatedShapes=im(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(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;nm((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=Ct(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&&(St(r.labels,n,i),n.labelTarget=r)}))}function im(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(rm,gs),rm.$inject=["injector","eventBus","modeling"];var om={__init__:["labelSupport"],labelSupport:["type",rm]},sm="attach-ok";function am(e,t,n,r,i){gs.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=lm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(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;v(lm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(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,sm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,sm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(lm(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||v(r?n:y(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){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(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;nm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=ah(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,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=ah(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;nm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function lm(e){return r(k(e,(function(e){return e.attachers||[]})))}e(am,gs),am.$inject=["injector","eventBus","canvas","rules","modeling"];var cm={__depends__:[Rc],__init__:["attachSupport"],attachSupport:["type",am]};function pm(e){this._model=e}function um(e,t,n,r){gs.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){v(e.context.oldRoot.children,(function(e){Si(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function s(e){var t=e.context.shape;Si(t,"bpmn:BaseElement")&&i.updateBounds(t)}function a(e){i.updateConnection(e.context)}function l(e){i.updateConnectionWaypoints(e.context.connection)}function c(e){i.updateAttachment(e.context)}function p(e){const{element:n}=e.context,r=oo(n),i=Mi(n),o=i&&i.get("label");eo(n)||Ss(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}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"],hm((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"],hm((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"],hm((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],hm((function(e){"label"!==e.context.shape.type&&s(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&s({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],hm(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],hm(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],hm(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],hm(l)),this.executed("connection.reconnect",hm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ti(n),s=Ti(r),a=Ti(i);o.conditionExpression&&!Ci(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",hm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Ti(n),s=Ti(r),a=Ti(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],hm(c)),this.reverted(["element.updateAttachment"],hm(c)),this.executed("element.updateLabel",hm(p)),this.reverted("element.updateLabel",hm(p))}function hm(e){return function(t){var n=t.context;Si(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function dm(e,t,n){Wn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function fm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function mm(e,t){this._modeling=e,this._canvas=t}function gm(e){this._modeling=e}function ym(e,t){this._canvas=e,this._layouter=t}pm.$inject=["moddle"],pm.prototype._needsId=function(e){return Ci(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"])},pm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Si(e,"bpmn:Activity")?"Activity":Si(e,"bpmn:Event")?"Event":Si(e,"bpmn:Gateway")?"Gateway":Ci(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},pm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},pm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},pm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},pm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},pm.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},pm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},pm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},pm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))},e(um,gs),um.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],um.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},um.prototype.updateParent=function(e,t){if(!(gn(e)||Si(e,"bpmn:DataStoreReference")&&e.parent&&Si(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Mi(e),o=n&&n.businessObject,s=Mi(n);Si(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),Si(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Si(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),Si(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},um.prototype.updateBounds=function(e){var t=Mi(e),n=function(e){if(!Si(e,"bpmn:Activity"))return;var t=Mi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=pa(n,t.get("bounds"));L(n,{x:e.x+r.x,y:e.y+r.y})}var i=gn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},um.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Si(n,"bpmn:Lane")&&Pt(n.get("flowNodeRef"),e),Si(t,"bpmn:Lane")&&St(t.get("flowNodeRef"),e))},um.prototype.updateDiConnection=function(e,t,n){var r=Mi(e),i=Mi(t),o=Mi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Ti(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Ti(n)&&(r.targetElement=n&&o)},um.prototype.updateDiParent=function(e,t){if(t&&!Si(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Pt(n,e),e.$parent=null)}},um.prototype.getLaneSet=function(e){var t,n;return Si(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Si(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},um.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!Si(e,"bpmn:DataInput")&&!Si(e,"bpmn:DataOutput")||(Si(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Si(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(Si(e,"bpmn:FlowElement")){if(t)if(Si(t,"bpmn:Participant"))t=t.processRef;else if(Si(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Si(t,"bpmn:Lane"));r="flowElements"}else if(Si(e,"bpmn:Artifact")){for(;t&&!Si(t,"bpmn:Process")&&!Si(t,"bpmn:SubProcess")&&!Si(t,"bpmn:Collaboration");){if(Si(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(Si(e,"bpmn:MessageFlow"))r="messageFlows";else if(Si(e,"bpmn:Participant")){r="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!Si(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),s),s.$parent=null),t&&(St(o.get("rootElements"),s),s.$parent=o))}else Si(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":Si(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Pt(a=e.$parent.get(r),e),t?((a=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(r);Pt(a,e),t&&(l||(l=[],t.set(r,l)),l.push(e))}}},um.prototype.updateConnectionWaypoints=function(e){Mi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},um.prototype.updateConnection=function(e){var t,n=e.connection,r=Ti(n),i=n.source,o=Ti(i),s=n.target,a=Ti(n.target);if(Si(r,"bpmn:DataAssociation"))Si(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):Si(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=Si(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Pt(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Pt(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},um.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(dm,Wn),dm.$inject=["bpmnFactory","moddle","translate"],dm.prototype._baseCreate=Wn.prototype.create,dm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Ki,t))}return this.createElement(e,t)},dm.prototype.createElement=function(e,t){var n,r,i,o=this._translate,s=(t=L({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Ei(s=this._bpmnFactory.create(t.type))}if(!Ci(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=L({},l||{},{id:s.id+"_di"});l="root"===e?this._bpmnFactory.createDiPlane(s,c):"connection"===e?this._bpmnFactory.createDiEdge(s,c):this._bpmnFactory.createDiShape(s,c)}return Si(s,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=fm(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=fm(l,t,"isExpanded")),Ci(s,["bpmn:Lane","bpmn:Participant"])&&(t=fm(l,t,"isHorizontal")),Si(s,"bpmn:SubProcess")&&(t.collapsed=!Gi(s,l)),Si(s,"bpmn:ExclusiveGateway")&&(f(l,"isMarkerVisible")?void 0===l.isMarkerVisible&&(l.isMarkerVisible=!1):l.isMarkerVisible=!0),a(t.triggeredByEvent)&&(s.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(s.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=s.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=s,s.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=L({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},dm.prototype.getDefaultSize=function(e,t){var n=Ti(e);return t=t||Mi(e),Si(n,"bpmn:SubProcess")?Gi(n,t)?{width:350,height:200}:{width:100,height:80}:Si(n,"bpmn:Task")?{width:100,height:80}:Si(n,"bpmn:Gateway")?{width:50,height:50}:Si(n,"bpmn:Event")?{width:36,height:36}:Si(n,"bpmn:Participant")?Gi(n,t)?{width:600,height:250}:{width:400,height:60}:Si(n,"bpmn:Lane")?{width:400,height:100}:Si(n,"bpmn:DataObjectReference")?{width:36,height:50}:Si(n,"bpmn:DataStoreReference")?{width:50,height:50}:Si(n,"bpmn:TextAnnotation")?{width:100,height:30}:Si(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=L({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},mm.$inject=["modeling","canvas"],mm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},mm.prototype.postExecute=function(e){},gm.$inject=["modeling"],gm.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},gm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(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))},ym.$inject=["canvas","layouter"],ym.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=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,s)),this._canvas.addConnection(t,i,o),t},ym.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var vm=Math.round;function bm(e){this._modeling=e}bm.$inject=["modeling"],bm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=wt(y(t,(function(e){return!e.hidden})));v(t,(function(e){mn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:vm(e.x-a.x-a.width/2+i.x),y:vm(e.y-a.y-a.height/2+i.y)}}))),L(e,{x:vm(e.x-a.x-a.width/2+i.x),y:vm(e.y-a.y-a.height/2+i.y)})}));var l=mt(t),c={};v(t,(function(e){if(mn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=L({},o);-1===l.indexOf(e)&&(t.autoResize=!1),gn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var wm=Math.round;function xm(e){this._canvas=e}function _m(e){xm.call(this,e)}xm.$inject=["canvas"],xm.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?L(t,n):L(t,{x:n.x-wm(t.width/2),y:n.y-wm(t.height/2)}),this._canvas.addShape(t,r,i),t},xm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(_m,xm),_m.$inject=["canvas"];var km=xm.prototype.execute;_m.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,km.call(this,e)};var Em=xm.prototype.revert;function Om(e,t){this._canvas=e,this._modeling=t}function Pm(e,t){this._modeling=e,this._elementRegistry=t}function Sm(e,t){this._canvas=e,this._modeling=t}function Cm(e){this._modeling=e}_m.prototype.revert=function(e){return e.shape.labelTarget=null,Em.call(this,e)},Om.$inject=["canvas","modeling"],Om.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;nm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Om.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ct(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Om.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,r),this._canvas.addConnection(t,n),t},Pm.$inject=["modeling","elementRegistry"],Pm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Sm.$inject=["canvas","modeling"],Sm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;nm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),nm(n.children,(function(e){mn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Sm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Ct(r.children,n),t.removeShape(n),n},Sm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return St(r.children,n,i),t.addShape(n,r),n},Cm.$inject=["modeling"];var Tm={x:"y",y:"x"};function Mm(e,t){this._layouter=e,this._canvas=t}function Am(){}function Dm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Nm(e){this._modeling=e}function Rm(e){this._helper=new Nm(e)}function jm(e){this._modeling=e,this._helper=new Nm(e)}function Im(e){this._modeling=e}function Lm(e){return e.original||e}function zm(e,t){this._modeling=e,this._rules=t}function Bm(e){this._modeling=e}function $m(e){this._modeling=e}function qm(e){return L({},e)}function Fm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Vm(e,t,n){var r=Fm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Hm(e,t){return-1!==e.indexOf(t)}function Um(e){this._modeling=e}function Wm(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=L({},t,Wm(e.children)))})),t}function Gm(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Gm(e.children,e.collapsed||t)))})),n}function Qm(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Qm(e.children,t)))})),n}function Xm(e){this._modeling=e}function Zm(e,t){return Pt(e&&e.attachers,t)}function Ym(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),St(r,t,n)}}function Km(){}function Jm(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function eg(e){this._elementRegistry=e}function tg(e,t){v(t,(function(t,n){e.set(n,t)}))}Cm.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 s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],h=a(n),d=n[h],f=0;v(n,(function(e,c){var p,u,d;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===h&&(u=p[a(p)]),d=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Tm[r]]=0,t.moveElements([n],i,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(d.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==d&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Tm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},Cm.prototype.postExecute=function(e){},Mm.$inject=["layouter","canvas"],Mm.prototype.execute=function(e){var t=e.connection;return L(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Mm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Am.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=Pt(o.children,t),St(r.children,t,i),t.parent=r,v(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},Am.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Pt(n.children,t),St(r.children,t,i),t.parent=r,v(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},Dm.prototype.add=function(e,t){return this.addAll([e],t)},Dm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=kt((n=n||{}).allShapes),i=kt(n.allConnections),o=kt(n.enclosedElements),a=kt(n.enclosedConnections),l=kt(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return vt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return L(this,n),this},Nm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Nm.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&mh(e,e.source,t),connectionEnd:i&&gh(e,e.target,t)})}))},Nm.prototype.getClosure=function(e){return(new Dm).addAll(e,!0)},Rm.$inject=["modeling"],Rm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Rm.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)},jm.$inject=["modeling"],jm.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=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),St(r.children,t,i),L(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},jm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:gh(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:mh(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},jm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return St(n.children,t,r),L(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},jm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},jm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Im.$inject=["modeling"],Im.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 c(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},Im.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Lm(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Lm(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Im.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},zm.$inject=["modeling","rules"],zm.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var h=o.incoming.slice(),d=o.outgoing.slice();v(h,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,fh(e,t,u),a)})),v(d,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,dh(e,t,u),a)}))},zm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},zm.prototype.execute=function(e){},zm.prototype.revert=function(e){},zm.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},zm.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},zm.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Bm.$inject=["modeling"],Bm.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},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Bm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:fh(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:dh(e,n,r)})})))},Bm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},$m.$inject=["modeling"],$m.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[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 v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(Rf(e,i)||Rf(e,o)||Rf(t,i)||Rf(t,o))&&(Rf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},$m.prototype.execute=function(){},$m.prototype.revert=function(){},$m.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},$m.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},$m.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=qm(e)).original&&(e.original=qm(e.original)),e}))}(e),h=Fm(n),d={};Hm(l,c)&&Hm(l,p)?(u=k(u,(function(e){return Vm(e,r,n)&&(e[h]=e[h]+t[h]),e.original&&Vm(e.original,r,n)&&(e.original[h]=e.original[h]+t[h]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Hm(l,c)||Hm(l,p))&&(Hm(i,c)?d.connectionStart=mh(e,c,t):Hm(i,p)?d.connectionEnd=gh(e,p,t):Hm(o,c)?d.connectionStart=dh(e,c,s[c.id]):Hm(o,p)&&(d.connectionEnd=fh(e,p,s[p.id])),a._modeling.layoutConnection(e,d))}))},Um.$inject=["modeling"],Um.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Wm(n),t.collapsed=!t.collapsed;var r=Gm(n,t.collapsed);return[t].concat(r)},Um.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=Qm(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},Xm.$inject=["modeling"],Xm.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Zm(r,t),Ym(n,t),t.host=n,t},Xm.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Zm(n,t),Ym(r,t,i),t},Km.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Km.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Jm.$inject=["eventBus","elementFactory","commandStack"],Jm.prototype.getHandlers=function(){return{"shape.append":gm,"shape.create":xm,"shape.delete":Sm,"shape.move":jm,"shape.resize":Bm,"shape.replace":zm,"shape.toggleCollapse":Um,spaceTool:$m,"label.create":_m,"connection.create":ym,"connection.delete":Om,"connection.move":Am,"connection.layout":Mm,"connection.updateWaypoints":Km,"connection.reconnect":Im,"elements.create":bm,"elements.move":Rm,"elements.delete":Pm,"elements.distribute":Cm,"elements.align":mm,"element.updateAttachment":Xm}},Jm.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Jm.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)},Jm.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Jm.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},Jm.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)},Jm.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Jm.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},Jm.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},Jm.prototype.createElements=function(e,t,n,r,i){c(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},Jm.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},Jm.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},Jm.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Jm.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},Jm.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Jm.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Jm.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},Jm.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Jm.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},Jm.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)},Jm.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},Jm.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)},Jm.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,L(r,{docking:"source"}))},Jm.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,L(r,{docking:"target"}))},Jm.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},Jm.prototype._create=function(e,t){return t instanceof $n?t:this._elementFactory.create(e,t)},Jm.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},eg.$inject=["elementRegistry"],eg.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 w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,E(r));return tg(n,r),e.oldProperties=o,e.changed=i,i},eg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return tg(n,t),r},eg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Si(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Si(t,"bpmn:DataObjectReference")&&Ti(t).dataObjectRef===e}))}(e,t):[]};var ng="default",rg="id",ig="di",og={width:0,height:0};function sg(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function ag(e,t){return rg in e&&e[rg]!==t[rg]}function lg(e,t){var n=e.businessObject,r=Mi(e);v(t,(function(e,t){t!==ig?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}sg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],sg.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,s=t.businessObject,a=function(e){var t=L({},e);return cg.forEach((function(n){n in e&&(t[n]=Ti(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=E(t),r=e.businessObject,i=Mi(e);return w(n,(function(e,n){return e[n]=n!==ig?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,E(t.di)),e}),{})}(t,a);return ag(a,s)&&(o.unclaim(s[rg]),i.updateId(t,a[rg]),o.claim(a[rg],s)),ng in a&&(a[ng]&&n.push(i.get(a[ng].id)),s[ng]&&n.push(i.get(s[ng].id))),lg(t,a),e.oldProperties=l,e.changed=n,n},sg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Ti(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,og)}},sg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return lg(t,r),ag(n,i)&&(s.unclaim(n[rg]),o.updateId(t,r[rg]),s.claim(r[rg],i)),e.changed};var cg=["default"];function pg(e,t){this._canvas=e,this._modeling=t}function ug(e,t){this._modeling=e,this._spaceTool=t}function hg(e,t){this._modeling=e,this._translate=t}function dg(e,t){this._modeling=e,this._spaceTool=t}pg.$inject=["canvas","modeling"],pg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Mi(i);return t.setRootElement(n),t.removeRootElement(i),St(s.rootElements,r),r.$parent=s,Pt(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},pg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Mi(n);return t.setRootElement(i),t.removeRootElement(n),Pt(s.rootElements,r),r.$parent=null,St(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},ug.$inject=["modeling","spaceTool"],ug.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Mu(r),s=o===r,a=s?r:r.parent,l=Tu(a),c=Qi(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Su,y:r.y,width:r.width-Su,height:r.height}:{x:r.x,y:r.y+Su,width:r.width,height:r.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,h,d,f,m,g=[];vt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,d=(h=r.y)+10,f="n",m="y"):"left"===i?(u=-120,d=(h=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,d=(h=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,d=(h=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,d),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,d);var w=c?{x:r.x+(s?Su:0),y:h-("top"===i?120:0),width:r.width-(s?Su:0),height:120}:{x:h-("left"===i?120:0),y:r.y+(s?Su:0),width:120,height:r.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},hg.$inject=["modeling","translate"],hg.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=Tu(r),s=o.length;if(s>i)throw new Error(n("more than {count} child lanes",{count:i}));var a,l,c,p,u=Qi(r),h=u?r.height:r.width,d=Math.round(h/i);for(p=0;p<i;p++)a=p===i-1?h-d*p:d,l=u?{x:r.x+Su,y:r.y+p*d,width:r.width-Su,height:a}:{x:r.x+p*d,y:r.y+Su,width:a,height:r.height-Su},p<s?t.resizeShape(o[p],l):(c={type:"bpmn:Lane",isHorizontal:u},t.createShape(c,l,r))},dg.$inject=["modeling","spaceTool"],dg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},dg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Au(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},dg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=bn(e),c=wu(bn(t),l),p=Mu(e),u=[],h=[];vt(p,(function(e){return u.push(e),(Si(e,"bpmn:Lane")||Si(e,"bpmn:Participant"))&&h.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(h,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var fg="flowNodeRef",mg="lanes";function gg(e){this._elementRegistry=e}function yg(e){this._moddle=e}gg.$inject=["elementRegistry"],gg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=Mu(e);return i[t.id]||(i[t.id]=Cu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=bn(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=Mu(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return Si(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(mg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(fg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},gg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(mg);e.remove.forEach((function(e){Pt(n,e),Pt(e.get(fg),t)})),e.add.forEach((function(e){St(n,e),St(e.get(fg),t)}))})),[]},gg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(mg);e.add.forEach((function(e){Pt(n,e),Pt(e.get(fg),t)})),e.remove.forEach((function(e){St(n,e),St(e.get(fg),t)}))})),[]},yg.$inject=["moddle"],yg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},yg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var vg={fill:void 0,stroke:void 0};function bg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(d(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)}}}bg.$inject=["commandStack"],bg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||vg,r=this,i={};"fill"in n&&L(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=mn(e)?$(i,["border-color"]):i,n=Mi(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),gn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ci(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var wg={width:0,height:0};function xg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return so(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!gn(n)&&eo(n)&&!to(n)&&!_g(i)){var o=ro(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=oo(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,s=n.newBounds,a=n.hints||{};if(gn(i)||Si(i,"bpmn:TextAnnotation"))if(gn(i)&&_g(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=oo(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,wg)}}}function _g(e){return!e||!e.trim()}function kg(e,t,n,r){Jm.call(this,e,t,n),this._bpmnRules=r}function Eg(){}xg.$inject=["modeling","textRenderer","bpmnFactory"],e(kg,Jm),kg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kg.prototype.getHandlers=function(){var e=Jm.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=eg,e["element.updateProperties"]=sg,e["canvas.updateRoot"]=pg,e["lane.add"]=ug,e["lane.resize"]=dg,e["lane.split"]=hg,e["lane.updateRefs"]=gg,e["id.updateClaim"]=yg,e["element.setColor"]=bg,e["element.updateLabel"]=xg,e},kg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},kg.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)},kg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},kg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Eg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||_n(t.source||e.source),t.connectionEnd||_n(t.target||e.target)]};var Og=20,Pg=5,Sg=Math.round,Cg=20,Tg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Mg(e,t,n){var r,i,o,s=kn(t,e,Pg),a=n.split(":")[0],l=Sg((t.x-e.x)/2+e.x),c=Sg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),h=!1,d=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(h=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",h?u?(d=c===e.y,r={x:e.x+Og*(/l/.test(a)?-1:1),y:d?c+Og:c}):r={x:(d=l===e.x)?l+Og:l,y:e.y+Og*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Dg(e,r,i).concat(r),directions:i,turnNextDirections:d}}function Ag(e){return e.split(":").reverse().join(":")}function Dg(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(Lg(n)){var r=function(e,t,n){return Mg(e,t,n)}(e,t,n),i=function(e,t,n){var r=Mg(t,e,Ag(n));return{waypoints:r.waypoints.slice().reverse(),directions:Ag(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:Dg(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=Sg((t.x-e.x)/2+e.x),i=Sg((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 Ng(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=kn(e,t,Tg[o]||0),a=function(e,t){if(Lg(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}}(s,o);n=n||_n(e),r=r||_n(t);var l=a.split(":"),c=zg(n,e,l[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]}(s));return function(e,t,n){var r=Dg(e,t,n);return r.unshift(e),r.push(t),Bg(r)}(c,zg(r,t,l[1],s),a)}function Rg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=_n(e),r=_n(t)),i=i||[],s=-1!==(o=L({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=kn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?jg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:jg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Ig(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Ig(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:Ng(e,t,n,r,o))))}function jg(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 Ig(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&Tt(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(Dt(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(s[1],o,n),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Rt(e[r],t,Cg)||Rt(e[r],n,Cg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Ig(e,t,n,i)),s&&Dt(s)?null:s}function Lg(e){return e&&/t|r|b|l/.test(e)}function zg(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 Bg(e){return e.reduce((function(t,n,r){return Mt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var $g=-10,qg=40,Fg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Vg={top:"t",right:"r",bottom:"b",left:"l"};function Hg(){}function Ug(e,t){return Si(t,"bpmn:Participant")?"source":Si(e,"bpmn:Participant")?"target":Xg(t)?"source":Xg(e)||Si(t,"bpmn:Event")?"target":Si(e,"bpmn:Event")?"source":null}function Wg(e){return Xg(e)?"target":"source"}function Gg(e,t){return e?e.original||e:_n(t)}function Qg(e,t){return Si(t,"bpmn:Activity")&&Si(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Xg(e){return Si(e,"bpmn:SubProcess")&&Gi(e)}function Zg(e,t){return e===t}function Yg(e){var t=/right|left/.exec(e);return t&&t[0]}function Kg(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Jg(e){return"right"===e||"left"===e}function ey(e,t){var n=t.waypoints,r=n&&n.length&&kn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function ty(e,t,n){var r,i,o,s,a=_n(e),l=_n(t),c=(s=(o=e).host,kn(_n(o),s,$g)),p=Zg(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),h=kn(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,s=t?e:Kg(e),a=Vg[s];o=t?Jg(e)?ny("y",n,r,i)?"h":"b":ny("x",n,r,i)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(r=function(e,t,n){if(n)return Vg[e];if(Zg(Kg(e),Kg(t))||function(e,t){return Fg[e]===t}(Yg(e),Yg(t)))return Vg[Kg(e)];return Vg[Yg(e)]}(c,h,u),i=function(e,t,n){if(n)return Jg(e)?function(e,t){var n=Yg(e),r=Fg[n];return-1!==t.indexOf(r)}(e,t)||Zg(e,t)?"h":"v":function(e,t){var n=Kg(e),r=Fg[n];return-1!==t.indexOf(r)}(e,t)||Zg(e,t)?"v":"h";return Jg(t)||Zg(Kg(e),Kg(t))&&Yg(t)?"h":"v"}(c,h,u),[r+":"+i])}function ny(e,t,n,r){var i=qg;return!(ry(e,r,n,i)||ry(e,r,{x:n.x+n.width,y:n.y+n.height},i)||ry(e,r,_n(t),i))}function ry(e,t,n,r){return Math.abs(t[e]-n[e])<r}function iy(e){return L({original:e.point.original||e.point},e.actual)}function oy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Hg,Eg),Hg.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd;return a||(a=Gg(s&&s[0],i)),l||(l=Gg(s&&s[s.length-1],o)),(Si(e,"bpmn:Association")||Si(e,"bpmn:DataAssociation"))&&s&&!Qg(i,o)?[].concat([a],s.slice(1,-1),[l]):(Si(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:Ug(e,t)}}(i,o):(Si(e,"bpmn:SequenceFlow")||Qg(i,o))&&(n=i===o?{preferredLayouts:ey(i,e)}:Si(i,"bpmn:BoundaryEvent")?{preferredLayouts:ty(i,o,l)}:Xg(i)||Xg(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:Wg(e)}}(i):Si(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Si(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=Bg(Rg(i,o,a,l,s,n=L(n,t)))),r||[a,l])},oy.$inject=["elementRegistry","graphicsFactory"],oy.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(iy(r)),o.push(iy(i)),o},oy.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}},oy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},oy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},oy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},oy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var sy={__init__:["modeling","bpmnUpdater"],__depends__:[hd,Wd,Qd,Yd,Af,tm,om,cm,ss,ms,Jf],bpmnFactory:["type",pm],bpmnUpdater:["type",um],elementFactory:["type",dm],modeling:["type",kg],layouter:["type",Hg],connectionDocking:["type",oy]};const ay=Math.round;function ly(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}ly.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(L({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;L(p,{x:u.x-ay(p.width/2),y:u.y-ay(p.height/2)});const h=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let d=null;h&&(d=o.createConnection(h),d.waypoints=a.layoutConnection(d,{source:e,target:p}),d.waypoints=i.getCroppedWaypoints(d,e,p)),r.create({created:[p,d].filter((e=>!l(e)))})},ly.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ly.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var cy={__depends__:[yc,Up,sy],__init__:["appendPreview"],appendPreview:["type",ly]},py=Math.min,uy=Math.max;function hy(e){e.preventDefault()}function dy(e){e.stopPropagation()}function fy(e){this.container=e.container,this.parent=ye('<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=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function my(e,t){this._eventBus=e,this._providers=[],this._textbox=new fy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}fy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(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"},a);var l=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&L(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,pe.bind(o,"keydown",this.keyHandler),pe.bind(o,"mousedown",dy),pe.bind(o,"paste",this.handlePaste),r.autoResize&&pe.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},fy.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)}},fy.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},fy.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var h=document.createTextNode(e);this.content.insertBefore(h,p[a]),n=h,r=h.textContent.length}else{var d=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===d?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>d&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},fy.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})}},fy.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,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ye('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){hy(n),dy(n);var u=py(uy(c+n.clientX-a,r),o),h=py(uy(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},h=function(e){hy(e),dy(e),pe.unbind(document,"mousemove",u,!1),pe.unbind(document,"mouseup",h,!1)};pe.bind(n,"mousedown",(function(e){hy(e),dy(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,pe.bind(document,"mousemove",u),pe.bind(document,"mouseup",h)}))}L(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)},fy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),pe.unbind(t,"keydown",this.keyHandler),pe.unbind(t,"mousedown",dy),pe.unbind(t,"input",this.autoResize),pe.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},fy.prototype.getValue=function(){return this.content.innerText.trim()},fy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},fy.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)},my.$inject=["eventBus","canvas"],my.prototype.registerProvider=function(e){this._providers.push(e)},my.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},my.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},my.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},my.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},my.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()}},my.prototype.getValue=function(){return this._textbox.getValue()},my.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())},my.prototype._handleResize=function(e){this._fire("resize",e)},my.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=m(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 gy={__depends__:[Yo],__init__:["directEditing"],directEditing:["type",my]};function yy(e){return function(t){var n=t.target,r=Ti(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,s=(i&&i.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!r.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Gi(e);return!(o&&s&&a&&l)}}var vy=[{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"}}],by=[{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"}}],wy=[{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"}}],xy=[{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"}}],_y=[{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"}}],ky=[{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}}],Ey=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{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}}],Oy=Ey,Py=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{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:"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:"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}}],Sy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Cy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Ty=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{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}}],My=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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}}],Ay=[{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"}],Dy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";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}}],Ny={"start-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)">\n <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>\n </g>\n </svg>',"intermediate-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">\n <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>\n <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>\n </g>\n </svg>'};function Ry(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Ry.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ry.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ry.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=yy(e);return Si(t,"bpmn:DataObjectReference")?this._createEntries(e,Sy):Si(t,"bpmn:DataStoreReference")&&!Si(e.parent,"bpmn:Collaboration")?this._createEntries(e,Cy):Si(t,"bpmn:StartEvent")&&!Si(t.$parent,"bpmn:SubProcess")?(r=y(vy,i),this._createEntries(e,r)):Si(t,"bpmn:Participant")?(r=y(Dy,(function(t){return Gi(e)!==t.target.isExpanded})),this._createEntries(e,r)):Si(t,"bpmn:StartEvent")&&Zi(t.$parent)?(r=y(My,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):Si(t,"bpmn:StartEvent")&&!Zi(t.$parent)&&Si(t.$parent,"bpmn:SubProcess")?(r=y(by,i),this._createEntries(e,r)):Si(t,"bpmn:EndEvent")?(r=y(xy,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Si(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):Si(t,"bpmn:BoundaryEvent")?(r=y(Ty,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!Si(t.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==n.cancelActivity,o=t.cancelActivity==r;return i(e)||!i(e)&&!o})),this._createEntries(e,r)):Si(t,"bpmn:IntermediateCatchEvent")||Si(t,"bpmn:IntermediateThrowEvent")?(r=y(wy,i),this._createEntries(e,r)):Si(t,"bpmn:Gateway")?(r=y(_y,i),this._createEntries(e,r)):Si(t,"bpmn:Transaction")?(r=y(Ey,i),this._createEntries(e,r)):Zi(t)&&Gi(e)?(r=y(Oy,i),this._createEntries(e,r)):Si(t,"bpmn:SubProcess")&&Gi(e)?(r=y(ky,i),this._createEntries(e,r)):Si(t,"bpmn:AdHocSubProcess")&&!Gi(e)?(r=y(Py,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return yy(t)&&(!n||r)})),this._createEntries(e,r)):Si(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Ay):Si(t,"bpmn:FlowNode")?(r=y(Py,i),Si(t,"bpmn:SubProcess")&&!Gi(e)&&(r=y(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Ry.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Si(e,"bpmn:Activity")&&!Zi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Si(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Si(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!Si(e,"bpmn:SubProcess")||Si(e,"bpmn:Transaction")||Zi(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),kh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ry.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Ry.prototype._createSequenceFlowEntries=function(e,t){var n=Ti(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Si(n.sourceRef,"bpmn:ExclusiveGateway")||Si(n.sourceRef,"bpmn:InclusiveGateway")||Si(n.sourceRef,"bpmn:ComplexGateway")||Si(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&Si(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:Si(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(Si(n.sourceRef,"bpmn:ExclusiveGateway")||Si(n.sourceRef,"bpmn:InclusiveGateway")||Si(n.sourceRef,"bpmn:ComplexGateway")||Si(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Ry.prototype._createEntry=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,action:n}},Ry.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const i=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(r.options.loopCharacteristics);i&&t._moddleCopy.copyElement(i,o),o.set("isSequential",r.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var i,o,s,a=Ti(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Ry.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"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})}}}},Ry.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"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})}}}},Ry.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=Si(Ti(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"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})}}}},Ry.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ti(e),r=this,i=Eh(e),o=Si(e,"bpmn:BoundaryEvent")?Ny["intermediate-event-non-interrupting"]:Ny["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var jy={__depends__:[Ql,Af,yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ry]};function Iy(e,t,n,r,i,o,s,a,l,c,p,u,h){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=h,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Wo(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ly(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Iy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Iy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Iy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(t,(function(e){return n=e,-1!==t.indexOf(n);var n})):t},Iy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,h={};if("label"===e.type)return h;var d=e.businessObject;function f(e,t){i.start(e,t)}function m(e,t,n,i){function s(t,n){var s=r.createShape(L({type:e},i));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=r.createShape(L({type:e},i));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,i),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ci(d,["bpmn:Lane","bpmn:Participant"])&&Gi(e)){var y=Tu(e);L(h,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Qi(e)?e.height>=120:e.width>=120)&&L(h,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two lanes"),action:{click:g(2)}}}),(Qi(e)?e.height>=180:e.width>=180)&&L(h,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),L(h,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Si(d,"bpmn:FlowNode")&&(Si(d,"bpmn:EventBasedGateway")?L(h,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ly(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(h,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):Si(d,"bpmn:EndEvent")||d.isForCompensation||Ly(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Zi(d)||L(h,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||L(h,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change element"),action:{click:function(e,n){var r=L(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:p("Change element"),width:300,search:!0})}}}}),Si(d,"bpmn:SequenceFlow")&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))}),Ci(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect to other element"),action:{click:f,dragstart:f}}}),Si(d,"bpmn:TextAnnotation")&&L(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:f,dragstart:f}}}),Ci(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:f,dragstart:f}}}),Si(d,"bpmn:Group")&&L(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))});var v=a.allowed("elements.delete",{elements:[e]});return c(v)&&(v=v[0]===e),v&&L(h,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Delete"),action:{click:function(e,t){n.removeElements([t])}}}}),h};var zy={__depends__:[cy,gy,ja,ss,Ip,pf,jy],__init__:["contextPadProvider"],contextPadProvider:["type",Iy]},By={horizontal:["x","width"],vertical:["y","height"]};function $y(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return c(n)?n:n?e:[]}))}$y.$inject=["modeling","rules"],$y.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},$y.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},$y.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},$y.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 v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},$y.prototype._setOrientation=function(e){var t=By[e];this._axis=t[0],this._dimension=t[1]},$y.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)},$y.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var qy={__init__:["distributeElements"],distributeElements:["type",$y]};function Fy(e){Jl.call(this,e)}Fy.$inject=["eventBus"],e(Fy,Jl),Fy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=mt(t=y(t,(function(e){var t=Ci(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})))).length<3)&&t}))};var Vy={horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Hy(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}Hy.$inject=["popupMenu","distributeElements","translate","rules"],Hy.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Hy.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Hy.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Vy.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Vy.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var Uy={__depends__:[Ql,qy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Fy],distributeElementsMenuProvider:["type",Hy]},Wy="is not a registered action";function Gy(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Qy(e,t){return new Error(e+" "+t)}Gy.$inject=["eventBus","injector"],Gy.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),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=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();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},Gy.prototype.trigger=function(e,t){if(!this._actions[e])throw Qy(e,Wy);return this._actions[e](t)},Gy.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},Gy.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Qy(e,"is already registered");this._actions[e]=t},Gy.prototype.unregister=function(e){if(!this.isRegistered(e))throw Qy(e,Wy);this._actions[e]=void 0},Gy.prototype.getActions=function(){return Object.keys(this._actions)},Gy.prototype.isRegistered=function(e){return!!this._actions[e]};var Xy={__init__:["editorActions"],editorActions:["type",Gy]};function Zy(e){e.invoke(Gy,this)}e(Zy,Gy),Zy.$inject=["injector"],Zy.prototype._registerDefaultActions=function(e){Gy.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),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1),d=e.get("contextPad",!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()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!Si(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&h&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&h.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&h&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=wt(r=Si(i,"bpmn:Collaboration")?n.filter((function(e){return Si(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!Si(e.parent,"bpmn:SubProcess")}))),h.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&d&&this._registerAction("replaceElement",(function(e){d.triggerEntry("replace","click",e)}))};var Yy={__depends__:[Xy],editorActions:["type",Zy]};function Ky(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ci(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Ky.$inject=["eventBus"];var Jy=10;function ev(e,t,n){return n||(n="round"),Math[n](e/t)*t}function tv(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&&Hs(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,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(nv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(nv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(nv(t)?iv(a)?s.x.max=l.left:s.x.min=l.right:rv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(nv(t)?iv(a)?s.x.min=c.left:s.x.max=c.right:rv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&L(r,s),Ep(t,n)||i.snapEvent(t,n,r)}))}}))}function nv(e){return"x"===e}function rv(e){return-1!==e.indexOf("n")}function iv(e){return-1!==e.indexOf("w")}function ov(e,t){gs.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;d(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}tv.prototype.snapEvent=function(e,t,n){Op(e,t,this.snapValue(e[t],n))},tv.prototype.getGridSpacing=function(){return Jy},tv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=ev(e+=i,Jy),t&&t.min&&u(n=t.min)&&(n=ev(n+i,Jy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=ev(r+i,Jy,"floor"),e=Math.min(e,r)),e-=i},tv.prototype.isActive=function(){return this.active},tv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},tv.prototype.toggleActive=function(){this.setActive(!this.active)},tv.$inject=["elementRegistry","eventBus","config.gridSnapping"],ov.$inject=["eventBus","gridSnapping","modeling"],e(ov,gs),ov.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},ov.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},ov.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),L(e,o),e},ov.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),L(e,o),e};function sv(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))}))}sv.$inject=["eventBus","gridSnapping"];var av={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ov],gridSnappingSpaceToolBehavior:["type",sv]}],__init__:["gridSnapping"],gridSnapping:["type",tv]};function lv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=_n(n),i=e.shape,o=fc(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],Si(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}))}lv.$inject=["eventBus","gridSnapping"];function cv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();Si(i,"bpmn:Participant")&&Si(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})))}))}cv.$inject=["canvas","eventBus","gridSnapping"];function pv(e,t,n){gs.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||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function uv(e,t,n){var r=Dt(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=L({},t,i),n=L({},n,i)),[t,n]}pv.$inject=["eventBus","gridSnapping","modeling"],e(pv,gs),pv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=uv(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var hv={__depends__:[av,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",lv],gridSnappingParticipantBehavior:["type",cv],gridSnappingLayoutConnectionBehavior:["type",pv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Ky]};function dv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return Si(t,"bpmn:Lane")?n._createParticipantHit(t,r):Si(t,"bpmn:Participant")?Gi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):Si(t,"bpmn:SubProcess")?Gi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}dv.$inject=["eventBus","interactionEvents"],dv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},dv.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Qi(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},dv.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var fv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",dv]};function mv(e){e.invoke(Js,this)}e(mv,Js),mv.$inject=["injector"],mv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Js.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})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var gv={__depends__:[ea],__init__:["keyboardBindings"],keyboardBindings:["type",mv]},yv={moveSpeed:1,moveSpeedAccelerated:10},vv="left",bv="right",wv="down",xv={ArrowLeft:vv,Left:vv,ArrowUp:"up",Up:"up",ArrowRight:bv,Right:bv,ArrowDown:wv,Down:wv},_v={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 kv(e,t,n,r,i){var o=this;this._config=L({},yv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=xv[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 s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=_v[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}kv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Ev={__depends__:[ea,ss],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",kv]};function Ov(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,s=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=bn(e);return wn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("left",n,t)})}(n,s),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:bn(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=yn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function Pv(e,t){var n=_n(e),r=bn(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 Sv(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Ov.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ov.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=L({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Pv(t,i),"resize",{autoActivate:!0,cursor:Sv(i),data:{shape:t,context:r}})},Ov.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=bn(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},s=r?bn(r):o;return wn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:yu(o.bottom,s.bottom),right:yu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Eu(t,e.childrenBoxPadding))},Ov.$inject=["eventBus","rules","modeling","dragging"];var Cv="djs-resizing",Tv="resize-not-ok";function Mv(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,Cv)),o.width>5&&Pe(s,{x:o.x,width:o.width}),o.height>5&&Pe(s,{y:o.y,height:o.height}),r.canExecute?Ce(s).remove(Tv):Ce(s).add(Tv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Me(n.frame),t.removeMarker(r,Cv)}))}Mv.$inject=["eventBus","canvas","previewSupport"];var Av=-6,Dv="djs-resizer",Nv=["n","w","s","e","nw","ne","se","sw"];function Rv(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&&v(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Rv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Uo(t)&&r.activate(t,e,n)}pe.bind(t,"mousedown",i),pe.bind(t,"touchstart",i)},Rv.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=Av);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Av);return t}(r),s=Ie("g");Ce(s).add(Dv),Ce(s).add(Dv+"-"+e.id),Ce(s).add(Dv+"-"+r),_e(i,s);var a=Ie("rect");Pe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Ce(a).add(Dv+"-visual"),_e(s,a);var l=Ie("rect");return Pe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Ce(l).add(Dv+"-hit"),_e(s,l),Kn(s,t,n),s},Rv.prototype.createResizer=function(e,t){var n=Pv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Rv.prototype.addResizer=function(e){var t=this;!mn(e)&&this._resize.canResize({shape:e})&&v(Nv,(function(n){t.createResizer(e,n)}))},Rv.prototype.removeResizers=function(){Ae(this._getResizersParent())},Rv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Rv.$inject=["eventBus","canvas","selection","resize"];var jv={__depends__:[Rc,Tc,Fp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ov],resizePreview:["type",Mv],resizeHandles:["type",Rv]};function Iv(e,t,n,r,i,o,s){function a(e,t){(t||Ci(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Lv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),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||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Lv(e){return Si(e,"bpmn:SubProcess")&&!Gi(e)}Iv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Iv.prototype.activate=function(e){var t=oo(e);if(void 0!==t){var n={text:t};L(n,this.getEditingBBox(e));var r={};return(Ci(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Lv(e))&&L(r,{centerVertically:!0}),eo(e)&&L(r,{autoResize:!0}),Si(e,"bpmn:TextAnnotation")&&L(r,{resizable:!0,autoResize:!0}),L(n,{options:r}),n}},Iv.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,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,h=l.fontSize*a,d=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Si(e,"bpmn:Lane")||function(e){return Si(e,"bpmn:Participant")&&Gi(e)}(e)){var m=Qi(e);L(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return Si(e,"bpmn:Participant")&&!Gi(e)}(e)){var g=Qi(e);L(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ci(e,["bpmn:Task","bpmn:CallActivity"])||Lv(e))&&(L(s,{width:r.width,height:r.height}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return Si(e,"bpmn:SubProcess")&&Gi(e)}(e)&&(L(s,{width:r.width,x:r.x}),L(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(L(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),eo(n)&&!to(n)&&!gn(n)){var w=ro(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;L(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return Si(e,"bpmn:TextAnnotation")&&(L(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),L(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:h+"px",lineHeight:d})),{bounds:s,style:f}},Iv.prototype.update=function(e,t,n,r){var i,o,s;Si(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}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var zv="djs-element-hidden",Bv="djs-label-hidden";function $v(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Si(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Ie("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Ie("path");Pe(p,{d:c,strokeWidth:2,stroke:qv(r)}),_e(o,p),_e(a,o),Jn(o,r.x,r.y)}Si(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,zv):(Si(r,"bpmn:Task")||Si(r,"bpmn:CallActivity")||Si(r,"bpmn:SubProcess")||Si(r,"bpmn:Participant"))&&t.addMarker(r,Bv)})),e.on("directEditing.resize",(function(e){if(Si(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Pe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,zv),t.removeMarker(r,Bv)),r=void 0,i=void 0,o&&(Me(o),o=void 0)}))}function qv(e,t){return Mi(e).get("stroke")||t||"black"}$v.$inject=["eventBus","canvas","pathMap"];var Fv={__depends__:[ms,jv,gy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Iv],labelEditingPreview:["type",$v]},Vv=new as("tt");function Hv(e,t){e.style.display=!1===t?"none":""}var Uv="djs-tooltip",Wv="."+Uv;function Gv(e,t){this._eventBus=e,this._canvas=t,this._ids=Vv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=function(e){var t=ye('<div class="djs-tooltip-container" />');return X(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}(t.getContainer());var n=this;de.bind(this._tooltipRoot,Wv,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,Wv,"mouseover",(function(e){n.trigger("mouseover",e)})),de.bind(this._tooltipRoot,Wv,"mouseout",(function(e){n.trigger("mouseout",e)})),this._init()}Gv.$inject=["eventBus","canvas"],Gv.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=L({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Gv.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(Z(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},Gv.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Gv.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Gv.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Gv.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Gv.prototype.show=function(){Hv(this._tooltipRoot)},Gv.prototype.hide=function(){Hv(this._tooltipRoot,!1)},Gv.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},Gv.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)),d(r)&&(r=ye(r)),X(t=ye('<div data-tooltip-id="'+n+'" class="'+Uv+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Gv.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){X(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Gv.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),Hv(r,i))}))},Gv.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 Qv={__init__:["tooltips"],tooltips:["type",Gv]};function Xv(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,s=e.context,a=s.shape;Si(s.target,"bpmn:Collaboration")&&Si(a,"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>"}))}))}Xv.$inject=["eventBus","tooltips","translate"];var Zv={__depends__:[Qv],__init__:["modelingFeedback"],modelingFeedback:["type",Xv]},Yv=Math.round;function Kv(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 s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Ce(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+Yv(e.width/2),y:e.y+Yv(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]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),L(t,{shapes: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,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,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,s=t.shapes;if(!1===i)return!1;r.x=Yv(r.x),r.y=Yv(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Uo(e)){var t=$o(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}Kv.$inject=["eventBus","dragging","modeling","selection","rules"];var Jv="djs-dragging",eb="drop-ok",tb="drop-not-ok",nb="new-parent",rb="attach-ok";function ib(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!mn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=bt(e,!0),n=k(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return r(t.concat(n))}function a(e,n){[rb,eb,tb,nb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var h=Ie("g");Pe(h,n.cls("djs-drag-group",["no-events"])),_e(t.getActiveLayer(),h),l.dragGroup=h}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,Jv)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),E(a).length)})),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?a(r,rb):t.canExecute&&r&&r.id!==i.id?a(r,nb):a(r,t.canExecute?eb:tb)),Jn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,Jv)})),i&&Me(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,Jv),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}ib.$inject=["eventBus","canvas","styles","previewSupport"];var ob={__depends__:[Yo,ss,Jo,Rc,Tc,Fp],__init__:["move","movePreview"],move:["type",Kv],movePreview:["type",ib]};const sb={width:36,height:50},ab={width:50,height:50};function lb(e,t,n){return Ie("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function cb(e,t){this._styles=t,e.registerProvider(this)}function pb(e,t){var n;return"bpmn:DataObjectReference"===t?n=sb:"bpmn:DataStoreReference"===t&&(n=ab),e.width===n.width&&e.height===n.height}cb.$inject=["outline","styles"],cb.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!gn(e))return Si(e,"bpmn:Gateway")?(L((n=Ie("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,L({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ci(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Pe(n=Ie("rect"),L({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Si(e,"bpmn:EndEvent")?Pe(n=Ie("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Si(e,"bpmn:Event")?Pe(n=Ie("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Si(e,"bpmn:DataObjectReference")&&pb(e,"bpmn:DataObjectReference")?n=lb("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):Si(e,"bpmn:DataStoreReference")&&pb(e,"bpmn:DataStoreReference")&&(n=lb("M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",{x:-6,y:-6},t)),n},cb.prototype.updateOutline=function(e,t){if(!gn(e))return Ci(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+10,height:e.height+10}),!0):!!Ci(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var ub={__depends__:[Jo],__init__:["outlineProvider"],outlineProvider:["type",cb]},hb=".djs-palette-toggle",db=".entry",fb=hb+", "+db,mb="djs-palette-",gb="open",yb="two-column";function vb(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 bb(e,t){var n=t.getPaletteEntries();return h(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}vb.$inject=["eventBus","canvas"],vb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},vb.prototype.getEntries=function(){return this._getProviders().reduce(bb,{})},vb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},vb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ye(vb.HTML_MARKUP);n.appendChild(r),K(n).add(mb+"shown"),de.bind(r,fb,"click",(function(t){if(te(t.delegateTarget,hb))return e.toggle();e.trigger("click",t)})),pe.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,db,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},vb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},vb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(yb,t),s.toggle(mb+yb,t),"open"in e&&(o.toggle(gb,e.open),s.toggle(mb+gb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},vb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+ws(r)+"]",e);i||(Z(i=ye('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ye(o);if(i.appendChild(s),!t.separator&&(Z(s,"data-action",n),t.title&&Z(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ye("<img>");Z(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},vb.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=Z(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},vb.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(h(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},vb.prototype._layoutChanged=function(){this._toggleState({})},vb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},vb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},vb.prototype.open=function(){this._toggleState({open:!0})},vb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},vb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},vb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},vb.prototype.isOpen=function(){return K(this._container).has(gb)},vb.prototype._getParentContainer=function(){return this._canvas.getContainer()},vb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var wb={__init__:["palette"],palette:["type",vb]},xb="crosshair";function _b(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Pe(n=e.frame=Ie("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),_e(r,n)},c=function(e){var t=e.frame,n=e.bbox;Pe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Me(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(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=kb(e),i=r.filter((function(e){return e})),o=Go(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=kb(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=kb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Go(e))return a.activateLasso(e.originalEvent),!0}))}function kb(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}}_b.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],_b.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:xb,data:{context:{}}})},_b.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:xb,data:{context:{}},keepSelection:!0})},_b.prototype.select=function(e,t,n=[]){var r=function(e,t){var n={};return v(e,(function(e){var r=e;r.waypoints&&(r=wt(r)),!u(t.y)&&r.x>t.x&&(n[e.id]=e),!u(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(u(t.width)&&u(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:u(t.width)&&u(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select([...n,...O(r)])},_b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_b.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Eb={__depends__:[Nf,hf],__init__:["lassoTool"],lassoTool:["type",_b]},Ob=1500,Pb="grab";function Sb(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Ob,(function(e){if(Wo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ob,(function(e){if(Cb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ob,(function(e){Cb(e.keyEvent)&&s.isActive()&&s.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(){s.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!Wo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Cb(e){return Us("Space",e)}Sb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Sb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Pb,data:{context:n||{}}})},Sb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Pb,data:{context:{reactivate:n}}})},Sb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Sb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Tb={__depends__:[Nf,hf],__init__:["handTool"],handTool:["type",Sb]},Mb="connect-ok",Ab="connect-not-ok";function Db(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,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=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?Mb:Ab))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Mb:Ab)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.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}))}Db.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Db.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Db.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Db.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Db.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Ip,Rc,Tc,Nf,hf],globalConnect:["type",Db]};function Rb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Rb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Rb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(L({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return L(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate 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",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var jb={__depends__:[wb,pf,Jf,Eb,Tb,Nb,No],__init__:["paletteProvider"],paletteProvider:["type",Rb]};function Ib(e,t,n,r,i){gs.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);L(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+ws(l.id)+'"]',e.dragGroup);p&&Pe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+ws(r)+'"]',e.dragGroup);i&&Pe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Ib.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ib,gs);var Lb={__depends__:[Fp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ib]},zb=40,Bb=20,$b=10,qb=20,Fb=["x","y"],Vb=Math.abs;function Hb(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,s=t.target;e.originalEvent&&Hs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Fb.forEach((function(r){var i=Gb(r,t);e[r]<t[r]+n?Op(e,r,t[r]+n):e[r]>t[r]+i-n&&Op(e,r,t[r]+i-n)}))}(e,i,function(e){return Si(e,"bpmn:Task")?$b:Bb}(i)),i&&function(e,t){return _(t,(function(t){return Wb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=kp(r),Ci(i,["bpmn:Event","bpmn:Gateway"])&&Ub(e,kp(i)),Ci(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=kp(t);Fb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+qb&&e[n]<t[n]+Gb(n,t)-qb})(e,t,r)&&Op(e,r,n[r])}))}(e,i),Si(o,"bpmn:BoundaryEvent")&&s===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=kp(n),o=kn(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Vb(r-i[t])<zb&&(n=r>i[t]?i[t]+zb:i[t]-zb,Op(e,t,n))}))}(e)):Wb(n,"bpmn:MessageFlow")?(Si(r,"bpmn:Event")&&(t.connectionStart=kp(r)),Si(i,"bpmn:Event")&&Ub(e,kp(i))):t.connectionStart=t.initialConnectionStart)}))}function Ub(e,t){Op(e,"x",t.x),Op(e,"y",t.y)}function Wb(e,t){return e&&e.type===t}function Gb(e,t){return"x"===e?t.width:t.height}function Qb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Xb(){this._snapValues={}}Hb.$inject=["eventBus"],Qb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Qb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Qb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Qb.prototype.getSnapLocations=function(){return this._snapLocations},Qb.prototype.setSnapLocations=function(e){this._snapLocations=e},Qb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Xb).initDefaults(this._defaultSnaps),n},Xb.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)},Xb.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],bp(i-e)<=n)return i}(e[n],i[n],r)},Xb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var Zb=1250;function Yb(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"],Zb,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Hs(e.originalEvent))&&!Ep(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}Yb.$inject=["elementRegistry","eventBus","snapping"],Yb.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new Qb);var s=(t=n.get(i.id)?kp(i,e):{x:e.x+kp(i).x,y:e.y+kp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),gn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},Yb.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(gn(n))gn(t)&&e.add("mid",kp(n));else if(mn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",kp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",kp(t)),e):e},Yb.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function Kb(e,t){t.invoke(Yb,this),e.on(["create.move","create.end"],1500,Jb),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)&&!Ep(e)&&function(e,t){var n,r=bn(t),i=dd(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:_n(s);/top/.test(i)?Op(e,"y",r.top-n.y):/bottom/.test(i)&&Op(e,"y",r.bottom-n.y);/left/.test(i)?Op(e,"x",r.left-n.x):/right/.test(i)&&Op(e,"x",r.right-n.x)}(e,r)}))}function Jb(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)&&Op(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Op(e,"y",e.y)}}function ew(e,t){return-1!==e.indexOf(t)}function tw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(Kb,Yb),Kb.$inject=["eventBus","injector"],Kb.prototype.initSnap=function(e){var t=Yb.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",tw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",tw(i,r,e))})),Si(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Kb.prototype.addSnapTargetPoints=function(e,t,n){Yb.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(Si(e,"bpmn:SubProcess")&&Gi(e))return!0;return Si(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return Si(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",xp(n)),e.add("bottom-right",_p(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){ew(r,n.source)||e.add("mid",_n(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){ew(r,n.target)||e.add("mid",_n(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Si(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Kb.prototype.getSnapTargets=function(e,t){return Yb.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Si(e,"bpmn:Lane")}))};function nw(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,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&Hs(e.originalEvent)||Ep(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Op(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Op(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function rw(e,t){var n=_n(e),r=bn(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}nw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new Qb);var o=rw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},nw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",_p(t)),e.add("corner",xp(t))})),e.add("corner",rw(t,r)),e},nw.$inject=["eventBus","snapping"],nw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,r=e,n.host===r||mn(t)||function(e){return!!e.hidden}(t)||gn(t));var n,r}))};function iw(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}iw.$inject=["canvas"],iw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Ep(e,"x"),y:Ep(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,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),v(["x","y"],(function(t){var n=i[t];p(n)&&Op(e,t,n.originValue)}))},iw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ie("path");return Pe(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),_e(t,n),{update:function(t){u(t)?Pe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Pe(n,{display:"none"})}}},iw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},iw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},iw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},iw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var ow={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Yb],resizeSnapping:["type",nw],snapping:["type",iw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Hb],createMoveSnapping:["type",Kb]};function sw(e,t,n,r,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=r,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ve(sw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(sw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function aw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+sw.RESULT_HIGHLIGHT_CLASS+'">'+_s(e.matched)+"</strong>":t+=_s(e.normal)})),""!==t?t:null}(t),i=ye(n);i.innerHTML=r,e.appendChild(i)}sw.$inject=["canvas","eventBus","overlays","selection","translate"],sw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,sw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,sw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,sw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,sw.INPUT_SELECTOR,"keydown",(function(e){Us("ArrowUp",e)&&e.preventDefault(),Us("ArrowDown",e)&&e.preventDefault()})),t(this._container,sw.INPUT_SELECTOR,"keyup",(function(t){if(Us("Escape",t))return e.close();if(Us("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Us("ArrowUp",t)?e._scrollToDirection(!0):Us("ArrowDown",t)?e._scrollToDirection():void(Us(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},sw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},sw.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(sw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},sw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},sw.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)}},sw.prototype._clearResults=function(){ee(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},sw.prototype._getCurrentResult=function(){return ve(sw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},sw.prototype._createResultNode=function(e,t){var n=ye(sw.RESULT_HTML);return e.primaryTokens.length>0&&aw(n,e.primaryTokens,sw.RESULT_PRIMARY_HTML),aw(n,e.secondaryTokens,sw.RESULT_SECONDARY_HTML),Z(n,sw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},sw.prototype.registerProvider=function(e){this._searchProvider=e},sw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,K(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},sw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,K(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},sw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},sw.prototype.isOpen=function(){return this._open},sw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(sw.RESULT_SELECTED_CLASS);var n=Z(e,sw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(sw.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},sw.prototype._select=function(e){var t=Z(e,sw.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)},sw.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"},o=ye('<div class="'+sw.OVERLAY_CLASS+'"></div>');return X(o,i),{position:{bottom:r-t,right:n-t},show:!0,html:o}}(wt(e));this._overlayId=this._overlays.add(e,t)}},sw.prototype._getBoxHtml=function(){const e=ye(sw.BOX_HTML),t=ve(sw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},sw.CONTAINER_SELECTOR=".djs-search-container",sw.INPUT_SELECTOR=".djs-search-input input",sw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",sw.RESULT_SELECTOR=".djs-search-result",sw.RESULT_SELECTED_CLASS="djs-search-result-selected",sw.RESULT_SELECTED_SELECTOR="."+sw.RESULT_SELECTED_CLASS,sw.RESULT_ID_ATTRIBUTE="data-result-id",sw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",sw.OVERLAY_CLASS="djs-search-overlay",sw.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>',sw.RESULT_HTML='<div class="djs-search-result"></div>',sw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',sw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var lw={__depends__:[No,ds,ss],searchPad:["type",sw]};function cw(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function pw(e){return y(e,(function(e){return!!e.matched})).length>0}function uw(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}cw.$inject=["elementRegistry","searchPad","canvas"],cw.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=y(n,(function(e){return e!==t})),n=T(n=y(n=k(n,(function(t){return{primaryTokens:uw(oo(t),e),secondaryTokens:uw(t.id,e),element:t}})),(function(e){return pw(e.primaryTokens)||pw(e.secondaryTokens)})),(function(e){return oo(e.element)+e.element.id}))};var hw={__depends__:[lw],__init__:["bpmnSearch"],bpmnSearch:["type",cw]};function dw(e){Wi.call(this,e)}e(dw,Wi),dw.Viewer=Bs,dw.NavigatedViewer=ba,dw.prototype.createDiagram=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>')},dw.prototype._interactionModules=[ra,ha,va],dw.prototype._modelingModules=[tc,yc,Dc,_c,Mp,Ip,zp,zy,_f,pf,Uy,Yy,hv,fv,gv,Ev,Fv,sy,Zv,ob,ub,jb,Lb,jv,ow,hw],dw.prototype._modules=[].concat(Bs.prototype._modules,dw.prototype._interactionModules,dw.prototype._modelingModules);var fw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function mw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gw={exports:{}};
|
|
160
158
|
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
161
159
|
* http://hammerjs.github.io/
|
|
162
160
|
*
|