camunda-bpmn-js 5.6.1 → 5.6.2

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.
@@ -168,7 +168,7 @@
168
168
  searchFn=${this._search}
169
169
  ...${{...o}}
170
170
  />
171
- `,this._current.container)},ql.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()},ql.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()},ql.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)}},ql.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},ql.prototype.reset=function(){const e=this._current.container;nl(null,e),be(e)},ql.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},ql.prototype._onOpened=function(){this._emit("opened")},ql.prototype._onClosed=function(){this._emit("closed")},ql.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=fe(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},ql.prototype._bindAutoClose=function(){this._eventBus.once(jl,this.close,this)},ql.prototype._unbindAutoClose=function(){this._eventBus.off(jl,this.close,this)},ql.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},ql.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}},ql.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},ql.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},ql.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},ql.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},ql.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},ql.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},ql.prototype.isOpen=function(){return!!this._current},ql.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(ee(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)},ql.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 Ul={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:r}=n.reduce(((n,i)=>{const r=e[i],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(Hl),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[r]=a,o=a.index,s=a.index+r.length,c=0===o,p=s===e.length,u=!!a.groups.all,d=c||/\s/.test(e.charAt(o-1)),h=p||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:r,index:a.index,match:!0,wordStart:d,wordEnd:h,start:c,end:p,all:u});const m=u?t:[r];for(const e of m)i[e.toLowerCase()]=!0;l=a.index+r.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:i}}(r,t);return{tokens:{...n.tokens,[i]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return r}(e,r,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=zl(t.tokens[i],n.tokens[i]);if(0!==e)return e;const r=Vl(t.item[i],n.item[i]);if(0!==r)return r}return 0}}(i))}]},Wl={__depends__:[Ul],__init__:["popupMenu"],popupMenu:["type",ql]},Gl={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 Ql(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ql.$inject=["contextPad","popupMenu","translate","canvas"],Ql.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ql.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ql.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Gl.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)}}}}},Ql.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Xl=["left","center","right","top","middle","bottom"];function Kl(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Yl(e){Ho.call(this,e),this.init()}function Zl(e){Yl.call(this,e)}Kl.$inject=["popupMenu","alignElements","translate","rules"],Kl.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Kl.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return v(Xl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Gl[o],action:function(){t.trigger(e,o),i.close()}}})),r},Yl.$inject=["eventBus"],e(Yl,Ho),Yl.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)}))},Yl.prototype.init=function(){},Zl.$inject=["eventBus"],e(Zl,Yl),Zl.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=dt(t)).length<2)&&t}))};var Jl={__depends__:[ba,Ta,Wl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ql],alignElementsMenuProvider:["type",Kl],bpmnAlignElements:["type",Zl]},ec=10,tc=50,nc=250;function ic(e,t,n,i){for(var r;r=oc(e,n,t);)n=i(t,n,r);return n}function rc(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 oc(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=sc(e);e.host&&(t=t.concat(sc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(sc(t))}),[])));return t}(e);return f(r,(function(e){return e!==n&&"intersect"===xn(e,i,ec)}))}function sc(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 ac(){return!0}function lc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||tc,r=wn(e),o=yn(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 cc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}lc.$inject=["eventBus","modeling","canvas"],cc.$inject=["eventBus","selection"];var pc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lc],autoPlaceSelectionBehavior:["type",cc]};function uc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Or(e,t))return e;return null}function dc(e,t){var n=uc(e,"bpmn:Process");if(n)return!0;var i,r=["bpmn:Participant","bpmn:Lane"];if(n=uc(e,r))return Hr(n);if(Or(e,r))return Hr(e);for(i=Pr(e);i&&!_r(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find((function(e){var t=Pr(e);return t&&t.get("processRef")===i}));return!o||Hr(o)}function hc(e,t,n){var i=dc(e,n);return _r(t,"bpmn:TextAnnotation")?function(e,t,n){var i=yn(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};hn(e)&&(r=wn(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return ic(e,t,r,rc(s))}(e,t,i):Or(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var i=yn(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return ic(e,t,r,rc(s))}(e,t,i):_r(t,"bpmn:FlowNode")?function(e,t,n){var i=yn(e),r=wn(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},s=function(e,t){t||(t={});var n=t.defaultDistance||tc,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||nc,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?yn(e).top-yn(t).bottom:"center"===a?yn(e).top-wn(t).y:yn(e).top-yn(t).top:"w"===i?"start"===a?yn(e).left-yn(t).right:"center"===a?yn(e).left-wn(t).x:yn(e).left-yn(t).left:"s"===i?"start"===a?yn(t).top-yn(e).bottom:"center"===a?wn(t).y-yn(e).bottom:yn(t).bottom-yn(e).bottom:"start"===a?yn(t).left-yn(e).right:"center"===a?wn(t).x-yn(e).right:yn(t).right-yn(e).right}r||(r=ac);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 _r(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;_r(e,"bpmn:BoundaryEvent")&&-1!==(c=xn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:i.right+s+t.width/2,y:r.y+mc(c,l,o)}:{x:r.x+mc(c,l,o),y:i.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return ic(e,t,p,rc(d))}(e,t,i):void 0}function mc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function fc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return hc(e.source,n,t)}))}fc.$inject=["eventBus","elementRegistry"];var gc={__depends__:[pc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fc]};function yc(e,t,n,r){Ho.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 vc(e){e.invoke(yc,this)}function bc(e){Yl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function wc(e,t){bc.call(this,e),this._modeling=t}yc.$inject=["eventBus","elementRegistry","modeling","rules"],e(yc,Ho),yc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=yn(yt(e)),o=yn(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),vn(I({},o,s))},yc.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=yn(e),t=yn(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}(j(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},yc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},yc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},yc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},vc.$inject=["injector"],e(vc,yc),vc.prototype.resize=function(e,t,n){_r(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},bc.$inject=["eventBus"],e(bc,Yl),bc.prototype.canResize=function(e,t){return!1},e(wc,bc),wc.$inject=["eventBus","modeling"],wc.prototype.canResize=function(e,t){if(_r(t.di,"bpmndi:BPMNPlane"))return!1;if(!_r(t,"bpmn:Participant")&&!_r(t,"bpmn:Lane")&&!_r(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(_r(e,"bpmn:Lane")||mn(e))&&(n=!1)})),n};var xc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",vc],bpmnAutoResizeProvider:["type",wc]};function Ec(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=gs(e),function(e){return ee(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Ec.$inject=["elementRegistry","eventBus","injector"];var _c={__init__:["hoverFix"],hoverFix:["type",Ec]},Oc=Math.round,Pc="djs-drag-active";function kc(e){e.preventDefault()}function Sc(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=gs(e),d=ra(u,p),h=r.localStart,m=s(u),g=ra(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:Oc(h.x+c.x),y:Oc(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&&Js(r.cursor),t.addMarker(t.getRootElement(),Pc)}fs(e),r.active&&(I(l,{x:Oc(m.x+c.x),y:Oc(m.y+c.y),dx:Oc(g.x),dy:Oc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,fs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){js("Escape",e)&&(kc(e),f())}function u(t){var n;r.active&&(n=na(e),setTimeout(n,400),kc(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"),ea(),g=r.trapClick?u:c,le.unbind(document,"mousemove",l),le.unbind(document,"dragstart",kc),le.unbind(document,"selectstart",kc),le.unbind(document,"mousedown",g,!0),le.unbind(document,"mouseup",g,!0),le.unbind(document,"keyup",p),le.unbind(document,"touchstart",d,!0),le.unbind(document,"touchcancel",f,!0),le.unbind(document,"touchmove",l,!0),le.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Pc);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,E=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=ms(t)||t,v=gs(t),fs(t),"dragstart"===y.type&&kc(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:E,payload:{},globalStart:v,displacement:ra(n,b),localStart:b,isTouch:x},g),g.manual||(x?(le.bind(document,"touchstart",d,!0),le.bind(document,"touchcancel",f,!0),le.bind(document,"touchmove",l,!0),le.bind(document,"touchend",c,!0)):(le.bind(document,"mousemove",l),le.bind(document,"dragstart",kc),le.bind(document,"selectstart",kc),le.bind(document,"mousedown",w,!0),le.bind(document,"mouseup",w,!0)),le.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)}}Sc.$inject=["eventBus","canvas","selection","elementRegistry"];var Cc={__depends__:[_c,Rs],dragging:["type",Sc]};function Ac(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 Tc(e,t,n){return t<e&&e<n}Ac.$inject=["config.autoScroll","eventBus","canvas"],Ac.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++)Tc(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))},Ac.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ac.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Ac.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=gs(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Mc={__depends__:[Cc],__init__:["autoScroll"],autoScroll:["type",Ac]};function Rc(e){this._commandStack=e.get("commandStack",!1)}Rc.$inject=["injector"],Rc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Dc={__init__:["rules"],rules:["type",Rc]},Nc=Math.round,$c=Math.max;var Bc=10;function Ic(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(St(i,t)<=Bc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=sn(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,Bc),(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=$c(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Nc(o.x+s.x)/2,y:Nc(o.y+s.y)/2},index:o.segment2}:{point:{x:Nc(o.x),y:Nc(o.y)},index:o.segment2}:null}(e,t)}function Lc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qc(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 zc(e,t){var n=qc(e,t);return Lc({x:n.x-e.x,y:n.y-e.y})}function Fc(e,t){return Lc({x:e.x-t.x,y:e.y-t.y})}var Vc="djs-bendpoint",Hc="djs-segment-dragger";function Uc(e,t,n){var i=function(e,t){var n,i=gs(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 Ic(t,i)}function Wc(e,t){var n=De("g");ke(n).add(Vc),we(e,n);var i=De("circle");Oe(i,{cx:0,cy:0,r:4}),ke(i).add("djs-visual"),we(n,i);var r=De("circle");return Oe(r,{cx:0,cy:0,r:10}),ke(r).add("djs-hit"),we(n,r),t&&ke(n).add(t),n}function Gc(e,t,n,i){var r=De("g");we(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Xc("h"===n?i:r)}(t,n,i),s=De("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),ke(s).add("djs-visual"),we(r,s);var a=De("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),ke(a).add("djs-hit"),we(r,a),Zn(r,"v"===i?90:0),r}function Qc(e,t,n){var i=De("g"),r=Dt(t,n),o=Tt(t,n);return we(e,i),Gc(i,t,n,o),ke(i).add(Hc),ke(i).add("h"===o?"horizontal":"vertical"),Yn(i,r.x,r.y),i}function Xc(e){return Math.abs(Math.round(2*e/3))}function Kc(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=zc(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return qc(e,n)}function Yc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=Uc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Tt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Xc("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=Dt(i=t[c-1],r=t[c]),s=Tt(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){le.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="'+Qo(e.id)+'"]',i);return!r&&n&&(Oe(r=De("g"),{"data-element-id":e.id}),ke(r).add("djs-bendpoints"),we(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=Wc(e);we(e,i),Yn(i,t.x,t.y)})),Wc(e,"floating")}function p(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Tt(n=o[a-1],i=o[a])&&(Oe(r=Qc(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("."+Hc,e),(function(e){He(e)}))}(t),function(e){v(ve("."+Vc,e),(function(e){He(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=Dt(s,a),u=Tt(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}),Yn(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&&He(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?ke(t).add(e.marker):ke(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=Uc(t,o,e.originalEvent)))return;!function(e,t){var n=ye(".floating",e),i=t.point;n&&Yn(n,i.x,i.y)}(n,i),i.bendpoint||h(n,i,o)}})),e.on("element.mousedown",(function(e){if(bs(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&&Oe(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Yc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Zc=Math.round,Jc="reconnectStart",ep="reconnectEnd",tp="updateWaypoints";function np(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?tp:ep:Jc)===tp?"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===tp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Jc?a:o,target:l===ep?a:s}))return n.source=l===Jc?a:o,void(n.target=l===ep?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===ep?a:s,target:l===Jc?a:o})),t&&(n.source=l===ep?a:s,n.target=l===Jc?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!==tp&&(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:Zc(e.x),y:Zc(e.y)};if(!n)return!1;p===tp?(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===St(t,i=e[r+1])||Ct(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(p===Jc?(u.docking="source",ip(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===ep&&(u.docking="target",ip(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,d,u))}),this)}function ip(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Jc?t&&i&&t===i&&n!==i:r===ep?t&&n&&t===n&&n!==i:void 0}np.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],np.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 rp="updateWaypoints",op="connect-ok",sp="connect-not-ok",ap="connect-hover",lp="djs-updating",cp="djs-dragging";function pp(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,ke(t.draggerGfx=Wc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,cp),i.addMarker(r,lp)})),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,ap),o===rp)return;n?(i.removeMarker(r,sp),i.addMarker(r,op)):!1===n&&(i.removeMarker(r,op),i.addMarker(r,sp))}})),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,ap),i.removeMarker(n,r?op:sp))})),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?ip(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?ip(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===rp&&(d=e.cropWaypoints(c,d)),f.waypoints=d,r.drawPreview(n,i,f)),Yn(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,He(o),i.removeMarker(n,lp),i.removeMarker(n,cp),s&&(i.removeMarker(s,op),i.removeMarker(s,a?op:sp)),r&&r.cleanUp(t)}))}pp.$inject=["bendpointMove","injector","eventBus","canvas"];var up="connect-hover",dp="djs-updating";function hp(e,t,n){return mp(e,t,e[t]+n)}function mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function fp(e){return"x"===e?"y":"x"}function gp(e,t,n){var i,r;return e.original?e.original:(i=wn(t),mp(e,r=fp(n),i[r]))}function yp(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 mp(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],fp(e.axis));Yn(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=Uc(n,d,e);(s=Tt(h,m))&&(a="v"===s?"x":"y",0===p&&(h=gp(h,t.source,a)),u===d.length-1&&(m=gp(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=Qc(r,t.segmentStart,t.segmentEnd),ke(t.draggerGfx).add("djs-dragging"),n.addMarker(i,dp)})),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=hp(p,d,e["d"+d]),f=hp(u,d,e["d"+d]),g=h.length,y=0;h[o]=m,h[s]=f,o<2&&(t=xn(r.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=xn(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,up)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,up)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&He(t.draggerGfx),n.removeMarker(i,dp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,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!Ct(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)}))}yp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var vp=Math.abs,bp=Math.round;function wp(e){return{x:e.x,y:e.y}}function xp(e){return{x:e.x+e.width,y:e.y+e.height}}function Ep(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:bp(e.x+e.width/2),y:bp(e.y+e.height/2)}}function _p(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Op(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var 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 Pp(e){return e.children||[]}var kp=Math.abs,Sp=Math.round;function Cp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(kp(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?Kc(t,e):e.width?{x:Sp(e.width/2+e.x),y:Sp(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))&&Op(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&Op(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);hn(t)&&i&&i.x&&i.y&&(Op(e,"x",i.x),Op(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))&&Op(e,"x",i),(d||-1!==s.horizontal.indexOf(p))&&Op(e,"y",r)}}))}Cp.$inject=["eventBus"];var Ap={__depends__:[Cc,Dc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Yc],bendpointMove:["type",np],bendpointMovePreview:["type",pp],connectionSegmentMove:["type",yp],bendpointSnapping:["type",Cp]};function Tp(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:Mp(t)?o:r,connectionEnd:Mp(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=wn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Mp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}Tp.$inject=["eventBus","dragging","modeling","rules"];var Rp="connect-ok",Dp="connect-not-ok";function Np(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;Mp(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?Rp:Dp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Rp),n.removeMarker(t,Dp))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Np.$inject=["injector","eventBus","canvas"];var $p={__depends__:[Rs,Dc,Cc],__init__:["connectPreview"],connect:["type",Tp],connectPreview:["type",Np]};function Bp(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)}Bp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Bp.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()),Ce(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?wn(s):c,a?wn(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)},Bp.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||wn(n),o=t.connectionEnd||wn(i),s=this.cropWaypoints(r,o,n,i);we(e,this.createNoopConnection(s[0],s[1]))},Bp.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]},Bp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&He(e.connectionPreviewGfx)},Bp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Bp.prototype.createConnectionPreviewGfx=function(){var e=De("g");return Oe(e,{pointerEvents:"none"}),ke(e).add("djs-dragger"),we(this._canvas.getActiveLayer(),e),e},Bp.prototype.createNoopConnection=function(e,t){return pt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Ip={__init__:["connectionPreview"],connectionPreview:["type",Bp]};const Lp=new $o("ps");var jp=["marker-start","marker-mid","marker-end"],qp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function zp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}zp.$inject=["elementRegistry","eventBus","canvas","styles"],zp.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},zp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},zp.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ae(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Xn(r),i),Oe(r,this._styles.cls(i,[],{x:o.top,y:o.left})),we(t,r),Oe(r,"data-preview-support-element-id",e.id),r},zp.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return we(t,n),Oe(n,"data-preview-support-element-id",e.id),n},zp.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==qp.indexOf(e.nodeName)}(e)&&jp.forEach((function(r){if(Oe(e,r)){var o=function(e,t,n){var i=(r=Oe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ye("marker#"+i,n||document)}(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}}))},zp.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Lp.next()].join("-"),s=ye("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Ae(n);a.id=o,ke(a).add(r);var l=ye(":scope > defs",e);l||we(e,l=De("defs")),we(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,i,c)};var Fp={__init__:["previewSupport"],previewSupport:["type",zp]};const Vp="complex-preview";class Hp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:i=[],resized:r=[]}=e,o=this._canvas.getLayer(Vp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;hn(e)?(t=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(Xn(t),e)):(t=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(Xn(t),e),Yn(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);hn(e)?Yn(n,t.x,t.y):Yn(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",De("g"));this._graphicsFactory.drawShape(Xn(n),e,{width:t.width,height:t.height}),Yn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Ce(this._canvas.getLayer(Vp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Vp)}hide(){this._canvas.hideLayer(Vp)}}Hp.$inject=["canvas","graphicsFactory","previewSupport"];var Up={__depends__:[Fp],__init__:["complexPreview"],complexPreview:["type",Hp]},Wp=["top","bottom","left","right"],Gp=10;function Qp(e,t){function n(e){if(Yr(e)&&!hn(e)){var n=function(e){var t=wn(e.label),n=wn(e),i=Xp(n,t);if(r=i,-1===Wp.indexOf(r))return;var r;var o=function(e){var t=wn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Xp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=wn(e),r=xn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Wp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=wn(e),r=e.label,o=wn(r);if(!r.parent)return;var s,a=yn(e);switch(n){case"top":s={x:i.x,y:a.top-Gp-r.height/2};break;case"left":s={x:a.left-Gp-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Gp+r.height/2};break;case"right":s={x:a.right+Gp+r.width/2,y:i.y}}var l=ra(s,o);t.moveShape(r,l)}(e,n)}}Ho.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 Xp(e,t){return xn(t,e,5)}function Kp(e){Ho.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(_r(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function Yp(e,t){e.invoke(Ho,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;v(y(i.incoming.concat(i.outgoing),(function(e){return _r(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Qp,Ho),Qp.$inject=["eventBus","modeling"],e(Kp,Ho),Kp.$inject=["eventBus"],e(Yp,Ho),Yp.$inject=["injector","modeling"];function Zp(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return Jp(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(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];Jp(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Jp(e,t){return!mn(e)&&Or(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function eu(e,t){function n(e){return y(e.attachers,(function(e){return _r(e,"bpmn:BoundaryEvent")}))}Ho.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);_r(i,"bpmn:EventBasedGateway")&&_r(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;_r(i,"bpmn:Gateway")&&_r(r,"bpmn:EventBasedGateway")&&v(r.outgoing,(function(e){var i=e.target,r=n(i);_r(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function tu(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}Ho.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(iu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>nu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!iu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>ru(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>_r(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;iu(r)&&ru(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>_r(e,"bpmn:Association"))),r=i.filter((e=>nu(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;iu(t)&&nu(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;nu(o)&&r(o),iu(e)&&ru(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;nu(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)):ru(i)&&function(e){const n=e.incoming.filter((e=>iu(e.source)));t.removeElements(n)}(i)}),!0)}function nu(e){const t=Pr(e);return t&&t.get("isForCompensation")}function iu(e){return e&&_r(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}function ru(e){return e&&_r(e,"bpmn:Activity")&&!Wr(e)}function ou(e){e.invoke(Ho,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;_r(n,"bpmn:Lane")&&!_r(i,"bpmn:Lane")&&(t.parent=uc(n,"bpmn:Participant"))}))}function su(e,t){Ho.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(_r(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Zp.$inject=["bpmnReplace","injector"],e(Zp,Ho),Zp.prototype._replaceShape=function(e,t){var n,i=(n=Pr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},eu.$inject=["eventBus","modeling"],e(eu,Ho),e(tu,Ho),tu.$inject=["eventBus","modeling","bpmnRules"],ou.$inject=["injector"],e(ou,Ho),su.$inject=["eventBus","bpmnFactory"],e(su,Ho);var au=20,lu=20,cu=30,pu=2e3;function uu(e,t,n){function i(){var t=e.getRootElement();return _r(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Ho.call(this,t),t.on(["create.start","shape.move.start"],pu,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(_r(i,"bpmn:Participant")&&_r(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!_r(e,"bpmn:Group")&&!mn(e)&&!hn(e)}));if(o.length){var s=yt(o),a=function(e,t){t={width:t.width+2*au+cu,height:t.height+2*lu};var n=Math.max(e.width,t.width),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=yn(t),{bottom:t.top+e.height/2-lu,left:t.right-e.width/2+au,top:t.bottom-e.height/2+lu,right:t.left+e.width/2-au-cu}}(i,s)}}})),t.on("create.start",pu,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}_r(i,"bpmn:Participant")&&_r(r,"bpmn:Process")&&(t.on("element.hover",pu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",pu,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return f(e,(function(e){return _r(e,"bpmn:Participant")}))}(n);o&&_r(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Pr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;_r(n,"bpmn:Participant")&&_r(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Pr(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||Pr(i).set("processRef",Pr(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||Pr(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)}uu.$inject=["canvas","eventBus","modeling"],e(uu,Ho);var du="__targetRef_placeholder";function hu(e,t){function n(e,n){var i=e.get("properties"),r=f(i,(function(e){return e.name===du}));return!r&&n&&Pt(i,r=t.create("bpmn:Property",{name:du})),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)||Ot(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}Ho.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r))}function mu(e){return function(t){if(_r(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function fu(e){this._bpmnUpdater=e}function gu(e,t,n,i){function r(e){return e.children.filter((function(e){return _r(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return _r(e,"bpmn:Participant")&&Pr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:kr(e),newSemanticParent:o.processRef||o,newDiParent:kr(i)})}}Ho.call(this,i),t.registerHandler("dataStore.updateContainment",fu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;_r(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 _r(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!_r(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;_r(t,"bpmn:DataStoreReference")&&"label"!==t.type&&_r(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;_r(i,"bpmn:Collaboration")||_r(n,"bpmn:DataStoreReference")&&"label"!==n.type&&_r(r,"bpmn:Collaboration")&&o(n,_r(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(_r(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();Or(n,["bpmn:Participant","bpmn:SubProcess"])&&_r(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){_r(i,"bpmn:Process")&&o(e,i)}))}))}hu.$inject=["eventBus","bpmnFactory"],e(hu,Ho),fu.$inject=["bpmnUpdater"],fu.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),[]},fu.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),[]},gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(gu,Ho);var yu=Math.max,vu=Math.min,bu=20;function wu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?vu:yu)(i,r)),u(o)&&(i=(/top|left/.test(e)?yu:vu)(i,o)),i}function Eu(e,t){return void 0!==e?e:bu}function _u(e){return!e.waypoints&&"label"!==e.type}function Ou(e,t){var n;if((n=void 0===e.length?y(e.children,_u):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=Eu(t.left),i=Eu(t.right),r=Eu(t.top),o=Eu(t.bottom)):n=i=r=o=Eu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(yt(n),t)}var Pu=Math.abs;var ku=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){_r(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Au(e){return e.children.filter((function(e){return _r(e,"bpmn:Lane")}))}function Tu(e){return uc(e,ku)||e}function Mu(e,t){var n=Tu(e),i=Cu(n,_r(n,"bpmn:Process")?[]:[n]),r=yn(e),o=yn(t),s=function(e,t){return wu(yn(t),yn(e))}(e,t),a=[],l=Hr(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=yn(t);s.top&&(Pu(h.bottom-r.top)<10&&(u=o.top-h.bottom),Pu(h.top-r.top)<5&&(c=o.top-h.top)),s.left&&(Pu(h.right-r.left)<10&&(p=o.left-h.right),Pu(h.left-r.left)<5&&(d=o.left-h.left)),s.bottom&&(Pu(h.top-r.bottom)<10&&(c=o.bottom-h.top),Pu(h.bottom-r.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Pu(h.left-r.right)<10&&(d=o.right-h.left),Pu(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 Ru(e,t){Ho.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;_r(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=Hr(e),c=Au(n),p=[],u=[],d=[],h=[];ft(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))}))}Ru.$inject=["eventBus","spaceTool"],e(Ru,Ho);function Du(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Nu(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;Nu(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Nu(e,t){return!mn(e)&&_r(e,"bpmn:BoundaryEvent")&&!t}function $u(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=Ic(m,h=u(r.width)?wn(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&&Bu(e,o[o.length-1])||o.push(Iu(a)),1!==s.length&&Bu(e,s[0])||s.unshift(Iu(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)}Ho.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=wn(o),a={x:s.x+r.x,y:s.y+r.y},l=f(n.children,(function(e){return t.canInsert(i,e)&&Ic(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 Bu(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 Iu(e){return I({},e)}function Lu(e,t){Ho.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)&&ju(i)){(_r(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&ju(e))):o.incoming.filter((e=>e!==i&&ju(e)&&_r(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;_r(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ju).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(ju).forEach((function(i){const r=e.incoming.filter(ju).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function ju(e){return _r(e,"bpmn:SequenceFlow")}Du.$inject=["bpmnReplace","injector"],e(Du,Ho),Du.prototype._replaceShape=function(e){var t,n,i=(n=Pr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e($u,Ho),$u.$inject=["eventBus","bpmnRules","modeling"],Lu.$inject=["eventBus","modeling"],e(Lu,Ho);var qu=1500;function zu(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"],qu,(function(t){var i=t.context.shape||t.shape,r=t.hover;_r(r,"bpmn:Lane")&&!Or(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Tu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Or(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"],qu,(function(t){var n=t.hover;_r(n,"bpmn:Lane")&&(t.hover=Tu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],qu,(function(t){var n=t.context,i=t.hover,r=n.type;_r(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Tu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],qu,(function(e){var t=e.context,n=t.start;_r(n,"bpmn:Lane")&&(t.start=Tu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;_r(t,"bpmn:Lane")&&(e.shape=Tu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&_r(t,"bpmn:Lane")&&(e.hover=Tu(t))}))}zu.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return _r(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Pr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(Ot(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Pr(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(Ot(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Pr(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=Pr(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(Ho,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;_r(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;_r(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Pr(n);if(_r(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(_r(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Pr(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;_r(n,"bpmn:Group")&&!n.labelTarget&&Pr(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;_r(n,"bpmn:Group")&&!n.labelTarget&&Pr(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(_r(n,"bpmn:Group")&&!n.labelTarget){var i=Pr(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 Vu(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 Hu(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=Vu(e,t,n,r),a=Vu(e,t,n,o);i=s&&a?Uu(s,n)>Uu(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],wn(n.source)),t(i[i.length-1],i[i.length-2],wn(n.target)))}))}function Uu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){Ho.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=Pr(n),r=kr(n);if(Or(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,Ho),Hu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,Ho);var Gu=Math.sqrt,Qu=Math.min,Xu=Math.max,Ku=Math.abs;function Yu(e){return Math.pow(e,2)}function Zu(e,t){return Gu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Ju(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=Gu(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 ed(e.x,t.x,n.x)&&ed(e.y,t.y,n.y)}(n,e,t)}))}function ed(e,t,n){return e>=Qu(t,n)-td&&e<=Xu(t,n)+td}var td=.1;function nd(e,t){return Ku(e.x-t.x)<=td&&Ku(e.y-t.y)<=td}function id(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(nd(n=t[m],i=t[m+1])?a=[n]:(r=Zu(e,n),o=Zu(e,i),a=Ju(n,i,e,Qu(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:nd(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:Zu(n,s)/Zu(n,i)}),c=Zu(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&&rd(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=od(n,l),h=od(t,c),m=a.position,f=function(e,t){var n=Fc(e[0],e[1]),i=Fc(e[0],t);return 0===n?0:i/n}(d,m),g=(p=h,u=jc(d),jc(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=rd(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},(E=g)?{x:Math.cos(E)*x.x-Math.sin(E)*x.y,y:Math.sin(E)*x.x+Math.cos(E)*x.y}:x);return r=_.x+O.x-e.x,o=_.y+O.y-e.y,{point:gn(_),delta:gn({x:r,y:o})}}function rd(e,t){var n=Fc(e[t-1],e[t]);return n/(n+Fc(e[t],e[t+1]))}function od(e,t){return[e[t],e[t+1]]}function sd(e,t,n){var i=ia(t),r=ia(n),o=ra(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:r.x+s,y:r.y+a})}function ad(e,t,n){var i=ia(e),r=ia(t),o=ia(n),s=ra(e,i),a=ra(i,r),l=function(e,t,n){var i=yn(t),r=yn(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=xn(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=xn(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 gn({x:u+s.x-e.x,y:d+s.y-e.y})}var ld="name",cd="text";function pd(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(ld in o&&t.updateLabel(r,o[ld]),cd in o&&_r(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[cd]||"");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 id(wn(e),t,n,i).delta}(i,o,s,r)}Ho.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Pr(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;!mn(i)&&Kr(i)&&to(i)&&t.updateLabel(i,to(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=Pr(n);r&&Kr(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(Yr(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:zc(e,t)}}));return A(n,"distance")[0].line}(e,t);return qc(e,n)}(wn(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=ud(l,s,o);t.moveShape(a,c)}}))}function ud(e,t,n){return gn(ra(sd(e,t,n),e))}function dd(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 id(e,t,n,i).point}(t,o,s,r)}Ho.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 hd(e,t,n){var i=vd(e),r=bd(i,t),o=i[0];return r.length?r[r.length-1]:sd(o.original||o,n,t)}function md(e,t,n){var i=vd(e),r=bd(i,t),o=i[i.length-1];return r.length?r[0]:sd(o.original||o,n,t)}function fd(e,t,n){var i=vd(e),r=yd(t,n),o=i[0];return sd(o.original||o,r,t)}function gd(e,t,n){var i=vd(e),r=yd(t,n),o=i[i.length-1];return sd(o.original||o,r,t)}function yd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bd(e,t){return y(_(e,wd),(function(e){return function(e,t){return"intersect"===xn(t,e,1)}(e,t)}))}function wd(e){return e.original||e}function xd(e,t){Ho.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return _r(e,"bpmn:Participant")&&Vr(e)&&_r(t,"bpmn:Participant")&&!Vr(t)}(n,i)){var r,o,s,a,l=(o=gt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){_r(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){_r(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=md(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=hd(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(pd,Ho),pd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(dd,Ho),dd.$inject=["eventBus","modeling"],xd.$inject=["eventBus","modeling"],e(xd,Ho);const Ed=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function _d(e){const t=Pr(e);if(!(_r(t,"bpmn:BoundaryEvent")||_r(t,"bpmn:StartEvent")&&Wr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Ed.some((e=>_r(n[0],e)))}function Od(e){return _r(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Pd(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!_d(i))return;const o=Od(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Pr(n).get(o);s!==Pr(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function kd(e,t){Ho.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=kr(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function Sd(e,t,n){Ho.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(_r(r,"bpmn:SequenceFlow")&&_r(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=Vu(Cd(e[e.length-2]),Cd(e[e.length-1]),Cd(t[1]),Cd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Cd(e[0]),Cd(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Cd(e){return e.original||e}function Ad(e,t){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;_r(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var i=t.makeProcess(),r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}}),!0)}function Td(e,t,n,i){Ho.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(_r(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),_r(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 Md(e,t,n,i,r,o){i.invoke(Ho,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=Wr(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})}))}Pd.$inject=["injector","modeling"],e(Pd,Ho),e(kd,Ho),kd.$inject=["eventBus","modeling"],e(Sd,Ho),Sd.$inject=["eventBus","bpmnRules","modeling"],Ad.$inject=["eventBus","modeling"],e(Ad,Ho),e(Td,Ho),Td.$inject=["eventBus","modeling","bpmnRules","injector"],e(Md,Ho),Md.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)},Md.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Rd={width:140,height:120},Dd={width:300,height:60},Nd={width:60,height:300},$d={width:300,height:150},Bd={width:150,height:300},Id={width:140,height:120},Ld={width:50,height:30};function jd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(_r(n,"bpmn:Lane")||_r(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Tu(e),r=!0,o=!0,s=Cu(i,[i]),a=yn(e),l={},c={},p=Hr(e),u=p?Dd:Nd;/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=yn(e);p?(i.top<a.top-10&&(r=!1),i.bottom>a.bottom+10&&(o=!1)):(i.left<a.left-10&&(r=!1),i.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&qd(a.top-i.bottom)<10&&Ud(l,"top",i.top+u.height),qd(a.top-i.top)<5&&Hd(c,"top",i.bottom-u.height)),/e/.test(t)&&(n&&qd(a.right-i.left)<10&&Hd(l,"right",i.right-u.width),qd(a.right-i.right)<5&&Ud(c,"right",i.left+u.width)),/s/.test(t)&&(n&&qd(a.bottom-i.top)<10&&Hd(l,"bottom",i.bottom-u.height),qd(a.bottom-i.bottom)<5&&Ud(c,"bottom",i.top+u.height)),/w/.test(t)&&(n&&qd(a.left-i.right)<10&&Ud(l,"left",i.left+u.width),qd(a.left-i.left)<5&&Hd(c,"left",i.right-u.width))}));var d=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(_r(e,"bpmn:FlowElement")||_r(e,"bpmn:Artifact"))})),h=p?Wd:Gd;return d.forEach((function(e){var n=yn(e);!/n/.test(t)||p&&!r||Hd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Ud(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Ud(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||r)&&Hd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,i,r)),_r(n,"bpmn:SubProcess")&&Vr(n)&&(t.minDimensions=Id),_r(n,"bpmn:TextAnnotation")&&(t.minDimensions=Ld)}))}jd.$inject=["eventBus"];var qd=Math.abs,zd=Math.min,Fd=Math.max;function Vd(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Hd(e,t,n){return Vd(e,t,n,zd)}function Ud(e,t,n){return Vd(e,t,n,Fd)}var Wd={top:20,left:50,right:20,bottom:20},Gd={top:50,left:20,right:20,bottom:20};function Qd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(_r(n,"bpmn:Lane")||_r(n,"bpmn:Participant"))&&(t.balanced=!ws(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(_r(i,"bpmn:Lane")||_r(i,"bpmn:Participant"))return r&&(o=fn(o),t.resizeLane(i,o,n.balanced)),!1}))}Qd.$inject=["eventBus","modeling"];function Xd(e,t,n,i,r){function o(e){return Or(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return E(t,(function(t){return Gr(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 _r(e,"bpmn:ErrorEventDefinition")?"errorRef":_r(e,"bpmn:EscalationEventDefinition")?"escalationRef":_r(e,"bpmn:MessageEventDefinition")?"messageRef":_r(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Or(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Ho,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Pr(n));i&&!s(i)&&(Pt(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Ot(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(Pr(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(Or(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)}))}Xd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xd,Ho);var Kd=Math.max;function Yd(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;_r(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=Hr(e);if(r=e,!Au(r).length)return i?$d:Bd;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?$d:{width:Jd(e,n,o),height:Bd.height}:i?{width:$d.width,height:Zd(e,n,o)}:Bd;return s}(e,n,i)),_r(e,"bpmn:Lane")&&(r[t]=Hr(e)?Dd:Nd),_r(e,"bpmn:SubProcess")&&Vr(e)&&(r[t]=Id),_r(e,"bpmn:TextAnnotation")&&(r[t]=Ld),_r(e,"bpmn:Group")&&(r[t]=Rd)})),r}))}function Zd(e,t,n){var i;return i=function(e,t,n){var i,r=Au(e);return i=eh(r,t,n),e.height-i.height+Dd.height}(e,t,n),Kd($d.height,i)}function Jd(e,t,n){var i;return i=function(e,t,n){var i,r=Au(e);return i=eh(r,t,n),e.width-i.width+Nd.width}(e,t,n),Kd(Bd.width,i)}function eh(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=Au(r)).length?eh(o,t,n):r}Yd.$inject=["eventBus"];var th=180,nh=160;function ih(e,t,n,i,r,o,s){Ho.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 _r(e,"bpmn:SubProcess")&&!Vr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Pr(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function p(t){var n=Pr(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Jo(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(Jo(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(Jo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Jo(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(_r(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ts(t))return s.updateId(t,es(r)),void s.updateId(i,r);s.get(es(i))&&s.updateId(es(i),es(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(_r(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ts(t))return s.updateId(t,es(i)),void s.updateId(r,i);var o=s.get(es(r));o&&s.updateId(o,es(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ts(n)){var i=n,r=s.get(Zo(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;_r(t,"bpmn:SubProcess")&&(Vr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;_r(t,"bpmn:SubProcess")&&(Vr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(_r(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vr(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=Jo(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(_r(kr(r),"bpmndi:BPMNPlane")){var o=Zo(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 rh(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(_r(i,"bpmn:SubProcess")&&(_r(n,"bpmn:Task")||_r(n,"bpmn:CallActivity"))&&Vr(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 oh(e){Ho.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;_r(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&&_r(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function sh(e,t){Ho.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vr(n)){var i=gt(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,wn(n)):t.reconnectStart(e,n,wn(n)))}}),!0)}e(ih,Ho),ih.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=yt(o);if(t.x){var a=wn(t),l=wn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:th-s.x,y:nh-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},ih.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},ih.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},ih.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:Jo(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},ih.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},ih.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],rh.$inject=["injector","modeling"],e(rh,Ho),e(oh,Ho),oh.$inject=["eventBus"],e(sh,Ho),sh.$inject=["eventBus","modeling"];function ah(e,t,n){Ho.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;_r(n,"bpmn:SubProcess")&&(n.collapsed?kr(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),kr(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?kr(t).isExpanded=!1:kr(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=Ou(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 lh(e,t,n,i){t.invoke(Ho,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;mn(t)||(_r(t,"bpmn:Participant")&&Vr(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;_r(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function ch(e,t){Ho.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!_r(e,"bpmn:SequenceFlow"))return!1;var n=Pr(t),i=Pr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(ah,Ho),ah.$inject=["eventBus","elementFactory","modeling"],e(lh,Ho),lh.$inject=["canvas","injector","moddle","modeling"],e(ch,Ho),ch.$inject=["eventBus","modeling"];function ph(e,t){var n;function i(){if(!n)throw new Error("out of bounds release");return n}Ho.call(this,e);var r=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(r,5e3,(function(e){(n=n||new uh).enter()})),this.postExecuted(r,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=i();t.labelTarget||(_r(t,"bpmn:Lane")&&n.addLane(t),_r(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function uh(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function dh(e,t){Ho.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)hh(e)&&!mh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function hh(e){const t=Pr(e);return t&&t.isForCompensation}function mh(e){return e.incoming.filter((e=>function(e){return e&&_r(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}ph.$inject=["eventBus","modeling"],e(ph,Ho),e(dh,Ho),dh.$inject=["eventBus","modeling"];var fh={__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","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Qp],appendBehavior:["type",Kp],associationBehavior:["type",Yp],attachEventBehavior:["type",Zp],boundaryEventBehavior:["type",eu],compensateBoundaryEventBehaviour:["type",tu],createBehavior:["type",ou],createDataObjectBehavior:["type",su],createParticipantBehavior:["type",uu],dataInputAssociationBehavior:["type",hu],dataStoreBehavior:["type",gu],deleteLaneBehavior:["type",Ru],detachEventBehavior:["type",Du],dropOnFlowBehavior:["type",$u],eventBasedGatewayBehavior:["type",Lu],fixHoverBehavior:["type",zu],groupBehavior:["type",Fu],importDockingFix:["type",Hu],isHorizontalFix:["type",Wu],labelBehavior:["type",pd],layoutConnectionBehavior:["type",dd],messageFlowBehavior:["type",xd],nonInterruptingBehavior:["type",Pd],removeElementBehavior:["type",Sd],removeEmbeddedLabelBoundsBehavior:["type",kd],removeParticipantBehavior:["type",Ad],replaceConnectionBehavior:["type",Td],replaceElementBehaviour:["type",Md],resizeBehavior:["type",jd],resizeLaneBehavior:["type",Qd],rootElementReferenceBehavior:["type",Xd],spaceToolBehavior:["type",Yd],subProcessPlaneBehavior:["type",ih],subProcessStartEventBehavior:["type",rh],textAnnotationBehavior:["type",oh],toggleCollapseConnectionBehaviour:["type",sh],toggleElementCollapseBehaviour:["type",ah],unclaimIdBehavior:["type",lh],unsetDefaultFlowBehavior:["type",ch],updateFlowNodeRefsBehavior:["type",ph],setCompensationActivityAfterPasteBehavior:["type",dh]};function gh(e,t){var n=xn(e,t,-15);return"intersect"!==n?n:null}function yh(e){Yl.call(this,e)}function vh(e){return!e||mn(e)}function bh(e){do{if(_r(e,"bpmn:Process"))return Pr(e);if(_r(e,"bpmn:Participant"))return Pr(e).processRef||Pr(e)}while(e=e.parent)}function wh(e){return _r(e,"bpmn:TextAnnotation")}function xh(e){return _r(e,"bpmn:Group")&&!e.labelTarget}function Eh(e){return _r(e,"bpmn:BoundaryEvent")&&kh(e,"bpmn:CompensateEventDefinition")}function _h(e){return Pr(e).isForCompensation}function Oh(e){for(var t=e;t=t.parent;){if(_r(t,"bpmn:FlowElementsContainer"))return Pr(t);if(_r(t,"bpmn:Participant"))return Pr(t).processRef}return null}function Ph(e,t){return Oh(e)===Oh(t)}function kh(e,t){return!!f(Pr(e).eventDefinitions||[],(function(e){return _r(e,t)}))}function Sh(e,t){return(Pr(e).eventDefinitions||[]).every((function(e){return _r(e,t)}))}function Ch(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 Ah(e,t,n){if(vh(e)||vh(t))return null;if(!_r(n,"bpmn:DataAssociation")){if(Vh(e,t))return{type:"bpmn:MessageFlow"};if(Hh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Uh(e,t);return i||(Fh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!zh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Th(e,t){return!(!mn(e)&&!xh(e))||!(_r(t,"bpmn:Participant")&&!Vr(t))&&(_r(e,"bpmn:Participant")?_r(t,"bpmn:Process")||_r(t,"bpmn:Collaboration"):Or(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:_r(e,"bpmn:Lane")?_r(t,"bpmn:Participant")||_r(t,"bpmn:Lane"):!(_r(e,"bpmn:BoundaryEvent")&&!function(e){return Pr(e).cancelActivity&&(Dh(e)||Nh(e))}(e))&&(_r(e,"bpmn:FlowElement")&&!_r(e,"bpmn:DataStoreReference")?_r(t,"bpmn:FlowElementsContainer")?Vr(t):Or(t,["bpmn:Participant","bpmn:Lane"]):_r(e,"bpmn:DataStoreReference")&&_r(t,"bpmn:Collaboration")?E(Pr(t).get("participants"),(function(e){return!!e.get("processRef")})):Or(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Or(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!_r(e,"bpmn:MessageFlow")&&(_r(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Mh(e){return _r(e,"bpmn:Lane")}function Rh(e){return!!function(e){return!mn(e)&&_r(e,"bpmn:BoundaryEvent")}(e)||(!(!_r(e,"bpmn:IntermediateThrowEvent")||!Dh(e))||_r(e,"bpmn:IntermediateCatchEvent")&&Nh(e))}function Dh(e){var t=Pr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Nh(e){return $h(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function $h(e,t){return t.some((function(t){return kh(e,t)}))}function Bh(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!mn(r)&&(!!Rh(r)&&(!Wr(t)&&(!(!_r(t,"bpmn:Activity")||_h(t))&&(!(i&&!gh(i,t))&&(!function(e){return _r(e,"bpmn:ReceiveTask")&&f(e.incoming,(function(e){return _r(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Ih(e,t,n){if(!t)return!1;var i={replacements:[]};return v(e,(function(e){Wr(t)||_r(e,"bpmn:StartEvent")&&"label"!==e.type&&Th(e,t)&&(Ur(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),$h(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&_r(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),_r(t,"bpmn:Transaction")||kh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(_r(e,"bpmn:EndEvent")&&Th(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),_r(e,"bpmn:BoundaryEvent")&&Bh(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Lh(e,t){return!E(e,Mh)&&(!t||e.every((function(e){return Th(e,t)})))}function jh(e,t,n,i){return!!t&&(!(!mn(e)&&!xh(e))||!function(e,t){return e===t}(n,t)&&((!n||!Ch(n,t))&&(Th(e,t)||Wh(e,t))))}function qh(e,t){return _r(e,"bpmn:SubProcess")?Vr(e)&&(!t||t.width>=100&&t.height>=80):!!_r(e,"bpmn:Lane")||(!!_r(e,"bpmn:Participant")||(!!wh(e)||!!xh(e)))}function zh(e,t){return!Ch(t,e)&&!Ch(e,t)&&(!!function(e,t){var n=wh(e),i=wh(t);return(n||i)&&n!==i}(e,t)||!!Uh(e,t))}function Fh(e,t){return Ph(e,t)&&Eh(e)&&_r(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Wr(t);var n}function Vh(e,t){return!(Qh(e)&&!Qh(t))&&(_r(n=e,"bpmn:InteractionNode")&&!_r(n,"bpmn:BoundaryEvent")&&(!_r(n,"bpmn:Event")||_r(n,"bpmn:ThrowEvent")&&Sh(n,"bpmn:MessageEventDefinition"))&&function(e){return _r(e,"bpmn:InteractionNode")&&!_h(e)&&(!_r(e,"bpmn:Event")||_r(e,"bpmn:CatchEvent")&&Sh(e,"bpmn:MessageEventDefinition"))&&!(_r(e,"bpmn:BoundaryEvent")&&!kh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return bh(e)===bh(t)}(e,t));var n}function Hh(e,t){return _r(n=e,"bpmn:FlowNode")&&!_r(n,"bpmn:EndEvent")&&!Wr(n)&&!(_r(n,"bpmn:IntermediateThrowEvent")&&kh(n,"bpmn:LinkEventDefinition"))&&!Eh(n)&&!_h(n)&&function(e){return _r(e,"bpmn:FlowNode")&&!_r(e,"bpmn:StartEvent")&&!_r(e,"bpmn:BoundaryEvent")&&!Wr(e)&&!(_r(e,"bpmn:IntermediateCatchEvent")&&kh(e,"bpmn:LinkEventDefinition"))&&!_h(e)}(t)&&Ph(e,t)&&!(_r(e,"bpmn:EventBasedGateway")&&!function(e){return _r(e,"bpmn:ReceiveTask")||_r(e,"bpmn:IntermediateCatchEvent")&&(kh(e,"bpmn:MessageEventDefinition")||kh(e,"bpmn:TimerEventDefinition")||kh(e,"bpmn:ConditionalEventDefinition")||kh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Uh(e,t){return Or(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Or(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Or(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Or(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Wh(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&&(Or(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mn(t)&&_r(e,"bpmn:FlowNode")&&!_r(e,"bpmn:BoundaryEvent")&&Th(e,t.parent))}function Gh(e,t){return!!mn(t)||!(_r(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Qh(e){return uc(e,"bpmn:Process")||uc(e,"bpmn:Collaboration")}e(yh,Yl),yh.$inject=["eventBus"],yh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(vh(e))return null;return Or(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 Ah(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Ah(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return qh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(hn(i)&&!Wh(t,i))&&x(t,(function(e){return hn(e)?Ah(e.source,e.target,e):e.host?Bh(e,e.host,null,n):jh(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Bh(n,t,null,i)||Ih(n,t,i)||Lh(n,t)||Wh(n,t)})),this.addRule("shape.create",(function(e){return jh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Bh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Gh(e.elements,t)}))},yh.prototype.canConnectMessageFlow=Vh,yh.prototype.canConnectSequenceFlow=Hh,yh.prototype.canConnectDataAssociation=Uh,yh.prototype.canConnectAssociation=zh,yh.prototype.canConnectCompensationAssociation=Fh,yh.prototype.canMove=Lh,yh.prototype.canAttach=Bh,yh.prototype.canReplace=Ih,yh.prototype.canDrop=Th,yh.prototype.canInsert=Wh,yh.prototype.canCreate=jh,yh.prototype.canConnect=Ah,yh.prototype.canResize=qh,yh.prototype.canCopy=Gh;var Xh={__depends__:[Dc],__init__:["bpmnRules"],bpmnRules:["type",yh]};function Kh(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=kr(e);t=_(y(gt([e],!1),(function(t){return t!==e&&!t.labelTarget})),kr),n.set("planeElement",t)}))}))}Kh.$inject=["eventBus","canvas"];var Yh={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Kh]};function Zh(e){Ho.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 Jh(e,t){Zh.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=f(n,(function(t){return Or(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||_r(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var i=t;i&&!Or(i,n);)i=i.parent;if(!i)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return i}(e,n,r.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Zh.prototype.getOrdering=function(e,t){return null},e(Zh,Ho),Jh.$inject=["eventBus","canvas"],e(Jh,Zh);var em={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jh]};function tm(){}tm.prototype.get=function(){return this._data},tm.prototype.set=function(e){this._data=e},tm.prototype.clear=function(){var e=this._data;return delete this._data,e},tm.prototype.isEmpty=function(){return!this._data};var nm={clipboard:["type",tm]},im="drop-ok",rm="drop-not-ok",om="attach-ok",sm="new-parent",am="create";function lm(e,t,n,i,r){function o(t,n){[om,im,rm,sm].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===am&&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);cm(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||mn(t)&&-1!==e.indexOf(n))})),(function(e){return!hn(e)})),a=!1,l=!1,c=!1;pm(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=pm(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,om):o(i,c?sm:rm))})),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;cm(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!hn(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!hn(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=yt(y(n,(function(e){return!e.hidden})));v(n,(function(e){hn(e)&&(e.waypoints=_(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,am,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function cm(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 pm(e){return e&&1===e.length&&!hn(e[0])}lm.$inject=["canvas","dragging","eventBus","modeling","rules"];function um(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=De("g");Oe(t,r.cls("djs-drag-group",["no-events"]));var o=De("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Xn(r),e)):(r=n._createContainer("shape",o),n.drawShape(Xn(r),e),Yn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||we(e.getActiveLayer(),l),Yn(l,t.x,t.y)):He(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&He(t)}))}um.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var dm={__depends__:[Cc,Fp,Dc,Rs],__init__:["create","createPreview"],create:["type",lm],createPreview:["type",um]};function hm(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)}))}hm.$inject=["eventBus"],hm.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 mm={__init__:["mouse"],mouse:["type",hm]};function fm(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),hn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return _(e.waypoints,(function(e){return(e=gm(e)).original&&(e.original=gm(e.original)),e}))}(n)),mn(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 gm(e){return I({},e)}function ym(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}fm.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fm.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},fm.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||{}})}},fm.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=yt(e);return v(e,(function(e){hn(e)&&(e.waypoints=_(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))},fm.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}),hn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):mn(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},fm.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},fm.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},fm.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},fm.prototype.hasRelations=function(e,t){var n,i;return!(hn(e)&&(n=f(t,T({id:e.source.id})),i=f(t,T({id:e.target.id})),!n||!i))&&!(mn(e)&&!f(t,T({id:e.labelTarget.id})))},fm.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 ft(dt(e),(function(e,t,i){if(!mn(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=_(r,(function(e){return e.element})),r=_(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=_(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)?ym(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):ym(r.element,e)})),i};var vm={__depends__:[nm,dm,mm,Dc],__init__:["copyPaste"],copyPaste:["type",fm]};function bm(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function wm(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=Pr(n);if(mn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(kr(n),!0);s.bpmnElement=o,bm(o,t,"name"),bm(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(mn(n))return n.businessObject=Pr(t[n.labelTarget]),void(n.di=kr(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,bm(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(_r(n,"bpmn:Participant")){var r=Pr(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=Pr(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Pr(e).attachedToRef=Pr(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)))}))}wm.$inject=["bpmnFactory","eventBus","moddleCopy"];var xm=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Em(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===xm.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 _m(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Em.$inject=["eventBus","bpmnFactory","moddle"],Em.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||_m(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},Em.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}}},Em.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 Om={__depends__:[vm],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",wm],moddleCopy:["type",Em]},Pm=Math.round;function km(e,t){this._modeling=e,this._eventBus=t}function Sm(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}km.$inject=["modeling","eventBus"],km.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=Pm(a+o/2),p=Pm(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},Sm.$inject=["selection","eventBus"];var Cm={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Sm],replace:["type",km]};var Am=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Tm(e,t,n,i,r,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Mm(d)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Vr(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)}))}(_m(d.$descriptor),_m(h.$descriptor,!0));I(h,j(l,Am));var b=y(g,(function(e){return"eventDefinitions"===e?Rm(a,l.eventDefinitionType):"loopCharacteristics"===e?!Wr(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Wr(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(Rm(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),_r(d,"bpmn:Activity")){if(Mm(d))f.isExpanded=Vr(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}Vr(a)&&!_r(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}if(Mm(d)&&!Mm(h)&&(p.moveChildren=!1),_r(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Hr(a);kr(a).isHorizontal||(kr(f).isHorizontal=x),f.width=x?a.width:t.getDefaultSize(f).width,f.height=x?t.getDefaultSize(f).height:a.height}return o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Or(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Or(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!_r(d,"bpmn:BoundaryEvent")&&_r(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 Mm(e){return _r(e,"bpmn:SubProcess")}function Rm(e,t){var n=Pr(e);return t&&n.get("eventDefinitions").some((function(e){return _r(e,t)}))}Tm.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Dm={__depends__:[Om,Cm,Rs],bpmnReplace:["type",Tm]};function Nm(e){this._eventBus=e,this._tools=[],this._active=null}Nm.$inject=["eventBus"],Nm.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)},Nm.prototype.isActive=function(e){return e&&this._active===e},Nm.prototype.length=function(e){return this._tools.length},Nm.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Nm.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ee(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var $m={__depends__:[Cc],__init__:["toolManager"],toolManager:["type",Nm]};function Bm(e,t){return-1!==e.indexOf(t)}var Im=Math.abs,Lm=Math.round,jm={x:"width",y:"height"},qm="crosshair",zm={n:"top",w:"left",s:"bottom",e:"right"},Fm=1500,Vm={n:"s",w:"e",s:"n",e:"w"},Hm=20;function Um(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",Fm,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Gm(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){Gm(e);var c={x:0,y:0};c[i]=Lm(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Wm(e){return{top:e.top-Hm,right:e.right+Hm,bottom:e.bottom+Hm,left:e.left-Hm}}function Gm(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)}Um.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Um.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:qm,data:{context:{reactivate:n}},trapClick:!1})},Um.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:qm,data:{context:{}}})},Um.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Um.prototype.init=function(e,t){var n=Im(e.dx)>Im(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Im(i)<5)return!1;i<0&&(i*=-1),ws(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();!xs(e)&&e.hover&&(s=e.hover);var a=[...gt(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=yn(e),x=y(b,(function(e){return!(hn(e)||mn(e)||Qm(o,e)||Qm(s,e))})),E=y(b,(function(e){return!hn(e)&&!mn(e)&&Qm(o,e)})),_=[],O=[];x.length&&(d=Wm(yn(yt(x))),p=i-w[zm[n]]+d[zm[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)),E.length&&(h=Wm(yn(yt(E))),p=i-h[zm[Vm[n]]]+w[zm[Vm[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)?_.push(e):O.push(e)})),_.length&&(m=yn(yt(_.map(wn))),f=w[zm[Vm[n]]]-(m[zm[Vm[n]]]-i)),O.length&&(g=yn(yt(O.map(wn)))[zm[n]]-(w[zm[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[jm[t]]-P[jm[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=i+e[jm[t]]-P[jm[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=i-e[jm[t]]+P[jm[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=i-e[jm[t]]+P[jm[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}),Js("resize-"+("x"===n?"ew":"ns")),!0},Um.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&&!mn(e))if(hn(e))l.push(e);else{var o=e[t],p=o+e[jm[t]];if(function(e){return!!e.host}(e)&&(n>0&&wn(e)[t]>i||n<0&&wn(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}},Um.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Um.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Xm="djs-dragging",Km="djs-resizing",Ym=Math.max;function Zm(e,t,n,i,r){function o(e,t){v(e,(function(e){r.addDragger(e,t),n.addMarker(e,Xm)}))}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=De("g");Oe(a,i.cls("djs-crosshair-group",["no-events"])),we(t,a);var l=De("path");Oe(l,"d",o),ke(l).add("djs-crosshair"),we(a,l);var c=De("path");Oe(c,"d",s),ke(c).add("djs-crosshair"),we(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Yn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&He(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");Oe(a=De("path"),"d","M0,0 L0,0"),ke(a).add("djs-crosshair"),we(u,a),s.line=a;var d=De("g");Oe(d,i.cls("djs-drag-group",["no-events"])),we(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)}))})),hn(e)&&(t||i)&&(n||r)})),d),s.dragGroup=d}if(!s.frameGroup){var h=De("g");Oe(h,i.cls("djs-frame-group",["no-events"])),we(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,Km)})),s.frameGroup=h,s.frames=m}Oe(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,Yn(s.dragGroup,f.x,f.y),v(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?Oe(i,{width:Ym(r.width+f.x,5)}):Oe(i,{width:t=Ym(r.width-f.x,5),x:r.x+r.width-t}),"s"===s.direction?Oe(i,{height:Ym(r.height+f.y,5)}):Oe(i,{height:n=Ym(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,Xm)})),v(r,(function(e){n.removeMarker(e,Xm)})),a&&(He(s),He(a)),v(o,(function(e){n.removeMarker(e,Km)})),l&&He(l)}))}Zm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Jm={__init__:["spaceToolPreview"],__depends__:[Cc,Dc,$m,Fp,mm],spaceTool:["type",Um],spaceToolPreview:["type",Zm]};function ef(e,t){e.invoke(Um,this),this._canvas=t}ef.$inject=["injector","canvas"],e(ef,Um),ef.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],s=[];o&&(s=P(vt(r.children.filter((e=>_r(e,"bpmn:Artifact"))),yt(o))));const a=[...e,...s];var l=Um.prototype.calculateAdjustments.call(this,a,t,n,i);return l.resizingShapes=l.resizingShapes.filter((function(e){return!_r(e,"bpmn:TextAnnotation")&&(!function(e){return _r(e,"bpmn:Participant")&&!Pr(e).processRef}(e)||!("y"===t&&Hr(e)||"x"===t&&!Hr(e)))})),l};var tf={__depends__:[Jm],spaceTool:["type",ef]};function nf(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)}nf.$inject=["eventBus","injector"],nf.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()},nf.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},nf.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},nf.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()}},nf.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()}},nf.prototype.register=function(e,t){this._setHandler(e,t)},nf.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)},nf.prototype.canUndo=function(){return!!this._getUndoAction()},nf.prototype.canRedo=function(){return!!this._getRedoAction()},nf.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nf.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nf.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)}))},nf.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},nf.prototype._createId=function(){return this._uid++},nf.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nf.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()},nf.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)},nf.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)},nf.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},nf.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nf.prototype._revertedAction=function(e){this._stackIdx--},nf.prototype._getHandler=function(e){return this._handlerMap[e]},nf.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 rf={commandStack:["type",nf]};function of(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 sf(e,t,n){Ho.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=af(n),t.validatedShapes=af(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;of((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=kt(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&&(Pt(i.labels,n,r),n.labelTarget=i)}))}function af(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(sf,Ho),sf.$inject=["injector","eventBus","modeling"];var lf={__init__:["labelSupport"],labelSupport:["type",sf]},cf="attach-ok";function pf(e,t,n,i,r){Ho.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=uf(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(uf(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,cf),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,cf)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(uf(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;of(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=ad(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=ad(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;of(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function uf(e){return i(_(e,(function(e){return e.attachers||[]})))}e(pf,Ho),pf.$inject=["injector","eventBus","canvas","rules","modeling"];var df={__depends__:[Dc],__init__:["attachSupport"],attachSupport:["type",pf]};function hf(e){this._model=e}function mf(e,t,n){Ho.call(this,e),this._bpmnFactory=t;var i=this;function r(e){v(e.context.oldRoot.children,(function(e){_r(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function o(e){var t=e.context.shape;_r(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function a(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}function c(e){const{element:n}=e.context,i=to(n),r=kr(n),o=r&&r.get("label");Kr(n)||ts(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"],ff((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ff((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],r),this.reverted(["canvas.updateRoot"],r),this.executed(["shape.move","shape.create","shape.resize"],ff((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],ff((function(e){"label"!==e.context.shape.type&&o(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&o({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ff(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ff(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ff(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ff(a)),this.executed("connection.reconnect",ff((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Pr(n),s=Pr(i),a=Pr(r);o.conditionExpression&&!Or(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",ff((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Pr(n),s=Pr(i),a=Pr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],ff(l)),this.reverted(["element.updateAttachment"],ff(l)),this.executed("element.updateLabel",ff(c)),this.reverted("element.updateLabel",ff(c))}function ff(e){return function(t){var n=t.context;_r(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function gf(e,t){Hn.call(this),this._bpmnFactory=e,this._moddle=t}function yf(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function vf(e,t){this._modeling=e,this._canvas=t}function bf(e){this._modeling=e}function wf(e,t){this._canvas=e,this._layouter=t}hf.$inject=["moddle"],hf.prototype._needsId=function(e){return Or(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"])},hf.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=_r(e,"bpmn:Activity")?"Activity":_r(e,"bpmn:Event")?"Event":_r(e,"bpmn:Gateway")?"Gateway":Or(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},hf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},hf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},hf.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},hf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},hf.prototype.createDiWaypoints=function(e){var t=this;return _(e,(function(e){return t.createDiWaypoint(e)}))},hf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",j(e,["x","y"]))},hf.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},hf.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(mf,Ho),mf.$inject=["eventBus","bpmnFactory","connectionDocking"],mf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},mf.prototype.updateParent=function(e,t){if(!(mn(e)||_r(e,"bpmn:DataStoreReference")&&e.parent&&_r(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=kr(e),o=n&&n.businessObject,s=kr(n);_r(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),_r(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),_r(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),_r(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},mf.prototype.updateBounds=function(e){var t=kr(e),n=function(e){if(!_r(e,"bpmn:Activity"))return;var t=kr(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ra(n,t.get("bounds"));I(n,{x:e.x+i.x,y:e.y+i.y})}var r=mn(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})},mf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(_r(n,"bpmn:Lane")&&Ot(n.get("flowNodeRef"),e),_r(t,"bpmn:Lane")&&Pt(t.get("flowNodeRef"),e))},mf.prototype.updateDiConnection=function(e,t,n){var i=kr(e),r=kr(t),o=kr(n);i.sourceElement&&i.sourceElement.bpmnElement!==Pr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Pr(n)&&(i.targetElement=n&&o)},mf.prototype.updateDiParent=function(e,t){if(t&&!_r(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ot(n,e),e.$parent=null)}},mf.prototype.getLaneSet=function(e){var t,n;return _r(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(_r(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},mf.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&(!_r(e,"bpmn:DataInput")&&!_r(e,"bpmn:DataOutput")||(_r(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(_r(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(_r(e,"bpmn:FlowElement")){if(t)if(_r(t,"bpmn:Participant"))t=t.processRef;else if(_r(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(_r(t,"bpmn:Lane"));i="flowElements"}else if(_r(e,"bpmn:Artifact")){for(;t&&!_r(t,"bpmn:Process")&&!_r(t,"bpmn:SubProcess")&&!_r(t,"bpmn:Collaboration");){if(_r(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(_r(e,"bpmn:MessageFlow"))i="messageFlows";else if(_r(e,"bpmn:Participant")){i="participants";var r,o=e.processRef;o&&(r=function(e){for(;e&&!_r(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Ot(r.get("rootElements"),o),o.$parent=null),t&&(Pt(r.get("rootElements"),o),o.$parent=r))}else _r(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":_r(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Ot(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(i);Ot(s,e),t&&(a||(a=[],t.set(i,a)),a.push(e))}}},mf.prototype.updateConnectionWaypoints=function(e){kr(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},mf.prototype.updateConnection=function(e){var t,n=e.connection,i=Pr(n),r=n.source,o=Pr(r),s=n.target,a=Pr(n.target);if(_r(i,"bpmn:DataAssociation"))_r(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):_r(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=_r(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(Ot(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(Ot(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)},mf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(gf,Hn),gf.$inject=["bpmnFactory","moddle"],gf.prototype._baseCreate=Hn.prototype.create,gf.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Qr,t))}return this.createElement(e,t)},gf.prototype.createElement=function(e,t){var n,i,r,o=(t=I({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");wr(o=this._bpmnFactory.create(t.type))}if(!Or(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=I({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return _r(o,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=yf(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=yf(s,t,"isExpanded")),Or(o,["bpmn:Lane","bpmn:Participant"])&&(t=yf(s,t,"isHorizontal")),_r(o,"bpmn:SubProcess")&&(t.collapsed=!Vr(o,s)),_r(o,"bpmn:ExclusiveGateway")&&(m(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(i=o.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=o,o.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=I({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},gf.prototype.getDefaultSize=function(e,t){var n=Pr(e);if(t=t||kr(e),_r(n,"bpmn:SubProcess"))return Vr(n,t)?{width:350,height:200}:{width:100,height:80};if(_r(n,"bpmn:Task"))return{width:100,height:80};if(_r(n,"bpmn:Gateway"))return{width:50,height:50};if(_r(n,"bpmn:Event"))return{width:36,height:36};if(_r(n,"bpmn:Participant")){var i=void 0===t.isHorizontal||!0===t.isHorizontal;return Vr(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return _r(n,"bpmn:Lane")?{width:400,height:100}:_r(n,"bpmn:DataObjectReference")?{width:36,height:50}:_r(n,"bpmn:DataStoreReference")?{width:50,height:50}:_r(n,"bpmn:TextAnnotation")?{width:100,height:30}:_r(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},gf.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)},vf.$inject=["modeling","canvas"],vf.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)}))},vf.prototype.postExecute=function(e){},bf.$inject=["modeling"],bf.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},bf.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,E(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))},wf.$inject=["canvas","layouter"],wf.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},wf.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xf=Math.round;function Ef(e){this._modeling=e}Ef.$inject=["modeling"],Ef.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=yt(y(t,(function(e){return!e.hidden})));v(t,(function(e){hn(e)&&(e.waypoints=_(e.waypoints,(function(e){return{x:xf(e.x-a.x-a.width/2+r.x),y:xf(e.y-a.y-a.height/2+r.y)}}))),I(e,{x:xf(e.x-a.x-a.width/2+r.x),y:xf(e.y-a.y-a.height/2+r.y)})}));var l=dt(t),c={};v(t,(function(e){if(hn(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),mn(e)&&(t=q(t,["attach"])),c[e.id]=u(i)?s.createShape(e,j(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,j(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=P(c)};var _f=Math.round;function Of(e){this._canvas=e}function Pf(e){Of.call(this,e)}Of.$inject=["canvas"],Of.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-_f(t.width/2),y:n.y-_f(t.height/2)}),this._canvas.addShape(t,i,r),t},Of.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Pf,Of),Pf.$inject=["canvas"];var kf=Of.prototype.execute;Pf.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,kf.call(this,e)};var Sf=Of.prototype.revert;function Cf(e,t){this._canvas=e,this._modeling=t}function Af(e,t){this._modeling=e,this._elementRegistry=t}function Tf(e,t){this._canvas=e,this._modeling=t}function Mf(e){this._modeling=e}Pf.prototype.revert=function(e){return e.shape.labelTarget=null,Sf.call(this,e)},Cf.$inject=["canvas","modeling"],Cf.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;of(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),of(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Cf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=kt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Cf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,i),this._canvas.addConnection(t,n),t},Af.$inject=["modeling","elementRegistry"],Af.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))}))},Tf.$inject=["canvas","modeling"],Tf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;of(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),of(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),of(n.children,(function(e){hn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Tf.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=kt(i.children,n),t.removeShape(n),n},Tf.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Pt(i.children,n,r),t.addShape(n,i),n},Mf.$inject=["modeling"];var Rf={x:"y",y:"x"};function Df(e,t){this._layouter=e,this._canvas=t}function Nf(){}function $f(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Bf(e){this._modeling=e}function If(e){this._helper=new Bf(e)}function Lf(e){this._modeling=e,this._helper=new Bf(e)}function jf(e){this._modeling=e}function qf(e){return e.original||e}function zf(e,t){this._modeling=e,this._rules=t}function Ff(e){this._modeling=e}function Vf(e){this._modeling=e}function Hf(e){return I({},e)}function Uf(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Wf(e,t,n){var i=Uf(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Gf(e,t){return-1!==e.indexOf(t)}function Qf(e){this._modeling=e}function Xf(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,Xf(e.children)))})),t}function Kf(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Kf(e.children,e.collapsed||t)))})),n}function Yf(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Yf(e.children,t)))})),n}function Zf(e){this._modeling=e}function Jf(e,t){return Ot(e&&e.attachers,t)}function eg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Pt(i,t,n)}}function tg(){}function ng(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function ig(e){this._elementRegistry=e}function rg(e,t){v(t,(function(t,n){e.set(n,t)}))}Mf.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[Rf[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[Rf[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)})))}))},Mf.prototype.postExecute=function(e){},Df.$inject=["layouter","canvas"],Df.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Df.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Nf.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=Ot(o.children,t),Pt(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},Nf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ot(n.children,t),Pt(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},$f.prototype.add=function(e,t){return this.addAll([e],t)},$f.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var i=xt((n=n||{}).allShapes),r=xt(n.allConnections),o=xt(n.enclosedElements),a=xt(n.enclosedConnections),l=xt(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 ft(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},Bf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Bf.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&&fd(e,e.source,t),connectionEnd:r&&gd(e,e.target,t)})}))},Bf.prototype.getClosure=function(e){return(new $f).addAll(e,!0)},If.$inject=["modeling"],If.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},If.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)},Lf.$inject=["modeling"],Lf.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=j(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Lf.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:gd(e,t,n)})})),v(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:fd(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},Lf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Pt(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Lf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Lf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},jf.$inject=["modeling"],jf.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},jf.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||qf(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||qf(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},jf.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},zf.$inject=["modeling","rules"],zf.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,md(e,t,u),a)})),v(h,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,hd(e,t,u),a)}))},zf.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},zf.prototype.execute=function(e){},zf.prototype.revert=function(e){},zf.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},zf.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},zf.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Ff.$inject=["modeling"],Ff.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},Ff.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:md(e,n,i)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:hd(e,n,i)})})))},Ff.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},Vf.$inject=["modeling"],Vf.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;(Bm(e,r)||Bm(e,o)||Bm(t,r)||Bm(t,o))&&(Bm(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Vf.prototype.execute=function(){},Vf.prototype.revert=function(){},Vf.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Vf.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})}))},Vf.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.waypoints,(function(e){return(e=Hf(e)).original&&(e.original=Hf(e.original)),e}))}(e),d=Uf(n),h={};Gf(l,c)&&Gf(l,p)?(u=_(u,(function(e){return Wf(e,i,n)&&(e[d]=e[d]+t[d]),e.original&&Wf(e.original,i,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Gf(l,c)||Gf(l,p))&&(Gf(r,c)?h.connectionStart=fd(e,c,t):Gf(r,p)?h.connectionEnd=gd(e,p,t):Gf(o,c)?h.connectionStart=hd(e,c,s[c.id]):Gf(o,p)&&(h.connectionEnd=md(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=Xf(n),t.collapsed=!t.collapsed;var i=Kf(n,t.collapsed);return[t].concat(i)},Qf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Yf(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Zf.$inject=["modeling"],Zf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jf(i,t),eg(n,t),t.host=n,t},Zf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Jf(n,t),eg(i,t,r),t},tg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},tg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},ng.$inject=["eventBus","elementFactory","commandStack"],ng.prototype.getHandlers=function(){return{"shape.append":bf,"shape.create":Of,"shape.delete":Tf,"shape.move":Lf,"shape.resize":Ff,"shape.replace":zf,"shape.toggleCollapse":Qf,spaceTool:Vf,"label.create":Pf,"connection.create":wf,"connection.delete":Cf,"connection.move":Nf,"connection.layout":Df,"connection.updateWaypoints":tg,"connection.reconnect":jf,"elements.create":Ef,"elements.move":If,"elements.delete":Af,"elements.distribute":Mf,"elements.align":vf,"element.updateAttachment":Zf}},ng.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},ng.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)},ng.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ng.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)},ng.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)},ng.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ng.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},ng.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},ng.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},ng.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},ng.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},ng.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ng.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ng.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ng.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ng.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ng.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ng.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ng.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)},ng.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ng.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)},ng.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,I(i,{docking:"source"}))},ng.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,I(i,{docking:"target"}))},ng.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ng.prototype._create=function(e,t){return t instanceof Ln?t:this._elementFactory.create(e,t)},ng.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ig.$inject=["elementRegistry"],ig.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 rg(n,i),e.oldProperties=o,e.changed=r,r},ig.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return rg(n,t),i},ig.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return _r(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return _r(t,"bpmn:DataObjectReference")&&Pr(t).dataObjectRef===e}))}(e,t):[]};var og="default",sg="id",ag="di",lg={width:0,height:0};function cg(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}function pg(e,t){return sg in e&&e[sg]!==t[sg]}function ug(e,t){var n=e.businessObject,i=kr(e);v(t,(function(e,t){t!==ag?n.set(t,e):i&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(i,e)}))}cg.$inject=["elementRegistry","moddle","modeling","textRenderer"],cg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,s=function(e){var t=I({},e);return dg.forEach((function(n){n in e&&(t[n]=Pr(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=O(t),i=e.businessObject,r=kr(e);return w(n,(function(e,n){return e[n]=n!==ag?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,s);return pg(s,o)&&(r.unclaim(o[sg]),i.updateId(t,s[sg]),r.claim(s[sg],o)),og in s&&(s[og]&&n.push(i.get(s[og].id)),o[og]&&n.push(i.get(o[og].id))),ug(t,s),e.oldProperties=a,e.changed=n,n},cg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Pr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,lg)}},cg.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 ug(t,i),pg(n,r)&&(s.unclaim(n[sg]),o.updateId(t,i[sg]),s.claim(i[sg],r)),e.changed};var dg=["default"];function hg(e,t){this._canvas=e,this._modeling=t}function mg(e,t){this._modeling=e,this._spaceTool=t}function fg(e){this._modeling=e}function gg(e,t){this._modeling=e,this._spaceTool=t}hg.$inject=["canvas","modeling"],hg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=kr(r);return t.setRootElement(n),t.removeRootElement(r),Pt(s.rootElements,i),i.$parent=s,Ot(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},hg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=kr(n);return t.setRootElement(r),t.removeRootElement(n),Ot(s.rootElements,i),i.$parent=null,Pt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},mg.$inject=["modeling","spaceTool"],mg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Tu(i),s=o===i,a=s?i:i.parent,l=Au(a),c=Hr(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+Su,y:i.y,width:i.width-Su,height:i.height}:{x:i.x,y:i.y+Su,width:i.width,height:i.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,m,f,g=[];ft(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?Su:0),y:d-("top"===r?120:0),width:i.width-(s?Su:0),height:120}:{x:d-("left"===r?120:0),y:i.y+(s?Su:0),width:120,height:i.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},fg.$inject=["modeling"],fg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Au(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var s,a,l,c,p=Hr(n),u=p?n.height:n.width,d=Math.round(u/i);for(c=0;c<i;c++)s=c===i-1?u-d*c:d,a=p?{x:n.x+Su,y:n.y+c*d,width:n.width-Su,height:s}:{x:n.x+c*d,y:n.y+Su,width:s,height:n.height-Su},c<o?t.resizeShape(r[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},gg.$inject=["modeling","spaceTool"],gg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},gg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Mu(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},gg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=yn(e),c=wu(yn(t),l),p=Tu(e),u=[],d=[];ft(p,(function(e){return u.push(e),(_r(e,"bpmn:Lane")||_r(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 yg="flowNodeRef",vg="lanes";function bg(e){this._elementRegistry=e}function wg(e){this._moddle=e}bg.$inject=["elementRegistry"],bg.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=Tu(e);return r[t.id]||(r[t.id]=Cu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=yn(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=Tu(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return _r(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(vg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(yg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},bg.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(vg);e.remove.forEach((function(e){Ot(n,e),Ot(e.get(yg),t)})),e.add.forEach((function(e){Pt(n,e),Pt(e.get(yg),t)}))})),[]},bg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(vg);e.add.forEach((function(e){Ot(n,e),Ot(e.get(yg),t)})),e.remove.forEach((function(e){Pt(n,e),Pt(e.get(yg),t)}))})),[]},wg.$inject=["moddle"],wg.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),[]},wg.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 xg={fill:void 0,stroke:void 0};function Eg(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}`)}}}Eg.$inject=["commandStack"],Eg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xg,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=hn(e)?j(r,["border-color"]):r,n=kr(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),mn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!Or(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var _g={width:0,height:0};function Og(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return no(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!mn(n)&&Kr(n)&&!Yr(n)&&!Pg(r)){var o=Jr(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=to(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(mn(r)||_r(r,"bpmn:TextAnnotation"))if(mn(r)&&Pg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=to(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,_g)}}}function Pg(e){return!e||!e.trim()}function kg(e,t,n,i){ng.call(this,e,t,n),this._bpmnRules=i}function Sg(){}Og.$inject=["modeling","textRenderer","bpmnFactory"],e(kg,ng),kg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kg.prototype.getHandlers=function(){var e=ng.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ig,e["element.updateProperties"]=cg,e["canvas.updateRoot"]=hg,e["lane.add"]=mg,e["lane.resize"]=gg,e["lane.split"]=fg,e["lane.updateRefs"]=bg,e["id.updateClaim"]=wg,e["element.setColor"]=Eg,e["element.updateLabel"]=Og,e},kg.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},kg.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)},kg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Sg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||wn(t.source||e.source),t.connectionEnd||wn(t.target||e.target)]};var Cg=20,Ag=5,Tg=Math.round,Mg=20,Rg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Dg(e,t,n){var i,r,o,s=xn(t,e,Ag),a=n.split(":")[0],l=Tg((t.x-e.x)/2+e.x),c=Tg((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+Cg*(/l/.test(a)?-1:1),y:h?c+Cg:c}):i={x:(h=l===e.x)?l+Cg:l,y:e.y+Cg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:$g(e,i,r).concat(i),directions:r,turnNextDirections:h}}function Ng(e){return e.split(":").reverse().join(":")}function $g(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(qg(n)){var i=function(e,t,n){return Dg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Dg(t,e,Ng(n));return{waypoints:i.waypoints.slice().reverse(),directions:Ng(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:$g(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=Tg((t.x-e.x)/2+e.x),r=Tg((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 Bg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=xn(e,t,Rg[o]||0),a=function(e,t){if(qg(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||wn(e),i=i||wn(t);var l=a.split(":"),c=zg(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var i=$g(e,t,n);return i.unshift(e),i.push(t),Fg(i)}(c,zg(i,t,l[1],s),a)}function Ig(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=wn(e),i=wn(t)),r=r||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=xn(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?Lg(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:Lg(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=jg(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&jg(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Bg(e,t,n,i,o))))}function Lg(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 jg(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&&St(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(Tt(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(Rt(e[i],t,Mg)||Rt(e[i],n,Mg))return e.slice(i);return e}(s,e,t),r!==s&&(s=jg(e,t,n,r)),s&&Tt(s)?null:s}function qg(e){return e&&/t|r|b|l/.test(e)}function zg(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 Fg(e){return e.reduce((function(t,n,i){return Ct(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Vg=-10,Hg=40,Ug={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},Wg={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Gg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Qg={top:"t",right:"r",bottom:"b",left:"l"};function Xg(e){this._elementRegistry=e}function Kg(e,t){return _r(t,"bpmn:Participant")?"source":_r(e,"bpmn:Participant")?"target":ey(t)?"source":ey(e)||_r(t,"bpmn:Event")?"target":_r(e,"bpmn:Event")?"source":null}function Yg(e){return ey(e)?"target":"source"}function Zg(e,t){return e?e.original||e:wn(t)}function Jg(e,t){return _r(t,"bpmn:Activity")&&_r(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ey(e){return _r(e,"bpmn:SubProcess")&&Vr(e)}function ty(e,t){return e===t}function ny(e){var t=/right|left/.exec(e);return t&&t[0]}function iy(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ry(e,t){return Gg[e]===t}function oy(e){return"right"===e||"left"===e}function sy(e,t,n){var i=t.waypoints,r=i&&i.length&&xn(i[0],e);return"top"===r?n.loop.fromTop:"right"===r?n.loop.fromRight:"left"===r?n.loop.fromLeft:n.loop.fromBottom}function ay(e,t,n,i){var r,o,s,a,l=wn(e),c=wn(t),p=(a=(s=e).host,xn(wn(s),a,Vg)),u=ty(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=xn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,i,r,o){var s,a=t?e:o.isHorizontal?iy(e):ny(e),l=Qg[a];s=t?oy(e)?ly("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:ly("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,i):(r=function(e,t,n,i){if(n)return Qg[e];var r=iy(e),o=ny(e),s=iy(t),a=ny(t);if(i){if(ty(r,s)||ry(o,a))return Qg[r]}else if(ty(o,a)||ry(r,s))return Qg[o];return Qg[i?o:r]}(p,h,d,i.isHorizontal),o=function(e,t,n,i){if(n)return oy(e)?function(e,t){var n=ny(e),i=Gg[n];return-1!==t.indexOf(i)}(e,t)||ty(e,t)?"h":"v":function(e,t){var n=iy(e),i=Gg[n];return-1!==t.indexOf(i)}(e,t)||ty(e,t)?"v":"h";return i?ty(iy(e),iy(t))?"h":"v":ty(ny(e),ny(t))?"v":"h"}(p,h,d,i.isHorizontal),[r+":"+o])}function ly(e,t,n,i){var r=Hg;return!(cy(e,i,n,r)||cy(e,i,{x:n.x+n.width,y:n.y+n.height},r)||cy(e,i,wn(t),r))}function cy(e,t,n,i){return Math.abs(t[e]-n[e])<i}function py(e){return I({original:e.point.original||e.point},e.actual)}function uy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Xg,Sg),Xg.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,c=this._elementRegistry;if(a||(a=Zg(s&&s[0],r)),l||(l=Zg(s&&s[s.length-1],o)),(_r(e,"bpmn:Association")||_r(e,"bpmn:DataAssociation"))&&s&&!Jg(r,o))return[].concat([a],s.slice(1,-1),[l]);var p=dc(r,c)?Ug:Wg;return _r(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Kg(e,t)}}(r,o,p):(_r(e,"bpmn:SequenceFlow")||Jg(r,o))&&(n=r===o?{preferredLayouts:sy(r,e,p)}:_r(r,"bpmn:BoundaryEvent")?{preferredLayouts:ay(r,o,l,p)}:ey(r)||ey(o)?{preferredLayouts:p.subProcess,preserveDocking:Yg(r)}:_r(r,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:_r(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(i=Fg(Ig(r,o,a,l,s,n=I(n,t)))),i||[a,l]},Xg.$inject=["elementRegistry"],uy.$inject=["elementRegistry","graphicsFactory"],uy.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(py(i)),o.push(py(r)),o},uy.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}},uy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},uy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},uy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},uy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var dy={__init__:["modeling","bpmnUpdater"],__depends__:[fh,Xh,Yh,em,Dm,rf,lf,df,Rs,Vo,tf],bpmnFactory:["type",hf],bpmnUpdater:["type",mf],elementFactory:["type",gf],modeling:["type",kg],layouter:["type",Xg],connectionDocking:["type",uy]};const hy=Math.round;function my(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}my.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-hy(p.width/2),y:u.y-hy(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)))})},my.prototype.cleanUp=function(){this._complexPreview.cleanUp()},my.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var fy={__depends__:[gc,Up,dy],__init__:["appendPreview"],appendPreview:["type",my]},gy=Math.min,yy=Math.max;function vy(e){e.preventDefault()}function by(e){e.stopPropagation()}function wy(e){this.container=e.container,this.parent=fe('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ye("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=B(this.autoResize,this),this.handlePaste=B(this.handlePaste,this)}function xy(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new wy({container:t.getContainer(),keyHandler:B(this._handleKey,this),resizeHandler:B(this._handleResize,this)})}wy.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=j(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=j(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,le.bind(o,"keydown",this.keyHandler),le.bind(o,"mousedown",by),le.bind(o,"paste",this.handlePaste),i.autoResize&&le.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},wy.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)}},wy.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)},wy.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)}))},wy.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})}},wy.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=fe('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){vy(n),by(n);var u=gy(yy(c+n.clientX-a,i),o),d=gy(yy(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){vy(e),by(e),le.unbind(document,"mousemove",u,!1),le.unbind(document,"mouseup",d,!1)};le.bind(n,"mousedown",(function(e){vy(e),by(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,le.bind(document,"mousemove",u),le.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)},wy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",by),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},wy.prototype.getValue=function(){return this.content.innerText.trim()},wy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},wy.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)},xy.$inject=["eventBus","canvas"],xy.prototype.registerProvider=function(e){this._providers.push(e)},xy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},xy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},xy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},xy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},xy.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()}},xy.prototype.getValue=function(){return this._textbox.getValue()},xy.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())},xy.prototype._handleResize=function(e){this._fire("resize",e)},xy.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 Ey={__depends__:[Ps],__init__:["directEditing"],directEditing:["type",xy]};var _y=[{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"}}],Oy=[{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"}}],Py=[{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"}}],ky=[{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"}}],Sy=[{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"}}],Cy=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ay=[{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],Ty=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",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}}],My=Ty,Ry=[{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}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],Dy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Ny=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],$y=[{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}}],By=[{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}}],Iy=[{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"}],Ly=[{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}}],jy={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{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:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{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"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{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"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{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"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{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:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{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:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]},qy={"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 zy(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()}zy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],zy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},zy.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,i=this._rules,r=[],o=[];if(c(e)||!i.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Pr(s),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Vr(s);return!(r&&o&&a&&l)});return _r(n,"bpmn:DataObjectReference")?this._createEntries(e,Dy):_r(n,"bpmn:DataStoreReference")&&!_r(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ny):(_r(n,"bpmn:Event")&&!_r(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,r=jy[t]||[],!Wr(n.$parent)&&_r(n.$parent,"bpmn:SubProcess")&&(r=y(r,(function(e){return"bpmn:StartEvent"!==e.target.type})))),_r(n,"bpmn:StartEvent")&&!_r(n.$parent,"bpmn:SubProcess")?(o=y(_y.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:Participant")?(o=y(Ly,(function(t){return Vr(e)!==t.target.isExpanded})),this._createEntries(e,o)):_r(n,"bpmn:StartEvent")&&Wr(n.$parent)?(o=y(By.concat(r),(function(e){var t=!1!==e.target.isInterrupting,i=n.isInterrupting===t;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):_r(n,"bpmn:StartEvent")&&!Wr(n.$parent)&&_r(n.$parent,"bpmn:SubProcess")?(o=y(Oy.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:EndEvent")?(o=y(ky.concat(r),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!_r(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):_r(n,"bpmn:BoundaryEvent")?(o=y($y,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!_r(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,r=n.cancelActivity==i;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):_r(n,"bpmn:IntermediateCatchEvent")||_r(n,"bpmn:IntermediateThrowEvent")?(o=y(Py.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:Gateway")?(o=y(Sy,a),this._createEntries(e,o)):_r(n,"bpmn:Transaction")?(o=y(Ty,a),this._createEntries(e,o)):Wr(n)&&Vr(e)?(o=y(My,a),this._createEntries(e,o)):_r(n,"bpmn:AdHocSubProcess")&&Vr(e)?(o=y(Ay,a),this._createEntries(e,o)):_r(n,"bpmn:SubProcess")&&Vr(e)?(o=y(Cy,a),this._createEntries(e,o)):_r(n,"bpmn:SubProcess")&&!Vr(e)?(o=y(Ry,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):_r(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Iy):_r(n,"bpmn:FlowNode")?(o=y(Ry,a),this._createEntries(e,o)):{})},zy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return _r(e,"bpmn:Activity")&&!Wr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),_r(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),_r(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),_d(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},zy.prototype._createEntries=function(e,t){var n={},i=this;return v(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},zy.prototype._createSequenceFlowEntries=function(e,t){var n=Pr(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&&(_r(n.sourceRef,"bpmn:ExclusiveGateway")||_r(n.sourceRef,"bpmn:InclusiveGateway")||_r(n.sourceRef,"bpmn:ComplexGateway")||_r(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&&_r(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:_r(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(_r(n.sourceRef,"bpmn:ExclusiveGateway")||_r(n.sourceRef,"bpmn:InclusiveGateway")||_r(n.sourceRef,"bpmn:ComplexGateway")||_r(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},zy.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}},zy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var r=e.businessObject.get("loopCharacteristics");r&&_r(r,i.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,r,{isSequential:i.options.isSequential}):(r=t._moddle.create(i.options.loopCharacteristics,{isSequential:i.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:r}))}}var r,o,s,a=Pr(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"}}}},zy.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})}}}},zy.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})}}}},zy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Pr(e),i=this,r=Od(e),o=_r(e,"bpmn:BoundaryEvent")?qy["intermediate-event-non-interrupting"]:qy["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 Fy={__depends__:[Wl,Dm,gc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",zy]};function Vy(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(ws(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Hy(e,t,n){var i=e.$instanceOf(t),r=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}Vy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Vy.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},Vy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Vy.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._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&I(p,m()),p;var u=e.businessObject;function d(e,t){r.start(e,t)}function h(e,t){n.removeElements([t])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function f(e,t,n,r){function s(t,n){var s=i.createShape(I({type:e},r));o.start(t,s,{source:n})}var l=a?function(t,n){var o=i.createShape(I({type:e},r));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,r),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Or(u,["bpmn:Lane","bpmn:Participant"])&&Vr(e)){var y=Au(e);I(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Hr(e)?e.height>=120:e.width>=120)&&I(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Hr(e)?e.height>=180:e.width>=180)&&I(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),I(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return _r(u,"bpmn:FlowNode")&&(_r(u,"bpmn:EventBasedGateway")?I(p,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Hy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(p,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):_r(u,"bpmn:EndEvent")||u.isForCompensation||Hy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Wr(u)||I(p,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("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:l("Change element"),width:300,search:!0})}}}}),_r(u,"bpmn:SequenceFlow")&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Or(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),_r(u,"bpmn:TextAnnotation")&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Or(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),_r(u,"bpmn:Group")&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&I(p,m()),p};var Uy={__depends__:[fy,Ey,Ta,Rs,$p,dm,Fy],__init__:["contextPadProvider"],contextPadProvider:["type",Vy]},Wy={horizontal:["x","width"],vertical:["y","height"]};function Gy(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:[]}))}Gy.$inject=["modeling","rules"],Gy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Gy.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},Gy.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},Gy.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},Gy.prototype._setOrientation=function(e){var t=Wy[e];this._axis=t[0],this._dimension=t[1]},Gy.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)},Gy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Qy={__init__:["distributeElements"],distributeElements:["type",Gy]};function Xy(e){Yl.call(this,e)}Xy.$inject=["eventBus"],e(Xy,Yl),Xy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=dt(t=y(t,(function(e){var t=Or(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 Ky={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 Yy(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Yy.$inject=["popupMenu","distributeElements","translate","rules"],Yy.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Yy.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Yy.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:Ky.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Ky.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var Zy={__depends__:[Wl,Qy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xy],distributeElementsMenuProvider:["type",Yy]},Jy="is not a registered action";function ev(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function tv(e,t){return new Error(e+" "+t)}ev.$inject=["eventBus","injector"],ev.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)}))},ev.prototype.trigger=function(e,t){if(!this._actions[e])throw tv(e,Jy);return this._actions[e](t)},ev.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)}))},ev.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw tv(e,"is already registered");this._actions[e]=t},ev.prototype.unregister=function(e){if(!this.isRegistered(e))throw tv(e,Jy);this._actions[e]=void 0},ev.prototype.getActions=function(){return Object.keys(this._actions)},ev.prototype.isRegistered=function(e){return!!this._actions[e]};var nv={__init__:["editorActions"],editorActions:["type",ev]};function iv(e){e.invoke(ev,this)}e(iv,ev),iv.$inject=["injector"],iv.prototype._registerDefaultActions=function(e){ev.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!_r(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=yt(i=_r(r,"bpmn:Collaboration")?n.filter((function(e){return _r(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!_r(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 rv={__depends__:[nv],editorActions:["type",iv]};function ov(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Or(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}ov.$inject=["eventBus"];var sv=10;function av(e,t,n){return n||(n="round"),Math[n](e/t)*t}function lv(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&&Ls(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)||(cv(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&&(cv(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&&(cv(t)?uv(a)?s.x.max=l.left:s.x.min=l.right:pv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(cv(t)?uv(a)?s.x.min=c.left:s.x.max=c.right:pv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(i,s),_p(t,n)||r.snapEvent(t,n,i)}))}}))}function cv(e){return"x"===e}function pv(e){return-1!==e.indexOf("n")}function uv(e){return-1!==e.indexOf("w")}function dv(e,t){Ho.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)}}))}lv.prototype.snapEvent=function(e,t,n){Op(e,t,this.snapValue(e[t],n))},lv.prototype.getGridSpacing=function(){return sv},lv.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=av(e+=r,sv),t&&t.min&&u(n=t.min)&&(n=av(n+r,sv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=av(i+r,sv,"floor"),e=Math.min(e,i)),e-=r},lv.prototype.isActive=function(){return this.active},lv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},lv.prototype.toggleActive=function(){this.setActive(!this.active)},lv.$inject=["elementRegistry","eventBus","config.gridSnapping"],dv.$inject=["eventBus","gridSnapping","modeling"],e(dv,Ho),dv.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},dv.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},dv.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},dv.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 hv(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))}))}hv.$inject=["eventBus","gridSnapping"];var mv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",dv],gridSnappingSpaceToolBehavior:["type",hv]}],__init__:["gridSnapping"],gridSnapping:["type",lv]};function fv(e,t,n){e.on("autoPlace",2e3,(function(e){var i=e.source,r=wn(i),o=e.shape,s=hc(i,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==r[e]&&(s[e]>r[e]?n.min=s[e]:n.max=s[e],_r(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}fv.$inject=["eventBus","gridSnapping","elementRegistry"];function gv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();_r(r,"bpmn:Participant")&&_r(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})))}))}gv.$inject=["canvas","eventBus","gridSnapping"];function yv(e,t,n){Ho.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 vv(e,t,n){var i=Tt(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]}yv.$inject=["eventBus","gridSnapping","modeling"],e(yv,Ho),yv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=vv(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var bv={__depends__:[mv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fv],gridSnappingParticipantBehavior:["type",gv],gridSnappingLayoutConnectionBehavior:["type",yv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ov]};function wv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return _r(t,"bpmn:Lane")?n._createParticipantHit(t,i):_r(t,"bpmn:Participant")?Vr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):_r(t,"bpmn:SubProcess")?Vr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}wv.$inject=["eventBus","interactionEvents"],wv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},wv.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=Hr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},wv.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 xv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",wv]};function Ev(e){e.invoke(Gs,this)}e(Ev,Gs),Ev.$inject=["injector"],Ev.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Gs.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 _v={__depends__:[Qs],__init__:["keyboardBindings"],keyboardBindings:["type",Ev]},Ov={moveSpeed:1,moveSpeedAccelerated:10},Pv="left",kv="right",Sv="down",Cv={ArrowLeft:Pv,Left:Pv,ArrowUp:"up",Up:"up",ArrowRight:kv,Right:kv,ArrowDown:Sv,Down:Sv},Av={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 Tv(e,t,n,i,r){var o=this;this._config=I({},Ov,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=Cv[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=Av[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Tv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Mv={__depends__:[Qs,Rs],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Tv]};function Rv(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=yn(e);return vn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("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:yn(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=fn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function Dv(e,t){var n=wn(e),i=yn(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 Nv(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"}Rv.prototype.canResize=function(e){var t=this._rules,n=j(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rv.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,Dv(t,r),"resize",{autoActivate:!0,cursor:Nv(r),data:{shape:t,context:i}})},Rv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=yn(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?yn(i):o;return vn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:yu(o.bottom,s.bottom),right:yu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Ou(t,e.childrenBoxPadding))},Rv.$inject=["eventBus","rules","modeling","dragging"];var $v="djs-resizing",Bv="resize-not-ok";function Iv(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,$v)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),i.canExecute?ke(s).remove(Bv):ke(s).add(Bv)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&He(n.frame),t.removeMarker(i,$v)}))}Iv.$inject=["eventBus","canvas","previewSupport"];var Lv=-6,jv="djs-resizer",qv=["n","w","s","e","nw","ne","se","sw"];function zv(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,B(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}zv.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){bs(t)&&i.activate(t,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},zv.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=Lv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Lv);return t}(i),s=De("g");ke(s).add(jv),ke(s).add(jv+"-"+e.id),ke(s).add(jv+"-"+i),we(r,s);var a=De("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),ke(a).add(jv+"-visual"),we(s,a);var l=De("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),ke(l).add(jv+"-hit"),we(s,l),Kn(s,t,n),s},zv.prototype.createResizer=function(e,t){var n=Dv(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},zv.prototype.addResizer=function(e){var t=this;!hn(e)&&this._resize.canResize({shape:e})&&v(qv,(function(n){t.createResizer(e,n)}))},zv.prototype.removeResizers=function(){Ce(this._getResizersParent())},zv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},zv.$inject=["eventBus","canvas","selection","resize"];var Fv={__depends__:[Dc,Cc,Fp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rv],resizePreview:["type",Iv],resizeHandles:["type",zv]};function Vv(e,t,n,i,r,o,s){function a(e,t){(t||Or(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Hv(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 Hv(e){return _r(e,"bpmn:SubProcess")&&!Vr(e)}Vv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vv.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var i={},r=n.style||{};return I(r,{backgroundColor:null,border:null}),(Or(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Hv(e))&&I(i,{centerVertically:!0}),Kr(e)&&(I(i,{autoResize:!0}),I(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),_r(e,"bpmn:TextAnnotation")&&(I(i,{resizable:!0,autoResize:!0}),I(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),I(n,{options:i,style:r}),n}},Vv.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(_r(e,"bpmn:Lane")||function(e){return _r(e,"bpmn:Participant")&&Vr(e)}(e)){var f=Hr(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 _r(e,"bpmn:Participant")&&!Vr(e)}(e)){var g=Hr(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)"})}(Or(e,["bpmn:Task","bpmn:CallActivity"])||Hv(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 _r(e,"bpmn:SubProcess")&&Vr(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"})),Kr(n)&&!Yr(n)&&!mn(n)){var w=Jr(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),E=p+v+b;I(s,{width:y,height:E,x:x.x-y/2,y:x.y-E/2}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return _r(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}},Vv.prototype.update=function(e,t,n,i){var r,o,s;_r(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 Uv="djs-element-hidden",Wv="djs-label-hidden";function Gv(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(_r(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=De("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=De("path");Oe(p,{d:c,strokeWidth:2,stroke:Qv(i)}),we(o,p),we(a,o),Yn(o,i.x,i.y)}_r(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,Uv):(_r(i,"bpmn:Task")||_r(i,"bpmn:CallActivity")||_r(i,"bpmn:SubProcess")||_r(i,"bpmn:Participant")||_r(i,"bpmn:Lane"))&&t.addMarker(i,Wv)})),e.on("directEditing.resize",(function(e){if(_r(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}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Uv),t.removeMarker(i,Wv)),i=void 0,r=void 0,o&&(He(o),o=void 0)}))}function Qv(e,t){return kr(e).get("stroke")||t||"black"}Gv.$inject=["eventBus","canvas","pathMap"];var Xv={__depends__:[Vo,Fv,Ey],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vv],labelEditingPreview:["type",Gv]},Kv=new $o("tt");function Yv(e,t){e.style.display=!1===t?"none":""}var Zv="djs-tooltip",Jv="."+Zv;function eb(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Kv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Q(i=fe('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;ue.bind(this._tooltipRoot,Jv,"mousedown",(function(e){e.stopPropagation()})),ue.bind(this._tooltipRoot,Jv,"mouseover",(function(e){r.trigger("mouseover",e)})),ue.bind(this._tooltipRoot,Jv,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}eb.$inject=["eventBus","canvas"],eb.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},eb.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)))},eb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},eb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},eb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},eb.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},eb.prototype.show=function(){Yv(this._tooltipRoot)},eb.prototype.hide=function(){Yv(this._tooltipRoot,!1)},eb.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},eb.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=fe(i)),Q(t=fe('<div data-tooltip-id="'+n+'" class="'+Zv+'">'),{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)},eb.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Q(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},eb.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),Yv(i,r))}))},eb.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 tb={__init__:["tooltips"],tooltips:["type",eb]};function nb(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var i,r,o=e.context,s=o.shape;_r(o.target,"bpmn:Collaboration")&&_r(s,"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:2e3,html:"<div>"+r+"</div>"}))}))}nb.$inject=["eventBus","tooltips","translate"];var ib={__depends__:[tb],__init__:["modelingFeedback"],modelingFeedback:["type",nb]};function rb(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=De("rect");return Oe(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||we(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||we(n,o=r()),i.updateConnectionOutline(o,t)}))}rb.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&v(i,(function(i){n=n||i.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},rb.prototype.updateConnectionOutline=function(e,t){var n=yt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},rb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},rb.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rb.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},rb.$inject=["eventBus","styles","elementRegistry"];function ob(e,t,n){this._canvas=t;var i=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;i._updateMultiSelectionOutline(t)}))}ob.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ce(t);var n=e.length>1;if(ke(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}}(yt(e)),r=De("rect");Oe(r,I({rx:3},i)),ke(r).add("djs-selection-outline"),we(t,r)}},ob.$inject=["eventBus","canvas","selection"];var sb={__depends__:[Rs],__init__:["outline","multiSelectionOutline"],outline:["type",rb],multiSelectionOutline:["type",ob]},ab=Math.round;function lb(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&&!ke(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+ab(e.width/2),y:e.y+ab(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=ab(i.x),i.y=ab(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(bs(e)){var t=ms(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}lb.$inject=["eventBus","dragging","modeling","selection","rules"];var cb="djs-dragging",pb="drop-ok",ub="drop-not-ok",db="new-parent",hb="attach-ok";function mb(e,t,n,r){function o(e){var t=function(e){var t=y(e,(function(t){return!hn(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=gt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),i=t.concat(n);return[...new Set(i)]}function a(e,n){[hb,pb,ub,db].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=De("g");Oe(d,n.cls("djs-drag-group",["no-events"])),we(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,cb)})),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,hb):t.canExecute&&r&&i.id!==r.id?a(i,db):a(i,t.canExecute?pb:ub)),Yn(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,cb)})),r&&He(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,cb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}mb.$inject=["eventBus","canvas","styles","previewSupport"];var fb={__depends__:[Ps,Rs,sb,Dc,Cc,Fp],__init__:["move","movePreview"],move:["type",lb],movePreview:["type",mb]},gb=".djs-palette-toggle",yb=".entry",vb=gb+", "+yb,bb="djs-palette-",wb="open",xb="two-column";function Eb(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 _b(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Eb.$inject=["eventBus","canvas"],Eb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Eb.prototype.getEntries=function(){return this._getProviders().reduce(_b,{})},Eb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Eb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=fe(Eb.HTML_MARKUP);n.appendChild(i),Y(n).add(bb+"shown"),ue.bind(i,vb,"click",(function(t){if(ge(t.delegateTarget,gb))return e.toggle();e.trigger("click",t)})),le.bind(i,"mousedown",(function(e){e.stopPropagation()})),ue.bind(i,yb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Eb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Eb.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(xb,t),s.toggle(bb+xb,t),"open"in e&&(o.toggle(wb,e.open),s.toggle(bb+wb,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Eb.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="+Qo(i)+"]",e);r||(X(r=fe('<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=fe(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=fe("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Eb.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()},Eb.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()}},Eb.prototype._layoutChanged=function(){this._toggleState({})},Eb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Eb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Eb.prototype.open=function(){this._toggleState({open:!0})},Eb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Eb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Eb.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")}}))},Eb.prototype.isOpen=function(){return Y(this._container).has(wb)},Eb.prototype._getParentContainer=function(){return this._canvas.getContainer()},Eb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Ob={__init__:["palette"],palette:["type",Eb]},Pb="crosshair";function kb(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();Oe(n=e.frame=De("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),we(i,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&He(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=Sb(e),r=i.filter((function(e){return e})),o=xs(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Sb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Sb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Sb(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}}kb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],kb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Pb,data:{context:{}}})},kb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Pb,data:{context:{}},keepSelection:!0})},kb.prototype.select=function(e,t,n=[]){var i=vt(e,t);this._selection.select([...n,...P(i)])},kb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},kb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Cb={__depends__:[$m,mm],__init__:["lassoTool"],lassoTool:["type",kb]},Ab=1500,Tb="grab";function Mb(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",Ab,(function(e){if(ws(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ab,(function(e){if(Rb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ab,(function(e){Rb(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!ws(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Rb(e){return js("Space",e)}Mb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Tb,data:{context:n||{}}})},Mb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Tb,data:{context:{reactivate:n}}})},Mb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Db={__depends__:[$m,mm],__init__:["handTool"],handTool:["type",Mb]},Nb="connect-ok",$b="connect-not-ok";function Bb(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?Nb:$b))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Nb:$b)})),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}))}Bb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Ib={__depends__:[$p,Dc,Cc,$m,mm],globalConnect:["type",Bb]};function Lb(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)}Lb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Lb.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 jb={__depends__:[Ob,dm,tf,Cb,Db,Ib,Ao],__init__:["paletteProvider"],paletteProvider:["type",Lb]};function qb(e,t,n,i,r){Ho.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="'+Qo(l.id)+'"]',e.dragGroup);p&&Oe(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="'+Qo(i)+'"]',e.dragGroup);r&&Oe(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}qb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(qb,Ho);var zb={__depends__:[Fp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",qb]},Fb=40,Vb=20,Hb=10,Ub=20,Wb=["x","y"],Gb=Math.abs;function Qb(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&&Ls(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Wb.forEach((function(i){var r=Yb(i,t);e[i]<t[i]+n?Op(e,i,t[i]+n):e[i]>t[i]+r-n&&Op(e,i,t[i]+r-n)}))}(e,r,function(e){return _r(e,"bpmn:Task")?Hb:Vb}(r)),r&&function(e,t){return E(t,(function(t){return Kb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Ep(i),Or(r,["bpmn:Event","bpmn:Gateway"])&&Xb(e,Ep(r)),Or(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Ep(t);Wb.forEach((function(i){(function(e,t,n){return e[n]>t[n]+Ub&&e[n]<t[n]+Yb(n,t)-Ub})(e,t,i)&&Op(e,i,n[i])}))}(e,r),_r(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=Ep(n),o=xn(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];Gb(i-r[t])<Fb&&(n=i>r[t]?r[t]+Fb:r[t]-Fb,Op(e,t,n))}))}(e)):Kb(n,"bpmn:MessageFlow")?(_r(i,"bpmn:Event")&&(t.connectionStart=Ep(i)),_r(r,"bpmn:Event")&&Xb(e,Ep(r))):t.connectionStart=t.initialConnectionStart)}))}function Xb(e,t){Op(e,"x",t.x),Op(e,"y",t.y)}function Kb(e,t){return e&&e.type===t}function Yb(e,t){return"x"===e?t.width:t.height}function Zb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Jb(){this._snapValues={}}Qb.$inject=["eventBus"],Zb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Zb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Zb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Zb.prototype.getSnapLocations=function(){return this._snapLocations},Zb.prototype.setSnapLocations=function(e){this._snapLocations=e},Zb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Jb).initDefaults(this._defaultSnaps),n},Jb.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)},Jb.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],vp(r-e)<=n)return r}(e[n],r[n],i)},Jb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var ew=1250;function tw(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"],ew,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Ls(e.originalEvent))&&!_p(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()}))}tw.$inject=["elementRegistry","eventBus","snapping"],tw.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Zb);var s=(t=n.get(r.id)?Ep(r,e):{x:e.x+Ep(r).x,y:e.y+Ep(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}),mn(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},tw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(mn(n))mn(t)&&e.add("mid",Ep(n));else if(hn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Ep(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Ep(t)),e):e},tw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function nw(e,t){t.invoke(tw,this),e.on(["create.move","create.end"],1500,iw),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)&&!_p(e)&&function(e,t){var n,i=yn(t),r=gh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:wn(s);/top/.test(r)?Op(e,"y",i.top-n.y):/bottom/.test(r)&&Op(e,"y",i.bottom-n.y);/left/.test(r)?Op(e,"x",i.left-n.x):/right/.test(r)&&Op(e,"x",i.right-n.x)}(e,i)}))}function iw(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)&&Op(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Op(e,"y",e.y)}}function rw(e,t){return-1!==e.indexOf(t)}function ow(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(nw,tw),nw.$inject=["eventBus","injector"],nw.prototype.initSnap=function(e){var t=tw.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",ow(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",ow(r,i,e))})),_r(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},nw.prototype.addSnapTargetPoints=function(e,t,n){tw.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);v(i,(function(n){var i;(function(e){if(_r(e,"bpmn:SubProcess")&&Vr(e))return!0;return _r(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return _r(e,i)}))))&&(e.add("top-left",wp(n)),e.add("bottom-right",xp(n)))}));var r=this._elementRegistry;return v(t.incoming,(function(n){if(r.get(t.id)){rw(i,n.source)||e.add("mid",wn(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)){rw(i,n.target)||e.add("mid",wn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),_r(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},nw.prototype.getSnapTargets=function(e,t){return tw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!_r(e,"bpmn:Lane")}))};function sw(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&&Ls(e.originalEvent)||_p(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)&&Op(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Op(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function aw(e,t){var n=wn(e),i=yn(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}sw.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Zb);var o=aw(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},sw.prototype.addSnapTargetPoints=function(e,t,n,i){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",xp(t)),e.add("corner",wp(t))})),e.add("corner",aw(t,i)),e},sw.$inject=["eventBus","snapping"],sw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,i=e,n.host===i||hn(t)||function(e){return!!e.hidden}(t)||mn(t));var n,i}))};function lw(e){this._canvas=e,this._asyncHide=$(B(this.hide,this),1e3)}lw.$inject=["canvas"],lw.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:_p(e,"x"),y:_p(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)&&Op(e,t,n.originValue)}))},lw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return Oe(n,{d:"M0,0 L0,0"}),ke(n).add("djs-snap-line"),we(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},lw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},lw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},lw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},lw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var cw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",tw],resizeSnapping:["type",sw],snapping:["type",lw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Qb],createMoveSnapping:["type",nw]};function pw(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ye(pw.INPUT_SELECTOR,this._container),this._resultsContainer=ye(pw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function uw(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n=Ko(e.value||e.matched||e.normal),i=e.match||e.matched;t+=i?'<b class="'+pw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),r=fe(n);r.innerHTML=i,e.appendChild(r)}pw.$inject=["canvas","eventBus","selection","translate"],pw.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:ue.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,pw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,pw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,pw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,pw.INPUT_SELECTOR,"keydown",(function(e){js("ArrowUp",e)&&e.preventDefault(),js("ArrowDown",e)&&e.preventDefault()})),t(this._container,pw.INPUT_SELECTOR,"keyup",(function(t){if(js("Escape",t))return e.close();if(js("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return js("ArrowUp",t)?e._scrollToDirection(!0):js("ArrowDown",t)?e._scrollToDirection():void(js(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},pw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ue.unbind(e.el,e.type,e.listener)}))},pw.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).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(pw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},pw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},pw.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)}},pw.prototype._clearResults=function(){J(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},pw.prototype._getCurrentResult=function(){return ye(pw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},pw.prototype._createResultNode=function(e,t){var n=fe(pw.RESULT_HTML);return e.primaryTokens.length>0&&uw(n,e.primaryTokens,pw.RESULT_PRIMARY_HTML),uw(n,e.secondaryTokens,pw.RESULT_SECONDARY_HTML),X(n,pw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},pw.prototype.registerProvider=function(e){this._searchProvider=e},pw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Y(this._canvas.getContainer()).add("djs-search-open"),Y(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},pw.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Y(this._canvas.getContainer()).remove("djs-search-open"),Y(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},pw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pw.prototype.isOpen=function(){return this._open},pw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Y(t).remove(pw.RESULT_SELECTED_CLASS);var n=X(e,pw.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Y(e).add(pw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},pw.prototype._select=function(e){var t=X(e,pw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},pw.prototype._getBoxHtml=function(){const e=fe(pw.BOX_HTML),t=ye(pw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},pw.CONTAINER_SELECTOR=".djs-search-container",pw.INPUT_SELECTOR=".djs-search-input input",pw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",pw.RESULT_SELECTOR=".djs-search-result",pw.RESULT_SELECTED_CLASS="djs-search-result-selected",pw.RESULT_SELECTED_SELECTOR="."+pw.RESULT_SELECTED_CLASS,pw.RESULT_ID_ATTRIBUTE="data-result-id",pw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",pw.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <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"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',pw.RESULT_HTML='<div class="djs-search-result"></div>',pw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',pw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var dw={__depends__:[Ao,zo,Rs],searchPad:["type",pw]};function hw(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}function mw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}hw.$inject=["elementRegistry","searchPad","canvas","search"],hw.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!mn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:to(e),id:e.id}))),e,{keys:["label","id"]}).map(mw)};var fw={__depends__:[dw,Ul],__init__:["bpmnSearch"],bpmnSearch:["type",hw]};const gw={width:36,height:50},yw={width:50,height:50};function vw(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function bw(e,t){this._styles=t,e.registerProvider(this)}function ww(e,t){var n;return"bpmn:DataObjectReference"===t?n=gw:"bpmn:DataStoreReference"===t&&(n=yw),e.width===n.width&&e.height===n.height}bw.$inject=["outline","styles"],bw.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!mn(e))return _r(e,"bpmn:Gateway")?(I((n=De("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Or(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=De("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):_r(e,"bpmn:EndEvent")?Oe(n=De("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):_r(e,"bpmn:Event")?Oe(n=De("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):_r(e,"bpmn:DataObjectReference")&&ww(e,"bpmn:DataObjectReference")?n=vw("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):_r(e,"bpmn:DataStoreReference")&&ww(e,"bpmn:DataStoreReference")&&(n=vw("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},bw.prototype.updateOutline=function(e,t){if(!mn(e))return Or(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Or(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var xw={__depends__:[sb],__init__:["outlineProvider"],outlineProvider:["type",bw]};function Ew(e){Fr.call(this,e)}e(Ew,Fr),Ew.Viewer=Ds,Ew.NavigatedViewer=ha,Ew.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>')},Ew.prototype._interactionModules=[Ys,sa,da],Ew.prototype._modelingModules=[Jl,gc,Mc,xc,Ap,$p,Ip,Uy,Om,dm,Zy,rv,bv,xv,_v,Mv,Xv,dy,ib,fb,jb,zb,Fv,cw,fw,xw],Ew.prototype._modules=[].concat(Ds.prototype._modules,Ew.prototype._interactionModules,Ew.prototype._modelingModules);var _w=new $o,Ow={min:.2,max:4};function Pw(e,t,n,i,r){var o=this;function s(e){o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Sw(kw({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function a(e){return function(t){var n=$w(t);o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var r=kw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=i.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(r,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};I(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),le.bind(document,"mousemove",l),le.bind(document,"mouseup",c)}}function l(e){var t=$w(e);if(o._state.isDragging){o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;I(o._viewportDom.style,{top:t.y-n.y-r.top+"px",left:t.x-n.x-r.left+"px"});var s=Rw(r,{top:t.y-n.y-r.top,left:t.x-n.x-r.left,width:i.width,height:i.height});I(o._overlay.style,{clipPath:s});var a=kw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=$w(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),I(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),le.unbind(document,"mousemove",l),le.unbind(document,"mouseup",c))}this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=_w.next(),this._init(),this.toggle(e&&e.open||!1),le.bind(this._viewportDom,"mousedown",a(!1)),le.bind(this._svg,"mousedown",a(!0)),le.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,r=0===e.deltaMode?.02:.32,s=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Mw(e.deltaY)*-r;if(o._state.zoomDelta+=s,Math.abs(o._state.zoomDelta)>.1){var a=s>0?1:-1,l=Math.log(i.zoom())/Math.log(10),c=function(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(i))/t}(Ow,20),p=Math.round(l/c)*c;p+=c*a;var u=Math.pow(10,p);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ow,u),d),o._state.zoomDelta=0;var d=kw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sw(d,o._canvas),o._update()}}})),le.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function kw(e,t,n){var i=t.getBoundingClientRect(),r=function(e,t){var n=e.width/e.height,i=I({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t);I(i,{y:i.y-(r-i.height)/2,height:r})}else if(n<t){var o=i.height*t;I(i,{x:i.x-(o-i.width)/2,width:o})}return i}(n,i.width/i.height);return{x:Cw(e.x,0,i.width,r.x,r.x+r.width),y:Cw(e.y,0,i.height,r.y,r.y+r.height)}}function Sw(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function Cw(e,t,n,i,r){return(e-t)*(r-i)/(n-t)+i}function Aw(e,t,n){var i=function(e){var t=ye(".children",e);t||we(e,t=De("g",{class:"children"}));return t}(t),r=[].slice.call(i.childNodes)[n];r?t.insertBefore(e,r.nextSibling):t.appendChild(e)}function Tw(e){return 0===e.width&&0===e.height}Pw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Pw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");Y(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");Y(n).add("toggle"),t.appendChild(n);var i=this._map=document.createElement("div");Y(i).add("map"),t.appendChild(i);var r=this._svg=De("svg");Oe(r,{width:"100%",height:"100%"}),we(i,r),we(r,this._elementsGroup=De("g"));var o=this._viewportGroup=De("g");we(r,o);var s=this._viewport=De("rect");ke(s).add("viewport"),we(o,s),le.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");Y(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");Y(l).add("overlay"),this._parent.appendChild(l)},Pw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Nw(e)){var i,r,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(i=t.x-a/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-l/2,s=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,s=t.height),i-=50,r-=50,o+=100,s+=100,this._lastViewbox={x:i,y:r,width:o,height:s},Oe(this._svg,{viewBox:i+", "+r+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};I(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Rw(c,u);I(this._overlay.style,{clipPath:d})}},Pw.prototype.open=function(){I(this._state,{isOpen:!0}),Y(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Pw.prototype.close=function(){I(this._state,{isOpen:!1}),Y(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Pw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Pw.prototype.isOpen=function(){return this._state.isOpen},Pw.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Pw.prototype._updateElementId=function(e,t){try{var n=ye("#"+Qo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Pw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Pw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,i,r,o=this._createElement(e),s=ye("#"+Qo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ye(".djs-children",t.parentNode);if(!n)return;var i=[].slice.call(n.childNodes),r=-1;return i.forEach((function(t,n){ye(".djs-element",t)===e&&(r=n)})),r}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Aw(o,s,a):Aw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(i=e.x,r=e.y,s&&(i-=(n=e.parent).x,r-=n.y),Oe(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),Oe(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Pw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&He(t)},Pw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Xn(n))){var i=function(e){return ve("[id]",e).forEach((function(e){e.remove()})),e}(Ae(t));return Oe(i,{id:this._prefixId(e.id)}),i}},Pw.prototype._clear=function(){Ce(this._elementsGroup)},Pw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Mw=Math.sign||function(e){return e>=0?1:-1};function Rw(e,t){return"polygon("+[Dw(t.left,t.top),Dw(t.left+t.width,t.top),Dw(t.left+t.width,t.top+t.height),Dw(t.left,t.top+t.height),Dw(t.left,e.height),Dw(e.width,e.height),Dw(e.width,0),Dw(0,0),Dw(0,e.height),Dw(t.left,e.height)].join(", ")+")"}function Dw(e,t){return e+"px "+t+"px"}function Nw(e){return x(e,(function(e){return p(e)?Nw(e):u(e)&&isFinite(e)}))}function $w(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Bw={__init__:["minimap"],minimap:["type",Pw]},Iw=1e5,Lw=1e5;function jw(e,t){this._canvas=e;var n=this;t.on("diagram.init",(function(){n._init(),n.toggle(!0)})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}jw.prototype._init=function(){var e=ye("defs",this._canvas._svg);e||(e=De("defs"),we(this._canvas._svg,e));var t=this._pattern=De("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:sv,height:sv,patternUnits:"userSpaceOnUse"});var i=this._circle=De("circle");Oe(i,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),we(t,i),we(e,t),Oe(this._gfx=De("rect"),{x:-Iw/2,y:-Lw/2,width:Iw,height:Lw,fill:`url(#${n})`})},jw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=wn(e);Oe(this._gfx,{x:-Iw/2+av(t.x,sv),y:-Lw/2+av(t.y,sv)})},jw.prototype.isVisible=function(){return this._visible},jw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?we(t,this._gfx):Ce(t),this._visible=e}},jw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},jw.$inject=["canvas","eventBus"];var qw={__init__:["grid"],grid:["type",jw]};function zw(e,t){var n,i,r=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;we(t.getLayer("djs-origin",-1),n=Hw("g",{"pointer-events":"none"})),!1!==e.showBorder&&we(n,Hw("path",{class:Vw("border"),d:Fw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:r,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),we(n,Hw("path",{d:Fw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Vw("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(i=Hw("text",{x:-40,y:-10,fill:o,class:Vw("label")})).textContent="(0, 0)",we(n,i)}function Fw(e){return e.join(" ")}function Vw(e){return"djs-origin-"+e}function Hw(e,t){var n=De(e);return Oe(n,t),n}zw.$inject=["config.origin","canvas"];var Uw={__init__:[zw]},Ww={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Gw(e,t,n,i,r,o){function s(e,n){var i=n.offset,r=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+i[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<r?0:s})),o}function a(){var t=r.viewbox().inner,n=r.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||i.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,i=r.viewbox().scale;r.scroll({dx:e*n.x*i,dy:e*n.y*i})}))}}var c,p,d;e=function(e){var t=I({},Ww,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),i.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Gw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Qw={__init__:["alignToOrigin"],alignToOrigin:["type",Gw]};function Xw(e){function t(e){if(!e.labelTarget){var t=Pr(e);_r(t,"bpmn:Participant")&&(t=t.processRef),_r(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}Xw.$inject=["eventBus"];var Kw,Yw,Zw,Jw,ex,tx,nx,ix,rx={__init__:[Xw]},ox={},sx=[],ax=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,lx=Array.isArray;function cx(e,t){for(var n in t)e[n]=t[n];return e}function px(e){var t=e.parentNode;t&&t.removeChild(e)}function ux(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?Kw.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 dx(e,s,i,r,null)}function dx(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,constructor:void 0,__v:null==r?++Zw:r,__i:-1,__u:0};return null==r&&null!=Yw.vnode&&Yw.vnode(o),o}function hx(e){return e.children}function mx(e,t){this.props=e,this.context=t}function fx(e,t){if(null==t)return e.__?fx(e.__,e.__i+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?fx(e):null}function gx(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 gx(e)}}function yx(e){(!e.__d&&(e.__d=!0)&&Jw.push(e)&&!vx.__r++||ex!==Yw.debounceRendering)&&((ex=Yw.debounceRendering)||tx)(vx)}function vx(){var e,t,n,i,r,o,s,a,l;for(Jw.sort(nx);e=Jw.shift();)e.__d&&(t=Jw.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=cx({},r)).__v=r.__v+1,Yw.vnode&&Yw.vnode(i),Sx(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?fx(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Cx(a,i,l),i.__e!=o&&gx(i)),Jw.length>t&&Jw.sort(nx));vx.__r=0}function bx(e,t,n,i,r,o,s,a,l,c,p){var u,d,h,m,f,g=i&&i.__k||sx,y=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?dx(null,r,null,null,r):lx(r)?dx(hx,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?dx(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=Ex(r,n,s=i+u,p),r.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==i+u&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=fx(o)),Tx(o,o,!1),n[i]=null,p--);if(p)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=fx(o)),Tx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?ox:g[h.__i]||ox,h.__i=u,Sx(e,h,d,r,o,s,a,l,c,p),m=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Ax(d.ref,null,h),p.push(h.ref,h.__c||m,h)),null==f&&null!=m&&(f=m),65536&h.__u||d.__k===h.__k?l=wx(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:m&&(l=m.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=f}function wx(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=wx(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function xx(e,t){return t=t||[],null==e||"boolean"==typeof e||(lx(e)?e.some((function(e){xx(e,t)})):t.push(e)),t}function Ex(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function _x(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||ax.test(t)?n:n+"px"}function Ox(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||_x(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||_x(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?kx:Px,o)):e.removeEventListener(t,o?kx:Px,o);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Px(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Yw.event?Yw.event(e):e)}function kx(e){return this.l[e.type+!0](Yw.event?Yw.event(e):e)}function Sx(e,t,n,i,r,o,s,a,l,c){var p,u,d,h,m,f,g,y,v,b,w,x,E,_,O,P=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=Yw.__b)&&p(t);e:if("function"==typeof P)try{if(y=t.props,v=(p=P.contextType)&&i[p.__c],b=p?v?v.props.value:p.__:i,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in P&&P.prototype.render?t.__c=u=new P(y,b):(t.__c=u=new mx(y,b),u.constructor=P,u.render=Mx),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=i,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=P.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=cx({},u.__s)),cx(u.__s,P.getDerivedStateFromProps(y,u.__s))),h=u.props,m=u.state,u.__v=t,d)null==P.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==P.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,m,f)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=Yw.__r,E=0,"prototype"in P&&P.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),_=0;_<u._sb.length;_++)u.__h.push(u._sb[_]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++E<25);u.state=u.__s,null!=u.getChildContext&&(i=cx(cx({},i),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(f=u.getSnapshotBeforeUpdate(h,m)),bx(e,lx(O=null!=p&&p.type===hx&&null==p.key?p.props.children:p)?O:[O],t,n,i,r,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),Yw.__e(e,t,n)}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,l){var c,p,u,d,h,m,f,g=n.props,y=t.props,v=t.type;if("svg"===v&&(r=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=r?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&Kw.call(e.childNodes),g=n.props||ox,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Ox(e,c,null,h,r));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?m=h:"checked"==c?f=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Ox(e,c,h,g[c],r);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),bx(e,lx(d)?d:[d],t,n,i,r&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&fx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&px(o[c]);a||(c="value",void 0!==m&&(m!==e[c]||"progress"===v&&!m||"option"===v&&m!==g[c])&&Ox(e,c,m,g[c],!1),c="checked",void 0!==f&&f!==e[c]&&Ox(e,c,f,g[c],!1))}return e}(n.__e,t,n,i,r,o,s,l,c);(p=Yw.diffed)&&p(t)}function Cx(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Ax(n[i],n[++i],n[++i]);Yw.__c&&Yw.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Yw.__e(e,t.__v)}}))}function Ax(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Yw.__e(e,n)}}function Tx(e,t,n){var i,r;if(Yw.unmount&&Yw.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Ax(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Yw.__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]&&Tx(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||px(e.__e),e.__=e.__e=e.__d=void 0}function Mx(e,t,n){return this.constructor(e,n)}function Rx(e,t,n){var i,r,o,s;Yw.__&&Yw.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Sx(t,e=(!i&&n||t).__k=ux(hx,null,[e]),r||ox,ox,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Kw.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Cx(o,e,s)}function Dx(e,t){var n={__c:t="__cC"+ix++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,yx(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}Kw=sx.slice,Yw={__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}},Zw=0,mx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=cx({},this.state),"function"==typeof e&&(e=e(cx({},n),this.props)),e&&cx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),yx(this))},mx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yx(this))},mx.prototype.render=hx,Jw=[],tx="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nx=function(e,t){return e.__v.__b-t.__v.__b},vx.__r=0,ix=0;var Nx,$x,Bx,Ix,Lx=0,jx=[],qx=[],zx=Yw.__b,Fx=Yw.__r,Vx=Yw.diffed,Hx=Yw.__c,Ux=Yw.unmount;function Wx(e,t){Yw.__h&&Yw.__h($x,e,Lx||t),Lx=0;var n=$x.__H||($x.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:qx}),n.__[e]}function Gx(e){return Lx=1,Qx(aE,e)}function Qx(e,t,n){var i=Wx(Nx++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):aE(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=$x,!$x.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.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)&&(!o||o.call(this,e,t,n))};$x.u=!0;var o=$x.shouldComponentUpdate,s=$x.componentWillUpdate;$x.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},$x.shouldComponentUpdate=r}return i.__N||i.__}function Xx(e,t){var n=Wx(Nx++,3);!Yw.__s&&sE(n.__H,t)&&(n.__=e,n.i=t,$x.__H.__h.push(n))}function Kx(e,t){var n=Wx(Nx++,4);!Yw.__s&&sE(n.__H,t)&&(n.__=e,n.i=t,$x.__h.push(n))}function Yx(e){return Lx=5,Zx((function(){return{current:e}}),[])}function Zx(e,t){var n=Wx(Nx++,7);return sE(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jx(e,t){return Lx=8,Zx((function(){return e}),t)}function eE(e){var t=$x.context[e.__c],n=Wx(Nx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub($x)),t.props.value):e.__}function tE(){for(var e;e=jx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(rE),e.__H.__h.forEach(oE),e.__H.__h=[]}catch(t){e.__H.__h=[],Yw.__e(t,e.__v)}}Yw.__b=function(e){$x=null,zx&&zx(e)},Yw.__r=function(e){Fx&&Fx(e),Nx=0;var t=($x=e.__c).__H;t&&(Bx===$x?(t.__h=[],$x.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=qx,e.__N=e.i=void 0}))):(t.__h.forEach(rE),t.__h.forEach(oE),t.__h=[],Nx=0)),Bx=$x},Yw.diffed=function(e){Vx&&Vx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==jx.push(t)&&Ix===Yw.requestAnimationFrame||((Ix=Yw.requestAnimationFrame)||iE)(tE)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==qx&&(e.__=e.__V),e.i=void 0,e.__V=qx}))),Bx=$x=null},Yw.__c=function(e,t){t.some((function(e){try{e.__h.forEach(rE),e.__h=e.__h.filter((function(e){return!e.__||oE(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Yw.__e(n,e.__v)}})),Hx&&Hx(e,t)},Yw.unmount=function(e){Ux&&Ux(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{rE(e)}catch(e){t=e}})),n.__H=void 0,t&&Yw.__e(t,n.__v))};var nE="function"==typeof requestAnimationFrame;function iE(e){var t,n=function(){clearTimeout(i),nE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);nE&&(t=requestAnimationFrame(n))}function rE(e){var t=$x,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),$x=t}function oE(e){var t=$x;e.__c=e.__(),$x=t}function sE(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function aE(e,t){return"function"==typeof t?t(e):t}function lE(e,t){for(var n in t)e[n]=t[n];return e}function cE(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function pE(e){this.props=e}(pE.prototype=new mx).isPureReactComponent=!0,pE.prototype.shouldComponentUpdate=function(e,t){return cE(this.props,e)||cE(this.state,t)};var uE=Yw.__b;Yw.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),uE&&uE(e)};var dE="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function hE(e){function t(t){var n=lE({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=dE,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var mE=Yw.__e;Yw.__e=function(e,t,n,i){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);mE(e,t,n,i)};var fE=Yw.unmount;function gE(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=lE({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return gE(e,t,n)}))),e}function yE(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return yE(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function vE(){this.__u=0,this.t=null,this.__b=null}function bE(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function wE(){this.u=null,this.o=null}Yw.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),fE&&fE(e)},(vE.prototype=new mx).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var r=bE(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=yE(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},vE.prototype.componentWillUnmount=function(){this.t=[]},vE.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=gE(this.__b,n,i.__O=i.__P)}this.__b=null}var r=t.__a&&ux(hx,null,e.fallback);return r&&(r.__u&=-33),[ux(hx,null,t.__a?null:e.children),r]};var xE=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function EE(e){return this.getChildContext=function(){return e.context},e.children}function _E(e){var t=this,n=e.i;t.componentWillUnmount=function(){Rx(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),Rx(ux(EE,{context:t.context},e.__v),t.l)}function OE(e,t){var n=ux(_E,{__v:e,i:t});return n.containerInfo=t,n}(wE.prototype=new mx).__a=function(e){var t=this,n=bE(t.__v),i=t.o.get(e);return i[0]++,function(r){var o=function(){t.props.revealOrder?(i.push(r),xE(t,e,i)):r()};n?n(o):o()}},wE.prototype.render=function(e){this.u=null,this.o=new Map;var t=xx(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},wE.prototype.componentDidUpdate=wE.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){xE(e,n,t)}))};var PE="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,kE=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,SE=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,CE=/[A-Z0-9]/g,AE="undefined"!=typeof document,TE=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};mx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(mx.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var ME=Yw.event;function RE(){}function DE(){return this.cancelBubble}function NE(){return this.defaultPrevented}Yw.event=function(e){return ME&&(e=ME(e)),e.persist=RE,e.isPropagationStopped=DE,e.isDefaultPrevented=NE,e.nativeEvent=e};var $E={enumerable:!1,configurable:!0,get:function(){return this.class}},BE=Yw.vnode;Yw.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var r in t){var o=t[r];if(!("value"===r&&"defaultValue"in t&&null==o||AE&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===o?o="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||TE(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":SE.test(r)?r=s:-1===n.indexOf("-")&&kE.test(r)?r=r.replace(CE,"-$&").toLowerCase():null===o&&(o=void 0):s=r="oninput","oninput"===s&&i[r=s]&&(r="oninputCapture"),i[r]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=xx(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=xx(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",$E)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=PE,BE&&BE(e)};var IE=Yw.__r;Yw.__r=function(e){IE&&IE(e),e.__c};var LE=Yw.diffed;Yw.diffed=function(e){LE&&LE(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),null};var jE=ux,qE=0;function zE(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--qE,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Yw.vnode&&Yw.vnode(c),c}function FE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var VE,HE={exports:{}};
171
+ `,this._current.container)},ql.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()},ql.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()},ql.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)}},ql.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},ql.prototype.reset=function(){const e=this._current.container;nl(null,e),be(e)},ql.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},ql.prototype._onOpened=function(){this._emit("opened")},ql.prototype._onClosed=function(){this._emit("closed")},ql.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=fe(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},ql.prototype._bindAutoClose=function(){this._eventBus.once(jl,this.close,this)},ql.prototype._unbindAutoClose=function(){this._eventBus.off(jl,this.close,this)},ql.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},ql.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}},ql.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},ql.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},ql.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},ql.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},ql.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},ql.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},ql.prototype.isOpen=function(){return!!this._current},ql.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(ee(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)},ql.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 Ul={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:r}=n.reduce(((n,i)=>{const r=e[i],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(Hl),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[r]=a,o=a.index,s=a.index+r.length,c=0===o,p=s===e.length,u=!!a.groups.all,d=c||/\s/.test(e.charAt(o-1)),h=p||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:r,index:a.index,match:!0,wordStart:d,wordEnd:h,start:c,end:p,all:u});const m=u?t:[r];for(const e of m)i[e.toLowerCase()]=!0;l=a.index+r.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:i}}(r,t);return{tokens:{...n.tokens,[i]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return r}(e,r,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=zl(t.tokens[i],n.tokens[i]);if(0!==e)return e;const r=Vl(t.item[i],n.item[i]);if(0!==r)return r}return 0}}(i))}]},Wl={__depends__:[Ul],__init__:["popupMenu"],popupMenu:["type",ql]},Gl={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 Ql(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ql.$inject=["contextPad","popupMenu","translate","canvas"],Ql.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Ql.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ql.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Gl.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)}}}}},Ql.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Xl=["left","center","right","top","middle","bottom"];function Kl(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Yl(e){Ho.call(this,e),this.init()}function Zl(e){Yl.call(this,e)}Kl.$inject=["popupMenu","alignElements","translate","rules"],Kl.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Kl.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return v(Xl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Gl[o],action:function(){t.trigger(e,o),i.close()}}})),r},Yl.$inject=["eventBus"],e(Yl,Ho),Yl.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)}))},Yl.prototype.init=function(){},Zl.$inject=["eventBus"],e(Zl,Yl),Zl.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=dt(t)).length<2)&&t}))};var Jl={__depends__:[ba,Ta,Wl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ql],alignElementsMenuProvider:["type",Kl],bpmnAlignElements:["type",Zl]},ec=10,tc=50,nc=250;function ic(e,t,n,i){for(var r;r=oc(e,n,t);)n=i(t,n,r);return n}function rc(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 oc(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=sc(e);e.host&&(t=t.concat(sc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(sc(t))}),[])));return t}(e);return f(r,(function(e){return e!==n&&"intersect"===xn(e,i,ec)}))}function sc(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 ac(){return!0}function lc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||tc,r=wn(e),o=yn(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 cc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}lc.$inject=["eventBus","modeling","canvas"],cc.$inject=["eventBus","selection"];var pc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lc],autoPlaceSelectionBehavior:["type",cc]};function uc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Or(e,t))return e;return null}function dc(e,t){var n=uc(e,"bpmn:Process");if(n)return!0;var i,r=["bpmn:Participant","bpmn:Lane"];if(n=uc(e,r))return Hr(n);if(Or(e,r))return Hr(e);for(i=Pr(e);i&&!_r(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find((function(e){var t=Pr(e);return t&&t.get("processRef")===i}));return!o||Hr(o)}function hc(e,t,n){var i=dc(e,n);return _r(t,"bpmn:TextAnnotation")?function(e,t,n){var i=yn(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};hn(e)&&(r=wn(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return ic(e,t,r,rc(s))}(e,t,i):Or(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var i=yn(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return ic(e,t,r,rc(s))}(e,t,i):_r(t,"bpmn:FlowNode")?function(e,t,n){var i=yn(e),r=wn(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},s=function(e,t){t||(t={});var n=t.defaultDistance||tc,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||nc,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?yn(e).top-yn(t).bottom:"center"===a?yn(e).top-wn(t).y:yn(e).top-yn(t).top:"w"===i?"start"===a?yn(e).left-yn(t).right:"center"===a?yn(e).left-wn(t).x:yn(e).left-yn(t).left:"s"===i?"start"===a?yn(t).top-yn(e).bottom:"center"===a?wn(t).y-yn(e).bottom:yn(t).bottom-yn(e).bottom:"start"===a?yn(t).left-yn(e).right:"center"===a?wn(t).x-yn(e).right:yn(t).right-yn(e).right}r||(r=ac);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 _r(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;_r(e,"bpmn:BoundaryEvent")&&-1!==(c=xn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:i.right+s+t.width/2,y:r.y+mc(c,l,o)}:{x:r.x+mc(c,l,o),y:i.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return ic(e,t,p,rc(d))}(e,t,i):void 0}function mc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function fc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return hc(e.source,n,t)}))}fc.$inject=["eventBus","elementRegistry"];var gc={__depends__:[pc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fc]};function yc(e,t,n,r){Ho.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 vc(e){e.invoke(yc,this)}function bc(e){Yl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function wc(e,t){bc.call(this,e),this._modeling=t}yc.$inject=["eventBus","elementRegistry","modeling","rules"],e(yc,Ho),yc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=yn(yt(e)),o=yn(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),vn(I({},o,s))},yc.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=yn(e),t=yn(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}(j(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},yc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},yc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},yc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},vc.$inject=["injector"],e(vc,yc),vc.prototype.resize=function(e,t,n){_r(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},bc.$inject=["eventBus"],e(bc,Yl),bc.prototype.canResize=function(e,t){return!1},e(wc,bc),wc.$inject=["eventBus","modeling"],wc.prototype.canResize=function(e,t){if(_r(t.di,"bpmndi:BPMNPlane"))return!1;if(!_r(t,"bpmn:Participant")&&!_r(t,"bpmn:Lane")&&!_r(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(_r(e,"bpmn:Lane")||mn(e))&&(n=!1)})),n};var xc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",vc],bpmnAutoResizeProvider:["type",wc]};function Ec(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=gs(e),function(e){return ee(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Ec.$inject=["elementRegistry","eventBus","injector"];var _c={__init__:["hoverFix"],hoverFix:["type",Ec]},Oc=Math.round,Pc="djs-drag-active";function kc(e){e.preventDefault()}function Sc(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=gs(e),d=ra(u,p),h=r.localStart,m=s(u),g=ra(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:Oc(h.x+c.x),y:Oc(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&&Js(r.cursor),t.addMarker(t.getRootElement(),Pc)}fs(e),r.active&&(I(l,{x:Oc(m.x+c.x),y:Oc(m.y+c.y),dx:Oc(g.x),dy:Oc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,fs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){js("Escape",e)&&(kc(e),f())}function u(t){var n;r.active&&(n=na(e),setTimeout(n,400),kc(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"),ea(),g=r.trapClick?u:c,le.unbind(document,"mousemove",l),le.unbind(document,"dragstart",kc),le.unbind(document,"selectstart",kc),le.unbind(document,"mousedown",g,!0),le.unbind(document,"mouseup",g,!0),le.unbind(document,"keyup",p),le.unbind(document,"touchstart",d,!0),le.unbind(document,"touchcancel",f,!0),le.unbind(document,"touchmove",l,!0),le.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Pc);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,E=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=ms(t)||t,v=gs(t),fs(t),"dragstart"===y.type&&kc(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:E,payload:{},globalStart:v,displacement:ra(n,b),localStart:b,isTouch:x},g),g.manual||(x?(le.bind(document,"touchstart",d,!0),le.bind(document,"touchcancel",f,!0),le.bind(document,"touchmove",l,!0),le.bind(document,"touchend",c,!0)):(le.bind(document,"mousemove",l),le.bind(document,"dragstart",kc),le.bind(document,"selectstart",kc),le.bind(document,"mousedown",w,!0),le.bind(document,"mouseup",w,!0)),le.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)}}Sc.$inject=["eventBus","canvas","selection","elementRegistry"];var Cc={__depends__:[_c,Rs],dragging:["type",Sc]};function Ac(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 Tc(e,t,n){return t<e&&e<n}Ac.$inject=["config.autoScroll","eventBus","canvas"],Ac.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++)Tc(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))},Ac.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ac.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Ac.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=gs(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Mc={__depends__:[Cc],__init__:["autoScroll"],autoScroll:["type",Ac]};function Rc(e){this._commandStack=e.get("commandStack",!1)}Rc.$inject=["injector"],Rc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Dc={__init__:["rules"],rules:["type",Rc]},Nc=Math.round,$c=Math.max;var Bc=10;function Ic(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(St(i,t)<=Bc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=sn(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,Bc),(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=$c(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Nc(o.x+s.x)/2,y:Nc(o.y+s.y)/2},index:o.segment2}:{point:{x:Nc(o.x),y:Nc(o.y)},index:o.segment2}:null}(e,t)}function Lc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qc(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 zc(e,t){var n=qc(e,t);return Lc({x:n.x-e.x,y:n.y-e.y})}function Fc(e,t){return Lc({x:e.x-t.x,y:e.y-t.y})}var Vc="djs-bendpoint",Hc="djs-segment-dragger";function Uc(e,t,n){var i=function(e,t){var n,i=gs(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 Ic(t,i)}function Wc(e,t){var n=De("g");ke(n).add(Vc),we(e,n);var i=De("circle");Oe(i,{cx:0,cy:0,r:4}),ke(i).add("djs-visual"),we(n,i);var r=De("circle");return Oe(r,{cx:0,cy:0,r:10}),ke(r).add("djs-hit"),we(n,r),t&&ke(n).add(t),n}function Gc(e,t,n,i){var r=De("g");we(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Xc("h"===n?i:r)}(t,n,i),s=De("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),ke(s).add("djs-visual"),we(r,s);var a=De("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),ke(a).add("djs-hit"),we(r,a),Zn(r,"v"===i?90:0),r}function Qc(e,t,n){var i=De("g"),r=Dt(t,n),o=Tt(t,n);return we(e,i),Gc(i,t,n,o),ke(i).add(Hc),ke(i).add("h"===o?"horizontal":"vertical"),Yn(i,r.x,r.y),i}function Xc(e){return Math.abs(Math.round(2*e/3))}function Kc(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=zc(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return qc(e,n)}function Yc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=Uc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Tt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Xc("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=Dt(i=t[c-1],r=t[c]),s=Tt(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){le.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="'+Qo(e.id)+'"]',i);return!r&&n&&(Oe(r=De("g"),{"data-element-id":e.id}),ke(r).add("djs-bendpoints"),we(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=Wc(e);we(e,i),Yn(i,t.x,t.y)})),Wc(e,"floating")}function p(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Tt(n=o[a-1],i=o[a])&&(Oe(r=Qc(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("."+Hc,e),(function(e){He(e)}))}(t),function(e){v(ve("."+Vc,e),(function(e){He(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=Dt(s,a),u=Tt(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}),Yn(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&&He(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?ke(t).add(e.marker):ke(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=Uc(t,o,e.originalEvent)))return;!function(e,t){var n=ye(".floating",e),i=t.point;n&&Yn(n,i.x,i.y)}(n,i),i.bendpoint||h(n,i,o)}})),e.on("element.mousedown",(function(e){if(bs(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&&Oe(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}Yc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Zc=Math.round,Jc="reconnectStart",ep="reconnectEnd",tp="updateWaypoints";function np(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?tp:ep:Jc)===tp?"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===tp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Jc?a:o,target:l===ep?a:s}))return n.source=l===Jc?a:o,void(n.target=l===ep?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===ep?a:s,target:l===Jc?a:o})),t&&(n.source=l===ep?a:s,n.target=l===Jc?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!==tp&&(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:Zc(e.x),y:Zc(e.y)};if(!n)return!1;p===tp?(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===St(t,i=e[r+1])||Ct(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(p===Jc?(u.docking="source",ip(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===ep&&(u.docking="target",ip(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,d,u))}),this)}function ip(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Jc?t&&i&&t===i&&n!==i:r===ep?t&&n&&t===n&&n!==i:void 0}np.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],np.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 rp="updateWaypoints",op="connect-ok",sp="connect-not-ok",ap="connect-hover",lp="djs-updating",cp="djs-dragging";function pp(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,ke(t.draggerGfx=Wc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,cp),i.addMarker(r,lp)})),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,ap),o===rp)return;n?(i.removeMarker(r,sp),i.addMarker(r,op)):!1===n&&(i.removeMarker(r,op),i.addMarker(r,sp))}})),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,ap),i.removeMarker(n,r?op:sp))})),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?ip(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?ip(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===rp&&(d=e.cropWaypoints(c,d)),f.waypoints=d,r.drawPreview(n,i,f)),Yn(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,He(o),i.removeMarker(n,lp),i.removeMarker(n,cp),s&&(i.removeMarker(s,op),i.removeMarker(s,a?op:sp)),r&&r.cleanUp(t)}))}pp.$inject=["bendpointMove","injector","eventBus","canvas"];var up="connect-hover",dp="djs-updating";function hp(e,t,n){return mp(e,t,e[t]+n)}function mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function fp(e){return"x"===e?"y":"x"}function gp(e,t,n){var i,r;return e.original?e.original:(i=wn(t),mp(e,r=fp(n),i[r]))}function yp(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 mp(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],fp(e.axis));Yn(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=Uc(n,d,e);(s=Tt(h,m))&&(a="v"===s?"x":"y",0===p&&(h=gp(h,t.source,a)),u===d.length-1&&(m=gp(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=Qc(r,t.segmentStart,t.segmentEnd),ke(t.draggerGfx).add("djs-dragging"),n.addMarker(i,dp)})),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=hp(p,d,e["d"+d]),f=hp(u,d,e["d"+d]),g=h.length,y=0;h[o]=m,h[s]=f,o<2&&(t=xn(r.source,m),1===o?"intersect"===t&&(h.shift(),h[0]=m,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=xn(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,up)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,up)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&He(t.draggerGfx),n.removeMarker(i,dp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,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!Ct(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)}))}yp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var vp=Math.abs,bp=Math.round;function wp(e){return{x:e.x,y:e.y}}function xp(e){return{x:e.x+e.width,y:e.y+e.height}}function Ep(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:bp(e.x+e.width/2),y:bp(e.y+e.height/2)}}function _p(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Op(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var 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 Pp(e){return e.children||[]}var kp=Math.abs,Sp=Math.round;function Cp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(kp(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?Kc(t,e):e.width?{x:Sp(e.width/2+e.x),y:Sp(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))&&Op(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&Op(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);hn(t)&&i&&i.x&&i.y&&(Op(e,"x",i.x),Op(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))&&Op(e,"x",i),(d||-1!==s.horizontal.indexOf(p))&&Op(e,"y",r)}}))}Cp.$inject=["eventBus"];var Ap={__depends__:[Cc,Dc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Yc],bendpointMove:["type",np],bendpointMovePreview:["type",pp],connectionSegmentMove:["type",yp],bendpointSnapping:["type",Cp]};function Tp(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:Mp(t)?o:r,connectionEnd:Mp(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=wn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Mp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}Tp.$inject=["eventBus","dragging","modeling","rules"];var Rp="connect-ok",Dp="connect-not-ok";function Np(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;Mp(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?Rp:Dp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Rp),n.removeMarker(t,Dp))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Np.$inject=["injector","eventBus","canvas"];var $p={__depends__:[Rs,Dc,Cc],__init__:["connectPreview"],connect:["type",Tp],connectPreview:["type",Np]};function Bp(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)}Bp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Bp.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()),Ce(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?wn(s):c,a?wn(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)},Bp.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||wn(n),o=t.connectionEnd||wn(i),s=this.cropWaypoints(r,o,n,i);we(e,this.createNoopConnection(s[0],s[1]))},Bp.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]},Bp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&He(e.connectionPreviewGfx)},Bp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Bp.prototype.createConnectionPreviewGfx=function(){var e=De("g");return Oe(e,{pointerEvents:"none"}),ke(e).add("djs-dragger"),we(this._canvas.getActiveLayer(),e),e},Bp.prototype.createNoopConnection=function(e,t){return pt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Ip={__init__:["connectionPreview"],connectionPreview:["type",Bp]};const Lp=new $o("ps");var jp=["marker-start","marker-mid","marker-end"],qp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function zp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}zp.$inject=["elementRegistry","eventBus","canvas","styles"],zp.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},zp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},zp.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ae(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Xn(r),i),Oe(r,this._styles.cls(i,[],{x:o.top,y:o.left})),we(t,r),Oe(r,"data-preview-support-element-id",e.id),r},zp.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return we(t,n),Oe(n,"data-preview-support-element-id",e.id),n},zp.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==qp.indexOf(e.nodeName)}(e)&&jp.forEach((function(r){if(Oe(e,r)){var o=function(e,t,n){var i=(r=Oe(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ye("marker#"+i,n||document)}(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}}))},zp.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Lp.next()].join("-"),s=ye("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Ae(n);a.id=o,ke(a).add(r);var l=ye(":scope > defs",e);l||we(e,l=De("defs")),we(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,i,c)};var Fp={__init__:["previewSupport"],previewSupport:["type",zp]};const Vp="complex-preview";class Hp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:i=[],resized:r=[]}=e,o=this._canvas.getLayer(Vp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;hn(e)?(t=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(Xn(t),e)):(t=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(Xn(t),e),Yn(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);hn(e)?Yn(n,t.x,t.y):Yn(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",De("g"));this._graphicsFactory.drawShape(Xn(n),e,{width:t.width,height:t.height}),Yn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Ce(this._canvas.getLayer(Vp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Vp)}hide(){this._canvas.hideLayer(Vp)}}Hp.$inject=["canvas","graphicsFactory","previewSupport"];var Up={__depends__:[Fp],__init__:["complexPreview"],complexPreview:["type",Hp]},Wp=["top","bottom","left","right"],Gp=10;function Qp(e,t){function n(e){if(Yr(e)&&!hn(e)){var n=function(e){var t=wn(e.label),n=wn(e),i=Xp(n,t);if(r=i,-1===Wp.indexOf(r))return;var r;var o=function(e){var t=wn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return Xp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=wn(e),r=xn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Wp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=wn(e),r=e.label,o=wn(r);if(!r.parent)return;var s,a=yn(e);switch(n){case"top":s={x:i.x,y:a.top-Gp-r.height/2};break;case"left":s={x:a.left-Gp-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Gp+r.height/2};break;case"right":s={x:a.right+Gp+r.width/2,y:i.y}}var l=ra(s,o);t.moveShape(r,l)}(e,n)}}Ho.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 Xp(e,t){return xn(t,e,5)}function Kp(e){Ho.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(_r(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function Yp(e,t){e.invoke(Ho,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;v(y(i.incoming.concat(i.outgoing),(function(e){return _r(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Qp,Ho),Qp.$inject=["eventBus","modeling"],e(Kp,Ho),Kp.$inject=["eventBus"],e(Yp,Ho),Yp.$inject=["injector","modeling"];function Zp(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return Jp(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(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];Jp(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Jp(e,t){return!mn(e)&&Or(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function eu(e,t){function n(e){return y(e.attachers,(function(e){return _r(e,"bpmn:BoundaryEvent")}))}Ho.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);_r(i,"bpmn:EventBasedGateway")&&_r(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;_r(i,"bpmn:Gateway")&&_r(r,"bpmn:EventBasedGateway")&&v(r.outgoing,(function(e){var i=e.target,r=n(i);_r(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function tu(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}Ho.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(iu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>nu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!iu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>ru(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>_r(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;iu(r)&&ru(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>_r(e,"bpmn:Association"))),r=i.filter((e=>nu(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;iu(t)&&nu(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;nu(o)&&r(o),iu(e)&&ru(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;nu(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)):ru(i)&&function(e){const n=e.incoming.filter((e=>iu(e.source)));t.removeElements(n)}(i)}),!0)}function nu(e){const t=Pr(e);return t&&t.get("isForCompensation")}function iu(e){return e&&_r(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}function ru(e){return e&&_r(e,"bpmn:Activity")&&!Wr(e)}function ou(e){e.invoke(Ho,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;_r(n,"bpmn:Lane")&&!_r(i,"bpmn:Lane")&&(t.parent=uc(n,"bpmn:Participant"))}))}function su(e,t){Ho.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(_r(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Zp.$inject=["bpmnReplace","injector"],e(Zp,Ho),Zp.prototype._replaceShape=function(e,t){var n,i=(n=Pr(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},eu.$inject=["eventBus","modeling"],e(eu,Ho),e(tu,Ho),tu.$inject=["eventBus","modeling","bpmnRules"],ou.$inject=["injector"],e(ou,Ho),su.$inject=["eventBus","bpmnFactory"],e(su,Ho);var au=20,lu=20,cu=30,pu=2e3;function uu(e,t,n){function i(){var t=e.getRootElement();return _r(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Ho.call(this,t),t.on(["create.start","shape.move.start"],pu,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(_r(i,"bpmn:Participant")&&_r(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!_r(e,"bpmn:Group")&&!mn(e)&&!hn(e)}));if(o.length){var s=yt(o),a=function(e,t){t={width:t.width+2*au+cu,height:t.height+2*lu};var n=Math.max(e.width,t.width),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=yn(t),{bottom:t.top+e.height/2-lu,left:t.right-e.width/2+au,top:t.bottom-e.height/2+lu,right:t.left+e.width/2-au-cu}}(i,s)}}})),t.on("create.start",pu,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}_r(i,"bpmn:Participant")&&_r(r,"bpmn:Process")&&(t.on("element.hover",pu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",pu,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return f(e,(function(e){return _r(e,"bpmn:Participant")}))}(n);o&&_r(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Pr(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;_r(n,"bpmn:Participant")&&_r(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Pr(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||Pr(i).set("processRef",Pr(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||Pr(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)}uu.$inject=["canvas","eventBus","modeling"],e(uu,Ho);var du="__targetRef_placeholder";function hu(e,t){function n(e,n){var i=e.get("properties"),r=f(i,(function(e){return e.name===du}));return!r&&n&&Pt(i,r=t.create("bpmn:Property",{name:du})),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)||Ot(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}Ho.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],mu(r))}function mu(e){return function(t){if(_r(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function fu(e){this._bpmnUpdater=e}function gu(e,t,n,i){function r(e){return e.children.filter((function(e){return _r(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return _r(e,"bpmn:Participant")&&Pr(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:kr(e),newSemanticParent:o.processRef||o,newDiParent:kr(i)})}}Ho.call(this,i),t.registerHandler("dataStore.updateContainment",fu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;_r(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 _r(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!_r(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;_r(t,"bpmn:DataStoreReference")&&"label"!==t.type&&_r(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;_r(i,"bpmn:Collaboration")||_r(n,"bpmn:DataStoreReference")&&"label"!==n.type&&_r(r,"bpmn:Collaboration")&&o(n,_r(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(_r(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();Or(n,["bpmn:Participant","bpmn:SubProcess"])&&_r(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){_r(i,"bpmn:Process")&&o(e,i)}))}))}hu.$inject=["eventBus","bpmnFactory"],e(hu,Ho),fu.$inject=["bpmnUpdater"],fu.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),[]},fu.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),[]},gu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(gu,Ho);var yu=Math.max,vu=Math.min,bu=20;function wu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?vu:yu)(i,r)),u(o)&&(i=(/top|left/.test(e)?yu:vu)(i,o)),i}function Eu(e,t){return void 0!==e?e:bu}function _u(e){return!e.waypoints&&"label"!==e.type}function Ou(e,t){var n;if((n=void 0===e.length?y(e.children,_u):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=Eu(t.left),i=Eu(t.right),r=Eu(t.top),o=Eu(t.bottom)):n=i=r=o=Eu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(yt(n),t)}var Pu=Math.abs;var ku=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){_r(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Au(e){return e.children.filter((function(e){return _r(e,"bpmn:Lane")}))}function Tu(e){return uc(e,ku)||e}function Mu(e,t){var n=Tu(e),i=Cu(n,_r(n,"bpmn:Process")?[]:[n]),r=yn(e),o=yn(t),s=function(e,t){return wu(yn(t),yn(e))}(e,t),a=[],l=Hr(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=yn(t);s.top&&(Pu(h.bottom-r.top)<10&&(u=o.top-h.bottom),Pu(h.top-r.top)<5&&(c=o.top-h.top)),s.left&&(Pu(h.right-r.left)<10&&(p=o.left-h.right),Pu(h.left-r.left)<5&&(d=o.left-h.left)),s.bottom&&(Pu(h.top-r.bottom)<10&&(c=o.bottom-h.top),Pu(h.bottom-r.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Pu(h.left-r.right)<10&&(d=o.right-h.left),Pu(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 Ru(e,t){Ho.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;_r(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=Hr(e),c=Au(n),p=[],u=[],d=[],h=[];ft(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))}))}Ru.$inject=["eventBus","spaceTool"],e(Ru,Ho);function Du(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Nu(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;Nu(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Nu(e,t){return!mn(e)&&_r(e,"bpmn:BoundaryEvent")&&!t}function $u(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=Ic(m,h=u(r.width)?wn(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&&Bu(e,o[o.length-1])||o.push(Iu(a)),1!==s.length&&Bu(e,s[0])||s.unshift(Iu(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)}Ho.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=wn(o),a={x:s.x+r.x,y:s.y+r.y},l=f(n.children,(function(e){return t.canInsert(i,e)&&Ic(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 Bu(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 Iu(e){return I({},e)}function Lu(e,t){Ho.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)&&ju(i)){(_r(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&ju(e))):o.incoming.filter((e=>e!==i&&ju(e)&&_r(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;_r(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ju).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(ju).forEach((function(i){const r=e.incoming.filter(ju).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function ju(e){return _r(e,"bpmn:SequenceFlow")}Du.$inject=["bpmnReplace","injector"],e(Du,Ho),Du.prototype._replaceShape=function(e){var t,n,i=(n=Pr(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e($u,Ho),$u.$inject=["eventBus","bpmnRules","modeling"],Lu.$inject=["eventBus","modeling"],e(Lu,Ho);var qu=1500;function zu(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"],qu,(function(t){var i=t.context.shape||t.shape,r=t.hover;_r(r,"bpmn:Lane")&&!Or(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Tu(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Or(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"],qu,(function(t){var n=t.hover;_r(n,"bpmn:Lane")&&(t.hover=Tu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],qu,(function(t){var n=t.context,i=t.hover,r=n.type;_r(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Tu(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],qu,(function(e){var t=e.context,n=t.start;_r(n,"bpmn:Lane")&&(t.start=Tu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;_r(t,"bpmn:Lane")&&(e.shape=Tu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&_r(t,"bpmn:Lane")&&(e.hover=Tu(t))}))}zu.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return _r(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Pr(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(Ot(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Pr(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(Ot(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Pr(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=Pr(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(Ho,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;_r(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;_r(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Pr(n);if(_r(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(_r(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Pr(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;_r(n,"bpmn:Group")&&!n.labelTarget&&Pr(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;_r(n,"bpmn:Group")&&!n.labelTarget&&Pr(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(_r(n,"bpmn:Group")&&!n.labelTarget){var i=Pr(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 Vu(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 Hu(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=Vu(e,t,n,r),a=Vu(e,t,n,o);i=s&&a?Uu(s,n)>Uu(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],wn(n.source)),t(i[i.length-1],i[i.length-2],wn(n.target)))}))}function Uu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){Ho.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=Pr(n),r=kr(n);if(Or(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,Ho),Hu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,Ho);var Gu=Math.sqrt,Qu=Math.min,Xu=Math.max,Ku=Math.abs;function Yu(e){return Math.pow(e,2)}function Zu(e,t){return Gu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Ju(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=Gu(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 ed(e.x,t.x,n.x)&&ed(e.y,t.y,n.y)}(n,e,t)}))}function ed(e,t,n){return e>=Qu(t,n)-td&&e<=Xu(t,n)+td}var td=.1;function nd(e,t){return Ku(e.x-t.x)<=td&&Ku(e.y-t.y)<=td}function id(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(nd(n=t[m],i=t[m+1])?a=[n]:(r=Zu(e,n),o=Zu(e,i),a=Ju(n,i,e,Qu(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:nd(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:Zu(n,s)/Zu(n,i)}),c=Zu(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&&rd(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=od(n,l),h=od(t,c),m=a.position,f=function(e,t){var n=Fc(e[0],e[1]),i=Fc(e[0],t);return 0===n?0:i/n}(d,m),g=(p=h,u=jc(d),jc(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=rd(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},(E=g)?{x:Math.cos(E)*x.x-Math.sin(E)*x.y,y:Math.sin(E)*x.x+Math.cos(E)*x.y}:x);return r=_.x+O.x-e.x,o=_.y+O.y-e.y,{point:gn(_),delta:gn({x:r,y:o})}}function rd(e,t){var n=Fc(e[t-1],e[t]);return n/(n+Fc(e[t],e[t+1]))}function od(e,t){return[e[t],e[t+1]]}function sd(e,t,n){var i=ia(t),r=ia(n),o=ra(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:r.x+s,y:r.y+a})}function ad(e,t,n){var i=ia(e),r=ia(t),o=ia(n),s=ra(e,i),a=ra(i,r),l=function(e,t,n){var i=yn(t),r=yn(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=xn(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=xn(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 gn({x:u+s.x-e.x,y:d+s.y-e.y})}var ld="name",cd="text";function pd(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(ld in o&&t.updateLabel(r,o[ld]),cd in o&&_r(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[cd]||"");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 id(wn(e),t,n,i).delta}(i,o,s,r)}Ho.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Pr(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;!mn(i)&&Kr(i)&&to(i)&&t.updateLabel(i,to(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=Pr(n);r&&Kr(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(Yr(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:zc(e,t)}}));return A(n,"distance")[0].line}(e,t);return qc(e,n)}(wn(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=ud(l,s,o);t.moveShape(a,c)}}))}function ud(e,t,n){return gn(ra(sd(e,t,n),e))}function dd(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 id(e,t,n,i).point}(t,o,s,r)}Ho.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 hd(e,t,n){var i=vd(e),r=bd(i,t),o=i[0];return r.length?r[r.length-1]:sd(o.original||o,n,t)}function md(e,t,n){var i=vd(e),r=bd(i,t),o=i[i.length-1];return r.length?r[0]:sd(o.original||o,n,t)}function fd(e,t,n){var i=vd(e),r=yd(t,n),o=i[0];return sd(o.original||o,r,t)}function gd(e,t,n){var i=vd(e),r=yd(t,n),o=i[i.length-1];return sd(o.original||o,r,t)}function yd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bd(e,t){return y(_(e,wd),(function(e){return function(e,t){return"intersect"===xn(t,e,1)}(e,t)}))}function wd(e){return e.original||e}function xd(e,t){Ho.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return _r(e,"bpmn:Participant")&&Vr(e)&&_r(t,"bpmn:Participant")&&!Vr(t)}(n,i)){var r,o,s,a,l=(o=gt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){_r(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){_r(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=md(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=hd(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(pd,Ho),pd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(dd,Ho),dd.$inject=["eventBus","modeling"],xd.$inject=["eventBus","modeling"],e(xd,Ho);const Ed=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function _d(e){const t=Pr(e);if(!(_r(t,"bpmn:BoundaryEvent")||_r(t,"bpmn:StartEvent")&&Wr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Ed.some((e=>_r(n[0],e)))}function Od(e){return _r(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Pd(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!_d(i))return;const o=Od(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Pr(n).get(o);s!==Pr(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function kd(e,t){Ho.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=kr(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function Sd(e,t,n){Ho.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(_r(r,"bpmn:SequenceFlow")&&_r(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=Vu(Cd(e[e.length-2]),Cd(e[e.length-1]),Cd(t[1]),Cd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Cd(e[0]),Cd(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Cd(e){return e.original||e}function Ad(e,t){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;_r(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var i=t.makeProcess(),r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}}),!0)}function Td(e,t,n,i){Ho.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(_r(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),_r(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 Md(e,t,n,i,r,o){i.invoke(Ho,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=Wr(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})}))}Pd.$inject=["injector","modeling"],e(Pd,Ho),e(kd,Ho),kd.$inject=["eventBus","modeling"],e(Sd,Ho),Sd.$inject=["eventBus","bpmnRules","modeling"],Ad.$inject=["eventBus","modeling"],e(Ad,Ho),e(Td,Ho),Td.$inject=["eventBus","modeling","bpmnRules","injector"],e(Md,Ho),Md.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)},Md.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Rd={width:140,height:120},Dd={width:300,height:60},Nd={width:60,height:300},$d={width:300,height:150},Bd={width:150,height:300},Id={width:140,height:120},Ld={width:50,height:30};function jd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(_r(n,"bpmn:Lane")||_r(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Tu(e),r=!0,o=!0,s=Cu(i,[i]),a=yn(e),l={},c={},p=Hr(e),u=p?Dd:Nd;/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=yn(e);p?(i.top<a.top-10&&(r=!1),i.bottom>a.bottom+10&&(o=!1)):(i.left<a.left-10&&(r=!1),i.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&qd(a.top-i.bottom)<10&&Ud(l,"top",i.top+u.height),qd(a.top-i.top)<5&&Hd(c,"top",i.bottom-u.height)),/e/.test(t)&&(n&&qd(a.right-i.left)<10&&Hd(l,"right",i.right-u.width),qd(a.right-i.right)<5&&Ud(c,"right",i.left+u.width)),/s/.test(t)&&(n&&qd(a.bottom-i.top)<10&&Hd(l,"bottom",i.bottom-u.height),qd(a.bottom-i.bottom)<5&&Ud(c,"bottom",i.top+u.height)),/w/.test(t)&&(n&&qd(a.left-i.right)<10&&Ud(l,"left",i.left+u.width),qd(a.left-i.left)<5&&Hd(c,"left",i.right-u.width))}));var d=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(_r(e,"bpmn:FlowElement")||_r(e,"bpmn:Artifact"))})),h=p?Wd:Gd;return d.forEach((function(e){var n=yn(e);!/n/.test(t)||p&&!r||Hd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Ud(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Ud(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||r)&&Hd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,i,r)),_r(n,"bpmn:SubProcess")&&Vr(n)&&(t.minDimensions=Id),_r(n,"bpmn:TextAnnotation")&&(t.minDimensions=Ld)}))}jd.$inject=["eventBus"];var qd=Math.abs,zd=Math.min,Fd=Math.max;function Vd(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Hd(e,t,n){return Vd(e,t,n,zd)}function Ud(e,t,n){return Vd(e,t,n,Fd)}var Wd={top:20,left:50,right:20,bottom:20},Gd={top:50,left:20,right:20,bottom:20};function Qd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(_r(n,"bpmn:Lane")||_r(n,"bpmn:Participant"))&&(t.balanced=!ws(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(_r(i,"bpmn:Lane")||_r(i,"bpmn:Participant"))return r&&(o=fn(o),t.resizeLane(i,o,n.balanced)),!1}))}Qd.$inject=["eventBus","modeling"];function Xd(e,t,n,i,r){function o(e){return Or(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return E(t,(function(t){return Gr(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 _r(e,"bpmn:ErrorEventDefinition")?"errorRef":_r(e,"bpmn:EscalationEventDefinition")?"escalationRef":_r(e,"bpmn:MessageEventDefinition")?"messageRef":_r(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Or(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Ho,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Pr(n));i&&!s(i)&&(Pt(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Ot(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(Pr(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(Or(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)}))}Xd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xd,Ho);var Kd=Math.max;function Yd(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;_r(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=Hr(e);if(r=e,!Au(r).length)return i?$d:Bd;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?$d:{width:Jd(e,n,o),height:Bd.height}:i?{width:$d.width,height:Zd(e,n,o)}:Bd;return s}(e,n,i)),_r(e,"bpmn:Lane")&&(r[t]=Hr(e)?Dd:Nd),_r(e,"bpmn:SubProcess")&&Vr(e)&&(r[t]=Id),_r(e,"bpmn:TextAnnotation")&&(r[t]=Ld),_r(e,"bpmn:Group")&&(r[t]=Rd)})),r}))}function Zd(e,t,n){var i;return i=function(e,t,n){var i,r=Au(e);return i=eh(r,t,n),e.height-i.height+Dd.height}(e,t,n),Kd($d.height,i)}function Jd(e,t,n){var i;return i=function(e,t,n){var i,r=Au(e);return i=eh(r,t,n),e.width-i.width+Nd.width}(e,t,n),Kd(Bd.width,i)}function eh(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=Au(r)).length?eh(o,t,n):r}Yd.$inject=["eventBus"];var th=180,nh=160;function ih(e,t,n,i,r,o,s){Ho.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 _r(e,"bpmn:SubProcess")&&!Vr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Pr(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function p(t){var n=Pr(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Jo(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(Jo(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(Jo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Jo(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(_r(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ts(t))return s.updateId(t,es(r)),void s.updateId(i,r);s.get(es(i))&&s.updateId(es(i),es(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(_r(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(ts(t))return s.updateId(t,es(i)),void s.updateId(r,i);var o=s.get(es(r));o&&s.updateId(o,es(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ts(n)){var i=n,r=s.get(Zo(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;_r(t,"bpmn:SubProcess")&&(Vr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;_r(t,"bpmn:SubProcess")&&(Vr(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(_r(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vr(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=Jo(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(_r(kr(r),"bpmndi:BPMNPlane")){var o=Zo(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 rh(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(_r(i,"bpmn:SubProcess")&&!_r(i,"bpmn:AdHocSubProcess")&&(_r(n,"bpmn:Task")||_r(n,"bpmn:CallActivity"))&&Vr(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 oh(e){Ho.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;_r(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&&_r(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function sh(e,t){Ho.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vr(n)){var i=gt(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,wn(n)):t.reconnectStart(e,n,wn(n)))}}),!0)}e(ih,Ho),ih.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=yt(o);if(t.x){var a=wn(t),l=wn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:th-s.x,y:nh-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},ih.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},ih.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},ih.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:Jo(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},ih.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},ih.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],rh.$inject=["injector","modeling"],e(rh,Ho),e(oh,Ho),oh.$inject=["eventBus"],e(sh,Ho),sh.$inject=["eventBus","modeling"];function ah(e,t,n){Ho.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;_r(n,"bpmn:SubProcess")&&(n.collapsed?kr(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),kr(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?kr(t).isExpanded=!1:kr(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=Ou(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 lh(e,t,n,i){t.invoke(Ho,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;mn(t)||(_r(t,"bpmn:Participant")&&Vr(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;_r(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function ch(e,t){Ho.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!_r(e,"bpmn:SequenceFlow"))return!1;var n=Pr(t),i=Pr(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(ah,Ho),ah.$inject=["eventBus","elementFactory","modeling"],e(lh,Ho),lh.$inject=["canvas","injector","moddle","modeling"],e(ch,Ho),ch.$inject=["eventBus","modeling"];function ph(e,t){var n;function i(){if(!n)throw new Error("out of bounds release");return n}Ho.call(this,e);var r=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(r,5e3,(function(e){(n=n||new uh).enter()})),this.postExecuted(r,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=i();t.labelTarget||(_r(t,"bpmn:Lane")&&n.addLane(t),_r(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function uh(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function dh(e,t){Ho.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)hh(e)&&!mh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function hh(e){const t=Pr(e);return t&&t.isForCompensation}function mh(e){return e.incoming.filter((e=>function(e){return e&&_r(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}ph.$inject=["eventBus","modeling"],e(ph,Ho),e(dh,Ho),dh.$inject=["eventBus","modeling"];var fh={__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","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Qp],appendBehavior:["type",Kp],associationBehavior:["type",Yp],attachEventBehavior:["type",Zp],boundaryEventBehavior:["type",eu],compensateBoundaryEventBehaviour:["type",tu],createBehavior:["type",ou],createDataObjectBehavior:["type",su],createParticipantBehavior:["type",uu],dataInputAssociationBehavior:["type",hu],dataStoreBehavior:["type",gu],deleteLaneBehavior:["type",Ru],detachEventBehavior:["type",Du],dropOnFlowBehavior:["type",$u],eventBasedGatewayBehavior:["type",Lu],fixHoverBehavior:["type",zu],groupBehavior:["type",Fu],importDockingFix:["type",Hu],isHorizontalFix:["type",Wu],labelBehavior:["type",pd],layoutConnectionBehavior:["type",dd],messageFlowBehavior:["type",xd],nonInterruptingBehavior:["type",Pd],removeElementBehavior:["type",Sd],removeEmbeddedLabelBoundsBehavior:["type",kd],removeParticipantBehavior:["type",Ad],replaceConnectionBehavior:["type",Td],replaceElementBehaviour:["type",Md],resizeBehavior:["type",jd],resizeLaneBehavior:["type",Qd],rootElementReferenceBehavior:["type",Xd],spaceToolBehavior:["type",Yd],subProcessPlaneBehavior:["type",ih],subProcessStartEventBehavior:["type",rh],textAnnotationBehavior:["type",oh],toggleCollapseConnectionBehaviour:["type",sh],toggleElementCollapseBehaviour:["type",ah],unclaimIdBehavior:["type",lh],unsetDefaultFlowBehavior:["type",ch],updateFlowNodeRefsBehavior:["type",ph],setCompensationActivityAfterPasteBehavior:["type",dh]};function gh(e,t){var n=xn(e,t,-15);return"intersect"!==n?n:null}function yh(e){Yl.call(this,e)}function vh(e){return!e||mn(e)}function bh(e){do{if(_r(e,"bpmn:Process"))return Pr(e);if(_r(e,"bpmn:Participant"))return Pr(e).processRef||Pr(e)}while(e=e.parent)}function wh(e){return _r(e,"bpmn:TextAnnotation")}function xh(e){return _r(e,"bpmn:Group")&&!e.labelTarget}function Eh(e){return _r(e,"bpmn:BoundaryEvent")&&kh(e,"bpmn:CompensateEventDefinition")}function _h(e){return Pr(e).isForCompensation}function Oh(e){for(var t=e;t=t.parent;){if(_r(t,"bpmn:FlowElementsContainer"))return Pr(t);if(_r(t,"bpmn:Participant"))return Pr(t).processRef}return null}function Ph(e,t){return Oh(e)===Oh(t)}function kh(e,t){return!!f(Pr(e).eventDefinitions||[],(function(e){return _r(e,t)}))}function Sh(e,t){return(Pr(e).eventDefinitions||[]).every((function(e){return _r(e,t)}))}function Ch(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 Ah(e,t,n){if(vh(e)||vh(t))return null;if(!_r(n,"bpmn:DataAssociation")){if(Vh(e,t))return{type:"bpmn:MessageFlow"};if(Hh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Uh(e,t);return i||(Fh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!zh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Th(e,t){return!(!mn(e)&&!xh(e))||!(_r(t,"bpmn:Participant")&&!Vr(t))&&(_r(e,"bpmn:Participant")?_r(t,"bpmn:Process")||_r(t,"bpmn:Collaboration"):Or(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:_r(e,"bpmn:Lane")?_r(t,"bpmn:Participant")||_r(t,"bpmn:Lane"):!(_r(e,"bpmn:BoundaryEvent")&&!function(e){return Pr(e).cancelActivity&&(Dh(e)||Nh(e))}(e))&&(_r(e,"bpmn:FlowElement")&&!_r(e,"bpmn:DataStoreReference")?_r(t,"bpmn:FlowElementsContainer")?Vr(t):Or(t,["bpmn:Participant","bpmn:Lane"]):_r(e,"bpmn:DataStoreReference")&&_r(t,"bpmn:Collaboration")?E(Pr(t).get("participants"),(function(e){return!!e.get("processRef")})):Or(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Or(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!_r(e,"bpmn:MessageFlow")&&(_r(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Mh(e){return _r(e,"bpmn:Lane")}function Rh(e){return!!function(e){return!mn(e)&&_r(e,"bpmn:BoundaryEvent")}(e)||(!(!_r(e,"bpmn:IntermediateThrowEvent")||!Dh(e))||_r(e,"bpmn:IntermediateCatchEvent")&&Nh(e))}function Dh(e){var t=Pr(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Nh(e){return $h(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function $h(e,t){return t.some((function(t){return kh(e,t)}))}function Bh(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!mn(r)&&(!!Rh(r)&&(!Wr(t)&&(!(!_r(t,"bpmn:Activity")||_h(t))&&(!(i&&!gh(i,t))&&(!function(e){return _r(e,"bpmn:ReceiveTask")&&f(e.incoming,(function(e){return _r(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Ih(e,t,n){if(!t)return!1;var i={replacements:[]};return v(e,(function(e){Wr(t)||_r(e,"bpmn:StartEvent")&&"label"!==e.type&&Th(e,t)&&(Ur(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),$h(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&_r(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),_r(t,"bpmn:Transaction")||kh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(_r(e,"bpmn:EndEvent")&&Th(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),_r(e,"bpmn:BoundaryEvent")&&Bh(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function Lh(e,t){return!E(e,Mh)&&(!t||e.every((function(e){return Th(e,t)})))}function jh(e,t,n,i){return!!t&&(!(!mn(e)&&!xh(e))||!function(e,t){return e===t}(n,t)&&((!n||!Ch(n,t))&&(Th(e,t)||Wh(e,t))))}function qh(e,t){return _r(e,"bpmn:SubProcess")?Vr(e)&&(!t||t.width>=100&&t.height>=80):!!_r(e,"bpmn:Lane")||(!!_r(e,"bpmn:Participant")||(!!wh(e)||!!xh(e)))}function zh(e,t){return!Ch(t,e)&&!Ch(e,t)&&(!!function(e,t){var n=wh(e),i=wh(t);return(n||i)&&n!==i}(e,t)||!!Uh(e,t))}function Fh(e,t){return Ph(e,t)&&Eh(e)&&_r(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Wr(t);var n}function Vh(e,t){return!(Qh(e)&&!Qh(t))&&(_r(n=e,"bpmn:InteractionNode")&&!_r(n,"bpmn:BoundaryEvent")&&(!_r(n,"bpmn:Event")||_r(n,"bpmn:ThrowEvent")&&Sh(n,"bpmn:MessageEventDefinition"))&&function(e){return _r(e,"bpmn:InteractionNode")&&!_h(e)&&(!_r(e,"bpmn:Event")||_r(e,"bpmn:CatchEvent")&&Sh(e,"bpmn:MessageEventDefinition"))&&!(_r(e,"bpmn:BoundaryEvent")&&!kh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return bh(e)===bh(t)}(e,t));var n}function Hh(e,t){return _r(n=e,"bpmn:FlowNode")&&!_r(n,"bpmn:EndEvent")&&!Wr(n)&&!(_r(n,"bpmn:IntermediateThrowEvent")&&kh(n,"bpmn:LinkEventDefinition"))&&!Eh(n)&&!_h(n)&&function(e){return _r(e,"bpmn:FlowNode")&&!_r(e,"bpmn:StartEvent")&&!_r(e,"bpmn:BoundaryEvent")&&!Wr(e)&&!(_r(e,"bpmn:IntermediateCatchEvent")&&kh(e,"bpmn:LinkEventDefinition"))&&!_h(e)}(t)&&Ph(e,t)&&!(_r(e,"bpmn:EventBasedGateway")&&!function(e){return _r(e,"bpmn:ReceiveTask")||_r(e,"bpmn:IntermediateCatchEvent")&&(kh(e,"bpmn:MessageEventDefinition")||kh(e,"bpmn:TimerEventDefinition")||kh(e,"bpmn:ConditionalEventDefinition")||kh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Uh(e,t){return Or(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Or(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Or(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Or(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Wh(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&&(Or(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mn(t)&&_r(e,"bpmn:FlowNode")&&!_r(e,"bpmn:BoundaryEvent")&&Th(e,t.parent))}function Gh(e,t){return!!mn(t)||!(_r(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Qh(e){return uc(e,"bpmn:Process")||uc(e,"bpmn:Collaboration")}e(yh,Yl),yh.$inject=["eventBus"],yh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(vh(e))return null;return Or(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 Ah(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Ah(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return qh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(hn(i)&&!Wh(t,i))&&x(t,(function(e){return hn(e)?Ah(e.source,e.target,e):e.host?Bh(e,e.host,null,n):jh(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Bh(n,t,null,i)||Ih(n,t,i)||Lh(n,t)||Wh(n,t)})),this.addRule("shape.create",(function(e){return jh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Bh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Gh(e.elements,t)}))},yh.prototype.canConnectMessageFlow=Vh,yh.prototype.canConnectSequenceFlow=Hh,yh.prototype.canConnectDataAssociation=Uh,yh.prototype.canConnectAssociation=zh,yh.prototype.canConnectCompensationAssociation=Fh,yh.prototype.canMove=Lh,yh.prototype.canAttach=Bh,yh.prototype.canReplace=Ih,yh.prototype.canDrop=Th,yh.prototype.canInsert=Wh,yh.prototype.canCreate=jh,yh.prototype.canConnect=Ah,yh.prototype.canResize=qh,yh.prototype.canCopy=Gh;var Xh={__depends__:[Dc],__init__:["bpmnRules"],bpmnRules:["type",yh]};function Kh(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=kr(e);t=_(y(gt([e],!1),(function(t){return t!==e&&!t.labelTarget})),kr),n.set("planeElement",t)}))}))}Kh.$inject=["eventBus","canvas"];var Yh={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Kh]};function Zh(e){Ho.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 Jh(e,t){Zh.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=f(n,(function(t){return Or(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||_r(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var i=t;i&&!Or(i,n);)i=i.parent;if(!i)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return i}(e,n,r.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Zh.prototype.getOrdering=function(e,t){return null},e(Zh,Ho),Jh.$inject=["eventBus","canvas"],e(Jh,Zh);var em={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jh]};function tm(){}tm.prototype.get=function(){return this._data},tm.prototype.set=function(e){this._data=e},tm.prototype.clear=function(){var e=this._data;return delete this._data,e},tm.prototype.isEmpty=function(){return!this._data};var nm={clipboard:["type",tm]},im="drop-ok",rm="drop-not-ok",om="attach-ok",sm="new-parent",am="create";function lm(e,t,n,i,r){function o(t,n){[om,im,rm,sm].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===am&&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);cm(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||mn(t)&&-1!==e.indexOf(n))})),(function(e){return!hn(e)})),a=!1,l=!1,c=!1;pm(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=pm(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,om):o(i,c?sm:rm))})),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;cm(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!hn(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!hn(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=yt(y(n,(function(e){return!e.hidden})));v(n,(function(e){hn(e)&&(e.waypoints=_(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,am,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function cm(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 pm(e){return e&&1===e.length&&!hn(e[0])}lm.$inject=["canvas","dragging","eventBus","modeling","rules"];function um(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=De("g");Oe(t,r.cls("djs-drag-group",["no-events"]));var o=De("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Xn(r),e)):(r=n._createContainer("shape",o),n.drawShape(Xn(r),e),Yn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||we(e.getActiveLayer(),l),Yn(l,t.x,t.y)):He(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&He(t)}))}um.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var dm={__depends__:[Cc,Fp,Dc,Rs],__init__:["create","createPreview"],create:["type",lm],createPreview:["type",um]};function hm(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)}))}hm.$inject=["eventBus"],hm.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 mm={__init__:["mouse"],mouse:["type",hm]};function fm(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),hn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return _(e.waypoints,(function(e){return(e=gm(e)).original&&(e.original=gm(e.original)),e}))}(n)),mn(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 gm(e){return I({},e)}function ym(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}fm.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fm.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},fm.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||{}})}},fm.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=yt(e);return v(e,(function(e){hn(e)&&(e.waypoints=_(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))},fm.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}),hn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):mn(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},fm.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},fm.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},fm.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},fm.prototype.hasRelations=function(e,t){var n,i;return!(hn(e)&&(n=f(t,T({id:e.source.id})),i=f(t,T({id:e.target.id})),!n||!i))&&!(mn(e)&&!f(t,T({id:e.labelTarget.id})))},fm.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 ft(dt(e),(function(e,t,i){if(!mn(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=_(r,(function(e){return e.element})),r=_(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=_(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)?ym(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):ym(r.element,e)})),i};var vm={__depends__:[nm,dm,mm,Dc],__init__:["copyPaste"],copyPaste:["type",fm]};function bm(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function wm(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=Pr(n);if(mn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(kr(n),!0);s.bpmnElement=o,bm(o,t,"name"),bm(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(mn(n))return n.businessObject=Pr(t[n.labelTarget]),void(n.di=kr(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,bm(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(_r(n,"bpmn:Participant")){var r=Pr(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=Pr(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Pr(e).attachedToRef=Pr(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)))}))}wm.$inject=["bpmnFactory","eventBus","moddleCopy"];var xm=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Em(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===xm.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 _m(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Em.$inject=["eventBus","bpmnFactory","moddle"],Em.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||_m(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},Em.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}}},Em.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 Om={__depends__:[vm],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",wm],moddleCopy:["type",Em]},Pm=Math.round;function km(e,t){this._modeling=e,this._eventBus=t}function Sm(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}km.$inject=["modeling","eventBus"],km.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=Pm(a+o/2),p=Pm(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},Sm.$inject=["selection","eventBus"];var Cm={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Sm],replace:["type",km]};var Am=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Tm(e,t,n,i,r,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Mm(d)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Vr(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)}))}(_m(d.$descriptor),_m(h.$descriptor,!0));I(h,j(l,Am));var b=y(g,(function(e){return"eventDefinitions"===e?Rm(a,l.eventDefinitionType):"loopCharacteristics"===e?!Wr(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Wr(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(Rm(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),_r(d,"bpmn:Activity")){if(Mm(d))f.isExpanded=Vr(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}Vr(a)&&!_r(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}if(Mm(d)&&!Mm(h)&&(p.moveChildren=!1),_r(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Hr(a);kr(a).isHorizontal||(kr(f).isHorizontal=x),f.width=x?a.width:t.getDefaultSize(f).width,f.height=x?t.getDefaultSize(f).height:a.height}return o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Or(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Or(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!_r(d,"bpmn:BoundaryEvent")&&_r(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 Mm(e){return _r(e,"bpmn:SubProcess")}function Rm(e,t){var n=Pr(e);return t&&n.get("eventDefinitions").some((function(e){return _r(e,t)}))}Tm.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Dm={__depends__:[Om,Cm,Rs],bpmnReplace:["type",Tm]};function Nm(e){this._eventBus=e,this._tools=[],this._active=null}Nm.$inject=["eventBus"],Nm.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)},Nm.prototype.isActive=function(e){return e&&this._active===e},Nm.prototype.length=function(e){return this._tools.length},Nm.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Nm.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ee(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var $m={__depends__:[Cc],__init__:["toolManager"],toolManager:["type",Nm]};function Bm(e,t){return-1!==e.indexOf(t)}var Im=Math.abs,Lm=Math.round,jm={x:"width",y:"height"},qm="crosshair",zm={n:"top",w:"left",s:"bottom",e:"right"},Fm=1500,Vm={n:"s",w:"e",s:"n",e:"w"},Hm=20;function Um(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",Fm,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Gm(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){Gm(e);var c={x:0,y:0};c[i]=Lm(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Wm(e){return{top:e.top-Hm,right:e.right+Hm,bottom:e.bottom+Hm,left:e.left-Hm}}function Gm(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)}Um.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Um.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:qm,data:{context:{reactivate:n}},trapClick:!1})},Um.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:qm,data:{context:{}}})},Um.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Um.prototype.init=function(e,t){var n=Im(e.dx)>Im(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Im(i)<5)return!1;i<0&&(i*=-1),ws(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();!xs(e)&&e.hover&&(s=e.hover);var a=[...gt(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=yn(e),x=y(b,(function(e){return!(hn(e)||mn(e)||Qm(o,e)||Qm(s,e))})),E=y(b,(function(e){return!hn(e)&&!mn(e)&&Qm(o,e)})),_=[],O=[];x.length&&(d=Wm(yn(yt(x))),p=i-w[zm[n]]+d[zm[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)),E.length&&(h=Wm(yn(yt(E))),p=i-h[zm[Vm[n]]]+w[zm[Vm[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)?_.push(e):O.push(e)})),_.length&&(m=yn(yt(_.map(wn))),f=w[zm[Vm[n]]]-(m[zm[Vm[n]]]-i)),O.length&&(g=yn(yt(O.map(wn)))[zm[n]]-(w[zm[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[jm[t]]-P[jm[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=i+e[jm[t]]-P[jm[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=i-e[jm[t]]+P[jm[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=i-e[jm[t]]+P[jm[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}),Js("resize-"+("x"===n?"ew":"ns")),!0},Um.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&&!mn(e))if(hn(e))l.push(e);else{var o=e[t],p=o+e[jm[t]];if(function(e){return!!e.host}(e)&&(n>0&&wn(e)[t]>i||n<0&&wn(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}},Um.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Um.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Xm="djs-dragging",Km="djs-resizing",Ym=Math.max;function Zm(e,t,n,i,r){function o(e,t){v(e,(function(e){r.addDragger(e,t),n.addMarker(e,Xm)}))}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=De("g");Oe(a,i.cls("djs-crosshair-group",["no-events"])),we(t,a);var l=De("path");Oe(l,"d",o),ke(l).add("djs-crosshair"),we(a,l);var c=De("path");Oe(c,"d",s),ke(c).add("djs-crosshair"),we(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Yn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&He(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");Oe(a=De("path"),"d","M0,0 L0,0"),ke(a).add("djs-crosshair"),we(u,a),s.line=a;var d=De("g");Oe(d,i.cls("djs-drag-group",["no-events"])),we(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)}))})),hn(e)&&(t||i)&&(n||r)})),d),s.dragGroup=d}if(!s.frameGroup){var h=De("g");Oe(h,i.cls("djs-frame-group",["no-events"])),we(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,Km)})),s.frameGroup=h,s.frames=m}Oe(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,Yn(s.dragGroup,f.x,f.y),v(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?Oe(i,{width:Ym(r.width+f.x,5)}):Oe(i,{width:t=Ym(r.width-f.x,5),x:r.x+r.width-t}),"s"===s.direction?Oe(i,{height:Ym(r.height+f.y,5)}):Oe(i,{height:n=Ym(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,Xm)})),v(r,(function(e){n.removeMarker(e,Xm)})),a&&(He(s),He(a)),v(o,(function(e){n.removeMarker(e,Km)})),l&&He(l)}))}Zm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Jm={__init__:["spaceToolPreview"],__depends__:[Cc,Dc,$m,Fp,mm],spaceTool:["type",Um],spaceToolPreview:["type",Zm]};function ef(e,t){e.invoke(Um,this),this._canvas=t}ef.$inject=["injector","canvas"],e(ef,Um),ef.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],s=[];o&&(s=P(vt(r.children.filter((e=>_r(e,"bpmn:Artifact"))),yt(o))));const a=[...e,...s];var l=Um.prototype.calculateAdjustments.call(this,a,t,n,i);return l.resizingShapes=l.resizingShapes.filter((function(e){return!_r(e,"bpmn:TextAnnotation")&&(!function(e){return _r(e,"bpmn:Participant")&&!Pr(e).processRef}(e)||!("y"===t&&Hr(e)||"x"===t&&!Hr(e)))})),l};var tf={__depends__:[Jm],spaceTool:["type",ef]};function nf(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)}nf.$inject=["eventBus","injector"],nf.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()},nf.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},nf.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},nf.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()}},nf.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()}},nf.prototype.register=function(e,t){this._setHandler(e,t)},nf.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)},nf.prototype.canUndo=function(){return!!this._getUndoAction()},nf.prototype.canRedo=function(){return!!this._getRedoAction()},nf.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nf.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nf.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)}))},nf.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},nf.prototype._createId=function(){return this._uid++},nf.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nf.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()},nf.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)},nf.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)},nf.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},nf.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nf.prototype._revertedAction=function(e){this._stackIdx--},nf.prototype._getHandler=function(e){return this._handlerMap[e]},nf.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 rf={commandStack:["type",nf]};function of(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 sf(e,t,n){Ho.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=af(n),t.validatedShapes=af(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;of((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=kt(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&&(Pt(i.labels,n,r),n.labelTarget=i)}))}function af(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(sf,Ho),sf.$inject=["injector","eventBus","modeling"];var lf={__init__:["labelSupport"],labelSupport:["type",sf]},cf="attach-ok";function pf(e,t,n,i,r){Ho.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=uf(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(uf(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,cf),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,cf)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(uf(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;of(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=ad(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=ad(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;of(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function uf(e){return i(_(e,(function(e){return e.attachers||[]})))}e(pf,Ho),pf.$inject=["injector","eventBus","canvas","rules","modeling"];var df={__depends__:[Dc],__init__:["attachSupport"],attachSupport:["type",pf]};function hf(e){this._model=e}function mf(e,t,n){Ho.call(this,e),this._bpmnFactory=t;var i=this;function r(e){v(e.context.oldRoot.children,(function(e){_r(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function o(e){var t=e.context.shape;_r(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function a(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}function c(e){const{element:n}=e.context,i=to(n),r=kr(n),o=r&&r.get("label");Kr(n)||ts(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"],ff((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ff((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],r),this.reverted(["canvas.updateRoot"],r),this.executed(["shape.move","shape.create","shape.resize"],ff((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],ff((function(e){"label"!==e.context.shape.type&&o(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&o({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ff(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ff(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ff(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ff(a)),this.executed("connection.reconnect",ff((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Pr(n),s=Pr(i),a=Pr(r);o.conditionExpression&&!Or(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",ff((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Pr(n),s=Pr(i),a=Pr(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],ff(l)),this.reverted(["element.updateAttachment"],ff(l)),this.executed("element.updateLabel",ff(c)),this.reverted("element.updateLabel",ff(c))}function ff(e){return function(t){var n=t.context;_r(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function gf(e,t){Hn.call(this),this._bpmnFactory=e,this._moddle=t}function yf(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function vf(e,t){this._modeling=e,this._canvas=t}function bf(e){this._modeling=e}function wf(e,t){this._canvas=e,this._layouter=t}hf.$inject=["moddle"],hf.prototype._needsId=function(e){return Or(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"])},hf.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=_r(e,"bpmn:Activity")?"Activity":_r(e,"bpmn:Event")?"Event":_r(e,"bpmn:Gateway")?"Gateway":Or(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},hf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},hf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},hf.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},hf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},hf.prototype.createDiWaypoints=function(e){var t=this;return _(e,(function(e){return t.createDiWaypoint(e)}))},hf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",j(e,["x","y"]))},hf.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},hf.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(mf,Ho),mf.$inject=["eventBus","bpmnFactory","connectionDocking"],mf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},mf.prototype.updateParent=function(e,t){if(!(mn(e)||_r(e,"bpmn:DataStoreReference")&&e.parent&&_r(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=kr(e),o=n&&n.businessObject,s=kr(n);_r(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),_r(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),_r(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),_r(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},mf.prototype.updateBounds=function(e){var t=kr(e),n=function(e){if(!_r(e,"bpmn:Activity"))return;var t=kr(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ra(n,t.get("bounds"));I(n,{x:e.x+i.x,y:e.y+i.y})}var r=mn(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})},mf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(_r(n,"bpmn:Lane")&&Ot(n.get("flowNodeRef"),e),_r(t,"bpmn:Lane")&&Pt(t.get("flowNodeRef"),e))},mf.prototype.updateDiConnection=function(e,t,n){var i=kr(e),r=kr(t),o=kr(n);i.sourceElement&&i.sourceElement.bpmnElement!==Pr(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Pr(n)&&(i.targetElement=n&&o)},mf.prototype.updateDiParent=function(e,t){if(t&&!_r(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ot(n,e),e.$parent=null)}},mf.prototype.getLaneSet=function(e){var t,n;return _r(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(_r(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},mf.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&(!_r(e,"bpmn:DataInput")&&!_r(e,"bpmn:DataOutput")||(_r(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(_r(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(_r(e,"bpmn:FlowElement")){if(t)if(_r(t,"bpmn:Participant"))t=t.processRef;else if(_r(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(_r(t,"bpmn:Lane"));i="flowElements"}else if(_r(e,"bpmn:Artifact")){for(;t&&!_r(t,"bpmn:Process")&&!_r(t,"bpmn:SubProcess")&&!_r(t,"bpmn:Collaboration");){if(_r(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(_r(e,"bpmn:MessageFlow"))i="messageFlows";else if(_r(e,"bpmn:Participant")){i="participants";var r,o=e.processRef;o&&(r=function(e){for(;e&&!_r(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Ot(r.get("rootElements"),o),o.$parent=null),t&&(Pt(r.get("rootElements"),o),o.$parent=r))}else _r(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":_r(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Ot(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(i);Ot(s,e),t&&(a||(a=[],t.set(i,a)),a.push(e))}}},mf.prototype.updateConnectionWaypoints=function(e){kr(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},mf.prototype.updateConnection=function(e){var t,n=e.connection,i=Pr(n),r=n.source,o=Pr(r),s=n.target,a=Pr(n.target);if(_r(i,"bpmn:DataAssociation"))_r(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):_r(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=_r(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(Ot(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(Ot(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)},mf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(gf,Hn),gf.$inject=["bpmnFactory","moddle"],gf.prototype._baseCreate=Hn.prototype.create,gf.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Qr,t))}return this.createElement(e,t)},gf.prototype.createElement=function(e,t){var n,i,r,o=(t=I({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");wr(o=this._bpmnFactory.create(t.type))}if(!Or(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=I({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return _r(o,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=yf(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=yf(s,t,"isExpanded")),Or(o,["bpmn:Lane","bpmn:Participant"])&&(t=yf(s,t,"isHorizontal")),_r(o,"bpmn:SubProcess")&&(t.collapsed=!Vr(o,s)),_r(o,"bpmn:ExclusiveGateway")&&(m(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(i=o.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=o,o.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=I({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},gf.prototype.getDefaultSize=function(e,t){var n=Pr(e);if(t=t||kr(e),_r(n,"bpmn:SubProcess"))return Vr(n,t)?{width:350,height:200}:{width:100,height:80};if(_r(n,"bpmn:Task"))return{width:100,height:80};if(_r(n,"bpmn:Gateway"))return{width:50,height:50};if(_r(n,"bpmn:Event"))return{width:36,height:36};if(_r(n,"bpmn:Participant")){var i=void 0===t.isHorizontal||!0===t.isHorizontal;return Vr(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return _r(n,"bpmn:Lane")?{width:400,height:100}:_r(n,"bpmn:DataObjectReference")?{width:36,height:50}:_r(n,"bpmn:DataStoreReference")?{width:50,height:50}:_r(n,"bpmn:TextAnnotation")?{width:100,height:30}:_r(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},gf.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)},vf.$inject=["modeling","canvas"],vf.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)}))},vf.prototype.postExecute=function(e){},bf.$inject=["modeling"],bf.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},bf.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,E(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))},wf.$inject=["canvas","layouter"],wf.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},wf.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xf=Math.round;function Ef(e){this._modeling=e}Ef.$inject=["modeling"],Ef.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=yt(y(t,(function(e){return!e.hidden})));v(t,(function(e){hn(e)&&(e.waypoints=_(e.waypoints,(function(e){return{x:xf(e.x-a.x-a.width/2+r.x),y:xf(e.y-a.y-a.height/2+r.y)}}))),I(e,{x:xf(e.x-a.x-a.width/2+r.x),y:xf(e.y-a.y-a.height/2+r.y)})}));var l=dt(t),c={};v(t,(function(e){if(hn(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),mn(e)&&(t=q(t,["attach"])),c[e.id]=u(i)?s.createShape(e,j(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,j(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=P(c)};var _f=Math.round;function Of(e){this._canvas=e}function Pf(e){Of.call(this,e)}Of.$inject=["canvas"],Of.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-_f(t.width/2),y:n.y-_f(t.height/2)}),this._canvas.addShape(t,i,r),t},Of.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Pf,Of),Pf.$inject=["canvas"];var kf=Of.prototype.execute;Pf.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,kf.call(this,e)};var Sf=Of.prototype.revert;function Cf(e,t){this._canvas=e,this._modeling=t}function Af(e,t){this._modeling=e,this._elementRegistry=t}function Tf(e,t){this._canvas=e,this._modeling=t}function Mf(e){this._modeling=e}Pf.prototype.revert=function(e){return e.shape.labelTarget=null,Sf.call(this,e)},Cf.$inject=["canvas","modeling"],Cf.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;of(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),of(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Cf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=kt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Cf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,i),this._canvas.addConnection(t,n),t},Af.$inject=["modeling","elementRegistry"],Af.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))}))},Tf.$inject=["canvas","modeling"],Tf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;of(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),of(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),of(n.children,(function(e){hn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Tf.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=kt(i.children,n),t.removeShape(n),n},Tf.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Pt(i.children,n,r),t.addShape(n,i),n},Mf.$inject=["modeling"];var Rf={x:"y",y:"x"};function Df(e,t){this._layouter=e,this._canvas=t}function Nf(){}function $f(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Bf(e){this._modeling=e}function If(e){this._helper=new Bf(e)}function Lf(e){this._modeling=e,this._helper=new Bf(e)}function jf(e){this._modeling=e}function qf(e){return e.original||e}function zf(e,t){this._modeling=e,this._rules=t}function Ff(e){this._modeling=e}function Vf(e){this._modeling=e}function Hf(e){return I({},e)}function Uf(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Wf(e,t,n){var i=Uf(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Gf(e,t){return-1!==e.indexOf(t)}function Qf(e){this._modeling=e}function Xf(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,Xf(e.children)))})),t}function Kf(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Kf(e.children,e.collapsed||t)))})),n}function Yf(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Yf(e.children,t)))})),n}function Zf(e){this._modeling=e}function Jf(e,t){return Ot(e&&e.attachers,t)}function eg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Pt(i,t,n)}}function tg(){}function ng(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function ig(e){this._elementRegistry=e}function rg(e,t){v(t,(function(t,n){e.set(n,t)}))}Mf.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[Rf[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[Rf[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)})))}))},Mf.prototype.postExecute=function(e){},Df.$inject=["layouter","canvas"],Df.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Df.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Nf.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=Ot(o.children,t),Pt(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},Nf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ot(n.children,t),Pt(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},$f.prototype.add=function(e,t){return this.addAll([e],t)},$f.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var i=xt((n=n||{}).allShapes),r=xt(n.allConnections),o=xt(n.enclosedElements),a=xt(n.enclosedConnections),l=xt(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 ft(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},Bf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Bf.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&&fd(e,e.source,t),connectionEnd:r&&gd(e,e.target,t)})}))},Bf.prototype.getClosure=function(e){return(new $f).addAll(e,!0)},If.$inject=["modeling"],If.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},If.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)},Lf.$inject=["modeling"],Lf.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=j(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Lf.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:gd(e,t,n)})})),v(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:fd(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},Lf.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Pt(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Lf.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Lf.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},jf.$inject=["modeling"],jf.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},jf.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||qf(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||qf(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},jf.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},zf.$inject=["modeling","rules"],zf.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,md(e,t,u),a)})),v(h,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,hd(e,t,u),a)}))},zf.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},zf.prototype.execute=function(e){},zf.prototype.revert=function(e){},zf.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},zf.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},zf.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Ff.$inject=["modeling"],Ff.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},Ff.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:md(e,n,i)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:hd(e,n,i)})})))},Ff.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},Vf.$inject=["modeling"],Vf.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;(Bm(e,r)||Bm(e,o)||Bm(t,r)||Bm(t,o))&&(Bm(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Vf.prototype.execute=function(){},Vf.prototype.revert=function(){},Vf.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Vf.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})}))},Vf.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.waypoints,(function(e){return(e=Hf(e)).original&&(e.original=Hf(e.original)),e}))}(e),d=Uf(n),h={};Gf(l,c)&&Gf(l,p)?(u=_(u,(function(e){return Wf(e,i,n)&&(e[d]=e[d]+t[d]),e.original&&Wf(e.original,i,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Gf(l,c)||Gf(l,p))&&(Gf(r,c)?h.connectionStart=fd(e,c,t):Gf(r,p)?h.connectionEnd=gd(e,p,t):Gf(o,c)?h.connectionStart=hd(e,c,s[c.id]):Gf(o,p)&&(h.connectionEnd=md(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=Xf(n),t.collapsed=!t.collapsed;var i=Kf(n,t.collapsed);return[t].concat(i)},Qf.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Yf(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Zf.$inject=["modeling"],Zf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jf(i,t),eg(n,t),t.host=n,t},Zf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Jf(n,t),eg(i,t,r),t},tg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},tg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},ng.$inject=["eventBus","elementFactory","commandStack"],ng.prototype.getHandlers=function(){return{"shape.append":bf,"shape.create":Of,"shape.delete":Tf,"shape.move":Lf,"shape.resize":Ff,"shape.replace":zf,"shape.toggleCollapse":Qf,spaceTool:Vf,"label.create":Pf,"connection.create":wf,"connection.delete":Cf,"connection.move":Nf,"connection.layout":Df,"connection.updateWaypoints":tg,"connection.reconnect":jf,"elements.create":Ef,"elements.move":If,"elements.delete":Af,"elements.distribute":Mf,"elements.align":vf,"element.updateAttachment":Zf}},ng.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},ng.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)},ng.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ng.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)},ng.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)},ng.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ng.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},ng.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},ng.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},ng.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},ng.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},ng.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ng.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ng.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ng.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ng.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ng.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ng.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ng.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)},ng.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ng.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)},ng.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,I(i,{docking:"source"}))},ng.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,I(i,{docking:"target"}))},ng.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ng.prototype._create=function(e,t){return t instanceof Ln?t:this._elementFactory.create(e,t)},ng.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ig.$inject=["elementRegistry"],ig.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 rg(n,i),e.oldProperties=o,e.changed=r,r},ig.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return rg(n,t),i},ig.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return _r(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return _r(t,"bpmn:DataObjectReference")&&Pr(t).dataObjectRef===e}))}(e,t):[]};var og="default",sg="id",ag="di",lg={width:0,height:0};function cg(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}function pg(e,t){return sg in e&&e[sg]!==t[sg]}function ug(e,t){var n=e.businessObject,i=kr(e);v(t,(function(e,t){t!==ag?n.set(t,e):i&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(i,e)}))}cg.$inject=["elementRegistry","moddle","modeling","textRenderer"],cg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,s=function(e){var t=I({},e);return dg.forEach((function(n){n in e&&(t[n]=Pr(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=O(t),i=e.businessObject,r=kr(e);return w(n,(function(e,n){return e[n]=n!==ag?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,s);return pg(s,o)&&(r.unclaim(o[sg]),i.updateId(t,s[sg]),r.claim(s[sg],o)),og in s&&(s[og]&&n.push(i.get(s[og].id)),o[og]&&n.push(i.get(o[og].id))),ug(t,s),e.oldProperties=a,e.changed=n,n},cg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Pr(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,lg)}},cg.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 ug(t,i),pg(n,r)&&(s.unclaim(n[sg]),o.updateId(t,i[sg]),s.claim(i[sg],r)),e.changed};var dg=["default"];function hg(e,t){this._canvas=e,this._modeling=t}function mg(e,t){this._modeling=e,this._spaceTool=t}function fg(e){this._modeling=e}function gg(e,t){this._modeling=e,this._spaceTool=t}hg.$inject=["canvas","modeling"],hg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=kr(r);return t.setRootElement(n),t.removeRootElement(r),Pt(s.rootElements,i),i.$parent=s,Ot(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},hg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=kr(n);return t.setRootElement(r),t.removeRootElement(n),Ot(s.rootElements,i),i.$parent=null,Pt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},mg.$inject=["modeling","spaceTool"],mg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Tu(i),s=o===i,a=s?i:i.parent,l=Au(a),c=Hr(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+Su,y:i.y,width:i.width-Su,height:i.height}:{x:i.x,y:i.y+Su,width:i.width,height:i.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,m,f,g=[];ft(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?Su:0),y:d-("top"===r?120:0),width:i.width-(s?Su:0),height:120}:{x:d-("left"===r?120:0),y:i.y+(s?Su:0),width:120,height:i.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},fg.$inject=["modeling"],fg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Au(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var s,a,l,c,p=Hr(n),u=p?n.height:n.width,d=Math.round(u/i);for(c=0;c<i;c++)s=c===i-1?u-d*c:d,a=p?{x:n.x+Su,y:n.y+c*d,width:n.width-Su,height:s}:{x:n.x+c*d,y:n.y+Su,width:s,height:n.height-Su},c<o?t.resizeShape(r[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},gg.$inject=["modeling","spaceTool"],gg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},gg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Mu(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},gg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=yn(e),c=wu(yn(t),l),p=Tu(e),u=[],d=[];ft(p,(function(e){return u.push(e),(_r(e,"bpmn:Lane")||_r(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 yg="flowNodeRef",vg="lanes";function bg(e){this._elementRegistry=e}function wg(e){this._moddle=e}bg.$inject=["elementRegistry"],bg.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=Tu(e);return r[t.id]||(r[t.id]=Cu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=yn(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=Tu(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return _r(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(vg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(yg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},bg.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(vg);e.remove.forEach((function(e){Ot(n,e),Ot(e.get(yg),t)})),e.add.forEach((function(e){Pt(n,e),Pt(e.get(yg),t)}))})),[]},bg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(vg);e.add.forEach((function(e){Ot(n,e),Ot(e.get(yg),t)})),e.remove.forEach((function(e){Pt(n,e),Pt(e.get(yg),t)}))})),[]},wg.$inject=["moddle"],wg.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),[]},wg.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 xg={fill:void 0,stroke:void 0};function Eg(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}`)}}}Eg.$inject=["commandStack"],Eg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xg,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=hn(e)?j(r,["border-color"]):r,n=kr(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),mn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!Or(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var _g={width:0,height:0};function Og(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return no(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!mn(n)&&Kr(n)&&!Yr(n)&&!Pg(r)){var o=Jr(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=to(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(mn(r)||_r(r,"bpmn:TextAnnotation"))if(mn(r)&&Pg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=to(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,_g)}}}function Pg(e){return!e||!e.trim()}function kg(e,t,n,i){ng.call(this,e,t,n),this._bpmnRules=i}function Sg(){}Og.$inject=["modeling","textRenderer","bpmnFactory"],e(kg,ng),kg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kg.prototype.getHandlers=function(){var e=ng.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ig,e["element.updateProperties"]=cg,e["canvas.updateRoot"]=hg,e["lane.add"]=mg,e["lane.resize"]=gg,e["lane.split"]=fg,e["lane.updateRefs"]=bg,e["id.updateClaim"]=wg,e["element.setColor"]=Eg,e["element.updateLabel"]=Og,e},kg.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},kg.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)},kg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Sg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||wn(t.source||e.source),t.connectionEnd||wn(t.target||e.target)]};var Cg=20,Ag=5,Tg=Math.round,Mg=20,Rg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Dg(e,t,n){var i,r,o,s=xn(t,e,Ag),a=n.split(":")[0],l=Tg((t.x-e.x)/2+e.x),c=Tg((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+Cg*(/l/.test(a)?-1:1),y:h?c+Cg:c}):i={x:(h=l===e.x)?l+Cg:l,y:e.y+Cg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:$g(e,i,r).concat(i),directions:r,turnNextDirections:h}}function Ng(e){return e.split(":").reverse().join(":")}function $g(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(qg(n)){var i=function(e,t,n){return Dg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Dg(t,e,Ng(n));return{waypoints:i.waypoints.slice().reverse(),directions:Ng(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:$g(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=Tg((t.x-e.x)/2+e.x),r=Tg((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 Bg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=xn(e,t,Rg[o]||0),a=function(e,t){if(qg(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||wn(e),i=i||wn(t);var l=a.split(":"),c=zg(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var i=$g(e,t,n);return i.unshift(e),i.push(t),Fg(i)}(c,zg(i,t,l[1],s),a)}function Ig(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=wn(e),i=wn(t)),r=r||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=xn(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?Lg(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:Lg(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=jg(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&jg(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Bg(e,t,n,i,o))))}function Lg(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 jg(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&&St(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(Tt(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(Rt(e[i],t,Mg)||Rt(e[i],n,Mg))return e.slice(i);return e}(s,e,t),r!==s&&(s=jg(e,t,n,r)),s&&Tt(s)?null:s}function qg(e){return e&&/t|r|b|l/.test(e)}function zg(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 Fg(e){return e.reduce((function(t,n,i){return Ct(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Vg=-10,Hg=40,Ug={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},Wg={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Gg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Qg={top:"t",right:"r",bottom:"b",left:"l"};function Xg(e){this._elementRegistry=e}function Kg(e,t){return _r(t,"bpmn:Participant")?"source":_r(e,"bpmn:Participant")?"target":ey(t)?"source":ey(e)||_r(t,"bpmn:Event")?"target":_r(e,"bpmn:Event")?"source":null}function Yg(e){return ey(e)?"target":"source"}function Zg(e,t){return e?e.original||e:wn(t)}function Jg(e,t){return _r(t,"bpmn:Activity")&&_r(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ey(e){return _r(e,"bpmn:SubProcess")&&Vr(e)}function ty(e,t){return e===t}function ny(e){var t=/right|left/.exec(e);return t&&t[0]}function iy(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ry(e,t){return Gg[e]===t}function oy(e){return"right"===e||"left"===e}function sy(e,t,n){var i=t.waypoints,r=i&&i.length&&xn(i[0],e);return"top"===r?n.loop.fromTop:"right"===r?n.loop.fromRight:"left"===r?n.loop.fromLeft:n.loop.fromBottom}function ay(e,t,n,i){var r,o,s,a,l=wn(e),c=wn(t),p=(a=(s=e).host,xn(wn(s),a,Vg)),u=ty(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=xn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,i,r,o){var s,a=t?e:o.isHorizontal?iy(e):ny(e),l=Qg[a];s=t?oy(e)?ly("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:ly("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,i):(r=function(e,t,n,i){if(n)return Qg[e];var r=iy(e),o=ny(e),s=iy(t),a=ny(t);if(i){if(ty(r,s)||ry(o,a))return Qg[r]}else if(ty(o,a)||ry(r,s))return Qg[o];return Qg[i?o:r]}(p,h,d,i.isHorizontal),o=function(e,t,n,i){if(n)return oy(e)?function(e,t){var n=ny(e),i=Gg[n];return-1!==t.indexOf(i)}(e,t)||ty(e,t)?"h":"v":function(e,t){var n=iy(e),i=Gg[n];return-1!==t.indexOf(i)}(e,t)||ty(e,t)?"v":"h";return i?ty(iy(e),iy(t))?"h":"v":ty(ny(e),ny(t))?"v":"h"}(p,h,d,i.isHorizontal),[r+":"+o])}function ly(e,t,n,i){var r=Hg;return!(cy(e,i,n,r)||cy(e,i,{x:n.x+n.width,y:n.y+n.height},r)||cy(e,i,wn(t),r))}function cy(e,t,n,i){return Math.abs(t[e]-n[e])<i}function py(e){return I({original:e.point.original||e.point},e.actual)}function uy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Xg,Sg),Xg.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,c=this._elementRegistry;if(a||(a=Zg(s&&s[0],r)),l||(l=Zg(s&&s[s.length-1],o)),(_r(e,"bpmn:Association")||_r(e,"bpmn:DataAssociation"))&&s&&!Jg(r,o))return[].concat([a],s.slice(1,-1),[l]);var p=dc(r,c)?Ug:Wg;return _r(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Kg(e,t)}}(r,o,p):(_r(e,"bpmn:SequenceFlow")||Jg(r,o))&&(n=r===o?{preferredLayouts:sy(r,e,p)}:_r(r,"bpmn:BoundaryEvent")?{preferredLayouts:ay(r,o,l,p)}:ey(r)||ey(o)?{preferredLayouts:p.subProcess,preserveDocking:Yg(r)}:_r(r,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:_r(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(i=Fg(Ig(r,o,a,l,s,n=I(n,t)))),i||[a,l]},Xg.$inject=["elementRegistry"],uy.$inject=["elementRegistry","graphicsFactory"],uy.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(py(i)),o.push(py(r)),o},uy.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}},uy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},uy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},uy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},uy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var dy={__init__:["modeling","bpmnUpdater"],__depends__:[fh,Xh,Yh,em,Dm,rf,lf,df,Rs,Vo,tf],bpmnFactory:["type",hf],bpmnUpdater:["type",mf],elementFactory:["type",gf],modeling:["type",kg],layouter:["type",Xg],connectionDocking:["type",uy]};const hy=Math.round;function my(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}my.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-hy(p.width/2),y:u.y-hy(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)))})},my.prototype.cleanUp=function(){this._complexPreview.cleanUp()},my.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var fy={__depends__:[gc,Up,dy],__init__:["appendPreview"],appendPreview:["type",my]},gy=Math.min,yy=Math.max;function vy(e){e.preventDefault()}function by(e){e.stopPropagation()}function wy(e){this.container=e.container,this.parent=fe('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ye("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=B(this.autoResize,this),this.handlePaste=B(this.handlePaste,this)}function xy(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new wy({container:t.getContainer(),keyHandler:B(this._handleKey,this),resizeHandler:B(this._handleResize,this)})}wy.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=j(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=j(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,le.bind(o,"keydown",this.keyHandler),le.bind(o,"mousedown",by),le.bind(o,"paste",this.handlePaste),i.autoResize&&le.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},wy.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)}},wy.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)},wy.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)}))},wy.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})}},wy.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=fe('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){vy(n),by(n);var u=gy(yy(c+n.clientX-a,i),o),d=gy(yy(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){vy(e),by(e),le.unbind(document,"mousemove",u,!1),le.unbind(document,"mouseup",d,!1)};le.bind(n,"mousedown",(function(e){vy(e),by(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,le.bind(document,"mousemove",u),le.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)},wy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",by),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},wy.prototype.getValue=function(){return this.content.innerText.trim()},wy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},wy.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)},xy.$inject=["eventBus","canvas"],xy.prototype.registerProvider=function(e){this._providers.push(e)},xy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},xy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},xy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},xy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},xy.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()}},xy.prototype.getValue=function(){return this._textbox.getValue()},xy.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())},xy.prototype._handleResize=function(e){this._fire("resize",e)},xy.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 Ey={__depends__:[Ps],__init__:["directEditing"],directEditing:["type",xy]};var _y=[{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"}}],Oy=[{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"}}],Py=[{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"}}],ky=[{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"}}],Sy=[{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"}}],Cy=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ay=[{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],Ty=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",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}}],My=Ty,Ry=[{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}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],Dy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Ny=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],$y=[{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}}],By=[{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}}],Iy=[{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"}],Ly=[{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}}],jy={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{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:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{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"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{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"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{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"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{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:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{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:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]},qy={"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 zy(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()}zy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],zy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},zy.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,i=this._rules,r=[],o=[];if(c(e)||!i.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Pr(s),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Vr(s);return!(r&&o&&a&&l)});return _r(n,"bpmn:DataObjectReference")?this._createEntries(e,Dy):_r(n,"bpmn:DataStoreReference")&&!_r(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ny):(_r(n,"bpmn:Event")&&!_r(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,r=jy[t]||[],!Wr(n.$parent)&&_r(n.$parent,"bpmn:SubProcess")&&(r=y(r,(function(e){return"bpmn:StartEvent"!==e.target.type})))),_r(n,"bpmn:StartEvent")&&!_r(n.$parent,"bpmn:SubProcess")?(o=y(_y.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:Participant")?(o=y(Ly,(function(t){return Vr(e)!==t.target.isExpanded})),this._createEntries(e,o)):_r(n,"bpmn:StartEvent")&&Wr(n.$parent)?(o=y(By.concat(r),(function(e){var t=!1!==e.target.isInterrupting,i=n.isInterrupting===t;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):_r(n,"bpmn:StartEvent")&&!Wr(n.$parent)&&_r(n.$parent,"bpmn:SubProcess")?(o=y(Oy.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:EndEvent")?(o=y(ky.concat(r),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!_r(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):_r(n,"bpmn:BoundaryEvent")?(o=y($y,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!_r(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,r=n.cancelActivity==i;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):_r(n,"bpmn:IntermediateCatchEvent")||_r(n,"bpmn:IntermediateThrowEvent")?(o=y(Py.concat(r),a),this._createEntries(e,o)):_r(n,"bpmn:Gateway")?(o=y(Sy,a),this._createEntries(e,o)):_r(n,"bpmn:Transaction")?(o=y(Ty,a),this._createEntries(e,o)):Wr(n)&&Vr(e)?(o=y(My,a),this._createEntries(e,o)):_r(n,"bpmn:AdHocSubProcess")&&Vr(e)?(o=y(Ay,a),this._createEntries(e,o)):_r(n,"bpmn:SubProcess")&&Vr(e)?(o=y(Cy,a),this._createEntries(e,o)):_r(n,"bpmn:SubProcess")&&!Vr(e)?(o=y(Ry,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):_r(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Iy):_r(n,"bpmn:FlowNode")?(o=y(Ry,a),this._createEntries(e,o)):{})},zy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return _r(e,"bpmn:Activity")&&!Wr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),_r(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),_r(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),_d(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},zy.prototype._createEntries=function(e,t){var n={},i=this;return v(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},zy.prototype._createSequenceFlowEntries=function(e,t){var n=Pr(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&&(_r(n.sourceRef,"bpmn:ExclusiveGateway")||_r(n.sourceRef,"bpmn:InclusiveGateway")||_r(n.sourceRef,"bpmn:ComplexGateway")||_r(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&&_r(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:_r(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(_r(n.sourceRef,"bpmn:ExclusiveGateway")||_r(n.sourceRef,"bpmn:InclusiveGateway")||_r(n.sourceRef,"bpmn:ComplexGateway")||_r(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},zy.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}},zy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var r=e.businessObject.get("loopCharacteristics");r&&_r(r,i.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,r,{isSequential:i.options.isSequential}):(r=t._moddle.create(i.options.loopCharacteristics,{isSequential:i.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:r}))}}var r,o,s,a=Pr(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"}}}},zy.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})}}}},zy.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})}}}},zy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Pr(e),i=this,r=Od(e),o=_r(e,"bpmn:BoundaryEvent")?qy["intermediate-event-non-interrupting"]:qy["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 Fy={__depends__:[Wl,Dm,gc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",zy]};function Vy(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(ws(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Hy(e,t,n){var i=e.$instanceOf(t),r=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}Vy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Vy.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},Vy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Vy.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._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&I(p,m()),p;var u=e.businessObject;function d(e,t){r.start(e,t)}function h(e,t){n.removeElements([t])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function f(e,t,n,r){function s(t,n){var s=i.createShape(I({type:e},r));o.start(t,s,{source:n})}var l=a?function(t,n){var o=i.createShape(I({type:e},r));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,r),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(Or(u,["bpmn:Lane","bpmn:Participant"])&&Vr(e)){var y=Au(e);I(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Hr(e)?e.height>=120:e.width>=120)&&I(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Hr(e)?e.height>=180:e.width>=180)&&I(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),I(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return _r(u,"bpmn:FlowNode")&&(_r(u,"bpmn:EventBasedGateway")?I(p,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Hy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(p,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):_r(u,"bpmn:EndEvent")||u.isForCompensation||Hy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Wr(u)||I(p,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":f("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("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:l("Change element"),width:300,search:!0})}}}}),_r(u,"bpmn:SequenceFlow")&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Or(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),_r(u,"bpmn:TextAnnotation")&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Or(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),_r(u,"bpmn:Group")&&I(p,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&I(p,m()),p};var Uy={__depends__:[fy,Ey,Ta,Rs,$p,dm,Fy],__init__:["contextPadProvider"],contextPadProvider:["type",Vy]},Wy={horizontal:["x","width"],vertical:["y","height"]};function Gy(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:[]}))}Gy.$inject=["modeling","rules"],Gy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Gy.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},Gy.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},Gy.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},Gy.prototype._setOrientation=function(e){var t=Wy[e];this._axis=t[0],this._dimension=t[1]},Gy.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)},Gy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Qy={__init__:["distributeElements"],distributeElements:["type",Gy]};function Xy(e){Yl.call(this,e)}Xy.$inject=["eventBus"],e(Xy,Yl),Xy.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=dt(t=y(t,(function(e){var t=Or(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 Ky={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 Yy(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Yy.$inject=["popupMenu","distributeElements","translate","rules"],Yy.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Yy.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Yy.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:Ky.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Ky.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var Zy={__depends__:[Wl,Qy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xy],distributeElementsMenuProvider:["type",Yy]},Jy="is not a registered action";function ev(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function tv(e,t){return new Error(e+" "+t)}ev.$inject=["eventBus","injector"],ev.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)}))},ev.prototype.trigger=function(e,t){if(!this._actions[e])throw tv(e,Jy);return this._actions[e](t)},ev.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)}))},ev.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw tv(e,"is already registered");this._actions[e]=t},ev.prototype.unregister=function(e){if(!this.isRegistered(e))throw tv(e,Jy);this._actions[e]=void 0},ev.prototype.getActions=function(){return Object.keys(this._actions)},ev.prototype.isRegistered=function(e){return!!this._actions[e]};var nv={__init__:["editorActions"],editorActions:["type",ev]};function iv(e){e.invoke(ev,this)}e(iv,ev),iv.$inject=["injector"],iv.prototype._registerDefaultActions=function(e){ev.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!_r(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=yt(i=_r(r,"bpmn:Collaboration")?n.filter((function(e){return _r(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!_r(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 rv={__depends__:[nv],editorActions:["type",iv]};function ov(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Or(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}ov.$inject=["eventBus"];var sv=10;function av(e,t,n){return n||(n="round"),Math[n](e/t)*t}function lv(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&&Ls(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)||(cv(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&&(cv(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&&(cv(t)?uv(a)?s.x.max=l.left:s.x.min=l.right:pv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(cv(t)?uv(a)?s.x.min=c.left:s.x.max=c.right:pv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(i,s),_p(t,n)||r.snapEvent(t,n,i)}))}}))}function cv(e){return"x"===e}function pv(e){return-1!==e.indexOf("n")}function uv(e){return-1!==e.indexOf("w")}function dv(e,t){Ho.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)}}))}lv.prototype.snapEvent=function(e,t,n){Op(e,t,this.snapValue(e[t],n))},lv.prototype.getGridSpacing=function(){return sv},lv.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=av(e+=r,sv),t&&t.min&&u(n=t.min)&&(n=av(n+r,sv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=av(i+r,sv,"floor"),e=Math.min(e,i)),e-=r},lv.prototype.isActive=function(){return this.active},lv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},lv.prototype.toggleActive=function(){this.setActive(!this.active)},lv.$inject=["elementRegistry","eventBus","config.gridSnapping"],dv.$inject=["eventBus","gridSnapping","modeling"],e(dv,Ho),dv.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},dv.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},dv.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},dv.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 hv(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))}))}hv.$inject=["eventBus","gridSnapping"];var mv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",dv],gridSnappingSpaceToolBehavior:["type",hv]}],__init__:["gridSnapping"],gridSnapping:["type",lv]};function fv(e,t,n){e.on("autoPlace",2e3,(function(e){var i=e.source,r=wn(i),o=e.shape,s=hc(i,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==r[e]&&(s[e]>r[e]?n.min=s[e]:n.max=s[e],_r(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}fv.$inject=["eventBus","gridSnapping","elementRegistry"];function gv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();_r(r,"bpmn:Participant")&&_r(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})))}))}gv.$inject=["canvas","eventBus","gridSnapping"];function yv(e,t,n){Ho.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 vv(e,t,n){var i=Tt(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]}yv.$inject=["eventBus","gridSnapping","modeling"],e(yv,Ho),yv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=vv(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var bv={__depends__:[mv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fv],gridSnappingParticipantBehavior:["type",gv],gridSnappingLayoutConnectionBehavior:["type",yv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ov]};function wv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return _r(t,"bpmn:Lane")?n._createParticipantHit(t,i):_r(t,"bpmn:Participant")?Vr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):_r(t,"bpmn:SubProcess")?Vr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}wv.$inject=["eventBus","interactionEvents"],wv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},wv.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=Hr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},wv.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 xv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",wv]};function Ev(e){e.invoke(Gs,this)}e(Ev,Gs),Ev.$inject=["injector"],Ev.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Gs.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 _v={__depends__:[Qs],__init__:["keyboardBindings"],keyboardBindings:["type",Ev]},Ov={moveSpeed:1,moveSpeedAccelerated:10},Pv="left",kv="right",Sv="down",Cv={ArrowLeft:Pv,Left:Pv,ArrowUp:"up",Up:"up",ArrowRight:kv,Right:kv,ArrowDown:Sv,Down:Sv},Av={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 Tv(e,t,n,i,r){var o=this;this._config=I({},Ov,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=Cv[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=Av[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Tv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Mv={__depends__:[Qs,Rs],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Tv]};function Rv(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=yn(e);return vn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("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:yn(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=fn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function Dv(e,t){var n=wn(e),i=yn(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 Nv(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"}Rv.prototype.canResize=function(e){var t=this._rules,n=j(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rv.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,Dv(t,r),"resize",{autoActivate:!0,cursor:Nv(r),data:{shape:t,context:i}})},Rv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=yn(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?yn(i):o;return vn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:yu(o.bottom,s.bottom),right:yu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Ou(t,e.childrenBoxPadding))},Rv.$inject=["eventBus","rules","modeling","dragging"];var $v="djs-resizing",Bv="resize-not-ok";function Iv(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,$v)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),i.canExecute?ke(s).remove(Bv):ke(s).add(Bv)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&He(n.frame),t.removeMarker(i,$v)}))}Iv.$inject=["eventBus","canvas","previewSupport"];var Lv=-6,jv="djs-resizer",qv=["n","w","s","e","nw","ne","se","sw"];function zv(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,B(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}zv.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){bs(t)&&i.activate(t,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},zv.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=Lv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Lv);return t}(i),s=De("g");ke(s).add(jv),ke(s).add(jv+"-"+e.id),ke(s).add(jv+"-"+i),we(r,s);var a=De("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),ke(a).add(jv+"-visual"),we(s,a);var l=De("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),ke(l).add(jv+"-hit"),we(s,l),Kn(s,t,n),s},zv.prototype.createResizer=function(e,t){var n=Dv(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},zv.prototype.addResizer=function(e){var t=this;!hn(e)&&this._resize.canResize({shape:e})&&v(qv,(function(n){t.createResizer(e,n)}))},zv.prototype.removeResizers=function(){Ce(this._getResizersParent())},zv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},zv.$inject=["eventBus","canvas","selection","resize"];var Fv={__depends__:[Dc,Cc,Fp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rv],resizePreview:["type",Iv],resizeHandles:["type",zv]};function Vv(e,t,n,i,r,o,s){function a(e,t){(t||Or(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Hv(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 Hv(e){return _r(e,"bpmn:SubProcess")&&!Vr(e)}Vv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vv.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var i={},r=n.style||{};return I(r,{backgroundColor:null,border:null}),(Or(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Hv(e))&&I(i,{centerVertically:!0}),Kr(e)&&(I(i,{autoResize:!0}),I(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),_r(e,"bpmn:TextAnnotation")&&(I(i,{resizable:!0,autoResize:!0}),I(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),I(n,{options:i,style:r}),n}},Vv.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(_r(e,"bpmn:Lane")||function(e){return _r(e,"bpmn:Participant")&&Vr(e)}(e)){var f=Hr(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 _r(e,"bpmn:Participant")&&!Vr(e)}(e)){var g=Hr(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)"})}(Or(e,["bpmn:Task","bpmn:CallActivity"])||Hv(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 _r(e,"bpmn:SubProcess")&&Vr(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"})),Kr(n)&&!Yr(n)&&!mn(n)){var w=Jr(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),E=p+v+b;I(s,{width:y,height:E,x:x.x-y/2,y:x.y-E/2}),I(m,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return _r(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}},Vv.prototype.update=function(e,t,n,i){var r,o,s;_r(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 Uv="djs-element-hidden",Wv="djs-label-hidden";function Gv(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(_r(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=De("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=De("path");Oe(p,{d:c,strokeWidth:2,stroke:Qv(i)}),we(o,p),we(a,o),Yn(o,i.x,i.y)}_r(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,Uv):(_r(i,"bpmn:Task")||_r(i,"bpmn:CallActivity")||_r(i,"bpmn:SubProcess")||_r(i,"bpmn:Participant")||_r(i,"bpmn:Lane"))&&t.addMarker(i,Wv)})),e.on("directEditing.resize",(function(e){if(_r(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}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Uv),t.removeMarker(i,Wv)),i=void 0,r=void 0,o&&(He(o),o=void 0)}))}function Qv(e,t){return kr(e).get("stroke")||t||"black"}Gv.$inject=["eventBus","canvas","pathMap"];var Xv={__depends__:[Vo,Fv,Ey],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vv],labelEditingPreview:["type",Gv]},Kv=new $o("tt");function Yv(e,t){e.style.display=!1===t?"none":""}var Zv="djs-tooltip",Jv="."+Zv;function eb(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Kv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Q(i=fe('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;ue.bind(this._tooltipRoot,Jv,"mousedown",(function(e){e.stopPropagation()})),ue.bind(this._tooltipRoot,Jv,"mouseover",(function(e){r.trigger("mouseover",e)})),ue.bind(this._tooltipRoot,Jv,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}eb.$inject=["eventBus","canvas"],eb.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},eb.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)))},eb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},eb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},eb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},eb.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},eb.prototype.show=function(){Yv(this._tooltipRoot)},eb.prototype.hide=function(){Yv(this._tooltipRoot,!1)},eb.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},eb.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=fe(i)),Q(t=fe('<div data-tooltip-id="'+n+'" class="'+Zv+'">'),{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)},eb.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Q(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},eb.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),Yv(i,r))}))},eb.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 tb={__init__:["tooltips"],tooltips:["type",eb]};function nb(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],(function(e){var t=e.context,r=t.shape;_r(t.target,"bpmn:Collaboration")&&(_r(r,"bpmn:FlowNode")?i(e,n("flow elements must be children of pools/participants")):_r(r,"bpmn:DataObjectReference")&&i(e,n("Data object must be placed within a pool/participant.")))}))}nb.$inject=["eventBus","tooltips","translate"];var ib={__depends__:[tb],__init__:["modelingFeedback"],modelingFeedback:["type",nb]};function rb(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=De("rect");return Oe(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||we(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||we(n,o=r()),i.updateConnectionOutline(o,t)}))}rb.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&v(i,(function(i){n=n||i.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},rb.prototype.updateConnectionOutline=function(e,t){var n=yt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},rb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},rb.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},rb.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},rb.$inject=["eventBus","styles","elementRegistry"];function ob(e,t,n){this._canvas=t;var i=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;i._updateMultiSelectionOutline(t)}))}ob.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ce(t);var n=e.length>1;if(ke(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}}(yt(e)),r=De("rect");Oe(r,I({rx:3},i)),ke(r).add("djs-selection-outline"),we(t,r)}},ob.$inject=["eventBus","canvas","selection"];var sb={__depends__:[Rs],__init__:["outline","multiSelectionOutline"],outline:["type",rb],multiSelectionOutline:["type",ob]},ab=Math.round;function lb(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&&!ke(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+ab(e.width/2),y:e.y+ab(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=ab(i.x),i.y=ab(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(bs(e)){var t=ms(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}lb.$inject=["eventBus","dragging","modeling","selection","rules"];var cb="djs-dragging",pb="drop-ok",ub="drop-not-ok",db="new-parent",hb="attach-ok";function mb(e,t,n,r){function o(e){var t=function(e){var t=y(e,(function(t){return!hn(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=gt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),i=t.concat(n);return[...new Set(i)]}function a(e,n){[hb,pb,ub,db].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=De("g");Oe(d,n.cls("djs-drag-group",["no-events"])),we(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,cb)})),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,hb):t.canExecute&&r&&i.id!==r.id?a(i,db):a(i,t.canExecute?pb:ub)),Yn(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,cb)})),r&&He(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,cb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}mb.$inject=["eventBus","canvas","styles","previewSupport"];var fb={__depends__:[Ps,Rs,sb,Dc,Cc,Fp],__init__:["move","movePreview"],move:["type",lb],movePreview:["type",mb]},gb=".djs-palette-toggle",yb=".entry",vb=gb+", "+yb,bb="djs-palette-",wb="open",xb="two-column";function Eb(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 _b(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Eb.$inject=["eventBus","canvas"],Eb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Eb.prototype.getEntries=function(){return this._getProviders().reduce(_b,{})},Eb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Eb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=fe(Eb.HTML_MARKUP);n.appendChild(i),Y(n).add(bb+"shown"),ue.bind(i,vb,"click",(function(t){if(ge(t.delegateTarget,gb))return e.toggle();e.trigger("click",t)})),le.bind(i,"mousedown",(function(e){e.stopPropagation()})),ue.bind(i,yb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Eb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Eb.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(xb,t),s.toggle(bb+xb,t),"open"in e&&(o.toggle(wb,e.open),s.toggle(bb+wb,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Eb.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="+Qo(i)+"]",e);r||(X(r=fe('<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=fe(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=fe("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Eb.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()},Eb.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()}},Eb.prototype._layoutChanged=function(){this._toggleState({})},Eb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Eb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Eb.prototype.open=function(){this._toggleState({open:!0})},Eb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Eb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Eb.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")}}))},Eb.prototype.isOpen=function(){return Y(this._container).has(wb)},Eb.prototype._getParentContainer=function(){return this._canvas.getContainer()},Eb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Ob={__init__:["palette"],palette:["type",Eb]},Pb="crosshair";function kb(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();Oe(n=e.frame=De("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),we(i,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&He(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=Sb(e),r=i.filter((function(e){return e})),o=xs(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Sb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Sb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Sb(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}}kb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],kb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Pb,data:{context:{}}})},kb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Pb,data:{context:{}},keepSelection:!0})},kb.prototype.select=function(e,t,n=[]){var i=vt(e,t);this._selection.select([...n,...P(i)])},kb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},kb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Cb={__depends__:[$m,mm],__init__:["lassoTool"],lassoTool:["type",kb]},Ab=1500,Tb="grab";function Mb(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",Ab,(function(e){if(ws(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ab,(function(e){if(Rb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ab,(function(e){Rb(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!ws(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Rb(e){return js("Space",e)}Mb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Tb,data:{context:n||{}}})},Mb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Tb,data:{context:{reactivate:n}}})},Mb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Db={__depends__:[$m,mm],__init__:["handTool"],handTool:["type",Mb]},Nb="connect-ok",$b="connect-not-ok";function Bb(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?Nb:$b))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Nb:$b)})),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}))}Bb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Ib={__depends__:[$p,Dc,Cc,$m,mm],globalConnect:["type",Bb]};function Lb(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)}Lb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Lb.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 jb={__depends__:[Ob,dm,tf,Cb,Db,Ib,Ao],__init__:["paletteProvider"],paletteProvider:["type",Lb]};function qb(e,t,n,i,r){Ho.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="'+Qo(l.id)+'"]',e.dragGroup);p&&Oe(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="'+Qo(i)+'"]',e.dragGroup);r&&Oe(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}qb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(qb,Ho);var zb={__depends__:[Fp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",qb]},Fb=40,Vb=20,Hb=10,Ub=20,Wb=["x","y"],Gb=Math.abs;function Qb(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&&Ls(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Wb.forEach((function(i){var r=Yb(i,t);e[i]<t[i]+n?Op(e,i,t[i]+n):e[i]>t[i]+r-n&&Op(e,i,t[i]+r-n)}))}(e,r,function(e){return _r(e,"bpmn:Task")?Hb:Vb}(r)),r&&function(e,t){return E(t,(function(t){return Kb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Ep(i),Or(r,["bpmn:Event","bpmn:Gateway"])&&Xb(e,Ep(r)),Or(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Ep(t);Wb.forEach((function(i){(function(e,t,n){return e[n]>t[n]+Ub&&e[n]<t[n]+Yb(n,t)-Ub})(e,t,i)&&Op(e,i,n[i])}))}(e,r),_r(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=Ep(n),o=xn(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];Gb(i-r[t])<Fb&&(n=i>r[t]?r[t]+Fb:r[t]-Fb,Op(e,t,n))}))}(e)):Kb(n,"bpmn:MessageFlow")?(_r(i,"bpmn:Event")&&(t.connectionStart=Ep(i)),_r(r,"bpmn:Event")&&Xb(e,Ep(r))):t.connectionStart=t.initialConnectionStart)}))}function Xb(e,t){Op(e,"x",t.x),Op(e,"y",t.y)}function Kb(e,t){return e&&e.type===t}function Yb(e,t){return"x"===e?t.width:t.height}function Zb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Jb(){this._snapValues={}}Qb.$inject=["eventBus"],Zb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Zb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Zb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Zb.prototype.getSnapLocations=function(){return this._snapLocations},Zb.prototype.setSnapLocations=function(e){this._snapLocations=e},Zb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Jb).initDefaults(this._defaultSnaps),n},Jb.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)},Jb.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],vp(r-e)<=n)return r}(e[n],r[n],i)},Jb.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var ew=1250;function tw(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"],ew,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Ls(e.originalEvent))&&!_p(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()}))}tw.$inject=["elementRegistry","eventBus","snapping"],tw.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Zb);var s=(t=n.get(r.id)?Ep(r,e):{x:e.x+Ep(r).x,y:e.y+Ep(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}),mn(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},tw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(mn(n))mn(t)&&e.add("mid",Ep(n));else if(hn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Ep(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Ep(t)),e):e},tw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(e){return!e.hidden}))};function nw(e,t){t.invoke(tw,this),e.on(["create.move","create.end"],1500,iw),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)&&!_p(e)&&function(e,t){var n,i=yn(t),r=gh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:wn(s);/top/.test(r)?Op(e,"y",i.top-n.y):/bottom/.test(r)&&Op(e,"y",i.bottom-n.y);/left/.test(r)?Op(e,"x",i.left-n.x):/right/.test(r)&&Op(e,"x",i.right-n.x)}(e,i)}))}function iw(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)&&Op(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Op(e,"y",e.y)}}function rw(e,t){return-1!==e.indexOf(t)}function ow(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(nw,tw),nw.$inject=["eventBus","injector"],nw.prototype.initSnap=function(e){var t=tw.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",ow(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",ow(r,i,e))})),_r(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},nw.prototype.addSnapTargetPoints=function(e,t,n){tw.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);v(i,(function(n){var i;(function(e){if(_r(e,"bpmn:SubProcess")&&Vr(e))return!0;return _r(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return _r(e,i)}))))&&(e.add("top-left",wp(n)),e.add("bottom-right",xp(n)))}));var r=this._elementRegistry;return v(t.incoming,(function(n){if(r.get(t.id)){rw(i,n.source)||e.add("mid",wn(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)){rw(i,n.target)||e.add("mid",wn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),_r(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},nw.prototype.getSnapTargets=function(e,t){return tw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!_r(e,"bpmn:Lane")}))};function sw(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&&Ls(e.originalEvent)||_p(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)&&Op(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Op(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function aw(e,t){var n=wn(e),i=yn(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}sw.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Zb);var o=aw(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},sw.prototype.addSnapTargetPoints=function(e,t,n,i){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",xp(t)),e.add("corner",wp(t))})),e.add("corner",aw(t,i)),e},sw.$inject=["eventBus","snapping"],sw.prototype.getSnapTargets=function(e,t){return Pp(t).filter((function(t){return!(n=t,i=e,n.host===i||hn(t)||function(e){return!!e.hidden}(t)||mn(t));var n,i}))};function lw(e){this._canvas=e,this._asyncHide=$(B(this.hide,this),1e3)}lw.$inject=["canvas"],lw.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:_p(e,"x"),y:_p(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)&&Op(e,t,n.originValue)}))},lw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return Oe(n,{d:"M0,0 L0,0"}),ke(n).add("djs-snap-line"),we(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},lw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},lw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},lw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},lw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var cw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",tw],resizeSnapping:["type",sw],snapping:["type",lw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Qb],createMoveSnapping:["type",nw]};function pw(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ye(pw.INPUT_SELECTOR,this._container),this._resultsContainer=ye(pw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function uw(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n=Ko(e.value||e.matched||e.normal),i=e.match||e.matched;t+=i?'<b class="'+pw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),r=fe(n);r.innerHTML=i,e.appendChild(r)}pw.$inject=["canvas","eventBus","selection","translate"],pw.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:ue.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,pw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,pw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,pw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,pw.INPUT_SELECTOR,"keydown",(function(e){js("ArrowUp",e)&&e.preventDefault(),js("ArrowDown",e)&&e.preventDefault()})),t(this._container,pw.INPUT_SELECTOR,"keyup",(function(t){if(js("Escape",t))return e.close();if(js("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return js("ArrowUp",t)?e._scrollToDirection(!0):js("ArrowDown",t)?e._scrollToDirection():void(js(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},pw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ue.unbind(e.el,e.type,e.listener)}))},pw.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).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(pw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},pw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},pw.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)}},pw.prototype._clearResults=function(){J(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},pw.prototype._getCurrentResult=function(){return ye(pw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},pw.prototype._createResultNode=function(e,t){var n=fe(pw.RESULT_HTML);return e.primaryTokens.length>0&&uw(n,e.primaryTokens,pw.RESULT_PRIMARY_HTML),uw(n,e.secondaryTokens,pw.RESULT_SECONDARY_HTML),X(n,pw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},pw.prototype.registerProvider=function(e){this._searchProvider=e},pw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Y(this._canvas.getContainer()).add("djs-search-open"),Y(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},pw.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Y(this._canvas.getContainer()).remove("djs-search-open"),Y(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},pw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pw.prototype.isOpen=function(){return this._open},pw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Y(t).remove(pw.RESULT_SELECTED_CLASS);var n=X(e,pw.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Y(e).add(pw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},pw.prototype._select=function(e){var t=X(e,pw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},pw.prototype._getBoxHtml=function(){const e=fe(pw.BOX_HTML),t=ye(pw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},pw.CONTAINER_SELECTOR=".djs-search-container",pw.INPUT_SELECTOR=".djs-search-input input",pw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",pw.RESULT_SELECTOR=".djs-search-result",pw.RESULT_SELECTED_CLASS="djs-search-result-selected",pw.RESULT_SELECTED_SELECTOR="."+pw.RESULT_SELECTED_CLASS,pw.RESULT_ID_ATTRIBUTE="data-result-id",pw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",pw.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <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"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',pw.RESULT_HTML='<div class="djs-search-result"></div>',pw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',pw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var dw={__depends__:[Ao,zo,Rs],searchPad:["type",pw]};function hw(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}function mw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}hw.$inject=["elementRegistry","searchPad","canvas","search"],hw.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!mn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:to(e),id:e.id}))),e,{keys:["label","id"]}).map(mw)};var fw={__depends__:[dw,Ul],__init__:["bpmnSearch"],bpmnSearch:["type",hw]};const gw={width:36,height:50},yw={width:50,height:50};function vw(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function bw(e,t){this._styles=t,e.registerProvider(this)}function ww(e,t){var n;return"bpmn:DataObjectReference"===t?n=gw:"bpmn:DataStoreReference"===t&&(n=yw),e.width===n.width&&e.height===n.height}bw.$inject=["outline","styles"],bw.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!mn(e))return _r(e,"bpmn:Gateway")?(I((n=De("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Or(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=De("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):_r(e,"bpmn:EndEvent")?Oe(n=De("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):_r(e,"bpmn:Event")?Oe(n=De("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):_r(e,"bpmn:DataObjectReference")&&ww(e,"bpmn:DataObjectReference")?n=vw("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):_r(e,"bpmn:DataStoreReference")&&ww(e,"bpmn:DataStoreReference")&&(n=vw("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},bw.prototype.updateOutline=function(e,t){if(!mn(e))return Or(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Or(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var xw={__depends__:[sb],__init__:["outlineProvider"],outlineProvider:["type",bw]};function Ew(e){Fr.call(this,e)}e(Ew,Fr),Ew.Viewer=Ds,Ew.NavigatedViewer=ha,Ew.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>')},Ew.prototype._interactionModules=[Ys,sa,da],Ew.prototype._modelingModules=[Jl,gc,Mc,xc,Ap,$p,Ip,Uy,Om,dm,Zy,rv,bv,xv,_v,Mv,Xv,dy,ib,fb,jb,zb,Fv,cw,fw,xw],Ew.prototype._modules=[].concat(Ds.prototype._modules,Ew.prototype._interactionModules,Ew.prototype._modelingModules);var _w=new $o,Ow={min:.2,max:4};function Pw(e,t,n,i,r){var o=this;function s(e){o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Sw(kw({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function a(e){return function(t){var n=$w(t);o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var r=kw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=i.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(r,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};I(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),le.bind(document,"mousemove",l),le.bind(document,"mouseup",c)}}function l(e){var t=$w(e);if(o._state.isDragging){o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;I(o._viewportDom.style,{top:t.y-n.y-r.top+"px",left:t.x-n.x-r.left+"px"});var s=Rw(r,{top:t.y-n.y-r.top,left:t.x-n.x-r.left,width:i.width,height:i.height});I(o._overlay.style,{clipPath:s});var a=kw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=$w(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),I(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),le.unbind(document,"mousemove",l),le.unbind(document,"mouseup",c))}this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=_w.next(),this._init(),this.toggle(e&&e.open||!1),le.bind(this._viewportDom,"mousedown",a(!1)),le.bind(this._svg,"mousedown",a(!0)),le.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Tw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,r=0===e.deltaMode?.02:.32,s=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Mw(e.deltaY)*-r;if(o._state.zoomDelta+=s,Math.abs(o._state.zoomDelta)>.1){var a=s>0?1:-1,l=Math.log(i.zoom())/Math.log(10),c=function(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(i))/t}(Ow,20),p=Math.round(l/c)*c;p+=c*a;var u=Math.pow(10,p);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ow,u),d),o._state.zoomDelta=0;var d=kw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sw(d,o._canvas),o._update()}}})),le.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function kw(e,t,n){var i=t.getBoundingClientRect(),r=function(e,t){var n=e.width/e.height,i=I({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t);I(i,{y:i.y-(r-i.height)/2,height:r})}else if(n<t){var o=i.height*t;I(i,{x:i.x-(o-i.width)/2,width:o})}return i}(n,i.width/i.height);return{x:Cw(e.x,0,i.width,r.x,r.x+r.width),y:Cw(e.y,0,i.height,r.y,r.y+r.height)}}function Sw(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function Cw(e,t,n,i,r){return(e-t)*(r-i)/(n-t)+i}function Aw(e,t,n){var i=function(e){var t=ye(".children",e);t||we(e,t=De("g",{class:"children"}));return t}(t),r=[].slice.call(i.childNodes)[n];r?t.insertBefore(e,r.nextSibling):t.appendChild(e)}function Tw(e){return 0===e.width&&0===e.height}Pw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Pw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");Y(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");Y(n).add("toggle"),t.appendChild(n);var i=this._map=document.createElement("div");Y(i).add("map"),t.appendChild(i);var r=this._svg=De("svg");Oe(r,{width:"100%",height:"100%"}),we(i,r),we(r,this._elementsGroup=De("g"));var o=this._viewportGroup=De("g");we(r,o);var s=this._viewport=De("rect");ke(s).add("viewport"),we(o,s),le.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");Y(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");Y(l).add("overlay"),this._parent.appendChild(l)},Pw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Nw(e)){var i,r,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(i=t.x-a/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-l/2,s=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,s=t.height),i-=50,r-=50,o+=100,s+=100,this._lastViewbox={x:i,y:r,width:o,height:s},Oe(this._svg,{viewBox:i+", "+r+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};I(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Rw(c,u);I(this._overlay.style,{clipPath:d})}},Pw.prototype.open=function(){I(this._state,{isOpen:!0}),Y(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Pw.prototype.close=function(){I(this._state,{isOpen:!1}),Y(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Pw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Pw.prototype.isOpen=function(){return this._state.isOpen},Pw.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Pw.prototype._updateElementId=function(e,t){try{var n=ye("#"+Qo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Pw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Pw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,i,r,o=this._createElement(e),s=ye("#"+Qo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ye(".djs-children",t.parentNode);if(!n)return;var i=[].slice.call(n.childNodes),r=-1;return i.forEach((function(t,n){ye(".djs-element",t)===e&&(r=n)})),r}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Aw(o,s,a):Aw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(i=e.x,r=e.y,s&&(i-=(n=e.parent).x,r-=n.y),Oe(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),Oe(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Pw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&He(t)},Pw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Xn(n))){var i=function(e){return ve("[id]",e).forEach((function(e){e.remove()})),e}(Ae(t));return Oe(i,{id:this._prefixId(e.id)}),i}},Pw.prototype._clear=function(){Ce(this._elementsGroup)},Pw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Mw=Math.sign||function(e){return e>=0?1:-1};function Rw(e,t){return"polygon("+[Dw(t.left,t.top),Dw(t.left+t.width,t.top),Dw(t.left+t.width,t.top+t.height),Dw(t.left,t.top+t.height),Dw(t.left,e.height),Dw(e.width,e.height),Dw(e.width,0),Dw(0,0),Dw(0,e.height),Dw(t.left,e.height)].join(", ")+")"}function Dw(e,t){return e+"px "+t+"px"}function Nw(e){return x(e,(function(e){return p(e)?Nw(e):u(e)&&isFinite(e)}))}function $w(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Bw={__init__:["minimap"],minimap:["type",Pw]},Iw=1e5,Lw=1e5;function jw(e,t){this._canvas=e;var n=this;t.on("diagram.init",(function(){n._init(),n.toggle(!0)})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}jw.prototype._init=function(){var e=ye("defs",this._canvas._svg);e||(e=De("defs"),we(this._canvas._svg,e));var t=this._pattern=De("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:sv,height:sv,patternUnits:"userSpaceOnUse"});var i=this._circle=De("circle");Oe(i,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),we(t,i),we(e,t),Oe(this._gfx=De("rect"),{x:-Iw/2,y:-Lw/2,width:Iw,height:Lw,fill:`url(#${n})`})},jw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=wn(e);Oe(this._gfx,{x:-Iw/2+av(t.x,sv),y:-Lw/2+av(t.y,sv)})},jw.prototype.isVisible=function(){return this._visible},jw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?we(t,this._gfx):Ce(t),this._visible=e}},jw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},jw.$inject=["canvas","eventBus"];var qw={__init__:["grid"],grid:["type",jw]};function zw(e,t){var n,i,r=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;we(t.getLayer("djs-origin",-1),n=Hw("g",{"pointer-events":"none"})),!1!==e.showBorder&&we(n,Hw("path",{class:Vw("border"),d:Fw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:r,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),we(n,Hw("path",{d:Fw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Vw("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(i=Hw("text",{x:-40,y:-10,fill:o,class:Vw("label")})).textContent="(0, 0)",we(n,i)}function Fw(e){return e.join(" ")}function Vw(e){return"djs-origin-"+e}function Hw(e,t){var n=De(e);return Oe(n,t),n}zw.$inject=["config.origin","canvas"];var Uw={__init__:[zw]},Ww={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Gw(e,t,n,i,r,o){function s(e,n){var i=n.offset,r=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+i[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<r?0:s})),o}function a(){var t=r.viewbox().inner,n=r.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||i.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,i=r.viewbox().scale;r.scroll({dx:e*n.x*i,dy:e*n.y*i})}))}}var c,p,d;e=function(e){var t=I({},Ww,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),i.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Gw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Qw={__init__:["alignToOrigin"],alignToOrigin:["type",Gw]};function Xw(e){function t(e){if(!e.labelTarget){var t=Pr(e);_r(t,"bpmn:Participant")&&(t=t.processRef),_r(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}Xw.$inject=["eventBus"];var Kw,Yw,Zw,Jw,ex,tx,nx,ix,rx={__init__:[Xw]},ox={},sx=[],ax=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,lx=Array.isArray;function cx(e,t){for(var n in t)e[n]=t[n];return e}function px(e){var t=e.parentNode;t&&t.removeChild(e)}function ux(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?Kw.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 dx(e,s,i,r,null)}function dx(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,constructor:void 0,__v:null==r?++Zw:r,__i:-1,__u:0};return null==r&&null!=Yw.vnode&&Yw.vnode(o),o}function hx(e){return e.children}function mx(e,t){this.props=e,this.context=t}function fx(e,t){if(null==t)return e.__?fx(e.__,e.__i+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?fx(e):null}function gx(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 gx(e)}}function yx(e){(!e.__d&&(e.__d=!0)&&Jw.push(e)&&!vx.__r++||ex!==Yw.debounceRendering)&&((ex=Yw.debounceRendering)||tx)(vx)}function vx(){var e,t,n,i,r,o,s,a,l;for(Jw.sort(nx);e=Jw.shift();)e.__d&&(t=Jw.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=cx({},r)).__v=r.__v+1,Yw.vnode&&Yw.vnode(i),Sx(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?fx(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Cx(a,i,l),i.__e!=o&&gx(i)),Jw.length>t&&Jw.sort(nx));vx.__r=0}function bx(e,t,n,i,r,o,s,a,l,c,p){var u,d,h,m,f,g=i&&i.__k||sx,y=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?dx(null,r,null,null,r):lx(r)?dx(hx,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?dx(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=Ex(r,n,s=i+u,p),r.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==i+u&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=fx(o)),Tx(o,o,!1),n[i]=null,p--);if(p)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=fx(o)),Tx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?ox:g[h.__i]||ox,h.__i=u,Sx(e,h,d,r,o,s,a,l,c,p),m=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Ax(d.ref,null,h),p.push(h.ref,h.__c||m,h)),null==f&&null!=m&&(f=m),65536&h.__u||d.__k===h.__k?l=wx(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:m&&(l=m.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=f}function wx(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=wx(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function xx(e,t){return t=t||[],null==e||"boolean"==typeof e||(lx(e)?e.some((function(e){xx(e,t)})):t.push(e)),t}function Ex(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function _x(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||ax.test(t)?n:n+"px"}function Ox(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||_x(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||_x(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?kx:Px,o)):e.removeEventListener(t,o?kx:Px,o);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Px(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Yw.event?Yw.event(e):e)}function kx(e){return this.l[e.type+!0](Yw.event?Yw.event(e):e)}function Sx(e,t,n,i,r,o,s,a,l,c){var p,u,d,h,m,f,g,y,v,b,w,x,E,_,O,P=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=Yw.__b)&&p(t);e:if("function"==typeof P)try{if(y=t.props,v=(p=P.contextType)&&i[p.__c],b=p?v?v.props.value:p.__:i,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in P&&P.prototype.render?t.__c=u=new P(y,b):(t.__c=u=new mx(y,b),u.constructor=P,u.render=Mx),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=i,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=P.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=cx({},u.__s)),cx(u.__s,P.getDerivedStateFromProps(y,u.__s))),h=u.props,m=u.state,u.__v=t,d)null==P.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==P.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,m,f)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=Yw.__r,E=0,"prototype"in P&&P.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),_=0;_<u._sb.length;_++)u.__h.push(u._sb[_]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++E<25);u.state=u.__s,null!=u.getChildContext&&(i=cx(cx({},i),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(f=u.getSnapshotBeforeUpdate(h,m)),bx(e,lx(O=null!=p&&p.type===hx&&null==p.key?p.props.children:p)?O:[O],t,n,i,r,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),Yw.__e(e,t,n)}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,l){var c,p,u,d,h,m,f,g=n.props,y=t.props,v=t.type;if("svg"===v&&(r=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=r?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&Kw.call(e.childNodes),g=n.props||ox,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Ox(e,c,null,h,r));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?m=h:"checked"==c?f=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Ox(e,c,h,g[c],r);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),bx(e,lx(d)?d:[d],t,n,i,r&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&fx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&px(o[c]);a||(c="value",void 0!==m&&(m!==e[c]||"progress"===v&&!m||"option"===v&&m!==g[c])&&Ox(e,c,m,g[c],!1),c="checked",void 0!==f&&f!==e[c]&&Ox(e,c,f,g[c],!1))}return e}(n.__e,t,n,i,r,o,s,l,c);(p=Yw.diffed)&&p(t)}function Cx(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Ax(n[i],n[++i],n[++i]);Yw.__c&&Yw.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Yw.__e(e,t.__v)}}))}function Ax(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Yw.__e(e,n)}}function Tx(e,t,n){var i,r;if(Yw.unmount&&Yw.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Ax(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Yw.__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]&&Tx(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||px(e.__e),e.__=e.__e=e.__d=void 0}function Mx(e,t,n){return this.constructor(e,n)}function Rx(e,t,n){var i,r,o,s;Yw.__&&Yw.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Sx(t,e=(!i&&n||t).__k=ux(hx,null,[e]),r||ox,ox,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Kw.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Cx(o,e,s)}function Dx(e,t){var n={__c:t="__cC"+ix++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,yx(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}Kw=sx.slice,Yw={__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}},Zw=0,mx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=cx({},this.state),"function"==typeof e&&(e=e(cx({},n),this.props)),e&&cx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),yx(this))},mx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yx(this))},mx.prototype.render=hx,Jw=[],tx="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nx=function(e,t){return e.__v.__b-t.__v.__b},vx.__r=0,ix=0;var Nx,$x,Bx,Ix,Lx=0,jx=[],qx=[],zx=Yw.__b,Fx=Yw.__r,Vx=Yw.diffed,Hx=Yw.__c,Ux=Yw.unmount;function Wx(e,t){Yw.__h&&Yw.__h($x,e,Lx||t),Lx=0;var n=$x.__H||($x.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:qx}),n.__[e]}function Gx(e){return Lx=1,Qx(aE,e)}function Qx(e,t,n){var i=Wx(Nx++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):aE(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=$x,!$x.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.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)&&(!o||o.call(this,e,t,n))};$x.u=!0;var o=$x.shouldComponentUpdate,s=$x.componentWillUpdate;$x.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},$x.shouldComponentUpdate=r}return i.__N||i.__}function Xx(e,t){var n=Wx(Nx++,3);!Yw.__s&&sE(n.__H,t)&&(n.__=e,n.i=t,$x.__H.__h.push(n))}function Kx(e,t){var n=Wx(Nx++,4);!Yw.__s&&sE(n.__H,t)&&(n.__=e,n.i=t,$x.__h.push(n))}function Yx(e){return Lx=5,Zx((function(){return{current:e}}),[])}function Zx(e,t){var n=Wx(Nx++,7);return sE(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jx(e,t){return Lx=8,Zx((function(){return e}),t)}function eE(e){var t=$x.context[e.__c],n=Wx(Nx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub($x)),t.props.value):e.__}function tE(){for(var e;e=jx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(rE),e.__H.__h.forEach(oE),e.__H.__h=[]}catch(t){e.__H.__h=[],Yw.__e(t,e.__v)}}Yw.__b=function(e){$x=null,zx&&zx(e)},Yw.__r=function(e){Fx&&Fx(e),Nx=0;var t=($x=e.__c).__H;t&&(Bx===$x?(t.__h=[],$x.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=qx,e.__N=e.i=void 0}))):(t.__h.forEach(rE),t.__h.forEach(oE),t.__h=[],Nx=0)),Bx=$x},Yw.diffed=function(e){Vx&&Vx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==jx.push(t)&&Ix===Yw.requestAnimationFrame||((Ix=Yw.requestAnimationFrame)||iE)(tE)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==qx&&(e.__=e.__V),e.i=void 0,e.__V=qx}))),Bx=$x=null},Yw.__c=function(e,t){t.some((function(e){try{e.__h.forEach(rE),e.__h=e.__h.filter((function(e){return!e.__||oE(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Yw.__e(n,e.__v)}})),Hx&&Hx(e,t)},Yw.unmount=function(e){Ux&&Ux(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{rE(e)}catch(e){t=e}})),n.__H=void 0,t&&Yw.__e(t,n.__v))};var nE="function"==typeof requestAnimationFrame;function iE(e){var t,n=function(){clearTimeout(i),nE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);nE&&(t=requestAnimationFrame(n))}function rE(e){var t=$x,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),$x=t}function oE(e){var t=$x;e.__c=e.__(),$x=t}function sE(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function aE(e,t){return"function"==typeof t?t(e):t}function lE(e,t){for(var n in t)e[n]=t[n];return e}function cE(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function pE(e){this.props=e}(pE.prototype=new mx).isPureReactComponent=!0,pE.prototype.shouldComponentUpdate=function(e,t){return cE(this.props,e)||cE(this.state,t)};var uE=Yw.__b;Yw.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),uE&&uE(e)};var dE="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function hE(e){function t(t){var n=lE({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=dE,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var mE=Yw.__e;Yw.__e=function(e,t,n,i){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);mE(e,t,n,i)};var fE=Yw.unmount;function gE(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=lE({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return gE(e,t,n)}))),e}function yE(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return yE(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function vE(){this.__u=0,this.t=null,this.__b=null}function bE(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function wE(){this.u=null,this.o=null}Yw.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),fE&&fE(e)},(vE.prototype=new mx).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var r=bE(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=yE(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},vE.prototype.componentWillUnmount=function(){this.t=[]},vE.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=gE(this.__b,n,i.__O=i.__P)}this.__b=null}var r=t.__a&&ux(hx,null,e.fallback);return r&&(r.__u&=-33),[ux(hx,null,t.__a?null:e.children),r]};var xE=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function EE(e){return this.getChildContext=function(){return e.context},e.children}function _E(e){var t=this,n=e.i;t.componentWillUnmount=function(){Rx(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),Rx(ux(EE,{context:t.context},e.__v),t.l)}function OE(e,t){var n=ux(_E,{__v:e,i:t});return n.containerInfo=t,n}(wE.prototype=new mx).__a=function(e){var t=this,n=bE(t.__v),i=t.o.get(e);return i[0]++,function(r){var o=function(){t.props.revealOrder?(i.push(r),xE(t,e,i)):r()};n?n(o):o()}},wE.prototype.render=function(e){this.u=null,this.o=new Map;var t=xx(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},wE.prototype.componentDidUpdate=wE.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){xE(e,n,t)}))};var PE="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,kE=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,SE=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,CE=/[A-Z0-9]/g,AE="undefined"!=typeof document,TE=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};mx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(mx.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var ME=Yw.event;function RE(){}function DE(){return this.cancelBubble}function NE(){return this.defaultPrevented}Yw.event=function(e){return ME&&(e=ME(e)),e.persist=RE,e.isPropagationStopped=DE,e.isDefaultPrevented=NE,e.nativeEvent=e};var $E={enumerable:!1,configurable:!0,get:function(){return this.class}},BE=Yw.vnode;Yw.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var r in t){var o=t[r];if(!("value"===r&&"defaultValue"in t&&null==o||AE&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===o?o="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||TE(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":SE.test(r)?r=s:-1===n.indexOf("-")&&kE.test(r)?r=r.replace(CE,"-$&").toLowerCase():null===o&&(o=void 0):s=r="oninput","oninput"===s&&i[r=s]&&(r="oninputCapture"),i[r]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=xx(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=xx(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",$E)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=PE,BE&&BE(e)};var IE=Yw.__r;Yw.__r=function(e){IE&&IE(e),e.__c};var LE=Yw.diffed;Yw.diffed=function(e){LE&&LE(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),null};var jE=ux,qE=0;function zE(e,t,n,i,r,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--qE,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Yw.vnode&&Yw.vnode(c),c}function FE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var VE,HE={exports:{}};
172
172
  /*!
173
173
  Copyright (c) 2018 Jed Watson.
174
174
  Licensed under the MIT License (MIT), see