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 i=Math.log(Math.pow(2,e))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var o=i-Math.floor(i),s="";for(r=0;r<Math.floor(i);r++){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,i){var r=function(r){var s=0;do{if(s++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var a=t(e,n)}while(Object.hasOwnProperty.call(o,a));return o[a]=r,a},o=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=n||16,r}}));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 i(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 r=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]"===r.call(e)}function p(e){return"[object Object]"===r.call(e)}function u(e){return"[object Number]"===r.call(e)}function d(e){const t=r.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function h(e){return"[object String]"===r.call(e)}function m(e,t){return o.call(e,t)}function f(e,t){const n=R(t);let i;return v(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function g(e,t){const n=R(t);let i=c(e)?-1:void 0;return v(e,(function(e,t){if(n(e,t))return i=t,!1})),i}function y(e,t){const n=R(t);let i=[];return v(e,(function(e,t){n(e,t)&&i.push(e)})),i}function v(e,t){let n,i;if(s(e))return;const r=c(e)?N:D;for(let o in e)if(m(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function b(e,t){if(s(e))return[];!function(e){if(!c(e))throw new Error("must supply array")}(e);const n=R(t);return e.filter((function(e,t){return!n(e,t)}))}function w(e,t,n){return v(e,(function(e,i){n=t(n,e,i)})),n}function x(e,t){return!!w(e,(function(e,n,i){return e&&t(n,i)}),!0)}function _(e,t){return!!f(e,t)}function E(e,t){let n=[];return v(e,(function(e,i){n.push(t(e,i))})),n}function O(e){return e&&Object.keys(e)||[]}function P(e){return E(e,(e=>e))}function k(e,t,n={}){return t=M(t),v(e,(function(e){let i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)})),n}function S(e,...t){e=M(e);let n={};return v(t,(t=>k(t,e,n))),E(n,(function(e,t){return e[0]}))}const C=S;function A(e,t){t=M(t);let n=[];return v(e,(function(e,i){let r=t(e,i),o={d:r,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(r<e)return void n.splice(s,0,o)}n.push(o)})),E(n,(e=>e.v))}function T(e){return function(t){return x(e,(function(e,n){return t[n]===e}))}}function M(e){return d(e)?e:t=>t[e]}function R(e){return d(e)?e:t=>t===e}function D(e){return e}function N(e){return Number(e)}function B(e,t){let n,i,r,o;function s(n){let s=Date.now(),c=n?0:o+t-s;if(c>0)return a(c);e.apply(r,i),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=o=i=r=void 0}function c(...e){o=Date.now(),i=e,r=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function j(e,t){return e.bind(t)}function I(e,...t){return Object.assign(e,...t)}function $(e,t,n){let i=e;return v(t,(function(e,r){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[r+1],c=i[e];a(o)&&l(c)&&(c=i[e]=isNaN(+o)?{}:[]),s(o)?s(n)?delete i[e]:i[e]=n:i=c})),e}function L(e,t){let n={},i=Object(e);return v(t,(function(t){t in i&&(n[t]=e[t])})),n}function q(e,t){let n={};return v(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}function z(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 i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const V=Object.prototype.toString,F=Object.prototype.hasOwnProperty;function H(e,t){return F.call(e,t)}function U(e,t){let n,i;if(void 0===e)return;const r=function(e){return"[object Array]"===V.call(e)}(e)?Q:W;for(let o in e)if(H(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function W(e){return e}function Q(e){return Number(e)}function G(e,...t){const n=e.style;return U(t,(function(e){e&&U(e,(function(e,t){n[t]=e}))})),e}function X(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const K=Object.prototype.toString;function Y(e){return new Z(e)}function Z(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function J(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function ee(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function te(e,t,n){for(var i=n?e:e.parentNode;i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(ee(i,t))return i;i=i.parentNode}return ee(i,t)?i:null}Z.prototype.add=function(e){return this.list.add(e),this},Z.prototype.remove=function(e){return"[object RegExp]"==K.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Z.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},Z.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Z.prototype.array=function(){return Array.from(this.list)},Z.prototype.has=Z.prototype.contains=function(e){return this.list.contains(e)};var ne,ie,re,oe={};function se(){ne=window.addEventListener?"addEventListener":"attachEvent",ie=window.removeEventListener?"removeEventListener":"detachEvent",re="addEventListener"!==ne?"on":""}var ae=oe.bind=function(e,t,n,i){return ne||se(),e[ne](re+t,n,i||!1),n},le=oe.unbind=function(e,t,n,i){return ie||se(),e[ie](re+t,n,i||!1),n},ce=z({__proto__:null,bind:ae,unbind:le,default:oe},[oe]),pe=["focus","blur"];var ue,de={bind:function(e,t,n,i,r){return-1!==pe.indexOf(n)&&(r=!0),ce.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=te(r,t,!0),n.delegateTarget&&i.call(e,n)}),r)},unbind:function(e,t,n,i){return-1!==pe.indexOf(t)&&(i=!0),ce.unbind(e,t,n,i)}},he=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){return(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var r=Object.prototype.hasOwnProperty.call(fe,i)?fe[i]:fe._default,o=r[0],s=r[1],a=r[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&&((ue=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',me=!ue.getElementsByTagName("link").length,ue=void 0);var fe={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,"",""]};fe.td=fe.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],fe.option=fe.optgroup=[1,'<select multiple="multiple">',"</select>"],fe.thead=fe.tbody=fe.colgroup=fe.caption=fe.tfoot=[1,"<table>","</table>"],fe.polyline=fe.ellipse=fe.polygon=fe.circle=fe.text=fe.line=fe.path=fe.rect=fe.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var ge=he;function ye(e,t){return(t=t||document).querySelector(e)}function ve(e,t){return(t=t||document).querySelectorAll(e)}function be(e){e.parentNode&&e.parentNode.removeChild(e)}function we(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function xe(e,t){return we(t,e),e}var _e=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":_e,"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":_e,"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 i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Ee[i];r?(r===_e&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=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,i,r=Object.keys(t);for(n=0;i=r[n];n++)Oe(e,i,t[i])}(e,t);return e}const ke=Object.prototype.toString;function Se(e){return new Ce(e)}function Ce(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ae(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Te(e){for(var t;t=e.firstChild;)Ae(t);return e}function Me(e){return e.cloneNode(!0)}Ce.prototype.add=function(e){return this.list.add(e),this},Ce.prototype.remove=function(e){return"[object RegExp]"==ke.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Ce.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},Ce.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ce.prototype.array=function(){return Array.from(this.list)},Ce.prototype.has=Ce.prototype.contains=function(e){return this.list.contains(e)};var Re={svg:"http://www.w3.org/2000/svg"},De='<svg xmlns="'+Re.svg+'"';function Ne(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Re.svg)&&(e=De+e.substring(4)):(e=De+">"+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 i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Be(e,t){var n;return"<"===e.charAt(0)?(n=Ne(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Re.svg,e),t&&Pe(n,t),n}var je=null;function Ie(){return null===je&&(je=Be("svg")),je}function $e(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Le(e){return e?Ie().createSVGTransformFromMatrix(e):Ie().createSVGTransform()}var qe=/([&<>]{1})/g,ze=/([\n\r"]{1})/g,Ve={"&":"&","<":"<",">":">",'"':"'"};function Fe(e,t){return e.replace(t,(function(e,t){return Ve[t]||t}))}function He(e,t){var n,i,r,o,s;switch(e.nodeType){case 3:t.push(Fe(e.textContent,qe));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Fe(o.value,ze),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(s=e.childNodes).length;n<i;++n)He(s.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Fe(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 Ue(e,t){var n=Ne(t);if(Te(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)we(r[o],e)}}function We(e,t){if(void 0!==t){try{Ue(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)He(t,n),t=t.nextSibling;return n.join("")}(e)}function Qe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ge(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Qe(e,i))}(n,t)),n.consolidate()}const Xe=/^class[ {]/;function Ke(e){return Array.isArray(e)}function Ye(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ze(...e){1===e.length&&Ke(e[0])&&(e=e[0]);const t=(e=[...e]).pop();return t.$inject=e,t}const Je=/constructor\s*[^(]*\(\s*([^)]*)\)/m,et=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,tt=/\/\*([^*]*)\*\//m;function nt(e){if("function"!=typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(function(e){return Xe.test(e.toString())}(e)?Je:et);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map((e=>{const t=e.match(tt);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=[],i=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),o=r.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(!i[e]&&-1!==e.indexOf(".")){const t=e.split(".");let n=a(t.shift());for(;t.length;)n=n[t.shift()];return n}if(Ye(r,e))return r[e];if(Ye(i,e)){if(-1!==n.indexOf(e))throw n.push(e),s("Cannot resolve circular dependency!");return n.push(e),r[e]=i[e][0](i[e][1]),n.pop(),r[e]}return t.get(e,o)}function l(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Ke(e))throw s(`Cannot invoke "${e}". Expected a function!`);e=Ze(e.slice())}return{fn:e,dependencies:(e.$inject||nt(e)).map((e=>Ye(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:i,dependencies:r}=l(e,n);return i.apply(t,r)}function u(e){return Ze((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,d;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),d=u(p),o.push(l[3]),s.push(p),a.push(d),n[e]=[d,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,o)}const h={factory:p,type:c,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 f(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=Ze((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;if("private"===e[t][2])return void(i[t]=e[t]);const n=e[t][0],r=e[t][1];i[t]=[h[n],rt(n,r),n]})),m(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=d,this.init=function(e){const t=e.reduce(g,[]).map(f);let n=!1;return function(){n||(n=!0,t.forEach((e=>e())))}}(e)}function rt(e,t){return"value"!==e&&Ke(t)&&(t=Ze(t.slice())),t}var ot=1e3;function st(e,t){var n=this;t=t||ot,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,r=t.element,o=t.gfx,s=t.attrs;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r,s):n.drawConnection(o,r,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 at(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function lt(e){return["L",e.x,e.y]}function ct(e,t){const n=e.length,i=[(r=e[0],["M",r.x,r.y])];var r,o,s,a;for(let r=1;r<n;r++){const n=e[r-1],l=e[r],c=e[r+1];if(!c||!t){i.push(lt(l));continue}const p=Math.min(t,ut(l.x-n.x,l.y-n.y),ut(c.x-l.x,c.y-l.y));if(!p){i.push(lt(l));continue}const u=pt(l,n,p),d=pt(l,n,.5*p),h=pt(l,c,p),m=pt(l,c,.5*p);i.push(lt(u)),i.push((s=m,a=h,["C",(o=d).x,o.y,s.x,s.y,a.x,a.y]))}return i}function pt(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n/ut(i,r);return{x:e.x+i*o,y:e.y+r*o}}function ut(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 i=Be("path",t);return u(n)&&(i.dataset.cornerRadius=String(n)),ht(i,e)}function ht(e,t){return Pe(e,{d:at(ct(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function mt(e){return y(e,(function(t){return!f(e,(function(e){return e!==t&&ft(t,e)}))}))}function ft(e,t){if(t){if(e===t)return t;if(e.parent)return ft(e.parent,t)}}function gt(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function yt(e,t,n){n=n||0,c(e)||(e=[e]),v(e,(function(e,i){var r=t(e,i,n);c(r)&&r.length&&yt(r,t,n+1)}))}function vt(e,t){return function(e,t,n){var i=[],r=[];return yt(e,(function(e,o,s){gt(i,e,t);var a=e.children;if((-1===n||s<n)&&a&>(r,a,t))return a})),i}(e,!t,-1)}function bt(e,t){var n,i,r,o;return t=!!t,c(e)||(e=[e]),v(e,(function(e){var s=e;e.waypoints&&!t&&(s=bt(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<i||void 0===i)&&(i=l),(a+p>r||void 0===r)&&(r=a+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:i,height:o-i,width:r-n}}function wt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function xt(e){return!(!e||!e.isFrame)}function _t(e,t){return I({},e||{},t||{})}st.prototype.canRender=function(e){},st.prototype.drawShape=function(e,t){},st.prototype.drawConnection=function(e,t){},st.prototype.getShapePath=function(e){},st.prototype.getConnectionPath=function(e){};function Et(e,t){st.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}e(Et,st),Et.prototype.canRender=function(){return!0},Et.prototype.drawShape=function(e,t,n){var i=Be("rect");return Pe(i,{x:0,y:0,width:t.width||0,height:t.height||0}),xt(t)?Pe(i,I({},this.FRAME_STYLE,n||{})):Pe(i,I({},this.SHAPE_STYLE,n||{})),xe(e,i),i},Et.prototype.drawConnection=function(e,t,n){var i=dt(t.waypoints,I({},this.CONNECTION_STYLE,n||{}));return xe(e,i),i},Et.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return at([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},Et.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return at(r)},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 I(this.style(t,n),{class:e})},this.style=function(t,n){c(t)||n||(n=t,t=[]);var i=w(t,(function(t,n){return I(t,e[n]||{})}),{});return n?I(i,n):i},this.computeStyle=function(e,n,i){return c(n)||(i=n,n=[]),t.style(n||[],I({},i,e||{}))}}]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function kt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function St(e,t){return e&&t?e.indexOf(t):-1}function Ct(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function At(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Ct(e,t);return Math.abs(r/o)<=i}var Tt=2;function Mt(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[e,t]of Object.entries(i))if(Rt(e,n))return t;return!1}function Rt(e,t){const n=t[0];return x(t,(function(t){return Math.abs(n[e]-t[e])<=Tt}))}function Dt(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 Nt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Bt=/,?([a-z]),?/gi,jt=parseFloat,It=Math,$t=It.PI,Lt=It.min,qt=It.max,zt=It.pow,Vt=It.abs,Ft=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Ht=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Ut=Array.isArray||function(e){return e instanceof Array};function Wt(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)Wt(e,n)&&(t[n]=Qt(e[n]));return t}function Gt(e){var t=Gt.ps=Gt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Wt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Xt(e,t,n,i){return 1===arguments.length&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Kt(){return this.join(",").replace(Bt,"$1")}function Yt(e){var t=Qt(e);return t.toString=Kt,t}function Zt(e,t,n,i,r,o,s,a,l){var c=1-l,p=zt(c,3),u=zt(c,2),d=l*l*l,h=p*t+3*u*l*i+3*c*l*l*o+d*a;return{x:on(p*e+3*u*l*n+3*c*l*l*r+d*s),y:on(h)}}function Jt(e){var t=function(e,t,n,i,r,o,s,a){for(var l,c,p,u,d,h,m,f,g=[],y=[[],[]],v=0;v<2;++v)if(0==v?(c=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*s,p=3*n-3*e):(c=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*a,p=3*i-3*t),Vt(l)<1e-12){if(Vt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else m=c*c-4*p*l,f=It.sqrt(m),m<0||(0<(d=(-c+f)/(2*l))&&d<1&&g.push(d),0<(h=(-c-f)/(2*l))&&h<1&&g.push(h));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*r+u*u*u*s,y[1][w]=b*b*b*t+3*b*b*u*i+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:Lt(...y[0]),y0:Lt(...y[1]),x1:qt(...y[0]),y1:qt(...y[1])}}(...e);return Xt(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function en(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function tn(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function nn(e,t,n,i,r,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],d=0,h=0;h<12;h++){var m=c*p[h]+c,f=tn(m,e,n,r,s),g=tn(m,t,i,o,a),y=f*f+g*g;d+=u[h]*It.sqrt(y)}return c*d}function rn(e,t,n,i,r,o,s,a){if(!(qt(e,n)<Lt(r,s)||Lt(e,n)>qt(r,s)||qt(t,i)<Lt(o,a)||Lt(t,i)>qt(o,a))){var l=(e*i-t*n)*(o-a)-(t-i)*(r*a-o*s),c=(e-n)*(o-a)-(t-i)*(r-s);if(c){var p=on(((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/c),u=on(l/c),d=+p.toFixed(2),h=+u.toFixed(2);if(!(d<+Lt(e,n).toFixed(2)||d>+qt(e,n).toFixed(2)||d<+Lt(r,s).toFixed(2)||d>+qt(r,s).toFixed(2)||h<+Lt(t,i).toFixed(2)||h>+qt(t,i).toFixed(2)||h<+Lt(o,a).toFixed(2)||h>+qt(o,a).toFixed(2)))return{x:p,y:u}}}}function on(e){return Math.round(1e11*e)/1e11}function sn(e,t,n){if(!function(e,t){return e=Xt(e),en(t=Xt(t),e.x,e.y)||en(t,e.x2,e.y)||en(t,e.x,e.y2)||en(t,e.x2,e.y2)||en(e,t.x,t.y)||en(e,t.x2,t.y)||en(e,t.x,t.y2)||en(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)}(Jt(e),Jt(t)))return n?0:[];for(var i=nn(...e),r=nn(...t),o=cn(e)?1:~~(i/5)||1,s=cn(t)?1:~~(r/5)||1,a=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var d=Zt(...e,u/o);a.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<s+1;u++)d=Zt(...t,u/s),l.push({x:d.x,y:d.y,t:u/s});for(u=0;u<o;u++)for(var h=0;h<s;h++){var m,f=a[u],g=a[u+1],y=l[h],v=l[h+1],b=Vt(g.x-f.x)<.01?"y":"x",w=Vt(v.x-y.x)<.01?"y":"x",x=rn(f.x,f.y,g.x,g.y,y.x,y.y,v.x,v.y);if(x){if(c[m=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[m]=!0;var _=f.t+Vt((x[b]-f[b])/(g[b]-f[b]))*(g.t-f.t),E=y.t+Vt((x[w]-y[w])/(v[w]-y[w]))*(v.t-y.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?p++:p.push({x:x.x,y:x.y,t1:_,t2:E}))}}return p}function an(e,t,n){e=hn(e),t=hn(t);for(var i,r,o,s,a,l,c,p,u,d,h=n?0:[],m=0,f=e.length;m<f;m++){var g=e[m];if("M"==g[0])i=a=g[1],r=l=g[2];else{"C"==g[0]?(i=(u=[i,r,...g.slice(1)])[6],r=u[7]):(u=[i,r,i,r,a,l,a,l],i=a,r=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=(d=[o,s,...b.slice(1)])[6],s=d[7]):(d=[o,s,o,s,c,p,c,p],o=c,s=p);var w=sn(u,d,n);if(n)h+=w;else{for(var x=0,_=w.length;x<_;x++)w[x].segment1=m,w[x].segment2=y,w[x].bez1=u,w[x].bez2=d;h=h.concat(w)}}}}}return h}function ln(e){var t=Gt(e);if(t.abs)return Yt(t.abs);if(Ut(e)&&Ut(e&&e[0])||(e=function(e){if(!e)return null;var t=Gt(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},i=[];return Ut(e)&&Ut(e[0])&&(i=Qt(e)),i.length||String(e).replace(Ft,(function(e,t,r){var o=[],s=t.toLowerCase();for(r.replace(Ht,(function(e,t){t&&o.push(+t)})),"m"==s&&o.length>2&&(i.push([t,...o.splice(0,2)]),s="l",t="m"==t?"l":"L");o.length>=n[s]&&(i.push([t,...o.splice(0,n[s])]),n[s]););})),i.toString=Gt.toString,t.arr=Qt(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=r=+e[0][1],a=o=+e[0][2],l++,i[0]=["M",r,o]);for(var c,p,u=l,d=e.length;u<d;u++){if(i.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]+r,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+r;break;case"M":s=+p[1]+r,a=+p[2]+o;default:for(var h=1,m=p.length;h<m;h++)c[h]=+p[h]+(h%2?r:o)}else for(var f=0,g=p.length;f<g;f++)c[f]=p[f];switch(n=n.toUpperCase(),c[0]){case"Z":r=+s,o=+a;break;case"H":r=c[1];break;case"V":o=c[1];break;case"M":s=c[c.length-2],a=c[c.length-1];default:r=c[c.length-2],o=c[c.length-1]}}return i.toString=Kt,t.abs=Yt(i),i}function cn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function pn(e,t,n,i){return[e,t,n,i,n,i]}function un(e,t,n,i,r,o){var s=1/3,a=2/3;return[s*e+a*n,s*t+a*i,s*r+a*n,s*o+a*i,r,o]}function dn(e,t,n,i,r,o,s,a,l,c){var p,u=120*$t/180,d=$t/180*(+r||0),h=[],m=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return Wt(i,n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=e(...arguments),i[n])}}((function(e,t,n){return{x:e*It.cos(n)-t*It.sin(n),y:e*It.sin(n)+t*It.cos(n)}}));if(c)E=c[0],O=c[1],x=c[2],_=c[3];else{e=(p=m(e,t,-d)).x,t=p.y;var f=(e-(a=(p=m(a,l,-d)).x))/2,g=(t-(l=p.y))/2,y=f*f/(n*n)+g*g/(i*i);y>1&&(n*=y=It.sqrt(y),i*=y);var v=n*n,b=i*i,w=(o==s?-1:1)*It.sqrt(Vt((v*b-v*g*g-b*f*f)/(v*g*g+b*f*f))),x=w*n*g/i+(e+a)/2,_=w*-i*f/n+(t+l)/2,E=It.asin(((t-_)/i).toFixed(9)),O=It.asin(((l-_)/i).toFixed(9));(E=e<x?$t-E:E)<0&&(E=2*$t+E),(O=a<x?$t-O:O)<0&&(O=2*$t+O),s&&E>O&&(E-=2*$t),!s&&O>E&&(O-=2*$t)}var P=O-E;if(Vt(P)>u){var k=O,S=a,C=l;O=E+u*(s&&O>E?1:-1),h=dn(a=x+n*It.cos(O),l=_+i*It.sin(O),n,i,r,0,s,S,C,[O,k,x,_])}P=O-E;var A=It.cos(E),T=It.sin(E),M=It.cos(O),R=It.sin(O),D=It.tan(P/4),N=4/3*n*D,B=4/3*i*D,j=[e,t],I=[e+N*T,t-B*A],$=[a+N*R,l-B*M],L=[a,l];if(I[0]=2*j[0]-I[0],I[1]=2*j[1]-I[1],c)return[I,$,L].concat(h);for(var q=[],z=0,V=(h=[I,$,L].concat(h).join().split(",")).length;z<V;z++)q[z]=z%2?m(h[z-1],h[z],d).y:m(h[z],h[z+1],d).x;return q}function hn(e){var t=Gt(e);if(t.curve)return Yt(t.curve);for(var n=ln(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C",...dn(t.x,t.y,...e.slice(1))];break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r,...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",...un(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",...un(t.x,t.y,e[1],e[2],e[3],e[4])];break;case"L":e=["C",...pn(t.x,t.y,e[1],e[2])];break;case"H":e=["C",...pn(t.x,t.y,e[1],t.y)];break;case"V":e=["C",...pn(t.x,t.y,t.x,e[1])];break;case"Z":e=["C",...pn(t.x,t.y,t.X,t.Y)]}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var i=e[t];i.length;)s[t]="A",e.splice(t++,0,["C",...i.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]=r(n[c],i,l),"A"!=s[c]&&"C"==a&&(s[c]="C"),o(n,c);var u=n[c],d=u.length;i.x=u[d-2],i.y=u[d-1],i.bx=jt(u[d-4])||i.x,i.by=jt(u[d-3])||i.y}return t.curve=Yt(n),n}function mn(e){return p(e)&&m(e,"waypoints")}function fn(e){return p(e)&&m(e,"labelTarget")}function gn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function vn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function bn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function wn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,i){var r=t[i-1];if(r){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))}(r,n);e.push({start:r,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0),r=i/2,o=0,s=n[o];s.endLength<r;)s=n[++o];var a=(r-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 xn(e){return mn(e)?wn(e):yn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function _n(e,t,n){p(n=n||0)||(n={x:n,y:n});var i=vn(e),r=vn(t),o=i.bottom+n.y<=r.top,s=i.left-n.x>=r.right,a=i.top-n.y>=r.bottom,l=o?"top":a?"bottom":null,c=i.right+n.x<=r.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function En(e,t,n){var i=function(e,t){return an(e,t)}(e,t);return 1===i.length||2===i.length&&Ct(i[0],i[1])<1?yn(i[0]):i.length>1?(i=A(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),yn(i[n?0:i.length-1])):null}function On(e,t){return Math.round(e*t)/t}function Pn(e){return u(e)?e+"px":e}function kn(e,t,n){const i=Be("g");Se(i).add(t);const r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Sn={shape:["x","y","width","height"],connection:["waypoints"]};function Cn(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function An(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Cn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Cn.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=I({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),G(n,{position:"relative",overflow:"hidden",width:Pn(e.width),height:Pn(e.height)}),t.appendChild(n),n}(e),i=this._svg=Be("svg");Pe(i,{width:"100%",height:"100%"}),xe(n,i);const r=this._viewport=kn(i,"viewport");e.deferUpdate&&(this._viewboxChanged=B(j(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:i,viewport:r})})),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)},Cn.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},Cn.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=wt(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Cn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Cn.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},Cn.prototype._getChildIndex=function(e){return w(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Cn.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:kn(this._viewport,"layer-"+e,n),index:t,visible:!0}},Cn.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,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Cn.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?(Ae(n),t.visible=!1,n):n},Cn.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ae(t.group))},Cn.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Cn.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},Cn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Cn.prototype._findPlaneForRoot=function(e){return f(this._planes,(function(t){return t.rootElement===e}))},Cn.prototype.getContainer=function(){return this._container},Cn.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),i=this._elementRegistry._elements[e.id],i&&(v([i.gfx,i.secondaryGfx],(function(e){e&&(n?Se(e).add(t):Se(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Cn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Cn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Cn.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));return Se(this.getGraphics(e)).has(t)},Cn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Cn.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Cn.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 i=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Cn.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},Cn.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},Cn.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)},Cn.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Cn.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})},Cn.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=Sn[e],i=x(n,(function(e){return void 0!==t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Cn.prototype._setParent=function(e,t,n){kt(t.children,e,n),e.parent=t},Cn.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const s=o.create(e,t,i);return this._elementRegistry.add(t,s),o.update(e,t,s),r.fire(e+".added",{element:t,gfx:s}),t},Cn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Cn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Cn.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),Pt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Cn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Cn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Cn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Cn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Cn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Cn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let i,r,o,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const i=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Ge(t,i)})),e):(o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},s=Ge(t),r=s?s.matrix:function(e,t,n,i,r,o){var s=Ie().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return $e(s,e);case 6:return $e(s,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),a=On(r.a,1e3),l=On(-r.e||0,1e3),c=On(-r.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:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n})},Cn.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=I({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),An(t,n)})),{x:n.e,y:n.f}},Cn.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===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 r=bt(e),o=vn(r),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=vn(s);if(r.width<s.width&&r.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),i=Math.min(0,o.top-p.top);l=e||t,c=n||i}else l=r.x-s.x,c=r.y-s.y;this.scroll({dx:-l*a,dy:-c*a})},Cn.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,i;return this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)})),On(i.a,1e3)},Cn.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Cn.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let s,a,l,c,p;l=i.getCTM();const u=l.a;return t?(s=I(o,t),a=s.matrixTransform(l.inverse()),c=r.translate(a.x,a.y).scale(1/u*e).translate(-a.x,-a.y),p=l.multiply(c)):p=r.scale(e),An(this._viewport,p),p},Cn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Cn.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}},Cn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Tn="data-element-id";function Mn(e){this._elements={},this._eventBus=e}function Rn(e,t,n){var i=function(e,t,n,i){var r=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,r,i)),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,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach((function(i){e.set(i,t.inverse,n)}))}function Dn(e,t){if(!(this instanceof Dn))return new Dn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Mn.$inject=["eventBus"],Mn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Pe(t,Tn,i),n&&Pe(n,Tn,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Mn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Pe(i.gfx,Tn,""),i.secondaryGfx&&Pe(i.secondaryGfx,Tn,""),delete t[n])},Mn.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Mn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Pe(t,Tn,i),t},Mn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Pe(e,Tn);var n=this._elements[t];return n&&n.element},Mn.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},Mn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=t[n[i]],o=r.element;if(e(o,r.gfx))return o}},Mn.prototype.getAll=function(){return this.filter((function(e){return e}))},Mn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)}))},Mn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Mn.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")},Dn.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?Rn(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},Dn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return function(e){return!0===e.__refs_collection}(n)||Rn(this,t,e),n},Dn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Dn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Dn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nn=new Dn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Bn=new Dn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),jn=new Dn({name:"attachers",collection:!0},{name:"host"}),In=new Dn({name:"outgoing",collection:!0},{name:"source"}),$n=new Dn({name:"incoming",collection:!0},{name:"target"});function Ln(){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)}}),Nn.bind(this,"parent"),Bn.bind(this,"labels"),In.bind(this,"outgoing"),$n.bind(this,"incoming")}function qn(){Ln.call(this),Nn.bind(this,"children"),jn.bind(this,"host"),jn.bind(this,"attachers")}function zn(){Ln.call(this),Nn.bind(this,"children")}function Vn(){qn.call(this),Bn.bind(this,"labelTarget")}function Fn(){Ln.call(this),In.bind(this,"source"),$n.bind(this,"target")}e(qn,Ln),e(zn,qn),e(Vn,qn),e(Fn,Ln);var Hn={connection:Fn,shape:qn,label:Vn,root:zn};function Un(){this._uid=12}Un.prototype.createRoot=function(e){return this.create("root",e)},Un.prototype.createLabel=function(e){return this.create("label",e)},Un.prototype.createShape=function(e){return this.create("shape",e)},Un.prototype.createConnection=function(e){return this.create("connection",e)},Un.prototype.create=function(e,t){return(t=I({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Hn[e];if(!n)throw new Error("unknown type: <"+e+">");return I(new n,t)}(e,t)};var Wn="__fn",Qn=Array.prototype.slice;function Gn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Xn(){}function Kn(e){return e.childNodes[0]}function Yn(e,t,n,i,r){var o=Le();o.setTranslate(t,n);var s=Le();s.setRotate(i||0,0,0);var a=Le();a.setScale(r||1,r||1),Ge(e,[o,s,a])}function Zn(e,t,n){var i=Le();i.setTranslate(t,n),Ge(e,i)}function Jn(e,t){var n=Le();n.setRotate(t,0,0),Ge(e,n)}function ei(e,t){this._eventBus=e,this._elementRegistry=t}function ti(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}Gn.prototype.on=function(e,t,n,i){if(e=c(e)?e:[e],d(t)&&(i=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");var r=n;i&&((r=j(n,i))[Wn]=n[Wn]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},Gn.prototype.once=function(e,t,n,i){var r=this;if(d(t)&&(i=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(i,arguments);return r.off(e,o),t}o[Wn]=n,this.on(e,t,o)},Gn.prototype.off=function(e,t){e=c(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Gn.prototype.createEvent=function(e){var t=new Xn;return t.init(e),t},Gn.prototype.fire=function(e,t){var n,i,r,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Xn?t:this.createEvent(t),o[0]=n;var s=n.type;e!==s&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==s&&(n.type=s)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Gn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Gn.prototype._destroy=function(){this._listeners={}},Gn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Gn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return i},Gn.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},Gn.prototype._getListeners=function(e){return this._listeners[e]},Gn.prototype._setListeners=function(e,t){this._listeners[e]=t},Gn.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r[Wn]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},Xn.prototype.stopPropagation=function(){this.cancelBubble=!0},Xn.prototype.preventDefault=function(){this.defaultPrevented=!0},Xn.prototype.init=function(e){I(this,e||{})},ei.$inject=["eventBus","elementRegistry"],ei.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(Se(t=Be("g")).add("djs-children"),xe(n.parentNode,t))):t=n,t},ei.prototype._clear=function(e){var t=Kn(e);return J(t),t},ei.prototype._createContainer=function(e,t,n,i){var r=Be("g");Se(r).add("djs-group"),void 0!==n?ti(r,t,t.childNodes[n]):xe(t,r);var o=Be("g");Se(o).add("djs-element"),Se(o).add("djs-"+e),i&&Se(o).add("djs-frame"),xe(r,o);var s=Be("g");return Se(s).add("djs-visual"),xe(o,s),o},ei.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,xt(t))},ei.prototype.updateContainments=function(e){var t,n=this,i=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 r=n._getChildrenContainer(e);v(t.slice().reverse(),(function(e){ti(i.getGraphics(e).parentNode,r)}))}}))},ei.prototype.drawShape=function(e,t,n={}){return this._eventBus.fire("render.shape",{gfx:e,element:t,attrs:n})},ei.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},ei.prototype.drawConnection=function(e,t,n={}){return this._eventBus.fire("render.connection",{gfx:e,element:t,attrs:n})},ei.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},ei.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Zn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},ei.prototype.remove=function(e){Ae(this._elementRegistry.getGraphics(e).parentNode)};var ni={__depends__:[Ot],__init__:["canvas"],canvas:["type",Cn],elementRegistry:["type",Mn],elementFactory:["type",Un],eventBus:["type",Gn],graphicsFactory:["type",ei]};function ii(e){return function(e){var t=new it(e);return t.init(),t}([{config:["value",e=e||{}]},ni].concat(e.modules||[]))}function ri(e,t){this._injector=t=t||ii(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function oi(){}function si(e,t){this.model=e,this.properties=t}ri.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ri.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},oi.prototype.get=function(e){return this.$model.properties.get(this,e)},oi.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},si.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(oi.prototype);v(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),v(e,j((function(e,t){this.set(t,e)}),this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var ai={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},li={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 ci(e,t){var n=li[e];return n?n(t):t}function pi(e){return!!ai[e]}function ui(e){return!!li[e]}function di(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function hi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mi(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,v(e,j(this.registerPackage,this))}function fi(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function gi(e){this.model=e}function yi(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function vi(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new gi(this),this.factory=new si(this,this.properties),this.registry=new mi(e,this.properties),this.typeCache={},this.config=t}hi.prototype.build=function(){return L(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},hi.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},hi.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=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=r.indexOf(e);if(-1===a)throw new Error("property <"+i.name+"> not found in property list");r.splice(a,1),this.addProperty(t,n?void 0:a,s),o[i.name]=o[i.localName]=t},hi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=di(r[0],i),s=di(r[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},hi.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},hi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},hi.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},hi.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},hi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},hi.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},hi.prototype.hasProperty=function(e){return this.propertiesByName[e]},hi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(v(e.properties,j((function(n){n=I({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},mi.prototype.getPackage=function(e){return this.packageMap[e]},mi.prototype.getPackages=function(){return this.packages},mi.prototype.registerPackage=function(e){e=I({},e);var t=this.packageMap;fi(t,e,"prefix"),fi(t,e,"uri"),v(e.types,j((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mi.prototype.registerType=function(e,t){var n=di((e=I({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:I(e.meta||{})})).name,t.prefix),i=n.name,r={};v(e.properties,j((function(e){var t=di(e.name,n.prefix),i=t.name;pi(e.type)||(e.type=di(e.type,t.prefix).name),I(e,{ns:t,name:i}),r[i]=e}),this)),I(e,{ns:n,name:i,propertiesByName:r}),v(e.extends,j((function(e){var t=di(e,n.prefix),r=this.typeMap[t.name];r.traits=r.traits||[],r.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},mi.prototype.mapTypes=function(e,t,n){var i=pi(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(n,i){var o=di(n,pi(n)?"":e.prefix);r.mapTypes(o,t,i)}function s(e){return o(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");v(i.superClass,n?s:function(e){return o(e,!1)}),t(i,!n),v(i.traits,s)},mi.prototype.getEffectiveDescriptor=function(e){var t=di(e),n=new hi(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},mi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},gi.prototype.set=function(e,t,n){if(!h(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[vi(t)]:i?r in e?e[r]=n:yi(e,i,n):e.$attrs[vi(t)]=n},gi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[vi(t)];var i=n.name;return!e[i]&&n.isMany&&yi(e,n,[]),e[i]},gi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=I({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},gi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},gi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},gi.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(void 0!==r){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw n;"undefined"!=typeof console&&console.warn(n)}return null},bi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bi.prototype.getType=function(e){var t=this.typeCache,n=h(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bi.prototype.createAny=function(e,t,n){var i=di(e),r={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){$(this,[e],t)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),v(n,(function(e,t){p(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},bi.prototype.getPackage=function(e){return this.registry.getPackage(e)},bi.prototype.getPackages=function(){return this.registry.getPackages()},bi.prototype.getElementDescriptor=function(e){return e.$descriptor},bi.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},bi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var wi=String.fromCharCode,xi=Object.prototype.hasOwnProperty,_i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Ei={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Oi(e,t,n,i){return i?xi.call(Ei,i)?Ei[i]:"&"+i+";":wi(t||parseInt(n,16))}function Pi(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(_i,Oi):e}Object.keys(Ei).forEach((function(e){Ei[e.toUpperCase()]=Ei[e]}));var ki="xsi:type",Si="non-whitespace outside of root node";function Ci(e){return new Error(e)}function Ai(e){return"missing namespace for prefix <"+e+">"}function Ti(e){return{get:e,enumerable:!0}}function Mi(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ri(e){return e+"$uri"}function Di(){return{line:0,column:0}}function Ni(e){throw e}function Bi(e){if(!this)return new Bi(e);var t,n,i,r,o,s,a,l,c,p=e&&e.proxy,u=Ni,d=Di,h=!1,m=!1,f=null,g=!1;function y(e){e instanceof Error||(e=Ci(e)),f=e,u(e,d)}function v(e){o&&(e instanceof Error||(e=Ci(e)),o(e,d))}this.on=function(e,c){if("function"!=typeof c)throw Ci("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":i=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":r=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw Ci("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Ci("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",m=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Ci("required args <xml=string>");return f=null,function(e){var o,u,f,b,w,x,_,E,O,P,k,S=m?[]:null,C=m?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Ri(n)]=t;return i}(c):null,A=[],T=0,M=!1,R=!1,D=0,N=0,B="",j=0;function I(){if(null!==k)return k;var e,t,n,i,r,o,s,a,l,p,u,d=m&&C.xmlns,f=m&&h?[]:null,g=j,y=B,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,m)if(h){if(null!==(r="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=Pi(o),t=Ri(r),!(s=c[e])){if("xmlns"===r||t in C&&C[t]!==e)do{s="ns"+T++}while(void 0!==C[s]);else s=r;c[e]=s}C[r]!==s&&(i||(C=Mi(C),i=!0),C[r]=s,"xmlns"===r&&(C[Ri(s)]=e,d=s),C[t]=e),w[a]=o;continue}f.push(a,o)}else-1!==(p=a.indexOf(":"))?(n=C[a.substring(0,p)])?((a=d===n?a.substr(p+1):n+a.substr(p))===ki&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=d+":"+o),w[a]=o):v(Ai(a.substring(0,p))):w[a]=o;else w[a]=o}if(h)for(g=0,b=f.length;g<b;g++){if(a=f[g++],o=f[g],-1!==(p=a.indexOf(":"))){if(!(n=C[a.substring(0,p)])){v(Ai(a.substring(0,p)));continue}(a=d===n?a.substr(p+1):n+a.substr(p))===ki&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=d+":"+o)}w[a]=o}return k=w}function $(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,s=0,a=N;D>=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>D);)r+=1,s=a;return-1==D?(o=a,n=e.substring(N)):0===N?n=e.substring(N,D):(o=D-s,n=-1==N?e.substring(D):e.substring(D,N+1)),{data:n,line:r,column:o}}d=$,p&&(P=Object.create({},{name:Ti((function(){return E})),originalName:Ti((function(){return O})),attrs:Ti(I),ns:Ti((function(){return C}))}));for(;-1!==N;){if(-1===(D=60===e.charCodeAt(N)?N:e.indexOf("<",N)))return A.length?y("unexpected end of file"):0===N?y("missing start tag"):void(N<e.length&&e.substring(N).trim()&&v(Si));if(N!==D)if(A.length){if(t&&(t(e.substring(N,D),Pi,d),g))return}else if(e.substring(N,D).trim()&&(v(Si),g))return;if(33===(w=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(N=e.indexOf("]]>",D)))return y("unclosed cdata");if(r&&(r(e.substring(D+9,N),d),g))return;N+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(N=e.indexOf("--\x3e",D)))return y("unclosed comment");if(s&&(s(e.substring(D+4,N),Pi,d),g))return;N+=3;continue}}if(63!==w){for(u=D+1;;u++){if(x=e.charCodeAt(u),isNaN(x))return N=-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){N=u;break}}if(33!==w){if(k={},47===w){if(M=!1,R=!0,!A.length)return y("missing open tag");if(u=E=A.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return y("closing tag mismatch");for(;b<N;b++)if(!(32===(w=e.charCodeAt(b))||w>8&&w<14))return y("close tag")}else{if(47===e.charCodeAt(N-1)?(u=E=e.substring(D+1,N-1),M=!0,R=!0):(u=E=e.substring(D+1,N),M=!0,R=!1),!(w>96&&w<123||w>64&&w<91||95===w||58===w))return y("illegal first char nodeName");for(b=1,f=u.length;b<f;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){E=u.substring(0,b),k=null;break}return y("invalid nodeName")}R||A.push(E)}if(m){if(o=C,M&&(R||S.push(o),null===k&&(h=-1!==u.indexOf("xmlns",b))&&(j=b,B=u,I(),h=!1)),O=E,-1!==(w=E.indexOf(":"))){if(!(_=C[E.substring(0,w)]))return y("missing namespace on <"+O+">");E=E.substr(w+1)}else _=C.xmlns;_&&(E=_+":"+E)}if(M&&(j=b,B=u,n&&(p?n(P,Pi,R,d):n(E,I,Pi,R,d),g)))return;if(R){if(i&&(i(p?P:E,Pi,M,d),g))return;m&&(C=M?o:S.pop())}N+=1}else{if(l&&(l(e.substring(D,N+1),Pi,d),g))return;N+=1}}else{if(-1===(N=e.indexOf("?>",D)))return y("unclosed question");if(a&&(a(e.substring(D,N+2),d),g))return;N+=2}}}(e),d=Di,g=!1,f},this.stop=function(){g=!0}}function ji(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Ii={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},$i="xsi:type";function Li(e){return e.xml&&e.xml.serialize}function qi(e){return Li(e)===$i}function zi(e,t){return ji(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Vi(e){return new Error(e)}function Fi(e){return e.$descriptor}function Hi(e){I(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Vi("expected element");var t,n=this.elementsById,i=Fi(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Vi("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Ui(){}function Wi(){}function Qi(){}function Gi(e,t){this.property=e,this.context=t}function Xi(e,t){this.element=t,this.propertyDesc=e}function Ki(){}function Yi(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Zi(e,t,n){Yi.call(this,e,t,n)}function Ji(e,t,n){this.model=e,this.context=n}function er(e){e instanceof bi&&(e={model:e}),I(this,{lax:!1},e)}Ui.prototype.handleEnd=function(){},Ui.prototype.handleText=function(){},Ui.prototype.handleNode=function(){},Wi.prototype=Object.create(Ui.prototype),Wi.prototype.handleNode=function(){return this},Qi.prototype=Object.create(Ui.prototype),Qi.prototype.handleText=function(e){this.body=(this.body||"")+e},Gi.prototype=Object.create(Qi.prototype),Gi.prototype.handleNode=function(e){if(this.element)throw Vi("expected no sub nodes");return this.element=this.createReference(e),this},Gi.prototype.handleEnd=function(){this.element.id=this.body},Gi.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Xi.prototype=Object.create(Qi.prototype),Xi.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ci(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ki.prototype=Object.create(Qi.prototype),Ki.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},Yi.prototype=Object.create(Ki.prototype),Yi.prototype.addReference=function(e){this.context.addReference(e)},Yi.prototype.handleText=function(e){if(!Fi(this.element).bodyProperty)throw Vi("unexpected body text <"+e+">");Qi.prototype.handleText.call(this,e)},Yi.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Fi(t).bodyProperty;n&&void 0!==e&&(e=ci(n.type,e),t.set(n.name,e))},Yi.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=Fi(i),o=this.context,s=new i({}),a=this.model;return v(n,(function(e,n){var i=r.propertiesByName[n];i&&i.isReference?i.isMany?v(e.split(" "),(function(e){o.addReference({element:s,property:i.ns.name,id:e})})):o.addReference({element:s,property:i.ns.name,id:e}):(i?e=ci(i.type,e):"xmlns"!==n&&(t=di(n,r.ns.prefix),a.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},Yi.prototype.getPropertyForNode=function(e){var t,n,i=di(e.name),r=this.type,o=this.model,s=Fi(r),a=i.name,l=s.propertiesByName[a];if(l&&!l.isAttr)return qi(l)&&(t=e.attributes[$i])?(t=function(e,t){var n=di(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),I({},l,{effectiveType:Fi(n=o.getType(t)).name})):l;var c=o.getPackage(i.prefix);if(c){if(t=zi(i,c),n=o.getType(t),l=f(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),l)return I({},l,{effectiveType:Fi(n).name})}else if(l=f(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),l)return l;throw Vi("unrecognized element <"+i.name+">")},Yi.prototype.toString=function(){return"ElementDescriptor["+Fi(this.type).name+"]"},Yi.prototype.valueHandler=function(e,t){return new Xi(e,t)},Yi.prototype.referenceHandler=function(e){return new Gi(e,this.context)},Yi.prototype.handler=function(e){return"Element"===e?new Ji(this.model,e,this.context):new Yi(this.model,e,this.context)},Yi.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,ui(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(I(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},Zi.prototype=Object.create(Yi.prototype),Zi.prototype.createElement=function(e){var t=e.name,n=di(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),s=o&&zi(n,o)||t;if(!r.hasType(s))throw Vi("unexpected element <"+e.originalName+">");return Yi.prototype.createElement.call(this,e)},Ji.prototype=Object.create(Ki.prototype),Ji.prototype.createElement=function(e){var t=e.name,n=di(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Ji.prototype.handleChild=function(e){var t=new Ji(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Ji.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},er.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yi?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,s=new Hi(I({},t,{rootHandler:i})),a=new Bi({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 i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Vi(l)}function p(e,t){return c(e,t,!0)}i.context=s,l.push(i);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var f=r.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return a.ns(f).on("openTag",(function(e,t,n,i){var r=e.attrs||{},s=Object.keys(r).reduce((function(e,n){var i=t(r[n]);return e[n]=i,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Wi)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},i)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!h.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",m).on("text",(function(e,t,n){!function(e,t){e.trim()&&m(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var r;try{a.parse(e),function(){var e,t,n=s.elementsById,i=s.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=Fi(r).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=r.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else r.set(a.name,o)}}()}catch(e){r=e}var o=i.element;r||o||(r=Vi("failed to parse document as <"+i.type.$descriptor.name+">"));var l=s.warnings,c=s.references,p=s.elementsById;return r?(r.warnings=l,n(r)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},er.prototype.handler=function(e){return new Zi(this.model,e)};var tr=/<|>|'|"|&|\n\r|\n/g,nr=/<|>|&/g;function ir(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.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,r=this.getNSKey(t);i[r]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(r,o).filter((function(e){var n=t.getNSKey(e);return i[n]}))}}function rr(e,t){return ji(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function or(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function sr(e){return h(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var ar={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},lr={"<":"lt",">":"gt","&":"amp"};function cr(e,t,n){return(e=h(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function pr(e){this.tagName=e}function ur(){}function dr(e){this.tagName=e}function hr(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function mr(e,t){hr.call(this,e,t)}function fr(){this.value="",this.write=function(e){this.value+=e}}function gr(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 yr(e){return e=I({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new fr,r=new gr(i,e.format);if(e.preamble&&r.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new hr).build(t).serializeTo(r),!n)return i.value}}}function vr(e,t){bi.call(this,e,t)}pr.prototype.build=function(e){return this.element=e,this},pr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},ur.prototype.serializeValue=ur.prototype.serializeTo=function(e){e.append(this.escape?cr(this.value,nr,lr):this.value)},ur.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(nr)&&(this.escape=!0),this},or(dr,ur),dr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},hr.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){return y(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!m(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.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},hr.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?I({localName:t.ns.localName},e):I({localName:rr(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},hr.prototype.nsPropertyTagName=function(e){return function(e,t){return I({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},hr.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},hr.prototype.nsAttributeName=function(e){var t;if(t=h(e)?di(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}:I({localName:t.localName},n)},hr.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return v(e,(function(r,o){"$body"===o?n.push((new ur).build({type:"String"},r)):"$children"===o?v(r,(function(e){n.push(new hr(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})})),i},hr.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=di(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var s=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(s)}},hr.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return v(i,(function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)})),r},hr.prototype.parseGenericAttributes=function(e,t){var n=this;v(t,(function(t){if(t.name!==$i)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},hr.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;v(e,(function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new ur).build(e,r[0]));else if(ui(e.type))v(r,(function(i){n.push(new dr(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(o)v(r,(function(i){n.push(new pr(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=qi(e),a=function(e){return"property"===Li(e)}(e);v(r,(function(i){var r;r=s?new mr(t,e):a?new hr(t,e):new hr(t),n.push(r.build(i))}))}}))},hr.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ir(t):n=t),n},hr.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)&&!n||i.add(e,t),i.mapPrefix(o,r),e},hr.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,s=this.getNamespaces(t),a=e.prefix,l=e.uri;if(!a&&!l)return{localName:e.localName};if(r=Ii[a]||o&&(o.getPackage(a)||{}).uri,!(l=l||r||s.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=s.byUri(l))){for(n=a,i=1;s.uriByPrefix(n);)n=a+"_"+i++;e=this.logNamespace({prefix:n,uri:l},r===l)}return a&&s.mapPrefix(a,l),e},hr.prototype.parseAttributes=function(e){var t=this,n=this.element;v(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];v(i,(function(e){r.push(e.id)})),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},hr.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),sr(e)},hr.prototype.addAttribute=function(e,t){var n=this.attrs;h(t)&&(t=cr(t,tr,ar));var i=g(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),r={name:e,value:t};-1!==i?n.splice(i,1,r):n.push(r)},hr.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(sr(t.name)).append('="').append(t.value).append('"')}))},hr.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ur;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()},or(mr,hr),mr.prototype.parseNsAttributes=function(e){var t=hr.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName($i),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},mr.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},vr.prototype=Object.create(bi.prototype),vr.prototype.fromXML=function(e,t,n){h(t)||(n=t,t="bpmn:Definitions");var i=new er(I({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},vr.prototype.toXML=function(e,t){var n=new yr(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var br={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 wr(e,t){return new vr(I({},br,e),t)}function xr(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var _r="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 Er(e){m(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(_r)}})}function Or(e,t){return e.$instanceOf(t)}function Pr(e,t){var n={},i=[],r={};function o(e,t){return function(n){e(n,t)}}function s(e){n[e.id]=e}function a(n,i){try{var o=r[n.id]&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:xr(n)}));return e.element(n,r[n.id],i)}(n,i);return s(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:xr(n)})),console.error(e)}}function l(t,n){e.error(t,n)}var c=this.registerDi=function(e){var n=e.bpmnElement;n?r[n.id]?l(t("multiple DI elements defined for {element}",{element:xr(n)}),{element:n}):(r[n.id]=e,Er(n)):l(t("no bpmnElement referenced in {element}",{element:xr(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"));r={},p(a);var g=a.plane;if(!g)throw new Error(t("no plane for {element}",{element:xr(a)}));var b=g.bpmnElement;if(!b){if(b=function(e){return f(e.rootElements,(function(e){return Or(e,"bpmn:Process")||Or(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:xr(g),rootElement:xr(b)})),g.bpmnElement=b,c(g)}var w,x,E=function(t,n){return e.root(t,r[t.id],n)}(b,g);if(Or(b,"bpmn:Process")||Or(b,"bpmn:SubProcess"))h(b,E);else{if(!Or(b,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:xr(g),rootElement:xr(b)}));x=E,v((w=b).participants,o(T,x)),_(w.artifacts,x),i.push((function(){!function(e,t){v(e,o(m,t))}(w.messageFlows,x)})),function(e,t){var i=y(e,(function(e){return!n[e.id]&&Or(e,"bpmn:Process")&&e.laneSets}));i.forEach(o(h,t))}(s.rootElements,E)}d(i)};var d=this.handleDeferred=function(){for(;i.length;)i.shift()()};function h(e,t){A(e,t),E(e.ioSpecification,t),_(e.artifacts,t),s(e)}function m(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){Or(e,"bpmn:Association")?i.push((function(){x(e,t)})):x(e,t)}))}function E(e,t){e&&(v(e.dataInputs,o(b,t)),v(e.dataOutputs,o(w,t)))}var O=this.handleSubProcess=function(e,t){A(e,t),_(e.artifacts,t)};function P(e,t){var n=a(e,t);Or(e,"bpmn:SubProcess")&&O(e,n||t),Or(e,"bpmn:Activity")&&E(e.ioSpecification,t),i.push((function(){v(e.dataInputAssociations,o(g,t)),v(e.dataOutputAssociations,o(g,t))}))}function k(e,t){a(e,t)}function S(e,t){i.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 A(e,n){!function(e,n){v(e,(function(e){Or(e,"bpmn:SequenceFlow")?i.push((function(){!function(e,t){a(e,t)}(e,n)})):Or(e,"bpmn:BoundaryEvent")?i.unshift((function(){P(e,n)})):Or(e,"bpmn:FlowNode")?P(e,n):Or(e,"bpmn:DataObject")||(Or(e,"bpmn:DataStoreReference")||Or(e,"bpmn:DataObjectReference")?k(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:xr(e),context:n?xr(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){v(e,o(C,t))}(e.laneSets,n)}function T(e,t){var n=a(e,t),i=e.processRef;i&&h(i,n||t)}}function kr(e,t){var n=Cr(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Sr(e,t){return _(t,(function(t){return kr(e,t)}))}function Cr(e){return e&&e.businessObject||e}function Ar(e){return e&&e.di}function Tr(e,t,n){var i,r,o,s,a=[];function l(e,t){var n=new Pr({root:function(e,t){return i.add(e,t)},element:function(e,t,n){return i.add(e,t,n)},error:function(e,t){a.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var r=function(e,t){if(!t)return;var n,i=t.plane.bpmnElement,r=i;kr(i,"bpmn:Process")||kr(i,"bpmn:Collaboration")||(r=function(e){var t=e;for(;t;){if(kr(t,"bpmn:Process"))return t;t=t.$parent}}(i));n=kr(r,"bpmn:Collaboration")?r:f(e.rootElements,(function(e){if(kr(e,"bpmn:Collaboration"))return f(e.participants,(function(e){return e.processRef===r}))}));var o=[r];n&&(o=E(n.participants,(function(e){return e.processRef}))).push(n);var s=Mr(o),a=[t],l=[i];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(!r)throw new Error(o("no diagram to display"));v(r,(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 i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),s=e.get("canvas"),r.fire("import.render.start",{definitions:t}),l(t,n),r.fire("import.render.complete",{error:undefined,warnings:a}),c({warnings:a})}catch(e){return e.warnings=a,p(e)}}))}function Mr(e){var t=[];return v(e,(function(e){e&&(t.push(e),t=t.concat(Mr(e.flowElements)))})),t}var Rr,Dr='<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>',Nr={verticalAlign:"middle"},Br={color:"#404040"},jr={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Ir={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},$r={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"},Lr='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Dr+'</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 qr(){Rr||(G(Rr=ge(Lr),jr),G(ye("svg",Rr),Nr),G(ye(".backdrop",Rr),Ir),G(ye(".notice",Rr),$r),G(ye(".link",Rr),Br,{margin:"15px 20px 15px 10px",alignSelf:"center"}),de.bind(Rr,".backdrop","click",(function(e){document.body.removeChild(Rr)}))),document.body.appendChild(Rr)}function zr(e){e=I({},Fr,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),function(e){const t=ge('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Dr+"</a>");G(ye("svg",t),Nr),G(t,Br,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(t),ce.bind(t,"click",(function(e){qr(),e.preventDefault()}))}(this._container),this._init(this._container,this._moddle,e)}function Vr(e,t){return e.warnings=t,e}e(zr,ri),zr.prototype.importXML=async function(e,t){const n=this;let i=[];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;i=i.concat(l),s=this._emit("import.parse.complete",(r={error:null,definitions:s,elementsById:c,references:a,warnings:i},n.get("eventBus").createEvent(r)))||s;const p=await this.importDefinitions(s,t);return i=i.concat(p.warnings),this._emit("import.done",{error:null,warnings:i}),{warnings:i}}catch(e){let t=e;throw i=i.concat(t.warnings||[]),Vr(t,i),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 r},zr.prototype.importDefinitions=async function(e,t){this._setDefinitions(e);return{warnings:(await this.open(t)).warnings}},zr.prototype.open=async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw Vr(e,[]),e}if("string"==typeof e&&(n=function(e,t){if(!t)return null;return f(e.diagrams,(function(e){return e.id===t}))||null}(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw Vr(t,[]),t}try{this.clear()}catch(e){throw Vr(e,[]),e}const{warnings:i}=await Tr(this,t,n);return{warnings:i}},zr.prototype.saveXML=async function(e){e=e||{};let t,n,i=this._definitions;try{if(!i)throw new Error("no definitions loaded");i=this._emit("saveXML.start",{definitions:i})||i;n=(await this._moddle.toXML(i,e)).xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(e){t=e}const r=t?{error:t}:{xml:n};if(this._emit("saveXML.done",r),t)throw t;return r},zr.prototype.saveSVG=async function(){let e,t;this._emit("saveSVG.start");try{const t=this.get("canvas"),n=t.getActiveLayer(),i=ye("defs",t._svg),r=We(n),o=i?"<defs>"+We(i)+"</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+r+"</svg>"}catch(e){t=e}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}},zr.prototype._setDefinitions=function(e){this._definitions=e},zr.prototype.getModules=function(){return this._modules},zr.prototype.clear=function(){this.getDefinitions()&&ri.prototype.clear.call(this)},zr.prototype.destroy=function(){ri.prototype.destroy.call(this),be(this._container)},zr.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},zr.prototype.off=function(e,t){this.get("eventBus").off(e,t)},zr.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=ye(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},zr.prototype.getDefinitions=function(){return this._definitions},zr.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},zr.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),s=I(q(n,["additionalModules"]),{canvas:I({},n.canvas,{container:e}),modules:o});ri.call(this,s),n&&n.container&&this.attachTo(n.container)},zr.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},zr.prototype._createContainer=function(e){const t=ge('<div class="bjs-container"></div>');return G(t,{width:Hr(e.width),height:Hr(e.height),position:e.position}),t},zr.prototype._createModdle=function(e){return new wr(I({},this._moddleExtensions,e.moddleExtensions))},zr.prototype._modules=[];const Fr={width:"100%",height:"100%",position:"relative"};function Hr(e){return e+(u(e)?"px":"")}function Ur(e){zr.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 Wr(e,t){return!kr(e,"bpmn:CallActivity")&&(kr(e,"bpmn:SubProcess")?!(!(t=t||Ar(e))||!kr(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!kr(e,"bpmn:Participant")||!!Cr(e).processRef)}function Qr(e){if(kr(e,"bpmn:Participant")||kr(e,"bpmn:Lane")){var t=Ar(e).isHorizontal;return void 0===t||t}}function Gr(e){return e&&!1!==Cr(e).isInterrupting}function Xr(e){return e&&!!Cr(e).triggeredByEvent}function Kr(e,t){return _(Cr(e).eventDefinitions,(function(e){return kr(e,t)}))}e(Ur,zr),Ur.prototype._createModdle=function(e){var t=zr.prototype._createModdle.call(this,e);return t.ids=new n([32,36,1]),t},Ur.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t)i.claim(n,t[n])};var Yr={width:90,height:20},Zr=15;function Jr(e){return kr(e,"bpmn:Event")||kr(e,"bpmn:Gateway")||kr(e,"bpmn:DataStoreReference")||kr(e,"bpmn:DataObjectReference")||kr(e,"bpmn:DataInput")||kr(e,"bpmn:DataOutput")||kr(e,"bpmn:SequenceFlow")||kr(e,"bpmn:MessageFlow")||kr(e,"bpmn:Group")}function eo(e){return fn(e.label)}function to(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=function(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),s=r.x,a=r.y;return Math.abs(o)<Math.PI/2?a-=Zr:s+=Zr,{x:s,y:a}}function no(e){return e.waypoints?to(e.waypoints):kr(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Yr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Yr.height/2}}function io(e){return kr(e,"bpmn:FlowElement")||kr(e,"bpmn:Participant")||kr(e,"bpmn:Lane")||kr(e,"bpmn:SequenceFlow")||kr(e,"bpmn:MessageFlow")||kr(e,"bpmn:DataInput")||kr(e,"bpmn:DataOutput")?"name":kr(e,"bpmn:TextAnnotation")?"text":kr(e,"bpmn:Group")?"categoryValueRef":void 0}function ro(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 oo(e,t){var n=e.businessObject,i=io(n);return i&&("categoryValueRef"===i?n.categoryValueRef.value=t:n[i]=t),e}var so="hsl(225, 10%, 15%)",ao="white";function lo(e,t){return _(e.eventDefinitions,(function(e){return e.$type===t}))}function co(e,t,n){var i=Ar(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||ao}function po(e,t,n){var i=Ar(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||so}function uo(e,t,n,i){var r=Ar(e).get("label");return i||r&&r.get("color:color")||t||po(e,n)}function ho(e,t={}){return{width:mo(e,t),height:fo(e,t)}}function mo(e,t={}){return m(t,"width")?t.width:e.width}function fo(e,t={}){return m(t,"height")?t.height:e.height}var go=new n,yo=.95;function vo(e,t,n,i,r,o,s){st.call(this,t,s);var a=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,u=go.next(),d={};function h(e){return n.computeStyle(e,{strokeLinecap:"round",strokeLinejoin:"round",stroke:so,strokeWidth:2,fill:"white"})}function m(e){return n.computeStyle(e,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:so,strokeWidth:2})}function f(e,t){var{ref:n={x:0,y:0},scale:i=1,element:o}=t,s=Be("marker",{id:e,viewBox:"0 0 20 20",refX:n.x,refY:n.y,markerWidth:20*i,markerHeight:20*i,orient:"auto"});xe(s,o);var a=ye("defs",r._svg);a||(a=Be("defs"),xe(r._svg,a)),xe(a,s),d[e]=s}function g(e){return e.replace(/[^0-9a-zA-Z]+/g,"_")}function y(e,t,n){var i=e+"-"+g(t)+"-"+g(n)+"-"+u;return d[i]||function(e,t,n,i){if("sequenceflow-end"===t){f(e,{element:Be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:i,stroke:i,strokeWidth:1})}),ref:{x:11,y:10},scale:.5})}if("messageflow-start"===t){f(e,{element:Be("circle",{cx:6,cy:6,r:3.5,...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6}})}if("messageflow-end"===t){f(e,{element:Be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5}})}if("association-start"===t){f(e,{element:Be("path",{d:"M 11 5 L 1 10 L 11 15",...m({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5})}if("association-end"===t){f(e,{element:Be("path",{d:"M 1 5 L 11 10 L 1 15",...m({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5})}if("conditional-flow-marker"===t){f(e,{element:Be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:n,stroke:i})}),ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){f(e,{element:Be("path",{d:"M 6 4 L 10 16",...h({stroke:i})}),ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function b(e,t,n,i,r={}){p(i)&&(r=i,i=0),i=i||0,r=h(r);var o=Be("circle",{cx:t/2,cy:n/2,r:Math.round((t+n)/4-i),...r});return xe(e,o),o}function w(e,t,n,i,r,o){p(r)&&(o=r,r=0),r=r||0,o=h(o);var s=Be("rect",{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i,...o});return xe(e,s),s}function x(e,t,n,i){var r=dt(t,n=m(n),i);return xe(e,r),r}function _(e,t,n){return x(e,t,n,5)}function E(e,t,n){n=m(n);var i=Be("path",{...n,d:t});return xe(e,i),i}function O(e,t,n,i){return E(t,n,I({"data-marker":e},i))}function P(e){return te[e]}function k(e){return function(t,n,i){return P(e)(t,n,i)}}var S=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:r?co(t,a,n.fill):po(t,l,n.stroke),strokeWidth:1})},C=function(e,t,n={}){var r=b(e,t.width,t.height,.2*t.height,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:2});E(e,i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{stroke:po(t,l,n.stroke),strokeWidth:2});for(var o=0;o<12;o++){var s=i.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;E(e,s,{strokeWidth:1,stroke:po(t,l,n.stroke),transform:"rotate("+30*o+","+p+","+c+")"})}return r},A=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},T=function(e,t,n={}){return E(e,i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},M=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},R=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},D=function(e,t,n={},r){var o=E(e,i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{fill:r?po(t,l,n.stroke):"none",stroke:po(t,l,n.stroke),strokeWidth:1});return Jn(o,45),o},N=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},B=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke)})},j=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),strokeWidth:1})},$=function(e,t,n={}){return E(e,i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},L=function(e,t,n={}){return b(e,t.width,t.height,8,{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:4})};function q(e,t,n={}){var i=Cr(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(i);return i.get("eventDefinitions")&&i.get("eventDefinitions").length>1?i.get("parallelMultiple")?$(t,e,n,r):j(t,e,n,r):lo(i,"bpmn:MessageEventDefinition")?S(t,e,n,r):lo(i,"bpmn:TimerEventDefinition")?C(t,e,n,r):lo(i,"bpmn:ConditionalEventDefinition")?T(t,e,n,r):lo(i,"bpmn:SignalEventDefinition")?B(t,e,n,r):lo(i,"bpmn:EscalationEventDefinition")?A(t,e,n,r):lo(i,"bpmn:LinkEventDefinition")?M(t,e,n,r):lo(i,"bpmn:ErrorEventDefinition")?R(t,e,n,r):lo(i,"bpmn:CancelEventDefinition")?D(t,e,n,r):lo(i,"bpmn:CompensateEventDefinition")?N(t,e,n,r):lo(i,"bpmn:TerminateEventDefinition")?L(t,e,n,r):null}var z={ParticipantMultiplicityMarker:function(e,t,n={}){var r=mo(t,n),o=fo(t,n);O("participant-multiplicity",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2-6)/r,my:(o-15)/o}}),{strokeWidth:2,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},SubProcessMarker:function(e,t,n={}){Zn(w(e,14,14,0,{strokeWidth:1,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)}),t.width/2-7.5,t.height-20),O("sub-process",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},ParallelMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("parallel",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.parallel)/r,my:(o-20)/o}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},SequentialMarker:function(e,t,n){O("sequential",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},CompensationMarker:function(e,t,n){O("compensation",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},LoopMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("loop",e,i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.loop)/r,my:(o-7)/o}}),{strokeWidth:1.5,fill:"none",stroke:po(t,l,n.stroke),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("adhoc",e,i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.adhoc)/r,my:(o-15)/o}}),{strokeWidth:1,fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke)})}};function V(e,t,n,i){z[e](t,n,i)}function F(e,t,n,i={}){i={fill:i.fill,stroke:i.stroke,width:mo(t,i),height:fo(t,i)};var r=Cr(t),o=n&&n.includes("SubProcessMarker");i=o?{...i,seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{...i,seq:-5,parallel:-6,compensation:-27,loop:0,adhoc:10},v(n,(function(n){V(n,e,t,i)})),r.get("isForCompensation")&&V("CompensationMarker",e,t,i),kr(r,"bpmn:AdHocSubProcess")&&V("AdhocMarker",e,t,i);var s=r.get("loopCharacteristics"),a=s&&s.get("isSequential");s&&(void 0===a&&V("LoopMarker",e,t,i),!1===a&&V("ParallelMarker",e,t,i),!0===a&&V("SequentialMarker",e,t,i))}function H(e,t,n={}){n=I({size:{width:100}},n);var i=o.createText(t||"",n);return Se(i).add("djs-label"),xe(e,i),i}function U(e,t,n,i={}){var r=Cr(t),o=ho({x:t.x,y:t.y,width:t.width,height:t.height},i);return H(e,r.name,{align:n,box:o,padding:7,style:{fill:uo(t,c,l,i.stroke)}})}function W(e,t,n,i={}){var r=Qr(n),o=H(e,t,{box:{height:30,width:r?fo(n,i):mo(n,i)},align:"center-middle",style:{fill:uo(n,c,l,i.stroke)}});r&&Yn(o,0,-(-1*fo(n,i)),270)}function Q(e,t,n={}){var{width:i,height:r}=ho(t,n);return w(e,i,r,10,{...n,fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke)})}function G(e,t,n={}){var i=Cr(t),r=co(t,a,n.fill),o=po(t,l,n.stroke);return"One"!==i.get("associationDirection")&&"Both"!==i.get("associationDirection")||(n.markerEnd=y("association-end",r,o)),"Both"===i.get("associationDirection")&&(n.markerStart=y("association-start",r,o)),n=bo(n,["markerStart","markerEnd"]),_(e,t.waypoints,{...n,stroke:o,strokeDasharray:"0, 5"})}function X(e,t,n={}){var r=co(t,a,n.fill),o=po(t,l,n.stroke),s=E(e,i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:r,fillOpacity:yo,stroke:o});(function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection})(Cr(t))&&E(e,i.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:r,stroke:o});return s}function K(e,t,n={}){return b(e,t.width,t.height,{fillOpacity:yo,...n,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})}function Y(e,t,n={}){return function(e,t,n,i){var r=t/2,o=n/2,s=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");i=h(i);var a=Be("polygon",{...i,points:s});return xe(e,a),a}(e,t.width,t.height,{fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke)})}function Z(e,t,n={}){var i=w(e,mo(t,n),fo(t,n),0,{fill:co(t,a,n.fill),fillOpacity:n.fillOpacity||yo,stroke:po(t,l,n.stroke),strokeWidth:1.5}),r=Cr(t);kr(r,"bpmn:Lane")&&W(e,r.get("name"),t,n);return i}function J(e,t,n={}){var i=Q(e,t,n);Xr(t)&&Pe(i,{strokeDasharray:"0, 5.5",strokeWidth:2.5});var r=Wr(t);return U(e,t,r?"center-top":"center-middle",n),F(e,t,r?void 0:["SubProcessMarker"],n),i}function ee(e,t,n={}){var i=Q(e,t,n);return U(e,t,"center-middle",n),F(e,t,void 0,n),i}var te=this.handlers={"bpmn:AdHocSubProcess":function(e,t,n={}){return J(e,t,n=Wr(t)?bo(n,["fill","stroke","width","height"]):bo(n,["fill","stroke"]))},"bpmn:Association":function(e,t,n={}){return G(e,t,n=bo(n,["fill","stroke"]))},"bpmn:BoundaryEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=Cr(t).get("cancelActivity");n={strokeWidth:1.5,fill:co(t,a,n.fill),fillOpacity:1,stroke:po(t,l,n.stroke)},r||(n.strokeDasharray="6");var o=K(e,t,n);return b(e,t.width,t.height,3,{...n,fill:"none"}),i&&q(t,e,n),o},"bpmn:BusinessRuleTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return Pe(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),Pe(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:CallActivity":function(e,t,n={}){return n=bo(n,["fill","stroke"]),J(e,t,{strokeWidth:5,...n})},"bpmn:ComplexGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:DataInput":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1}),o},"bpmn:DataInputAssociation":function(e,t,n={}){return n=bo(n,["fill","stroke"]),G(e,t,{...n,markerEnd:y("association-end",co(t,a,n.fill),po(t,l,n.stroke))})},"bpmn:DataObject":function(e,t,n={}){return X(e,t,n=bo(n,["fill","stroke"]))},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{strokeWidth:1,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)}),o},"bpmn:DataOutputAssociation":function(e,t,n={}){return n=bo(n,["fill","stroke"]),G(e,t,{...n,markerEnd:y("association-end",co(t,a,n.fill),po(t,l,n.stroke))})},"bpmn:DataStoreReference":function(e,t,n={}){return n=bo(n,["fill","stroke"]),E(e,i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke),strokeWidth:2})},"bpmn:EndEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:4});return i&&q(t,e,n),r},"bpmn:EventBasedGateway":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=Cr(t),o=Y(e,t,n);b(e,t.width,t.height,.2*t.height,{fill:co(t,"none",n.fill),stroke:po(t,l,n.stroke),strokeWidth:1});var s=r.get("eventGatewayType"),a=!!r.get("instantiate");if("Parallel"===s){var c=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});E(e,c,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1})}else"Exclusive"===s&&(a||b(e,t.width,t.height,.26*t.height,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1}),function(){var r=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});E(e,r,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:2})}());return o},"bpmn:ExclusiveGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"])),o=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Ar(t).get("isMarkerVisible")&&E(e,o,{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Gateway":function(e,t,n={}){return Y(e,t,n=bo(n,["fill","stroke"]))},"bpmn:Group":function(e,t,n={}){return n=bo(n,["fill","stroke","width","height"]),w(e,t.width,t.height,10,{stroke:po(t,l,n.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:mo(t,n),height:fo(t,n)})},"bpmn:InclusiveGateway":function(e,t,n={}){var i=Y(e,t,n=bo(n,["fill","stroke"]));return b(e,t.width,t.height,.24*t.height,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:2.5}),i},"bpmn:IntermediateEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:1.5});return b(e,t.width,t.height,3,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1.5}),i&&q(t,e,n),r},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(e,t,n={}){return n=bo(n,["fill","stroke","width","height"]),Z(e,t,{...n,fillOpacity:.25})},"bpmn:ManualTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),r},"bpmn:MessageFlow":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=Cr(t),o=Ar(t),s=co(t,a,n.fill),c=po(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(r.get("messageRef")){var u=p.getPointAtLength(p.getTotalLength()/2),d=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),h={strokeWidth:1};"initiating"===o.get("messageVisibleKind")?(h.fill=s,h.stroke=c):(h.fill=c,h.stroke=s);var m=E(e,d,h),f=H(e,r.get("messageRef").get("name"),{align:"center-top",fitBox:!0,style:{fill:c}}),g=m.getBBox(),v=f.getBBox();Yn(f,u.x-v.width/2,u.y+g.height/2+10,0)}return p},"bpmn:ParallelGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Participant":function(e,t,n={}){var i=Z(e,t,n=bo(n,["fill","stroke","width","height"])),r=Wr(t),o=Qr(t),s=Cr(t),a=s.get("name");if(r){x(e,o?[{x:30,y:0},{x:30,y:fo(t,n)}]:[{x:0,y:30},{x:mo(t,n),y:30}],{stroke:po(t,l,n.stroke),strokeWidth:1.5}),W(e,a,t,n)}else{var p=ho(t,n);o||(p.height=mo(t,n),p.width=fo(t,n));var u=H(e,a,{box:p,align:"center-middle",style:{fill:uo(t,c,l,n.stroke)}});if(!o)Yn(u,0,-(-1*fo(t,n)),270)}return s.get("participantMultiplicity")&&V("ParticipantMultiplicityMarker",e,t,n),i},"bpmn:ReceiveTask":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r,o=Cr(t),s=ee(e,t,n);return o.get("instantiate")?(b(e,28,28,4.4,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):r=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),E(e,r,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),s},"bpmn:ScriptTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:SendTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{fill:po(t,l,n.stroke),stroke:co(t,a,n.fill),strokeWidth:1}),r},"bpmn:SequenceFlow":function(e,t,n={}){n=bo(n,["fill","stroke"]);var i=co(t,a,n.fill),r=po(t,l,n.stroke),o=_(e,t.waypoints,{markerEnd:y("sequenceflow-end",i,r),stroke:r}),s=Cr(t),{source:c}=t;if(c){var p=Cr(c);s.get("conditionExpression")&&kr(p,"bpmn:Activity")&&Pe(o,{markerStart:y("conditional-flow-marker",i,r)}),p.get("default")&&(kr(p,"bpmn:Gateway")||kr(p,"bpmn:Activity"))&&p.get("default")===s&&Pe(o,{markerStart:y("conditional-default-flow-marker",i,r)})}return o},"bpmn:ServiceTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return b(e,10,10,{fill:co(t,a,n.fill),stroke:"none",transform:"translate(6, 6)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),b(e,10,10,{fill:co(t,a,n.fill),stroke:"none",transform:"translate(11, 10)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:StartEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]),Cr(t).get("isInterrupting")||(n={...n,strokeDasharray:"6"});var r=K(e,t,n);return i&&q(t,e,n),r},"bpmn:SubProcess":function(e,t,n={}){return J(e,t,n=Wr(t)?bo(n,["fill","stroke","width","height"]):bo(n,["fill","stroke"]))},"bpmn:Task":function(e,t,n={}){return ee(e,t,n=bo(n,["fill","stroke"]))},"bpmn:TextAnnotation":function(e,t,n={}){n=bo(n,["fill","stroke","width","height"]);var{width:r,height:o}=ho(t,n),s=w(e,r,o,0,0,{fill:"none",stroke:"none"});return E(e,i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:0,my:0}}),{stroke:po(t,l,n.stroke)}),H(e,Cr(t).get("text")||"",{align:"left-top",box:ho(t,n),padding:7,style:{fill:uo(t,c,l,n.stroke)}}),s},"bpmn:Transaction":function(e,t,i={}){i=Wr(t)?bo(i,["fill","stroke","width","height"]):bo(i,["fill","stroke"]);var r=J(e,t,{strokeWidth:1.5,...i}),o=n.style(["no-fill","no-events"],{stroke:po(t,l,i.stroke),strokeWidth:1.5});return Wr(t)||(i={}),w(e,mo(t,i),fo(t,i),7,3,o),r},"bpmn:UserTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:.5}),r},label:function(e,t,n={}){return function(e,t,n={}){var i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return H(e,ro(t),{box:i,fitBox:!0,style:I({},o.getExternalStyle(),{fill:uo(t,c,l,n.stroke)})})}(e,t,n)}};this._drawPath=E,this._renderer=P}function bo(e,t=[]){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}e(vo,st),vo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],vo.prototype.canRender=function(e){return kr(e,"bpmn:BaseElement")},vo.prototype.drawShape=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},vo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},vo.prototype.getShapePath=function(e){return kr(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,at([["M",n,i],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]])):kr(e,"bpmn:Activity")?function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return at([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):kr(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return at([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,i=e.width;return at([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])}(e);var t,n,i,r};var wo=0,xo={width:150,height:50};function _o(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function Eo(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=_o(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Oo(e,o,r,i);o=ko(o,i.width,t)}}function Oo(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var Po="";function ko(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-|\u00AD)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"!==n&&n!==Po||r.pop();break}r.push(n),o+=n.length}var s=r[r.length-1];return s&&s===Po&&(r[r.length-1]="-"),r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function So(e){this._config=I({},{size:xo,padding:wo,style:{},align:"center-top"},e||{})}So.prototype.createText=function(e,t){return this.layoutText(e,t).element},So.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},So.prototype.layoutText=function(e,t){var n=I({},this._config.size,t.box),i=I({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return p(e)?I({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)}(i),l=e.split(/\u00AD?\r?\n/),c=[],u=n.width-o.left-o.right,d=Be("text");for(Pe(d,{x:0,y:0}),Pe(d,i),xe(function(){var e=document.getElementById("helper-svg");return e||(Pe(e=Be("svg"),{id:"helper-svg"}),G(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),d);l.length;)c.push(Eo(l,u,d));"middle"===r.vertical&&(o.top=o.bottom=0);var h=w(c,(function(e,t,n){return e+(a||t.height)}),0)+o.top+o.bottom,m=w(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===r.vertical&&(f+=(n.height-h)/2),f-=(a||c[0].height)/4;var g=Be("text");return Pe(g,i),v(c,(function(e){var t;switch(f+=a||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(s?m:u)-o.right-e.width;break;default:t=Math.max(((s?m:u)-e.width)/2+o.left,0)}var n=Be("tspan");Pe(n,{x:t,y:f}),n.textContent=e.text,xe(g,n)})),Ae(d),{dimensions:{width:m,height:h},element:g}};function Co(e){var t=I({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=I({},t,{fontSize:n},e&&e.externalStyle||{}),r=new So({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30},style:i});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 i=r.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(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Co.$inject=["config.textRenderer"];var Ao=/\{([^{}]+)\}/g,To=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Mo={__init__:["bpmnRenderer"],bpmnRenderer:["type",vo],textRenderer:["type",Co],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,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o={};if(t.position){for(var s=t.containerHeight/r.height*t.yScaleFactor,a=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)o["y"+l]=r.heightElements[l]*s;for(var c=0;c<r.widthElements.length;c++)o["x"+c]=r.widthElements[c]*a}var p,u,d=(p=r.d,u={mx:n,my:i,e:o},String(p).replace(Ao,(function(e,t){return function(e,t,n){var i=n;return t.replace(To,(function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))})),i=(null==i||i==n?e:i)+""}(e,t,u)})));return d}}]};var Ro={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function Do(e,t,n){return I({id:e.id,type:e.$type,businessObject:e,di:t},n)}function No(e,t,n){var i=e.waypoint;return!i||i.length<2?[xn(t),xn(n)]:i.map((function(e){return{x:e.x,y:e.y}}))}function Bo(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:xr(n),referenced:xr(t),property:i}))}function jo(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}jo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],jo.prototype.add=function(e,t,n){var i,r,o,s=this._translate;if(kr(t,"bpmndi:BPMNPlane")){var a=kr(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Do(e,t,a)),this._canvas.addRootElement(i)}else if(kr(t,"bpmndi:BPMNShape")){var l=!Wr(e,t),c=function(e){return kr(e,"bpmn:Group")}(e);r=n&&(n.hidden||n.collapsed);var p=t.bounds;i=this._elementFactory.createShape(Do(e,t,{collapsed:l,hidden:r,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),kr(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),kr(e,"bpmn:Lane")&&(o=0),kr(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}(n,xn(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else{if(!kr(t,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:xr(t),semantic:xr(e)}));var u=this._getSource(e),d=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Do(e,t,{hidden:r,source:u,target:d,waypoints:No(t,u,d)})),kr(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}return Jr(e)&&ro(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},jo.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:xr(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Bo(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},jo.prototype.addLabel=function(e,t,n){var i,r,o;return i=function(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Yr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=no(t),i=Yr),I({x:n.x-i.width/2,y:n.y-i.height/2},i)}(t,n),(r=ro(n))&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Do(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ro(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},jo.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Bo(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:xr(e),side:t}))},jo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},jo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},jo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Io={__depends__:[Mo,{__depends__:[Ro],bpmnImporter:["type",jo]}]};function $o(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Lo(e){return e.originalEvent||e.srcEvent}function qo(e){$o(e),$o(Lo(e))}function zo(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 Fo(e,t){return(Lo(e)||e).button===t}function Ho(e){return Fo(e,0)}function Uo(e){var t=Lo(e)||e;return!!Ho(e)&&(Vo()?t.metaKey:t.ctrlKey)}function Wo(e){var t=Lo(e)||e;return Ho(e)&&t.shiftKey}function Qo(e){return!0}function Go(e){return Ho(e)||function(e){return Fo(e,1)}(e)}function Xo(e,t,n){var i=this;function r(n,i,r){var o,s;(function(e,t){var n=l[e]||Ho;return!n(t)})(n,i)||(r?s=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(s=o,r=t.get(s)),s&&r&&!1===e.fire(n,{element:r,gfx:s,originalEvent:i})&&(i.stopPropagation(),i.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":Go,"element.mouseup":Go,"element.click":Go,"element.dblclick":Go};var c="svg, .djs-element";function p(e,t,n,i){var s=o[n]=function(e){r(n,e)};i&&(l[n]=i),s.$delegate=de.bind(e,c,t,s)}function u(e,t,n){var i=s(n);i&&de.unbind(e,t,i.$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,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var d=f("djs-hit djs-hit-stroke"),h=f("djs-hit djs-hit-click-stroke"),m={all:f("djs-hit djs-hit-all"),"click-stroke":h,stroke:d,"no-move":f("djs-hit djs-hit-no-move")};function f(e,t){return t=I({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=m[t];if(!n)throw new Error("invalid hit type <"+t+">");return Pe(e,n),e}function y(e,t){xe(e,t)}this.removeHits=function(e){v(ve(".djs-hit",e),Ae)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"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=I({x:0,y:0},n);var i=Be("rect");return g(i,t),Pe(i,n),y(e,i),i},this.updateDefaultHit=function(e,t){var n=ye(".djs-hit",t);if(n)return e.waypoints?ht(n,e.waypoints):Pe(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=a[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=s,this.registerEvent=p,this.unregisterEvent=u}Xo.$inject=["eventBus","elementRegistry","styles"];var Ko={__init__:["interactionEvents"],interactionEvents:["type",Xo]};function Yo(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=Be("rect");return Pe(t,I({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=ye(".djs-outline",n);o||xe(n,o=i.getOutline(t)||r()),i.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ye(".djs-outline",n);o||xe(n,o=r()),i.updateConnectionOutline(o,t)}))}Yo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&v(i,(function(i){n=n||i.updateOutline(t,e)})),n||Pe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Yo.prototype.updateConnectionOutline=function(e,t){var n=bt(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})},Yo.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},Yo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Yo.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},Yo.$inject=["eventBus","styles","elementRegistry"];var Zo={__init__:["outline"],outline:["type",Yo]};function Jo(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)}))}Jo.$inject=["eventBus","canvas"],Jo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},Jo.prototype.get=function(){return this._selectedElements},Jo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Jo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();c(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter((function(e){var t=r.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:i,newSelection:n})};var es="hover",ts="selected";function ns(e,t,n){this._canvas=e;var i=this;function r(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,es)})),t.on("element.out",(function(e){o(e.element,es)})),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,ts)}(e)})),v(n,(function(e){-1===t.indexOf(e)&&function(e){r(e,ts)}(e)})),i._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateSelectionOutline(n.get())}))}function is(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,r=n.elements,o=(n.hints||{}).autoSelect;if(i){if(!1===o)return;c(o)?t.select(o):t.select(r.filter(rs))}})),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||[],r=i.get(e.context.shape.id);f(n,(function(e){return r.id===e.id}))||t.select(r)})),e.on("element.click",(function(e){if(Ho(e)){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,s=Wo(e);if(r&&o)return s?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,s)}}))}function rs(e){return!e.hidden}ns.$inject=["canvas","eventBus","selection"],ns.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(bt(e)),r=Be("rect");Pe(r,I({rx:3},i)),Se(r).add("djs-selection-outline"),xe(t,r)}},is.$inject=["eventBus","selection","canvas","elementRegistry"];var os={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ko,Zo],selection:["type",Jo],selectionVisuals:["type",ns],selectionBehavior:["type",is]};function ss(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}ss.prototype.next=function(){return this._prefix+ ++this._counter};var as=new ss("ov");function ls(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=as,this._overlayDefaults=I({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),G(o=ge('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),r.insertBefore(o,r.firstChild),o),this._init()}function cs(e,t,n){G(e,{left:t+"px",top:n+"px"})}function ps(e,t){e.style.display=!1===t?"none":""}function us(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}ls.$inject=["config.overlays","eventBus","canvas","elementRegistry"],ls.prototype.get=function(e){if(h(e)&&(e={id:e}),h(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,T({type:e.type})):t.overlays.slice():[]}return e.type?y(this._overlays,T({type:e.type})):e.id?this._overlays[e.id]:null},ls.prototype.add=function(e,t,n){if(p(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=I({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ls.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&&(be(e.html),be(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}}))},ls.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},ls.prototype.show=function(){ps(this._overlayRoot)},ls.prototype.hide=function(){ps(this._overlayRoot,!1)},ls.prototype.clear=function(){this._overlays={},this._overlayContainers=[],J(this._overlayRoot)},ls.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=bt(t);i=o.x,r=o.y}cs(n,i,r),X(e.html,"data-container-id",t.id)},ls.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,s=i.left,a=i.top;void 0!==i.right&&(t=o.waypoints?bt(o).width:o.width,s=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?bt(o).height:o.height,a=-1*i.bottom+n);cs(r,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ls.prototype._createOverlayContainer=function(e){var t=ge('<div class="djs-overlays" />');G(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},ls.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";us(this._overlayRoot,n)},ls.prototype._getOverlayContainer=function(e,t){var n=f(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},ls.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),h(o)&&(o=ge(o)),n=this._getOverlayContainer(r),G(t=ge('<div class="djs-overlay" data-overlay-id="'+i+'">'),{position:"absolute"}),t.appendChild(o),e.type&&Y(t).add("djs-overlay-"+e.type),ps(t,this._canvas.findRoot(r)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ls.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,s=e.htmlContainer,l=!0;(i!==this._canvas.getRootElement()||n&&(a(r)&&r>t.scale||a(o)&&o<t.scale))&&(l=!1),ps(s,l),this._updateOverlayScale(e,t)},ls.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,s=e.htmlContainer,l="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),a(n)&&t.scale<n&&(r=(1/t.scale||1)*n),a(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),a(r)&&(l="scale("+r+","+r+")"),us(s,l)},ls.prototype._updateOverlaysVisibilty=function(e){var t=this;v(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},ls.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 i=t._getOverlayContainer(n);if(i){be(i.html);var r=t._overlayContainers.indexOf(i);-1!==r&&t._overlayContainers.splice(r,1)}})),e.on("element.changed",500,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(v(i.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(i))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&Y(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",ls]};function hs(e,t,n,i){e.on("element.changed",(function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(wt(r)+".changed",i)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),i.updateContainments(n)})),e.on("shape.changed",(function(e){i.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){i.update("connection",e.element,e.gfx)}))}hs.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ms={__init__:["changeSupport"],changeSupport:["type",hs]};function fs(e){this._eventBus=e}function gs(e){return function(t,n,i,r,o){(d(t)||u(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}}function ys(e,t){t.invoke(fs,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)}))}fs.$inject=["eventBus"],fs.prototype.on=function(e,t,n,i,r,o){if((d(t)||u(t))&&(o=r,r=i,i=n,n=t,t=null),d(n)&&(o=r,r=i,i=n,n=1e3),p(r)&&(o=r,r=!1),!d(i))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,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)}))},fs.prototype.canExecute=gs("canExecute"),fs.prototype.preExecute=gs("preExecute"),fs.prototype.preExecuted=gs("preExecuted"),fs.prototype.execute=gs("execute"),fs.prototype.executed=gs("executed"),fs.prototype.postExecute=gs("postExecute"),fs.prototype.postExecuted=gs("postExecuted"),fs.prototype.revert=gs("revert"),fs.prototype.reverted=gs("reverted"),e(ys,fs),ys.$inject=["canvas","injector"];var vs={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ys]};function bs(e){return CSS.escape(e)}var ws={"&":"&","<":"<",">":">",'"':""","'":"'"};function xs(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return ws[e]}))}var _s="_plane";function Es(e){return function(e){return e.replace(new RegExp(_s+"$"),"")}(e.id)}function Os(e){var t=e.id;return kr(e,"bpmn:SubProcess")?Ss(t):t}function Ps(e){return Ss(e)}function ks(e){return kr(Ar(e),"bpmndi:BPMNPlane")}function Ss(e){return e+_s}function Cs(e,t,n){var i=ge('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Y(r);r.appendChild(i);var s=[];function a(e){e&&(s=function(e){for(var t=Cr(e),n=[],i=t;i;i=i.$parent)(kr(i,"bpmn:SubProcess")||kr(i,"bpmn:Process"))&&n.push(i);return n.reverse()}(e));var r=s.map((function(e){var i=xs(e.name||e.id),r=ge('<li><span class="bjs-crumb"><a title="'+i+'">'+i+"</a></span></li>"),o=n.findRoot(Os(e))||n.findRoot(e.id);if(!o&&kr(e,"bpmn:Process")){var s=t.find((function(t){var n=Cr(t);return n&&n.get("processRef")&&n.get("processRef")===e}));o=n.findRoot(s.id)}return r.addEventListener("click",(function(){n.setRootElement(o)})),r}));i.innerHTML="";var a=r.length>1;o.toggle("bjs-breadcrumbs-shown",a),r.forEach((function(e){i.appendChild(e)}))}e.on("element.changed",(function(e){var t=Cr(e.element);f(s,(function(e){return e===t}))&&a()})),e.on("root.set",(function(e){a(e.element)}))}function As(e,t){var n=null,i=new Ts;e.on("root.set",(function(e){var r=e.element,o=t.viewbox(),s=i.get(r);if(i.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=r,!kr(r,"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(){i.clear(),n=null}))}function Ts(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][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)}}Cs.$inject=["eventBus","elementRegistry","canvas"],As.$inject=["eventBus","canvas"];var Ms=180,Rs=160;function Ds(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 Ns(e){return kr(e,"bpmndi:BPMNDiagram")?e:Ns(e.$parent)}Ds.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 i=t._createNewDiagrams(e.plane);Array.prototype.push.apply(n,i)})),n.forEach((function(e){t._movePlaneElementsToOrigin(e.plane)}))}},Ds.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach((function(t){var r=t.bpmnElement;if(r){var o=r.$parent;kr(r,"bpmn:SubProcess")&&!t.isExpanded&&n.push(r),function(e,t){var n=e.$parent;if(!kr(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Sr(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(r,e)&&i.push({diElement:t,parent:o})}}));var r=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t._createDiagram(e);t._processToDiagramMap[e.id]=n,r.push(n)}})),i.forEach((function(e){for(var i=e.diElement,r=e.parent;r&&-1===n.indexOf(r);)r=r.$parent;if(r){var o=t._processToDiagramMap[r.id];t._moveToDiPlane(i,o.plane)}})),r},Ds.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=vn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),bn(t)}(e),i=n.x-Ms,r=n.y-Rs;t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-i,e.y=e.y-r})):e.bounds&&(e.bounds.x=e.bounds.x-i,e.bounds.y=e.bounds.y-r)}))},Ds.prototype._moveToDiPlane=function(e,t){var n=Ns(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Ds.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},Ds.$inject=["eventBus","moddle"];var Bs=250;function js(e,t,n,i){fs.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i;var r=this;this.executed("shape.toggleCollapse",Bs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Bs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Bs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],Bs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return r._canDrillDown(e)})).map((function(e){r._addOverlay(e)}))}))}e(js,fs),js.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},js.prototype._canDrillDown=function(e){var t=this._canvas;return kr(e,"bpmn:SubProcess")&&t.findRoot(Os(e))},js.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Cr(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Y(i.html).toggle("bjs-drilldown-empty",!r)}},js.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this._removeOverlay(e);var i=ge('<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>');i.addEventListener("click",(function(){t.setRootElement(t.findRoot(Os(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:i}),this._updateOverlayVisibility(e)},js.prototype._removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},js.$inject=["canvas","eventBus","elementRegistry","overlays"];var Is={__depends__:[ds,ms,vs],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Cs],drilldownCentering:["type",As],drilldownOverlayBehavior:["type",js],subprocessCompatibility:["type",Ds]};function $s(e){zr.call(this,e)}e($s,zr),$s.prototype._modules=[Io,Ro,os,ds,Is],$s.prototype._moddleExtensions={};var Ls=["c","C"],qs=["v","V"],zs=["y","Y"],Vs=["z","Z"];function Fs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Hs(e,t){return-1!==(e=c(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Us(e){return e.shiftKey}function Ws(e){return Fs(e)&&!Us(e)&&Hs(Vs,e)}function Qs(e){return Fs(e)&&(Hs(zs,e)||Hs(Vs,e)&&Us(e))}var Gs="keyboard.keydown",Xs="input-handle-modified-keys";function Ks(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()}))}Ks.$inject=["config.keyboard","eventBus"],Ks.prototype._keydownHandler=function(e){this._keyHandler(e,Gs)},Ks.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Ks.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Gs,n)&&e.preventDefault()}},Ks.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||(t=e.target)&&(ee(t,"input, textarea")||"true"===t.contentEditable)&&this._isModifiedKeyIgnored(e);var t},Ks.prototype._isModifiedKeyIgnored=function(e){return!Fs(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Ks.prototype._getAllowedModifiers=function(e){var t=te(e,"["+Xs+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Xs).split(",")},Ks.prototype.bind=function(e){this.unbind(),this._node=e,ce.bind(e,"keydown",this._keydownHandler),ce.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ks.prototype.getBinding=function(){return this._node},Ks.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ce.unbind(e,"keydown",this._keydownHandler),ce.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ks.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ks.prototype.addListener=function(e,t,n){d(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Gs,e,t)},Ks.prototype.removeListener=function(e,t){this._eventBus.off(t||Gs,e)},Ks.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Ks.prototype.isCmd=Fs,Ks.prototype.isShift=Us,Ks.prototype.isKey=Hs;var Ys=500;function Zs(e,t){var n=this;e.on("editorActions.init",Ys,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}Zs.$inject=["eventBus","keyboard"],Zs.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(Ws(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 Fs(e)&&Hs(Ls,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return Fs(e)&&Hs(qs,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Hs(["+","Add","="],n)&&Fs(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Hs(["-","Subtract"],n)&&Fs(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Hs("0",n)&&Fs(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Hs(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var Js={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ks],keyboardBindings:["type",Zs]},ea={moveSpeed:50,moveSpeedAccelerated:200};function ta(e,t,n){var i=this;this._config=I({},ea,e||{}),t.addListener((function(e){var n=e.keyEvent,r=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,s=t.isShift(n)?r.moveSpeedAccelerated:r.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 i.moveCanvas({speed:s,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,i=0,r=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":i=r;break;case"right":t=-r;break;case"down":i=-r}n.scroll({dx:t,dy:i})}}ta.$inject=["config.keyboardMove","keyboard","canvas"];var na={__depends__:[Js],__init__:["keyboardMove"],keyboardMove:["type",ta]},ia=/^djs-cursor-.*$/;function ra(e){var t=Y(document.body);t.removeMatching(ia),e&&t.add("djs-cursor-"+e)}function oa(){ra(null)}var sa=5e3;function aa(e,t){function n(){return!1}return t=t||"element.click",e.once(t,sa,n),function(){e.off(t,n)}}function la(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ca(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pa(e,t){var n;function i(i){var r,o=n.start,s=n.button,a=zo(i),l=ca(a,o);(!n.dragging&&(r=l,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>15)&&(n.dragging=!0,0===s&&aa(e),ra("grab")),n.dragging)&&(l=ca(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function r(e){ce.unbind(document,"mousemove",i),ce.unbind(document,"mouseup",r),n=null,oa()}e.on("element.mousedown",500,(function(e){return function(e){if(te(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:zo(e)},ce.bind(document,"mousemove",i),ce.bind(document,"mouseup",r),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}pa.$inject=["eventBus","canvas"];var ua={__init__:["moveCanvas"],moveCanvas:["type",pa]};function da(e){return Math.log(e)/Math.log(10)}function ha(e,t){var n=da(e.min),i=da(e.max);return(Math.abs(n)+Math.abs(i))/t}var ma=Math.sign||function(e){return e>=0?1:-1},fa={min:.2,max:4};function ga(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=j(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}ga.$inject=["config.zoomScroll","eventBus","canvas"],ga.prototype.scroll=function(e){this._canvas.scroll(e)},ga.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ga.prototype.zoom=function(e,t){var n=ha(fa,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},ga.prototype._handleWheel=function(e){if(!te(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||Vo()&&e.metaKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){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=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},ga.prototype.stepZoom=function(e,t){var n=ha(fa,10);this._zoom(e,t,n)},ga.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=da(i.zoom()),s=Math.round(o/n)*n;s+=n*r;var a,l,c=Math.pow(10,s);i.zoom((a=fa,l=c,Math.max(a.min,Math.min(a.max,l))),t)},ga.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&ce[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},ga.prototype._init=function(e){this.toggle(e)};var ya={__init__:["zoomScroll"],zoomScroll:["type",ga]};function va(e){$s.call(this,e)}function ba(e){return e&&e[e.length-1]}function wa(e){return e.y}function xa(e){return e.x}e(va,$s),va.prototype._navigationModules=[na,ua,ya],va.prototype._modules=[].concat($s.prototype._modules,va.prototype._navigationModules);var _a={left:xa,center:xa,right:function(e){return e.x+e.width},top:wa,middle:wa,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,i,r,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"]))r=ba(t),l[e]=r[s]+r[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=A(c,(function(e){return e.elements.length>1&&(p=!0),e.elements.length})),p)return l[e]=ba(n).center,l;i=t[0],r=ba(t=A(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(i,r)}return l},Ea.prototype.trigger=function(e,t){var n,i=this._modeling,r=y(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(c(n=this._rules.allowed("elements.align",{elements:r}))&&(r=n),!(r.length<2)&&n){var o=A(r,_a[t]),s=this._alignmentPosition(t,o);i.alignElements(o,s)}};var Oa={__init__:["alignElements"],alignElements:["type",Ea]},Pa=".entry";function ka(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=a(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function Sa(e,t){return-1!==e.indexOf(t)}ka.$inject=["canvas","config.contextPad","eventBus","overlays"],ka.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var r=i.target;_(c(r)?r:[r],(function(e){return Sa(n,e)}))&&e.open(r,!0)}}))},ka.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},ka.prototype.getEntries=function(e){var t=this._getProviders(),n=c(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return v(t,(function(t){if(d(t[n])){var r=t[n](e);d(r)?i=r(i):v(r,(function(e,t){i[t]=e}))}})),i},ka.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=X(o,"data-action"),r=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(i,"hover",r,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(i,e,r,n)):t.preventDefault()},ka.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=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(d(s)){if("click"===t)return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ka.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ka.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ka.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this.getPad(e),r=i.html;v(n,(function(e,n){var i,o=e.group||"default",s=ge(e.html||'<div class="entry" draggable="true"></div>');X(s,"data-action",n),(i=ye("[data-group="+bs(o)+"]",r))||(X(i=ge('<div class="group"></div>'),"data-group",o),r.appendChild(i)),i.appendChild(s),e.className&&function(e,t){var n=Y(e);(t=c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,e.className),e.title&&X(s,"title",e.title),e.imageUrl&&(X(t=ge("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),Y(r).add("open"),this._current={target:e,entries:n,pad:i},this._eventBus.fire("contextPad.open",{current:this._current})},ka.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=ge('<div class="djs-context-pad"></div>'),r=this._getPosition(e),o=I({html:i},this._overlaysConfig,r);de.bind(i,Pa,"click",(function(e){t.trigger("click",e)})),de.bind(i,Pa,"dragstart",(function(e){t.trigger("dragstart",e)})),de.bind(i,Pa,"mouseover",(function(e){t.trigger("mouseover",e)})),de.bind(i,Pa,"mouseout",(function(e){t.trigger("mouseout",e)})),ce.bind(i,"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},ka.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)},ka.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 Sa(n,e)})):n===e)},ka.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},ka.prototype._getPosition=function(e){var t,n=bt(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 Ca,Aa,Ta,Ma,Ra,Da={__depends__:[Ko,ds],contextPad:["type",ka]},Na={},Ba=[],ja=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Ia(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 La(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ca.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 qa(e,s,i,r,null)}function qa(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++Ta:r};return null==r&&null!=Aa.vnode&&Aa.vnode(o),o}function za(e){return e.children}function Va(e,t){this.props=e,this.context=t}function Fa(e,t){if(null==t)return e.__?Fa(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?Fa(e):null}function Ha(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 Ha(e)}}function Ua(e){(!e.__d&&(e.__d=!0)&&Ma.push(e)&&!Wa.__r++||Ra!==Aa.debounceRendering)&&((Ra=Aa.debounceRendering)||setTimeout)(Wa)}function Wa(){for(var e;Wa.__r=Ma.length;)e=Ma.sort((function(e,t){return e.__v.__b-t.__v.__b})),Ma=[],e.some((function(e){var t,n,i,r,o,s;e.__d&&(o=(r=(t=e).__v).__e,(s=t.__P)&&(n=[],(i=Ia({},r)).__v=r.__v+1,el(s,r,i,t.__n,void 0!==s.ownerSVGElement,null!=r.__h?[o]:null,n,null==o?Fa(r):o,r.__h),tl(n,r),r.__e!=o&&Ha(r)))}))}function Qa(e,t,n,i,r,o,s,a,l,c){var p,u,d,h,m,f,g,y=i&&i.__k||Ba,v=y.length;for(n.__k=[],p=0;p<t.length;p++)if(null!=(h=n.__k[p]=null==(h=t[p])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?qa(null,h,null,null,h):Array.isArray(h)?qa(za,{children:h},null,null,null):h.__b>0?qa(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(d=y[p])||d&&h.key==d.key&&h.type===d.type)y[p]=void 0;else for(u=0;u<v;u++){if((d=y[u])&&h.key==d.key&&h.type===d.type){y[u]=void 0;break}d=null}el(e,h,d=d||Na,r,o,s,a,l,c),m=h.__e,(u=h.ref)&&d.ref!=u&&(g||(g=[]),d.ref&&g.push(d.ref,null,h),g.push(u,h.__c||m,h)),null!=m?(null==f&&(f=m),"function"==typeof h.type&&h.__k===d.__k?h.__d=l=Ga(h,l,e):l=Xa(e,h,d,y,m,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Fa(d))}for(n.__e=f,p=v;p--;)null!=y[p]&&il(y[p],y[p]);if(g)for(p=0;p<g.length;p++)nl(g[p],g[++p],g[++p])}function Ga(e,t,n){for(var i,r=e.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=e,t="function"==typeof i.type?Ga(i,t,n):Xa(n,i,i,r,i.__e,t));return t}function Xa(e,t,n,i,r,o){var s,a,l;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||r!=o||null==r.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(r),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<i.length;l+=1)if(a==r)break e;e.insertBefore(r,o),s=o}return void 0!==s?s:r.nextSibling}function Ka(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||ja.test(t)?n:n+"px"}function Ya(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Ka(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Ka(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?i||e.addEventListener(t,o?Ja:Za,o):e.removeEventListener(t,o?Ja:Za,o);else if("dangerouslySetInnerHTML"!==t){if(r)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 Za(e){this.l[e.type+!1](Aa.event?Aa.event(e):e)}function Ja(e){this.l[e.type+!0](Aa.event?Aa.event(e):e)}function el(e,t,n,i,r,o,s,a,l){var c,p,u,d,h,m,f,g,y,v,b,w,x,_,E,O=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=Aa.__b)&&c(t);try{e:if("function"==typeof O){if(g=t.props,y=(c=O.contextType)&&i[c.__c],v=c?y?y.props.value:c.__:i,n.__c?f=(p=t.__c=n.__c).__=p.__E:("prototype"in O&&O.prototype.render?t.__c=p=new O(g,v):(t.__c=p=new Va(g,v),p.constructor=O,p.render=rl),y&&y.sub(p),p.props=g,p.state||(p.state={}),p.context=v,p.__n=i,u=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=O.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Ia({},p.__s)),Ia(p.__s,O.getDerivedStateFromProps(g,p.__s))),d=p.props,h=p.state,u)null==O.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==O.getDerivedStateFromProps&&g!==d&&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(d,h,m)}))}if(p.context=v,p.props=g,p.__v=t,p.__P=e,w=Aa.__r,x=0,"prototype"in O&&O.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&&(i=Ia(Ia({},i),p.getChildContext())),u||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,h)),E=null!=c&&c.type===za&&null==c.key?c.props.children:c,Qa(e,Array.isArray(E)?E:[E],t,n,i,r,o,s,a,l),p.base=t.__e,t.__h=null,p.__h.length&&s.push(p),f&&(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,i,r,o,s,a){var l,c,p,u=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(r=!0),null!=o)for(;m<o.length;m++)if((l=o[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,o[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=r?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),o=null,a=!1}if(null===h)u===d||a&&e.data===d||(e.data=d);else{if(o=o&&Ca.call(e.childNodes),c=(u=n.props||Na).dangerouslySetInnerHTML,p=d.dangerouslySetInnerHTML,!a){if(null!=o)for(u={},m=0;m<e.attributes.length;m++)u[e.attributes[m].name]=e.attributes[m].value;(p||c)&&(p&&(c&&p.__html==c.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,t,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in t||Ya(e,o,null,n[o],i);for(o in t)r&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||Ya(e,o,t[o],n[o],i)}(e,d,u,r,a),p)t.__k=[];else if(m=t.props.children,Qa(e,Array.isArray(m)?m:[m],t,n,i,r&&"foreignObject"!==h,o,s,o?o[0]:n.__k&&Fa(n,0),a),null!=o)for(m=o.length;m--;)null!=o[m]&&$a(o[m]);a||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==u.value)&&Ya(e,"value",m,u.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&Ya(e,"checked",m,u.checked,!1))}return e}(n.__e,t,n,i,r,o,s,l);(c=Aa.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=o)&&(t.__e=a,t.__h=!!l,o[o.indexOf(a)]=null),Aa.__e(e,t,n)}}function tl(e,t){Aa.__c&&Aa.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Aa.__e(e,t.__v)}}))}function nl(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Aa.__e(e,n)}}function il(e,t,n){var i,r;if(Aa.unmount&&Aa.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||nl(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Aa.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&il(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||$a(e.__e),e.__=e.__e=e.__d=void 0}function rl(e,t,n){return this.constructor(e,n)}function ol(e,t,n){var i,r,o;Aa.__&&Aa.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],el(t,e=(!i&&n||t).__k=La(za,null,[e]),r||Na,Na,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Ca.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i),tl(o,e)}Ca=Ba.slice,Aa={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Ta=0,Va.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Ia({},this.state),"function"==typeof e&&(e=e(Ia({},n),this.props)),e&&Ia(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ua(this))},Va.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ua(this))},Va.prototype.render=za,Ma=[],Wa.__r=0;var sl=function(e,t,n,i){var r;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?i[0]=a:4===s?i[1]=Object.assign(i[1]||{},a):5===s?(i[1]=i[1]||{})[t[++o]]=a:6===s?i[1][t[++o]]+=a+"":s?(r=e.apply(a,sl(e,a,n,["",null])),i.push(r),a[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(a)}return i},al=new Map;var ll,cl,pl,ul,dl=function(e){var t=al.get(this);return t||(t=new Map,al.set(this,t)),(t=sl(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,r="",o="",s=[0],a=function(e){1===i&&(e||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,r):3===i&&(e||r)?(s.push(3,e,r),i=2):2===i&&"..."===r&&e?s.push(4,e,0):2===i&&r&&!e?s.push(5,0,!0,r):i>=5&&((r||!e&&5===i)&&(s.push(i,0,r,n),i=6),e&&(s.push(i,e,0,n),i=6)),r=""},l=0;l<e.length;l++){l&&(1===i&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===i?"<"===t?(a(),s=[s],i=3):r+=t:4===i?"--"===r&&">"===t?(i=1,r=""):r=t+r[0]:o?t===o?o="":r+=t:'"'===t||"'"===t?o=t:">"===t?(a(),i=1):i&&("="===t?(i=5,n=r,r=""):"/"===t&&(i<5||">"===e[l][c+1])?(a(),3===i&&(s=s[0]),i=s,(s=s[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),i=2):r+=t),3===i&&"!--"===r&&(i=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(La),hl=0,ml=[],fl=[],gl=Aa.__b,yl=Aa.__r,vl=Aa.diffed,bl=Aa.__c,wl=Aa.unmount;function xl(e,t){Aa.__h&&Aa.__h(cl,e,hl||t),hl=0;var n=cl.__H||(cl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:fl}),n.__[e]}function _l(e){return hl=1,function(e,t,n){var i=xl(ll++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):Nl(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=cl,!cl.u)){cl.u=!0;var r=cl.shouldComponentUpdate;cl.shouldComponentUpdate=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.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&&i.__c.props===e)&&(!r||r.call(this,e,t,n))}}return i.__N||i.__}(Nl,e)}function El(e,t){var n=xl(ll++,3);!Aa.__s&&Dl(n.__H,t)&&(n.__=e,n.i=t,cl.__H.__h.push(n))}function Ol(e,t){var n=xl(ll++,4);!Aa.__s&&Dl(n.__H,t)&&(n.__=e,n.i=t,cl.__h.push(n))}function Pl(e){return hl=5,kl((function(){return{current:e}}),[])}function kl(e,t){var n=xl(ll++,7);return Dl(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Sl(e,t){return hl=8,kl((function(){return e}),t)}function Cl(){for(var e;e=ml.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ml),e.__H.__h.forEach(Rl),e.__H.__h=[]}catch(t){e.__H.__h=[],Aa.__e(t,e.__v)}}Aa.__b=function(e){cl=null,gl&&gl(e)},Aa.__r=function(e){yl&&yl(e),ll=0;var t=(cl=e.__c).__H;t&&(pl===cl?(t.__h=[],cl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=fl,e.__N=e.i=void 0}))):(t.__h.forEach(Ml),t.__h.forEach(Rl),t.__h=[])),pl=cl},Aa.diffed=function(e){vl&&vl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ml.push(t)&&ul===Aa.requestAnimationFrame||((ul=Aa.requestAnimationFrame)||Tl)(Cl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==fl&&(e.__=e.__V),e.i=void 0,e.__V=fl}))),pl=cl=null},Aa.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ml),e.__h=e.__h.filter((function(e){return!e.__||Rl(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Aa.__e(n,e.__v)}})),bl&&bl(e,t)},Aa.unmount=function(e){wl&&wl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ml(e)}catch(e){t=e}})),n.__H=void 0,t&&Aa.__e(t,n.__v))};var Al="function"==typeof requestAnimationFrame;function Tl(e){var t,n=function(){clearTimeout(i),Al&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Al&&(t=requestAnimationFrame(n))}function Ml(e){var t=cl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),cl=t}function Rl(e){var t=cl;e.__c=e.__(),cl=t}function Dl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Nl(e,t){return"function"==typeof t?t(e):t}function Bl(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Bl(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function jl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Bl(e))&&(i&&(i+=" "),i+=t);return i}function Il(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:r,onAction:o}=e;return dl`
|
|
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 i=Math.log(Math.pow(2,e))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var o=i-Math.floor(i),s="";for(r=0;r<Math.floor(i);r++){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,i){var r=function(r){var s=0;do{if(s++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var a=t(e,n)}while(Object.hasOwnProperty.call(o,a));return o[a]=r,a},o=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=n||16,r}}));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 i(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 r=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]"===r.call(e)}function p(e){return"[object Object]"===r.call(e)}function u(e){return"[object Number]"===r.call(e)}function d(e){const t=r.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function h(e){return"[object String]"===r.call(e)}function m(e,t){return o.call(e,t)}function f(e,t){const n=R(t);let i;return v(e,(function(e,t){if(n(e,t))return i=e,!1})),i}function g(e,t){const n=R(t);let i=c(e)?-1:void 0;return v(e,(function(e,t){if(n(e,t))return i=t,!1})),i}function y(e,t){const n=R(t);let i=[];return v(e,(function(e,t){n(e,t)&&i.push(e)})),i}function v(e,t){let n,i;if(s(e))return;const r=c(e)?N:D;for(let o in e)if(m(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function b(e,t){if(s(e))return[];!function(e){if(!c(e))throw new Error("must supply array")}(e);const n=R(t);return e.filter((function(e,t){return!n(e,t)}))}function w(e,t,n){return v(e,(function(e,i){n=t(n,e,i)})),n}function x(e,t){return!!w(e,(function(e,n,i){return e&&t(n,i)}),!0)}function _(e,t){return!!f(e,t)}function E(e,t){let n=[];return v(e,(function(e,i){n.push(t(e,i))})),n}function O(e){return e&&Object.keys(e)||[]}function P(e){return E(e,(e=>e))}function k(e,t,n={}){return t=M(t),v(e,(function(e){let i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)})),n}function S(e,...t){e=M(e);let n={};return v(t,(t=>k(t,e,n))),E(n,(function(e,t){return e[0]}))}const C=S;function A(e,t){t=M(t);let n=[];return v(e,(function(e,i){let r=t(e,i),o={d:r,v:e};for(var s=0;s<n.length;s++){let{d:e}=n[s];if(r<e)return void n.splice(s,0,o)}n.push(o)})),E(n,(e=>e.v))}function T(e){return function(t){return x(e,(function(e,n){return t[n]===e}))}}function M(e){return d(e)?e:t=>t[e]}function R(e){return d(e)?e:t=>t===e}function D(e){return e}function N(e){return Number(e)}function B(e,t){let n,i,r,o;function s(n){let s=Date.now(),c=n?0:o+t-s;if(c>0)return a(c);e.apply(r,i),l()}function a(e){n=setTimeout(s,e)}function l(){n&&clearTimeout(n),n=o=i=r=void 0}function c(...e){o=Date.now(),i=e,r=this,n||a(t)}return c.flush=function(){n&&s(!0),l()},c.cancel=l,c}function j(e,t){return e.bind(t)}function I(e,...t){return Object.assign(e,...t)}function $(e,t,n){let i=e;return v(t,(function(e,r){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[r+1],c=i[e];a(o)&&l(c)&&(c=i[e]=isNaN(+o)?{}:[]),s(o)?s(n)?delete i[e]:i[e]=n:i=c})),e}function L(e,t){let n={},i=Object(e);return v(t,(function(t){t in i&&(n[t]=e[t])})),n}function q(e,t){let n={};return v(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}function z(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 i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const V=Object.prototype.toString,F=Object.prototype.hasOwnProperty;function H(e,t){return F.call(e,t)}function U(e,t){let n,i;if(void 0===e)return;const r=function(e){return"[object Array]"===V.call(e)}(e)?Q:W;for(let o in e)if(H(e,o)&&(n=e[o],i=t(n,r(o)),!1===i))return n}function W(e){return e}function Q(e){return Number(e)}function G(e,...t){const n=e.style;return U(t,(function(e){e&&U(e,(function(e,t){n[t]=e}))})),e}function X(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}const K=Object.prototype.toString;function Y(e){return new Z(e)}function Z(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function J(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}function ee(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function te(e,t,n){for(var i=n?e:e.parentNode;i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(ee(i,t))return i;i=i.parentNode}return ee(i,t)?i:null}Z.prototype.add=function(e){return this.list.add(e),this},Z.prototype.remove=function(e){return"[object RegExp]"==K.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Z.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},Z.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Z.prototype.array=function(){return Array.from(this.list)},Z.prototype.has=Z.prototype.contains=function(e){return this.list.contains(e)};var ne,ie,re,oe={};function se(){ne=window.addEventListener?"addEventListener":"attachEvent",ie=window.removeEventListener?"removeEventListener":"detachEvent",re="addEventListener"!==ne?"on":""}var ae=oe.bind=function(e,t,n,i){return ne||se(),e[ne](re+t,n,i||!1),n},le=oe.unbind=function(e,t,n,i){return ie||se(),e[ie](re+t,n,i||!1),n},ce=z({__proto__:null,bind:ae,unbind:le,default:oe},[oe]),pe=["focus","blur"];var ue,de={bind:function(e,t,n,i,r){return-1!==pe.indexOf(n)&&(r=!0),ce.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=te(r,t,!0),n.delegateTarget&&i.call(e,n)}),r)},unbind:function(e,t,n,i){return-1!==pe.indexOf(t)&&(i=!0),ce.unbind(e,t,n,i)}},he=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){return(l=t.createElement("html")).innerHTML=e,l.removeChild(l.lastChild)}var r=Object.prototype.hasOwnProperty.call(fe,i)?fe[i]:fe._default,o=r[0],s=r[1],a=r[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&&((ue=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',me=!ue.getElementsByTagName("link").length,ue=void 0);var fe={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,"",""]};fe.td=fe.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],fe.option=fe.optgroup=[1,'<select multiple="multiple">',"</select>"],fe.thead=fe.tbody=fe.colgroup=fe.caption=fe.tfoot=[1,"<table>","</table>"],fe.polyline=fe.ellipse=fe.polygon=fe.circle=fe.text=fe.line=fe.path=fe.rect=fe.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var ge=he;function ye(e,t){return(t=t||document).querySelector(e)}function ve(e,t){return(t=t||document).querySelectorAll(e)}function be(e){e.parentNode&&e.parentNode.removeChild(e)}function we(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function xe(e,t){return we(t,e),e}var _e=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":_e,"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":_e,"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 i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Ee[i];r?(r===_e&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=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,i,r=Object.keys(t);for(n=0;i=r[n];n++)Oe(e,i,t[i])}(e,t);return e}const ke=Object.prototype.toString;function Se(e){return new Ce(e)}function Ce(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ae(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Te(e){for(var t;t=e.firstChild;)Ae(t);return e}function Me(e){return e.cloneNode(!0)}Ce.prototype.add=function(e){return this.list.add(e),this},Ce.prototype.remove=function(e){return"[object RegExp]"==ke.call(e)?this.removeMatching(e):(this.list.remove(e),this)},Ce.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},Ce.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ce.prototype.array=function(){return Array.from(this.list)},Ce.prototype.has=Ce.prototype.contains=function(e){return this.list.contains(e)};var Re={svg:"http://www.w3.org/2000/svg"},De='<svg xmlns="'+Re.svg+'"';function Ne(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Re.svg)&&(e=De+e.substring(4)):(e=De+">"+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 i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Be(e,t){var n;return"<"===e.charAt(0)?(n=Ne(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Re.svg,e),t&&Pe(n,t),n}var je=null;function Ie(){return null===je&&(je=Be("svg")),je}function $e(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Le(e){return e?Ie().createSVGTransformFromMatrix(e):Ie().createSVGTransform()}var qe=/([&<>]{1})/g,ze=/([\n\r"]{1})/g,Ve={"&":"&","<":"<",">":">",'"':"'"};function Fe(e,t){return e.replace(t,(function(e,t){return Ve[t]||t}))}function He(e,t){var n,i,r,o,s;switch(e.nodeType){case 3:t.push(Fe(e.textContent,qe));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Fe(o.value,ze),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(s=e.childNodes).length;n<i;++n)He(s.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Fe(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 Ue(e,t){var n=Ne(t);if(Te(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)we(r[o],e)}}function We(e,t){if(void 0!==t){try{Ue(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)He(t,n),t=t.nextSibling;return n.join("")}(e)}function Qe(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ge(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Qe(e,i))}(n,t)),n.consolidate()}const Xe=/^class[ {]/;function Ke(e){return Array.isArray(e)}function Ye(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ze(...e){1===e.length&&Ke(e[0])&&(e=e[0]);const t=(e=[...e]).pop();return t.$inject=e,t}const Je=/constructor\s*[^(]*\(\s*([^)]*)\)/m,et=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,tt=/\/\*([^*]*)\*\//m;function nt(e){if("function"!=typeof e)throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(function(e){return Xe.test(e.toString())}(e)?Je:et);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map((e=>{const t=e.match(tt);return(t&&t[1]||e).trim()}))||[]}function it(e,t){const n=t||{get:function(e,t){if(i.push(e),!1===t)return null;throw a(`No provider for "${e}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),s=o.injector=this,a=function(e){const t=i.join(" -> ");return i.length=0,new Error(t?`${e} (Resolving: ${t})`:e)};function l(e,t){if(!r[e]&&e.includes(".")){const t=e.split(".");let n=l(t.shift());for(;t.length;)n=n[t.shift()];return n}if(Ye(o,e))return o[e];if(Ye(r,e)){if(-1!==i.indexOf(e))throw i.push(e),a("Cannot resolve circular dependency!");return i.push(e),o[e]=r[e][0](r[e][1]),i.pop(),o[e]}return n.get(e,t)}function c(e,t){if(void 0===t&&(t={}),"function"!=typeof e){if(!Ke(e))throw a(`Cannot invoke "${e}". Expected a function!`);e=Ze(e.slice())}return{fn:e,dependencies:(e.$inject||nt(e)).map((e=>Ye(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:i,dependencies:r}=c(e,n);return i.apply(t,r)}function d(e){return Ze((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,u;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),u=d(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]],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,s)}const m={factory:u,type:p,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 g(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=Ze((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;const n=e[t];if("private"===n[2])return void(r[t]=n);const i=n[0],o=n[1];r[t]=[m[i],rt(i,o),i]})),f(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=h,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 rt(e,t){return"value"!==e&&Ke(t)&&(t=Ze(t.slice())),t}var ot=1e3;function st(e,t){var n=this;t=t||ot,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,r=t.element,o=t.gfx,s=t.attrs;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r,s):n.drawConnection(o,r,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 at(e){return e.flat().join(",").replace(/,?([A-z]),?/g,"$1")}function lt(e){return["L",e.x,e.y]}function ct(e,t){const n=e.length,i=[(r=e[0],["M",r.x,r.y])];var r,o,s,a;for(let r=1;r<n;r++){const n=e[r-1],l=e[r],c=e[r+1];if(!c||!t){i.push(lt(l));continue}const p=Math.min(t,ut(l.x-n.x,l.y-n.y),ut(c.x-l.x,c.y-l.y));if(!p){i.push(lt(l));continue}const u=pt(l,n,p),d=pt(l,n,.5*p),h=pt(l,c,p),m=pt(l,c,.5*p);i.push(lt(u)),i.push((s=m,a=h,["C",(o=d).x,o.y,s.x,s.y,a.x,a.y]))}return i}function pt(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n/ut(i,r);return{x:e.x+i*o,y:e.y+r*o}}function ut(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 i=Be("path",t);return u(n)&&(i.dataset.cornerRadius=String(n)),ht(i,e)}function ht(e,t){return Pe(e,{d:at(ct(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function mt(e){return y(e,(function(t){return!f(e,(function(e){return e!==t&&ft(t,e)}))}))}function ft(e,t){if(t){if(e===t)return t;if(e.parent)return ft(e.parent,t)}}function gt(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function yt(e,t,n){n=n||0,c(e)||(e=[e]),v(e,(function(e,i){var r=t(e,i,n);c(r)&&r.length&&yt(r,t,n+1)}))}function vt(e,t){return function(e,t,n){var i=[],r=[];return yt(e,(function(e,o,s){gt(i,e,t);var a=e.children;if((-1===n||s<n)&&a&>(r,a,t))return a})),i}(e,!t,-1)}function bt(e,t){var n,i,r,o;return t=!!t,c(e)||(e=[e]),v(e,(function(e){var s=e;e.waypoints&&!t&&(s=bt(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<i||void 0===i)&&(i=l),(a+p>r||void 0===r)&&(r=a+p),(l+c>o||void 0===o)&&(o=l+c)})),{x:n,y:i,height:o-i,width:r-n}}function wt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function xt(e){return!(!e||!e.isFrame)}function _t(e,t){return I({},e||{},t||{})}st.prototype.canRender=function(e){},st.prototype.drawShape=function(e,t){},st.prototype.drawConnection=function(e,t){},st.prototype.getShapePath=function(e){},st.prototype.getConnectionPath=function(e){};function Et(e,t){st.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}e(Et,st),Et.prototype.canRender=function(){return!0},Et.prototype.drawShape=function(e,t,n){var i=Be("rect");return Pe(i,{x:0,y:0,width:t.width||0,height:t.height||0}),xt(t)?Pe(i,I({},this.FRAME_STYLE,n||{})):Pe(i,I({},this.SHAPE_STYLE,n||{})),xe(e,i),i},Et.prototype.drawConnection=function(e,t,n){var i=dt(t.waypoints,I({},this.CONNECTION_STYLE,n||{}));return xe(e,i),i},Et.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return at([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},Et.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return at(r)},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 I(this.style(t,n),{class:e})},this.style=function(t,n){c(t)||n||(n=t,t=[]);var i=w(t,(function(t,n){return I(t,e[n]||{})}),{});return n?I(i,n):i},this.computeStyle=function(e,n,i){return c(n)||(i=n,n=[]),t.style(n||[],I({},i,e||{}))}}]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function kt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function St(e,t){return e&&t?e.indexOf(t):-1}function Ct(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function At(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Ct(e,t);return Math.abs(r/o)<=i}var Tt=2;function Mt(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[e,t]of Object.entries(i))if(Rt(e,n))return t;return!1}function Rt(e,t){const n=t[0];return x(t,(function(t){return Math.abs(n[e]-t[e])<=Tt}))}function Dt(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 Nt(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Bt=/,?([a-z]),?/gi,jt=parseFloat,It=Math,$t=It.PI,Lt=It.min,qt=It.max,zt=It.pow,Vt=It.abs,Ft=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Ht=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Ut=Array.isArray||function(e){return e instanceof Array};function Wt(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)Wt(e,n)&&(t[n]=Qt(e[n]));return t}function Gt(e){var t=Gt.ps=Gt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout((function(){for(var n in t)Wt(t,n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])})),t[e]}function Xt(e,t,n,i){return 1===arguments.length&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Kt(){return this.join(",").replace(Bt,"$1")}function Yt(e){var t=Qt(e);return t.toString=Kt,t}function Zt(e,t,n,i,r,o,s,a,l){var c=1-l,p=zt(c,3),u=zt(c,2),d=l*l*l,h=p*t+3*u*l*i+3*c*l*l*o+d*a;return{x:on(p*e+3*u*l*n+3*c*l*l*r+d*s),y:on(h)}}function Jt(e){var t=function(e,t,n,i,r,o,s,a){for(var l,c,p,u,d,h,m,f,g=[],y=[[],[]],v=0;v<2;++v)if(0==v?(c=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*s,p=3*n-3*e):(c=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*a,p=3*i-3*t),Vt(l)<1e-12){if(Vt(c)<1e-12)continue;0<(u=-p/c)&&u<1&&g.push(u)}else m=c*c-4*p*l,f=It.sqrt(m),m<0||(0<(d=(-c+f)/(2*l))&&d<1&&g.push(d),0<(h=(-c-f)/(2*l))&&h<1&&g.push(h));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*r+u*u*u*s,y[1][w]=b*b*b*t+3*b*b*u*i+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:Lt(...y[0]),y0:Lt(...y[1]),x1:qt(...y[0]),y1:qt(...y[1])}}(...e);return Xt(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function en(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function tn(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function nn(e,t,n,i,r,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],d=0,h=0;h<12;h++){var m=c*p[h]+c,f=tn(m,e,n,r,s),g=tn(m,t,i,o,a),y=f*f+g*g;d+=u[h]*It.sqrt(y)}return c*d}function rn(e,t,n,i,r,o,s,a){if(!(qt(e,n)<Lt(r,s)||Lt(e,n)>qt(r,s)||qt(t,i)<Lt(o,a)||Lt(t,i)>qt(o,a))){var l=(e*i-t*n)*(o-a)-(t-i)*(r*a-o*s),c=(e-n)*(o-a)-(t-i)*(r-s);if(c){var p=on(((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/c),u=on(l/c),d=+p.toFixed(2),h=+u.toFixed(2);if(!(d<+Lt(e,n).toFixed(2)||d>+qt(e,n).toFixed(2)||d<+Lt(r,s).toFixed(2)||d>+qt(r,s).toFixed(2)||h<+Lt(t,i).toFixed(2)||h>+qt(t,i).toFixed(2)||h<+Lt(o,a).toFixed(2)||h>+qt(o,a).toFixed(2)))return{x:p,y:u}}}}function on(e){return Math.round(1e11*e)/1e11}function sn(e,t,n){if(!function(e,t){return e=Xt(e),en(t=Xt(t),e.x,e.y)||en(t,e.x2,e.y)||en(t,e.x,e.y2)||en(t,e.x2,e.y2)||en(e,t.x,t.y)||en(e,t.x2,t.y)||en(e,t.x,t.y2)||en(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)}(Jt(e),Jt(t)))return n?0:[];for(var i=nn(...e),r=nn(...t),o=cn(e)?1:~~(i/5)||1,s=cn(t)?1:~~(r/5)||1,a=[],l=[],c={},p=n?0:[],u=0;u<o+1;u++){var d=Zt(...e,u/o);a.push({x:d.x,y:d.y,t:u/o})}for(u=0;u<s+1;u++)d=Zt(...t,u/s),l.push({x:d.x,y:d.y,t:u/s});for(u=0;u<o;u++)for(var h=0;h<s;h++){var m,f=a[u],g=a[u+1],y=l[h],v=l[h+1],b=Vt(g.x-f.x)<.01?"y":"x",w=Vt(v.x-y.x)<.01?"y":"x",x=rn(f.x,f.y,g.x,g.y,y.x,y.y,v.x,v.y);if(x){if(c[m=x.x.toFixed(9)+"#"+x.y.toFixed(9)])continue;c[m]=!0;var _=f.t+Vt((x[b]-f[b])/(g[b]-f[b]))*(g.t-f.t),E=y.t+Vt((x[w]-y[w])/(v[w]-y[w]))*(v.t-y.t);_>=0&&_<=1&&E>=0&&E<=1&&(n?p++:p.push({x:x.x,y:x.y,t1:_,t2:E}))}}return p}function an(e,t,n){e=hn(e),t=hn(t);for(var i,r,o,s,a,l,c,p,u,d,h=n?0:[],m=0,f=e.length;m<f;m++){var g=e[m];if("M"==g[0])i=a=g[1],r=l=g[2];else{"C"==g[0]?(i=(u=[i,r,...g.slice(1)])[6],r=u[7]):(u=[i,r,i,r,a,l,a,l],i=a,r=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=(d=[o,s,...b.slice(1)])[6],s=d[7]):(d=[o,s,o,s,c,p,c,p],o=c,s=p);var w=sn(u,d,n);if(n)h+=w;else{for(var x=0,_=w.length;x<_;x++)w[x].segment1=m,w[x].segment2=y,w[x].bez1=u,w[x].bez2=d;h=h.concat(w)}}}}}return h}function ln(e){var t=Gt(e);if(t.abs)return Yt(t.abs);if(Ut(e)&&Ut(e&&e[0])||(e=function(e){if(!e)return null;var t=Gt(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},i=[];return Ut(e)&&Ut(e[0])&&(i=Qt(e)),i.length||String(e).replace(Ft,(function(e,t,r){var o=[],s=t.toLowerCase();for(r.replace(Ht,(function(e,t){t&&o.push(+t)})),"m"==s&&o.length>2&&(i.push([t,...o.splice(0,2)]),s="l",t="m"==t?"l":"L");o.length>=n[s]&&(i.push([t,...o.splice(0,n[s])]),n[s]););})),i.toString=Gt.toString,t.arr=Qt(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,s=0,a=0,l=0;"M"==e[0][0]&&(s=r=+e[0][1],a=o=+e[0][2],l++,i[0]=["M",r,o]);for(var c,p,u=l,d=e.length;u<d;u++){if(i.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]+r,c[7]=+p[7]+o;break;case"V":c[1]=+p[1]+o;break;case"H":c[1]=+p[1]+r;break;case"M":s=+p[1]+r,a=+p[2]+o;default:for(var h=1,m=p.length;h<m;h++)c[h]=+p[h]+(h%2?r:o)}else for(var f=0,g=p.length;f<g;f++)c[f]=p[f];switch(n=n.toUpperCase(),c[0]){case"Z":r=+s,o=+a;break;case"H":r=c[1];break;case"V":o=c[1];break;case"M":s=c[c.length-2],a=c[c.length-1];default:r=c[c.length-2],o=c[c.length-1]}}return i.toString=Kt,t.abs=Yt(i),i}function cn(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function pn(e,t,n,i){return[e,t,n,i,n,i]}function un(e,t,n,i,r,o){var s=1/3,a=2/3;return[s*e+a*n,s*t+a*i,s*r+a*n,s*o+a*i,r,o]}function dn(e,t,n,i,r,o,s,a,l,c){var p,u=120*$t/180,d=$t/180*(+r||0),h=[],m=function(e){return function t(){var n=Array.prototype.slice.call(arguments,0).join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return Wt(i,n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=e(...arguments),i[n])}}((function(e,t,n){return{x:e*It.cos(n)-t*It.sin(n),y:e*It.sin(n)+t*It.cos(n)}}));if(c)E=c[0],O=c[1],x=c[2],_=c[3];else{e=(p=m(e,t,-d)).x,t=p.y;var f=(e-(a=(p=m(a,l,-d)).x))/2,g=(t-(l=p.y))/2,y=f*f/(n*n)+g*g/(i*i);y>1&&(n*=y=It.sqrt(y),i*=y);var v=n*n,b=i*i,w=(o==s?-1:1)*It.sqrt(Vt((v*b-v*g*g-b*f*f)/(v*g*g+b*f*f))),x=w*n*g/i+(e+a)/2,_=w*-i*f/n+(t+l)/2,E=It.asin(((t-_)/i).toFixed(9)),O=It.asin(((l-_)/i).toFixed(9));(E=e<x?$t-E:E)<0&&(E=2*$t+E),(O=a<x?$t-O:O)<0&&(O=2*$t+O),s&&E>O&&(E-=2*$t),!s&&O>E&&(O-=2*$t)}var P=O-E;if(Vt(P)>u){var k=O,S=a,C=l;O=E+u*(s&&O>E?1:-1),h=dn(a=x+n*It.cos(O),l=_+i*It.sin(O),n,i,r,0,s,S,C,[O,k,x,_])}P=O-E;var A=It.cos(E),T=It.sin(E),M=It.cos(O),R=It.sin(O),D=It.tan(P/4),N=4/3*n*D,B=4/3*i*D,j=[e,t],I=[e+N*T,t-B*A],$=[a+N*R,l-B*M],L=[a,l];if(I[0]=2*j[0]-I[0],I[1]=2*j[1]-I[1],c)return[I,$,L].concat(h);for(var q=[],z=0,V=(h=[I,$,L].concat(h).join().split(",")).length;z<V;z++)q[z]=z%2?m(h[z-1],h[z],d).y:m(h[z],h[z+1],d).x;return q}function hn(e){var t=Gt(e);if(t.curve)return Yt(t.curve);for(var n=ln(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C",...dn(t.x,t.y,...e.slice(1))];break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r,...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",...un(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",...un(t.x,t.y,e[1],e[2],e[3],e[4])];break;case"L":e=["C",...pn(t.x,t.y,e[1],e[2])];break;case"H":e=["C",...pn(t.x,t.y,e[1],t.y)];break;case"V":e=["C",...pn(t.x,t.y,t.x,e[1])];break;case"Z":e=["C",...pn(t.x,t.y,t.X,t.Y)]}return e},o=function(e,t){if(e[t].length>7){e[t].shift();for(var i=e[t];i.length;)s[t]="A",e.splice(t++,0,["C",...i.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]=r(n[c],i,l),"A"!=s[c]&&"C"==a&&(s[c]="C"),o(n,c);var u=n[c],d=u.length;i.x=u[d-2],i.y=u[d-1],i.bx=jt(u[d-4])||i.x,i.by=jt(u[d-3])||i.y}return t.curve=Yt(n),n}function mn(e){return p(e)&&m(e,"waypoints")}function fn(e){return p(e)&&m(e,"labelTarget")}function gn(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function vn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function bn(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function wn(e){for(var t=e.waypoints,n=t.reduce((function(e,n,i){var r=t[i-1];if(r){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))}(r,n);e.push({start:r,end:n,startLength:s,endLength:s+a,length:a})}return e}),[]),i=n.reduce((function(e,t){return e+t.length}),0),r=i/2,o=0,s=n[o];s.endLength<r;)s=n[++o];var a=(r-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 xn(e){return mn(e)?wn(e):yn({x:(t=e).x+(t.width||0)/2,y:t.y+(t.height||0)/2});var t}function _n(e,t,n){p(n=n||0)||(n={x:n,y:n});var i=vn(e),r=vn(t),o=i.bottom+n.y<=r.top,s=i.left-n.x>=r.right,a=i.top-n.y>=r.bottom,l=o?"top":a?"bottom":null,c=i.right+n.x<=r.left?"left":s?"right":null;return c&&l?l+"-"+c:c||l||"intersect"}function En(e,t,n){var i=function(e,t){return an(e,t)}(e,t);return 1===i.length||2===i.length&&Ct(i[0],i[1])<1?yn(i[0]):i.length>1?(i=A(i,(function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t})),yn(i[n?0:i.length-1])):null}function On(e,t){return Math.round(e*t)/t}function Pn(e){return u(e)?e+"px":e}function kn(e,t,n){const i=Be("g");Se(i).add(t);const r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Sn={shape:["x","y","width","height"],connection:["waypoints"]};function Cn(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._init(e||{})}function An(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Cn.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Cn.prototype._init=function(e){const t=this._eventBus,n=this._container=function(e){const t=(e=I({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),G(n,{position:"relative",overflow:"hidden",width:Pn(e.width),height:Pn(e.height)}),t.appendChild(n),n}(e),i=this._svg=Be("svg");Pe(i,{width:"100%",height:"100%"}),xe(n,i);const r=this._viewport=kn(i,"viewport");e.deferUpdate&&(this._viewboxChanged=B(j(this._viewboxChanged,this),300)),t.on("diagram.init",(()=>{t.fire("canvas.init",{svg:i,viewport:r})})),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)},Cn.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},Cn.prototype._clear=function(){this._elementRegistry.getAll().forEach((e=>{const t=wt(e);"root"===t?this.removeRootElement(e):this._removeElement(e,t)})),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Cn.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Cn.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},Cn.prototype._getChildIndex=function(e){return w(this._layers,(function(t,n){return n.visible&&e>=n.index&&t++,t}),0)},Cn.prototype._createLayer=function(e,t){void 0===t&&(t=1);const n=this._getChildIndex(t);return{group:kn(this._viewport,"layer-"+e,n),index:t,visible:!0}},Cn.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,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Cn.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?(Ae(n),t.visible=!1,n):n},Cn.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ae(t.group))},Cn.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Cn.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},Cn.prototype.getRootElements=function(){return this._planes.map((function(e){return e.rootElement}))},Cn.prototype._findPlaneForRoot=function(e){return f(this._planes,(function(t){return t.rootElement===e}))},Cn.prototype.getContainer=function(){return this._container},Cn.prototype._updateMarker=function(e,t,n){let i;e.id||(e=this._elementRegistry.get(e)),i=this._elementRegistry._elements[e.id],i&&(v([i.gfx,i.secondaryGfx],(function(e){e&&(n?Se(e).add(t):Se(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Cn.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Cn.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Cn.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));return Se(this.getGraphics(e)).has(t)},Cn.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Cn.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Cn.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 i=this.getLayer(n,0);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Cn.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},Cn.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},Cn.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)},Cn.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Cn.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})},Cn.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=Sn[e],i=x(n,(function(e){return void 0!==t[e]}));if(!i)throw new Error("must supply { "+n.join(", ")+" } with "+e)},Cn.prototype._setParent=function(e,t,n){kt(t.children,e,n),e.parent=t},Cn.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const s=o.create(e,t,i);return this._elementRegistry.add(t,s),o.update(e,t,s),r.fire(e+".added",{element:t,gfx:s}),t},Cn.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Cn.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Cn.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),Pt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Cn.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Cn.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Cn.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Cn.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Cn.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Cn.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;const t=this._viewport,n=this.getSize();let i,r,o,s,a,l,c;return e?(this._changeViewbox((function(){a=Math.min(n.width/e.width,n.height/e.height);const i=this._svg.createSVGMatrix().scale(a).translate(-e.x,-e.y);Ge(t,i)})),e):(o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},s=Ge(t),r=s?s.matrix:function(e,t,n,i,r,o){var s=Ie().createSVGMatrix();switch(arguments.length){case 0:return s;case 1:return $e(s,e);case 6:return $e(s,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),a=On(r.a,1e3),l=On(-r.e||0,1e3),c=On(-r.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:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n})},Cn.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox((function(){e=I({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),An(t,n)})),{x:n.e,y:n.f}},Cn.prototype.scrollToElement=function(e,t){let n=100;"string"==typeof e&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===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 r=bt(e),o=vn(r),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=vn(s);if(r.width<s.width&&r.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),i=Math.min(0,o.top-p.top);l=e||t,c=n||i}else l=r.x-s.x,c=r.y-s.y;this.scroll({dx:-l*a,dy:-c*a})},Cn.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if("fit-viewport"===e)return this._fitViewport(t);let n,i;return this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)})),On(i.a,1e3)},Cn.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Cn.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let s,a,l,c,p;l=i.getCTM();const u=l.a;return t?(s=I(o,t),a=s.matrixTransform(l.inverse()),c=r.translate(a.x,a.y).scale(1/u*e).translate(-a.x,-a.y),p=l.multiply(c)):p=r.scale(e),An(this._viewport,p),p},Cn.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Cn.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}},Cn.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Tn="data-element-id";function Mn(e){this._elements={},this._eventBus=e}function Rn(e,t,n){var i=function(e,t,n,i){var r=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,r,i)),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,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach((function(i){e.set(i,t.inverse,n)}))}function Dn(e,t){if(!(this instanceof Dn))return new Dn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Mn.$inject=["eventBus"],Mn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Pe(t,Tn,i),n&&Pe(n,Tn,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Mn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Pe(i.gfx,Tn,""),i.secondaryGfx&&Pe(i.secondaryGfx,Tn,""),delete t[n])},Mn.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Mn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Pe(t,Tn,i),t},Mn.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Pe(e,Tn);var n=this._elements[t];return n&&n.element},Mn.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},Mn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=t[n[i]],o=r.element;if(e(o,r.gfx))return o}},Mn.prototype.getAll=function(){return this.filter((function(e){return e}))},Mn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)}))},Mn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Mn.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")},Dn.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?Rn(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},Dn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return function(e){return!0===e.__refs_collection}(n)||Rn(this,t,e),n},Dn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Dn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Dn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nn=new Dn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Bn=new Dn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),jn=new Dn({name:"attachers",collection:!0},{name:"host"}),In=new Dn({name:"outgoing",collection:!0},{name:"source"}),$n=new Dn({name:"incoming",collection:!0},{name:"target"});function Ln(){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)}}),Nn.bind(this,"parent"),Bn.bind(this,"labels"),In.bind(this,"outgoing"),$n.bind(this,"incoming")}function qn(){Ln.call(this),Nn.bind(this,"children"),jn.bind(this,"host"),jn.bind(this,"attachers")}function zn(){Ln.call(this),Nn.bind(this,"children")}function Vn(){qn.call(this),Bn.bind(this,"labelTarget")}function Fn(){Ln.call(this),In.bind(this,"source"),$n.bind(this,"target")}e(qn,Ln),e(zn,qn),e(Vn,qn),e(Fn,Ln);var Hn={connection:Fn,shape:qn,label:Vn,root:zn};function Un(){this._uid=12}Un.prototype.createRoot=function(e){return this.create("root",e)},Un.prototype.createLabel=function(e){return this.create("label",e)},Un.prototype.createShape=function(e){return this.create("shape",e)},Un.prototype.createConnection=function(e){return this.create("connection",e)},Un.prototype.create=function(e,t){return(t=I({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Hn[e];if(!n)throw new Error("unknown type: <"+e+">");return I(new n,t)}(e,t)};var Wn="__fn",Qn=Array.prototype.slice;function Gn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Xn(){}function Kn(e){return e.childNodes[0]}function Yn(e,t,n,i,r){var o=Le();o.setTranslate(t,n);var s=Le();s.setRotate(i||0,0,0);var a=Le();a.setScale(r||1,r||1),Ge(e,[o,s,a])}function Zn(e,t,n){var i=Le();i.setTranslate(t,n),Ge(e,i)}function Jn(e,t){var n=Le();n.setRotate(t,0,0),Ge(e,n)}function ei(e,t){this._eventBus=e,this._elementRegistry=t}function ti(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}Gn.prototype.on=function(e,t,n,i){if(e=c(e)?e:[e],d(t)&&(i=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");var r=n;i&&((r=j(n,i))[Wn]=n[Wn]||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},Gn.prototype.once=function(e,t,n,i){var r=this;if(d(t)&&(i=n,n=t,t=1e3),!u(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var t=n.apply(i,arguments);return r.off(e,o),t}o[Wn]=n,this.on(e,t,o)},Gn.prototype.off=function(e,t){e=c(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Gn.prototype.createEvent=function(e){var t=new Xn;return t.init(e),t},Gn.prototype.fire=function(e,t){var n,i,r,o;if(o=Qn.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Xn?t:this.createEvent(t),o[0]=n;var s=n.type;e!==s&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==s&&(n.type=s)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Gn.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Gn.prototype._destroy=function(){this._listeners={}},Gn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Gn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=function(e,t){return e.apply(null,t)}(n.callback,t),void 0!==i&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener",e),e}return i},Gn.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},Gn.prototype._getListeners=function(e){return this._listeners[e]},Gn.prototype._setListeners=function(e,t){this._listeners[e]=t},Gn.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r[Wn]!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},Xn.prototype.stopPropagation=function(){this.cancelBubble=!0},Xn.prototype.preventDefault=function(){this.defaultPrevented=!0},Xn.prototype.init=function(e){I(this,e||{})},ei.$inject=["eventBus","elementRegistry"],ei.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n),t||(Se(t=Be("g")).add("djs-children"),xe(n.parentNode,t))):t=n,t},ei.prototype._clear=function(e){var t=Kn(e);return J(t),t},ei.prototype._createContainer=function(e,t,n,i){var r=Be("g");Se(r).add("djs-group"),void 0!==n?ti(r,t,t.childNodes[n]):xe(t,r);var o=Be("g");Se(o).add("djs-element"),Se(o).add("djs-"+e),i&&Se(o).add("djs-frame"),xe(r,o);var s=Be("g");return Se(s).add("djs-visual"),xe(o,s),o},ei.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,xt(t))},ei.prototype.updateContainments=function(e){var t,n=this,i=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 r=n._getChildrenContainer(e);v(t.slice().reverse(),(function(e){ti(i.getGraphics(e).parentNode,r)}))}}))},ei.prototype.drawShape=function(e,t,n={}){return this._eventBus.fire("render.shape",{gfx:e,element:t,attrs:n})},ei.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},ei.prototype.drawConnection=function(e,t,n={}){return this._eventBus.fire("render.connection",{gfx:e,element:t,attrs:n})},ei.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},ei.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Zn(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?Pe(n,"display","none"):Pe(n,"display","block")}},ei.prototype.remove=function(e){Ae(this._elementRegistry.getGraphics(e).parentNode)};var ni={__depends__:[Ot],__init__:["canvas"],canvas:["type",Cn],elementRegistry:["type",Mn],elementFactory:["type",Un],eventBus:["type",Gn],graphicsFactory:["type",ei]};function ii(e){return function(e){var t=new it(e);return t.init(),t}([{config:["value",e=e||{}]},ni].concat(e.modules||[]))}function ri(e,t){this._injector=t||ii(e),this.get("eventBus").fire("diagram.init")}function oi(){}function si(e,t){this.model=e,this.properties=t}ri.prototype.get=function(e,t){return this._injector.get(e,t)},ri.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ri.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ri.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},oi.prototype.get=function(e){return this.$model.properties.get(this,e)},oi.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},si.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(oi.prototype);v(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),v(e,j((function(e,t){this.set(t,e)}),this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var ai={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},li={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 ci(e,t){var n=li[e];return n?n(t):t}function pi(e){return!!ai[e]}function ui(e){return!!li[e]}function di(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function hi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mi(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,v(e,j(this.registerPackage,this))}function fi(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function gi(e){this.model=e}function yi(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function vi(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new gi(this),this.factory=new si(this,this.properties),this.registry=new mi(e,this.properties),this.typeCache={},this.config=t}hi.prototype.build=function(){return L(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},hi.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},hi.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=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=r.indexOf(e);if(-1===a)throw new Error("property <"+i.name+"> not found in property list");r.splice(a,1),this.addProperty(t,n?void 0:a,s),o[i.name]=o[i.localName]=t},hi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=di(r[0],i),s=di(r[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},hi.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},hi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},hi.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},hi.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},hi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},hi.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},hi.prototype.hasProperty=function(e){return this.propertiesByName[e]},hi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(v(e.properties,j((function(n){n=I({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},mi.prototype.getPackage=function(e){return this.packageMap[e]},mi.prototype.getPackages=function(){return this.packages},mi.prototype.registerPackage=function(e){e=I({},e);var t=this.packageMap;fi(t,e,"prefix"),fi(t,e,"uri"),v(e.types,j((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mi.prototype.registerType=function(e,t){var n=di((e=I({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:I(e.meta||{})})).name,t.prefix),i=n.name,r={};v(e.properties,j((function(e){var t=di(e.name,n.prefix),i=t.name;pi(e.type)||(e.type=di(e.type,t.prefix).name),I(e,{ns:t,name:i}),r[i]=e}),this)),I(e,{ns:n,name:i,propertiesByName:r}),v(e.extends,j((function(e){var t=di(e,n.prefix),r=this.typeMap[t.name];r.traits=r.traits||[],r.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},mi.prototype.mapTypes=function(e,t,n){var i=pi(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(n,i){var o=di(n,pi(n)?"":e.prefix);r.mapTypes(o,t,i)}function s(e){return o(e,!0)}if(!i)throw new Error("unknown type <"+e.name+">");v(i.superClass,n?s:function(e){return o(e,!1)}),t(i,!n),v(i.traits,s)},mi.prototype.getEffectiveDescriptor=function(e){var t=di(e),n=new hi(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},mi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},gi.prototype.set=function(e,t,n){if(!h(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[vi(t)]:i?r in e?e[r]=n:yi(e,i,n):e.$attrs[vi(t)]=n},gi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[vi(t)];var i=n.name;return!e[i]&&n.isMany&&yi(e,n,[]),e[i]},gi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;delete(n=I({},n,{get:function(){return i}})).value}Object.defineProperty(e,t,n)},gi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},gi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},gi.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(void 0!==r){const n=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw n;"undefined"!=typeof console&&console.warn(n)}return null},bi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bi.prototype.getType=function(e){var t=this.typeCache,n=h(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bi.prototype.createAny=function(e,t,n){var i=di(e),r={$type:e,$instanceOf:function(e){return e===this.$type},get:function(e){return this[e]},set:function(e,t){$(this,[e],t)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),v(n,(function(e,t){p(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},bi.prototype.getPackage=function(e){return this.registry.getPackage(e)},bi.prototype.getPackages=function(){return this.registry.getPackages()},bi.prototype.getElementDescriptor=function(e){return e.$descriptor},bi.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},bi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var wi=String.fromCharCode,xi=Object.prototype.hasOwnProperty,_i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Ei={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Oi(e,t,n,i){return i?xi.call(Ei,i)?Ei[i]:"&"+i+";":wi(t||parseInt(n,16))}function Pi(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(_i,Oi):e}Object.keys(Ei).forEach((function(e){Ei[e.toUpperCase()]=Ei[e]}));var ki="xsi:type",Si="non-whitespace outside of root node";function Ci(e){return new Error(e)}function Ai(e){return"missing namespace for prefix <"+e+">"}function Ti(e){return{get:e,enumerable:!0}}function Mi(e){var t,n={};for(t in e)n[t]=e[t];return n}function Ri(e){return e+"$uri"}function Di(){return{line:0,column:0}}function Ni(e){throw e}function Bi(e){if(!this)return new Bi(e);var t,n,i,r,o,s,a,l,c,p=e&&e.proxy,u=Ni,d=Di,h=!1,m=!1,f=null,g=!1;function y(e){e instanceof Error||(e=Ci(e)),f=e,u(e,d)}function v(e){o&&(e instanceof Error||(e=Ci(e)),o(e,d))}this.on=function(e,c){if("function"!=typeof c)throw Ci("required args <name, cb>");switch(e){case"openTag":n=c;break;case"text":t=c;break;case"closeTag":i=c;break;case"error":u=c;break;case"warn":o=c;break;case"cdata":r=c;break;case"attention":l=c;break;case"question":a=c;break;case"comment":s=c;break;default:throw Ci("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Ci("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",m=!0,c=n,this},this.parse=function(e){if("string"!=typeof e)throw Ci("required args <xml=string>");return f=null,function(e){var o,u,f,b,w,x,_,E,O,P,k,S=m?[]:null,C=m?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Ri(n)]=t;return i}(c):null,A=[],T=0,M=!1,R=!1,D=0,N=0,B="",j=0;function I(){if(null!==k)return k;var e,t,n,i,r,o,s,a,l,p,u,d=m&&C.xmlns,f=m&&h?[]:null,g=j,y=B,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,m)if(h){if(null!==(r="xmlns"===a?"xmlns":120===a.charCodeAt(0)&&"xmlns:"===a.substr(0,6)?a.substr(6):null)){if(e=Pi(o),t=Ri(r),!(s=c[e])){if("xmlns"===r||t in C&&C[t]!==e)do{s="ns"+T++}while(void 0!==C[s]);else s=r;c[e]=s}C[r]!==s&&(i||(C=Mi(C),i=!0),C[r]=s,"xmlns"===r&&(C[Ri(s)]=e,d=s),C[t]=e),w[a]=o;continue}f.push(a,o)}else-1!==(p=a.indexOf(":"))?(n=C[a.substring(0,p)])?((a=d===n?a.substr(p+1):n+a.substr(p))===ki&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=d+":"+o),w[a]=o):v(Ai(a.substring(0,p))):w[a]=o;else w[a]=o}if(h)for(g=0,b=f.length;g<b;g++){if(a=f[g++],o=f[g],-1!==(p=a.indexOf(":"))){if(!(n=C[a.substring(0,p)])){v(Ai(a.substring(0,p)));continue}(a=d===n?a.substr(p+1):n+a.substr(p))===ki&&(-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),o=(n=C[n]||n)+o.substring(p)):o=d+":"+o)}w[a]=o}return k=w}function $(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,s=0,a=N;D>=s&&(t=i.exec(e))&&!((a=t[0].length+t.index)>D);)r+=1,s=a;return-1==D?(o=a,n=e.substring(N)):0===N?n=e.substring(N,D):(o=D-s,n=-1==N?e.substring(D):e.substring(D,N+1)),{data:n,line:r,column:o}}d=$,p&&(P=Object.create({},{name:Ti((function(){return E})),originalName:Ti((function(){return O})),attrs:Ti(I),ns:Ti((function(){return C}))}));for(;-1!==N;){if(-1===(D=60===e.charCodeAt(N)?N:e.indexOf("<",N)))return A.length?y("unexpected end of file"):0===N?y("missing start tag"):void(N<e.length&&e.substring(N).trim()&&v(Si));if(N!==D)if(A.length){if(t&&(t(e.substring(N,D),Pi,d),g))return}else if(e.substring(N,D).trim()&&(v(Si),g))return;if(33===(w=e.charCodeAt(D+1))){if(91===(b=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(N=e.indexOf("]]>",D)))return y("unclosed cdata");if(r&&(r(e.substring(D+9,N),d),g))return;N+=3;continue}if(45===b&&45===e.charCodeAt(D+3)){if(-1===(N=e.indexOf("--\x3e",D)))return y("unclosed comment");if(s&&(s(e.substring(D+4,N),Pi,d),g))return;N+=3;continue}}if(63!==w){for(u=D+1;;u++){if(x=e.charCodeAt(u),isNaN(x))return N=-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){N=u;break}}if(33!==w){if(k={},47===w){if(M=!1,R=!0,!A.length)return y("missing open tag");if(u=E=A.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return y("closing tag mismatch");for(;b<N;b++)if(!(32===(w=e.charCodeAt(b))||w>8&&w<14))return y("close tag")}else{if(47===e.charCodeAt(N-1)?(u=E=e.substring(D+1,N-1),M=!0,R=!0):(u=E=e.substring(D+1,N),M=!0,R=!1),!(w>96&&w<123||w>64&&w<91||95===w||58===w))return y("illegal first char nodeName");for(b=1,f=u.length;b<f;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){E=u.substring(0,b),k=null;break}return y("invalid nodeName")}R||A.push(E)}if(m){if(o=C,M&&(R||S.push(o),null===k&&(h=-1!==u.indexOf("xmlns",b))&&(j=b,B=u,I(),h=!1)),O=E,-1!==(w=E.indexOf(":"))){if(!(_=C[E.substring(0,w)]))return y("missing namespace on <"+O+">");E=E.substr(w+1)}else _=C.xmlns;_&&(E=_+":"+E)}if(M&&(j=b,B=u,n&&(p?n(P,Pi,R,d):n(E,I,Pi,R,d),g)))return;if(R){if(i&&(i(p?P:E,Pi,M,d),g))return;m&&(C=M?o:S.pop())}N+=1}else{if(l&&(l(e.substring(D,N+1),Pi,d),g))return;N+=1}}else{if(-1===(N=e.indexOf("?>",D)))return y("unclosed question");if(a&&(a(e.substring(D,N+2),d),g))return;N+=2}}}(e),d=Di,g=!1,f},this.stop=function(){g=!0}}function ji(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Ii={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},$i="xsi:type";function Li(e){return e.xml&&e.xml.serialize}function qi(e){return Li(e)===$i}function zi(e,t){return ji(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Vi(e){return new Error(e)}function Fi(e){return e.$descriptor}function Hi(e){I(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Vi("expected element");var t,n=this.elementsById,i=Fi(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Vi("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Ui(){}function Wi(){}function Qi(){}function Gi(e,t){this.property=e,this.context=t}function Xi(e,t){this.element=t,this.propertyDesc=e}function Ki(){}function Yi(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Zi(e,t,n){Yi.call(this,e,t,n)}function Ji(e,t,n){this.model=e,this.context=n}function er(e){e instanceof bi&&(e={model:e}),I(this,{lax:!1},e)}Ui.prototype.handleEnd=function(){},Ui.prototype.handleText=function(){},Ui.prototype.handleNode=function(){},Wi.prototype=Object.create(Ui.prototype),Wi.prototype.handleNode=function(){return this},Qi.prototype=Object.create(Ui.prototype),Qi.prototype.handleText=function(e){this.body=(this.body||"")+e},Gi.prototype=Object.create(Qi.prototype),Gi.prototype.handleNode=function(e){if(this.element)throw Vi("expected no sub nodes");return this.element=this.createReference(e),this},Gi.prototype.handleEnd=function(){this.element.id=this.body},Gi.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Xi.prototype=Object.create(Qi.prototype),Xi.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ci(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ki.prototype=Object.create(Qi.prototype),Ki.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},Yi.prototype=Object.create(Ki.prototype),Yi.prototype.addReference=function(e){this.context.addReference(e)},Yi.prototype.handleText=function(e){if(!Fi(this.element).bodyProperty)throw Vi("unexpected body text <"+e+">");Qi.prototype.handleText.call(this,e)},Yi.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Fi(t).bodyProperty;n&&void 0!==e&&(e=ci(n.type,e),t.set(n.name,e))},Yi.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=Fi(i),o=this.context,s=new i({}),a=this.model;return v(n,(function(e,n){var i=r.propertiesByName[n];i&&i.isReference?i.isMany?v(e.split(" "),(function(e){o.addReference({element:s,property:i.ns.name,id:e})})):o.addReference({element:s,property:i.ns.name,id:e}):(i?e=ci(i.type,e):"xmlns"!==n&&(t=di(n,r.ns.prefix),a.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:s,property:n,value:e})),s.set(n,e))})),s},Yi.prototype.getPropertyForNode=function(e){var t,n,i=di(e.name),r=this.type,o=this.model,s=Fi(r),a=i.name,l=s.propertiesByName[a];if(l&&!l.isAttr)return qi(l)&&(t=e.attributes[$i])?(t=function(e,t){var n=di(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),I({},l,{effectiveType:Fi(n=o.getType(t)).name})):l;var c=o.getPackage(i.prefix);if(c){if(t=zi(i,c),n=o.getType(t),l=f(s.properties,(function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)})),l)return I({},l,{effectiveType:Fi(n).name})}else if(l=f(s.properties,(function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type})),l)return l;throw Vi("unrecognized element <"+i.name+">")},Yi.prototype.toString=function(){return"ElementDescriptor["+Fi(this.type).name+"]"},Yi.prototype.valueHandler=function(e,t){return new Xi(e,t)},Yi.prototype.referenceHandler=function(e){return new Gi(e,this.context)},Yi.prototype.handler=function(e){return"Element"===e?new Ji(this.model,e,this.context):new Yi(this.model,e,this.context)},Yi.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,ui(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(I(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},Zi.prototype=Object.create(Yi.prototype),Zi.prototype.createElement=function(e){var t=e.name,n=di(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),s=o&&zi(n,o)||t;if(!r.hasType(s))throw Vi("unexpected element <"+e.originalName+">");return Yi.prototype.createElement.call(this,e)},Ji.prototype=Object.create(Ki.prototype),Ji.prototype.createElement=function(e){var t=e.name,n=di(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Ji.prototype.handleChild=function(e){var t=new Ji(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},Ji.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},er.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yi?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,s=new Hi(I({},t,{rootHandler:i})),a=new Bi({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 i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var l="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return s.addWarning({message:l,error:e}),!0;throw Vi(l)}function p(e,t){return c(e,t,!0)}i.context=s,l.push(i);var u=/^<\?xml /i,d=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(e,t){try{l.peek().handleText(e)}catch(e){p(e,t)}}var f=r.getPackages().reduce((function(e,t){return e[t.uri]=t.prefix,e}),{"http://www.w3.org/XML/1998/namespace":"xml"});return a.ns(f).on("openTag",(function(e,t,n,i){var r=e.attrs||{},s=Object.keys(r).reduce((function(e,n){var i=t(r[n]);return e[n]=i,e}),{});!function(e,t){var n=l.peek();try{l.push(n.handleNode(e))}catch(e){c(e,t,o)&&l.push(new Wi)}}({name:e.name,originalName:e.originalName,attributes:s,ns:e.ns},i)})).on("question",(function(e){if(u.test(e)){var t=d.exec(e),n=t&&t[1];n&&!h.test(n)&&s.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}})).on("closeTag",(function(){l.pop().handleEnd()})).on("cdata",m).on("text",(function(e,t,n){!function(e,t){e.trim()&&m(e,t)}(t(e),n)})).on("error",c).on("warn",p),new Promise((function(t,n){var r;try{a.parse(e),function(){var e,t,n=s.elementsById,i=s.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=Fi(r).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=r.get(a.name),c=l.indexOf(t);-1===c&&(c=l.length),o?l[c]=o:l.splice(c,1)}else r.set(a.name,o)}}()}catch(e){r=e}var o=i.element;r||o||(r=Vi("failed to parse document as <"+i.type.$descriptor.name+">"));var l=s.warnings,c=s.references,p=s.elementsById;return r?(r.warnings=l,n(r)):t({rootElement:o,elementsById:p,references:c,warnings:l})}))},er.prototype.handler=function(e){return new Zi(this.model,e)};var tr=/<|>|'|"|&|\n\r|\n/g,nr=/<|>|&/g;function ir(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.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,r=this.getNSKey(t);i[r]=this.byUri(n),e&&e.logUsed(t)},this.getUsed=function(e){var t=this;return[].concat(r,o).filter((function(e){var n=t.getNSKey(e);return i[n]}))}}function rr(e,t){return ji(t)?function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(e):e}function or(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function sr(e){return h(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var ar={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},lr={"<":"lt",">":"gt","&":"amp"};function cr(e,t,n){return(e=h(e)?e:""+e).replace(t,(function(e){return"&"+n[e]+";"}))}function pr(e){this.tagName=e}function ur(){}function dr(e){this.tagName=e}function hr(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function mr(e,t){hr.call(this,e,t)}function fr(){this.value="",this.write=function(e){this.value+=e}}function gr(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 yr(e){return e=I({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new fr,r=new gr(i,e.format);if(e.preamble&&r.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new hr).build(t).serializeTo(r),!n)return i.value}}}function vr(e,t){bi.call(this,e,t)}pr.prototype.build=function(e){return this.element=e,this},pr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},ur.prototype.serializeValue=ur.prototype.serializeTo=function(e){e.append(this.escape?cr(this.value,nr,lr):this.value)},ur.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(nr)&&(this.escape=!0),this},or(dr,ur),dr.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},hr.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){return y(e.$descriptor.properties,(function(t){var n=t.name;if(t.isVirtual)return!1;if(!m(e,n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.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},hr.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?I({localName:t.ns.localName},e):I({localName:rr(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},hr.prototype.nsPropertyTagName=function(e){return function(e,t){return I({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},hr.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},hr.prototype.nsAttributeName=function(e){var t;if(t=h(e)?di(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}:I({localName:t.localName},n)},hr.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return v(e,(function(r,o){"$body"===o?n.push((new ur).build({type:"String"},r)):"$children"===o?v(r,(function(e){n.push(new hr(t).build(e))})):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})})),i},hr.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=di(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var s=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(s)}},hr.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return v(i,(function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)})),r},hr.prototype.parseGenericAttributes=function(e,t){var n=this;v(t,(function(t){if(t.name!==$i)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}}))},hr.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;v(e,(function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new ur).build(e,r[0]));else if(ui(e.type))v(r,(function(i){n.push(new dr(t.addTagName(t.nsPropertyTagName(e))).build(e,i))}));else if(o)v(r,(function(i){n.push(new pr(t.addTagName(t.nsPropertyTagName(e))).build(i))}));else{var s=qi(e),a=function(e){return"property"===Li(e)}(e);v(r,(function(i){var r;r=s?new mr(t,e):a?new hr(t,e):new hr(t),n.push(r.build(i))}))}}))},hr.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ir(t):n=t),n},hr.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)&&!n||i.add(e,t),i.mapPrefix(o,r),e},hr.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,s=this.getNamespaces(t),a=e.prefix,l=e.uri;if(!a&&!l)return{localName:e.localName};if(r=Ii[a]||o&&(o.getPackage(a)||{}).uri,!(l=l||r||s.uriByPrefix(a)))throw new Error("no namespace uri given for prefix <"+a+">");if(!(e=s.byUri(l))){for(n=a,i=1;s.uriByPrefix(n);)n=a+"_"+i++;e=this.logNamespace({prefix:n,uri:l},r===l)}return a&&s.mapPrefix(a,l),e},hr.prototype.parseAttributes=function(e){var t=this,n=this.element;v(e,(function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];v(i,(function(e){r.push(e.id)})),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)}))},hr.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),sr(e)},hr.prototype.addAttribute=function(e,t){var n=this.attrs;h(t)&&(t=cr(t,tr,ar));var i=g(n,(function(t){return t.name.localName===e.localName&&t.name.uri===e.uri&&t.name.prefix===e.prefix})),r={name:e,value:t};-1!==i?n.splice(i,1,r):n.push(r)},hr.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(sr(t.name)).append('="').append(t.value).append('"')}))},hr.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ur;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()},or(mr,hr),mr.prototype.parseNsAttributes=function(e){var t=hr.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName($i),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},mr.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},vr.prototype=Object.create(bi.prototype),vr.prototype.fromXML=function(e,t,n){h(t)||(n=t,t="bpmn:Definitions");var i=new er(I({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},vr.prototype.toXML=function(e,t){var n=new yr(t);return new Promise((function(t,i){try{return t({xml:n.toXML(e)})}catch(e){return i(e)}}))};var br={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 wr(e,t){return new vr(I({},br,e),t)}function xr(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var _r="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 Er(e){m(e,"di")||Object.defineProperty(e,"di",{enumerable:!1,get:function(){throw new Error(_r)}})}function Or(e,t){return e.$instanceOf(t)}function Pr(e,t){var n={},i=[],r={};function o(e,t){return function(n){e(n,t)}}function s(e){n[e.id]=e}function a(n,i){try{var o=r[n.id]&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:xr(n)}));return e.element(n,r[n.id],i)}(n,i);return s(n),o}catch(e){l(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:xr(n)})),console.error(e)}}function l(t,n){e.error(t,n)}var c=this.registerDi=function(e){var n=e.bpmnElement;n?r[n.id]?l(t("multiple DI elements defined for {element}",{element:xr(n)}),{element:n}):(r[n.id]=e,Er(n)):l(t("no bpmnElement referenced in {element}",{element:xr(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"));r={},p(a);var g=a.plane;if(!g)throw new Error(t("no plane for {element}",{element:xr(a)}));var b=g.bpmnElement;if(!b){if(b=function(e){return f(e.rootElements,(function(e){return Or(e,"bpmn:Process")||Or(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:xr(g),rootElement:xr(b)})),g.bpmnElement=b,c(g)}var w,x,E=function(t,n){return e.root(t,r[t.id],n)}(b,g);if(Or(b,"bpmn:Process")||Or(b,"bpmn:SubProcess"))h(b,E);else{if(!Or(b,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:xr(g),rootElement:xr(b)}));x=E,v((w=b).participants,o(T,x)),_(w.artifacts,x),i.push((function(){!function(e,t){v(e,o(m,t))}(w.messageFlows,x)})),function(e,t){var i=y(e,(function(e){return!n[e.id]&&Or(e,"bpmn:Process")&&e.laneSets}));i.forEach(o(h,t))}(s.rootElements,E)}d(i)};var d=this.handleDeferred=function(){for(;i.length;)i.shift()()};function h(e,t){A(e,t),E(e.ioSpecification,t),_(e.artifacts,t),s(e)}function m(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){Or(e,"bpmn:Association")?i.push((function(){x(e,t)})):x(e,t)}))}function E(e,t){e&&(v(e.dataInputs,o(b,t)),v(e.dataOutputs,o(w,t)))}var O=this.handleSubProcess=function(e,t){A(e,t),_(e.artifacts,t)};function P(e,t){var n=a(e,t);Or(e,"bpmn:SubProcess")&&O(e,n||t),Or(e,"bpmn:Activity")&&E(e.ioSpecification,t),i.push((function(){v(e.dataInputAssociations,o(g,t)),v(e.dataOutputAssociations,o(g,t))}))}function k(e,t){a(e,t)}function S(e,t){i.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 A(e,n){!function(e,n){v(e,(function(e){Or(e,"bpmn:SequenceFlow")?i.push((function(){!function(e,t){a(e,t)}(e,n)})):Or(e,"bpmn:BoundaryEvent")?i.unshift((function(){P(e,n)})):Or(e,"bpmn:FlowNode")?P(e,n):Or(e,"bpmn:DataObject")||(Or(e,"bpmn:DataStoreReference")||Or(e,"bpmn:DataObjectReference")?k(e,n):l(t("unrecognized flowElement {element} in context {context}",{element:xr(e),context:n?xr(n.businessObject):"null"}),{element:e,context:n}))}))}(e.flowElements,n),e.laneSets&&function(e,t){v(e,o(C,t))}(e.laneSets,n)}function T(e,t){var n=a(e,t),i=e.processRef;i&&h(i,n||t)}}function kr(e,t){var n=Cr(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Sr(e,t){return _(t,(function(t){return kr(e,t)}))}function Cr(e){return e&&e.businessObject||e}function Ar(e){return e&&e.di}function Tr(e,t,n){var i,r,o,s,a=[];function l(e,t){var n=new Pr({root:function(e,t){return i.add(e,t)},element:function(e,t,n){return i.add(e,t,n)},error:function(e,t){a.push({message:e,context:t})}},o);t=t||e.diagrams&&e.diagrams[0];var r=function(e,t){if(!t)return;var n,i=t.plane.bpmnElement,r=i;kr(i,"bpmn:Process")||kr(i,"bpmn:Collaboration")||(r=function(e){var t=e;for(;t;){if(kr(t,"bpmn:Process"))return t;t=t.$parent}}(i));n=kr(r,"bpmn:Collaboration")?r:f(e.rootElements,(function(e){if(kr(e,"bpmn:Collaboration"))return f(e.participants,(function(e){return e.processRef===r}))}));var o=[r];n&&(o=E(n.participants,(function(e){return e.processRef}))).push(n);var s=Mr(o),a=[t],l=[i];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(!r)throw new Error(o("no diagram to display"));v(r,(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 i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),s=e.get("canvas"),r.fire("import.render.start",{definitions:t}),l(t,n),r.fire("import.render.complete",{error:undefined,warnings:a}),c({warnings:a})}catch(e){return e.warnings=a,p(e)}}))}function Mr(e){var t=[];return v(e,(function(e){e&&(t.push(e),t=t.concat(Mr(e.flowElements)))})),t}var Rr,Dr='<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>',Nr={verticalAlign:"middle"},Br={color:"#404040"},jr={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Ir={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},$r={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"},Lr='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Dr+'</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 qr(){Rr||(G(Rr=ge(Lr),jr),G(ye("svg",Rr),Nr),G(ye(".backdrop",Rr),Ir),G(ye(".notice",Rr),$r),G(ye(".link",Rr),Br,{margin:"15px 20px 15px 10px",alignSelf:"center"}),de.bind(Rr,".backdrop","click",(function(e){document.body.removeChild(Rr)}))),document.body.appendChild(Rr)}function zr(e){e=I({},Fr,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),function(e){const t=ge('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Dr+"</a>");G(ye("svg",t),Nr),G(t,Br,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(t),ce.bind(t,"click",(function(e){qr(),e.preventDefault()}))}(this._container),this._init(this._container,this._moddle,e)}function Vr(e,t){return e.warnings=t,e}e(zr,ri),zr.prototype.importXML=async function(e,t){const n=this;let i=[];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;i=i.concat(l),s=this._emit("import.parse.complete",(r={error:null,definitions:s,elementsById:c,references:a,warnings:i},n.get("eventBus").createEvent(r)))||s;const p=await this.importDefinitions(s,t);return i=i.concat(p.warnings),this._emit("import.done",{error:null,warnings:i}),{warnings:i}}catch(e){let t=e;throw i=i.concat(t.warnings||[]),Vr(t,i),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 r},zr.prototype.importDefinitions=async function(e,t){this._setDefinitions(e);return{warnings:(await this.open(t)).warnings}},zr.prototype.open=async function(e){const t=this._definitions;let n=e;if(!t){const e=new Error("no XML imported");throw Vr(e,[]),e}if("string"==typeof e&&(n=function(e,t){if(!t)return null;return f(e.diagrams,(function(e){return e.id===t}))||null}(t,e),!n)){const t=new Error("BPMNDiagram <"+e+"> not found");throw Vr(t,[]),t}try{this.clear()}catch(e){throw Vr(e,[]),e}const{warnings:i}=await Tr(this,t,n);return{warnings:i}},zr.prototype.saveXML=async function(e){e=e||{};let t,n,i=this._definitions;try{if(!i)throw new Error("no definitions loaded");i=this._emit("saveXML.start",{definitions:i})||i;n=(await this._moddle.toXML(i,e)).xml,n=this._emit("saveXML.serialized",{xml:n})||n}catch(e){t=e}const r=t?{error:t}:{xml:n};if(this._emit("saveXML.done",r),t)throw t;return r},zr.prototype.saveSVG=async function(){let e,t;this._emit("saveSVG.start");try{const t=this.get("canvas"),n=t.getActiveLayer(),i=ye("defs",t._svg),r=We(n),o=i?"<defs>"+We(i)+"</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+r+"</svg>"}catch(e){t=e}if(this._emit("saveSVG.done",{error:t,svg:e}),t)throw t;return{svg:e}},zr.prototype._setDefinitions=function(e){this._definitions=e},zr.prototype.getModules=function(){return this._modules},zr.prototype.clear=function(){this.getDefinitions()&&ri.prototype.clear.call(this)},zr.prototype.destroy=function(){ri.prototype.destroy.call(this),be(this._container)},zr.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},zr.prototype.off=function(e,t){this.get("eventBus").off(e,t)},zr.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=ye(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},zr.prototype.getDefinitions=function(){return this._definitions},zr.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},zr.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),s=I(q(n,["additionalModules"]),{canvas:I({},n.canvas,{container:e}),modules:o});ri.call(this,s),n&&n.container&&this.attachTo(n.container)},zr.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},zr.prototype._createContainer=function(e){const t=ge('<div class="bjs-container"></div>');return G(t,{width:Hr(e.width),height:Hr(e.height),position:e.position}),t},zr.prototype._createModdle=function(e){return new wr(I({},this._moddleExtensions,e.moddleExtensions))},zr.prototype._modules=[];const Fr={width:"100%",height:"100%",position:"relative"};function Hr(e){return e+(u(e)?"px":"")}function Ur(e){zr.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 Wr(e,t){return!kr(e,"bpmn:CallActivity")&&(kr(e,"bpmn:SubProcess")?!(!(t=t||Ar(e))||!kr(t,"bpmndi:BPMNPlane"))||t&&!!t.isExpanded:!kr(e,"bpmn:Participant")||!!Cr(e).processRef)}function Qr(e){if(kr(e,"bpmn:Participant")||kr(e,"bpmn:Lane")){var t=Ar(e).isHorizontal;return void 0===t||t}}function Gr(e){return e&&!1!==Cr(e).isInterrupting}function Xr(e){return e&&!!Cr(e).triggeredByEvent}function Kr(e,t){return _(Cr(e).eventDefinitions,(function(e){return kr(e,t)}))}e(Ur,zr),Ur.prototype._createModdle=function(e){var t=zr.prototype._createModdle.call(this,e);return t.ids=new n([32,36,1]),t},Ur.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t)i.claim(n,t[n])};var Yr={width:90,height:20},Zr=15;function Jr(e){return kr(e,"bpmn:Event")||kr(e,"bpmn:Gateway")||kr(e,"bpmn:DataStoreReference")||kr(e,"bpmn:DataObjectReference")||kr(e,"bpmn:DataInput")||kr(e,"bpmn:DataOutput")||kr(e,"bpmn:SequenceFlow")||kr(e,"bpmn:MessageFlow")||kr(e,"bpmn:Group")}function eo(e){return fn(e.label)}function to(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=function(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),s=r.x,a=r.y;return Math.abs(o)<Math.PI/2?a-=Zr:s+=Zr,{x:s,y:a}}function no(e){return e.waypoints?to(e.waypoints):kr(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Yr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Yr.height/2}}function io(e){return kr(e,"bpmn:FlowElement")||kr(e,"bpmn:Participant")||kr(e,"bpmn:Lane")||kr(e,"bpmn:SequenceFlow")||kr(e,"bpmn:MessageFlow")||kr(e,"bpmn:DataInput")||kr(e,"bpmn:DataOutput")?"name":kr(e,"bpmn:TextAnnotation")?"text":kr(e,"bpmn:Group")?"categoryValueRef":void 0}function ro(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 oo(e,t){var n=e.businessObject,i=io(n);return i&&("categoryValueRef"===i?n.categoryValueRef.value=t:n[i]=t),e}var so="hsl(225, 10%, 15%)",ao="white";function lo(e,t){return _(e.eventDefinitions,(function(e){return e.$type===t}))}function co(e,t,n){var i=Ar(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||ao}function po(e,t,n){var i=Ar(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||so}function uo(e,t,n,i){var r=Ar(e).get("label");return i||r&&r.get("color:color")||t||po(e,n)}function ho(e,t={}){return{width:mo(e,t),height:fo(e,t)}}function mo(e,t={}){return m(t,"width")?t.width:e.width}function fo(e,t={}){return m(t,"height")?t.height:e.height}var go=new n,yo=.95;function vo(e,t,n,i,r,o,s){st.call(this,t,s);var a=e&&e.defaultFillColor,l=e&&e.defaultStrokeColor,c=e&&e.defaultLabelColor,u=go.next(),d={};function h(e){return n.computeStyle(e,{strokeLinecap:"round",strokeLinejoin:"round",stroke:so,strokeWidth:2,fill:"white"})}function m(e){return n.computeStyle(e,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:so,strokeWidth:2})}function f(e,t){var{ref:n={x:0,y:0},scale:i=1,element:o}=t,s=Be("marker",{id:e,viewBox:"0 0 20 20",refX:n.x,refY:n.y,markerWidth:20*i,markerHeight:20*i,orient:"auto"});xe(s,o);var a=ye("defs",r._svg);a||(a=Be("defs"),xe(r._svg,a)),xe(a,s),d[e]=s}function g(e){return e.replace(/[^0-9a-zA-Z]+/g,"_")}function y(e,t,n){var i=e+"-"+g(t)+"-"+g(n)+"-"+u;return d[i]||function(e,t,n,i){if("sequenceflow-end"===t){f(e,{element:Be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:i,stroke:i,strokeWidth:1})}),ref:{x:11,y:10},scale:.5})}if("messageflow-start"===t){f(e,{element:Be("circle",{cx:6,cy:6,r:3.5,...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6}})}if("messageflow-end"===t){f(e,{element:Be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:n,stroke:i,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5}})}if("association-start"===t){f(e,{element:Be("path",{d:"M 11 5 L 1 10 L 11 15",...m({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5})}if("association-end"===t){f(e,{element:Be("path",{d:"M 1 5 L 11 10 L 1 15",...m({fill:"none",stroke:i,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5})}if("conditional-flow-marker"===t){f(e,{element:Be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:n,stroke:i})}),ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){f(e,{element:Be("path",{d:"M 6 4 L 10 16",...h({stroke:i})}),ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function b(e,t,n,i,r={}){p(i)&&(r=i,i=0),i=i||0,r=h(r);var o=Be("circle",{cx:t/2,cy:n/2,r:Math.round((t+n)/4-i),...r});return xe(e,o),o}function w(e,t,n,i,r,o){p(r)&&(o=r,r=0),r=r||0,o=h(o);var s=Be("rect",{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i,...o});return xe(e,s),s}function x(e,t,n,i){var r=dt(t,n=m(n),i);return xe(e,r),r}function _(e,t,n){return x(e,t,n,5)}function E(e,t,n){n=m(n);var i=Be("path",{...n,d:t});return xe(e,i),i}function O(e,t,n,i){return E(t,n,I({"data-marker":e},i))}function P(e){return te[e]}function k(e){return function(t,n,i){return P(e)(t,n,i)}}var S=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:r?co(t,a,n.fill):po(t,l,n.stroke),strokeWidth:1})},C=function(e,t,n={}){var r=b(e,t.width,t.height,.2*t.height,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:2});E(e,i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{stroke:po(t,l,n.stroke),strokeWidth:2});for(var o=0;o<12;o++){var s=i.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;E(e,s,{strokeWidth:1,stroke:po(t,l,n.stroke),transform:"rotate("+30*o+","+p+","+c+")"})}return r},A=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},T=function(e,t,n={}){return E(e,i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},M=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},R=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},D=function(e,t,n={},r){var o=E(e,i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{fill:r?po(t,l,n.stroke):"none",stroke:po(t,l,n.stroke),strokeWidth:1});return Jn(o,45),o},N=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},B=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:r?po(t,l,n.stroke):co(t,a,n.fill),stroke:po(t,l,n.stroke)})},j=function(e,t,n={},r){return E(e,i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{fill:r?po(t,l,n.stroke):co(t,a,n.fill),strokeWidth:1})},$=function(e,t,n={}){return E(e,i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1})},L=function(e,t,n={}){return b(e,t.width,t.height,8,{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:4})};function q(e,t,n={}){var i=Cr(e),r=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(i);return i.get("eventDefinitions")&&i.get("eventDefinitions").length>1?i.get("parallelMultiple")?$(t,e,n,r):j(t,e,n,r):lo(i,"bpmn:MessageEventDefinition")?S(t,e,n,r):lo(i,"bpmn:TimerEventDefinition")?C(t,e,n,r):lo(i,"bpmn:ConditionalEventDefinition")?T(t,e,n,r):lo(i,"bpmn:SignalEventDefinition")?B(t,e,n,r):lo(i,"bpmn:EscalationEventDefinition")?A(t,e,n,r):lo(i,"bpmn:LinkEventDefinition")?M(t,e,n,r):lo(i,"bpmn:ErrorEventDefinition")?R(t,e,n,r):lo(i,"bpmn:CancelEventDefinition")?D(t,e,n,r):lo(i,"bpmn:CompensateEventDefinition")?N(t,e,n,r):lo(i,"bpmn:TerminateEventDefinition")?L(t,e,n,r):null}var z={ParticipantMultiplicityMarker:function(e,t,n={}){var r=mo(t,n),o=fo(t,n);O("participant-multiplicity",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2-6)/r,my:(o-15)/o}}),{strokeWidth:2,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},SubProcessMarker:function(e,t,n={}){Zn(w(e,14,14,0,{strokeWidth:1,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)}),t.width/2-7.5,t.height-20),O("sub-process",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},ParallelMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("parallel",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.parallel)/r,my:(o-20)/o}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},SequentialMarker:function(e,t,n){O("sequential",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},CompensationMarker:function(e,t,n){O("compensation",e,i.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:co(t,a,n.fill),stroke:po(t,l,n.stroke)})},LoopMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("loop",e,i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.loop)/r,my:(o-7)/o}}),{strokeWidth:1.5,fill:"none",stroke:po(t,l,n.stroke),strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){var r=mo(t,n),o=fo(t,n);O("adhoc",e,i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:(r/2+n.adhoc)/r,my:(o-15)/o}}),{strokeWidth:1,fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke)})}};function V(e,t,n,i){z[e](t,n,i)}function F(e,t,n,i={}){i={fill:i.fill,stroke:i.stroke,width:mo(t,i),height:fo(t,i)};var r=Cr(t),o=n&&n.includes("SubProcessMarker");i=o?{...i,seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{...i,seq:-5,parallel:-6,compensation:-27,loop:0,adhoc:10},v(n,(function(n){V(n,e,t,i)})),r.get("isForCompensation")&&V("CompensationMarker",e,t,i),kr(r,"bpmn:AdHocSubProcess")&&V("AdhocMarker",e,t,i);var s=r.get("loopCharacteristics"),a=s&&s.get("isSequential");s&&(void 0===a&&V("LoopMarker",e,t,i),!1===a&&V("ParallelMarker",e,t,i),!0===a&&V("SequentialMarker",e,t,i))}function H(e,t,n={}){n=I({size:{width:100}},n);var i=o.createText(t||"",n);return Se(i).add("djs-label"),xe(e,i),i}function U(e,t,n,i={}){var r=Cr(t),o=ho({x:t.x,y:t.y,width:t.width,height:t.height},i);return H(e,r.name,{align:n,box:o,padding:7,style:{fill:uo(t,c,l,i.stroke)}})}function W(e,t,n,i={}){var r=Qr(n),o=H(e,t,{box:{height:30,width:r?fo(n,i):mo(n,i)},align:"center-middle",style:{fill:uo(n,c,l,i.stroke)}});r&&Yn(o,0,-(-1*fo(n,i)),270)}function Q(e,t,n={}){var{width:i,height:r}=ho(t,n);return w(e,i,r,10,{...n,fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke)})}function G(e,t,n={}){var i=Cr(t),r=co(t,a,n.fill),o=po(t,l,n.stroke);return"One"!==i.get("associationDirection")&&"Both"!==i.get("associationDirection")||(n.markerEnd=y("association-end",r,o)),"Both"===i.get("associationDirection")&&(n.markerStart=y("association-start",r,o)),n=bo(n,["markerStart","markerEnd"]),_(e,t.waypoints,{...n,stroke:o,strokeDasharray:"0, 5"})}function X(e,t,n={}){var r=co(t,a,n.fill),o=po(t,l,n.stroke),s=E(e,i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:r,fillOpacity:yo,stroke:o});(function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection})(Cr(t))&&E(e,i.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:r,stroke:o});return s}function K(e,t,n={}){return b(e,t.width,t.height,{fillOpacity:yo,...n,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)})}function Y(e,t,n={}){return function(e,t,n,i){var r=t/2,o=n/2,s=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map((function(e){return e.x+","+e.y})).join(" ");i=h(i);var a=Be("polygon",{...i,points:s});return xe(e,a),a}(e,t.width,t.height,{fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke)})}function Z(e,t,n={}){var i=w(e,mo(t,n),fo(t,n),0,{fill:co(t,a,n.fill),fillOpacity:n.fillOpacity||yo,stroke:po(t,l,n.stroke),strokeWidth:1.5}),r=Cr(t);kr(r,"bpmn:Lane")&&W(e,r.get("name"),t,n);return i}function J(e,t,n={}){var i=Q(e,t,n);Xr(t)&&Pe(i,{strokeDasharray:"0, 5.5",strokeWidth:2.5});var r=Wr(t);return U(e,t,r?"center-top":"center-middle",n),F(e,t,r?void 0:["SubProcessMarker"],n),i}function ee(e,t,n={}){var i=Q(e,t,n);return U(e,t,"center-middle",n),F(e,t,void 0,n),i}var te=this.handlers={"bpmn:AdHocSubProcess":function(e,t,n={}){return J(e,t,n=Wr(t)?bo(n,["fill","stroke","width","height"]):bo(n,["fill","stroke"]))},"bpmn:Association":function(e,t,n={}){return G(e,t,n=bo(n,["fill","stroke"]))},"bpmn:BoundaryEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=Cr(t).get("cancelActivity");n={strokeWidth:1.5,fill:co(t,a,n.fill),fillOpacity:1,stroke:po(t,l,n.stroke)},r||(n.strokeDasharray="6");var o=K(e,t,n);return b(e,t.width,t.height,3,{...n,fill:"none"}),i&&q(t,e,n),o},"bpmn:BusinessRuleTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return Pe(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),Pe(E(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:CallActivity":function(e,t,n={}){return n=bo(n,["fill","stroke"]),J(e,t,{strokeWidth:5,...n})},"bpmn:ComplexGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:DataInput":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1}),o},"bpmn:DataInputAssociation":function(e,t,n={}){return n=bo(n,["fill","stroke"]),G(e,t,{...n,markerEnd:y("association-end",co(t,a,n.fill),po(t,l,n.stroke))})},"bpmn:DataObject":function(e,t,n={}){return X(e,t,n=bo(n,["fill","stroke"]))},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=i.getRawPath("DATA_ARROW"),o=X(e,t,n);return E(e,r,{strokeWidth:1,fill:co(t,a,n.fill),stroke:po(t,l,n.stroke)}),o},"bpmn:DataOutputAssociation":function(e,t,n={}){return n=bo(n,["fill","stroke"]),G(e,t,{...n,markerEnd:y("association-end",co(t,a,n.fill),po(t,l,n.stroke))})},"bpmn:DataStoreReference":function(e,t,n={}){return n=bo(n,["fill","stroke"]),E(e,i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{fill:co(t,a,n.fill),fillOpacity:yo,stroke:po(t,l,n.stroke),strokeWidth:2})},"bpmn:EndEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:4});return i&&q(t,e,n),r},"bpmn:EventBasedGateway":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=Cr(t),o=Y(e,t,n);b(e,t.width,t.height,.2*t.height,{fill:co(t,"none",n.fill),stroke:po(t,l,n.stroke),strokeWidth:1});var s=r.get("eventGatewayType"),a=!!r.get("instantiate");if("Parallel"===s){var c=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});E(e,c,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1})}else"Exclusive"===s&&(a||b(e,t.width,t.height,.26*t.height,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1}),function(){var r=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}});E(e,r,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:2})}());return o},"bpmn:ExclusiveGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"])),o=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Ar(t).get("isMarkerVisible")&&E(e,o,{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Gateway":function(e,t,n={}){return Y(e,t,n=bo(n,["fill","stroke"]))},"bpmn:Group":function(e,t,n={}){return n=bo(n,["fill","stroke","width","height"]),w(e,t.width,t.height,10,{stroke:po(t,l,n.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:mo(t,n),height:fo(t,n)})},"bpmn:InclusiveGateway":function(e,t,n={}){var i=Y(e,t,n=bo(n,["fill","stroke"]));return b(e,t.width,t.height,.24*t.height,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:2.5}),i},"bpmn:IntermediateEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]);var r=K(e,t,{...n,strokeWidth:1.5});return b(e,t.width,t.height,3,{fill:"none",stroke:po(t,l,n.stroke),strokeWidth:1.5}),i&&q(t,e,n),r},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(e,t,n={}){return n=bo(n,["fill","stroke","width","height"]),Z(e,t,{...n,fillOpacity:.25})},"bpmn:ManualTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),r},"bpmn:MessageFlow":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r=Cr(t),o=Ar(t),s=co(t,a,n.fill),c=po(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(r.get("messageRef")){var u=p.getPointAtLength(p.getTotalLength()/2),d=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:u.x,y:u.y}}),h={strokeWidth:1};"initiating"===o.get("messageVisibleKind")?(h.fill=s,h.stroke=c):(h.fill=c,h.stroke=s);var m=E(e,d,h),f=H(e,r.get("messageRef").get("name"),{align:"center-top",fitBox:!0,style:{fill:c}}),g=m.getBBox(),v=f.getBBox();Yn(f,u.x-v.width/2,u.y+g.height/2+10,0)}return p},"bpmn:ParallelGateway":function(e,t,n={}){var r=Y(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:Participant":function(e,t,n={}){var i=Z(e,t,n=bo(n,["fill","stroke","width","height"])),r=Wr(t),o=Qr(t),s=Cr(t),a=s.get("name");if(r){x(e,o?[{x:30,y:0},{x:30,y:fo(t,n)}]:[{x:0,y:30},{x:mo(t,n),y:30}],{stroke:po(t,l,n.stroke),strokeWidth:1.5}),W(e,a,t,n)}else{var p=ho(t,n);o||(p.height=mo(t,n),p.width=fo(t,n));var u=H(e,a,{box:p,align:"center-middle",style:{fill:uo(t,c,l,n.stroke)}});if(!o)Yn(u,0,-(-1*fo(t,n)),270)}return s.get("participantMultiplicity")&&V("ParticipantMultiplicityMarker",e,t,n),i},"bpmn:ReceiveTask":function(e,t,n={}){n=bo(n,["fill","stroke"]);var r,o=Cr(t),s=ee(e,t,n);return o.get("instantiate")?(b(e,28,28,4.4,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):r=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),E(e,r,{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),s},"bpmn:ScriptTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:SendTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{fill:po(t,l,n.stroke),stroke:co(t,a,n.fill),strokeWidth:1}),r},"bpmn:SequenceFlow":function(e,t,n={}){n=bo(n,["fill","stroke"]);var i=co(t,a,n.fill),r=po(t,l,n.stroke),o=_(e,t.waypoints,{markerEnd:y("sequenceflow-end",i,r),stroke:r}),s=Cr(t),{source:c}=t;if(c){var p=Cr(c);s.get("conditionExpression")&&kr(p,"bpmn:Activity")&&Pe(o,{markerStart:y("conditional-flow-marker",i,r)}),p.get("default")&&(kr(p,"bpmn:Gateway")||kr(p,"bpmn:Activity"))&&p.get("default")===s&&Pe(o,{markerStart:y("conditional-default-flow-marker",i,r)})}return o},"bpmn:ServiceTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return b(e,10,10,{fill:co(t,a,n.fill),stroke:"none",transform:"translate(6, 6)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),b(e,10,10,{fill:co(t,a,n.fill),stroke:"none",transform:"translate(11, 10)"}),E(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:1}),r},"bpmn:StartEvent":function(e,t,n={}){var{renderIcon:i=!0}=n;n=bo(n,["fill","stroke"]),Cr(t).get("isInterrupting")||(n={...n,strokeDasharray:"6"});var r=K(e,t,n);return i&&q(t,e,n),r},"bpmn:SubProcess":function(e,t,n={}){return J(e,t,n=Wr(t)?bo(n,["fill","stroke","width","height"]):bo(n,["fill","stroke"]))},"bpmn:Task":function(e,t,n={}){return ee(e,t,n=bo(n,["fill","stroke"]))},"bpmn:TextAnnotation":function(e,t,n={}){n=bo(n,["fill","stroke","width","height"]);var{width:r,height:o}=ho(t,n),s=w(e,r,o,0,0,{fill:"none",stroke:"none"});return E(e,i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r,containerHeight:o,position:{mx:0,my:0}}),{stroke:po(t,l,n.stroke)}),H(e,Cr(t).get("text")||"",{align:"left-top",box:ho(t,n),padding:7,style:{fill:uo(t,c,l,n.stroke)}}),s},"bpmn:Transaction":function(e,t,i={}){i=Wr(t)?bo(i,["fill","stroke","width","height"]):bo(i,["fill","stroke"]);var r=J(e,t,{strokeWidth:1.5,...i}),o=n.style(["no-fill","no-events"],{stroke:po(t,l,i.stroke),strokeWidth:1.5});return Wr(t)||(i={}),w(e,mo(t,i),fo(t,i),7,3,o),r},"bpmn:UserTask":function(e,t,n={}){var r=ee(e,t,n=bo(n,["fill","stroke"]));return E(e,i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{fill:co(t,a,n.fill),stroke:po(t,l,n.stroke),strokeWidth:.5}),E(e,i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{fill:po(t,l,n.stroke),stroke:po(t,l,n.stroke),strokeWidth:.5}),r},label:function(e,t,n={}){return function(e,t,n={}){var i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return H(e,ro(t),{box:i,fitBox:!0,style:I({},o.getExternalStyle(),{fill:uo(t,c,l,n.stroke)})})}(e,t,n)}};this._drawPath=E,this._renderer=P}function bo(e,t=[]){return t.reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{})}e(vo,st),vo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],vo.prototype.canRender=function(e){return kr(e,"bpmn:BaseElement")},vo.prototype.drawShape=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},vo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t;return this._renderer(i)(e,t,n)},vo.prototype.getShapePath=function(e){return kr(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,at([["M",n,i],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]])):kr(e,"bpmn:Activity")?function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return at([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,10):kr(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return at([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,i=e.width;return at([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])}(e);var t,n,i,r};var wo=0,xo={width:150,height:50};function _o(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function Eo(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=_o(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Oo(e,o,r,i);o=ko(o,i.width,t)}}function Oo(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var Po="";function ko(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-|\u00AD)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"!==n&&n!==Po||r.pop();break}r.push(n),o+=n.length}var s=r[r.length-1];return s&&s===Po&&(r[r.length-1]="-"),r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function So(e){this._config=I({},{size:xo,padding:wo,style:{},align:"center-top"},e||{})}So.prototype.createText=function(e,t){return this.layoutText(e,t).element},So.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},So.prototype.layoutText=function(e,t){var n=I({},this._config.size,t.box),i=I({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return p(e)?I({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)}(i),l=e.split(/\u00AD?\r?\n/),c=[],u=n.width-o.left-o.right,d=Be("text");for(Pe(d,{x:0,y:0}),Pe(d,i),xe(function(){var e=document.getElementById("helper-svg");return e||(Pe(e=Be("svg"),{id:"helper-svg"}),G(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}(),d);l.length;)c.push(Eo(l,u,d));"middle"===r.vertical&&(o.top=o.bottom=0);var h=w(c,(function(e,t,n){return e+(a||t.height)}),0)+o.top+o.bottom,m=w(c,(function(e,t,n){return t.width>e?t.width:e}),0),f=o.top;"middle"===r.vertical&&(f+=(n.height-h)/2),f-=(a||c[0].height)/4;var g=Be("text");return Pe(g,i),v(c,(function(e){var t;switch(f+=a||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(s?m:u)-o.right-e.width;break;default:t=Math.max(((s?m:u)-e.width)/2+o.left,0)}var n=Be("tspan");Pe(n,{x:t,y:f}),n.textContent=e.text,xe(g,n)})),Ae(d),{dimensions:{width:m,height:h},element:g}};function Co(e){var t=I({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=I({},t,{fontSize:n},e&&e.externalStyle||{}),r=new So({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30},style:i});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 i=r.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(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Co.$inject=["config.textRenderer"];var Ao=/\{([^{}]+)\}/g,To=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Mo={__init__:["bpmnRenderer"],bpmnRenderer:["type",vo],textRenderer:["type",Co],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,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o={};if(t.position){for(var s=t.containerHeight/r.height*t.yScaleFactor,a=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)o["y"+l]=r.heightElements[l]*s;for(var c=0;c<r.widthElements.length;c++)o["x"+c]=r.widthElements[c]*a}var p,u,d=(p=r.d,u={mx:n,my:i,e:o},String(p).replace(Ao,(function(e,t){return function(e,t,n){var i=n;return t.replace(To,(function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))})),i=(null==i||i==n?e:i)+""}(e,t,u)})));return d}}]};var Ro={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,(function(e,n){return t[n]||"{"+n+"}"}))}]};function Do(e,t,n){return I({id:e.id,type:e.$type,businessObject:e,di:t},n)}function No(e,t,n){var i=e.waypoint;return!i||i.length<2?[xn(t),xn(n)]:i.map((function(e){return{x:e.x,y:e.y}}))}function Bo(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:xr(n),referenced:xr(t),property:i}))}function jo(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}jo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],jo.prototype.add=function(e,t,n){var i,r,o,s=this._translate;if(kr(t,"bpmndi:BPMNPlane")){var a=kr(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Do(e,t,a)),this._canvas.addRootElement(i)}else if(kr(t,"bpmndi:BPMNShape")){var l=!Wr(e,t),c=function(e){return kr(e,"bpmn:Group")}(e);r=n&&(n.hidden||n.collapsed);var p=t.bounds;i=this._elementFactory.createShape(Do(e,t,{collapsed:l,hidden:r,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height),isFrame:c})),kr(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),kr(e,"bpmn:Lane")&&(o=0),kr(e,"bpmn:DataStoreReference")&&(function(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}(n,xn(p))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else{if(!kr(t,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:xr(t),semantic:xr(e)}));var u=this._getSource(e),d=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Do(e,t,{hidden:r,source:u,target:d,waypoints:No(t,u,d)})),kr(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}return Jr(e)&&ro(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},jo.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:xr(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Bo(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},jo.prototype.addLabel=function(e,t,n){var i,r,o;return i=function(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Yr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=no(t),i=Yr),I({x:n.x-i.width/2,y:n.y-i.height/2},i)}(t,n),(r=ro(n))&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Do(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ro(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},jo.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?Bo(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:xr(e),side:t}))},jo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},jo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},jo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Io={__depends__:[Mo,{__depends__:[Ro],bpmnImporter:["type",jo]}]};function $o(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function Lo(e){return e.originalEvent||e.srcEvent}function qo(e){$o(e),$o(Lo(e))}function zo(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 Fo(e,t){return(Lo(e)||e).button===t}function Ho(e){return Fo(e,0)}function Uo(e){var t=Lo(e)||e;return!!Ho(e)&&(Vo()?t.metaKey:t.ctrlKey)}function Wo(e){var t=Lo(e)||e;return Ho(e)&&t.shiftKey}function Qo(e){return!0}function Go(e){return Ho(e)||function(e){return Fo(e,1)}(e)}function Xo(e,t,n){var i=this;function r(n,i,r){var o,s;(function(e,t){var n=l[e]||Ho;return!n(t)})(n,i)||(r?s=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(s=o,r=t.get(s)),s&&r&&!1===e.fire(n,{element:r,gfx:s,originalEvent:i})&&(i.stopPropagation(),i.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":Go,"element.mouseup":Go,"element.click":Go,"element.dblclick":Go};var c="svg, .djs-element";function p(e,t,n,i){var s=o[n]=function(e){r(n,e)};i&&(l[n]=i),s.$delegate=de.bind(e,c,t,s)}function u(e,t,n){var i=s(n);i&&de.unbind(e,t,i.$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,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})})),e.on(["shape.changed","connection.changed"],500,(function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})})),e.on("interactionEvents.createHit",500,(function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)})),e.on("interactionEvents.updateHit",(function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)}));var d=f("djs-hit djs-hit-stroke"),h=f("djs-hit djs-hit-click-stroke"),m={all:f("djs-hit djs-hit-all"),"click-stroke":h,stroke:d,"no-move":f("djs-hit djs-hit-no-move")};function f(e,t){return t=I({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function g(e,t){var n=m[t];if(!n)throw new Error("invalid hit type <"+t+">");return Pe(e,n),e}function y(e,t){xe(e,t)}this.removeHits=function(e){v(ve(".djs-hit",e),Ae)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"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=I({x:0,y:0},n);var i=Be("rect");return g(i,t),Pe(i,n),y(e,i),i},this.updateDefaultHit=function(e,t){var n=ye(".djs-hit",t);if(n)return e.waypoints?ht(n,e.waypoints):Pe(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=a[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=s,this.registerEvent=p,this.unregisterEvent=u}Xo.$inject=["eventBus","elementRegistry","styles"];var Ko={__init__:["interactionEvents"],interactionEvents:["type",Xo]};function Yo(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=Be("rect");return Pe(t,I({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=ye(".djs-outline",n);o||xe(n,o=i.getOutline(t)||r()),i.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ye(".djs-outline",n);o||xe(n,o=r()),i.updateConnectionOutline(o,t)}))}Yo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&v(i,(function(i){n=n||i.updateOutline(t,e)})),n||Pe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},Yo.prototype.updateConnectionOutline=function(e,t){var n=bt(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})},Yo.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},Yo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Yo.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},Yo.$inject=["eventBus","styles","elementRegistry"];var Zo={__init__:["outline"],outline:["type",Yo]};function Jo(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)}))}Jo.$inject=["eventBus","canvas"],Jo.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},Jo.prototype.get=function(){return this._selectedElements},Jo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Jo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();c(e)||(e=e?[e]:[]);var r=this._canvas,o=r.getRootElement();e=e.filter((function(e){var t=r.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:i,newSelection:n})};var es="hover",ts="selected";function ns(e,t,n){this._canvas=e;var i=this;function r(t,n){e.addMarker(t,n)}function o(t,n){e.removeMarker(t,n)}this._multiSelectionBox=null,t.on("element.hover",(function(e){r(e.element,es)})),t.on("element.out",(function(e){o(e.element,es)})),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,ts)}(e)})),v(n,(function(e){-1===t.indexOf(e)&&function(e){r(e,ts)}(e)})),i._updateSelectionOutline(n)})),t.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateSelectionOutline(n.get())}))}function is(e,t,n,i){e.on("create.end",500,(function(e){var n=e.context,i=n.canExecute,r=n.elements,o=(n.hints||{}).autoSelect;if(i){if(!1===o)return;c(o)?t.select(o):t.select(r.filter(rs))}})),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||[],r=i.get(e.context.shape.id);f(n,(function(e){return r.id===e.id}))||t.select(r)})),e.on("element.click",(function(e){if(Ho(e)){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,s=Wo(e);if(r&&o)return s?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,s)}}))}function rs(e){return!e.hidden}ns.$inject=["canvas","eventBus","selection"],ns.prototype._updateSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(bt(e)),r=Be("rect");Pe(r,I({rx:3},i)),Se(r).add("djs-selection-outline"),xe(t,r)}},is.$inject=["eventBus","selection","canvas","elementRegistry"];var os={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ko,Zo],selection:["type",Jo],selectionVisuals:["type",ns],selectionBehavior:["type",is]};function ss(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}ss.prototype.next=function(){return this._prefix+ ++this._counter};var as=new ss("ov");function ls(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=as,this._overlayDefaults=I({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),G(o=ge('<div class="djs-overlay-container" />'),{position:"absolute",width:0,height:0}),r.insertBefore(o,r.firstChild),o),this._init()}function cs(e,t,n){G(e,{left:t+"px",top:n+"px"})}function ps(e,t){e.style.display=!1===t?"none":""}function us(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach((function(n){e.style[n+"transform"]=t}))}ls.$inject=["config.overlays","eventBus","canvas","elementRegistry"],ls.prototype.get=function(e){if(h(e)&&(e={id:e}),h(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,T({type:e.type})):t.overlays.slice():[]}return e.type?y(this._overlays,T({type:e.type})):e.id?this._overlays[e.id]:null},ls.prototype.add=function(e,t,n){if(p(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=I({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ls.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&&(be(e.html),be(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}}))},ls.prototype.isShown=function(){return"none"!==this._overlayRoot.style.display},ls.prototype.show=function(){ps(this._overlayRoot)},ls.prototype.hide=function(){ps(this._overlayRoot,!1)},ls.prototype.clear=function(){this._overlays={},this._overlayContainers=[],J(this._overlayRoot)},ls.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=bt(t);i=o.x,r=o.y}cs(n,i,r),X(e.html,"data-container-id",t.id)},ls.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,s=i.left,a=i.top;void 0!==i.right&&(t=o.waypoints?bt(o).width:o.width,s=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?bt(o).height:o.height,a=-1*i.bottom+n);cs(r,s||0,a||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ls.prototype._createOverlayContainer=function(e){var t=ge('<div class="djs-overlays" />');G(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},ls.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";us(this._overlayRoot,n)},ls.prototype._getOverlayContainer=function(e,t){var n=f(this._overlayContainers,(function(t){return t.element===e}));return n||t?n:this._createOverlayContainer(e)},ls.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),h(o)&&(o=ge(o)),n=this._getOverlayContainer(r),G(t=ge('<div class="djs-overlay" data-overlay-id="'+i+'">'),{position:"absolute"}),t.appendChild(o),e.type&&Y(t).add("djs-overlay-"+e.type),ps(t,this._canvas.findRoot(r)===this._canvas.getRootElement()),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ls.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,s=e.htmlContainer,l=!0;(i!==this._canvas.getRootElement()||n&&(a(r)&&r>t.scale||a(o)&&o<t.scale))&&(l=!1),ps(s,l),this._updateOverlayScale(e,t)},ls.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,s=e.htmlContainer,l="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),a(n)&&t.scale<n&&(r=(1/t.scale||1)*n),a(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),a(r)&&(l="scale("+r+","+r+")"),us(s,l)},ls.prototype._updateOverlaysVisibilty=function(e){var t=this;v(this._overlays,(function(n){t._updateOverlayVisibilty(n,e)}))},ls.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 i=t._getOverlayContainer(n);if(i){be(i.html);var r=t._overlayContainers.indexOf(i);-1!==r&&t._overlayContainers.splice(r,1)}})),e.on("element.changed",500,(function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(v(i.overlays,(function(e){t._updateOverlay(e)})),t._updateOverlayContainer(i))})),e.on("element.marker.update",(function(e){var n=t._getOverlayContainer(e.element,!0);n&&Y(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",ls]};function hs(e,t,n,i){e.on("element.changed",(function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(wt(r)+".changed",i)})),e.on("elements.changed",(function(t){var n=t.elements;n.forEach((function(t){e.fire("element.changed",{element:t})})),i.updateContainments(n)})),e.on("shape.changed",(function(e){i.update("shape",e.element,e.gfx)})),e.on("connection.changed",(function(e){i.update("connection",e.element,e.gfx)}))}hs.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var ms={__init__:["changeSupport"],changeSupport:["type",hs]};function fs(e){this._eventBus=e}function gs(e){return function(t,n,i,r,o){(d(t)||u(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}}function ys(e,t){t.invoke(fs,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)}))}fs.$inject=["eventBus"],fs.prototype.on=function(e,t,n,i,r,o){if((d(t)||u(t))&&(o=r,r=i,i=n,n=t,t=null),d(n)&&(o=r,r=i,i=n,n=1e3),p(r)&&(o=r,r=!1),!d(i))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,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)}))},fs.prototype.canExecute=gs("canExecute"),fs.prototype.preExecute=gs("preExecute"),fs.prototype.preExecuted=gs("preExecuted"),fs.prototype.execute=gs("execute"),fs.prototype.executed=gs("executed"),fs.prototype.postExecute=gs("postExecute"),fs.prototype.postExecuted=gs("postExecuted"),fs.prototype.revert=gs("revert"),fs.prototype.reverted=gs("reverted"),e(ys,fs),ys.$inject=["canvas","injector"];var vs={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ys]};function bs(e){return CSS.escape(e)}var ws={"&":"&","<":"<",">":">",'"':""","'":"'"};function xs(e){return(e=""+e)&&e.replace(/[&<>"']/g,(function(e){return ws[e]}))}var _s="_plane";function Es(e){return function(e){return e.replace(new RegExp(_s+"$"),"")}(e.id)}function Os(e){var t=e.id;return kr(e,"bpmn:SubProcess")?Ss(t):t}function Ps(e){return Ss(e)}function ks(e){return kr(Ar(e),"bpmndi:BPMNPlane")}function Ss(e){return e+_s}function Cs(e,t,n){var i=ge('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Y(r);r.appendChild(i);var s=[];function a(e){e&&(s=function(e){for(var t=Cr(e),n=[],i=t;i;i=i.$parent)(kr(i,"bpmn:SubProcess")||kr(i,"bpmn:Process"))&&n.push(i);return n.reverse()}(e));var r=s.map((function(e){var i=xs(e.name||e.id),r=ge('<li><span class="bjs-crumb"><a title="'+i+'">'+i+"</a></span></li>"),o=n.findRoot(Os(e))||n.findRoot(e.id);if(!o&&kr(e,"bpmn:Process")){var s=t.find((function(t){var n=Cr(t);return n&&n.get("processRef")&&n.get("processRef")===e}));o=n.findRoot(s.id)}return r.addEventListener("click",(function(){n.setRootElement(o)})),r}));i.innerHTML="";var a=r.length>1;o.toggle("bjs-breadcrumbs-shown",a),r.forEach((function(e){i.appendChild(e)}))}e.on("element.changed",(function(e){var t=Cr(e.element);f(s,(function(e){return e===t}))&&a()})),e.on("root.set",(function(e){a(e.element)}))}function As(e,t){var n=null,i=new Ts;e.on("root.set",(function(e){var r=e.element,o=t.viewbox(),s=i.get(r);if(i.set(n,{x:o.x,y:o.y,zoom:o.scale}),n=r,!kr(r,"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(){i.clear(),n=null}))}function Ts(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][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)}}Cs.$inject=["eventBus","elementRegistry","canvas"],As.$inject=["eventBus","canvas"];var Ms=180,Rs=160;function Ds(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 Ns(e){return kr(e,"bpmndi:BPMNDiagram")?e:Ns(e.$parent)}Ds.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 i=t._createNewDiagrams(e.plane);Array.prototype.push.apply(n,i)})),n.forEach((function(e){t._movePlaneElementsToOrigin(e.plane)}))}},Ds.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach((function(t){var r=t.bpmnElement;if(r){var o=r.$parent;kr(r,"bpmn:SubProcess")&&!t.isExpanded&&n.push(r),function(e,t){var n=e.$parent;if(!kr(n,"bpmn:SubProcess")||n===t.bpmnElement)return!1;if(Sr(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))return!1;return!0}(r,e)&&i.push({diElement:t,parent:o})}}));var r=[];return n.forEach((function(e){if(!t._processToDiagramMap[e.id]){var n=t._createDiagram(e);t._processToDiagramMap[e.id]=n,r.push(n)}})),i.forEach((function(e){for(var i=e.diElement,r=e.parent;r&&-1===n.indexOf(r);)r=r.$parent;if(r){var o=t._processToDiagramMap[r.id];t._moveToDiPlane(i,o.plane)}})),r},Ds.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=vn(e.bounds);t.top=Math.min(n.top,t.top),t.left=Math.min(n.left,t.left)}})),bn(t)}(e),i=n.x-Ms,r=n.y-Rs;t.forEach((function(e){e.waypoint?e.waypoint.forEach((function(e){e.x=e.x-i,e.y=e.y-r})):e.bounds&&(e.bounds.x=e.bounds.x-i,e.bounds.y=e.bounds.y-r)}))},Ds.prototype._moveToDiPlane=function(e,t){var n=Ns(e).plane.get("planeElement");n.splice(n.indexOf(e),1),t.get("planeElement").push(e)},Ds.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},Ds.$inject=["eventBus","moddle"];var Bs=250;function js(e,t,n,i){fs.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i;var r=this;this.executed("shape.toggleCollapse",Bs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.reverted("shape.toggleCollapse",Bs,(function(e){var t=e.shape;r._canDrillDown(t)?r._addOverlay(t):r._removeOverlay(t)}),!0),this.executed(["shape.create","shape.move","shape.delete"],Bs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),this.reverted(["shape.create","shape.move","shape.delete"],Bs,(function(e){var t=e.oldParent,n=e.newParent||e.parent,i=e.shape;r._canDrillDown(i)&&r._addOverlay(i),r._updateDrilldownOverlay(t),r._updateDrilldownOverlay(n),r._updateDrilldownOverlay(i)}),!0),t.on("import.render.complete",(function(){n.filter((function(e){return r._canDrillDown(e)})).map((function(e){r._addOverlay(e)}))}))}e(js,fs),js.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},js.prototype._canDrillDown=function(e){var t=this._canvas;return kr(e,"bpmn:SubProcess")&&t.findRoot(Os(e))},js.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Cr(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Y(i.html).toggle("bjs-drilldown-empty",!r)}},js.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays;n.get({element:e,type:"drilldown"}).length&&this._removeOverlay(e);var i=ge('<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>');i.addEventListener("click",(function(){t.setRootElement(t.findRoot(Os(e)))})),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:i}),this._updateOverlayVisibility(e)},js.prototype._removeOverlay=function(e){this._overlays.remove({element:e,type:"drilldown"})},js.$inject=["canvas","eventBus","elementRegistry","overlays"];var Is={__depends__:[ds,ms,vs],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Cs],drilldownCentering:["type",As],drilldownOverlayBehavior:["type",js],subprocessCompatibility:["type",Ds]};function $s(e){zr.call(this,e)}e($s,zr),$s.prototype._modules=[Io,Ro,os,ds,Is],$s.prototype._moddleExtensions={};var Ls=["c","C"],qs=["v","V"],zs=["y","Y"],Vs=["z","Z"];function Fs(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Hs(e,t){return-1!==(e=c(e)?e:[e]).indexOf(t.key)||-1!==e.indexOf(t.code)}function Us(e){return e.shiftKey}function Ws(e){return Fs(e)&&!Us(e)&&Hs(Vs,e)}function Qs(e){return Fs(e)&&(Hs(zs,e)||Hs(Vs,e)&&Us(e))}var Gs="keyboard.keydown",Xs="input-handle-modified-keys";function Ks(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()}))}Ks.$inject=["config.keyboard","eventBus"],Ks.prototype._keydownHandler=function(e){this._keyHandler(e,Gs)},Ks.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Ks.prototype._keyHandler=function(e,t){if(!this._isEventIgnored(e)){var n={keyEvent:e};this._eventBus.fire(t||Gs,n)&&e.preventDefault()}},Ks.prototype._isEventIgnored=function(e){return!!e.defaultPrevented||((t=e.target)&&(ee(t,"input, textarea")||"true"===t.contentEditable)||function(e){return e&&ee(e,"button, input[type=submit], input[type=button], a[href], [aria-role=button]")}(e.target)&&Hs([" ","Enter"],e))&&this._isModifiedKeyIgnored(e);var t},Ks.prototype._isModifiedKeyIgnored=function(e){return!Fs(e)||-1===this._getAllowedModifiers(e.target).indexOf(e.key)},Ks.prototype._getAllowedModifiers=function(e){var t=te(e,"["+Xs+"]",!0);return!t||this._node&&!this._node.contains(t)?[]:t.getAttribute(Xs).split(",")},Ks.prototype.bind=function(e){this.unbind(),this._node=e,ce.bind(e,"keydown",this._keydownHandler),ce.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ks.prototype.getBinding=function(){return this._node},Ks.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ce.unbind(e,"keydown",this._keydownHandler),ce.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ks.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ks.prototype.addListener=function(e,t,n){d(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Gs,e,t)},Ks.prototype.removeListener=function(e,t){this._eventBus.off(t||Gs,e)},Ks.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Ks.prototype.isCmd=Fs,Ks.prototype.isShift=Us,Ks.prototype.isKey=Hs;var Ys=500;function Zs(e,t){var n=this;e.on("editorActions.init",Ys,(function(e){var i=e.editorActions;n.registerBindings(t,i)}))}Zs.$inject=["eventBus","keyboard"],Zs.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",(function(e){if(Ws(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 Fs(e)&&Hs(Ls,e)}(e.keyEvent))return t.trigger("copy"),!0})),n("paste",(function(e){if(function(e){return Fs(e)&&Hs(qs,e)}(e.keyEvent))return t.trigger("paste"),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Hs(["+","Add","="],n)&&Fs(n))return t.trigger("stepZoom",{value:1}),!0})),n("stepZoom",(function(e){var n=e.keyEvent;if(Hs(["-","Subtract"],n)&&Fs(n))return t.trigger("stepZoom",{value:-1}),!0})),n("zoom",(function(e){var n=e.keyEvent;if(Hs("0",n)&&Fs(n))return t.trigger("zoom",{value:1}),!0})),n("removeSelection",(function(e){if(Hs(["Backspace","Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0}))};var Js={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ks],keyboardBindings:["type",Zs]},ea={moveSpeed:50,moveSpeedAccelerated:200};function ta(e,t,n){var i=this;this._config=I({},ea,e||{}),t.addListener((function(e){var n=e.keyEvent,r=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,s=t.isShift(n)?r.moveSpeedAccelerated:r.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 i.moveCanvas({speed:s,direction:o}),!0}})),this.moveCanvas=function(e){var t=0,i=0,r=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":i=r;break;case"right":t=-r;break;case"down":i=-r}n.scroll({dx:t,dy:i})}}ta.$inject=["config.keyboardMove","keyboard","canvas"];var na={__depends__:[Js],__init__:["keyboardMove"],keyboardMove:["type",ta]},ia=/^djs-cursor-.*$/;function ra(e){var t=Y(document.body);t.removeMatching(ia),e&&t.add("djs-cursor-"+e)}function oa(){ra(null)}var sa=5e3;function aa(e,t){function n(){return!1}return t=t||"element.click",e.once(t,sa,n),function(){e.off(t,n)}}function la(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ca(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pa(e,t){var n;function i(i){var r,o=n.start,s=n.button,a=zo(i),l=ca(a,o);(!n.dragging&&(r=l,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>15)&&(n.dragging=!0,0===s&&aa(e),ra("grab")),n.dragging)&&(l=ca(a,n.last||n.start),t.scroll({dx:l.x,dy:l.y}),n.last=a);i.preventDefault()}function r(e){ce.unbind(document,"mousemove",i),ce.unbind(document,"mouseup",r),n=null,oa()}e.on("element.mousedown",500,(function(e){return function(e){if(te(e.target,".djs-draggable"))return;var t=e.button;if(t>=2||e.ctrlKey||e.shiftKey||e.altKey)return;return n={button:t,start:zo(e)},ce.bind(document,"mousemove",i),ce.bind(document,"mouseup",r),!0}(e.originalEvent)})),this.isActive=function(){return!!n}}pa.$inject=["eventBus","canvas"];var ua={__init__:["moveCanvas"],moveCanvas:["type",pa]};function da(e){return Math.log(e)/Math.log(10)}function ha(e,t){var n=da(e.min),i=da(e.max);return(Math.abs(n)+Math.abs(i))/t}var ma=Math.sign||function(e){return e>=0?1:-1},fa={min:.2,max:4};function ga(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=j(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||.75;var i=this;t.on("canvas.init",(function(t){i._init(!1!==e.enabled)}))}ga.$inject=["config.zoomScroll","eventBus","canvas"],ga.prototype.scroll=function(e){this._canvas.scroll(e)},ga.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ga.prototype.zoom=function(e,t){var n=ha(fa,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},ga.prototype._handleWheel=function(e){if(!te(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey||Vo()&&e.metaKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){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=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},ga.prototype.stepZoom=function(e,t){var n=ha(fa,10);this._zoom(e,t,n)},ga.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=da(i.zoom()),s=Math.round(o/n)*n;s+=n*r;var a,l,c=Math.pow(10,s);i.zoom((a=fa,l=c,Math.max(a.min,Math.min(a.max,l))),t)},ga.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&ce[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},ga.prototype._init=function(e){this.toggle(e)};var ya={__init__:["zoomScroll"],zoomScroll:["type",ga]};function va(e){$s.call(this,e)}function ba(e){return e&&e[e.length-1]}function wa(e){return e.y}function xa(e){return e.x}e(va,$s),va.prototype._navigationModules=[na,ua,ya],va.prototype._modules=[].concat($s.prototype._modules,va.prototype._navigationModules);var _a={left:xa,center:xa,right:function(e){return e.x+e.width},top:wa,middle:wa,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,i,r,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"]))r=ba(t),l[e]=r[s]+r[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=A(c,(function(e){return e.elements.length>1&&(p=!0),e.elements.length})),p)return l[e]=ba(n).center,l;i=t[0],r=ba(t=A(t,(function(e){return e[s]+e[a]}))),l[e]=function(e,t){return Math.round((e[s]+t[s]+t[a])/2)}(i,r)}return l},Ea.prototype.trigger=function(e,t){var n,i=this._modeling,r=y(e,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));if(c(n=this._rules.allowed("elements.align",{elements:r}))&&(r=n),!(r.length<2)&&n){var o=A(r,_a[t]),s=this._alignmentPosition(t,o);i.alignElements(o,s)}};var Oa={__init__:["alignElements"],alignElements:["type",Ea]},Pa=".entry";function ka(e,t,n,i){this._canvas=e,this._eventBus=n,this._overlays=i;var r=a(t&&t.scale)?t.scale:{min:1,max:1.5};this._overlaysConfig={scale:r},this._current=null,this._init()}function Sa(e,t){return-1!==e.indexOf(t)}ka.$inject=["canvas","config.contextPad","eventBus","overlays"],ka.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",(function(t){var n=t.newSelection,i=n.length?1===n.length?n[0]:n:null;i?e.open(i,!0):e.close()})),this._eventBus.on("elements.changed",(function(t){var n=t.elements,i=e._current;if(i){var r=i.target;_(c(r)?r:[r],(function(e){return Sa(n,e)}))&&e.open(r,!0)}}))},ka.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("contextPad.getProviders",e,(function(e){e.providers.push(t)}))},ka.prototype.getEntries=function(e){var t=this._getProviders(),n=c(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return v(t,(function(t){if(d(t[n])){var r=t[n](e);d(r)?i=r(i):v(r,(function(e,t){i[t]=e}))}})),i},ka.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=X(o,"data-action"),r=t.originalEvent||t,"mouseover"===e?this._timeout=setTimeout((()=>{this._mouseout=this.triggerEntry(i,"hover",r,n)}),300):"mouseout"===e&&(clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null)),this.triggerEntry(i,e,r,n)):t.preventDefault()},ka.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=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(d(s)){if("click"===t)return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ka.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ka.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ka.prototype._updateAndOpen=function(e){var t,n=this.getEntries(e),i=this.getPad(e),r=i.html;v(n,(function(e,n){var i,o=e.group||"default",s=ge(e.html||'<div class="entry" draggable="true"></div>');X(s,"data-action",n),(i=ye("[data-group="+bs(o)+"]",r))||(X(i=ge('<div class="group"></div>'),"data-group",o),r.appendChild(i)),i.appendChild(s),e.className&&function(e,t){var n=Y(e);(t=c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,e.className),e.title&&X(s,"title",e.title),e.imageUrl&&(X(t=ge("<img>"),"src",e.imageUrl),t.style.width="100%",t.style.height="100%",s.appendChild(t))})),Y(r).add("open"),this._current={target:e,entries:n,pad:i},this._eventBus.fire("contextPad.open",{current:this._current})},ka.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=ge('<div class="djs-context-pad"></div>'),r=this._getPosition(e),o=I({html:i},this._overlaysConfig,r);de.bind(i,Pa,"click",(function(e){t.trigger("click",e)})),de.bind(i,Pa,"dragstart",(function(e){t.trigger("dragstart",e)})),de.bind(i,Pa,"mouseover",(function(e){t.trigger("mouseover",e)})),de.bind(i,Pa,"mouseout",(function(e){t.trigger("mouseout",e)})),ce.bind(i,"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},ka.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)},ka.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 Sa(n,e)})):n===e)},ka.prototype.isShown=function(){return this.isOpen()&&this._overlays.isShown()},ka.prototype._getPosition=function(e){var t,n=bt(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 Ca,Aa,Ta,Ma,Ra,Da={__depends__:[Ko,ds],contextPad:["type",ka]},Na={},Ba=[],ja=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Ia(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 La(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ca.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 qa(e,s,i,r,null)}function qa(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++Ta:r};return null==r&&null!=Aa.vnode&&Aa.vnode(o),o}function za(e){return e.children}function Va(e,t){this.props=e,this.context=t}function Fa(e,t){if(null==t)return e.__?Fa(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?Fa(e):null}function Ha(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 Ha(e)}}function Ua(e){(!e.__d&&(e.__d=!0)&&Ma.push(e)&&!Wa.__r++||Ra!==Aa.debounceRendering)&&((Ra=Aa.debounceRendering)||setTimeout)(Wa)}function Wa(){for(var e;Wa.__r=Ma.length;)e=Ma.sort((function(e,t){return e.__v.__b-t.__v.__b})),Ma=[],e.some((function(e){var t,n,i,r,o,s;e.__d&&(o=(r=(t=e).__v).__e,(s=t.__P)&&(n=[],(i=Ia({},r)).__v=r.__v+1,el(s,r,i,t.__n,void 0!==s.ownerSVGElement,null!=r.__h?[o]:null,n,null==o?Fa(r):o,r.__h),tl(n,r),r.__e!=o&&Ha(r)))}))}function Qa(e,t,n,i,r,o,s,a,l,c){var p,u,d,h,m,f,g,y=i&&i.__k||Ba,v=y.length;for(n.__k=[],p=0;p<t.length;p++)if(null!=(h=n.__k[p]=null==(h=t[p])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?qa(null,h,null,null,h):Array.isArray(h)?qa(za,{children:h},null,null,null):h.__b>0?qa(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(d=y[p])||d&&h.key==d.key&&h.type===d.type)y[p]=void 0;else for(u=0;u<v;u++){if((d=y[u])&&h.key==d.key&&h.type===d.type){y[u]=void 0;break}d=null}el(e,h,d=d||Na,r,o,s,a,l,c),m=h.__e,(u=h.ref)&&d.ref!=u&&(g||(g=[]),d.ref&&g.push(d.ref,null,h),g.push(u,h.__c||m,h)),null!=m?(null==f&&(f=m),"function"==typeof h.type&&h.__k===d.__k?h.__d=l=Ga(h,l,e):l=Xa(e,h,d,y,m,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Fa(d))}for(n.__e=f,p=v;p--;)null!=y[p]&&il(y[p],y[p]);if(g)for(p=0;p<g.length;p++)nl(g[p],g[++p],g[++p])}function Ga(e,t,n){for(var i,r=e.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=e,t="function"==typeof i.type?Ga(i,t,n):Xa(n,i,i,r,i.__e,t));return t}function Xa(e,t,n,i,r,o){var s,a,l;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||r!=o||null==r.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(r),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<i.length;l+=1)if(a==r)break e;e.insertBefore(r,o),s=o}return void 0!==s?s:r.nextSibling}function Ka(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||ja.test(t)?n:n+"px"}function Ya(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Ka(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||Ka(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?i||e.addEventListener(t,o?Ja:Za,o):e.removeEventListener(t,o?Ja:Za,o);else if("dangerouslySetInnerHTML"!==t){if(r)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 Za(e){this.l[e.type+!1](Aa.event?Aa.event(e):e)}function Ja(e){this.l[e.type+!0](Aa.event?Aa.event(e):e)}function el(e,t,n,i,r,o,s,a,l){var c,p,u,d,h,m,f,g,y,v,b,w,x,_,E,O=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=Aa.__b)&&c(t);try{e:if("function"==typeof O){if(g=t.props,y=(c=O.contextType)&&i[c.__c],v=c?y?y.props.value:c.__:i,n.__c?f=(p=t.__c=n.__c).__=p.__E:("prototype"in O&&O.prototype.render?t.__c=p=new O(g,v):(t.__c=p=new Va(g,v),p.constructor=O,p.render=rl),y&&y.sub(p),p.props=g,p.state||(p.state={}),p.context=v,p.__n=i,u=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=O.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Ia({},p.__s)),Ia(p.__s,O.getDerivedStateFromProps(g,p.__s))),d=p.props,h=p.state,u)null==O.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==O.getDerivedStateFromProps&&g!==d&&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(d,h,m)}))}if(p.context=v,p.props=g,p.__v=t,p.__P=e,w=Aa.__r,x=0,"prototype"in O&&O.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&&(i=Ia(Ia({},i),p.getChildContext())),u||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,h)),E=null!=c&&c.type===za&&null==c.key?c.props.children:c,Qa(e,Array.isArray(E)?E:[E],t,n,i,r,o,s,a,l),p.base=t.__e,t.__h=null,p.__h.length&&s.push(p),f&&(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,i,r,o,s,a){var l,c,p,u=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(r=!0),null!=o)for(;m<o.length;m++)if((l=o[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,o[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=r?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),o=null,a=!1}if(null===h)u===d||a&&e.data===d||(e.data=d);else{if(o=o&&Ca.call(e.childNodes),c=(u=n.props||Na).dangerouslySetInnerHTML,p=d.dangerouslySetInnerHTML,!a){if(null!=o)for(u={},m=0;m<e.attributes.length;m++)u[e.attributes[m].name]=e.attributes[m].value;(p||c)&&(p&&(c&&p.__html==c.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,t,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in t||Ya(e,o,null,n[o],i);for(o in t)r&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||Ya(e,o,t[o],n[o],i)}(e,d,u,r,a),p)t.__k=[];else if(m=t.props.children,Qa(e,Array.isArray(m)?m:[m],t,n,i,r&&"foreignObject"!==h,o,s,o?o[0]:n.__k&&Fa(n,0),a),null!=o)for(m=o.length;m--;)null!=o[m]&&$a(o[m]);a||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==u.value)&&Ya(e,"value",m,u.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&Ya(e,"checked",m,u.checked,!1))}return e}(n.__e,t,n,i,r,o,s,l);(c=Aa.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=o)&&(t.__e=a,t.__h=!!l,o[o.indexOf(a)]=null),Aa.__e(e,t,n)}}function tl(e,t){Aa.__c&&Aa.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Aa.__e(e,t.__v)}}))}function nl(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Aa.__e(e,n)}}function il(e,t,n){var i,r;if(Aa.unmount&&Aa.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||nl(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Aa.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&il(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||$a(e.__e),e.__=e.__e=e.__d=void 0}function rl(e,t,n){return this.constructor(e,n)}function ol(e,t,n){var i,r,o;Aa.__&&Aa.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],el(t,e=(!i&&n||t).__k=La(za,null,[e]),r||Na,Na,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Ca.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i),tl(o,e)}Ca=Ba.slice,Aa={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Ta=0,Va.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Ia({},this.state),"function"==typeof e&&(e=e(Ia({},n),this.props)),e&&Ia(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ua(this))},Va.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ua(this))},Va.prototype.render=za,Ma=[],Wa.__r=0;var sl=function(e,t,n,i){var r;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?i[0]=a:4===s?i[1]=Object.assign(i[1]||{},a):5===s?(i[1]=i[1]||{})[t[++o]]=a:6===s?i[1][t[++o]]+=a+"":s?(r=e.apply(a,sl(e,a,n,["",null])),i.push(r),a[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(a)}return i},al=new Map;var ll,cl,pl,ul,dl=function(e){var t=al.get(this);return t||(t=new Map,al.set(this,t)),(t=sl(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,i=1,r="",o="",s=[0],a=function(e){1===i&&(e||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,e,r):3===i&&(e||r)?(s.push(3,e,r),i=2):2===i&&"..."===r&&e?s.push(4,e,0):2===i&&r&&!e?s.push(5,0,!0,r):i>=5&&((r||!e&&5===i)&&(s.push(i,0,r,n),i=6),e&&(s.push(i,e,0,n),i=6)),r=""},l=0;l<e.length;l++){l&&(1===i&&a(),a(l));for(var c=0;c<e[l].length;c++)t=e[l][c],1===i?"<"===t?(a(),s=[s],i=3):r+=t:4===i?"--"===r&&">"===t?(i=1,r=""):r=t+r[0]:o?t===o?o="":r+=t:'"'===t||"'"===t?o=t:">"===t?(a(),i=1):i&&("="===t?(i=5,n=r,r=""):"/"===t&&(i<5||">"===e[l][c+1])?(a(),3===i&&(s=s[0]),i=s,(s=s[0]).push(2,0,i),i=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),i=2):r+=t),3===i&&"!--"===r&&(i=4,s=s[0])}return a(),s}(e)),t),arguments,[])).length>1?t:t[0]}.bind(La),hl=0,ml=[],fl=[],gl=Aa.__b,yl=Aa.__r,vl=Aa.diffed,bl=Aa.__c,wl=Aa.unmount;function xl(e,t){Aa.__h&&Aa.__h(cl,e,hl||t),hl=0;var n=cl.__H||(cl.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:fl}),n.__[e]}function _l(e){return hl=1,function(e,t,n){var i=xl(ll++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):Nl(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=cl,!cl.u)){cl.u=!0;var r=cl.shouldComponentUpdate;cl.shouldComponentUpdate=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.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&&i.__c.props===e)&&(!r||r.call(this,e,t,n))}}return i.__N||i.__}(Nl,e)}function El(e,t){var n=xl(ll++,3);!Aa.__s&&Dl(n.__H,t)&&(n.__=e,n.i=t,cl.__H.__h.push(n))}function Ol(e,t){var n=xl(ll++,4);!Aa.__s&&Dl(n.__H,t)&&(n.__=e,n.i=t,cl.__h.push(n))}function Pl(e){return hl=5,kl((function(){return{current:e}}),[])}function kl(e,t){var n=xl(ll++,7);return Dl(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Sl(e,t){return hl=8,kl((function(){return e}),t)}function Cl(){for(var e;e=ml.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ml),e.__H.__h.forEach(Rl),e.__H.__h=[]}catch(t){e.__H.__h=[],Aa.__e(t,e.__v)}}Aa.__b=function(e){cl=null,gl&&gl(e)},Aa.__r=function(e){yl&&yl(e),ll=0;var t=(cl=e.__c).__H;t&&(pl===cl?(t.__h=[],cl.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=fl,e.__N=e.i=void 0}))):(t.__h.forEach(Ml),t.__h.forEach(Rl),t.__h=[])),pl=cl},Aa.diffed=function(e){vl&&vl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ml.push(t)&&ul===Aa.requestAnimationFrame||((ul=Aa.requestAnimationFrame)||Tl)(Cl)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==fl&&(e.__=e.__V),e.i=void 0,e.__V=fl}))),pl=cl=null},Aa.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Ml),e.__h=e.__h.filter((function(e){return!e.__||Rl(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Aa.__e(n,e.__v)}})),bl&&bl(e,t)},Aa.unmount=function(e){wl&&wl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{Ml(e)}catch(e){t=e}})),n.__H=void 0,t&&Aa.__e(t,n.__v))};var Al="function"==typeof requestAnimationFrame;function Tl(e){var t,n=function(){clearTimeout(i),Al&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);Al&&(t=requestAnimationFrame(n))}function Ml(e){var t=cl,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),cl=t}function Rl(e){var t=cl;e.__c=e.__(),cl=t}function Dl(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Nl(e,t){return"function"==typeof t?t(e):t}function Bl(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Bl(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function jl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Bl(e))&&(i&&(i+=" "),i+=t);return i}function Il(e){const{entry:t,selected:n,onMouseEnter:i,onMouseLeave:r,onAction:o}=e;return dl`
|
|
2
2
|
<li
|
|
3
3
|
class=${jl("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=${i}
|
|
9
|
+
onBlur=${r}
|
|
7
10
|
onMouseEnter=${i}
|
|
8
11
|
onMouseLeave=${r}
|
|
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 Ll(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,entries:h,onOpened:m,onClosed:f}=e,g=kl((()=>!!a(p)&&h.length>5),[p,h]),y
|
|
75
|
+
`}function Ll(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,entries:h,onOpened:m,onClosed:f}=e,g=kl((()=>!!a(p)&&h.length>5),[p,h]),[y,v]=_l(""),b=Sl(((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]=_l(b(h,y)),[_,E]=_l(w[0]),O=Sl((e=>{_&&e.includes(_)||E(e[0]),x(e)}),[_,x,E]);El((()=>{O(b(h,y))}),[y,h]);const P=Sl((e=>{let t=w.indexOf(_)+e;t<0&&(t=w.length-1),t>=w.length&&(t=0),E(w[t])}),[w,_,E]),k=Sl((e=>"Enter"===e.key&&_?n(e,_):"ArrowUp"===e.key?(P(-1),e.preventDefault()):"ArrowDown"===e.key?(P(1),e.preventDefault()):void 0),[n,_,P]),S=Sl((e=>{ee(e.target,"input")&&v((()=>e.target.value))}),[v]);El((()=>(m(),()=>{f()})),[]);const C=kl((()=>s||r.length>0),[s,r]);return dl`
|
|
72
76
|
<${ql}
|
|
73
77
|
onClose=${t}
|
|
74
|
-
onKeyup=${
|
|
75
|
-
onKeydown=${
|
|
78
|
+
onKeyup=${S}
|
|
79
|
+
onKeydown=${k}
|
|
76
80
|
className=${i}
|
|
77
81
|
position=${o}
|
|
78
82
|
width=${l}
|
|
79
83
|
scale=${c}
|
|
80
84
|
>
|
|
81
|
-
${
|
|
85
|
+
${C&&dl`
|
|
82
86
|
<div class="djs-popup-header">
|
|
83
87
|
<h3 class="djs-popup-title" title=${s}>${s}</h3>
|
|
84
88
|
${r.map((e=>dl`
|
|
85
|
-
|
|
86
|
-
class=${function(e,t){return jl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}(e,e===
|
|
89
|
+
<${e.action?"button":"span"}
|
|
90
|
+
class=${function(e,t){return jl("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=${()=>E(e)}
|
|
95
|
+
onMouseLeave=${()=>E(null)}
|
|
96
|
+
onFocus=${()=>E(e)}
|
|
97
|
+
onBlur=${()=>E(null)}
|
|
92
98
|
>
|
|
93
99
|
${e.imageUrl&&dl`<img class="djs-popup-entry-icon" src=${e.imageUrl} alt="" />`||e.imageHtml&&dl`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:e.imageHtml}} />`}
|
|
94
100
|
|
|
95
101
|
${e.label?dl`
|
|
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
|
<${$l}
|
|
118
|
-
entries=${
|
|
119
|
-
selectedEntry=${
|
|
120
|
-
setSelectedEntry=${
|
|
121
|
+
entries=${w}
|
|
122
|
+
selectedEntry=${_}
|
|
123
|
+
setSelectedEntry=${E}
|
|
121
124
|
onAction=${n}
|
|
122
125
|
/>
|
|
123
126
|
</div>
|
|
124
|
-
${u&&0===x.length&&dl`
|
|
125
|
-
<div class="djs-popup-no-results">${d(u)?u(v):u}</div>
|
|
126
|
-
`}
|
|
127
127
|
`}
|
|
128
|
+
${u&&0===w.length&&dl`
|
|
129
|
+
<div class="djs-popup-no-results">${d(u)?u(y):u}</div>
|
|
130
|
+
`}
|
|
128
131
|
</${ql}>
|
|
129
|
-
`}function ql(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:s}=e,a=Pl()
|
|
132
|
+
`}function ql(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,position:s}=e,a=Pl();return Ol((()=>{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]),Ol((()=>{const e=a.current;if(!e)return;(e.querySelector("input")||e).focus()}),[]),El((()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),t()},n=e=>{if(!te(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)}}),[]),dl`
|
|
130
133
|
<div
|
|
131
|
-
class
|
|
132
|
-
|
|
134
|
+
class=${jl("djs-popup",r)}
|
|
135
|
+
style=${function(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`}}(e)}
|
|
136
|
+
onKeydown=${n}
|
|
137
|
+
onKeyup=${i}
|
|
138
|
+
ref=${a}
|
|
139
|
+
tabIndex="-1"
|
|
133
140
|
>
|
|
134
|
-
|
|
135
|
-
class=${jl("djs-popup",r)}
|
|
136
|
-
style=${function(e){return{transform:`scale(${e.scale})`,width:`${e.width}px`}}(e)}
|
|
137
|
-
onKeydown=${n}
|
|
138
|
-
onKeyup=${i}
|
|
139
|
-
ref=${a}
|
|
140
|
-
tabIndex="-1"
|
|
141
|
-
>
|
|
142
|
-
${o}
|
|
143
|
-
</div>
|
|
141
|
+
${o}
|
|
144
142
|
</div>
|
|
145
143
|
`}var zl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Vl(e,t,n){this._eventBus=t,this._canvas=n,this._current=null;var i=a(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this.refresh()}))}Vl.$inject=["config.popupMenu","eventBus","canvas"],Vl.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,s=Object.entries(n).map((([e,t])=>({id:e,...t}))),a=Object.entries(i).map((([e,t])=>({id:e,...t}))),l=e&&(t=>this._ensureVisible(t,e)),c=this._updateScale(this._current.container);ol(dl`
|
|
146
144
|
<${Ll}
|
|
@@ -156,7 +154,7 @@
|
|
|
156
154
|
onClosed=${this._onClosed.bind(this)}
|
|
157
155
|
...${{...o}}
|
|
158
156
|
/>
|
|
159
|
-
`,this._current.container)},Vl.prototype.open=function(e,t,n,i){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:r,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Vl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Vl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(r).length)}},Vl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Vl.prototype.reset=function(){const e=this._current.container;ol(null,e),be(e)},Vl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Vl.prototype._onOpened=function(){this._emit("opened")},Vl.prototype._onClosed=function(){this._emit("closed")},Vl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Vl.prototype._bindAutoClose=function(){this._eventBus.once(zl,this.close,this)},Vl.prototype._unbindAutoClose=function(){this._eventBus.off(zl,this.close,this)},Vl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),a(e)&&n<e&&(r=e),a(t)&&n>t&&(r=t)),r},Vl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,s=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,s=t.y-i.height):r.x?(o=t.x-i.width,s=t.y):r.y&&t.y<i.height?(o=t.x,s=10):r.y&&(o=t.x,s=t.y-i.height),t.y<n.top&&(s=t.y+i.height),{x:o,y:s}},Vl.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},Vl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Vl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Vl.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);d(i)?n=i(n):v(i,(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},Vl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);d(i)?n=i(n):v(i,(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},Vl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Vl.prototype.isOpen=function(){return!!this._current},Vl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Vl.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 Fl={__init__:["popupMenu"],popupMenu:["type",Vl]},Hl={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 Ul(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ul.$inject=["contextPad","popupMenu","translate","canvas"],Ul.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ul.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ul.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Hl.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);I(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ul.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Wl=["left","center","right","top","middle","bottom"];function Ql(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Gl(e){fs.call(this,e),this.init()}function Xl(e){Gl.call(this,e)}Ql.$inject=["popupMenu","alignElements","translate","rules"],Ql.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ql.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ql.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return v(Wl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Hl[o],action:function(){t.trigger(e,o),i.close()}}})),r},Gl.$inject=["eventBus"],e(Gl,fs),Gl.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},Gl.prototype.init=function(){},Xl.$inject=["eventBus"],e(Xl,Gl),Xl.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 Kl={__depends__:[Oa,Da,Fl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ul],alignElementsMenuProvider:["type",Ql],bpmnAlignElements:["type",Xl]},Yl=10,Zl=50,Jl=250;function ec(e,t,n,i){for(var r;r=nc(e,n,t);)n=i(t,n,r);return n}function tc(e){return function(t,n,i){var r={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;r[o]=l<0?Math.min(i[o]+l-t[a]/2,n[o]-c+l):Math.max(i[o]+i[a]+l+t[a]/2,n[o]+c+l)}})),r}}function nc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=ic(e);e.host&&(t=t.concat(ic(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(ic(t))}),[])));return t}(e);return f(r,(function(e){return e!==n&&"intersect"===_n(e,i,Yl)}))}function ic(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 rc(){return!0}function oc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||Zl,r=xn(e),o=vn(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function sc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}oc.$inject=["eventBus","modeling","canvas"],sc.$inject=["eventBus","selection"];var ac={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",oc],autoPlaceSelectionBehavior:["type",sc]};function lc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Sr(e,t))return e;return null}function cc(e,t){return kr(t,"bpmn:TextAnnotation")?function(e,t){var n=vn(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};mn(e)&&((i=xn(e)).x+=100,i.y-=50);return ec(e,t,i,tc({y:{margin:-30,minDistance:20}}))}(e,t):Sr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=vn(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return ec(e,t,i,tc({x:{margin:30,minDistance:30}}))}(e,t):kr(t,"bpmn:FlowNode")?function(e,t){var n=vn(e),i=xn(e),r=function(e,t){t||(t={});var n=t.defaultDistance||Zl,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||Jl,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===i?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===i?"start"===a?vn(t).top-vn(e).bottom:"center"===a?xn(t).y-vn(e).bottom:vn(t).bottom-vn(e).bottom:"start"===a?vn(t).left-vn(e).right:"center"===a?xn(t).x-vn(e).right:vn(t).right-vn(e).right}r||(r=rc);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),p=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,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,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return kr(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";kr(e,"bpmn:BoundaryEvent")&&-1!==(a=_n(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+r+t.width/2,y:i.y+pc(a,s)};return ec(e,t,l,tc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function pc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function uc(e){e.on("autoPlace",(function(e){var t=e.shape;return cc(e.source,t)}))}uc.$inject=["eventBus"];var dc={__depends__:[ac],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",uc]};function hc(e,t,n,r){fs.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,r=t.parent||t.newParent;!1!==n.autoResize&&o._expand([i],r)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=i(P(t.closure.topLevel)),r=t.hints,s=!r||r.autoResize;!1!==s&&v(k(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return f(s,T({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,i=t.shape;n&&!1===n.autoResize||i.collapsed||o._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&!1===n.autoResize||r&&o._expand([i],r)}))}function mc(e){e.invoke(hc,this)}function fc(e){Gl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function gc(e,t){fc.call(this,e),this._modeling=t}hc.$inject=["eventBus","elementRegistry","modeling","rules"],e(hc,fs),hc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=vn(bt(e)),o=vn(t),s={};return r.top-o.top<i.top&&(s.top=r.top-n.top),r.left-o.left<i.left&&(s.left=r.left-n.left),o.right-r.right<i.right&&(s.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(s.bottom=r.bottom+n.bottom),bn(I({},o,s))},hc.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 i=function(e,t){var n="";e=vn(e),t=vn(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}(L(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},hc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},hc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},hc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},mc.$inject=["injector"],e(mc,hc),mc.prototype.resize=function(e,t,n){kr(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},fc.$inject=["eventBus"],e(fc,Gl),fc.prototype.canResize=function(e,t){return!1},e(gc,fc),gc.$inject=["eventBus","modeling"],gc.prototype.canResize=function(e,t){if(kr(t.di,"bpmndi:BPMNPlane"))return!1;if(!kr(t,"bpmn:Participant")&&!kr(t,"bpmn:Lane")&&!kr(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(kr(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var yc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mc],bpmnAutoResizeProvider:["type",gc]};function vc(e,t,n){var i,r,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,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),s.hover({element:r,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=zo(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}vc.$inject=["elementRegistry","eventBus","injector"];var bc={__init__:["hoverFix"],hoverFix:["type",vc]},wc=Math.round,xc="djs-drag-active";function _c(e){e.preventDefault()}function Ec(e,t,n,i){var r,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||r;var i=e.createEvent(I({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var o,l=r.payload,c=r.displacement,p=r.globalStart,u=zo(e),d=ca(u,p),h=r.localStart,m=s(u),g=ca(m,h);if(!r.active&&(i||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(I(l,{x:wc(h.x+c.x),y:wc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return f();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&ra(r.cursor),t.addMarker(t.getRootElement(),xc)}qo(e),r.active&&(I(l,{x:wc(m.x+c.x),y:wc(m.y+c.y),dx:wc(g.x),dy:wc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,qo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Hs("Escape",e)&&(_c(e),f())}function u(t){var n;r.active&&(n=aa(e),setTimeout(n,400),_c(t)),c(t)}function d(e){l(e)}function h(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function m(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function f(e){var t;if(r){var n=r.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),oa(),g=r.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",_c),ce.unbind(document,"selectstart",_c),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",f,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),xc);var y=r.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(y),s=r,r=null,s}e.on("diagram.destroy",f),this.init=function(t,n,i,g){r&&f(!1),"string"==typeof n&&(g=i,i=n,n=null);var y,v,b,w,x,_=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=Lo(t)||t,v=zo(t),qo(t),"dragstart"===y.type&&_c(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),r=I({prefix:i,data:_,payload:{},globalStart:v,displacement:ca(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",f,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",_c),ce.bind(document,"selectstart",_c),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=m,this.end=c,this.cancel=f,this.context=function(){return r},this.setOptions=function(e){I(o,e)}}Ec.$inject=["eventBus","canvas","selection","elementRegistry"];var Oc={__depends__:[bc,os],dragging:["type",Ec]};function Pc(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function kc(e,t,n){return t<e&&e<n}Pc.$inject=["config.autoScroll","eventBus","canvas"],Pc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)kc(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(){i.startScroll(e)}),n.scrollRepeatTimeout))},Pc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Pc.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Pc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=zo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Sc={__depends__:[Oc],__init__:["autoScroll"],autoScroll:["type",Pc]};function Cc(e){this._commandStack=e.get("commandStack",!1)}Cc.$inject=["injector"],Cc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Ac={__init__:["rules"],rules:["type",Cc]},Tc=Math.round,Mc=Math.max;var Rc=10;function Dc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Ct(i,t)<=Rc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=an(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,Rc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],s=r[r.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[i=Mc(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Tc(o.x+s.x)/2,y:Tc(o.y+s.y)/2},index:o.segment2}:{point:{x:Tc(o.x),y:Tc(o.y)},index:o.segment2}:null}(e,t)}function Nc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function jc(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Ic(e,t){var n=jc(e,t);return Nc({x:n.x-e.x,y:n.y-e.y})}function $c(e,t){return Nc({x:e.x-t.x,y:e.y-t.y})}var Lc="djs-bendpoint",qc="djs-segment-dragger";function zc(e,t,n){var i=function(e,t){var n,i=zo(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return Dc(t,i)}function Vc(e,t){var n=Be("g");Se(n).add(Lc),xe(e,n);var i=Be("circle");Pe(i,{cx:0,cy:0,r:4}),Se(i).add("djs-visual"),xe(n,i);var r=Be("circle");return Pe(r,{cx:0,cy:0,r:10}),Se(r).add("djs-hit"),xe(n,r),t&&Se(n).add(t),n}function Fc(e,t,n,i){var r=Be("g");xe(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Uc("h"===n?i:r)}(t,n,i),s=Be("rect");Pe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(r,s);var a=Be("rect");return Pe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(r,a),Jn(r,"v"===i?90:0),r}function Hc(e,t,n){var i=Be("g"),r=Nt(t,n),o=Mt(t,n);return xe(e,i),Fc(i,t,n,o),Se(i).add(qc),Se(i).add("h"===o?"horizontal":"vertical"),Zn(i,r.x,r.y),i}function Uc(e){return Math.abs(Math.round(2*e/3))}function Wc(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var s=Ic(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return jc(e,n)}function Qc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=zc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Mt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Uc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,r,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Nt(i=t[c-1],r=t[c]),s=Mt(i,r),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?i.start(e,n,a.index,!a.bendpoint):r.start(e,n,a.index),!0}function s(e,t,i){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),r=ye('.djs-bendpoints[data-element-id="'+bs(e.id)+'"]',i);return!r&&n&&(Pe(r=Be("g"),{"data-element-id":e.id}),Se(r).add("djs-bendpoints"),xe(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}function l(e,t){return ye('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var i=Vc(e);xe(e,i),Zn(i,t.x,t.y)})),Vc(e,"floating")}function p(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],i=o[a])&&(Pe(r=Hc(e,n,i),{"data-segment-idx":a}),s(r,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(ve("."+qc,e),(function(e){Ae(e)}))}(t),function(e){v(ve("."+Lc,e),(function(e){Ae(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var i,r,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Nt(s,a),u=Mt(s,a);o&&(i=function(e){return ye(".djs-visual",e)}(o),r={x:c.x-p.x,y:c.y-p.y},"v"===u&&(r={x:r.y,y:r.x}),Zn(i,r.x,r.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ae(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=a(r,!0),!(i=zc(t,o,e.originalEvent)))return;!function(e,t){var n=ye(".floating",e),i=t.point;n&&Zn(n,i.x,i.y)}(n,i),i.bendpoint||h(n,i,o)}})),e.on("element.mousedown",(function(e){if(Ho(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 i=a(t);i&&Pe(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Qc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Gc=Math.round,Xc="reconnectStart",Kc="reconnectEnd",Yc="updateWaypoints";function Zc(e,t,n,i,r,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,d=(a=s||0!==o?s||o!==u.length-1?Yc:Kc:Xc)===Yc?"connection.updateWaypoints":"connection.reconnect",h=r.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=r.allowed(d,{connection:t,source:p,target:c})),!1!==h&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===Yc?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Xc?a:o,target:l===Kc?a:s}))return n.source=l===Xc?a:o,void(n.target=l===Kc?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===Kc?a:s,target:l===Xc?a:o})),t&&(n.source=l===Kc?a:s,n.target=l===Xc?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!==Yc&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,s=t.insert,a=r.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:Gc(e.x),y:Gc(e.y)};if(!n)return!1;p===Yc?(s?a.splice(i,0,d):a[i]=d,u.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(r,a),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===Ct(t,i=e[r+1])||At(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(p===Xc?(u.docking="source",Jc(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===Kc&&(u.docking="target",Jc(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,d,u))}),this)}function Jc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Xc?t&&i&&t===i&&n!==i:r===Kc?t&&n&&t===n&&n!==i:void 0}Zc.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Zc.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var ep="updateWaypoints",tp="connect-ok",np="connect-not-ok",ip="connect-hover",rp="djs-updating",op="djs-dragging";function sp(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,s=r.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),r.waypoints=a,Se(t.draggerGfx=Vc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,op),i.addMarker(r,rp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,ip),o===ep)return;n?(i.removeMarker(r,np),i.addMarker(r,tp)):!1===n&&(i.removeMarker(r,tp),i.addMarker(r,np))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,ip),i.removeMarker(n,r?tp:np))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},m=n.hints||{},f={};r&&(m.connectionStart&&(f.connectionStart=m.connectionStart),m.connectionEnd&&(f.connectionEnd=m.connectionEnd),"reconnectStart"===l?Jc(n)?(f.connectionEnd=f.connectionEnd||h,f.source=u,f.target=a||p,d=d.reverse()):(f.connectionStart=f.connectionStart||h,f.source=a||p,f.target=u):"reconnectEnd"===l?Jc(n)?(f.connectionStart=f.connectionStart||h,f.source=a||u,f.target=p,d=d.reverse()):(f.connectionEnd=f.connectionEnd||h,f.source=p,f.target=a||u):(f.noCropping=!0,f.noLayout=!0,d[o]=h),l===ep&&(d=e.cropWaypoints(c,d)),f.waypoints=d,r.drawPreview(n,i,f)),Zn(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,Ae(o),i.removeMarker(n,rp),i.removeMarker(n,op),s&&(i.removeMarker(s,tp),i.removeMarker(s,a?tp:np)),r&&r.cleanUp(t)}))}sp.$inject=["bendpointMove","injector","eventBus","canvas"];var ap="connect-hover",lp="djs-updating";function cp(e,t,n){return pp(e,t,e[t]+n)}function pp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function up(e){return"x"===e?"y":"x"}function dp(e,t,n){var i,r;return e.original?e.original:(i=xn(t),pp(e,r=up(n),i[r]))}function hp(e,t,n,i,r,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){r.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return pp(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],up(e.axis));Zn(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,s,a,l,c=n.getGraphics(t),p=r-1,u=r,d=t.waypoints,h=d[p],m=d[u],f=zc(n,d,e);(s=Mt(h,m))&&(a="v"===s?"x":"y",0===p&&(h=dp(h,t.source,a)),u===d.length-1&&(m=dp(m,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:m,axis:a,dragPosition:l=f?f.point:{x:(h.x+m.x)/2,y:(h.y+m.y)/2}},i.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,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Hc(r,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(i,lp)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,s=i.segmentEndIndex,p=i.segmentStart,u=i.segmentEnd,d=i.axis,h=i.originalWaypoints.slice(),m=cp(p,d,e["d"+d]),f=cp(u,d,e["d"+d]),g=h.length,y=0;h[o]=m,h[s]=f,o<2&&(t=_n(r.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=_n(r.target,f),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=f):"intersect"!==n&&h.push(u)),i.newWaypoints=r.waypoints=a(r,h),c(i,y,e),i.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,ap)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,ap)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&Ae(t.draggerGfx),n.removeMarker(i,lp)})),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,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,r){return!At(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,l,p)}))}hp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var mp=Math.abs,fp=Math.round;function gp(e){return{x:e.x,y:e.y}}function yp(e){return{x:e.x+e.width,y:e.y+e.height}}function vp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:fp(e.x+e.width/2),y:fp(e.y+e.height/2)}}function bp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function wp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function xp(e){return e.children||[]}var _p=Math.abs,Ep=Math.round;function Op(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(_p(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Wc(t,e):e.width?{x:Ep(e.width/2+e.x),y:Ep(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(i)return i;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(r.source,e)),c>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&i.horizontal.push(e.y),"x"===p&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(o){var l=s-(i=t(o.vertical,s)),c=a-(r=t(o.horizontal,a));I(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:r}),(l||-1!==o.vertical.indexOf(s))&&wp(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&wp(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);mn(t)&&i&&i.x&&i.y&&(wp(e,"x",i.x),wp(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(r,(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-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,p));I(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&wp(e,"x",i),(d||-1!==s.horizontal.indexOf(p))&&wp(e,"y",r)}}))}Op.$inject=["eventBus"];var Pp={__depends__:[Oc,Ac],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Qc],bendpointMove:["type",Zc],bendpointMovePreview:["type",sp],connectionSegmentMove:["type",hp],bendpointSnapping:["type",Op]};function kp(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);l(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),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,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:Sp(t)?o:r,connectionEnd:Sp(t)?r:o};p(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,r){p(i)||(r=i,i=xn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Sp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}kp.$inject=["eventBus","dragging","modeling","rules"];var Cp="connect-ok",Ap="connect-not-ok";function Tp(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=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,d=p;Sp(t)&&(u=p,d=c),i.drawPreview(t,n,{source:o||s,target:l||r,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?Cp:Ap)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Cp),n.removeMarker(t,Ap))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Tp.$inject=["injector","eventBus","canvas"];var Mp={__depends__:[os,Ac,Oc],__init__:["connectPreview"],connect:["type",kp],connectPreview:["type",Tp]};function Rp(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Rp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Rp.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,m=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(r),o||(o=e.getConnection=function(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}((function(e,t,n){return m.getConnection(e,t,n)}))),t&&(i=o(t,s,a)),i?(i.waypoints=l||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[s?xn(s):c,a?xn(a):p]),this._connectionDocking&&(s||a)&&!d&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,s,a)),this._graphicsFactory.drawConnection(r,i,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(r,n)},Rp.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||xn(n),o=t.connectionEnd||xn(i),s=this.cropWaypoints(r,o,n,i);xe(e,this.createNoopConnection(s[0],s[1]))},Rp.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=i&&En(s,a,!1)||t]},Rp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ae(e.connectionPreviewGfx)},Rp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Rp.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return Pe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},Rp.prototype.createNoopConnection=function(e,t){return dt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Dp={__init__:["connectionPreview"],connectionPreview:["type",Rp]},Np=["marker-start","marker-mid","marker-end"],Bp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function jp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){r.cleanUp()}))}jp.$inject=["elementRegistry","eventBus","canvas","styles"],jp.prototype.cleanUp=function(){v(this._clonedMarkers,(function(e){Ae(e)})),this._clonedMarkers={}},jp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},jp.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Kn(r),i),Pe(r,this._styles.cls(i,[],{x:o.top,y:o.left})),xe(t,r),Pe(r,"data-preview-support-element-id",e.id),r},jp.prototype.addFrame=function(e,t){var n=Be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Pe(n,"data-preview-support-element-id",e.id),n},jp.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var i=0;i<e.childNodes.length;i++)n._cloneMarkers(e.childNodes[i],t);(function(e){return-1!==Bp.indexOf(e.nodeName)})(e)&&Np.forEach((function(i){if(Pe(e,i)){var r=function(e,t,n){var i=(r=Pe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ye("marker#"+i,n||document)}(e,i,n._canvas.getContainer());n._cloneMarker(e,r,i,t)}}))},jp.prototype._cloneMarker=function(e,t,n,i="djs-dragger"){var r=t.id+"-"+i,o=this._clonedMarkers[r];if(!o){var s=r+"-clone";(o=Me(t)).id=s,Se(o).add(i),this._clonedMarkers[r]=o;var a=ye("defs",this._canvas._svg);a||(a=Be("defs"),xe(this._canvas._svg,a)),xe(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[r].id);Pe(e,n,l)};var Ip={__init__:["previewSupport"],previewSupport:["type",jp]};const $p="complex-preview";class Lp{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:i=[],resized:r=[]}=e,o=this._canvas.getLayer($p);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;mn(e)?(t=this._graphicsFactory._createContainer("connection",Be("g")),this._graphicsFactory.drawConnection(Kn(t),e)):(t=this._graphicsFactory._createContainer("shape",Be("g")),this._graphicsFactory.drawShape(Kn(t),e),Zn(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)?Zn(n,t.x,t.y):Zn(n,e.x+t.x,e.y+t.y)})),i.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"])})),r.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",Be("g"));this._graphicsFactory.drawShape(Kn(n),e,{width:t.width,height:t.height}),Zn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer($p)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer($p)}hide(){this._canvas.hideLayer($p)}}Lp.$inject=["canvas","graphicsFactory","previewSupport"];var qp={__depends__:[Ip],__init__:["complexPreview"],complexPreview:["type",Lp]},zp=["top","bottom","left","right"],Vp=10;function Fp(e,t){function n(e){if(eo(e)){var n=function(e){var t=xn(e.label),n=xn(e),i=Hp(n,t);if(r=i,-1===zp.indexOf(r))return;var r;var o=function(e){var t=xn(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 Hp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=xn(e),r=_n(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=zp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=zp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=xn(e),r=e.label,o=xn(r);if(!r.parent)return;var s,a=vn(e);switch(n){case"top":s={x:i.x,y:a.top-Vp-r.height/2};break;case"left":s={x:a.left-Vp-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Vp+r.height/2};break;case"right":s={x:a.right+Vp+r.width/2,y:i.y}}var l=ca(s,o);t.moveShape(r,l)}(e,n)}}fs.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Hp(e,t){return _n(t,e,5)}function Up(e){fs.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(kr(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 Wp(e,t){e.invoke(fs,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;v(y(i.incoming.concat(i.outgoing),(function(e){return kr(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Fp,fs),Fp.$inject=["eventBus","modeling"],e(Up,fs),Up.$inject=["eventBus"],e(Wp,fs),Wp.$inject=["injector","modeling"];function Qp(e,t){t.invoke(fs,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 Gp(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Gp(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Gp(e,t){return!fn(e)&&Sr(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Xp(e,t){function n(e){return y(e.attachers,(function(e){return kr(e,"bpmn:BoundaryEvent")}))}fs.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);kr(i,"bpmn:EventBasedGateway")&&kr(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;kr(i,"bpmn:Gateway")&&kr(r,"bpmn:EventBasedGateway")&&v(r.outgoing,(function(e){var i=e.target,r=n(i);kr(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function Kp(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}fs.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(Zp(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>Yp(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!Zp(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>Jp(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>kr(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;Zp(r)&&Jp(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>kr(e,"bpmn:Association"))),r=i.filter((e=>Yp(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;Zp(t)&&Yp(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;Yp(o)&&r(o),Zp(e)&&Jp(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;Yp(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):Jp(i)&&function(e){const n=e.incoming.filter((e=>Zp(e.source)));t.removeElements(n)}(i)}),!0)}function Yp(e){const t=Cr(e);return t&&t.get("isForCompensation")}function Zp(e){return e&&kr(e,"bpmn:BoundaryEvent")&&Kr(e,"bpmn:CompensateEventDefinition")}function Jp(e){return e&&kr(e,"bpmn:Activity")&&!Xr(e)}function eu(e){e.invoke(fs,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;kr(n,"bpmn:Lane")&&!kr(i,"bpmn:Lane")&&(t.parent=lc(n,"bpmn:Participant"))}))}function tu(e,t){fs.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(kr(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Qp.$inject=["bpmnReplace","injector"],e(Qp,fs),Qp.prototype._replaceShape=function(e,t){var n,i=(n=Cr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},Xp.$inject=["eventBus","modeling"],e(Xp,fs),e(Kp,fs),Kp.$inject=["eventBus","modeling","bpmnRules"],eu.$inject=["injector"],e(eu,fs),tu.$inject=["eventBus","bpmnFactory"],e(tu,fs);var nu=20,iu=20,ru=30,ou=2e3;function su(e,t,n){function i(){var t=e.getRootElement();return kr(t,"bpmn:Collaboration")?t:n.makeCollaboration()}fs.call(this,t),t.on(["create.start","shape.move.start"],ou,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(kr(i,"bpmn:Participant")&&kr(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!kr(e,"bpmn:Group")&&!fn(e)&&!mn(e)}));if(o.length){var s=bt(o),a=function(e,t){t={width:t.width+2*nu+ru,height:t.height+2*iu};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,s);I(i,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-iu,left:t.right-e.width/2+nu,top:t.bottom-e.height/2+iu,right:t.left+e.width/2-nu-ru}}(i,s)}}})),t.on("create.start",ou,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}kr(i,"bpmn:Participant")&&kr(r,"bpmn:Process")&&(t.on("element.hover",ou,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",ou,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return f(e,(function(e){return kr(e,"bpmn:Participant")}))}(n);o&&kr(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Cr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;kr(n,"bpmn:Participant")&&kr(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Cr(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Cr(i).set("processRef",Cr(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Cr(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var s=i.children.slice();o?r===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},r)}}),!0)}su.$inject=["canvas","eventBus","modeling"],e(su,fs);var au="__targetRef_placeholder";function lu(e,t){function n(e,n){var i=e.get("properties"),r=f(i,(function(e){return e.name===au}));return!r&&n&&kt(i,r=t.create("bpmn:Property",{name:au})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return f(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||Pt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=r.newTarget,p=c&&c.businessObject,u=r.oldTarget||r.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&i(d,s),p&&p!==l&&i(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}fs.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],cu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],cu(r))}function cu(e){return function(t){if(kr(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function pu(e){this._bpmnUpdater=e}function uu(e,t,n,i){function r(e){return e.children.filter((function(e){return kr(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return kr(e,"bpmn:Participant")&&Cr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:Ar(e),newSemanticParent:o.processRef||o,newDiParent:Ar(i)})}}fs.call(this,i),t.registerHandler("dataStore.updateContainment",pu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;kr(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 kr(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!kr(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;kr(t,"bpmn:DataStoreReference")&&"label"!==t.type&&kr(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;kr(i,"bpmn:Collaboration")||kr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&kr(r,"bpmn:Collaboration")&&o(n,kr(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(kr(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();Sr(n,["bpmn:Participant","bpmn:SubProcess"])&&kr(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){kr(i,"bpmn:Process")&&o(e,i)}))}))}lu.$inject=["eventBus","bpmnFactory"],e(lu,fs),pu.$inject=["bpmnUpdater"],pu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},pu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},uu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(uu,fs);var du=Math.max,hu=Math.min,mu=20;function fu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function gu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?hu:du)(i,r)),u(o)&&(i=(/top|left/.test(e)?du:hu)(i,o)),i}function yu(e,t){return void 0!==e?e:mu}function vu(e){return!e.waypoints&&"label"!==e.type}function bu(e,t){var n;if((n=void 0===e.length?y(e.children,vu):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=yu(t.left),i=yu(t.right),r=yu(t.top),o=yu(t.bottom)):n=i=r=o=yu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(bt(n),t)}var wu=Math.abs;var xu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],_u=30;function Eu(e,t){return t=t||[],e.children.filter((function(e){kr(e,"bpmn:Lane")&&(Eu(e,t),t.push(e))})),t}function Ou(e){return e.children.filter((function(e){return kr(e,"bpmn:Lane")}))}function Pu(e){return lc(e,xu)||e}function ku(e,t){var n=Pu(e),i=Eu(n,kr(n,"bpmn:Process")?[]:[n]),r=vn(e),o=vn(t),s=function(e,t){return fu(vn(t),vn(e))}(e,t),a=[],l=Qr(e);return i.forEach((function(t){if(t!==e){var n,i,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=vn(t);s.top&&(wu(h.bottom-r.top)<10&&(u=o.top-h.bottom),wu(h.top-r.top)<5&&(c=o.top-h.top)),s.left&&(wu(h.right-r.left)<10&&(p=o.left-h.right),wu(h.left-r.left)<5&&(d=o.left-h.left)),s.bottom&&(wu(h.top-r.bottom)<10&&(c=o.bottom-h.top),wu(h.bottom-r.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(wu(h.left-r.right)<10&&(d=o.right-h.left),wu(h.right-r.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,i={top:c,right:p,bottom:u,left:d},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}})),a}function Su(e,t){fs.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;kr(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=Qr(e),c=Ou(n),p=[],u=[],d=[],h=[];yt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(i=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(r=t.calculateAdjustments(p,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),d.length&&(s=t.calculateAdjustments(d,"x",i,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:i,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-i,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}Su.$inject=["eventBus","spaceTool"],e(Su,fs);function Cu(e,t){t.invoke(fs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Au(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,s=e.host;Au(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Au(e,t){return!fn(e)&&kr(e,"bpmn:BoundaryEvent")&&!t}function Tu(e,t,n){function i(e,i,r){var o,s,a,l,c,p,d,h,m=i.waypoints,f=e.outgoing.slice(),g=e.incoming.slice(),v=Dc(m,h=u(r.width)?xn(r):r);if(v){if(o=m.slice(0,v.index),s=m.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?m[v.index]:h,1!==o.length&&Mu(e,o[o.length-1])||o.push(Ru(a)),1!==s.length&&Mu(e,s[0])||s.unshift(Ru(a))}l=i.source,c=i.target,t.canConnect(l,e,i)&&(n.reconnectEnd(i,e,o||h),p=i),t.canConnect(e,c,i)&&(p?d=n.connect(e,c,{type:i.type,waypoints:s}):(n.reconnectStart(i,e,s||h),d=i));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(f,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}fs.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+r.x,y:s.y+r.y},l=f(n.children,(function(e){return t.canInsert(i,e)&&Dc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Mu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Ru(e){return I({},e)}function Du(e,t){fs.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Nu(i)){(kr(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&Nu(e))):o.incoming.filter((e=>e!==i&&Nu(e)&&kr(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;kr(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Nu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Nu).forEach((function(i){const r=e.incoming.filter(Nu).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function Nu(e){return kr(e,"bpmn:SequenceFlow")}Cu.$inject=["bpmnReplace","injector"],e(Cu,fs),Cu.prototype._replaceShape=function(e){var t,n,i=(n=Cr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Tu,fs),Tu.$inject=["eventBus","bpmnRules","modeling"],Du.$inject=["eventBus","modeling"],e(Du,fs);var Bu=1500;function ju(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"],Bu,(function(t){var i=t.context.shape||t.shape,r=t.hover;kr(r,"bpmn:Lane")&&!Sr(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Pu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Sr(i,["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"],Bu,(function(t){var n=t.hover;kr(n,"bpmn:Lane")&&(t.hover=Pu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Bu,(function(t){var n=t.context,i=t.hover,r=n.type;kr(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Pu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Bu,(function(e){var t=e.context,n=t.start;kr(n,"bpmn:Lane")&&(t.start=Pu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;kr(t,"bpmn:Lane")&&(e.shape=Pu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&kr(t,"bpmn:Lane")&&(e.hover=Pu(t))}))}ju.$inject=["elementRegistry","eventBus","canvas"];function Iu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return kr(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Cr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,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 Cr(e).categoryValueRef===t}))}(r,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 kt(t.get("categoryValue"),e),e.$parent=t,kt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Cr(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,i=t.categoryValue,r=Cr(e);i?(r.categoryValueRef=null,s(i,n,r)):s(null,r.categoryValueRef.$parent,r)}function p(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(fs,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;kr(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;kr(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Cr(n);if(kr(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(s(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(kr(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Cr(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;kr(n,"bpmn:Group")&&!n.labelTarget&&Cr(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;kr(n,"bpmn:Group")&&!n.labelTarget&&Cr(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(kr(n,"bpmn:Group")&&!n.labelTarget){var i=Cr(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=p(r,!0),r.$parent&&(t.category=p(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=p(i)),r&&(i.$parent=p(r)),delete t.category,delete t.categoryValue}))}function $u(e,t,n,i){var r,o,s,a;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((i.x-n.x)*o-(i.y-n.y)*s)/r,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Lu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=$u(e,t,n,r),a=$u(e,t,n,o);i=s&&a?qu(s,n)>qu(a,n)?a:s:s||a,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],xn(n.source)),t(i[i.length-1],i[i.length-2],xn(n.target)))}))}function qu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zu(e){fs.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Cr(n),r=Ar(n);if(Sr(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Iu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Iu,fs),Lu.$inject=["eventBus"],zu.$inject=["eventBus"],e(zu,fs);var Vu=Math.sqrt,Fu=Math.min,Hu=Math.max,Uu=Math.abs;function Wu(e){return Math.pow(e,2)}function Qu(e,t){return Vu(Wu(e.x-t.x)+Wu(e.y-t.y))}function Gu(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=r*r+o*o,c=(r*s+o*a)/l,p=c*c-(s*s+a*a-i*i)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Vu(p),d=-c+u,h=-c-u,m={x:e.x-r*d,y:e.y-o*d};return 0===p?[m]:[m,{x:e.x-r*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return Xu(e.x,t.x,n.x)&&Xu(e.y,t.y,n.y)}(n,e,t)}))}function Xu(e,t,n){return e>=Fu(t,n)-Ku&&e<=Hu(t,n)+Ku}var Ku=.1;function Yu(e,t){return Uu(e.x-t.x)<=Ku&&Uu(e.y-t.y)<=Ku}function Zu(e,t,n,i){var r=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,i,r,o,s,a,l,c,p,u,d,h,m=0;for(m=0;m<t.length-1;m++){if(Yu(n=t[m],i=t[m+1])?a=[n]:(r=Qu(e,n),o=Qu(e,i),a=Gu(n,i,e,Fu(r,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:m,bendpointIndex:Yu(n,a[0])?m:m+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:m,relativeLocation:Qu(n,s)/Qu(n,i)}),c=Qu(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var s=i.segmentMove.segmentStartIndex,a=i.segmentMove.newSegmentStartIndex;return r===s?a:r>=a?r+o<a?a:r+o:r}if(i.bendpointMove){var l,c=i.bendpointMove.insert,p=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=p&&(l=c?r+1:r-1),r<p&&(l=r,c&&"bendpoint"!==n.type&&p-1===r&&Ju(t,p)<n.relativeLocation&&l++),l)}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,i);if(c<0||c>t.length-2||null===c)return s;var p,u,d=ed(n,l),h=ed(t,c),m=a.position,f=function(e,t){var n=$c(e[0],e[1]),i=$c(e[0],t);return 0===n?0:i/n}(d,m),g=(p=h,u=Bc(d),Bc(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:r=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+r,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(f=Ju(n,v))}var x,_,E={x:(h[1].x-h[0].x)*f+h[0].x,y:(h[1].y-h[0].y)*f+h[0].y},O=(x={x:e.x-m.x,y:e.y-m.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return r=E.x+O.x-e.x,o=E.y+O.y-e.y,{point:yn(E),delta:yn({x:r,y:o})}}function Ju(e,t){var n=$c(e[t-1],e[t]);return n/(n+$c(e[t],e[t+1]))}function ed(e,t){return[e[t],e[t+1]]}function td(e,t,n){var i=la(t),r=la(n),o=ca(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return yn({x:r.x+s,y:r.y+a})}function nd(e,t,n){var i=la(e),r=la(t),o=la(n),s=ca(e,i),a=ca(i,r),l=function(e,t,n){var i=vn(t),r=vn(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)}(i,r))return null;var o,s,a,l=_n(t,e);if("top"===l)o={x:0,y:r.bottom-i.bottom};else if("bottom"===l)o={x:0,y:r.top-i.top};else if("right"===l)o={x:r.left-i.left,y:0};else{if("left"!==l)return null;o={x:r.right-i.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=_n(n,s),a!==l)return null;return o}(i,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,d=o.y+p;return yn({x:u+s.x-e.x,y:d+s.y-e.y})}var id="name",rd="text";function od(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(id in o&&t.updateLabel(r,o[id]),rd in o&&kr(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[rd]||"");t.updateLabel(r,o.text,s)}}function o(e){var t=e.context,n=t.connection,i=n.label,r=I({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Zu(xn(e),t,n,i).delta}(i,o,s,r)}fs.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Cr(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!fn(i)&&Jr(i)&&ro(i)&&t.updateLabel(i,ro(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Cr(n);r&&Jr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,s=i.oldBounds;if(eo(r)){var a=r.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Ic(e,t)}}));return A(n,"distance")[0].line}(e,t);return jc(e,n)}(xn(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=sd(l,s,o);t.moveShape(a,c)}}))}function sd(e,t,n){return yn(ca(td(e,t,n),e))}function ad(e,t){function n(e,t){var n=e.context,i=n.connection,r=I({},n.hints),o=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Zu(e,t,n,i).point}(t,o,s,r)}fs.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),s=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,s)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),s=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+s.x,y:n.y+s.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+s.x,y:n.y+s.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function ld(e,t,n){var i=hd(e),r=md(i,t),o=i[0];return r.length?r[r.length-1]:td(o.original||o,n,t)}function cd(e,t,n){var i=hd(e),r=md(i,t),o=i[i.length-1];return r.length?r[0]:td(o.original||o,n,t)}function pd(e,t,n){var i=hd(e),r=dd(t,n),o=i[0];return td(o.original||o,r,t)}function ud(e,t,n){var i=hd(e),r=dd(t,n),o=i[i.length-1];return td(o.original||o,r,t)}function dd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function hd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function md(e,t){return y(E(e,fd),(function(e){return function(e,t){return"intersect"===_n(t,e,1)}(e,t)}))}function fd(e){return e.original||e}function gd(e,t){fs.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return kr(e,"bpmn:Participant")&&Wr(e)&&kr(t,"bpmn:Participant")&&!Wr(t)}(n,i)){var r,o,s,a,l=(o=vt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){kr(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){kr(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=cd(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=ld(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(od,fs),od.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(ad,fs),ad.$inject=["eventBus","modeling"],gd.$inject=["eventBus","modeling"],e(gd,fs);const yd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function vd(e){const t=Cr(e);if(!(kr(t,"bpmn:BoundaryEvent")||kr(t,"bpmn:StartEvent")&&Xr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&yd.some((e=>kr(n[0],e)))}function bd(e){return kr(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function wd(e,t){e.invoke(fs,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!vd(i))return;const o=bd(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Cr(n).get(o);s!==Cr(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function xd(e,t){fs.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Ar(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function _d(e,t,n){fs.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(kr(r,"bpmn:SequenceFlow")&&kr(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=$u(Ed(e[e.length-2]),Ed(e[e.length-1]),Ed(t[1]),Ed(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ed(e[0]),Ed(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Ed(e){return e.original||e}function Od(e,t){fs.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;kr(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 Pd(e,t,n,i){fs.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(kr(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),kr(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(r=!0),n.canConnectSequenceFlow(o,s)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,s,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(i=n.canConnect(l,c))&&i.type!==a.type&&(o=t.connect(l,c,{type:i.type,associationDirection:i.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.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,i=e.context,r=i.properties,o=i.element,s=o.businessObject;r.default&&(n=f(o.outgoing,T({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function kd(e,t,n,i,r,o){i.invoke(fs,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=w(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Xr(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var s=t.canReplace(o,i);s&&this._replaceElements(o,s.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,s=r.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,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}wd.$inject=["injector","modeling"],e(wd,fs),e(xd,fs),xd.$inject=["eventBus","modeling"],e(_d,fs),_d.$inject=["eventBus","bpmnRules","modeling"],Od.$inject=["eventBus","modeling"],e(Od,fs),e(Pd,fs),Pd.$inject=["eventBus","modeling","bpmnRules","injector"],e(kd,fs),kd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;v(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},kd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Sd={width:140,height:120},Cd={width:300,height:60},Ad={width:60,height:300},Td={width:300,height:150},Md={width:150,height:300},Rd={width:140,height:120},Dd={width:50,height:30};function Nd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(kr(n,"bpmn:Lane")||kr(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Pu(e),r=!0,o=!0,s=Eu(i,[i]),a=vn(e),l={},c={},p=Qr(e),u=p?Cd:Ad;/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 i=vn(e);/n/.test(t)&&(p&&i.top<a.top-10&&(r=!1),n&&Bd(a.top-i.bottom)<10&&qd(l,"top",i.top+u.height),Bd(a.top-i.top)<5&&Ld(c,"top",i.bottom-u.height)),/e/.test(t)&&(!p&&i.right>a.right+10&&(o=!1),n&&Bd(a.right-i.left)<10&&Ld(l,"right",i.right-u.width),Bd(a.right-i.right)<5&&qd(c,"right",i.left+u.width)),/s/.test(t)&&(p&&i.bottom>a.bottom+10&&(o=!1),n&&Bd(a.bottom-i.top)<10&&Ld(l,"bottom",i.bottom-u.height),Bd(a.bottom-i.bottom)<5&&qd(c,"bottom",i.top+u.height)),/w/.test(t)&&(!p&&i.left<a.left-10&&(r=!1),n&&Bd(a.left-i.right)<10&&qd(l,"left",i.left+u.width),Bd(a.left-i.left)<5&&Ld(c,"left",i.right-u.width))}));var d=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(kr(e,"bpmn:FlowElement")||kr(e,"bpmn:Artifact"))})),h=p?zd:Vd;return d.forEach((function(e){var n=vn(e);r&&/n/.test(t)&&Ld(c,"top",n.top-h.top),o&&/e/.test(t)&&qd(c,"right",n.right+h.right),o&&/s/.test(t)&&qd(c,"bottom",n.bottom+h.bottom),r&&/w/.test(t)&&Ld(c,"left",n.left-h.left)})),{min:c,max:l}}(n,i,r)),kr(n,"bpmn:SubProcess")&&Wr(n)&&(t.minDimensions=Rd),kr(n,"bpmn:TextAnnotation")&&(t.minDimensions=Dd)}))}Nd.$inject=["eventBus"];var Bd=Math.abs,jd=Math.min,Id=Math.max;function $d(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Ld(e,t,n){return $d(e,t,n,jd)}function qd(e,t,n){return $d(e,t,n,Id)}var zd={top:20,left:50,right:20,bottom:20},Vd={top:50,left:20,right:20,bottom:20};function Fd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(kr(n,"bpmn:Lane")||kr(n,"bpmn:Participant"))&&(t.balanced=!Uo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(kr(i,"bpmn:Lane")||kr(i,"bpmn:Participant"))return r&&(o=gn(o),t.resizeLane(i,o,n.balanced)),!1}))}Fd.$inject=["eventBus","modeling"];function Hd(e,t,n,i,r){function o(e){return Sr(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Kr(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!f(e.getDefinitions().get("rootElements"),T({id:t.id}))}function a(e){return kr(e,"bpmn:ErrorEventDefinition")?"errorRef":kr(e,"bpmn:EscalationEventDefinition")?"escalationRef":kr(e,"bpmn:MessageEventDefinition")?"messageRef":kr(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Sr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(fs,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Cr(n));i&&!s(i)&&(kt(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!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 i=l(Cr(n));i&&(t.referencedRootElement=i)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=i.copyElement(o,r.create(o.$type))),function(e,t){if(Sr(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)}))}Hd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Hd,fs);var Ud=Math.max;function Wd(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return v(t,(function(e){var t=e.id;kr(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=Qr(e);if(r=e,!Ou(r).length)return i?Td:Md;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?Td:{width:Gd(e,n,o),height:Md.height}:i?{width:Td.width,height:Qd(e,n,o)}:Md;return s}(e,n,i)),kr(e,"bpmn:Lane")&&(r[t]=Qr(e)?Cd:Ad),kr(e,"bpmn:SubProcess")&&Wr(e)&&(r[t]=Rd),kr(e,"bpmn:TextAnnotation")&&(r[t]=Dd),kr(e,"bpmn:Group")&&(r[t]=Sd)})),r}))}function Qd(e,t,n){var i;return i=function(e,t,n){var i,r=Ou(e);return i=Xd(r,t,n),e.height-i.height+Cd.height}(e,t,n),Ud(Td.height,i)}function Gd(e,t,n){var i;return i=function(e,t,n){var i,r=Ou(e);return i=Xd(r,t,n),e.width-i.width+Ad.width}(e,t,n),Ud(Md.width,i)}function Xd(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=Ou(r)).length?Xd(o,t,n):r}Wd.$inject=["eventBus"];var Kd=180,Yd=160;function Zd(e,t,n,i,r,o,s){fs.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return kr(e,"bpmn:SubProcess")&&!Wr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Cr(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function p(t){var n=Cr(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Os(n));e.removeRootElement(i)}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 i=s.get(Os(t));i&&n.removeElements(i.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,i=t.newShape;l(n)&&l(i)&&(t.oldRoot=e.removeRootElement(Os(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Os(i));if(r&&o){var s=r.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(kr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ks(t))return s.updateId(t,Ps(r)),void s.updateId(i,r);s.get(Ps(i))&&s.updateId(Ps(i),Ps(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(kr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ks(t))return s.updateId(t,Ps(i)),void s.updateId(r,i);var o=s.get(Ps(r));o&&s.updateId(o,Ps(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ks(n)){var i=n,r=s.get(Es(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;kr(t,"bpmn:SubProcess")&&(Wr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;kr(t,"bpmn:SubProcess")&&(Wr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(kr(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Wr(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 i=Os(t),r=s.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(kr(Ar(r),"bpmndi:BPMNPlane")){var o=Es(r),s=f(i,(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 Jd(e,t){e.invoke(fs,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(kr(i,"bpmn:SubProcess")&&(kr(n,"bpmn:Task")||kr(n,"bpmn:CallActivity"))&&Wr(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function eh(e){fs.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;kr(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&&kr(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function th(e,t){fs.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Wr(n)){var i=vt(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){r(e,!0)})),v(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(Zd,fs),Zd.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.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=bt(o);if(t.x){var a=xn(t),l=xn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:Kd-s.x,y:Yd-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},Zd.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},Zd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},Zd.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:Os(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},Zd.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=f(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},Zd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],Jd.$inject=["injector","modeling"],e(Jd,fs),e(eh,fs),eh.$inject=["eventBus"],e(th,fs),th.$inject=["eventBus","modeling"];function nh(e,t,n){fs.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;kr(n,"bpmn:SubProcess")&&(n.collapsed?Ar(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Ar(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Ar(t).isExpanded=!1:Ar(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.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}}(r,o):function(e,t){var n,i,r,o=e.children,s=t;return n=(r=o,r.filter((function(e){return!e.hidden}))).concat([e]),(i=bu(n))?(s.width=Math.max(i.width,s.width),s.height=Math.max(i.height,s.height),s.x=i.x+(i.width-s.width)/2,s.y=i.y+(i.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function ih(e,t,n,i){t.invoke(fs,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;fn(t)||(kr(t,"bpmn:Participant")&&Wr(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;kr(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function rh(e,t){fs.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!kr(e,"bpmn:SequenceFlow"))return!1;var n=Cr(t),i=Cr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(nh,fs),nh.$inject=["eventBus","elementFactory","modeling"],e(ih,fs),ih.$inject=["canvas","injector","moddle","modeling"],e(rh,fs),rh.$inject=["eventBus","modeling"];function oh(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}fs.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){(i=i||new sh).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(kr(t,"bpmn:Lane")&&n.addLane(t),kr(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function sh(){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}}oh.$inject=["eventBus","modeling","translate"],e(oh,fs);var ah={__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",Fp],appendBehavior:["type",Up],associationBehavior:["type",Wp],attachEventBehavior:["type",Qp],boundaryEventBehavior:["type",Xp],compensateBoundaryEventBehaviour:["type",Kp],createBehavior:["type",eu],createDataObjectBehavior:["type",tu],createParticipantBehavior:["type",su],dataInputAssociationBehavior:["type",lu],dataStoreBehavior:["type",uu],deleteLaneBehavior:["type",Su],detachEventBehavior:["type",Cu],dropOnFlowBehavior:["type",Tu],eventBasedGatewayBehavior:["type",Du],fixHoverBehavior:["type",ju],groupBehavior:["type",Iu],importDockingFix:["type",Lu],isHorizontalFix:["type",zu],labelBehavior:["type",od],layoutConnectionBehavior:["type",ad],messageFlowBehavior:["type",gd],nonInterruptingBehavior:["type",wd],removeElementBehavior:["type",_d],removeEmbeddedLabelBoundsBehavior:["type",xd],removeParticipantBehavior:["type",Od],replaceConnectionBehavior:["type",Pd],replaceElementBehaviour:["type",kd],resizeBehavior:["type",Nd],resizeLaneBehavior:["type",Fd],rootElementReferenceBehavior:["type",Hd],spaceToolBehavior:["type",Wd],subProcessPlaneBehavior:["type",Zd],subProcessStartEventBehavior:["type",Jd],textAnnotationBehavior:["type",eh],toggleCollapseConnectionBehaviour:["type",th],toggleElementCollapseBehaviour:["type",nh],unclaimIdBehavior:["type",ih],unsetDefaultFlowBehavior:["type",rh],updateFlowNodeRefsBehavior:["type",oh]};function lh(e,t){var n=_n(e,t,-15);return"intersect"!==n?n:null}function ch(e){Gl.call(this,e)}function ph(e){return!e||fn(e)}function uh(e){do{if(kr(e,"bpmn:Process"))return Cr(e);if(kr(e,"bpmn:Participant"))return Cr(e).processRef||Cr(e)}while(e=e.parent)}function dh(e){return kr(e,"bpmn:TextAnnotation")}function hh(e){return kr(e,"bpmn:Group")&&!e.labelTarget}function mh(e){return kr(e,"bpmn:BoundaryEvent")&&vh(e,"bpmn:CompensateEventDefinition")}function fh(e){return Cr(e).isForCompensation}function gh(e){for(var t=e;t=t.parent;){if(kr(t,"bpmn:FlowElementsContainer"))return Cr(t);if(kr(t,"bpmn:Participant"))return Cr(t).processRef}return null}function yh(e,t){return gh(e)===gh(t)}function vh(e,t){return!!f(Cr(e).eventDefinitions||[],(function(e){return kr(e,t)}))}function bh(e,t){return(Cr(e).eventDefinitions||[]).every((function(e){return kr(e,t)}))}function wh(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 xh(e,t,n){if(ph(e)||ph(t))return null;if(!kr(n,"bpmn:DataAssociation")){if(Bh(e,t))return{type:"bpmn:MessageFlow"};if(jh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Ih(e,t);return i||(Nh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Dh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function _h(e,t){return!(!fn(e)&&!hh(e))||!(kr(t,"bpmn:Participant")&&!Wr(t))&&(kr(e,"bpmn:Participant")?kr(t,"bpmn:Process")||kr(t,"bpmn:Collaboration"):Sr(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:kr(e,"bpmn:Lane")?kr(t,"bpmn:Participant")||kr(t,"bpmn:Lane"):!(kr(e,"bpmn:BoundaryEvent")&&!function(e){return Cr(e).cancelActivity&&(Ph(e)||kh(e))}(e))&&(kr(e,"bpmn:FlowElement")&&!kr(e,"bpmn:DataStoreReference")?kr(t,"bpmn:FlowElementsContainer")?Wr(t):Sr(t,["bpmn:Participant","bpmn:Lane"]):kr(e,"bpmn:DataStoreReference")&&kr(t,"bpmn:Collaboration")?_(Cr(t).get("participants"),(function(e){return!!e.get("processRef")})):Sr(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Sr(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!kr(e,"bpmn:MessageFlow")&&(kr(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Eh(e){return kr(e,"bpmn:Lane")}function Oh(e){return!!function(e){return!fn(e)&&kr(e,"bpmn:BoundaryEvent")}(e)||(!(!kr(e,"bpmn:IntermediateThrowEvent")||!Ph(e))||kr(e,"bpmn:IntermediateCatchEvent")&&kh(e))}function Ph(e){var t=Cr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function kh(e){return Sh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Sh(e,t){return t.some((function(t){return vh(e,t)}))}function Ch(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!fn(r)&&(!!Oh(r)&&(!Xr(t)&&(!(!kr(t,"bpmn:Activity")||fh(t))&&(!(i&&!lh(i,t))&&(!function(e){return kr(e,"bpmn:ReceiveTask")&&f(e.incoming,(function(e){return kr(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Ah(e,t,n){if(!t)return!1;var i={replacements:[]};return v(e,(function(e){Xr(t)||kr(e,"bpmn:StartEvent")&&"label"!==e.type&&_h(e,t)&&(Gr(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Kr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Kr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Kr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Sh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&kr(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),kr(t,"bpmn:Transaction")||vh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(kr(e,"bpmn:EndEvent")&&_h(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),kr(e,"bpmn:BoundaryEvent")&&Ch(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Th(e,t){return!_(e,Eh)&&(!t||e.every((function(e){return _h(e,t)})))}function Mh(e,t,n,i){return!!t&&(!(!fn(e)&&!hh(e))||!function(e,t){return e===t}(n,t)&&((!n||!wh(n,t))&&(_h(e,t)||$h(e,t))))}function Rh(e,t){return kr(e,"bpmn:SubProcess")?Wr(e)&&(!t||t.width>=100&&t.height>=80):!!kr(e,"bpmn:Lane")||(!!kr(e,"bpmn:Participant")||(!!dh(e)||!!hh(e)))}function Dh(e,t){return!wh(t,e)&&!wh(e,t)&&(!!function(e,t){var n=dh(e),i=dh(t);return(n||i)&&n!==i}(e,t)||!!Ih(e,t))}function Nh(e,t){return yh(e,t)&&mh(e)&&kr(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Xr(t);var n}function Bh(e,t){return!(qh(e)&&!qh(t))&&(kr(n=e,"bpmn:InteractionNode")&&!kr(n,"bpmn:BoundaryEvent")&&(!kr(n,"bpmn:Event")||kr(n,"bpmn:ThrowEvent")&&bh(n,"bpmn:MessageEventDefinition"))&&function(e){return kr(e,"bpmn:InteractionNode")&&!fh(e)&&(!kr(e,"bpmn:Event")||kr(e,"bpmn:CatchEvent")&&bh(e,"bpmn:MessageEventDefinition"))&&!(kr(e,"bpmn:BoundaryEvent")&&!vh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return uh(e)===uh(t)}(e,t));var n}function jh(e,t){return kr(n=e,"bpmn:FlowNode")&&!kr(n,"bpmn:EndEvent")&&!Xr(n)&&!(kr(n,"bpmn:IntermediateThrowEvent")&&vh(n,"bpmn:LinkEventDefinition"))&&!mh(n)&&!fh(n)&&function(e){return kr(e,"bpmn:FlowNode")&&!kr(e,"bpmn:StartEvent")&&!kr(e,"bpmn:BoundaryEvent")&&!Xr(e)&&!(kr(e,"bpmn:IntermediateCatchEvent")&&vh(e,"bpmn:LinkEventDefinition"))&&!fh(e)}(t)&&yh(e,t)&&!(kr(e,"bpmn:EventBasedGateway")&&!function(e){return kr(e,"bpmn:ReceiveTask")||kr(e,"bpmn:IntermediateCatchEvent")&&(vh(e,"bpmn:MessageEventDefinition")||vh(e,"bpmn:TimerEventDefinition")||vh(e,"bpmn:ConditionalEventDefinition")||vh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Ih(e,t){return Sr(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Sr(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Sr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Sr(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function $h(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&&(Sr(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&kr(e,"bpmn:FlowNode")&&!kr(e,"bpmn:BoundaryEvent")&&_h(e,t.parent))}function Lh(e,t){return!!fn(t)||!(kr(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function qh(e){return lc(e,"bpmn:Process")||lc(e,"bpmn:Collaboration")}e(ch,Gl),ch.$inject=["eventBus"],ch.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(ph(e))return null;return Sr(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,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return xh(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return xh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Rh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(mn(i)&&!$h(t,i))&&x(t,(function(e){return mn(e)?xh(e.source,e.target,e):e.host?Ch(e,e.host,null,n):Mh(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Ch(n,t,null,i)||Ah(n,t,i)||Th(n,t)||$h(n,t)})),this.addRule("shape.create",(function(e){return Mh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Ch(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Lh(e.elements,t)}))},ch.prototype.canConnectMessageFlow=Bh,ch.prototype.canConnectSequenceFlow=jh,ch.prototype.canConnectDataAssociation=Ih,ch.prototype.canConnectAssociation=Dh,ch.prototype.canConnectCompensationAssociation=Nh,ch.prototype.canMove=Th,ch.prototype.canAttach=Ch,ch.prototype.canReplace=Ah,ch.prototype.canDrop=_h,ch.prototype.canInsert=$h,ch.prototype.canCreate=Mh,ch.prototype.canConnect=xh,ch.prototype.canResize=Rh,ch.prototype.canCopy=Lh;var zh={__depends__:[Ac],__init__:["bpmnRules"],bpmnRules:["type",ch]};function Vh(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Ar(e);t=E(y(vt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Ar),n.set("planeElement",t)}))}))}Vh.$inject=["eventBus","canvas"];var Fh={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vh]};function Hh(e){fs.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);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,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function Uh(e,t,n){Hh.call(this,e);var i=[{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 r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=f(i,(function(t){return Sr(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||kr(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var i=t;i&&!Sr(i,n);)i=i.parent;if(!i)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return i}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Hh.prototype.getOrdering=function(e,t){return null},e(Hh,fs),Uh.$inject=["eventBus","canvas","translate"],e(Uh,Hh);var Wh={__depends__:[Ro],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Uh]};function Qh(){}Qh.prototype.get=function(){return this._data},Qh.prototype.set=function(e){this._data=e},Qh.prototype.clear=function(){var e=this._data;return delete this._data,e},Qh.prototype.isEmpty=function(){return!this._data};var Gh={clipboard:["type",Qh]},Xh="drop-ok",Kh="drop-not-ok",Yh="attach-ok",Zh="new-parent",Jh="create";function em(e,t,n,i,r){function o(t,n){[Yh,Xh,Kh,Zh].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===Jh&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,s=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);tm(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var s=f(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!mn(e)})),a=!1,l=!1,c=!1;nm(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=nm(e)?r.allowed("shape.create",{position:n,shape:s,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&i&&(l=r.allowed("connection.create",{source:p===i?s:i,target:p===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,s,a);i&&null!==c&&(t.target=i,c&&c.attach?o(i,Yh):o(i,c?Zh:Kh))})),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,r=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;tm(e);var u={x:e.x,y:e.y};r=c?i.appendShape(n,r,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):f(o=i.createElements(o,u,s,I({},p,{attach:l})),(function(e){return!mn(e)})),I(t,{elements:o,shape:r}),I(e,{elements:o,shape:r})})),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,i){c(n)||(n=[n]);var r=f(n,(function(e){return!mn(e)}));if(r){i=I({elements:n,hints:{},shape:r},i||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=bt(y(n,(function(e){return!e.hidden})));v(n,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),I(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,Jh,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function tm(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 nm(e){return e&&1===e.length&&!mn(e[0])}em.$inject=["canvas","dragging","eventBus","modeling","rules"];function im(e,t,n,i,r){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=Be("g");Pe(t,r.cls("djs-drag-group",["no-events"]));var o=Be("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Kn(r),e)):(r=n._createContainer("shape",o),n.drawShape(Kn(r),e),Zn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Zn(l,t.x,t.y)):Ae(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ae(t)}))}im.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var rm={__depends__:[Oc,Ip,Ac,os],__init__:["create","createPreview"],create:["type",em],createPreview:["type",im]};function om(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)}))}om.$inject=["eventBus"],om.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var sm={__init__:["mouse"],mouse:["type",om]};function am(e,t,n,i,r,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=s,this._rules=a,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=f(i,(function(e){return e===n.parent}));r&&(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 E(e.waypoints,(function(e){return(e=lm(e)).original&&(e.original=lm(e.original)),e}))}(n)),fn(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})),r.on("copyPaste.pasteElements",(function(e){I(e.hints,{createElementsBehavior:!1})}))}function lm(e){return I({},e)}function cm(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}am.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],am.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},am.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 i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},am.prototype._paste=function(e,t,n,i){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var r=bt(e);return v(e,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),I(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,I({},i))},am.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return v(e,(function(e,o){v(e=A(e,"priority"),(function(e){var o,s=I({},q(e,["priority"]));return i[e.parent]?s.parent=i[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s}),mn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):fn(s)?(s.labelTarget=i[s.labelTarget],o=i[e.id]=t.createLabel(s),void r.push(o)):(s.host&&(s.host=i[s.host]),o=i[e.id]=t.createShape(s),void r.push(o))}))})),r},am.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},am.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},am.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},am.prototype.hasRelations=function(e,t){var n,i;return!(mn(e)&&(n=f(t,T({id:e.source.id})),i=f(t,T({id:e.target.id})),!n||!i))&&!(fn(e)&&!f(t,T({id:e.labelTarget.id})))},am.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=f(r,(function(t){return e===t.element}));n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}return yt(mt(e),(function(e,t,i){if(!fn(e)){v(e.labels,(function(e){o(e,i)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,i)})),o(e,i)}))})),o(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}})),e=E(r,(function(e){return e.element})),r=E(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=A(r,(function(e){return e.descriptor.priority})),e=E(r,(function(e){return e.element})),v(r,(function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?cm(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):cm(r.element,e)})),i};var pm={__depends__:[Gh,rm,sm,Ac],__init__:["copyPaste"],copyPaste:["type",am]};function um(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function dm(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=Cr(n);if(fn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(Ar(n),!0);s.bpmnElement=o,um(o,t,"name"),um(s,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Cr(t[n.labelTarget]),void(n.di=Ar(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,um(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(kr(n,"bpmn:Participant")){var r=Cr(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[r]=t}(t,function(e,t,n){var i=Cr(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Cr(e).attachedToRef=Cr(t[e.host])),q(n,w(n,(function(t,n,r){var o=n.element,s=n.property;return r===e.id&&(o.set(s,i),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[r]=e[r]||{}}(t)))}))}dm.$inject=["bpmnFactory","eventBus","moddleCopy"];var hm=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function mm(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 A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===hm.indexOf(i))&&(!(i&&n&&!f(n.properties,T({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&d(t.$instanceOf)&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1}))}function fm(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}mm.$inject=["eventBus","bpmnFactory","moddle"],mm.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||fm(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;m(e,n)&&(o=e.get(n));var s=r.copyProperty(o,t,n,i);a(s)&&(!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},mm.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});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,i);if(c(e))return w(e,(function(e,s){return(o=r.copyProperty(s,t,n,i))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=r._bpmnFactory.create(e.$type)).$parent=t,o=r.copyElement(e,o,null,i)}return e}}},mm.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 gm={__depends__:[pm],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",dm],moddleCopy:["type",mm]},ym=Math.round;function vm(e,t){this._modeling=e,this._eventBus=t}function bm(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}vm.$inject=["modeling","eventBus"],vm.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.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=ym(a+o/2),p=ym(l+s/2),u=i.replaceShape(e,I({},t,{x:c,y:p,width:o,height:s}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},bm.$inject=["selection","eventBus"];var wm={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bm],replace:["type",vm]};var xm=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function _m(e,t,n,i,r,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Em(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Wr(e);return n!==(t&&(m(t,"collapsed")||m(t,"isExpanded"))?m(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return i.toggleCollapse(a),a;var h=e.create(u),f={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(f.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(fm(d.$descriptor),fm(h.$descriptor,!0));I(h,L(l,xm));var b=y(g,(function(e){return"eventDefinitions"===e?Om(a,l.eventDefinitionType):"loopCharacteristics"===e?!Xr(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Xr(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(Om(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),kr(d,"bpmn:Activity")){if(Em(d))f.isExpanded=Wr(a);else if(l&&m(l,"isExpanded")){f.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:f.isExpanded});f.width=w.width,f.height=w.height,f.x=a.x-(f.width-a.width)/2,f.y=a.y-(f.height-a.height)/2}Wr(a)&&!kr(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}return Em(d)&&!Em(h)&&(p.moveChildren=!1),kr(d,"bpmn:Participant")&&(!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,f.width=a.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Sr(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Sr(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!kr(d,"bpmn:BoundaryEvent")&&kr(h,"bpmn:BoundaryEvent")&&(f.host=l.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=a.x+(a.width-f.width)/2),r.replaceElement(a,f,{...p,targetElement:l})}}function Em(e){return kr(e,"bpmn:SubProcess")}function Om(e,t){var n=Cr(e);return t&&n.get("eventDefinitions").some((function(e){return kr(e,t)}))}_m.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Pm={__depends__:[gm,wm,os],bpmnReplace:["type",_m]};function km(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}km.$inject=["eventBus","dragging"],km.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)},km.prototype.isActive=function(e){return e&&this._active===e},km.prototype.length=function(e){return this._tools.length},km.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},km.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Sm={__depends__:[Oc],__init__:["toolManager"],toolManager:["type",km]};function Cm(e,t){return-1!==e.indexOf(t)}var Am=Math.abs,Tm=Math.round,Mm={x:"width",y:"height"},Rm="crosshair",Dm={n:"top",w:"left",s:"bottom",e:"right"},Nm=1500,Bm={n:"s",w:"e",s:"n",e:"w"},jm=20;function Im(e,t,n,i,r,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",Nm,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Lm(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Lm(e);var c={x:0,y:0};c[i]=Tm(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function $m(e){return{top:e.top-jm,right:e.right+jm,bottom:e.bottom+jm,left:e.left-jm}}function Lm(e){var t,n,i=e.context.spaceToolConstraints;i&&(u(i.left)&&(t=Math.max(e.x,i.left),e.dx=e.dx+t-e.x,e.x=t),u(i.right)&&(t=Math.min(e.x,i.right),e.dx=e.dx+t-e.x,e.x=t),u(i.top)&&(n=Math.max(e.y,i.top),e.dy=e.dy+n-e.y,e.y=n),u(i.bottom)&&(n=Math.min(e.y,i.bottom),e.dy=e.dy+n-e.y,e.y=n))}function qm(e,t){return-1!==e.indexOf(t)}Im.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Im.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Rm,data:{context:{reactivate:n}},trapClick:!1})},Im.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Rm,data:{context:{}}})},Im.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Im.prototype.init=function(e,t){var n=Am(e.dx)>Am(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Am(i)<5)return!1;i<0&&(i*=-1),Uo(e)&&(i*=-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,i),s=this._canvas.getRootElement();!Wo(e)&&e.hover&&(s=e.hover);var a=[...vt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,i,r),c=function(e,t,n,i,r){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,m,f,g,v=e.attachers,b=e.children,w=vn(e),x=y(b,(function(e){return!(mn(e)||fn(e)||qm(o,e)||qm(s,e))})),_=y(b,(function(e){return!mn(e)&&!fn(e)&&qm(o,e)})),E=[],O=[];x.length&&(d=$m(vn(bt(x))),p=i-w[Dm[n]]+d[Dm[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&&(h=$m(vn(bt(_))),p=i-h[Dm[Bm[n]]]+w[Dm[Bm[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){qm(o,e)?E.push(e):O.push(e)})),E.length&&(m=vn(bt(E.map(xn))),f=w[Dm[Bm[n]]]-(m[Dm[Bm[n]]]-i)),O.length&&(g=vn(bt(O.map(xn)))[Dm[n]]-(w[Dm[n]]-i)),"n"===n?(p=Math.min(f||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(f||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(f||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(f||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var P=r&&r[e.id];P&&("n"===n?(p=i+e[Mm[t]]-P[Mm[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=i+e[Mm[t]]-P[Mm[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=i-e[Mm[t]]+P[Mm[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=i-e[Mm[t]]+P[Mm[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:r}));return I(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:r}),ra("resize-"+("x"===n?"ew":"ns")),!0},Im.prototype.calculateAdjustments=function(e,t,n,i){var r=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&&!fn(e))if(mn(e))l.push(e);else{var o=e[t],p=o+e[Mm[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>i||n<0&&xn(e)[t]<i))a.push(e);else{var u;if(!(n>0&&o>i||n<0&&p<i))return o<i&&p>i&&r.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;qm(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,i=e.label;qm(p,t)&&qm(p,n)&&i&&c(i)})),{movingShapes:o,resizingShapes:s}},Im.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Im.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var zm="djs-dragging",Vm="djs-resizing",Fm=Math.max;function Hm(e,t,n,i,r){function o(e,t){v(e,(function(e){r.addDragger(e,t),n.addMarker(e,zm)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Be("g");Pe(a,i.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Be("path");Pe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Be("path");Pe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Zn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ae(t)})),e.on("spaceTool.move",250,(function(e){var 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=Be("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Be("g");Pe(d,i.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),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 i=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(r=!0)}))})),mn(e)&&(t||i)&&(n||r)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Be("g");Pe(h,i.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var m=[];v(p,(function(e){var t=r.addFrame(e,h),i=t.getBBox();m.push({element:t,initialBounds:i}),n.addMarker(e,Vm)})),s.frameGroup=h,s.frames=m}Pe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var f={x:e.dx,y:e.dy};f[{x:"y",y:"x"}[s.axis]]=0,Zn(s.dragGroup,f.x,f.y),v(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?Pe(i,{width:Fm(r.width+f.x,5)}):Pe(i,{width:t=Fm(r.width-f.x,5),x:r.x+r.width-t}),"s"===s.direction?Pe(i,{height:Fm(r.height+f.y,5)}):Pe(i,{height:n=Fm(r.height-f.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(i,(function(e){n.removeMarker(e,zm)})),v(r,(function(e){n.removeMarker(e,zm)})),a&&(Ae(s),Ae(a)),v(o,(function(e){n.removeMarker(e,Vm)})),l&&Ae(l)}))}Hm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Um={__init__:["spaceToolPreview"],__depends__:[Oc,Ac,Sm,Ip,sm],spaceTool:["type",Im],spaceToolPreview:["type",Hm]};function Wm(e){e.invoke(Im,this)}Wm.$inject=["injector"],e(Wm,Im),Wm.prototype.calculateAdjustments=function(e,t,n,i){var r=Im.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter((function(e){return!kr(e,"bpmn:TextAnnotation")&&(!function(e){return kr(e,"bpmn:Participant")&&!Cr(e).processRef}(e)||!("y"===t&&Qr(e)||"x"===t&&!Qr(e)))})),r};var Qm={__depends__:[Um],spaceTool:["type",Wm]};function Gm(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)}Gm.$inject=["eventBus","injector"],Gm.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()},Gm.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Gm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},Gm.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()}},Gm.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()}},Gm.prototype.register=function(e,t){this._setHandler(e,t)},Gm.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)},Gm.prototype.canUndo=function(){return!!this._getUndoAction()},Gm.prototype.canRedo=function(){return!!this._getRedoAction()},Gm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Gm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Gm.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},Gm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},Gm.prototype._createId=function(){return this._uid++},Gm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Gm.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Gm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Gm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Gm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},Gm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Gm.prototype._revertedAction=function(e){this._stackIdx--},Gm.prototype._getHandler=function(e){return this._handlerMap[e]},Gm.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 Xm={commandStack:["type",Gm]};function Km(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 Ym(e,t,n){fs.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Zm(n),t.validatedShapes=Zm(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),v(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;Km((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=St(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(kt(i.labels,n,r),n.labelTarget=i)}))}function Zm(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(Ym,fs),Ym.$inject=["injector","eventBus","modeling"];var Jm={__init__:["labelSupport"],labelSupport:["type",Ym]},ef="attach-ok";function tf(e,t,n,i,r){fs.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=nf(t=r),C("id",t,n)),i.validatedShapes=function(e){var t=k(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(nf(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 i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,ef),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,ef)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(nf(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||v(i?n:y(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),v(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;Km(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=nd(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=nd(e,i,o);r.moveShape(e,t,e.parent),v(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;Km(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function nf(e){return i(E(e,(function(e){return e.attachers||[]})))}e(tf,fs),tf.$inject=["injector","eventBus","canvas","rules","modeling"];var rf={__depends__:[Ac],__init__:["attachSupport"],attachSupport:["type",tf]};function of(e){this._model=e}function sf(e,t,n,i){fs.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){v(e.context.oldRoot.children,(function(e){kr(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function s(e){var t=e.context.shape;kr(t,"bpmn:BaseElement")&&r.updateBounds(t)}function a(e){r.updateConnection(e.context)}function l(e){r.updateConnectionWaypoints(e.context.connection)}function c(e){r.updateAttachment(e.context)}function p(e){const{element:n}=e.context,i=ro(n),r=Ar(n),o=r&&r.get("label");Jr(n)||ks(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.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"],af((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],af((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],af((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],af((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"],af(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],af(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],af(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],af(l)),this.executed("connection.reconnect",af((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Cr(n),s=Cr(i),a=Cr(r);o.conditionExpression&&!Sr(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",af((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Cr(n),s=Cr(i),a=Cr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],af(c)),this.reverted(["element.updateAttachment"],af(c)),this.executed("element.updateLabel",af(p)),this.reverted("element.updateLabel",af(p))}function af(e){return function(t){var n=t.context;kr(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function lf(e,t,n){Un.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function cf(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function pf(e,t){this._modeling=e,this._canvas=t}function uf(e){this._modeling=e}function df(e,t){this._canvas=e,this._layouter=t}of.$inject=["moddle"],of.prototype._needsId=function(e){return Sr(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"])},of.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=kr(e,"bpmn:Activity")?"Activity":kr(e,"bpmn:Event")?"Event":kr(e,"bpmn:Gateway")?"Gateway":Sr(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},of.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},of.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},of.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},of.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},of.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},of.prototype.createDiWaypoint=function(e){return this.create("dc:Point",L(e,["x","y"]))},of.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},of.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(sf,fs),sf.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],sf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},sf.prototype.updateParent=function(e,t){if(!(fn(e)||kr(e,"bpmn:DataStoreReference")&&e.parent&&kr(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ar(e),o=n&&n.businessObject,s=Ar(n);kr(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),kr(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),kr(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),kr(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},sf.prototype.updateBounds=function(e){var t=Ar(e),n=function(e){if(!kr(e,"bpmn:Activity"))return;var t=Ar(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ca(n,t.get("bounds"));I(n,{x:e.x+i.x,y:e.y+i.y})}var r=fn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),I(o,{x:e.x,y:e.y,width:e.width,height:e.height})},sf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(kr(n,"bpmn:Lane")&&Pt(n.get("flowNodeRef"),e),kr(t,"bpmn:Lane")&&kt(t.get("flowNodeRef"),e))},sf.prototype.updateDiConnection=function(e,t,n){var i=Ar(e),r=Ar(t),o=Ar(n);i.sourceElement&&i.sourceElement.bpmnElement!==Cr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Cr(n)&&(i.targetElement=n&&o)},sf.prototype.updateDiParent=function(e,t){if(t&&!kr(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)}},sf.prototype.getLaneSet=function(e){var t,n;return kr(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(kr(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},sf.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&(!kr(e,"bpmn:DataInput")&&!kr(e,"bpmn:DataOutput")||(kr(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(kr(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(kr(e,"bpmn:FlowElement")){if(t)if(kr(t,"bpmn:Participant"))t=t.processRef;else if(kr(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(kr(t,"bpmn:Lane"));i="flowElements"}else if(kr(e,"bpmn:Artifact")){for(;t&&!kr(t,"bpmn:Process")&&!kr(t,"bpmn:SubProcess")&&!kr(t,"bpmn:Collaboration");){if(kr(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(kr(e,"bpmn:MessageFlow"))i="messageFlows";else if(kr(e,"bpmn:Participant")){i="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!kr(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),s),s.$parent=null),t&&(kt(o.get("rootElements"),s),s.$parent=o))}else kr(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":kr(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Pt(a=e.$parent.get(i),e),t?((a=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(i);Pt(a,e),t&&(l||(l=[],t.set(i,l)),l.push(e))}}},sf.prototype.updateConnectionWaypoints=function(e){Ar(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},sf.prototype.updateConnection=function(e){var t,n=e.connection,i=Cr(n),r=n.source,o=Cr(r),s=n.target,a=Cr(n.target);if(kr(i,"bpmn:DataAssociation"))kr(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):kr(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=kr(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(Pt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(Pt(i.targetRef&&i.targetRef.get("incoming"),i),a&&a.get("incoming")&&a.get("incoming").push(i)),i.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,s)},sf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(lf,Un),lf.$inject=["bpmnFactory","moddle","translate"],lf.prototype._baseCreate=Un.prototype.create,lf.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Yr,t))}return this.createElement(e,t)},lf.prototype.createElement=function(e,t){var n,i,r,o=this._translate,s=(t=I({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Er(s=this._bpmnFactory.create(t.type))}if(!Sr(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=I({},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 kr(s,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=cf(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=cf(l,t,"isExpanded")),Sr(s,["bpmn:Lane","bpmn:Participant"])&&(t=cf(l,t,"isHorizontal")),kr(s,"bpmn:SubProcess")&&(t.collapsed=!Wr(s,l)),kr(s,"bpmn:ExclusiveGateway")&&(m(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&&(i=s.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=s,s.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=I({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},lf.prototype.getDefaultSize=function(e,t){var n=Cr(e);return t=t||Ar(e),kr(n,"bpmn:SubProcess")?Wr(n,t)?{width:350,height:200}:{width:100,height:80}:kr(n,"bpmn:Task")?{width:100,height:80}:kr(n,"bpmn:Gateway")?{width:50,height:50}:kr(n,"bpmn:Event")?{width:36,height:36}:kr(n,"bpmn:Participant")?Wr(n,t)?{width:600,height:250}:{width:400,height:60}:kr(n,"bpmn:Lane")?{width:400,height:100}:kr(n,"bpmn:DataObjectReference")?{width:36,height:50}:kr(n,"bpmn:DataStoreReference")?{width:50,height:50}:kr(n,"bpmn:TextAnnotation")?{width:100,height:30}:kr(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lf.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=I({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},pf.$inject=["modeling","canvas"],pf.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;v(n,(function(e){var n={x:0,y:0};a(i.left)?n.x=i.left-e.x:a(i.right)?n.x=i.right-e.width-e.x:a(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:a(i.top)?n.y=i.top-e.y:a(i.bottom)?n.y=i.bottom-e.height-e.y:a(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},pf.prototype.postExecute=function(e){},uf.$inject=["modeling"],uf.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},uf.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},df.$inject=["canvas","layouter"],df.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,o),t},df.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var hf=Math.round;function mf(e){this._modeling=e}mf.$inject=["modeling"],mf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=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=bt(y(t,(function(e){return!e.hidden})));v(t,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:hf(e.x-a.x-a.width/2+r.x),y:hf(e.y-a.y-a.height/2+r.y)}}))),I(e,{x:hf(e.x-a.x-a.width/2+r.x),y:hf(e.y-a.y-a.height/2+r.y)})}));var l=mt(t),c={};v(t,(function(e){if(mn(e))c[e.id]=u(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=I({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=q(t,["attach"])),c[e.id]=u(i)?s.createShape(e,L(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,L(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=P(c)};var ff=Math.round;function gf(e){this._canvas=e}function yf(e){gf.call(this,e)}gf.$inject=["canvas"],gf.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?I(t,n):I(t,{x:n.x-ff(t.width/2),y:n.y-ff(t.height/2)}),this._canvas.addShape(t,i,r),t},gf.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(yf,gf),yf.$inject=["canvas"];var vf=gf.prototype.execute;yf.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,vf.call(this,e)};var bf=gf.prototype.revert;function wf(e,t){this._canvas=e,this._modeling=t}function xf(e,t){this._modeling=e,this._elementRegistry=t}function _f(e,t){this._canvas=e,this._modeling=t}function Ef(e){this._modeling=e}yf.prototype.revert=function(e){return e.shape.labelTarget=null,bf.call(this,e)},wf.$inject=["canvas","modeling"],wf.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Km(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},wf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=St(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},wf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,kt(n.children,t,i),this._canvas.addConnection(t,n),t},xf.$inject=["modeling","elementRegistry"],xf.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))}))},_f.$inject=["canvas","modeling"],_f.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Km(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.children,(function(e){mn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},_f.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=St(i.children,n),t.removeShape(n),n},_f.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return kt(i.children,n,r),t.addShape(n,i),n},Ef.$inject=["modeling"];var Of={x:"y",y:"x"};function Pf(e,t){this._layouter=e,this._canvas=t}function kf(){}function Sf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Cf(e){this._modeling=e}function Af(e){this._helper=new Cf(e)}function Tf(e){this._modeling=e,this._helper=new Cf(e)}function Mf(e){this._modeling=e}function Rf(e){return e.original||e}function Df(e,t){this._modeling=e,this._rules=t}function Nf(e){this._modeling=e}function Bf(e){this._modeling=e}function jf(e){return I({},e)}function If(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function $f(e,t,n){var i=If(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Lf(e,t){return-1!==e.indexOf(t)}function qf(e){this._modeling=e}function zf(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,zf(e.children)))})),t}function Vf(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Vf(e.children,e.collapsed||t)))})),n}function Ff(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Ff(e.children,t)))})),n}function Hf(e){this._modeling=e}function Uf(e,t){return Pt(e&&e.attachers,t)}function Wf(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),kt(i,t,n)}}function Qf(){}function Gf(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function Xf(e){this._elementRegistry=e}function Kf(e,t){v(t,(function(t,n){e.set(n,t)}))}Ef.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function s(e){return e[i]+e[r]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],m=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),m+=l(e.range)):(u=(p=A(e.elements,i))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var r={y:0};r[i]=e-s(n),r[i]&&(r[Of[i]]=0,t.moveElements([n],r,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),c&&c!==n.length-1&&(m+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-m)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Of[i]]=0,a[i]=s.range.max-n[i]+c,e.range.min!==n[i]&&(a[i]+=n[i]-e.range.min),a[i]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},Ef.prototype.postExecute=function(e){},Pf.$inject=["layouter","canvas"],Pf.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},kf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Pt(o.children,t),kt(i.children,t,r),t.parent=i,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},kf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Pt(n.children,t),kt(i.children,t,r),t.parent=i,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},Sf.prototype.add=function(e,t){return this.addAll([e],t)},Sf.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var i=_t((n=n||{}).allShapes),r=_t(n.allConnections),o=_t(n.enclosedElements),a=_t(n.enclosedConnections),l=_t(n.topLevel,t&&k(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return yt(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return I(this,n),this},Cf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Cf.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;r&&r.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 i=!!s[e.source.id],r=!!s[e.target.id];l[e.id]&&i&&r?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:i&&pd(e,e.source,t),connectionEnd:r&&ud(e,e.target,t)})}))},Cf.prototype.getClosure=function(e){return(new Sf).addAll(e,!0)},Af.$inject=["modeling"],Af.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Af.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)},Tf.$inject=["modeling"],Tf.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=L(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),kt(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Tf.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(v(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:ud(e,t,n)})})),v(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:pd(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},Tf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return kt(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Tf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Tf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Mf.$inject=["modeling"],Mf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Mf.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Rf(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Rf(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Mf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},Df.$inject=["modeling","rules"],Df.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return r.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&&i.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),i.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,cd(e,t,u),a)})),v(h,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,ld(e,t,u),a)}))},Df.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Df.prototype.execute=function(e){},Df.prototype.revert=function(e){},Df.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Df.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Df.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Nf.$inject=["modeling"],Nf.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Nf.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:cd(e,n,i)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:ld(e,n,i)})})))},Nf.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Bf.$inject=["modeling"],Bf.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,s={};this.moveShapes(i,t),v(r,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;v(r.concat(o),(function(i){var r=i.source,o=i.target;(Cm(e,r)||Cm(e,o)||Cm(t,r)||Cm(t,o))&&(Cm(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Bf.prototype.execute=function(){},Bf.prototype.revert=function(){},Bf.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Bf.prototype.resizeShapes=function(e,t,n){var i=this;v(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:i,y:r+l,width:o,height:s-l};case"s":return{x:i,y:r,width:o,height:s+l};case"w":return{x:i+a,y:r,width:o-a,height:s};case"e":return{x:i,y:r,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Bf.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,s){var a=this,l=r.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=jf(e)).original&&(e.original=jf(e.original)),e}))}(e),d=If(n),h={};Lf(l,c)&&Lf(l,p)?(u=E(u,(function(e){return $f(e,i,n)&&(e[d]=e[d]+t[d]),e.original&&$f(e.original,i,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Lf(l,c)||Lf(l,p))&&(Lf(r,c)?h.connectionStart=pd(e,c,t):Lf(r,p)?h.connectionEnd=ud(e,p,t):Lf(o,c)?h.connectionStart=ld(e,c,s[c.id]):Lf(o,p)&&(h.connectionEnd=cd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},qf.$inject=["modeling"],qf.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=zf(n),t.collapsed=!t.collapsed;var i=Vf(n,t.collapsed);return[t].concat(i)},qf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Ff(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Hf.$inject=["modeling"],Hf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Uf(i,t),Wf(n,t),t.host=n,t},Hf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Uf(n,t),Wf(i,t,r),t},Qf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Qf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Gf.$inject=["eventBus","elementFactory","commandStack"],Gf.prototype.getHandlers=function(){return{"shape.append":uf,"shape.create":gf,"shape.delete":_f,"shape.move":Tf,"shape.resize":Nf,"shape.replace":Df,"shape.toggleCollapse":qf,spaceTool:Bf,"label.create":yf,"connection.create":df,"connection.delete":wf,"connection.move":kf,"connection.layout":Pf,"connection.updateWaypoints":Qf,"connection.reconnect":Mf,"elements.create":mf,"elements.move":Af,"elements.delete":xf,"elements.distribute":Ef,"elements.align":pf,"element.updateAttachment":Hf}},Gf.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Gf.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Gf.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Gf.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,s=n;!0===o?(r=n,s=n.parent):!1===o&&(r=null);var a={shapes:e,delta:t,newParent:s,newHost:r,hints:i};this._commandStack.execute("elements.move",a)},Gf.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Gf.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Gf.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var s={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",s),s.connection},Gf.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,s,a=(r=r||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",l),l.shape},Gf.prototype.createElements=function(e,t,n,i,r){c(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},Gf.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Gf.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Gf.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Gf.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Gf.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Gf.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Gf.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Gf.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Gf.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Gf.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Gf.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Gf.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Gf.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,I(i,{docking:"source"}))},Gf.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,I(i,{docking:"target"}))},Gf.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Gf.prototype._create=function(e,t){return t instanceof Ln?t:this._elementFactory.create(e,t)},Gf.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Xf.$inject=["elementRegistry"],Xf.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=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,O(i));return Kf(n,i),e.oldProperties=o,e.changed=r,r},Xf.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Kf(n,t),i},Xf.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return kr(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return kr(t,"bpmn:DataObjectReference")&&Cr(t).dataObjectRef===e}))}(e,t):[]};var Yf="default",Zf="id",Jf="di",eg={width:0,height:0};function tg(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function ng(e,t){return Zf in e&&e[Zf]!==t[Zf]}function ig(e,t){var n=e.businessObject,i=Ar(e);v(t,(function(e,t){t!==Jf?n.set(t,e):i&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(i,e)}))}tg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],tg.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,s=t.businessObject,a=function(e){var t=I({},e);return rg.forEach((function(n){n in e&&(t[n]=Cr(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=O(t),i=e.businessObject,r=Ar(e);return w(n,(function(e,n){return e[n]=n!==Jf?i.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,O(t.di)),e}),{})}(t,a);return ng(a,s)&&(o.unclaim(s[Zf]),r.updateId(t,a[Zf]),o.claim(a[Zf],s)),Yf in a&&(a[Yf]&&n.push(r.get(a[Yf].id)),s[Yf]&&n.push(r.get(s[Yf].id))),ig(t,a),e.oldProperties=l,e.changed=n,n},tg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Cr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,eg)}},tg.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return ig(t,i),ng(n,r)&&(s.unclaim(n[Zf]),o.updateId(t,i[Zf]),s.claim(i[Zf],r)),e.changed};var rg=["default"];function og(e,t){this._canvas=e,this._modeling=t}function sg(e,t){this._modeling=e,this._spaceTool=t}function ag(e,t){this._modeling=e,this._translate=t}function lg(e,t){this._modeling=e,this._spaceTool=t}og.$inject=["canvas","modeling"],og.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=Ar(r);return t.setRootElement(n),t.removeRootElement(r),kt(s.rootElements,i),i.$parent=s,Pt(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},og.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=Ar(n);return t.setRootElement(r),t.removeRootElement(n),Pt(s.rootElements,i),i.$parent=null,kt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},sg.$inject=["modeling","spaceTool"],sg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Pu(i),s=o===i,a=s?i:i.parent,l=Ou(a),c=Qr(i);if(c?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!l.length){var p=c?{x:i.x+_u,y:i.y,width:i.width-_u,height:i.height}:{x:i.x,y:i.y+_u,width:i.width,height:i.height-_u};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,m,f,g=[];yt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===i?[]:y(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,h=(d=i.y)+10,m="n",f="y"):"left"===r?(u=-120,h=(d=i.x)+10,m="w",f="x"):"bottom"===r?(u=120,h=(d=i.y+i.height)-10,m="s",f="y"):"right"===r&&(u=120,h=(d=i.x+i.width)-10,m="e",f="x");var v=t.calculateAdjustments(g,f,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,m,h);var w=c?{x:i.x+(s?_u:0),y:d-("top"===r?120:0),width:i.width-(s?_u:0),height:120}:{x:d-("left"===r?120:0),y:i.y+(s?_u:0),width:120,height:i.height-(s?_u:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},ag.$inject=["modeling","translate"],ag.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Ou(i),s=o.length;if(s>r)throw new Error(n("more than {count} child lanes",{count:r}));var a,l,c,p,u,d=Math.round(i.height/r);for(u=0;u<r;u++)a=i.y+u*d,l=u===r-1?i.height-d*u:d,c={x:i.x+_u,y:a,width:i.width-_u,height:l},u<s?t.resizeShape(o[u],c):(p={type:"bpmn:Lane"},t.createShape(p,c,i))},lg.$inject=["modeling","spaceTool"],lg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},lg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ku(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},lg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=vn(e),c=fu(vn(t),l),p=Pu(e),u=[],d=[];yt(p,(function(e){return u.push(e),(kr(e,"bpmn:Lane")||kr(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,i=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),r=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},r)),(c.left||c.right)&&(n=c.right||c.left,i=e.x+(c.right?e.width:0)+(c.right?-10:100),r=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},r))};var cg="flowNodeRef",pg="lanes";function ug(e){this._elementRegistry=e}function dg(e){this._moddle=e}ug.$inject=["elementRegistry"],ug.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},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=Pu(e);return r[t.id]||(r[t.id]=Eu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=vn(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Pu(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return kr(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(pg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(cg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},ug.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(pg);e.remove.forEach((function(e){Pt(n,e),Pt(e.get(cg),t)})),e.add.forEach((function(e){kt(n,e),kt(e.get(cg),t)}))})),[]},ug.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(pg);e.add.forEach((function(e){Pt(n,e),Pt(e.get(cg),t)})),e.remove.forEach((function(e){kt(n,e),kt(e.get(cg),t)}))})),[]},dg.$inject=["moddle"],dg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.claim(n,i):t.unclaim(n),[]},dg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.unclaim(n):t.claim(n,i),[]};var hg={fill:void 0,stroke:void 0};function mg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(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)}}}mg.$inject=["commandStack"],mg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||hg,i=this,r={};"fill"in n&&I(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&I(r,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=mn(e)?L(r,["border-color"]):r,n=Ar(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),fn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!Sr(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var fg={width:0,height:0};function gg(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return oo(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!fn(n)&&Jr(n)&&!eo(n)&&!yg(r)){var o=no(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i,di:n.di})}},this.execute=function(e){return e.oldLabel=ro(e.element),i(e.element,e.newLabel)},this.revert=function(e){return i(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(r)||kr(r,"bpmn:TextAnnotation"))if(fn(r)&&yg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=ro(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,fg)}}}function yg(e){return!e||!e.trim()}function vg(e,t,n,i){Gf.call(this,e,t,n),this._bpmnRules=i}function bg(){}gg.$inject=["modeling","textRenderer","bpmnFactory"],e(vg,Gf),vg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],vg.prototype.getHandlers=function(){var e=Gf.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Xf,e["element.updateProperties"]=tg,e["canvas.updateRoot"]=og,e["lane.add"]=sg,e["lane.resize"]=lg,e["lane.split"]=ag,e["lane.updateRefs"]=ug,e["id.updateClaim"]=dg,e["element.setColor"]=mg,e["element.updateLabel"]=gg,e},vg.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},vg.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},vg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},vg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},vg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},vg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},vg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},vg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},vg.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},vg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},vg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},vg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},vg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},bg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var wg=20,xg=5,_g=Math.round,Eg=20,Og={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Pg(e,t,n){var i,r,o,s=_n(t,e,xg),a=n.split(":")[0],l=_g((t.x-e.x)/2+e.x),c=_g((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),d=!1,h=!1;return p?(i=u?{x:l,y:e.y}:{x:e.x,y:c},r=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),r=u?"h:v":"v:h",d?u?(h=c===e.y,i={x:e.x+wg*(/l/.test(a)?-1:1),y:h?c+wg:c}):i={x:(h=l===e.x)?l+wg:l,y:e.y+wg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:Sg(e,i,r).concat(i),directions:r,turnNextDirections:h}}function kg(e){return e.split(":").reverse().join(":")}function Sg(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(Rg(n)){var i=function(e,t,n){return Pg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Pg(t,e,kg(n));return{waypoints:i.waypoints.slice().reverse(),directions:kg(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Sg(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=_g((t.x-e.x)/2+e.x),r=_g((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Cg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=_n(e,t,Og[o]||0),a=function(e,t){if(Rg(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||xn(e),i=i||xn(t);var l=a.split(":"),c=Dg(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 i=Sg(e,t,n);return i.unshift(e),i.push(t),Ng(i)}(c,Dg(i,t,l[1],s),a)}function Ag(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=xn(e),i=xn(t)),r=r||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=_n(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===r.preserveDocking?Tg(o,i,e)?(a[o]=i[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:i.x,y:i.y}]):null:Tg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y,original:{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y}}]):null}(e,t,n,i,o),s||(s=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=Mg(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&Mg(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Cg(e,t,n,i,o))))}function Tg(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 Mg(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!f(e,(function(t,n){var i=e[n-1];return i&&Ct(t,i)<3}))}(i))return null;var r,o=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(Mt(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),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(Dt(e[i],t,Eg)||Dt(e[i],n,Eg))return e.slice(i);return e}(s,e,t),r!==s&&(s=Mg(e,t,n,r)),s&&Mt(s)?null:s}function Rg(e){return e&&/t|r|b|l/.test(e)}function Dg(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Ng(e){return e.reduce((function(t,n,i){return At(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Bg=-10,jg=40,Ig={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$g={top:"t",right:"r",bottom:"b",left:"l"};function Lg(){}function qg(e,t){return kr(t,"bpmn:Participant")?"source":kr(e,"bpmn:Participant")?"target":Hg(t)?"source":Hg(e)||kr(t,"bpmn:Event")?"target":kr(e,"bpmn:Event")?"source":null}function zg(e){return Hg(e)?"target":"source"}function Vg(e,t){return e?e.original||e:xn(t)}function Fg(e,t){return kr(t,"bpmn:Activity")&&kr(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Hg(e){return kr(e,"bpmn:SubProcess")&&Wr(e)}function Ug(e,t){return e===t}function Wg(e){var t=/right|left/.exec(e);return t&&t[0]}function Qg(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Gg(e){return"right"===e||"left"===e}function Xg(e,t){var n=t.waypoints,i=n&&n.length&&_n(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function Kg(e,t,n){var i,r,o,s,a=xn(e),l=xn(t),c=(s=(o=e).host,_n(xn(o),s,Bg)),p=Ug(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),d=_n(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,i,r){var o,s=t?e:Qg(e),a=$g[s];o=t?Gg(e)?Yg("y",n,i,r)?"h":"b":Yg("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(i=function(e,t,n){if(n)return $g[e];if(Ug(Qg(e),Qg(t))||function(e,t){return Ig[e]===t}(Wg(e),Wg(t)))return $g[Qg(e)];return $g[Wg(e)]}(c,d,u),r=function(e,t,n){if(n)return Gg(e)?function(e,t){var n=Wg(e),i=Ig[n];return-1!==t.indexOf(i)}(e,t)||Ug(e,t)?"h":"v":function(e,t){var n=Qg(e),i=Ig[n];return-1!==t.indexOf(i)}(e,t)||Ug(e,t)?"v":"h";return Gg(t)||Ug(Qg(e),Qg(t))&&Wg(t)?"h":"v"}(c,d,u),[i+":"+r])}function Yg(e,t,n,i){var r=jg;return!(Zg(e,i,n,r)||Zg(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Zg(e,i,xn(t),r))}function Zg(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Jg(e){return I({original:e.point.original||e.point},e.actual)}function ey(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Lg,bg),Lg.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd;return a||(a=Vg(s&&s[0],r)),l||(l=Vg(s&&s[s.length-1],o)),(kr(e,"bpmn:Association")||kr(e,"bpmn:DataAssociation"))&&s&&!Fg(r,o)?[].concat([a],s.slice(1,-1),[l]):(kr(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:qg(e,t)}}(r,o):(kr(e,"bpmn:SequenceFlow")||Fg(r,o))&&(n=r===o?{preferredLayouts:Xg(r,e)}:kr(r,"bpmn:BoundaryEvent")?{preferredLayouts:Kg(r,o,l)}:Hg(r)||Hg(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:zg(e)}}(r):kr(r,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:kr(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=Ng(Ag(r,o,a,l,s,n=I(n,t)))),i||[a,l])},ey.$inject=["elementRegistry","graphicsFactory"],ey.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Jg(i)),o.push(Jg(r)),o},ey.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},ey.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},ey.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ey.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ey.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var ty={__init__:["modeling","bpmnUpdater"],__depends__:[ah,zh,Fh,Wh,Pm,Xm,Jm,rf,os,ms,Qm],bpmnFactory:["type",of],bpmnUpdater:["type",sf],elementFactory:["type",lf],modeling:["type",vg],layouter:["type",Lg],connectionDocking:["type",ey]};const ny=Math.round;function iy(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}iy.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(I({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;I(p,{x:u.x-ny(p.width/2),y:u.y-ny(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=r.getCroppedWaypoints(h,e,p)),i.create({created:[p,h].filter((e=>!l(e)))})},iy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},iy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var ry={__depends__:[dc,qp,ty],__init__:["appendPreview"],appendPreview:["type",iy]},oy=Math.min,sy=Math.max;function ay(e){e.preventDefault()}function ly(e){e.stopPropagation()}function cy(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ye("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=j(this.autoResize,this),this.handlePaste=j(this.handlePaste,this)}function py(e,t){this._eventBus=e,this._providers=[],this._textbox=new cy({container:t.getContainer(),keyHandler:j(this._handleKey,this),resizeHandler:j(this._handleResize,this)})}cy.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=L(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=L(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&I(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ly),ce.bind(o,"paste",this.handlePaste),i.autoResize&&ce.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},cy.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},cy.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)},cy.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,s=r.endContainer,a=r.startOffset,l=r.endOffset,c=r.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,i=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,i=d.textContent.length}else{var h=p.indexOf(o),m=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=m&&be(t)})),n=o,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},cy.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},cy.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=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=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){ay(n),ly(n);var u=oy(sy(c+n.clientX-a,i),o),d=oy(sy(p+n.clientY-l,r),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){ay(e),ly(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){ay(e),ly(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}I(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)},cy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ly),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},cy.prototype.getValue=function(){return this.content.innerText.trim()},cy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},cy.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},py.$inject=["eventBus","canvas"],py.prototype.registerProvider=function(e){this._providers.push(e)},py.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},py.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},py.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},py.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},py.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},py.prototype.getValue=function(){return this._textbox.getValue()},py.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())},py.prototype._handleResize=function(e){this._fire("resize",e)},py.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=f(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 uy={__depends__:[Ko],__init__:["directEditing"],directEditing:["type",py]};function dy(e){return function(t){var n=t.target,i=Cr(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,s=(r&&r.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!i.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Wr(e);return!(o&&s&&a&&l)}}var hy=[{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"}}],my=[{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"}}],fy=[{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"}}],gy=[{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"}}],yy=[{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"}}],vy=[{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}}],by=[{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}}],wy=by,xy=[{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}}],_y=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Ey=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Oy=[{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}}],Py=[{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}}],ky=[{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"}],Sy=[{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}}],Cy={"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 Ay(e,t,n,i,r,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Ay.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ay.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ay.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,i=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var r=dy(e);return kr(t,"bpmn:DataObjectReference")?this._createEntries(e,_y):kr(t,"bpmn:DataStoreReference")&&!kr(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ey):kr(t,"bpmn:StartEvent")&&!kr(t.$parent,"bpmn:SubProcess")?(i=y(hy,r),this._createEntries(e,i)):kr(t,"bpmn:Participant")?(i=y(Sy,(function(t){return Wr(e)!==t.target.isExpanded})),this._createEntries(e,i)):kr(t,"bpmn:StartEvent")&&Xr(t.$parent)?(i=y(Py,(function(e){var n=!1!==e.target.isInterrupting,i=t.isInterrupting===n;return r(e)||!r(e)&&!i})),this._createEntries(e,i)):kr(t,"bpmn:StartEvent")&&!Xr(t.$parent)&&kr(t.$parent,"bpmn:SubProcess")?(i=y(my,r),this._createEntries(e,i)):kr(t,"bpmn:EndEvent")?(i=y(gy,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!kr(t.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,i)):kr(t,"bpmn:BoundaryEvent")?(i=y(Oy,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!kr(t.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==n.cancelActivity,o=t.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,i)):kr(t,"bpmn:IntermediateCatchEvent")||kr(t,"bpmn:IntermediateThrowEvent")?(i=y(fy,r),this._createEntries(e,i)):kr(t,"bpmn:Gateway")?(i=y(yy,r),this._createEntries(e,i)):kr(t,"bpmn:Transaction")?(i=y(by,r),this._createEntries(e,i)):Xr(t)&&Wr(e)?(i=y(wy,r),this._createEntries(e,i)):kr(t,"bpmn:SubProcess")&&Wr(e)?(i=y(vy,r),this._createEntries(e,i)):kr(t,"bpmn:AdHocSubProcess")&&!Wr(e)?(i=y(xy,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return dy(t)&&(!n||i)})),this._createEntries(e,i)):kr(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ky):kr(t,"bpmn:FlowNode")?(i=y(xy,r),kr(t,"bpmn:SubProcess")&&!Wr(e)&&(i=y(i,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,i)):{}},Ay.prototype.getPopupMenuHeaderEntries=function(e){var t={};return kr(e,"bpmn:Activity")&&!Xr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),kr(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),kr(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!kr(e,"bpmn:SubProcess")||kr(e,"bpmn:Transaction")||Xr(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),vd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ay.prototype._createEntries=function(e,t){var n={},i=this;return v(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},Ay.prototype._createSequenceFlowEntries=function(e,t){var n=Cr(e),i={},r=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(kr(n.sourceRef,"bpmn:ExclusiveGateway")||kr(n.sourceRef,"bpmn:InclusiveGateway")||kr(n.sourceRef,"bpmn:ComplexGateway")||kr(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&kr(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:kr(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(kr(n.sourceRef,"bpmn:ExclusiveGateway")||kr(n.sourceRef,"bpmn:InclusiveGateway")||kr(n.sourceRef,"bpmn:ComplexGateway")||kr(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},Ay.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},Ay.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const r=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(i.options.loopCharacteristics);r&&t._moddleCopy.copyElement(r,o),o.set("isSequential",i.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var r,o,s,a=Cr(e).loopCharacteristics;return a&&(r=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:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Ay.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},Ay.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Ay.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=kr(Cr(e),"bpmn:AdHocSubProcess"),i=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,r){return i(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}},Ay.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Cr(e),i=this,r=bd(e),o=kr(e,"bpmn:BoundaryEvent")?Cy["intermediate-event-non-interrupting"]:Cy["start-event-non-interrupting"],s=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){i._modeling.updateProperties(e,{[r]:!!s})}}}};var Ty={__depends__:[Fl,Pm,dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ay]};function My(e,t,n,i,r,o,s,a,l,c,p,u,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,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=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Uo(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ry(e,t,n){var i=e.$instanceOf(t),r=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}My.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],My.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&I(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},My.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},My.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,d={};if("label"===e.type)return d;var h=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function s(t,n){var s=i.createShape(I({type:e},r));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=i.createShape(I({type:e},r));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,r),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Sr(h,["bpmn:Lane","bpmn:Participant"])&&Wr(e)){var y=Ou(e);I(d,{"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&&I(d,{"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&&I(d,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),I(d,{"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")}}}})}kr(h,"bpmn:FlowNode")&&(kr(h,"bpmn:EventBasedGateway")?I(d,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ry(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(d,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):kr(h,"bpmn:EndEvent")||h.isForCompensation||Ry(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Xr(h)||I(d,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(d,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change element"),action:{click:function(e,n){var i=I(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",i,{title:p("Change element"),width:300,search:!0})}}}}),kr(h,"bpmn:SequenceFlow")&&I(d,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))}),Sr(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(d,{"append.text-annotation":f("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:m,dragstart:m}}}),kr(h,"bpmn:TextAnnotation")&&I(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:m,dragstart:m}}}),Sr(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:m,dragstart:m}}}),kr(h,"bpmn:Group")&&I(d,{"append.text-annotation":f("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&&I(d,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Delete"),action:{click:function(e,t){n.removeElements([t])}}}}),d};var Dy={__depends__:[ry,uy,Da,os,Mp,rm,Ty],__init__:["contextPadProvider"],contextPadProvider:["type",My]},Ny={horizontal:["x","width"],vertical:["y","height"]};function By(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:[]}))}By.$inject=["modeling","rules"],By.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},By.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},By.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(v(t,(function(e){r=e(r,n,i)})),r):e},By.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return v(A(e,i),(function(e,o){var s,a=n._findRange(e,i,r),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},By.prototype._setOrientation=function(e){var t=Ny[e];this._axis=t[0],this._dimension=t[1]},By.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)},By.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var jy={__init__:["distributeElements"],distributeElements:["type",By]};function Iy(e){Gl.call(this,e)}Iy.$inject=["eventBus"],e(Iy,Gl),Iy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=mt(t=y(t,(function(e){var t=Sr(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 $y={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 Ly(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Ly.$inject=["popupMenu","distributeElements","translate","rules"],Ly.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ly.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ly.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:$y.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:$y.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var qy={__depends__:[Fl,jy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Iy],distributeElementsMenuProvider:["type",Ly]},zy="is not a registered action";function Vy(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Fy(e,t){return new Error(e+" "+t)}Vy.$inject=["eventBus","injector"],Vy.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=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&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=a.allowed("elements.delete",{elements:e});!1!==r&&(t=c(r)?r: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)}))},Vy.prototype.trigger=function(e,t){if(!this._actions[e])throw Fy(e,zy);return this._actions[e](t)},Vy.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)}))},Vy.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Fy(e,"is already registered");this._actions[e]=t},Vy.prototype.unregister=function(e){if(!this.isRegistered(e))throw Fy(e,zy);this._actions[e]=void 0},Vy.prototype.getActions=function(){return Object.keys(this._actions)},Vy.prototype.isRegistered=function(e){return!!this._actions[e]};var Hy={__init__:["editorActions"],editorActions:["type",Vy]};function Uy(e){e.invoke(Vy,this)}e(Uy,Vy),Uy.$inject=["injector"],Uy.prototype._registerDefaultActions=function(e){Vy.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=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),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),i&&l&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&l.trigger(t,n)})),i&&c&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=y(t,(function(e){return!kr(e,"bpmn:Lane")})),c.trigger(n,r))})),i&&d&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&d.setColor(t,e)})),i&&p&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();e=bt(i=kr(r,"bpmn:Collaboration")?n.filter((function(e){return kr(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!kr(e.parent,"bpmn:SubProcess")}))),d.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var Wy={__depends__:[Hy],editorActions:["type",Uy]};function Qy(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Sr(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Qy.$inject=["eventBus"];var Gy=10;function Xy(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Ky(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),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(!(!r.active||n&&Fs(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.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(!r)return a[t];n.get(r.id)||(Yy(t)?a[t]+=r[t]+r.width/2:a[t]+=r[t]+r.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=r.width/2:/right/.test(s)&&(a[t]+=r.width/2):/top/.test(s)?a[t]-=r.height/2:/bottom/.test(s)&&(a[t]+=r.height/2);return a[t]}(t,n,e);o&&(i.offset=o);var s=function(e,t){var n=e.context,i=n.createConstraints,r=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;i&&(Yy(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;l&&(Yy(t)?Jy(a)?s.x.max=l.left:s.x.min=l.right:Zy(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(Yy(t)?Jy(a)?s.x.min=c.left:s.x.max=c.right:Zy(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(i,s),bp(t,n)||r.snapEvent(t,n,i)}))}}))}function Yy(e){return"x"===e}function Zy(e){return-1!==e.indexOf("n")}function Jy(e){return-1!==e.indexOf("w")}function ev(e,t){fs.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;h(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}Ky.prototype.snapEvent=function(e,t,n){wp(e,t,this.snapValue(e[t],n))},Ky.prototype.getGridSpacing=function(){return Gy},Ky.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=Xy(e+=r,Gy),t&&t.min&&u(n=t.min)&&(n=Xy(n+r,Gy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=Xy(i+r,Gy,"floor"),e=Math.min(e,i)),e-=r},Ky.prototype.isActive=function(){return this.active},Ky.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ky.prototype.toggleActive=function(){this.setActive(!this.active)},Ky.$inject=["elementRegistry","eventBus","config.gridSnapping"],ev.$inject=["eventBus","gridSnapping","modeling"],e(ev,fs),ev.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},ev.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},ev.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),I(e,o),e},ev.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),I(e,o),e};function tv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.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))}))}tv.$inject=["eventBus","gridSnapping"];var nv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ev],gridSnappingSpaceToolBehavior:["type",tv]}],__init__:["gridSnapping"],gridSnapping:["type",Ky]};function iv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,i=xn(n),r=e.shape,o=cc(n,r);return["x","y"].forEach((function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],kr(r,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-r.height/2:n.offset=-r.width/2),o[e]=t.snapValue(o[e],n))})),o}))}iv.$inject=["eventBus","gridSnapping"];function rv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();kr(r,"bpmn:Participant")&&kr(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))}))}rv.$inject=["canvas","eventBus","gridSnapping"];function ov(e,t,n){fs.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,r=t.connection,o=t.hints||{},s=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(r,i.snapMiddleSegments(s))}))}function sv(e,t,n){var i=Mt(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=I({},t,r),n=I({},n,r)),[t,n]}ov.$inject=["eventBus","gridSnapping","modeling"],e(ov,fs),ov.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=sv(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var av={__depends__:[nv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",iv],gridSnappingParticipantBehavior:["type",rv],gridSnappingLayoutConnectionBehavior:["type",ov]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Qy]};function lv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return kr(t,"bpmn:Lane")?n._createParticipantHit(t,i):kr(t,"bpmn:Participant")?Wr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):kr(t,"bpmn:SubProcess")?Wr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}lv.$inject=["eventBus","interactionEvents"],lv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},lv.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=Qr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},lv.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 cv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",lv]};function pv(e){e.invoke(Zs,this)}e(pv,Zs),pv.$inject=["injector"],pv.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Zs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0})),n("spaceTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["r","R"],i)?(t.trigger("replaceElement",i),!0):void 0}))};var uv={__depends__:[Js],__init__:["keyboardBindings"],keyboardBindings:["type",pv]},dv={moveSpeed:1,moveSpeedAccelerated:10},hv="left",mv="right",fv="down",gv={ArrowLeft:hv,Left:hv,ArrowUp:"up",Up:"up",ArrowRight:mv,Right:mv,ArrowDown:fv,Down:fv},yv={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 vv(e,t,n,i,r){var o=this;this._config=I({},dv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=gv[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=yv[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}vv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var bv={__depends__:[Js,os],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vv]};function wv(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return bn({top:gu("top",n,t),right:gu("right",n,t),bottom:gu("bottom",n,t),left:gu("left",n,t)})}(n,s),e.canExecute=r.canResize(e)}e.on("resize.start",(function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:vn(i)})})),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,i=e.canExecute,r=e.newBounds;if(i){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,r=gn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function xv(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function _v(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"}wv.prototype.canResize=function(e){var t=this._rules,n=L(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},wv.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=I({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,xv(t,r),"resize",{autoActivate:!0,cursor:_v(r),data:{shape:t,context:i}})},wv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=vn(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},s=i?vn(i):o;return bn({top:hu(o.top,s.top),left:hu(o.left,s.left),bottom:du(o.bottom,s.bottom),right:du(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},bu(t,e.childrenBoxPadding))},wv.$inject=["eventBus","rules","modeling","dragging"];var Ev="djs-resizing",Ov="resize-not-ok";function Pv(e,t,n){e.on("resize.move",500,(function(e){var i,r,o,s;i=e.context,r=i.shape,o=i.newBounds,(s=i.frame)||(s=i.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,Ev)),o.width>5&&Pe(s,{x:o.x,width:o.width}),o.height>5&&Pe(s,{y:o.y,height:o.height}),i.canExecute?Se(s).remove(Ov):Se(s).add(Ov)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&Ae(n.frame),t.removeMarker(i,Ev)}))}Pv.$inject=["eventBus","canvas","previewSupport"];var kv=-6,Sv="djs-resizer",Cv=["n","w","s","e","nw","ne","se","sw"];function Av(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&v(t,j(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}Av.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){Ho(t)&&i.activate(t,e,n)}ce.bind(t,"mousedown",r),ce.bind(t,"touchstart",r)},Av.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=kv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=kv);return t}(i),s=Be("g");Se(s).add(Sv),Se(s).add(Sv+"-"+e.id),Se(s).add(Sv+"-"+i),xe(r,s);var a=Be("rect");Pe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Sv+"-visual"),xe(s,a);var l=Be("rect");return Pe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Sv+"-hit"),xe(s,l),Yn(s,t,n),s},Av.prototype.createResizer=function(e,t){var n=xv(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Av.prototype.addResizer=function(e){var t=this;!mn(e)&&this._resize.canResize({shape:e})&&v(Cv,(function(n){t.createResizer(e,n)}))},Av.prototype.removeResizers=function(){Te(this._getResizersParent())},Av.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Av.$inject=["eventBus","canvas","selection","resize"];var Tv={__depends__:[Ac,Oc,Ip],__init__:["resize","resizePreview","resizeHandles"],resize:["type",wv],resizePreview:["type",Pv],resizeHandles:["type",Av]};function Mv(e,t,n,i,r,o,s){function a(e,t){(t||Sr(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Rv(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=s,i.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(){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Rv(e){return kr(e,"bpmn:SubProcess")&&!Wr(e)}Mv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Mv.prototype.activate=function(e){var t=ro(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var i={};return(Sr(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Rv(e))&&I(i,{centerVertically:!0}),Jr(e)&&I(i,{autoResize:!0}),kr(e,"bpmn:TextAnnotation")&&I(i,{resizable:!0,autoResize:!0}),I(n,{options:i}),n}},Mv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,s={x:i.x,y:i.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(kr(e,"bpmn:Lane")||function(e){return kr(e,"bpmn:Participant")&&Wr(e)}(e)){var f=Qr(e);I(s,f?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o-30*a/2}:{width:i.width,height:30*a}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:f?"rotate(-90deg)":null})}if(function(e){return kr(e,"bpmn:Participant")&&!Wr(e)}(e)){var g=Qr(e);I(s,g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r-i.height/2,y:o-i.width/2}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Sr(e,["bpmn:Task","bpmn:CallActivity"])||Rv(e))&&(I(s,{width:i.width,height:i.height}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return kr(e,"bpmn:SubProcess")&&Wr(e)}(e)&&(I(s,{width:i.width,x:i.x}),I(m,{fontSize:d+"px",lineHeight:h,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&&(I(s,{width:y,height:i.height+v+b,x:r-y/2,y:i.y-v}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Jr(n)&&!eo(n)&&!fn(n)){var w=no(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;I(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return kr(e,"bpmn:TextAnnotation")&&(I(s,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),I(m,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:m}},Mv.prototype.update=function(e,t,n,i){var r,o,s;kr(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Dv="djs-element-hidden",Nv="djs-label-hidden";function Bv(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(kr(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=Be("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),p=s.path=Be("path");Pe(p,{d:c,strokeWidth:2,stroke:jv(i)}),xe(o,p),xe(a,o),Zn(o,i.x,i.y)}kr(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,Dv):(kr(i,"bpmn:Task")||kr(i,"bpmn:CallActivity")||kr(i,"bpmn:SubProcess")||kr(i,"bpmn:Participant"))&&t.addMarker(i,Nv)})),e.on("directEditing.resize",(function(e){if(kr(i,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(i.height/r.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.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,Dv),t.removeMarker(i,Nv)),i=void 0,r=void 0,o&&(Ae(o),o=void 0)}))}function jv(e,t){return Ar(e).get("stroke")||t||"black"}Bv.$inject=["eventBus","canvas","pathMap"];var Iv={__depends__:[ms,Tv,uy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Mv],labelEditingPreview:["type",Bv]},$v=new ss("tt");function Lv(e,t){e.style.display=!1===t?"none":""}var qv="djs-tooltip",zv="."+qv;function Vv(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=$v,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),G(i=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;de.bind(this._tooltipRoot,zv,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,zv,"mouseover",(function(e){r.trigger("mouseover",e)})),de.bind(this._tooltipRoot,zv,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}Vv.$inject=["eventBus","canvas"],Vv.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=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Vv.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(X(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Vv.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Vv.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Vv.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Vv.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Vv.prototype.show=function(){Lv(this._tooltipRoot)},Vv.prototype.hide=function(){Lv(this._tooltipRoot,!1)},Vv.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Vv.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),h(i)&&(i=ge(i)),G(t=ge('<div data-tooltip-id="'+n+'" class="'+qv+'">'),{position:"absolute"}),t.appendChild(i),e.type&&Y(t).add("djs-tooltip-"+e.type),e.className&&Y(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Vv.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){G(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Vv.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Lv(i,r))}))},Vv.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 Fv={__init__:["tooltips"],tooltips:["type",Vv]};function Hv(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var i,r,o,s=e.context,a=s.shape;kr(s.target,"bpmn:Collaboration")&&kr(a,"bpmn:FlowNode")&&(i=e,r=n("flow elements must be children of pools/participants"),t.add({position:{x:i.x+5,y:i.y+5},type:"error",timeout:o||2e3,html:"<div>"+r+"</div>"}))}))}Hv.$inject=["eventBus","tooltips","translate"];var Uv={__depends__:[Fv],__init__:["modelingFeedback"],modelingFeedback:["type",Hv]},Wv=Math.round;function Qv(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,r){if(p(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+Wv(e.width/2),y:e.y+Wv(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=k(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),I(t,{shapes:r,validatedShapes:r,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,i=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=o(i,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,s=t.shapes;if(!1===r)return!1;i.x=Wv(i.x),i.y=Wv(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Ho(e)){var t=Lo(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}Qv.$inject=["eventBus","dragging","modeling","selection","rules"];var Gv="djs-dragging",Xv="drop-ok",Kv="drop-not-ok",Yv="new-parent",Zv="attach-ok";function Jv(e,t,n,r){function o(e){var t=function(e){var t=y(e,(function(t){return!mn(t)||f(e,T({id:t.source.id}))&&f(e,T({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=vt(e,!0),n=E(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return i(t.concat(n))}function a(e,n){[Zv,Xv,Kv,Yv].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}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 d=Be("g");Pe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){r.addDragger(e,l.dragGroup)})),v(p=p?i([p,s(c)]):s(c),(function(e){t.addMarker(e,Gv)})),l.allDraggedElements=p,l.differentParents=1!==(a=k(c,(function(e){return e.parent&&e.parent.id})),O(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,Zv):t.canExecute&&i&&i.id!==r.id?a(i,Yv):a(i,t.canExecute?Xv:Kv)),Zn(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,i=n.allDraggedElements,r=n.dragGroup;v(i,(function(e){t.removeMarker(e,Gv)})),r&&Ae(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Gv),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}Jv.$inject=["eventBus","canvas","styles","previewSupport"];var eb={__depends__:[Ko,os,Zo,Ac,Oc,Ip],__init__:["move","movePreview"],move:["type",Qv],movePreview:["type",Jv]};const tb={width:36,height:50},nb={width:50,height:50};function ib(e,t,n){return Be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function rb(e,t){this._styles=t,e.registerProvider(this)}function ob(e,t){var n;return"bpmn:DataObjectReference"===t?n=tb:"bpmn:DataStoreReference"===t&&(n=nb),e.width===n.width&&e.height===n.height}rb.$inject=["outline","styles"],rb.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return kr(e,"bpmn:Gateway")?(I((n=Be("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Sr(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Pe(n=Be("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):kr(e,"bpmn:EndEvent")?Pe(n=Be("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):kr(e,"bpmn:Event")?Pe(n=Be("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):kr(e,"bpmn:DataObjectReference")&&ob(e,"bpmn:DataObjectReference")?n=ib("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):kr(e,"bpmn:DataStoreReference")&&ob(e,"bpmn:DataStoreReference")&&(n=ib("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},rb.prototype.updateOutline=function(e,t){if(!fn(e))return Sr(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+10,height:e.height+10}),!0):!!Sr(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var sb={__depends__:[Zo],__init__:["outlineProvider"],outlineProvider:["type",rb]},ab=".djs-palette-toggle",lb=".entry",cb=ab+", "+lb,pb="djs-palette-",ub="open",db="two-column";function hb(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 mb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}hb.$inject=["eventBus","canvas"],hb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},hb.prototype.getEntries=function(){return this._getProviders().reduce(mb,{})},hb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},hb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ge(hb.HTML_MARKUP);n.appendChild(i),Y(n).add(pb+"shown"),de.bind(i,cb,"click",(function(t){if(ee(t.delegateTarget,ab))return e.toggle();e.trigger("click",t)})),ce.bind(i,"mousedown",(function(e){e.stopPropagation()})),de.bind(i,lb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=Y(i),s=Y(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(db,t),s.toggle(pb+db,t),"open"in e&&(o.toggle(ub,e.open),s.toggle(pb+ub,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},hb.prototype._update=function(){var e=ye(".djs-palette-entries",this._container),t=this._entries=this.getEntries();J(e),v(t,(function(t,n){var i=t.group||"default",r=ye("[data-group="+bs(i)+"]",e);r||(X(r=ge('<div class="group"></div>'),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(r.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=Y(e);(c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},hb.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=X(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},hb.prototype.triggerEntry=function(e,t,n,i){var r,o;if((r=this._entries[e])&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(d(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},hb.prototype._layoutChanged=function(){this._toggleState({})},hb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},hb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hb.prototype.open=function(){this._toggleState({open:!0})},hb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ye(".djs-palette-entries",this._container),this._toolsContainer=ye("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=Y(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},hb.prototype.isOpen=function(){return Y(this._container).has(ub)},hb.prototype._getParentContainer=function(){return this._canvas.getContainer()},hb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var fb={__init__:["palette"],palette:["type",hb]},gb="crosshair";function yb(e,t,n,i,r,o,s){this._selection=r,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();Pe(n=e.frame=Be("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(i,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&&Ae(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=vb(e),r=i.filter((function(e){return e})),o=Wo(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=vb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=vb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Wo(e))return a.activateLasso(e.originalEvent),!0}))}function vb(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}}yb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],yb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:gb,data:{context:{}}})},yb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:gb,data:{context:{}},keepSelection:!0})},yb.prototype.select=function(e,t,n=[]){var i=function(e,t){var n={};return v(e,(function(e){var i=e;i.waypoints&&(i=bt(i)),!u(t.y)&&i.x>t.x&&(n[e.id]=e),!u(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(u(t.width)&&u(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.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,...P(i)])},yb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var bb={__depends__:[Sm,sm],__init__:["lassoTool"],lassoTool:["type",yb]},wb=1500,xb="grab";function _b(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var s=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wb,(function(e){if(Uo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(wb,(function(e){if(Eb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(wb,(function(e){Eb(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!Uo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Eb(e){return Hs("Space",e)}_b.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],_b.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:xb,data:{context:n||{}}})},_b.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:xb,data:{context:{reactivate:n}}})},_b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},_b.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Ob={__depends__:[Sm,sm],__init__:["handTool"],handTool:["type",_b]},Pb="connect-ok",kb="connect-not-ok";function Sb(e,t,n,i,r,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,r=t.canStartConnect=a.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Pb:kb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Pb:kb)})),e.on(["global-connect.ended"],(function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(a.canStartConnect(i))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,i,r)})),!1}))}Sb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Sb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Sb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Sb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Sb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Cb={__depends__:[Mp,Ac,Oc,Sm,sm],globalConnect:["type",Sb]};function Ab(e,t,n,i,r,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Ab.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Ab.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,i,r,o,s){function a(i){var r=n.createShape(I({type:e},s));t.start(i,r)}return{group:i,className:r,title:o,action:{dragstart:a,click:a}}}function c(e){var i=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:i});t.start(e,[i,r],{hints:{autoSelect:[i]}})}function p(e){t.start(e,n.createParticipantShape())}return I(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){r.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){i.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 Tb={__depends__:[fb,rm,Qm,bb,Ob,Cb,Ro],__init__:["paletteProvider"],paletteProvider:["type",Ab]};function Mb(e,t,n,i,r){fs.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);I(a,{x:l.x,y:l.y});var c=n.createShape(a);i.addShape(c,l.parent);var p=ye('[data-element-id="'+bs(l.id)+'"]',e.dragGroup);p&&Pe(p,{display:"none"});var u=r.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,i.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,i){var r=ye('[data-element-id="'+bs(i)+'"]',e.dragGroup);r&&Pe(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}Mb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Mb,fs);var Rb={__depends__:[Ip],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Mb]},Db=40,Nb=20,Bb=10,jb=20,Ib=["x","y"],$b=Math.abs;function Lb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,i=t.start,r=t.hover,o=t.source,s=t.target;e.originalEvent&&Fs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Ib.forEach((function(i){var r=Vb(i,t);e[i]<t[i]+n?wp(e,i,t[i]+n):e[i]>t[i]+r-n&&wp(e,i,t[i]+r-n)}))}(e,r,function(e){return kr(e,"bpmn:Task")?Bb:Nb}(r)),r&&function(e,t){return _(t,(function(t){return zb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=vp(i),Sr(r,["bpmn:Event","bpmn:Gateway"])&&qb(e,vp(r)),Sr(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=vp(t);Ib.forEach((function(i){(function(e,t,n){return e[n]>t[n]+jb&&e[n]<t[n]+Vb(n,t)-jb})(e,t,i)&&wp(e,i,n[i])}))}(e,r),kr(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,i=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var r=vp(n),o=_n(r,i,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,i=e[t];$b(i-r[t])<Db&&(n=i>r[t]?r[t]+Db:r[t]-Db,wp(e,t,n))}))}(e)):zb(n,"bpmn:MessageFlow")?(kr(i,"bpmn:Event")&&(t.connectionStart=vp(i)),kr(r,"bpmn:Event")&&qb(e,vp(r))):t.connectionStart=t.initialConnectionStart)}))}function qb(e,t){wp(e,"x",t.x),wp(e,"y",t.y)}function zb(e,t){return e&&e.type===t}function Vb(e,t){return"x"===e?t.width:t.height}function Fb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Hb(){this._snapValues={}}Lb.$inject=["eventBus"],Fb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Fb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Fb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Fb.prototype.getSnapLocations=function(){return this._snapLocations},Fb.prototype.setSnapLocations=function(e){this._snapLocations=e},Fb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Hb).initDefaults(this._defaultSnaps),n},Hb.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)},Hb.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],mp(r-e)<=n)return r}(e[n],r[n],i)},Hb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var Ub=1250;function Wb(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Ub,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Fs(e.originalEvent))&&!bp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=i.addSnapTargetPoints(a,r,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}Wb.$inject=["elementRegistry","eventBus","snapping"],Wb.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Fb);var s=(t=n.get(r.id)?vp(r,e):{x:e.x+vp(r).x,y:e.y+vp(r).y}).x-r.width/2,a=t.y-r.height/2,l=t.x+r.width/2,c=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(r)||(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},Wb.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",vp(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",vp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",vp(t)),e):e},Wb.prototype.getSnapTargets=function(e,t){return xp(t).filter((function(e){return!e.hidden}))};function Qb(e,t){t.invoke(Wb,this),e.on(["create.move","create.end"],1500,Gb),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,i=t.target;n&&("attach"===n||n.attach)&&!bp(e)&&function(e,t){var n,i=vn(t),r=lh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(r)?wp(e,"y",i.top-n.y):/bottom/.test(r)&&wp(e,"y",i.bottom-n.y);/left/.test(r)?wp(e,"x",i.left-n.x):/right/.test(r)&&wp(e,"x",i.right-n.x)}(e,i)}))}function Gb(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&wp(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&wp(e,"y",e.y)}}function Xb(e,t){return-1!==e.indexOf(t)}function Kb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(Qb,Wb),Qb.$inject=["eventBus","injector"],Qb.prototype.initSnap=function(e){var t=Wb.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",Kb(r,i,e))})),v(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",Kb(r,i,e))})),kr(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Qb.prototype.addSnapTargetPoints=function(e,t,n){Wb.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);v(i,(function(n){var i;(function(e){if(kr(e,"bpmn:SubProcess")&&Wr(e))return!0;return kr(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return kr(e,i)}))))&&(e.add("top-left",gp(n)),e.add("bottom-right",yp(n)))}));var r=this._elementRegistry;return v(t.incoming,(function(n){if(r.get(t.id)){Xb(i,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(r.get(t.id)){Xb(i,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),kr(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Qb.prototype.getSnapTargets=function(e,t){return Wb.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!kr(e,"bpmn:Lane")}))};function Yb(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&Fs(e.originalEvent)||bp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,r,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&wp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&wp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function Zb(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}Yb.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Fb);var o=Zb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Yb.prototype.addSnapTargetPoints=function(e,t,n,i){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",yp(t)),e.add("corner",gp(t))})),e.add("corner",Zb(t,i)),e},Yb.$inject=["eventBus","snapping"],Yb.prototype.getSnapTargets=function(e,t){return xp(t).filter((function(t){return!(n=t,i=e,n.host===i||mn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,i}))};function Jb(e){this._canvas=e,this._asyncHide=B(j(this.hide,this),1e3)}Jb.$inject=["canvas"],Jb.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:bp(e,"x"),y:bp(e,"y")};v(i,(function(i){var o=n.getSnapOrigin(i),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(s,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),v(["x","y"],(function(t){var n=r[t];p(n)&&wp(e,t,n.originValue)}))},Jb.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return Pe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(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"})}}},Jb.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Jb.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Jb.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Jb.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var ew={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Wb],resizeSnapping:["type",Yb],snapping:["type",Jb]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Lb],createMoveSnapping:["type",Qb]};function tw(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=ge(tw.BOX_HTML),this._searchInput=ye(tw.INPUT_SELECTOR,this._container),this._resultsContainer=ye(tw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function nw(e,t,n){var i=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+tw.RESULT_HIGHLIGHT_CLASS+'">'+xs(e.matched)+"</strong>":t+=xs(e.normal)})),""!==t?t:null}(t),r=ge(n);r.innerHTML=i,e.appendChild(r)}tw.$inject=["canvas","eventBus","overlays","selection"],tw.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:de.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close()})),t(this._container,tw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,tw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,tw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,tw.INPUT_SELECTOR,"keydown",(function(e){Hs("ArrowUp",e)&&e.preventDefault(),Hs("ArrowDown",e)&&e.preventDefault()})),t(this._container,tw.INPUT_SELECTOR,"keyup",(function(t){if(Hs("Escape",t))return e.close();if(Hs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Hs("ArrowUp",t)?e._scrollToDirection(!0):Hs("ArrowDown",t)?e._scrollToDirection():void(Hs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},tw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},tw.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,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=ye(tw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},tw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},tw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},tw.prototype._clearResults=function(){J(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},tw.prototype._getCurrentResult=function(){return ye(tw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},tw.prototype._createResultNode=function(e,t){var n=ge(tw.RESULT_HTML);return e.primaryTokens.length>0&&nw(n,e.primaryTokens,tw.RESULT_PRIMARY_HTML),nw(n,e.secondaryTokens,tw.RESULT_SECONDARY_HTML),X(n,tw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},tw.prototype.registerProvider=function(e){this._searchProvider=e},tw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,Y(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},tw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,Y(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},tw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},tw.prototype.isOpen=function(){return this._open},tw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Y(t).remove(tw.RESULT_SELECTED_CLASS);var n=X(e,tw.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Y(e).add(tw.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},tw.prototype._select=function(e){var t=X(e,tw.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)},tw.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,i=e.height+2*t,r={width:n+"px",height:i+"px"},o=ge('<div class="'+tw.OVERLAY_CLASS+'"></div>');return G(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}(bt(e));this._overlayId=this._overlays.add(e,t)}},tw.CONTAINER_SELECTOR=".djs-search-container",tw.INPUT_SELECTOR=".djs-search-input input",tw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",tw.RESULT_SELECTOR=".djs-search-result",tw.RESULT_SELECTED_CLASS="djs-search-result-selected",tw.RESULT_SELECTED_SELECTOR="."+tw.RESULT_SELECTED_CLASS,tw.RESULT_ID_ATTRIBUTE="data-result-id",tw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",tw.OVERLAY_CLASS="djs-search-overlay",tw.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>',tw.RESULT_HTML='<div class="djs-search-result"></div>',tw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',tw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var iw={__depends__:[ds,os],searchPad:["type",tw]};function rw(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function ow(e){return y(e,(function(e){return!!e.matched})).length>0}function sw(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}rw.$inject=["elementRegistry","searchPad","canvas"],rw.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=A(n=y(n=E(n,(function(t){return{primaryTokens:sw(ro(t),e),secondaryTokens:sw(t.id,e),element:t}})),(function(e){return ow(e.primaryTokens)||ow(e.secondaryTokens)})),(function(e){return ro(e.element)+e.element.id}))};var aw={__depends__:[iw],__init__:["bpmnSearch"],bpmnSearch:["type",rw]};function lw(e){Ur.call(this,e)}function cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}e(lw,Ur),lw.Viewer=$s,lw.NavigatedViewer=va,lw.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>')},lw.prototype._interactionModules=[na,ua,ya],lw.prototype._modelingModules=[Kl,dc,Sc,yc,Pp,Mp,Dp,Dy,gm,rm,qy,Wy,av,cv,uv,bv,Iv,ty,Uv,eb,sb,Tb,Rb,Tv,ew,aw],lw.prototype._modules=[].concat($s.prototype._modules,lw.prototype._interactionModules,lw.prototype._modelingModules);var pw={exports:{}};
|
|
157
|
+
`,this._current.container)},Vl.prototype.open=function(e,t,n,i){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:r,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Vl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Vl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(r).length)}},Vl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},Vl.prototype.reset=function(){const e=this._current.container;ol(null,e),be(e)},Vl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Vl.prototype._onOpened=function(){this._emit("opened")},Vl.prototype._onClosed=function(){this._emit("closed")},Vl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Vl.prototype._bindAutoClose=function(){this._eventBus.once(zl,this.close,this)},Vl.prototype._unbindAutoClose=function(){this._eventBus.off(zl,this.close,this)},Vl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),a(e)&&n<e&&(r=e),a(t)&&n>t&&(r=t)),r},Vl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,s=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,s=t.y-i.height):r.x?(o=t.x-i.width,s=t.y):r.y&&t.y<i.height?(o=t.x,s=10):r.y&&(o=t.x,s=t.y-i.height),t.y<n.top&&(s=t.y+i.height),{x:o,y:s}},Vl.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},Vl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Vl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Vl.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);d(i)?n=i(n):v(i,(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},Vl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);d(i)?n=i(n):v(i,(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},Vl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Vl.prototype.isOpen=function(){return!!this._current},Vl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Vl.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 Fl={__init__:["popupMenu"],popupMenu:["type",Vl]},Hl={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 Ul(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ul.$inject=["contextPad","popupMenu","translate","canvas"],Ul.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ul.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ul.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Hl.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);I(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ul.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Wl=["left","center","right","top","middle","bottom"];function Ql(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Gl(e){fs.call(this,e),this.init()}function Xl(e){Gl.call(this,e)}Ql.$inject=["popupMenu","alignElements","translate","rules"],Ql.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ql.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ql.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return v(Wl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Hl[o],action:function(){t.trigger(e,o),i.close()}}})),r},Gl.$inject=["eventBus"],e(Gl,fs),Gl.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},Gl.prototype.init=function(){},Xl.$inject=["eventBus"],e(Xl,Gl),Xl.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 Kl={__depends__:[Oa,Da,Fl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ul],alignElementsMenuProvider:["type",Ql],bpmnAlignElements:["type",Xl]},Yl=10,Zl=50,Jl=250;function ec(e,t,n,i){for(var r;r=nc(e,n,t);)n=i(t,n,r);return n}function tc(e){return function(t,n,i){var r={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;r[o]=l<0?Math.min(i[o]+l-t[a]/2,n[o]-c+l):Math.max(i[o]+i[a]+l+t[a]/2,n[o]+c+l)}})),r}}function nc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=ic(e);e.host&&(t=t.concat(ic(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(ic(t))}),[])));return t}(e);return f(r,(function(e){return e!==n&&"intersect"===_n(e,i,Yl)}))}function ic(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 rc(){return!0}function oc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||Zl,r=xn(e),o=vn(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function sc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}oc.$inject=["eventBus","modeling","canvas"],sc.$inject=["eventBus","selection"];var ac={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",oc],autoPlaceSelectionBehavior:["type",sc]};function lc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Sr(e,t))return e;return null}function cc(e,t){return kr(t,"bpmn:TextAnnotation")?function(e,t){var n=vn(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};mn(e)&&((i=xn(e)).x+=100,i.y-=50);return ec(e,t,i,tc({y:{margin:-30,minDistance:20}}))}(e,t):Sr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=vn(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return ec(e,t,i,tc({x:{margin:30,minDistance:30}}))}(e,t):kr(t,"bpmn:FlowNode")?function(e,t){var n=vn(e),i=xn(e),r=function(e,t){t||(t={});var n=t.defaultDistance||Zl,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||Jl,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===i?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===i?"start"===a?vn(t).top-vn(e).bottom:"center"===a?xn(t).y-vn(e).bottom:vn(t).bottom-vn(e).bottom:"start"===a?vn(t).left-vn(e).right:"center"===a?xn(t).x-vn(e).right:vn(t).right-vn(e).right}r||(r=rc);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),p=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,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,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return kr(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";kr(e,"bpmn:BoundaryEvent")&&-1!==(a=_n(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+r+t.width/2,y:i.y+pc(a,s)};return ec(e,t,l,tc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function pc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function uc(e){e.on("autoPlace",(function(e){var t=e.shape;return cc(e.source,t)}))}uc.$inject=["eventBus"];var dc={__depends__:[ac],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",uc]};function hc(e,t,n,r){fs.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,r=t.parent||t.newParent;!1!==n.autoResize&&o._expand([i],r)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=i(P(t.closure.topLevel)),r=t.hints,s=!r||r.autoResize;!1!==s&&v(k(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return f(s,T({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,i=t.shape;n&&!1===n.autoResize||i.collapsed||o._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&!1===n.autoResize||r&&o._expand([i],r)}))}function mc(e){e.invoke(hc,this)}function fc(e){Gl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function gc(e,t){fc.call(this,e),this._modeling=t}hc.$inject=["eventBus","elementRegistry","modeling","rules"],e(hc,fs),hc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=vn(bt(e)),o=vn(t),s={};return r.top-o.top<i.top&&(s.top=r.top-n.top),r.left-o.left<i.left&&(s.left=r.left-n.left),o.right-r.right<i.right&&(s.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(s.bottom=r.bottom+n.bottom),bn(I({},o,s))},hc.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 i=function(e,t){var n="";e=vn(e),t=vn(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}(L(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},hc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},hc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},hc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},mc.$inject=["injector"],e(mc,hc),mc.prototype.resize=function(e,t,n){kr(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},fc.$inject=["eventBus"],e(fc,Gl),fc.prototype.canResize=function(e,t){return!1},e(gc,fc),gc.$inject=["eventBus","modeling"],gc.prototype.canResize=function(e,t){if(kr(t.di,"bpmndi:BPMNPlane"))return!1;if(!kr(t,"bpmn:Participant")&&!kr(t,"bpmn:Lane")&&!kr(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(kr(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var yc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mc],bpmnAutoResizeProvider:["type",gc]};function vc(e,t,n){var i,r,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,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),s.hover({element:r,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=zo(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}vc.$inject=["elementRegistry","eventBus","injector"];var bc={__init__:["hoverFix"],hoverFix:["type",vc]},wc=Math.round,xc="djs-drag-active";function _c(e){e.preventDefault()}function Ec(e,t,n,i){var r,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||r;var i=e.createEvent(I({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var o,l=r.payload,c=r.displacement,p=r.globalStart,u=zo(e),d=ca(u,p),h=r.localStart,m=s(u),g=ca(m,h);if(!r.active&&(i||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(I(l,{x:wc(h.x+c.x),y:wc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return f();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&ra(r.cursor),t.addMarker(t.getRootElement(),xc)}qo(e),r.active&&(I(l,{x:wc(m.x+c.x),y:wc(m.y+c.y),dx:wc(g.x),dy:wc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,qo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Hs("Escape",e)&&(_c(e),f())}function u(t){var n;r.active&&(n=aa(e),setTimeout(n,400),_c(t)),c(t)}function d(e){l(e)}function h(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function m(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function f(e){var t;if(r){var n=r.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),oa(),g=r.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",_c),ce.unbind(document,"selectstart",_c),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",f,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),xc);var y=r.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(y),s=r,r=null,s}e.on("diagram.destroy",f),this.init=function(t,n,i,g){r&&f(!1),"string"==typeof n&&(g=i,i=n,n=null);var y,v,b,w,x,_=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=Lo(t)||t,v=zo(t),qo(t),"dragstart"===y.type&&_c(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),r=I({prefix:i,data:_,payload:{},globalStart:v,displacement:ca(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",f,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",_c),ce.bind(document,"selectstart",_c),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=m,this.end=c,this.cancel=f,this.context=function(){return r},this.setOptions=function(e){I(o,e)}}Ec.$inject=["eventBus","canvas","selection","elementRegistry"];var Oc={__depends__:[bc,os],dragging:["type",Ec]};function Pc(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function kc(e,t,n){return t<e&&e<n}Pc.$inject=["config.autoScroll","eventBus","canvas"],Pc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)kc(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(){i.startScroll(e)}),n.scrollRepeatTimeout))},Pc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Pc.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Pc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=zo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Sc={__depends__:[Oc],__init__:["autoScroll"],autoScroll:["type",Pc]};function Cc(e){this._commandStack=e.get("commandStack",!1)}Cc.$inject=["injector"],Cc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Ac={__init__:["rules"],rules:["type",Cc]},Tc=Math.round,Mc=Math.max;var Rc=10;function Dc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Ct(i,t)<=Rc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=an(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,Rc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],s=r[r.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[i=Mc(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Tc(o.x+s.x)/2,y:Tc(o.y+s.y)/2},index:o.segment2}:{point:{x:Tc(o.x),y:Tc(o.y)},index:o.segment2}:null}(e,t)}function Nc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function jc(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Ic(e,t){var n=jc(e,t);return Nc({x:n.x-e.x,y:n.y-e.y})}function $c(e,t){return Nc({x:e.x-t.x,y:e.y-t.y})}var Lc="djs-bendpoint",qc="djs-segment-dragger";function zc(e,t,n){var i=function(e,t){var n,i=zo(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return Dc(t,i)}function Vc(e,t){var n=Be("g");Se(n).add(Lc),xe(e,n);var i=Be("circle");Pe(i,{cx:0,cy:0,r:4}),Se(i).add("djs-visual"),xe(n,i);var r=Be("circle");return Pe(r,{cx:0,cy:0,r:10}),Se(r).add("djs-hit"),xe(n,r),t&&Se(n).add(t),n}function Fc(e,t,n,i){var r=Be("g");xe(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Uc("h"===n?i:r)}(t,n,i),s=Be("rect");Pe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(r,s);var a=Be("rect");return Pe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(r,a),Jn(r,"v"===i?90:0),r}function Hc(e,t,n){var i=Be("g"),r=Nt(t,n),o=Mt(t,n);return xe(e,i),Fc(i,t,n,o),Se(i).add(qc),Se(i).add("h"===o?"horizontal":"vertical"),Zn(i,r.x,r.y),i}function Uc(e){return Math.abs(Math.round(2*e/3))}function Wc(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var s=Ic(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return jc(e,n)}function Qc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=zc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Mt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Uc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,r,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Nt(i=t[c-1],r=t[c]),s=Mt(i,r),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?i.start(e,n,a.index,!a.bendpoint):r.start(e,n,a.index),!0}function s(e,t,i){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),r=ye('.djs-bendpoints[data-element-id="'+bs(e.id)+'"]',i);return!r&&n&&(Pe(r=Be("g"),{"data-element-id":e.id}),Se(r).add("djs-bendpoints"),xe(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}function l(e,t){return ye('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var i=Vc(e);xe(e,i),Zn(i,t.x,t.y)})),Vc(e,"floating")}function p(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],i=o[a])&&(Pe(r=Hc(e,n,i),{"data-segment-idx":a}),s(r,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(ve("."+qc,e),(function(e){Ae(e)}))}(t),function(e){v(ve("."+Lc,e),(function(e){Ae(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var i,r,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Nt(s,a),u=Mt(s,a);o&&(i=function(e){return ye(".djs-visual",e)}(o),r={x:c.x-p.x,y:c.y-p.y},"v"===u&&(r={x:r.y,y:r.x}),Zn(i,r.x,r.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ae(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=a(r,!0),!(i=zc(t,o,e.originalEvent)))return;!function(e,t){var n=ye(".floating",e),i=t.point;n&&Zn(n,i.x,i.y)}(n,i),i.bendpoint||h(n,i,o)}})),e.on("element.mousedown",(function(e){if(Ho(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 i=a(t);i&&Pe(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Qc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Gc=Math.round,Xc="reconnectStart",Kc="reconnectEnd",Yc="updateWaypoints";function Zc(e,t,n,i,r,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,d=(a=s||0!==o?s||o!==u.length-1?Yc:Kc:Xc)===Yc?"connection.updateWaypoints":"connection.reconnect",h=r.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=r.allowed(d,{connection:t,source:p,target:c})),!1!==h&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===Yc?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Xc?a:o,target:l===Kc?a:s}))return n.source=l===Xc?a:o,void(n.target=l===Kc?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===Kc?a:s,target:l===Xc?a:o})),t&&(n.source=l===Kc?a:s,n.target=l===Xc?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!==Yc&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,s=t.insert,a=r.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:Gc(e.x),y:Gc(e.y)};if(!n)return!1;p===Yc?(s?a.splice(i,0,d):a[i]=d,u.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(r,a),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===Ct(t,i=e[r+1])||At(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(p===Xc?(u.docking="source",Jc(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===Kc&&(u.docking="target",Jc(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,d,u))}),this)}function Jc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Xc?t&&i&&t===i&&n!==i:r===Kc?t&&n&&t===n&&n!==i:void 0}Zc.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Zc.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var ep="updateWaypoints",tp="connect-ok",np="connect-not-ok",ip="connect-hover",rp="djs-updating",op="djs-dragging";function sp(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,s=r.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),r.waypoints=a,Se(t.draggerGfx=Vc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,op),i.addMarker(r,rp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,ip),o===ep)return;n?(i.removeMarker(r,np),i.addMarker(r,tp)):!1===n&&(i.removeMarker(r,tp),i.addMarker(r,np))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,ip),i.removeMarker(n,r?tp:np))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},m=n.hints||{},f={};r&&(m.connectionStart&&(f.connectionStart=m.connectionStart),m.connectionEnd&&(f.connectionEnd=m.connectionEnd),"reconnectStart"===l?Jc(n)?(f.connectionEnd=f.connectionEnd||h,f.source=u,f.target=a||p,d=d.reverse()):(f.connectionStart=f.connectionStart||h,f.source=a||p,f.target=u):"reconnectEnd"===l?Jc(n)?(f.connectionStart=f.connectionStart||h,f.source=a||u,f.target=p,d=d.reverse()):(f.connectionEnd=f.connectionEnd||h,f.source=p,f.target=a||u):(f.noCropping=!0,f.noLayout=!0,d[o]=h),l===ep&&(d=e.cropWaypoints(c,d)),f.waypoints=d,r.drawPreview(n,i,f)),Zn(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,Ae(o),i.removeMarker(n,rp),i.removeMarker(n,op),s&&(i.removeMarker(s,tp),i.removeMarker(s,a?tp:np)),r&&r.cleanUp(t)}))}sp.$inject=["bendpointMove","injector","eventBus","canvas"];var ap="connect-hover",lp="djs-updating";function cp(e,t,n){return pp(e,t,e[t]+n)}function pp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function up(e){return"x"===e?"y":"x"}function dp(e,t,n){var i,r;return e.original?e.original:(i=xn(t),pp(e,r=up(n),i[r]))}function hp(e,t,n,i,r,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){r.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return pp(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],up(e.axis));Zn(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,s,a,l,c=n.getGraphics(t),p=r-1,u=r,d=t.waypoints,h=d[p],m=d[u],f=zc(n,d,e);(s=Mt(h,m))&&(a="v"===s?"x":"y",0===p&&(h=dp(h,t.source,a)),u===d.length-1&&(m=dp(m,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:m,axis:a,dragPosition:l=f?f.point:{x:(h.x+m.x)/2,y:(h.y+m.y)/2}},i.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,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Hc(r,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(i,lp)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,s=i.segmentEndIndex,p=i.segmentStart,u=i.segmentEnd,d=i.axis,h=i.originalWaypoints.slice(),m=cp(p,d,e["d"+d]),f=cp(u,d,e["d"+d]),g=h.length,y=0;h[o]=m,h[s]=f,o<2&&(t=_n(r.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=_n(r.target,f),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=f):"intersect"!==n&&h.push(u)),i.newWaypoints=r.waypoints=a(r,h),c(i,y,e),i.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,ap)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,ap)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&Ae(t.draggerGfx),n.removeMarker(i,lp)})),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,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,r){return!At(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,l,p)}))}hp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var mp=Math.abs,fp=Math.round;function gp(e){return{x:e.x,y:e.y}}function yp(e){return{x:e.x+e.width,y:e.y+e.height}}function vp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:fp(e.x+e.width/2),y:fp(e.y+e.height/2)}}function bp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function wp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function xp(e){return e.children||[]}var _p=Math.abs,Ep=Math.round;function Op(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(_p(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Wc(t,e):e.width?{x:Ep(e.width/2+e.x),y:Ep(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(i)return i;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(r.source,e)),c>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&i.horizontal.push(e.y),"x"===p&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(o){var l=s-(i=t(o.vertical,s)),c=a-(r=t(o.horizontal,a));I(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:r}),(l||-1!==o.vertical.indexOf(s))&&wp(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&wp(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);mn(t)&&i&&i.x&&i.y&&(wp(e,"x",i.x),wp(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(r,(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-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,p));I(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&wp(e,"x",i),(d||-1!==s.horizontal.indexOf(p))&&wp(e,"y",r)}}))}Op.$inject=["eventBus"];var Pp={__depends__:[Oc,Ac],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Qc],bendpointMove:["type",Zc],bendpointMovePreview:["type",sp],connectionSegmentMove:["type",hp],bendpointSnapping:["type",Op]};function kp(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);l(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),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,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:Sp(t)?o:r,connectionEnd:Sp(t)?r:o};p(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,r){p(i)||(r=i,i=xn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Sp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}kp.$inject=["eventBus","dragging","modeling","rules"];var Cp="connect-ok",Ap="connect-not-ok";function Tp(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=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,d=p;Sp(t)&&(u=p,d=c),i.drawPreview(t,n,{source:o||s,target:l||r,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?Cp:Ap)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Cp),n.removeMarker(t,Ap))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Tp.$inject=["injector","eventBus","canvas"];var Mp={__depends__:[os,Ac,Oc],__init__:["connectPreview"],connect:["type",kp],connectPreview:["type",Tp]};function Rp(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Rp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Rp.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,m=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(r),o||(o=e.getConnection=function(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}((function(e,t,n){return m.getConnection(e,t,n)}))),t&&(i=o(t,s,a)),i?(i.waypoints=l||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[s?xn(s):c,a?xn(a):p]),this._connectionDocking&&(s||a)&&!d&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,s,a)),this._graphicsFactory.drawConnection(r,i,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(r,n)},Rp.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||xn(n),o=t.connectionEnd||xn(i),s=this.cropWaypoints(r,o,n,i);xe(e,this.createNoopConnection(s[0],s[1]))},Rp.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=i&&En(s,a,!1)||t]},Rp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ae(e.connectionPreviewGfx)},Rp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Rp.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return Pe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},Rp.prototype.createNoopConnection=function(e,t){return dt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Dp={__init__:["connectionPreview"],connectionPreview:["type",Rp]},Np=["marker-start","marker-mid","marker-end"],Bp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function jp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",(function(){r.cleanUp()}))}jp.$inject=["elementRegistry","eventBus","canvas","styles"],jp.prototype.cleanUp=function(){v(this._clonedMarkers,(function(e){Ae(e)})),this._clonedMarkers={}},jp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},jp.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Kn(r),i),Pe(r,this._styles.cls(i,[],{x:o.top,y:o.left})),xe(t,r),Pe(r,"data-preview-support-element-id",e.id),r},jp.prototype.addFrame=function(e,t){var n=Be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Pe(n,"data-preview-support-element-id",e.id),n},jp.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var i=0;i<e.childNodes.length;i++)n._cloneMarkers(e.childNodes[i],t);(function(e){return-1!==Bp.indexOf(e.nodeName)})(e)&&Np.forEach((function(i){if(Pe(e,i)){var r=function(e,t,n){var i=(r=Pe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ye("marker#"+i,n||document)}(e,i,n._canvas.getContainer());n._cloneMarker(e,r,i,t)}}))},jp.prototype._cloneMarker=function(e,t,n,i="djs-dragger"){var r=t.id+"-"+i,o=this._clonedMarkers[r];if(!o){var s=r+"-clone";(o=Me(t)).id=s,Se(o).add(i),this._clonedMarkers[r]=o;var a=ye("defs",this._canvas._svg);a||(a=Be("defs"),xe(this._canvas._svg,a)),xe(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[r].id);Pe(e,n,l)};var Ip={__init__:["previewSupport"],previewSupport:["type",jp]};const $p="complex-preview";class Lp{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:i=[],resized:r=[]}=e,o=this._canvas.getLayer($p);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;mn(e)?(t=this._graphicsFactory._createContainer("connection",Be("g")),this._graphicsFactory.drawConnection(Kn(t),e)):(t=this._graphicsFactory._createContainer("shape",Be("g")),this._graphicsFactory.drawShape(Kn(t),e),Zn(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)?Zn(n,t.x,t.y):Zn(n,e.x+t.x,e.y+t.y)})),i.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"])})),r.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",Be("g"));this._graphicsFactory.drawShape(Kn(n),e,{width:t.width,height:t.height}),Zn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer($p)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer($p)}hide(){this._canvas.hideLayer($p)}}Lp.$inject=["canvas","graphicsFactory","previewSupport"];var qp={__depends__:[Ip],__init__:["complexPreview"],complexPreview:["type",Lp]},zp=["top","bottom","left","right"],Vp=10;function Fp(e,t){function n(e){if(eo(e)){var n=function(e){var t=xn(e.label),n=xn(e),i=Hp(n,t);if(r=i,-1===zp.indexOf(r))return;var r;var o=function(e){var t=xn(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 Hp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=xn(e),r=_n(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=zp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=zp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=xn(e),r=e.label,o=xn(r);if(!r.parent)return;var s,a=vn(e);switch(n){case"top":s={x:i.x,y:a.top-Vp-r.height/2};break;case"left":s={x:a.left-Vp-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Vp+r.height/2};break;case"right":s={x:a.right+Vp+r.width/2,y:i.y}}var l=ca(s,o);t.moveShape(r,l)}(e,n)}}fs.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Hp(e,t){return _n(t,e,5)}function Up(e){fs.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(kr(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 Wp(e,t){e.invoke(fs,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;v(y(i.incoming.concat(i.outgoing),(function(e){return kr(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Fp,fs),Fp.$inject=["eventBus","modeling"],e(Up,fs),Up.$inject=["eventBus"],e(Wp,fs),Wp.$inject=["injector","modeling"];function Qp(e,t){t.invoke(fs,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 Gp(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Gp(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Gp(e,t){return!fn(e)&&Sr(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Xp(e,t){function n(e){return y(e.attachers,(function(e){return kr(e,"bpmn:BoundaryEvent")}))}fs.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);kr(i,"bpmn:EventBasedGateway")&&kr(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;kr(i,"bpmn:Gateway")&&kr(r,"bpmn:EventBasedGateway")&&v(r.outgoing,(function(e){var i=e.target,r=n(i);kr(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function Kp(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}fs.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(Zp(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>Yp(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!Zp(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>Jp(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>kr(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;Zp(r)&&Jp(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>kr(e,"bpmn:Association"))),r=i.filter((e=>Yp(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;Zp(t)&&Yp(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;Yp(o)&&r(o),Zp(e)&&Jp(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;Yp(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):Jp(i)&&function(e){const n=e.incoming.filter((e=>Zp(e.source)));t.removeElements(n)}(i)}),!0)}function Yp(e){const t=Cr(e);return t&&t.get("isForCompensation")}function Zp(e){return e&&kr(e,"bpmn:BoundaryEvent")&&Kr(e,"bpmn:CompensateEventDefinition")}function Jp(e){return e&&kr(e,"bpmn:Activity")&&!Xr(e)}function eu(e){e.invoke(fs,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;kr(n,"bpmn:Lane")&&!kr(i,"bpmn:Lane")&&(t.parent=lc(n,"bpmn:Participant"))}))}function tu(e,t){fs.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(kr(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Qp.$inject=["bpmnReplace","injector"],e(Qp,fs),Qp.prototype._replaceShape=function(e,t){var n,i=(n=Cr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},Xp.$inject=["eventBus","modeling"],e(Xp,fs),e(Kp,fs),Kp.$inject=["eventBus","modeling","bpmnRules"],eu.$inject=["injector"],e(eu,fs),tu.$inject=["eventBus","bpmnFactory"],e(tu,fs);var nu=20,iu=20,ru=30,ou=2e3;function su(e,t,n){function i(){var t=e.getRootElement();return kr(t,"bpmn:Collaboration")?t:n.makeCollaboration()}fs.call(this,t),t.on(["create.start","shape.move.start"],ou,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(kr(i,"bpmn:Participant")&&kr(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!kr(e,"bpmn:Group")&&!fn(e)&&!mn(e)}));if(o.length){var s=bt(o),a=function(e,t){t={width:t.width+2*nu+ru,height:t.height+2*iu};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,s);I(i,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-iu,left:t.right-e.width/2+nu,top:t.bottom-e.height/2+iu,right:t.left+e.width/2-nu-ru}}(i,s)}}})),t.on("create.start",ou,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}kr(i,"bpmn:Participant")&&kr(r,"bpmn:Process")&&(t.on("element.hover",ou,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",ou,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return f(e,(function(e){return kr(e,"bpmn:Participant")}))}(n);o&&kr(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Cr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;kr(n,"bpmn:Participant")&&kr(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Cr(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Cr(i).set("processRef",Cr(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Cr(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var s=i.children.slice();o?r===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},r)}}),!0)}su.$inject=["canvas","eventBus","modeling"],e(su,fs);var au="__targetRef_placeholder";function lu(e,t){function n(e,n){var i=e.get("properties"),r=f(i,(function(e){return e.name===au}));return!r&&n&&kt(i,r=t.create("bpmn:Property",{name:au})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return f(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||Pt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=r.newTarget,p=c&&c.businessObject,u=r.oldTarget||r.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&i(d,s),p&&p!==l&&i(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}fs.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],cu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],cu(r))}function cu(e){return function(t){if(kr(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function pu(e){this._bpmnUpdater=e}function uu(e,t,n,i){function r(e){return e.children.filter((function(e){return kr(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return kr(e,"bpmn:Participant")&&Cr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:Ar(e),newSemanticParent:o.processRef||o,newDiParent:Ar(i)})}}fs.call(this,i),t.registerHandler("dataStore.updateContainment",pu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;kr(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 kr(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!kr(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;kr(t,"bpmn:DataStoreReference")&&"label"!==t.type&&kr(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;kr(i,"bpmn:Collaboration")||kr(n,"bpmn:DataStoreReference")&&"label"!==n.type&&kr(r,"bpmn:Collaboration")&&o(n,kr(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(kr(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();Sr(n,["bpmn:Participant","bpmn:SubProcess"])&&kr(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){kr(i,"bpmn:Process")&&o(e,i)}))}))}lu.$inject=["eventBus","bpmnFactory"],e(lu,fs),pu.$inject=["bpmnUpdater"],pu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},pu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},uu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(uu,fs);var du=Math.max,hu=Math.min,mu=20;function fu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function gu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?hu:du)(i,r)),u(o)&&(i=(/top|left/.test(e)?du:hu)(i,o)),i}function yu(e,t){return void 0!==e?e:mu}function vu(e){return!e.waypoints&&"label"!==e.type}function bu(e,t){var n;if((n=void 0===e.length?y(e.children,vu):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=yu(t.left),i=yu(t.right),r=yu(t.top),o=yu(t.bottom)):n=i=r=o=yu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(bt(n),t)}var wu=Math.abs;var xu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],_u=30;function Eu(e,t){return t=t||[],e.children.filter((function(e){kr(e,"bpmn:Lane")&&(Eu(e,t),t.push(e))})),t}function Ou(e){return e.children.filter((function(e){return kr(e,"bpmn:Lane")}))}function Pu(e){return lc(e,xu)||e}function ku(e,t){var n=Pu(e),i=Eu(n,kr(n,"bpmn:Process")?[]:[n]),r=vn(e),o=vn(t),s=function(e,t){return fu(vn(t),vn(e))}(e,t),a=[],l=Qr(e);return i.forEach((function(t){if(t!==e){var n,i,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=vn(t);s.top&&(wu(h.bottom-r.top)<10&&(u=o.top-h.bottom),wu(h.top-r.top)<5&&(c=o.top-h.top)),s.left&&(wu(h.right-r.left)<10&&(p=o.left-h.right),wu(h.left-r.left)<5&&(d=o.left-h.left)),s.bottom&&(wu(h.top-r.bottom)<10&&(c=o.bottom-h.top),wu(h.bottom-r.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(wu(h.left-r.right)<10&&(d=o.right-h.left),wu(h.right-r.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,i={top:c,right:p,bottom:u,left:d},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}})),a}function Su(e,t){fs.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;kr(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=Qr(e),c=Ou(n),p=[],u=[],d=[],h=[];yt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(i=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(r=t.calculateAdjustments(p,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),d.length&&(s=t.calculateAdjustments(d,"x",i,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:i,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-i,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}Su.$inject=["eventBus","spaceTool"],e(Su,fs);function Cu(e,t){t.invoke(fs,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Au(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,s=e.host;Au(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Au(e,t){return!fn(e)&&kr(e,"bpmn:BoundaryEvent")&&!t}function Tu(e,t,n){function i(e,i,r){var o,s,a,l,c,p,d,h,m=i.waypoints,f=e.outgoing.slice(),g=e.incoming.slice(),v=Dc(m,h=u(r.width)?xn(r):r);if(v){if(o=m.slice(0,v.index),s=m.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?m[v.index]:h,1!==o.length&&Mu(e,o[o.length-1])||o.push(Ru(a)),1!==s.length&&Mu(e,s[0])||s.unshift(Ru(a))}l=i.source,c=i.target,t.canConnect(l,e,i)&&(n.reconnectEnd(i,e,o||h),p=i),t.canConnect(e,c,i)&&(p?d=n.connect(e,c,{type:i.type,waypoints:s}):(n.reconnectStart(i,e,s||h),d=i));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(f,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}fs.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+r.x,y:s.y+r.y},l=f(n.children,(function(e){return t.canInsert(i,e)&&Dc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Mu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Ru(e){return I({},e)}function Du(e,t){fs.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Nu(i)){(kr(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&Nu(e))):o.incoming.filter((e=>e!==i&&Nu(e)&&kr(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;kr(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Nu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Nu).forEach((function(i){const r=e.incoming.filter(Nu).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function Nu(e){return kr(e,"bpmn:SequenceFlow")}Cu.$inject=["bpmnReplace","injector"],e(Cu,fs),Cu.prototype._replaceShape=function(e){var t,n,i=(n=Cr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Tu,fs),Tu.$inject=["eventBus","bpmnRules","modeling"],Du.$inject=["eventBus","modeling"],e(Du,fs);var Bu=1500;function ju(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"],Bu,(function(t){var i=t.context.shape||t.shape,r=t.hover;kr(r,"bpmn:Lane")&&!Sr(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Pu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Sr(i,["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"],Bu,(function(t){var n=t.hover;kr(n,"bpmn:Lane")&&(t.hover=Pu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Bu,(function(t){var n=t.context,i=t.hover,r=n.type;kr(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Pu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Bu,(function(e){var t=e.context,n=t.start;kr(n,"bpmn:Lane")&&(t.start=Pu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;kr(t,"bpmn:Lane")&&(e.shape=Pu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&kr(t,"bpmn:Lane")&&(e.hover=Pu(t))}))}ju.$inject=["elementRegistry","eventBus","canvas"];function Iu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return kr(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Cr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,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 Cr(e).categoryValueRef===t}))}(r,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 kt(t.get("categoryValue"),e),e.$parent=t,kt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Cr(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,i=t.categoryValue,r=Cr(e);i?(r.categoryValueRef=null,s(i,n,r)):s(null,r.categoryValueRef.$parent,r)}function p(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(fs,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;kr(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;kr(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Cr(n);if(kr(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(s(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(kr(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Cr(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;kr(n,"bpmn:Group")&&!n.labelTarget&&Cr(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;kr(n,"bpmn:Group")&&!n.labelTarget&&Cr(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(kr(n,"bpmn:Group")&&!n.labelTarget){var i=Cr(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=p(r,!0),r.$parent&&(t.category=p(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=p(i)),r&&(i.$parent=p(r)),delete t.category,delete t.categoryValue}))}function $u(e,t,n,i){var r,o,s,a;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((i.x-n.x)*o-(i.y-n.y)*s)/r,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Lu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=$u(e,t,n,r),a=$u(e,t,n,o);i=s&&a?qu(s,n)>qu(a,n)?a:s:s||a,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],xn(n.source)),t(i[i.length-1],i[i.length-2],xn(n.target)))}))}function qu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zu(e){fs.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Cr(n),r=Ar(n);if(Sr(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Iu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Iu,fs),Lu.$inject=["eventBus"],zu.$inject=["eventBus"],e(zu,fs);var Vu=Math.sqrt,Fu=Math.min,Hu=Math.max,Uu=Math.abs;function Wu(e){return Math.pow(e,2)}function Qu(e,t){return Vu(Wu(e.x-t.x)+Wu(e.y-t.y))}function Gu(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=r*r+o*o,c=(r*s+o*a)/l,p=c*c-(s*s+a*a-i*i)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Vu(p),d=-c+u,h=-c-u,m={x:e.x-r*d,y:e.y-o*d};return 0===p?[m]:[m,{x:e.x-r*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return Xu(e.x,t.x,n.x)&&Xu(e.y,t.y,n.y)}(n,e,t)}))}function Xu(e,t,n){return e>=Fu(t,n)-Ku&&e<=Hu(t,n)+Ku}var Ku=.1;function Yu(e,t){return Uu(e.x-t.x)<=Ku&&Uu(e.y-t.y)<=Ku}function Zu(e,t,n,i){var r=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,i,r,o,s,a,l,c,p,u,d,h,m=0;for(m=0;m<t.length-1;m++){if(Yu(n=t[m],i=t[m+1])?a=[n]:(r=Qu(e,n),o=Qu(e,i),a=Gu(n,i,e,Fu(r,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:m,bendpointIndex:Yu(n,a[0])?m:m+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:m,relativeLocation:Qu(n,s)/Qu(n,i)}),c=Qu(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var s=i.segmentMove.segmentStartIndex,a=i.segmentMove.newSegmentStartIndex;return r===s?a:r>=a?r+o<a?a:r+o:r}if(i.bendpointMove){var l,c=i.bendpointMove.insert,p=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=p&&(l=c?r+1:r-1),r<p&&(l=r,c&&"bendpoint"!==n.type&&p-1===r&&Ju(t,p)<n.relativeLocation&&l++),l)}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,i);if(c<0||c>t.length-2||null===c)return s;var p,u,d=ed(n,l),h=ed(t,c),m=a.position,f=function(e,t){var n=$c(e[0],e[1]),i=$c(e[0],t);return 0===n?0:i/n}(d,m),g=(p=h,u=Bc(d),Bc(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:r=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+r,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(f=Ju(n,v))}var x,_,E={x:(h[1].x-h[0].x)*f+h[0].x,y:(h[1].y-h[0].y)*f+h[0].y},O=(x={x:e.x-m.x,y:e.y-m.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return r=E.x+O.x-e.x,o=E.y+O.y-e.y,{point:yn(E),delta:yn({x:r,y:o})}}function Ju(e,t){var n=$c(e[t-1],e[t]);return n/(n+$c(e[t],e[t+1]))}function ed(e,t){return[e[t],e[t+1]]}function td(e,t,n){var i=la(t),r=la(n),o=ca(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return yn({x:r.x+s,y:r.y+a})}function nd(e,t,n){var i=la(e),r=la(t),o=la(n),s=ca(e,i),a=ca(i,r),l=function(e,t,n){var i=vn(t),r=vn(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)}(i,r))return null;var o,s,a,l=_n(t,e);if("top"===l)o={x:0,y:r.bottom-i.bottom};else if("bottom"===l)o={x:0,y:r.top-i.top};else if("right"===l)o={x:r.left-i.left,y:0};else{if("left"!==l)return null;o={x:r.right-i.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=_n(n,s),a!==l)return null;return o}(i,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,d=o.y+p;return yn({x:u+s.x-e.x,y:d+s.y-e.y})}var id="name",rd="text";function od(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(id in o&&t.updateLabel(r,o[id]),rd in o&&kr(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[rd]||"");t.updateLabel(r,o.text,s)}}function o(e){var t=e.context,n=t.connection,i=n.label,r=I({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Zu(xn(e),t,n,i).delta}(i,o,s,r)}fs.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Cr(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!fn(i)&&Jr(i)&&ro(i)&&t.updateLabel(i,ro(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Cr(n);r&&Jr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,s=i.oldBounds;if(eo(r)){var a=r.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Ic(e,t)}}));return A(n,"distance")[0].line}(e,t);return jc(e,n)}(xn(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=sd(l,s,o);t.moveShape(a,c)}}))}function sd(e,t,n){return yn(ca(td(e,t,n),e))}function ad(e,t){function n(e,t){var n=e.context,i=n.connection,r=I({},n.hints),o=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return Zu(e,t,n,i).point}(t,o,s,r)}fs.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),s=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,s)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),s=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+s.x,y:n.y+s.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+s.x,y:n.y+s.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function ld(e,t,n){var i=hd(e),r=md(i,t),o=i[0];return r.length?r[r.length-1]:td(o.original||o,n,t)}function cd(e,t,n){var i=hd(e),r=md(i,t),o=i[i.length-1];return r.length?r[0]:td(o.original||o,n,t)}function pd(e,t,n){var i=hd(e),r=dd(t,n),o=i[0];return td(o.original||o,r,t)}function ud(e,t,n){var i=hd(e),r=dd(t,n),o=i[i.length-1];return td(o.original||o,r,t)}function dd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function hd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function md(e,t){return y(E(e,fd),(function(e){return function(e,t){return"intersect"===_n(t,e,1)}(e,t)}))}function fd(e){return e.original||e}function gd(e,t){fs.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return kr(e,"bpmn:Participant")&&Wr(e)&&kr(t,"bpmn:Participant")&&!Wr(t)}(n,i)){var r,o,s,a,l=(o=vt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){kr(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){kr(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=cd(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=ld(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(od,fs),od.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(ad,fs),ad.$inject=["eventBus","modeling"],gd.$inject=["eventBus","modeling"],e(gd,fs);const yd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function vd(e){const t=Cr(e);if(!(kr(t,"bpmn:BoundaryEvent")||kr(t,"bpmn:StartEvent")&&Xr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&yd.some((e=>kr(n[0],e)))}function bd(e){return kr(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function wd(e,t){e.invoke(fs,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!vd(i))return;const o=bd(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Cr(n).get(o);s!==Cr(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function xd(e,t){fs.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Ar(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function _d(e,t,n){fs.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(kr(r,"bpmn:SequenceFlow")&&kr(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=$u(Ed(e[e.length-2]),Ed(e[e.length-1]),Ed(t[1]),Ed(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ed(e[0]),Ed(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Ed(e){return e.original||e}function Od(e,t){fs.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;kr(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 Pd(e,t,n,i){fs.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(kr(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),kr(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(r=!0),n.canConnectSequenceFlow(o,s)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,s,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(i=n.canConnect(l,c))&&i.type!==a.type&&(o=t.connect(l,c,{type:i.type,associationDirection:i.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.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,i=e.context,r=i.properties,o=i.element,s=o.businessObject;r.default&&(n=f(o.outgoing,T({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function kd(e,t,n,i,r,o){i.invoke(fs,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=w(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Xr(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var s=t.canReplace(o,i);s&&this._replaceElements(o,s.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,s=r.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,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}wd.$inject=["injector","modeling"],e(wd,fs),e(xd,fs),xd.$inject=["eventBus","modeling"],e(_d,fs),_d.$inject=["eventBus","bpmnRules","modeling"],Od.$inject=["eventBus","modeling"],e(Od,fs),e(Pd,fs),Pd.$inject=["eventBus","modeling","bpmnRules","injector"],e(kd,fs),kd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;v(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},kd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Sd={width:140,height:120},Cd={width:300,height:60},Ad={width:60,height:300},Td={width:300,height:150},Md={width:150,height:300},Rd={width:140,height:120},Dd={width:50,height:30};function Nd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(kr(n,"bpmn:Lane")||kr(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Pu(e),r=!0,o=!0,s=Eu(i,[i]),a=vn(e),l={},c={},p=Qr(e),u=p?Cd:Ad;/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 i=vn(e);/n/.test(t)&&(p&&i.top<a.top-10&&(r=!1),n&&Bd(a.top-i.bottom)<10&&qd(l,"top",i.top+u.height),Bd(a.top-i.top)<5&&Ld(c,"top",i.bottom-u.height)),/e/.test(t)&&(!p&&i.right>a.right+10&&(o=!1),n&&Bd(a.right-i.left)<10&&Ld(l,"right",i.right-u.width),Bd(a.right-i.right)<5&&qd(c,"right",i.left+u.width)),/s/.test(t)&&(p&&i.bottom>a.bottom+10&&(o=!1),n&&Bd(a.bottom-i.top)<10&&Ld(l,"bottom",i.bottom-u.height),Bd(a.bottom-i.bottom)<5&&qd(c,"bottom",i.top+u.height)),/w/.test(t)&&(!p&&i.left<a.left-10&&(r=!1),n&&Bd(a.left-i.right)<10&&qd(l,"left",i.left+u.width),Bd(a.left-i.left)<5&&Ld(c,"left",i.right-u.width))}));var d=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(kr(e,"bpmn:FlowElement")||kr(e,"bpmn:Artifact"))})),h=p?zd:Vd;return d.forEach((function(e){var n=vn(e);r&&/n/.test(t)&&Ld(c,"top",n.top-h.top),o&&/e/.test(t)&&qd(c,"right",n.right+h.right),o&&/s/.test(t)&&qd(c,"bottom",n.bottom+h.bottom),r&&/w/.test(t)&&Ld(c,"left",n.left-h.left)})),{min:c,max:l}}(n,i,r)),kr(n,"bpmn:SubProcess")&&Wr(n)&&(t.minDimensions=Rd),kr(n,"bpmn:TextAnnotation")&&(t.minDimensions=Dd)}))}Nd.$inject=["eventBus"];var Bd=Math.abs,jd=Math.min,Id=Math.max;function $d(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Ld(e,t,n){return $d(e,t,n,jd)}function qd(e,t,n){return $d(e,t,n,Id)}var zd={top:20,left:50,right:20,bottom:20},Vd={top:50,left:20,right:20,bottom:20};function Fd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(kr(n,"bpmn:Lane")||kr(n,"bpmn:Participant"))&&(t.balanced=!Uo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(kr(i,"bpmn:Lane")||kr(i,"bpmn:Participant"))return r&&(o=gn(o),t.resizeLane(i,o,n.balanced)),!1}))}Fd.$inject=["eventBus","modeling"];function Hd(e,t,n,i,r){function o(e){return Sr(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Kr(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!f(e.getDefinitions().get("rootElements"),T({id:t.id}))}function a(e){return kr(e,"bpmn:ErrorEventDefinition")?"errorRef":kr(e,"bpmn:EscalationEventDefinition")?"escalationRef":kr(e,"bpmn:MessageEventDefinition")?"messageRef":kr(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Sr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(fs,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Cr(n));i&&!s(i)&&(kt(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!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 i=l(Cr(n));i&&(t.referencedRootElement=i)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=i.copyElement(o,r.create(o.$type))),function(e,t){if(Sr(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)}))}Hd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Hd,fs);var Ud=Math.max;function Wd(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return v(t,(function(e){var t=e.id;kr(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=Qr(e);if(r=e,!Ou(r).length)return i?Td:Md;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?Td:{width:Gd(e,n,o),height:Md.height}:i?{width:Td.width,height:Qd(e,n,o)}:Md;return s}(e,n,i)),kr(e,"bpmn:Lane")&&(r[t]=Qr(e)?Cd:Ad),kr(e,"bpmn:SubProcess")&&Wr(e)&&(r[t]=Rd),kr(e,"bpmn:TextAnnotation")&&(r[t]=Dd),kr(e,"bpmn:Group")&&(r[t]=Sd)})),r}))}function Qd(e,t,n){var i;return i=function(e,t,n){var i,r=Ou(e);return i=Xd(r,t,n),e.height-i.height+Cd.height}(e,t,n),Ud(Td.height,i)}function Gd(e,t,n){var i;return i=function(e,t,n){var i,r=Ou(e);return i=Xd(r,t,n),e.width-i.width+Ad.width}(e,t,n),Ud(Md.width,i)}function Xd(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=Ou(r)).length?Xd(o,t,n):r}Wd.$inject=["eventBus"];var Kd=180,Yd=160;function Zd(e,t,n,i,r,o,s){fs.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return kr(e,"bpmn:SubProcess")&&!Wr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Cr(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function p(t){var n=Cr(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Os(n));e.removeRootElement(i)}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 i=s.get(Os(t));i&&n.removeElements(i.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,i=t.newShape;l(n)&&l(i)&&(t.oldRoot=e.removeRootElement(Os(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Os(i));if(r&&o){var s=r.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(kr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ks(t))return s.updateId(t,Ps(r)),void s.updateId(i,r);s.get(Ps(i))&&s.updateId(Ps(i),Ps(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(kr(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ks(t))return s.updateId(t,Ps(i)),void s.updateId(r,i);var o=s.get(Ps(r));o&&s.updateId(o,Ps(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ks(n)){var i=n,r=s.get(Es(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;kr(t,"bpmn:SubProcess")&&(Wr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;kr(t,"bpmn:SubProcess")&&(Wr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(kr(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Wr(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 i=Os(t),r=s.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(kr(Ar(r),"bpmndi:BPMNPlane")){var o=Es(r),s=f(i,(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 Jd(e,t){e.invoke(fs,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(kr(i,"bpmn:SubProcess")&&(kr(n,"bpmn:Task")||kr(n,"bpmn:CallActivity"))&&Wr(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function eh(e){fs.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;kr(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&&kr(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function th(e,t){fs.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Wr(n)){var i=vt(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){r(e,!0)})),v(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(Zd,fs),Zd.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.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=bt(o);if(t.x){var a=xn(t),l=xn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:Kd-s.x,y:Yd-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},Zd.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},Zd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},Zd.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:Os(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},Zd.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=f(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},Zd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],Jd.$inject=["injector","modeling"],e(Jd,fs),e(eh,fs),eh.$inject=["eventBus"],e(th,fs),th.$inject=["eventBus","modeling"];function nh(e,t,n){fs.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;kr(n,"bpmn:SubProcess")&&(n.collapsed?Ar(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Ar(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Ar(t).isExpanded=!1:Ar(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.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}}(r,o):function(e,t){var n,i,r,o=e.children,s=t;return n=(r=o,r.filter((function(e){return!e.hidden}))).concat([e]),(i=bu(n))?(s.width=Math.max(i.width,s.width),s.height=Math.max(i.height,s.height),s.x=i.x+(i.width-s.width)/2,s.y=i.y+(i.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function ih(e,t,n,i){t.invoke(fs,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;fn(t)||(kr(t,"bpmn:Participant")&&Wr(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;kr(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function rh(e,t){fs.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!kr(e,"bpmn:SequenceFlow"))return!1;var n=Cr(t),i=Cr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(nh,fs),nh.$inject=["eventBus","elementFactory","modeling"],e(ih,fs),ih.$inject=["canvas","injector","moddle","modeling"],e(rh,fs),rh.$inject=["eventBus","modeling"];function oh(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}fs.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){(i=i||new sh).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(kr(t,"bpmn:Lane")&&n.addLane(t),kr(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function sh(){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}}oh.$inject=["eventBus","modeling","translate"],e(oh,fs);var ah={__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",Fp],appendBehavior:["type",Up],associationBehavior:["type",Wp],attachEventBehavior:["type",Qp],boundaryEventBehavior:["type",Xp],compensateBoundaryEventBehaviour:["type",Kp],createBehavior:["type",eu],createDataObjectBehavior:["type",tu],createParticipantBehavior:["type",su],dataInputAssociationBehavior:["type",lu],dataStoreBehavior:["type",uu],deleteLaneBehavior:["type",Su],detachEventBehavior:["type",Cu],dropOnFlowBehavior:["type",Tu],eventBasedGatewayBehavior:["type",Du],fixHoverBehavior:["type",ju],groupBehavior:["type",Iu],importDockingFix:["type",Lu],isHorizontalFix:["type",zu],labelBehavior:["type",od],layoutConnectionBehavior:["type",ad],messageFlowBehavior:["type",gd],nonInterruptingBehavior:["type",wd],removeElementBehavior:["type",_d],removeEmbeddedLabelBoundsBehavior:["type",xd],removeParticipantBehavior:["type",Od],replaceConnectionBehavior:["type",Pd],replaceElementBehaviour:["type",kd],resizeBehavior:["type",Nd],resizeLaneBehavior:["type",Fd],rootElementReferenceBehavior:["type",Hd],spaceToolBehavior:["type",Wd],subProcessPlaneBehavior:["type",Zd],subProcessStartEventBehavior:["type",Jd],textAnnotationBehavior:["type",eh],toggleCollapseConnectionBehaviour:["type",th],toggleElementCollapseBehaviour:["type",nh],unclaimIdBehavior:["type",ih],unsetDefaultFlowBehavior:["type",rh],updateFlowNodeRefsBehavior:["type",oh]};function lh(e,t){var n=_n(e,t,-15);return"intersect"!==n?n:null}function ch(e){Gl.call(this,e)}function ph(e){return!e||fn(e)}function uh(e){do{if(kr(e,"bpmn:Process"))return Cr(e);if(kr(e,"bpmn:Participant"))return Cr(e).processRef||Cr(e)}while(e=e.parent)}function dh(e){return kr(e,"bpmn:TextAnnotation")}function hh(e){return kr(e,"bpmn:Group")&&!e.labelTarget}function mh(e){return kr(e,"bpmn:BoundaryEvent")&&vh(e,"bpmn:CompensateEventDefinition")}function fh(e){return Cr(e).isForCompensation}function gh(e){for(var t=e;t=t.parent;){if(kr(t,"bpmn:FlowElementsContainer"))return Cr(t);if(kr(t,"bpmn:Participant"))return Cr(t).processRef}return null}function yh(e,t){return gh(e)===gh(t)}function vh(e,t){return!!f(Cr(e).eventDefinitions||[],(function(e){return kr(e,t)}))}function bh(e,t){return(Cr(e).eventDefinitions||[]).every((function(e){return kr(e,t)}))}function wh(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 xh(e,t,n){if(ph(e)||ph(t))return null;if(!kr(n,"bpmn:DataAssociation")){if(Bh(e,t))return{type:"bpmn:MessageFlow"};if(jh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Ih(e,t);return i||(Nh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Dh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function _h(e,t){return!(!fn(e)&&!hh(e))||!(kr(t,"bpmn:Participant")&&!Wr(t))&&(kr(e,"bpmn:Participant")?kr(t,"bpmn:Process")||kr(t,"bpmn:Collaboration"):Sr(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:kr(e,"bpmn:Lane")?kr(t,"bpmn:Participant")||kr(t,"bpmn:Lane"):!(kr(e,"bpmn:BoundaryEvent")&&!function(e){return Cr(e).cancelActivity&&(Ph(e)||kh(e))}(e))&&(kr(e,"bpmn:FlowElement")&&!kr(e,"bpmn:DataStoreReference")?kr(t,"bpmn:FlowElementsContainer")?Wr(t):Sr(t,["bpmn:Participant","bpmn:Lane"]):kr(e,"bpmn:DataStoreReference")&&kr(t,"bpmn:Collaboration")?_(Cr(t).get("participants"),(function(e){return!!e.get("processRef")})):Sr(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Sr(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!kr(e,"bpmn:MessageFlow")&&(kr(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Eh(e){return kr(e,"bpmn:Lane")}function Oh(e){return!!function(e){return!fn(e)&&kr(e,"bpmn:BoundaryEvent")}(e)||(!(!kr(e,"bpmn:IntermediateThrowEvent")||!Ph(e))||kr(e,"bpmn:IntermediateCatchEvent")&&kh(e))}function Ph(e){var t=Cr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function kh(e){return Sh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Sh(e,t){return t.some((function(t){return vh(e,t)}))}function Ch(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!fn(r)&&(!!Oh(r)&&(!Xr(t)&&(!(!kr(t,"bpmn:Activity")||fh(t))&&(!(i&&!lh(i,t))&&(!function(e){return kr(e,"bpmn:ReceiveTask")&&f(e.incoming,(function(e){return kr(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Ah(e,t,n){if(!t)return!1;var i={replacements:[]};return v(e,(function(e){Xr(t)||kr(e,"bpmn:StartEvent")&&"label"!==e.type&&_h(e,t)&&(Gr(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Kr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Kr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Kr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Sh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&kr(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),kr(t,"bpmn:Transaction")||vh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(kr(e,"bpmn:EndEvent")&&_h(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),kr(e,"bpmn:BoundaryEvent")&&Ch(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Th(e,t){return!_(e,Eh)&&(!t||e.every((function(e){return _h(e,t)})))}function Mh(e,t,n,i){return!!t&&(!(!fn(e)&&!hh(e))||!function(e,t){return e===t}(n,t)&&((!n||!wh(n,t))&&(_h(e,t)||$h(e,t))))}function Rh(e,t){return kr(e,"bpmn:SubProcess")?Wr(e)&&(!t||t.width>=100&&t.height>=80):!!kr(e,"bpmn:Lane")||(!!kr(e,"bpmn:Participant")||(!!dh(e)||!!hh(e)))}function Dh(e,t){return!wh(t,e)&&!wh(e,t)&&(!!function(e,t){var n=dh(e),i=dh(t);return(n||i)&&n!==i}(e,t)||!!Ih(e,t))}function Nh(e,t){return yh(e,t)&&mh(e)&&kr(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Xr(t);var n}function Bh(e,t){return!(qh(e)&&!qh(t))&&(kr(n=e,"bpmn:InteractionNode")&&!kr(n,"bpmn:BoundaryEvent")&&(!kr(n,"bpmn:Event")||kr(n,"bpmn:ThrowEvent")&&bh(n,"bpmn:MessageEventDefinition"))&&function(e){return kr(e,"bpmn:InteractionNode")&&!fh(e)&&(!kr(e,"bpmn:Event")||kr(e,"bpmn:CatchEvent")&&bh(e,"bpmn:MessageEventDefinition"))&&!(kr(e,"bpmn:BoundaryEvent")&&!vh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return uh(e)===uh(t)}(e,t));var n}function jh(e,t){return kr(n=e,"bpmn:FlowNode")&&!kr(n,"bpmn:EndEvent")&&!Xr(n)&&!(kr(n,"bpmn:IntermediateThrowEvent")&&vh(n,"bpmn:LinkEventDefinition"))&&!mh(n)&&!fh(n)&&function(e){return kr(e,"bpmn:FlowNode")&&!kr(e,"bpmn:StartEvent")&&!kr(e,"bpmn:BoundaryEvent")&&!Xr(e)&&!(kr(e,"bpmn:IntermediateCatchEvent")&&vh(e,"bpmn:LinkEventDefinition"))&&!fh(e)}(t)&&yh(e,t)&&!(kr(e,"bpmn:EventBasedGateway")&&!function(e){return kr(e,"bpmn:ReceiveTask")||kr(e,"bpmn:IntermediateCatchEvent")&&(vh(e,"bpmn:MessageEventDefinition")||vh(e,"bpmn:TimerEventDefinition")||vh(e,"bpmn:ConditionalEventDefinition")||vh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Ih(e,t){return Sr(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Sr(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Sr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Sr(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function $h(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&&(Sr(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&kr(e,"bpmn:FlowNode")&&!kr(e,"bpmn:BoundaryEvent")&&_h(e,t.parent))}function Lh(e,t){return!!fn(t)||!(kr(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function qh(e){return lc(e,"bpmn:Process")||lc(e,"bpmn:Collaboration")}e(ch,Gl),ch.$inject=["eventBus"],ch.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(ph(e))return null;return Sr(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,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return xh(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return xh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Rh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(mn(i)&&!$h(t,i))&&x(t,(function(e){return mn(e)?xh(e.source,e.target,e):e.host?Ch(e,e.host,null,n):Mh(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Ch(n,t,null,i)||Ah(n,t,i)||Th(n,t)||$h(n,t)})),this.addRule("shape.create",(function(e){return Mh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Ch(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Lh(e.elements,t)}))},ch.prototype.canConnectMessageFlow=Bh,ch.prototype.canConnectSequenceFlow=jh,ch.prototype.canConnectDataAssociation=Ih,ch.prototype.canConnectAssociation=Dh,ch.prototype.canConnectCompensationAssociation=Nh,ch.prototype.canMove=Th,ch.prototype.canAttach=Ch,ch.prototype.canReplace=Ah,ch.prototype.canDrop=_h,ch.prototype.canInsert=$h,ch.prototype.canCreate=Mh,ch.prototype.canConnect=xh,ch.prototype.canResize=Rh,ch.prototype.canCopy=Lh;var zh={__depends__:[Ac],__init__:["bpmnRules"],bpmnRules:["type",ch]};function Vh(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Ar(e);t=E(y(vt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Ar),n.set("planeElement",t)}))}))}Vh.$inject=["eventBus","canvas"];var Fh={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vh]};function Hh(e){fs.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);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,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function Uh(e,t,n){Hh.call(this,e);var i=[{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 r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=f(i,(function(t){return Sr(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||kr(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var i=t;i&&!Sr(i,n);)i=i.parent;if(!i)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return i}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Hh.prototype.getOrdering=function(e,t){return null},e(Hh,fs),Uh.$inject=["eventBus","canvas","translate"],e(Uh,Hh);var Wh={__depends__:[Ro],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Uh]};function Qh(){}Qh.prototype.get=function(){return this._data},Qh.prototype.set=function(e){this._data=e},Qh.prototype.clear=function(){var e=this._data;return delete this._data,e},Qh.prototype.isEmpty=function(){return!this._data};var Gh={clipboard:["type",Qh]},Xh="drop-ok",Kh="drop-not-ok",Yh="attach-ok",Zh="new-parent",Jh="create";function em(e,t,n,i,r){function o(t,n){[Yh,Xh,Kh,Zh].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===Jh&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,s=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);tm(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var s=f(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!mn(e)})),a=!1,l=!1,c=!1;nm(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=nm(e)?r.allowed("shape.create",{position:n,shape:s,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&i&&(l=r.allowed("connection.create",{source:p===i?s:i,target:p===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,s,a);i&&null!==c&&(t.target=i,c&&c.attach?o(i,Yh):o(i,c?Zh:Kh))})),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,r=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;tm(e);var u={x:e.x,y:e.y};r=c?i.appendShape(n,r,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):f(o=i.createElements(o,u,s,I({},p,{attach:l})),(function(e){return!mn(e)})),I(t,{elements:o,shape:r}),I(e,{elements:o,shape:r})})),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,i){c(n)||(n=[n]);var r=f(n,(function(e){return!mn(e)}));if(r){i=I({elements:n,hints:{},shape:r},i||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=bt(y(n,(function(e){return!e.hidden})));v(n,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),I(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,Jh,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function tm(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 nm(e){return e&&1===e.length&&!mn(e[0])}em.$inject=["canvas","dragging","eventBus","modeling","rules"];function im(e,t,n,i,r){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=Be("g");Pe(t,r.cls("djs-drag-group",["no-events"]));var o=Be("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Kn(r),e)):(r=n._createContainer("shape",o),n.drawShape(Kn(r),e),Zn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Zn(l,t.x,t.y)):Ae(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ae(t)}))}im.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var rm={__depends__:[Oc,Ip,Ac,os],__init__:["create","createPreview"],create:["type",em],createPreview:["type",im]};function om(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)}))}om.$inject=["eventBus"],om.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var sm={__init__:["mouse"],mouse:["type",om]};function am(e,t,n,i,r,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=s,this._rules=a,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=f(i,(function(e){return e===n.parent}));r&&(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 E(e.waypoints,(function(e){return(e=lm(e)).original&&(e.original=lm(e.original)),e}))}(n)),fn(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})),r.on("copyPaste.pasteElements",(function(e){I(e.hints,{createElementsBehavior:!1})}))}function lm(e){return I({},e)}function cm(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}am.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],am.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},am.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 i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},am.prototype._paste=function(e,t,n,i){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var r=bt(e);return v(e,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),I(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,I({},i))},am.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return v(e,(function(e,o){v(e=A(e,"priority"),(function(e){var o,s=I({},q(e,["priority"]));return i[e.parent]?s.parent=i[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s}),mn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):fn(s)?(s.labelTarget=i[s.labelTarget],o=i[e.id]=t.createLabel(s),void r.push(o)):(s.host&&(s.host=i[s.host]),o=i[e.id]=t.createShape(s),void r.push(o))}))})),r},am.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},am.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},am.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},am.prototype.hasRelations=function(e,t){var n,i;return!(mn(e)&&(n=f(t,T({id:e.source.id})),i=f(t,T({id:e.target.id})),!n||!i))&&!(fn(e)&&!f(t,T({id:e.labelTarget.id})))},am.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=f(r,(function(t){return e===t.element}));n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}return yt(mt(e),(function(e,t,i){if(!fn(e)){v(e.labels,(function(e){o(e,i)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,i)})),o(e,i)}))})),o(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}})),e=E(r,(function(e){return e.element})),r=E(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=A(r,(function(e){return e.descriptor.priority})),e=E(r,(function(e){return e.element})),v(r,(function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?cm(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):cm(r.element,e)})),i};var pm={__depends__:[Gh,rm,sm,Ac],__init__:["copyPaste"],copyPaste:["type",am]};function um(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function dm(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=Cr(n);if(fn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(Ar(n),!0);s.bpmnElement=o,um(o,t,"name"),um(s,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Cr(t[n.labelTarget]),void(n.di=Ar(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,um(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(kr(n,"bpmn:Participant")){var r=Cr(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[r]=t}(t,function(e,t,n){var i=Cr(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Cr(e).attachedToRef=Cr(t[e.host])),q(n,w(n,(function(t,n,r){var o=n.element,s=n.property;return r===e.id&&(o.set(s,i),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[r]=e[r]||{}}(t)))}))}dm.$inject=["bpmnFactory","eventBus","moddleCopy"];var hm=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function mm(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 A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===hm.indexOf(i))&&(!(i&&n&&!f(n.properties,T({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&d(t.$instanceOf)&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1}))}function fm(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}mm.$inject=["eventBus","bpmnFactory","moddle"],mm.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||fm(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;m(e,n)&&(o=e.get(n));var s=r.copyProperty(o,t,n,i);a(s)&&(!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},mm.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});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,i);if(c(e))return w(e,(function(e,s){return(o=r.copyProperty(s,t,n,i))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=r._bpmnFactory.create(e.$type)).$parent=t,o=r.copyElement(e,o,null,i)}return e}}},mm.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 gm={__depends__:[pm],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",dm],moddleCopy:["type",mm]},ym=Math.round;function vm(e,t){this._modeling=e,this._eventBus=t}function bm(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}vm.$inject=["modeling","eventBus"],vm.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.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=ym(a+o/2),p=ym(l+s/2),u=i.replaceShape(e,I({},t,{x:c,y:p,width:o,height:s}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},bm.$inject=["selection","eventBus"];var wm={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bm],replace:["type",vm]};var xm=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function _m(e,t,n,i,r,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Em(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Wr(e);return n!==(t&&(m(t,"collapsed")||m(t,"isExpanded"))?m(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return i.toggleCollapse(a),a;var h=e.create(u),f={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(f.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(fm(d.$descriptor),fm(h.$descriptor,!0));I(h,L(l,xm));var b=y(g,(function(e){return"eventDefinitions"===e?Om(a,l.eventDefinitionType):"loopCharacteristics"===e?!Xr(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Xr(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(Om(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),kr(d,"bpmn:Activity")){if(Em(d))f.isExpanded=Wr(a);else if(l&&m(l,"isExpanded")){f.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:f.isExpanded});f.width=w.width,f.height=w.height,f.x=a.x-(f.width-a.width)/2,f.y=a.y-(f.height-a.height)/2}Wr(a)&&!kr(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}return Em(d)&&!Em(h)&&(p.moveChildren=!1),kr(d,"bpmn:Participant")&&(!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,f.width=a.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Sr(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Sr(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!kr(d,"bpmn:BoundaryEvent")&&kr(h,"bpmn:BoundaryEvent")&&(f.host=l.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=a.x+(a.width-f.width)/2),r.replaceElement(a,f,{...p,targetElement:l})}}function Em(e){return kr(e,"bpmn:SubProcess")}function Om(e,t){var n=Cr(e);return t&&n.get("eventDefinitions").some((function(e){return kr(e,t)}))}_m.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Pm={__depends__:[gm,wm,os],bpmnReplace:["type",_m]};function km(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}km.$inject=["eventBus","dragging"],km.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)},km.prototype.isActive=function(e){return e&&this._active===e},km.prototype.length=function(e){return this._tools.length},km.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},km.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Sm={__depends__:[Oc],__init__:["toolManager"],toolManager:["type",km]};function Cm(e,t){return-1!==e.indexOf(t)}var Am=Math.abs,Tm=Math.round,Mm={x:"width",y:"height"},Rm="crosshair",Dm={n:"top",w:"left",s:"bottom",e:"right"},Nm=1500,Bm={n:"s",w:"e",s:"n",e:"w"},jm=20;function Im(e,t,n,i,r,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",Nm,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Lm(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Lm(e);var c={x:0,y:0};c[i]=Tm(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function $m(e){return{top:e.top-jm,right:e.right+jm,bottom:e.bottom+jm,left:e.left-jm}}function Lm(e){var t,n,i=e.context.spaceToolConstraints;i&&(u(i.left)&&(t=Math.max(e.x,i.left),e.dx=e.dx+t-e.x,e.x=t),u(i.right)&&(t=Math.min(e.x,i.right),e.dx=e.dx+t-e.x,e.x=t),u(i.top)&&(n=Math.max(e.y,i.top),e.dy=e.dy+n-e.y,e.y=n),u(i.bottom)&&(n=Math.min(e.y,i.bottom),e.dy=e.dy+n-e.y,e.y=n))}function qm(e,t){return-1!==e.indexOf(t)}Im.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Im.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Rm,data:{context:{reactivate:n}},trapClick:!1})},Im.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Rm,data:{context:{}}})},Im.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Im.prototype.init=function(e,t){var n=Am(e.dx)>Am(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Am(i)<5)return!1;i<0&&(i*=-1),Uo(e)&&(i*=-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,i),s=this._canvas.getRootElement();!Wo(e)&&e.hover&&(s=e.hover);var a=[...vt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,i,r),c=function(e,t,n,i,r){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,m,f,g,v=e.attachers,b=e.children,w=vn(e),x=y(b,(function(e){return!(mn(e)||fn(e)||qm(o,e)||qm(s,e))})),_=y(b,(function(e){return!mn(e)&&!fn(e)&&qm(o,e)})),E=[],O=[];x.length&&(d=$m(vn(bt(x))),p=i-w[Dm[n]]+d[Dm[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&&(h=$m(vn(bt(_))),p=i-h[Dm[Bm[n]]]+w[Dm[Bm[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){qm(o,e)?E.push(e):O.push(e)})),E.length&&(m=vn(bt(E.map(xn))),f=w[Dm[Bm[n]]]-(m[Dm[Bm[n]]]-i)),O.length&&(g=vn(bt(O.map(xn)))[Dm[n]]-(w[Dm[n]]-i)),"n"===n?(p=Math.min(f||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(f||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(f||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(f||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var P=r&&r[e.id];P&&("n"===n?(p=i+e[Mm[t]]-P[Mm[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=i+e[Mm[t]]-P[Mm[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=i-e[Mm[t]]+P[Mm[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=i-e[Mm[t]]+P[Mm[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:r}));return I(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:r}),ra("resize-"+("x"===n?"ew":"ns")),!0},Im.prototype.calculateAdjustments=function(e,t,n,i){var r=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&&!fn(e))if(mn(e))l.push(e);else{var o=e[t],p=o+e[Mm[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>i||n<0&&xn(e)[t]<i))a.push(e);else{var u;if(!(n>0&&o>i||n<0&&p<i))return o<i&&p>i&&r.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;qm(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,i=e.label;qm(p,t)&&qm(p,n)&&i&&c(i)})),{movingShapes:o,resizingShapes:s}},Im.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Im.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var zm="djs-dragging",Vm="djs-resizing",Fm=Math.max;function Hm(e,t,n,i,r){function o(e,t){v(e,(function(e){r.addDragger(e,t),n.addMarker(e,zm)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Be("g");Pe(a,i.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Be("path");Pe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Be("path");Pe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Zn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ae(t)})),e.on("spaceTool.move",250,(function(e){var 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=Be("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Be("g");Pe(d,i.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),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 i=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(r=!0)}))})),mn(e)&&(t||i)&&(n||r)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Be("g");Pe(h,i.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var m=[];v(p,(function(e){var t=r.addFrame(e,h),i=t.getBBox();m.push({element:t,initialBounds:i}),n.addMarker(e,Vm)})),s.frameGroup=h,s.frames=m}Pe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var f={x:e.dx,y:e.dy};f[{x:"y",y:"x"}[s.axis]]=0,Zn(s.dragGroup,f.x,f.y),v(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?Pe(i,{width:Fm(r.width+f.x,5)}):Pe(i,{width:t=Fm(r.width-f.x,5),x:r.x+r.width-t}),"s"===s.direction?Pe(i,{height:Fm(r.height+f.y,5)}):Pe(i,{height:n=Fm(r.height-f.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(i,(function(e){n.removeMarker(e,zm)})),v(r,(function(e){n.removeMarker(e,zm)})),a&&(Ae(s),Ae(a)),v(o,(function(e){n.removeMarker(e,Vm)})),l&&Ae(l)}))}Hm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Um={__init__:["spaceToolPreview"],__depends__:[Oc,Ac,Sm,Ip,sm],spaceTool:["type",Im],spaceToolPreview:["type",Hm]};function Wm(e){e.invoke(Im,this)}Wm.$inject=["injector"],e(Wm,Im),Wm.prototype.calculateAdjustments=function(e,t,n,i){var r=Im.prototype.calculateAdjustments.call(this,e,t,n,i);return r.resizingShapes=r.resizingShapes.filter((function(e){return!kr(e,"bpmn:TextAnnotation")&&(!function(e){return kr(e,"bpmn:Participant")&&!Cr(e).processRef}(e)||!("y"===t&&Qr(e)||"x"===t&&!Qr(e)))})),r};var Qm={__depends__:[Um],spaceTool:["type",Wm]};function Gm(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)}Gm.$inject=["eventBus","injector"],Gm.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()},Gm.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Gm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},Gm.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()}},Gm.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()}},Gm.prototype.register=function(e,t){this._setHandler(e,t)},Gm.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)},Gm.prototype.canUndo=function(){return!!this._getUndoAction()},Gm.prototype.canRedo=function(){return!!this._getRedoAction()},Gm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Gm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Gm.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},Gm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},Gm.prototype._createId=function(){return this._uid++},Gm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Gm.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Gm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Gm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Gm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},Gm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Gm.prototype._revertedAction=function(e){this._stackIdx--},Gm.prototype._getHandler=function(e){return this._handlerMap[e]},Gm.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 Xm={commandStack:["type",Gm]};function Km(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 Ym(e,t,n){fs.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Zm(n),t.validatedShapes=Zm(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),v(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;Km((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=St(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(kt(i.labels,n,r),n.labelTarget=i)}))}function Zm(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(Ym,fs),Ym.$inject=["injector","eventBus","modeling"];var Jm={__init__:["labelSupport"],labelSupport:["type",Ym]},ef="attach-ok";function tf(e,t,n,i,r){fs.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=nf(t=r),C("id",t,n)),i.validatedShapes=function(e){var t=k(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(nf(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 i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,ef),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,ef)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(nf(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||v(i?n:y(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),v(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;Km(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=nd(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=nd(e,i,o);r.moveShape(e,t,e.parent),v(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;Km(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function nf(e){return i(E(e,(function(e){return e.attachers||[]})))}e(tf,fs),tf.$inject=["injector","eventBus","canvas","rules","modeling"];var rf={__depends__:[Ac],__init__:["attachSupport"],attachSupport:["type",tf]};function of(e){this._model=e}function sf(e,t,n,i){fs.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){v(e.context.oldRoot.children,(function(e){kr(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function s(e){var t=e.context.shape;kr(t,"bpmn:BaseElement")&&r.updateBounds(t)}function a(e){r.updateConnection(e.context)}function l(e){r.updateConnectionWaypoints(e.context.connection)}function c(e){r.updateAttachment(e.context)}function p(e){const{element:n}=e.context,i=ro(n),r=Ar(n),o=r&&r.get("label");Jr(n)||ks(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.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"],af((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],af((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],af((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],af((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"],af(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],af(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],af(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],af(l)),this.executed("connection.reconnect",af((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Cr(n),s=Cr(i),a=Cr(r);o.conditionExpression&&!Sr(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",af((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Cr(n),s=Cr(i),a=Cr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],af(c)),this.reverted(["element.updateAttachment"],af(c)),this.executed("element.updateLabel",af(p)),this.reverted("element.updateLabel",af(p))}function af(e){return function(t){var n=t.context;kr(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function lf(e,t,n){Un.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function cf(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function pf(e,t){this._modeling=e,this._canvas=t}function uf(e){this._modeling=e}function df(e,t){this._canvas=e,this._layouter=t}of.$inject=["moddle"],of.prototype._needsId=function(e){return Sr(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"])},of.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=kr(e,"bpmn:Activity")?"Activity":kr(e,"bpmn:Event")?"Event":kr(e,"bpmn:Gateway")?"Gateway":Sr(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},of.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},of.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},of.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},of.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},of.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},of.prototype.createDiWaypoint=function(e){return this.create("dc:Point",L(e,["x","y"]))},of.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},of.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(sf,fs),sf.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],sf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},sf.prototype.updateParent=function(e,t){if(!(fn(e)||kr(e,"bpmn:DataStoreReference")&&e.parent&&kr(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ar(e),o=n&&n.businessObject,s=Ar(n);kr(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),kr(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),kr(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),kr(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},sf.prototype.updateBounds=function(e){var t=Ar(e),n=function(e){if(!kr(e,"bpmn:Activity"))return;var t=Ar(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ca(n,t.get("bounds"));I(n,{x:e.x+i.x,y:e.y+i.y})}var r=fn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),I(o,{x:e.x,y:e.y,width:e.width,height:e.height})},sf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(kr(n,"bpmn:Lane")&&Pt(n.get("flowNodeRef"),e),kr(t,"bpmn:Lane")&&kt(t.get("flowNodeRef"),e))},sf.prototype.updateDiConnection=function(e,t,n){var i=Ar(e),r=Ar(t),o=Ar(n);i.sourceElement&&i.sourceElement.bpmnElement!==Cr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Cr(n)&&(i.targetElement=n&&o)},sf.prototype.updateDiParent=function(e,t){if(t&&!kr(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)}},sf.prototype.getLaneSet=function(e){var t,n;return kr(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(kr(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},sf.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&(!kr(e,"bpmn:DataInput")&&!kr(e,"bpmn:DataOutput")||(kr(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(kr(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(kr(e,"bpmn:FlowElement")){if(t)if(kr(t,"bpmn:Participant"))t=t.processRef;else if(kr(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(kr(t,"bpmn:Lane"));i="flowElements"}else if(kr(e,"bpmn:Artifact")){for(;t&&!kr(t,"bpmn:Process")&&!kr(t,"bpmn:SubProcess")&&!kr(t,"bpmn:Collaboration");){if(kr(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(kr(e,"bpmn:MessageFlow"))i="messageFlows";else if(kr(e,"bpmn:Participant")){i="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!kr(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),s),s.$parent=null),t&&(kt(o.get("rootElements"),s),s.$parent=o))}else kr(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":kr(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Pt(a=e.$parent.get(i),e),t?((a=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(i);Pt(a,e),t&&(l||(l=[],t.set(i,l)),l.push(e))}}},sf.prototype.updateConnectionWaypoints=function(e){Ar(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},sf.prototype.updateConnection=function(e){var t,n=e.connection,i=Cr(n),r=n.source,o=Cr(r),s=n.target,a=Cr(n.target);if(kr(i,"bpmn:DataAssociation"))kr(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):kr(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=kr(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(Pt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(Pt(i.targetRef&&i.targetRef.get("incoming"),i),a&&a.get("incoming")&&a.get("incoming").push(i)),i.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,s)},sf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(lf,Un),lf.$inject=["bpmnFactory","moddle","translate"],lf.prototype._baseCreate=Un.prototype.create,lf.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Yr,t))}return this.createElement(e,t)},lf.prototype.createElement=function(e,t){var n,i,r,o=this._translate,s=(t=I({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Er(s=this._bpmnFactory.create(t.type))}if(!Sr(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=I({},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 kr(s,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=cf(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=cf(l,t,"isExpanded")),Sr(s,["bpmn:Lane","bpmn:Participant"])&&(t=cf(l,t,"isHorizontal")),kr(s,"bpmn:SubProcess")&&(t.collapsed=!Wr(s,l)),kr(s,"bpmn:ExclusiveGateway")&&(m(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&&(i=s.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=s,s.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=I({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},lf.prototype.getDefaultSize=function(e,t){var n=Cr(e);return t=t||Ar(e),kr(n,"bpmn:SubProcess")?Wr(n,t)?{width:350,height:200}:{width:100,height:80}:kr(n,"bpmn:Task")?{width:100,height:80}:kr(n,"bpmn:Gateway")?{width:50,height:50}:kr(n,"bpmn:Event")?{width:36,height:36}:kr(n,"bpmn:Participant")?Wr(n,t)?{width:600,height:250}:{width:400,height:60}:kr(n,"bpmn:Lane")?{width:400,height:100}:kr(n,"bpmn:DataObjectReference")?{width:36,height:50}:kr(n,"bpmn:DataStoreReference")?{width:50,height:50}:kr(n,"bpmn:TextAnnotation")?{width:100,height:30}:kr(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lf.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=I({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},pf.$inject=["modeling","canvas"],pf.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;v(n,(function(e){var n={x:0,y:0};a(i.left)?n.x=i.left-e.x:a(i.right)?n.x=i.right-e.width-e.x:a(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:a(i.top)?n.y=i.top-e.y:a(i.bottom)?n.y=i.bottom-e.height-e.y:a(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},pf.prototype.postExecute=function(e){},uf.$inject=["modeling"],uf.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},uf.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},df.$inject=["canvas","layouter"],df.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,o),t},df.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var hf=Math.round;function mf(e){this._modeling=e}mf.$inject=["modeling"],mf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=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=bt(y(t,(function(e){return!e.hidden})));v(t,(function(e){mn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:hf(e.x-a.x-a.width/2+r.x),y:hf(e.y-a.y-a.height/2+r.y)}}))),I(e,{x:hf(e.x-a.x-a.width/2+r.x),y:hf(e.y-a.y-a.height/2+r.y)})}));var l=mt(t),c={};v(t,(function(e){if(mn(e))c[e.id]=u(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=I({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=q(t,["attach"])),c[e.id]=u(i)?s.createShape(e,L(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,L(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=P(c)};var ff=Math.round;function gf(e){this._canvas=e}function yf(e){gf.call(this,e)}gf.$inject=["canvas"],gf.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?I(t,n):I(t,{x:n.x-ff(t.width/2),y:n.y-ff(t.height/2)}),this._canvas.addShape(t,i,r),t},gf.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(yf,gf),yf.$inject=["canvas"];var vf=gf.prototype.execute;yf.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,vf.call(this,e)};var bf=gf.prototype.revert;function wf(e,t){this._canvas=e,this._modeling=t}function xf(e,t){this._modeling=e,this._elementRegistry=t}function _f(e,t){this._canvas=e,this._modeling=t}function Ef(e){this._modeling=e}yf.prototype.revert=function(e){return e.shape.labelTarget=null,bf.call(this,e)},wf.$inject=["canvas","modeling"],wf.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Km(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},wf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=St(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},wf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,kt(n.children,t,i),this._canvas.addConnection(t,n),t},xf.$inject=["modeling","elementRegistry"],xf.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))}))},_f.$inject=["canvas","modeling"],_f.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Km(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),Km(n.children,(function(e){mn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},_f.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=St(i.children,n),t.removeShape(n),n},_f.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return kt(i.children,n,r),t.addShape(n,i),n},Ef.$inject=["modeling"];var Of={x:"y",y:"x"};function Pf(e,t){this._layouter=e,this._canvas=t}function kf(){}function Sf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Cf(e){this._modeling=e}function Af(e){this._helper=new Cf(e)}function Tf(e){this._modeling=e,this._helper=new Cf(e)}function Mf(e){this._modeling=e}function Rf(e){return e.original||e}function Df(e,t){this._modeling=e,this._rules=t}function Nf(e){this._modeling=e}function Bf(e){this._modeling=e}function jf(e){return I({},e)}function If(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function $f(e,t,n){var i=If(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Lf(e,t){return-1!==e.indexOf(t)}function qf(e){this._modeling=e}function zf(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,zf(e.children)))})),t}function Vf(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Vf(e.children,e.collapsed||t)))})),n}function Ff(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Ff(e.children,t)))})),n}function Hf(e){this._modeling=e}function Uf(e,t){return Pt(e&&e.attachers,t)}function Wf(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),kt(i,t,n)}}function Qf(){}function Gf(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function Xf(e){this._elementRegistry=e}function Kf(e,t){v(t,(function(t,n){e.set(n,t)}))}Ef.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function s(e){return e[i]+e[r]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],m=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),m+=l(e.range)):(u=(p=A(e.elements,i))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var r={y:0};r[i]=e-s(n),r[i]&&(r[Of[i]]=0,t.moveElements([n],r,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),c&&c!==n.length-1&&(m+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-m)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Of[i]]=0,a[i]=s.range.max-n[i]+c,e.range.min!==n[i]&&(a[i]+=n[i]-e.range.min),a[i]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},Ef.prototype.postExecute=function(e){},Pf.$inject=["layouter","canvas"],Pf.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},kf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Pt(o.children,t),kt(i.children,t,r),t.parent=i,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},kf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Pt(n.children,t),kt(i.children,t,r),t.parent=i,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},Sf.prototype.add=function(e,t){return this.addAll([e],t)},Sf.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var i=_t((n=n||{}).allShapes),r=_t(n.allConnections),o=_t(n.enclosedElements),a=_t(n.enclosedConnections),l=_t(n.topLevel,t&&k(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return yt(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return I(this,n),this},Cf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Cf.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;r&&r.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 i=!!s[e.source.id],r=!!s[e.target.id];l[e.id]&&i&&r?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:i&&pd(e,e.source,t),connectionEnd:r&&ud(e,e.target,t)})}))},Cf.prototype.getClosure=function(e){return(new Sf).addAll(e,!0)},Af.$inject=["modeling"],Af.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Af.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)},Tf.$inject=["modeling"],Tf.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=L(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),kt(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Tf.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(v(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:ud(e,t,n)})})),v(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:pd(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},Tf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return kt(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Tf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Tf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Mf.$inject=["modeling"],Mf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Mf.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Rf(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Rf(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Mf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},Df.$inject=["modeling","rules"],Df.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return r.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&&i.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),i.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,cd(e,t,u),a)})),v(h,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,ld(e,t,u),a)}))},Df.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Df.prototype.execute=function(e){},Df.prototype.revert=function(e){},Df.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Df.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Df.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Nf.$inject=["modeling"],Nf.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Nf.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:cd(e,n,i)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:ld(e,n,i)})})))},Nf.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Bf.$inject=["modeling"],Bf.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,s={};this.moveShapes(i,t),v(r,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;v(r.concat(o),(function(i){var r=i.source,o=i.target;(Cm(e,r)||Cm(e,o)||Cm(t,r)||Cm(t,o))&&(Cm(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Bf.prototype.execute=function(){},Bf.prototype.revert=function(){},Bf.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Bf.prototype.resizeShapes=function(e,t,n){var i=this;v(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:i,y:r+l,width:o,height:s-l};case"s":return{x:i,y:r,width:o,height:s+l};case"w":return{x:i+a,y:r,width:o-a,height:s};case"e":return{x:i,y:r,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Bf.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,s){var a=this,l=r.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=jf(e)).original&&(e.original=jf(e.original)),e}))}(e),d=If(n),h={};Lf(l,c)&&Lf(l,p)?(u=E(u,(function(e){return $f(e,i,n)&&(e[d]=e[d]+t[d]),e.original&&$f(e.original,i,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Lf(l,c)||Lf(l,p))&&(Lf(r,c)?h.connectionStart=pd(e,c,t):Lf(r,p)?h.connectionEnd=ud(e,p,t):Lf(o,c)?h.connectionStart=ld(e,c,s[c.id]):Lf(o,p)&&(h.connectionEnd=cd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},qf.$inject=["modeling"],qf.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=zf(n),t.collapsed=!t.collapsed;var i=Vf(n,t.collapsed);return[t].concat(i)},qf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Ff(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Hf.$inject=["modeling"],Hf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Uf(i,t),Wf(n,t),t.host=n,t},Hf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Uf(n,t),Wf(i,t,r),t},Qf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Qf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Gf.$inject=["eventBus","elementFactory","commandStack"],Gf.prototype.getHandlers=function(){return{"shape.append":uf,"shape.create":gf,"shape.delete":_f,"shape.move":Tf,"shape.resize":Nf,"shape.replace":Df,"shape.toggleCollapse":qf,spaceTool:Bf,"label.create":yf,"connection.create":df,"connection.delete":wf,"connection.move":kf,"connection.layout":Pf,"connection.updateWaypoints":Qf,"connection.reconnect":Mf,"elements.create":mf,"elements.move":Af,"elements.delete":xf,"elements.distribute":Ef,"elements.align":pf,"element.updateAttachment":Hf}},Gf.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},Gf.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Gf.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Gf.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,s=n;!0===o?(r=n,s=n.parent):!1===o&&(r=null);var a={shapes:e,delta:t,newParent:s,newHost:r,hints:i};this._commandStack.execute("elements.move",a)},Gf.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Gf.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Gf.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var s={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",s),s.connection},Gf.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,s,a=(r=r||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",l),l.shape},Gf.prototype.createElements=function(e,t,n,i,r){c(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},Gf.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Gf.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Gf.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Gf.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Gf.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Gf.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Gf.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Gf.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Gf.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Gf.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Gf.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Gf.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Gf.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,I(i,{docking:"source"}))},Gf.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,I(i,{docking:"target"}))},Gf.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Gf.prototype._create=function(e,t){return t instanceof Ln?t:this._elementFactory.create(e,t)},Gf.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},Xf.$inject=["elementRegistry"],Xf.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=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,O(i));return Kf(n,i),e.oldProperties=o,e.changed=r,r},Xf.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Kf(n,t),i},Xf.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return kr(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return kr(t,"bpmn:DataObjectReference")&&Cr(t).dataObjectRef===e}))}(e,t):[]};var Yf="default",Zf="id",Jf="di",eg={width:0,height:0};function tg(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function ng(e,t){return Zf in e&&e[Zf]!==t[Zf]}function ig(e,t){var n=e.businessObject,i=Ar(e);v(t,(function(e,t){t!==Jf?n.set(t,e):i&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(i,e)}))}tg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],tg.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,s=t.businessObject,a=function(e){var t=I({},e);return rg.forEach((function(n){n in e&&(t[n]=Cr(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=O(t),i=e.businessObject,r=Ar(e);return w(n,(function(e,n){return e[n]=n!==Jf?i.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,O(t.di)),e}),{})}(t,a);return ng(a,s)&&(o.unclaim(s[Zf]),r.updateId(t,a[Zf]),o.claim(a[Zf],s)),Yf in a&&(a[Yf]&&n.push(r.get(a[Yf].id)),s[Yf]&&n.push(r.get(s[Yf].id))),ig(t,a),e.oldProperties=l,e.changed=n,n},tg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Cr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,eg)}},tg.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return ig(t,i),ng(n,r)&&(s.unclaim(n[Zf]),o.updateId(t,i[Zf]),s.claim(i[Zf],r)),e.changed};var rg=["default"];function og(e,t){this._canvas=e,this._modeling=t}function sg(e,t){this._modeling=e,this._spaceTool=t}function ag(e,t){this._modeling=e,this._translate=t}function lg(e,t){this._modeling=e,this._spaceTool=t}og.$inject=["canvas","modeling"],og.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=Ar(r);return t.setRootElement(n),t.removeRootElement(r),kt(s.rootElements,i),i.$parent=s,Pt(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},og.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=Ar(n);return t.setRootElement(r),t.removeRootElement(n),Pt(s.rootElements,i),i.$parent=null,kt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},sg.$inject=["modeling","spaceTool"],sg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Pu(i),s=o===i,a=s?i:i.parent,l=Ou(a),c=Qr(i);if(c?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!l.length){var p=c?{x:i.x+_u,y:i.y,width:i.width-_u,height:i.height}:{x:i.x,y:i.y+_u,width:i.width,height:i.height-_u};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,m,f,g=[];yt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===i?[]:y(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,h=(d=i.y)+10,m="n",f="y"):"left"===r?(u=-120,h=(d=i.x)+10,m="w",f="x"):"bottom"===r?(u=120,h=(d=i.y+i.height)-10,m="s",f="y"):"right"===r&&(u=120,h=(d=i.x+i.width)-10,m="e",f="x");var v=t.calculateAdjustments(g,f,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,m,h);var w=c?{x:i.x+(s?_u:0),y:d-("top"===r?120:0),width:i.width-(s?_u:0),height:120}:{x:d-("left"===r?120:0),y:i.y+(s?_u:0),width:120,height:i.height-(s?_u:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},ag.$inject=["modeling","translate"],ag.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Ou(i),s=o.length;if(s>r)throw new Error(n("more than {count} child lanes",{count:r}));var a,l,c,p,u=Qr(i),d=u?i.height:i.width,h=Math.round(d/r);for(p=0;p<r;p++)a=p===r-1?d-h*p:h,l=u?{x:i.x+_u,y:i.y+p*h,width:i.width-_u,height:a}:{x:i.x+p*h,y:i.y+_u,width:a,height:i.height-_u},p<s?t.resizeShape(o[p],l):(c={type:"bpmn:Lane",isHorizontal:u},t.createShape(c,l,i))},lg.$inject=["modeling","spaceTool"],lg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},lg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ku(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},lg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=vn(e),c=fu(vn(t),l),p=Pu(e),u=[],d=[];yt(p,(function(e){return u.push(e),(kr(e,"bpmn:Lane")||kr(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,i=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),r=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},r)),(c.left||c.right)&&(n=c.right||c.left,i=e.x+(c.right?e.width:0)+(c.right?-10:100),r=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},r))};var cg="flowNodeRef",pg="lanes";function ug(e){this._elementRegistry=e}function dg(e){this._moddle=e}ug.$inject=["elementRegistry"],ug.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},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=Pu(e);return r[t.id]||(r[t.id]=Eu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=vn(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Pu(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return kr(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(pg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(cg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},ug.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(pg);e.remove.forEach((function(e){Pt(n,e),Pt(e.get(cg),t)})),e.add.forEach((function(e){kt(n,e),kt(e.get(cg),t)}))})),[]},ug.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(pg);e.add.forEach((function(e){Pt(n,e),Pt(e.get(cg),t)})),e.remove.forEach((function(e){kt(n,e),kt(e.get(cg),t)}))})),[]},dg.$inject=["moddle"],dg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.claim(n,i):t.unclaim(n),[]},dg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.unclaim(n):t.claim(n,i),[]};var hg={fill:void 0,stroke:void 0};function mg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(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)}}}mg.$inject=["commandStack"],mg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||hg,i=this,r={};"fill"in n&&I(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&I(r,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=mn(e)?L(r,["border-color"]):r,n=Ar(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),fn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!Sr(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var fg={width:0,height:0};function gg(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return oo(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!fn(n)&&Jr(n)&&!eo(n)&&!yg(r)){var o=no(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i,di:n.di})}},this.execute=function(e){return e.oldLabel=ro(e.element),i(e.element,e.newLabel)},this.revert=function(e){return i(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(r)||kr(r,"bpmn:TextAnnotation"))if(fn(r)&&yg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=ro(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,fg)}}}function yg(e){return!e||!e.trim()}function vg(e,t,n,i){Gf.call(this,e,t,n),this._bpmnRules=i}function bg(){}gg.$inject=["modeling","textRenderer","bpmnFactory"],e(vg,Gf),vg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],vg.prototype.getHandlers=function(){var e=Gf.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Xf,e["element.updateProperties"]=tg,e["canvas.updateRoot"]=og,e["lane.add"]=sg,e["lane.resize"]=lg,e["lane.split"]=ag,e["lane.updateRefs"]=ug,e["id.updateClaim"]=dg,e["element.setColor"]=mg,e["element.updateLabel"]=gg,e},vg.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},vg.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},vg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},vg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},vg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},vg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},vg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},vg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},vg.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},vg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},vg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},vg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},vg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},bg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var wg=20,xg=5,_g=Math.round,Eg=20,Og={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Pg(e,t,n){var i,r,o,s=_n(t,e,xg),a=n.split(":")[0],l=_g((t.x-e.x)/2+e.x),c=_g((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),d=!1,h=!1;return p?(i=u?{x:l,y:e.y}:{x:e.x,y:c},r=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),r=u?"h:v":"v:h",d?u?(h=c===e.y,i={x:e.x+wg*(/l/.test(a)?-1:1),y:h?c+wg:c}):i={x:(h=l===e.x)?l+wg:l,y:e.y+wg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:Sg(e,i,r).concat(i),directions:r,turnNextDirections:h}}function kg(e){return e.split(":").reverse().join(":")}function Sg(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(Rg(n)){var i=function(e,t,n){return Pg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Pg(t,e,kg(n));return{waypoints:i.waypoints.slice().reverse(),directions:kg(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Sg(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=_g((t.x-e.x)/2+e.x),r=_g((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Cg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=_n(e,t,Og[o]||0),a=function(e,t){if(Rg(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||xn(e),i=i||xn(t);var l=a.split(":"),c=Dg(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 i=Sg(e,t,n);return i.unshift(e),i.push(t),Ng(i)}(c,Dg(i,t,l[1],s),a)}function Ag(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=xn(e),i=xn(t)),r=r||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=_n(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===r.preserveDocking?Tg(o,i,e)?(a[o]=i[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:i.x,y:i.y}]):null:Tg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y,original:{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y}}]):null}(e,t,n,i,o),s||(s=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=Mg(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&Mg(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Cg(e,t,n,i,o))))}function Tg(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 Mg(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!f(e,(function(t,n){var i=e[n-1];return i&&Ct(t,i)<3}))}(i))return null;var r,o=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(Mt(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),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(Dt(e[i],t,Eg)||Dt(e[i],n,Eg))return e.slice(i);return e}(s,e,t),r!==s&&(s=Mg(e,t,n,r)),s&&Mt(s)?null:s}function Rg(e){return e&&/t|r|b|l/.test(e)}function Dg(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Ng(e){return e.reduce((function(t,n,i){return At(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Bg=-10,jg=40,Ig={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$g={top:"t",right:"r",bottom:"b",left:"l"};function Lg(){}function qg(e,t){return kr(t,"bpmn:Participant")?"source":kr(e,"bpmn:Participant")?"target":Hg(t)?"source":Hg(e)||kr(t,"bpmn:Event")?"target":kr(e,"bpmn:Event")?"source":null}function zg(e){return Hg(e)?"target":"source"}function Vg(e,t){return e?e.original||e:xn(t)}function Fg(e,t){return kr(t,"bpmn:Activity")&&kr(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Hg(e){return kr(e,"bpmn:SubProcess")&&Wr(e)}function Ug(e,t){return e===t}function Wg(e){var t=/right|left/.exec(e);return t&&t[0]}function Qg(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Gg(e){return"right"===e||"left"===e}function Xg(e,t){var n=t.waypoints,i=n&&n.length&&_n(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function Kg(e,t,n){var i,r,o,s,a=xn(e),l=xn(t),c=(s=(o=e).host,_n(xn(o),s,Bg)),p=Ug(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),d=_n(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,i,r){var o,s=t?e:Qg(e),a=$g[s];o=t?Gg(e)?Yg("y",n,i,r)?"h":"b":Yg("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(i=function(e,t,n){if(n)return $g[e];if(Ug(Qg(e),Qg(t))||function(e,t){return Ig[e]===t}(Wg(e),Wg(t)))return $g[Qg(e)];return $g[Wg(e)]}(c,d,u),r=function(e,t,n){if(n)return Gg(e)?function(e,t){var n=Wg(e),i=Ig[n];return-1!==t.indexOf(i)}(e,t)||Ug(e,t)?"h":"v":function(e,t){var n=Qg(e),i=Ig[n];return-1!==t.indexOf(i)}(e,t)||Ug(e,t)?"v":"h";return Gg(t)||Ug(Qg(e),Qg(t))&&Wg(t)?"h":"v"}(c,d,u),[i+":"+r])}function Yg(e,t,n,i){var r=jg;return!(Zg(e,i,n,r)||Zg(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Zg(e,i,xn(t),r))}function Zg(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Jg(e){return I({original:e.point.original||e.point},e.actual)}function ey(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Lg,bg),Lg.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd;return a||(a=Vg(s&&s[0],r)),l||(l=Vg(s&&s[s.length-1],o)),(kr(e,"bpmn:Association")||kr(e,"bpmn:DataAssociation"))&&s&&!Fg(r,o)?[].concat([a],s.slice(1,-1),[l]):(kr(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:qg(e,t)}}(r,o):(kr(e,"bpmn:SequenceFlow")||Fg(r,o))&&(n=r===o?{preferredLayouts:Xg(r,e)}:kr(r,"bpmn:BoundaryEvent")?{preferredLayouts:Kg(r,o,l)}:Hg(r)||Hg(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:zg(e)}}(r):kr(r,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:kr(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=Ng(Ag(r,o,a,l,s,n=I(n,t)))),i||[a,l])},ey.$inject=["elementRegistry","graphicsFactory"],ey.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Jg(i)),o.push(Jg(r)),o},ey.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},ey.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},ey.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ey.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ey.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var ty={__init__:["modeling","bpmnUpdater"],__depends__:[ah,zh,Fh,Wh,Pm,Xm,Jm,rf,os,ms,Qm],bpmnFactory:["type",of],bpmnUpdater:["type",sf],elementFactory:["type",lf],modeling:["type",vg],layouter:["type",Lg],connectionDocking:["type",ey]};const ny=Math.round;function iy(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}iy.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(I({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;I(p,{x:u.x-ny(p.width/2),y:u.y-ny(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=r.getCroppedWaypoints(h,e,p)),i.create({created:[p,h].filter((e=>!l(e)))})},iy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},iy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var ry={__depends__:[dc,qp,ty],__init__:["appendPreview"],appendPreview:["type",iy]},oy=Math.min,sy=Math.max;function ay(e){e.preventDefault()}function ly(e){e.stopPropagation()}function cy(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ye("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=j(this.autoResize,this),this.handlePaste=j(this.handlePaste,this)}function py(e,t){this._eventBus=e,this._providers=[],this._textbox=new cy({container:t.getContainer(),keyHandler:j(this._handleKey,this),resizeHandler:j(this._handleResize,this)})}cy.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=L(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=L(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&I(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ly),ce.bind(o,"paste",this.handlePaste),i.autoResize&&ce.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},cy.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},cy.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)},cy.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,s=r.endContainer,a=r.startOffset,l=r.endOffset,c=r.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,i=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,i=d.textContent.length}else{var h=p.indexOf(o),m=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=m&&be(t)})),n=o,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},cy.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},cy.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=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=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){ay(n),ly(n);var u=oy(sy(c+n.clientX-a,i),o),d=oy(sy(p+n.clientY-l,r),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){ay(e),ly(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){ay(e),ly(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}I(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)},cy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ly),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},cy.prototype.getValue=function(){return this.content.innerText.trim()},cy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},cy.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},py.$inject=["eventBus","canvas"],py.prototype.registerProvider=function(e){this._providers.push(e)},py.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},py.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},py.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},py.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},py.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},py.prototype.getValue=function(){return this._textbox.getValue()},py.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())},py.prototype._handleResize=function(e){this._fire("resize",e)},py.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=f(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 uy={__depends__:[Ko],__init__:["directEditing"],directEditing:["type",py]};function dy(e){return function(t){var n=t.target,i=Cr(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,s=(r&&r.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!i.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Wr(e);return!(o&&s&&a&&l)}}var hy=[{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"}}],my=[{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"}}],fy=[{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"}}],gy=[{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"}}],yy=[{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"}}],vy=[{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}}],by=[{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}}],wy=by,xy=[{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}}],_y=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Ey=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Oy=[{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}}],Py=[{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}}],ky=[{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"}],Sy=[{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}}],Cy={"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 Ay(e,t,n,i,r,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Ay.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ay.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ay.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,i=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var r=dy(e);return kr(t,"bpmn:DataObjectReference")?this._createEntries(e,_y):kr(t,"bpmn:DataStoreReference")&&!kr(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ey):kr(t,"bpmn:StartEvent")&&!kr(t.$parent,"bpmn:SubProcess")?(i=y(hy,r),this._createEntries(e,i)):kr(t,"bpmn:Participant")?(i=y(Sy,(function(t){return Wr(e)!==t.target.isExpanded})),this._createEntries(e,i)):kr(t,"bpmn:StartEvent")&&Xr(t.$parent)?(i=y(Py,(function(e){var n=!1!==e.target.isInterrupting,i=t.isInterrupting===n;return r(e)||!r(e)&&!i})),this._createEntries(e,i)):kr(t,"bpmn:StartEvent")&&!Xr(t.$parent)&&kr(t.$parent,"bpmn:SubProcess")?(i=y(my,r),this._createEntries(e,i)):kr(t,"bpmn:EndEvent")?(i=y(gy,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!kr(t.$parent,"bpmn:Transaction"))&&r(e)})),this._createEntries(e,i)):kr(t,"bpmn:BoundaryEvent")?(i=y(Oy,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!kr(t.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==n.cancelActivity,o=t.cancelActivity==i;return r(e)||!r(e)&&!o})),this._createEntries(e,i)):kr(t,"bpmn:IntermediateCatchEvent")||kr(t,"bpmn:IntermediateThrowEvent")?(i=y(fy,r),this._createEntries(e,i)):kr(t,"bpmn:Gateway")?(i=y(yy,r),this._createEntries(e,i)):kr(t,"bpmn:Transaction")?(i=y(by,r),this._createEntries(e,i)):Xr(t)&&Wr(e)?(i=y(wy,r),this._createEntries(e,i)):kr(t,"bpmn:SubProcess")&&Wr(e)?(i=y(vy,r),this._createEntries(e,i)):kr(t,"bpmn:AdHocSubProcess")&&!Wr(e)?(i=y(xy,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return dy(t)&&(!n||i)})),this._createEntries(e,i)):kr(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ky):kr(t,"bpmn:FlowNode")?(i=y(xy,r),kr(t,"bpmn:SubProcess")&&!Wr(e)&&(i=y(i,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,i)):{}},Ay.prototype.getPopupMenuHeaderEntries=function(e){var t={};return kr(e,"bpmn:Activity")&&!Xr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),kr(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),kr(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!kr(e,"bpmn:SubProcess")||kr(e,"bpmn:Transaction")||Xr(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),vd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ay.prototype._createEntries=function(e,t){var n={},i=this;return v(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},Ay.prototype._createSequenceFlowEntries=function(e,t){var n=Cr(e),i={},r=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(kr(n.sourceRef,"bpmn:ExclusiveGateway")||kr(n.sourceRef,"bpmn:InclusiveGateway")||kr(n.sourceRef,"bpmn:ComplexGateway")||kr(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&kr(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:kr(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(kr(n.sourceRef,"bpmn:ExclusiveGateway")||kr(n.sourceRef,"bpmn:InclusiveGateway")||kr(n.sourceRef,"bpmn:ComplexGateway")||kr(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},Ay.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},Ay.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const r=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(i.options.loopCharacteristics);r&&t._moddleCopy.copyElement(r,o),o.set("isSequential",i.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var r,o,s,a=Cr(e).loopCharacteristics;return a&&(r=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:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Ay.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},Ay.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Ay.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=kr(Cr(e),"bpmn:AdHocSubProcess"),i=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,r){return i(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}},Ay.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Cr(e),i=this,r=bd(e),o=kr(e,"bpmn:BoundaryEvent")?Cy["intermediate-event-non-interrupting"]:Cy["start-event-non-interrupting"],s=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){i._modeling.updateProperties(e,{[r]:!!s})}}}};var Ty={__depends__:[Fl,Pm,dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ay]};function My(e,t,n,i,r,o,s,a,l,c,p,u,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,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=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Uo(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Ry(e,t,n){var i=e.$instanceOf(t),r=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}My.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],My.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&I(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},My.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},My.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,d={};if("label"===e.type)return d;var h=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function s(t,n){var s=i.createShape(I({type:e},r));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=i.createShape(I({type:e},r));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,r),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Sr(h,["bpmn:Lane","bpmn:Participant"])&&Wr(e)){var y=Ou(e);I(d,{"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&&((Qr(e)?e.height>=120:e.width>=120)&&I(d,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two lanes"),action:{click:g(2)}}}),(Qr(e)?e.height>=180:e.width>=180)&&I(d,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),I(d,{"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")}}}})}kr(h,"bpmn:FlowNode")&&(kr(h,"bpmn:EventBasedGateway")?I(d,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ry(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(d,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):kr(h,"bpmn:EndEvent")||h.isForCompensation||Ry(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Xr(h)||I(d,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(d,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change element"),action:{click:function(e,n){var i=I(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",i,{title:p("Change element"),width:300,search:!0})}}}}),kr(h,"bpmn:SequenceFlow")&&I(d,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Add text annotation"))}),Sr(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(d,{"append.text-annotation":f("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:m,dragstart:m}}}),kr(h,"bpmn:TextAnnotation")&&I(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:m,dragstart:m}}}),Sr(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:m,dragstart:m}}}),kr(h,"bpmn:Group")&&I(d,{"append.text-annotation":f("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&&I(d,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Delete"),action:{click:function(e,t){n.removeElements([t])}}}}),d};var Dy={__depends__:[ry,uy,Da,os,Mp,rm,Ty],__init__:["contextPadProvider"],contextPadProvider:["type",My]},Ny={horizontal:["x","width"],vertical:["y","height"]};function By(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:[]}))}By.$inject=["modeling","rules"],By.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},By.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},By.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(v(t,(function(e){r=e(r,n,i)})),r):e},By.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return v(A(e,i),(function(e,o){var s,a=n._findRange(e,i,r),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},By.prototype._setOrientation=function(e){var t=Ny[e];this._axis=t[0],this._dimension=t[1]},By.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)},By.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var jy={__init__:["distributeElements"],distributeElements:["type",By]};function Iy(e){Gl.call(this,e)}Iy.$inject=["eventBus"],e(Iy,Gl),Iy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=mt(t=y(t,(function(e){var t=Sr(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 $y={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 Ly(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Ly.$inject=["popupMenu","distributeElements","translate","rules"],Ly.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ly.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ly.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:$y.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:$y.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var qy={__depends__:[Fl,jy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Iy],distributeElementsMenuProvider:["type",Ly]},zy="is not a registered action";function Vy(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function Fy(e,t){return new Error(e+" "+t)}Vy.$inject=["eventBus","injector"],Vy.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=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&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=a.allowed("elements.delete",{elements:e});!1!==r&&(t=c(r)?r: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)}))},Vy.prototype.trigger=function(e,t){if(!this._actions[e])throw Fy(e,zy);return this._actions[e](t)},Vy.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)}))},Vy.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Fy(e,"is already registered");this._actions[e]=t},Vy.prototype.unregister=function(e){if(!this.isRegistered(e))throw Fy(e,zy);this._actions[e]=void 0},Vy.prototype.getActions=function(){return Object.keys(this._actions)},Vy.prototype.isRegistered=function(e){return!!this._actions[e]};var Hy={__init__:["editorActions"],editorActions:["type",Vy]};function Uy(e){e.invoke(Vy,this)}e(Uy,Vy),Uy.$inject=["injector"],Uy.prototype._registerDefaultActions=function(e){Vy.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=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),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),i&&l&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&l.trigger(t,n)})),i&&c&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=y(t,(function(e){return!kr(e,"bpmn:Lane")})),c.trigger(n,r))})),i&&d&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&d.setColor(t,e)})),i&&p&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();e=bt(i=kr(r,"bpmn:Collaboration")?n.filter((function(e){return kr(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!kr(e.parent,"bpmn:SubProcess")}))),d.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var Wy={__depends__:[Hy],editorActions:["type",Uy]};function Qy(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Sr(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}Qy.$inject=["eventBus"];var Gy=10;function Xy(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Ky(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),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(!(!r.active||n&&Fs(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.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(!r)return a[t];n.get(r.id)||(Yy(t)?a[t]+=r[t]+r.width/2:a[t]+=r[t]+r.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=r.width/2:/right/.test(s)&&(a[t]+=r.width/2):/top/.test(s)?a[t]-=r.height/2:/bottom/.test(s)&&(a[t]+=r.height/2);return a[t]}(t,n,e);o&&(i.offset=o);var s=function(e,t){var n=e.context,i=n.createConstraints,r=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;i&&(Yy(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;l&&(Yy(t)?Jy(a)?s.x.max=l.left:s.x.min=l.right:Zy(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(Yy(t)?Jy(a)?s.x.min=c.left:s.x.max=c.right:Zy(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(i,s),bp(t,n)||r.snapEvent(t,n,i)}))}}))}function Yy(e){return"x"===e}function Zy(e){return-1!==e.indexOf("n")}function Jy(e){return-1!==e.indexOf("w")}function ev(e,t){fs.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;h(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}Ky.prototype.snapEvent=function(e,t,n){wp(e,t,this.snapValue(e[t],n))},Ky.prototype.getGridSpacing=function(){return Gy},Ky.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=Xy(e+=r,Gy),t&&t.min&&u(n=t.min)&&(n=Xy(n+r,Gy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=Xy(i+r,Gy,"floor"),e=Math.min(e,i)),e-=r},Ky.prototype.isActive=function(){return this.active},Ky.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ky.prototype.toggleActive=function(){this.setActive(!this.active)},Ky.$inject=["elementRegistry","eventBus","config.gridSnapping"],ev.$inject=["eventBus","gridSnapping","modeling"],e(ev,fs),ev.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},ev.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},ev.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),I(e,o),e},ev.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),I(e,o),e};function tv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.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))}))}tv.$inject=["eventBus","gridSnapping"];var nv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ev],gridSnappingSpaceToolBehavior:["type",tv]}],__init__:["gridSnapping"],gridSnapping:["type",Ky]};function iv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,i=xn(n),r=e.shape,o=cc(n,r);return["x","y"].forEach((function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],kr(r,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-r.height/2:n.offset=-r.width/2),o[e]=t.snapValue(o[e],n))})),o}))}iv.$inject=["eventBus","gridSnapping"];function rv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();kr(r,"bpmn:Participant")&&kr(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))}))}rv.$inject=["canvas","eventBus","gridSnapping"];function ov(e,t,n){fs.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,r=t.connection,o=t.hints||{},s=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(r,i.snapMiddleSegments(s))}))}function sv(e,t,n){var i=Mt(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=I({},t,r),n=I({},n,r)),[t,n]}ov.$inject=["eventBus","gridSnapping","modeling"],e(ov,fs),ov.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=sv(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var av={__depends__:[nv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",iv],gridSnappingParticipantBehavior:["type",rv],gridSnappingLayoutConnectionBehavior:["type",ov]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Qy]};function lv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return kr(t,"bpmn:Lane")?n._createParticipantHit(t,i):kr(t,"bpmn:Participant")?Wr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):kr(t,"bpmn:SubProcess")?Wr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}lv.$inject=["eventBus","interactionEvents"],lv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},lv.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=Qr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},lv.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 cv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",lv]};function pv(e){e.invoke(Zs,this)}e(pv,Zs),pv.$inject=["injector"],pv.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Zs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0})),n("spaceTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["r","R"],i)?(t.trigger("replaceElement",i),!0):void 0}))};var uv={__depends__:[Js],__init__:["keyboardBindings"],keyboardBindings:["type",pv]},dv={moveSpeed:1,moveSpeedAccelerated:10},hv="left",mv="right",fv="down",gv={ArrowLeft:hv,Left:hv,ArrowUp:"up",Up:"up",ArrowRight:mv,Right:mv,ArrowDown:fv,Down:fv},yv={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 vv(e,t,n,i,r){var o=this;this._config=I({},dv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=gv[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=yv[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}vv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var bv={__depends__:[Js,os],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vv]};function wv(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return bn({top:gu("top",n,t),right:gu("right",n,t),bottom:gu("bottom",n,t),left:gu("left",n,t)})}(n,s),e.canExecute=r.canResize(e)}e.on("resize.start",(function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:vn(i)})})),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,i=e.canExecute,r=e.newBounds;if(i){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,r=gn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function xv(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function _v(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"}wv.prototype.canResize=function(e){var t=this._rules,n=L(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},wv.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=I({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,xv(t,r),"resize",{autoActivate:!0,cursor:_v(r),data:{shape:t,context:i}})},wv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=vn(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},s=i?vn(i):o;return bn({top:hu(o.top,s.top),left:hu(o.left,s.left),bottom:du(o.bottom,s.bottom),right:du(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},bu(t,e.childrenBoxPadding))},wv.$inject=["eventBus","rules","modeling","dragging"];var Ev="djs-resizing",Ov="resize-not-ok";function Pv(e,t,n){e.on("resize.move",500,(function(e){var i,r,o,s;i=e.context,r=i.shape,o=i.newBounds,(s=i.frame)||(s=i.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,Ev)),o.width>5&&Pe(s,{x:o.x,width:o.width}),o.height>5&&Pe(s,{y:o.y,height:o.height}),i.canExecute?Se(s).remove(Ov):Se(s).add(Ov)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&Ae(n.frame),t.removeMarker(i,Ev)}))}Pv.$inject=["eventBus","canvas","previewSupport"];var kv=-6,Sv="djs-resizer",Cv=["n","w","s","e","nw","ne","se","sw"];function Av(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&v(t,j(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}Av.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){Ho(t)&&i.activate(t,e,n)}ce.bind(t,"mousedown",r),ce.bind(t,"touchstart",r)},Av.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=kv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=kv);return t}(i),s=Be("g");Se(s).add(Sv),Se(s).add(Sv+"-"+e.id),Se(s).add(Sv+"-"+i),xe(r,s);var a=Be("rect");Pe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Sv+"-visual"),xe(s,a);var l=Be("rect");return Pe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Sv+"-hit"),xe(s,l),Yn(s,t,n),s},Av.prototype.createResizer=function(e,t){var n=xv(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Av.prototype.addResizer=function(e){var t=this;!mn(e)&&this._resize.canResize({shape:e})&&v(Cv,(function(n){t.createResizer(e,n)}))},Av.prototype.removeResizers=function(){Te(this._getResizersParent())},Av.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Av.$inject=["eventBus","canvas","selection","resize"];var Tv={__depends__:[Ac,Oc,Ip],__init__:["resize","resizePreview","resizeHandles"],resize:["type",wv],resizePreview:["type",Pv],resizeHandles:["type",Av]};function Mv(e,t,n,i,r,o,s){function a(e,t){(t||Sr(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Rv(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=s,i.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(){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Rv(e){return kr(e,"bpmn:SubProcess")&&!Wr(e)}Mv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Mv.prototype.activate=function(e){var t=ro(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var i={};return(Sr(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Rv(e))&&I(i,{centerVertically:!0}),Jr(e)&&I(i,{autoResize:!0}),kr(e,"bpmn:TextAnnotation")&&I(i,{resizable:!0,autoResize:!0}),I(n,{options:i}),n}},Mv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,s={x:i.x,y:i.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(kr(e,"bpmn:Lane")||function(e){return kr(e,"bpmn:Participant")&&Wr(e)}(e)){var f=Qr(e);I(s,f?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o-30*a/2}:{width:i.width,height:30*a}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:f?"rotate(-90deg)":null})}if(function(e){return kr(e,"bpmn:Participant")&&!Wr(e)}(e)){var g=Qr(e);I(s,g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r-i.height/2,y:o-i.width/2}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Sr(e,["bpmn:Task","bpmn:CallActivity"])||Rv(e))&&(I(s,{width:i.width,height:i.height}),I(m,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return kr(e,"bpmn:SubProcess")&&Wr(e)}(e)&&(I(s,{width:i.width,x:i.x}),I(m,{fontSize:d+"px",lineHeight:h,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&&(I(s,{width:y,height:i.height+v+b,x:r-y/2,y:i.y-v}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Jr(n)&&!eo(n)&&!fn(n)){var w=no(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;I(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return kr(e,"bpmn:TextAnnotation")&&(I(s,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),I(m,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:m}},Mv.prototype.update=function(e,t,n,i){var r,o,s;kr(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Dv="djs-element-hidden",Nv="djs-label-hidden";function Bv(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(kr(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=Be("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),p=s.path=Be("path");Pe(p,{d:c,strokeWidth:2,stroke:jv(i)}),xe(o,p),xe(a,o),Zn(o,i.x,i.y)}kr(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,Dv):(kr(i,"bpmn:Task")||kr(i,"bpmn:CallActivity")||kr(i,"bpmn:SubProcess")||kr(i,"bpmn:Participant"))&&t.addMarker(i,Nv)})),e.on("directEditing.resize",(function(e){if(kr(i,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(i.height/r.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.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,Dv),t.removeMarker(i,Nv)),i=void 0,r=void 0,o&&(Ae(o),o=void 0)}))}function jv(e,t){return Ar(e).get("stroke")||t||"black"}Bv.$inject=["eventBus","canvas","pathMap"];var Iv={__depends__:[ms,Tv,uy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Mv],labelEditingPreview:["type",Bv]},$v=new ss("tt");function Lv(e,t){e.style.display=!1===t?"none":""}var qv="djs-tooltip",zv="."+qv;function Vv(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=$v,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),G(i=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;de.bind(this._tooltipRoot,zv,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,zv,"mouseover",(function(e){r.trigger("mouseover",e)})),de.bind(this._tooltipRoot,zv,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}Vv.$inject=["eventBus","canvas"],Vv.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=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Vv.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(X(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Vv.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Vv.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Vv.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Vv.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Vv.prototype.show=function(){Lv(this._tooltipRoot)},Vv.prototype.hide=function(){Lv(this._tooltipRoot,!1)},Vv.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Vv.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),h(i)&&(i=ge(i)),G(t=ge('<div data-tooltip-id="'+n+'" class="'+qv+'">'),{position:"absolute"}),t.appendChild(i),e.type&&Y(t).add("djs-tooltip-"+e.type),e.className&&Y(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Vv.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){G(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Vv.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Lv(i,r))}))},Vv.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 Fv={__init__:["tooltips"],tooltips:["type",Vv]};function Hv(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var i,r,o,s=e.context,a=s.shape;kr(s.target,"bpmn:Collaboration")&&kr(a,"bpmn:FlowNode")&&(i=e,r=n("flow elements must be children of pools/participants"),t.add({position:{x:i.x+5,y:i.y+5},type:"error",timeout:o||2e3,html:"<div>"+r+"</div>"}))}))}Hv.$inject=["eventBus","tooltips","translate"];var Uv={__depends__:[Fv],__init__:["modelingFeedback"],modelingFeedback:["type",Hv]},Wv=Math.round;function Qv(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,r){if(p(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+Wv(e.width/2),y:e.y+Wv(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=k(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),I(t,{shapes:r,validatedShapes:r,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,i=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=o(i,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,s=t.shapes;if(!1===r)return!1;i.x=Wv(i.x),i.y=Wv(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(Ho(e)){var t=Lo(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}Qv.$inject=["eventBus","dragging","modeling","selection","rules"];var Gv="djs-dragging",Xv="drop-ok",Kv="drop-not-ok",Yv="new-parent",Zv="attach-ok";function Jv(e,t,n,r){function o(e){var t=function(e){var t=y(e,(function(t){return!mn(t)||f(e,T({id:t.source.id}))&&f(e,T({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=vt(e,!0),n=E(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return i(t.concat(n))}function a(e,n){[Zv,Xv,Kv,Yv].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}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 d=Be("g");Pe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){r.addDragger(e,l.dragGroup)})),v(p=p?i([p,s(c)]):s(c),(function(e){t.addMarker(e,Gv)})),l.allDraggedElements=p,l.differentParents=1!==(a=k(c,(function(e){return e.parent&&e.parent.id})),O(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,Zv):t.canExecute&&i&&i.id!==r.id?a(i,Yv):a(i,t.canExecute?Xv:Kv)),Zn(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,i=n.allDraggedElements,r=n.dragGroup;v(i,(function(e){t.removeMarker(e,Gv)})),r&&Ae(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Gv),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}Jv.$inject=["eventBus","canvas","styles","previewSupport"];var eb={__depends__:[Ko,os,Zo,Ac,Oc,Ip],__init__:["move","movePreview"],move:["type",Qv],movePreview:["type",Jv]};const tb={width:36,height:50},nb={width:50,height:50};function ib(e,t,n){return Be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function rb(e,t){this._styles=t,e.registerProvider(this)}function ob(e,t){var n;return"bpmn:DataObjectReference"===t?n=tb:"bpmn:DataStoreReference"===t&&(n=nb),e.width===n.width&&e.height===n.height}rb.$inject=["outline","styles"],rb.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return kr(e,"bpmn:Gateway")?(I((n=Be("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Pe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Sr(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Pe(n=Be("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):kr(e,"bpmn:EndEvent")?Pe(n=Be("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):kr(e,"bpmn:Event")?Pe(n=Be("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):kr(e,"bpmn:DataObjectReference")&&ob(e,"bpmn:DataObjectReference")?n=ib("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):kr(e,"bpmn:DataStoreReference")&&ob(e,"bpmn:DataStoreReference")&&(n=ib("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},rb.prototype.updateOutline=function(e,t){if(!fn(e))return Sr(e,["bpmn:SubProcess","bpmn:Group"])?(Pe(t,{width:e.width+10,height:e.height+10}),!0):!!Sr(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var sb={__depends__:[Zo],__init__:["outlineProvider"],outlineProvider:["type",rb]},ab=".djs-palette-toggle",lb=".entry",cb=ab+", "+lb,pb="djs-palette-",ub="open",db="two-column";function hb(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 mb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}hb.$inject=["eventBus","canvas"],hb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},hb.prototype.getEntries=function(){return this._getProviders().reduce(mb,{})},hb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},hb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ge(hb.HTML_MARKUP);n.appendChild(i),Y(n).add(pb+"shown"),de.bind(i,cb,"click",(function(t){if(ee(t.delegateTarget,ab))return e.toggle();e.trigger("click",t)})),ce.bind(i,"mousedown",(function(e){e.stopPropagation()})),de.bind(i,lb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=Y(i),s=Y(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(db,t),s.toggle(pb+db,t),"open"in e&&(o.toggle(ub,e.open),s.toggle(pb+ub,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},hb.prototype._update=function(){var e=ye(".djs-palette-entries",this._container),t=this._entries=this.getEntries();J(e),v(t,(function(t,n){var i=t.group||"default",r=ye("[data-group="+bs(i)+"]",e);r||(X(r=ge('<div class="group"></div>'),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(r.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=Y(e);(c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},hb.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=X(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},hb.prototype.triggerEntry=function(e,t,n,i){var r,o;if((r=this._entries[e])&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(d(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},hb.prototype._layoutChanged=function(){this._toggleState({})},hb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},hb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hb.prototype.open=function(){this._toggleState({open:!0})},hb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ye(".djs-palette-entries",this._container),this._toolsContainer=ye("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=Y(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},hb.prototype.isOpen=function(){return Y(this._container).has(ub)},hb.prototype._getParentContainer=function(){return this._canvas.getContainer()},hb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var fb={__init__:["palette"],palette:["type",hb]},gb="crosshair";function yb(e,t,n,i,r,o,s){this._selection=r,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();Pe(n=e.frame=Be("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(i,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&&Ae(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=vb(e),r=i.filter((function(e){return e})),o=Wo(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=vb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=vb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Wo(e))return a.activateLasso(e.originalEvent),!0}))}function vb(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}}yb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],yb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:gb,data:{context:{}}})},yb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:gb,data:{context:{}},keepSelection:!0})},yb.prototype.select=function(e,t,n=[]){var i=function(e,t){var n={};return v(e,(function(e){var i=e;i.waypoints&&(i=bt(i)),!u(t.y)&&i.x>t.x&&(n[e.id]=e),!u(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(u(t.width)&&u(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.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,...P(i)])},yb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var bb={__depends__:[Sm,sm],__init__:["lassoTool"],lassoTool:["type",yb]},wb=1500,xb="grab";function _b(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var s=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",wb,(function(e){if(Uo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(wb,(function(e){if(Eb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(wb,(function(e){Eb(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!Uo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Eb(e){return Hs("Space",e)}_b.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],_b.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:xb,data:{context:n||{}}})},_b.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:xb,data:{context:{reactivate:n}}})},_b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},_b.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Ob={__depends__:[Sm,sm],__init__:["handTool"],handTool:["type",_b]},Pb="connect-ok",kb="connect-not-ok";function Sb(e,t,n,i,r,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,r=t.canStartConnect=a.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Pb:kb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Pb:kb)})),e.on(["global-connect.ended"],(function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(a.canStartConnect(i))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,i,r)})),!1}))}Sb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Sb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Sb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Sb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Sb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Cb={__depends__:[Mp,Ac,Oc,Sm,sm],globalConnect:["type",Sb]};function Ab(e,t,n,i,r,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Ab.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Ab.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,i,r,o,s){function a(i){var r=n.createShape(I({type:e},s));t.start(i,r)}return{group:i,className:r,title:o,action:{dragstart:a,click:a}}}function c(e){var i=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:i});t.start(e,[i,r],{hints:{autoSelect:[i]}})}function p(e){t.start(e,n.createParticipantShape())}return I(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){r.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){i.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 Tb={__depends__:[fb,rm,Qm,bb,Ob,Cb,Ro],__init__:["paletteProvider"],paletteProvider:["type",Ab]};function Mb(e,t,n,i,r){fs.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);I(a,{x:l.x,y:l.y});var c=n.createShape(a);i.addShape(c,l.parent);var p=ye('[data-element-id="'+bs(l.id)+'"]',e.dragGroup);p&&Pe(p,{display:"none"});var u=r.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,i.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,i){var r=ye('[data-element-id="'+bs(i)+'"]',e.dragGroup);r&&Pe(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}Mb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Mb,fs);var Rb={__depends__:[Ip],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Mb]},Db=40,Nb=20,Bb=10,jb=20,Ib=["x","y"],$b=Math.abs;function Lb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,i=t.start,r=t.hover,o=t.source,s=t.target;e.originalEvent&&Fs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Ib.forEach((function(i){var r=Vb(i,t);e[i]<t[i]+n?wp(e,i,t[i]+n):e[i]>t[i]+r-n&&wp(e,i,t[i]+r-n)}))}(e,r,function(e){return kr(e,"bpmn:Task")?Bb:Nb}(r)),r&&function(e,t){return _(t,(function(t){return zb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=vp(i),Sr(r,["bpmn:Event","bpmn:Gateway"])&&qb(e,vp(r)),Sr(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=vp(t);Ib.forEach((function(i){(function(e,t,n){return e[n]>t[n]+jb&&e[n]<t[n]+Vb(n,t)-jb})(e,t,i)&&wp(e,i,n[i])}))}(e,r),kr(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,i=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var r=vp(n),o=_n(r,i,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,i=e[t];$b(i-r[t])<Db&&(n=i>r[t]?r[t]+Db:r[t]-Db,wp(e,t,n))}))}(e)):zb(n,"bpmn:MessageFlow")?(kr(i,"bpmn:Event")&&(t.connectionStart=vp(i)),kr(r,"bpmn:Event")&&qb(e,vp(r))):t.connectionStart=t.initialConnectionStart)}))}function qb(e,t){wp(e,"x",t.x),wp(e,"y",t.y)}function zb(e,t){return e&&e.type===t}function Vb(e,t){return"x"===e?t.width:t.height}function Fb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Hb(){this._snapValues={}}Lb.$inject=["eventBus"],Fb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Fb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Fb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Fb.prototype.getSnapLocations=function(){return this._snapLocations},Fb.prototype.setSnapLocations=function(e){this._snapLocations=e},Fb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Hb).initDefaults(this._defaultSnaps),n},Hb.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)},Hb.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],mp(r-e)<=n)return r}(e[n],r[n],i)},Hb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var Ub=1250;function Wb(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Ub,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Fs(e.originalEvent))&&!bp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=i.addSnapTargetPoints(a,r,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}Wb.$inject=["elementRegistry","eventBus","snapping"],Wb.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Fb);var s=(t=n.get(r.id)?vp(r,e):{x:e.x+vp(r).x,y:e.y+vp(r).y}).x-r.width/2,a=t.y-r.height/2,l=t.x+r.width/2,c=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(r)||(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},Wb.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",vp(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",vp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",vp(t)),e):e},Wb.prototype.getSnapTargets=function(e,t){return xp(t).filter((function(e){return!e.hidden}))};function Qb(e,t){t.invoke(Wb,this),e.on(["create.move","create.end"],1500,Gb),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,i=t.target;n&&("attach"===n||n.attach)&&!bp(e)&&function(e,t){var n,i=vn(t),r=lh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(r)?wp(e,"y",i.top-n.y):/bottom/.test(r)&&wp(e,"y",i.bottom-n.y);/left/.test(r)?wp(e,"x",i.left-n.x):/right/.test(r)&&wp(e,"x",i.right-n.x)}(e,i)}))}function Gb(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&wp(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&wp(e,"y",e.y)}}function Xb(e,t){return-1!==e.indexOf(t)}function Kb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(Qb,Wb),Qb.$inject=["eventBus","injector"],Qb.prototype.initSnap=function(e){var t=Wb.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",Kb(r,i,e))})),v(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",Kb(r,i,e))})),kr(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Qb.prototype.addSnapTargetPoints=function(e,t,n){Wb.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);v(i,(function(n){var i;(function(e){if(kr(e,"bpmn:SubProcess")&&Wr(e))return!0;return kr(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return kr(e,i)}))))&&(e.add("top-left",gp(n)),e.add("bottom-right",yp(n)))}));var r=this._elementRegistry;return v(t.incoming,(function(n){if(r.get(t.id)){Xb(i,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(r.get(t.id)){Xb(i,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),kr(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Qb.prototype.getSnapTargets=function(e,t){return Wb.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!kr(e,"bpmn:Lane")}))};function Yb(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&Fs(e.originalEvent)||bp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,r,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&wp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&wp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function Zb(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}Yb.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Fb);var o=Zb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Yb.prototype.addSnapTargetPoints=function(e,t,n,i){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",yp(t)),e.add("corner",gp(t))})),e.add("corner",Zb(t,i)),e},Yb.$inject=["eventBus","snapping"],Yb.prototype.getSnapTargets=function(e,t){return xp(t).filter((function(t){return!(n=t,i=e,n.host===i||mn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,i}))};function Jb(e){this._canvas=e,this._asyncHide=B(j(this.hide,this),1e3)}Jb.$inject=["canvas"],Jb.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:bp(e,"x"),y:bp(e,"y")};v(i,(function(i){var o=n.getSnapOrigin(i),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(s,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),v(["x","y"],(function(t){var n=r[t];p(n)&&wp(e,t,n.originValue)}))},Jb.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return Pe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(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"})}}},Jb.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Jb.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Jb.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Jb.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var ew={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Wb],resizeSnapping:["type",Yb],snapping:["type",Jb]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Lb],createMoveSnapping:["type",Qb]};function tw(e,t,n,i,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ye(tw.INPUT_SELECTOR,this._container),this._resultsContainer=ye(tw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function nw(e,t,n){var i=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+tw.RESULT_HIGHLIGHT_CLASS+'">'+xs(e.matched)+"</strong>":t+=xs(e.normal)})),""!==t?t:null}(t),r=ge(n);r.innerHTML=i,e.appendChild(r)}tw.$inject=["canvas","eventBus","overlays","selection","translate"],tw.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:de.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close()})),t(this._container,tw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,tw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,tw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,tw.INPUT_SELECTOR,"keydown",(function(e){Hs("ArrowUp",e)&&e.preventDefault(),Hs("ArrowDown",e)&&e.preventDefault()})),t(this._container,tw.INPUT_SELECTOR,"keyup",(function(t){if(Hs("Escape",t))return e.close();if(Hs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Hs("ArrowUp",t)?e._scrollToDirection(!0):Hs("ArrowDown",t)?e._scrollToDirection():void(Hs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},tw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},tw.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,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=ye(tw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},tw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},tw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},tw.prototype._clearResults=function(){J(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},tw.prototype._getCurrentResult=function(){return ye(tw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},tw.prototype._createResultNode=function(e,t){var n=ge(tw.RESULT_HTML);return e.primaryTokens.length>0&&nw(n,e.primaryTokens,tw.RESULT_PRIMARY_HTML),nw(n,e.secondaryTokens,tw.RESULT_SECONDARY_HTML),X(n,tw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},tw.prototype.registerProvider=function(e){this._searchProvider=e},tw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,Y(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},tw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,Y(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},tw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},tw.prototype.isOpen=function(){return this._open},tw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Y(t).remove(tw.RESULT_SELECTED_CLASS);var n=X(e,tw.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Y(e).add(tw.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._canvas.scrollToElement(i,{top:400}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},tw.prototype._select=function(e){var t=X(e,tw.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)},tw.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,i=e.height+2*t,r={width:n+"px",height:i+"px"},o=ge('<div class="'+tw.OVERLAY_CLASS+'"></div>');return G(o,r),{position:{bottom:i-t,right:n-t},show:!0,html:o}}(bt(e));this._overlayId=this._overlays.add(e,t)}},tw.prototype._getBoxHtml=function(){const e=ge(tw.BOX_HTML),t=ye(tw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},tw.CONTAINER_SELECTOR=".djs-search-container",tw.INPUT_SELECTOR=".djs-search-input input",tw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",tw.RESULT_SELECTOR=".djs-search-result",tw.RESULT_SELECTED_CLASS="djs-search-result-selected",tw.RESULT_SELECTED_SELECTOR="."+tw.RESULT_SELECTED_CLASS,tw.RESULT_ID_ATTRIBUTE="data-result-id",tw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",tw.OVERLAY_CLASS="djs-search-overlay",tw.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>',tw.RESULT_HTML='<div class="djs-search-result"></div>',tw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',tw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var iw={__depends__:[Ro,ds,os],searchPad:["type",tw]};function rw(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function ow(e){return y(e,(function(e){return!!e.matched})).length>0}function sw(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}rw.$inject=["elementRegistry","searchPad","canvas"],rw.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=A(n=y(n=E(n,(function(t){return{primaryTokens:sw(ro(t),e),secondaryTokens:sw(t.id,e),element:t}})),(function(e){return ow(e.primaryTokens)||ow(e.secondaryTokens)})),(function(e){return ro(e.element)+e.element.id}))};var aw={__depends__:[iw],__init__:["bpmnSearch"],bpmnSearch:["type",rw]};function lw(e){Ur.call(this,e)}function cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}e(lw,Ur),lw.Viewer=$s,lw.NavigatedViewer=va,lw.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>')},lw.prototype._interactionModules=[na,ua,ya],lw.prototype._modelingModules=[Kl,dc,Sc,yc,Pp,Mp,Dp,Dy,gm,rm,qy,Wy,av,cv,uv,bv,Iv,ty,Uv,eb,sb,Tb,Rb,Tv,ew,aw],lw.prototype._modules=[].concat($s.prototype._modules,lw.prototype._interactionModules,lw.prototype._modelingModules);var pw={exports:{}};
|
|
160
158
|
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
161
159
|
* http://hammerjs.github.io/
|
|
162
160
|
*
|