@sentropic/design-system-elements 0.2.0 → 0.3.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.
- package/LICENSE.THIRD-PARTY.md +44 -1
- package/README.md +81 -13
- package/catalog.json +401 -7
- package/dist/browser/chunks/{Modeler-BfAmwsmK.js → Modeler-D87tL_OJ.js} +4 -4
- package/dist/browser/chunks/Viewer-D9zjRrp2.js +4 -0
- package/dist/browser/chunks/bpmn-canvas-BevbP_6a.js +1 -0
- package/dist/browser/chunks/bpmn-mount-BhO_zb0S.js +2202 -0
- package/dist/browser/chunks/dist-DRauAwm2.js +6 -0
- package/dist/browser/chunks/{entropic-CM5BHERN.js → entropic-MwNVEq6w.js} +639 -0
- package/dist/browser/chunks/focus-renderer-BWm7DlQD.js +55 -0
- package/dist/browser/chunks/{forge-B8hrW4lA.js → forge-CzwO8Hbe.js} +639 -0
- package/dist/browser/chunks/layout-T3X333Za.js +1 -0
- package/dist/browser/elements.js +671 -6
- package/dist/browser/sri.json +52 -45
- package/dist/contracts/bar-chart.js +2 -2
- package/dist/contracts/decision-dossier.d.ts +4 -8
- package/dist/contracts/decision-dossier.js +8 -12
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/time-series-chart.d.ts +49 -0
- package/dist/contracts/time-series-chart.js +37 -0
- package/dist/dossier/dossier-mount.js +845 -0
- package/dist/dossier/renderer/dossier.css +2 -0
- package/dist/element/bpmn-mount.d.ts +11 -0
- package/dist/element/bpmn-mount.js +56 -0
- package/dist/element/bpmn-types.d.ts +27 -0
- package/dist/element/bpmn-types.js +12 -0
- package/dist/element/bpmn.d.ts +10 -0
- package/dist/element/bpmn.js +39 -0
- package/dist/element/dom/dossier-mount.d.ts +25 -0
- package/dist/element/dom/dossier-review-mount.d.ts +25 -0
- package/dist/element/dom/dossier-review-state.svelte.d.ts +13 -0
- package/dist/element/dom/engines/bpmn-canvas.d.ts +11 -0
- package/dist/element/dom/engines/bpmn-canvas.js +11 -0
- package/dist/element/dom/engines/dossier-diagrams.d.ts +5 -0
- package/dist/element/dom/engines/dossier-evidence.d.ts +9 -0
- package/dist/element/dom/engines/dossier-styles.d.ts +21 -0
- package/dist/element/dom/engines/focus-renderer.d.ts +60 -0
- package/dist/element/dom/engines/focus-snapshot.d.ts +3 -0
- package/dist/element/dom/intents.d.ts +20 -0
- package/dist/element/markdown/minimal-markdown.d.ts +1 -2
- package/dist/element/markdown/minimal-markdown.js +19 -1
- package/dist/element/validator.d.ts +26 -0
- package/dist/element/validator.js +54 -0
- package/dist/focus-diagrams/diagram-layout.d.ts +140 -0
- package/dist/focus-diagrams/diagram-layout.js +190 -0
- package/dist/focus-diagrams/diagram-source.d.ts +11 -0
- package/dist/focus-diagrams/diagram-source.js +147 -0
- package/dist/focus-diagrams/dossier-views.d.ts +21 -0
- package/dist/focus-diagrams/dossier-views.js +57 -0
- package/dist/focus-diagrams/ecosystem.json +853 -0
- package/dist/focus-kit/index.html +13 -0
- package/dist/focus-kit/renderer/dossier.css +2 -0
- package/dist/focus-kit/renderer/dossier.js +845 -0
- package/dist/focus-kit-manifest.json +1 -0
- package/dist/focus-kit.d.ts +9 -0
- package/dist/focus-kit.js +30 -0
- package/dist/format-time-series-markdown.d.ts +5 -0
- package/dist/format-time-series-markdown.js +24 -0
- package/dist/generator/parity.js +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/ports/dossier-views.d.ts +3 -0
- package/dist/ports/dossier-views.js +3 -0
- package/dist/ports/focus.d.ts +0 -1
- package/dist/ports/types.d.ts +0 -1
- package/dist/shells/BarChart.html +8494 -0
- package/dist/shells/BarChart.js +8482 -0
- package/dist/shells/DecisionDossier.html +8502 -0
- package/dist/shells/DecisionDossier.js +8490 -0
- package/dist/shells/TimeSeriesChart.html +8475 -0
- package/dist/shells/TimeSeriesChart.js +8463 -0
- package/dist/shells/manifest.json +108 -0
- package/dist/structure/interpreter.d.ts +1 -1
- package/dist/structure/interpreter.js +14 -4
- package/dist/time-series.d.ts +13 -0
- package/dist/time-series.js +15 -0
- package/dist/validate/envelope.js +5 -1
- package/dist/validate/time-series.d.ts +5 -0
- package/dist/validate/time-series.js +28 -0
- package/fixtures/time-series-multi.json +46 -0
- package/fixtures/time-series-single.json +28 -0
- package/fixtures/time-series-thresholds.json +52 -0
- package/package.json +40 -6
- package/schemas/BarChart.v1.json +2 -2
- package/schemas/DecisionDossier.v1.json +155 -5
- package/schemas/TimeSeriesChart.v1.json +287 -0
- package/skill/SKILL.md +27 -0
- package/dist/browser/chunks/Viewer-eYLzc3fD.js +0 -4
- package/dist/browser/chunks/bpmn-canvas-DeAWdJFy.js +0 -2207
- package/dist/browser/chunks/dist-O6_2ByYB.js +0 -1
- package/dist/browser/chunks/focus-renderer-0elVToA2.js +0 -10
- package/dist/browser/chunks/layout-q0TR9-aY.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"../elements.js";import{A as t,C as n,D as r,M as i,N as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,i as _,j as v,k as y,l as b,m as x,n as S,o as C,p as w,r as ee,s as te,t as T,u as ne,v as re,w as ie,x as ae,y as oe}from"./dist-Co2MgHWm.js";import{i as E,n as D,r as O,t as k}from"./ModelUtil-CMh7LuN4.js";import{a as se,c as ce,d as le,i as ue,l as A,o as de,r as fe,s as pe,t as me,u as j}from"./LabelUtil-7QpE43Ed.js";import{a as M,c as he,d as ge,f as _e,i as ve,l as ye,m as be,n as N,o as xe,p as Se,r as Ce,s as we,t as Te,u as Ee}from"./LayoutUtil-hAMJmJFU.js";import{a as De,i as Oe,n as P,o as F,r as I,t as L,u as ke}from"./dist-kvAYI1vo.js";import{A as Ae,C as je,D as Me,E as Ne,M as Pe,N as Fe,O as R,P as z,S as Ie,T as Le,_ as Re,b as ze,g as Be,j as Ve,k as He,l as Ue,r as We,v as B,w as Ge,x as Ke,y as qe}from"./BpmnRenderUtil-WMCgqGDs.js";import{a as Je,i as Ye,n as Xe,r as Ze,t as Qe}from"./BpmnUpdater-C-UNbzXl.js";import $e,{A as et,B as tt,C as nt,D as rt,E as it,F as at,H as ot,I as st,L as ct,M as lt,N as ut,O as dt,P as ft,R as pt,S as mt,T as ht,U as gt,V,W as _t,_ as vt,a as yt,b as bt,c as xt,d as St,f as Ct,g as wt,h as Tt,i as Et,j as Dt,k as Ot,l as kt,m as At,n as jt,o as Mt,p as Nt,r as Pt,s as Ft,t as It,u as Lt,v as Rt,w as zt,x as Bt,y as Vt,z as H}from"./Viewer-eYLzc3fD.js";import{c as Ht,d as Ut,f as Wt,h as Gt,l as Kt,m as qt,o as Jt,p as Yt,s as Xt,u as Zt}from"./bpmn-canvas-DeAWdJFy.js";function Qt(e){Rt.call(this,e),this.on(`import.parse.complete`,function(e){e.error||this._collectIds(e.definitions,e.elementsById)},this),this.on(`diagram.destroy`,function(){this.get(`moddle`).ids.clear()},this)}z(Qt,Rt),Qt.prototype._createModdle=function(e){var t=Rt.prototype._createModdle.call(this,e);return t.ids=new _t([32,36,1]),t},Qt.prototype._collectIds=function(e,t){var n=e.$model.ids,r;for(r in n.clear(),t)n.claim(r,t[r])};var $t=300;function en(e,t,n){this._selectionWasVisible=!1;let r=ee(()=>{this._selectionWasVisible=i()},$t);e.on(`canvas.viewbox.changed`,r),e.on(`selection.changed`,r),e.on(`diagram.destroy`,()=>{r.cancel()}),e.on(`canvas.resized`,()=>{var e=n.get();if(e.length&&this._selectionWasVisible&&!i()){var r=t.getRootElement();t.scrollToElement(e.concat(r))}});function i(){var e=n.get();if(!e.length)return!1;var r=it(e),i=t.viewbox(),a=N(r),o=N(i);return a.left>=o.left&&a.right<=o.right&&a.top>=o.top&&a.bottom<=o.bottom}this._flush=r.flush}en.$inject=[`eventBus`,`canvas`,`selection`];var tn={__init__:[`keepSelectionVisible`],__depends__:[It],keepSelectionVisible:[`type`,en]},nn=`keyboard.keydown`,rn=`keyboard.keyup`,an=1e3,on=`Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661`;function sn(e,t){var n=this;this._config=e||={},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on(`diagram.destroy`,function(){n._fire(`destroy`),n.unbind()}),e.bindTo&&console.error(`unsupported configuration <keyboard.bindTo>`,Error(on));var r=e&&e.bind!==!1;t.on(`canvas.init`,function(e){n._target=e.svg,r&&n.bind(),n._fire(`init`)})}sn.$inject=[`config.keyboard`,`eventBus`],sn.prototype._keydownHandler=function(e){this._keyHandler(e,nn)},sn.prototype._keyupHandler=function(e){this._keyHandler(e,rn)},sn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var r={keyEvent:e};n=this._eventBus.fire(t||nn,r),n&&e.preventDefault()}},sn.prototype._isEventIgnored=function(e){return!1},sn.prototype.bind=function(e){e&&console.error(`unsupported argument <node>`,Error(on)),this.unbind(),e=this._node=this._target,H.bind(e,`keydown`,this._keydownHandler),H.bind(e,`keyup`,this._keyupHandler),this._fire(`bind`)},sn.prototype.getBinding=function(){return this._node},sn.prototype.unbind=function(){var e=this._node;e&&(this._fire(`unbind`),H.unbind(e,`keydown`,this._keydownHandler),H.unbind(e,`keyup`,this._keyupHandler)),this._node=null},sn.prototype._fire=function(e){this._eventBus.fire(`keyboard.`+e,{node:this._node})},sn.prototype.addListener=function(e,t,n){x(e)&&(n=t,t=e,e=an),this._eventBus.on(n||nn,e,t)},sn.prototype.removeListener=function(e,t){this._eventBus.off(t||nn,e)},sn.prototype.hasModifier=Jt,sn.prototype.isCmd=Xt,sn.prototype.isShift=qt,sn.prototype.isKey=Ut;var cn=500;function ln(e,t){var n=this;e.on(`editorActions.init`,cn,function(e){var r=e.editorActions;n.registerBindings(t,r)})}ln.$inject=[`eventBus`,`keyboard`],ln.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n(`undo`,function(e){var n=e.keyEvent;if(Gt(n))return t.trigger(`undo`),!0}),n(`redo`,function(e){var n=e.keyEvent;if(Yt(n))return t.trigger(`redo`),!0}),n(`copy`,function(e){var n=e.keyEvent;if(Ht(n))return t.trigger(`copy`),!0}),n(`paste`,function(e){var n=e.keyEvent;if(Wt(n))return t.trigger(`paste`),!0}),n(`duplicate`,function(e){var n=e.keyEvent;if(Zt(n))return t.trigger(`duplicate`),!0}),n(`cut`,function(e){var n=e.keyEvent;if(Kt(n))return t.trigger(`cut`),!0}),n(`stepZoom`,function(e){var n=e.keyEvent;if(Ut([`+`,`Add`,`=`],n)&&Xt(n))return t.trigger(`stepZoom`,{value:1}),!0}),n(`stepZoom`,function(e){var n=e.keyEvent;if(Ut([`-`,`Subtract`],n)&&Xt(n))return t.trigger(`stepZoom`,{value:-1}),!0}),n(`zoom`,function(e){var n=e.keyEvent;if(Ut(`0`,n)&&Xt(n))return t.trigger(`zoom`,{value:1}),!0}),n(`removeSelection`,function(e){var n=e.keyEvent;if(Ut([`Backspace`,`Delete`,`Del`],n))return t.trigger(`removeSelection`),!0})};var un={__init__:[`keyboard`,`keyboardBindings`],keyboard:[`type`,sn],keyboardBindings:[`type`,ln]},dn={moveSpeed:50,moveSpeedAccelerated:200};function fn(e,t,n){var r=this;this._config=T({},dn,e||{}),t.addListener(i);function i(e){var n=e.keyEvent,i=r._config;if(t.isCmd(n)&&t.isKey([`ArrowLeft`,`Left`,`ArrowUp`,`Up`,`ArrowDown`,`Down`,`ArrowRight`,`Right`],n)){var a=t.isShift(n)?i.moveSpeedAccelerated:i.moveSpeed,o;switch(n.key){case`ArrowLeft`:case`Left`:o=`left`;break;case`ArrowUp`:case`Up`:o=`up`;break;case`ArrowRight`:case`Right`:o=`right`;break;case`ArrowDown`:case`Down`:o=`down`}return r.moveCanvas({speed:a,direction:o}),!0}}this.moveCanvas=function(e){var t=0,r=0,i=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case`left`:t=i;break;case`up`:r=i;break;case`right`:t=-i;break;case`down`:r=-i}n.scroll({dx:t,dy:r})}}fn.$inject=[`config.keyboardMove`,`keyboard`,`canvas`];var pn={__depends__:[un],__init__:[`keyboardMove`],keyboardMove:[`type`,fn]},mn=/^djs-cursor-.*$/;function hn(e){var t=at(document.body);t.removeMatching(mn),e&&t.add(`djs-cursor-`+e)}function gn(){hn(null)}var _n=5e3;function vn(e,t){t||=`element.click`;function n(){return!1}return e.once(t,_n,n),function(){e.off(t,n)}}var yn=15;function bn(e,t){var n;function r(e){return o(e.originalEvent)}e.on(`canvas.focus.changed`,function(t){t.focused?e.on(`element.mousedown`,500,r):e.off(`element.mousedown`,r)}),e.on(`diagram.destroy`,function(){n&&a()});function i(r){var i=n.start,a=n.button,o=kt(r),s=Ze(o,i);if(!n.dragging&&xn(s)>yn&&(n.dragging=!0,a===0&&vn(e),hn(`grab`)),n.dragging){var c=n.last||n.start;s=Ze(o,c),t.scroll({dx:s.x,dy:s.y}),n.last=o}r.preventDefault()}function a(e){H.unbind(document,`mousemove`,i),H.unbind(document,`mouseup`,a),n=null,gn()}function o(e){if(!ct(e.target,`.djs-draggable`)){var t=e.button;if(!(t>=2||e.ctrlKey||e.shiftKey||e.altKey))return n={button:t,start:kt(e)},H.bind(document,`mousemove`,i),H.bind(document,`mouseup`,a),!0}}this.isActive=function(){return!!n}}bn.$inject=[`eventBus`,`canvas`];function xn(e){return Math.sqrt(e.x**2+e.y**2)}var Sn={__init__:[`moveCanvas`],moveCanvas:[`type`,bn]};function Cn(e){return Math.log(e)/Math.log(10)}function wn(e,t){var n=Cn(e.min),r=Cn(e.max);return(Math.abs(n)+Math.abs(r))/t}function Tn(e,t){return Math.max(e.min,Math.min(e.max,t))}var En=Math.sign||function(e){return e>=0?1:-1},Dn={min:.2,max:4},On=10,kn=.1,An=.75;function jn(e,t,n){e||={},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=S(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||An;var r=this;t.on(`canvas.mouseover`,function(){r._init(e.enabled!==!1)}),t.on(`canvas.mouseout`,function(){r._init(!1)})}jn.$inject=[`config.zoomScroll`,`eventBus`,`canvas`],jn.prototype.scroll=function(e){this._canvas.scroll(e)},jn.prototype.reset=function(){this._canvas.zoom(`fit-viewport`)},jn.prototype.zoom=function(e,t){var n=wn(Dn,On*2);this._totalDelta+=e,Math.abs(this._totalDelta)>kn&&(this._zoom(e,t,n),this._totalDelta=0)},jn.prototype._handleWheel=function(e){if(this._enabled){var t=this._container;e.preventDefault();var n=e.ctrlKey||Mt()&&e.metaKey,r=e.shiftKey,i=-1*this._scale,a;if(i*=n?e.deltaMode===0?.02:.32:e.deltaMode===0?1:16,n){var o=t.getBoundingClientRect(),s={x:e.clientX-o.left,y:e.clientY-o.top};a=Math.sqrt(e.deltaY**2+e.deltaX**2)*En(e.deltaY)*i,this.zoom(a,s)}else a=r?{dx:i*e.deltaY,dy:0}:{dx:i*e.deltaX,dy:i*e.deltaY},this.scroll(a)}},jn.prototype.stepZoom=function(e,t){var n=wn(Dn,On);this._zoom(e,t,n)},jn.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,a=Cn(r.zoom()),o=Math.round(a/n)*n;o+=n*i;var s=10**o;r.zoom(Tn(Dn,s),t)},jn.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return e===void 0&&(e=!r),r!==e&&H[e?`bind`:`unbind`](t,`wheel`,n,!1),this._enabled=e,e},jn.prototype._init=function(e){this.toggle(e)};var Mn={__init__:[`zoomScroll`],zoomScroll:[`type`,jn]};function Nn(e){$e.call(this,e)}z(Nn,$e),Nn.prototype._navigationModules=[tn,pn,Sn,Mn],Nn.prototype._modules=[].concat($e.prototype._modules,Nn.prototype._navigationModules);function Pn(e){return e&&e[e.length-1]}function Fn(e){return e.y}function In(e){return e.x}var Ln={left:In,center:In,right:function(e){return e.x+e.width},top:Fn,middle:Fn,bottom:function(e){return e.y+e.height}};function Rn(e,t){this._modeling=e,this._rules=t}Rn.$inject=[`modeling`,`rules`],Rn.prototype._getOrientationDetails=function(e){var t=[`top`,`bottom`,`middle`],n=`x`,r=`width`;return t.indexOf(e)!==-1&&(n=`y`,r=`height`),{axis:n,dimension:r}},Rn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Rn.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),r=n.axis,i=n.dimension,a={},o={},s=!1,c,l,u;function d(e,t){return Math.round((e[r]+t[r]+t[i])/2)}if(this._isType(e,[`left`,`top`]))a[e]=t[0][r];else if(this._isType(e,[`right`,`bottom`]))u=Pn(t),a[e]=u[r]+u[i];else if(this._isType(e,[`center`,`middle`])){if(b(t,function(e){var t=e[r]+Math.round(e[i]/2);o[t]?o[t].elements.push(e):o[t]={elements:[e],center:t}}),c=y(o,function(e){return e.elements.length>1&&(s=!0),e.elements.length}),s)return a[e]=Pn(c).center,a;l=t[0],t=y(t,function(e){return e[r]+e[i]}),u=Pn(t),a[e]=d(l,u)}return a},Rn.prototype.trigger=function(e,t){var n=this._modeling,r,i=u(e,function(e){return!(e.waypoints||e.host||e.labelTarget)});if(r=this._rules.allowed(`elements.align`,{elements:i}),m(r)&&(i=r),!(i.length<2||!r)){var a=Ln[t],o=y(i,a),s=this._alignmentPosition(t,o);n.alignElements(o,s)}};var zn={__init__:[`alignElements`],alignElements:[`type`,Rn]},Bn=new At;function Vn(e){this._scheduled={},e.on(`diagram.destroy`,()=>{Object.keys(this._scheduled).forEach(e=>{this.cancel(e)})})}Vn.$inject=[`eventBus`],Vn.prototype.schedule=function(e,t=Bn.next()){this.cancel(t);let n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Vn.prototype._schedule=function(e,t){let n=Hn();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(e){n.reject(e)}}catch(e){console.error(`Scheduler#_schedule execution failed`,e)}}),promise:n.promise}},Vn.prototype.cancel=function(e){let t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Vn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Hn(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var Un={scheduler:[`type`,Vn]},Wn=`djs-element-hidden`,Gn=`.entry`,Kn=1e3,qn=8,Jn=300;function U(e,t,n,r){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=r,this._current=null,this._init()}U.$inject=[`canvas`,`elementRegistry`,`eventBus`,`scheduler`],U.prototype._init=function(){var e=this;this._eventBus.on(`selection.changed`,function(t){var n=t.newSelection,r=n.length?n.length===1?n[0]:n:null;r?e.open(r,!0):e.close()}),this._eventBus.on(`elements.changed`,function(t){var n=t.elements,r=e._current;if(r){var i=r.target,a=m(i)?i:[i];if(a.filter(function(e){return n.includes(e)}).length){e.close();var o=a.filter(function(t){return e._elementRegistry.get(t.id)});o.length&&e._updateAndOpen(o.length>1?o:o[0])}}}),this._eventBus.on(`canvas.viewbox.changed`,function(){e._updatePosition()}),this._eventBus.on(`element.marker.update`,function(t){if(e.isOpen()){var n=t.element,r=e._current;(m(r.target)?r.target:[r.target]).includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},U.prototype._createContainer=function(){var e=gt(`<div class="djs-context-pad-parent"></div>`);return this._canvas.getContainer().appendChild(e),e},U.prototype.registerProvider=function(e,t){t||(t=e,e=Kn),this._eventBus.on(`contextPad.getProviders`,e,function(e){e.providers.push(t)})},U.prototype.getEntries=function(e){var t=this._getProviders(),n=m(e)?`getMultiElementContextPadEntries`:`getContextPadEntries`,r={};return b(t,function(t){if(x(t[n])){var i=t[n](e);x(i)?r=i(r):b(i,function(e,t){r[t]=e})}}),r},U.prototype.trigger=function(e,t,n){var r=this,i,a,o=t.delegateTarget||t.target;if(!o)return t.preventDefault();if(i=ft(o,`data-action`),a=t.originalEvent||t,e===`mouseover`)this._timeout=setTimeout(function(){r._mouseout=r.triggerEntry(i,`hover`,a,n)},Jn);else if(e===`mouseout`)clearTimeout(this._timeout),this._mouseout&&=(this._mouseout(),null);else return this.triggerEntry(i,e,a,n)},U.prototype.triggerEntry=function(e,t,n,r){if(this.isShown()){var i=this._current.target,a=this._current.entries[e];if(a){var o=a.action;if(this._eventBus.fire(`contextPad.trigger`,{entry:a,event:n})!==!1){if(x(o)){if(t===`click`)return o(n,i,r)}else if(o[t])return o[t](n,i,r);n.preventDefault()}}}},U.prototype.open=function(e,t){(t||!this.isOpen(e))&&this._eventBus.fire(`contextPad.open.allowed`,{target:e})!==!1&&(this.close(),this._updateAndOpen(e))},U.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`contextPad.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},U.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),r;b(t,function(e,t){var i=e.group||`default`,a=gt(e.html||`<div class="entry" draggable="true"></div>`),o;ft(a,`data-action`,t),o=V(`[data-group=`+Lt(i)+`]`,n),o||(o=gt(`<div class="group"></div>`),ft(o,`data-group`,i),n.appendChild(o)),o.appendChild(a),e.className&&Yn(a,e.className),e.title&&ft(a,`title`,e.title),e.imageUrl&&(r=gt(`<img>`),ft(r,`src`,e.imageUrl),r.style.width=`100%`,r.style.height=`100%`,a.appendChild(r))}),at(n).add(`open`),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire(`contextPad.open`,{current:this._current})},U.prototype._createHtml=function(e){var t=this,n=gt(`<div class="djs-context-pad"></div>`);return pt.bind(n,Gn,`click`,function(e){t.trigger(`click`,e)}),pt.bind(n,Gn,`dragstart`,function(e){t.trigger(`dragstart`,e)}),pt.bind(n,Gn,`mouseover`,function(e){t.trigger(`mouseover`,e)}),pt.bind(n,Gn,`mouseout`,function(e){t.trigger(`mouseout`,e)}),H.bind(n,`mousedown`,function(e){e.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire(`contextPad.create`,{target:e,pad:n}),n},U.prototype.getPad=function(e){console.warn(Error(`ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888`));let t;return t=this.isOpen()&&Zn(this._current.target,e)?this._current.html:this._createHtml(e),{html:t}},U.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML=``,this._eventBus.fire(`contextPad.close`,{current:this._current}),this._current=null)},U.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return m(e)===m(n)?m(e)?e.length===n.length&&_(e,function(e){return n.includes(e)}):n===e:!1},U.prototype.isShown=function(){return this.isOpen()&&at(this._current.html).has(`open`)},U.prototype.show=function(){this.isOpen()&&(at(this._current.html).add(`open`),this._updatePosition(),this._eventBus.fire(`contextPad.show`,{current:this._current}))},U.prototype.hide=function(){this.isOpen()&&(at(this._current.html).remove(`open`),this._eventBus.fire(`contextPad.hide`,{current:this._current}))},U.prototype._getPosition=function(e){if(!m(e)&&A(e)){var t=this._canvas.viewbox(),n=Xn(e),r=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:r+qn*this._canvas.zoom(),top:i}}var a=this._canvas.getContainer().getBoundingClientRect(),o=this._getTargetBounds(e);return{left:o.right-a.left+qn*this._canvas.zoom(),top:o.top-a.top}},U.prototype._updatePosition=function(){this._scheduler.schedule(()=>{if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);`x`in t&&`y`in t?(e.style.left=t.x+`px`,e.style.top=t.y+`px`):[`top`,`right`,`bottom`,`left`].forEach(function(n){n in t&&(e.style[n]=t[n]+`px`)})}},`ContextPad#_updatePosition`)},U.prototype._updateVisibility=function(){this._scheduler.schedule(()=>{if(this.isOpen()){var e=this,t=this._current.target;(m(t)?t:[t]).some(function(t){return e._canvas.hasMarker(t,Wn)})?e.hide():e.show()}},`ContextPad#_updateVisibility`)},U.prototype._getTargetBounds=function(e){var t=this;return(m(e)?e:[e]).map(function(e){return t._canvas.getGraphics(e)}).reduce(function(e,t){let n=t.getBoundingClientRect();return e.top=Math.min(e.top,n.top),e.right=Math.max(e.right,n.right),e.bottom=Math.max(e.bottom,n.bottom),e.left=Math.min(e.left,n.left),e.x=e.left,e.y=e.top,e.width=e.right-e.left,e.height=e.bottom-e.top,e},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Yn(e,t){var n=at(e);t=m(t)?t:t.split(/\s+/g),t.forEach(function(e){n.add(e)})}function Xn(e){return e.waypoints[e.waypoints.length-1]}function Zn(e,t){return e=m(e)?e:[e],t=m(t)?t:[t],e.length===t.length&&_(e,function(e){return t.includes(e)})}var Qn={__depends__:[jt,Un,Nt],contextPad:[`type`,U]},$n,W,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr={},pr=[],mr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hr=Array.isArray;function gr(e,t){for(var n in t)e[n]=t[n];return e}function _r(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vr(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?$n.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return yr(e,o,r,i,null)}function yr(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++er,__i:-1,__u:0};return i==null&&W.vnode!=null&&W.vnode(a),a}function br(e){return e.children}function xr(e,t){this.props=e,this.context=t}function Sr(e,t){if(t==null)return e.__?Sr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Sr(e):null}function Cr(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=gr({},t);a.__v=t.__v+1,W.vnode&&W.vnode(a),Pr(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Sr(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Ir(r,a,i),t.__e=t.__=null,a.__e!=n&&wr(a)}}function wr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),wr(e)}function Tr(e){(!e.__d&&(e.__d=!0)&&tr.push(e)&&!Er.__r++||nr!=W.debounceRendering)&&((nr=W.debounceRendering)||rr)(Er)}function Er(){try{for(var e,t=1;tr.length;)tr.length>t&&tr.sort(ir),e=tr.shift(),t=tr.length,Cr(e)}finally{tr.length=Er.__r=0}}function Dr(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||pr,v=t.length;for(c=Or(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||fr,p.__i=d,g=Pr(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&zr(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=kr(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Or(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=yr(null,o,null,null,null):hr(o)?o=e.__k[a]=yr(br,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=yr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=Ar(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Sr(s)),Br(s,s));return r}function kr(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=kr(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Sr(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ar(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function jr(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||mr.test(t)?n:n+`px`}function Mr(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||jr(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||jr(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(cr,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[sr]=r[sr]:(n[sr]=lr,e.addEventListener(t,a?dr:ur,a)):e.removeEventListener(t,a?dr:ur,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Nr(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[or]==null)t[or]=lr++;else if(t[or]<n[sr])return;return n(W.event?W.event(t):t)}}}function Pr(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,ee,te=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=W.__b)&&u(t);n:if(typeof te==`function`){d=o.length;try{if(v=t.props,y=te.prototype&&te.prototype.render,b=(u=te.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new te(v,x):(t.__c=f=new xr(v,x),f.constructor=te,f.render=Vr),b&&b.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=gr({},f.__s)),gr(f.__s,te.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&te.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),pr.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=Sr(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=W.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),pr.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=gr(gr({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===br&&u.key==null?Lr(u.props.children):u,s=Dr(e,hr(w)?w:[w],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(ee=a.length;ee--;)_r(a[ee])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||Fr(t),W.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Rr(n.__e,t,n,r,i,a,o,c,l);return(u=W.diffed)&&u(t),128&t.__u?void 0:s}function Fr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Fr))}function Ir(e,t,n){for(var r=0;r<n.length;r++)zr(n[r],n[++r],n[++r]);W.__c&&W.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){W.__e(e,t.__v)}})}function Lr(e){return typeof e!=`object`||!e||e.__b>0?e:hr(e)?e.map(Lr):e.constructor===void 0?gr({},e):null}function Rr(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||fr,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(W.__m&&W.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&$n.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||Mr(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||Mr(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),Dr(t.type==`template`?e.content:e,hr(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Sr(n,0),s,c),a!=null)for(l=a.length;l--;)_r(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&Mr(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&Mr(e,l,h,g[l],i))}return e}function zr(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){W.__e(e,n)}}function Br(e,t,n){var r,i;if(W.unmount&&W.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||zr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){W.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Br(r[i],t,n||typeof e.type!=`function`);n||_r(e.__e),e.__c=e.__=e.__e=void 0}function Vr(e,t,n){return this.constructor(e,n)}function Hr(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),W.__&&W.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],Pr(t,e=(!r&&n||t).__k=vr(br,null,[e]),i||fr,fr,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?$n.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),Ir(a,e,o),e.props.children=null}$n=pr.slice,W={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},er=0,xr.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=gr({},this.state);typeof e==`function`&&(e=e(gr({},n),this.props)),e&&gr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Tr(this))},xr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Tr(this))},xr.prototype.render=br,tr=[],rr=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ir=function(e,t){return e.__v.__b-t.__v.__b},Er.__r=0,ar=Math.random().toString(8),or=`__d`+ar,sr=`__a`+ar,cr=/(PointerCapture)$|Capture$/i,lr=0,ur=Nr(!1),dr=Nr(!0);var Ur=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,Ur(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},Wr=new Map;function Gr(e){var t=Wr.get(this);return t||(t=new Map,Wr.set(this,t)),(t=Ur(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
|
|
1
|
+
import{n as e}from"../elements.js";import{A as t,C as n,D as r,M as i,N as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,i as _,j as v,k as y,l as b,m as x,n as S,o as C,p as w,r as ee,s as te,t as T,u as ne,v as re,w as ie,x as ae,y as oe}from"./dist-Co2MgHWm.js";import{i as E,n as D,r as O,t as k}from"./ModelUtil-CMh7LuN4.js";import{a as se,c as ce,d as le,i as ue,l as A,o as de,r as fe,s as pe,t as me,u as j}from"./LabelUtil-7QpE43Ed.js";import{a as M,c as he,d as ge,f as _e,i as ve,l as ye,m as be,n as N,o as xe,p as Se,r as Ce,s as we,t as Te,u as Ee}from"./LayoutUtil-hAMJmJFU.js";import{a as De,i as Oe,n as P,o as F,r as I,t as L,u as ke}from"./dist-kvAYI1vo.js";import{A as Ae,C as je,D as Me,E as Ne,M as Pe,N as Fe,O as R,P as z,S as Ie,T as Le,_ as Re,b as ze,g as Be,j as Ve,k as He,l as Ue,r as We,v as B,w as Ge,x as Ke,y as qe}from"./BpmnRenderUtil-WMCgqGDs.js";import{a as Je,i as Ye,n as Xe,r as Ze,t as Qe}from"./BpmnUpdater-C-UNbzXl.js";import $e,{A as et,B as tt,C as nt,D as rt,E as it,F as at,H as ot,I as st,L as ct,M as lt,N as ut,O as dt,P as ft,R as pt,S as mt,T as ht,U as gt,V,W as _t,_ as vt,a as yt,b as bt,c as xt,d as St,f as Ct,g as wt,h as Tt,i as Et,j as Dt,k as Ot,l as kt,m as At,n as jt,o as Mt,p as Nt,r as Pt,s as Ft,t as It,u as Lt,v as Rt,w as zt,x as Bt,y as Vt,z as H}from"./Viewer-D9zjRrp2.js";import{a as Ht,c as Ut,d as Wt,f as Gt,l as Kt,m as qt,o as Jt,p as Yt,s as Xt,u as Zt}from"./bpmn-mount-BhO_zb0S.js";function Qt(e){Rt.call(this,e),this.on(`import.parse.complete`,function(e){e.error||this._collectIds(e.definitions,e.elementsById)},this),this.on(`diagram.destroy`,function(){this.get(`moddle`).ids.clear()},this)}z(Qt,Rt),Qt.prototype._createModdle=function(e){var t=Rt.prototype._createModdle.call(this,e);return t.ids=new _t([32,36,1]),t},Qt.prototype._collectIds=function(e,t){var n=e.$model.ids,r;for(r in n.clear(),t)n.claim(r,t[r])};var $t=300;function en(e,t,n){this._selectionWasVisible=!1;let r=ee(()=>{this._selectionWasVisible=i()},$t);e.on(`canvas.viewbox.changed`,r),e.on(`selection.changed`,r),e.on(`diagram.destroy`,()=>{r.cancel()}),e.on(`canvas.resized`,()=>{var e=n.get();if(e.length&&this._selectionWasVisible&&!i()){var r=t.getRootElement();t.scrollToElement(e.concat(r))}});function i(){var e=n.get();if(!e.length)return!1;var r=it(e),i=t.viewbox(),a=N(r),o=N(i);return a.left>=o.left&&a.right<=o.right&&a.top>=o.top&&a.bottom<=o.bottom}this._flush=r.flush}en.$inject=[`eventBus`,`canvas`,`selection`];var tn={__init__:[`keepSelectionVisible`],__depends__:[It],keepSelectionVisible:[`type`,en]},nn=`keyboard.keydown`,rn=`keyboard.keyup`,an=1e3,on=`Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661`;function sn(e,t){var n=this;this._config=e||={},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on(`diagram.destroy`,function(){n._fire(`destroy`),n.unbind()}),e.bindTo&&console.error(`unsupported configuration <keyboard.bindTo>`,Error(on));var r=e&&e.bind!==!1;t.on(`canvas.init`,function(e){n._target=e.svg,r&&n.bind(),n._fire(`init`)})}sn.$inject=[`config.keyboard`,`eventBus`],sn.prototype._keydownHandler=function(e){this._keyHandler(e,nn)},sn.prototype._keyupHandler=function(e){this._keyHandler(e,rn)},sn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var r={keyEvent:e};n=this._eventBus.fire(t||nn,r),n&&e.preventDefault()}},sn.prototype._isEventIgnored=function(e){return!1},sn.prototype.bind=function(e){e&&console.error(`unsupported argument <node>`,Error(on)),this.unbind(),e=this._node=this._target,H.bind(e,`keydown`,this._keydownHandler),H.bind(e,`keyup`,this._keyupHandler),this._fire(`bind`)},sn.prototype.getBinding=function(){return this._node},sn.prototype.unbind=function(){var e=this._node;e&&(this._fire(`unbind`),H.unbind(e,`keydown`,this._keydownHandler),H.unbind(e,`keyup`,this._keyupHandler)),this._node=null},sn.prototype._fire=function(e){this._eventBus.fire(`keyboard.`+e,{node:this._node})},sn.prototype.addListener=function(e,t,n){x(e)&&(n=t,t=e,e=an),this._eventBus.on(n||nn,e,t)},sn.prototype.removeListener=function(e,t){this._eventBus.off(t||nn,e)},sn.prototype.hasModifier=Ht,sn.prototype.isCmd=Jt,sn.prototype.isShift=Yt,sn.prototype.isKey=Zt;var cn=500;function ln(e,t){var n=this;e.on(`editorActions.init`,cn,function(e){var r=e.editorActions;n.registerBindings(t,r)})}ln.$inject=[`eventBus`,`keyboard`],ln.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}n(`undo`,function(e){var n=e.keyEvent;if(qt(n))return t.trigger(`undo`),!0}),n(`redo`,function(e){var n=e.keyEvent;if(Gt(n))return t.trigger(`redo`),!0}),n(`copy`,function(e){var n=e.keyEvent;if(Xt(n))return t.trigger(`copy`),!0}),n(`paste`,function(e){var n=e.keyEvent;if(Wt(n))return t.trigger(`paste`),!0}),n(`duplicate`,function(e){var n=e.keyEvent;if(Kt(n))return t.trigger(`duplicate`),!0}),n(`cut`,function(e){var n=e.keyEvent;if(Ut(n))return t.trigger(`cut`),!0}),n(`stepZoom`,function(e){var n=e.keyEvent;if(Zt([`+`,`Add`,`=`],n)&&Jt(n))return t.trigger(`stepZoom`,{value:1}),!0}),n(`stepZoom`,function(e){var n=e.keyEvent;if(Zt([`-`,`Subtract`],n)&&Jt(n))return t.trigger(`stepZoom`,{value:-1}),!0}),n(`zoom`,function(e){var n=e.keyEvent;if(Zt(`0`,n)&&Jt(n))return t.trigger(`zoom`,{value:1}),!0}),n(`removeSelection`,function(e){var n=e.keyEvent;if(Zt([`Backspace`,`Delete`,`Del`],n))return t.trigger(`removeSelection`),!0})};var un={__init__:[`keyboard`,`keyboardBindings`],keyboard:[`type`,sn],keyboardBindings:[`type`,ln]},dn={moveSpeed:50,moveSpeedAccelerated:200};function fn(e,t,n){var r=this;this._config=T({},dn,e||{}),t.addListener(i);function i(e){var n=e.keyEvent,i=r._config;if(t.isCmd(n)&&t.isKey([`ArrowLeft`,`Left`,`ArrowUp`,`Up`,`ArrowDown`,`Down`,`ArrowRight`,`Right`],n)){var a=t.isShift(n)?i.moveSpeedAccelerated:i.moveSpeed,o;switch(n.key){case`ArrowLeft`:case`Left`:o=`left`;break;case`ArrowUp`:case`Up`:o=`up`;break;case`ArrowRight`:case`Right`:o=`right`;break;case`ArrowDown`:case`Down`:o=`down`}return r.moveCanvas({speed:a,direction:o}),!0}}this.moveCanvas=function(e){var t=0,r=0,i=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case`left`:t=i;break;case`up`:r=i;break;case`right`:t=-i;break;case`down`:r=-i}n.scroll({dx:t,dy:r})}}fn.$inject=[`config.keyboardMove`,`keyboard`,`canvas`];var pn={__depends__:[un],__init__:[`keyboardMove`],keyboardMove:[`type`,fn]},mn=/^djs-cursor-.*$/;function hn(e){var t=at(document.body);t.removeMatching(mn),e&&t.add(`djs-cursor-`+e)}function gn(){hn(null)}var _n=5e3;function vn(e,t){t||=`element.click`;function n(){return!1}return e.once(t,_n,n),function(){e.off(t,n)}}var yn=15;function bn(e,t){var n;function r(e){return o(e.originalEvent)}e.on(`canvas.focus.changed`,function(t){t.focused?e.on(`element.mousedown`,500,r):e.off(`element.mousedown`,r)}),e.on(`diagram.destroy`,function(){n&&a()});function i(r){var i=n.start,a=n.button,o=kt(r),s=Ze(o,i);if(!n.dragging&&xn(s)>yn&&(n.dragging=!0,a===0&&vn(e),hn(`grab`)),n.dragging){var c=n.last||n.start;s=Ze(o,c),t.scroll({dx:s.x,dy:s.y}),n.last=o}r.preventDefault()}function a(e){H.unbind(document,`mousemove`,i),H.unbind(document,`mouseup`,a),n=null,gn()}function o(e){if(!ct(e.target,`.djs-draggable`)){var t=e.button;if(!(t>=2||e.ctrlKey||e.shiftKey||e.altKey))return n={button:t,start:kt(e)},H.bind(document,`mousemove`,i),H.bind(document,`mouseup`,a),!0}}this.isActive=function(){return!!n}}bn.$inject=[`eventBus`,`canvas`];function xn(e){return Math.sqrt(e.x**2+e.y**2)}var Sn={__init__:[`moveCanvas`],moveCanvas:[`type`,bn]};function Cn(e){return Math.log(e)/Math.log(10)}function wn(e,t){var n=Cn(e.min),r=Cn(e.max);return(Math.abs(n)+Math.abs(r))/t}function Tn(e,t){return Math.max(e.min,Math.min(e.max,t))}var En=Math.sign||function(e){return e>=0?1:-1},Dn={min:.2,max:4},On=10,kn=.1,An=.75;function jn(e,t,n){e||={},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=S(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||An;var r=this;t.on(`canvas.mouseover`,function(){r._init(e.enabled!==!1)}),t.on(`canvas.mouseout`,function(){r._init(!1)})}jn.$inject=[`config.zoomScroll`,`eventBus`,`canvas`],jn.prototype.scroll=function(e){this._canvas.scroll(e)},jn.prototype.reset=function(){this._canvas.zoom(`fit-viewport`)},jn.prototype.zoom=function(e,t){var n=wn(Dn,On*2);this._totalDelta+=e,Math.abs(this._totalDelta)>kn&&(this._zoom(e,t,n),this._totalDelta=0)},jn.prototype._handleWheel=function(e){if(this._enabled){var t=this._container;e.preventDefault();var n=e.ctrlKey||Mt()&&e.metaKey,r=e.shiftKey,i=-1*this._scale,a;if(i*=n?e.deltaMode===0?.02:.32:e.deltaMode===0?1:16,n){var o=t.getBoundingClientRect(),s={x:e.clientX-o.left,y:e.clientY-o.top};a=Math.sqrt(e.deltaY**2+e.deltaX**2)*En(e.deltaY)*i,this.zoom(a,s)}else a=r?{dx:i*e.deltaY,dy:0}:{dx:i*e.deltaX,dy:i*e.deltaY},this.scroll(a)}},jn.prototype.stepZoom=function(e,t){var n=wn(Dn,On);this._zoom(e,t,n)},jn.prototype._zoom=function(e,t,n){var r=this._canvas,i=e>0?1:-1,a=Cn(r.zoom()),o=Math.round(a/n)*n;o+=n*i;var s=10**o;r.zoom(Tn(Dn,s),t)},jn.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,r=this._enabled;return e===void 0&&(e=!r),r!==e&&H[e?`bind`:`unbind`](t,`wheel`,n,!1),this._enabled=e,e},jn.prototype._init=function(e){this.toggle(e)};var Mn={__init__:[`zoomScroll`],zoomScroll:[`type`,jn]};function Nn(e){$e.call(this,e)}z(Nn,$e),Nn.prototype._navigationModules=[tn,pn,Sn,Mn],Nn.prototype._modules=[].concat($e.prototype._modules,Nn.prototype._navigationModules);function Pn(e){return e&&e[e.length-1]}function Fn(e){return e.y}function In(e){return e.x}var Ln={left:In,center:In,right:function(e){return e.x+e.width},top:Fn,middle:Fn,bottom:function(e){return e.y+e.height}};function Rn(e,t){this._modeling=e,this._rules=t}Rn.$inject=[`modeling`,`rules`],Rn.prototype._getOrientationDetails=function(e){var t=[`top`,`bottom`,`middle`],n=`x`,r=`width`;return t.indexOf(e)!==-1&&(n=`y`,r=`height`),{axis:n,dimension:r}},Rn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Rn.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),r=n.axis,i=n.dimension,a={},o={},s=!1,c,l,u;function d(e,t){return Math.round((e[r]+t[r]+t[i])/2)}if(this._isType(e,[`left`,`top`]))a[e]=t[0][r];else if(this._isType(e,[`right`,`bottom`]))u=Pn(t),a[e]=u[r]+u[i];else if(this._isType(e,[`center`,`middle`])){if(b(t,function(e){var t=e[r]+Math.round(e[i]/2);o[t]?o[t].elements.push(e):o[t]={elements:[e],center:t}}),c=y(o,function(e){return e.elements.length>1&&(s=!0),e.elements.length}),s)return a[e]=Pn(c).center,a;l=t[0],t=y(t,function(e){return e[r]+e[i]}),u=Pn(t),a[e]=d(l,u)}return a},Rn.prototype.trigger=function(e,t){var n=this._modeling,r,i=u(e,function(e){return!(e.waypoints||e.host||e.labelTarget)});if(r=this._rules.allowed(`elements.align`,{elements:i}),m(r)&&(i=r),!(i.length<2||!r)){var a=Ln[t],o=y(i,a),s=this._alignmentPosition(t,o);n.alignElements(o,s)}};var zn={__init__:[`alignElements`],alignElements:[`type`,Rn]},Bn=new At;function Vn(e){this._scheduled={},e.on(`diagram.destroy`,()=>{Object.keys(this._scheduled).forEach(e=>{this.cancel(e)})})}Vn.$inject=[`eventBus`],Vn.prototype.schedule=function(e,t=Bn.next()){this.cancel(t);let n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Vn.prototype._schedule=function(e,t){let n=Hn();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(e){n.reject(e)}}catch(e){console.error(`Scheduler#_schedule execution failed`,e)}}),promise:n.promise}},Vn.prototype.cancel=function(e){let t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Vn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Hn(){let e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}var Un={scheduler:[`type`,Vn]},Wn=`djs-element-hidden`,Gn=`.entry`,Kn=1e3,qn=8,Jn=300;function U(e,t,n,r){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=r,this._current=null,this._init()}U.$inject=[`canvas`,`elementRegistry`,`eventBus`,`scheduler`],U.prototype._init=function(){var e=this;this._eventBus.on(`selection.changed`,function(t){var n=t.newSelection,r=n.length?n.length===1?n[0]:n:null;r?e.open(r,!0):e.close()}),this._eventBus.on(`elements.changed`,function(t){var n=t.elements,r=e._current;if(r){var i=r.target,a=m(i)?i:[i];if(a.filter(function(e){return n.includes(e)}).length){e.close();var o=a.filter(function(t){return e._elementRegistry.get(t.id)});o.length&&e._updateAndOpen(o.length>1?o:o[0])}}}),this._eventBus.on(`canvas.viewbox.changed`,function(){e._updatePosition()}),this._eventBus.on(`element.marker.update`,function(t){if(e.isOpen()){var n=t.element,r=e._current;(m(r.target)?r.target:[r.target]).includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},U.prototype._createContainer=function(){var e=gt(`<div class="djs-context-pad-parent"></div>`);return this._canvas.getContainer().appendChild(e),e},U.prototype.registerProvider=function(e,t){t||(t=e,e=Kn),this._eventBus.on(`contextPad.getProviders`,e,function(e){e.providers.push(t)})},U.prototype.getEntries=function(e){var t=this._getProviders(),n=m(e)?`getMultiElementContextPadEntries`:`getContextPadEntries`,r={};return b(t,function(t){if(x(t[n])){var i=t[n](e);x(i)?r=i(r):b(i,function(e,t){r[t]=e})}}),r},U.prototype.trigger=function(e,t,n){var r=this,i,a,o=t.delegateTarget||t.target;if(!o)return t.preventDefault();if(i=ft(o,`data-action`),a=t.originalEvent||t,e===`mouseover`)this._timeout=setTimeout(function(){r._mouseout=r.triggerEntry(i,`hover`,a,n)},Jn);else if(e===`mouseout`)clearTimeout(this._timeout),this._mouseout&&=(this._mouseout(),null);else return this.triggerEntry(i,e,a,n)},U.prototype.triggerEntry=function(e,t,n,r){if(this.isShown()){var i=this._current.target,a=this._current.entries[e];if(a){var o=a.action;if(this._eventBus.fire(`contextPad.trigger`,{entry:a,event:n})!==!1){if(x(o)){if(t===`click`)return o(n,i,r)}else if(o[t])return o[t](n,i,r);n.preventDefault()}}}},U.prototype.open=function(e,t){(t||!this.isOpen(e))&&this._eventBus.fire(`contextPad.open.allowed`,{target:e})!==!1&&(this.close(),this._updateAndOpen(e))},U.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`contextPad.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},U.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),r;b(t,function(e,t){var i=e.group||`default`,a=gt(e.html||`<div class="entry" draggable="true"></div>`),o;ft(a,`data-action`,t),o=V(`[data-group=`+Lt(i)+`]`,n),o||(o=gt(`<div class="group"></div>`),ft(o,`data-group`,i),n.appendChild(o)),o.appendChild(a),e.className&&Yn(a,e.className),e.title&&ft(a,`title`,e.title),e.imageUrl&&(r=gt(`<img>`),ft(r,`src`,e.imageUrl),r.style.width=`100%`,r.style.height=`100%`,a.appendChild(r))}),at(n).add(`open`),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire(`contextPad.open`,{current:this._current})},U.prototype._createHtml=function(e){var t=this,n=gt(`<div class="djs-context-pad"></div>`);return pt.bind(n,Gn,`click`,function(e){t.trigger(`click`,e)}),pt.bind(n,Gn,`dragstart`,function(e){t.trigger(`dragstart`,e)}),pt.bind(n,Gn,`mouseover`,function(e){t.trigger(`mouseover`,e)}),pt.bind(n,Gn,`mouseout`,function(e){t.trigger(`mouseout`,e)}),H.bind(n,`mousedown`,function(e){e.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire(`contextPad.create`,{target:e,pad:n}),n},U.prototype.getPad=function(e){console.warn(Error(`ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888`));let t;return t=this.isOpen()&&Zn(this._current.target,e)?this._current.html:this._createHtml(e),{html:t}},U.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML=``,this._eventBus.fire(`contextPad.close`,{current:this._current}),this._current=null)},U.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return m(e)===m(n)?m(e)?e.length===n.length&&_(e,function(e){return n.includes(e)}):n===e:!1},U.prototype.isShown=function(){return this.isOpen()&&at(this._current.html).has(`open`)},U.prototype.show=function(){this.isOpen()&&(at(this._current.html).add(`open`),this._updatePosition(),this._eventBus.fire(`contextPad.show`,{current:this._current}))},U.prototype.hide=function(){this.isOpen()&&(at(this._current.html).remove(`open`),this._eventBus.fire(`contextPad.hide`,{current:this._current}))},U.prototype._getPosition=function(e){if(!m(e)&&A(e)){var t=this._canvas.viewbox(),n=Xn(e),r=n.x*t.scale-t.x*t.scale,i=n.y*t.scale-t.y*t.scale;return{left:r+qn*this._canvas.zoom(),top:i}}var a=this._canvas.getContainer().getBoundingClientRect(),o=this._getTargetBounds(e);return{left:o.right-a.left+qn*this._canvas.zoom(),top:o.top-a.top}},U.prototype._updatePosition=function(){this._scheduler.schedule(()=>{if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);`x`in t&&`y`in t?(e.style.left=t.x+`px`,e.style.top=t.y+`px`):[`top`,`right`,`bottom`,`left`].forEach(function(n){n in t&&(e.style[n]=t[n]+`px`)})}},`ContextPad#_updatePosition`)},U.prototype._updateVisibility=function(){this._scheduler.schedule(()=>{if(this.isOpen()){var e=this,t=this._current.target;(m(t)?t:[t]).some(function(t){return e._canvas.hasMarker(t,Wn)})?e.hide():e.show()}},`ContextPad#_updateVisibility`)},U.prototype._getTargetBounds=function(e){var t=this;return(m(e)?e:[e]).map(function(e){return t._canvas.getGraphics(e)}).reduce(function(e,t){let n=t.getBoundingClientRect();return e.top=Math.min(e.top,n.top),e.right=Math.max(e.right,n.right),e.bottom=Math.max(e.bottom,n.bottom),e.left=Math.min(e.left,n.left),e.x=e.left,e.y=e.top,e.width=e.right-e.left,e.height=e.bottom-e.top,e},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Yn(e,t){var n=at(e);t=m(t)?t:t.split(/\s+/g),t.forEach(function(e){n.add(e)})}function Xn(e){return e.waypoints[e.waypoints.length-1]}function Zn(e,t){return e=m(e)?e:[e],t=m(t)?t:[t],e.length===t.length&&_(e,function(e){return t.includes(e)})}var Qn={__depends__:[jt,Un,Nt],contextPad:[`type`,U]},$n,W,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr={},pr=[],mr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hr=Array.isArray;function gr(e,t){for(var n in t)e[n]=t[n];return e}function _r(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vr(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?$n.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return yr(e,o,r,i,null)}function yr(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++er,__i:-1,__u:0};return i==null&&W.vnode!=null&&W.vnode(a),a}function br(e){return e.children}function xr(e,t){this.props=e,this.context=t}function Sr(e,t){if(t==null)return e.__?Sr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Sr(e):null}function Cr(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=gr({},t);a.__v=t.__v+1,W.vnode&&W.vnode(a),Pr(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Sr(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Ir(r,a,i),t.__e=t.__=null,a.__e!=n&&wr(a)}}function wr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),wr(e)}function Tr(e){(!e.__d&&(e.__d=!0)&&tr.push(e)&&!Er.__r++||nr!=W.debounceRendering)&&((nr=W.debounceRendering)||rr)(Er)}function Er(){try{for(var e,t=1;tr.length;)tr.length>t&&tr.sort(ir),e=tr.shift(),t=tr.length,Cr(e)}finally{tr.length=Er.__r=0}}function Dr(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r&&r.__k||pr,v=t.length;for(c=Or(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&_[p.__i]||fr,p.__i=d,g=Pr(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&zr(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=kr(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Or(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=yr(null,o,null,null,null):hr(o)?o=e.__k[a]=yr(br,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=yr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=Ar(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Sr(s)),Br(s,s));return r}function kr(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=kr(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Sr(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ar(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function jr(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||mr.test(t)?n:n+`px`}function Mr(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||jr(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||jr(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(cr,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[sr]=r[sr]:(n[sr]=lr,e.addEventListener(t,a?dr:ur,a)):e.removeEventListener(t,a?dr:ur,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Nr(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[or]==null)t[or]=lr++;else if(t[or]<n[sr])return;return n(W.event?W.event(t):t)}}}function Pr(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,ee,te=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=W.__b)&&u(t);n:if(typeof te==`function`){d=o.length;try{if(v=t.props,y=te.prototype&&te.prototype.render,b=(u=te.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new te(v,x):(t.__c=f=new xr(v,x),f.constructor=te,f.render=Vr),b&&b.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=gr({},f.__s)),gr(f.__s,te.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&te.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),pr.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=Sr(n);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=W.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),pr.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=gr(gr({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===br&&u.key==null?Lr(u.props.children):u,s=Dr(e,hr(w)?w:[w],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(ee=a.length;ee--;)_r(a[ee])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||Fr(t),W.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Rr(n.__e,t,n,r,i,a,o,c,l);return(u=W.diffed)&&u(t),128&t.__u?void 0:s}function Fr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Fr))}function Ir(e,t,n){for(var r=0;r<n.length;r++)zr(n[r],n[++r],n[++r]);W.__c&&W.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){W.__e(e,t.__v)}})}function Lr(e){return typeof e!=`object`||!e||e.__b>0?e:hr(e)?e.map(Lr):e.constructor===void 0?gr({},e):null}function Rr(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||fr,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(W.__m&&W.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&$n.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||Mr(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||Mr(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),Dr(t.type==`template`?e.content:e,hr(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Sr(n,0),s,c),a!=null)for(l=a.length;l--;)_r(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&Mr(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&Mr(e,l,h,g[l],i))}return e}function zr(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){W.__e(e,n)}}function Br(e,t,n){var r,i;if(W.unmount&&W.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||zr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){W.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Br(r[i],t,n||typeof e.type!=`function`);n||_r(e.__e),e.__c=e.__=e.__e=void 0}function Vr(e,t,n){return this.constructor(e,n)}function Hr(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),W.__&&W.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],Pr(t,e=(!r&&n||t).__k=vr(br,null,[e]),i||fr,fr,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?$n.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),Ir(a,e,o),e.props.children=null}$n=pr.slice,W={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},er=0,xr.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=gr({},this.state);typeof e==`function`&&(e=e(gr({},n),this.props)),e&&gr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Tr(this))},xr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Tr(this))},xr.prototype.render=br,tr=[],rr=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ir=function(e,t){return e.__v.__b-t.__v.__b},Er.__r=0,ar=Math.random().toString(8),or=`__d`+ar,sr=`__a`+ar,cr=/(PointerCapture)$|Capture$/i,lr=0,ur=Nr(!1),dr=Nr(!0);var Ur=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,Ur(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},Wr=new Map;function Gr(e){var t=Wr.get(this);return t||(t=new Map,Wr.set(this,t)),(t=Ur(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
|
|
2
2
|
`||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}var G=Gr.bind(vr),Kr,K,qr,Jr,Yr=0,Xr=[],Zr=W,Qr=Zr.__b,$r=Zr.__r,ei=Zr.diffed,ti=Zr.__c,ni=Zr.unmount,ri=Zr.__;function ii(e,t){Zr.__h&&Zr.__h(K,e,Yr||t),Yr=0;var n=K.__H||(K.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ai(e){return Yr=1,oi(vi,e)}function oi(e,t,n){var r=ii(Kr++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):vi(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=K,!K.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};K.__f=!0;var a=K.shouldComponentUpdate,o=K.componentWillUpdate;K.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},K.shouldComponentUpdate=i}return r.__N||r.__}function si(e,t){var n=ii(Kr++,3);!Zr.__s&&_i(n.__H,t)&&(n.__=e,n.u=t,K.__H.__h.push(n))}function ci(e,t){var n=ii(Kr++,4);!Zr.__s&&_i(n.__H,t)&&(n.__=e,n.u=t,K.__h.push(n))}function li(e){return Yr=5,ui(function(){return{current:e}},[])}function ui(e,t){var n=ii(Kr++,7);return _i(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function di(e,t){return Yr=8,ui(function(){return e},t)}function fi(){for(var e;e=Xr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(hi),t.__h.some(gi),t.__h=[]}catch(n){t.__h=[],Zr.__e(n,e.__v)}}}Zr.__b=function(e){K=null,Qr&&Qr(e)},Zr.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ri&&ri(e,t)},Zr.__r=function(e){$r&&$r(e),Kr=0;var t=(K=e.__c).__H;t&&(qr===K?(t.__h=[],K.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(hi),t.__h.some(gi),t.__h=[],Kr=0)),qr=K},Zr.diffed=function(e){ei&&ei(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Xr.push(t)!==1&&Jr===Zr.requestAnimationFrame||((Jr=Zr.requestAnimationFrame)||mi)(fi)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),qr=K=null},Zr.__c=function(e,t){t.some(function(e){try{e.__h.some(hi),e.__h=e.__h.filter(function(e){return!e.__||gi(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Zr.__e(n,e.__v)}}),ti&&ti(e,t)},Zr.unmount=function(e){ni&&ni(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{hi(e)}catch(e){t=e}}),n.__H=void 0,t&&Zr.__e(t,n.__v))};var pi=typeof requestAnimationFrame==`function`;function mi(e){var t,n=function(){clearTimeout(r),pi&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);pi&&(t=requestAnimationFrame(n))}function hi(e){var t=K,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),K=t}function gi(e){var t=K;e.__c=e.__(),K=t}function _i(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function vi(e,t){return typeof t==`function`?t(e):t}function yi(e){let{navigationStack:t,setNavigationStack:n}=e,r=ui(()=>t.length<=1?[]:t.slice(0,-1).map((e,t)=>({label:e.label,onClick:()=>n(e=>e.slice(0,t+1))})),[t,n]),i=t.length>0?()=>n([]):null,a=t.length>0?t[t.length-1].label:null;return G`
|
|
3
3
|
<div class="djs-popup-breadcrumbs">
|
|
4
4
|
${i&&G`
|
|
@@ -349,7 +349,7 @@ import{n as e}from"../elements.js";import{A as t,C as n,D as r,M as i,N as a,O a
|
|
|
349
349
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
350
350
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
351
351
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
352
|
-
</svg>`},na=900;function ra(e,t,n,r){e.registerProvider(na,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}ra.$inject=[`contextPad`,`popupMenu`,`translate`,`canvas`],ra.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},ra.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,`align-elements`)},ra.prototype._getEntries=function(){var e=this;return{"align-elements":{group:`align-elements`,title:e._translate(`Align elements`),html:`<div class="entry">${ta.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);T(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,`align-elements`,r)}}}}},ra.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+t}};var ia=[`left`,`center`,`right`,`top`,`middle`,`bottom`];function aa(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider(`align-elements`,this)}aa.$inject=[`popupMenu`,`alignElements`,`translate`,`rules`],aa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},aa.prototype._isAllowed=function(e){return this._rules.allowed(`elements.align`,{elements:e})},aa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return b(ia,function(a){i[`align-elements-`+a]={group:`align`,title:n(`Align elements `+a),className:`bjs-align-elements-menu-entry`,imageHtml:ta[a],action:function(){t.trigger(e,a),r.close()}}}),i};function oa(e){B.call(this,e),this.init()}oa.$inject=[`eventBus`],z(oa,B),oa.prototype.addRule=function(e,t,n){var r=this;typeof e==`string`&&(e=[e]),e.forEach(function(e){r.canExecute(e,t,function(e,t,r){return n(e)},!0)})},oa.prototype.init=function(){};function sa(e){oa.call(this,e)}sa.$inject=[`eventBus`],z(sa,oa),sa.prototype.init=function(){this.addRule(`elements.align`,function(e){var t=e.elements,n=u(t,function(e){return!(e.waypoints||e.host||e.labelTarget)});return n=Ot(n),n.length<2?!1:n})};var ca={__depends__:[zn,Qn,ea],__init__:[`alignElementsContextPadProvider`,`alignElementsMenuProvider`,`bpmnAlignElements`],alignElementsContextPadProvider:[`type`,ra],alignElementsMenuProvider:[`type`,aa],bpmnAlignElements:[`type`,sa]},la=10,ua=250;function da(e,t,n,r){for(var i;i=pa(e,n,t);)n=r(t,n,i);return n}function fa(e){return function(t,n,r){var i={x:n.x,y:n.y};return[`x`,`y`].forEach(function(a){var o=e[a];if(o){var s=a===`x`?`width`:`height`,c=o.margin,l=o.minDistance;i[a]=c<0?Math.min(r[a]+c-t[s]/2,n[a]-l+c):Math.max(r[a]+r[s]+c+t[s]/2,n[a]+l+c)}}),i}}function pa(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=ha(e);return C(i,function(e){return e!==n&&xe(e,r,la)===`intersect`})}function ma(e,t){t||={};function n(t){return t.source===e?1:-1}var r=t.defaultDistance||50,i=t.direction||`e`,a=t.filter,o=t.getWeight||n,s=t.maxDistance||ua,l=t.reference||`start`;a||=ya;function u(e,t){return i===`n`?l===`start`?N(e).top-N(t).bottom:l===`center`?N(e).top-M(t).y:N(e).top-N(t).top:i===`w`?l===`start`?N(e).left-N(t).right:l===`center`?N(e).left-M(t).x:N(e).left-N(t).left:i===`s`?l===`start`?N(t).top-N(e).bottom:l===`center`?M(t).y-N(e).bottom:N(t).bottom-N(e).bottom:l===`start`?N(t).left-N(e).right:l===`center`?M(t).x-N(e).right:N(t).right-N(e).right}var d=e.incoming.filter(a).map(function(t){var n=o(t),r=n<0?u(t.source,e):u(e,t.source);return{id:t.source.id,distance:r,weight:n}}),f=e.outgoing.filter(a).map(function(t){var n=o(t),r=n>0?u(e,t.target):u(t.target,e);return{id:t.target.id,distance:r,weight:n}}),p=d.concat(f).reduce(function(e,t){return e[t.id+`__weight_`+t.weight]=t,e},{});return c(p,function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e},{}).distance||r}function ha(e){var t=ga(e);return e.host&&(t=t.concat(ga(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(e,t){return e.concat(ga(t))},[]))),t}function ga(e){return va(e).concat(_a(e))}function _a(e){return e.incoming.map(function(e){return e.source})}function va(e){return e.outgoing.map(function(e){return e.target})}function ya(){return!0}var ba=100;function xa(e,t,n){e.on(`autoPlace`,ba,function(e){var t=e.shape,n=e.source;return Sa(n,t)}),e.on(`autoPlace.end`,function(e){n.scrollToElement(e.shape)}),this.append=function(n,r,i){e.fire(`autoPlace.start`,{source:n,shape:r});var a=e.fire(`autoPlace`,{source:n,shape:r}),o=t.appendShape(n,r,a,n.parent,i);return e.fire(`autoPlace.end`,{source:n,shape:o}),o}}xa.$inject=[`eventBus`,`modeling`,`canvas`];function Sa(e,t,n){n||={};var r=n.defaultDistance||50,i=M(e);return{x:N(e).right+r+t.width/2,y:i.y}}function Ca(e,t){e.on(`autoPlace.end`,500,function(e){t.select(e.shape)})}Ca.$inject=[`eventBus`,`selection`];var wa={__init__:[`autoPlaceSelectionBehavior`],autoPlace:[`type`,xa],autoPlaceSelectionBehavior:[`type`,Ca]};function Ta(e,t,n){var r=Je(e,n);if(O(t,`bpmn:TextAnnotation`))return Oa(e,t,r);if(E(t,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`]))return ka(e,t,r);if(O(t,`bpmn:FlowNode`))return Ea(e,t,r)}function Ea(e,t,n){var r=N(e),i=M(e),a=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`},o=ma(e,{filter:function(e){return O(e,`bpmn:SequenceFlow`)},direction:a.directionHint}),s=30,c=a.minDistance,l=a.baseOrientation;O(e,`bpmn:BoundaryEvent`)&&(l=xe(e,e.host,-25),l.indexOf(a.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:r.right+o+t.width/2,y:i.y+Da(l,c,a)}:{x:i.x+Da(l,c,a),y:r.bottom+o+t.height/2},d={margin:s,minDistance:c};return da(e,t,u,fa(n?{y:d}:{x:d}))}function Da(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function Oa(e,t,n){var r=N(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};A(e)&&(i=M(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var a={margin:n?-30:30,minDistance:20};return da(e,t,i,fa(n?{y:a}:{x:a}))}function ka(e,t,n){var r=N(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},a={margin:30,minDistance:30};return da(e,t,i,fa(n?{x:a}:{y:a}))}function Aa(e,t){e.on(`autoPlace`,function(e){var n=e.shape,r=e.source;return Ta(r,n,t)})}Aa.$inject=[`eventBus`,`elementRegistry`];var ja={__depends__:[wa],__init__:[`bpmnAutoPlace`],bpmnAutoPlace:[`type`,Aa]};function Ma(e,t,n,r){B.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var a=this;this.postExecuted([`shape.create`],function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;n.autoResize!==!1&&a._expand([r],i)}),this.postExecuted([`elements.move`],function(e){var t=e.context,n=f(i(t.closure.topLevel)),r=t.hints,o=!r||r.autoResize;if(o!==!1){var c=ne(n,function(e){return e.parent.id});b(c,function(e,t){m(o)&&(e=e.filter(function(e){return C(o,s({id:e.id}))})),a._expand(e,t)})}}),this.postExecuted([`shape.toggleCollapse`],function(e){var t=e.context,n=t.hints,r=t.shape;n&&n.autoResize===!1||r.collapsed||a._expand(r.children||[],r)}),this.postExecuted([`shape.resize`],function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&n.autoResize===!1||i&&a._expand([r],i)})}Ma.$inject=[`eventBus`,`elementRegistry`,`modeling`,`rules`],z(Ma,B),Ma.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=N(it(e)),a=N(t),o={};return i.top-a.top<r.top&&(o.top=i.top-n.top),i.left-a.left<r.left&&(o.left=i.left-n.left),a.right-i.right<r.right&&(o.right=i.right+n.right),a.bottom-i.bottom<r.bottom&&(o.bottom=i.bottom+n.bottom),Te(T({},a,o))},Ma.prototype._expand=function(e,t){if(typeof t==`string`&&(t=this._elementRegistry.get(t)),this._rules.allowed(`element.autoResize`,{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(Na(n,t)){var r=Pa(ie(t,[`x`,`y`,`width`,`height`]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},Ma.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ma.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ma.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function Na(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pa(e,t){var n=``;return e=N(e),t=N(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`)),n}function Fa(e){e.invoke(Ma,this)}Fa.$inject=[`injector`],z(Fa,Ma),Fa.prototype.resize=function(e,t,n){O(e,`bpmn:Participant`)?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ia(e){oa.call(this,e);var t=this;this.addRule(`element.autoResize`,function(e){return t.canResize(e.elements,e.target)})}Ia.$inject=[`eventBus`],z(Ia,oa),Ia.prototype.canResize=function(e,t){return!1};function La(e,t){Ia.call(this,e),this._modeling=t}z(La,Ia),La.$inject=[`eventBus`,`modeling`],La.prototype.canResize=function(e,t){if(O(t.di,`bpmndi:BPMNPlane`)||!O(t,`bpmn:Participant`)&&!O(t,`bpmn:Lane`)&&!O(t,`bpmn:SubProcess`))return!1;var n=!0;return b(e,function(e){(O(e,`bpmn:Lane`)||j(e))&&(n=!1)}),n};var Ra={__init__:[`bpmnAutoResize`,`bpmnAutoResizeProvider`],bpmnAutoResize:[`type`,Fa],bpmnAutoResizeProvider:[`type`,La]},za=1500;function Ba(e,t,n){var r=this,i=n.get(`dragging`,!1);function a(t){if(!t.hover){var n=t.originalEvent,a=r._findTargetGfx(n),o=a&&e.get(a);a&&o&&(t.stopPropagation(),i.hover({element:o,gfx:a}),i.move(n))}}i&&t.on(`drag.start`,function(e){t.once(`drag.move`,za,function(e){a(e)})}),(function(){var e,n;t.on(`element.hover`,function(t){e=t.gfx,n=t.element}),t.on(`element.hover`,za,function(r){n&&t.fire(`element.out`,{element:n,gfx:e})}),t.on(`element.out`,function(){e=null,n=null})})(),this._findTargetGfx=function(e){var t,n;if(e instanceof MouseEvent)return t=kt(e),n=document.elementFromPoint(t.x,t.y),Va(n)}}Ba.$inject=[`elementRegistry`,`eventBus`,`injector`];function Va(e){return ct(e,`svg, .djs-element`,!0)}var Ha={__init__:[`hoverFix`],hoverFix:[`type`,Ba]},Ua=Math.round,Wa=`djs-drag-active`;function Ga(e){e.preventDefault()}function Ka(e){return typeof TouchEvent<`u`&&e instanceof TouchEvent}function qa(e){return Math.sqrt(e.x**2+e.y**2)}function Ja(e,t,n,r){var i={threshold:5,trapClick:!0},a;function o(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function s(t,n){n||=a;var r=e.createEvent(T({},n.payload,n.data,{isTouch:n.isTouch}));return e.fire(`drag.`+t,r)!==!1&&e.fire(n.prefix+`.`+t,r)}function c(e){var t=e.filter(function(e){return r.get(e.id)});t.length&&n.select(t)}function l(e,r){var i=a.payload,c=a.displacement,l=a.globalStart,u=kt(e),d=Ze(u,l),f=a.localStart,p=o(u),m=Ze(p,f);if(!a.active&&(r||qa(d)>a.threshold)){if(T(i,{x:Ua(f.x+c.x),y:Ua(f.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===s(`start`))return g();a.active=!0,a.keepSelection||(i.previousSelection=n.get(),n.select(null)),a.cursor&&hn(a.cursor),t.addMarker(t.getRootElement(),Wa)}xt(e),a.active&&(T(i,{x:Ua(p.x+c.x),y:Ua(p.y+c.y),dx:Ua(m.x),dy:Ua(m.y)},{originalEvent:e}),s(`move`))}function u(e){var t,n=!0;a.active&&(e&&(a.payload.originalEvent=e,xt(e)),n=s(`end`)),n===!1&&s(`rejected`),t=_(n!==!0),s(`ended`,t)}function d(e){Ut(`Escape`,e)&&(Ga(e),g())}function f(t){var n;a.active&&(n=vn(e),setTimeout(n,400),Ga(t)),u(t)}function p(e){l(e)}function m(e){var t=a.payload;t.hoverGfx=e.gfx,t.hover=e.element,s(`hover`)}function h(e){s(`out`);var t=a.payload;t.hoverGfx=null,t.hover=null}function g(e){var t;if(a){var n=a.active;n&&s(`cancel`),t=_(e),n&&s(`canceled`,t)}}function _(r){var i,o;s(`cleanup`),gn(),o=a.trapClick?f:u,H.unbind(document,`mousemove`,l),H.unbind(document,`dragstart`,Ga),H.unbind(document,`selectstart`,Ga),H.unbind(document,`mousedown`,o,!0),H.unbind(document,`mouseup`,o,!0),H.unbind(document,`keyup`,d),H.unbind(document,`touchstart`,p,!0),H.unbind(document,`touchcancel`,g,!0),H.unbind(document,`touchmove`,l,!0),H.unbind(document,`touchend`,u,!0),e.off(`element.hover`,m),e.off(`element.out`,h),t.removeMarker(t.getRootElement(),Wa);var _=a.payload.previousSelection;return r!==!1&&_&&!n.get().length&&c(_),i=a,a=null,i}function v(t,n,r,c){a&&g(!1),typeof n==`string`&&(c=r,r=n,n=null),c=T({},i,c||{});var _=c.data||{},v,y,b,x=c.trapClick?f:u,S;if(t?(v=Ft(t)||t,y=kt(t),xt(t),v.type===`dragstart`&&Ga(v)):(v=null,y={x:0,y:0}),b=o(y),n||=b,S=Ka(v),a=T({prefix:r,data:_,payload:{},globalStart:y,displacement:Ze(n,b),localStart:b,isTouch:S},c),c.manual||(S?(H.bind(document,`touchstart`,p,!0),H.bind(document,`touchcancel`,g,!0),H.bind(document,`touchmove`,l,!0),H.bind(document,`touchend`,u,!0)):(H.bind(document,`mousemove`,l),H.bind(document,`dragstart`,Ga),H.bind(document,`selectstart`,Ga),H.bind(document,`mousedown`,x,!0),H.bind(document,`mouseup`,x,!0)),H.bind(document,`keyup`,d),e.on(`element.hover`,m),e.on(`element.out`,h)),s(`init`)===!1)return g(),!1;c.autoActivate&&l(t,!0)}e.on(`diagram.destroy`,g),this.init=v,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=g,this.context=function(){return a},this.setOptions=function(e){T(i,e)}}Ja.$inject=[`eventBus`,`canvas`,`selection`,`elementRegistry`];var Ya={__depends__:[Ha,It],dragging:[`type`,Ja]};function Xa(e,t,n){this._canvas=n,this._opts=T({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on(`drag.move`,function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on([`drag.cleanup`],function(){r.stopScroll()})}Xa.$inject=[`config.autoScroll`,`eventBus`,`canvas`],Xa.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),a=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var o=0,s=0,c=0;c<4;c++)Za(a[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?o=n.scrollStep:c==1?s=n.scrollStep:c==2?o=-n.scrollStep:c==3&&(s=-n.scrollStep));(o!==0||s!==0)&&(t.scroll({dx:o,dy:s}),this._scrolling=setTimeout(function(){r.startScroll(e)},n.scrollRepeatTimeout))};function Za(e,t,n){return t<e&&e<n}Xa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Xa.prototype.setOptions=function(e){this._opts=T({},this._opts,e)},Xa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=kt(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Qa={__depends__:[Ya],__init__:[`autoScroll`],autoScroll:[`type`,Xa]};function $a(e){this._commandStack=e.get(`commandStack`,!1)}$a.$inject=[`injector`],$a.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),n===void 0||n};var eo={__init__:[`rules`],rules:[`type`,$a]},to=Math.round,no=Math.max;function ro(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`]]}function io(e){var t=[];return e.forEach(function(e,n){t.push([n===0?`M`:`L`,e.x,e.y])}),t}var ao=10;function oo(e,t){for(var n=0,r;r=e[n];n++)if(ge(r,t)<=ao)return{point:e[n],bendpoint:!0,index:n};return null}function so(e,t){var n=ye(ro(t,ao),io(e)),r=n[0],i=n[n.length-1],a;return r?r===i?{point:{x:to(r.x),y:to(r.y)},index:r.segment2}:r.segment2===i.segment2?{point:{x:to(r.x+i.x)/2,y:to(r.y+i.y)/2},index:r.segment2}:(a=no(r.segment2,i.segment2)-1,{point:e[a],bendpoint:!0,index:a}):null}function co(e,t){return oo(e,t)||so(e,t)}function lo(e){return Math.sqrt(e.x**2+e.y**2)}function uo(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function fo(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function po(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=r[0].n*t[0]+r[1].n*t[1],a=r[0].lambda*t[0]+r[1].lambda*t[1];return-i/a}function mo(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},a=po([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+a*i.x,y:n.y+a*i.y}}function ho(e,t){var n=mo(e,t);return lo({x:n.x-e.x,y:n.y-e.y})}function go(e,t){return lo({x:e.x-t.x,y:e.y-t.y})}var _o=`djs-bendpoint`,vo=`djs-segment-dragger`;function yo(e,t){var n=kt(t),r=e._container.getBoundingClientRect(),i={x:r.left,y:r.top},a=e.viewbox();return{x:a.x+(n.x-i.x)/a.scale,y:a.y+(n.y-i.y)/a.scale}}function bo(e,t,n){return co(t,yo(e,n))}function xo(e,t){var n=F(`g`);I(n).add(_o),L(e,n);var r=F(`circle`);P(r,{cx:0,cy:0,r:4}),I(r).add(`djs-visual`),L(n,r);var i=F(`circle`);return P(i,{cx:0,cy:0,r:10}),I(i).add(`djs-hit`),L(n,i),t&&I(n).add(t),n}function So(e,t,n,r){var i=F(`g`);L(e,i);var a=18,o=6,s=11,c=Eo(t,n,r),l=o+s,u=F(`rect`);P(u,{x:-a/2,y:-o/2,rx:3,width:a,height:o}),I(u).add(`djs-visual`),L(i,u);var d=F(`rect`);return P(d,{x:-c/2,y:-l/2,width:c,height:l}),I(d).add(`djs-hit`),L(i,d),Vt(i,r===`v`?90:0,0,0),i}function Co(e,t,n){var r=F(`g`),i=Ee(t,n),a=Se(t,n);return L(e,r),So(r,t,n,a),I(r).add(vo),I(r).add(a===`h`?`horizontal`:`vertical`),Bt(r,i.x,i.y),r}function wo(e){return Math.abs(Math.round(e*2/3))}function To(e,t){return mo(e,Do(e,t))}function Eo(e,t,n){var r=t.x-e.x,i=t.y-e.y;return wo(n===`h`?r:i)}function Do(e,t){for(var n=t.waypoints,r=1/0,i,a=0;a<n.length-1;a++){var o=n[a],s=n[a+1],c=ho(e,[o,s]);c<r&&(r=c,i=a)}return[n[i],n[i+1]]}function Oo(e,t,n,r,i){function a(e,t,n){var r=e.index,i=e.point,a,o,s,c,l,u;return r<=0||e.bendpoint?!1:(a=t[r-1],o=t[r],s=Ee(a,o),c=Se(a,o),l=Math.abs(i.x-s.x),u=Math.abs(i.y-s.y),c&&l<=n&&u<=n)}function o(e,t){var n=e.waypoints,r,i,a,o;return t.index<=0||t.bendpoint||(r={start:n[t.index-1],end:n[t.index]},i=Se(r.start,r.end),!i)?null:(a=i===`h`?r.end.x-r.start.x:r.end.y-r.start.y,o=wo(a)/2,o)}function s(e,n){var s=n.waypoints,c=bo(t,s,e),l;if(c&&(l=o(n,c),(a(c,s,l)?i.start(e,n,c.index):r.start(e,n,c.index,!c.bendpoint))!==!1))return!0}function c(e,t,r){H.bind(e,t,function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()})}function l(e,n){var r=t.getLayer(`overlays`),i=V(`.djs-bendpoints[data-element-id="`+Lt(e.id)+`"]`,r);return!i&&n&&(i=F(`g`),P(i,{"data-element-id":e.id}),I(i).add(`djs-bendpoints`),L(r,i),c(i,`mousedown`,e),c(i,`click`,e),c(i,`dblclick`,e)),i}function u(e,t){return V(`.djs-segment-dragger[data-segment-idx="`+e+`"]`,t)}function d(e,t){t.waypoints.forEach(function(t,n){var r=xo(e);L(e,r),Bt(r,t.x,t.y)}),xo(e,`floating`)}function f(e,t){for(var n=t.waypoints,r,i,a,o=1;o<n.length;o++)r=n[o-1],i=n[o],Se(r,i)&&(a=Co(e,r,i),P(a,{"data-segment-idx":o}),c(a,`mousemove`,t))}function p(e){b(lt(`.`+_o,e),function(e){ke(e)})}function m(e){b(lt(`.`+vo,e),function(e){ke(e)})}function h(e){var t=l(e);return t||(t=l(e,!0),d(t,e),f(t,e)),t}function g(e){var t=l(e);t&&(m(t),p(t),f(t,e),d(t,e))}function _(e,t){var n=V(`.floating`,e),r=t.point;n&&(Bt(n,r.x,r.y),I(n).add(`positioned`))}function v(e,t,n){var r=u(t.index,e),i=n[t.index-1],a=n[t.index],o=t.point,s=Ee(i,a),c=Se(i,a),l,d;r&&(l=ko(r),d={x:o.x-s.x,y:o.y-s.y},c===`v`&&(d={x:d.y,y:d.x}),Bt(l,d.x,d.y))}e.on(`connection.changed`,function(e){g(e.element)}),e.on(`connection.remove`,function(e){var t=l(e.element);t&&ke(t)}),e.on(`element.marker.update`,function(e){var t=e.element,n;t.waypoints&&(n=h(t),e.add?I(n).add(e.marker):I(n).remove(e.marker))}),e.on(`element.mousemove`,function(e){var n=e.element,r=n.waypoints,i,a;if(r){if(i=l(n,!0),a=bo(t,r,e.originalEvent),!a)return;_(i,a),a.bendpoint||v(i,a,r)}}),e.on(`element.mousedown`,function(e){if(yt(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return s(t,n)}}),e.on(`selection.changed`,function(e){var t=e.newSelection[0];t&&t.waypoints&&h(t)}),e.on(`element.hover`,function(e){var t=e.element;t.waypoints&&h(t)}),e.on(`element.out`,function(e){var t=e.element;if(t.waypoints){var n=l(t);if(n){var r=V(`.floating`,n);r&&I(r).remove(`positioned`)}}}),e.on(`element.updateId`,function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=l(t);r&&P(r,{"data-element-id":n})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=l,this.getSegmentDragger=u}Oo.$inject=[`eventBus`,`canvas`,`interactionEvents`,`bendpointMove`,`connectionSegmentMove`];function ko(e){return V(`.djs-visual`,e)}var Ao=Math.round,jo=`reconnectStart`,Mo=`reconnectEnd`,No=`updateWaypoints`;function Po(e,t,n,r,i,a){this._injector=e,this.start=function(e,t,a,o){var s=n.getGraphics(t),c=t.source,l=t.target,u=t.waypoints,d=!o&&a===0?jo:!o&&a===u.length-1?Mo:No,f=d===No?`connection.updateWaypoints`:`connection.reconnect`,p=i.allowed(f,{connection:t,source:c,target:l});if(p===!1&&(p=i.allowed(f,{connection:t,source:l,target:c})),p!==!1)return r.init(e,`bendpoint.move`,{data:{connection:t,connectionGfx:s,context:{allowed:p,bendpointIndex:a,connection:t,source:c,target:l,insert:o,type:d}}})},t.on(`bendpoint.move.hover`,function(e){var t=e.context,n=t.connection,r=n.source,a=n.target,o=e.hover,s=t.type;t.hover=o;var c;if(o){var l=s===No?`connection.updateWaypoints`:`connection.reconnect`;c=t.allowed=i.allowed(l,{connection:n,source:s===jo?o:r,target:s===Mo?o:a}),c?(t.source=s===jo?o:r,t.target=s===Mo?o:a):(c===!1&&(c=t.allowed=i.allowed(l,{connection:n,source:s===Mo?o:a,target:s===jo?o:r})),c&&(t.source=s===Mo?o:a,t.target=s===jo?o:r))}}),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!==No&&(t.allowed=!1)}),t.on(`bendpoint.move.end`,function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints.slice(),c=t.source,l=t.target,u=t.type,d=t.hints||{},f={x:Ao(e.x),y:Ao(e.y)};if(!n)return!1;u===No?(o?s.splice(r,0,f):s[r]=f,d.bendpointMove={insert:o,bendpointIndex:r},s=this.cropWaypoints(i,s),a.updateWaypoints(i,Ce(s),d)):(u===jo?(d.docking=`source`,Fo(t)&&(d.docking=`target`,d.newWaypoints=s.reverse())):u===Mo&&(d.docking=`target`,Fo(t)&&(d.docking=`source`,d.newWaypoints=s.reverse())),a.reconnect(i,c,l,f,d))},this)}Po.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`rules`,`modeling`],Po.prototype.cropWaypoints=function(e,t){var n=this._injector.get(`connectionDocking`,!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};function Fo(e){var t=e.hover,n=e.source,r=e.target,i=e.type;if(i===jo)return t&&r&&t===r&&n!==r;if(i===Mo)return t&&n&&t===n&&n!==r}var Io=`reconnectStart`,Lo=`reconnectEnd`,Ro=`updateWaypoints`,zo=`connect-ok`,Bo=`connect-not-ok`,Vo=`connect-hover`,Ho=`djs-updating`,Uo=`djs-dragging`,Wo=1100;function Go(e,t,n,r){this._injector=t;var i=t.get(`connectionPreview`,!1);n.on(`bendpoint.move.start`,function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,a=t.insert,o=i.waypoints,s=o.slice();t.waypoints=o,a&&s.splice(n,0,{x:e.x,y:e.y}),i.waypoints=s;var c=t.draggerGfx=xo(r.getLayer(`overlays`));I(c).add(`djs-dragging`),r.addMarker(i,Uo),r.addMarker(i,Ho)}),n.on(`bendpoint.move.hover`,function(e){var t=e.context,n=t.allowed,i=t.hover,a=t.type;if(i){if(r.addMarker(i,Vo),a===Ro)return;n?(r.removeMarker(i,Bo),r.addMarker(i,zo)):n===!1&&(r.removeMarker(i,zo),r.addMarker(i,Bo))}}),n.on([`bendpoint.move.out`,`bendpoint.move.cleanup`],Wo,function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,Vo),r.removeMarker(n,i?zo:Bo))}),n.on(`bendpoint.move.move`,function(t){var n=t.context,r=n.allowed,a=n.bendpointIndex,o=n.draggerGfx,s=n.hover,c=n.type,l=n.connection,u=l.source,d=l.target,f=l.waypoints.slice(),p={x:t.x,y:t.y},m=n.hints||{},h={};i&&(m.connectionStart&&(h.connectionStart=m.connectionStart),m.connectionEnd&&(h.connectionEnd=m.connectionEnd),c===Io?Fo(n)?(h.connectionEnd=h.connectionEnd||p,h.source=d,h.target=s||u,f=f.reverse()):(h.connectionStart=h.connectionStart||p,h.source=s||u,h.target=d):c===Lo?Fo(n)?(h.connectionStart=h.connectionStart||p,h.source=s||d,h.target=u,f=f.reverse()):(h.connectionEnd=h.connectionEnd||p,h.source=u,h.target=s||d):(h.noCropping=!0,h.noLayout=!0,f[a]=p),c===Ro&&(f=e.cropWaypoints(l,f)),h.waypoints=f,i.drawPreview(n,r,h)),Bt(o,t.x,t.y)},this),n.on([`bendpoint.move.end`,`bendpoint.move.cancel`],Wo,function(e){var t=e.context,n=t.connection,a=t.draggerGfx,o=t.hover,s=t.target;n.waypoints=t.waypoints,ke(a),r.removeMarker(n,Ho),r.removeMarker(n,Uo),o&&(r.removeMarker(o,zo),r.removeMarker(o,s?zo:Bo)),i&&i.cleanUp(t)})}Go.$inject=[`bendpointMove`,`injector`,`eventBus`,`canvas`];var Ko=`connect-hover`,qo=`djs-updating`;function Jo(e,t,n){return Yo(e,t,e[t]+n)}function Yo(e,t,n){return{x:t===`x`?n:e.x,y:t===`y`?n:e.y}}function Xo(e,t,n,r){var i=Math.max(t[r],n[r]),a=Math.min(t[r],n[r]),o=20;return Yo(t,r,Math.min(Math.max(a+o,e[r]),i-o))}function Zo(e){return e===`x`?`y`:`x`}function Qo(e,t,n){var r,i;return e.original?e.original:(r=M(t),i=Zo(n),Yo(e,i,r[i]))}function $o(e,t,n,r,i,a){var o=e.get(`connectionDocking`,!1);this.start=function(e,t,i){var a,o=n.getGraphics(t),s=i-1,c=i,l=t.waypoints,u=l[s],d=l[c],f=bo(n,l,e),p=Se(u,d),m,h;if(p)return m=p===`v`?`x`:`y`,s===0&&(u=Qo(u,t.source,m)),c===l.length-1&&(d=Qo(d,t.target,m)),h=f?f.point:{x:(u.x+d.x)/2,y:(u.y+d.y)/2},a={connection:t,segmentStartIndex:s,segmentEndIndex:c,segmentStart:u,segmentEnd:d,axis:m,dragPosition:h},r.init(e,h,`connectionSegment.move`,{cursor:m===`x`?`resize-ew`:`resize-ns`,data:{connection:t,connectionGfx:o,context:a}})};function s(e,t){if(!o)return t;var n=e.waypoints,r;return e.waypoints=t,r=o.getCroppedWaypoints(e),e.waypoints=n,r}function c(e){i.update(`connection`,e.connection,e.connectionGfx)}function l(e,t,n){var r=e.newWaypoints,i=r[e.segmentStartIndex+t],a=r[e.segmentEndIndex+t],o=Xo(n,i,a,Zo(e.axis));Bt(e.draggerGfx,o.x,o.y)}function u(e,t){var n=0;return{waypoints:e.filter(function(r,i){return!be(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}),segmentOffset:n}}t.on(`connectionSegment.move.start`,function(e){var t=e.context,r=e.connection,i=n.getLayer(`overlays`);t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Co(i,t.segmentStart,t.segmentEnd),I(t.draggerGfx).add(`djs-dragging`),n.addMarker(r,qo)}),t.on(`connectionSegment.move.move`,function(e){var t=e.context,n=t.connection,r=t.segmentStartIndex,i=t.segmentEndIndex,a=t.segmentStart,o=t.segmentEnd,u=t.axis,d=t.originalWaypoints.slice(),f=Jo(a,u,e[`d`+u]),p=Jo(o,u,e[`d`+u]),m=d.length,h=0;d[r]=f,d[i]=p;var g,_;r<2&&(g=xe(n.source,f),r===1?g===`intersect`&&(d.shift(),d[0]=f,h--):g!==`intersect`&&(d.unshift(a),h++)),i>m-3&&(_=xe(n.target,p),i===m-2?_===`intersect`&&(d.pop(),d[d.length-1]=p):_!==`intersect`&&d.push(o)),t.newWaypoints=n.waypoints=s(n,d),l(t,h,e),t.newSegmentStartIndex=r+h,c(e)}),t.on(`connectionSegment.move.hover`,function(e){e.context.hover=e.hover,n.addMarker(e.hover,Ko)}),t.on([`connectionSegment.move.out`,`connectionSegment.move.cleanup`],function(e){var t=e.context.hover;t&&n.removeMarker(t,Ko)}),t.on(`connectionSegment.move.cleanup`,function(e){var t=e.context,r=t.connection;t.draggerGfx&&ke(t.draggerGfx),n.removeMarker(r,qo)}),t.on([`connectionSegment.move.cancel`,`connectionSegment.move.end`],function(e){var t=e.context,n=t.connection;n.waypoints=t.originalWaypoints,c(e)}),t.on(`connectionSegment.move.end`,function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}});var o=u(r,i),c=o.waypoints,l=s(n,c),d=o.segmentOffset,f={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+d}};a.updateWaypoints(n,l,f)})}$o.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`graphicsFactory`,`modeling`];var es=Math.abs,ts=Math.round;function ns(e,t,n){n=n===void 0?10:n;for(var r=0,i;r<t.length;r++)if(i=t[r],es(i-e)<=n)return i}function rs(e){return{x:e.x,y:e.y}}function is(e){return{x:e.x+e.width,y:e.y+e.height}}function as(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:ts(e.x+e.width/2),y:ts(e.y+e.height/2)}}function os(e,t){var n=e.snapped;return n?typeof t==`string`?n[t]:n.x&&n.y:!1}function J(e,t,n){if(typeof t!=`string`)throw Error(`axis must be in [x, y]`);if(typeof n!=`number`&&n!==!1)throw Error(`value must be Number or false`);var r,i=e[t],a=e.snapped=e.snapped||{};return n===!1?a[t]=!1:(a[t]=!0,r=n-i,e[t]+=r,e[`d`+t]+=r),i}function ss(e){return e.children||[]}var cs=Math.abs,ls=Math.round,us=10;function ds(e){function t(e,t){if(m(e)){for(var n=e.length;n--;)if(cs(e[n]-t)<=us)return e[n]}else{e=+e;var r=t%e;if(r<us)return t-r;if(r>e-us)return t-r+e}return t}function n(e,t){if(e.waypoints)return To(t,e);if(e.width)return{x:ls(e.width/2+e.x),y:ls(e.height/2+e.y)}}function r(e){var t=e.context,r=t.snapPoints,i=t.connection,a=i.waypoints,o=t.segmentStart,s=t.segmentStartIndex,c=t.segmentEnd,l=t.segmentEndIndex,u=t.axis;if(r)return r;var d=[a[s-1],o,c,a[l+1]];return s<2&&d.unshift(n(i.source,e)),l>a.length-3&&d.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},b(d,function(e){e&&(e=e.original||e,u===`y`&&r.horizontal.push(e.y),u===`x`&&r.vertical.push(e.x))}),r}e.on(`connectionSegment.move.move`,1500,function(e){var n=r(e),i=e.x,a=e.y,o,s;if(n){o=t(n.vertical,i),s=t(n.horizontal,a);var c=i-o,l=a-s;T(e,{dx:e.dx-c,dy:e.dy-l,x:o,y:s}),(c||n.vertical.indexOf(i)!==-1)&&J(e,`x`,o),(l||n.horizontal.indexOf(a)!==-1)&&J(e,`y`,s)}});function i(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},b(i,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}e.on([`connect.hover`,`connect.move`,`connect.end`],1500,function(e){var t=e.context.hover,r=t&&n(t,e);A(t)&&r&&r.x&&r.y&&(J(e,`x`,r.x),J(e,`y`,r.y))}),e.on([`bendpoint.move.move`,`bendpoint.move.end`],1500,function(e){var r=e.context,a=i(r),o=r.hover,s=o&&n(o,e),c=e.x,l=e.y,u,d;if(a){u=t(s?a.vertical.concat([s.x]):a.vertical,c),d=t(s?a.horizontal.concat([s.y]):a.horizontal,l);var f=c-u,p=l-d;T(e,{dx:e.dx-f,dy:e.dy-p,x:e.x-f,y:e.y-p}),(f||a.vertical.indexOf(c)!==-1)&&J(e,`x`,u),(p||a.horizontal.indexOf(l)!==-1)&&J(e,`y`,d)}})}ds.$inject=[`eventBus`];var fs={__depends__:[Ya,eo],__init__:[`bendpoints`,`bendpointSnapping`,`bendpointMovePreview`],bendpoints:[`type`,Oo],bendpointMove:[`type`,Po],bendpointMovePreview:[`type`,Go],connectionSegmentMove:[`type`,$o],bendpointSnapping:[`type`,ds]};function ps(e,t,n,r){function i(e,t){return r.allowed(`connection.create`,{source:e,target:t})}function a(e,t){return i(t,e)}e.on(`connect.hover`,function(e){var t=e.context,n=t.start,r=e.hover,o;t.hover=r,o=t.canExecute=i(n,r),!g(o)&&(o===!1?(o=t.canExecute=a(n,r),!g(o)&&o!==!1&&(t.source=r,t.target=n)):(t.source=n,t.target=r))}),e.on([`connect.out`,`connect.cleanup`],function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1}),e.on(`connect.end`,function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,a={x:e.x,y:e.y},o=t.source,s=t.target;if(!r)return!1;var c=null,u={connectionStart:ms(t)?a:i,connectionEnd:ms(t)?i:a};l(r)&&(c=r),t.connection=n.connect(o,s,c,u)}),this.start=function(e,n,r,i){l(r)||(i=r,r=M(n)),t.init(e,`connect`,{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}ps.$inject=[`eventBus`,`dragging`,`modeling`,`rules`];function ms(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var hs=1100,gs=900,_s=`connect-ok`,vs=`connect-not-ok`;function ys(e,t,n){var r=e.get(`connectionPreview`,!1);r&&t.on(`connect.move`,function(e){var t=e.context,n=t.canExecute,i=t.hover,a=t.source,o=t.start,s=t.startPosition,c=t.target,l=t.connectionStart||s,u=t.connectionEnd||{x:e.x,y:e.y},d=l,f=u;ms(t)&&(d=u,f=l),r.drawPreview(t,n,{source:a||o,target:c||i,connectionStart:d,connectionEnd:f})}),t.on(`connect.hover`,gs,function(e){var t=e.context,r=e.hover,i=t.canExecute;i!==null&&n.addMarker(r,i?_s:vs)}),t.on([`connect.out`,`connect.cleanup`],hs,function(e){var t=e.hover;t&&(n.removeMarker(t,_s),n.removeMarker(t,vs))}),r&&t.on(`connect.cleanup`,function(e){r.cleanUp(e.context)})}ys.$inject=[`injector`,`eventBus`,`canvas`];var bs={__depends__:[It,eo,Ya],__init__:[`connectPreview`],connect:[`type`,ps],connectPreview:[`type`,ys]},xs=`djs-dragger`;function Ss(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get(`connectionDocking`,!1),this._layouter=e.get(`layouter`,!1)}Ss.$inject=[`injector`,`canvas`,`graphicsFactory`,`elementFactory`],Ss.prototype.drawPreview=function(e,t,n){n||={};var r=e.connectionPreviewGfx,i=e.getConnection,a=n.source,o=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,d=n.noCropping,f=n.noNoop,p,m=this;r||=e.connectionPreviewGfx=this.createConnectionPreviewGfx(),Oe(r),i||=e.getConnection=Cs(function(e,t,n){return m.getConnection(e,t,n)}),t&&(p=i(t,a,o)),p?(p.waypoints=s||[],this._layouter&&!u&&(p.waypoints=this._layouter.layoutConnection(p,{source:a,target:o,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||p.waypoints})),(!p.waypoints||!p.waypoints.length)&&(p.waypoints=[a?M(a):c,o?M(o):l]),this._connectionDocking&&(a||o)&&!d&&(p.waypoints=this._connectionDocking.getCroppedWaypoints(p,a,o)),this._graphicsFactory.drawConnection(r,p,{stroke:`var(--element-dragger-color)`})):!f&&this.drawNoopPreview(r,n)},Ss.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||M(n),a=t.connectionEnd||M(r),o=this.cropWaypoints(i,a,n,r),s=this.createNoopConnection(o[0],o[1]);L(e,s)},Ss.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,a=n&&i.getShapePath(n),o=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&ve(a,s,!0)||e,t=r&&ve(o,s,!1)||t,[e,t]},Ss.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ke(e.connectionPreviewGfx)},Ss.prototype.getConnection=function(e){var t=ws(e);return this._elementFactory.createConnection(t)},Ss.prototype.createConnectionPreviewGfx=function(){var e=F(`g`);return P(e,{pointerEvents:`none`}),I(e).add(xs),L(this._canvas.getActiveLayer(),e),e},Ss.prototype.createNoopConnection=function(e,t){return Be([e,t],{stroke:`#333`,strokeDasharray:[1],strokeWidth:2,"pointer-events":`none`})};function Cs(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||=t[r]=e.apply(null,arguments),i}}function ws(e){return l(e)?e:{}}var Ts={__init__:[`connectionPreview`],connectionPreview:[`type`,Ss]},Es=new At(`ps`),Ds=[`marker-start`,`marker-mid`,`marker-end`],Os=[`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`,`path`,`rect`];function ks(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}ks.$inject=[`elementRegistry`,`eventBus`,`canvas`,`styles`],ks.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`)},ks.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ks.prototype.addDragger=function(e,t,n,r=`djs-dragger`){n||=this.getGfx(e);var i=De(n);return this._cloneMarkers(mt(i),r),P(i,this._styles.cls(r,[])),L(t,i),P(i,`data-preview-support-element-id`,e.id),i},ks.prototype.addFrame=function(e,t){var n=F(`rect`,{class:`djs-resize-overlay`,width:e.width,height:e.height,x:e.x,y:e.y});return L(t,n),P(n,`data-preview-support-element-id`,e.id),n},ks.prototype._cloneMarkers=function(e,t=`djs-dragger`,n=e){var r=this;e.childNodes&&e.childNodes.forEach(e=>{r._cloneMarkers(e,t,n)}),Ns(e)&&Ds.forEach(function(i){if(P(e,i)){var a=As(e,i,r._canvas.getContainer());a&&r._cloneMarker(n,e,a,i,t)}})},ks.prototype._cloneMarker=function(e,t,n,r,i=`djs-dragger`){var a=[n.id,i,Es.next()].join(`-`),o=V(`marker#`+n.id,e);e||=this._canvas._svg;var s=o||De(n);s.id=a,I(s).add(i);var c=V(`:scope > defs`,e);c||(c=F(`defs`),L(e,c)),L(c,s);var l=Ms(s.id);P(t,r,l)};function As(e,t,n){var r=js(P(e,t));return V(`marker#`+r,n||document)}function js(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Ms(e){return`url(#`+e+`)`}function Ns(e){return Os.indexOf(e.nodeName)!==-1}var Ps={__init__:[`previewSupport`],previewSupport:[`type`,ks]},Fs=`complex-preview`,Is=class{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();let{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,a=this._canvas.getLayer(Fs);t.filter(e=>!Ls(e)).forEach(e=>{let t;A(e)?(t=this._graphicsFactory._createContainer(`connection`,F(`g`)),this._graphicsFactory.drawConnection(mt(t),e)):(t=this._graphicsFactory._createContainer(`shape`,F(`g`)),this._graphicsFactory.drawShape(mt(t),e),Bt(t,e.x,e.y)),this._previewSupport.addDragger(e,a,t)}),n.forEach(({element:e,delta:t})=>{this._previewSupport.addDragger(e,a,void 0,`djs-dragging`),this._canvas.addMarker(e,`djs-element-hidden`),this._markers.push([e,`djs-element-hidden`]);let n=this._previewSupport.addDragger(e,a);A(e)?Bt(n,t.x,t.y):Bt(n,e.x+t.x,e.y+t.y)}),r.forEach(e=>{this._previewSupport.addDragger(e,a,void 0,`djs-dragging`),this._canvas.addMarker(e,`djs-element-hidden`),this._markers.push([e,`djs-element-hidden`])}),i.forEach(({shape:e,bounds:t})=>{this._canvas.addMarker(e,`djs-hidden`),this._markers.push([e,`djs-hidden`]),this._previewSupport.addDragger(e,a,void 0,`djs-dragging`);let n=this._graphicsFactory._createContainer(`shape`,F(`g`));this._graphicsFactory.drawShape(mt(n),e,{width:t.width,height:t.height}),Bt(n,t.x,t.y),this._previewSupport.addDragger(e,a,n)})}cleanUp(){Oe(this._canvas.getLayer(Fs)),this._markers.forEach(([e,t])=>this._canvas.removeMarker(e,t)),this._markers=[]}show(){this._canvas.showLayer(Fs)}hide(){this._canvas.hideLayer(Fs)}};Is.$inject=[`canvas`,`graphicsFactory`,`previewSupport`];function Ls(e){return e.hidden}var Rs={__depends__:[Ps],__init__:[`complexPreview`],complexPreview:[`type`,Is]},zs=[`top`,`bottom`,`left`,`right`],Bs=10;function Vs(e,t){B.call(this,e),this.postExecuted([`connection.create`,`connection.layout`,`connection.updateWaypoints`],function(e){var t=e.context,r=t.connection,i=r.source,a=r.target;(t.hints||{}).createElementsBehavior!==!1&&(n(i),n(a))}),this.postExecuted([`label.create`],function(e){var t=e.context,r=t.shape;(t.hints||{}).createElementsBehavior!==!1&&n(r.labelTarget)}),this.postExecuted([`elements.create`],function(e){var t=e.context,r=t.elements;(t.hints||{}).createElementsBehavior!==!1&&r.forEach(function(e){n(e)})});function n(e){if(se(e)&&!A(e)&&!O(e,`bpmn:Group`)){var t=Ws(e);t&&r(e,t)}}function r(e,n){var r=M(e),i=e.label,a=M(i);if(i.parent){var o=N(e),s;switch(n){case`top`:s={x:r.x,y:o.top-Bs-i.height/2};break;case`left`:s={x:o.left-Bs-i.width/2,y:r.y};break;case`bottom`:s={x:r.x,y:o.bottom+Bs+i.height/2};break;case`right`:s={x:o.right+Bs+i.width/2,y:r.y}}var c=Ze(s,a);t.moveShape(i,c)}}}z(Vs,B),Vs.$inject=[`eventBus`,`modeling`];function Hs(e){var t=e.host,n=M(e),r=xe(n,t),i=r.indexOf(`-`)>=0?r.split(`-`):[r];return zs.filter(function(e){return i.indexOf(e)===-1})}function Us(e){var t=M(e);return[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return Gs(t,e)})}function Ws(e){var t=M(e.label),n=Gs(M(e),t);if(Ks(n)){var r=Us(e);if(e.host){var i=Hs(e);r=r.concat(i)}var a=zs.filter(function(e){return r.indexOf(e)===-1});return a.indexOf(n)===-1?a[0]:xe(e.label,e)===`intersect`?n:void 0}}function Gs(e,t){return xe(t,e,5)}function Ks(e){return zs.indexOf(e)!==-1}function qs(e){B.call(this,e),this.preExecute(`shape.append`,function(e){var t=e.source,n=e.shape;e.position||=O(n,`bpmn:TextAnnotation`)?{x:t.x+t.width/2+75,y:t.y-50-n.height/2}:{x:t.x+t.width+80+n.width/2,y:t.y+t.height/2}},!0)}z(qs,B),qs.$inject=[`eventBus`];var Js=1500;function Ys(e,t,n){e.invoke(B,this),this.preExecute(`elements.delete`,Js,function(e){var t=e.context,n=t.elements,i=r(n);i.length&&(t.elements=n.concat(i))}),t.on(`shape.move.start`,function(e){var t=e.context.shapes,n=r(t);n.length&&(e.context.shapes=t.concat(n))});function r(e){var t=u(e,e=>O(e,`bpmn:Participant`)||O(e,`bpmn:SubProcess`));if(!t.length)return[];var r=n.getRootElement(),a=new Set(r.children.filter(e=>O(e,`bpmn:Artifact`))),o=new Set;return b(t,e=>{let t=new Set(i(dt(Array.from(a),it(e))));o=o.union(t),a=a.difference(t)}),Array.from(o)}}z(Ys,B),Ys.$inject=[`injector`,`eventBus`,`canvas`];function Xs(e,t){e.invoke(B,this),this.postExecute(`shape.move`,function(e){var n=e.newParent,r=e.shape,i=u(r.incoming.concat(r.outgoing),function(e){return O(e,`bpmn:Association`)});b(i,function(e){t.moveConnection(e,{x:0,y:0},n)})},!0)}z(Xs,B),Xs.$inject=[`injector`,`modeling`];var Zs=500;function Qs(e,t){t.invoke(B,this),this._bpmnReplace=e;var n=this;this.postExecuted(`elements.create`,Zs,function(e){var t=e.elements;t=t.filter(function(e){var t=e.host;return ec(e,t)}),t.length===1&&t.map(function(e){return t.indexOf(e)}).forEach(function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)})},!0),this.preExecute(`elements.move`,Zs,function(e){var t=e.shapes,r=e.newHost;if(t.length===1){var i=t[0];ec(i,r)&&(e.shapes=[n._replaceShape(i,r)])}},!0)}Qs.$inject=[`bpmnReplace`,`injector`],z(Qs,B),Qs.prototype._replaceShape=function(e,t){var n=$s(e),r={type:`bpmn:BoundaryEvent`,host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function $s(e){var t=k(e).eventDefinitions;return t&&t[0]}function ec(e,t){return!j(e)&&E(e,[`bpmn:IntermediateThrowEvent`,`bpmn:IntermediateCatchEvent`])&&!!t}function tc(e,t){B.call(this,e);function n(e){return u(e.attachers,function(e){return O(e,`bpmn:BoundaryEvent`)})}this.postExecute(`connection.create`,function(e){var r=e.context.source,i=e.context.target,a=n(i);O(r,`bpmn:EventBasedGateway`)&&O(i,`bpmn:ReceiveTask`)&&a.length>0&&t.removeElements(a)}),this.postExecute(`connection.reconnect`,function(e){var r=e.context.oldSource,i=e.context.newSource;O(r,`bpmn:Gateway`)&&O(i,`bpmn:EventBasedGateway`)&&b(i.outgoing,function(e){var r=e.target,i=n(r);O(r,`bpmn:ReceiveTask`)&&i.length>0&&t.removeElements(i)})})}tc.$inject=[`eventBus`,`modeling`],z(tc,B);function nc(e){return e.create(`bpmn:Category`)}function rc(e){return e.create(`bpmn:CategoryValue`)}function ic(e,t){var n=t.get(`categoryValueRef`);return n||=t.categoryValueRef=rc(e),n.$parent||(n.$parent=nc(e)),n}function ac(e,t,n){return Ve(t.get(`categoryValue`),e),e.$parent=t,Ve(n.get(`rootElements`),t),t.$parent=n,e}function oc(e){var t=e.$parent;return t&&(Fe(t.get(`categoryValue`),e),e.$parent=null),e}function sc(e){var t=e.$parent;return t&&(Fe(t.get(`rootElements`),e),e.$parent=null),e}var cc=500;function lc(e,t,n){n.invoke(B,this);function r(e){return t.filter(function(e){return O(e,`bpmn:Group`)&&!e.labelTarget}).map(k).filter(function(t){return t!==e})}function i(e,t){return r(t).some(function(t){return t.get(`categoryValueRef`)===e})}function a(e,t){return r(t).some(function(t){var n=t.get(`categoryValueRef`);return n&&n.$parent===e})}function o(t,n){t&&n&&ac(t,n,e.getDefinitions())}function s(e,t,n){t&&!a(t,n)&&sc(t),e&&!i(e,n)&&oc(e)}this.executed([`shape.create`,`label.create`],function(e){var t=e.labelTarget||e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&o(e.categoryValue,e.category)},!0),this.reverted([`shape.create`,`label.create`],function(e){var t=e.labelTarget||e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&s(e.categoryValue,e.category,k(t))},!0),this.executed([`shape.move`,`shape.resize`],cc,function(e){o(e.categoryValue,e.category)},!0),this.reverted([`shape.move`,`shape.resize`],function(e){var t=e.shape;e.categoryValue&&s(e.categoryValue,e.category,k(t))},!0),this.executed(`group.updateRefs`,function(e){uc(e).forEach(function(e){o(e.categoryValue,e.category)})},!0),this.reverted(`group.updateRefs`,function(e){uc(e).forEach(function(e){s(e.categoryValue,e.category,k(e.groupShape))})},!0),this.executed(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&s(e.categoryValue,e.category,k(t))},!0),this.reverted(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&o(e.categoryValue,e.category)},!0)}lc.$inject=[`bpmnjs`,`elementRegistry`,`injector`],z(lc,B);function uc(e){return e.updates?.groups||[]}function dc(e,t,n){B.call(this,e),this.preExecute(`shape.replace`,s,!0),this.postExecuted(`shape.replace`,c,!0),this.preExecute(`connection.create`,i,!0),this.postExecuted(`connection.delete`,r,!0),this.postExecuted(`connection.reconnect`,a,!0),this.postExecuted(`element.updateProperties`,o,!0);function r(e){let t=e.source,n=e.target;pc(t)&&fc(n)&&u(n)}function i(e){let t=e.connection,n=e.source,r=e.target;pc(n)&&mc(r)&&(l(r),f(n,[t]))}function a(e){let t=e.newTarget,n=e.oldSource,r=e.oldTarget;if(r!==t){let e=n;fc(r)&&u(r),pc(e)&&mc(t)&&l(t)}}function o(e){let{element:t}=e;fc(t)?(d(t),p(t)):mc(t)&&m(t)}function s(e){let{newData:t,oldShape:n}=e;if(pc(e.oldShape)&&t.eventDefinitionType!==`bpmn:CompensateEventDefinition`||t.type!==`bpmn:BoundaryEvent`){let t=n.outgoing.find(({target:e})=>fc(e));t&&t.target&&(e._connectionTarget=t.target)}else if(!pc(e.oldShape)&&t.eventDefinitionType===`bpmn:CompensateEventDefinition`&&t.type===`bpmn:BoundaryEvent`){let t=n.outgoing.find(({target:e})=>mc(e));t&&t.target&&(e._connectionTarget=t.target),h(n)}}function c(e){let{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}function l(e){t.updateProperties(e,{isForCompensation:!0})}function u(e){t.updateProperties(e,{isForCompensation:void 0})}function d(e){for(let r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(let r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}function f(e,n){e.outgoing.filter(e=>O(e,`bpmn:Association`)).filter(e=>fc(e.target)&&!n.includes(e)).forEach(e=>t.removeConnection(e))}function p(e){let n=e.attachers.slice();n.length&&t.removeElements(n)}function m(e){let n=e.incoming.filter(e=>pc(e.source));t.removeElements(n)}function h(e){let n=e.outgoing.filter(e=>O(e,`bpmn:SequenceFlow`));t.removeElements(n)}}z(dc,B),dc.$inject=[`eventBus`,`modeling`,`bpmnRules`];function fc(e){let t=k(e);return t&&t.get(`isForCompensation`)}function pc(e){return e&&O(e,`bpmn:BoundaryEvent`)&&Ne(e,`bpmn:CompensateEventDefinition`)}function mc(e){return e&&O(e,`bpmn:Activity`)&&!Me(e)}function hc(e){e.invoke(B,this),this.preExecute(`shape.create`,1500,function(e){var t=e.context,n=t.parent,r=t.shape;O(n,`bpmn:Lane`)&&!O(r,`bpmn:Lane`)&&(t.parent=Ye(n,`bpmn:Participant`))})}hc.$inject=[`injector`],z(hc,B);function gc(e,t){B.call(this,e),this.preExecute(`shape.create`,function(e){var n=e.context.shape;if(O(n,`bpmn:DataObjectReference`)&&n.type!==`label`){var r=t.create(`bpmn:DataObject`);r.isCollection=n.businessObject.dataObjectRef?.isCollection||!1,n.businessObject.dataObjectRef=r}})}gc.$inject=[`eventBus`,`bpmnFactory`],z(gc,B);var _c=20,vc=20,yc=2e3;function bc(e,t,n){B.call(this,t),t.on([`create.start`,`shape.move.start`],yc,function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(O(r,`bpmn:Participant`)&&O(i,`bpmn:Process`)&&i.children.length){var a=i.children.filter(function(e){return!O(e,`bpmn:Group`)&&!j(e)&&!A(e)});if(a.length){var o=it(a),s=xc(r,o);T(r,s),n.createConstraints=Sc(r,o)}}}),t.on(`create.start`,yc,function(n){var r=n.context.shape,i=e.getRootElement(),a=e.getGraphics(i);function o(e){e.element=i,e.gfx=a}O(r,`bpmn:Participant`)&&O(i,`bpmn:Process`)&&(t.on(`element.hover`,yc,o),t.once(`create.cleanup`,function(){t.off(`element.hover`,o)}))});function r(){var t=e.getRootElement();return O(t,`bpmn:Collaboration`)?t:n.makeCollaboration()}this.preExecute(`elements.create`,yc,function(e){var t=e.elements,n=e.parent,i=Cc(t),a;i&&O(n,`bpmn:Process`)&&(e.parent=r(),a=e.hints=e.hints||{},a.participant=i,a.process=n,a.processRef=k(i).get(`processRef`))},!0),this.preExecute(`shape.create`,function(e){var t=e.parent,n=e.shape;O(n,`bpmn:Participant`)&&O(t,`bpmn:Process`)&&(e.parent=r(),e.process=t,e.processRef=k(n).get(`processRef`))},!0),this.execute(`shape.create`,function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;n&&(!i||r===i)&&k(r).set(`processRef`,k(n))},!0),this.revert(`shape.create`,function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,a=t.participant;n&&(!a||i===a)&&k(i).set(`processRef`,r)},!0),this.postExecute(`shape.create`,function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,a=t.participant;if(r){var o=r.children.slice();a?i===a&&n.moveElements(o,{x:0,y:0},a):n.moveElements(o,{x:0,y:0},i)}},!0)}bc.$inject=[`canvas`,`eventBus`,`modeling`],z(bc,B);function xc(e,t){t={width:t.width+_c*2+30,height:t.height+vc*2};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}function Sc(e,t){return t=N(t),{bottom:t.top+e.height/2-vc,left:t.right-e.width/2+_c,top:t.bottom-e.height/2+vc,right:t.left+e.width/2-_c-30}}function Cc(e){return C(e,function(e){return O(e,`bpmn:Participant`)})}var wc=`__targetRef_placeholder`;function Tc(e,t){B.call(this,e),this.executed([`connection.create`,`connection.delete`,`connection.move`,`connection.reconnect`],Ec(a)),this.reverted([`connection.create`,`connection.delete`,`connection.move`,`connection.reconnect`],Ec(a));function n(e,t,n){var r=e.get(`dataInputAssociations`);return C(r,function(e){return e!==n&&e.targetRef===t})}function r(e,n){var r=e.get(`properties`),i=C(r,function(e){return e.name===wc});return!i&&n&&(i=t.create(`bpmn:Property`,{name:wc}),Ve(r,i)),i}function i(e,t){var i=r(e);i&&(n(e,i,t)||Fe(e.get(`properties`),i))}function a(e){var t=e.context,n=t.connection,a=n.businessObject,o=n.target,s=o&&o.businessObject,c=t.newTarget,l=c&&c.businessObject,u=t.oldTarget||t.target,d=u&&u.businessObject,f=n.businessObject,p;d&&d!==s&&i(d,a),l&&l!==s&&i(l,a),s?(p=r(s,!0),f.targetRef=p):f.targetRef=null}}Tc.$inject=[`eventBus`,`bpmnFactory`],z(Tc,B);function Ec(e){return function(t){var n=t.context.connection;if(O(n,`bpmn:DataInputAssociation`))return e(t)}}function Dc(e){this._bpmnUpdater=e}Dc.$inject=[`bpmnUpdater`],Dc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},Dc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};function Oc(e,t,n,r){B.call(this,r),t.registerHandler(`dataStore.updateContainment`,Dc);function i(){return n.filter(function(e){return O(e,`bpmn:Participant`)&&k(e).processRef})[0]}function a(e){return e.children.filter(function(e){return O(e,`bpmn:DataStoreReference`)&&!e.labelTarget})}function o(e,n){var r=e.businessObject||e;if(n||=i(),n){var a=n.businessObject||n;t.execute(`dataStore.updateContainment`,{dataStoreBo:r,dataStoreDi:D(e),newSemanticParent:a.processRef||a,newDiParent:D(n)})}}this.preExecute(`shape.create`,function(e){var t=e.context,n=t.shape;O(n,`bpmn:DataStoreReference`)&&n.type!==`label`&&(t.hints||={},t.hints.autoResize=!1)}),this.preExecute(`elements.move`,function(e){var t=e.context,n=t.shapes;n.filter(function(e){return O(e,`bpmn:DataStoreReference`)}).length&&(t.hints||={},t.hints.autoResize=n.filter(function(e){return!O(e,`bpmn:DataStoreReference`)}))}),this.postExecute(`shape.create`,function(e){var t=e.context.shape,n=t.parent;O(t,`bpmn:DataStoreReference`)&&t.type!==`label`&&O(n,`bpmn:Collaboration`)&&o(t)}),this.postExecute(`shape.move`,function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;O(r,`bpmn:Collaboration`)||O(n,`bpmn:DataStoreReference`)&&n.type!==`label`&&O(i,`bpmn:Collaboration`)&&o(n,O(r,`bpmn:Participant`)?r:Ac(r,`bpmn:Participant`))}),this.postExecute(`shape.delete`,function(t){var n=t.context.shape,r=e.getRootElement();E(n,[`bpmn:Participant`,`bpmn:SubProcess`])&&O(r,`bpmn:Collaboration`)&&a(r).filter(function(e){return kc(e,n)}).forEach(function(e){o(e)})}),this.postExecute(`canvas.updateRoot`,function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;a(n).forEach(function(e){O(r,`bpmn:Process`)&&o(e,r)})})}Oc.$inject=[`canvas`,`commandStack`,`elementRegistry`,`eventBus`],z(Oc,B);function kc(e,t){for(var n=e.businessObject||e,r=t.businessObject||t;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}function Ac(e,t){for(;e.parent;){if(O(e.parent,t))return e.parent;e=e.parent}}var jc=Math.max,Mc=Math.min,Nc=20;function Pc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Fc(e,t,n){var r=n.x,i=n.y,a={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(a.height=e.height+i):(a.y=e.y+i,a.height=e.height-i),t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(a.x=e.x+r,a.width=e.width-r):a.width=e.width+r,a}function Ic(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Lc(e,t,n){var r=t[e],i=n.min&&n.min[e],a=n.max&&n.max[e];return h(i)&&(r=(/top|left/.test(e)?Mc:jc)(r,i)),h(a)&&(r=(/top|left/.test(e)?jc:Mc)(r,a)),r}function Rc(e,t){if(!t)return e;var n=N(e);return Te({top:Lc(`top`,n,t),right:Lc(`right`,n,t),bottom:Lc(`bottom`,n,t),left:Lc(`left`,n,t)})}function zc(e,t,n,r){var i=N(t),a={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},o=r?N(r):a,s={top:Mc(a.top,o.top),left:Mc(a.left,o.left),bottom:jc(a.bottom,o.bottom),right:jc(a.right,o.right)};return Te(s)}function Bc(e,t){return e===void 0?Nc:e}function Vc(e,t){var n,r,i,a;return typeof t==`object`?(n=Bc(t.left),r=Bc(t.right),i=Bc(t.top),a=Bc(t.bottom)):n=r=i=a=Bc(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+a}}function Hc(e){return!(e.waypoints||e.type===`label`)}function Uc(e,t){var n=e.length===void 0?u(e.children,Hc):e;if(n.length)return Vc(it(n),t)}var Wc=Math.abs;function Gc(e,t){return Pc(N(t),N(e))}var Kc=[`bpmn:Participant`,`bpmn:Process`,`bpmn:SubProcess`];function qc(e,t){return t||=[],e.children.filter(function(e){O(e,`bpmn:Lane`)&&(qc(e,t),t.push(e))}),t}function Jc(e){return e.children.filter(function(e){return O(e,`bpmn:Lane`)})}function Yc(e){return Ye(e,Kc)||e}function Xc(e,t){var n=Yc(e),r=qc(n,O(n,`bpmn:Process`)?[]:[n]),i=N(e),a=N(t),o=Gc(e,t),s=[],c=He(e);return r.forEach(function(t){if(t!==e){var n=c?0:o.top,r=c?o.right:0,l=c?0:o.bottom,u=c?o.left:0,d=N(t);o.top&&(Wc(d.bottom-i.top)<10&&(l=a.top-d.bottom),Wc(d.top-i.top)<5&&(n=a.top-d.top)),o.left&&(Wc(d.right-i.left)<10&&(r=a.left-d.right),Wc(d.left-i.left)<5&&(u=a.left-d.left)),o.bottom&&(Wc(d.top-i.bottom)<10&&(n=a.bottom-d.top),Wc(d.bottom-i.bottom)<5&&(l=a.bottom-d.bottom)),o.right&&(Wc(d.left-i.right)<10&&(u=a.right-d.left),Wc(d.right-i.right)<5&&(r=a.right-d.right)),(n||r||l||u)&&s.push({shape:t,newBounds:Ic(t,{top:n,right:r,bottom:l,left:u})})}}),s}var Zc=500;function Qc(e,t){B.call(this,e);function n(e,n){var r=He(e),i=Jc(n),a=[],o=[],s=[],c=[];if(ht(i,function(t){return r?t.y>e.y?o.push(t):a.push(t):t.x>e.x?c.push(t):s.push(t),t.children}),i.length){var l=r?o.length&&a.length?e.height/2:e.height:c.length&&s.length?e.width/2:e.width,u,d,f,p;a.length&&(u=t.calculateAdjustments(a,`y`,l,e.y-10),t.makeSpace(u.movingShapes,u.resizingShapes,{x:0,y:l},`s`)),o.length&&(d=t.calculateAdjustments(o,`y`,-l,e.y+e.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},`n`)),s.length&&(f=t.calculateAdjustments(s,`x`,l,e.x-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},`e`)),c.length&&(p=t.calculateAdjustments(c,`x`,-l,e.x+e.width+10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:-l,y:0},`w`))}}this.postExecuted(`shape.delete`,Zc,function(e){var t=e.context,r=t.hints,i=t.shape,a=t.oldParent;O(i,`bpmn:Lane`)&&(r&&r.nested||n(i,a))})}Qc.$inject=[`eventBus`,`spaceTool`],z(Qc,B);var $c=500;function el(e,t){t.invoke(B,this),this._bpmnReplace=e;var n=this;this.postExecuted(`elements.create`,$c,function(e){var t=e.elements;t.filter(function(e){var t=e.host;return nl(e,t)}).map(function(e){return t.indexOf(e)}).forEach(function(r){e.elements[r]=n._replaceShape(t[r])})},!0),this.preExecute(`elements.move`,$c,function(e){var t=e.shapes,r=e.newHost;t.forEach(function(e,i){var a=e.host;nl(e,rl(t,a)?a:r)&&(t[i]=n._replaceShape(e))})},!0)}el.$inject=[`bpmnReplace`,`injector`],z(el,B),el.prototype._replaceShape=function(e){var t=tl(e),n=t?{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:t.$type}:{type:`bpmn:IntermediateThrowEvent`};return this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function tl(e){var t=k(e).eventDefinitions;return t&&t[0]}function nl(e,t){return!j(e)&&O(e,`bpmn:BoundaryEvent`)&&!t}function rl(e,t){return e.indexOf(t)!==-1}function il(e,t,n){B.call(this,e);function r(e,r,i){var a=r.waypoints,o,s,c,l,d,f,p,m=e.outgoing.slice(),g=e.incoming.slice(),_=h(i.width)?M(i):i,v=co(a,_);if(v){if(o=a.slice(0,v.index),s=a.slice(v.index+ +!!v.bendpoint),!o.length||!s.length)return;c=v.bendpoint?a[v.index]:_,(o.length===1||!al(e,o[o.length-1]))&&o.push(ol(c)),(s.length===1||!al(e,s[0]))&&s.unshift(ol(c))}l=r.source,d=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||_),f=r),t.canConnect(e,d,r)&&(f?p=n.connect(e,d,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||_),p=r));var y=[].concat(f&&u(g,function(e){return e.source===f.source})||[],p&&u(m,function(e){return e.target===p.target})||[]);y.length&&n.removeElements(y)}this.preExecute(`elements.move`,function(e){var n=e.newParent,r=e.shapes,i=e.delta,a=r[0];if(a&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var o=M(a),s={x:o.x+i.x,y:o.y+i.y},c=C(n.children,function(e){return t.canInsert(r,e)&&co(e.waypoints,s)});c&&(e.targetFlow=c,e.position=s)}},!0),this.postExecuted(`elements.move`,function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute(`shape.create`,function(e){var n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted(`shape.create`,function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}z(il,B),il.$inject=[`eventBus`,`bpmnRules`,`modeling`];function al(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function ol(e){return T({},e)}function sl(e,t){B.call(this,e),this.preExecuted(`connection.create`,function(e){var n=e.context,r=n.connection,i=n.source,a=n.target,o=n.hints;if(!(o&&o.createElementsBehavior===!1)&&cl(r)){var s=[];s=O(i,`bpmn:EventBasedGateway`)?a.incoming.filter(e=>e!==r&&cl(e)):a.incoming.filter(e=>e!==r&&cl(e)&&O(e.source,`bpmn:EventBasedGateway`)),s.forEach(function(e){t.removeConnection(e)})}}),this.preExecuted(`shape.replace`,function(e){var n=e.context.newShape;O(n,`bpmn:EventBasedGateway`)&&n.outgoing.filter(cl).reduce(function(e,t){return e.includes(t.target)?e:e.concat(t.target)},[]).forEach(function(e){e.incoming.filter(cl).forEach(function(r){let i=e.incoming.filter(cl).filter(function(e){return e.source===n});(r.source!==n||i.length>1)&&t.removeConnection(r)})})})}sl.$inject=[`eventBus`,`modeling`],z(sl,B);function cl(e){return O(e,`bpmn:SequenceFlow`)}var ll=1500,ul=2e3;function dl(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`],ll,function(t){var r=t.context.shape||t.shape,i=t.hover;O(i,`bpmn:Lane`)&&!E(r,[`bpmn:Lane`,`bpmn:Participant`])&&(t.hover=Yc(i),t.hoverGfx=e.getGraphics(t.hover));var a=n.getRootElement();i&&i!==a&&(r.labelTarget||E(r,[`bpmn:Group`,`bpmn:TextAnnotation`]))&&(t.hover=a,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`],ll,function(t){var n=t.hover;O(n,`bpmn:Lane`)&&(t.hover=Yc(n)||n,t.hoverGfx=e.getGraphics(t.hover))}),t.on([`bendpoint.move.hover`],ll,function(t){var n=t.context,r=t.hover,i=n.type;O(r,`bpmn:Lane`)&&/reconnect/.test(i)&&(t.hover=Yc(r)||r,t.hoverGfx=e.getGraphics(t.hover))}),t.on([`connect.start`],ll,function(e){var t=e.context,n=t.start;O(n,`bpmn:Lane`)&&(t.start=Yc(n)||n)}),t.on(`shape.move.start`,ul,function(e){var t=e.shape;O(t,`bpmn:Lane`)&&(e.shape=Yc(t)||t)}),t.on(`spaceTool.move`,ul,function(e){var t=e.hover;t&&O(t,`bpmn:Lane`)&&(e.hover=Yc(t))})}dl.$inject=[`elementRegistry`,`eventBus`,`canvas`];var fl=770;function pl(e,t,n,r){n.invoke(B,this);function i(t,n){var r=k(t),i=n.categoryValue||r.categoryValueRef;i||=ic(e,r);var a=n.category||i.$parent||nc(e);r.categoryValueRef=i,i.$parent=a,n.categoryValue=i,n.category=a}function a(e,t){var n=k(e),r=t.categoryValue||n.categoryValueRef,i=t.category||r&&r.$parent;r&&(t.categoryValue=r,t.category=i,n.categoryValueRef=null)}this.execute(`label.create`,function(e){var t=e.context,n=t.labelTarget;O(n,`bpmn:Group`)&&i(n,t)}),this.revert(`label.create`,function(e){var t=e.context,n=t.labelTarget;O(n,`bpmn:Group`)&&a(n,t)}),this.execute(`shape.delete`,function(e){var t=e.context,n=t.shape,r=k(n);if(O(n,`bpmn:Group`)&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(t.category=i.$parent,r.categoryValueRef=null)}}),this.reverted(`shape.delete`,function(e){var t=e.context,n=t.shape;if(O(n,`bpmn:Group`)&&!n.labelTarget){var r=t.category,i=t.categoryValue,a=k(n);i&&(a.categoryValueRef=i,i.$parent=r)}}),this.execute(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.hints||{};O(n,`bpmn:Group`)&&!n.labelTarget&&(r.createElementsBehavior!==!1||k(n).categoryValueRef||t.categoryValue)&&i(n,t)}),this.reverted(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.hints||{};O(n,`bpmn:Group`)&&!n.labelTarget&&(r.createElementsBehavior!==!1||k(n).categoryValueRef||t.categoryValue)&&a(n,t)}),this.executed([`shape.move`,`shape.resize`],function(e){var t=e.context,n=t.shape;!O(n,`bpmn:Group`)||n.labelTarget||k(n).categoryValueRef||i(n,t)}),this.reverted([`shape.move`,`shape.resize`],function(e){var t=e.context,n=t.shape;O(n,`bpmn:Group`)&&!n.labelTarget&&t.categoryValue&&a(n,t)});function o(t,n){var i=e.create(t.$type);return r.copyElement(t,i,null,n)}t.on(`copyPaste.copyElement`,fl,function(e){var t=e.descriptor,n=e.element;if(O(n,`bpmn:Group`)&&!n.labelTarget){var r=k(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=o(i,!0),i.$parent&&(t.category=o(i.$parent,!0))}}}),t.on(`copyPaste.pasteElement`,fl,function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&=n.categoryValueRef=o(r),i&&(r.$parent=o(i)),delete t.category,delete t.categoryValue})}pl.$inject=[`bpmnFactory`,`eventBus`,`injector`,`moddleCopy`],z(pl,B);function ml(e,t,n,r){var i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y),a,o,s,c;return i==0?null:(a=e.y-n.y,o=e.x-n.x,c=(r.x-n.x)*a-(r.y-n.y)*o,s=c/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function hl(e){function t(e,t,n){var r={x:n.x,y:n.y-50},i={x:n.x-50,y:n.y},a=ml(e,t,n,r),o=ml(e,t,n,i);e.original=a&&o?gl(a,n)>gl(o,n)?o:a:a||o}function n(e){var n=e.waypoints;t(n[0],n[1],M(e.source)),t(n[n.length-1],n[n.length-2],M(e.target))}e.on(`bpmnElement.added`,function(e){var t=e.element;t.waypoints&&n(t)})}hl.$inject=[`eventBus`];function gl(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function _l(e){B.call(this,e);var t=[`bpmn:Participant`,`bpmn:Lane`];this.executed([`shape.move`,`shape.create`,`shape.resize`],function(e){var n=e.context.shape,r=k(n),i=D(n);if(E(r,t)){var a=i.get(`isHorizontal`);a===void 0&&(a=!0),i.set(`isHorizontal`,a)}})}_l.$inject=[`eventBus`],z(_l,B);var vl=Math.sqrt,yl=Math.min,bl=Math.max,xl=Math.abs;function Sl(e){return e**2}function Cl(e,t){return vl(Sl(e.x-t.x)+Sl(e.y-t.y))}function wl(e,t){var n=0,r,i,a,o,s,c,l,u,d,f,p;for(n=0;n<t.length-1;n++){if(r=t[n],i=t[n+1],Al(r,i)?l=[r]:(a=Cl(e,r),o=Cl(e,i),c=yl(a,o),l=Tl(r,i,e,c)),l.length<1)throw Error(`expected between [1, 2] circle -> line intersections`);l.length===1&&(u={type:`bendpoint`,position:l[0],segmentIndex:n,bendpointIndex:Al(r,l[0])?n:n+1}),l.length===2&&(s=Ol(l[0],l[1]),u={type:`segment`,position:s,segmentIndex:n,relativeLocation:Cl(r,s)/Cl(r,i)}),d=Cl(u.position,e),(!p||f>d)&&(p=u,f=d)}return p}function Tl(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=n.x-e.x,s=n.y-e.y,c=i*i+a*a,l=i*o+a*s,u=o*o+s*s-r*r,d=l/c,f=u/c,p=d*d-f;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var m=vl(p),h=-d+m,g=-d-m,_={x:e.x-i*h,y:e.y-a*h};return p===0?[_]:[_,{x:e.x-i*g,y:e.y-a*g}].filter(function(n){return El(n,e,t)})}function El(e,t,n){return Dl(e.x,t.x,n.x)&&Dl(e.y,t.y,n.y)}function Dl(e,t,n){return e>=yl(t,n)-kl&&e<=bl(t,n)+kl}function Ol(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var kl=.1;function Al(e,t){return xl(e.x-t.x)<=kl&&xl(e.y-t.y)<=kl}function jl(e,t,n,r){var i=n.segmentIndex,a=t.length-e.length;if(r.segmentMove){var o=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===o?s:i>=s?i+a<s?s:i+a:i}if(r.bendpointMove){var c=r.bendpointMove.insert,l=r.bendpointMove.bendpointIndex,u;return a===0?i:(i>=l&&(u=c?i+1:i-1),i<l&&(u=i,c&&n.type!==`bendpoint`&&l-1===i&&Nl(t,l)<n.relativeLocation&&u++),u)}return a===0?i:r.connectionStart&&i===0?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Ml(e,t,n,r){var i=0,a=0,o={point:e,delta:{x:0,y:0}},s=wl(e,n),c=s.segmentIndex,l=jl(n,t,s,r);if(l<0||l>t.length-2||l===null)return o;var u=Fl(n,c),d=Fl(t,l),f=s.position,p=Il(u,f),m=Pl(u,d);if(s.type===`bendpoint`){var h=t.length-n.length,g=s.bendpointIndex,_=n[g];if(t.indexOf(_)!==-1)return o;if(h===0){var v=t[g];return i=v.x-s.position.x,a=v.y-s.position.y,{delta:{x:i,y:a},point:{x:e.x+i,y:e.y+a}}}h<0&&g!==0&&g<n.length-1&&(p=Nl(n,g))}var y={x:(d[1].x-d[0].x)*p+d[0].x,y:(d[1].y-d[0].y)*p+d[0].y},b=fo({x:e.x-f.x,y:e.y-f.y},m);return i=y.x+b.x-e.x,a=y.y+b.y-e.y,{point:he(y),delta:he({x:i,y:a})}}function Nl(e,t){var n=go(e[t-1],e[t]);return n/(n+go(e[t],e[t+1]))}function Pl(e,t){var n=uo(e);return uo(t)-n}function Fl(e,t){return[e[t],e[t+1]]}function Il(e,t){var n=go(e[0],e[1]),r=go(e[0],t);return n===0?0:r/n}function Ll(e,t,n,r){return Ml(M(e),t,n,r).delta}function Rl(e,t,n){var r=Xe(t),i=Xe(n),a=Ze(e,r),o={x:a.x*(n.width/t.width),y:a.y*(n.height/t.height)};return he({x:i.x+o.x,y:i.y+o.y})}function zl(e,t,n){var r=Xe(e),i=Xe(t),a=Xe(n),o=Ze(e,r),s=Ze(r,i),c=Bl(r,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:a.x+l.x,y:a.y+l.y};return he({x:u.x+o.x-e.x,y:u.y+o.y-e.y})}function Bl(e,t,n){var r=N(t),i=N(n);if(Vl(r,i))return null;var a=xe(t,e),o,s,c;if(a===`top`)o={x:0,y:i.bottom-r.bottom};else if(a===`bottom`)o={x:0,y:i.top-r.top};else if(a===`right`)o={x:i.left-r.left,y:0};else if(a===`left`)o={x:i.right-r.right,y:0};else return null;return s={x:e.x+o.x,y:e.y+o.y},c=xe(n,s),c===a?o:null}function Vl(e,t){return Hl(e,t)||Ul(e,t)}function Hl(e,t){return e.right!==t.right&&e.left!==t.left}function Ul(e,t){return e.top!==t.top&&e.bottom!==t.bottom}function Wl(e,t){if(t.length)return Jl(e,ql(e,t))}function Gl(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function Kl(e){for(var t=[],n=0;n<e.length-1;n++)t.push([e[n],e[n+1]]);return t}function ql(e,t){var n=t.map(function(t){return{line:t,distance:go(e,Jl(e,t))}});return y(n,`distance`)[0].line}function Jl(e,t){var n=t[0],r=t[1],i=r.x-n.x,a=r.y-n.y,o=i*i+a*a;if(o===0)return{x:n.x,y:n.y};var s=((e.x-n.x)*i+(e.y-n.y)*a)/o;return s=Math.max(0,Math.min(1,s)),{x:n.x+s*i,y:n.y+s*a}}var Yl=`name`,Xl=`text`;function Zl(e,t,n,r){B.call(this,e),this.postExecute(`element.updateProperties`,i),this.postExecute(`element.updateModdleProperties`,e=>{k(e.context.element)===e.context.moddleElement&&i(e)});function i(e){var n=e.context,i=n.element,a=n.properties;if(Yl in a&&t.updateLabel(i,a[Yl]),Xl in a&&O(i,`bpmn:TextAnnotation`)){var o=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},a[Xl]||``);t.updateLabel(i,a.text,o)}}this.postExecute([`shape.create`,`connection.create`],function(e){var n=e.context;if((n.hints||{}).createElementsBehavior!==!1){var r=n.shape||n.connection;!j(r)&&pe(r)&&ue(r)&&t.updateLabel(r,ue(r))}}),this.postExecute(`shape.delete`,function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&i.unsetLabel!==!1&&t.updateLabel(r,null,null,{removeShape:!1})});function a(e){var t=e.context,n=t.connection,r=n.label,i=T({},t.hints),a=t.newWaypoints||n.waypoints,o=t.oldWaypoints;return i.startChanged===void 0&&(i.startChanged=!!i.connectionStart),i.endChanged===void 0&&(i.endChanged=!!i.connectionEnd),Ll(r,a,o,i)}this.postExecute([`connection.layout`,`connection.updateWaypoints`],function(e){var n=e.context;if((n.hints||{}).labelBehavior!==!1){var r=n.connection.label,i;r&&r.parent&&(i=a(e),t.moveShape(r,i))}}),this.postExecute([`shape.replace`],function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=k(n);i&&pe(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)}),this.preExecute(`shape.resize`,function(e){var t=e.context,n=t.shape,i=t.hints||{};if(j(n)&&!i.autoResize){var a=t.newBounds,o=r.getDimensions(ue(n)||``,{box:a,style:r.getExternalStyle()}),s=Math.ceil(o.height),c=a.y!==n.y,l=n.y+n.height;t.newBounds={width:a.width,height:s,x:a.x,y:c?l-s:a.y}}}),this.postExecute(`shape.resize`,function(e){var n=e.context,r=n.shape,i=n.newBounds,a=n.oldBounds;if(se(r)){var o=r.label,s=Ql(Wl(M(o),Gl(a)),a,i);t.moveShape(o,s)}})}z(Zl,B),Zl.$inject=[`eventBus`,`modeling`,`bpmnFactory`,`textRenderer`];function Ql(e,t,n){var r=Rl(e,t,n);return he(Ze(r,e))}function $l(e,t,n,r){return Ml(e,t,n,r).point}function eu(e,t){B.call(this,e);function n(e,t){var n=e.context,r=n.connection,i=T({},n.hints),a=n.newWaypoints||r.waypoints,o=n.oldWaypoints;return i.startChanged===void 0&&(i.startChanged=!!i.connectionStart),i.endChanged===void 0&&(i.endChanged=!!i.connectionEnd),$l(t,a,o,i)}this.postExecute([`connection.layout`,`connection.updateWaypoints`],function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach(function(r){var i=r.waypoints[r.waypoints.length-1],a=n(e,i),o=[].concat(r.waypoints.slice(0,-1),[a]);t.updateWaypoints(r,o)}),i.forEach(function(r){var i=r.waypoints[0],a=[n(e,i)].concat(r.waypoints.slice(1));t.updateWaypoints(r,a)})}),this.postExecute([`connection.move`],function(e){var n=e.context,r=n.connection,i=r.outgoing,a=r.incoming,o=n.delta;a.forEach(function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+o.x,y:n.y+o.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)}),i.forEach(function(e){var n=e.waypoints[0],r=[{x:n.x+o.x,y:n.y+o.y}].concat(e.waypoints.slice(1));t.updateWaypoints(e,r)})})}z(eu,B),eu.$inject=[`eventBus`,`modeling`];function tu(e,t,n){var r=ou(e),i=su(r,t),a=r[0];return i.length?i[i.length-1]:Rl(a.original||a,n,t)}function nu(e,t,n){var r=ou(e),i=su(r,t),a=r[r.length-1];return i.length?i[0]:Rl(a.original||a,n,t)}function ru(e,t,n){var r=ou(e),i=au(t,n),a=r[0];return Rl(a.original||a,i,t)}function iu(e,t,n){var r=ou(e),i=au(t,n),a=r[r.length-1];return Rl(a.original||a,i,t)}function au(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ou(e){var t=e.waypoints;if(!t.length)throw Error(`connection#`+e.id+`: no waypoints`);return t}function su(e,t){var n=ae(e,lu);return u(n,function(e){return cu(e,t)})}function cu(e,t){return xe(t,e,1)===`intersect`}function lu(e){return e.original||e}function uu(e,t){B.call(this,e),this.postExecute(`shape.replace`,function(e){var n=e.oldShape,r=e.newShape;if(du(n,r)){var i=fu(n);i.incoming.forEach(function(e){var i=nu(e,r,n);t.reconnectEnd(e,r,i)}),i.outgoing.forEach(function(e){var i=tu(e,r,n);t.reconnectStart(e,r,i)})}},!0)}uu.$inject=[`eventBus`,`modeling`],z(uu,B);function du(e,t){return O(e,`bpmn:Participant`)&&R(e)&&O(t,`bpmn:Participant`)&&!R(t)}function fu(e){var t=et([e],!1),n=[],r=[];return t.forEach(function(t){t!==e&&(t.incoming.forEach(function(e){O(e,`bpmn:MessageFlow`)&&n.push(e)}),t.outgoing.forEach(function(e){O(e,`bpmn:MessageFlow`)&&r.push(e)}))},[]),{incoming:n,outgoing:r}}var pu=[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:EscalationEventDefinition`,`bpmn:ConditionalEventDefinition`,`bpmn:SignalEventDefinition`];function mu(e){let t=k(e);if(!O(t,`bpmn:BoundaryEvent`)&&!(O(t,`bpmn:StartEvent`)&&Me(t.$parent)))return!1;let n=t.get(`eventDefinitions`);return!n||!n.length?!1:pu.some(e=>O(n[0],e))}function hu(e){return O(e,`bpmn:BoundaryEvent`)?`cancelActivity`:`isInterrupting`}function gu(e,t){e.invoke(B,this),this.postExecuted(`shape.replace`,function(e){let n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!mu(r))return;let a=hu(r);if(i.targetElement&&i.targetElement[a]!==void 0)return;let o=k(n).get(a);o!==k(r).get(a)&&t.updateProperties(r,{[a]:o})})}gu.$inject=[`injector`,`modeling`],z(gu,B);function _u(e,t){B.call(this,e),this.preExecute(`shape.resize`,function(e){var n=e.shape,r=D(n),i=r&&r.get(`label`);i&&i.get(`bounds`)&&t.updateModdleProperties(n,i,{bounds:void 0})},!0)}z(_u,B),_u.$inject=[`eventBus`,`modeling`];function vu(e,t,n){B.call(this,e),this.preExecute(`shape.delete`,function(e){var r=e.context.shape;if(r.incoming.length===1&&r.outgoing.length===1){var i=r.incoming[0],a=r.outgoing[0];if(O(i,`bpmn:SequenceFlow`)&&O(a,`bpmn:SequenceFlow`)&&t.canConnect(i.source,a.target,i)){var o=bu(i.waypoints,a.waypoints);n.reconnectEnd(i,a.target,o)}}})}z(vu,B),vu.$inject=[`eventBus`,`bpmnRules`,`modeling`];function yu(e){return e.original||e}function bu(e,t){var n=ml(yu(e[e.length-2]),yu(e[e.length-1]),yu(t[1]),yu(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yu(e[0]),yu(t[t.length-1])]}function xu(e,t){B.call(this,e),this.preExecute(`shape.delete`,function(e){var t=e.shape,n=t.parent;O(t,`bpmn:Participant`)&&(e.collaborationRoot=n)},!0),this.postExecute(`shape.delete`,function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}},!0)}xu.$inject=[`eventBus`,`modeling`],z(xu,B);function Su(e,t,n,r){B.call(this,e);var i=r.get(`dragging`,!1);function a(e){var r=e.source,i=e.target;if(e.parent){var a,o;O(e,`bpmn:SequenceFlow`)&&(n.canConnectSequenceFlow(r,i)||(o=!0),n.canConnectMessageFlow(r,i)&&(a=`bpmn:MessageFlow`)),O(e,`bpmn:MessageFlow`)&&(n.canConnectMessageFlow(r,i)||(o=!0),n.canConnectSequenceFlow(r,i)&&(a=`bpmn:SequenceFlow`)),o&&t.removeConnection(e),a&&t.connect(r,i,{type:a,waypoints:e.waypoints.slice()})}}function o(e){var r=e.context,a=r.connection,o=r.newSource||a.source,s=r.newTarget||a.target,l=n.canConnect(o,s),u;l&&l.type!==a.type&&(u=t.connect(o,s,{type:l.type,associationDirection:l.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),r.connection=u,i&&c(a,u))}function c(e,t){var n=i.context(),r=n&&n.payload.previousSelection,a;r&&r.length&&(a=r.indexOf(e),a!==-1&&r.splice(a,1,t))}this.postExecuted(`elements.move`,function(e){var t=e.closure.allConnections;b(t,a)},!0),this.preExecute(`connection.reconnect`,o),this.postExecuted(`element.updateProperties`,function(e){var n=e.context,r=n.properties,i=n.element,a=i.businessObject,o;r.default&&(o=C(i.outgoing,s({id:i.businessObject.default.id})),o&&t.updateProperties(o,{conditionExpression:void 0})),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(i.source,{default:void 0})})}z(Su,B),Su.$inject=[`eventBus`,`modeling`,`bpmnRules`,`injector`];function Cu(e,t,n,r,i,a){r.invoke(B,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=a,this.postExecuted([`elements.create`],500,function(e){var n=e.context,r=n.parent,i=n.elements,a=c(i,function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e},[]);a.length&&this._replaceElements(i,a)},this),this.postExecuted([`elements.move`],500,function(e){var n=e.context,r=n.newParent,i=n.newHost,a=[];b(n.closure.topLevel,function(e){a=Me(e)?a.concat(e.children):a.concat(e)}),a.length===1&&i&&(r=i);var o=t.canReplace(a,r);o&&this._replaceElements(a,o.replacements,i)},this),this.postExecute([`shape.replace`],1500,function(e){var n=e.context,r=n.oldShape,i=n.newShape,a=r.attachers,o;a&&a.length&&(o=t.canReplace(a,i),this._replaceElements(a,o.replacements))},this),this.postExecuted([`shape.replace`],1500,function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})})}z(Cu,B),Cu.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;b(t,function(t){var i={type:t.newElementType},a=n.get(t.oldElementId),o=e.indexOf(a);e[o]=r.replaceElement(a,i,{select:!1})}),t&&i.select(e)},Cu.$inject=[`bpmnReplace`,`bpmnRules`,`elementRegistry`,`injector`,`modeling`,`selection`];var wu=1500,Tu={width:140,height:120},Eu={width:300,height:60},Du={width:60,height:300},Ou={width:300,height:150},ku={width:150,height:300},Au={width:140,height:120},ju={width:100,height:40};function Mu(e){e.on(`resize.start`,wu,function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(O(n,`bpmn:Lane`)||O(n,`bpmn:Participant`))&&(t.resizeConstraints=Vu(n,r,i)),O(n,`bpmn:SubProcess`)&&R(n)&&(t.minDimensions=Au),O(n,`bpmn:TextAnnotation`)&&(t.minDimensions=ju)})}Mu.$inject=[`eventBus`];var Nu=Math.abs,Pu=Math.min,Fu=Math.max;function Iu(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function Lu(e,t,n){return Iu(e,t,n,Pu)}function Ru(e,t,n){return Iu(e,t,n,Fu)}var zu={top:20,left:50,right:20,bottom:20},Bu={top:50,left:20,right:20,bottom:20};function Vu(e,t,n){var r=Yc(e),i=!0,a=!0,o=qc(r,[r]),s=N(e),c={},l={},u=He(e),d=u?Eu:Du;/n/.test(t)?l.top=s.bottom-d.height:/e/.test(t)?l.right=s.left+d.width:/s/.test(t)?l.bottom=s.top+d.height:/w/.test(t)&&(l.left=s.right-d.width),o.forEach(function(e){var r=N(e);u?(r.top<s.top-10&&(i=!1),r.bottom>s.bottom+10&&(a=!1)):(r.left<s.left-10&&(i=!1),r.right>s.right+10&&(a=!1)),/n/.test(t)&&(n&&Nu(s.top-r.bottom)<10&&Ru(c,`top`,r.top+d.height),Nu(s.top-r.top)<5&&Lu(l,`top`,r.bottom-d.height)),/e/.test(t)&&(n&&Nu(s.right-r.left)<10&&Lu(c,`right`,r.right-d.width),Nu(s.right-r.right)<5&&Ru(l,`right`,r.left+d.width)),/s/.test(t)&&(n&&Nu(s.bottom-r.top)<10&&Lu(c,`bottom`,r.bottom-d.height),Nu(s.bottom-r.bottom)<5&&Ru(l,`bottom`,r.top+d.height)),/w/.test(t)&&(n&&Nu(s.left-r.right)<10&&Ru(c,`left`,r.left+d.width),Nu(s.left-r.left)<5&&Lu(l,`left`,r.right-d.width))});var f=r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(O(e,`bpmn:FlowElement`)||O(e,`bpmn:Artifact`))}),p=u?zu:Bu;return f.forEach(function(e){var n=N(e);/n/.test(t)&&(!u||i)&&Lu(l,`top`,n.top-p.top),/e/.test(t)&&(u||a)&&Ru(l,`right`,n.right+p.right),/s/.test(t)&&(!u||a)&&Ru(l,`bottom`,n.bottom+p.bottom),/w/.test(t)&&(u||i)&&Lu(l,`left`,n.left-p.left)}),{min:l,max:c}}var Hu=1001;function Uu(e,t){e.on(`resize.start`,Hu+500,function(e){var t=e.context,n=t.shape;(O(n,`bpmn:Lane`)||O(n,`bpmn:Participant`))&&(t.balanced=!Pt(e))}),e.on(`resize.end`,Hu,function(e){var n=e.context,r=n.shape,i=n.canExecute,a=n.newBounds;if(O(r,`bpmn:Lane`)||O(r,`bpmn:Participant`))return i&&(a=we(a),t.resizeLane(r,a,n.balanced)),!1})}Uu.$inject=[`eventBus`,`modeling`];var Wu=500;function Gu(e,t,n,r,i){n.invoke(B,this);function a(e){return E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`])||Ku(e,[`bpmn:ErrorEventDefinition`,`bpmn:EscalationEventDefinition`,`bpmn:MessageEventDefinition`,`bpmn:SignalEventDefinition`])}function o(t){var n=e.getDefinitions().get(`rootElements`);return!!C(n,s({id:t.id}))}function c(e){if(O(e,`bpmn:ErrorEventDefinition`))return`errorRef`;if(O(e,`bpmn:EscalationEventDefinition`))return`escalationRef`;if(O(e,`bpmn:MessageEventDefinition`))return`messageRef`;if(O(e,`bpmn:SignalEventDefinition`))return`signalRef`}function l(e){if(E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`]))return e.get(`messageRef`);var t=e.get(`eventDefinitions`)[0];return t.get(c(t))}function u(e,t){if(E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`]))return e.set(`messageRef`,t);var n=e.get(`eventDefinitions`)[0];return n.set(c(n),t)}this.executed([`shape.create`,`element.updateProperties`,`element.updateModdleProperties`],function(t){var n=t.shape||t.element;if(a(n)){var r=l(k(n)),i;r&&!o(r)&&(i=e.getDefinitions().get(`rootElements`),Ve(i,r),t.addedRootElement=r)}},!0),this.reverted([`shape.create`,`element.updateProperties`,`element.updateModdleProperties`],function(t){var n=t.addedRootElement;if(n){var r=e.getDefinitions().get(`rootElements`);Fe(r,n)}},!0),t.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&a(n)){var r=l(k(n));r&&(t.referencedRootElement=r)}}),t.on(`copyPaste.pasteElement`,Wu,function(e){var t=e.descriptor,n=t.businessObject,a=t.referencedRootElement;a&&(o(a)||(a=r.copyElement(a,i.create(a.$type))),u(n,a),delete t.referencedRootElement)})}Gu.$inject=[`bpmnjs`,`eventBus`,`injector`,`moddleCopy`,`bpmnFactory`],z(Gu,B);function Ku(e,t){return m(t)||(t=[t]),o(t,function(t){return Ne(e,t)})}var qu=Math.max;function Ju(e){e.on(`spaceTool.getMinDimensions`,function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return b(t,function(e){var t=e.id;O(e,`bpmn:Participant`)&&(i[t]=Xu(e,n,r)),O(e,`bpmn:Lane`)&&(i[t]=He(e)?Eu:Du),O(e,`bpmn:SubProcess`)&&R(e)&&(i[t]=Au),O(e,`bpmn:TextAnnotation`)&&(i[t]=ju),O(e,`bpmn:Group`)&&(i[t]=Tu)}),i})}Ju.$inject=[`eventBus`];function Yu(e){return e===`x`}function Xu(e,t,n){var r=He(e);if(!$u(e))return r?Ou:ku;var i=Yu(t),a={};return a=i?r?Ou:{width:Qu(e,n,i),height:ku.height}:r?{width:Ou.width,height:Zu(e,n,i)}:ku,a}function Zu(e,t,n){var r=ed(e,t,n);return qu(Ou.height,r)}function Qu(e,t,n){var r=td(e,t,n);return qu(ku.width,r)}function $u(e){return!!Jc(e).length}function ed(e,t,n){var r=nd(Jc(e),t,n);return e.height-r.height+Eu.height}function td(e,t,n){var r=nd(Jc(e),t,n);return e.width-r.width+Du.width}function nd(e,t,n){for(var r=0,i,a;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return a=Jc(i),a.length?nd(a,t,n):i}var rd=400,id=600,ad={x:180,y:160};function od(e,t,n,r,i,a,o){B.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=a,this._elementRegistry=o;var s=this;function c(e){return O(e,`bpmn:SubProcess`)&&!R(e)}function l(t){var n=t.shape,r=t.newRootElement,i=k(n);r=s._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function u(t){var n=t.shape,r=k(n);s._removeDiagram(r);var i=t.newRootElement=o.get(qe(r));e.removeRootElement(i)}this.executed(`shape.create`,function(e){var t=e.shape;c(t)&&l(e)},!0),this.postExecuted(`elements.create`,function(e){var t=e.elements;b(t,function(e){if(c(e)){var t=o.get(qe(e));if(t&&e.children&&e.children.length){var n=cd(e);s._showRecursively(n),s._moveChildrenToShape(n,t)}}})},!0),this.reverted(`shape.create`,function(e){var t=e.shape;c(t)&&u(e)},!0),this.preExecute(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&R(t)&&b(wt([t]),e=>{n.removeShape(e.annotation)})},!0),this.preExecuted(`shape.delete`,function(e){var t=e.shape;if(c(t)){var r=o.get(qe(t));r&&n.removeElements(r.children.slice())}},!0),this.executed(`shape.delete`,function(e){var t=e.shape;c(t)&&u(e)},!0),this.reverted(`shape.delete`,function(e){var t=e.shape;c(t)&&l(e)},!0),this.preExecuted(`shape.replace`,function(t){var n=t.oldShape,r=t.newShape;c(n)&&c(r)&&(t.oldRoot=e.removeRootElement(qe(n)))},!0),this.postExecuted(`shape.replace`,function(t){var r=t.newShape,i=t.oldRoot,a=e.findRoot(qe(r));if(i&&a){var o=i.children;n.moveElements(o,{x:0,y:0},a)}},!0),this.executed(`element.updateProperties`,function(e){var t=e.element;if(O(t,`bpmn:SubProcess`)){var n=e.properties,r=e.oldProperties.id,i=n.id;r!==i&&(Ke(t)?(o.updateId(t,Ie(i)),o.updateId(r,i)):o.get(Ie(r))&&o.updateId(Ie(r),Ie(i)))}},!0),this.reverted(`element.updateProperties`,function(e){var t=e.element;if(O(t,`bpmn:SubProcess`)){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ke(t))o.updateId(t,Ie(r)),o.updateId(i,r);else{var a=o.get(Ie(i));a&&o.updateId(a,Ie(r))}}}},!0),t.on(`element.changed`,function(e){var n=e.element;if(Ke(n)){var r=n,i=o.get(ze(r));i&&i!==r&&t.fire(`element.changed`,{element:i})}}),this.executed(`shape.toggleCollapse`,rd,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&(R(t)?u(e):(l(e),s._showRecursively(t.children)))},!0),this.reverted(`shape.toggleCollapse`,rd,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&(R(t)?u(e):(l(e),s._showRecursively(t.children)))},!0),this.postExecuted(`shape.toggleCollapse`,id,function(e){var t=e.shape;if(O(t,`bpmn:SubProcess`)){var r=e.newRootElement;if(r){if(R(t))s._moveChildrenToShape(r.children.slice(),t),b(wt(t.children),e=>{n.moveShape(e.annotation,{x:0,y:0},t.parent),b(e.associations,e=>{n.moveConnection(e,{x:0,y:0},t.parent)})});else{s._disconnectSharedAnnotations(t);var i=cd(t);s._moveChildrenToShape(i,r)}}}},!0),t.on(`copyPaste.createTree`,function(e){var t=e.element,n=e.children;if(c(t)){var r=qe(t),i=o.get(r);i&&n.push.apply(n,i.children)}}),t.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(O(D(i),`bpmndi:BPMNPlane`)){var a=ze(i),o=C(r,function(e){return e.id===a});o&&(t.parent=o.id)}}),t.on(`copyPaste.pasteElement`,function(e){var t=e.descriptor;t.parent&&(c(t.parent)||t.parent.hidden)&&(t.hidden=!0)})}z(od,B),od.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var r=e.filter(function(e){return!e.hidden});if(!r.length)n.moveElements(e,{x:0,y:0},t,{autoResize:!1});else{var i=it(r),a;if(!t.x)a={x:ad.x-i.x,y:ad.y-i.y};else{var o=M(t),s=M(i);a={x:o.x-s.x,y:o.y-s.y}}n.moveElements(e,a,t,{autoResize:!1})}}},od.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(vt(e).map(e=>e.annotation));n.size&&b(wt(e.children),e=>{n.has(e.annotation)&&b(e.associations,e=>{t.removeConnection(e)})})},od.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach(function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))}),r},od.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},od.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create(`bpmndi:BPMNPlane`,{bpmnElement:e});return r.$parent=t.create(`bpmndi:BPMNDiagram`,{plane:r}),n.createRoot({id:qe(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},od.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=C(t,function(t){return t.plane.bpmnElement.id===e.id});return t.splice(t.indexOf(n),1),n},od.$inject=[`canvas`,`eventBus`,`modeling`,`elementFactory`,`bpmnFactory`,`bpmnjs`,`elementRegistry`];function sd(e){var t=[];return b(wt(e),e=>{t.push(e.annotation),t.push.apply(t,e.associations)}),t}function cd(e){return e.children.slice().concat(sd(e.children)).concat(ld(e))}function ld(e){return Dt(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ud(e,t){e.invoke(B,this),this.postExecuted(`shape.replace`,function(e){var n=e.context.oldShape,r=e.context.newShape;if(O(r,`bpmn:SubProcess`)&&!O(r,`bpmn:AdHocSubProcess`)&&(O(n,`bpmn:Task`)||O(n,`bpmn:CallActivity`))&&R(r)){var i=dd(r);t.createShape({type:`bpmn:StartEvent`},i,r)}})}ud.$inject=[`injector`,`modeling`],z(ud,B);function dd(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function fd(e,t){B.call(this,e),this.preExecute(`connection.create`,function(e){let{target:t}=e;O(t,`bpmn:TextAnnotation`)&&(e.parent=t.parent)},!0),this.preExecute([`shape.create`,`shape.resize`,`elements.move`],function(e){let t=e.shapes||[e.shape];t.length===1&&O(t[0],`bpmn:TextAnnotation`)&&(e.hints=e.hints||{},e.hints.autoResize=!1)},!0),this.preExecute(`shape.resize`,function(e){var n=e.context,r=n.shape,i=n.hints||{};if(O(r,`bpmn:TextAnnotation`)&&!i.autoResize){var a=n.newBounds,o=t.getTextAnnotationBounds(a,ue(r)||``),s=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,c=r.y+r.height;n.newBounds={width:a.width,height:o.height,x:a.x,y:s?c-o.height:a.y}}})}z(fd,B),fd.$inject=[`eventBus`,`textRenderer`];function pd(e,t){B.call(this,e),this.postExecuted(`shape.toggleCollapse`,1500,function(e){var n=e.shape;if(R(n))return;var r=et(n);r.forEach(function(e){var t=e.incoming.slice(),n=e.outgoing.slice();b(t,function(e){i(e,!0)}),b(n,function(e){i(e,!1)})});function i(e,i){(r.indexOf(e.source)===-1||r.indexOf(e.target)===-1)&&(O(e,`bpmn:Association`)&&(O(e.source,`bpmn:TextAnnotation`)||O(e.target,`bpmn:TextAnnotation`))||(i?t.reconnectEnd(e,n,M(n)):t.reconnectStart(e,n,M(n))))}},!0)}z(pd,B),pd.$inject=[`eventBus`,`modeling`];var md=500;function hd(e,t,n){B.call(this,e);function r(e){e.length&&e.forEach(function(e){e.type===`label`&&!e.businessObject.name&&(e.hidden=!0)})}function i(e,t){var n=e.children,r=t,i=Uc(gd(n).concat([e]));return i?(r.width=Math.max(i.width,r.width),r.height=Math.max(i.height,r.height),r.x=i.x+(i.width-r.width)/2,r.y=i.y+(i.height-r.height)/2):(r.x=e.x+(e.width-r.width)/2,r.y=e.y+(e.height-r.height)/2),r}function a(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}}this.executed([`shape.toggleCollapse`],md,function(e){var t=e.context.shape;O(t,`bpmn:SubProcess`)&&(t.collapsed?D(t).isExpanded=!1:(r(t.children),D(t).isExpanded=!0))}),this.reverted([`shape.toggleCollapse`],md,function(e){var t=e.context.shape;t.collapsed?D(t).isExpanded=!1:D(t).isExpanded=!0}),this.postExecuted([`shape.toggleCollapse`],md,function(e){var r=e.context.shape,o=t.getDefaultSize(r),s=r.collapsed?a(r,o):i(r,o);n.resizeShape(r,s,null,{autoResize:!r.collapsed&&`nwse`})})}z(hd,B),hd.$inject=[`eventBus`,`elementFactory`,`modeling`];function gd(e){return e.filter(function(e){return!e.hidden})}function _d(e,t,n,r){t.invoke(B,this),this.preExecute(`shape.delete`,function(e){var t=e.context.shape,i=t.businessObject;j(t)||(O(t,`bpmn:Participant`)&&R(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))}),this.preExecute(`connection.delete`,function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)}),this.preExecute(`canvas.updateRoot`,function(){var t=e.getRootElement(),r=t.businessObject;O(t,`bpmn:Collaboration`)&&n.ids.unclaim(r.id)})}z(_d,B),_d.$inject=[`canvas`,`injector`,`moddle`,`modeling`];function vd(e,t){B.call(this,e),this.preExecute(`connection.delete`,function(e){var n=e.context.connection,r=n.source;yd(n,r)&&t.updateProperties(r,{default:null})})}z(vd,B),vd.$inject=[`eventBus`,`modeling`];function yd(e,t){if(!O(e,`bpmn:SequenceFlow`))return!1;var n=k(t),r=k(e);return n.get(`default`)===r}var bd=500,xd=5e3,Sd=[`shape.create`,`shape.delete`,`shape.move`,`shape.resize`],Cd=[...Sd,`spaceTool`,`lane.add`,`lane.resize`,`lane.split`,`elements.create`,`elements.delete`,`elements.move`];function wd(e,t){B.call(this,e);var n;function r(){return n||=new Td,n.enter(),n}function i(){if(!n)throw Error(`out of bounds release`);return n}function a(){if(!n)throw Error(`out of bounds release`);var e=n.leave();return e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),e}this.preExecute(Cd,xd,function(){r()}),this.postExecuted(Cd,bd,function(){a()}),this.preExecute(Sd,function(e){var t=e.context.shape,n=i();t&&!t.labelTarget&&(O(t,`bpmn:Lane`)&&n.addLane(t),O(t,`bpmn:FlowNode`)&&n.addFlowNode(t))})}wd.$inject=[`eventBus`,`modeling`],z(wd,B);function Td(){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}}var Ed=500,Dd=5e3,Od=[`connection.create`,`connection.delete`,`connection.layout`,`connection.move`,`connection.reconnect`,`connection.updateWaypoints`,`shape.create`,`shape.delete`,`shape.move`,`shape.resize`],kd=[...Od,`elements.create`,`elements.delete`,`elements.move`,`label.create`,`spaceTool`];function Ad(e,t){B.call(this,e);var n;function r(){return n||=new jd,n.enter(),n}function i(){if(!n)throw Error(`out of bounds release`);return n}function a(){if(!n)throw Error(`out of bounds release`);var e=n.leave();return e&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),e}this.preExecute(kd,Dd,function(){r()}),this.postExecuted(kd,Ed,function(){a()}),this.preExecute(Od,function(e){var t=e.context.connection||e.context.shape,n=i();t&&!t.labelTarget&&(O(t,`bpmn:FlowElement`)&&n.addFlowElement(t),O(t,`bpmn:Group`)&&n.addGroup(t))}),this.preExecute(`label.create`,function(e){var t=e.context.labelTarget;O(t,`bpmn:Group`)&&i().addGroup(t)})}Ad.$inject=[`eventBus`,`modeling`],z(Ad,B);function jd(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Md(e,t){B.call(this,e),this.postExecuted(`elements.create`,function(e){let n=e.context.elements;for(let e of n)Nd(e)&&!Fd(e)&&t.updateProperties(e,{isForCompensation:void 0})})}z(Md,B),Md.$inject=[`eventBus`,`modeling`];function Nd(e){let t=k(e);return t&&t.isForCompensation}function Pd(e){return e&&O(e,`bpmn:BoundaryEvent`)&&Ne(e,`bpmn:CompensateEventDefinition`)}function Fd(e){return e.incoming.filter(e=>Pd(e.source)).length>0}var Id={__init__:`adaptiveLabelPositioningBehavior.appendBehavior.artifactBehavior.associationBehavior.attachEventBehavior.boundaryEventBehavior.categoryRootElementReferenceBehavior.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.updateCategoryValueRefsBehavior.unsetDefaultFlowBehavior.setCompensationActivityAfterPasteBehavior`.split(`.`),adaptiveLabelPositioningBehavior:[`type`,Vs],appendBehavior:[`type`,qs],associationBehavior:[`type`,Xs],attachEventBehavior:[`type`,Qs],artifactBehavior:[`type`,Ys],boundaryEventBehavior:[`type`,tc],categoryRootElementReferenceBehavior:[`type`,lc],compensateBoundaryEventBehaviour:[`type`,dc],createBehavior:[`type`,hc],createDataObjectBehavior:[`type`,gc],createParticipantBehavior:[`type`,bc],dataInputAssociationBehavior:[`type`,Tc],dataStoreBehavior:[`type`,Oc],deleteLaneBehavior:[`type`,Qc],detachEventBehavior:[`type`,el],dropOnFlowBehavior:[`type`,il],eventBasedGatewayBehavior:[`type`,sl],fixHoverBehavior:[`type`,dl],groupBehavior:[`type`,pl],importDockingFix:[`type`,hl],isHorizontalFix:[`type`,_l],labelBehavior:[`type`,Zl],layoutConnectionBehavior:[`type`,eu],messageFlowBehavior:[`type`,uu],nonInterruptingBehavior:[`type`,gu],removeElementBehavior:[`type`,vu],removeEmbeddedLabelBoundsBehavior:[`type`,_u],removeParticipantBehavior:[`type`,xu],replaceConnectionBehavior:[`type`,Su],replaceElementBehaviour:[`type`,Cu],resizeBehavior:[`type`,Mu],resizeLaneBehavior:[`type`,Uu],rootElementReferenceBehavior:[`type`,Gu],spaceToolBehavior:[`type`,Ju],subProcessPlaneBehavior:[`type`,od],subProcessStartEventBehavior:[`type`,ud],textAnnotationBehavior:[`type`,fd],toggleCollapseConnectionBehaviour:[`type`,pd],toggleElementCollapseBehaviour:[`type`,hd],unclaimIdBehavior:[`type`,_d],unsetDefaultFlowBehavior:[`type`,vd],updateFlowNodeRefsBehavior:[`type`,wd],updateCategoryValueRefsBehavior:[`type`,Ad],setCompensationActivityAfterPasteBehavior:[`type`,Md]};function Ld(e,t){var n=xe(e,t,-15);return n===`intersect`?null:n}function Rd(e){oa.call(this,e)}z(Rd,oa),Rd.$inject=[`eventBus`],Rd.prototype.init=function(){this.addRule(`connection.start`,function(e){var t=e.source;return zd(t)}),this.addRule(`connection.create`,function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return af(t,n)}finally{i&&(n.parent=null)}}),this.addRule(`connection.reconnect`,function(e){var t=e.connection,n=e.source,r=e.target;return af(n,r,t)}),this.addRule(`connection.updateWaypoints`,function(e){return{type:e.connection.type}}),this.addRule(`shape.resize`,function(e){var t=e.shape,n=e.newBounds,r=e.direction;return yf(t,n,r)}),this.addRule(`elements.create`,function(e){var t=e.elements,n=e.position,r=e.target;return A(r)&&!Ef(t,r,n)?!1:_(t,function(e){return A(e)?af(e.source,e.target,e):e.host?hf(e,e.host,null,n):vf(e,r,null,n)})}),this.addRule(`elements.move`,function(e){var t=e.target,n=e.shapes,r=e.position;return e.hints?.keyboardMove&&n.some(function(e){return cf(e)&&!n.includes(e.host)})?!1:hf(n,t,null,r)||gf(n,t,r)||_f(n,t,r)||Ef(n,t,r)}),this.addRule(`shape.create`,function(e){return vf(e.shape,e.target,e.source,e.position)}),this.addRule(`shape.attach`,function(e){return hf(e.shape,e.target,null,e.position)}),this.addRule(`element.copy`,function(e){var t=e.element,n=e.elements;return Of(n,t)})},Rd.prototype.canConnectMessageFlow=Cf,Rd.prototype.canConnectSequenceFlow=wf,Rd.prototype.canConnectDataAssociation=Tf,Rd.prototype.canConnectAssociation=xf,Rd.prototype.canConnectCompensationAssociation=Sf,Rd.prototype.canMove=_f,Rd.prototype.canAttach=hf,Rd.prototype.canReplace=gf,Rd.prototype.canDrop=of,Rd.prototype.canInsert=Ef,Rd.prototype.canCreate=vf,Rd.prototype.canConnect=af,Rd.prototype.canResize=yf,Rd.prototype.canCopy=Of;function zd(e){return Bd(e)?null:E(e,[`bpmn:FlowNode`,`bpmn:InteractionNode`,`bpmn:DataObjectReference`,`bpmn:DataStoreReference`,`bpmn:Group`,`bpmn:TextAnnotation`])}function Bd(e){return!e||j(e)}function Vd(e){do{if(O(e,`bpmn:Process`))return k(e);if(O(e,`bpmn:Participant`))return k(e).processRef||k(e)}while(e=e.parent)}function Hd(e){return O(e,`bpmn:TextAnnotation`)}function Ud(e){return O(e,`bpmn:Group`)&&!e.labelTarget}function Wd(e){return O(e,`bpmn:BoundaryEvent`)&&Zd(e,`bpmn:CompensateEventDefinition`)}function Gd(e){return k(e).isForCompensation}function Kd(e,t){return Vd(e)===Vd(t)}function qd(e){return O(e,`bpmn:InteractionNode`)&&!O(e,`bpmn:BoundaryEvent`)&&(!O(e,`bpmn:Event`)||O(e,`bpmn:ThrowEvent`)&&Qd(e,`bpmn:MessageEventDefinition`))}function Jd(e){return O(e,`bpmn:InteractionNode`)&&!Gd(e)&&(!O(e,`bpmn:Event`)||O(e,`bpmn:CatchEvent`)&&Qd(e,`bpmn:MessageEventDefinition`))&&!(O(e,`bpmn:BoundaryEvent`)&&!Zd(e,`bpmn:MessageEventDefinition`))}function Yd(e){for(var t=e;t=t.parent;){if(O(t,`bpmn:FlowElementsContainer`))return k(t);if(O(t,`bpmn:Participant`))return k(t).processRef}return null}function Xd(e,t){return Yd(e)===Yd(t)}function Zd(e,t){var n=k(e);return!!C(n.eventDefinitions||[],function(e){return O(e,t)})}function Qd(e,t){return(k(e).eventDefinitions||[]).every(function(e){return O(e,t)})}function $d(e){return O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:EndEvent`)&&!Me(e)&&!(O(e,`bpmn:IntermediateThrowEvent`)&&Zd(e,`bpmn:LinkEventDefinition`))&&!Wd(e)&&!Gd(e)}function ef(e){return O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:StartEvent`)&&!O(e,`bpmn:BoundaryEvent`)&&!Me(e)&&!(O(e,`bpmn:IntermediateCatchEvent`)&&Zd(e,`bpmn:LinkEventDefinition`))&&!Gd(e)}function tf(e){return O(e,`bpmn:ReceiveTask`)||O(e,`bpmn:IntermediateCatchEvent`)&&(Zd(e,`bpmn:MessageEventDefinition`)||Zd(e,`bpmn:TimerEventDefinition`)||Zd(e,`bpmn:ConditionalEventDefinition`)||Zd(e,`bpmn:SignalEventDefinition`))}function nf(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function rf(e,t){return nf(t).indexOf(e)!==-1}function af(e,t,n){if(Bd(e)||Bd(t))return null;if(!O(n,`bpmn:DataAssociation`)){if(Cf(e,t))return{type:`bpmn:MessageFlow`};if(wf(e,t))return{type:`bpmn:SequenceFlow`}}return Tf(e,t)||(Sf(e,t)?{type:`bpmn:Association`,associationDirection:`One`}:xf(e,t)?{type:`bpmn:Association`,associationDirection:`None`}:!1)}function of(e,t){return j(e)||Ud(e)?!0:O(t,`bpmn:Participant`)&&!R(t)?!1:O(e,`bpmn:Participant`)?O(t,`bpmn:Process`)||O(t,`bpmn:Collaboration`):E(e,[`bpmn:DataInput`,`bpmn:DataOutput`])&&e.parent?t===e.parent:O(e,`bpmn:Lane`)?O(t,`bpmn:Participant`)||O(t,`bpmn:Lane`):O(e,`bpmn:BoundaryEvent`)&&!sf(e)?!1:O(e,`bpmn:FlowElement`)&&!O(e,`bpmn:DataStoreReference`)?O(t,`bpmn:FlowElementsContainer`)?R(t):E(t,[`bpmn:Participant`,`bpmn:Lane`]):O(e,`bpmn:DataStoreReference`)&&O(t,`bpmn:Collaboration`)?o(k(t).get(`participants`),function(e){return!!e.get(`processRef`)}):E(e,[`bpmn:Artifact`,`bpmn:DataAssociation`,`bpmn:DataStoreReference`])?E(t,[`bpmn:Collaboration`,`bpmn:Lane`,`bpmn:Participant`,`bpmn:Process`,`bpmn:SubProcess`]):O(e,`bpmn:MessageFlow`)?O(t,`bpmn:Collaboration`)||e.source.parent==t||e.target.parent==t:!1}function sf(e){return k(e).cancelActivity&&(df(e)||ff(e))}function cf(e){return!j(e)&&O(e,`bpmn:BoundaryEvent`)}function lf(e){return O(e,`bpmn:Lane`)}function uf(e){return cf(e)||O(e,`bpmn:IntermediateThrowEvent`)&&df(e)?!0:O(e,`bpmn:IntermediateCatchEvent`)&&ff(e)}function df(e){var t=k(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ff(e){return pf(e,[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:SignalEventDefinition`,`bpmn:ConditionalEventDefinition`])}function pf(e,t){return t.some(function(t){return Zd(e,t)})}function mf(e){return O(e,`bpmn:ReceiveTask`)&&C(e.incoming,function(e){return O(e.source,`bpmn:EventBasedGateway`)})}function hf(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return j(i)||!uf(i)||Me(t)||!O(t,`bpmn:Activity`)||Gd(t)||r&&!Ld(r,t)||mf(t)?!1:`attach`}function gf(e,t,n){if(!t)return!1;var r={replacements:[]};return b(e,function(e){Me(t)||O(e,`bpmn:StartEvent`)&&e.type!==`label`&&of(e,t)&&(Ae(e)||r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`}),(Ge(e)||Le(e)||je(e))&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`}),pf(e,[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:SignalEventDefinition`,`bpmn:ConditionalEventDefinition`])&&O(t,`bpmn:SubProcess`)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`})),O(t,`bpmn:Transaction`)||Zd(e,`bpmn:CancelEventDefinition`)&&e.type!==`label`&&(O(e,`bpmn:EndEvent`)&&of(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:EndEvent`}),O(e,`bpmn:BoundaryEvent`)&&hf(e,t,null,n)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:BoundaryEvent`}))}),r.replacements.length?r:!1}function _f(e,t){return o(e,lf)?!1:t===void 0||t!==null&&e.every(function(e){return of(e,t)})}function vf(e,t,n,r){return t?j(e)||Ud(e)?!0:of(e,t,r)||Ef(e,t,r):!1}function yf(e,t,n){return O(e,`bpmn:SubProcess`)?R(e)&&(!t||t.width>=100&&t.height>=80):O(e,`bpmn:Lane`)||O(e,`bpmn:Participant`)?!0:Hd(e)?!n||n===`e`||n===`w`:Ud(e)?!0:j(e)?!n||n===`e`||n===`w`:!1}function bf(e,t){var n=Hd(e),r=Hd(t);return(n||r)&&n!==r}function xf(e,t){return rf(t,e)||rf(e,t)?!1:bf(e,t)?!0:!!Tf(e,t)}function Sf(e,t){return Xd(e,t)&&Wd(e)&&O(t,`bpmn:Activity`)&&!Mf(t,e)&&!Me(t)}function Cf(e,t){return jf(e)&&!jf(t)?!1:qd(e)&&Jd(t)&&!Kd(e,t)}function wf(e,t){return $d(e)&&ef(t)&&Xd(e,t)&&!(O(e,`bpmn:EventBasedGateway`)&&!tf(t))}function Tf(e,t){return E(e,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`])&&E(t,[`bpmn:Activity`,`bpmn:ThrowEvent`])?{type:`bpmn:DataInputAssociation`}:E(t,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`])&&E(e,[`bpmn:Activity`,`bpmn:CatchEvent`])?{type:`bpmn:DataOutputAssociation`}:!1}function Ef(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:E(t,[`bpmn:SequenceFlow`,`bpmn:MessageFlow`])&&!j(t)&&O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:BoundaryEvent`)&&of(e,t.parent,n)}function Df(e,t){return e&&t&&e.indexOf(t)!==-1}function Of(e,t){return j(t)?!0:!(O(t,`bpmn:Lane`)&&!Df(e,t.parent)||O(t,`bpmn:MessageFlow`)&&!kf(e,t))}function kf(e,t){var n=Af(t.source),r=Af(t.target);return Df(e,n)&&Df(e,r)}function Af(e){for(;e;e=e.parent)if(O(e,`bpmn:Participant`))return e;return null}function jf(e){return Ye(e,`bpmn:Process`)||Ye(e,`bpmn:Collaboration`)}function Mf(e,t){return e.attachers.includes(t)}var Nf={__depends__:[eo],__init__:[`bpmnRules`],bpmnRules:[`type`,Rd]},Pf=2e3;function Ff(e,t){e.on(`saveXML.start`,Pf,n);function n(){var e=t.getRootElements();b(e,function(e){var t=D(e),n=et([e],!1),r;n=u(n,function(t){return t!==e&&!t.labelTarget}),r=ae(n,D),t.set(`planeElement`,r)})}}Ff.$inject=[`eventBus`,`canvas`];var If={__init__:[`bpmnDiOrdering`],bpmnDiOrdering:[`type`,Ff]};function Lf(e){B.call(this,e);var t=this;this.preExecute([`shape.create`,`connection.create`],function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,a=t.getOrdering(r,i);a&&(a.parent!==void 0&&(n.parent=a.parent),n.parentIndex=a.index)}),this.preExecute([`shape.move`,`connection.move`],function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,a=t.getOrdering(r,i);a&&(a.parent!==void 0&&(n.newParent=a.parent),n.newParentIndex=a.index)})}Lf.prototype.getOrdering=function(e,t){return null},z(Lf,B);function Rf(e,t){Lf.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 r(e){if(e.labelTarget)return{level:10};var t=C(n,function(t){return E(e,[t.type])});return t&&t.order||{level:1}}function i(e){var t=e.order;if(t||(e.order=t=r(e)),!t)throw Error(`no order for <${e.id}>`);return t}function a(e,t,n){for(var r=t;r&&!E(r,n);)r=r.parent;if(!r)throw Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}this.getOrdering=function(e,n){if(e.labelTarget||O(e,`bpmn:TextAnnotation`))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=a(e,n,r.containers));var o=n.children.indexOf(e),s=te(n.children,function(t){return!e.labelTarget&&t.labelTarget?!1:r.level<i(t).level});return s!==-1&&o!==-1&&o<s&&--s,{index:s,parent:n}}}Rf.$inject=[`eventBus`,`canvas`],z(Rf,Lf);var zf={__init__:[`bpmnOrderingProvider`],bpmnOrderingProvider:[`type`,Rf]};function Bf(){}Bf.prototype.get=function(){return this._data},Bf.prototype.set=function(e){this._data=e},Bf.prototype.clear=function(){var e=this._data;return delete this._data,e},Bf.prototype.isEmpty=function(){return!this._data};var Vf={clipboard:[`type`,Bf]},Hf=`drop-ok`,Uf=`drop-not-ok`,Wf=`attach-ok`,Gf=`new-parent`,Kf=`create`,qf=2e3;function Jf(e,t,n,r,i){function a(e,t,n,r,a){if(!t)return!1;e=u(e,function(t){var n=t.labelTarget;return!t.parent&&!(j(t)&&e.indexOf(n)!==-1)});var o=C(e,function(e){return!A(e)}),s=!1,c=!1,l=!1;Xf(e)&&(s=i.allowed(`shape.attach`,{position:n,shape:o,target:t})),s||(l=Xf(e)?i.allowed(`shape.create`,{position:n,shape:o,source:r,target:t}):i.allowed(`elements.create`,{elements:e,position:n,target:t}));var d=a.connectionTarget;return l||s?(o&&r&&(c=i.allowed(`connection.create`,{source:d===r?o:r,target:d===r?r:o,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:c}):l===null||s===null?null:!1}function o(t,n){[Wf,Hf,Uf,Gf].forEach(function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)})}n.on([`create.move`,`create.hover`],function(e){var t=e.context,n=t.elements,r=e.hover,i=t.source,s=t.hints||{};if(!r)t.canExecute=!1,t.target=null;else{Yf(e);var c={x:e.x,y:e.y},l=t.canExecute=r&&a(n,r,c,i,s);r&&l!==null&&(t.target=r,l&&l.attach?o(r,Wf):o(r,l?Gf:Uf))}}),n.on([`create.end`,`create.out`,`create.cleanup`],function(e){var t=e.hover;t&&o(t,null)}),n.on(`create.end`,function(e){var t=e.context,n=t.source,i=t.shape,a=t.elements,o=t.target,s=t.canExecute,c=s&&s.attach,l=s&&s.connect,u=t.hints||{};if(s===!1||!o)return!1;Yf(e);var d={x:e.x,y:e.y};l?i=r.appendShape(n,i,d,o,{attach:c,connection:l===!0?{}:l,connectionTarget:u.connectionTarget}):(a=r.createElements(a,d,o,T({},u,{attach:c})),i=C(a,function(e){return!A(e)})),T(t,{elements:a,shape:i}),T(e,{elements:a,shape:i})});function s(){var e=t.context();e&&e.prefix===Kf&&t.cancel()}n.on(`create.init`,function(){n.on(`elements.changed`,s),n.once([`create.cancel`,`create.end`],qf,function(){n.off(`elements.changed`,s)})}),this.start=function(e,n,r){m(n)||(n=[n]);var i=C(n,function(e){return!A(e)});if(i){r=T({elements:n,hints:{},shape:i},r||{}),b(n,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var a=u(n,function(e){return!e.hidden}),o=it(a);b(n,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}})),T(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})}),t.init(e,Kf,{cursor:`grabbing`,autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}Jf.$inject=[`canvas`,`dragging`,`eventBus`,`modeling`,`rules`];function Yf(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 Xf(e){return e&&e.length===1&&!A(e[0])}var Zf=750;function Qf(e,t,n,r,i){function a(e){var t=F(`g`);P(t,i.cls(`djs-drag-group`,[`no-events`]));var a=F(`g`);return e.forEach(function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer(`connection`,a),n.drawConnection(mt(i),e)):(i=n._createContainer(`shape`,a),n.drawShape(mt(i),e),Bt(i,e.x,e.y)),r.addDragger(e,t,i))}),t}t.on(`create.move`,Zf,function(t){var n=t.hover,r=t.context,i=r.elements,o=r.dragGroup;o||=r.dragGroup=a(i);var s;n?(o.parentNode||(s=e.getActiveLayer(),L(s,o)),Bt(o,t.x,t.y)):ke(o)}),t.on(`create.cleanup`,function(e){var t=e.context.dragGroup;t&&ke(t)})}Qf.$inject=[`canvas`,`eventBus`,`graphicsFactory`,`previewSupport`,`styles`];var $f={__depends__:[Ya,Ps,eo,It],__init__:[`create`,`createPreview`],create:[`type`,Jf],createPreview:[`type`,Qf]};function ep(e){var t=this;this._lastMoveEvent=null;function n(e){t._lastMoveEvent=e}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)})}ep.$inject=[`eventBus`],ep.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||tp(0,0)};function tp(e,t){var n=document.createEvent(`MouseEvent`),r=e,i=t,a=e,o=t;return n.initMouseEvent&&n.initMouseEvent(`mousemove`,!0,!0,window,0,r,i,a,o,!1,!1,!1,!1,0,null),n}var np={__init__:[`mouse`],mouse:[`type`,ep]},rp=2e3;function ip(e,t,n,r,i,a,o,s){this._canvas=e,this._create=t,this._elementFactory=r,this._eventBus=i,this._modeling=a,this._mouse=o,this._rules=s,i.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element,r=e.elementsSet;t.priority=1,t.id=n.id,r.has(n.parent)&&(t.parent=n.parent.id),ap(n)&&(t.priority=2,t.host=n.host.id),A(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=op(n)),j(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),b([`x`,`y`,`width`,`height`],function(e){h(n[e])&&(t[e]=n[e])}),t.hidden=n.hidden,t.collapsed=n.collapsed}),i.on(`copyPaste.elementsCopied`,rp,function(e){e.hints?.clip!==!1&&n.set(e.tree)}),i.on(`copyPaste.pasteElements`,rp,function(e){e.tree||=n.get()}),i.on(`copyPaste.pasteElements`,function(e){var t=e.hints;T(t,{createElementsBehavior:!1})})}ip.$inject=[`canvas`,`create`,`clipboard`,`elementFactory`,`eventBus`,`modeling`,`mouse`,`rules`],ip.prototype.copy=function(e,t={}){var n,r;return m(e)||(e=e?[e]:[]),n=this._eventBus.fire(`copyPaste.canCopyElements`,{elements:e}),r=n===!1?{}:this.createTree(m(n)?n:e),this._eventBus.fire(`copyPaste.elementsCopied`,{elements:e,tree:r,hints:t}),r},ip.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:`copyPaste.pasteElements`,hints:{},...e});if(this._eventBus.fire(t)!==!1){var n=t.tree;if(n){var r=t.hints,i=this._createElements(n);if(t.element&&t.point)return this._paste(i,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:r})}}},ip.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ip.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),r=e.filter(function(e){return n[e.id]});return r.length>0&&this._modeling.removeElements(r),t},ip.prototype._getElementIdsFromTree=function(e){var t={};return b(e,function(e){b(e,function(e){e.id&&(t[e.id]=!0)})}),t},ip.prototype._paste=function(e,t,n,r){b(e,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var i=it(e);return b(e,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}})),T(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,T({},r))},ip.prototype._createElements=function(e){var t=this,r=this._eventBus,i={},a=[];return b(e,function(e,o){o=parseInt(o,10),e=y(e,`priority`),b(e,function(e){var o=T({},n(e,[`priority`]));i[e.parent]?o.parent=i[e.parent]:delete o.parent,r.fire(`copyPaste.pasteElement`,{cache:i,descriptor:o});var s;A(o)?(o.source=i[e.source],o.target=i[e.target],s=i[e.id]=t.createConnection(o),a.push(s)):j(o)?(o.labelTarget=i[o.labelTarget],s=i[e.id]=t.createLabel(o),a.push(s)):(o.host&&=i[o.host],s=i[e.id]=t.createShape(o),a.push(s))})}),a},ip.prototype.createConnection=function(e){return this._elementFactory.createConnection(n(e,[`id`]))},ip.prototype.createLabel=function(e){return this._elementFactory.createLabel(n(e,[`id`]))},ip.prototype.createShape=function(e){return this._elementFactory.createShape(n(e,[`id`]))},ip.prototype.hasRelations=function(e,t,n){return n||=new Set(t),!(A(e)&&(!n.has(e.source)||!n.has(e.target))||j(e)&&!n.has(e.labelTarget))},ip.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],a=new Map,o=Ot(e);function s(e,n){return t.allowed(`element.copy`,{element:e,elements:n})}function c(e,t){var n=a.get(e);if(!n){var r={element:e,depth:t};i.push(r),a.set(e,r)}else if(n.depth<t){i=l(n,i);var o={element:n.element,depth:t};i.push(o),a.set(e,o)}}function l(e,t){var n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}ht(o,function(e,t,r){if(j(e))return;b(e.labels,function(e){c(e,r)});function i(e){e&&e.length&&b(e,function(e){b(e.labels,function(e){c(e,r)}),c(e,r)})}b([e.attachers,e.incoming,e.outgoing],i),c(e,r);var a=[];return e.children&&(a=e.children.slice()),n._eventBus.fire(`copyPaste.createTree`,{element:e,children:a}),a}),e=ae(i,function(e){return e.element});var u=new Set(e);return i=ae(i,function(t){return t.descriptor={},n._eventBus.fire(`copyPaste.copyElement`,{descriptor:t.descriptor,element:t.element,elements:e,elementsSet:u}),t}),i=y(i,function(e){return e.descriptor.priority}),e=ae(i,function(e){return e.element}),b(i,function(t){var i=t.depth;n.hasRelations(t.element,e,u)&&s(t.element,e)?(r[i]||(r[i]=[]),r[i].push(t.descriptor)):(cp(t.element,e),u.delete(t.element))}),r};function ap(e){return!!e.host}function op(e){return ae(e.waypoints,function(e){return e=sp(e),e.original&&(e.original=sp(e.original)),e})}function sp(e){return T({},e)}function cp(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}var lp={__depends__:[Vf,$f,np,eo],__init__:[`copyPaste`],copyPaste:[`type`,ip]};function up(e,t,n){m(n)||(n=[n]),b(n,function(n){oe(e[n])||(t[n]=e[n])})}var dp=750;function fp(e,t,r){function i(t,n){var i=e.create(t.$type);return r.copyElement(t,i,null,n)}t.on(`copyPaste.copyElement`,dp,function(e){var t=e.descriptor,n=e.element,r=k(n);if(j(n))return t;var a=t.businessObject=i(r,!0),o=t.di=i(D(n),!0);o.bpmnElement=a,up(a,t,`name`),up(o,t,`isExpanded`),r.default&&(t.default=r.default.id)});var a=`-bpmn-js-refs`;function o(e){return e[a]=e[a]||{}}function s(e,t){e[a]=t}function l(e,t,r){var i=k(e);return e.default&&(r[e.default]={element:i,property:`default`}),e.host&&(k(e).attachedToRef=k(t[e.host])),n(r,c(r,function(t,n,r){var a=n.element,o=n.property;return r===e.id&&(a.set(o,i),t.push(e.id)),t},[]))}t.on(`copyPaste.pasteElement`,function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,a=n.di;j(n)?(n.businessObject=k(t[n.labelTarget]),n.di=D(t[n.labelTarget])):(r=n.businessObject=i(r),a=n.di=i(a),a.bpmnElement=r,up(n,r,[`isExpanded`,`name`]),n.type=r.$type)}),t.on(`copyPaste.copyElement`,dp,function(e){var t=e.descriptor,n=e.element;if(O(n,`bpmn:Participant`)){var r=k(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.createTree`,function(e){var t=e.element,n=e.children;O(t,`bpmn:SubProcess`)&&b(wt(n),e=>{n.push(e.annotation)})}),t.on(`copyPaste.pasteElement`,dp,function(e){var t=e.cache,n=e.descriptor;s(t,l(n,t,o(t)))})}fp.$inject=[`bpmnFactory`,`eventBus`,`moddleCopy`];var pp=[`artifacts`,`dataInputAssociations`,`dataOutputAssociations`,`default`,`flowElements`,`lanes`,`incoming`,`outgoing`,`categoryValue`],mp=[`errorRef`,`escalationRef`,`messageRef`,`signalRef`,`dataObjectRef`];function hp(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on(`moddleCopy.canCopyProperties`,e=>{let{propertyNames:t}=e;if(t&&t.length)return y(t,e=>e===`extensionElements`)}),e.on(`moddleCopy.canCopyProperty`,e=>{let{parent:t,property:n,propertyName:r}=e,i=l(t)&&t.$descriptor;if(r&&mp.includes(r))return n;if(r&&pp.includes(r)||r&&i&&!C(i.properties,s({name:r})))return!1}),e.on(`moddleCopy.canSetCopiedProperty`,e=>{let{property:t}=e;if(O(t,`bpmn:ExtensionElements`)&&(!t.values||!t.values.length))return!1})}hp.$inject=[`eventBus`,`bpmnFactory`,`moddle`],hp.prototype.copyElement=function(e,t,n,r=!1){n&&!m(n)&&(n=[n]),n||=gp(e.$descriptor);let i=this._eventBus.fire(`moddleCopy.canCopyProperties`,{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return i===!1||(m(i)&&(n=i),b(n,n=>{let i;p(e,n)&&(i=e.get(n));let a=this.copyProperty(i,t,n,r);w(a)&&this._eventBus.fire(`moddleCopy.canSetCopiedProperty`,{parent:t,property:a,propertyName:n})!==!1&&t.set(n,a)})),t},hp.prototype.copyProperty=function(e,t,n,r=!1){let i=this._eventBus.fire(`moddleCopy.canCopyProperty`,{parent:t,property:e,propertyName:n,clone:r});if(i===!1)return;if(i)return l(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;let a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference)return a.isId?e&&this._copyId(e,t,r):m(e)?c(e,(e,i)=>{let a=this.copyProperty(i,t,n,r);return a?e.concat(a):e},[]):l(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(i=this._bpmnFactory.create(e.$type),i.$parent=t,i=this.copyElement(e,i,null,r),i):e},hp.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function gp(e,t){return c(e.properties,(e,n)=>t&&n.default?e:e.concat(n.name),[])}var _p={__depends__:[lp],__init__:[`bpmnCopyPaste`,`moddleCopy`],bpmnCopyPaste:[`type`,fp],moddleCopy:[`type`,hp]},vp=Math.round;function yp(e,t){this._modeling=e,this._eventBus=t}yp.$inject=[`modeling`,`eventBus`],yp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire(`replace.start`,{element:e,attrs:t,hints:n});var a=t.width||e.width,o=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vp(s+a/2),u=vp(c+o/2),d=r.replaceShape(e,T({},t,{x:l,y:u,width:a,height:o}),n);return i.fire(`replace.end`,{element:e,newElement:d,hints:n}),d};function bp(e,t){t.on(`replace.end`,500,function(t){let{newElement:n,hints:r={}}=t;r.select!==!1&&e.select(n)})}bp.$inject=[`selection`,`eventBus`];var xp={__init__:[`replace`,`replaceSelectionBehavior`],replaceSelectionBehavior:[`type`,bp],replace:[`type`,yp]};function Sp(e,t,n){m(n)||(n=[n]),b(n,function(n){oe(e[n])||(t[n]=e[n])})}var Cp=[`cancelActivity`,`instantiate`,`eventGatewayType`,`triggeredByEvent`,`isInterrupting`];function wp(e,t){var n=e&&p(e,`collapsed`)?e.collapsed:!R(e);return n!==(t&&(p(t,`collapsed`)||p(t,`isExpanded`))?p(t,`collapsed`)?t.collapsed:!t.isExpanded:n)}function Tp(e,t,n,r,i,a){function o(o,s,c){c||={};var l=s.type,d=o.businessObject;if(Ep(d)&&(l===`bpmn:SubProcess`||l===`bpmn:AdHocSubProcess`)&&wp(o,s))return r.toggleCollapse(o),o;var f=e.create(l),m={type:l,businessObject:f};m.di={},l===`bpmn:ExclusiveGateway`&&(m.di.isMarkerVisible=!0),Sp(o.di,m.di,[`fill`,`stroke`,`background-color`,`border-color`,`color`]);var h=Op(gp(d.$descriptor),gp(f.$descriptor,!0));T(f,ie(s,Cp));var g=u(h,function(e){return e===`eventDefinitions`?Dp(o,s.eventDefinitionType):e===`loopCharacteristics`?!Me(f):p(f,e)||e===`processRef`&&s.isExpanded===!1||e===`triggeredByEvent`?!1:e!==`isForCompensation`||!Me(f)});if(f=n.copyElement(d,f,g),s.eventDefinitionType&&(Dp(f,s.eventDefinitionType)||(m.eventDefinitionType=s.eventDefinitionType,m.eventDefinitionAttrs=s.eventDefinitionAttrs)),O(d,`bpmn:Activity`)){if(Ep(d))m.isExpanded=R(o);else if(s&&p(s,`isExpanded`)){m.isExpanded=s.isExpanded;var _=t.getDefaultSize(f,{isExpanded:m.isExpanded});m.width=_.width,m.height=_.height,m.x=o.x-(m.width-o.width)/2,m.y=o.y-(m.height-o.height)/2}R(o)&&!O(d,`bpmn:Task`)&&m.isExpanded&&(m.width=o.width,m.height=o.height)}if(Ep(d)&&!Ep(f)&&(c.moveChildren=!1),O(d,`bpmn:Participant`)){s.isExpanded===!0?f.processRef=e.create(`bpmn:Process`):c.moveChildren=!1;var v=He(o);D(o).isHorizontal||(D(m).isHorizontal=v),m.width=v?o.width:t.getDefaultSize(m).width,m.height=v?t.getDefaultSize(m).height:o.height}return a.allowed(`shape.resize`,{shape:f})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),f.name=d.name,E(d,[`bpmn:ExclusiveGateway`,`bpmn:InclusiveGateway`,`bpmn:Activity`])&&E(f,[`bpmn:ExclusiveGateway`,`bpmn:InclusiveGateway`,`bpmn:Activity`])&&(f.default=d.default),s.host&&!O(d,`bpmn:BoundaryEvent`)&&O(f,`bpmn:BoundaryEvent`)&&(m.host=s.host),(m.type===`bpmn:DataStoreReference`||m.type===`bpmn:DataObjectReference`)&&(m.x=o.x+(o.width-m.width)/2),i.replaceElement(o,m,{...c,targetElement:s})}this.replaceElement=o}Tp.$inject=[`bpmnFactory`,`elementFactory`,`moddleCopy`,`modeling`,`replace`,`rules`];function Ep(e){return O(e,`bpmn:SubProcess`)}function Dp(e,t){var n=k(e);return t&&n.get(`eventDefinitions`).some(function(e){return O(e,t)})}function Op(e,t){return e.filter(function(e){return t.includes(e)})}var kp={__depends__:[_p,xp,It],bpmnReplace:[`type`,Tp]},Ap=250;function jp(e){this._eventBus=e,this._tools=[],this._active=null}jp.$inject=[`eventBus`],jp.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jp.prototype.isActive=function(e){return e&&this._active===e},jp.prototype.length=function(e){return this._tools.length},jp.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire(`tool-manager.update`,{tool:e}))},jp.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+`.init`,function(t){!t.context.reactivate&&this.isActive(e)?this.setActive(null):this.setActive(e)},this),b(t,function(e){r.push(e+`.ended`),r.push(e+`.canceled`)}),n.on(r,Ap,function(e){this._active&&(Mp(e)||this.setActive(null))},this)};function Mp(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ct(t,`.group[data-group="tools"]`)}var Np={__depends__:[Ya],__init__:[`toolManager`],toolManager:[`type`,jp]};function Pp(e,t){if(e===`x`){if(t>0)return`e`;if(t<0)return`w`}if(e===`y`){if(t>0)return`s`;if(t<0)return`n`}return null}function Fp(e,t){var n=[],r=new Set(e);b(t,function(e){r.add(e)});var i=new Set;return r.forEach(function(e){var t=e.incoming,a=e.outgoing;b(t.concat(a),function(e){var t=e.source,a=e.target;(r.has(t)||r.has(a))&&(i.has(e)||(i.add(e),n.push(e)))})}),n}function Ip(e,t,n){var r=e.x,i=e.y,a=e.width,o=e.height,s=n.x,c=n.y;switch(t){case`n`:return{x:r,y:i+c,width:a,height:o-c};case`s`:return{x:r,y:i,width:a,height:o+c};case`w`:return{x:r+s,y:i,width:a-s,height:o};case`e`:return{x:r,y:i,width:a+s,height:o};default:throw Error(`unknown direction: `+t)}}var Lp=Math.abs,Rp=Math.round,zp={x:`width`,y:`height`},Bp=`crosshair`,Vp={n:`top`,w:`left`,s:`bottom`,e:`right`},Hp=1500,Up={n:`s`,w:`e`,s:`n`,e:`w`},Wp=20;function Gp(e,t,n,r,i,a,o){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=a,this._mouse=o;var s=this;a.registerTool(`space`,{tool:`spaceTool.selection`,dragging:`spaceTool`}),n.on(`spaceTool.selection.end`,function(e){n.once(`spaceTool.selection.ended`,function(){s.activateMakeSpace(e.originalEvent)})}),n.on(`spaceTool.move`,Hp,function(e){var t=e.context,n=t.initialized;n||=t.initialized=s.init(e,t),n&&qp(e)}),n.on(`spaceTool.end`,function(e){var t=e.context,r=t.axis,i=t.direction,a=t.movingShapes,o=t.resizingShapes,c=t.start;if(t.initialized){qp(e);var l={x:0,y:0};l[r]=Rp(e[`d`+r]),s.makeSpace(a,o,l,i,c),n.once(`spaceTool.ended`,function(e){s.activateSelection(e.originalEvent,!0,!0)})}})}Gp.$inject=[`canvas`,`dragging`,`eventBus`,`modeling`,`rules`,`toolManager`,`mouse`],Gp.prototype.activateSelection=function(e,t,n){this._dragging.init(e,`spaceTool.selection`,{autoActivate:t,cursor:Bp,data:{context:{reactivate:n}},trapClick:!1})},Gp.prototype.activateMakeSpace=function(e){this._dragging.init(e,`spaceTool`,{autoActivate:!0,cursor:Bp,data:{context:{}}})},Gp.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Gp.prototype.init=function(e,t){var n=Lp(e.dx)>Lp(e.dy)?`x`:`y`,r=e[`d`+n],i=e[n]-r;if(Lp(r)<5)return!1;r<0&&(r*=-1),Pt(e)&&(r*=-1);var a=Pp(n,r),o=this._canvas.getRootElement();!Et(e)&&e.hover&&(o=e.hover);var s=[...et(o),...o.attachers||[]],c=this.calculateAdjustments(s,n,r,i),l=Jp(c,n,a,i,this._eventBus.fire(`spaceTool.getMinDimensions`,{axis:n,direction:a,shapes:c.resizingShapes,start:i}));return T(t,c,{axis:n,direction:a,spaceToolConstraints:l,start:i}),hn(`resize-`+(n===`x`?`ew`:`ns`)),!0},Gp.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,a=[],o=[],s=new Set,c=new Set,l=[],u=[];function d(e){s.has(e)||(s.add(e),a.push(e));var t=e.label;t&&!s.has(t)&&(s.add(t),a.push(t))}function f(e){c.has(e)||(c.add(e),o.push(e))}return b(e,function(e){if(e.parent&&!j(e)){if(A(e))u.push(e);else{var a=e[t],o=a+e[zp[t]];Yp(e)&&(n>0&&M(e)[t]>r||n<0&&M(e)[t]<r)?l.push(e):n>0&&a>r||n<0&&o<r?d(e):a<r&&o>r&&i.allowed(`shape.resize`,{shape:e})&&f(e)}}}),b(a,function(e){var t=e.attachers;t&&b(t,function(e){d(e)})}),b(l,function(e){var t=e.host;(s.has(t)||c.has(t))&&d(e)}),b(u,function(e){var t=e.source,n=e.target,r=e.label;(s.has(t)||c.has(t))&&(s.has(n)||c.has(n))&&r&&d(r)}),{movingShapes:a,resizingShapes:o}},Gp.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gp.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Kp(e){return{top:e.top-Wp,right:e.right+Wp,bottom:e.bottom+Wp,left:e.left-Wp}}function qp(e){var t=e.context.spaceToolConstraints;if(t){var n,r;h(t.left)&&(n=Math.max(e.x,t.left),e.dx=e.dx+n-e.x,e.x=n),h(t.right)&&(n=Math.min(e.x,t.right),e.dx=e.dx+n-e.x,e.x=n),h(t.top)&&(r=Math.max(e.y,t.top),e.dy=e.dy+r-e.y,e.y=r),h(t.bottom)&&(r=Math.min(e.y,t.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function Jp(e,t,n,r,i){var a=e.movingShapes,o=e.resizingShapes;if(o.length){var s={},c,l,d=new Set(a),f=new Set(o);return b(o,function(e){var a=e.attachers,o=e.children,p=N(e),m=u(o,function(e){return!A(e)&&!j(e)&&!d.has(e)&&!f.has(e)}),g=u(o,function(e){return!A(e)&&!j(e)&&d.has(e)}),_,v,y,b=[],x=[],S,C,w,ee;m.length&&(v=Kp(N(it(m))),_=r-p[Vp[n]]+v[Vp[n]],n===`n`?s.bottom=l=h(l)?Math.min(l,_):_:n===`w`?s.right=l=h(l)?Math.min(l,_):_:n===`s`?s.top=c=h(c)?Math.max(c,_):_:n===`e`&&(s.left=c=h(c)?Math.max(c,_):_)),g.length&&(y=Kp(N(it(g))),_=r-y[Vp[Up[n]]]+p[Vp[Up[n]]],n===`n`?s.bottom=l=h(l)?Math.min(l,_):_:n===`w`?s.right=l=h(l)?Math.min(l,_):_:n===`s`?s.top=c=h(c)?Math.max(c,_):_:n===`e`&&(s.left=c=h(c)?Math.max(c,_):_)),a&&a.length&&(a.forEach(function(e){d.has(e)?b.push(e):x.push(e)}),b.length&&(S=N(it(b.map(M))),C=p[Vp[Up[n]]]-(S[Vp[Up[n]]]-r)),x.length&&(w=N(it(x.map(M))),ee=w[Vp[n]]-(p[Vp[n]]-r)),n===`n`?(_=Math.min(C||1/0,ee||1/0),s.bottom=l=h(l)?Math.min(l,_):_):n===`w`?(_=Math.min(C||1/0,ee||1/0),s.right=l=h(l)?Math.min(l,_):_):n===`s`?(_=Math.max(C||-1/0,ee||-1/0),s.top=c=h(c)?Math.max(c,_):_):n===`e`&&(_=Math.max(C||-1/0,ee||-1/0),s.left=c=h(c)?Math.max(c,_):_));var te=i&&i[e.id];te&&(n===`n`?(_=r+e[zp[t]]-te[zp[t]],s.bottom=l=h(l)?Math.min(l,_):_):n===`w`?(_=r+e[zp[t]]-te[zp[t]],s.right=l=h(l)?Math.min(l,_):_):n===`s`?(_=r-e[zp[t]]+te[zp[t]],s.top=c=h(c)?Math.max(c,_):_):n===`e`&&(_=r-e[zp[t]]+te[zp[t]],s.left=c=h(c)?Math.max(c,_):_))}),s}}function Yp(e){return!!e.host}var Xp=`djs-dragging`,Zp=`djs-resizing`,Qp=250,$p=Math.max;function em(e,t,n,r,i){function a(e,t){b(e,function(e){i.addDragger(e,t),n.addMarker(e,Xp)})}e.on(`spaceTool.selection.start`,function(e){var t=n.getLayer(`space`),i=e.context,a={x:`M 0,-10000 L 0,10000`,y:`M -10000,0 L 10000,0`},o=F(`g`);P(o,r.cls(`djs-crosshair-group`,[`no-events`])),L(t,o);var s=F(`path`);P(s,`d`,a.x),I(s).add(`djs-crosshair`),L(o,s);var c=F(`path`);P(c,`d`,a.y),I(c).add(`djs-crosshair`),L(o,c),i.crosshairGroup=o}),e.on(`spaceTool.selection.move`,function(e){var t=e.context.crosshairGroup;Bt(t,e.x,e.y)}),e.on(`spaceTool.selection.cleanup`,function(e){var t=e.context.crosshairGroup;t&&ke(t)}),e.on(`spaceTool.move`,Qp,function(e){var t=e.context,o=t.line,s=t.axis,c=t.movingShapes,l=t.resizingShapes;if(t.initialized){if(!t.dragGroup){var u=n.getLayer(`space`);o=F(`path`),P(o,`d`,`M0,0 L0,0`),I(o).add(`djs-crosshair`),L(u,o),t.line=o;var d=F(`g`);P(d,r.cls(`djs-drag-group`,[`no-events`])),L(n.getActiveLayer(),d),a(c,d);var f=new Set(c);b(l,function(e){f.add(e)});var p=new Set,m=t.movingConnections=[];f.forEach(function(e){b(e.outgoing,function(e){!p.has(e)&&A(e)&&f.has(e.target)&&(p.add(e),m.push(e))})}),a(m,d),t.dragGroup=d}if(!t.frameGroup){var h=F(`g`);P(h,r.cls(`djs-frame-group`,[`no-events`])),L(n.getActiveLayer(),h);var g=[];b(l,function(e){var t=i.addFrame(e,h),r=t.getBBox();g.push({element:t,initialBounds:r}),n.addMarker(e,Zp)}),t.frameGroup=h,t.frames=g}var _={x:`M`+e.x+`, -10000 L`+e.x+`, 10000`,y:`M -10000, `+e.y+` L 10000, `+e.y};P(o,{d:_[s]});var v={x:`y`,y:`x`},y={x:e.dx,y:e.dy};y[v[t.axis]]=0,Bt(t.dragGroup,y.x,y.y),b(t.frames,function(e){var n=e.element,r=e.initialBounds,i,a;t.direction===`e`?P(n,{width:$p(r.width+y.x,5)}):(i=$p(r.width-y.x,5),P(n,{width:i,x:r.x+r.width-i})),t.direction===`s`?P(n,{height:$p(r.height+y.y,5)}):(a=$p(r.height-y.y,5),P(n,{height:a,y:r.y+r.height-a}))})}}),e.on(`spaceTool.cleanup`,function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,a=t.resizingShapes,o=t.line,s=t.dragGroup,c=t.frameGroup;b(r,function(e){n.removeMarker(e,Xp)}),b(i,function(e){n.removeMarker(e,Xp)}),s&&(ke(o),ke(s)),b(a,function(e){n.removeMarker(e,Zp)}),c&&ke(c)})}em.$inject=[`eventBus`,`elementRegistry`,`canvas`,`styles`,`previewSupport`];var tm={__init__:[`spaceToolPreview`],__depends__:[Ya,eo,Np,Ps,np],spaceTool:[`type`,Gp],spaceToolPreview:[`type`,em]};function nm(e,t){e.invoke(Gp,this),this._canvas=t}nm.$inject=[`injector`,`canvas`],z(nm,Gp),nm.prototype.calculateAdjustments=function(e,t,n,r){var a=this._canvas.getRootElement(),o=e[0]===a?null:e[0],s=[];o&&(s=i(dt(a.children.filter(e=>O(e,`bpmn:Artifact`)),it(o))));let c=[...e,...s];var l=Gp.prototype.calculateAdjustments.call(this,c,t,n,r);return l.resizingShapes=l.resizingShapes.filter(function(e){return!(O(e,`bpmn:TextAnnotation`)||rm(e)&&(t===`y`&&He(e)||t===`x`&&!He(e)))}),l};function rm(e){return O(e,`bpmn:Participant`)&&!k(e).processRef}var im={__depends__:[tm],spaceTool:[`type`,nm]};function Y(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)}Y.$inject=[`eventBus`,`injector`],Y.prototype.execute=function(e,t){if(!e)throw Error(`command required`);this._currentExecution.trigger=`execute`;let n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Y.prototype.canExecute=function(e,t){let n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,`canExecute`,n);if(i===void 0){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},Y.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire(`changed`,{trigger:`clear`})},Y.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger=`undo`,this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),t&&t.id===e.id);)e=t;this._popAction()}},Y.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger=`redo`,this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),t&&t.id===e.id);)e=t;this._popAction()}},Y.prototype.register=function(e,t){this._setHandler(e,t)},Y.prototype.registerHandler=function(e,t){if(!e||!t)throw Error(`command and handlerCls must be defined`);let n=this._injector.instantiate(t);this.register(e,n)},Y.prototype.canUndo=function(){return!!this._getUndoAction()},Y.prototype.canRedo=function(){return!!this._getRedoAction()},Y.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Y.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Y.prototype._internalUndo=function(e){let t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo(()=>{this._fire(t,`revert`,e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,`reverted`,e)})},Y.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);let r=t?[e+`.`+t,t]:[e],i;n=this._eventBus.createEvent(n);for(let e of r)if(i=this._eventBus.fire(`commandStack.`+e,n),n.cancelBubble)break;return i},Y.prototype._createId=function(){return this._uid++},Y.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Y.prototype._internalExecute=function(e,t){let n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw Error(`no command handler registered for <`+n+`>`);this._pushAction(e),t||(this._fire(n,`preExecute`,e),i.preExecute&&i.preExecute(r),this._fire(n,`preExecuted`,e)),this._atomicDo(()=>{this._fire(n,`execute`,e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,`executed`,e)}),t||(this._fire(n,`postExecute`,e),i.postExecute&&i.postExecute(r),this._fire(n,`postExecuted`,e)),this._popAction()},Y.prototype._pushAction=function(e){let t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw Error(`illegal invocation in <execute> or <revert> phase (action: `+e.command+`)`);e.id||=r&&r.id||this._createId(),n.push(e)},Y.prototype._popAction=function(){let e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire(`elements.changed`,{elements:v(`id`,r.reverse())}),r.length=0,this._fire(`changed`,{trigger:t}),e.trigger=null)},Y.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=m(e)?e:[e],t.dirty=t.dirty.concat(e))},Y.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Y.prototype._revertedAction=function(e){this._stackIdx--},Y.prototype._getHandler=function(e){return this._handlerMap[e]},Y.prototype._setHandler=function(e,t){if(!e||!t)throw Error(`command and handler required`);if(this._handlerMap[e])throw Error(`overriding handler for command <`+e+`>`);this._handlerMap[e]=t};var am={commandStack:[`type`,Y]};function om(e,t){if(typeof t!=`function`)throw Error(`removeFn iterator must be a function`);if(!e)return[];for(var n;n=e[0];)t(n);return e}var sm=250,cm=1400;function lm(e,t,n){B.call(this,t);var r=e.get(`movePreview`,!1);t.on(`shape.move.start`,cm,function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=um(n),t.validatedShapes=um(r)}),r&&t.on(`shape.move.start`,sm,function(e){var t=e.context,n=new Set(t.shapes),i=new Set;for(let e of n)for(let t of e.labels)!t.hidden&&!n.has(t)&&i.add(t),e.labelTarget&&i.add(e);for(let e of i)r.makeDraggable(t,e,!0)}),this.preExecuted(`elements.move`,cm,function(e){var t=e.context.closure,n=t.enclosedElements,r=[];b(n,function(e){b(e.labels,function(e){n[e.id]||r.push(e)})}),t.addAll(r)}),this.preExecute([`connection.delete`,`shape.delete`],function(e){var t=e.context;om((t.connection||t.shape).labels,function(e){n.removeShape(e,{nested:!0})})}),this.execute(`shape.delete`,function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=Pe(r.labels,n),t.labelTarget=r,n.labelTarget=null)}),this.revert(`shape.delete`,function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Ve(r.labels,n,i),n.labelTarget=r)})}z(lm,B),lm.$inject=[`injector`,`eventBus`,`modeling`];function um(e){var t=new Set(e);return u(e,function(e){return!t.has(e.labelTarget)})}var dm={__init__:[`labelSupport`],labelSupport:[`type`,lm]},fm=251,pm=1401,mm=`attach-ok`;function hm(e,t,n,r,i){B.call(this,t);var a=e.get(`movePreview`,!1);t.on(`shape.move.start`,pm,function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=_m(n),t.validatedShapes=vm(r)}),a&&t.on(`shape.move.start`,fm,function(e){var t=e.context,n=t.shapes,r=gm(n);b(r,function(e){a.makeDraggable(t,e,!0),b(e.labels,function(e){a.makeDraggable(t,e,!0)})})}),a&&t.on(`shape.move.start`,function(e){var r=e.context.shapes;if(r.length===1){var i=r[0].host;i&&(n.addMarker(i,mm),t.once([`shape.move.out`,`shape.move.cleanup`],function(){n.removeMarker(i,mm)}))}}),this.preExecuted(`elements.move`,pm,function(e){var t=e.context,n=t.closure,r=t.shapes,i=gm(r);b(i,function(e){n.add(e,n.topLevel[e.host.id])})}),this.postExecuted(`elements.move`,function(e){var t=e.context,n=t.shapes,r=t.newHost,a;r&&n.length!==1||(a=r?n:u(n,function(e){var t=e.host;return ym(e)&&!bm(n,t)}),b(a,function(e){i.updateAttachment(e,r)}))}),this.postExecuted(`elements.move`,function(e){var t=e.context.shapes;b(t,function(e){b(e.attachers,function(e){b(e.outgoing.slice(),function(e){r.allowed(`connection.reconnect`,{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),b(e.incoming.slice(),function(e){r.allowed(`connection.reconnect`,{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute(`shape.replace`,function(e){var t=e.context,n=t.oldShape,a=t.newShape;om(n.attachers,function(e){r.allowed(`elements.move`,{target:a,shapes:[e]})===`attach`?i.updateAttachment(e,a):i.removeShape(e)}),a.attachers.length&&b(a.attachers,function(e){var t=zl(e,n,a);i.moveShape(e,t,e.parent)})}),this.postExecute(`shape.resize`,function(e){var t=e.context,n=t.shape,r=t.oldBounds,a=t.newBounds,o=n.attachers;(t.hints||{}).attachSupport!==!1&&b(o,function(e){var t=zl(e,r,a);i.moveShape(e,t,e.parent),b(e.labels,function(e){i.moveShape(e,t,e.parent)})})}),this.preExecute(`shape.delete`,function(e){var t=e.context.shape;om(t.attachers,function(e){i.removeShape(e)}),t.host&&i.updateAttachment(t,null)})}z(hm,B),hm.$inject=[`injector`,`eventBus`,`canvas`,`rules`,`modeling`];function gm(e){return f(ae(e,function(e){return e.attachers||[]}))}function _m(e){var n=gm(e);return t(`id`,e,n)}function vm(e){var t=ne(e,`id`);return u(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}function ym(e){return!!e.host}function bm(e,t){return e.indexOf(t)!==-1}var xm={__depends__:[eo],__init__:[`attachSupport`],attachSupport:[`type`,hm]};function Sm(e){this._model=e}Sm.$inject=[`moddle`],Sm.prototype._needsId=function(e){return E(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`])},Sm.prototype._ensureId=function(e){if(e.id)this._model.ids.claim(e.id,e);else{var t=O(e,`bpmn:Activity`)?`Activity`:O(e,`bpmn:Event`)?`Event`:O(e,`bpmn:Gateway`)?`Gateway`:E(e,[`bpmn:SequenceFlow`,`bpmn:MessageFlow`])?`Flow`:(e.$type||``).replace(/^[^:]*:/g,``);t+=`_`,!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))}},Sm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Sm.prototype.createDiLabel=function(){return this.create(`bpmndi:BPMNLabel`,{bounds:this.createDiBounds()})},Sm.prototype.createDiShape=function(e,t){return this.create(`bpmndi:BPMNShape`,T({bpmnElement:e,bounds:this.createDiBounds()},t))},Sm.prototype.createDiBounds=function(e){return this.create(`dc:Bounds`,e)},Sm.prototype.createDiWaypoints=function(e){var t=this;return ae(e,function(e){return t.createDiWaypoint(e)})},Sm.prototype.createDiWaypoint=function(e){return this.create(`dc:Point`,ie(e,[`x`,`y`]))},Sm.prototype.createDiEdge=function(e,t){return this.create(`bpmndi:BPMNEdge`,T({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Sm.prototype.createDiPlane=function(e,t){return this.create(`bpmndi:BPMNPlane`,T({bpmnElement:e},t))};var Cm={width:100,height:80},wm={width:100,height:80},Tm={width:50,height:50},Em={width:36,height:36},Dm={width:350,height:200},Om={width:100,height:80},km={width:600,height:250},Am={width:250,height:600},jm={width:400,height:60},Mm={width:60,height:400},Nm={width:400,height:100},Pm={width:36,height:50},Fm={width:50,height:50},Im={width:100,height:40},Lm={width:300,height:300};function Rm(e,t){let n=k(e);if(t||=D(e),O(n,`bpmn:SubProcess`))return R(n,t)?{...Dm}:{...Om};if(O(n,`bpmn:Task`))return{...wm};if(O(n,`bpmn:Gateway`))return{...Tm};if(O(n,`bpmn:Event`))return{...Em};if(O(n,`bpmn:Participant`)){let e=!t||t.isHorizontal===void 0||t.isHorizontal===!0;return R(n,t)?e?{...km}:{...Am}:e?{...jm}:{...Mm}}return O(n,`bpmn:Lane`)?{...Nm}:O(n,`bpmn:DataObjectReference`)?{...Pm}:O(n,`bpmn:DataStoreReference`)?{...Fm}:O(n,`bpmn:TextAnnotation`)?{...Im}:O(n,`bpmn:Group`)?{...Lm}:{...Cm}}function zm(e,t){nt.call(this),this._bpmnFactory=e,this._moddle=t}z(zm,nt),zm.$inject=[`bpmnFactory`,`moddle`],zm.prototype._baseCreate=nt.prototype.create,zm.prototype.create=function(e,t){if(e===`label`){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,T({type:`label`,di:n},me,t))}return this.createElement(e,t)},zm.prototype.createElement=function(e,t){t=T({},t||{});var n,r=t.businessObject,i=t.di;if(!r){if(!t.type)throw Error(`no shape type specified`);r=this._bpmnFactory.create(t.type)}if(!Hm(i)){var a=T({},i||{},{id:r.id+`_di`});i=e===`root`?this._bpmnFactory.createDiPlane(r,a):e===`connection`?this._bpmnFactory.createDiEdge(r,a):this._bpmnFactory.createDiShape(r,a)}O(r,`bpmn:Group`)&&(t=T({isFrame:!0},t)),t=Bm(r,t,[`processRef`,`isInterrupting`,`associationDirection`,`isForCompensation`]),t.isExpanded&&(t=Vm(i,t,`isExpanded`)),E(r,[`bpmn:Lane`,`bpmn:Participant`])&&(t=Vm(i,t,`isHorizontal`)),O(r,`bpmn:SubProcess`)&&(t.collapsed=!R(r,i)),O(r,`bpmn:ExclusiveGateway`)&&(p(i,`isMarkerVisible`)?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),w(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),w(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var o,s;return t.eventDefinitionType&&(o=r.get(`eventDefinitions`)||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType===`bpmn:ConditionalEventDefinition`&&(s.condition=this._bpmnFactory.create(`bpmn:FormalExpression`)),o.push(s),s.$parent=r,r.eventDefinitions=o,delete t.eventDefinitionType),n=this.getDefaultSize(r,i),t=T({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)},zm.prototype.getDefaultSize=function(e,t){return Rm(e,t)},zm.prototype.createParticipantShape=function(e){return l(e)||(e={isExpanded:e}),e=T({type:`bpmn:Participant`},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create(`bpmn:Process`)),this.createShape(e)};function Bm(e,t,n){return b(n,function(n){t=Vm(e,t,n)}),t}function Vm(e,t,r){return t[r]===void 0?t:(e[r]=t[r],n(t,[r]))}function Hm(e){return E(e,[`bpmndi:BPMNShape`,`bpmndi:BPMNEdge`,`bpmndi:BPMNDiagram`,`bpmndi:BPMNPlane`])}function Um(e,t){this._modeling=e,this._canvas=t}Um.$inject=[`modeling`,`canvas`],Um.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;b(n,function(e){var n={x:0,y:0};w(r.left)?n.x=r.left-e.x:w(r.right)?n.x=r.right-e.width-e.x:w(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:w(r.top)?n.y=r.top-e.y:w(r.bottom)?n.y=r.bottom-e.height-e.y:w(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},Um.prototype.postExecute=function(e){};function Wm(e){this._modeling=e}Wm.$inject=[`modeling`],Wm.prototype.preExecute=function(e){var t=e.source;if(!t)throw Error(`source required`);var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},Wm.prototype.postExecute=function(e){var t=e.hints||{};Gm(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function Gm(e,t){return o(e.outgoing,function(e){return e.target===t})}function Km(e,t){this._canvas=e,this._layouter=t}Km.$inject=[`canvas`,`layouter`],Km.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,a=e.parentIndex,o=e.hints;if(!n||!r)throw Error(`source and target required`);if(!i)throw Error(`parent required`);return t.source=n,t.target=r,t.waypoints||=this._layouter.layoutConnection(t,o),this._canvas.addConnection(t,i,a),t},Km.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var qm=Math.round;function Jm(e){this._modeling=e}Jm.$inject=[`modeling`],Jm.prototype.preExecute=function(e){var t=e.elements,r=e.parent,a=e.parentIndex,o=e.position,s=e.hints,c=this._modeling;b(t,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var l=u(t,function(e){return!e.hidden}),d=it(l);b(t,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:qm(e.x-d.x-d.width/2+o.x),y:qm(e.y-d.y-d.height/2+o.y)}})),T(e,{x:qm(e.x-d.x-d.width/2+o.x),y:qm(e.y-d.y-d.height/2+o.y)})});var f=new Set(Ot(t)),p={};b(t,function(e){if(A(e))p[e.id]=h(a)?c.createConnection(p[e.source.id],p[e.target.id],a,e,e.parent||r,s):c.createConnection(p[e.source.id],p[e.target.id],e,e.parent||r,s);else{var t=T({},s);f.has(e)||(t.autoResize=!1),j(e)&&(t=n(t,[`attach`])),p[e.id]=h(a)?c.createShape(e,ie(e,[`x`,`y`,`width`,`height`]),e.parent||r,a,t):c.createShape(e,ie(e,[`x`,`y`,`width`,`height`]),e.parent||r,t)}}),e.elements=i(p)};var Ym=Math.round;function Xm(e){this._canvas=e}Xm.$inject=[`canvas`],Xm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw Error(`parent required`);if(!n)throw Error(`position required`);return n.width===void 0?T(t,{x:n.x-Ym(t.width/2),y:n.y-Ym(t.height/2)}):T(t,n),this._canvas.addShape(t,r,i),t},Xm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Zm(e){Xm.call(this,e)}z(Zm,Xm),Zm.$inject=[`canvas`];var Qm=Xm.prototype.execute;Zm.prototype.execute=function(e){var t=e.shape;return eh(t),t.labelTarget=e.labelTarget,Qm.call(this,e)};var $m=Xm.prototype.revert;Zm.prototype.revert=function(e){return e.shape.labelTarget=null,$m.call(this,e)};function eh(e){[`width`,`height`].forEach(function(t){e[t]===void 0&&(e[t]=0)})}function th(e,t){this._canvas=e,this._modeling=t}th.$inject=[`canvas`,`modeling`],th.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;om(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),om(n.outgoing,function(e){t.removeConnection(e,{nested:!0})})},th.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pe(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},th.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ve(n.children,t,r),this._canvas.addConnection(t,n),t};function nh(e,t){this._modeling=e,this._elementRegistry=t}nh.$inject=[`modeling`,`elementRegistry`],nh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,r=e.elements;b(r,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};function rh(e,t){this._canvas=e,this._modeling=t}rh.$inject=[`canvas`,`modeling`],rh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;om(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),om(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),om(n.children,function(e){A(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},rh.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pe(r.children,n),t.removeShape(n),n},rh.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ve(r.children,n,i),t.addShape(n,r),n};function ih(e){this._modeling=e}ih.$inject=[`modeling`];var ah={x:`y`,y:`x`};ih.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function a(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function o(e){return e[r]+e[i]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}function l(e,n){var i={y:0};i[r]=e-o(n),i[r]&&(i[ah[r]]=0,t.moveElements([n],i,n.parent))}var u=n[0],d=s(n),f=n[d],p,m,h=0;b(n,function(e,t){var u,f,p;e.elements.length<2?t&&t!==n.length-1&&(a(e,e.elements[0]),h+=c(e.range)):(u=y(e.elements,r),f=u[0],t===d&&(f=u[s(u)]),p=o(f),e.range=null,b(u,function(t){l(p,t),e.range===null?e.range={min:t[r],max:t[r]+t[i]}:a(e,t)}),t&&t!==n.length-1&&(h+=c(e.range)))}),m=Math.abs(f.range.min-u.range.max),p=Math.round((m-h)/(n.length-1)),!(p<n.length-1)&&b(n,function(e,a){var o={},s;e!==u&&e!==f&&(s=n[a-1],e.range.max=0,b(e.elements,function(n,a){o[ah[r]]=0,o[r]=s.range.max-n[r]+p,e.range.min!==n[r]&&(o[r]+=n[r]-e.range.min),o[r]&&t.moveElements([n],o,n.parent),e.range.max=Math.max(n[r]+n[i],a?e.range.max:0)}))})},ih.prototype.postExecute=function(e){};function oh(e,t){this._layouter=e,this._canvas=t}oh.$inject=[`layouter`,`canvas`],oh.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return T(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},oh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function sh(){}sh.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,a=t.parent;return e.oldParent=a,e.oldParentIndex=Fe(a.children,t),Ve(r.children,t,i),t.parent=r,b(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},sh.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,a=e.delta;return Fe(n.children,t),Ve(r.children,t,i),t.parent=r,b(t.waypoints,function(e){e.x-=a.x,e.y-=a.y,e.original&&(e.original.x-=a.x,e.original.y-=a.y)}),t};function ch(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}ch.prototype.add=function(e,t){return this.addAll([e],t)},ch.prototype.addAll=function(e,t){var n=rt(e,!!t,this);return T(this,n),this};function lh(e){this._modeling=e}lh.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lh.prototype.moveClosure=function(e,t,n,r,i){var a=this._modeling,o=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),b(o,function(e){a.moveShape(e,t,l[e.id]&&!u&&n,{recurse:!1,layout:!1})}),b(s,function(e){var r=!!o[e.source.id],i=!!o[e.target.id];c[e.id]&&r&&i?a.moveConnection(e,t,l[e.id]&&!u&&n):a.layoutConnection(e,{connectionStart:r&&ru(e,e.source,t),connectionEnd:i&&iu(e,e.target,t)})})},lh.prototype.getClosure=function(e){return new ch().addAll(e,!0)};function uh(e){this._helper=new lh(e)}uh.$inject=[`modeling`],uh.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},uh.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function dh(e){this._modeling=e,this._helper=new lh(e)}dh.$inject=[`modeling`],dh.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,a=t.parent;return e.oldBounds=ie(t,[`x`,`y`,`width`,`height`]),e.oldParent=a,e.oldParentIndex=Fe(a.children,t),Ve(r.children,t,i),T(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},dh.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;r.layout!==!1&&(b(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:iu(e,t,n)})}),b(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:ru(e,t,n)})})),r.recurse!==!1&&this.moveChildren(e)},dh.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ve(n.children,t,r),T(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},dh.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},dh.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function fh(e){this._modeling=e}fh.$inject=[`modeling`],fh.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw Error(`newSource or newTarget required`);return m(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},fh.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,a=e.hints||{},o={};a.connectionStart&&(o.connectionStart=a.connectionStart),a.connectionEnd&&(o.connectionEnd=a.connectionEnd),a.layoutConnection!==!1&&(n&&(!r||a.docking===`source`)&&(o.connectionStart=o.connectionStart||ph(m(i)?i[0]:i)),r&&(!n||a.docking===`target`)&&(o.connectionEnd=o.connectionEnd||ph(m(i)?i[i.length-1]:i)),a.newWaypoints&&(o.waypoints=a.newWaypoints),this._modeling.layoutConnection(t,o))},fh.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i};function ph(e){return e.original||e}function mh(e,t){this._modeling=e,this._rules=t}mh.$inject=[`modeling`,`rules`],mh.prototype.preExecute=function(e){var t=this,n=this._modeling,r=this._rules,i=e.oldShape,a=e.newData,o=e.hints||{},s;function c(e,t,n){return r.allowed(`connection.reconnect`,{connection:n,source:e,target:t})}var l={x:a.x,y:a.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(a,l,i.parent,o),i.host&&n.updateAttachment(s,i.host);var d;o.moveChildren!==!1&&(d=i.children.slice(),n.moveElements(d,{x:0,y:0},s,o));var f=i.incoming.slice(),p=i.outgoing.slice();b(f,function(e){var n=e.source;c(n,s,e)&&t.reconnectEnd(e,s,nu(e,s,u),o)}),b(p,function(e){var n=e.target;c(s,n,e)&&t.reconnectStart(e,s,tu(e,s,u),o)})},mh.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},mh.prototype.execute=function(e){},mh.prototype.revert=function(e){},mh.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},mh.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},mh.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)};function hh(e){this._modeling=e}hh.$inject=[`modeling`],hh.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw Error(`newBounds must have {x, y, width, height} properties`);if(r&&(n.width<r.width||n.height<r.height))throw Error(`width and height cannot be less than minimum height and width`);if(!r&&n.width<10||n.height<10)throw Error(`width and height cannot be less than 10px`);return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},T(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},hh.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;(e.hints||{}).layout!==!1&&(b(n.incoming,function(e){t.layoutConnection(e,{connectionEnd:nu(e,n,r)})}),b(n.outgoing,function(e){t.layoutConnection(e,{connectionStart:tu(e,n,r)})}))},hh.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return T(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function gh(e){this._modeling=e}gh.$inject=[`modeling`],gh.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,a=e.start,o={};this.moveShapes(r,t),b(i,function(e){o[e.id]=xh(e)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Fp(r,i),t,n,a,r,i,o)},gh.prototype.execute=function(){},gh.prototype.revert=function(){},gh.prototype.moveShapes=function(e,t){var n=this;b(e,function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})})},gh.prototype.resizeShapes=function(e,t,n){var r=this;b(e,function(e){var i=Ip(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})})},gh.prototype.updateConnectionWaypoints=function(e,t,n,r,i,a,o){var s=this,c=new Set(i),l=new Set(a);b(e,function(e){var i=e.source,a=e.target,u=vh(e),d=yh(n),f={},p=c.has(i)||l.has(i),m=c.has(a)||l.has(a);p&&m?(u=ae(u,function(e){return bh(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&bh(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e}),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(p||m)&&(c.has(i)?f.connectionStart=ru(e,i,t):c.has(a)?f.connectionEnd=iu(e,a,t):l.has(i)?f.connectionStart=tu(e,i,o[i.id]):l.has(a)&&(f.connectionEnd=nu(e,a,o[a.id])),s._modeling.layoutConnection(e,f))})};function _h(e){return T({},e)}function vh(e){return ae(e.waypoints,function(e){return e=_h(e),e.original&&(e.original=_h(e.original)),e})}function yh(e){switch(e){case`n`:return`y`;case`w`:return`x`;case`s`:return`y`;case`e`:return`x`}}function bh(e,t,n){var r=yh(n);if(/e|s/.test(n))return e[r]>t;if(/n|w/.test(n))return e[r]<t}function xh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Sh(e){this._modeling=e}Sh.$inject=[`modeling`],Sh.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ch(n),t.collapsed=!t.collapsed;var r=wh(n,t.collapsed);return[t].concat(r)},Sh.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=t.children,i=Th(r,n);return t.collapsed=!t.collapsed,[t].concat(i)};function Ch(e){var t={};return b(e,function(e){t[e.id]=e.hidden,e.children&&(t=T({},t,Ch(e.children)))}),t}function wh(e,t){var n=[];return b(e,function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(wh(e.children,e.collapsed||t)))}),n}function Th(e,t){var n=[];return b(e,function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Th(e.children,t)))}),n}function Eh(e){this._modeling=e}Eh.$inject=[`modeling`],Eh.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Dh(r,t),Oh(n,t),t.host=n,t},Eh.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Dh(n,t),Oh(r,t,i),t};function Dh(e,t){return Fe(e&&e.attachers,t)}function Oh(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ve(r,t,n)}}function kh(){}kh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function X(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on(`diagram.init`,function(){r.registerHandlers(n)})}X.$inject=[`eventBus`,`elementFactory`,`commandStack`],X.prototype.getHandlers=function(){return{"shape.append":Wm,"shape.create":Xm,"shape.delete":rh,"shape.move":dh,"shape.resize":hh,"shape.replace":mh,"shape.toggleCollapse":Sh,spaceTool:gh,"label.create":Zm,"connection.create":Km,"connection.delete":th,"connection.move":sh,"connection.layout":oh,"connection.updateWaypoints":kh,"connection.reconnect":fh,"elements.create":Jm,"elements.move":uh,"elements.delete":nh,"elements.distribute":ih,"elements.align":Um,"element.updateAttachment":Eh}},X.prototype.registerHandlers=function(e){b(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},X.prototype.moveShape=function(e,t,n,r,i){typeof r==`object`&&(i=r,r=null);var a={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute(`shape.move`,a)},X.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute(`element.updateAttachment`,n)},X.prototype.moveElements=function(e,t,n,r){r||={};var i=r.attach,a=n,o;i===!0?(o=n,a=n.parent):i===!1&&(o=null);var s={shapes:e,delta:t,newParent:a,newHost:o,hints:r};this._commandStack.execute(`elements.move`,s)},X.prototype.moveConnection=function(e,t,n,r,i){typeof r==`object`&&(i=r,r=void 0);var a={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute(`connection.move`,a)},X.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute(`connection.layout`,n)},X.prototype.createConnection=function(e,t,n,r,i,a){typeof n==`object`&&(a=i,i=r,r=n,n=void 0),r=this._create(`connection`,r);var o={source:e,target:t,parent:i,parentIndex:n,connection:r,hints:a};return this._commandStack.execute(`connection.create`,o),o.connection},X.prototype.createShape=function(e,t,n,r,i){typeof r!=`number`&&(i=r,r=void 0),i||={};var a=i.attach,o,s;e=this._create(`shape`,e),a?(o=n.parent,s=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute(`shape.create`,c),c.shape},X.prototype.createElements=function(e,t,n,r,i){m(e)||(e=[e]),typeof r!=`number`&&(i=r,r=void 0),i||={};var a={position:t,elements:e,parent:n,parentIndex:r,hints:i};return this._commandStack.execute(`elements.create`,a),a.elements},X.prototype.createLabel=function(e,t,n,r){n=this._create(`label`,n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute(`label.create`,i),i.shape},X.prototype.appendShape=function(e,t,n,r,i){i||={},t=this._create(`shape`,t);var a={source:e,position:n,target:r,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute(`shape.append`,a),a.shape},X.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute(`elements.delete`,t)},X.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute(`elements.distribute`,r)},X.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute(`shape.delete`,n)},X.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute(`connection.delete`,n)},X.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute(`shape.replace`,r),r.newShape},X.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute(`elements.align`,n)},X.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute(`shape.resize`,i)},X.prototype.createSpace=function(e,t,n,r,i){var a={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute(`spaceTool`,a)},X.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute(`connection.updateWaypoints`,r)},X.prototype.reconnect=function(e,t,n,r,i){var a={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute(`connection.reconnect`,a)},X.prototype.reconnectStart=function(e,t,n,r){r||={},this.reconnect(e,t,e.target,n,T(r,{docking:`source`}))},X.prototype.reconnectEnd=function(e,t,n,r){r||={},this.reconnect(e,e.source,t,n,T(r,{docking:`target`}))},X.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},X.prototype._create=function(e,t){return zt(t)?t:this._elementFactory.create(e,t)},X.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute(`shape.toggleCollapse`,n)};function Ah(e){this._elementRegistry=e}Ah.$inject=[`elementRegistry`],Ah.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw Error(`<moddleElement> required`);var i=e.changed||this._getVisualReferences(n).concat(t),a=e.oldProperties||jh(n,d(r));return Mh(n,r),e.oldProperties=a,e.changed=i,i},Ah.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return Mh(n,t),r},Ah.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return O(e,`bpmn:DataObject`)?Nh(e,t):[]};function jh(e,t){return c(t,function(t,n){return t[n]=e.get(n),t},{})}function Mh(e,t){b(t,function(t,n){e.set(n,t)})}function Nh(e,t){return t.filter(function(t){return O(t,`bpmn:DataObjectReference`)&&k(t).dataObjectRef===e})}var Ph=`default`,Fh=`id`,Ih=`di`,Lh={width:0,height:0};function Rh(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Rh.$inject=[`elementRegistry`,`moddle`,`modeling`,`textRenderer`],Rh.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw Error(`element required`);var r=this._elementRegistry,i=this._moddle.ids,a=t.businessObject,o=Gh(e.properties),s=e.oldProperties||Bh(t,o);return zh(o,a)&&(i.unclaim(a[Fh]),r.updateId(t,o[Fh]),i.claim(o[Fh],a)),Ph in o&&(o[Ph]&&n.push(r.get(o[Ph].id)),a[Ph]&&n.push(r.get(a[Ph].id))),Hh(t,o),e.oldProperties=s,e.changed=n,n},Rh.prototype.postExecute=function(e){var t=e.element.label,n=t&&k(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,Lh)}},Rh.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,a=this._elementRegistry,o=this._moddle.ids;return Hh(t,r),zh(n,i)&&(o.unclaim(n[Fh]),a.updateId(t,r[Fh]),o.claim(r[Fh],i)),e.changed};function zh(e,t){return Fh in e&&e[Fh]!==t[Fh]}function Bh(e,t){var n=d(t),r=e.businessObject,i=D(e);return c(n,function(e,n){return e[n]=n===Ih?Vh(i,d(t.di)):r.get(n),e},{})}function Vh(e,t){return c(t,function(t,n){return t[n]=e&&e.get(n),t},{})}function Hh(e,t){var n=e.businessObject,r=D(e);b(t,function(e,t){t===Ih?r&&Uh(r,e):n.set(t,e)})}function Uh(e,t){b(t,function(t,n){e.set(n,t)})}var Wh=[`default`];function Gh(e){var t=T({},e);return Wh.forEach(function(n){n in e&&(t[n]=k(t[n]))}),t}function Kh(e,t){this._canvas=e,this._modeling=t}Kh.$inject=[`canvas`,`modeling`],Kh.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),a=i.businessObject,o=a.$parent,s=D(i);return t.setRootElement(n),t.removeRootElement(i),Ve(o.rootElements,r),r.$parent=o,Fe(o.rootElements,a),a.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]},Kh.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,a=i.businessObject,o=r.$parent,s=D(n);return t.setRootElement(i),t.removeRootElement(n),Fe(o.rootElements,r),r.$parent=null,Ve(o.rootElements,a),a.$parent=o,n.di=null,s.bpmnElement=a,i.di=s,[]};function qh(e,t){this._modeling=e,this._spaceTool=t}qh.$inject=[`modeling`,`spaceTool`],qh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,a=Yc(r),o=a===r,s=o?r:r.parent,c=Jc(s),l=He(r);if(l?i===`left`?i=`top`:i===`right`&&(i=`bottom`):i===`top`?i=`left`:i===`bottom`&&(i=`right`),!c.length){var d=l?{x:r.x+30,y:r.y,width:r.width-30,height:r.height}:{x:r.x,y:r.y+30,width:r.width,height:r.height-30};n.createShape({type:`bpmn:Lane`,isHorizontal:l},d,s)}var f=[];ht(a,function(e){return f.push(e),e.label&&f.push(e.label),e===r?[]:u(e.children,function(e){return e!==r})});var p,m,h,g,_;i===`top`?(p=-120,m=r.y,h=m+10,g=`n`,_=`y`):i===`left`?(p=-120,m=r.x,h=m+10,g=`w`,_=`x`):i===`bottom`?(p=120,m=r.y+r.height,h=m-10,g=`s`,_=`y`):i===`right`&&(p=120,m=r.x+r.width,h=m-10,g=`e`,_=`x`);var v=t.calculateAdjustments(f,_,p,h),y=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,y,g,h);var b=l?{x:r.x+(o?30:0),y:m-(i===`top`?120:0),width:r.width-(o?30:0),height:120}:{x:m-(i===`left`?120:0),y:r.y+(o?30:0),width:120,height:r.height-(o?30:0)};e.newLane=n.createShape({type:`bpmn:Lane`,isHorizontal:l},b,s)};function Jh(e){this._modeling=e}Jh.$inject=[`modeling`],Jh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Jc(n),a=i.length;if(a>r)throw Error(`more than <${r}> child lanes`);for(var o=He(n),s=o?n.height:n.width,c=Math.round(s/r),l,u,d,f=0;f<r;f++)l=f===r-1?s-c*f:c,u=o?{x:n.x+30,y:n.y+f*c,width:n.width-30,height:l}:{x:n.x+f*c,y:n.y+30,width:l,height:n.height-30},f<a?t.resizeShape(i[f],u):(d={type:`bpmn:Lane`,isHorizontal:o},t.createShape(d,u,n))};function Yh(e,t){this._modeling=e,this._spaceTool=t}Yh.$inject=[`modeling`,`spaceTool`],Yh.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;e.balanced===!1?this.resizeSpace(t,n):this.resizeBalanced(t,n)},Yh.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Xc(e,t);n.resizeShape(e,t),r.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Yh.prototype.resizeSpace=function(e,t){var n=this._spaceTool,r=N(e),i=Pc(N(t),r),a=Yc(e),o=[],s=[];ht(a,function(e){return o.push(e),(O(e,`bpmn:Lane`)||O(e,`bpmn:Participant`))&&s.push(e),e.children});var c,l,u,d,f;(i.bottom||i.top)&&(c=i.bottom||i.top,l=e.y+(i.bottom?e.height:0)+(i.bottom?-10:10),u=i.bottom?`s`:`n`,d=i.top>0||i.bottom<0?-c:c,f=n.calculateAdjustments(o,`y`,d,l),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:c},u)),(i.left||i.right)&&(c=i.right||i.left,l=e.x+(i.right?e.width:0)+(i.right?-10:100),u=i.right?`e`:`w`,d=i.left>0||i.right<0?-c:c,f=n.calculateAdjustments(s,`x`,d,l),n.makeSpace(f.movingShapes,f.resizingShapes,{x:c,y:0},u))};var Xh=`flowNodeRef`,Zh=`lanes`;function Qh(){}Qh.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},a=[];function o(e,t){var n=N(t),r={x:e.x+e.width/2,y:e.y+e.height/2};return r.x>n.left&&r.x<n.right&&r.y>n.top&&r.y<n.bottom}function s(e){n.indexOf(e)===-1&&(a.push(e),n.push(e))}function c(e){var t=Yc(e);return i[t.id]||(i[t.id]=qc(t)),i[t.id]}function l(e){return e.parent?c(e).filter(function(t){return o(e,t)}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=Yc(e);t&&n.indexOf(t)===-1&&(t.children.filter(function(e){return O(e,`bpmn:FlowNode`)}).forEach(s),n.push(t))}),e.forEach(s),a.forEach(function(e){var t=e.businessObject,n=t.get(Zh).slice(),i=l(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get(Xh).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},Qh.prototype.execute=function(e){var t=e.updates;return t||=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes),t.forEach(function(e){var t=e.flowNode,n=t.get(Zh);e.remove.forEach(function(e){Fe(n,e),Fe(e.get(Xh),t)}),e.add.forEach(function(e){Ve(n,e),Ve(e.get(Xh),t)})}),[]},Qh.prototype.revert=function(e){return e.updates.forEach(function(e){var t=e.flowNode,n=t.get(Zh);e.add.forEach(function(e){Fe(n,e),Fe(e.get(Xh),t)}),e.remove.forEach(function(e){Ve(n,e),Ve(e.get(Xh),t)})}),[]};var $h=`categoryValueRef`;function eg(e,t){this._bpmnFactory=e,this._elementRegistry=t}eg.$inject=[`bpmnFactory`,`elementRegistry`],eg.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,r=this._bpmnFactory,i=new Map,a=[],o=new Map;function s(e,t,n){if(t){var r=o.get(e);r||(r={},o.set(e,r)),!(n&&r.present)&&(n||!r.past)&&(n?r.present={categoryValue:t,root:og(e)}:r.past={categoryValue:t})}}function c(e){i.set(e,k(e))}function l(){n.filter(function(e){return O(e,`bpmn:FlowElement`)&&!j(e)&&e.parent}).forEach(c)}function u(e){var t=k(e),n=t.get(`categoryValueRef`);return n||(n=ic(r,t),a.push(tg(e,n))),n}function d(e){return e.reduce(function(e,t){var n=og(t),r=e.get(n);return r||(r=[],e.set(n,r)),r.push(t),e},new Map)}e=Array.from(e||[]);var f=d(e);t.length&&l(),e.forEach(c),n.filter(function(e){return O(e,`bpmn:Group`)&&!j(e)&&e.parent}).forEach(function(e){var t=k(e).get(`categoryValueRef`);if(!t){var n=og(e),r=f.get(n)||[],i=dt(r,e);Object.keys(i).length>0&&(t=u(e))}s(e,t,!0)}),t.forEach(function(e){s(e.groupShape,e.categoryValue,!1)}),a.length&&l();var p=Array.from(i.keys()),m=Array.from(o.values()).reduce(function(e,t){return t.present&&e.add(t.present.categoryValue),t.past&&e.add(t.past.categoryValue),e},new Set),h=new Map,g=d(p);return o.forEach(function(e,t){var n=e.present;if(n){var r=g.get(n.root)||[],i=dt(r,t);r.forEach(function(e){if(i[e.id]){var t=h.get(e);t||(t=new Set,h.set(e,t)),t.add(n.categoryValue)}})}}),{flowElements:p.reduce(function(e,t){var n=i.get(t),r=n.get($h),a=new Set(r),o=h.get(t)||new Set,s=Array.from(o).filter(function(e){return!a.has(e)}),c=r.filter(function(e){return m.has(e)&&!o.has(e)});return(s.length||c.length)&&e.push({businessObject:n,categoryValuesToAdd:s,categoryValuesToRemove:c}),e},[]),groups:a}},eg.prototype.execute=function(e){var t=e.updates;return t||=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries),ng(t.groups),ig(t.flowElements),[]},eg.prototype.revert=function(e){var t=e.updates;return ag(t.flowElements),rg(t.groups),[]};function tg(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function ng(e){e.forEach(function(e){k(e.groupShape).categoryValueRef=e.categoryValue,e.categoryValue.$parent=e.category})}function rg(e){e.forEach(function(e){k(e.groupShape).categoryValueRef=null})}function ig(e){e.forEach(function(e){var t=e.businessObject.get($h);e.categoryValuesToRemove.forEach(function(e){Fe(t,e)}),e.categoryValuesToAdd.forEach(function(e){Ve(t,e,!0)})})}function ag(e){e.forEach(function(e){var t=e.businessObject.get($h);e.categoryValuesToAdd.forEach(function(e){Fe(t,e)}),e.categoryValuesToRemove.forEach(function(e){Ve(t,e,!0)})})}function og(e){for(;e.parent;)e=e.parent;return e}function sg(e){this._moddle=e}sg.$inject=[`moddle`],sg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},sg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var cg={fill:void 0,stroke:void 0};function lg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(re(e)){var t=ug(e);if(t)return t}throw Error(`invalid color value: ${e}`)}}}lg.$inject=[`commandStack`],lg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||cg,r=this,i={};`fill`in n&&T(i,{"background-color":this._normalizeColor(n.fill)}),`stroke`in n&&T(i,{"border-color":this._normalizeColor(n.stroke)}),b(t,function(e){var t=A(e)?ie(i,[`border-color`]):i,n=D(e);if(dg(t),j(e)){if(!n||!O(n.label,`bpmndi:BPMNLabel`))return;r._commandStack.execute(`element.updateModdleProperties`,{element:e,moddleElement:n.label,properties:{color:i[`border-color`]}})}else{if(!E(n,[`bpmndi:BPMNEdge`,`bpmndi:BPMNShape`]))return;r._commandStack.execute(`element.updateProperties`,{element:e,properties:{di:t}})}})};function ug(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}function dg(e){`border-color`in e&&(e.stroke=e[`border-color`]),`background-color`in e&&(e.fill=e[`background-color`])}var fg={width:0,height:0};function pg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return ce(n,t,r!==n),[n,r]}function i(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!j(n)&&pe(n)&&!se(n)&&!mg(i)){var a=7,o=fe(n);o={x:o.x,y:o.y+a},e.createLabel(n,o,{id:r.id+`_label`,businessObject:r,di:n.di})}}function a(e){return e.oldLabel=ue(e.element),r(e.element,e.newLabel)}function o(e){return r(e.element,e.oldLabel)}function s(n){var r=n.element,i=r.label||r,a=n.newLabel,o=n.newBounds,s=n.hints||{};if(j(i)||O(i,`bpmn:TextAnnotation`)){if(j(i)&&mg(a))s.removeShape!==!1&&e.removeShape(i,{unsetLabel:!1});else{var c=ue(r);o===void 0&&(o=t.getExternalLabelBounds(i,c)),o&&e.resizeShape(i,o,fg)}}}this.preExecute=i,this.execute=a,this.revert=o,this.postExecute=s}pg.$inject=[`modeling`,`textRenderer`,`bpmnFactory`];function mg(e){return!e||!e.trim()}function hg(e,t,n,r){X.call(this,e,t,n),this._bpmnRules=r}z(hg,X),hg.$inject=[`eventBus`,`elementFactory`,`commandStack`,`bpmnRules`],hg.prototype.getHandlers=function(){var e=X.prototype.getHandlers.call(this);return e[`element.updateModdleProperties`]=Ah,e[`element.updateProperties`]=Rh,e[`canvas.updateRoot`]=Kh,e[`lane.add`]=qh,e[`lane.resize`]=Yh,e[`lane.split`]=Jh,e[`lane.updateRefs`]=Qh,e[`group.updateRefs`]=eg,e[`id.updateClaim`]=sg,e[`element.setColor`]=lg,e[`element.updateLabel`]=pg,e},hg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute(`element.updateLabel`,{element:e,newLabel:t,newBounds:n,hints:r||{}})},hg.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||=i.canConnect(e,t),n)return this.createConnection(e,t,n,e.parent,r)},hg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute(`element.updateModdleProperties`,{element:e,moddleElement:t,properties:n})},hg.prototype.updateProperties=function(e,t){this._commandStack.execute(`element.updateProperties`,{element:e,properties:t})},hg.prototype.resizeLane=function(e,t,n){this._commandStack.execute(`lane.resize`,{shape:e,newBounds:t,balanced:n})},hg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute(`lane.add`,n),n.newLane},hg.prototype.splitLane=function(e,t){this._commandStack.execute(`lane.split`,{shape:e,count:t})},hg.prototype.makeCollaboration=function(){var e=this._create(`root`,{type:`bpmn:Collaboration`}),t={newRoot:e};return this._commandStack.execute(`canvas.updateRoot`,t),e},hg.prototype.makeProcess=function(){var e=this._create(`root`,{type:`bpmn:Process`}),t={newRoot:e};return this._commandStack.execute(`canvas.updateRoot`,t),e},hg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute(`lane.updateRefs`,{flowNodeShapes:e,laneShapes:t})},hg.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute(`group.updateRefs`,{affectedFlowElements:e,affectedGroupEntries:t})},hg.prototype.claimId=function(e,t){this._commandStack.execute(`id.updateClaim`,{id:e,element:t,claiming:!0})},hg.prototype.unclaimId=function(e,t){this._commandStack.execute(`id.updateClaim`,{id:e,element:t})},hg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute(`element.setColor`,{elements:e,colors:t})};function gg(){}gg.prototype.layoutConnection=function(e,t){return t||={},[t.connectionStart||M(t.source||e.source),t.connectionEnd||M(t.target||e.target)]};var _g=20,vg=5,yg=Math.round,bg=20,xg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Sg(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Cg(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function wg(e,t,n){var r=xe(t,e,vg),i=n.split(`:`)[0],a=yg((t.x-e.x)/2+e.x),o=yg((t.y-e.y)/2+e.y),s,c,l=Cg(i,r),u=/h|r|l/.test(i),d=!1,f=!1;return l?(s=u?{x:a,y:e.y}:{x:e.x,y:o},c=u?`h:h`:`v:v`):(d=Sg(r,i),c=u?`h:v`:`v:h`,d?u?(f=o===e.y,s={x:e.x+_g*(/l/.test(i)?-1:1),y:f?o+_g:o}):(f=a===e.x,s={x:f?a+_g:a,y:e.y+_g*(/t/.test(i)?-1:1)}):s={x:a,y:o}),{waypoints:Ag(e,s,c).concat(s),directions:c,turnNextDirections:f}}function Tg(e,t,n){return wg(e,t,n)}function Eg(e,t,n){var r=wg(t,e,Og(n));return{waypoints:r.waypoints.slice().reverse(),directions:Og(r.directions),turnNextDirections:r.turnNextDirections}}function Dg(e,t){var n=e.directions.split(`:`)[1],r=t.directions.split(`:`)[0];e.turnNextDirections&&(n=n==`h`?`v`:`h`),t.turnNextDirections&&(r=r==`h`?`v`:`h`);var i=n+`:`+r;return{waypoints:Ag(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}function Og(e){return e.split(`:`).reverse().join(`:`)}function kg(e,t,n){var r=yg((t.x-e.x)/2+e.x),i=yg((t.y-e.y)/2+e.y);if(n===`h:v`)return[{x:t.x,y:e.y}];if(n===`v:h`)return[{x:e.x,y:t.y}];if(n===`h:h`)return[{x:r,y:e.y},{x:r,y:t.y}];if(n===`v:v`)return[{x:e.x,y:i},{x:t.x,y:i}];throw Error(`invalid directions: can only handle varians of [hv]:[hv]`)}function Ag(e,t,n){if(n||=`h:h`,!Vg(n))throw Error(`unknown directions: <`+n+`>: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }`);if(Hg(n)){var r=Tg(e,t,n),i=Eg(e,t,n),a=Dg(r,i);return[].concat(r.waypoints,a.waypoints,i.waypoints)}return kg(e,t,n)}function jg(e,t,n){var r=Ag(e,t,n);return r.unshift(e),r.push(t),Gg(r)}function Mg(e,t,n,r,i){var o=i&&i.preferredLayouts||[],s=a(o,`straight`)[0]||`h:h`,c=xg[s]||0,l=xe(e,t,c),u=Bg(l,s);n||=M(e),r||=M(t);var d=u.split(`:`);return jg(Wg(n,e,d[0],Ug(l)),Wg(r,t,d[1],l),u)}function Ng(e,t,n,r,i,a){m(n)&&(i=n,a=r,n=M(e),r=M(t)),a=T({preferredLayouts:[]},a),i||=[];var o=a.preferredLayouts.indexOf(`straight`)!==-1&&Ig(e,t,n,r,a);return o||(o=a.connectionEnd&&Rg(t,e,r,i),o)||(o=a.connectionStart&&Lg(e,t,n,i),o)?o:!a.connectionStart&&!a.connectionEnd&&i&&i.length?i:Mg(e,t,n,r,a)}function Pg(e,t,n){return e>=t&&e<=n}function Fg(e,t,n){return Pg(t[e],n[e],n[e]+n[{x:`width`,y:`height`}[e]])}function Ig(e,t,n,r,i){var a={},o,s=xe(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(o=`x`),/left|right/.test(s)&&(o=`y`),i.preserveDocking===`target`?Fg(o,r,e)?(a[o]=r[o],[{x:a.x===void 0?n.x:a.x,y:a.y===void 0?n.y:a.y,original:{x:a.x===void 0?n.x:a.x,y:a.y===void 0?n.y:a.y}},{x:r.x,y:r.y}]):null:Fg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:a.x===void 0?r.x:a.x,y:a.y===void 0?r.y:a.y,original:{x:a.x===void 0?r.x:a.x,y:a.y===void 0?r.y:a.y}}]):null):null}function Lg(e,t,n,r){return zg(e,t,n,r)}function Rg(e,t,n,r){var i=r.slice().reverse();return i=zg(e,t,n,i),i?i.reverse():null}function zg(e,t,n,r){function i(e){return e.length<3?!0:e.length>4?!1:!!C(e,function(t,n){var r=e[n-1];return r&&ge(t,r)<3})}function a(e,t,n){switch(Se(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}}function o(e,t,n){for(var r=e.length-2;r!==0;r--)if(_e(e[r],t,bg)||_e(e[r],n,bg))return e.slice(r);return e}if(i(r))return null;var s=r[0],c=r.slice(),l;return c[0]=n,c[1]=a(c[1],s,n),l=o(c,e,t),l!==c&&(c=zg(e,t,n,l)),c&&Se(c)?null:c}function Bg(e,t){if(Hg(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}}function Vg(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Hg(e){return e&&/t|r|b|l/.test(e)}function Ug(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]}function Wg(e,t,n,r){if(n===`h`&&(n=/left/.test(r)?`l`:`r`),n===`v`&&(n=/top/.test(r)?`t`:`b`),n===`t`)return{original:e,x:e.x,y:t.y};if(n===`r`)return{original:e,x:t.x+t.width,y:e.y};if(n===`b`)return{original:e,x:e.x,y:t.y+t.height};if(n===`l`)return{original:e,x:t.x,y:e.y};throw Error(`unexpected dockingDirection: <`+n+`>`)}function Gg(e){return e.reduce(function(t,n,r){var i=t[t.length-1],a=e[r+1];return be(i,a,n,0)||t.push(n),t},[])}var Kg=-10,qg=40,Jg={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},Yg={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},Xg={top:`bottom`,"top-right":`bottom-left`,"top-left":`bottom-right`,right:`left`,bottom:`top`,"bottom-right":`top-left`,"bottom-left":`top-right`,left:`right`},Zg={top:`t`,right:`r`,bottom:`b`,left:`l`};function Qg(e){this._elementRegistry=e}z(Qg,gg),Qg.prototype.layoutConnection=function(e,t){t||={};var n=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints,a=t.connectionStart,o=t.connectionEnd,s=this._elementRegistry,c,l;if(a||=r_(i&&i[0],n),o||=r_(i&&i[i.length-1],r),(O(e,`bpmn:Association`)||O(e,`bpmn:DataAssociation`))&&i&&!i_(n,r))return[a].concat(i.slice(1,-1),[o]);var u=Je(n,s)?Jg:Yg;return O(e,`bpmn:MessageFlow`)?c=e_(n,r,u):(O(e,`bpmn:SequenceFlow`)||i_(n,r))&&(c=n===r?{preferredLayouts:m_(n,e,u)}:O(n,`bpmn:BoundaryEvent`)?{preferredLayouts:h_(n,r,o,u)}:a_(n)||a_(r)?{preferredLayouts:u.subProcess,preserveDocking:n_(n)}:O(n,`bpmn:Gateway`)?{preferredLayouts:u.fromGateway}:O(r,`bpmn:Gateway`)?{preferredLayouts:u.toGateway}:{preferredLayouts:u.default}),c&&(c=T(c,t),l=Gg(Ng(n,r,a,o,i,c))),l||[a,o]};function $g(e){var t=e.host;return xe(M(e),t,Kg)}function e_(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:t_(e,t)}}function t_(e,t){return O(t,`bpmn:Participant`)?`source`:O(e,`bpmn:Participant`)?`target`:a_(t)?`source`:a_(e)||O(t,`bpmn:Event`)?`target`:O(e,`bpmn:Event`)?`source`:null}function n_(e){return a_(e)?`target`:`source`}function r_(e,t){return e?e.original||e:M(t)}function i_(e,t){return O(t,`bpmn:Activity`)&&O(e,`bpmn:BoundaryEvent`)&&t.businessObject.isForCompensation}function a_(e){return O(e,`bpmn:SubProcess`)&&R(e)}function o_(e,t){return e===t}function s_(e,t){return t.indexOf(e)!==-1}function c_(e){var t=/right|left/.exec(e);return t&&t[0]}function l_(e){var t=/top|bottom/.exec(e);return t&&t[0]}function u_(e,t){return Xg[e]===t}function d_(e,t){var n=Xg[c_(e)];return t.indexOf(n)!==-1}function f_(e,t){var n=Xg[l_(e)];return t.indexOf(n)!==-1}function p_(e){return e===`right`||e===`left`}function m_(e,t,n){var r=t.waypoints,i=r&&r.length&&xe(r[0],e);return i===`top`?n.loop.fromTop:i===`right`?n.loop.fromRight:i===`left`?n.loop.fromLeft:n.loop.fromBottom}function h_(e,t,n,r){var i=M(e),a=M(t),o=$g(e),s,c,l=o_(e.host,t),u=s_(o,[`top`,`right`,`bottom`,`left`]),d=xe(a,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?g_(o,u,e,t,n,r):(s=y_(o,d,u,r.isHorizontal),c=b_(o,d,u,r.isHorizontal),[s+`:`+c])}function g_(e,t,n,r,i,a){var o=Zg[t?e:a.isHorizontal?l_(e):c_(e)],s=t?p_(e)?__(`y`,n,r,i)?`h`:a.boundaryLoop.alternateHorizontalSide:__(`x`,n,r,i)?`v`:a.boundaryLoop.alternateVerticalSide:a.boundaryLoop.default;return[o+`:`+s]}function __(e,t,n,r){var i=qg;return!(v_(e,r,n,i)||v_(e,r,{x:n.x+n.width,y:n.y+n.height},i)||v_(e,r,M(t),i))}function v_(e,t,n,r){return Math.abs(t[e]-n[e])<r}function y_(e,t,n,r){if(n)return Zg[e];var i=l_(e),a=c_(e),o=l_(t),s=c_(t);if(r){if(o_(i,o)||u_(a,s))return Zg[i]}else if(o_(a,s)||u_(i,o))return Zg[a];return Zg[r?a:i]}function b_(e,t,n,r){if(n)return p_(e)?d_(e,t)||o_(e,t)?`h`:`v`:f_(e,t)||o_(e,t)?`v`:`h`;var i=l_(e),a=c_(e),o=l_(t),s=c_(t);return o&&!s?`v`:s&&!o?`h`:r?o_(i,o)?`h`:`v`:o_(a,s)?`v`:`h`}Qg.$inject=[`elementRegistry`];function x_(e){return T({original:e.point.original||e.point},e.actual)}function S_(e,t){this._elementRegistry=e,this._graphicsFactory=t}S_.$inject=[`elementRegistry`,`graphicsFactory`],S_.prototype.getCroppedWaypoints=function(e,t,n){t||=e.source,n||=e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),a=e.waypoints.slice(r.idx+1,i.idx);return a.unshift(x_(r)),a.push(x_(i)),a},S_.prototype.getDockingPoint=function(e,t,n){var r=e.waypoints,i=n?0:r.length-1,a=r[i];return{point:a,actual:this._getIntersection(t,e,n)||a,idx:i}},S_.prototype._getIntersection=function(e,t,n){var r=this._getShapePath(e),i=this._getConnectionPath(t);return ve(r,i,n)},S_.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},S_.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},S_.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var C_={__init__:[`modeling`,`bpmnUpdater`],__depends__:[Id,Nf,If,zf,kp,am,dm,xm,It,Ct,im],bpmnFactory:[`type`,Sm],bpmnUpdater:[`type`,Qe],elementFactory:[`type`,zm],modeling:[`type`,hg],layouter:[`type`,Qg],connectionDocking:[`type`,S_]},w_=Math.round;function T_(e,t,n,r,i,a){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=a}T_.prototype.create=function(e,t,n){let r=this._complexPreview,i=this._connectionDocking,a=this._elementFactory,o=this._eventBus,s=this._layouter,c=this._rules,l=a.createShape(T({type:t},n)),u=o.fire(`autoPlace`,{source:e,shape:l});if(!u)return;T(l,{x:u.x-w_(l.width/2),y:u.y-w_(l.height/2)});let d=c.allowed(`connection.create`,{source:e,target:l,hints:{targetParent:e.parent}}),f=null;d&&(f=a.createConnection(d),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=i.getCroppedWaypoints(f,e,l)),r.create({created:[l,f].filter(e=>!g(e))})},T_.prototype.cleanUp=function(){this._complexPreview.cleanUp()},T_.$inject=[`complexPreview`,`connectionDocking`,`elementFactory`,`eventBus`,`layouter`,`rules`];var E_={__depends__:[ja,Rs,C_],__init__:[`appendPreview`],appendPreview:[`type`,T_]},D_=Math.min,O_=Math.max;function k_(e){e.preventDefault()}function A_(e){e.stopPropagation()}function j_(e){return e.nodeType===Node.TEXT_NODE}function M_(e){return[].slice.call(e)}function N_(e){this.container=e.container,this.parent=gt(`<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>`),this.content=V(`[contenteditable]`,this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=S(this.autoResize,this),this.handlePaste=S(this.handlePaste,this)}N_.prototype.create=function(e,t,n,r){var i=this,a=this.parent,o=this.content,s=this.container;r=this.options=r||{},t=this.style=t||{};var c=ie(t,[`width`,`height`,`maxWidth`,`maxHeight`,`minWidth`,`minHeight`,`left`,`top`,`backgroundColor`,`position`,`overflow`,`border`,`wordWrap`,`textAlign`,`outline`,`transform`]);T(a.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`},c);var l=ie(t,[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`]);return T(o.style,{boxSizing:`border-box`,width:`100%`,outline:`none`,wordWrap:`break-word`},l),r.centerVertically&&T(o.style,{position:`absolute`,top:`50%`,transform:`translate(0, -50%)`},l),o.innerText=n,H.bind(o,`keydown`,this.keyHandler),H.bind(o,`mousedown`,A_),H.bind(o,`paste`,i.handlePaste),H.bind(o,`focusout`,this.focusoutHandler),r.autoResize&&H.bind(o,`input`,this.autoResize),r.resizable&&this.resizable(t),s.appendChild(a),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),a},N_.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var r=e.clipboardData?e.clipboardData.getData(`text/plain`):window.clipboardData.getData(`Text`);if(this.insertText(r),t.autoResize){var i=this.autoResize(n);i&&this.resizeHandler(i)}},N_.prototype.insertText=function(e){e=P_(e),!document.execCommand(`insertText`,!1,e)&&this._insertTextIE(e)},N_.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,a=t.endOffset,o=t.commonAncestorContainer,s=M_(o.childNodes),c,l;if(j_(o)){var u=n.textContent;n.textContent=u.substring(0,i)+e+u.substring(a),c=n,l=i+e.length}else if(n===this.content&&r===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,s[i]),c=d,l=d.textContent.length}else{var f=s.indexOf(n),p=s.indexOf(r);s.forEach(function(t,o){o===f?t.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(a):o>f&&o<=p&&ot(t)}),c=n,l=i+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},N_.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+`px`,this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},N_.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,a=parseInt(this.style.maxWidth)||1/0,o=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=gt(`<div class="djs-direct-editing-resize-handle"></div>`);var s,c,l,u,d=function(e){k_(e),A_(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();l=n.width,u=n.height,H.bind(document,`mousemove`,f),H.bind(document,`mouseup`,p)},f=function(n){k_(n),A_(n);var d=D_(O_(l+n.clientX-s,r),a),f=D_(O_(u+n.clientY-c,i),o);t.style.width=d+`px`,t.style.height=f+`px`,e.resizeHandler({width:l,height:u,dx:n.clientX-s,dy:n.clientY-c})},p=function(e){k_(e),A_(e),H.unbind(document,`mousemove`,f,!1),H.unbind(document,`mouseup`,p,!1)};H.bind(n,`mousedown`,d)}T(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)},N_.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText=``,e.removeAttribute(`style`),t.removeAttribute(`style`),H.unbind(t,`keydown`,this.keyHandler),H.unbind(t,`mousedown`,A_),H.unbind(t,`input`,this.autoResize),H.unbind(t,`paste`,this.handlePaste),H.unbind(t,`focusout`,this.focusoutHandler),n&&(n.removeAttribute(`style`),ot(n)),ot(e)},N_.prototype.getValue=function(){return this.content.innerText.trim()},N_.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},N_.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)};function P_(e){return e.replace(/\r\n|\r|\n/g,`
|
|
352
|
+
</svg>`},na=900;function ra(e,t,n,r){e.registerProvider(na,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}ra.$inject=[`contextPad`,`popupMenu`,`translate`,`canvas`],ra.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},ra.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,`align-elements`)},ra.prototype._getEntries=function(){var e=this;return{"align-elements":{group:`align-elements`,title:e._translate(`Align elements`),html:`<div class="entry">${ta.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);T(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,`align-elements`,r)}}}}},ra.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+t}};var ia=[`left`,`center`,`right`,`top`,`middle`,`bottom`];function aa(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider(`align-elements`,this)}aa.$inject=[`popupMenu`,`alignElements`,`translate`,`rules`],aa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},aa.prototype._isAllowed=function(e){return this._rules.allowed(`elements.align`,{elements:e})},aa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return b(ia,function(a){i[`align-elements-`+a]={group:`align`,title:n(`Align elements `+a),className:`bjs-align-elements-menu-entry`,imageHtml:ta[a],action:function(){t.trigger(e,a),r.close()}}}),i};function oa(e){B.call(this,e),this.init()}oa.$inject=[`eventBus`],z(oa,B),oa.prototype.addRule=function(e,t,n){var r=this;typeof e==`string`&&(e=[e]),e.forEach(function(e){r.canExecute(e,t,function(e,t,r){return n(e)},!0)})},oa.prototype.init=function(){};function sa(e){oa.call(this,e)}sa.$inject=[`eventBus`],z(sa,oa),sa.prototype.init=function(){this.addRule(`elements.align`,function(e){var t=e.elements,n=u(t,function(e){return!(e.waypoints||e.host||e.labelTarget)});return n=Ot(n),n.length<2?!1:n})};var ca={__depends__:[zn,Qn,ea],__init__:[`alignElementsContextPadProvider`,`alignElementsMenuProvider`,`bpmnAlignElements`],alignElementsContextPadProvider:[`type`,ra],alignElementsMenuProvider:[`type`,aa],bpmnAlignElements:[`type`,sa]},la=10,ua=250;function da(e,t,n,r){for(var i;i=pa(e,n,t);)n=r(t,n,i);return n}function fa(e){return function(t,n,r){var i={x:n.x,y:n.y};return[`x`,`y`].forEach(function(a){var o=e[a];if(o){var s=a===`x`?`width`:`height`,c=o.margin,l=o.minDistance;i[a]=c<0?Math.min(r[a]+c-t[s]/2,n[a]-l+c):Math.max(r[a]+r[s]+c+t[s]/2,n[a]+l+c)}}),i}}function pa(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=ha(e);return C(i,function(e){return e!==n&&xe(e,r,la)===`intersect`})}function ma(e,t){t||={};function n(t){return t.source===e?1:-1}var r=t.defaultDistance||50,i=t.direction||`e`,a=t.filter,o=t.getWeight||n,s=t.maxDistance||ua,l=t.reference||`start`;a||=ya;function u(e,t){return i===`n`?l===`start`?N(e).top-N(t).bottom:l===`center`?N(e).top-M(t).y:N(e).top-N(t).top:i===`w`?l===`start`?N(e).left-N(t).right:l===`center`?N(e).left-M(t).x:N(e).left-N(t).left:i===`s`?l===`start`?N(t).top-N(e).bottom:l===`center`?M(t).y-N(e).bottom:N(t).bottom-N(e).bottom:l===`start`?N(t).left-N(e).right:l===`center`?M(t).x-N(e).right:N(t).right-N(e).right}var d=e.incoming.filter(a).map(function(t){var n=o(t),r=n<0?u(t.source,e):u(e,t.source);return{id:t.source.id,distance:r,weight:n}}),f=e.outgoing.filter(a).map(function(t){var n=o(t),r=n>0?u(e,t.target):u(t.target,e);return{id:t.target.id,distance:r,weight:n}}),p=d.concat(f).reduce(function(e,t){return e[t.id+`__weight_`+t.weight]=t,e},{});return c(p,function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e},{}).distance||r}function ha(e){var t=ga(e);return e.host&&(t=t.concat(ga(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(e,t){return e.concat(ga(t))},[]))),t}function ga(e){return va(e).concat(_a(e))}function _a(e){return e.incoming.map(function(e){return e.source})}function va(e){return e.outgoing.map(function(e){return e.target})}function ya(){return!0}var ba=100;function xa(e,t,n){e.on(`autoPlace`,ba,function(e){var t=e.shape,n=e.source;return Sa(n,t)}),e.on(`autoPlace.end`,function(e){n.scrollToElement(e.shape)}),this.append=function(n,r,i){e.fire(`autoPlace.start`,{source:n,shape:r});var a=e.fire(`autoPlace`,{source:n,shape:r}),o=t.appendShape(n,r,a,n.parent,i);return e.fire(`autoPlace.end`,{source:n,shape:o}),o}}xa.$inject=[`eventBus`,`modeling`,`canvas`];function Sa(e,t,n){n||={};var r=n.defaultDistance||50,i=M(e);return{x:N(e).right+r+t.width/2,y:i.y}}function Ca(e,t){e.on(`autoPlace.end`,500,function(e){t.select(e.shape)})}Ca.$inject=[`eventBus`,`selection`];var wa={__init__:[`autoPlaceSelectionBehavior`],autoPlace:[`type`,xa],autoPlaceSelectionBehavior:[`type`,Ca]};function Ta(e,t,n){var r=Je(e,n);if(O(t,`bpmn:TextAnnotation`))return Oa(e,t,r);if(E(t,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`]))return ka(e,t,r);if(O(t,`bpmn:FlowNode`))return Ea(e,t,r)}function Ea(e,t,n){var r=N(e),i=M(e),a=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`},o=ma(e,{filter:function(e){return O(e,`bpmn:SequenceFlow`)},direction:a.directionHint}),s=30,c=a.minDistance,l=a.baseOrientation;O(e,`bpmn:BoundaryEvent`)&&(l=xe(e,e.host,-25),l.indexOf(a.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:r.right+o+t.width/2,y:i.y+Da(l,c,a)}:{x:i.x+Da(l,c,a),y:r.bottom+o+t.height/2},d={margin:s,minDistance:c};return da(e,t,u,fa(n?{y:d}:{x:d}))}function Da(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function Oa(e,t,n){var r=N(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};A(e)&&(i=M(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var a={margin:n?-30:30,minDistance:20};return da(e,t,i,fa(n?{y:a}:{x:a}))}function ka(e,t,n){var r=N(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},a={margin:30,minDistance:30};return da(e,t,i,fa(n?{x:a}:{y:a}))}function Aa(e,t){e.on(`autoPlace`,function(e){var n=e.shape,r=e.source;return Ta(r,n,t)})}Aa.$inject=[`eventBus`,`elementRegistry`];var ja={__depends__:[wa],__init__:[`bpmnAutoPlace`],bpmnAutoPlace:[`type`,Aa]};function Ma(e,t,n,r){B.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var a=this;this.postExecuted([`shape.create`],function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;n.autoResize!==!1&&a._expand([r],i)}),this.postExecuted([`elements.move`],function(e){var t=e.context,n=f(i(t.closure.topLevel)),r=t.hints,o=!r||r.autoResize;if(o!==!1){var c=ne(n,function(e){return e.parent.id});b(c,function(e,t){m(o)&&(e=e.filter(function(e){return C(o,s({id:e.id}))})),a._expand(e,t)})}}),this.postExecuted([`shape.toggleCollapse`],function(e){var t=e.context,n=t.hints,r=t.shape;n&&n.autoResize===!1||r.collapsed||a._expand(r.children||[],r)}),this.postExecuted([`shape.resize`],function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&n.autoResize===!1||i&&a._expand([r],i)})}Ma.$inject=[`eventBus`,`elementRegistry`,`modeling`,`rules`],z(Ma,B),Ma.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=N(it(e)),a=N(t),o={};return i.top-a.top<r.top&&(o.top=i.top-n.top),i.left-a.left<r.left&&(o.left=i.left-n.left),a.right-i.right<r.right&&(o.right=i.right+n.right),a.bottom-i.bottom<r.bottom&&(o.bottom=i.bottom+n.bottom),Te(T({},a,o))},Ma.prototype._expand=function(e,t){if(typeof t==`string`&&(t=this._elementRegistry.get(t)),this._rules.allowed(`element.autoResize`,{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(Na(n,t)){var r=Pa(ie(t,[`x`,`y`,`width`,`height`]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},Ma.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ma.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ma.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function Na(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pa(e,t){var n=``;return e=N(e),t=N(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`)),n}function Fa(e){e.invoke(Ma,this)}Fa.$inject=[`injector`],z(Fa,Ma),Fa.prototype.resize=function(e,t,n){O(e,`bpmn:Participant`)?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ia(e){oa.call(this,e);var t=this;this.addRule(`element.autoResize`,function(e){return t.canResize(e.elements,e.target)})}Ia.$inject=[`eventBus`],z(Ia,oa),Ia.prototype.canResize=function(e,t){return!1};function La(e,t){Ia.call(this,e),this._modeling=t}z(La,Ia),La.$inject=[`eventBus`,`modeling`],La.prototype.canResize=function(e,t){if(O(t.di,`bpmndi:BPMNPlane`)||!O(t,`bpmn:Participant`)&&!O(t,`bpmn:Lane`)&&!O(t,`bpmn:SubProcess`))return!1;var n=!0;return b(e,function(e){(O(e,`bpmn:Lane`)||j(e))&&(n=!1)}),n};var Ra={__init__:[`bpmnAutoResize`,`bpmnAutoResizeProvider`],bpmnAutoResize:[`type`,Fa],bpmnAutoResizeProvider:[`type`,La]},za=1500;function Ba(e,t,n){var r=this,i=n.get(`dragging`,!1);function a(t){if(!t.hover){var n=t.originalEvent,a=r._findTargetGfx(n),o=a&&e.get(a);a&&o&&(t.stopPropagation(),i.hover({element:o,gfx:a}),i.move(n))}}i&&t.on(`drag.start`,function(e){t.once(`drag.move`,za,function(e){a(e)})}),(function(){var e,n;t.on(`element.hover`,function(t){e=t.gfx,n=t.element}),t.on(`element.hover`,za,function(r){n&&t.fire(`element.out`,{element:n,gfx:e})}),t.on(`element.out`,function(){e=null,n=null})})(),this._findTargetGfx=function(e){var t,n;if(e instanceof MouseEvent)return t=kt(e),n=document.elementFromPoint(t.x,t.y),Va(n)}}Ba.$inject=[`elementRegistry`,`eventBus`,`injector`];function Va(e){return ct(e,`svg, .djs-element`,!0)}var Ha={__init__:[`hoverFix`],hoverFix:[`type`,Ba]},Ua=Math.round,Wa=`djs-drag-active`;function Ga(e){e.preventDefault()}function Ka(e){return typeof TouchEvent<`u`&&e instanceof TouchEvent}function qa(e){return Math.sqrt(e.x**2+e.y**2)}function Ja(e,t,n,r){var i={threshold:5,trapClick:!0},a;function o(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function s(t,n){n||=a;var r=e.createEvent(T({},n.payload,n.data,{isTouch:n.isTouch}));return e.fire(`drag.`+t,r)!==!1&&e.fire(n.prefix+`.`+t,r)}function c(e){var t=e.filter(function(e){return r.get(e.id)});t.length&&n.select(t)}function l(e,r){var i=a.payload,c=a.displacement,l=a.globalStart,u=kt(e),d=Ze(u,l),f=a.localStart,p=o(u),m=Ze(p,f);if(!a.active&&(r||qa(d)>a.threshold)){if(T(i,{x:Ua(f.x+c.x),y:Ua(f.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===s(`start`))return g();a.active=!0,a.keepSelection||(i.previousSelection=n.get(),n.select(null)),a.cursor&&hn(a.cursor),t.addMarker(t.getRootElement(),Wa)}xt(e),a.active&&(T(i,{x:Ua(p.x+c.x),y:Ua(p.y+c.y),dx:Ua(m.x),dy:Ua(m.y)},{originalEvent:e}),s(`move`))}function u(e){var t,n=!0;a.active&&(e&&(a.payload.originalEvent=e,xt(e)),n=s(`end`)),n===!1&&s(`rejected`),t=_(n!==!0),s(`ended`,t)}function d(e){Zt(`Escape`,e)&&(Ga(e),g())}function f(t){var n;a.active&&(n=vn(e),setTimeout(n,400),Ga(t)),u(t)}function p(e){l(e)}function m(e){var t=a.payload;t.hoverGfx=e.gfx,t.hover=e.element,s(`hover`)}function h(e){s(`out`);var t=a.payload;t.hoverGfx=null,t.hover=null}function g(e){var t;if(a){var n=a.active;n&&s(`cancel`),t=_(e),n&&s(`canceled`,t)}}function _(r){var i,o;s(`cleanup`),gn(),o=a.trapClick?f:u,H.unbind(document,`mousemove`,l),H.unbind(document,`dragstart`,Ga),H.unbind(document,`selectstart`,Ga),H.unbind(document,`mousedown`,o,!0),H.unbind(document,`mouseup`,o,!0),H.unbind(document,`keyup`,d),H.unbind(document,`touchstart`,p,!0),H.unbind(document,`touchcancel`,g,!0),H.unbind(document,`touchmove`,l,!0),H.unbind(document,`touchend`,u,!0),e.off(`element.hover`,m),e.off(`element.out`,h),t.removeMarker(t.getRootElement(),Wa);var _=a.payload.previousSelection;return r!==!1&&_&&!n.get().length&&c(_),i=a,a=null,i}function v(t,n,r,c){a&&g(!1),typeof n==`string`&&(c=r,r=n,n=null),c=T({},i,c||{});var _=c.data||{},v,y,b,x=c.trapClick?f:u,S;if(t?(v=Ft(t)||t,y=kt(t),xt(t),v.type===`dragstart`&&Ga(v)):(v=null,y={x:0,y:0}),b=o(y),n||=b,S=Ka(v),a=T({prefix:r,data:_,payload:{},globalStart:y,displacement:Ze(n,b),localStart:b,isTouch:S},c),c.manual||(S?(H.bind(document,`touchstart`,p,!0),H.bind(document,`touchcancel`,g,!0),H.bind(document,`touchmove`,l,!0),H.bind(document,`touchend`,u,!0)):(H.bind(document,`mousemove`,l),H.bind(document,`dragstart`,Ga),H.bind(document,`selectstart`,Ga),H.bind(document,`mousedown`,x,!0),H.bind(document,`mouseup`,x,!0)),H.bind(document,`keyup`,d),e.on(`element.hover`,m),e.on(`element.out`,h)),s(`init`)===!1)return g(),!1;c.autoActivate&&l(t,!0)}e.on(`diagram.destroy`,g),this.init=v,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=g,this.context=function(){return a},this.setOptions=function(e){T(i,e)}}Ja.$inject=[`eventBus`,`canvas`,`selection`,`elementRegistry`];var Ya={__depends__:[Ha,It],dragging:[`type`,Ja]};function Xa(e,t,n){this._canvas=n,this._opts=T({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on(`drag.move`,function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on([`drag.cleanup`],function(){r.stopScroll()})}Xa.$inject=[`config.autoScroll`,`eventBus`,`canvas`],Xa.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),a=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var o=0,s=0,c=0;c<4;c++)Za(a[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?o=n.scrollStep:c==1?s=n.scrollStep:c==2?o=-n.scrollStep:c==3&&(s=-n.scrollStep));(o!==0||s!==0)&&(t.scroll({dx:o,dy:s}),this._scrolling=setTimeout(function(){r.startScroll(e)},n.scrollRepeatTimeout))};function Za(e,t,n){return t<e&&e<n}Xa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Xa.prototype.setOptions=function(e){this._opts=T({},this._opts,e)},Xa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=kt(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Qa={__depends__:[Ya],__init__:[`autoScroll`],autoScroll:[`type`,Xa]};function $a(e){this._commandStack=e.get(`commandStack`,!1)}$a.$inject=[`injector`],$a.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),n===void 0||n};var eo={__init__:[`rules`],rules:[`type`,$a]},to=Math.round,no=Math.max;function ro(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`]]}function io(e){var t=[];return e.forEach(function(e,n){t.push([n===0?`M`:`L`,e.x,e.y])}),t}var ao=10;function oo(e,t){for(var n=0,r;r=e[n];n++)if(ge(r,t)<=ao)return{point:e[n],bendpoint:!0,index:n};return null}function so(e,t){var n=ye(ro(t,ao),io(e)),r=n[0],i=n[n.length-1],a;return r?r===i?{point:{x:to(r.x),y:to(r.y)},index:r.segment2}:r.segment2===i.segment2?{point:{x:to(r.x+i.x)/2,y:to(r.y+i.y)/2},index:r.segment2}:(a=no(r.segment2,i.segment2)-1,{point:e[a],bendpoint:!0,index:a}):null}function co(e,t){return oo(e,t)||so(e,t)}function lo(e){return Math.sqrt(e.x**2+e.y**2)}function uo(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function fo(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function po(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=r[0].n*t[0]+r[1].n*t[1],a=r[0].lambda*t[0]+r[1].lambda*t[1];return-i/a}function mo(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},a=po([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+a*i.x,y:n.y+a*i.y}}function ho(e,t){var n=mo(e,t);return lo({x:n.x-e.x,y:n.y-e.y})}function go(e,t){return lo({x:e.x-t.x,y:e.y-t.y})}var _o=`djs-bendpoint`,vo=`djs-segment-dragger`;function yo(e,t){var n=kt(t),r=e._container.getBoundingClientRect(),i={x:r.left,y:r.top},a=e.viewbox();return{x:a.x+(n.x-i.x)/a.scale,y:a.y+(n.y-i.y)/a.scale}}function bo(e,t,n){return co(t,yo(e,n))}function xo(e,t){var n=F(`g`);I(n).add(_o),L(e,n);var r=F(`circle`);P(r,{cx:0,cy:0,r:4}),I(r).add(`djs-visual`),L(n,r);var i=F(`circle`);return P(i,{cx:0,cy:0,r:10}),I(i).add(`djs-hit`),L(n,i),t&&I(n).add(t),n}function So(e,t,n,r){var i=F(`g`);L(e,i);var a=18,o=6,s=11,c=Eo(t,n,r),l=o+s,u=F(`rect`);P(u,{x:-a/2,y:-o/2,rx:3,width:a,height:o}),I(u).add(`djs-visual`),L(i,u);var d=F(`rect`);return P(d,{x:-c/2,y:-l/2,width:c,height:l}),I(d).add(`djs-hit`),L(i,d),Vt(i,r===`v`?90:0,0,0),i}function Co(e,t,n){var r=F(`g`),i=Ee(t,n),a=Se(t,n);return L(e,r),So(r,t,n,a),I(r).add(vo),I(r).add(a===`h`?`horizontal`:`vertical`),Bt(r,i.x,i.y),r}function wo(e){return Math.abs(Math.round(e*2/3))}function To(e,t){return mo(e,Do(e,t))}function Eo(e,t,n){var r=t.x-e.x,i=t.y-e.y;return wo(n===`h`?r:i)}function Do(e,t){for(var n=t.waypoints,r=1/0,i,a=0;a<n.length-1;a++){var o=n[a],s=n[a+1],c=ho(e,[o,s]);c<r&&(r=c,i=a)}return[n[i],n[i+1]]}function Oo(e,t,n,r,i){function a(e,t,n){var r=e.index,i=e.point,a,o,s,c,l,u;return r<=0||e.bendpoint?!1:(a=t[r-1],o=t[r],s=Ee(a,o),c=Se(a,o),l=Math.abs(i.x-s.x),u=Math.abs(i.y-s.y),c&&l<=n&&u<=n)}function o(e,t){var n=e.waypoints,r,i,a,o;return t.index<=0||t.bendpoint||(r={start:n[t.index-1],end:n[t.index]},i=Se(r.start,r.end),!i)?null:(a=i===`h`?r.end.x-r.start.x:r.end.y-r.start.y,o=wo(a)/2,o)}function s(e,n){var s=n.waypoints,c=bo(t,s,e),l;if(c&&(l=o(n,c),(a(c,s,l)?i.start(e,n,c.index):r.start(e,n,c.index,!c.bendpoint))!==!1))return!0}function c(e,t,r){H.bind(e,t,function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()})}function l(e,n){var r=t.getLayer(`overlays`),i=V(`.djs-bendpoints[data-element-id="`+Lt(e.id)+`"]`,r);return!i&&n&&(i=F(`g`),P(i,{"data-element-id":e.id}),I(i).add(`djs-bendpoints`),L(r,i),c(i,`mousedown`,e),c(i,`click`,e),c(i,`dblclick`,e)),i}function u(e,t){return V(`.djs-segment-dragger[data-segment-idx="`+e+`"]`,t)}function d(e,t){t.waypoints.forEach(function(t,n){var r=xo(e);L(e,r),Bt(r,t.x,t.y)}),xo(e,`floating`)}function f(e,t){for(var n=t.waypoints,r,i,a,o=1;o<n.length;o++)r=n[o-1],i=n[o],Se(r,i)&&(a=Co(e,r,i),P(a,{"data-segment-idx":o}),c(a,`mousemove`,t))}function p(e){b(lt(`.`+_o,e),function(e){ke(e)})}function m(e){b(lt(`.`+vo,e),function(e){ke(e)})}function h(e){var t=l(e);return t||(t=l(e,!0),d(t,e),f(t,e)),t}function g(e){var t=l(e);t&&(m(t),p(t),f(t,e),d(t,e))}function _(e,t){var n=V(`.floating`,e),r=t.point;n&&(Bt(n,r.x,r.y),I(n).add(`positioned`))}function v(e,t,n){var r=u(t.index,e),i=n[t.index-1],a=n[t.index],o=t.point,s=Ee(i,a),c=Se(i,a),l,d;r&&(l=ko(r),d={x:o.x-s.x,y:o.y-s.y},c===`v`&&(d={x:d.y,y:d.x}),Bt(l,d.x,d.y))}e.on(`connection.changed`,function(e){g(e.element)}),e.on(`connection.remove`,function(e){var t=l(e.element);t&&ke(t)}),e.on(`element.marker.update`,function(e){var t=e.element,n;t.waypoints&&(n=h(t),e.add?I(n).add(e.marker):I(n).remove(e.marker))}),e.on(`element.mousemove`,function(e){var n=e.element,r=n.waypoints,i,a;if(r){if(i=l(n,!0),a=bo(t,r,e.originalEvent),!a)return;_(i,a),a.bendpoint||v(i,a,r)}}),e.on(`element.mousedown`,function(e){if(yt(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return s(t,n)}}),e.on(`selection.changed`,function(e){var t=e.newSelection[0];t&&t.waypoints&&h(t)}),e.on(`element.hover`,function(e){var t=e.element;t.waypoints&&h(t)}),e.on(`element.out`,function(e){var t=e.element;if(t.waypoints){var n=l(t);if(n){var r=V(`.floating`,n);r&&I(r).remove(`positioned`)}}}),e.on(`element.updateId`,function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=l(t);r&&P(r,{"data-element-id":n})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=l,this.getSegmentDragger=u}Oo.$inject=[`eventBus`,`canvas`,`interactionEvents`,`bendpointMove`,`connectionSegmentMove`];function ko(e){return V(`.djs-visual`,e)}var Ao=Math.round,jo=`reconnectStart`,Mo=`reconnectEnd`,No=`updateWaypoints`;function Po(e,t,n,r,i,a){this._injector=e,this.start=function(e,t,a,o){var s=n.getGraphics(t),c=t.source,l=t.target,u=t.waypoints,d=!o&&a===0?jo:!o&&a===u.length-1?Mo:No,f=d===No?`connection.updateWaypoints`:`connection.reconnect`,p=i.allowed(f,{connection:t,source:c,target:l});if(p===!1&&(p=i.allowed(f,{connection:t,source:l,target:c})),p!==!1)return r.init(e,`bendpoint.move`,{data:{connection:t,connectionGfx:s,context:{allowed:p,bendpointIndex:a,connection:t,source:c,target:l,insert:o,type:d}}})},t.on(`bendpoint.move.hover`,function(e){var t=e.context,n=t.connection,r=n.source,a=n.target,o=e.hover,s=t.type;t.hover=o;var c;if(o){var l=s===No?`connection.updateWaypoints`:`connection.reconnect`;c=t.allowed=i.allowed(l,{connection:n,source:s===jo?o:r,target:s===Mo?o:a}),c?(t.source=s===jo?o:r,t.target=s===Mo?o:a):(c===!1&&(c=t.allowed=i.allowed(l,{connection:n,source:s===Mo?o:a,target:s===jo?o:r})),c&&(t.source=s===Mo?o:a,t.target=s===jo?o:r))}}),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!==No&&(t.allowed=!1)}),t.on(`bendpoint.move.end`,function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints.slice(),c=t.source,l=t.target,u=t.type,d=t.hints||{},f={x:Ao(e.x),y:Ao(e.y)};if(!n)return!1;u===No?(o?s.splice(r,0,f):s[r]=f,d.bendpointMove={insert:o,bendpointIndex:r},s=this.cropWaypoints(i,s),a.updateWaypoints(i,Ce(s),d)):(u===jo?(d.docking=`source`,Fo(t)&&(d.docking=`target`,d.newWaypoints=s.reverse())):u===Mo&&(d.docking=`target`,Fo(t)&&(d.docking=`source`,d.newWaypoints=s.reverse())),a.reconnect(i,c,l,f,d))},this)}Po.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`rules`,`modeling`],Po.prototype.cropWaypoints=function(e,t){var n=this._injector.get(`connectionDocking`,!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};function Fo(e){var t=e.hover,n=e.source,r=e.target,i=e.type;if(i===jo)return t&&r&&t===r&&n!==r;if(i===Mo)return t&&n&&t===n&&n!==r}var Io=`reconnectStart`,Lo=`reconnectEnd`,Ro=`updateWaypoints`,zo=`connect-ok`,Bo=`connect-not-ok`,Vo=`connect-hover`,Ho=`djs-updating`,Uo=`djs-dragging`,Wo=1100;function Go(e,t,n,r){this._injector=t;var i=t.get(`connectionPreview`,!1);n.on(`bendpoint.move.start`,function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,a=t.insert,o=i.waypoints,s=o.slice();t.waypoints=o,a&&s.splice(n,0,{x:e.x,y:e.y}),i.waypoints=s;var c=t.draggerGfx=xo(r.getLayer(`overlays`));I(c).add(`djs-dragging`),r.addMarker(i,Uo),r.addMarker(i,Ho)}),n.on(`bendpoint.move.hover`,function(e){var t=e.context,n=t.allowed,i=t.hover,a=t.type;if(i){if(r.addMarker(i,Vo),a===Ro)return;n?(r.removeMarker(i,Bo),r.addMarker(i,zo)):n===!1&&(r.removeMarker(i,zo),r.addMarker(i,Bo))}}),n.on([`bendpoint.move.out`,`bendpoint.move.cleanup`],Wo,function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,Vo),r.removeMarker(n,i?zo:Bo))}),n.on(`bendpoint.move.move`,function(t){var n=t.context,r=n.allowed,a=n.bendpointIndex,o=n.draggerGfx,s=n.hover,c=n.type,l=n.connection,u=l.source,d=l.target,f=l.waypoints.slice(),p={x:t.x,y:t.y},m=n.hints||{},h={};i&&(m.connectionStart&&(h.connectionStart=m.connectionStart),m.connectionEnd&&(h.connectionEnd=m.connectionEnd),c===Io?Fo(n)?(h.connectionEnd=h.connectionEnd||p,h.source=d,h.target=s||u,f=f.reverse()):(h.connectionStart=h.connectionStart||p,h.source=s||u,h.target=d):c===Lo?Fo(n)?(h.connectionStart=h.connectionStart||p,h.source=s||d,h.target=u,f=f.reverse()):(h.connectionEnd=h.connectionEnd||p,h.source=u,h.target=s||d):(h.noCropping=!0,h.noLayout=!0,f[a]=p),c===Ro&&(f=e.cropWaypoints(l,f)),h.waypoints=f,i.drawPreview(n,r,h)),Bt(o,t.x,t.y)},this),n.on([`bendpoint.move.end`,`bendpoint.move.cancel`],Wo,function(e){var t=e.context,n=t.connection,a=t.draggerGfx,o=t.hover,s=t.target;n.waypoints=t.waypoints,ke(a),r.removeMarker(n,Ho),r.removeMarker(n,Uo),o&&(r.removeMarker(o,zo),r.removeMarker(o,s?zo:Bo)),i&&i.cleanUp(t)})}Go.$inject=[`bendpointMove`,`injector`,`eventBus`,`canvas`];var Ko=`connect-hover`,qo=`djs-updating`;function Jo(e,t,n){return Yo(e,t,e[t]+n)}function Yo(e,t,n){return{x:t===`x`?n:e.x,y:t===`y`?n:e.y}}function Xo(e,t,n,r){var i=Math.max(t[r],n[r]),a=Math.min(t[r],n[r]),o=20;return Yo(t,r,Math.min(Math.max(a+o,e[r]),i-o))}function Zo(e){return e===`x`?`y`:`x`}function Qo(e,t,n){var r,i;return e.original?e.original:(r=M(t),i=Zo(n),Yo(e,i,r[i]))}function $o(e,t,n,r,i,a){var o=e.get(`connectionDocking`,!1);this.start=function(e,t,i){var a,o=n.getGraphics(t),s=i-1,c=i,l=t.waypoints,u=l[s],d=l[c],f=bo(n,l,e),p=Se(u,d),m,h;if(p)return m=p===`v`?`x`:`y`,s===0&&(u=Qo(u,t.source,m)),c===l.length-1&&(d=Qo(d,t.target,m)),h=f?f.point:{x:(u.x+d.x)/2,y:(u.y+d.y)/2},a={connection:t,segmentStartIndex:s,segmentEndIndex:c,segmentStart:u,segmentEnd:d,axis:m,dragPosition:h},r.init(e,h,`connectionSegment.move`,{cursor:m===`x`?`resize-ew`:`resize-ns`,data:{connection:t,connectionGfx:o,context:a}})};function s(e,t){if(!o)return t;var n=e.waypoints,r;return e.waypoints=t,r=o.getCroppedWaypoints(e),e.waypoints=n,r}function c(e){i.update(`connection`,e.connection,e.connectionGfx)}function l(e,t,n){var r=e.newWaypoints,i=r[e.segmentStartIndex+t],a=r[e.segmentEndIndex+t],o=Xo(n,i,a,Zo(e.axis));Bt(e.draggerGfx,o.x,o.y)}function u(e,t){var n=0;return{waypoints:e.filter(function(r,i){return!be(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}),segmentOffset:n}}t.on(`connectionSegment.move.start`,function(e){var t=e.context,r=e.connection,i=n.getLayer(`overlays`);t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Co(i,t.segmentStart,t.segmentEnd),I(t.draggerGfx).add(`djs-dragging`),n.addMarker(r,qo)}),t.on(`connectionSegment.move.move`,function(e){var t=e.context,n=t.connection,r=t.segmentStartIndex,i=t.segmentEndIndex,a=t.segmentStart,o=t.segmentEnd,u=t.axis,d=t.originalWaypoints.slice(),f=Jo(a,u,e[`d`+u]),p=Jo(o,u,e[`d`+u]),m=d.length,h=0;d[r]=f,d[i]=p;var g,_;r<2&&(g=xe(n.source,f),r===1?g===`intersect`&&(d.shift(),d[0]=f,h--):g!==`intersect`&&(d.unshift(a),h++)),i>m-3&&(_=xe(n.target,p),i===m-2?_===`intersect`&&(d.pop(),d[d.length-1]=p):_!==`intersect`&&d.push(o)),t.newWaypoints=n.waypoints=s(n,d),l(t,h,e),t.newSegmentStartIndex=r+h,c(e)}),t.on(`connectionSegment.move.hover`,function(e){e.context.hover=e.hover,n.addMarker(e.hover,Ko)}),t.on([`connectionSegment.move.out`,`connectionSegment.move.cleanup`],function(e){var t=e.context.hover;t&&n.removeMarker(t,Ko)}),t.on(`connectionSegment.move.cleanup`,function(e){var t=e.context,r=t.connection;t.draggerGfx&&ke(t.draggerGfx),n.removeMarker(r,qo)}),t.on([`connectionSegment.move.cancel`,`connectionSegment.move.end`],function(e){var t=e.context,n=t.connection;n.waypoints=t.originalWaypoints,c(e)}),t.on(`connectionSegment.move.end`,function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}});var o=u(r,i),c=o.waypoints,l=s(n,c),d=o.segmentOffset,f={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+d}};a.updateWaypoints(n,l,f)})}$o.$inject=[`injector`,`eventBus`,`canvas`,`dragging`,`graphicsFactory`,`modeling`];var es=Math.abs,ts=Math.round;function ns(e,t,n){n=n===void 0?10:n;for(var r=0,i;r<t.length;r++)if(i=t[r],es(i-e)<=n)return i}function rs(e){return{x:e.x,y:e.y}}function is(e){return{x:e.x+e.width,y:e.y+e.height}}function as(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:ts(e.x+e.width/2),y:ts(e.y+e.height/2)}}function os(e,t){var n=e.snapped;return n?typeof t==`string`?n[t]:n.x&&n.y:!1}function J(e,t,n){if(typeof t!=`string`)throw Error(`axis must be in [x, y]`);if(typeof n!=`number`&&n!==!1)throw Error(`value must be Number or false`);var r,i=e[t],a=e.snapped=e.snapped||{};return n===!1?a[t]=!1:(a[t]=!0,r=n-i,e[t]+=r,e[`d`+t]+=r),i}function ss(e){return e.children||[]}var cs=Math.abs,ls=Math.round,us=10;function ds(e){function t(e,t){if(m(e)){for(var n=e.length;n--;)if(cs(e[n]-t)<=us)return e[n]}else{e=+e;var r=t%e;if(r<us)return t-r;if(r>e-us)return t-r+e}return t}function n(e,t){if(e.waypoints)return To(t,e);if(e.width)return{x:ls(e.width/2+e.x),y:ls(e.height/2+e.y)}}function r(e){var t=e.context,r=t.snapPoints,i=t.connection,a=i.waypoints,o=t.segmentStart,s=t.segmentStartIndex,c=t.segmentEnd,l=t.segmentEndIndex,u=t.axis;if(r)return r;var d=[a[s-1],o,c,a[l+1]];return s<2&&d.unshift(n(i.source,e)),l>a.length-3&&d.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},b(d,function(e){e&&(e=e.original||e,u===`y`&&r.horizontal.push(e.y),u===`x`&&r.vertical.push(e.x))}),r}e.on(`connectionSegment.move.move`,1500,function(e){var n=r(e),i=e.x,a=e.y,o,s;if(n){o=t(n.vertical,i),s=t(n.horizontal,a);var c=i-o,l=a-s;T(e,{dx:e.dx-c,dy:e.dy-l,x:o,y:s}),(c||n.vertical.indexOf(i)!==-1)&&J(e,`x`,o),(l||n.horizontal.indexOf(a)!==-1)&&J(e,`y`,s)}});function i(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},b(i,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}e.on([`connect.hover`,`connect.move`,`connect.end`],1500,function(e){var t=e.context.hover,r=t&&n(t,e);A(t)&&r&&r.x&&r.y&&(J(e,`x`,r.x),J(e,`y`,r.y))}),e.on([`bendpoint.move.move`,`bendpoint.move.end`],1500,function(e){var r=e.context,a=i(r),o=r.hover,s=o&&n(o,e),c=e.x,l=e.y,u,d;if(a){u=t(s?a.vertical.concat([s.x]):a.vertical,c),d=t(s?a.horizontal.concat([s.y]):a.horizontal,l);var f=c-u,p=l-d;T(e,{dx:e.dx-f,dy:e.dy-p,x:e.x-f,y:e.y-p}),(f||a.vertical.indexOf(c)!==-1)&&J(e,`x`,u),(p||a.horizontal.indexOf(l)!==-1)&&J(e,`y`,d)}})}ds.$inject=[`eventBus`];var fs={__depends__:[Ya,eo],__init__:[`bendpoints`,`bendpointSnapping`,`bendpointMovePreview`],bendpoints:[`type`,Oo],bendpointMove:[`type`,Po],bendpointMovePreview:[`type`,Go],connectionSegmentMove:[`type`,$o],bendpointSnapping:[`type`,ds]};function ps(e,t,n,r){function i(e,t){return r.allowed(`connection.create`,{source:e,target:t})}function a(e,t){return i(t,e)}e.on(`connect.hover`,function(e){var t=e.context,n=t.start,r=e.hover,o;t.hover=r,o=t.canExecute=i(n,r),!g(o)&&(o===!1?(o=t.canExecute=a(n,r),!g(o)&&o!==!1&&(t.source=r,t.target=n)):(t.source=n,t.target=r))}),e.on([`connect.out`,`connect.cleanup`],function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1}),e.on(`connect.end`,function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,a={x:e.x,y:e.y},o=t.source,s=t.target;if(!r)return!1;var c=null,u={connectionStart:ms(t)?a:i,connectionEnd:ms(t)?i:a};l(r)&&(c=r),t.connection=n.connect(o,s,c,u)}),this.start=function(e,n,r,i){l(r)||(i=r,r=M(n)),t.init(e,`connect`,{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}ps.$inject=[`eventBus`,`dragging`,`modeling`,`rules`];function ms(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var hs=1100,gs=900,_s=`connect-ok`,vs=`connect-not-ok`;function ys(e,t,n){var r=e.get(`connectionPreview`,!1);r&&t.on(`connect.move`,function(e){var t=e.context,n=t.canExecute,i=t.hover,a=t.source,o=t.start,s=t.startPosition,c=t.target,l=t.connectionStart||s,u=t.connectionEnd||{x:e.x,y:e.y},d=l,f=u;ms(t)&&(d=u,f=l),r.drawPreview(t,n,{source:a||o,target:c||i,connectionStart:d,connectionEnd:f})}),t.on(`connect.hover`,gs,function(e){var t=e.context,r=e.hover,i=t.canExecute;i!==null&&n.addMarker(r,i?_s:vs)}),t.on([`connect.out`,`connect.cleanup`],hs,function(e){var t=e.hover;t&&(n.removeMarker(t,_s),n.removeMarker(t,vs))}),r&&t.on(`connect.cleanup`,function(e){r.cleanUp(e.context)})}ys.$inject=[`injector`,`eventBus`,`canvas`];var bs={__depends__:[It,eo,Ya],__init__:[`connectPreview`],connect:[`type`,ps],connectPreview:[`type`,ys]},xs=`djs-dragger`;function Ss(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get(`connectionDocking`,!1),this._layouter=e.get(`layouter`,!1)}Ss.$inject=[`injector`,`canvas`,`graphicsFactory`,`elementFactory`],Ss.prototype.drawPreview=function(e,t,n){n||={};var r=e.connectionPreviewGfx,i=e.getConnection,a=n.source,o=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,d=n.noCropping,f=n.noNoop,p,m=this;r||=e.connectionPreviewGfx=this.createConnectionPreviewGfx(),Oe(r),i||=e.getConnection=Cs(function(e,t,n){return m.getConnection(e,t,n)}),t&&(p=i(t,a,o)),p?(p.waypoints=s||[],this._layouter&&!u&&(p.waypoints=this._layouter.layoutConnection(p,{source:a,target:o,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||p.waypoints})),(!p.waypoints||!p.waypoints.length)&&(p.waypoints=[a?M(a):c,o?M(o):l]),this._connectionDocking&&(a||o)&&!d&&(p.waypoints=this._connectionDocking.getCroppedWaypoints(p,a,o)),this._graphicsFactory.drawConnection(r,p,{stroke:`var(--element-dragger-color)`})):!f&&this.drawNoopPreview(r,n)},Ss.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||M(n),a=t.connectionEnd||M(r),o=this.cropWaypoints(i,a,n,r),s=this.createNoopConnection(o[0],o[1]);L(e,s)},Ss.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,a=n&&i.getShapePath(n),o=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&ve(a,s,!0)||e,t=r&&ve(o,s,!1)||t,[e,t]},Ss.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ke(e.connectionPreviewGfx)},Ss.prototype.getConnection=function(e){var t=ws(e);return this._elementFactory.createConnection(t)},Ss.prototype.createConnectionPreviewGfx=function(){var e=F(`g`);return P(e,{pointerEvents:`none`}),I(e).add(xs),L(this._canvas.getActiveLayer(),e),e},Ss.prototype.createNoopConnection=function(e,t){return Be([e,t],{stroke:`#333`,strokeDasharray:[1],strokeWidth:2,"pointer-events":`none`})};function Cs(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||=t[r]=e.apply(null,arguments),i}}function ws(e){return l(e)?e:{}}var Ts={__init__:[`connectionPreview`],connectionPreview:[`type`,Ss]},Es=new At(`ps`),Ds=[`marker-start`,`marker-mid`,`marker-end`],Os=[`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`,`path`,`rect`];function ks(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}ks.$inject=[`elementRegistry`,`eventBus`,`canvas`,`styles`],ks.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`)},ks.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ks.prototype.addDragger=function(e,t,n,r=`djs-dragger`){n||=this.getGfx(e);var i=De(n);return this._cloneMarkers(mt(i),r),P(i,this._styles.cls(r,[])),L(t,i),P(i,`data-preview-support-element-id`,e.id),i},ks.prototype.addFrame=function(e,t){var n=F(`rect`,{class:`djs-resize-overlay`,width:e.width,height:e.height,x:e.x,y:e.y});return L(t,n),P(n,`data-preview-support-element-id`,e.id),n},ks.prototype._cloneMarkers=function(e,t=`djs-dragger`,n=e){var r=this;e.childNodes&&e.childNodes.forEach(e=>{r._cloneMarkers(e,t,n)}),Ns(e)&&Ds.forEach(function(i){if(P(e,i)){var a=As(e,i,r._canvas.getContainer());a&&r._cloneMarker(n,e,a,i,t)}})},ks.prototype._cloneMarker=function(e,t,n,r,i=`djs-dragger`){var a=[n.id,i,Es.next()].join(`-`),o=V(`marker#`+n.id,e);e||=this._canvas._svg;var s=o||De(n);s.id=a,I(s).add(i);var c=V(`:scope > defs`,e);c||(c=F(`defs`),L(e,c)),L(c,s);var l=Ms(s.id);P(t,r,l)};function As(e,t,n){var r=js(P(e,t));return V(`marker#`+r,n||document)}function js(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Ms(e){return`url(#`+e+`)`}function Ns(e){return Os.indexOf(e.nodeName)!==-1}var Ps={__init__:[`previewSupport`],previewSupport:[`type`,ks]},Fs=`complex-preview`,Is=class{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();let{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,a=this._canvas.getLayer(Fs);t.filter(e=>!Ls(e)).forEach(e=>{let t;A(e)?(t=this._graphicsFactory._createContainer(`connection`,F(`g`)),this._graphicsFactory.drawConnection(mt(t),e)):(t=this._graphicsFactory._createContainer(`shape`,F(`g`)),this._graphicsFactory.drawShape(mt(t),e),Bt(t,e.x,e.y)),this._previewSupport.addDragger(e,a,t)}),n.forEach(({element:e,delta:t})=>{this._previewSupport.addDragger(e,a,void 0,`djs-dragging`),this._canvas.addMarker(e,`djs-element-hidden`),this._markers.push([e,`djs-element-hidden`]);let n=this._previewSupport.addDragger(e,a);A(e)?Bt(n,t.x,t.y):Bt(n,e.x+t.x,e.y+t.y)}),r.forEach(e=>{this._previewSupport.addDragger(e,a,void 0,`djs-dragging`),this._canvas.addMarker(e,`djs-element-hidden`),this._markers.push([e,`djs-element-hidden`])}),i.forEach(({shape:e,bounds:t})=>{this._canvas.addMarker(e,`djs-hidden`),this._markers.push([e,`djs-hidden`]),this._previewSupport.addDragger(e,a,void 0,`djs-dragging`);let n=this._graphicsFactory._createContainer(`shape`,F(`g`));this._graphicsFactory.drawShape(mt(n),e,{width:t.width,height:t.height}),Bt(n,t.x,t.y),this._previewSupport.addDragger(e,a,n)})}cleanUp(){Oe(this._canvas.getLayer(Fs)),this._markers.forEach(([e,t])=>this._canvas.removeMarker(e,t)),this._markers=[]}show(){this._canvas.showLayer(Fs)}hide(){this._canvas.hideLayer(Fs)}};Is.$inject=[`canvas`,`graphicsFactory`,`previewSupport`];function Ls(e){return e.hidden}var Rs={__depends__:[Ps],__init__:[`complexPreview`],complexPreview:[`type`,Is]},zs=[`top`,`bottom`,`left`,`right`],Bs=10;function Vs(e,t){B.call(this,e),this.postExecuted([`connection.create`,`connection.layout`,`connection.updateWaypoints`],function(e){var t=e.context,r=t.connection,i=r.source,a=r.target;(t.hints||{}).createElementsBehavior!==!1&&(n(i),n(a))}),this.postExecuted([`label.create`],function(e){var t=e.context,r=t.shape;(t.hints||{}).createElementsBehavior!==!1&&n(r.labelTarget)}),this.postExecuted([`elements.create`],function(e){var t=e.context,r=t.elements;(t.hints||{}).createElementsBehavior!==!1&&r.forEach(function(e){n(e)})});function n(e){if(se(e)&&!A(e)&&!O(e,`bpmn:Group`)){var t=Ws(e);t&&r(e,t)}}function r(e,n){var r=M(e),i=e.label,a=M(i);if(i.parent){var o=N(e),s;switch(n){case`top`:s={x:r.x,y:o.top-Bs-i.height/2};break;case`left`:s={x:o.left-Bs-i.width/2,y:r.y};break;case`bottom`:s={x:r.x,y:o.bottom+Bs+i.height/2};break;case`right`:s={x:o.right+Bs+i.width/2,y:r.y}}var c=Ze(s,a);t.moveShape(i,c)}}}z(Vs,B),Vs.$inject=[`eventBus`,`modeling`];function Hs(e){var t=e.host,n=M(e),r=xe(n,t),i=r.indexOf(`-`)>=0?r.split(`-`):[r];return zs.filter(function(e){return i.indexOf(e)===-1})}function Us(e){var t=M(e);return[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return Gs(t,e)})}function Ws(e){var t=M(e.label),n=Gs(M(e),t);if(Ks(n)){var r=Us(e);if(e.host){var i=Hs(e);r=r.concat(i)}var a=zs.filter(function(e){return r.indexOf(e)===-1});return a.indexOf(n)===-1?a[0]:xe(e.label,e)===`intersect`?n:void 0}}function Gs(e,t){return xe(t,e,5)}function Ks(e){return zs.indexOf(e)!==-1}function qs(e){B.call(this,e),this.preExecute(`shape.append`,function(e){var t=e.source,n=e.shape;e.position||=O(n,`bpmn:TextAnnotation`)?{x:t.x+t.width/2+75,y:t.y-50-n.height/2}:{x:t.x+t.width+80+n.width/2,y:t.y+t.height/2}},!0)}z(qs,B),qs.$inject=[`eventBus`];var Js=1500;function Ys(e,t,n){e.invoke(B,this),this.preExecute(`elements.delete`,Js,function(e){var t=e.context,n=t.elements,i=r(n);i.length&&(t.elements=n.concat(i))}),t.on(`shape.move.start`,function(e){var t=e.context.shapes,n=r(t);n.length&&(e.context.shapes=t.concat(n))});function r(e){var t=u(e,e=>O(e,`bpmn:Participant`)||O(e,`bpmn:SubProcess`));if(!t.length)return[];var r=n.getRootElement(),a=new Set(r.children.filter(e=>O(e,`bpmn:Artifact`))),o=new Set;return b(t,e=>{let t=new Set(i(dt(Array.from(a),it(e))));o=o.union(t),a=a.difference(t)}),Array.from(o)}}z(Ys,B),Ys.$inject=[`injector`,`eventBus`,`canvas`];function Xs(e,t){e.invoke(B,this),this.postExecute(`shape.move`,function(e){var n=e.newParent,r=e.shape,i=u(r.incoming.concat(r.outgoing),function(e){return O(e,`bpmn:Association`)});b(i,function(e){t.moveConnection(e,{x:0,y:0},n)})},!0)}z(Xs,B),Xs.$inject=[`injector`,`modeling`];var Zs=500;function Qs(e,t){t.invoke(B,this),this._bpmnReplace=e;var n=this;this.postExecuted(`elements.create`,Zs,function(e){var t=e.elements;t=t.filter(function(e){var t=e.host;return ec(e,t)}),t.length===1&&t.map(function(e){return t.indexOf(e)}).forEach(function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)})},!0),this.preExecute(`elements.move`,Zs,function(e){var t=e.shapes,r=e.newHost;if(t.length===1){var i=t[0];ec(i,r)&&(e.shapes=[n._replaceShape(i,r)])}},!0)}Qs.$inject=[`bpmnReplace`,`injector`],z(Qs,B),Qs.prototype._replaceShape=function(e,t){var n=$s(e),r={type:`bpmn:BoundaryEvent`,host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function $s(e){var t=k(e).eventDefinitions;return t&&t[0]}function ec(e,t){return!j(e)&&E(e,[`bpmn:IntermediateThrowEvent`,`bpmn:IntermediateCatchEvent`])&&!!t}function tc(e,t){B.call(this,e);function n(e){return u(e.attachers,function(e){return O(e,`bpmn:BoundaryEvent`)})}this.postExecute(`connection.create`,function(e){var r=e.context.source,i=e.context.target,a=n(i);O(r,`bpmn:EventBasedGateway`)&&O(i,`bpmn:ReceiveTask`)&&a.length>0&&t.removeElements(a)}),this.postExecute(`connection.reconnect`,function(e){var r=e.context.oldSource,i=e.context.newSource;O(r,`bpmn:Gateway`)&&O(i,`bpmn:EventBasedGateway`)&&b(i.outgoing,function(e){var r=e.target,i=n(r);O(r,`bpmn:ReceiveTask`)&&i.length>0&&t.removeElements(i)})})}tc.$inject=[`eventBus`,`modeling`],z(tc,B);function nc(e){return e.create(`bpmn:Category`)}function rc(e){return e.create(`bpmn:CategoryValue`)}function ic(e,t){var n=t.get(`categoryValueRef`);return n||=t.categoryValueRef=rc(e),n.$parent||(n.$parent=nc(e)),n}function ac(e,t,n){return Ve(t.get(`categoryValue`),e),e.$parent=t,Ve(n.get(`rootElements`),t),t.$parent=n,e}function oc(e){var t=e.$parent;return t&&(Fe(t.get(`categoryValue`),e),e.$parent=null),e}function sc(e){var t=e.$parent;return t&&(Fe(t.get(`rootElements`),e),e.$parent=null),e}var cc=500;function lc(e,t,n){n.invoke(B,this);function r(e){return t.filter(function(e){return O(e,`bpmn:Group`)&&!e.labelTarget}).map(k).filter(function(t){return t!==e})}function i(e,t){return r(t).some(function(t){return t.get(`categoryValueRef`)===e})}function a(e,t){return r(t).some(function(t){var n=t.get(`categoryValueRef`);return n&&n.$parent===e})}function o(t,n){t&&n&&ac(t,n,e.getDefinitions())}function s(e,t,n){t&&!a(t,n)&&sc(t),e&&!i(e,n)&&oc(e)}this.executed([`shape.create`,`label.create`],function(e){var t=e.labelTarget||e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&o(e.categoryValue,e.category)},!0),this.reverted([`shape.create`,`label.create`],function(e){var t=e.labelTarget||e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&s(e.categoryValue,e.category,k(t))},!0),this.executed([`shape.move`,`shape.resize`],cc,function(e){o(e.categoryValue,e.category)},!0),this.reverted([`shape.move`,`shape.resize`],function(e){var t=e.shape;e.categoryValue&&s(e.categoryValue,e.category,k(t))},!0),this.executed(`group.updateRefs`,function(e){uc(e).forEach(function(e){o(e.categoryValue,e.category)})},!0),this.reverted(`group.updateRefs`,function(e){uc(e).forEach(function(e){s(e.categoryValue,e.category,k(e.groupShape))})},!0),this.executed(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&s(e.categoryValue,e.category,k(t))},!0),this.reverted(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:Group`)&&!t.labelTarget&&o(e.categoryValue,e.category)},!0)}lc.$inject=[`bpmnjs`,`elementRegistry`,`injector`],z(lc,B);function uc(e){return e.updates?.groups||[]}function dc(e,t,n){B.call(this,e),this.preExecute(`shape.replace`,s,!0),this.postExecuted(`shape.replace`,c,!0),this.preExecute(`connection.create`,i,!0),this.postExecuted(`connection.delete`,r,!0),this.postExecuted(`connection.reconnect`,a,!0),this.postExecuted(`element.updateProperties`,o,!0);function r(e){let t=e.source,n=e.target;pc(t)&&fc(n)&&u(n)}function i(e){let t=e.connection,n=e.source,r=e.target;pc(n)&&mc(r)&&(l(r),f(n,[t]))}function a(e){let t=e.newTarget,n=e.oldSource,r=e.oldTarget;if(r!==t){let e=n;fc(r)&&u(r),pc(e)&&mc(t)&&l(t)}}function o(e){let{element:t}=e;fc(t)?(d(t),p(t)):mc(t)&&m(t)}function s(e){let{newData:t,oldShape:n}=e;if(pc(e.oldShape)&&t.eventDefinitionType!==`bpmn:CompensateEventDefinition`||t.type!==`bpmn:BoundaryEvent`){let t=n.outgoing.find(({target:e})=>fc(e));t&&t.target&&(e._connectionTarget=t.target)}else if(!pc(e.oldShape)&&t.eventDefinitionType===`bpmn:CompensateEventDefinition`&&t.type===`bpmn:BoundaryEvent`){let t=n.outgoing.find(({target:e})=>mc(e));t&&t.target&&(e._connectionTarget=t.target),h(n)}}function c(e){let{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}function l(e){t.updateProperties(e,{isForCompensation:!0})}function u(e){t.updateProperties(e,{isForCompensation:void 0})}function d(e){for(let r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(let r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}function f(e,n){e.outgoing.filter(e=>O(e,`bpmn:Association`)).filter(e=>fc(e.target)&&!n.includes(e)).forEach(e=>t.removeConnection(e))}function p(e){let n=e.attachers.slice();n.length&&t.removeElements(n)}function m(e){let n=e.incoming.filter(e=>pc(e.source));t.removeElements(n)}function h(e){let n=e.outgoing.filter(e=>O(e,`bpmn:SequenceFlow`));t.removeElements(n)}}z(dc,B),dc.$inject=[`eventBus`,`modeling`,`bpmnRules`];function fc(e){let t=k(e);return t&&t.get(`isForCompensation`)}function pc(e){return e&&O(e,`bpmn:BoundaryEvent`)&&Ne(e,`bpmn:CompensateEventDefinition`)}function mc(e){return e&&O(e,`bpmn:Activity`)&&!Me(e)}function hc(e){e.invoke(B,this),this.preExecute(`shape.create`,1500,function(e){var t=e.context,n=t.parent,r=t.shape;O(n,`bpmn:Lane`)&&!O(r,`bpmn:Lane`)&&(t.parent=Ye(n,`bpmn:Participant`))})}hc.$inject=[`injector`],z(hc,B);function gc(e,t){B.call(this,e),this.preExecute(`shape.create`,function(e){var n=e.context.shape;if(O(n,`bpmn:DataObjectReference`)&&n.type!==`label`){var r=t.create(`bpmn:DataObject`);r.isCollection=n.businessObject.dataObjectRef?.isCollection||!1,n.businessObject.dataObjectRef=r}})}gc.$inject=[`eventBus`,`bpmnFactory`],z(gc,B);var _c=20,vc=20,yc=2e3;function bc(e,t,n){B.call(this,t),t.on([`create.start`,`shape.move.start`],yc,function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(O(r,`bpmn:Participant`)&&O(i,`bpmn:Process`)&&i.children.length){var a=i.children.filter(function(e){return!O(e,`bpmn:Group`)&&!j(e)&&!A(e)});if(a.length){var o=it(a),s=xc(r,o);T(r,s),n.createConstraints=Sc(r,o)}}}),t.on(`create.start`,yc,function(n){var r=n.context.shape,i=e.getRootElement(),a=e.getGraphics(i);function o(e){e.element=i,e.gfx=a}O(r,`bpmn:Participant`)&&O(i,`bpmn:Process`)&&(t.on(`element.hover`,yc,o),t.once(`create.cleanup`,function(){t.off(`element.hover`,o)}))});function r(){var t=e.getRootElement();return O(t,`bpmn:Collaboration`)?t:n.makeCollaboration()}this.preExecute(`elements.create`,yc,function(e){var t=e.elements,n=e.parent,i=Cc(t),a;i&&O(n,`bpmn:Process`)&&(e.parent=r(),a=e.hints=e.hints||{},a.participant=i,a.process=n,a.processRef=k(i).get(`processRef`))},!0),this.preExecute(`shape.create`,function(e){var t=e.parent,n=e.shape;O(n,`bpmn:Participant`)&&O(t,`bpmn:Process`)&&(e.parent=r(),e.process=t,e.processRef=k(n).get(`processRef`))},!0),this.execute(`shape.create`,function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;n&&(!i||r===i)&&k(r).set(`processRef`,k(n))},!0),this.revert(`shape.create`,function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,a=t.participant;n&&(!a||i===a)&&k(i).set(`processRef`,r)},!0),this.postExecute(`shape.create`,function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,a=t.participant;if(r){var o=r.children.slice();a?i===a&&n.moveElements(o,{x:0,y:0},a):n.moveElements(o,{x:0,y:0},i)}},!0)}bc.$inject=[`canvas`,`eventBus`,`modeling`],z(bc,B);function xc(e,t){t={width:t.width+_c*2+30,height:t.height+vc*2};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}function Sc(e,t){return t=N(t),{bottom:t.top+e.height/2-vc,left:t.right-e.width/2+_c,top:t.bottom-e.height/2+vc,right:t.left+e.width/2-_c-30}}function Cc(e){return C(e,function(e){return O(e,`bpmn:Participant`)})}var wc=`__targetRef_placeholder`;function Tc(e,t){B.call(this,e),this.executed([`connection.create`,`connection.delete`,`connection.move`,`connection.reconnect`],Ec(a)),this.reverted([`connection.create`,`connection.delete`,`connection.move`,`connection.reconnect`],Ec(a));function n(e,t,n){var r=e.get(`dataInputAssociations`);return C(r,function(e){return e!==n&&e.targetRef===t})}function r(e,n){var r=e.get(`properties`),i=C(r,function(e){return e.name===wc});return!i&&n&&(i=t.create(`bpmn:Property`,{name:wc}),Ve(r,i)),i}function i(e,t){var i=r(e);i&&(n(e,i,t)||Fe(e.get(`properties`),i))}function a(e){var t=e.context,n=t.connection,a=n.businessObject,o=n.target,s=o&&o.businessObject,c=t.newTarget,l=c&&c.businessObject,u=t.oldTarget||t.target,d=u&&u.businessObject,f=n.businessObject,p;d&&d!==s&&i(d,a),l&&l!==s&&i(l,a),s?(p=r(s,!0),f.targetRef=p):f.targetRef=null}}Tc.$inject=[`eventBus`,`bpmnFactory`],z(Tc,B);function Ec(e){return function(t){var n=t.context.connection;if(O(n,`bpmn:DataInputAssociation`))return e(t)}}function Dc(e){this._bpmnUpdater=e}Dc.$inject=[`bpmnUpdater`],Dc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},Dc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]};function Oc(e,t,n,r){B.call(this,r),t.registerHandler(`dataStore.updateContainment`,Dc);function i(){return n.filter(function(e){return O(e,`bpmn:Participant`)&&k(e).processRef})[0]}function a(e){return e.children.filter(function(e){return O(e,`bpmn:DataStoreReference`)&&!e.labelTarget})}function o(e,n){var r=e.businessObject||e;if(n||=i(),n){var a=n.businessObject||n;t.execute(`dataStore.updateContainment`,{dataStoreBo:r,dataStoreDi:D(e),newSemanticParent:a.processRef||a,newDiParent:D(n)})}}this.preExecute(`shape.create`,function(e){var t=e.context,n=t.shape;O(n,`bpmn:DataStoreReference`)&&n.type!==`label`&&(t.hints||={},t.hints.autoResize=!1)}),this.preExecute(`elements.move`,function(e){var t=e.context,n=t.shapes;n.filter(function(e){return O(e,`bpmn:DataStoreReference`)}).length&&(t.hints||={},t.hints.autoResize=n.filter(function(e){return!O(e,`bpmn:DataStoreReference`)}))}),this.postExecute(`shape.create`,function(e){var t=e.context.shape,n=t.parent;O(t,`bpmn:DataStoreReference`)&&t.type!==`label`&&O(n,`bpmn:Collaboration`)&&o(t)}),this.postExecute(`shape.move`,function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;O(r,`bpmn:Collaboration`)||O(n,`bpmn:DataStoreReference`)&&n.type!==`label`&&O(i,`bpmn:Collaboration`)&&o(n,O(r,`bpmn:Participant`)?r:Ac(r,`bpmn:Participant`))}),this.postExecute(`shape.delete`,function(t){var n=t.context.shape,r=e.getRootElement();E(n,[`bpmn:Participant`,`bpmn:SubProcess`])&&O(r,`bpmn:Collaboration`)&&a(r).filter(function(e){return kc(e,n)}).forEach(function(e){o(e)})}),this.postExecute(`canvas.updateRoot`,function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;a(n).forEach(function(e){O(r,`bpmn:Process`)&&o(e,r)})})}Oc.$inject=[`canvas`,`commandStack`,`elementRegistry`,`eventBus`],z(Oc,B);function kc(e,t){for(var n=e.businessObject||e,r=t.businessObject||t;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}function Ac(e,t){for(;e.parent;){if(O(e.parent,t))return e.parent;e=e.parent}}var jc=Math.max,Mc=Math.min,Nc=20;function Pc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Fc(e,t,n){var r=n.x,i=n.y,a={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(a.height=e.height+i):(a.y=e.y+i,a.height=e.height-i),t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(a.x=e.x+r,a.width=e.width-r):a.width=e.width+r,a}function Ic(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Lc(e,t,n){var r=t[e],i=n.min&&n.min[e],a=n.max&&n.max[e];return h(i)&&(r=(/top|left/.test(e)?Mc:jc)(r,i)),h(a)&&(r=(/top|left/.test(e)?jc:Mc)(r,a)),r}function Rc(e,t){if(!t)return e;var n=N(e);return Te({top:Lc(`top`,n,t),right:Lc(`right`,n,t),bottom:Lc(`bottom`,n,t),left:Lc(`left`,n,t)})}function zc(e,t,n,r){var i=N(t),a={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},o=r?N(r):a,s={top:Mc(a.top,o.top),left:Mc(a.left,o.left),bottom:jc(a.bottom,o.bottom),right:jc(a.right,o.right)};return Te(s)}function Bc(e,t){return e===void 0?Nc:e}function Vc(e,t){var n,r,i,a;return typeof t==`object`?(n=Bc(t.left),r=Bc(t.right),i=Bc(t.top),a=Bc(t.bottom)):n=r=i=a=Bc(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+a}}function Hc(e){return!(e.waypoints||e.type===`label`)}function Uc(e,t){var n=e.length===void 0?u(e.children,Hc):e;if(n.length)return Vc(it(n),t)}var Wc=Math.abs;function Gc(e,t){return Pc(N(t),N(e))}var Kc=[`bpmn:Participant`,`bpmn:Process`,`bpmn:SubProcess`];function qc(e,t){return t||=[],e.children.filter(function(e){O(e,`bpmn:Lane`)&&(qc(e,t),t.push(e))}),t}function Jc(e){return e.children.filter(function(e){return O(e,`bpmn:Lane`)})}function Yc(e){return Ye(e,Kc)||e}function Xc(e,t){var n=Yc(e),r=qc(n,O(n,`bpmn:Process`)?[]:[n]),i=N(e),a=N(t),o=Gc(e,t),s=[],c=He(e);return r.forEach(function(t){if(t!==e){var n=c?0:o.top,r=c?o.right:0,l=c?0:o.bottom,u=c?o.left:0,d=N(t);o.top&&(Wc(d.bottom-i.top)<10&&(l=a.top-d.bottom),Wc(d.top-i.top)<5&&(n=a.top-d.top)),o.left&&(Wc(d.right-i.left)<10&&(r=a.left-d.right),Wc(d.left-i.left)<5&&(u=a.left-d.left)),o.bottom&&(Wc(d.top-i.bottom)<10&&(n=a.bottom-d.top),Wc(d.bottom-i.bottom)<5&&(l=a.bottom-d.bottom)),o.right&&(Wc(d.left-i.right)<10&&(u=a.right-d.left),Wc(d.right-i.right)<5&&(r=a.right-d.right)),(n||r||l||u)&&s.push({shape:t,newBounds:Ic(t,{top:n,right:r,bottom:l,left:u})})}}),s}var Zc=500;function Qc(e,t){B.call(this,e);function n(e,n){var r=He(e),i=Jc(n),a=[],o=[],s=[],c=[];if(ht(i,function(t){return r?t.y>e.y?o.push(t):a.push(t):t.x>e.x?c.push(t):s.push(t),t.children}),i.length){var l=r?o.length&&a.length?e.height/2:e.height:c.length&&s.length?e.width/2:e.width,u,d,f,p;a.length&&(u=t.calculateAdjustments(a,`y`,l,e.y-10),t.makeSpace(u.movingShapes,u.resizingShapes,{x:0,y:l},`s`)),o.length&&(d=t.calculateAdjustments(o,`y`,-l,e.y+e.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},`n`)),s.length&&(f=t.calculateAdjustments(s,`x`,l,e.x-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},`e`)),c.length&&(p=t.calculateAdjustments(c,`x`,-l,e.x+e.width+10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:-l,y:0},`w`))}}this.postExecuted(`shape.delete`,Zc,function(e){var t=e.context,r=t.hints,i=t.shape,a=t.oldParent;O(i,`bpmn:Lane`)&&(r&&r.nested||n(i,a))})}Qc.$inject=[`eventBus`,`spaceTool`],z(Qc,B);var $c=500;function el(e,t){t.invoke(B,this),this._bpmnReplace=e;var n=this;this.postExecuted(`elements.create`,$c,function(e){var t=e.elements;t.filter(function(e){var t=e.host;return nl(e,t)}).map(function(e){return t.indexOf(e)}).forEach(function(r){e.elements[r]=n._replaceShape(t[r])})},!0),this.preExecute(`elements.move`,$c,function(e){var t=e.shapes,r=e.newHost;t.forEach(function(e,i){var a=e.host;nl(e,rl(t,a)?a:r)&&(t[i]=n._replaceShape(e))})},!0)}el.$inject=[`bpmnReplace`,`injector`],z(el,B),el.prototype._replaceShape=function(e){var t=tl(e),n=t?{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:t.$type}:{type:`bpmn:IntermediateThrowEvent`};return this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function tl(e){var t=k(e).eventDefinitions;return t&&t[0]}function nl(e,t){return!j(e)&&O(e,`bpmn:BoundaryEvent`)&&!t}function rl(e,t){return e.indexOf(t)!==-1}function il(e,t,n){B.call(this,e);function r(e,r,i){var a=r.waypoints,o,s,c,l,d,f,p,m=e.outgoing.slice(),g=e.incoming.slice(),_=h(i.width)?M(i):i,v=co(a,_);if(v){if(o=a.slice(0,v.index),s=a.slice(v.index+ +!!v.bendpoint),!o.length||!s.length)return;c=v.bendpoint?a[v.index]:_,(o.length===1||!al(e,o[o.length-1]))&&o.push(ol(c)),(s.length===1||!al(e,s[0]))&&s.unshift(ol(c))}l=r.source,d=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||_),f=r),t.canConnect(e,d,r)&&(f?p=n.connect(e,d,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||_),p=r));var y=[].concat(f&&u(g,function(e){return e.source===f.source})||[],p&&u(m,function(e){return e.target===p.target})||[]);y.length&&n.removeElements(y)}this.preExecute(`elements.move`,function(e){var n=e.newParent,r=e.shapes,i=e.delta,a=r[0];if(a&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var o=M(a),s={x:o.x+i.x,y:o.y+i.y},c=C(n.children,function(e){return t.canInsert(r,e)&&co(e.waypoints,s)});c&&(e.targetFlow=c,e.position=s)}},!0),this.postExecuted(`elements.move`,function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute(`shape.create`,function(e){var n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted(`shape.create`,function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}z(il,B),il.$inject=[`eventBus`,`bpmnRules`,`modeling`];function al(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function ol(e){return T({},e)}function sl(e,t){B.call(this,e),this.preExecuted(`connection.create`,function(e){var n=e.context,r=n.connection,i=n.source,a=n.target,o=n.hints;if(!(o&&o.createElementsBehavior===!1)&&cl(r)){var s=[];s=O(i,`bpmn:EventBasedGateway`)?a.incoming.filter(e=>e!==r&&cl(e)):a.incoming.filter(e=>e!==r&&cl(e)&&O(e.source,`bpmn:EventBasedGateway`)),s.forEach(function(e){t.removeConnection(e)})}}),this.preExecuted(`shape.replace`,function(e){var n=e.context.newShape;O(n,`bpmn:EventBasedGateway`)&&n.outgoing.filter(cl).reduce(function(e,t){return e.includes(t.target)?e:e.concat(t.target)},[]).forEach(function(e){e.incoming.filter(cl).forEach(function(r){let i=e.incoming.filter(cl).filter(function(e){return e.source===n});(r.source!==n||i.length>1)&&t.removeConnection(r)})})})}sl.$inject=[`eventBus`,`modeling`],z(sl,B);function cl(e){return O(e,`bpmn:SequenceFlow`)}var ll=1500,ul=2e3;function dl(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`],ll,function(t){var r=t.context.shape||t.shape,i=t.hover;O(i,`bpmn:Lane`)&&!E(r,[`bpmn:Lane`,`bpmn:Participant`])&&(t.hover=Yc(i),t.hoverGfx=e.getGraphics(t.hover));var a=n.getRootElement();i&&i!==a&&(r.labelTarget||E(r,[`bpmn:Group`,`bpmn:TextAnnotation`]))&&(t.hover=a,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`],ll,function(t){var n=t.hover;O(n,`bpmn:Lane`)&&(t.hover=Yc(n)||n,t.hoverGfx=e.getGraphics(t.hover))}),t.on([`bendpoint.move.hover`],ll,function(t){var n=t.context,r=t.hover,i=n.type;O(r,`bpmn:Lane`)&&/reconnect/.test(i)&&(t.hover=Yc(r)||r,t.hoverGfx=e.getGraphics(t.hover))}),t.on([`connect.start`],ll,function(e){var t=e.context,n=t.start;O(n,`bpmn:Lane`)&&(t.start=Yc(n)||n)}),t.on(`shape.move.start`,ul,function(e){var t=e.shape;O(t,`bpmn:Lane`)&&(e.shape=Yc(t)||t)}),t.on(`spaceTool.move`,ul,function(e){var t=e.hover;t&&O(t,`bpmn:Lane`)&&(e.hover=Yc(t))})}dl.$inject=[`elementRegistry`,`eventBus`,`canvas`];var fl=770;function pl(e,t,n,r){n.invoke(B,this);function i(t,n){var r=k(t),i=n.categoryValue||r.categoryValueRef;i||=ic(e,r);var a=n.category||i.$parent||nc(e);r.categoryValueRef=i,i.$parent=a,n.categoryValue=i,n.category=a}function a(e,t){var n=k(e),r=t.categoryValue||n.categoryValueRef,i=t.category||r&&r.$parent;r&&(t.categoryValue=r,t.category=i,n.categoryValueRef=null)}this.execute(`label.create`,function(e){var t=e.context,n=t.labelTarget;O(n,`bpmn:Group`)&&i(n,t)}),this.revert(`label.create`,function(e){var t=e.context,n=t.labelTarget;O(n,`bpmn:Group`)&&a(n,t)}),this.execute(`shape.delete`,function(e){var t=e.context,n=t.shape,r=k(n);if(O(n,`bpmn:Group`)&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(t.category=i.$parent,r.categoryValueRef=null)}}),this.reverted(`shape.delete`,function(e){var t=e.context,n=t.shape;if(O(n,`bpmn:Group`)&&!n.labelTarget){var r=t.category,i=t.categoryValue,a=k(n);i&&(a.categoryValueRef=i,i.$parent=r)}}),this.execute(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.hints||{};O(n,`bpmn:Group`)&&!n.labelTarget&&(r.createElementsBehavior!==!1||k(n).categoryValueRef||t.categoryValue)&&i(n,t)}),this.reverted(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.hints||{};O(n,`bpmn:Group`)&&!n.labelTarget&&(r.createElementsBehavior!==!1||k(n).categoryValueRef||t.categoryValue)&&a(n,t)}),this.executed([`shape.move`,`shape.resize`],function(e){var t=e.context,n=t.shape;!O(n,`bpmn:Group`)||n.labelTarget||k(n).categoryValueRef||i(n,t)}),this.reverted([`shape.move`,`shape.resize`],function(e){var t=e.context,n=t.shape;O(n,`bpmn:Group`)&&!n.labelTarget&&t.categoryValue&&a(n,t)});function o(t,n){var i=e.create(t.$type);return r.copyElement(t,i,null,n)}t.on(`copyPaste.copyElement`,fl,function(e){var t=e.descriptor,n=e.element;if(O(n,`bpmn:Group`)&&!n.labelTarget){var r=k(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=o(i,!0),i.$parent&&(t.category=o(i.$parent,!0))}}}),t.on(`copyPaste.pasteElement`,fl,function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&=n.categoryValueRef=o(r),i&&(r.$parent=o(i)),delete t.category,delete t.categoryValue})}pl.$inject=[`bpmnFactory`,`eventBus`,`injector`,`moddleCopy`],z(pl,B);function ml(e,t,n,r){var i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y),a,o,s,c;return i==0?null:(a=e.y-n.y,o=e.x-n.x,c=(r.x-n.x)*a-(r.y-n.y)*o,s=c/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function hl(e){function t(e,t,n){var r={x:n.x,y:n.y-50},i={x:n.x-50,y:n.y},a=ml(e,t,n,r),o=ml(e,t,n,i);e.original=a&&o?gl(a,n)>gl(o,n)?o:a:a||o}function n(e){var n=e.waypoints;t(n[0],n[1],M(e.source)),t(n[n.length-1],n[n.length-2],M(e.target))}e.on(`bpmnElement.added`,function(e){var t=e.element;t.waypoints&&n(t)})}hl.$inject=[`eventBus`];function gl(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function _l(e){B.call(this,e);var t=[`bpmn:Participant`,`bpmn:Lane`];this.executed([`shape.move`,`shape.create`,`shape.resize`],function(e){var n=e.context.shape,r=k(n),i=D(n);if(E(r,t)){var a=i.get(`isHorizontal`);a===void 0&&(a=!0),i.set(`isHorizontal`,a)}})}_l.$inject=[`eventBus`],z(_l,B);var vl=Math.sqrt,yl=Math.min,bl=Math.max,xl=Math.abs;function Sl(e){return e**2}function Cl(e,t){return vl(Sl(e.x-t.x)+Sl(e.y-t.y))}function wl(e,t){var n=0,r,i,a,o,s,c,l,u,d,f,p;for(n=0;n<t.length-1;n++){if(r=t[n],i=t[n+1],Al(r,i)?l=[r]:(a=Cl(e,r),o=Cl(e,i),c=yl(a,o),l=Tl(r,i,e,c)),l.length<1)throw Error(`expected between [1, 2] circle -> line intersections`);l.length===1&&(u={type:`bendpoint`,position:l[0],segmentIndex:n,bendpointIndex:Al(r,l[0])?n:n+1}),l.length===2&&(s=Ol(l[0],l[1]),u={type:`segment`,position:s,segmentIndex:n,relativeLocation:Cl(r,s)/Cl(r,i)}),d=Cl(u.position,e),(!p||f>d)&&(p=u,f=d)}return p}function Tl(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=n.x-e.x,s=n.y-e.y,c=i*i+a*a,l=i*o+a*s,u=o*o+s*s-r*r,d=l/c,f=u/c,p=d*d-f;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var m=vl(p),h=-d+m,g=-d-m,_={x:e.x-i*h,y:e.y-a*h};return p===0?[_]:[_,{x:e.x-i*g,y:e.y-a*g}].filter(function(n){return El(n,e,t)})}function El(e,t,n){return Dl(e.x,t.x,n.x)&&Dl(e.y,t.y,n.y)}function Dl(e,t,n){return e>=yl(t,n)-kl&&e<=bl(t,n)+kl}function Ol(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var kl=.1;function Al(e,t){return xl(e.x-t.x)<=kl&&xl(e.y-t.y)<=kl}function jl(e,t,n,r){var i=n.segmentIndex,a=t.length-e.length;if(r.segmentMove){var o=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===o?s:i>=s?i+a<s?s:i+a:i}if(r.bendpointMove){var c=r.bendpointMove.insert,l=r.bendpointMove.bendpointIndex,u;return a===0?i:(i>=l&&(u=c?i+1:i-1),i<l&&(u=i,c&&n.type!==`bendpoint`&&l-1===i&&Nl(t,l)<n.relativeLocation&&u++),u)}return a===0?i:r.connectionStart&&i===0?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Ml(e,t,n,r){var i=0,a=0,o={point:e,delta:{x:0,y:0}},s=wl(e,n),c=s.segmentIndex,l=jl(n,t,s,r);if(l<0||l>t.length-2||l===null)return o;var u=Fl(n,c),d=Fl(t,l),f=s.position,p=Il(u,f),m=Pl(u,d);if(s.type===`bendpoint`){var h=t.length-n.length,g=s.bendpointIndex,_=n[g];if(t.indexOf(_)!==-1)return o;if(h===0){var v=t[g];return i=v.x-s.position.x,a=v.y-s.position.y,{delta:{x:i,y:a},point:{x:e.x+i,y:e.y+a}}}h<0&&g!==0&&g<n.length-1&&(p=Nl(n,g))}var y={x:(d[1].x-d[0].x)*p+d[0].x,y:(d[1].y-d[0].y)*p+d[0].y},b=fo({x:e.x-f.x,y:e.y-f.y},m);return i=y.x+b.x-e.x,a=y.y+b.y-e.y,{point:he(y),delta:he({x:i,y:a})}}function Nl(e,t){var n=go(e[t-1],e[t]);return n/(n+go(e[t],e[t+1]))}function Pl(e,t){var n=uo(e);return uo(t)-n}function Fl(e,t){return[e[t],e[t+1]]}function Il(e,t){var n=go(e[0],e[1]),r=go(e[0],t);return n===0?0:r/n}function Ll(e,t,n,r){return Ml(M(e),t,n,r).delta}function Rl(e,t,n){var r=Xe(t),i=Xe(n),a=Ze(e,r),o={x:a.x*(n.width/t.width),y:a.y*(n.height/t.height)};return he({x:i.x+o.x,y:i.y+o.y})}function zl(e,t,n){var r=Xe(e),i=Xe(t),a=Xe(n),o=Ze(e,r),s=Ze(r,i),c=Bl(r,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:a.x+l.x,y:a.y+l.y};return he({x:u.x+o.x-e.x,y:u.y+o.y-e.y})}function Bl(e,t,n){var r=N(t),i=N(n);if(Vl(r,i))return null;var a=xe(t,e),o,s,c;if(a===`top`)o={x:0,y:i.bottom-r.bottom};else if(a===`bottom`)o={x:0,y:i.top-r.top};else if(a===`right`)o={x:i.left-r.left,y:0};else if(a===`left`)o={x:i.right-r.right,y:0};else return null;return s={x:e.x+o.x,y:e.y+o.y},c=xe(n,s),c===a?o:null}function Vl(e,t){return Hl(e,t)||Ul(e,t)}function Hl(e,t){return e.right!==t.right&&e.left!==t.left}function Ul(e,t){return e.top!==t.top&&e.bottom!==t.bottom}function Wl(e,t){if(t.length)return Jl(e,ql(e,t))}function Gl(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function Kl(e){for(var t=[],n=0;n<e.length-1;n++)t.push([e[n],e[n+1]]);return t}function ql(e,t){var n=t.map(function(t){return{line:t,distance:go(e,Jl(e,t))}});return y(n,`distance`)[0].line}function Jl(e,t){var n=t[0],r=t[1],i=r.x-n.x,a=r.y-n.y,o=i*i+a*a;if(o===0)return{x:n.x,y:n.y};var s=((e.x-n.x)*i+(e.y-n.y)*a)/o;return s=Math.max(0,Math.min(1,s)),{x:n.x+s*i,y:n.y+s*a}}var Yl=`name`,Xl=`text`;function Zl(e,t,n,r){B.call(this,e),this.postExecute(`element.updateProperties`,i),this.postExecute(`element.updateModdleProperties`,e=>{k(e.context.element)===e.context.moddleElement&&i(e)});function i(e){var n=e.context,i=n.element,a=n.properties;if(Yl in a&&t.updateLabel(i,a[Yl]),Xl in a&&O(i,`bpmn:TextAnnotation`)){var o=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},a[Xl]||``);t.updateLabel(i,a.text,o)}}this.postExecute([`shape.create`,`connection.create`],function(e){var n=e.context;if((n.hints||{}).createElementsBehavior!==!1){var r=n.shape||n.connection;!j(r)&&pe(r)&&ue(r)&&t.updateLabel(r,ue(r))}}),this.postExecute(`shape.delete`,function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&i.unsetLabel!==!1&&t.updateLabel(r,null,null,{removeShape:!1})});function a(e){var t=e.context,n=t.connection,r=n.label,i=T({},t.hints),a=t.newWaypoints||n.waypoints,o=t.oldWaypoints;return i.startChanged===void 0&&(i.startChanged=!!i.connectionStart),i.endChanged===void 0&&(i.endChanged=!!i.connectionEnd),Ll(r,a,o,i)}this.postExecute([`connection.layout`,`connection.updateWaypoints`],function(e){var n=e.context;if((n.hints||{}).labelBehavior!==!1){var r=n.connection.label,i;r&&r.parent&&(i=a(e),t.moveShape(r,i))}}),this.postExecute([`shape.replace`],function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=k(n);i&&pe(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)}),this.preExecute(`shape.resize`,function(e){var t=e.context,n=t.shape,i=t.hints||{};if(j(n)&&!i.autoResize){var a=t.newBounds,o=r.getDimensions(ue(n)||``,{box:a,style:r.getExternalStyle()}),s=Math.ceil(o.height),c=a.y!==n.y,l=n.y+n.height;t.newBounds={width:a.width,height:s,x:a.x,y:c?l-s:a.y}}}),this.postExecute(`shape.resize`,function(e){var n=e.context,r=n.shape,i=n.newBounds,a=n.oldBounds;if(se(r)){var o=r.label,s=Ql(Wl(M(o),Gl(a)),a,i);t.moveShape(o,s)}})}z(Zl,B),Zl.$inject=[`eventBus`,`modeling`,`bpmnFactory`,`textRenderer`];function Ql(e,t,n){var r=Rl(e,t,n);return he(Ze(r,e))}function $l(e,t,n,r){return Ml(e,t,n,r).point}function eu(e,t){B.call(this,e);function n(e,t){var n=e.context,r=n.connection,i=T({},n.hints),a=n.newWaypoints||r.waypoints,o=n.oldWaypoints;return i.startChanged===void 0&&(i.startChanged=!!i.connectionStart),i.endChanged===void 0&&(i.endChanged=!!i.connectionEnd),$l(t,a,o,i)}this.postExecute([`connection.layout`,`connection.updateWaypoints`],function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach(function(r){var i=r.waypoints[r.waypoints.length-1],a=n(e,i),o=[].concat(r.waypoints.slice(0,-1),[a]);t.updateWaypoints(r,o)}),i.forEach(function(r){var i=r.waypoints[0],a=[n(e,i)].concat(r.waypoints.slice(1));t.updateWaypoints(r,a)})}),this.postExecute([`connection.move`],function(e){var n=e.context,r=n.connection,i=r.outgoing,a=r.incoming,o=n.delta;a.forEach(function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+o.x,y:n.y+o.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)}),i.forEach(function(e){var n=e.waypoints[0],r=[{x:n.x+o.x,y:n.y+o.y}].concat(e.waypoints.slice(1));t.updateWaypoints(e,r)})})}z(eu,B),eu.$inject=[`eventBus`,`modeling`];function tu(e,t,n){var r=ou(e),i=su(r,t),a=r[0];return i.length?i[i.length-1]:Rl(a.original||a,n,t)}function nu(e,t,n){var r=ou(e),i=su(r,t),a=r[r.length-1];return i.length?i[0]:Rl(a.original||a,n,t)}function ru(e,t,n){var r=ou(e),i=au(t,n),a=r[0];return Rl(a.original||a,i,t)}function iu(e,t,n){var r=ou(e),i=au(t,n),a=r[r.length-1];return Rl(a.original||a,i,t)}function au(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ou(e){var t=e.waypoints;if(!t.length)throw Error(`connection#`+e.id+`: no waypoints`);return t}function su(e,t){var n=ae(e,lu);return u(n,function(e){return cu(e,t)})}function cu(e,t){return xe(t,e,1)===`intersect`}function lu(e){return e.original||e}function uu(e,t){B.call(this,e),this.postExecute(`shape.replace`,function(e){var n=e.oldShape,r=e.newShape;if(du(n,r)){var i=fu(n);i.incoming.forEach(function(e){var i=nu(e,r,n);t.reconnectEnd(e,r,i)}),i.outgoing.forEach(function(e){var i=tu(e,r,n);t.reconnectStart(e,r,i)})}},!0)}uu.$inject=[`eventBus`,`modeling`],z(uu,B);function du(e,t){return O(e,`bpmn:Participant`)&&R(e)&&O(t,`bpmn:Participant`)&&!R(t)}function fu(e){var t=et([e],!1),n=[],r=[];return t.forEach(function(t){t!==e&&(t.incoming.forEach(function(e){O(e,`bpmn:MessageFlow`)&&n.push(e)}),t.outgoing.forEach(function(e){O(e,`bpmn:MessageFlow`)&&r.push(e)}))},[]),{incoming:n,outgoing:r}}var pu=[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:EscalationEventDefinition`,`bpmn:ConditionalEventDefinition`,`bpmn:SignalEventDefinition`];function mu(e){let t=k(e);if(!O(t,`bpmn:BoundaryEvent`)&&!(O(t,`bpmn:StartEvent`)&&Me(t.$parent)))return!1;let n=t.get(`eventDefinitions`);return!n||!n.length?!1:pu.some(e=>O(n[0],e))}function hu(e){return O(e,`bpmn:BoundaryEvent`)?`cancelActivity`:`isInterrupting`}function gu(e,t){e.invoke(B,this),this.postExecuted(`shape.replace`,function(e){let n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!mu(r))return;let a=hu(r);if(i.targetElement&&i.targetElement[a]!==void 0)return;let o=k(n).get(a);o!==k(r).get(a)&&t.updateProperties(r,{[a]:o})})}gu.$inject=[`injector`,`modeling`],z(gu,B);function _u(e,t){B.call(this,e),this.preExecute(`shape.resize`,function(e){var n=e.shape,r=D(n),i=r&&r.get(`label`);i&&i.get(`bounds`)&&t.updateModdleProperties(n,i,{bounds:void 0})},!0)}z(_u,B),_u.$inject=[`eventBus`,`modeling`];function vu(e,t,n){B.call(this,e),this.preExecute(`shape.delete`,function(e){var r=e.context.shape;if(r.incoming.length===1&&r.outgoing.length===1){var i=r.incoming[0],a=r.outgoing[0];if(O(i,`bpmn:SequenceFlow`)&&O(a,`bpmn:SequenceFlow`)&&t.canConnect(i.source,a.target,i)){var o=bu(i.waypoints,a.waypoints);n.reconnectEnd(i,a.target,o)}}})}z(vu,B),vu.$inject=[`eventBus`,`bpmnRules`,`modeling`];function yu(e){return e.original||e}function bu(e,t){var n=ml(yu(e[e.length-2]),yu(e[e.length-1]),yu(t[1]),yu(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yu(e[0]),yu(t[t.length-1])]}function xu(e,t){B.call(this,e),this.preExecute(`shape.delete`,function(e){var t=e.shape,n=t.parent;O(t,`bpmn:Participant`)&&(e.collaborationRoot=n)},!0),this.postExecute(`shape.delete`,function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}},!0)}xu.$inject=[`eventBus`,`modeling`],z(xu,B);function Su(e,t,n,r){B.call(this,e);var i=r.get(`dragging`,!1);function a(e){var r=e.source,i=e.target;if(e.parent){var a,o;O(e,`bpmn:SequenceFlow`)&&(n.canConnectSequenceFlow(r,i)||(o=!0),n.canConnectMessageFlow(r,i)&&(a=`bpmn:MessageFlow`)),O(e,`bpmn:MessageFlow`)&&(n.canConnectMessageFlow(r,i)||(o=!0),n.canConnectSequenceFlow(r,i)&&(a=`bpmn:SequenceFlow`)),o&&t.removeConnection(e),a&&t.connect(r,i,{type:a,waypoints:e.waypoints.slice()})}}function o(e){var r=e.context,a=r.connection,o=r.newSource||a.source,s=r.newTarget||a.target,l=n.canConnect(o,s),u;l&&l.type!==a.type&&(u=t.connect(o,s,{type:l.type,associationDirection:l.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),r.connection=u,i&&c(a,u))}function c(e,t){var n=i.context(),r=n&&n.payload.previousSelection,a;r&&r.length&&(a=r.indexOf(e),a!==-1&&r.splice(a,1,t))}this.postExecuted(`elements.move`,function(e){var t=e.closure.allConnections;b(t,a)},!0),this.preExecute(`connection.reconnect`,o),this.postExecuted(`element.updateProperties`,function(e){var n=e.context,r=n.properties,i=n.element,a=i.businessObject,o;r.default&&(o=C(i.outgoing,s({id:i.businessObject.default.id})),o&&t.updateProperties(o,{conditionExpression:void 0})),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(i.source,{default:void 0})})}z(Su,B),Su.$inject=[`eventBus`,`modeling`,`bpmnRules`,`injector`];function Cu(e,t,n,r,i,a){r.invoke(B,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=a,this.postExecuted([`elements.create`],500,function(e){var n=e.context,r=n.parent,i=n.elements,a=c(i,function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e},[]);a.length&&this._replaceElements(i,a)},this),this.postExecuted([`elements.move`],500,function(e){var n=e.context,r=n.newParent,i=n.newHost,a=[];b(n.closure.topLevel,function(e){a=Me(e)?a.concat(e.children):a.concat(e)}),a.length===1&&i&&(r=i);var o=t.canReplace(a,r);o&&this._replaceElements(a,o.replacements,i)},this),this.postExecute([`shape.replace`],1500,function(e){var n=e.context,r=n.oldShape,i=n.newShape,a=r.attachers,o;a&&a.length&&(o=t.canReplace(a,i),this._replaceElements(a,o.replacements))},this),this.postExecuted([`shape.replace`],1500,function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})})}z(Cu,B),Cu.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;b(t,function(t){var i={type:t.newElementType},a=n.get(t.oldElementId),o=e.indexOf(a);e[o]=r.replaceElement(a,i,{select:!1})}),t&&i.select(e)},Cu.$inject=[`bpmnReplace`,`bpmnRules`,`elementRegistry`,`injector`,`modeling`,`selection`];var wu=1500,Tu={width:140,height:120},Eu={width:300,height:60},Du={width:60,height:300},Ou={width:300,height:150},ku={width:150,height:300},Au={width:140,height:120},ju={width:100,height:40};function Mu(e){e.on(`resize.start`,wu,function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(O(n,`bpmn:Lane`)||O(n,`bpmn:Participant`))&&(t.resizeConstraints=Vu(n,r,i)),O(n,`bpmn:SubProcess`)&&R(n)&&(t.minDimensions=Au),O(n,`bpmn:TextAnnotation`)&&(t.minDimensions=ju)})}Mu.$inject=[`eventBus`];var Nu=Math.abs,Pu=Math.min,Fu=Math.max;function Iu(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function Lu(e,t,n){return Iu(e,t,n,Pu)}function Ru(e,t,n){return Iu(e,t,n,Fu)}var zu={top:20,left:50,right:20,bottom:20},Bu={top:50,left:20,right:20,bottom:20};function Vu(e,t,n){var r=Yc(e),i=!0,a=!0,o=qc(r,[r]),s=N(e),c={},l={},u=He(e),d=u?Eu:Du;/n/.test(t)?l.top=s.bottom-d.height:/e/.test(t)?l.right=s.left+d.width:/s/.test(t)?l.bottom=s.top+d.height:/w/.test(t)&&(l.left=s.right-d.width),o.forEach(function(e){var r=N(e);u?(r.top<s.top-10&&(i=!1),r.bottom>s.bottom+10&&(a=!1)):(r.left<s.left-10&&(i=!1),r.right>s.right+10&&(a=!1)),/n/.test(t)&&(n&&Nu(s.top-r.bottom)<10&&Ru(c,`top`,r.top+d.height),Nu(s.top-r.top)<5&&Lu(l,`top`,r.bottom-d.height)),/e/.test(t)&&(n&&Nu(s.right-r.left)<10&&Lu(c,`right`,r.right-d.width),Nu(s.right-r.right)<5&&Ru(l,`right`,r.left+d.width)),/s/.test(t)&&(n&&Nu(s.bottom-r.top)<10&&Lu(c,`bottom`,r.bottom-d.height),Nu(s.bottom-r.bottom)<5&&Ru(l,`bottom`,r.top+d.height)),/w/.test(t)&&(n&&Nu(s.left-r.right)<10&&Ru(c,`left`,r.left+d.width),Nu(s.left-r.left)<5&&Lu(l,`left`,r.right-d.width))});var f=r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(O(e,`bpmn:FlowElement`)||O(e,`bpmn:Artifact`))}),p=u?zu:Bu;return f.forEach(function(e){var n=N(e);/n/.test(t)&&(!u||i)&&Lu(l,`top`,n.top-p.top),/e/.test(t)&&(u||a)&&Ru(l,`right`,n.right+p.right),/s/.test(t)&&(!u||a)&&Ru(l,`bottom`,n.bottom+p.bottom),/w/.test(t)&&(u||i)&&Lu(l,`left`,n.left-p.left)}),{min:l,max:c}}var Hu=1001;function Uu(e,t){e.on(`resize.start`,Hu+500,function(e){var t=e.context,n=t.shape;(O(n,`bpmn:Lane`)||O(n,`bpmn:Participant`))&&(t.balanced=!Pt(e))}),e.on(`resize.end`,Hu,function(e){var n=e.context,r=n.shape,i=n.canExecute,a=n.newBounds;if(O(r,`bpmn:Lane`)||O(r,`bpmn:Participant`))return i&&(a=we(a),t.resizeLane(r,a,n.balanced)),!1})}Uu.$inject=[`eventBus`,`modeling`];var Wu=500;function Gu(e,t,n,r,i){n.invoke(B,this);function a(e){return E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`])||Ku(e,[`bpmn:ErrorEventDefinition`,`bpmn:EscalationEventDefinition`,`bpmn:MessageEventDefinition`,`bpmn:SignalEventDefinition`])}function o(t){var n=e.getDefinitions().get(`rootElements`);return!!C(n,s({id:t.id}))}function c(e){if(O(e,`bpmn:ErrorEventDefinition`))return`errorRef`;if(O(e,`bpmn:EscalationEventDefinition`))return`escalationRef`;if(O(e,`bpmn:MessageEventDefinition`))return`messageRef`;if(O(e,`bpmn:SignalEventDefinition`))return`signalRef`}function l(e){if(E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`]))return e.get(`messageRef`);var t=e.get(`eventDefinitions`)[0];return t.get(c(t))}function u(e,t){if(E(e,[`bpmn:ReceiveTask`,`bpmn:SendTask`]))return e.set(`messageRef`,t);var n=e.get(`eventDefinitions`)[0];return n.set(c(n),t)}this.executed([`shape.create`,`element.updateProperties`,`element.updateModdleProperties`],function(t){var n=t.shape||t.element;if(a(n)){var r=l(k(n)),i;r&&!o(r)&&(i=e.getDefinitions().get(`rootElements`),Ve(i,r),t.addedRootElement=r)}},!0),this.reverted([`shape.create`,`element.updateProperties`,`element.updateModdleProperties`],function(t){var n=t.addedRootElement;if(n){var r=e.getDefinitions().get(`rootElements`);Fe(r,n)}},!0),t.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&a(n)){var r=l(k(n));r&&(t.referencedRootElement=r)}}),t.on(`copyPaste.pasteElement`,Wu,function(e){var t=e.descriptor,n=t.businessObject,a=t.referencedRootElement;a&&(o(a)||(a=r.copyElement(a,i.create(a.$type))),u(n,a),delete t.referencedRootElement)})}Gu.$inject=[`bpmnjs`,`eventBus`,`injector`,`moddleCopy`,`bpmnFactory`],z(Gu,B);function Ku(e,t){return m(t)||(t=[t]),o(t,function(t){return Ne(e,t)})}var qu=Math.max;function Ju(e){e.on(`spaceTool.getMinDimensions`,function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return b(t,function(e){var t=e.id;O(e,`bpmn:Participant`)&&(i[t]=Xu(e,n,r)),O(e,`bpmn:Lane`)&&(i[t]=He(e)?Eu:Du),O(e,`bpmn:SubProcess`)&&R(e)&&(i[t]=Au),O(e,`bpmn:TextAnnotation`)&&(i[t]=ju),O(e,`bpmn:Group`)&&(i[t]=Tu)}),i})}Ju.$inject=[`eventBus`];function Yu(e){return e===`x`}function Xu(e,t,n){var r=He(e);if(!$u(e))return r?Ou:ku;var i=Yu(t),a={};return a=i?r?Ou:{width:Qu(e,n,i),height:ku.height}:r?{width:Ou.width,height:Zu(e,n,i)}:ku,a}function Zu(e,t,n){var r=ed(e,t,n);return qu(Ou.height,r)}function Qu(e,t,n){var r=td(e,t,n);return qu(ku.width,r)}function $u(e){return!!Jc(e).length}function ed(e,t,n){var r=nd(Jc(e),t,n);return e.height-r.height+Eu.height}function td(e,t,n){var r=nd(Jc(e),t,n);return e.width-r.width+Du.width}function nd(e,t,n){for(var r=0,i,a;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return a=Jc(i),a.length?nd(a,t,n):i}var rd=400,id=600,ad={x:180,y:160};function od(e,t,n,r,i,a,o){B.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=a,this._elementRegistry=o;var s=this;function c(e){return O(e,`bpmn:SubProcess`)&&!R(e)}function l(t){var n=t.shape,r=t.newRootElement,i=k(n);r=s._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function u(t){var n=t.shape,r=k(n);s._removeDiagram(r);var i=t.newRootElement=o.get(qe(r));e.removeRootElement(i)}this.executed(`shape.create`,function(e){var t=e.shape;c(t)&&l(e)},!0),this.postExecuted(`elements.create`,function(e){var t=e.elements;b(t,function(e){if(c(e)){var t=o.get(qe(e));if(t&&e.children&&e.children.length){var n=cd(e);s._showRecursively(n),s._moveChildrenToShape(n,t)}}})},!0),this.reverted(`shape.create`,function(e){var t=e.shape;c(t)&&u(e)},!0),this.preExecute(`shape.delete`,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&R(t)&&b(wt([t]),e=>{n.removeShape(e.annotation)})},!0),this.preExecuted(`shape.delete`,function(e){var t=e.shape;if(c(t)){var r=o.get(qe(t));r&&n.removeElements(r.children.slice())}},!0),this.executed(`shape.delete`,function(e){var t=e.shape;c(t)&&u(e)},!0),this.reverted(`shape.delete`,function(e){var t=e.shape;c(t)&&l(e)},!0),this.preExecuted(`shape.replace`,function(t){var n=t.oldShape,r=t.newShape;c(n)&&c(r)&&(t.oldRoot=e.removeRootElement(qe(n)))},!0),this.postExecuted(`shape.replace`,function(t){var r=t.newShape,i=t.oldRoot,a=e.findRoot(qe(r));if(i&&a){var o=i.children;n.moveElements(o,{x:0,y:0},a)}},!0),this.executed(`element.updateProperties`,function(e){var t=e.element;if(O(t,`bpmn:SubProcess`)){var n=e.properties,r=e.oldProperties.id,i=n.id;r!==i&&(Ke(t)?(o.updateId(t,Ie(i)),o.updateId(r,i)):o.get(Ie(r))&&o.updateId(Ie(r),Ie(i)))}},!0),this.reverted(`element.updateProperties`,function(e){var t=e.element;if(O(t,`bpmn:SubProcess`)){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(Ke(t))o.updateId(t,Ie(r)),o.updateId(i,r);else{var a=o.get(Ie(i));a&&o.updateId(a,Ie(r))}}}},!0),t.on(`element.changed`,function(e){var n=e.element;if(Ke(n)){var r=n,i=o.get(ze(r));i&&i!==r&&t.fire(`element.changed`,{element:i})}}),this.executed(`shape.toggleCollapse`,rd,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&(R(t)?u(e):(l(e),s._showRecursively(t.children)))},!0),this.reverted(`shape.toggleCollapse`,rd,function(e){var t=e.shape;O(t,`bpmn:SubProcess`)&&(R(t)?u(e):(l(e),s._showRecursively(t.children)))},!0),this.postExecuted(`shape.toggleCollapse`,id,function(e){var t=e.shape;if(O(t,`bpmn:SubProcess`)){var r=e.newRootElement;if(r){if(R(t))s._moveChildrenToShape(r.children.slice(),t),b(wt(t.children),e=>{n.moveShape(e.annotation,{x:0,y:0},t.parent),b(e.associations,e=>{n.moveConnection(e,{x:0,y:0},t.parent)})});else{s._disconnectSharedAnnotations(t);var i=cd(t);s._moveChildrenToShape(i,r)}}}},!0),t.on(`copyPaste.createTree`,function(e){var t=e.element,n=e.children;if(c(t)){var r=qe(t),i=o.get(r);i&&n.push.apply(n,i.children)}}),t.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(O(D(i),`bpmndi:BPMNPlane`)){var a=ze(i),o=C(r,function(e){return e.id===a});o&&(t.parent=o.id)}}),t.on(`copyPaste.pasteElement`,function(e){var t=e.descriptor;t.parent&&(c(t.parent)||t.parent.hidden)&&(t.hidden=!0)})}z(od,B),od.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var r=e.filter(function(e){return!e.hidden});if(!r.length)n.moveElements(e,{x:0,y:0},t,{autoResize:!1});else{var i=it(r),a;if(!t.x)a={x:ad.x-i.x,y:ad.y-i.y};else{var o=M(t),s=M(i);a={x:o.x-s.x,y:o.y-s.y}}n.moveElements(e,a,t,{autoResize:!1})}}},od.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(vt(e).map(e=>e.annotation));n.size&&b(wt(e.children),e=>{n.has(e.annotation)&&b(e.associations,e=>{t.removeConnection(e)})})},od.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach(function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))}),r},od.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},od.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create(`bpmndi:BPMNPlane`,{bpmnElement:e});return r.$parent=t.create(`bpmndi:BPMNDiagram`,{plane:r}),n.createRoot({id:qe(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},od.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=C(t,function(t){return t.plane.bpmnElement.id===e.id});return t.splice(t.indexOf(n),1),n},od.$inject=[`canvas`,`eventBus`,`modeling`,`elementFactory`,`bpmnFactory`,`bpmnjs`,`elementRegistry`];function sd(e){var t=[];return b(wt(e),e=>{t.push(e.annotation),t.push.apply(t,e.associations)}),t}function cd(e){return e.children.slice().concat(sd(e.children)).concat(ld(e))}function ld(e){return Dt(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ud(e,t){e.invoke(B,this),this.postExecuted(`shape.replace`,function(e){var n=e.context.oldShape,r=e.context.newShape;if(O(r,`bpmn:SubProcess`)&&!O(r,`bpmn:AdHocSubProcess`)&&(O(n,`bpmn:Task`)||O(n,`bpmn:CallActivity`))&&R(r)){var i=dd(r);t.createShape({type:`bpmn:StartEvent`},i,r)}})}ud.$inject=[`injector`,`modeling`],z(ud,B);function dd(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function fd(e,t){B.call(this,e),this.preExecute(`connection.create`,function(e){let{target:t}=e;O(t,`bpmn:TextAnnotation`)&&(e.parent=t.parent)},!0),this.preExecute([`shape.create`,`shape.resize`,`elements.move`],function(e){let t=e.shapes||[e.shape];t.length===1&&O(t[0],`bpmn:TextAnnotation`)&&(e.hints=e.hints||{},e.hints.autoResize=!1)},!0),this.preExecute(`shape.resize`,function(e){var n=e.context,r=n.shape,i=n.hints||{};if(O(r,`bpmn:TextAnnotation`)&&!i.autoResize){var a=n.newBounds,o=t.getTextAnnotationBounds(a,ue(r)||``),s=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,c=r.y+r.height;n.newBounds={width:a.width,height:o.height,x:a.x,y:s?c-o.height:a.y}}})}z(fd,B),fd.$inject=[`eventBus`,`textRenderer`];function pd(e,t){B.call(this,e),this.postExecuted(`shape.toggleCollapse`,1500,function(e){var n=e.shape;if(R(n))return;var r=et(n);r.forEach(function(e){var t=e.incoming.slice(),n=e.outgoing.slice();b(t,function(e){i(e,!0)}),b(n,function(e){i(e,!1)})});function i(e,i){(r.indexOf(e.source)===-1||r.indexOf(e.target)===-1)&&(O(e,`bpmn:Association`)&&(O(e.source,`bpmn:TextAnnotation`)||O(e.target,`bpmn:TextAnnotation`))||(i?t.reconnectEnd(e,n,M(n)):t.reconnectStart(e,n,M(n))))}},!0)}z(pd,B),pd.$inject=[`eventBus`,`modeling`];var md=500;function hd(e,t,n){B.call(this,e);function r(e){e.length&&e.forEach(function(e){e.type===`label`&&!e.businessObject.name&&(e.hidden=!0)})}function i(e,t){var n=e.children,r=t,i=Uc(gd(n).concat([e]));return i?(r.width=Math.max(i.width,r.width),r.height=Math.max(i.height,r.height),r.x=i.x+(i.width-r.width)/2,r.y=i.y+(i.height-r.height)/2):(r.x=e.x+(e.width-r.width)/2,r.y=e.y+(e.height-r.height)/2),r}function a(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}}this.executed([`shape.toggleCollapse`],md,function(e){var t=e.context.shape;O(t,`bpmn:SubProcess`)&&(t.collapsed?D(t).isExpanded=!1:(r(t.children),D(t).isExpanded=!0))}),this.reverted([`shape.toggleCollapse`],md,function(e){var t=e.context.shape;t.collapsed?D(t).isExpanded=!1:D(t).isExpanded=!0}),this.postExecuted([`shape.toggleCollapse`],md,function(e){var r=e.context.shape,o=t.getDefaultSize(r),s=r.collapsed?a(r,o):i(r,o);n.resizeShape(r,s,null,{autoResize:!r.collapsed&&`nwse`})})}z(hd,B),hd.$inject=[`eventBus`,`elementFactory`,`modeling`];function gd(e){return e.filter(function(e){return!e.hidden})}function _d(e,t,n,r){t.invoke(B,this),this.preExecute(`shape.delete`,function(e){var t=e.context.shape,i=t.businessObject;j(t)||(O(t,`bpmn:Participant`)&&R(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))}),this.preExecute(`connection.delete`,function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)}),this.preExecute(`canvas.updateRoot`,function(){var t=e.getRootElement(),r=t.businessObject;O(t,`bpmn:Collaboration`)&&n.ids.unclaim(r.id)})}z(_d,B),_d.$inject=[`canvas`,`injector`,`moddle`,`modeling`];function vd(e,t){B.call(this,e),this.preExecute(`connection.delete`,function(e){var n=e.context.connection,r=n.source;yd(n,r)&&t.updateProperties(r,{default:null})})}z(vd,B),vd.$inject=[`eventBus`,`modeling`];function yd(e,t){if(!O(e,`bpmn:SequenceFlow`))return!1;var n=k(t),r=k(e);return n.get(`default`)===r}var bd=500,xd=5e3,Sd=[`shape.create`,`shape.delete`,`shape.move`,`shape.resize`],Cd=[...Sd,`spaceTool`,`lane.add`,`lane.resize`,`lane.split`,`elements.create`,`elements.delete`,`elements.move`];function wd(e,t){B.call(this,e);var n;function r(){return n||=new Td,n.enter(),n}function i(){if(!n)throw Error(`out of bounds release`);return n}function a(){if(!n)throw Error(`out of bounds release`);var e=n.leave();return e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),e}this.preExecute(Cd,xd,function(){r()}),this.postExecuted(Cd,bd,function(){a()}),this.preExecute(Sd,function(e){var t=e.context.shape,n=i();t&&!t.labelTarget&&(O(t,`bpmn:Lane`)&&n.addLane(t),O(t,`bpmn:FlowNode`)&&n.addFlowNode(t))})}wd.$inject=[`eventBus`,`modeling`],z(wd,B);function Td(){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}}var Ed=500,Dd=5e3,Od=[`connection.create`,`connection.delete`,`connection.layout`,`connection.move`,`connection.reconnect`,`connection.updateWaypoints`,`shape.create`,`shape.delete`,`shape.move`,`shape.resize`],kd=[...Od,`elements.create`,`elements.delete`,`elements.move`,`label.create`,`spaceTool`];function Ad(e,t){B.call(this,e);var n;function r(){return n||=new jd,n.enter(),n}function i(){if(!n)throw Error(`out of bounds release`);return n}function a(){if(!n)throw Error(`out of bounds release`);var e=n.leave();return e&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),e}this.preExecute(kd,Dd,function(){r()}),this.postExecuted(kd,Ed,function(){a()}),this.preExecute(Od,function(e){var t=e.context.connection||e.context.shape,n=i();t&&!t.labelTarget&&(O(t,`bpmn:FlowElement`)&&n.addFlowElement(t),O(t,`bpmn:Group`)&&n.addGroup(t))}),this.preExecute(`label.create`,function(e){var t=e.context.labelTarget;O(t,`bpmn:Group`)&&i().addGroup(t)})}Ad.$inject=[`eventBus`,`modeling`],z(Ad,B);function jd(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Md(e,t){B.call(this,e),this.postExecuted(`elements.create`,function(e){let n=e.context.elements;for(let e of n)Nd(e)&&!Fd(e)&&t.updateProperties(e,{isForCompensation:void 0})})}z(Md,B),Md.$inject=[`eventBus`,`modeling`];function Nd(e){let t=k(e);return t&&t.isForCompensation}function Pd(e){return e&&O(e,`bpmn:BoundaryEvent`)&&Ne(e,`bpmn:CompensateEventDefinition`)}function Fd(e){return e.incoming.filter(e=>Pd(e.source)).length>0}var Id={__init__:`adaptiveLabelPositioningBehavior.appendBehavior.artifactBehavior.associationBehavior.attachEventBehavior.boundaryEventBehavior.categoryRootElementReferenceBehavior.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.updateCategoryValueRefsBehavior.unsetDefaultFlowBehavior.setCompensationActivityAfterPasteBehavior`.split(`.`),adaptiveLabelPositioningBehavior:[`type`,Vs],appendBehavior:[`type`,qs],associationBehavior:[`type`,Xs],attachEventBehavior:[`type`,Qs],artifactBehavior:[`type`,Ys],boundaryEventBehavior:[`type`,tc],categoryRootElementReferenceBehavior:[`type`,lc],compensateBoundaryEventBehaviour:[`type`,dc],createBehavior:[`type`,hc],createDataObjectBehavior:[`type`,gc],createParticipantBehavior:[`type`,bc],dataInputAssociationBehavior:[`type`,Tc],dataStoreBehavior:[`type`,Oc],deleteLaneBehavior:[`type`,Qc],detachEventBehavior:[`type`,el],dropOnFlowBehavior:[`type`,il],eventBasedGatewayBehavior:[`type`,sl],fixHoverBehavior:[`type`,dl],groupBehavior:[`type`,pl],importDockingFix:[`type`,hl],isHorizontalFix:[`type`,_l],labelBehavior:[`type`,Zl],layoutConnectionBehavior:[`type`,eu],messageFlowBehavior:[`type`,uu],nonInterruptingBehavior:[`type`,gu],removeElementBehavior:[`type`,vu],removeEmbeddedLabelBoundsBehavior:[`type`,_u],removeParticipantBehavior:[`type`,xu],replaceConnectionBehavior:[`type`,Su],replaceElementBehaviour:[`type`,Cu],resizeBehavior:[`type`,Mu],resizeLaneBehavior:[`type`,Uu],rootElementReferenceBehavior:[`type`,Gu],spaceToolBehavior:[`type`,Ju],subProcessPlaneBehavior:[`type`,od],subProcessStartEventBehavior:[`type`,ud],textAnnotationBehavior:[`type`,fd],toggleCollapseConnectionBehaviour:[`type`,pd],toggleElementCollapseBehaviour:[`type`,hd],unclaimIdBehavior:[`type`,_d],unsetDefaultFlowBehavior:[`type`,vd],updateFlowNodeRefsBehavior:[`type`,wd],updateCategoryValueRefsBehavior:[`type`,Ad],setCompensationActivityAfterPasteBehavior:[`type`,Md]};function Ld(e,t){var n=xe(e,t,-15);return n===`intersect`?null:n}function Rd(e){oa.call(this,e)}z(Rd,oa),Rd.$inject=[`eventBus`],Rd.prototype.init=function(){this.addRule(`connection.start`,function(e){var t=e.source;return zd(t)}),this.addRule(`connection.create`,function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return af(t,n)}finally{i&&(n.parent=null)}}),this.addRule(`connection.reconnect`,function(e){var t=e.connection,n=e.source,r=e.target;return af(n,r,t)}),this.addRule(`connection.updateWaypoints`,function(e){return{type:e.connection.type}}),this.addRule(`shape.resize`,function(e){var t=e.shape,n=e.newBounds,r=e.direction;return yf(t,n,r)}),this.addRule(`elements.create`,function(e){var t=e.elements,n=e.position,r=e.target;return A(r)&&!Ef(t,r,n)?!1:_(t,function(e){return A(e)?af(e.source,e.target,e):e.host?hf(e,e.host,null,n):vf(e,r,null,n)})}),this.addRule(`elements.move`,function(e){var t=e.target,n=e.shapes,r=e.position;return e.hints?.keyboardMove&&n.some(function(e){return cf(e)&&!n.includes(e.host)})?!1:hf(n,t,null,r)||gf(n,t,r)||_f(n,t,r)||Ef(n,t,r)}),this.addRule(`shape.create`,function(e){return vf(e.shape,e.target,e.source,e.position)}),this.addRule(`shape.attach`,function(e){return hf(e.shape,e.target,null,e.position)}),this.addRule(`element.copy`,function(e){var t=e.element,n=e.elements;return Of(n,t)})},Rd.prototype.canConnectMessageFlow=Cf,Rd.prototype.canConnectSequenceFlow=wf,Rd.prototype.canConnectDataAssociation=Tf,Rd.prototype.canConnectAssociation=xf,Rd.prototype.canConnectCompensationAssociation=Sf,Rd.prototype.canMove=_f,Rd.prototype.canAttach=hf,Rd.prototype.canReplace=gf,Rd.prototype.canDrop=of,Rd.prototype.canInsert=Ef,Rd.prototype.canCreate=vf,Rd.prototype.canConnect=af,Rd.prototype.canResize=yf,Rd.prototype.canCopy=Of;function zd(e){return Bd(e)?null:E(e,[`bpmn:FlowNode`,`bpmn:InteractionNode`,`bpmn:DataObjectReference`,`bpmn:DataStoreReference`,`bpmn:Group`,`bpmn:TextAnnotation`])}function Bd(e){return!e||j(e)}function Vd(e){do{if(O(e,`bpmn:Process`))return k(e);if(O(e,`bpmn:Participant`))return k(e).processRef||k(e)}while(e=e.parent)}function Hd(e){return O(e,`bpmn:TextAnnotation`)}function Ud(e){return O(e,`bpmn:Group`)&&!e.labelTarget}function Wd(e){return O(e,`bpmn:BoundaryEvent`)&&Zd(e,`bpmn:CompensateEventDefinition`)}function Gd(e){return k(e).isForCompensation}function Kd(e,t){return Vd(e)===Vd(t)}function qd(e){return O(e,`bpmn:InteractionNode`)&&!O(e,`bpmn:BoundaryEvent`)&&(!O(e,`bpmn:Event`)||O(e,`bpmn:ThrowEvent`)&&Qd(e,`bpmn:MessageEventDefinition`))}function Jd(e){return O(e,`bpmn:InteractionNode`)&&!Gd(e)&&(!O(e,`bpmn:Event`)||O(e,`bpmn:CatchEvent`)&&Qd(e,`bpmn:MessageEventDefinition`))&&!(O(e,`bpmn:BoundaryEvent`)&&!Zd(e,`bpmn:MessageEventDefinition`))}function Yd(e){for(var t=e;t=t.parent;){if(O(t,`bpmn:FlowElementsContainer`))return k(t);if(O(t,`bpmn:Participant`))return k(t).processRef}return null}function Xd(e,t){return Yd(e)===Yd(t)}function Zd(e,t){var n=k(e);return!!C(n.eventDefinitions||[],function(e){return O(e,t)})}function Qd(e,t){return(k(e).eventDefinitions||[]).every(function(e){return O(e,t)})}function $d(e){return O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:EndEvent`)&&!Me(e)&&!(O(e,`bpmn:IntermediateThrowEvent`)&&Zd(e,`bpmn:LinkEventDefinition`))&&!Wd(e)&&!Gd(e)}function ef(e){return O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:StartEvent`)&&!O(e,`bpmn:BoundaryEvent`)&&!Me(e)&&!(O(e,`bpmn:IntermediateCatchEvent`)&&Zd(e,`bpmn:LinkEventDefinition`))&&!Gd(e)}function tf(e){return O(e,`bpmn:ReceiveTask`)||O(e,`bpmn:IntermediateCatchEvent`)&&(Zd(e,`bpmn:MessageEventDefinition`)||Zd(e,`bpmn:TimerEventDefinition`)||Zd(e,`bpmn:ConditionalEventDefinition`)||Zd(e,`bpmn:SignalEventDefinition`))}function nf(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function rf(e,t){return nf(t).indexOf(e)!==-1}function af(e,t,n){if(Bd(e)||Bd(t))return null;if(!O(n,`bpmn:DataAssociation`)){if(Cf(e,t))return{type:`bpmn:MessageFlow`};if(wf(e,t))return{type:`bpmn:SequenceFlow`}}return Tf(e,t)||(Sf(e,t)?{type:`bpmn:Association`,associationDirection:`One`}:xf(e,t)?{type:`bpmn:Association`,associationDirection:`None`}:!1)}function of(e,t){return j(e)||Ud(e)?!0:O(t,`bpmn:Participant`)&&!R(t)?!1:O(e,`bpmn:Participant`)?O(t,`bpmn:Process`)||O(t,`bpmn:Collaboration`):E(e,[`bpmn:DataInput`,`bpmn:DataOutput`])&&e.parent?t===e.parent:O(e,`bpmn:Lane`)?O(t,`bpmn:Participant`)||O(t,`bpmn:Lane`):O(e,`bpmn:BoundaryEvent`)&&!sf(e)?!1:O(e,`bpmn:FlowElement`)&&!O(e,`bpmn:DataStoreReference`)?O(t,`bpmn:FlowElementsContainer`)?R(t):E(t,[`bpmn:Participant`,`bpmn:Lane`]):O(e,`bpmn:DataStoreReference`)&&O(t,`bpmn:Collaboration`)?o(k(t).get(`participants`),function(e){return!!e.get(`processRef`)}):E(e,[`bpmn:Artifact`,`bpmn:DataAssociation`,`bpmn:DataStoreReference`])?E(t,[`bpmn:Collaboration`,`bpmn:Lane`,`bpmn:Participant`,`bpmn:Process`,`bpmn:SubProcess`]):O(e,`bpmn:MessageFlow`)?O(t,`bpmn:Collaboration`)||e.source.parent==t||e.target.parent==t:!1}function sf(e){return k(e).cancelActivity&&(df(e)||ff(e))}function cf(e){return!j(e)&&O(e,`bpmn:BoundaryEvent`)}function lf(e){return O(e,`bpmn:Lane`)}function uf(e){return cf(e)||O(e,`bpmn:IntermediateThrowEvent`)&&df(e)?!0:O(e,`bpmn:IntermediateCatchEvent`)&&ff(e)}function df(e){var t=k(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ff(e){return pf(e,[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:SignalEventDefinition`,`bpmn:ConditionalEventDefinition`])}function pf(e,t){return t.some(function(t){return Zd(e,t)})}function mf(e){return O(e,`bpmn:ReceiveTask`)&&C(e.incoming,function(e){return O(e.source,`bpmn:EventBasedGateway`)})}function hf(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return j(i)||!uf(i)||Me(t)||!O(t,`bpmn:Activity`)||Gd(t)||r&&!Ld(r,t)||mf(t)?!1:`attach`}function gf(e,t,n){if(!t)return!1;var r={replacements:[]};return b(e,function(e){Me(t)||O(e,`bpmn:StartEvent`)&&e.type!==`label`&&of(e,t)&&(Ae(e)||r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`}),(Ge(e)||Le(e)||je(e))&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`}),pf(e,[`bpmn:MessageEventDefinition`,`bpmn:TimerEventDefinition`,`bpmn:SignalEventDefinition`,`bpmn:ConditionalEventDefinition`])&&O(t,`bpmn:SubProcess`)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:StartEvent`})),O(t,`bpmn:Transaction`)||Zd(e,`bpmn:CancelEventDefinition`)&&e.type!==`label`&&(O(e,`bpmn:EndEvent`)&&of(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:EndEvent`}),O(e,`bpmn:BoundaryEvent`)&&hf(e,t,null,n)&&r.replacements.push({oldElementId:e.id,newElementType:`bpmn:BoundaryEvent`}))}),r.replacements.length?r:!1}function _f(e,t){return o(e,lf)?!1:t===void 0||t!==null&&e.every(function(e){return of(e,t)})}function vf(e,t,n,r){return t?j(e)||Ud(e)?!0:of(e,t,r)||Ef(e,t,r):!1}function yf(e,t,n){return O(e,`bpmn:SubProcess`)?R(e)&&(!t||t.width>=100&&t.height>=80):O(e,`bpmn:Lane`)||O(e,`bpmn:Participant`)?!0:Hd(e)?!n||n===`e`||n===`w`:Ud(e)?!0:j(e)?!n||n===`e`||n===`w`:!1}function bf(e,t){var n=Hd(e),r=Hd(t);return(n||r)&&n!==r}function xf(e,t){return rf(t,e)||rf(e,t)?!1:bf(e,t)?!0:!!Tf(e,t)}function Sf(e,t){return Xd(e,t)&&Wd(e)&&O(t,`bpmn:Activity`)&&!Mf(t,e)&&!Me(t)}function Cf(e,t){return jf(e)&&!jf(t)?!1:qd(e)&&Jd(t)&&!Kd(e,t)}function wf(e,t){return $d(e)&&ef(t)&&Xd(e,t)&&!(O(e,`bpmn:EventBasedGateway`)&&!tf(t))}function Tf(e,t){return E(e,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`])&&E(t,[`bpmn:Activity`,`bpmn:ThrowEvent`])?{type:`bpmn:DataInputAssociation`}:E(t,[`bpmn:DataObjectReference`,`bpmn:DataStoreReference`])&&E(e,[`bpmn:Activity`,`bpmn:CatchEvent`])?{type:`bpmn:DataOutputAssociation`}:!1}function Ef(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:E(t,[`bpmn:SequenceFlow`,`bpmn:MessageFlow`])&&!j(t)&&O(e,`bpmn:FlowNode`)&&!O(e,`bpmn:BoundaryEvent`)&&of(e,t.parent,n)}function Df(e,t){return e&&t&&e.indexOf(t)!==-1}function Of(e,t){return j(t)?!0:!(O(t,`bpmn:Lane`)&&!Df(e,t.parent)||O(t,`bpmn:MessageFlow`)&&!kf(e,t))}function kf(e,t){var n=Af(t.source),r=Af(t.target);return Df(e,n)&&Df(e,r)}function Af(e){for(;e;e=e.parent)if(O(e,`bpmn:Participant`))return e;return null}function jf(e){return Ye(e,`bpmn:Process`)||Ye(e,`bpmn:Collaboration`)}function Mf(e,t){return e.attachers.includes(t)}var Nf={__depends__:[eo],__init__:[`bpmnRules`],bpmnRules:[`type`,Rd]},Pf=2e3;function Ff(e,t){e.on(`saveXML.start`,Pf,n);function n(){var e=t.getRootElements();b(e,function(e){var t=D(e),n=et([e],!1),r;n=u(n,function(t){return t!==e&&!t.labelTarget}),r=ae(n,D),t.set(`planeElement`,r)})}}Ff.$inject=[`eventBus`,`canvas`];var If={__init__:[`bpmnDiOrdering`],bpmnDiOrdering:[`type`,Ff]};function Lf(e){B.call(this,e);var t=this;this.preExecute([`shape.create`,`connection.create`],function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,a=t.getOrdering(r,i);a&&(a.parent!==void 0&&(n.parent=a.parent),n.parentIndex=a.index)}),this.preExecute([`shape.move`,`connection.move`],function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,a=t.getOrdering(r,i);a&&(a.parent!==void 0&&(n.newParent=a.parent),n.newParentIndex=a.index)})}Lf.prototype.getOrdering=function(e,t){return null},z(Lf,B);function Rf(e,t){Lf.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 r(e){if(e.labelTarget)return{level:10};var t=C(n,function(t){return E(e,[t.type])});return t&&t.order||{level:1}}function i(e){var t=e.order;if(t||(e.order=t=r(e)),!t)throw Error(`no order for <${e.id}>`);return t}function a(e,t,n){for(var r=t;r&&!E(r,n);)r=r.parent;if(!r)throw Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}this.getOrdering=function(e,n){if(e.labelTarget||O(e,`bpmn:TextAnnotation`))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=a(e,n,r.containers));var o=n.children.indexOf(e),s=te(n.children,function(t){return!e.labelTarget&&t.labelTarget?!1:r.level<i(t).level});return s!==-1&&o!==-1&&o<s&&--s,{index:s,parent:n}}}Rf.$inject=[`eventBus`,`canvas`],z(Rf,Lf);var zf={__init__:[`bpmnOrderingProvider`],bpmnOrderingProvider:[`type`,Rf]};function Bf(){}Bf.prototype.get=function(){return this._data},Bf.prototype.set=function(e){this._data=e},Bf.prototype.clear=function(){var e=this._data;return delete this._data,e},Bf.prototype.isEmpty=function(){return!this._data};var Vf={clipboard:[`type`,Bf]},Hf=`drop-ok`,Uf=`drop-not-ok`,Wf=`attach-ok`,Gf=`new-parent`,Kf=`create`,qf=2e3;function Jf(e,t,n,r,i){function a(e,t,n,r,a){if(!t)return!1;e=u(e,function(t){var n=t.labelTarget;return!t.parent&&!(j(t)&&e.indexOf(n)!==-1)});var o=C(e,function(e){return!A(e)}),s=!1,c=!1,l=!1;Xf(e)&&(s=i.allowed(`shape.attach`,{position:n,shape:o,target:t})),s||(l=Xf(e)?i.allowed(`shape.create`,{position:n,shape:o,source:r,target:t}):i.allowed(`elements.create`,{elements:e,position:n,target:t}));var d=a.connectionTarget;return l||s?(o&&r&&(c=i.allowed(`connection.create`,{source:d===r?o:r,target:d===r?r:o,hints:{targetParent:t,targetAttach:s}})),{attach:s,connect:c}):l===null||s===null?null:!1}function o(t,n){[Wf,Hf,Uf,Gf].forEach(function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)})}n.on([`create.move`,`create.hover`],function(e){var t=e.context,n=t.elements,r=e.hover,i=t.source,s=t.hints||{};if(!r)t.canExecute=!1,t.target=null;else{Yf(e);var c={x:e.x,y:e.y},l=t.canExecute=r&&a(n,r,c,i,s);r&&l!==null&&(t.target=r,l&&l.attach?o(r,Wf):o(r,l?Gf:Uf))}}),n.on([`create.end`,`create.out`,`create.cleanup`],function(e){var t=e.hover;t&&o(t,null)}),n.on(`create.end`,function(e){var t=e.context,n=t.source,i=t.shape,a=t.elements,o=t.target,s=t.canExecute,c=s&&s.attach,l=s&&s.connect,u=t.hints||{};if(s===!1||!o)return!1;Yf(e);var d={x:e.x,y:e.y};l?i=r.appendShape(n,i,d,o,{attach:c,connection:l===!0?{}:l,connectionTarget:u.connectionTarget}):(a=r.createElements(a,d,o,T({},u,{attach:c})),i=C(a,function(e){return!A(e)})),T(t,{elements:a,shape:i}),T(e,{elements:a,shape:i})});function s(){var e=t.context();e&&e.prefix===Kf&&t.cancel()}n.on(`create.init`,function(){n.on(`elements.changed`,s),n.once([`create.cancel`,`create.end`],qf,function(){n.off(`elements.changed`,s)})}),this.start=function(e,n,r){m(n)||(n=[n]);var i=C(n,function(e){return!A(e)});if(i){r=T({elements:n,hints:{},shape:i},r||{}),b(n,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var a=u(n,function(e){return!e.hidden}),o=it(a);b(n,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}})),T(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})}),t.init(e,Kf,{cursor:`grabbing`,autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}Jf.$inject=[`canvas`,`dragging`,`eventBus`,`modeling`,`rules`];function Yf(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 Xf(e){return e&&e.length===1&&!A(e[0])}var Zf=750;function Qf(e,t,n,r,i){function a(e){var t=F(`g`);P(t,i.cls(`djs-drag-group`,[`no-events`]));var a=F(`g`);return e.forEach(function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer(`connection`,a),n.drawConnection(mt(i),e)):(i=n._createContainer(`shape`,a),n.drawShape(mt(i),e),Bt(i,e.x,e.y)),r.addDragger(e,t,i))}),t}t.on(`create.move`,Zf,function(t){var n=t.hover,r=t.context,i=r.elements,o=r.dragGroup;o||=r.dragGroup=a(i);var s;n?(o.parentNode||(s=e.getActiveLayer(),L(s,o)),Bt(o,t.x,t.y)):ke(o)}),t.on(`create.cleanup`,function(e){var t=e.context.dragGroup;t&&ke(t)})}Qf.$inject=[`canvas`,`eventBus`,`graphicsFactory`,`previewSupport`,`styles`];var $f={__depends__:[Ya,Ps,eo,It],__init__:[`create`,`createPreview`],create:[`type`,Jf],createPreview:[`type`,Qf]};function ep(e){var t=this;this._lastMoveEvent=null;function n(e){t._lastMoveEvent=e}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)})}ep.$inject=[`eventBus`],ep.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||tp(0,0)};function tp(e,t){var n=document.createEvent(`MouseEvent`),r=e,i=t,a=e,o=t;return n.initMouseEvent&&n.initMouseEvent(`mousemove`,!0,!0,window,0,r,i,a,o,!1,!1,!1,!1,0,null),n}var np={__init__:[`mouse`],mouse:[`type`,ep]},rp=2e3;function ip(e,t,n,r,i,a,o,s){this._canvas=e,this._create=t,this._elementFactory=r,this._eventBus=i,this._modeling=a,this._mouse=o,this._rules=s,i.on(`copyPaste.copyElement`,function(e){var t=e.descriptor,n=e.element,r=e.elementsSet;t.priority=1,t.id=n.id,r.has(n.parent)&&(t.parent=n.parent.id),ap(n)&&(t.priority=2,t.host=n.host.id),A(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=op(n)),j(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),b([`x`,`y`,`width`,`height`],function(e){h(n[e])&&(t[e]=n[e])}),t.hidden=n.hidden,t.collapsed=n.collapsed}),i.on(`copyPaste.elementsCopied`,rp,function(e){e.hints?.clip!==!1&&n.set(e.tree)}),i.on(`copyPaste.pasteElements`,rp,function(e){e.tree||=n.get()}),i.on(`copyPaste.pasteElements`,function(e){var t=e.hints;T(t,{createElementsBehavior:!1})})}ip.$inject=[`canvas`,`create`,`clipboard`,`elementFactory`,`eventBus`,`modeling`,`mouse`,`rules`],ip.prototype.copy=function(e,t={}){var n,r;return m(e)||(e=e?[e]:[]),n=this._eventBus.fire(`copyPaste.canCopyElements`,{elements:e}),r=n===!1?{}:this.createTree(m(n)?n:e),this._eventBus.fire(`copyPaste.elementsCopied`,{elements:e,tree:r,hints:t}),r},ip.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:`copyPaste.pasteElements`,hints:{},...e});if(this._eventBus.fire(t)!==!1){var n=t.tree;if(n){var r=t.hints,i=this._createElements(n);if(t.element&&t.point)return this._paste(i,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:r})}}},ip.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ip.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),r=e.filter(function(e){return n[e.id]});return r.length>0&&this._modeling.removeElements(r),t},ip.prototype._getElementIdsFromTree=function(e){var t={};return b(e,function(e){b(e,function(e){e.id&&(t[e.id]=!0)})}),t},ip.prototype._paste=function(e,t,n,r){b(e,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var i=it(e);return b(e,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}})),T(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,T({},r))},ip.prototype._createElements=function(e){var t=this,r=this._eventBus,i={},a=[];return b(e,function(e,o){o=parseInt(o,10),e=y(e,`priority`),b(e,function(e){var o=T({},n(e,[`priority`]));i[e.parent]?o.parent=i[e.parent]:delete o.parent,r.fire(`copyPaste.pasteElement`,{cache:i,descriptor:o});var s;A(o)?(o.source=i[e.source],o.target=i[e.target],s=i[e.id]=t.createConnection(o),a.push(s)):j(o)?(o.labelTarget=i[o.labelTarget],s=i[e.id]=t.createLabel(o),a.push(s)):(o.host&&=i[o.host],s=i[e.id]=t.createShape(o),a.push(s))})}),a},ip.prototype.createConnection=function(e){return this._elementFactory.createConnection(n(e,[`id`]))},ip.prototype.createLabel=function(e){return this._elementFactory.createLabel(n(e,[`id`]))},ip.prototype.createShape=function(e){return this._elementFactory.createShape(n(e,[`id`]))},ip.prototype.hasRelations=function(e,t,n){return n||=new Set(t),!(A(e)&&(!n.has(e.source)||!n.has(e.target))||j(e)&&!n.has(e.labelTarget))},ip.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],a=new Map,o=Ot(e);function s(e,n){return t.allowed(`element.copy`,{element:e,elements:n})}function c(e,t){var n=a.get(e);if(!n){var r={element:e,depth:t};i.push(r),a.set(e,r)}else if(n.depth<t){i=l(n,i);var o={element:n.element,depth:t};i.push(o),a.set(e,o)}}function l(e,t){var n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}ht(o,function(e,t,r){if(j(e))return;b(e.labels,function(e){c(e,r)});function i(e){e&&e.length&&b(e,function(e){b(e.labels,function(e){c(e,r)}),c(e,r)})}b([e.attachers,e.incoming,e.outgoing],i),c(e,r);var a=[];return e.children&&(a=e.children.slice()),n._eventBus.fire(`copyPaste.createTree`,{element:e,children:a}),a}),e=ae(i,function(e){return e.element});var u=new Set(e);return i=ae(i,function(t){return t.descriptor={},n._eventBus.fire(`copyPaste.copyElement`,{descriptor:t.descriptor,element:t.element,elements:e,elementsSet:u}),t}),i=y(i,function(e){return e.descriptor.priority}),e=ae(i,function(e){return e.element}),b(i,function(t){var i=t.depth;n.hasRelations(t.element,e,u)&&s(t.element,e)?(r[i]||(r[i]=[]),r[i].push(t.descriptor)):(cp(t.element,e),u.delete(t.element))}),r};function ap(e){return!!e.host}function op(e){return ae(e.waypoints,function(e){return e=sp(e),e.original&&(e.original=sp(e.original)),e})}function sp(e){return T({},e)}function cp(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}var lp={__depends__:[Vf,$f,np,eo],__init__:[`copyPaste`],copyPaste:[`type`,ip]};function up(e,t,n){m(n)||(n=[n]),b(n,function(n){oe(e[n])||(t[n]=e[n])})}var dp=750;function fp(e,t,r){function i(t,n){var i=e.create(t.$type);return r.copyElement(t,i,null,n)}t.on(`copyPaste.copyElement`,dp,function(e){var t=e.descriptor,n=e.element,r=k(n);if(j(n))return t;var a=t.businessObject=i(r,!0),o=t.di=i(D(n),!0);o.bpmnElement=a,up(a,t,`name`),up(o,t,`isExpanded`),r.default&&(t.default=r.default.id)});var a=`-bpmn-js-refs`;function o(e){return e[a]=e[a]||{}}function s(e,t){e[a]=t}function l(e,t,r){var i=k(e);return e.default&&(r[e.default]={element:i,property:`default`}),e.host&&(k(e).attachedToRef=k(t[e.host])),n(r,c(r,function(t,n,r){var a=n.element,o=n.property;return r===e.id&&(a.set(o,i),t.push(e.id)),t},[]))}t.on(`copyPaste.pasteElement`,function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,a=n.di;j(n)?(n.businessObject=k(t[n.labelTarget]),n.di=D(t[n.labelTarget])):(r=n.businessObject=i(r),a=n.di=i(a),a.bpmnElement=r,up(n,r,[`isExpanded`,`name`]),n.type=r.$type)}),t.on(`copyPaste.copyElement`,dp,function(e){var t=e.descriptor,n=e.element;if(O(n,`bpmn:Participant`)){var r=k(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.createTree`,function(e){var t=e.element,n=e.children;O(t,`bpmn:SubProcess`)&&b(wt(n),e=>{n.push(e.annotation)})}),t.on(`copyPaste.pasteElement`,dp,function(e){var t=e.cache,n=e.descriptor;s(t,l(n,t,o(t)))})}fp.$inject=[`bpmnFactory`,`eventBus`,`moddleCopy`];var pp=[`artifacts`,`dataInputAssociations`,`dataOutputAssociations`,`default`,`flowElements`,`lanes`,`incoming`,`outgoing`,`categoryValue`],mp=[`errorRef`,`escalationRef`,`messageRef`,`signalRef`,`dataObjectRef`];function hp(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on(`moddleCopy.canCopyProperties`,e=>{let{propertyNames:t}=e;if(t&&t.length)return y(t,e=>e===`extensionElements`)}),e.on(`moddleCopy.canCopyProperty`,e=>{let{parent:t,property:n,propertyName:r}=e,i=l(t)&&t.$descriptor;if(r&&mp.includes(r))return n;if(r&&pp.includes(r)||r&&i&&!C(i.properties,s({name:r})))return!1}),e.on(`moddleCopy.canSetCopiedProperty`,e=>{let{property:t}=e;if(O(t,`bpmn:ExtensionElements`)&&(!t.values||!t.values.length))return!1})}hp.$inject=[`eventBus`,`bpmnFactory`,`moddle`],hp.prototype.copyElement=function(e,t,n,r=!1){n&&!m(n)&&(n=[n]),n||=gp(e.$descriptor);let i=this._eventBus.fire(`moddleCopy.canCopyProperties`,{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return i===!1||(m(i)&&(n=i),b(n,n=>{let i;p(e,n)&&(i=e.get(n));let a=this.copyProperty(i,t,n,r);w(a)&&this._eventBus.fire(`moddleCopy.canSetCopiedProperty`,{parent:t,property:a,propertyName:n})!==!1&&t.set(n,a)})),t},hp.prototype.copyProperty=function(e,t,n,r=!1){let i=this._eventBus.fire(`moddleCopy.canCopyProperty`,{parent:t,property:e,propertyName:n,clone:r});if(i===!1)return;if(i)return l(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;let a=this._moddle.getPropertyDescriptor(t,n);if(!a.isReference)return a.isId?e&&this._copyId(e,t,r):m(e)?c(e,(e,i)=>{let a=this.copyProperty(i,t,n,r);return a?e.concat(a):e},[]):l(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(i=this._bpmnFactory.create(e.$type),i.$parent=t,i=this.copyElement(e,i,null,r),i):e},hp.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function gp(e,t){return c(e.properties,(e,n)=>t&&n.default?e:e.concat(n.name),[])}var _p={__depends__:[lp],__init__:[`bpmnCopyPaste`,`moddleCopy`],bpmnCopyPaste:[`type`,fp],moddleCopy:[`type`,hp]},vp=Math.round;function yp(e,t){this._modeling=e,this._eventBus=t}yp.$inject=[`modeling`,`eventBus`],yp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire(`replace.start`,{element:e,attrs:t,hints:n});var a=t.width||e.width,o=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vp(s+a/2),u=vp(c+o/2),d=r.replaceShape(e,T({},t,{x:l,y:u,width:a,height:o}),n);return i.fire(`replace.end`,{element:e,newElement:d,hints:n}),d};function bp(e,t){t.on(`replace.end`,500,function(t){let{newElement:n,hints:r={}}=t;r.select!==!1&&e.select(n)})}bp.$inject=[`selection`,`eventBus`];var xp={__init__:[`replace`,`replaceSelectionBehavior`],replaceSelectionBehavior:[`type`,bp],replace:[`type`,yp]};function Sp(e,t,n){m(n)||(n=[n]),b(n,function(n){oe(e[n])||(t[n]=e[n])})}var Cp=[`cancelActivity`,`instantiate`,`eventGatewayType`,`triggeredByEvent`,`isInterrupting`];function wp(e,t){var n=e&&p(e,`collapsed`)?e.collapsed:!R(e);return n!==(t&&(p(t,`collapsed`)||p(t,`isExpanded`))?p(t,`collapsed`)?t.collapsed:!t.isExpanded:n)}function Tp(e,t,n,r,i,a){function o(o,s,c){c||={};var l=s.type,d=o.businessObject;if(Ep(d)&&(l===`bpmn:SubProcess`||l===`bpmn:AdHocSubProcess`)&&wp(o,s))return r.toggleCollapse(o),o;var f=e.create(l),m={type:l,businessObject:f};m.di={},l===`bpmn:ExclusiveGateway`&&(m.di.isMarkerVisible=!0),Sp(o.di,m.di,[`fill`,`stroke`,`background-color`,`border-color`,`color`]);var h=Op(gp(d.$descriptor),gp(f.$descriptor,!0));T(f,ie(s,Cp));var g=u(h,function(e){return e===`eventDefinitions`?Dp(o,s.eventDefinitionType):e===`loopCharacteristics`?!Me(f):p(f,e)||e===`processRef`&&s.isExpanded===!1||e===`triggeredByEvent`?!1:e!==`isForCompensation`||!Me(f)});if(f=n.copyElement(d,f,g),s.eventDefinitionType&&(Dp(f,s.eventDefinitionType)||(m.eventDefinitionType=s.eventDefinitionType,m.eventDefinitionAttrs=s.eventDefinitionAttrs)),O(d,`bpmn:Activity`)){if(Ep(d))m.isExpanded=R(o);else if(s&&p(s,`isExpanded`)){m.isExpanded=s.isExpanded;var _=t.getDefaultSize(f,{isExpanded:m.isExpanded});m.width=_.width,m.height=_.height,m.x=o.x-(m.width-o.width)/2,m.y=o.y-(m.height-o.height)/2}R(o)&&!O(d,`bpmn:Task`)&&m.isExpanded&&(m.width=o.width,m.height=o.height)}if(Ep(d)&&!Ep(f)&&(c.moveChildren=!1),O(d,`bpmn:Participant`)){s.isExpanded===!0?f.processRef=e.create(`bpmn:Process`):c.moveChildren=!1;var v=He(o);D(o).isHorizontal||(D(m).isHorizontal=v),m.width=v?o.width:t.getDefaultSize(m).width,m.height=v?t.getDefaultSize(m).height:o.height}return a.allowed(`shape.resize`,{shape:f})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),f.name=d.name,E(d,[`bpmn:ExclusiveGateway`,`bpmn:InclusiveGateway`,`bpmn:Activity`])&&E(f,[`bpmn:ExclusiveGateway`,`bpmn:InclusiveGateway`,`bpmn:Activity`])&&(f.default=d.default),s.host&&!O(d,`bpmn:BoundaryEvent`)&&O(f,`bpmn:BoundaryEvent`)&&(m.host=s.host),(m.type===`bpmn:DataStoreReference`||m.type===`bpmn:DataObjectReference`)&&(m.x=o.x+(o.width-m.width)/2),i.replaceElement(o,m,{...c,targetElement:s})}this.replaceElement=o}Tp.$inject=[`bpmnFactory`,`elementFactory`,`moddleCopy`,`modeling`,`replace`,`rules`];function Ep(e){return O(e,`bpmn:SubProcess`)}function Dp(e,t){var n=k(e);return t&&n.get(`eventDefinitions`).some(function(e){return O(e,t)})}function Op(e,t){return e.filter(function(e){return t.includes(e)})}var kp={__depends__:[_p,xp,It],bpmnReplace:[`type`,Tp]},Ap=250;function jp(e){this._eventBus=e,this._tools=[],this._active=null}jp.$inject=[`eventBus`],jp.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jp.prototype.isActive=function(e){return e&&this._active===e},jp.prototype.length=function(e){return this._tools.length},jp.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire(`tool-manager.update`,{tool:e}))},jp.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+`.init`,function(t){!t.context.reactivate&&this.isActive(e)?this.setActive(null):this.setActive(e)},this),b(t,function(e){r.push(e+`.ended`),r.push(e+`.canceled`)}),n.on(r,Ap,function(e){this._active&&(Mp(e)||this.setActive(null))},this)};function Mp(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ct(t,`.group[data-group="tools"]`)}var Np={__depends__:[Ya],__init__:[`toolManager`],toolManager:[`type`,jp]};function Pp(e,t){if(e===`x`){if(t>0)return`e`;if(t<0)return`w`}if(e===`y`){if(t>0)return`s`;if(t<0)return`n`}return null}function Fp(e,t){var n=[],r=new Set(e);b(t,function(e){r.add(e)});var i=new Set;return r.forEach(function(e){var t=e.incoming,a=e.outgoing;b(t.concat(a),function(e){var t=e.source,a=e.target;(r.has(t)||r.has(a))&&(i.has(e)||(i.add(e),n.push(e)))})}),n}function Ip(e,t,n){var r=e.x,i=e.y,a=e.width,o=e.height,s=n.x,c=n.y;switch(t){case`n`:return{x:r,y:i+c,width:a,height:o-c};case`s`:return{x:r,y:i,width:a,height:o+c};case`w`:return{x:r+s,y:i,width:a-s,height:o};case`e`:return{x:r,y:i,width:a+s,height:o};default:throw Error(`unknown direction: `+t)}}var Lp=Math.abs,Rp=Math.round,zp={x:`width`,y:`height`},Bp=`crosshair`,Vp={n:`top`,w:`left`,s:`bottom`,e:`right`},Hp=1500,Up={n:`s`,w:`e`,s:`n`,e:`w`},Wp=20;function Gp(e,t,n,r,i,a,o){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=a,this._mouse=o;var s=this;a.registerTool(`space`,{tool:`spaceTool.selection`,dragging:`spaceTool`}),n.on(`spaceTool.selection.end`,function(e){n.once(`spaceTool.selection.ended`,function(){s.activateMakeSpace(e.originalEvent)})}),n.on(`spaceTool.move`,Hp,function(e){var t=e.context,n=t.initialized;n||=t.initialized=s.init(e,t),n&&qp(e)}),n.on(`spaceTool.end`,function(e){var t=e.context,r=t.axis,i=t.direction,a=t.movingShapes,o=t.resizingShapes,c=t.start;if(t.initialized){qp(e);var l={x:0,y:0};l[r]=Rp(e[`d`+r]),s.makeSpace(a,o,l,i,c),n.once(`spaceTool.ended`,function(e){s.activateSelection(e.originalEvent,!0,!0)})}})}Gp.$inject=[`canvas`,`dragging`,`eventBus`,`modeling`,`rules`,`toolManager`,`mouse`],Gp.prototype.activateSelection=function(e,t,n){this._dragging.init(e,`spaceTool.selection`,{autoActivate:t,cursor:Bp,data:{context:{reactivate:n}},trapClick:!1})},Gp.prototype.activateMakeSpace=function(e){this._dragging.init(e,`spaceTool`,{autoActivate:!0,cursor:Bp,data:{context:{}}})},Gp.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Gp.prototype.init=function(e,t){var n=Lp(e.dx)>Lp(e.dy)?`x`:`y`,r=e[`d`+n],i=e[n]-r;if(Lp(r)<5)return!1;r<0&&(r*=-1),Pt(e)&&(r*=-1);var a=Pp(n,r),o=this._canvas.getRootElement();!Et(e)&&e.hover&&(o=e.hover);var s=[...et(o),...o.attachers||[]],c=this.calculateAdjustments(s,n,r,i),l=Jp(c,n,a,i,this._eventBus.fire(`spaceTool.getMinDimensions`,{axis:n,direction:a,shapes:c.resizingShapes,start:i}));return T(t,c,{axis:n,direction:a,spaceToolConstraints:l,start:i}),hn(`resize-`+(n===`x`?`ew`:`ns`)),!0},Gp.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,a=[],o=[],s=new Set,c=new Set,l=[],u=[];function d(e){s.has(e)||(s.add(e),a.push(e));var t=e.label;t&&!s.has(t)&&(s.add(t),a.push(t))}function f(e){c.has(e)||(c.add(e),o.push(e))}return b(e,function(e){if(e.parent&&!j(e)){if(A(e))u.push(e);else{var a=e[t],o=a+e[zp[t]];Yp(e)&&(n>0&&M(e)[t]>r||n<0&&M(e)[t]<r)?l.push(e):n>0&&a>r||n<0&&o<r?d(e):a<r&&o>r&&i.allowed(`shape.resize`,{shape:e})&&f(e)}}}),b(a,function(e){var t=e.attachers;t&&b(t,function(e){d(e)})}),b(l,function(e){var t=e.host;(s.has(t)||c.has(t))&&d(e)}),b(u,function(e){var t=e.source,n=e.target,r=e.label;(s.has(t)||c.has(t))&&(s.has(n)||c.has(n))&&r&&d(r)}),{movingShapes:a,resizingShapes:o}},Gp.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gp.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Kp(e){return{top:e.top-Wp,right:e.right+Wp,bottom:e.bottom+Wp,left:e.left-Wp}}function qp(e){var t=e.context.spaceToolConstraints;if(t){var n,r;h(t.left)&&(n=Math.max(e.x,t.left),e.dx=e.dx+n-e.x,e.x=n),h(t.right)&&(n=Math.min(e.x,t.right),e.dx=e.dx+n-e.x,e.x=n),h(t.top)&&(r=Math.max(e.y,t.top),e.dy=e.dy+r-e.y,e.y=r),h(t.bottom)&&(r=Math.min(e.y,t.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function Jp(e,t,n,r,i){var a=e.movingShapes,o=e.resizingShapes;if(o.length){var s={},c,l,d=new Set(a),f=new Set(o);return b(o,function(e){var a=e.attachers,o=e.children,p=N(e),m=u(o,function(e){return!A(e)&&!j(e)&&!d.has(e)&&!f.has(e)}),g=u(o,function(e){return!A(e)&&!j(e)&&d.has(e)}),_,v,y,b=[],x=[],S,C,w,ee;m.length&&(v=Kp(N(it(m))),_=r-p[Vp[n]]+v[Vp[n]],n===`n`?s.bottom=l=h(l)?Math.min(l,_):_:n===`w`?s.right=l=h(l)?Math.min(l,_):_:n===`s`?s.top=c=h(c)?Math.max(c,_):_:n===`e`&&(s.left=c=h(c)?Math.max(c,_):_)),g.length&&(y=Kp(N(it(g))),_=r-y[Vp[Up[n]]]+p[Vp[Up[n]]],n===`n`?s.bottom=l=h(l)?Math.min(l,_):_:n===`w`?s.right=l=h(l)?Math.min(l,_):_:n===`s`?s.top=c=h(c)?Math.max(c,_):_:n===`e`&&(s.left=c=h(c)?Math.max(c,_):_)),a&&a.length&&(a.forEach(function(e){d.has(e)?b.push(e):x.push(e)}),b.length&&(S=N(it(b.map(M))),C=p[Vp[Up[n]]]-(S[Vp[Up[n]]]-r)),x.length&&(w=N(it(x.map(M))),ee=w[Vp[n]]-(p[Vp[n]]-r)),n===`n`?(_=Math.min(C||1/0,ee||1/0),s.bottom=l=h(l)?Math.min(l,_):_):n===`w`?(_=Math.min(C||1/0,ee||1/0),s.right=l=h(l)?Math.min(l,_):_):n===`s`?(_=Math.max(C||-1/0,ee||-1/0),s.top=c=h(c)?Math.max(c,_):_):n===`e`&&(_=Math.max(C||-1/0,ee||-1/0),s.left=c=h(c)?Math.max(c,_):_));var te=i&&i[e.id];te&&(n===`n`?(_=r+e[zp[t]]-te[zp[t]],s.bottom=l=h(l)?Math.min(l,_):_):n===`w`?(_=r+e[zp[t]]-te[zp[t]],s.right=l=h(l)?Math.min(l,_):_):n===`s`?(_=r-e[zp[t]]+te[zp[t]],s.top=c=h(c)?Math.max(c,_):_):n===`e`&&(_=r-e[zp[t]]+te[zp[t]],s.left=c=h(c)?Math.max(c,_):_))}),s}}function Yp(e){return!!e.host}var Xp=`djs-dragging`,Zp=`djs-resizing`,Qp=250,$p=Math.max;function em(e,t,n,r,i){function a(e,t){b(e,function(e){i.addDragger(e,t),n.addMarker(e,Xp)})}e.on(`spaceTool.selection.start`,function(e){var t=n.getLayer(`space`),i=e.context,a={x:`M 0,-10000 L 0,10000`,y:`M -10000,0 L 10000,0`},o=F(`g`);P(o,r.cls(`djs-crosshair-group`,[`no-events`])),L(t,o);var s=F(`path`);P(s,`d`,a.x),I(s).add(`djs-crosshair`),L(o,s);var c=F(`path`);P(c,`d`,a.y),I(c).add(`djs-crosshair`),L(o,c),i.crosshairGroup=o}),e.on(`spaceTool.selection.move`,function(e){var t=e.context.crosshairGroup;Bt(t,e.x,e.y)}),e.on(`spaceTool.selection.cleanup`,function(e){var t=e.context.crosshairGroup;t&&ke(t)}),e.on(`spaceTool.move`,Qp,function(e){var t=e.context,o=t.line,s=t.axis,c=t.movingShapes,l=t.resizingShapes;if(t.initialized){if(!t.dragGroup){var u=n.getLayer(`space`);o=F(`path`),P(o,`d`,`M0,0 L0,0`),I(o).add(`djs-crosshair`),L(u,o),t.line=o;var d=F(`g`);P(d,r.cls(`djs-drag-group`,[`no-events`])),L(n.getActiveLayer(),d),a(c,d);var f=new Set(c);b(l,function(e){f.add(e)});var p=new Set,m=t.movingConnections=[];f.forEach(function(e){b(e.outgoing,function(e){!p.has(e)&&A(e)&&f.has(e.target)&&(p.add(e),m.push(e))})}),a(m,d),t.dragGroup=d}if(!t.frameGroup){var h=F(`g`);P(h,r.cls(`djs-frame-group`,[`no-events`])),L(n.getActiveLayer(),h);var g=[];b(l,function(e){var t=i.addFrame(e,h),r=t.getBBox();g.push({element:t,initialBounds:r}),n.addMarker(e,Zp)}),t.frameGroup=h,t.frames=g}var _={x:`M`+e.x+`, -10000 L`+e.x+`, 10000`,y:`M -10000, `+e.y+` L 10000, `+e.y};P(o,{d:_[s]});var v={x:`y`,y:`x`},y={x:e.dx,y:e.dy};y[v[t.axis]]=0,Bt(t.dragGroup,y.x,y.y),b(t.frames,function(e){var n=e.element,r=e.initialBounds,i,a;t.direction===`e`?P(n,{width:$p(r.width+y.x,5)}):(i=$p(r.width-y.x,5),P(n,{width:i,x:r.x+r.width-i})),t.direction===`s`?P(n,{height:$p(r.height+y.y,5)}):(a=$p(r.height-y.y,5),P(n,{height:a,y:r.y+r.height-a}))})}}),e.on(`spaceTool.cleanup`,function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,a=t.resizingShapes,o=t.line,s=t.dragGroup,c=t.frameGroup;b(r,function(e){n.removeMarker(e,Xp)}),b(i,function(e){n.removeMarker(e,Xp)}),s&&(ke(o),ke(s)),b(a,function(e){n.removeMarker(e,Zp)}),c&&ke(c)})}em.$inject=[`eventBus`,`elementRegistry`,`canvas`,`styles`,`previewSupport`];var tm={__init__:[`spaceToolPreview`],__depends__:[Ya,eo,Np,Ps,np],spaceTool:[`type`,Gp],spaceToolPreview:[`type`,em]};function nm(e,t){e.invoke(Gp,this),this._canvas=t}nm.$inject=[`injector`,`canvas`],z(nm,Gp),nm.prototype.calculateAdjustments=function(e,t,n,r){var a=this._canvas.getRootElement(),o=e[0]===a?null:e[0],s=[];o&&(s=i(dt(a.children.filter(e=>O(e,`bpmn:Artifact`)),it(o))));let c=[...e,...s];var l=Gp.prototype.calculateAdjustments.call(this,c,t,n,r);return l.resizingShapes=l.resizingShapes.filter(function(e){return!(O(e,`bpmn:TextAnnotation`)||rm(e)&&(t===`y`&&He(e)||t===`x`&&!He(e)))}),l};function rm(e){return O(e,`bpmn:Participant`)&&!k(e).processRef}var im={__depends__:[tm],spaceTool:[`type`,nm]};function Y(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)}Y.$inject=[`eventBus`,`injector`],Y.prototype.execute=function(e,t){if(!e)throw Error(`command required`);this._currentExecution.trigger=`execute`;let n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Y.prototype.canExecute=function(e,t){let n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,`canExecute`,n);if(i===void 0){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},Y.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire(`changed`,{trigger:`clear`})},Y.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger=`undo`,this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),t&&t.id===e.id);)e=t;this._popAction()}},Y.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger=`redo`,this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),t&&t.id===e.id);)e=t;this._popAction()}},Y.prototype.register=function(e,t){this._setHandler(e,t)},Y.prototype.registerHandler=function(e,t){if(!e||!t)throw Error(`command and handlerCls must be defined`);let n=this._injector.instantiate(t);this.register(e,n)},Y.prototype.canUndo=function(){return!!this._getUndoAction()},Y.prototype.canRedo=function(){return!!this._getRedoAction()},Y.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Y.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Y.prototype._internalUndo=function(e){let t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo(()=>{this._fire(t,`revert`,e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,`reverted`,e)})},Y.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);let r=t?[e+`.`+t,t]:[e],i;n=this._eventBus.createEvent(n);for(let e of r)if(i=this._eventBus.fire(`commandStack.`+e,n),n.cancelBubble)break;return i},Y.prototype._createId=function(){return this._uid++},Y.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Y.prototype._internalExecute=function(e,t){let n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw Error(`no command handler registered for <`+n+`>`);this._pushAction(e),t||(this._fire(n,`preExecute`,e),i.preExecute&&i.preExecute(r),this._fire(n,`preExecuted`,e)),this._atomicDo(()=>{this._fire(n,`execute`,e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,`executed`,e)}),t||(this._fire(n,`postExecute`,e),i.postExecute&&i.postExecute(r),this._fire(n,`postExecuted`,e)),this._popAction()},Y.prototype._pushAction=function(e){let t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw Error(`illegal invocation in <execute> or <revert> phase (action: `+e.command+`)`);e.id||=r&&r.id||this._createId(),n.push(e)},Y.prototype._popAction=function(){let e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire(`elements.changed`,{elements:v(`id`,r.reverse())}),r.length=0,this._fire(`changed`,{trigger:t}),e.trigger=null)},Y.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=m(e)?e:[e],t.dirty=t.dirty.concat(e))},Y.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Y.prototype._revertedAction=function(e){this._stackIdx--},Y.prototype._getHandler=function(e){return this._handlerMap[e]},Y.prototype._setHandler=function(e,t){if(!e||!t)throw Error(`command and handler required`);if(this._handlerMap[e])throw Error(`overriding handler for command <`+e+`>`);this._handlerMap[e]=t};var am={commandStack:[`type`,Y]};function om(e,t){if(typeof t!=`function`)throw Error(`removeFn iterator must be a function`);if(!e)return[];for(var n;n=e[0];)t(n);return e}var sm=250,cm=1400;function lm(e,t,n){B.call(this,t);var r=e.get(`movePreview`,!1);t.on(`shape.move.start`,cm,function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=um(n),t.validatedShapes=um(r)}),r&&t.on(`shape.move.start`,sm,function(e){var t=e.context,n=new Set(t.shapes),i=new Set;for(let e of n)for(let t of e.labels)!t.hidden&&!n.has(t)&&i.add(t),e.labelTarget&&i.add(e);for(let e of i)r.makeDraggable(t,e,!0)}),this.preExecuted(`elements.move`,cm,function(e){var t=e.context.closure,n=t.enclosedElements,r=[];b(n,function(e){b(e.labels,function(e){n[e.id]||r.push(e)})}),t.addAll(r)}),this.preExecute([`connection.delete`,`shape.delete`],function(e){var t=e.context;om((t.connection||t.shape).labels,function(e){n.removeShape(e,{nested:!0})})}),this.execute(`shape.delete`,function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=Pe(r.labels,n),t.labelTarget=r,n.labelTarget=null)}),this.revert(`shape.delete`,function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Ve(r.labels,n,i),n.labelTarget=r)})}z(lm,B),lm.$inject=[`injector`,`eventBus`,`modeling`];function um(e){var t=new Set(e);return u(e,function(e){return!t.has(e.labelTarget)})}var dm={__init__:[`labelSupport`],labelSupport:[`type`,lm]},fm=251,pm=1401,mm=`attach-ok`;function hm(e,t,n,r,i){B.call(this,t);var a=e.get(`movePreview`,!1);t.on(`shape.move.start`,pm,function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=_m(n),t.validatedShapes=vm(r)}),a&&t.on(`shape.move.start`,fm,function(e){var t=e.context,n=t.shapes,r=gm(n);b(r,function(e){a.makeDraggable(t,e,!0),b(e.labels,function(e){a.makeDraggable(t,e,!0)})})}),a&&t.on(`shape.move.start`,function(e){var r=e.context.shapes;if(r.length===1){var i=r[0].host;i&&(n.addMarker(i,mm),t.once([`shape.move.out`,`shape.move.cleanup`],function(){n.removeMarker(i,mm)}))}}),this.preExecuted(`elements.move`,pm,function(e){var t=e.context,n=t.closure,r=t.shapes,i=gm(r);b(i,function(e){n.add(e,n.topLevel[e.host.id])})}),this.postExecuted(`elements.move`,function(e){var t=e.context,n=t.shapes,r=t.newHost,a;r&&n.length!==1||(a=r?n:u(n,function(e){var t=e.host;return ym(e)&&!bm(n,t)}),b(a,function(e){i.updateAttachment(e,r)}))}),this.postExecuted(`elements.move`,function(e){var t=e.context.shapes;b(t,function(e){b(e.attachers,function(e){b(e.outgoing.slice(),function(e){r.allowed(`connection.reconnect`,{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),b(e.incoming.slice(),function(e){r.allowed(`connection.reconnect`,{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute(`shape.create`,function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute(`shape.replace`,function(e){var t=e.context,n=t.oldShape,a=t.newShape;om(n.attachers,function(e){r.allowed(`elements.move`,{target:a,shapes:[e]})===`attach`?i.updateAttachment(e,a):i.removeShape(e)}),a.attachers.length&&b(a.attachers,function(e){var t=zl(e,n,a);i.moveShape(e,t,e.parent)})}),this.postExecute(`shape.resize`,function(e){var t=e.context,n=t.shape,r=t.oldBounds,a=t.newBounds,o=n.attachers;(t.hints||{}).attachSupport!==!1&&b(o,function(e){var t=zl(e,r,a);i.moveShape(e,t,e.parent),b(e.labels,function(e){i.moveShape(e,t,e.parent)})})}),this.preExecute(`shape.delete`,function(e){var t=e.context.shape;om(t.attachers,function(e){i.removeShape(e)}),t.host&&i.updateAttachment(t,null)})}z(hm,B),hm.$inject=[`injector`,`eventBus`,`canvas`,`rules`,`modeling`];function gm(e){return f(ae(e,function(e){return e.attachers||[]}))}function _m(e){var n=gm(e);return t(`id`,e,n)}function vm(e){var t=ne(e,`id`);return u(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}function ym(e){return!!e.host}function bm(e,t){return e.indexOf(t)!==-1}var xm={__depends__:[eo],__init__:[`attachSupport`],attachSupport:[`type`,hm]};function Sm(e){this._model=e}Sm.$inject=[`moddle`],Sm.prototype._needsId=function(e){return E(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`])},Sm.prototype._ensureId=function(e){if(e.id)this._model.ids.claim(e.id,e);else{var t=O(e,`bpmn:Activity`)?`Activity`:O(e,`bpmn:Event`)?`Event`:O(e,`bpmn:Gateway`)?`Gateway`:E(e,[`bpmn:SequenceFlow`,`bpmn:MessageFlow`])?`Flow`:(e.$type||``).replace(/^[^:]*:/g,``);t+=`_`,!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))}},Sm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Sm.prototype.createDiLabel=function(){return this.create(`bpmndi:BPMNLabel`,{bounds:this.createDiBounds()})},Sm.prototype.createDiShape=function(e,t){return this.create(`bpmndi:BPMNShape`,T({bpmnElement:e,bounds:this.createDiBounds()},t))},Sm.prototype.createDiBounds=function(e){return this.create(`dc:Bounds`,e)},Sm.prototype.createDiWaypoints=function(e){var t=this;return ae(e,function(e){return t.createDiWaypoint(e)})},Sm.prototype.createDiWaypoint=function(e){return this.create(`dc:Point`,ie(e,[`x`,`y`]))},Sm.prototype.createDiEdge=function(e,t){return this.create(`bpmndi:BPMNEdge`,T({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Sm.prototype.createDiPlane=function(e,t){return this.create(`bpmndi:BPMNPlane`,T({bpmnElement:e},t))};var Cm={width:100,height:80},wm={width:100,height:80},Tm={width:50,height:50},Em={width:36,height:36},Dm={width:350,height:200},Om={width:100,height:80},km={width:600,height:250},Am={width:250,height:600},jm={width:400,height:60},Mm={width:60,height:400},Nm={width:400,height:100},Pm={width:36,height:50},Fm={width:50,height:50},Im={width:100,height:40},Lm={width:300,height:300};function Rm(e,t){let n=k(e);if(t||=D(e),O(n,`bpmn:SubProcess`))return R(n,t)?{...Dm}:{...Om};if(O(n,`bpmn:Task`))return{...wm};if(O(n,`bpmn:Gateway`))return{...Tm};if(O(n,`bpmn:Event`))return{...Em};if(O(n,`bpmn:Participant`)){let e=!t||t.isHorizontal===void 0||t.isHorizontal===!0;return R(n,t)?e?{...km}:{...Am}:e?{...jm}:{...Mm}}return O(n,`bpmn:Lane`)?{...Nm}:O(n,`bpmn:DataObjectReference`)?{...Pm}:O(n,`bpmn:DataStoreReference`)?{...Fm}:O(n,`bpmn:TextAnnotation`)?{...Im}:O(n,`bpmn:Group`)?{...Lm}:{...Cm}}function zm(e,t){nt.call(this),this._bpmnFactory=e,this._moddle=t}z(zm,nt),zm.$inject=[`bpmnFactory`,`moddle`],zm.prototype._baseCreate=nt.prototype.create,zm.prototype.create=function(e,t){if(e===`label`){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,T({type:`label`,di:n},me,t))}return this.createElement(e,t)},zm.prototype.createElement=function(e,t){t=T({},t||{});var n,r=t.businessObject,i=t.di;if(!r){if(!t.type)throw Error(`no shape type specified`);r=this._bpmnFactory.create(t.type)}if(!Hm(i)){var a=T({},i||{},{id:r.id+`_di`});i=e===`root`?this._bpmnFactory.createDiPlane(r,a):e===`connection`?this._bpmnFactory.createDiEdge(r,a):this._bpmnFactory.createDiShape(r,a)}O(r,`bpmn:Group`)&&(t=T({isFrame:!0},t)),t=Bm(r,t,[`processRef`,`isInterrupting`,`associationDirection`,`isForCompensation`]),t.isExpanded&&(t=Vm(i,t,`isExpanded`)),E(r,[`bpmn:Lane`,`bpmn:Participant`])&&(t=Vm(i,t,`isHorizontal`)),O(r,`bpmn:SubProcess`)&&(t.collapsed=!R(r,i)),O(r,`bpmn:ExclusiveGateway`)&&(p(i,`isMarkerVisible`)?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),w(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),w(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var o,s;return t.eventDefinitionType&&(o=r.get(`eventDefinitions`)||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType===`bpmn:ConditionalEventDefinition`&&(s.condition=this._bpmnFactory.create(`bpmn:FormalExpression`)),o.push(s),s.$parent=r,r.eventDefinitions=o,delete t.eventDefinitionType),n=this.getDefaultSize(r,i),t=T({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)},zm.prototype.getDefaultSize=function(e,t){return Rm(e,t)},zm.prototype.createParticipantShape=function(e){return l(e)||(e={isExpanded:e}),e=T({type:`bpmn:Participant`},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create(`bpmn:Process`)),this.createShape(e)};function Bm(e,t,n){return b(n,function(n){t=Vm(e,t,n)}),t}function Vm(e,t,r){return t[r]===void 0?t:(e[r]=t[r],n(t,[r]))}function Hm(e){return E(e,[`bpmndi:BPMNShape`,`bpmndi:BPMNEdge`,`bpmndi:BPMNDiagram`,`bpmndi:BPMNPlane`])}function Um(e,t){this._modeling=e,this._canvas=t}Um.$inject=[`modeling`,`canvas`],Um.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;b(n,function(e){var n={x:0,y:0};w(r.left)?n.x=r.left-e.x:w(r.right)?n.x=r.right-e.width-e.x:w(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:w(r.top)?n.y=r.top-e.y:w(r.bottom)?n.y=r.bottom-e.height-e.y:w(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},Um.prototype.postExecute=function(e){};function Wm(e){this._modeling=e}Wm.$inject=[`modeling`],Wm.prototype.preExecute=function(e){var t=e.source;if(!t)throw Error(`source required`);var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},Wm.prototype.postExecute=function(e){var t=e.hints||{};Gm(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function Gm(e,t){return o(e.outgoing,function(e){return e.target===t})}function Km(e,t){this._canvas=e,this._layouter=t}Km.$inject=[`canvas`,`layouter`],Km.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,a=e.parentIndex,o=e.hints;if(!n||!r)throw Error(`source and target required`);if(!i)throw Error(`parent required`);return t.source=n,t.target=r,t.waypoints||=this._layouter.layoutConnection(t,o),this._canvas.addConnection(t,i,a),t},Km.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var qm=Math.round;function Jm(e){this._modeling=e}Jm.$inject=[`modeling`],Jm.prototype.preExecute=function(e){var t=e.elements,r=e.parent,a=e.parentIndex,o=e.position,s=e.hints,c=this._modeling;b(t,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var l=u(t,function(e){return!e.hidden}),d=it(l);b(t,function(e){A(e)&&(e.waypoints=ae(e.waypoints,function(e){return{x:qm(e.x-d.x-d.width/2+o.x),y:qm(e.y-d.y-d.height/2+o.y)}})),T(e,{x:qm(e.x-d.x-d.width/2+o.x),y:qm(e.y-d.y-d.height/2+o.y)})});var f=new Set(Ot(t)),p={};b(t,function(e){if(A(e))p[e.id]=h(a)?c.createConnection(p[e.source.id],p[e.target.id],a,e,e.parent||r,s):c.createConnection(p[e.source.id],p[e.target.id],e,e.parent||r,s);else{var t=T({},s);f.has(e)||(t.autoResize=!1),j(e)&&(t=n(t,[`attach`])),p[e.id]=h(a)?c.createShape(e,ie(e,[`x`,`y`,`width`,`height`]),e.parent||r,a,t):c.createShape(e,ie(e,[`x`,`y`,`width`,`height`]),e.parent||r,t)}}),e.elements=i(p)};var Ym=Math.round;function Xm(e){this._canvas=e}Xm.$inject=[`canvas`],Xm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw Error(`parent required`);if(!n)throw Error(`position required`);return n.width===void 0?T(t,{x:n.x-Ym(t.width/2),y:n.y-Ym(t.height/2)}):T(t,n),this._canvas.addShape(t,r,i),t},Xm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Zm(e){Xm.call(this,e)}z(Zm,Xm),Zm.$inject=[`canvas`];var Qm=Xm.prototype.execute;Zm.prototype.execute=function(e){var t=e.shape;return eh(t),t.labelTarget=e.labelTarget,Qm.call(this,e)};var $m=Xm.prototype.revert;Zm.prototype.revert=function(e){return e.shape.labelTarget=null,$m.call(this,e)};function eh(e){[`width`,`height`].forEach(function(t){e[t]===void 0&&(e[t]=0)})}function th(e,t){this._canvas=e,this._modeling=t}th.$inject=[`canvas`,`modeling`],th.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;om(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),om(n.outgoing,function(e){t.removeConnection(e,{nested:!0})})},th.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pe(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},th.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ve(n.children,t,r),this._canvas.addConnection(t,n),t};function nh(e,t){this._modeling=e,this._elementRegistry=t}nh.$inject=[`modeling`,`elementRegistry`],nh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,r=e.elements;b(r,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};function rh(e,t){this._canvas=e,this._modeling=t}rh.$inject=[`canvas`,`modeling`],rh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;om(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),om(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),om(n.children,function(e){A(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},rh.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pe(r.children,n),t.removeShape(n),n},rh.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ve(r.children,n,i),t.addShape(n,r),n};function ih(e){this._modeling=e}ih.$inject=[`modeling`];var ah={x:`y`,y:`x`};ih.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function a(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function o(e){return e[r]+e[i]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}function l(e,n){var i={y:0};i[r]=e-o(n),i[r]&&(i[ah[r]]=0,t.moveElements([n],i,n.parent))}var u=n[0],d=s(n),f=n[d],p,m,h=0;b(n,function(e,t){var u,f,p;e.elements.length<2?t&&t!==n.length-1&&(a(e,e.elements[0]),h+=c(e.range)):(u=y(e.elements,r),f=u[0],t===d&&(f=u[s(u)]),p=o(f),e.range=null,b(u,function(t){l(p,t),e.range===null?e.range={min:t[r],max:t[r]+t[i]}:a(e,t)}),t&&t!==n.length-1&&(h+=c(e.range)))}),m=Math.abs(f.range.min-u.range.max),p=Math.round((m-h)/(n.length-1)),!(p<n.length-1)&&b(n,function(e,a){var o={},s;e!==u&&e!==f&&(s=n[a-1],e.range.max=0,b(e.elements,function(n,a){o[ah[r]]=0,o[r]=s.range.max-n[r]+p,e.range.min!==n[r]&&(o[r]+=n[r]-e.range.min),o[r]&&t.moveElements([n],o,n.parent),e.range.max=Math.max(n[r]+n[i],a?e.range.max:0)}))})},ih.prototype.postExecute=function(e){};function oh(e,t){this._layouter=e,this._canvas=t}oh.$inject=[`layouter`,`canvas`],oh.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return T(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},oh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function sh(){}sh.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,a=t.parent;return e.oldParent=a,e.oldParentIndex=Fe(a.children,t),Ve(r.children,t,i),t.parent=r,b(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},sh.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,a=e.delta;return Fe(n.children,t),Ve(r.children,t,i),t.parent=r,b(t.waypoints,function(e){e.x-=a.x,e.y-=a.y,e.original&&(e.original.x-=a.x,e.original.y-=a.y)}),t};function ch(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}ch.prototype.add=function(e,t){return this.addAll([e],t)},ch.prototype.addAll=function(e,t){var n=rt(e,!!t,this);return T(this,n),this};function lh(e){this._modeling=e}lh.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lh.prototype.moveClosure=function(e,t,n,r,i){var a=this._modeling,o=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;i&&i.parent===n&&(u=!0),b(o,function(e){a.moveShape(e,t,l[e.id]&&!u&&n,{recurse:!1,layout:!1})}),b(s,function(e){var r=!!o[e.source.id],i=!!o[e.target.id];c[e.id]&&r&&i?a.moveConnection(e,t,l[e.id]&&!u&&n):a.layoutConnection(e,{connectionStart:r&&ru(e,e.source,t),connectionEnd:i&&iu(e,e.target,t)})})},lh.prototype.getClosure=function(e){return new ch().addAll(e,!0)};function uh(e){this._helper=new lh(e)}uh.$inject=[`modeling`],uh.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},uh.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function dh(e){this._modeling=e,this._helper=new lh(e)}dh.$inject=[`modeling`],dh.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,a=t.parent;return e.oldBounds=ie(t,[`x`,`y`,`width`,`height`]),e.oldParent=a,e.oldParentIndex=Fe(a.children,t),Ve(r.children,t,i),T(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},dh.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;r.layout!==!1&&(b(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:iu(e,t,n)})}),b(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:ru(e,t,n)})})),r.recurse!==!1&&this.moveChildren(e)},dh.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ve(n.children,t,r),T(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},dh.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},dh.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function fh(e){this._modeling=e}fh.$inject=[`modeling`],fh.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw Error(`newSource or newTarget required`);return m(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},fh.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,a=e.hints||{},o={};a.connectionStart&&(o.connectionStart=a.connectionStart),a.connectionEnd&&(o.connectionEnd=a.connectionEnd),a.layoutConnection!==!1&&(n&&(!r||a.docking===`source`)&&(o.connectionStart=o.connectionStart||ph(m(i)?i[0]:i)),r&&(!n||a.docking===`target`)&&(o.connectionEnd=o.connectionEnd||ph(m(i)?i[i.length-1]:i)),a.newWaypoints&&(o.waypoints=a.newWaypoints),this._modeling.layoutConnection(t,o))},fh.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i};function ph(e){return e.original||e}function mh(e,t){this._modeling=e,this._rules=t}mh.$inject=[`modeling`,`rules`],mh.prototype.preExecute=function(e){var t=this,n=this._modeling,r=this._rules,i=e.oldShape,a=e.newData,o=e.hints||{},s;function c(e,t,n){return r.allowed(`connection.reconnect`,{connection:n,source:e,target:t})}var l={x:a.x,y:a.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(a,l,i.parent,o),i.host&&n.updateAttachment(s,i.host);var d;o.moveChildren!==!1&&(d=i.children.slice(),n.moveElements(d,{x:0,y:0},s,o));var f=i.incoming.slice(),p=i.outgoing.slice();b(f,function(e){var n=e.source;c(n,s,e)&&t.reconnectEnd(e,s,nu(e,s,u),o)}),b(p,function(e){var n=e.target;c(s,n,e)&&t.reconnectStart(e,s,tu(e,s,u),o)})},mh.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},mh.prototype.execute=function(e){},mh.prototype.revert=function(e){},mh.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},mh.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},mh.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)};function hh(e){this._modeling=e}hh.$inject=[`modeling`],hh.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw Error(`newBounds must have {x, y, width, height} properties`);if(r&&(n.width<r.width||n.height<r.height))throw Error(`width and height cannot be less than minimum height and width`);if(!r&&n.width<10||n.height<10)throw Error(`width and height cannot be less than 10px`);return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},T(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},hh.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;(e.hints||{}).layout!==!1&&(b(n.incoming,function(e){t.layoutConnection(e,{connectionEnd:nu(e,n,r)})}),b(n.outgoing,function(e){t.layoutConnection(e,{connectionStart:tu(e,n,r)})}))},hh.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return T(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function gh(e){this._modeling=e}gh.$inject=[`modeling`],gh.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,a=e.start,o={};this.moveShapes(r,t),b(i,function(e){o[e.id]=xh(e)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(Fp(r,i),t,n,a,r,i,o)},gh.prototype.execute=function(){},gh.prototype.revert=function(){},gh.prototype.moveShapes=function(e,t){var n=this;b(e,function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})})},gh.prototype.resizeShapes=function(e,t,n){var r=this;b(e,function(e){var i=Ip(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})})},gh.prototype.updateConnectionWaypoints=function(e,t,n,r,i,a,o){var s=this,c=new Set(i),l=new Set(a);b(e,function(e){var i=e.source,a=e.target,u=vh(e),d=yh(n),f={},p=c.has(i)||l.has(i),m=c.has(a)||l.has(a);p&&m?(u=ae(u,function(e){return bh(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&bh(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e}),s._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(p||m)&&(c.has(i)?f.connectionStart=ru(e,i,t):c.has(a)?f.connectionEnd=iu(e,a,t):l.has(i)?f.connectionStart=tu(e,i,o[i.id]):l.has(a)&&(f.connectionEnd=nu(e,a,o[a.id])),s._modeling.layoutConnection(e,f))})};function _h(e){return T({},e)}function vh(e){return ae(e.waypoints,function(e){return e=_h(e),e.original&&(e.original=_h(e.original)),e})}function yh(e){switch(e){case`n`:return`y`;case`w`:return`x`;case`s`:return`y`;case`e`:return`x`}}function bh(e,t,n){var r=yh(n);if(/e|s/.test(n))return e[r]>t;if(/n|w/.test(n))return e[r]<t}function xh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Sh(e){this._modeling=e}Sh.$inject=[`modeling`],Sh.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ch(n),t.collapsed=!t.collapsed;var r=wh(n,t.collapsed);return[t].concat(r)},Sh.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=t.children,i=Th(r,n);return t.collapsed=!t.collapsed,[t].concat(i)};function Ch(e){var t={};return b(e,function(e){t[e.id]=e.hidden,e.children&&(t=T({},t,Ch(e.children)))}),t}function wh(e,t){var n=[];return b(e,function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(wh(e.children,e.collapsed||t)))}),n}function Th(e,t){var n=[];return b(e,function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Th(e.children,t)))}),n}function Eh(e){this._modeling=e}Eh.$inject=[`modeling`],Eh.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=Dh(r,t),Oh(n,t),t.host=n,t},Eh.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,Dh(n,t),Oh(r,t,i),t};function Dh(e,t){return Fe(e&&e.attachers,t)}function Oh(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ve(r,t,n)}}function kh(){}kh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function X(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on(`diagram.init`,function(){r.registerHandlers(n)})}X.$inject=[`eventBus`,`elementFactory`,`commandStack`],X.prototype.getHandlers=function(){return{"shape.append":Wm,"shape.create":Xm,"shape.delete":rh,"shape.move":dh,"shape.resize":hh,"shape.replace":mh,"shape.toggleCollapse":Sh,spaceTool:gh,"label.create":Zm,"connection.create":Km,"connection.delete":th,"connection.move":sh,"connection.layout":oh,"connection.updateWaypoints":kh,"connection.reconnect":fh,"elements.create":Jm,"elements.move":uh,"elements.delete":nh,"elements.distribute":ih,"elements.align":Um,"element.updateAttachment":Eh}},X.prototype.registerHandlers=function(e){b(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},X.prototype.moveShape=function(e,t,n,r,i){typeof r==`object`&&(i=r,r=null);var a={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute(`shape.move`,a)},X.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute(`element.updateAttachment`,n)},X.prototype.moveElements=function(e,t,n,r){r||={};var i=r.attach,a=n,o;i===!0?(o=n,a=n.parent):i===!1&&(o=null);var s={shapes:e,delta:t,newParent:a,newHost:o,hints:r};this._commandStack.execute(`elements.move`,s)},X.prototype.moveConnection=function(e,t,n,r,i){typeof r==`object`&&(i=r,r=void 0);var a={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute(`connection.move`,a)},X.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute(`connection.layout`,n)},X.prototype.createConnection=function(e,t,n,r,i,a){typeof n==`object`&&(a=i,i=r,r=n,n=void 0),r=this._create(`connection`,r);var o={source:e,target:t,parent:i,parentIndex:n,connection:r,hints:a};return this._commandStack.execute(`connection.create`,o),o.connection},X.prototype.createShape=function(e,t,n,r,i){typeof r!=`number`&&(i=r,r=void 0),i||={};var a=i.attach,o,s;e=this._create(`shape`,e),a?(o=n.parent,s=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute(`shape.create`,c),c.shape},X.prototype.createElements=function(e,t,n,r,i){m(e)||(e=[e]),typeof r!=`number`&&(i=r,r=void 0),i||={};var a={position:t,elements:e,parent:n,parentIndex:r,hints:i};return this._commandStack.execute(`elements.create`,a),a.elements},X.prototype.createLabel=function(e,t,n,r){n=this._create(`label`,n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute(`label.create`,i),i.shape},X.prototype.appendShape=function(e,t,n,r,i){i||={},t=this._create(`shape`,t);var a={source:e,position:n,target:r,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute(`shape.append`,a),a.shape},X.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute(`elements.delete`,t)},X.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute(`elements.distribute`,r)},X.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute(`shape.delete`,n)},X.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute(`connection.delete`,n)},X.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute(`shape.replace`,r),r.newShape},X.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute(`elements.align`,n)},X.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute(`shape.resize`,i)},X.prototype.createSpace=function(e,t,n,r,i){var a={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute(`spaceTool`,a)},X.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute(`connection.updateWaypoints`,r)},X.prototype.reconnect=function(e,t,n,r,i){var a={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute(`connection.reconnect`,a)},X.prototype.reconnectStart=function(e,t,n,r){r||={},this.reconnect(e,t,e.target,n,T(r,{docking:`source`}))},X.prototype.reconnectEnd=function(e,t,n,r){r||={},this.reconnect(e,e.source,t,n,T(r,{docking:`target`}))},X.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},X.prototype._create=function(e,t){return zt(t)?t:this._elementFactory.create(e,t)},X.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute(`shape.toggleCollapse`,n)};function Ah(e){this._elementRegistry=e}Ah.$inject=[`elementRegistry`],Ah.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw Error(`<moddleElement> required`);var i=e.changed||this._getVisualReferences(n).concat(t),a=e.oldProperties||jh(n,d(r));return Mh(n,r),e.oldProperties=a,e.changed=i,i},Ah.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return Mh(n,t),r},Ah.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return O(e,`bpmn:DataObject`)?Nh(e,t):[]};function jh(e,t){return c(t,function(t,n){return t[n]=e.get(n),t},{})}function Mh(e,t){b(t,function(t,n){e.set(n,t)})}function Nh(e,t){return t.filter(function(t){return O(t,`bpmn:DataObjectReference`)&&k(t).dataObjectRef===e})}var Ph=`default`,Fh=`id`,Ih=`di`,Lh={width:0,height:0};function Rh(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Rh.$inject=[`elementRegistry`,`moddle`,`modeling`,`textRenderer`],Rh.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw Error(`element required`);var r=this._elementRegistry,i=this._moddle.ids,a=t.businessObject,o=Gh(e.properties),s=e.oldProperties||Bh(t,o);return zh(o,a)&&(i.unclaim(a[Fh]),r.updateId(t,o[Fh]),i.claim(o[Fh],a)),Ph in o&&(o[Ph]&&n.push(r.get(o[Ph].id)),a[Ph]&&n.push(r.get(a[Ph].id))),Hh(t,o),e.oldProperties=s,e.changed=n,n},Rh.prototype.postExecute=function(e){var t=e.element.label,n=t&&k(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,Lh)}},Rh.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,a=this._elementRegistry,o=this._moddle.ids;return Hh(t,r),zh(n,i)&&(o.unclaim(n[Fh]),a.updateId(t,r[Fh]),o.claim(r[Fh],i)),e.changed};function zh(e,t){return Fh in e&&e[Fh]!==t[Fh]}function Bh(e,t){var n=d(t),r=e.businessObject,i=D(e);return c(n,function(e,n){return e[n]=n===Ih?Vh(i,d(t.di)):r.get(n),e},{})}function Vh(e,t){return c(t,function(t,n){return t[n]=e&&e.get(n),t},{})}function Hh(e,t){var n=e.businessObject,r=D(e);b(t,function(e,t){t===Ih?r&&Uh(r,e):n.set(t,e)})}function Uh(e,t){b(t,function(t,n){e.set(n,t)})}var Wh=[`default`];function Gh(e){var t=T({},e);return Wh.forEach(function(n){n in e&&(t[n]=k(t[n]))}),t}function Kh(e,t){this._canvas=e,this._modeling=t}Kh.$inject=[`canvas`,`modeling`],Kh.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),a=i.businessObject,o=a.$parent,s=D(i);return t.setRootElement(n),t.removeRootElement(i),Ve(o.rootElements,r),r.$parent=o,Fe(o.rootElements,a),a.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]},Kh.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,a=i.businessObject,o=r.$parent,s=D(n);return t.setRootElement(i),t.removeRootElement(n),Fe(o.rootElements,r),r.$parent=null,Ve(o.rootElements,a),a.$parent=o,n.di=null,s.bpmnElement=a,i.di=s,[]};function qh(e,t){this._modeling=e,this._spaceTool=t}qh.$inject=[`modeling`,`spaceTool`],qh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,a=Yc(r),o=a===r,s=o?r:r.parent,c=Jc(s),l=He(r);if(l?i===`left`?i=`top`:i===`right`&&(i=`bottom`):i===`top`?i=`left`:i===`bottom`&&(i=`right`),!c.length){var d=l?{x:r.x+30,y:r.y,width:r.width-30,height:r.height}:{x:r.x,y:r.y+30,width:r.width,height:r.height-30};n.createShape({type:`bpmn:Lane`,isHorizontal:l},d,s)}var f=[];ht(a,function(e){return f.push(e),e.label&&f.push(e.label),e===r?[]:u(e.children,function(e){return e!==r})});var p,m,h,g,_;i===`top`?(p=-120,m=r.y,h=m+10,g=`n`,_=`y`):i===`left`?(p=-120,m=r.x,h=m+10,g=`w`,_=`x`):i===`bottom`?(p=120,m=r.y+r.height,h=m-10,g=`s`,_=`y`):i===`right`&&(p=120,m=r.x+r.width,h=m-10,g=`e`,_=`x`);var v=t.calculateAdjustments(f,_,p,h),y=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,y,g,h);var b=l?{x:r.x+(o?30:0),y:m-(i===`top`?120:0),width:r.width-(o?30:0),height:120}:{x:m-(i===`left`?120:0),y:r.y+(o?30:0),width:120,height:r.height-(o?30:0)};e.newLane=n.createShape({type:`bpmn:Lane`,isHorizontal:l},b,s)};function Jh(e){this._modeling=e}Jh.$inject=[`modeling`],Jh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Jc(n),a=i.length;if(a>r)throw Error(`more than <${r}> child lanes`);for(var o=He(n),s=o?n.height:n.width,c=Math.round(s/r),l,u,d,f=0;f<r;f++)l=f===r-1?s-c*f:c,u=o?{x:n.x+30,y:n.y+f*c,width:n.width-30,height:l}:{x:n.x+f*c,y:n.y+30,width:l,height:n.height-30},f<a?t.resizeShape(i[f],u):(d={type:`bpmn:Lane`,isHorizontal:o},t.createShape(d,u,n))};function Yh(e,t){this._modeling=e,this._spaceTool=t}Yh.$inject=[`modeling`,`spaceTool`],Yh.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;e.balanced===!1?this.resizeSpace(t,n):this.resizeBalanced(t,n)},Yh.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Xc(e,t);n.resizeShape(e,t),r.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Yh.prototype.resizeSpace=function(e,t){var n=this._spaceTool,r=N(e),i=Pc(N(t),r),a=Yc(e),o=[],s=[];ht(a,function(e){return o.push(e),(O(e,`bpmn:Lane`)||O(e,`bpmn:Participant`))&&s.push(e),e.children});var c,l,u,d,f;(i.bottom||i.top)&&(c=i.bottom||i.top,l=e.y+(i.bottom?e.height:0)+(i.bottom?-10:10),u=i.bottom?`s`:`n`,d=i.top>0||i.bottom<0?-c:c,f=n.calculateAdjustments(o,`y`,d,l),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:c},u)),(i.left||i.right)&&(c=i.right||i.left,l=e.x+(i.right?e.width:0)+(i.right?-10:100),u=i.right?`e`:`w`,d=i.left>0||i.right<0?-c:c,f=n.calculateAdjustments(s,`x`,d,l),n.makeSpace(f.movingShapes,f.resizingShapes,{x:c,y:0},u))};var Xh=`flowNodeRef`,Zh=`lanes`;function Qh(){}Qh.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},a=[];function o(e,t){var n=N(t),r={x:e.x+e.width/2,y:e.y+e.height/2};return r.x>n.left&&r.x<n.right&&r.y>n.top&&r.y<n.bottom}function s(e){n.indexOf(e)===-1&&(a.push(e),n.push(e))}function c(e){var t=Yc(e);return i[t.id]||(i[t.id]=qc(t)),i[t.id]}function l(e){return e.parent?c(e).filter(function(t){return o(e,t)}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=Yc(e);t&&n.indexOf(t)===-1&&(t.children.filter(function(e){return O(e,`bpmn:FlowNode`)}).forEach(s),n.push(t))}),e.forEach(s),a.forEach(function(e){var t=e.businessObject,n=t.get(Zh).slice(),i=l(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get(Xh).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},Qh.prototype.execute=function(e){var t=e.updates;return t||=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes),t.forEach(function(e){var t=e.flowNode,n=t.get(Zh);e.remove.forEach(function(e){Fe(n,e),Fe(e.get(Xh),t)}),e.add.forEach(function(e){Ve(n,e),Ve(e.get(Xh),t)})}),[]},Qh.prototype.revert=function(e){return e.updates.forEach(function(e){var t=e.flowNode,n=t.get(Zh);e.add.forEach(function(e){Fe(n,e),Fe(e.get(Xh),t)}),e.remove.forEach(function(e){Ve(n,e),Ve(e.get(Xh),t)})}),[]};var $h=`categoryValueRef`;function eg(e,t){this._bpmnFactory=e,this._elementRegistry=t}eg.$inject=[`bpmnFactory`,`elementRegistry`],eg.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,r=this._bpmnFactory,i=new Map,a=[],o=new Map;function s(e,t,n){if(t){var r=o.get(e);r||(r={},o.set(e,r)),!(n&&r.present)&&(n||!r.past)&&(n?r.present={categoryValue:t,root:og(e)}:r.past={categoryValue:t})}}function c(e){i.set(e,k(e))}function l(){n.filter(function(e){return O(e,`bpmn:FlowElement`)&&!j(e)&&e.parent}).forEach(c)}function u(e){var t=k(e),n=t.get(`categoryValueRef`);return n||(n=ic(r,t),a.push(tg(e,n))),n}function d(e){return e.reduce(function(e,t){var n=og(t),r=e.get(n);return r||(r=[],e.set(n,r)),r.push(t),e},new Map)}e=Array.from(e||[]);var f=d(e);t.length&&l(),e.forEach(c),n.filter(function(e){return O(e,`bpmn:Group`)&&!j(e)&&e.parent}).forEach(function(e){var t=k(e).get(`categoryValueRef`);if(!t){var n=og(e),r=f.get(n)||[],i=dt(r,e);Object.keys(i).length>0&&(t=u(e))}s(e,t,!0)}),t.forEach(function(e){s(e.groupShape,e.categoryValue,!1)}),a.length&&l();var p=Array.from(i.keys()),m=Array.from(o.values()).reduce(function(e,t){return t.present&&e.add(t.present.categoryValue),t.past&&e.add(t.past.categoryValue),e},new Set),h=new Map,g=d(p);return o.forEach(function(e,t){var n=e.present;if(n){var r=g.get(n.root)||[],i=dt(r,t);r.forEach(function(e){if(i[e.id]){var t=h.get(e);t||(t=new Set,h.set(e,t)),t.add(n.categoryValue)}})}}),{flowElements:p.reduce(function(e,t){var n=i.get(t),r=n.get($h),a=new Set(r),o=h.get(t)||new Set,s=Array.from(o).filter(function(e){return!a.has(e)}),c=r.filter(function(e){return m.has(e)&&!o.has(e)});return(s.length||c.length)&&e.push({businessObject:n,categoryValuesToAdd:s,categoryValuesToRemove:c}),e},[]),groups:a}},eg.prototype.execute=function(e){var t=e.updates;return t||=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries),ng(t.groups),ig(t.flowElements),[]},eg.prototype.revert=function(e){var t=e.updates;return ag(t.flowElements),rg(t.groups),[]};function tg(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function ng(e){e.forEach(function(e){k(e.groupShape).categoryValueRef=e.categoryValue,e.categoryValue.$parent=e.category})}function rg(e){e.forEach(function(e){k(e.groupShape).categoryValueRef=null})}function ig(e){e.forEach(function(e){var t=e.businessObject.get($h);e.categoryValuesToRemove.forEach(function(e){Fe(t,e)}),e.categoryValuesToAdd.forEach(function(e){Ve(t,e,!0)})})}function ag(e){e.forEach(function(e){var t=e.businessObject.get($h);e.categoryValuesToAdd.forEach(function(e){Fe(t,e)}),e.categoryValuesToRemove.forEach(function(e){Ve(t,e,!0)})})}function og(e){for(;e.parent;)e=e.parent;return e}function sg(e){this._moddle=e}sg.$inject=[`moddle`],sg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},sg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var cg={fill:void 0,stroke:void 0};function lg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(re(e)){var t=ug(e);if(t)return t}throw Error(`invalid color value: ${e}`)}}}lg.$inject=[`commandStack`],lg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||cg,r=this,i={};`fill`in n&&T(i,{"background-color":this._normalizeColor(n.fill)}),`stroke`in n&&T(i,{"border-color":this._normalizeColor(n.stroke)}),b(t,function(e){var t=A(e)?ie(i,[`border-color`]):i,n=D(e);if(dg(t),j(e)){if(!n||!O(n.label,`bpmndi:BPMNLabel`))return;r._commandStack.execute(`element.updateModdleProperties`,{element:e,moddleElement:n.label,properties:{color:i[`border-color`]}})}else{if(!E(n,[`bpmndi:BPMNEdge`,`bpmndi:BPMNShape`]))return;r._commandStack.execute(`element.updateProperties`,{element:e,properties:{di:t}})}})};function ug(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}function dg(e){`border-color`in e&&(e.stroke=e[`border-color`]),`background-color`in e&&(e.fill=e[`background-color`])}var fg={width:0,height:0};function pg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return ce(n,t,r!==n),[n,r]}function i(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!j(n)&&pe(n)&&!se(n)&&!mg(i)){var a=7,o=fe(n);o={x:o.x,y:o.y+a},e.createLabel(n,o,{id:r.id+`_label`,businessObject:r,di:n.di})}}function a(e){return e.oldLabel=ue(e.element),r(e.element,e.newLabel)}function o(e){return r(e.element,e.oldLabel)}function s(n){var r=n.element,i=r.label||r,a=n.newLabel,o=n.newBounds,s=n.hints||{};if(j(i)||O(i,`bpmn:TextAnnotation`)){if(j(i)&&mg(a))s.removeShape!==!1&&e.removeShape(i,{unsetLabel:!1});else{var c=ue(r);o===void 0&&(o=t.getExternalLabelBounds(i,c)),o&&e.resizeShape(i,o,fg)}}}this.preExecute=i,this.execute=a,this.revert=o,this.postExecute=s}pg.$inject=[`modeling`,`textRenderer`,`bpmnFactory`];function mg(e){return!e||!e.trim()}function hg(e,t,n,r){X.call(this,e,t,n),this._bpmnRules=r}z(hg,X),hg.$inject=[`eventBus`,`elementFactory`,`commandStack`,`bpmnRules`],hg.prototype.getHandlers=function(){var e=X.prototype.getHandlers.call(this);return e[`element.updateModdleProperties`]=Ah,e[`element.updateProperties`]=Rh,e[`canvas.updateRoot`]=Kh,e[`lane.add`]=qh,e[`lane.resize`]=Yh,e[`lane.split`]=Jh,e[`lane.updateRefs`]=Qh,e[`group.updateRefs`]=eg,e[`id.updateClaim`]=sg,e[`element.setColor`]=lg,e[`element.updateLabel`]=pg,e},hg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute(`element.updateLabel`,{element:e,newLabel:t,newBounds:n,hints:r||{}})},hg.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||=i.canConnect(e,t),n)return this.createConnection(e,t,n,e.parent,r)},hg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute(`element.updateModdleProperties`,{element:e,moddleElement:t,properties:n})},hg.prototype.updateProperties=function(e,t){this._commandStack.execute(`element.updateProperties`,{element:e,properties:t})},hg.prototype.resizeLane=function(e,t,n){this._commandStack.execute(`lane.resize`,{shape:e,newBounds:t,balanced:n})},hg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute(`lane.add`,n),n.newLane},hg.prototype.splitLane=function(e,t){this._commandStack.execute(`lane.split`,{shape:e,count:t})},hg.prototype.makeCollaboration=function(){var e=this._create(`root`,{type:`bpmn:Collaboration`}),t={newRoot:e};return this._commandStack.execute(`canvas.updateRoot`,t),e},hg.prototype.makeProcess=function(){var e=this._create(`root`,{type:`bpmn:Process`}),t={newRoot:e};return this._commandStack.execute(`canvas.updateRoot`,t),e},hg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute(`lane.updateRefs`,{flowNodeShapes:e,laneShapes:t})},hg.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute(`group.updateRefs`,{affectedFlowElements:e,affectedGroupEntries:t})},hg.prototype.claimId=function(e,t){this._commandStack.execute(`id.updateClaim`,{id:e,element:t,claiming:!0})},hg.prototype.unclaimId=function(e,t){this._commandStack.execute(`id.updateClaim`,{id:e,element:t})},hg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute(`element.setColor`,{elements:e,colors:t})};function gg(){}gg.prototype.layoutConnection=function(e,t){return t||={},[t.connectionStart||M(t.source||e.source),t.connectionEnd||M(t.target||e.target)]};var _g=20,vg=5,yg=Math.round,bg=20,xg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Sg(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Cg(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function wg(e,t,n){var r=xe(t,e,vg),i=n.split(`:`)[0],a=yg((t.x-e.x)/2+e.x),o=yg((t.y-e.y)/2+e.y),s,c,l=Cg(i,r),u=/h|r|l/.test(i),d=!1,f=!1;return l?(s=u?{x:a,y:e.y}:{x:e.x,y:o},c=u?`h:h`:`v:v`):(d=Sg(r,i),c=u?`h:v`:`v:h`,d?u?(f=o===e.y,s={x:e.x+_g*(/l/.test(i)?-1:1),y:f?o+_g:o}):(f=a===e.x,s={x:f?a+_g:a,y:e.y+_g*(/t/.test(i)?-1:1)}):s={x:a,y:o}),{waypoints:Ag(e,s,c).concat(s),directions:c,turnNextDirections:f}}function Tg(e,t,n){return wg(e,t,n)}function Eg(e,t,n){var r=wg(t,e,Og(n));return{waypoints:r.waypoints.slice().reverse(),directions:Og(r.directions),turnNextDirections:r.turnNextDirections}}function Dg(e,t){var n=e.directions.split(`:`)[1],r=t.directions.split(`:`)[0];e.turnNextDirections&&(n=n==`h`?`v`:`h`),t.turnNextDirections&&(r=r==`h`?`v`:`h`);var i=n+`:`+r;return{waypoints:Ag(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}function Og(e){return e.split(`:`).reverse().join(`:`)}function kg(e,t,n){var r=yg((t.x-e.x)/2+e.x),i=yg((t.y-e.y)/2+e.y);if(n===`h:v`)return[{x:t.x,y:e.y}];if(n===`v:h`)return[{x:e.x,y:t.y}];if(n===`h:h`)return[{x:r,y:e.y},{x:r,y:t.y}];if(n===`v:v`)return[{x:e.x,y:i},{x:t.x,y:i}];throw Error(`invalid directions: can only handle varians of [hv]:[hv]`)}function Ag(e,t,n){if(n||=`h:h`,!Vg(n))throw Error(`unknown directions: <`+n+`>: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }`);if(Hg(n)){var r=Tg(e,t,n),i=Eg(e,t,n),a=Dg(r,i);return[].concat(r.waypoints,a.waypoints,i.waypoints)}return kg(e,t,n)}function jg(e,t,n){var r=Ag(e,t,n);return r.unshift(e),r.push(t),Gg(r)}function Mg(e,t,n,r,i){var o=i&&i.preferredLayouts||[],s=a(o,`straight`)[0]||`h:h`,c=xg[s]||0,l=xe(e,t,c),u=Bg(l,s);n||=M(e),r||=M(t);var d=u.split(`:`);return jg(Wg(n,e,d[0],Ug(l)),Wg(r,t,d[1],l),u)}function Ng(e,t,n,r,i,a){m(n)&&(i=n,a=r,n=M(e),r=M(t)),a=T({preferredLayouts:[]},a),i||=[];var o=a.preferredLayouts.indexOf(`straight`)!==-1&&Ig(e,t,n,r,a);return o||(o=a.connectionEnd&&Rg(t,e,r,i),o)||(o=a.connectionStart&&Lg(e,t,n,i),o)?o:!a.connectionStart&&!a.connectionEnd&&i&&i.length?i:Mg(e,t,n,r,a)}function Pg(e,t,n){return e>=t&&e<=n}function Fg(e,t,n){return Pg(t[e],n[e],n[e]+n[{x:`width`,y:`height`}[e]])}function Ig(e,t,n,r,i){var a={},o,s=xe(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(o=`x`),/left|right/.test(s)&&(o=`y`),i.preserveDocking===`target`?Fg(o,r,e)?(a[o]=r[o],[{x:a.x===void 0?n.x:a.x,y:a.y===void 0?n.y:a.y,original:{x:a.x===void 0?n.x:a.x,y:a.y===void 0?n.y:a.y}},{x:r.x,y:r.y}]):null:Fg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:a.x===void 0?r.x:a.x,y:a.y===void 0?r.y:a.y,original:{x:a.x===void 0?r.x:a.x,y:a.y===void 0?r.y:a.y}}]):null):null}function Lg(e,t,n,r){return zg(e,t,n,r)}function Rg(e,t,n,r){var i=r.slice().reverse();return i=zg(e,t,n,i),i?i.reverse():null}function zg(e,t,n,r){function i(e){return e.length<3?!0:e.length>4?!1:!!C(e,function(t,n){var r=e[n-1];return r&&ge(t,r)<3})}function a(e,t,n){switch(Se(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}}function o(e,t,n){for(var r=e.length-2;r!==0;r--)if(_e(e[r],t,bg)||_e(e[r],n,bg))return e.slice(r);return e}if(i(r))return null;var s=r[0],c=r.slice(),l;return c[0]=n,c[1]=a(c[1],s,n),l=o(c,e,t),l!==c&&(c=zg(e,t,n,l)),c&&Se(c)?null:c}function Bg(e,t){if(Hg(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}}function Vg(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Hg(e){return e&&/t|r|b|l/.test(e)}function Ug(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]}function Wg(e,t,n,r){if(n===`h`&&(n=/left/.test(r)?`l`:`r`),n===`v`&&(n=/top/.test(r)?`t`:`b`),n===`t`)return{original:e,x:e.x,y:t.y};if(n===`r`)return{original:e,x:t.x+t.width,y:e.y};if(n===`b`)return{original:e,x:e.x,y:t.y+t.height};if(n===`l`)return{original:e,x:t.x,y:e.y};throw Error(`unexpected dockingDirection: <`+n+`>`)}function Gg(e){return e.reduce(function(t,n,r){var i=t[t.length-1],a=e[r+1];return be(i,a,n,0)||t.push(n),t},[])}var Kg=-10,qg=40,Jg={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},Yg={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},Xg={top:`bottom`,"top-right":`bottom-left`,"top-left":`bottom-right`,right:`left`,bottom:`top`,"bottom-right":`top-left`,"bottom-left":`top-right`,left:`right`},Zg={top:`t`,right:`r`,bottom:`b`,left:`l`};function Qg(e){this._elementRegistry=e}z(Qg,gg),Qg.prototype.layoutConnection=function(e,t){t||={};var n=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints,a=t.connectionStart,o=t.connectionEnd,s=this._elementRegistry,c,l;if(a||=r_(i&&i[0],n),o||=r_(i&&i[i.length-1],r),(O(e,`bpmn:Association`)||O(e,`bpmn:DataAssociation`))&&i&&!i_(n,r))return[a].concat(i.slice(1,-1),[o]);var u=Je(n,s)?Jg:Yg;return O(e,`bpmn:MessageFlow`)?c=e_(n,r,u):(O(e,`bpmn:SequenceFlow`)||i_(n,r))&&(c=n===r?{preferredLayouts:m_(n,e,u)}:O(n,`bpmn:BoundaryEvent`)?{preferredLayouts:h_(n,r,o,u)}:a_(n)||a_(r)?{preferredLayouts:u.subProcess,preserveDocking:n_(n)}:O(n,`bpmn:Gateway`)?{preferredLayouts:u.fromGateway}:O(r,`bpmn:Gateway`)?{preferredLayouts:u.toGateway}:{preferredLayouts:u.default}),c&&(c=T(c,t),l=Gg(Ng(n,r,a,o,i,c))),l||[a,o]};function $g(e){var t=e.host;return xe(M(e),t,Kg)}function e_(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:t_(e,t)}}function t_(e,t){return O(t,`bpmn:Participant`)?`source`:O(e,`bpmn:Participant`)?`target`:a_(t)?`source`:a_(e)||O(t,`bpmn:Event`)?`target`:O(e,`bpmn:Event`)?`source`:null}function n_(e){return a_(e)?`target`:`source`}function r_(e,t){return e?e.original||e:M(t)}function i_(e,t){return O(t,`bpmn:Activity`)&&O(e,`bpmn:BoundaryEvent`)&&t.businessObject.isForCompensation}function a_(e){return O(e,`bpmn:SubProcess`)&&R(e)}function o_(e,t){return e===t}function s_(e,t){return t.indexOf(e)!==-1}function c_(e){var t=/right|left/.exec(e);return t&&t[0]}function l_(e){var t=/top|bottom/.exec(e);return t&&t[0]}function u_(e,t){return Xg[e]===t}function d_(e,t){var n=Xg[c_(e)];return t.indexOf(n)!==-1}function f_(e,t){var n=Xg[l_(e)];return t.indexOf(n)!==-1}function p_(e){return e===`right`||e===`left`}function m_(e,t,n){var r=t.waypoints,i=r&&r.length&&xe(r[0],e);return i===`top`?n.loop.fromTop:i===`right`?n.loop.fromRight:i===`left`?n.loop.fromLeft:n.loop.fromBottom}function h_(e,t,n,r){var i=M(e),a=M(t),o=$g(e),s,c,l=o_(e.host,t),u=s_(o,[`top`,`right`,`bottom`,`left`]),d=xe(a,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?g_(o,u,e,t,n,r):(s=y_(o,d,u,r.isHorizontal),c=b_(o,d,u,r.isHorizontal),[s+`:`+c])}function g_(e,t,n,r,i,a){var o=Zg[t?e:a.isHorizontal?l_(e):c_(e)],s=t?p_(e)?__(`y`,n,r,i)?`h`:a.boundaryLoop.alternateHorizontalSide:__(`x`,n,r,i)?`v`:a.boundaryLoop.alternateVerticalSide:a.boundaryLoop.default;return[o+`:`+s]}function __(e,t,n,r){var i=qg;return!(v_(e,r,n,i)||v_(e,r,{x:n.x+n.width,y:n.y+n.height},i)||v_(e,r,M(t),i))}function v_(e,t,n,r){return Math.abs(t[e]-n[e])<r}function y_(e,t,n,r){if(n)return Zg[e];var i=l_(e),a=c_(e),o=l_(t),s=c_(t);if(r){if(o_(i,o)||u_(a,s))return Zg[i]}else if(o_(a,s)||u_(i,o))return Zg[a];return Zg[r?a:i]}function b_(e,t,n,r){if(n)return p_(e)?d_(e,t)||o_(e,t)?`h`:`v`:f_(e,t)||o_(e,t)?`v`:`h`;var i=l_(e),a=c_(e),o=l_(t),s=c_(t);return o&&!s?`v`:s&&!o?`h`:r?o_(i,o)?`h`:`v`:o_(a,s)?`v`:`h`}Qg.$inject=[`elementRegistry`];function x_(e){return T({original:e.point.original||e.point},e.actual)}function S_(e,t){this._elementRegistry=e,this._graphicsFactory=t}S_.$inject=[`elementRegistry`,`graphicsFactory`],S_.prototype.getCroppedWaypoints=function(e,t,n){t||=e.source,n||=e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),a=e.waypoints.slice(r.idx+1,i.idx);return a.unshift(x_(r)),a.push(x_(i)),a},S_.prototype.getDockingPoint=function(e,t,n){var r=e.waypoints,i=n?0:r.length-1,a=r[i];return{point:a,actual:this._getIntersection(t,e,n)||a,idx:i}},S_.prototype._getIntersection=function(e,t,n){var r=this._getShapePath(e),i=this._getConnectionPath(t);return ve(r,i,n)},S_.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},S_.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},S_.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var C_={__init__:[`modeling`,`bpmnUpdater`],__depends__:[Id,Nf,If,zf,kp,am,dm,xm,It,Ct,im],bpmnFactory:[`type`,Sm],bpmnUpdater:[`type`,Qe],elementFactory:[`type`,zm],modeling:[`type`,hg],layouter:[`type`,Qg],connectionDocking:[`type`,S_]},w_=Math.round;function T_(e,t,n,r,i,a){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=a}T_.prototype.create=function(e,t,n){let r=this._complexPreview,i=this._connectionDocking,a=this._elementFactory,o=this._eventBus,s=this._layouter,c=this._rules,l=a.createShape(T({type:t},n)),u=o.fire(`autoPlace`,{source:e,shape:l});if(!u)return;T(l,{x:u.x-w_(l.width/2),y:u.y-w_(l.height/2)});let d=c.allowed(`connection.create`,{source:e,target:l,hints:{targetParent:e.parent}}),f=null;d&&(f=a.createConnection(d),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=i.getCroppedWaypoints(f,e,l)),r.create({created:[l,f].filter(e=>!g(e))})},T_.prototype.cleanUp=function(){this._complexPreview.cleanUp()},T_.$inject=[`complexPreview`,`connectionDocking`,`elementFactory`,`eventBus`,`layouter`,`rules`];var E_={__depends__:[ja,Rs,C_],__init__:[`appendPreview`],appendPreview:[`type`,T_]},D_=Math.min,O_=Math.max;function k_(e){e.preventDefault()}function A_(e){e.stopPropagation()}function j_(e){return e.nodeType===Node.TEXT_NODE}function M_(e){return[].slice.call(e)}function N_(e){this.container=e.container,this.parent=gt(`<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>`),this.content=V(`[contenteditable]`,this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=S(this.autoResize,this),this.handlePaste=S(this.handlePaste,this)}N_.prototype.create=function(e,t,n,r){var i=this,a=this.parent,o=this.content,s=this.container;r=this.options=r||{},t=this.style=t||{};var c=ie(t,[`width`,`height`,`maxWidth`,`maxHeight`,`minWidth`,`minHeight`,`left`,`top`,`backgroundColor`,`position`,`overflow`,`border`,`wordWrap`,`textAlign`,`outline`,`transform`]);T(a.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`},c);var l=ie(t,[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`]);return T(o.style,{boxSizing:`border-box`,width:`100%`,outline:`none`,wordWrap:`break-word`},l),r.centerVertically&&T(o.style,{position:`absolute`,top:`50%`,transform:`translate(0, -50%)`},l),o.innerText=n,H.bind(o,`keydown`,this.keyHandler),H.bind(o,`mousedown`,A_),H.bind(o,`paste`,i.handlePaste),H.bind(o,`focusout`,this.focusoutHandler),r.autoResize&&H.bind(o,`input`,this.autoResize),r.resizable&&this.resizable(t),s.appendChild(a),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),a},N_.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var r=e.clipboardData?e.clipboardData.getData(`text/plain`):window.clipboardData.getData(`Text`);if(this.insertText(r),t.autoResize){var i=this.autoResize(n);i&&this.resizeHandler(i)}},N_.prototype.insertText=function(e){e=P_(e),!document.execCommand(`insertText`,!1,e)&&this._insertTextIE(e)},N_.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,a=t.endOffset,o=t.commonAncestorContainer,s=M_(o.childNodes),c,l;if(j_(o)){var u=n.textContent;n.textContent=u.substring(0,i)+e+u.substring(a),c=n,l=i+e.length}else if(n===this.content&&r===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,s[i]),c=d,l=d.textContent.length}else{var f=s.indexOf(n),p=s.indexOf(r);s.forEach(function(t,o){o===f?t.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(a):o>f&&o<=p&&ot(t)}),c=n,l=i+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},N_.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+`px`,this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},N_.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,a=parseInt(this.style.maxWidth)||1/0,o=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=gt(`<div class="djs-direct-editing-resize-handle"></div>`);var s,c,l,u,d=function(e){k_(e),A_(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();l=n.width,u=n.height,H.bind(document,`mousemove`,f),H.bind(document,`mouseup`,p)},f=function(n){k_(n),A_(n);var d=D_(O_(l+n.clientX-s,r),a),f=D_(O_(u+n.clientY-c,i),o);t.style.width=d+`px`,t.style.height=f+`px`,e.resizeHandler({width:l,height:u,dx:n.clientX-s,dy:n.clientY-c})},p=function(e){k_(e),A_(e),H.unbind(document,`mousemove`,f,!1),H.unbind(document,`mouseup`,p,!1)};H.bind(n,`mousedown`,d)}T(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)},N_.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText=``,e.removeAttribute(`style`),t.removeAttribute(`style`),H.unbind(t,`keydown`,this.keyHandler),H.unbind(t,`mousedown`,A_),H.unbind(t,`input`,this.autoResize),H.unbind(t,`paste`,this.handlePaste),H.unbind(t,`focusout`,this.focusoutHandler),n&&(n.removeAttribute(`style`),ot(n)),ot(e)},N_.prototype.getValue=function(){return this.content.innerText.trim()},N_.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},N_.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)};function P_(e){return e.replace(/\r\n|\r|\n/g,`
|
|
353
353
|
`)}function F_(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._active=null,this._textbox=new N_({container:t.getContainer(),keyHandler:S(this._handleKey,this),resizeHandler:S(this._handleResize,this),focusoutHandler:S(this._handleFocusout,this)}),e.on([`diagram.clear`,`diagram.destroy`],()=>this._cleanup())}F_.$inject=[`eventBus`,`canvas`],F_.prototype.registerProvider=function(e){this._providers.push(e)},F_.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},F_.prototype.cancel=function(){this._active&&(this._fire(`cancel`),this.close())},F_.prototype._fire=function(e,t){this._eventBus.fire(`directEditing.`+e,t||{active:this._active})},F_.prototype.close=function(){this._fire(`deactivate`),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},F_.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},F_.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();(i!==e.context.text||r.height!==n.height||r.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire(`complete`),this.close()}},F_.prototype.getValue=function(){return this._textbox.getValue()},F_.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},F_.prototype._handleResize=function(e){this._fire(`resize`,e)},F_.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},F_.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire(`directEditing.activate.allowed`,{element:e})===!1)return!1;var t,n=C(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 I_={__depends__:[jt],__init__:[`directEditing`],directEditing:[`type`,F_]};function L_(e){return function(t){var n=t.target,r=k(e),i=r.eventDefinitions&&r.eventDefinitions[0],a=r.$type===n.type,o=(i&&i.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!r.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===R(e);return!a||!o||!s||!c}}var R_={task:{label:`Task`,className:`bpmn-icon-task`,target:{type:`bpmn:Task`}},"user-task":{label:`User task`,className:`bpmn-icon-user`,target:{type:`bpmn:UserTask`}},"service-task":{label:`Service task`,className:`bpmn-icon-service`,target:{type:`bpmn:ServiceTask`}},"send-task":{label:`Send task`,className:`bpmn-icon-send`,target:{type:`bpmn:SendTask`}},"receive-task":{label:`Receive task`,className:`bpmn-icon-receive`,target:{type:`bpmn:ReceiveTask`}},"manual-task":{label:`Manual task`,className:`bpmn-icon-manual`,target:{type:`bpmn:ManualTask`}},"rule-task":{label:`Business rule task`,className:`bpmn-icon-business-rule`,target:{type:`bpmn:BusinessRuleTask`}},"script-task":{label:`Script task`,className:`bpmn-icon-script`,target:{type:`bpmn:ScriptTask`}},"call-activity":{label:`Call activity`,className:`bpmn-icon-call-activity`,target:{type:`bpmn:CallActivity`}},transaction:{label:`Transaction`,className:`bpmn-icon-transaction`,target:{type:`bpmn:Transaction`,isExpanded:!0}},"event-subprocess":{label:`Event sub-process`,className:`bpmn-icon-event-subprocess-expanded`,target:{type:`bpmn:SubProcess`,triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:`Sub-process (collapsed)`,className:`bpmn-icon-subprocess-collapsed`,target:{type:`bpmn:SubProcess`,isExpanded:!1}},"expanded-subprocess":{label:`Sub-process (expanded)`,className:`bpmn-icon-subprocess-expanded`,target:{type:`bpmn:SubProcess`,isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:`Ad-hoc sub-process (collapsed)`,className:`bpmn-icon-subprocess-collapsed`,target:{type:`bpmn:AdHocSubProcess`,isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:`Ad-hoc sub-process (expanded)`,className:`bpmn-icon-subprocess-expanded`,target:{type:`bpmn:AdHocSubProcess`,isExpanded:!0}},"exclusive-gateway":{label:`Exclusive gateway`,className:`bpmn-icon-gateway-xor`,target:{type:`bpmn:ExclusiveGateway`}},"parallel-gateway":{label:`Parallel gateway`,className:`bpmn-icon-gateway-parallel`,target:{type:`bpmn:ParallelGateway`}},"inclusive-gateway":{label:`Inclusive gateway`,className:`bpmn-icon-gateway-or`,target:{type:`bpmn:InclusiveGateway`}},"complex-gateway":{label:`Complex gateway`,className:`bpmn-icon-gateway-complex`,target:{type:`bpmn:ComplexGateway`}},"event-based-gateway":{label:`Event-based gateway`,className:`bpmn-icon-gateway-eventbased`,target:{type:`bpmn:EventBasedGateway`,instantiate:!1,eventGatewayType:`Exclusive`}},"data-store-reference":{label:`Data store reference`,className:`bpmn-icon-data-store`,target:{type:`bpmn:DataStoreReference`}},"data-object-reference":{label:`Data object reference`,className:`bpmn-icon-data-object`,target:{type:`bpmn:DataObjectReference`}},"expanded-pool":{label:`Expanded pool/participant`,className:`bpmn-icon-participant`,target:{type:`bpmn:Participant`,isExpanded:!0}},"collapsed-pool":{label:`Empty pool/participant`,className:`bpmn-icon-lane`,target:{type:`bpmn:Participant`,isExpanded:!1}},"none-start-event":{label:`Start event`,className:`bpmn-icon-start-event-none`,target:{type:`bpmn:StartEvent`}},"none-intermediate-throwing":{label:`Intermediate throw event`,className:`bpmn-icon-intermediate-event-none`,target:{type:`bpmn:IntermediateThrowEvent`}},"none-boundary-event":{label:`Boundary event`,className:`bpmn-icon-intermediate-event-none`,target:{type:`bpmn:BoundaryEvent`}},"none-end-event":{label:`End event`,className:`bpmn-icon-end-event-none`,target:{type:`bpmn:EndEvent`}},"message-start":{label:`Message start event`,className:`bpmn-icon-start-event-message`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`,isInterrupting:!0}},"timer-start":{label:`Timer start event`,className:`bpmn-icon-start-event-timer`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:TimerEventDefinition`,isInterrupting:!0}},"conditional-start":{label:`Conditional start event`,className:`bpmn-icon-start-event-condition`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:ConditionalEventDefinition`,isInterrupting:!0}},"signal-start":{label:`Signal start event`,className:`bpmn-icon-start-event-signal`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`,isInterrupting:!0}},"error-start":{label:`Error start event`,className:`bpmn-icon-start-event-error`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:ErrorEventDefinition`,isInterrupting:!0}},"escalation-start":{label:`Escalation start event`,className:`bpmn-icon-start-event-escalation`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`,isInterrupting:!0}},"compensation-start":{label:`Compensation start event`,className:`bpmn-icon-start-event-compensation`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:CompensateEventDefinition`,isInterrupting:!0}},"non-interrupting-message-start":{label:`Message start event (non-interrupting)`,className:`bpmn-icon-start-event-non-interrupting-message`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`,isInterrupting:!1}},"non-interrupting-timer-start":{label:`Timer start event (non-interrupting)`,className:`bpmn-icon-start-event-non-interrupting-timer`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:TimerEventDefinition`,isInterrupting:!1}},"non-interrupting-conditional-start":{label:`Conditional start event (non-interrupting)`,className:`bpmn-icon-start-event-non-interrupting-condition`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:ConditionalEventDefinition`,isInterrupting:!1}},"non-interrupting-signal-start":{label:`Signal start event (non-interrupting)`,className:`bpmn-icon-start-event-non-interrupting-signal`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`,isInterrupting:!1}},"non-interrupting-escalation-start":{label:`Escalation start event (non-interrupting)`,className:`bpmn-icon-start-event-non-interrupting-escalation`,target:{type:`bpmn:StartEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`,isInterrupting:!1}},"message-intermediate-catch":{label:`Message intermediate catch event`,className:`bpmn-icon-intermediate-event-catch-message`,target:{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`}},"message-intermediate-throw":{label:`Message intermediate throw event`,className:`bpmn-icon-intermediate-event-throw-message`,target:{type:`bpmn:IntermediateThrowEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`}},"timer-intermediate-catch":{label:`Timer intermediate catch event`,className:`bpmn-icon-intermediate-event-catch-timer`,target:{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:`bpmn:TimerEventDefinition`}},"escalation-intermediate-throw":{label:`Escalation intermediate throw event`,className:`bpmn-icon-intermediate-event-throw-escalation`,target:{type:`bpmn:IntermediateThrowEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`}},"conditional-intermediate-catch":{label:`Conditional intermediate catch event`,className:`bpmn-icon-intermediate-event-catch-condition`,target:{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:`bpmn:ConditionalEventDefinition`}},"link-intermediate-catch":{label:`Link intermediate catch event`,className:`bpmn-icon-intermediate-event-catch-link`,target:{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:`bpmn:LinkEventDefinition`,eventDefinitionAttrs:{name:``}}},"link-intermediate-throw":{label:`Link intermediate throw event`,className:`bpmn-icon-intermediate-event-throw-link`,target:{type:`bpmn:IntermediateThrowEvent`,eventDefinitionType:`bpmn:LinkEventDefinition`,eventDefinitionAttrs:{name:``}}},"compensation-intermediate-throw":{label:`Compensation intermediate throw event`,className:`bpmn-icon-intermediate-event-throw-compensation`,target:{type:`bpmn:IntermediateThrowEvent`,eventDefinitionType:`bpmn:CompensateEventDefinition`}},"signal-intermediate-catch":{label:`Signal intermediate catch event`,className:`bpmn-icon-intermediate-event-catch-signal`,target:{type:`bpmn:IntermediateCatchEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`}},"signal-intermediate-throw":{label:`Signal intermediate throw event`,className:`bpmn-icon-intermediate-event-throw-signal`,target:{type:`bpmn:IntermediateThrowEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`}},"message-boundary":{label:`Message boundary event`,className:`bpmn-icon-intermediate-event-catch-message`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`,cancelActivity:!0}},"timer-boundary":{label:`Timer boundary event`,className:`bpmn-icon-intermediate-event-catch-timer`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:TimerEventDefinition`,cancelActivity:!0}},"escalation-boundary":{label:`Escalation boundary event`,className:`bpmn-icon-intermediate-event-catch-escalation`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`,cancelActivity:!0}},"conditional-boundary":{label:`Conditional boundary event`,className:`bpmn-icon-intermediate-event-catch-condition`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:ConditionalEventDefinition`,cancelActivity:!0}},"error-boundary":{label:`Error boundary event`,className:`bpmn-icon-intermediate-event-catch-error`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:ErrorEventDefinition`,cancelActivity:!0}},"cancel-boundary":{label:`Cancel boundary event`,className:`bpmn-icon-intermediate-event-catch-cancel`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:CancelEventDefinition`,cancelActivity:!0}},"signal-boundary":{label:`Signal boundary event`,className:`bpmn-icon-intermediate-event-catch-signal`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`,cancelActivity:!0}},"compensation-boundary":{label:`Compensation boundary event`,className:`bpmn-icon-intermediate-event-catch-compensation`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:CompensateEventDefinition`,cancelActivity:!0}},"non-interrupting-message-boundary":{label:`Message boundary event (non-interrupting)`,className:`bpmn-icon-intermediate-event-catch-non-interrupting-message`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`,cancelActivity:!1}},"non-interrupting-timer-boundary":{label:`Timer boundary event (non-interrupting)`,className:`bpmn-icon-intermediate-event-catch-non-interrupting-timer`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:TimerEventDefinition`,cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:`Escalation boundary event (non-interrupting)`,className:`bpmn-icon-intermediate-event-catch-non-interrupting-escalation`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`,cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:`Conditional boundary event (non-interrupting)`,className:`bpmn-icon-intermediate-event-catch-non-interrupting-condition`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:ConditionalEventDefinition`,cancelActivity:!1}},"non-interrupting-signal-boundary":{label:`Signal boundary event (non-interrupting)`,className:`bpmn-icon-intermediate-event-catch-non-interrupting-signal`,target:{type:`bpmn:BoundaryEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`,cancelActivity:!1}},"message-end":{label:`Message end event`,className:`bpmn-icon-end-event-message`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:MessageEventDefinition`}},"escalation-end":{label:`Escalation end event`,className:`bpmn-icon-end-event-escalation`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:EscalationEventDefinition`}},"error-end":{label:`Error end event`,className:`bpmn-icon-end-event-error`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:ErrorEventDefinition`}},"cancel-end":{label:`Cancel end event`,className:`bpmn-icon-end-event-cancel`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:CancelEventDefinition`}},"compensation-end":{label:`Compensation end event`,className:`bpmn-icon-end-event-compensation`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:CompensateEventDefinition`}},"signal-end":{label:`Signal end event`,className:`bpmn-icon-end-event-signal`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:SignalEventDefinition`}},"terminate-end":{label:`Terminate end event`,className:`bpmn-icon-end-event-terminate`,target:{type:`bpmn:EndEvent`,eventDefinitionType:`bpmn:TerminateEventDefinition`}}};function Z(e,t={}){var n=R_[e];if(!n)throw Error(`unknown popup entry <`+e+`>`);return{...n,actionName:`replace-with-`+e,...t}}var z_=[Z(`none-start-event`,{actionName:`replace-with-none-start`}),Z(`none-intermediate-throwing`),Z(`none-end-event`,{actionName:`replace-with-none-end`}),Z(`message-start`),Z(`timer-start`),Z(`conditional-start`),Z(`signal-start`)],B_=[Z(`none-start-event`,{actionName:`replace-with-none-start`}),Z(`none-intermediate-throwing`),Z(`none-end-event`,{actionName:`replace-with-none-end`})],V_=[Z(`none-start-event`,{actionName:`replace-with-none-start`}),Z(`none-intermediate-throwing`,{actionName:`replace-with-none-intermediate-throw`}),Z(`none-end-event`,{actionName:`replace-with-none-end`}),Z(`message-intermediate-catch`),Z(`message-intermediate-throw`),Z(`timer-intermediate-catch`),Z(`escalation-intermediate-throw`),Z(`conditional-intermediate-catch`),Z(`link-intermediate-catch`),Z(`link-intermediate-throw`),Z(`compensation-intermediate-throw`),Z(`signal-intermediate-catch`),Z(`signal-intermediate-throw`)],H_=[Z(`none-start-event`,{actionName:`replace-with-none-start`}),Z(`none-intermediate-throwing`,{actionName:`replace-with-none-intermediate-throw`}),Z(`none-end-event`,{actionName:`replace-with-none-end`}),Z(`message-end`),Z(`escalation-end`),Z(`error-end`),Z(`cancel-end`),Z(`compensation-end`),Z(`signal-end`),Z(`terminate-end`)],U_=[Z(`exclusive-gateway`),Z(`parallel-gateway`),Z(`inclusive-gateway`),Z(`complex-gateway`),Z(`event-based-gateway`)],W_=[Z(`transaction`),Z(`event-subprocess`),Z(`expanded-ad-hoc-subprocess`,{actionName:`replace-with-ad-hoc-subprocess`,label:`Ad-hoc sub-process`}),Z(`collapsed-subprocess`)],G_=[Z(`expanded-subprocess`,{actionName:`replace-with-subprocess`,label:`Sub-process`}),Z(`transaction`),Z(`event-subprocess`),Z(`collapsed-ad-hoc-subprocess`)],K_=[Z(`transaction`),Z(`expanded-subprocess`,{actionName:`replace-with-subprocess`,label:`Sub-process`}),Z(`expanded-ad-hoc-subprocess`,{actionName:`replace-with-ad-hoc-subprocess`,label:`Ad-hoc sub-process`}),Z(`event-subprocess`)],q_=K_,J_=[Z(`task`),Z(`user-task`),Z(`service-task`),Z(`send-task`),Z(`receive-task`),Z(`manual-task`),Z(`rule-task`),Z(`script-task`),Z(`call-activity`),Z(`collapsed-subprocess`),Z(`expanded-subprocess`),Z(`collapsed-ad-hoc-subprocess`),Z(`expanded-ad-hoc-subprocess`,{actionName:`replace-with-ad-hoc-subprocess`})],Y_=[Z(`data-store-reference`)],X_=[Z(`data-object-reference`)],Z_=[Z(`message-boundary`),Z(`timer-boundary`),Z(`escalation-boundary`),Z(`conditional-boundary`),Z(`error-boundary`),Z(`cancel-boundary`),Z(`signal-boundary`),Z(`compensation-boundary`),Z(`non-interrupting-message-boundary`),Z(`non-interrupting-timer-boundary`),Z(`non-interrupting-escalation-boundary`),Z(`non-interrupting-conditional-boundary`),Z(`non-interrupting-signal-boundary`)],Q_=[Z(`message-start`),Z(`timer-start`),Z(`conditional-start`),Z(`signal-start`),Z(`error-start`),Z(`escalation-start`),Z(`compensation-start`),Z(`non-interrupting-message-start`),Z(`non-interrupting-timer-start`),Z(`non-interrupting-conditional-start`),Z(`non-interrupting-signal-start`),Z(`non-interrupting-escalation-start`)],$_=[{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`}],ev=[Z(`expanded-pool`),Z(`collapsed-pool`,{label:function(e){var t=`Empty pool/participant`;return e.children&&e.children.length&&(t+=` (removes content)`),t}})],tv={"bpmn:MessageEventDefinition":[Z(`message-start`),Z(`message-intermediate-catch`),Z(`message-intermediate-throw`),Z(`message-end`)],"bpmn:TimerEventDefinition":[Z(`timer-start`),Z(`timer-intermediate-catch`)],"bpmn:ConditionalEventDefinition":[Z(`conditional-start`),Z(`conditional-intermediate-catch`)],"bpmn:SignalEventDefinition":[Z(`signal-start`),Z(`signal-intermediate-catch`),Z(`signal-intermediate-throw`),Z(`signal-end`)],"bpmn:ErrorEventDefinition":[Z(`error-start`),Z(`error-end`)],"bpmn:EscalationEventDefinition":[Z(`escalation-start`),Z(`escalation-intermediate-throw`),Z(`escalation-end`)],"bpmn:CompensateEventDefinition":[Z(`compensation-start`),Z(`compensation-intermediate-throw`),Z(`compensation-end`)]},nv={"start-event-non-interrupting":`
|
|
354
354
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
355
355
|
<g transform="translate(0 995.64)">
|
|
@@ -369,7 +369,7 @@ import{n as e}from"../elements.js";import{A as t,C as n,D as r,M as i,N as a,O a
|
|
|
369
369
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
370
370
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
371
371
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
372
|
-
</svg>`},mv=900;function hv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider(`align-elements`,mv,this)}hv.$inject=[`popupMenu`,`distributeElements`,`translate`,`rules`],hv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},hv.prototype._isAllowed=function(e){return this._rules.allowed(`elements.distribute`,{elements:e})},hv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:`distribute`,title:n(`Distribute elements horizontally`),className:`bjs-align-elements-menu-entry`,imageHtml:pv.horizontal,action:function(n,i){t.trigger(e,`horizontal`),r.close()}},"distribute-elements-vertical":{group:`distribute`,title:n(`Distribute elements vertically`),imageHtml:pv.vertical,action:function(n,i){t.trigger(e,`vertical`),r.close()}}}};var gv={__depends__:[ea,dv],__init__:[`bpmnDistributeElements`,`distributeElementsMenuProvider`],bpmnDistributeElements:[`type`,fv],distributeElementsMenuProvider:[`type`,hv]},_v=`is not a registered action`,vv=`is already registered`;function yv(e,t){this._eventBus=e,this._actions={};var n=this;e.on(`diagram.init`,function(){n._registerDefaultActions(t),e.fire(`editorActions.init`,{editorActions:n})})}yv.$inject=[`eventBus`,`injector`],yv.prototype._registerDefaultActions=function(e){var t=e.get(`commandStack`,!1),n=e.get(`modeling`,!1),r=e.get(`selection`,!1),i=e.get(`zoomScroll`,!1),a=e.get(`copyPaste`,!1),o=e.get(`canvas`,!1),s=e.get(`rules`,!1),c=e.get(`keyboardMove`,!1),l=e.get(`keyboardMoveSelection`,!1);t&&(this.register(`undo`,function(){t.undo()}),this.register(`redo`,function(){t.redo()})),a&&r&&this.register(`copy`,function(){var e=r.get();if(e.length)return a.copy(e)}),a&&r&&this.register(`duplicate`,function(){var e=r.get();if(e.length)return a.duplicate(e)}),a&&this.register(`paste`,function(){a.paste()}),a&&r&&s&&this.register(`cut`,function(){var e=r.get();if(e.length){var t=s.allowed(`elements.delete`,{elements:e});if(t!==!1){var n=m(t)?t:e;return a.cut(n.slice())}}}),i&&this.register(`stepZoom`,function(e){i.stepZoom(e.value)}),o&&this.register(`zoom`,function(e){o.zoom(e.value)}),n&&r&&s&&this.register(`removeSelection`,function(){var e=r.get();if(e.length){var t=s.allowed(`elements.delete`,{elements:e}),i;t!==!1&&(i=m(t)?t:e,i.length&&n.removeElements(i.slice()))}}),c&&this.register(`moveCanvas`,function(e){c.moveCanvas(e)}),l&&this.register(`moveSelection`,function(e){l.moveSelection(e.direction,e.accelerated)})},yv.prototype.trigger=function(e,t){if(!this._actions[e])throw bv(e,_v);if(this._eventBus.fire(`editorActions.allowed`,{action:e,opts:t})!==!1)return this._actions[e](t)},yv.prototype.register=function(e,t){var n=this;if(typeof e==`string`)return this._registerAction(e,t);b(e,function(e,t){n._registerAction(t,e)})},yv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw bv(e,vv);this._actions[e]=t},yv.prototype.unregister=function(e){if(!this.isRegistered(e))throw bv(e,_v);this._actions[e]=void 0},yv.prototype.getActions=function(){return Object.keys(this._actions)},yv.prototype.isRegistered=function(e){return!!this._actions[e]};function bv(e,t){return Error(e+` `+t)}var xv={__init__:[`editorActions`],editorActions:[`type`,yv]};function Sv(e){e.invoke(yv,this)}z(Sv,yv),Sv.$inject=[`injector`],Sv.prototype._registerDefaultActions=function(e){yv.prototype._registerDefaultActions.call(this,e);var t=e.get(`canvas`,!1),n=e.get(`elementRegistry`,!1),r=e.get(`selection`,!1),i=e.get(`spaceTool`,!1),a=e.get(`lassoTool`,!1),o=e.get(`handTool`,!1),s=e.get(`globalConnect`,!1),c=e.get(`distributeElements`,!1),l=e.get(`alignElements`,!1),d=e.get(`directEditing`,!1),f=e.get(`searchPad`,!1),p=e.get(`modeling`,!1),m=e.get(`contextPad`,!1);t&&n&&r&&this._registerAction(`selectElements`,function(){var e=t.getRootElement(),i=n.filter(function(t){return t!==e});return r.select(i),i}),i&&this._registerAction(`spaceTool`,function(){i.toggle()}),a&&this._registerAction(`lassoTool`,function(){a.toggle()}),o&&this._registerAction(`handTool`,function(){o.toggle()}),s&&this._registerAction(`globalConnectTool`,function(){s.toggle()}),r&&c&&this._registerAction(`distributeElements`,function(e){var t=r.get(),n=e.type;t.length&&c.trigger(t,n)}),r&&l&&this._registerAction(`alignElements`,function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=u(t,function(e){return!O(e,`bpmn:Lane`)}),l.trigger(n,i))}),r&&p&&this._registerAction(`setColor`,function(e){var t=r.get();t.length&&p.setColor(t,e)}),r&&d&&this._registerAction(`directEditing`,function(){var e=r.get();e.length&&d.activate(e[0])}),f&&this._registerAction(`find`,function(){f.toggle()}),t&&p&&this._registerAction(`moveToOrigin`,function(){var e=t.getRootElement(),r,i=O(e,`bpmn:Collaboration`)?n.filter(function(e){return O(e.parent,`bpmn:Collaboration`)}):n.filter(function(t){return t!==e&&!O(t.parent,`bpmn:SubProcess`)});r=it(i),p.moveElements(i,{x:-r.x,y:-r.y},e)}),r&&m&&this._registerAction(`replaceElement`,function(e){m.triggerEntry(`replace`,`click`,e)})};var Cv={__depends__:[xv],editorActions:[`type`,Sv]};function wv(e){e.on([`create.init`,`shape.move.init`],function(e){var t=e.context,n=e.shape;E(n,[`bpmn:Participant`,`bpmn:SubProcess`,`bpmn:TextAnnotation`])&&(t.gridSnappingContext||={},t.gridSnappingContext.snapLocation=`top-left`)})}wv.$inject=[`eventBus`];function Tv(e,t){B.call(this,e),this._gridSnapping=t;var n=this;this.preExecute(`shape.resize`,function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,a=t.newBounds;t.newBounds=re(r)?n.snapComplex(a,r):n.snapSimple(i,a)}})}Tv.$inject=[`eventBus`,`gridSnapping`,`modeling`],z(Tv,B),Tv.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},Tv.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},Tv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),a={};return a.width=n.snapValue(e.width,{min:e.width}),i&&(r?(a.x=n.snapValue(e.x,{max:e.x}),a.width+=n.snapValue(e.x-a.x,{min:e.x-a.x})):e.x=e.x+e.width-a.width),T(e,a),e},Tv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),a={};return a.height=n.snapValue(e.height,{min:e.height}),r&&(i?(a.y=n.snapValue(e.y,{max:e.y}),a.height+=n.snapValue(e.y-a.y,{min:e.y-a.y})):e.y=e.y+e.height-a.height),T(e,a),e};var Ev=2e3;function Dv(e,t){e.on([`spaceTool.move`,`spaceTool.end`],Ev,function(e){var n=e.context;if(n.initialized){var r=n.axis,i;r===`x`?(i=t.snapValue(e.dx),e.x=e.x+i-e.dx,e.dx=i):(i=t.snapValue(e.dy),e.y=e.y+i-e.dy,e.dy=i)}})}Dv.$inject=[`eventBus`,`gridSnapping`];var Ov={__init__:[`gridSnappingResizeBehavior`,`gridSnappingSpaceToolBehavior`],gridSnappingResizeBehavior:[`type`,Tv],gridSnappingSpaceToolBehavior:[`type`,Dv]};function kv(e,t,n){return n||=`round`,Math[n](e/t)*t}var Av=1200,jv=800;function Mv(e,t,n){var r=!n||n.active!==!1;this._eventBus=t;var i=this;t.on(`diagram.init`,jv,function(){i.setActive(r)}),t.on([`create.move`,`create.end`,`bendpoint.move.move`,`bendpoint.move.end`,`connect.move`,`connect.end`,`connectionSegment.move.move`,`connectionSegment.move.end`,`resize.move`,`resize.end`,`shape.move.move`,`shape.move.end`],Av,function(t){var n=t.originalEvent;if(!(!i.active||n&&Xt(n))){var r=t.context,a=r.gridSnappingContext;a||=r.gridSnappingContext={},[`x`,`y`].forEach(function(n){var r={},a=Pv(t,n,e);a&&(r.offset=a);var o=Nv(t,n);o&&T(r,o),os(t,n)||i.snapEvent(t,n,r)})}})}Mv.prototype.snapEvent=function(e,t,n){J(e,t,this.snapValue(e[t],n))},Mv.prototype.getGridSpacing=function(){return 10},Mv.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=kv(e,10);var r,i;return t&&t.min&&(r=t.min,h(r)&&(r=kv(r+n,10,`ceil`),e=Math.max(e,r))),t&&t.max&&(i=t.max,h(i)&&(i=kv(i+n,10,`floor`),e=Math.min(e,i))),e-=n,e},Mv.prototype.isActive=function(){return this.active},Mv.prototype.setActive=function(e){this.active=e,this._eventBus.fire(`gridSnapping.toggle`,{active:e})},Mv.prototype.toggleActive=function(){this.setActive(!this.active)},Mv.$inject=[`elementRegistry`,`eventBus`,`config.gridSnapping`];function Nv(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},a=n.gridSnappingContext,o=a.snapConstraints;if(o&&o[t])return o[t];o||=a.snapConstraints={},o[t]||(o[t]={});var s=n.direction;r&&(Fv(t)?(o.x.min=r.left,o.x.max=r.right):(o.y.min=r.top,o.y.max=r.bottom));var c=i.min,l=i.max;return c&&(Fv(t)?Lv(s)?o.x.max=c.left:o.x.min=c.right:Iv(s)?o.y.max=c.top:o.y.min=c.bottom),l&&(Fv(t)?Lv(s)?o.x.min=l.left:o.x.max=l.right:Iv(s)?o.y.min=l.top:o.y.max=l.bottom),o[t]}function Pv(e,t,n){var r=e.context,i=e.shape,a=r.gridSnappingContext,o=a.snapLocation,s=a.snapOffset;return s&&h(s[t])||(s||=a.snapOffset={},h(s[t])||(s[t]=0),!i)||(n.get(i.id)||(Fv(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2),!o)||(t===`x`?/left/.test(o)?s[t]-=i.width/2:/right/.test(o)&&(s[t]+=i.width/2):/top/.test(o)?s[t]-=i.height/2:/bottom/.test(o)&&(s[t]+=i.height/2)),s[t]}function Fv(e){return e===`x`}function Iv(e){return e.indexOf(`n`)!==-1}function Lv(e){return e.indexOf(`w`)!==-1}var Rv={__depends__:[Ov],__init__:[`gridSnapping`],gridSnapping:[`type`,Mv]},zv=2e3;function Bv(e,t,n){e.on(`autoPlace`,zv,function(e){var r=e.source,i=M(r),a=e.shape,o=Ta(r,a,n);return[`x`,`y`].forEach(function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],O(a,`bpmn:TextAnnotation`)&&(n.offset=Vv(e)?-a.width/2:-a.height/2),o[e]=t.snapValue(o[e],n))}),o})}Bv.$inject=[`eventBus`,`gridSnapping`,`elementRegistry`];function Vv(e){return e===`x`}var Hv=1750;function Uv(e,t,n){t.on([`create.start`,`shape.move.start`],Hv,function(t){var r=t.context,i=r.shape,a=e.getRootElement();O(i,`bpmn:Participant`)&&O(a,`bpmn:Process`)&&a.children.length&&r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height}))})}Uv.$inject=[`canvas`,`eventBus`,`gridSnapping`];var Wv=3e3;function Gv(e,t,n){B.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted([`connection.create`,`connection.layout`],Wv,function(e){var t=e.context,i=t.connection,a=t.hints||{},o=i.waypoints;a.connectionStart||a.connectionEnd||a.createElementsBehavior===!1||Kv(o)&&n.updateWaypoints(i,r.snapMiddleSegments(o))})}Gv.$inject=[`eventBus`,`gridSnapping`,`modeling`],z(Gv,B),Gv.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var r=1;r<e.length-2;r++)n=Yv(t,e[r],e[r+1]),e[r]=n[0],e[r+1]=n[1];return e};function Kv(e){return e.length>3}function qv(e){return e===`h`}function Jv(e){return e===`v`}function Yv(e,t,n){var r=Se(t,n),i={};return qv(r)&&(i.y=e.snapValue(t.y)),Jv(r)&&(i.x=e.snapValue(t.x)),(`x`in i||`y`in i)&&(t=T({},t,i),n=T({},n,i)),[t,n]}var Xv={__depends__:[Rv,{__init__:[`gridSnappingAutoPlaceBehavior`,`gridSnappingParticipantBehavior`,`gridSnappingLayoutConnectionBehavior`],gridSnappingAutoPlaceBehavior:[`type`,Bv],gridSnappingParticipantBehavior:[`type`,Uv],gridSnappingLayoutConnectionBehavior:[`type`,Gv]}],__init__:[`bpmnGridSnapping`],bpmnGridSnapping:[`type`,wv]},Zv=30,Qv=30;function $v(e,t){this._interactionEvents=t;var n=this;e.on([`interactionEvents.createHit`,`interactionEvents.updateHit`],function(e){var t=e.element,r=e.gfx;if(O(t,`bpmn:Lane`))return n._createParticipantHit(t,r);if(O(t,`bpmn:Participant`))return R(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r);if(O(t,`bpmn:SubProcess`))return R(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r)})}$v.$inject=[`eventBus`,`interactionEvents`],$v.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},$v.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=He(e)?{width:Zv,height:e.height}:{width:e.width,height:Qv};return this._interactionEvents.createBoxHit(t,`all`,n),!0},$v.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:Qv}),!0};var ey={__init__:[`bpmnInteractionEvents`],bpmnInteractionEvents:[`type`,$v]};function ty(e){e.invoke(ln,this)}z(ty,ln),ty.$inject=[`injector`];var ny={selectElements:{key:`A`,modifier:`cmd`},find:{key:`F`,modifier:`cmd`},spaceTool:{key:`S`},lassoTool:{key:`L`},handTool:{key:`H`},globalConnectTool:{key:`C`},directEditing:{key:`E`},replaceElement:{key:`R`}};ty.prototype.registerBindings=function(e,t){ln.prototype.registerBindings.call(this,e,t),b(ny,function(n,r){if(t.isRegistered(r)){var i=[n.key.toLowerCase(),n.key.toUpperCase()],a=n.modifier===`cmd`;e.addListener(function(n){var o=n.keyEvent;if(e.isKey(i,o)){if(a){if(!e.isCmd(o))return}else if(e.hasModifier(o))return;return t.trigger(r,o),!0}})}})};var ry={__depends__:[un],__init__:[`keyboardBindings`],keyboardBindings:[`type`,ty]},iy={moveSpeed:1,moveSpeedAccelerated:10},ay=1500,oy=`left`,sy=`up`,cy=`right`,ly=`down`,uy={ArrowLeft:oy,Left:oy,ArrowUp:sy,Up:sy,ArrowRight:cy,Right:cy,ArrowDown:ly,Down:ly},dy={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 fy(e,t,n,r,i){var a=this;this._config=T({},iy,e||{}),t.addListener(ay,function(e){var n=e.keyEvent,r=uy[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return a.moveSelection(r,i),!0}}),this.moveSelection=function(e,t){var a=i.get();if(a.length){var o=this._config[t?`moveSpeedAccelerated`:`moveSpeed`],s=dy[e](o);r.allowed(`elements.move`,{shapes:a,hints:{keyboardMove:!0}})&&n.moveElements(a,s)}}}fy.$inject=[`config.keyboardMoveSelection`,`keyboard`,`modeling`,`rules`,`selection`];var py={__depends__:[un,It],__init__:[`keyboardMoveSelection`],keyboardMoveSelection:[`type`,fy]},my=10;function hy(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function a(e,t){var n=e.shape,r=e.direction,a=e.resizeConstraints,o;e.delta=t,o=Fc(n,r,t),e.newBounds=Rc(o,a),e.canExecute=i.canResize(e)}function o(e){var t=e.resizeConstraints,n=e.minBounds;t===void 0&&(n===void 0&&(n=i.computeMinResizeBox(e)),e.resizeConstraints={min:N(n)})}function s(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(i=we(i),!gy(t,i))return;n.resizeShape(t,i)}}e.on(`resize.start`,function(e){o(e.context)}),e.on(`resize.move`,function(e){var t={x:e.dx,y:e.dy};a(e.context,t)}),e.on(`resize.end`,function(e){s(e.context)})}hy.prototype.canResize=function(e){var t=this._rules,n=ie(e,[`newBounds`,`shape`,`delta`,`direction`]);return t.allowed(`shape.resize`,n)},hy.prototype.activate=function(e,t,n){var r=this._dragging,i,a;if(typeof n==`string`&&(n={direction:n}),i=T({shape:t},n),a=i.direction,!a)throw Error(`must provide a direction (n|w|s|e|nw|se|ne|sw)`);r.init(e,_y(t,a),`resize`,{autoActivate:!0,cursor:vy(a),data:{shape:t,context:i}})},hy.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction;return zc(n,t,e.minDimensions||{width:my,height:my},Uc(t,e.childrenBoxPadding))},hy.$inject=[`eventBus`,`rules`,`modeling`,`dragging`];function gy(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _y(e,t){var n=M(e),r=N(e),i={x:n.x,y:n.y};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(i.y=r.bottom):i.y=r.top,t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(i.x=r.left):i.x=r.right,i}function vy(e){var t=`resize-`;return e===`n`||e===`s`?t+`ns`:e===`e`||e===`w`?t+`ew`:e===`nw`||e===`se`?t+`nwse`:t+`nesw`}var yy=`djs-resizing`,by=`resize-not-ok`,xy=500;function Sy(e,t,n){function r(e){var r=e.shape,i=e.newBounds,a=e.frame;a||(a=e.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,yy)),i.width>5&&P(a,{x:i.x,width:i.width}),i.height>5&&P(a,{y:i.y,height:i.height}),e.canExecute?I(a).remove(by):I(a).add(by)}function i(e){var n=e.shape;e.frame&&ke(e.frame),t.removeMarker(n,yy)}e.on(`resize.move`,xy,function(e){r(e.context)}),e.on(`resize.cleanup`,function(e){i(e.context)})}Sy.$inject=[`eventBus`,`canvas`,`previewSupport`];var Cy=-6,wy=8,Ty=20,Ey=`djs-resizer`,Dy=[`n`,`w`,`s`,`e`,`nw`,`ne`,`se`,`sw`];function Oy(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on(`selection.changed`,function(e){var t=e.newSelection;i.removeResizers(),t.length===1&&b(t,S(i.addResizer,i))}),e.on(`shape.changed`,function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))})}Oy.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){yt(t)&&r.activate(t,e,n)}H.bind(t,`mousedown`,i),H.bind(t,`touchstart`,i)},Oy.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),a=ky(r),o=F(`g`);I(o).add(Ey),I(o).add(Ey+`-`+e.id),I(o).add(Ey+`-`+r),L(i,o);var s=F(`rect`);P(s,{x:-wy/2+a.x,y:-wy/2+a.y,rx:2,width:wy,height:wy}),I(s).add(Ey+`-visual`),L(o,s);var c=F(`rect`);return P(c,{x:-Ty/2+a.x,y:-Ty/2+a.y,width:Ty,height:Ty}),I(c).add(Ey+`-hit`),L(o,c),bt(o,t,n),o},Oy.prototype.createResizer=function(e,t){var n=_y(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Oy.prototype.addResizer=function(e){var t=this;A(e)||b(Dy,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Oy.prototype.removeResizers=function(){var e=this._getResizersParent();Oe(e)},Oy.prototype._getResizersParent=function(){return this._canvas.getLayer(`resizers`)},Oy.$inject=[`eventBus`,`canvas`,`selection`,`resize`];function ky(e){var t={x:0,y:0};return e.indexOf(`e`)===-1?e.indexOf(`w`)!==-1&&(t.x=Cy):t.x=-Cy,e.indexOf(`s`)===-1?e.indexOf(`n`)!==-1&&(t.y=Cy):t.y=-Cy,t}var Ay={__depends__:[eo,Ya,Ps],__init__:[`resize`,`resizePreview`,`resizeHandles`],resize:[`type`,hy],resizePreview:[`type`,Sy],resizeHandles:[`type`,Oy]},jy=2e3;function My(e,t,n,r,i,a,o){this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=o,r.registerProvider(this),e.on(`element.dblclick`,function(e){s(e.element,!0)}),e.on([`autoPlace.start`,`canvas.viewbox.changing`,`drag.init`,`element.mousedown`,`popupMenu.open`,`root.set`,`selection.changed`],function(){r.isActive()&&r.complete()}),e.on([`shape.remove`,`connection.remove`],jy,function(e){r.isActive(e.element)&&r.cancel()}),e.on([`commandStack.changed`],function(e){r.isActive()&&r.cancel()}),e.on(`directEditing.activate`,function(e){a.removeResizers()}),e.on(`create.end`,500,function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&t.hints.createElementsBehavior===!1||s(n))}),e.on(`autoPlace.end`,500,function(e){s(e.shape)});function s(e,t){(t||E(e,[`bpmn:Activity`,`bpmn:Event`,`bpmn:TextAnnotation`,`bpmn:Participant`]))&&r.activate(e)}}My.$inject=[`eventBus`,`bpmnFactory`,`canvas`,`directEditing`,`modeling`,`resizeHandles`,`textRenderer`],My.prototype.activate=function(e){var t=ue(e);if(t!==void 0){var n={text:t},r=this.getEditingBBox(e);T(n,r);var i={},a=n.style||{};return T(a,{backgroundColor:null,border:null}),(E(e,[`bpmn:Task`,`bpmn:Participant`,`bpmn:Lane`,`bpmn:CallActivity`])||Ny(e))&&T(i,{centerVertically:!0}),pe(e)&&(T(i,{resizable:!0,autoResize:!0}),T(a,{backgroundColor:`#ffffff`,border:`1px solid #ccc`})),O(e,`bpmn:TextAnnotation`)&&(T(i,{resizable:!0,autoResize:!0}),T(a,{backgroundColor:`#ffffff`,border:`1px solid #ccc`})),T(n,{options:i,style:a}),n}},My.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i={x:r.x+r.width/2,y:r.y+r.height/2},a={x:r.x,y:r.y},o=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*o,u=c.lineHeight,d=s.fontSize*o,f=s.lineHeight,p={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(O(e,`bpmn:Lane`)||Iy(e)){var m=He(e),h=m?{width:r.height,height:30*o,x:r.x-r.height/2+15*o,y:i.y-30*o/2}:{width:r.width,height:30*o};T(a,h),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`,transform:m?`rotate(-90deg)`:null})}if(Fy(e)){var g=He(e),_=g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i.x-r.height/2,y:i.y-r.width/2};T(a,_),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`,transform:g?null:`rotate(-90deg)`})}(E(e,[`bpmn:Task`,`bpmn:CallActivity`])||Ny(e))&&(T(a,{width:r.width,height:r.height}),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`})),Py(e)&&(T(a,{width:r.width,x:r.x}),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`}));var v=1,y=r.width+2*v;if(n.labelTarget&&(T(a,{width:y,height:r.height+2*v,x:r.x-v,y:r.y-v}),T(p,{fontSize:l+`px`,lineHeight:u})),pe(n)&&!se(n)&&!j(n)){var b=fe(e),x=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),S=l,C=me.width*o+2*v;T(a,{width:C,height:S+2*v,x:x.x-C/2,y:x.y-S/2-v}),T(p,{fontSize:l+`px`,lineHeight:u})}return O(e,`bpmn:TextAnnotation`)&&(T(a,{width:r.width+2*v,height:r.height+2*v,x:r.x-v,y:r.y-v,minWidth:30*o,minHeight:10*o}),T(p,{textAlign:`left`,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:7*o+`px`,paddingRight:7*o+`px`,fontSize:d+`px`,lineHeight:f})),{bounds:a,style:p}},My.prototype.update=function(e,t,n,r){var i,a;O(e,`bpmn:TextAnnotation`)&&(a=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/a.width*r.width,height:e.height/a.height*r.height}),Ly(t)&&(t=null),this._modeling.updateLabel(e,t,i)};function Ny(e){return O(e,`bpmn:SubProcess`)&&!R(e)}function Py(e){return O(e,`bpmn:SubProcess`)&&R(e)}function Fy(e){return O(e,`bpmn:Participant`)&&!R(e)}function Iy(e){return O(e,`bpmn:Participant`)&&R(e)}function Ly(e){return!e||!e.trim()}var Ry=`djs-element-hidden`,zy=`djs-label-hidden`;function By(e,t,n){var r=this,i=t.getDefaultLayer(),a,o,s;e.on(`directEditing.activate`,function(e){var c=e.active;if(a=c.element.label||c.element,O(a,`bpmn:TextAnnotation`)){o=t.getAbsoluteBBox(a),s=F(`g`);var l=n.getScaledPath(`TEXT_ANNOTATION`,{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:a.height,position:{mx:0,my:0}}),u=r.path=F(`path`);P(u,{d:l,strokeWidth:2,stroke:Vy(a)}),L(s,u),L(i,s),Bt(s,a.x,a.y)}O(a,`bpmn:TextAnnotation`)||a.labelTarget?t.addMarker(a,Ry):(O(a,`bpmn:Task`)||O(a,`bpmn:CallActivity`)||O(a,`bpmn:SubProcess`)||O(a,`bpmn:Participant`)||O(a,`bpmn:Lane`))&&t.addMarker(a,zy)}),e.on(`directEditing.resize`,function(e){if(O(a,`bpmn:TextAnnotation`)){var t=e.height,i=e.dy,s=Math.max(a.height/o.height*(t+i),0),c=n.getScaledPath(`TEXT_ANNOTATION`,{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:s,position:{mx:0,my:0}});P(r.path,{d:c})}}),e.on([`directEditing.complete`,`directEditing.cancel`],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Ry),t.removeMarker(a,zy)),a=void 0,o=void 0,s&&=(ke(s),void 0)})}By.$inject=[`eventBus`,`canvas`,`pathMap`];function Vy(e,t){return D(e).get(`stroke`)||t||`black`}var Hy={__depends__:[Ct,Ay,I_],__init__:[`labelEditingProvider`,`labelEditingPreview`],labelEditingProvider:[`type`,My],labelEditingPreview:[`type`,By]},Uy=500,Wy=1e3;function Gy(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls(`djs-outline`,[`no-fill`]);var r=this;function i(e){le(e)||r.createOutline(e)}e.on(`element.hover`,function(e){i(e.element)}),e.on(`selection.changed`,function(e){b(e.newSelection,i)}),e.on([`shape.changed`,`connection.changed`],Uy,function(e){var t=e.element,n=e.gfx,i=V(`.djs-outline`,n);i&&r.updateOutline(t,i)})}Gy.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw Error(`cannot create outline for non-rendered element`);var n=V(`.djs-outline`,t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),L(t,n),this.updateOutline(e,n)),n},Gy.prototype._createOutlineGfx=function(){var e=F(`rect`);return P(e,T({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Gy.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Gy.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&b(r,function(r){n||=r.updateOutline(t,e)}),n||P(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Gy.prototype.updateConnectionOutline=function(e,t){var n=it(t);P(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Gy.prototype.registerProvider=function(e,t){t||(t=e,e=Wy),this._eventBus.on(`outline.getProviders`,e,function(e){e.providers.push(t)})},Gy.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`outline.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},Gy.prototype.getOutline=function(e){var t,n=this._getProviders();return b(n,function(n){x(n.getOutline)&&(t||=n.getOutline(e))}),t},Gy.$inject=[`eventBus`,`styles`,`elementRegistry`];var Ky=6;function qy(e,t,n){this._canvas=t;var r=this;e.on(`element.changed`,function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())}),e.on(`selection.changed`,function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)})}qy.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer(`selectionOutline`);Oe(t);var n=e.length>1,r=this._canvas.getContainer();if(I(r)[n?`add`:`remove`](`djs-multi-select`),n){var i=Jy(it(e)),a=F(`rect`);P(a,T({rx:3},i)),I(a).add(`djs-selection-outline`),L(t,a)}},qy.$inject=[`eventBus`,`canvas`,`selection`];function Jy(e){return{x:e.x-Ky,y:e.y-Ky,width:e.width+Ky*2,height:e.height+Ky*2}}var Yy={__depends__:[It],__init__:[`outline`,`multiSelectionOutline`],outline:[`type`,Gy],multiSelectionOutline:[`type`,qy]},Xy=[`bpmn:Event`,`bpmn:SequenceFlow`,`bpmn:Gateway`],Zy={class:`bjs-label-link`,stroke:`var(--element-selected-outline-secondary-stroke-color)`,strokeDasharray:`5, 5`},Qy=15,$y=2;function eb(e,t,n,r,i){let a=t.getLayer(`overlays`);e.on([`selection.changed`,`shape.changed`],function(){s()}),e.on(`selection.changed`,function({newSelection:e}){let t=e.filter(e=>E(e,Xy));if(t.length===1){let e=t[0];j(e)?o(e,e.labelTarget):e.labels?.length&&o(e.labels[0],e)}if(t.length===2){let e=t.find(j),n=t.find(t=>t.labels?.includes(e));e&&n&&o(e,n)}}),e.on(`shape.changed`,function({element:e}){E(e,Xy)&&u(e)&&(j(e)?o(e,e.labelTarget):e.labels?.length&&o(e.labels[0],e))});function o(e,t){let n=M(e),r=A(t)?Wl(n,Kl(t.waypoints)):M(t),o=Be([r,n],Zy),s=o.getAttribute(`d`),u=i.isSelected(e)?c(e):l(e),d=ve(u,s);if(!d)return;let f;if(A(t))f=r;else{let e=i.isSelected(t)?c(t):l(t);f=ve(e,s)||M(t)}go(f,d)<Qy||(Re(o,[f,d]),L(a,o))}function s(){lt(`.${Zy.class}`,a).forEach(ke)}function c(e){let t=r.getOutline(e);if(!t)return l(e);if(t.x){let n={x:e.x+tb(t,`x`)-$y,y:e.y+tb(t,`y`)-$y,width:tb(t,`width`)+$y*2,height:tb(t,`height`)+$y*2};return Ue(n,tb(t,`rx`))}if(t.cx){let n=tb(t,`r`),r={x:e.x+tb(t,`cx`)-n,y:e.y+tb(t,`cy`)-n,width:n*2,height:n*2};return We(r)}}function l(e){return n.getShapePath(e)}function u(e){return i.isSelected(e)}}eb.$inject=[`eventBus`,`canvas`,`graphicsFactory`,`outline`,`selection`];function tb(e,t){return parseFloat(P(e,t)||0)}var nb={__depends__:[It,Yy],__init__:[`labelLink`],labelLink:[`type`,eb]},rb=new At(`tt`);function ib(e){var t=gt(`<div class="djs-tooltip-container" />`);return ut(t,{position:`absolute`,width:`0`,height:`0`}),e.insertBefore(t,e.firstChild),t}function ab(e,t,n){ut(e,{left:t+`px`,top:n+`px`})}function ob(e,t){e.style.display=t===!1?`none`:``}var sb=`djs-tooltip`,cb=`.`+sb;function lb(e,t){this._eventBus=e,this._canvas=t,this._ids=rb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=ib(t.getContainer());var n=this;pt.bind(this._tooltipRoot,cb,`mousedown`,function(e){e.stopPropagation()}),pt.bind(this._tooltipRoot,cb,`mouseover`,function(e){n.trigger(`mouseover`,e)}),pt.bind(this._tooltipRoot,cb,`mouseout`,function(e){n.trigger(`mouseout`,e)}),this._init()}lb.$inject=[`eventBus`,`canvas`],lb.prototype.add=function(e){if(!e.position)throw Error(`must specifiy tooltip position`);if(!e.html)throw Error(`must specifiy tooltip html`);var t=this._ids.next();return e=T({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},lb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(ft(n,`data-tooltip-id`));r&&(e===`mouseover`&&r.timeout&&this.clearTimeout(r),e===`mouseout`&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},lb.prototype.get=function(e){return typeof e!=`string`&&(e=e.id),this._tooltips[e]},lb.prototype.clearTimeout=function(e){if(e=this.get(e),e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},lb.prototype.setTimeout=function(e){if(e=this.get(e),e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},lb.prototype.remove=function(e){var t=this.get(e);t&&(ot(t.html),ot(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},lb.prototype.show=function(){ob(this._tooltipRoot)},lb.prototype.hide=function(){ob(this._tooltipRoot,!1)},lb.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r=`matrix(`+t+`,0,0,`+n+`,`+-1*e.x*t+`,`+-1*e.y*n+`)`;this._tooltipRoot.style.transform=r,this._tooltipRoot.style[`-ms-transform`]=r},lb.prototype._addTooltip=function(e){var t=e.id,n=e.html,r,i=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),re(n)&&(n=gt(n)),r=gt(`<div data-tooltip-id="`+t+`" class="`+sb+`">`),ut(r,{position:`absolute`}),r.appendChild(n),e.type&&at(r).add(`djs-tooltip-`+e.type),e.className&&at(r).add(e.className),e.htmlContainer=r,i.appendChild(r),this._tooltips[t]=e,this._updateTooltip(e)},lb.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;ab(n,t.x,t.y)},lb.prototype._updateTooltipVisibilty=function(e){b(this._tooltips,function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),ob(r,i))})},lb.prototype._init=function(){var e=this;function t(t){e._updateRoot(t),e._updateTooltipVisibilty(t),e.show()}this._eventBus.on(`canvas.viewbox.changing`,function(t){e.hide()}),this._eventBus.on(`canvas.viewbox.changed`,function(e){t(e.viewbox)})};var ub={__init__:[`tooltips`],tooltips:[`type`,lb]},db=`flow elements must be children of pools/participants`,fb=`Data object must be placed within a pool/participant.`;function pb(e,t,n){function r(e,n,r){t.add({position:{x:e.x+5,y:e.y+5},type:`error`,timeout:r||2e3,html:`<div>`+n+`</div>`})}e.on([`shape.move.rejected`,`create.rejected`],function(e){var t=e.context,i=t.shape,a=t.target;O(a,`bpmn:Collaboration`)&&(O(i,`bpmn:FlowNode`)?r(e,n(db)):O(i,`bpmn:DataObjectReference`)&&r(e,n(fb)))})}pb.$inject=[`eventBus`,`tooltips`,`translate`];var mb={__depends__:[ub],__init__:[`modelingFeedback`],modelingFeedback:[`type`,pb]},hb=500,gb=1250,_b=1500,vb=Math.round;function yb(e){return{x:e.x+vb(e.width/2),y:e.y+vb(e.height/2)}}function bb(e,t,n,r,i){function a(e,t,n,r){return i.allowed(`elements.move`,{shapes:e,delta:t,position:n,target:r})}e.on(`shape.move.start`,_b,function(e){var t=e.context,n=e.shape,i=r.get().slice();i.indexOf(n)===-1&&(i=[n]),i=xb(i),T(t,{shapes:i,validatedShapes:i,shape:n})}),e.on(`shape.move.start`,gb,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=a(n)))return!1}),e.on(`shape.move.move`,hb,function(e){var t=e.context,n=t.validatedShapes,r=e.hover,i={x:e.dx,y:e.dy},o=a(n,i,{x:e.x,y:e.y},r);t.delta=i,t.canExecute=o,t.target=o===null?null:r}),e.on(`shape.move.end`,function(e){var t=e.context,r=t.delta,i=t.canExecute,a=i===`attach`,o=t.shapes;if(i===!1)return!1;r.x=vb(r.x),r.y=vb(r.y),(r.x!==0||r.y!==0)&&n.moveElements(o,r,t.target,{primaryShape:t.shape,attach:a})}),e.on(`element.mousedown`,function(e){if(yt(e)){var t=Ft(e);if(!t)throw Error(`must supply DOM mousedown event`);return o(t,e.element)}});function o(e,n,r,i){if(l(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!I(e.target).has(`djs-hit-no-move`)){var a=yb(n);if(t.init(e,a,`shape.move`,{cursor:`grabbing`,autoActivate:r,data:{shape:n,context:i||{}}})!==!1)return!0}}this.start=o}bb.$inject=[`eventBus`,`dragging`,`modeling`,`selection`,`rules`];function xb(e){var t=ne(e,`id`);return u(e,function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0})}var Sb=499,Cb=`djs-dragging`,wb=`drop-ok`,Tb=`drop-not-ok`,Eb=`new-parent`,Db=`attach-ok`;function Ob(e,t,n,r){function i(e){return kb(a(e))}function a(e){var t=et(e),n=t.flatMap(e=>(e.incoming||[]).concat(e.outgoing||[])),r=t.concat(n);return[...new Set(r)]}function o(e,n){[Db,wb,Tb,Eb].forEach(function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)})}function s(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Cb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}e.on(`shape.move.start`,Sb,function(e){var o=e.context,s=o.shapes,c=o.allDraggedElements,l=i(s);if(!o.dragGroup){var u=F(`g`);P(u,n.cls(`djs-drag-group`,[`no-events`]));var d=t.getActiveLayer();L(d,u),o.dragGroup=u}l.forEach(function(e){r.addDragger(e,o.dragGroup)}),c=c?f([c,a(s)]):a(s),b(c,function(e){t.addMarker(e,Cb)}),o.allDraggedElements=c,o.differentParents=Ab(s)}),e.on(`shape.move.move`,Sb,function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,a=t.canExecute;r&&(a===`attach`?o(r,Db):t.canExecute&&i&&r.id!==i.id?o(r,Eb):o(r,t.canExecute?wb:Tb)),Bt(n,e.dx,e.dy)}),e.on([`shape.move.out`,`shape.move.cleanup`],function(e){var t=e.context.target;t&&o(t,null)}),e.on(`shape.move.cleanup`,function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;b(r,function(e){t.removeMarker(e,Cb)}),i&&ke(i)}),this.makeDraggable=s}Ob.$inject=[`eventBus`,`canvas`,`styles`,`previewSupport`];function kb(e){var t=new Set;return e.forEach(function(e){t.add(e.id)}),u(e,function(e){return!A(e)||t.has(e.source.id)&&t.has(e.target.id)})}function Ab(e){return r(ne(e,function(e){return e.parent&&e.parent.id}))!==1}var jb={__depends__:[jt,It,Yy,eo,Ya,Ps],__init__:[`move`,`movePreview`],move:[`type`,bb],movePreview:[`type`,Ob]},Mb=300;function Nb(e){this._canvas=e,this._mount=null,this._current=null,this._showTimer=null}Nb.$inject=[`canvas`],Nb.prototype.add=function(e){let{container:t,selector:n,showDelay:r=Mb}=e;pt.bind(t,n,`mouseover`,t=>this._show(t.delegateTarget,e,r)),pt.bind(t,n,`mouseout`,e=>{let{delegateTarget:t,relatedTarget:n}=e;n&&t.contains(n)||this._hide()})},Nb.prototype._show=function(e,t,n){let r=t.getContent(e);r&&(this._current={target:e,content:r,getPosition:t.getPosition},clearTimeout(this._showTimer),this._showTimer=setTimeout(()=>this._render(),n))},Nb.prototype._hide=function(){clearTimeout(this._showTimer),this._current=null,this._render()},Nb.prototype._render=function(){let e=this._getMount();if(!this._current){Hr(null,e);return}let{target:t,content:n,getPosition:r}=this._current,{x:i,y:a,placement:o=`right`}=r(t);Hr(G`<div
|
|
372
|
+
</svg>`},mv=900;function hv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider(`align-elements`,mv,this)}hv.$inject=[`popupMenu`,`distributeElements`,`translate`,`rules`],hv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&T(t,this._getEntries(e)),t},hv.prototype._isAllowed=function(e){return this._rules.allowed(`elements.distribute`,{elements:e})},hv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:`distribute`,title:n(`Distribute elements horizontally`),className:`bjs-align-elements-menu-entry`,imageHtml:pv.horizontal,action:function(n,i){t.trigger(e,`horizontal`),r.close()}},"distribute-elements-vertical":{group:`distribute`,title:n(`Distribute elements vertically`),imageHtml:pv.vertical,action:function(n,i){t.trigger(e,`vertical`),r.close()}}}};var gv={__depends__:[ea,dv],__init__:[`bpmnDistributeElements`,`distributeElementsMenuProvider`],bpmnDistributeElements:[`type`,fv],distributeElementsMenuProvider:[`type`,hv]},_v=`is not a registered action`,vv=`is already registered`;function yv(e,t){this._eventBus=e,this._actions={};var n=this;e.on(`diagram.init`,function(){n._registerDefaultActions(t),e.fire(`editorActions.init`,{editorActions:n})})}yv.$inject=[`eventBus`,`injector`],yv.prototype._registerDefaultActions=function(e){var t=e.get(`commandStack`,!1),n=e.get(`modeling`,!1),r=e.get(`selection`,!1),i=e.get(`zoomScroll`,!1),a=e.get(`copyPaste`,!1),o=e.get(`canvas`,!1),s=e.get(`rules`,!1),c=e.get(`keyboardMove`,!1),l=e.get(`keyboardMoveSelection`,!1);t&&(this.register(`undo`,function(){t.undo()}),this.register(`redo`,function(){t.redo()})),a&&r&&this.register(`copy`,function(){var e=r.get();if(e.length)return a.copy(e)}),a&&r&&this.register(`duplicate`,function(){var e=r.get();if(e.length)return a.duplicate(e)}),a&&this.register(`paste`,function(){a.paste()}),a&&r&&s&&this.register(`cut`,function(){var e=r.get();if(e.length){var t=s.allowed(`elements.delete`,{elements:e});if(t!==!1){var n=m(t)?t:e;return a.cut(n.slice())}}}),i&&this.register(`stepZoom`,function(e){i.stepZoom(e.value)}),o&&this.register(`zoom`,function(e){o.zoom(e.value)}),n&&r&&s&&this.register(`removeSelection`,function(){var e=r.get();if(e.length){var t=s.allowed(`elements.delete`,{elements:e}),i;t!==!1&&(i=m(t)?t:e,i.length&&n.removeElements(i.slice()))}}),c&&this.register(`moveCanvas`,function(e){c.moveCanvas(e)}),l&&this.register(`moveSelection`,function(e){l.moveSelection(e.direction,e.accelerated)})},yv.prototype.trigger=function(e,t){if(!this._actions[e])throw bv(e,_v);if(this._eventBus.fire(`editorActions.allowed`,{action:e,opts:t})!==!1)return this._actions[e](t)},yv.prototype.register=function(e,t){var n=this;if(typeof e==`string`)return this._registerAction(e,t);b(e,function(e,t){n._registerAction(t,e)})},yv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw bv(e,vv);this._actions[e]=t},yv.prototype.unregister=function(e){if(!this.isRegistered(e))throw bv(e,_v);this._actions[e]=void 0},yv.prototype.getActions=function(){return Object.keys(this._actions)},yv.prototype.isRegistered=function(e){return!!this._actions[e]};function bv(e,t){return Error(e+` `+t)}var xv={__init__:[`editorActions`],editorActions:[`type`,yv]};function Sv(e){e.invoke(yv,this)}z(Sv,yv),Sv.$inject=[`injector`],Sv.prototype._registerDefaultActions=function(e){yv.prototype._registerDefaultActions.call(this,e);var t=e.get(`canvas`,!1),n=e.get(`elementRegistry`,!1),r=e.get(`selection`,!1),i=e.get(`spaceTool`,!1),a=e.get(`lassoTool`,!1),o=e.get(`handTool`,!1),s=e.get(`globalConnect`,!1),c=e.get(`distributeElements`,!1),l=e.get(`alignElements`,!1),d=e.get(`directEditing`,!1),f=e.get(`searchPad`,!1),p=e.get(`modeling`,!1),m=e.get(`contextPad`,!1);t&&n&&r&&this._registerAction(`selectElements`,function(){var e=t.getRootElement(),i=n.filter(function(t){return t!==e});return r.select(i),i}),i&&this._registerAction(`spaceTool`,function(){i.toggle()}),a&&this._registerAction(`lassoTool`,function(){a.toggle()}),o&&this._registerAction(`handTool`,function(){o.toggle()}),s&&this._registerAction(`globalConnectTool`,function(){s.toggle()}),r&&c&&this._registerAction(`distributeElements`,function(e){var t=r.get(),n=e.type;t.length&&c.trigger(t,n)}),r&&l&&this._registerAction(`alignElements`,function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=u(t,function(e){return!O(e,`bpmn:Lane`)}),l.trigger(n,i))}),r&&p&&this._registerAction(`setColor`,function(e){var t=r.get();t.length&&p.setColor(t,e)}),r&&d&&this._registerAction(`directEditing`,function(){var e=r.get();e.length&&d.activate(e[0])}),f&&this._registerAction(`find`,function(){f.toggle()}),t&&p&&this._registerAction(`moveToOrigin`,function(){var e=t.getRootElement(),r,i=O(e,`bpmn:Collaboration`)?n.filter(function(e){return O(e.parent,`bpmn:Collaboration`)}):n.filter(function(t){return t!==e&&!O(t.parent,`bpmn:SubProcess`)});r=it(i),p.moveElements(i,{x:-r.x,y:-r.y},e)}),r&&m&&this._registerAction(`replaceElement`,function(e){m.triggerEntry(`replace`,`click`,e)})};var Cv={__depends__:[xv],editorActions:[`type`,Sv]};function wv(e){e.on([`create.init`,`shape.move.init`],function(e){var t=e.context,n=e.shape;E(n,[`bpmn:Participant`,`bpmn:SubProcess`,`bpmn:TextAnnotation`])&&(t.gridSnappingContext||={},t.gridSnappingContext.snapLocation=`top-left`)})}wv.$inject=[`eventBus`];function Tv(e,t){B.call(this,e),this._gridSnapping=t;var n=this;this.preExecute(`shape.resize`,function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,a=t.newBounds;t.newBounds=re(r)?n.snapComplex(a,r):n.snapSimple(i,a)}})}Tv.$inject=[`eventBus`,`gridSnapping`,`modeling`],z(Tv,B),Tv.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},Tv.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},Tv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),a={};return a.width=n.snapValue(e.width,{min:e.width}),i&&(r?(a.x=n.snapValue(e.x,{max:e.x}),a.width+=n.snapValue(e.x-a.x,{min:e.x-a.x})):e.x=e.x+e.width-a.width),T(e,a),e},Tv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),a={};return a.height=n.snapValue(e.height,{min:e.height}),r&&(i?(a.y=n.snapValue(e.y,{max:e.y}),a.height+=n.snapValue(e.y-a.y,{min:e.y-a.y})):e.y=e.y+e.height-a.height),T(e,a),e};var Ev=2e3;function Dv(e,t){e.on([`spaceTool.move`,`spaceTool.end`],Ev,function(e){var n=e.context;if(n.initialized){var r=n.axis,i;r===`x`?(i=t.snapValue(e.dx),e.x=e.x+i-e.dx,e.dx=i):(i=t.snapValue(e.dy),e.y=e.y+i-e.dy,e.dy=i)}})}Dv.$inject=[`eventBus`,`gridSnapping`];var Ov={__init__:[`gridSnappingResizeBehavior`,`gridSnappingSpaceToolBehavior`],gridSnappingResizeBehavior:[`type`,Tv],gridSnappingSpaceToolBehavior:[`type`,Dv]};function kv(e,t,n){return n||=`round`,Math[n](e/t)*t}var Av=1200,jv=800;function Mv(e,t,n){var r=!n||n.active!==!1;this._eventBus=t;var i=this;t.on(`diagram.init`,jv,function(){i.setActive(r)}),t.on([`create.move`,`create.end`,`bendpoint.move.move`,`bendpoint.move.end`,`connect.move`,`connect.end`,`connectionSegment.move.move`,`connectionSegment.move.end`,`resize.move`,`resize.end`,`shape.move.move`,`shape.move.end`],Av,function(t){var n=t.originalEvent;if(!(!i.active||n&&Jt(n))){var r=t.context,a=r.gridSnappingContext;a||=r.gridSnappingContext={},[`x`,`y`].forEach(function(n){var r={},a=Pv(t,n,e);a&&(r.offset=a);var o=Nv(t,n);o&&T(r,o),os(t,n)||i.snapEvent(t,n,r)})}})}Mv.prototype.snapEvent=function(e,t,n){J(e,t,this.snapValue(e[t],n))},Mv.prototype.getGridSpacing=function(){return 10},Mv.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=kv(e,10);var r,i;return t&&t.min&&(r=t.min,h(r)&&(r=kv(r+n,10,`ceil`),e=Math.max(e,r))),t&&t.max&&(i=t.max,h(i)&&(i=kv(i+n,10,`floor`),e=Math.min(e,i))),e-=n,e},Mv.prototype.isActive=function(){return this.active},Mv.prototype.setActive=function(e){this.active=e,this._eventBus.fire(`gridSnapping.toggle`,{active:e})},Mv.prototype.toggleActive=function(){this.setActive(!this.active)},Mv.$inject=[`elementRegistry`,`eventBus`,`config.gridSnapping`];function Nv(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},a=n.gridSnappingContext,o=a.snapConstraints;if(o&&o[t])return o[t];o||=a.snapConstraints={},o[t]||(o[t]={});var s=n.direction;r&&(Fv(t)?(o.x.min=r.left,o.x.max=r.right):(o.y.min=r.top,o.y.max=r.bottom));var c=i.min,l=i.max;return c&&(Fv(t)?Lv(s)?o.x.max=c.left:o.x.min=c.right:Iv(s)?o.y.max=c.top:o.y.min=c.bottom),l&&(Fv(t)?Lv(s)?o.x.min=l.left:o.x.max=l.right:Iv(s)?o.y.min=l.top:o.y.max=l.bottom),o[t]}function Pv(e,t,n){var r=e.context,i=e.shape,a=r.gridSnappingContext,o=a.snapLocation,s=a.snapOffset;return s&&h(s[t])||(s||=a.snapOffset={},h(s[t])||(s[t]=0),!i)||(n.get(i.id)||(Fv(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2),!o)||(t===`x`?/left/.test(o)?s[t]-=i.width/2:/right/.test(o)&&(s[t]+=i.width/2):/top/.test(o)?s[t]-=i.height/2:/bottom/.test(o)&&(s[t]+=i.height/2)),s[t]}function Fv(e){return e===`x`}function Iv(e){return e.indexOf(`n`)!==-1}function Lv(e){return e.indexOf(`w`)!==-1}var Rv={__depends__:[Ov],__init__:[`gridSnapping`],gridSnapping:[`type`,Mv]},zv=2e3;function Bv(e,t,n){e.on(`autoPlace`,zv,function(e){var r=e.source,i=M(r),a=e.shape,o=Ta(r,a,n);return[`x`,`y`].forEach(function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],O(a,`bpmn:TextAnnotation`)&&(n.offset=Vv(e)?-a.width/2:-a.height/2),o[e]=t.snapValue(o[e],n))}),o})}Bv.$inject=[`eventBus`,`gridSnapping`,`elementRegistry`];function Vv(e){return e===`x`}var Hv=1750;function Uv(e,t,n){t.on([`create.start`,`shape.move.start`],Hv,function(t){var r=t.context,i=r.shape,a=e.getRootElement();O(i,`bpmn:Participant`)&&O(a,`bpmn:Process`)&&a.children.length&&r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height}))})}Uv.$inject=[`canvas`,`eventBus`,`gridSnapping`];var Wv=3e3;function Gv(e,t,n){B.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted([`connection.create`,`connection.layout`],Wv,function(e){var t=e.context,i=t.connection,a=t.hints||{},o=i.waypoints;a.connectionStart||a.connectionEnd||a.createElementsBehavior===!1||Kv(o)&&n.updateWaypoints(i,r.snapMiddleSegments(o))})}Gv.$inject=[`eventBus`,`gridSnapping`,`modeling`],z(Gv,B),Gv.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var r=1;r<e.length-2;r++)n=Yv(t,e[r],e[r+1]),e[r]=n[0],e[r+1]=n[1];return e};function Kv(e){return e.length>3}function qv(e){return e===`h`}function Jv(e){return e===`v`}function Yv(e,t,n){var r=Se(t,n),i={};return qv(r)&&(i.y=e.snapValue(t.y)),Jv(r)&&(i.x=e.snapValue(t.x)),(`x`in i||`y`in i)&&(t=T({},t,i),n=T({},n,i)),[t,n]}var Xv={__depends__:[Rv,{__init__:[`gridSnappingAutoPlaceBehavior`,`gridSnappingParticipantBehavior`,`gridSnappingLayoutConnectionBehavior`],gridSnappingAutoPlaceBehavior:[`type`,Bv],gridSnappingParticipantBehavior:[`type`,Uv],gridSnappingLayoutConnectionBehavior:[`type`,Gv]}],__init__:[`bpmnGridSnapping`],bpmnGridSnapping:[`type`,wv]},Zv=30,Qv=30;function $v(e,t){this._interactionEvents=t;var n=this;e.on([`interactionEvents.createHit`,`interactionEvents.updateHit`],function(e){var t=e.element,r=e.gfx;if(O(t,`bpmn:Lane`))return n._createParticipantHit(t,r);if(O(t,`bpmn:Participant`))return R(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r);if(O(t,`bpmn:SubProcess`))return R(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r)})}$v.$inject=[`eventBus`,`interactionEvents`],$v.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},$v.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=He(e)?{width:Zv,height:e.height}:{width:e.width,height:Qv};return this._interactionEvents.createBoxHit(t,`all`,n),!0},$v.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:Qv}),!0};var ey={__init__:[`bpmnInteractionEvents`],bpmnInteractionEvents:[`type`,$v]};function ty(e){e.invoke(ln,this)}z(ty,ln),ty.$inject=[`injector`];var ny={selectElements:{key:`A`,modifier:`cmd`},find:{key:`F`,modifier:`cmd`},spaceTool:{key:`S`},lassoTool:{key:`L`},handTool:{key:`H`},globalConnectTool:{key:`C`},directEditing:{key:`E`},replaceElement:{key:`R`}};ty.prototype.registerBindings=function(e,t){ln.prototype.registerBindings.call(this,e,t),b(ny,function(n,r){if(t.isRegistered(r)){var i=[n.key.toLowerCase(),n.key.toUpperCase()],a=n.modifier===`cmd`;e.addListener(function(n){var o=n.keyEvent;if(e.isKey(i,o)){if(a){if(!e.isCmd(o))return}else if(e.hasModifier(o))return;return t.trigger(r,o),!0}})}})};var ry={__depends__:[un],__init__:[`keyboardBindings`],keyboardBindings:[`type`,ty]},iy={moveSpeed:1,moveSpeedAccelerated:10},ay=1500,oy=`left`,sy=`up`,cy=`right`,ly=`down`,uy={ArrowLeft:oy,Left:oy,ArrowUp:sy,Up:sy,ArrowRight:cy,Right:cy,ArrowDown:ly,Down:ly},dy={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 fy(e,t,n,r,i){var a=this;this._config=T({},iy,e||{}),t.addListener(ay,function(e){var n=e.keyEvent,r=uy[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return a.moveSelection(r,i),!0}}),this.moveSelection=function(e,t){var a=i.get();if(a.length){var o=this._config[t?`moveSpeedAccelerated`:`moveSpeed`],s=dy[e](o);r.allowed(`elements.move`,{shapes:a,hints:{keyboardMove:!0}})&&n.moveElements(a,s)}}}fy.$inject=[`config.keyboardMoveSelection`,`keyboard`,`modeling`,`rules`,`selection`];var py={__depends__:[un,It],__init__:[`keyboardMoveSelection`],keyboardMoveSelection:[`type`,fy]},my=10;function hy(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function a(e,t){var n=e.shape,r=e.direction,a=e.resizeConstraints,o;e.delta=t,o=Fc(n,r,t),e.newBounds=Rc(o,a),e.canExecute=i.canResize(e)}function o(e){var t=e.resizeConstraints,n=e.minBounds;t===void 0&&(n===void 0&&(n=i.computeMinResizeBox(e)),e.resizeConstraints={min:N(n)})}function s(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(i=we(i),!gy(t,i))return;n.resizeShape(t,i)}}e.on(`resize.start`,function(e){o(e.context)}),e.on(`resize.move`,function(e){var t={x:e.dx,y:e.dy};a(e.context,t)}),e.on(`resize.end`,function(e){s(e.context)})}hy.prototype.canResize=function(e){var t=this._rules,n=ie(e,[`newBounds`,`shape`,`delta`,`direction`]);return t.allowed(`shape.resize`,n)},hy.prototype.activate=function(e,t,n){var r=this._dragging,i,a;if(typeof n==`string`&&(n={direction:n}),i=T({shape:t},n),a=i.direction,!a)throw Error(`must provide a direction (n|w|s|e|nw|se|ne|sw)`);r.init(e,_y(t,a),`resize`,{autoActivate:!0,cursor:vy(a),data:{shape:t,context:i}})},hy.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction;return zc(n,t,e.minDimensions||{width:my,height:my},Uc(t,e.childrenBoxPadding))},hy.$inject=[`eventBus`,`rules`,`modeling`,`dragging`];function gy(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _y(e,t){var n=M(e),r=N(e),i={x:n.x,y:n.y};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(i.y=r.bottom):i.y=r.top,t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(i.x=r.left):i.x=r.right,i}function vy(e){var t=`resize-`;return e===`n`||e===`s`?t+`ns`:e===`e`||e===`w`?t+`ew`:e===`nw`||e===`se`?t+`nwse`:t+`nesw`}var yy=`djs-resizing`,by=`resize-not-ok`,xy=500;function Sy(e,t,n){function r(e){var r=e.shape,i=e.newBounds,a=e.frame;a||(a=e.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,yy)),i.width>5&&P(a,{x:i.x,width:i.width}),i.height>5&&P(a,{y:i.y,height:i.height}),e.canExecute?I(a).remove(by):I(a).add(by)}function i(e){var n=e.shape;e.frame&&ke(e.frame),t.removeMarker(n,yy)}e.on(`resize.move`,xy,function(e){r(e.context)}),e.on(`resize.cleanup`,function(e){i(e.context)})}Sy.$inject=[`eventBus`,`canvas`,`previewSupport`];var Cy=-6,wy=8,Ty=20,Ey=`djs-resizer`,Dy=[`n`,`w`,`s`,`e`,`nw`,`ne`,`se`,`sw`];function Oy(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on(`selection.changed`,function(e){var t=e.newSelection;i.removeResizers(),t.length===1&&b(t,S(i.addResizer,i))}),e.on(`shape.changed`,function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))})}Oy.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){yt(t)&&r.activate(t,e,n)}H.bind(t,`mousedown`,i),H.bind(t,`touchstart`,i)},Oy.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),a=ky(r),o=F(`g`);I(o).add(Ey),I(o).add(Ey+`-`+e.id),I(o).add(Ey+`-`+r),L(i,o);var s=F(`rect`);P(s,{x:-wy/2+a.x,y:-wy/2+a.y,rx:2,width:wy,height:wy}),I(s).add(Ey+`-visual`),L(o,s);var c=F(`rect`);return P(c,{x:-Ty/2+a.x,y:-Ty/2+a.y,width:Ty,height:Ty}),I(c).add(Ey+`-hit`),L(o,c),bt(o,t,n),o},Oy.prototype.createResizer=function(e,t){var n=_y(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Oy.prototype.addResizer=function(e){var t=this;A(e)||b(Dy,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Oy.prototype.removeResizers=function(){var e=this._getResizersParent();Oe(e)},Oy.prototype._getResizersParent=function(){return this._canvas.getLayer(`resizers`)},Oy.$inject=[`eventBus`,`canvas`,`selection`,`resize`];function ky(e){var t={x:0,y:0};return e.indexOf(`e`)===-1?e.indexOf(`w`)!==-1&&(t.x=Cy):t.x=-Cy,e.indexOf(`s`)===-1?e.indexOf(`n`)!==-1&&(t.y=Cy):t.y=-Cy,t}var Ay={__depends__:[eo,Ya,Ps],__init__:[`resize`,`resizePreview`,`resizeHandles`],resize:[`type`,hy],resizePreview:[`type`,Sy],resizeHandles:[`type`,Oy]},jy=2e3;function My(e,t,n,r,i,a,o){this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=o,r.registerProvider(this),e.on(`element.dblclick`,function(e){s(e.element,!0)}),e.on([`autoPlace.start`,`canvas.viewbox.changing`,`drag.init`,`element.mousedown`,`popupMenu.open`,`root.set`,`selection.changed`],function(){r.isActive()&&r.complete()}),e.on([`shape.remove`,`connection.remove`],jy,function(e){r.isActive(e.element)&&r.cancel()}),e.on([`commandStack.changed`],function(e){r.isActive()&&r.cancel()}),e.on(`directEditing.activate`,function(e){a.removeResizers()}),e.on(`create.end`,500,function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&t.hints.createElementsBehavior===!1||s(n))}),e.on(`autoPlace.end`,500,function(e){s(e.shape)});function s(e,t){(t||E(e,[`bpmn:Activity`,`bpmn:Event`,`bpmn:TextAnnotation`,`bpmn:Participant`]))&&r.activate(e)}}My.$inject=[`eventBus`,`bpmnFactory`,`canvas`,`directEditing`,`modeling`,`resizeHandles`,`textRenderer`],My.prototype.activate=function(e){var t=ue(e);if(t!==void 0){var n={text:t},r=this.getEditingBBox(e);T(n,r);var i={},a=n.style||{};return T(a,{backgroundColor:null,border:null}),(E(e,[`bpmn:Task`,`bpmn:Participant`,`bpmn:Lane`,`bpmn:CallActivity`])||Ny(e))&&T(i,{centerVertically:!0}),pe(e)&&(T(i,{resizable:!0,autoResize:!0}),T(a,{backgroundColor:`#ffffff`,border:`1px solid #ccc`})),O(e,`bpmn:TextAnnotation`)&&(T(i,{resizable:!0,autoResize:!0}),T(a,{backgroundColor:`#ffffff`,border:`1px solid #ccc`})),T(n,{options:i,style:a}),n}},My.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i={x:r.x+r.width/2,y:r.y+r.height/2},a={x:r.x,y:r.y},o=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*o,u=c.lineHeight,d=s.fontSize*o,f=s.lineHeight,p={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(O(e,`bpmn:Lane`)||Iy(e)){var m=He(e),h=m?{width:r.height,height:30*o,x:r.x-r.height/2+15*o,y:i.y-30*o/2}:{width:r.width,height:30*o};T(a,h),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`,transform:m?`rotate(-90deg)`:null})}if(Fy(e)){var g=He(e),_=g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i.x-r.height/2,y:i.y-r.width/2};T(a,_),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`,transform:g?null:`rotate(-90deg)`})}(E(e,[`bpmn:Task`,`bpmn:CallActivity`])||Ny(e))&&(T(a,{width:r.width,height:r.height}),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`})),Py(e)&&(T(a,{width:r.width,x:r.x}),T(p,{fontSize:d+`px`,lineHeight:f,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:5*o+`px`,paddingRight:5*o+`px`}));var v=1,y=r.width+2*v;if(n.labelTarget&&(T(a,{width:y,height:r.height+2*v,x:r.x-v,y:r.y-v}),T(p,{fontSize:l+`px`,lineHeight:u})),pe(n)&&!se(n)&&!j(n)){var b=fe(e),x=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),S=l,C=me.width*o+2*v;T(a,{width:C,height:S+2*v,x:x.x-C/2,y:x.y-S/2-v}),T(p,{fontSize:l+`px`,lineHeight:u})}return O(e,`bpmn:TextAnnotation`)&&(T(a,{width:r.width+2*v,height:r.height+2*v,x:r.x-v,y:r.y-v,minWidth:30*o,minHeight:10*o}),T(p,{textAlign:`left`,paddingTop:7*o+`px`,paddingBottom:7*o+`px`,paddingLeft:7*o+`px`,paddingRight:7*o+`px`,fontSize:d+`px`,lineHeight:f})),{bounds:a,style:p}},My.prototype.update=function(e,t,n,r){var i,a;O(e,`bpmn:TextAnnotation`)&&(a=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/a.width*r.width,height:e.height/a.height*r.height}),Ly(t)&&(t=null),this._modeling.updateLabel(e,t,i)};function Ny(e){return O(e,`bpmn:SubProcess`)&&!R(e)}function Py(e){return O(e,`bpmn:SubProcess`)&&R(e)}function Fy(e){return O(e,`bpmn:Participant`)&&!R(e)}function Iy(e){return O(e,`bpmn:Participant`)&&R(e)}function Ly(e){return!e||!e.trim()}var Ry=`djs-element-hidden`,zy=`djs-label-hidden`;function By(e,t,n){var r=this,i=t.getDefaultLayer(),a,o,s;e.on(`directEditing.activate`,function(e){var c=e.active;if(a=c.element.label||c.element,O(a,`bpmn:TextAnnotation`)){o=t.getAbsoluteBBox(a),s=F(`g`);var l=n.getScaledPath(`TEXT_ANNOTATION`,{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:a.height,position:{mx:0,my:0}}),u=r.path=F(`path`);P(u,{d:l,strokeWidth:2,stroke:Vy(a)}),L(s,u),L(i,s),Bt(s,a.x,a.y)}O(a,`bpmn:TextAnnotation`)||a.labelTarget?t.addMarker(a,Ry):(O(a,`bpmn:Task`)||O(a,`bpmn:CallActivity`)||O(a,`bpmn:SubProcess`)||O(a,`bpmn:Participant`)||O(a,`bpmn:Lane`))&&t.addMarker(a,zy)}),e.on(`directEditing.resize`,function(e){if(O(a,`bpmn:TextAnnotation`)){var t=e.height,i=e.dy,s=Math.max(a.height/o.height*(t+i),0),c=n.getScaledPath(`TEXT_ANNOTATION`,{xScaleFactor:1,yScaleFactor:1,containerWidth:a.width,containerHeight:s,position:{mx:0,my:0}});P(r.path,{d:c})}}),e.on([`directEditing.complete`,`directEditing.cancel`],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Ry),t.removeMarker(a,zy)),a=void 0,o=void 0,s&&=(ke(s),void 0)})}By.$inject=[`eventBus`,`canvas`,`pathMap`];function Vy(e,t){return D(e).get(`stroke`)||t||`black`}var Hy={__depends__:[Ct,Ay,I_],__init__:[`labelEditingProvider`,`labelEditingPreview`],labelEditingProvider:[`type`,My],labelEditingPreview:[`type`,By]},Uy=500,Wy=1e3;function Gy(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls(`djs-outline`,[`no-fill`]);var r=this;function i(e){le(e)||r.createOutline(e)}e.on(`element.hover`,function(e){i(e.element)}),e.on(`selection.changed`,function(e){b(e.newSelection,i)}),e.on([`shape.changed`,`connection.changed`],Uy,function(e){var t=e.element,n=e.gfx,i=V(`.djs-outline`,n);i&&r.updateOutline(t,i)})}Gy.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw Error(`cannot create outline for non-rendered element`);var n=V(`.djs-outline`,t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),L(t,n),this.updateOutline(e,n)),n},Gy.prototype._createOutlineGfx=function(){var e=F(`rect`);return P(e,T({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Gy.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Gy.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&b(r,function(r){n||=r.updateOutline(t,e)}),n||P(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Gy.prototype.updateConnectionOutline=function(e,t){var n=it(t);P(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Gy.prototype.registerProvider=function(e,t){t||(t=e,e=Wy),this._eventBus.on(`outline.getProviders`,e,function(e){e.providers.push(t)})},Gy.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:`outline.getProviders`,providers:[]});return this._eventBus.fire(e),e.providers},Gy.prototype.getOutline=function(e){var t,n=this._getProviders();return b(n,function(n){x(n.getOutline)&&(t||=n.getOutline(e))}),t},Gy.$inject=[`eventBus`,`styles`,`elementRegistry`];var Ky=6;function qy(e,t,n){this._canvas=t;var r=this;e.on(`element.changed`,function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())}),e.on(`selection.changed`,function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)})}qy.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer(`selectionOutline`);Oe(t);var n=e.length>1,r=this._canvas.getContainer();if(I(r)[n?`add`:`remove`](`djs-multi-select`),n){var i=Jy(it(e)),a=F(`rect`);P(a,T({rx:3},i)),I(a).add(`djs-selection-outline`),L(t,a)}},qy.$inject=[`eventBus`,`canvas`,`selection`];function Jy(e){return{x:e.x-Ky,y:e.y-Ky,width:e.width+Ky*2,height:e.height+Ky*2}}var Yy={__depends__:[It],__init__:[`outline`,`multiSelectionOutline`],outline:[`type`,Gy],multiSelectionOutline:[`type`,qy]},Xy=[`bpmn:Event`,`bpmn:SequenceFlow`,`bpmn:Gateway`],Zy={class:`bjs-label-link`,stroke:`var(--element-selected-outline-secondary-stroke-color)`,strokeDasharray:`5, 5`},Qy=15,$y=2;function eb(e,t,n,r,i){let a=t.getLayer(`overlays`);e.on([`selection.changed`,`shape.changed`],function(){s()}),e.on(`selection.changed`,function({newSelection:e}){let t=e.filter(e=>E(e,Xy));if(t.length===1){let e=t[0];j(e)?o(e,e.labelTarget):e.labels?.length&&o(e.labels[0],e)}if(t.length===2){let e=t.find(j),n=t.find(t=>t.labels?.includes(e));e&&n&&o(e,n)}}),e.on(`shape.changed`,function({element:e}){E(e,Xy)&&u(e)&&(j(e)?o(e,e.labelTarget):e.labels?.length&&o(e.labels[0],e))});function o(e,t){let n=M(e),r=A(t)?Wl(n,Kl(t.waypoints)):M(t),o=Be([r,n],Zy),s=o.getAttribute(`d`),u=i.isSelected(e)?c(e):l(e),d=ve(u,s);if(!d)return;let f;if(A(t))f=r;else{let e=i.isSelected(t)?c(t):l(t);f=ve(e,s)||M(t)}go(f,d)<Qy||(Re(o,[f,d]),L(a,o))}function s(){lt(`.${Zy.class}`,a).forEach(ke)}function c(e){let t=r.getOutline(e);if(!t)return l(e);if(t.x){let n={x:e.x+tb(t,`x`)-$y,y:e.y+tb(t,`y`)-$y,width:tb(t,`width`)+$y*2,height:tb(t,`height`)+$y*2};return Ue(n,tb(t,`rx`))}if(t.cx){let n=tb(t,`r`),r={x:e.x+tb(t,`cx`)-n,y:e.y+tb(t,`cy`)-n,width:n*2,height:n*2};return We(r)}}function l(e){return n.getShapePath(e)}function u(e){return i.isSelected(e)}}eb.$inject=[`eventBus`,`canvas`,`graphicsFactory`,`outline`,`selection`];function tb(e,t){return parseFloat(P(e,t)||0)}var nb={__depends__:[It,Yy],__init__:[`labelLink`],labelLink:[`type`,eb]},rb=new At(`tt`);function ib(e){var t=gt(`<div class="djs-tooltip-container" />`);return ut(t,{position:`absolute`,width:`0`,height:`0`}),e.insertBefore(t,e.firstChild),t}function ab(e,t,n){ut(e,{left:t+`px`,top:n+`px`})}function ob(e,t){e.style.display=t===!1?`none`:``}var sb=`djs-tooltip`,cb=`.`+sb;function lb(e,t){this._eventBus=e,this._canvas=t,this._ids=rb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=ib(t.getContainer());var n=this;pt.bind(this._tooltipRoot,cb,`mousedown`,function(e){e.stopPropagation()}),pt.bind(this._tooltipRoot,cb,`mouseover`,function(e){n.trigger(`mouseover`,e)}),pt.bind(this._tooltipRoot,cb,`mouseout`,function(e){n.trigger(`mouseout`,e)}),this._init()}lb.$inject=[`eventBus`,`canvas`],lb.prototype.add=function(e){if(!e.position)throw Error(`must specifiy tooltip position`);if(!e.html)throw Error(`must specifiy tooltip html`);var t=this._ids.next();return e=T({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},lb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(ft(n,`data-tooltip-id`));r&&(e===`mouseover`&&r.timeout&&this.clearTimeout(r),e===`mouseout`&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},lb.prototype.get=function(e){return typeof e!=`string`&&(e=e.id),this._tooltips[e]},lb.prototype.clearTimeout=function(e){if(e=this.get(e),e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},lb.prototype.setTimeout=function(e){if(e=this.get(e),e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},lb.prototype.remove=function(e){var t=this.get(e);t&&(ot(t.html),ot(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},lb.prototype.show=function(){ob(this._tooltipRoot)},lb.prototype.hide=function(){ob(this._tooltipRoot,!1)},lb.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r=`matrix(`+t+`,0,0,`+n+`,`+-1*e.x*t+`,`+-1*e.y*n+`)`;this._tooltipRoot.style.transform=r,this._tooltipRoot.style[`-ms-transform`]=r},lb.prototype._addTooltip=function(e){var t=e.id,n=e.html,r,i=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),re(n)&&(n=gt(n)),r=gt(`<div data-tooltip-id="`+t+`" class="`+sb+`">`),ut(r,{position:`absolute`}),r.appendChild(n),e.type&&at(r).add(`djs-tooltip-`+e.type),e.className&&at(r).add(e.className),e.htmlContainer=r,i.appendChild(r),this._tooltips[t]=e,this._updateTooltip(e)},lb.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;ab(n,t.x,t.y)},lb.prototype._updateTooltipVisibilty=function(e){b(this._tooltips,function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),ob(r,i))})},lb.prototype._init=function(){var e=this;function t(t){e._updateRoot(t),e._updateTooltipVisibilty(t),e.show()}this._eventBus.on(`canvas.viewbox.changing`,function(t){e.hide()}),this._eventBus.on(`canvas.viewbox.changed`,function(e){t(e.viewbox)})};var ub={__init__:[`tooltips`],tooltips:[`type`,lb]},db=`flow elements must be children of pools/participants`,fb=`Data object must be placed within a pool/participant.`;function pb(e,t,n){function r(e,n,r){t.add({position:{x:e.x+5,y:e.y+5},type:`error`,timeout:r||2e3,html:`<div>`+n+`</div>`})}e.on([`shape.move.rejected`,`create.rejected`],function(e){var t=e.context,i=t.shape,a=t.target;O(a,`bpmn:Collaboration`)&&(O(i,`bpmn:FlowNode`)?r(e,n(db)):O(i,`bpmn:DataObjectReference`)&&r(e,n(fb)))})}pb.$inject=[`eventBus`,`tooltips`,`translate`];var mb={__depends__:[ub],__init__:[`modelingFeedback`],modelingFeedback:[`type`,pb]},hb=500,gb=1250,_b=1500,vb=Math.round;function yb(e){return{x:e.x+vb(e.width/2),y:e.y+vb(e.height/2)}}function bb(e,t,n,r,i){function a(e,t,n,r){return i.allowed(`elements.move`,{shapes:e,delta:t,position:n,target:r})}e.on(`shape.move.start`,_b,function(e){var t=e.context,n=e.shape,i=r.get().slice();i.indexOf(n)===-1&&(i=[n]),i=xb(i),T(t,{shapes:i,validatedShapes:i,shape:n})}),e.on(`shape.move.start`,gb,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=a(n)))return!1}),e.on(`shape.move.move`,hb,function(e){var t=e.context,n=t.validatedShapes,r=e.hover,i={x:e.dx,y:e.dy},o=a(n,i,{x:e.x,y:e.y},r);t.delta=i,t.canExecute=o,t.target=o===null?null:r}),e.on(`shape.move.end`,function(e){var t=e.context,r=t.delta,i=t.canExecute,a=i===`attach`,o=t.shapes;if(i===!1)return!1;r.x=vb(r.x),r.y=vb(r.y),(r.x!==0||r.y!==0)&&n.moveElements(o,r,t.target,{primaryShape:t.shape,attach:a})}),e.on(`element.mousedown`,function(e){if(yt(e)){var t=Ft(e);if(!t)throw Error(`must supply DOM mousedown event`);return o(t,e.element)}});function o(e,n,r,i){if(l(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!I(e.target).has(`djs-hit-no-move`)){var a=yb(n);if(t.init(e,a,`shape.move`,{cursor:`grabbing`,autoActivate:r,data:{shape:n,context:i||{}}})!==!1)return!0}}this.start=o}bb.$inject=[`eventBus`,`dragging`,`modeling`,`selection`,`rules`];function xb(e){var t=ne(e,`id`);return u(e,function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0})}var Sb=499,Cb=`djs-dragging`,wb=`drop-ok`,Tb=`drop-not-ok`,Eb=`new-parent`,Db=`attach-ok`;function Ob(e,t,n,r){function i(e){return kb(a(e))}function a(e){var t=et(e),n=t.flatMap(e=>(e.incoming||[]).concat(e.outgoing||[])),r=t.concat(n);return[...new Set(r)]}function o(e,n){[Db,wb,Tb,Eb].forEach(function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)})}function s(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,Cb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}e.on(`shape.move.start`,Sb,function(e){var o=e.context,s=o.shapes,c=o.allDraggedElements,l=i(s);if(!o.dragGroup){var u=F(`g`);P(u,n.cls(`djs-drag-group`,[`no-events`]));var d=t.getActiveLayer();L(d,u),o.dragGroup=u}l.forEach(function(e){r.addDragger(e,o.dragGroup)}),c=c?f([c,a(s)]):a(s),b(c,function(e){t.addMarker(e,Cb)}),o.allDraggedElements=c,o.differentParents=Ab(s)}),e.on(`shape.move.move`,Sb,function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,a=t.canExecute;r&&(a===`attach`?o(r,Db):t.canExecute&&i&&r.id!==i.id?o(r,Eb):o(r,t.canExecute?wb:Tb)),Bt(n,e.dx,e.dy)}),e.on([`shape.move.out`,`shape.move.cleanup`],function(e){var t=e.context.target;t&&o(t,null)}),e.on(`shape.move.cleanup`,function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;b(r,function(e){t.removeMarker(e,Cb)}),i&&ke(i)}),this.makeDraggable=s}Ob.$inject=[`eventBus`,`canvas`,`styles`,`previewSupport`];function kb(e){var t=new Set;return e.forEach(function(e){t.add(e.id)}),u(e,function(e){return!A(e)||t.has(e.source.id)&&t.has(e.target.id)})}function Ab(e){return r(ne(e,function(e){return e.parent&&e.parent.id}))!==1}var jb={__depends__:[jt,It,Yy,eo,Ya,Ps],__init__:[`move`,`movePreview`],move:[`type`,bb],movePreview:[`type`,Ob]},Mb=300;function Nb(e){this._canvas=e,this._mount=null,this._current=null,this._showTimer=null}Nb.$inject=[`canvas`],Nb.prototype.add=function(e){let{container:t,selector:n,showDelay:r=Mb}=e;pt.bind(t,n,`mouseover`,t=>this._show(t.delegateTarget,e,r)),pt.bind(t,n,`mouseout`,e=>{let{delegateTarget:t,relatedTarget:n}=e;n&&t.contains(n)||this._hide()})},Nb.prototype._show=function(e,t,n){let r=t.getContent(e);r&&(this._current={target:e,content:r,getPosition:t.getPosition},clearTimeout(this._showTimer),this._showTimer=setTimeout(()=>this._render(),n))},Nb.prototype._hide=function(){clearTimeout(this._showTimer),this._current=null,this._render()},Nb.prototype._render=function(){let e=this._getMount();if(!this._current){Hr(null,e);return}let{target:t,content:n,getPosition:r}=this._current,{x:i,y:a,placement:o=`right`}=r(t);Hr(G`<div
|
|
373
373
|
class="djs-hover-tooltip djs-hover-tooltip--${o}"
|
|
374
374
|
style=${{left:`${i}px`,top:`${a}px`}}
|
|
375
375
|
>${n}</div>`,e)},Nb.prototype._getMount=function(){return this._mount||(this._mount=gt(`<div class="djs-hover-tooltip-container"></div>`),this._canvas.getContainer().appendChild(this._mount)),this._mount};var Pb={__init__:[`hoverTooltip`],hoverTooltip:[`type`,Nb]},Fb=`.djs-palette-toggle`,Ib=`.entry`,Lb=Fb+`, `+Ib,Rb=`djs-palette-`,zb=`shown`,Bb=`open`,Vb=`two-column`,Hb=1e3;function Q(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()})}Q.$inject=[`eventBus`,`canvas`],Q.prototype.registerProvider=function(e,t){t||(t=e,e=Hb),this._eventBus.on(`palette.getProviders`,e,function(e){e.providers.push(t)}),this._rebuild()},Q.prototype.getEntries=function(){return this._getProviders().reduce(Wb,{})},Q.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},Q.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=gt(Q.HTML_MARKUP);n.appendChild(r),at(n).add(Rb+zb),pt.bind(r,Lb,`click`,function(t){var n=t.delegateTarget;if(tt(n,Fb))return e.toggle();e.trigger(`click`,t)}),H.bind(r,`mousedown`,function(e){e.stopPropagation()}),pt.bind(r,Ib,`dragstart`,function(t){e.trigger(`dragstart`,t)}),t.on(`canvas.resized`,this._layoutChanged,this),t.fire(`palette.create`,{container:r})},Q.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:`palette.getProviders`,providers:[]});return this._eventBus.fire(t),t.providers},Q.prototype._toggleState=function(e){e||={};var t=this._getParentContainer(),n=this._container,r=this._eventBus,i,a=at(n),o=at(t);i=`twoColumn`in e?e.twoColumn:this._needsCollapse(t.clientHeight,this._entries||{}),a.toggle(Vb,i),o.toggle(Rb+Vb,i),`open`in e&&(a.toggle(Bb,e.open),o.toggle(Rb+Bb,e.open)),r.fire(`palette.changed`,{twoColumn:i,open:this.isOpen()})},Q.prototype._update=function(){var e=V(`.djs-palette-entries`,this._container),t=this._entries=this.getEntries();st(e),b(t,function(t,n){var r=t.group||`default`,i=V(`[data-group=`+Lt(r)+`]`,e);i||(i=gt(`<div class="group"></div>`),ft(i,`data-group`,r),e.appendChild(i));var a=t.html||(t.separator?`<hr class="separator" />`:`<div class="entry" draggable="true"></div>`),o=gt(a);if(i.appendChild(o),!t.separator&&(ft(o,`data-action`,n),t.title&&(ft(o,`aria-label`,t.title),ft(o,`role`,`button`)),t.className&&Ub(o,t.className),t.imageUrl)){var s=gt(`<img>`);ft(s,`src`,t.imageUrl),o.appendChild(s)}}),this.open()},Q.prototype.trigger=function(e,t,n){var r,i,a=t.delegateTarget||t.target;return a?(r=ft(a,`data-action`),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Q.prototype.triggerEntry=function(e,t,n,r){var i=this._entries[e],a;if(i&&(a=i.action,this._eventBus.fire(`palette.trigger`,{entry:i,event:n})!==!1)){if(x(a)){if(t===`click`)return a(n,r)}else if(a[t])return a[t](n,r);n.preventDefault()}},Q.prototype._layoutChanged=function(){this._toggleState({})},Q.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},Q.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Q.prototype.open=function(){this._toggleState({open:!0})},Q.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Q.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Q.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||=(t=V(`.djs-palette-entries`,this._container),V(`[data-group=tools]`,t)),n=this._toolsContainer,b(n.children,function(t){var n=t.getAttribute(`data-action`);if(n){var r=at(t);n=n.replace(`-tool`,``),r.contains(`entry`)&&n===e?r.add(`highlighted-entry`):r.remove(`highlighted-entry`)}})},Q.prototype.isOpen=function(){return at(this._container).has(Bb)},Q.prototype._getParentContainer=function(){return this._canvas.getContainer()},Q.HTML_MARKUP=`<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>`;function Ub(e,t){var n=at(e);(m(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})}function Wb(e,t){var n=t.getPaletteEntries();return x(n)?n(e):(b(n,function(t,n){e[n]=t}),e)}function Gb(e){let{title:t,shortcut:n}=e;return G`
|
|
@@ -378,7 +378,7 @@ import{n as e}from"../elements.js";import{A as t,C as n,D as r,M as i,N as a,O a
|
|
|
378
378
|
`}var Kb=`.djs-palette-entries .entry`,qb=8;function Jb(e,t,n){this._palette=t,this._hoverTooltip=n,this._entries={},e.on(`palette.create`,e=>this._init(e.container)),e.on(`palette.changed`,()=>this._updateEntries())}Jb.$inject=[`eventBus`,`palette`,`hoverTooltip`],Jb.prototype._init=function(e){this._updateEntries(),this._hoverTooltip.add({container:e,selector:Kb,getContent:e=>{let t=this._entries[ft(e,`data-action`)];return!t||!t.title?null:G`<${Gb}
|
|
379
379
|
title=${t.title}
|
|
380
380
|
shortcut=${t.shortcut}
|
|
381
|
-
/>`},getPosition:e=>{let t=e.getBoundingClientRect();return{x:t.right+qb,y:t.top+t.height/2,placement:`right`}}})},Jb.prototype._updateEntries=function(){this._entries=this._palette.getEntries()};var Yb={__depends__:[Pb],__init__:[`palette`,`paletteTooltip`],palette:[`type`,Q],paletteTooltip:[`type`,Jb]},Xb=`crosshair`,Zb=`selected`,Qb=`djs-dragging-active-lasso`;function $b(e,t,n,r,a,o,s){this._selection=a,this._dragging=n,this._mouse=s;var c=this,l={create:function(e){var n=t.getActiveLayer(),r=e.frame=F(`rect`);P(r,{class:`djs-lasso-overlay`,width:1,height:1,x:0,y:0}),L(n,r),u(!0),this.update(e)},update:function(e){var n=e.frame,r=e.bbox;n&&r&&P(n,{x:r.x,y:r.y,width:r.width,height:r.height});var i=e.marked,a=e.lastMarked;if(i&&a){for(let e of a)i.has(e)||t.removeMarker(e,Zb);for(let e of i)a.has(e)||t.addMarker(e,Zb)}},remove:function(e){this.update(e),e.frame&&ke(e.frame),u(!1)}};function u(e){I(t.getContainer()).toggle(Qb,e)}function d(e){var t=r.getAll();return new Set(i(dt(t,e)))}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(){c.activateLasso(t.originalEvent,!0)})}),e.on(`lasso.end`,0,function(e){var t=e.context;c._select(Array.from(t.marked))}),e.on(`lasso.start`,function(e){var t=e.context;t.bbox=ex(e),t.add=Et(e),t.lastMarked=new Set(a.get()),t.marked=t.add?t.lastMarked:new Set,t.initialMarked=t.marked,l.create(t)}),e.on(`lasso.move`,function(e){var t=e.context,n=d(t.bbox=ex(e)),r=t.initialMarked.union(n);t.lastMarked=t.marked,t.marked=r,l.update(t)}),e.on(`lasso.cleanup`,function(e){var t=e.context;t.lastMarked=t.marked,t.marked=new Set(a.get()),l.remove(e.context)}),e.on(`element.mousedown`,1500,function(e){if(Et(e))return c.activateLasso(e.originalEvent),!0})}$b.$inject=[`eventBus`,`canvas`,`dragging`,`elementRegistry`,`selection`,`toolManager`,`mouse`],$b.prototype.activateLasso=function(e,t){this._dragging.init(e,`lasso`,{autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},$b.prototype.activateSelection=function(e,t){this._dragging.init(e,`lasso.selection`,{trapClick:!1,autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},$b.prototype._select=function(e){this._selection.select(e)},$b.prototype.select=function(e,t,n=[]){var r=i(dt(e,t));this._select([...n,...r])},$b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},$b.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ex(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}}var tx={__depends__:[Np,np],__init__:[`lassoTool`],lassoTool:[`type`,$b]},nx=1500,rx=`grab`;function ix(e,t,n,r,i,a){this._dragging=n,this._mouse=a;var o=this,s=r.get(`keyboard`,!1);i.registerTool(`hand`,{tool:`hand`,dragging:`hand.move`}),e.on(`element.mousedown`,nx,function(e){if(Pt(e))return o.activateMove(e.originalEvent,!0),!1}),s&&s.addListener(nx,function(e){if(ax(e.keyEvent)&&!o.isActive()){var t=o._mouse.getLastMoveEvent();o.activateMove(t,!!t)}},`keyboard.keydown`),s&&s.addListener(nx,function(e){ax(e.keyEvent)&&o.isActive()&&o.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(){o.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!Pt(t)&&n&&e.once(`hand.move.ended`,function(e){o.activateHand(e.originalEvent,!0,!0)}),!1})}ix.$inject=[`eventBus`,`canvas`,`dragging`,`injector`,`toolManager`,`mouse`],ix.prototype.activateMove=function(e,t,n){typeof t==`object`&&(n=t,t=!1),this._dragging.init(e,`hand.move`,{autoActivate:t,cursor:rx,data:{context:n||{}}})},ix.prototype.activateHand=function(e,t,n){this._dragging.init(e,`hand`,{trapClick:!1,autoActivate:t,cursor:rx,data:{context:{reactivate:n}}})},ix.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},ix.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ax(e){return Ut(`Space`,e)}var ox={__depends__:[Np,np],__init__:[`handTool`],handTool:[`type`,ix]},sx=`connect-ok`,cx=`connect-not-ok`;function lx(e,t,n,r,i,a,o){var s=this;this._dragging=t,this._rules=a,this._mouse=o,i.registerTool(`global-connect`,{tool:`global-connect`,dragging:`global-connect.drag`}),e.on(`global-connect.hover`,function(e){var t=e.context,n=e.hover,i=t.canStartConnect=s.canStartConnect(n);i!==null&&(t.startTarget=n,r.addMarker(n,i?sx:cx))}),e.on([`global-connect.out`,`global-connect.cleanup`],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?sx:cx)}),e.on([`global-connect.ended`],function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(s.canStartConnect(r))return e.once(`element.out`,function(){e.once([`connect.ended`,`connect.canceled`],function(){e.fire(`global-connect.drag.ended`)}),n.start(null,r,i)}),!1})}lx.$inject=[`eventBus`,`dragging`,`connect`,`canvas`,`toolManager`,`rules`,`mouse`],lx.prototype.start=function(e,t){this._dragging.init(e,`global-connect`,{autoActivate:t,trapClick:!1,data:{context:{}}})},lx.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},lx.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},lx.prototype.canStartConnect=function(e){return this._rules.allowed(`connection.start`,{source:e})};var ux={__depends__:[bs,eo,Ya,Np,np],globalConnect:[`type`,lx]};function dx(e,t,n,r,i,a,o,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=a,this._globalConnect=o,this._translate=s,e.registerProvider(this)}dx.$inject=[`palette`,`create`,`elementFactory`,`spaceTool`,`lassoTool`,`handTool`,`globalConnect`,`translate`],dx.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,a=this._handTool,o=this._globalConnect,s=this._translate;function c(e,r,i,a,o){function s(r){var i=n.createShape(T({type:e},o));t.start(r,i)}return{group:r,className:i,title:a,action:{dragstart:s,click:s}}}function l(e){var r=n.createShape({type:`bpmn:SubProcess`,x:0,y:0,isExpanded:!0}),i=n.createShape({type:`bpmn:StartEvent`,x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function u(e){t.start(e,n.createParticipantShape())}return T(e,{"hand-tool":{group:`tools`,className:`bpmn-icon-hand-tool`,title:s(`Activate hand tool`),shortcut:ny.handTool.key,action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:`tools`,className:`bpmn-icon-lasso-tool`,title:s(`Activate lasso tool`),shortcut:ny.lassoTool.key,action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:`tools`,className:`bpmn-icon-space-tool`,title:s(`Activate create/remove space tool`),shortcut:ny.spaceTool.key,action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:`tools`,className:`bpmn-icon-connection-multi`,title:s(`Activate global connect tool`),shortcut:ny.globalConnectTool.key,action:{click:function(e){o.start(e)}}},"tool-separator":{group:`tools`,separator:!0},"create.start-event":c(`bpmn:StartEvent`,`event`,`bpmn-icon-start-event-none`,s(`Create start event`)),"create.intermediate-event":c(`bpmn:IntermediateThrowEvent`,`event`,`bpmn-icon-intermediate-event-none`,s(`Create intermediate/boundary event`)),"create.end-event":c(`bpmn:EndEvent`,`event`,`bpmn-icon-end-event-none`,s(`Create end event`)),"create.exclusive-gateway":c(`bpmn:ExclusiveGateway`,`gateway`,`bpmn-icon-gateway-none`,s(`Create gateway`)),"create.task":c(`bpmn:Task`,`activity`,`bpmn-icon-task`,s(`Create task`)),"create.data-object":c(`bpmn:DataObjectReference`,`data-object`,`bpmn-icon-data-object`,s(`Create data object reference`)),"create.data-store":c(`bpmn:DataStoreReference`,`data-store`,`bpmn-icon-data-store`,s(`Create data store reference`)),"create.subprocess-expanded":{group:`activity`,className:`bpmn-icon-subprocess-expanded`,title:s(`Create expanded sub-process`),action:{dragstart:l,click:l}},"create.participant-expanded":{group:`collaboration`,className:`bpmn-icon-participant`,title:s(`Create pool/participant`),action:{dragstart:u,click:u}},"create.group":c(`bpmn:Group`,`artifact`,`bpmn-icon-group`,s(`Create group`))}),e};var fx={__depends__:[Yb,$f,im,tx,ox,ux,Tt],__init__:[`paletteProvider`],paletteProvider:[`type`,dx]},px=250;function mx(e,t,n,r,i){B.call(this,e);function a(e){var a=e.canExecute.replacements;b(a,function(a){var o=a.oldElementId,s={type:a.newElementType};if(!e.visualReplacements[o]){var c=t.get(o);T(s,{x:c.x,y:c.y});var l=n.createShape(s);r.addShape(l,c.parent);var u=V(`[data-element-id="`+Lt(c.id)+`"]`,e.dragGroup);u&&P(u,{display:`none`});var d=i.addDragger(l,e.dragGroup);e.visualReplacements[o]=d,r.removeShape(l)}})}function o(e){var t=e.visualReplacements;b(t,function(n,r){var i=V(`[data-element-id="`+Lt(r)+`"]`,e.dragGroup);i&&P(i,{display:`inline`}),n.remove(),t[r]&&delete t[r]})}e.on(`shape.move.move`,px,function(e){var t=e.context,n=t.canExecute;t.visualReplacements||={},n&&n.replacements?a(t):o(t)})}mx.$inject=[`eventBus`,`elementRegistry`,`elementFactory`,`canvas`,`previewSupport`],z(mx,B);var hx={__depends__:[Ps],__init__:[`bpmnReplacePreview`],bpmnReplacePreview:[`type`,mx]},gx=1250,_x=40,vx=20,yx=10,bx=20,xx=[`x`,`y`],Sx=Math.abs;function Cx(e){e.on([`connect.hover`,`connect.move`,`connect.end`],gx,function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,a=t.source,o=t.target;e.originalEvent&&Xt(e.originalEvent)||(t.initialConnectionStart||=t.connectionStart,n&&i&&wx(e,i,jx(i)),i&&kx(n,[`bpmn:Association`,`bpmn:DataInputAssociation`,`bpmn:DataOutputAssociation`,`bpmn:SequenceFlow`])?(t.connectionStart=as(r),E(i,[`bpmn:Event`,`bpmn:Gateway`])&&Dx(e,as(i)),E(i,[`bpmn:Task`,`bpmn:SubProcess`])&&Tx(e,i),O(a,`bpmn:BoundaryEvent`)&&o===a.host&&Ex(e)):Ox(n,`bpmn:MessageFlow`)?(O(r,`bpmn:Event`)&&(t.connectionStart=as(r)),O(i,`bpmn:Event`)&&Dx(e,as(i))):t.connectionStart=t.initialConnectionStart)})}Cx.$inject=[`eventBus`];function wx(e,t,n){xx.forEach(function(r){var i=Ax(r,t);e[r]<t[r]+n?J(e,r,t[r]+n):e[r]>t[r]+i-n&&J(e,r,t[r]+i-n)})}function Tx(e,t){var n=as(t);xx.forEach(function(r){Mx(e,t,r)&&J(e,r,n[r])})}function Ex(e){var t=e.context,n=t.source,r=t.target;if(!Nx(t)){var i=as(n),a=xe(i,r,-10),o=[];/top|bottom/.test(a)&&o.push(`x`),/left|right/.test(a)&&o.push(`y`),o.forEach(function(t){var n=e[t],r;Sx(n-i[t])<_x&&(r=n>i[t]?i[t]+_x:i[t]-_x,J(e,t,r))})}}function Dx(e,t){J(e,`x`,t.x),J(e,`y`,t.y)}function Ox(e,t){return e&&e.type===t}function kx(e,t){return o(t,function(t){return Ox(e,t)})}function Ax(e,t){return e===`x`?t.width:t.height}function jx(e){return O(e,`bpmn:Task`)?yx:vx}function Mx(e,t,n){return e[n]>t[n]+bx&&e[n]<t[n]+Ax(n,t)-bx}function Nx(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Px(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Px.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Px.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Px.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||=this._defaultSnaps[e]=[],n.push(t)},Px.prototype.getSnapLocations=function(){return this._snapLocations},Px.prototype.setSnapLocations=function(e){this._snapLocations=e},Px.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Fx,n.initDefaults(this._defaultSnaps)),n};function Fx(){this._snapValues={}}Fx.prototype.add=function(e,t){var n=this._snapValues[e];n||=this._snapValues[e]={x:[],y:[]},n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Fx.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&ns(e[n],i[n],r)},Fx.prototype.initDefaults=function(e){var t=this;b(e||{},function(e,n){b(e,function(e){t.add(n,e)})})};var Ix=1250;function Lx(e,t,n){var r=this;this._elementRegistry=e,t.on([`create.start`,`shape.move.start`],function(e){r.initSnap(e)}),t.on([`create.move`,`create.end`,`shape.move.move`,`shape.move.end`],Ix,function(e){var t=e.context,i=t.shape,a=t.snapContext,o=t.target;if(!(e.originalEvent&&Xt(e.originalEvent))&&!os(e)&&o){var s=a.pointsForTarget(o);s.initialized||(s=r.addSnapTargetPoints(s,i,o),s.initialized=!0),n.snap(e,s)}}),t.on([`create.cleanup`,`shape.move.cleanup`],function(){n.hide()})}Lx.$inject=[`elementRegistry`,`eventBus`,`snapping`],Lx.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,r=n.shape,i=n.snapContext;i||=n.snapContext=new Px;var a=t.get(r.id)?as(r,e):{x:e.x+as(r).x,y:e.y+as(r).y},o={x:a.x-r.width/2,y:a.y-r.height/2},s={x:a.x+r.width/2,y:a.y+r.height/2};return i.setSnapOrigin(`mid`,{x:a.x-e.x,y:a.y-e.y}),j(r)||(i.setSnapOrigin(`top-left`,{x:o.x-e.x,y:o.y-e.y}),i.setSnapOrigin(`bottom-right`,{x:s.x-e.x,y:s.y-e.y})),i},Lx.prototype.addSnapTargetPoints=function(e,t,n){var r=this.getSnapTargets(t,n);return b(r,function(n){if(j(n))j(t)&&e.add(`mid`,as(n));else if(A(n)){if(n.waypoints.length<3)return;var r=n.waypoints.slice(1,-1);b(r,function(t){e.add(`mid`,t)})}else e.add(`mid`,as(n))}),!h(t.x)||!h(t.y)||this._elementRegistry.get(t.id)&&e.add(`mid`,as(t)),e},Lx.prototype.getSnapTargets=function(e,t){return ss(t).filter(function(e){return!Rx(e)})};function Rx(e){return!!e.hidden}var zx=1500;function Bx(e,t){t.invoke(Lx,this),e.on([`create.move`,`create.end`],zx,Wx),e.on([`create.move`,`create.end`,`shape.move.move`,`shape.move.end`],zx,function(e){var t=e.context,n=t.canExecute,r=t.target;n&&(n===`attach`||n.attach)&&!os(e)&&Vx(e,r)})}z(Bx,Lx),Bx.$inject=[`eventBus`,`injector`],Bx.prototype.initSnap=function(e){var t=Lx.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return b(n.outgoing,function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+`-docking`,Kx(i,r,e))}),b(n.incoming,function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+`-docking`,Kx(i,r,e))}),O(n,`bpmn:Participant`)&&t.setSnapLocations([`top-left`,`bottom-right`,`mid`]),t},Bx.prototype.addSnapTargetPoints=function(e,t,n){Lx.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);b(r,function(n){(Ux(n)||Hx([t,n],`bpmn:TextAnnotation`))&&(e.add(`top-left`,rs(n)),e.add(`bottom-right`,is(n)))});var i=this._elementRegistry;return b(t.incoming,function(n){if(i.get(t.id)){Gx(r,n.source)||e.add(`mid`,M(n.source));var a=n.waypoints[0];e.add(n.id+`-docking`,a.original||a)}}),b(t.outgoing,function(n){if(i.get(t.id)){Gx(r,n.target)||e.add(`mid`,M(n.target));var a=n.waypoints[n.waypoints.length-1];e.add(n.id+`-docking`,a.original||a)}}),O(n,`bpmn:SequenceFlow`)&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Bx.prototype.getSnapTargets=function(e,t){return Lx.prototype.getSnapTargets.call(this,e,t).filter(function(e){return!O(e,`bpmn:Lane`)})};function Vx(e,t){var n=N(t),r=Ld(e,t),i=e.context.shape,a=i.parent?{x:0,y:0}:M(i);/top/.test(r)?J(e,`y`,n.top-a.y):/bottom/.test(r)&&J(e,`y`,n.bottom-a.y),/left/.test(r)?J(e,`x`,n.left-a.x):/right/.test(r)&&J(e,`x`,n.right-a.x)}function Hx(e,t){return e.every(function(e){return O(e,t)})}function Ux(e){return O(e,`bpmn:SubProcess`)&&R(e)?!0:O(e,`bpmn:Participant`)}function Wx(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,a=t.left;(a&&a>=e.x||r&&r<=e.x)&&J(e,`x`,e.x),(n&&n>=e.y||i&&i<=e.y)&&J(e,`y`,e.y)}}function Gx(e,t){return e.indexOf(t)!==-1}function Kx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var qx=1250;function Jx(e,t){var n=this;e.on([`resize.start`],function(e){n.initSnap(e)}),e.on([`resize.move`,`resize.end`],qx,function(e){var r=e.context,i=r.shape,a=i.parent,o=r.direction,s=r.snapContext;if(!(e.originalEvent&&Xt(e.originalEvent))&&!os(e)){var c=s.pointsForTarget(a);c.initialized||(c=n.addSnapTargetPoints(c,i,a,o),c.initialized=!0),Qx(o)&&J(e,`x`,e.x),$x(o)&&J(e,`y`,e.y),t.snap(e,c)}}),e.on([`resize.cleanup`],function(){t.hide()})}Jx.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||=t.snapContext=new Px;var a=Yx(n,r);return i.setSnapOrigin(`corner`,{x:a.x-e.x,y:a.y-e.y}),i},Jx.prototype.addSnapTargetPoints=function(e,t,n,r){var i=this.getSnapTargets(t,n);return b(i,function(t){e.add(`corner`,is(t)),e.add(`corner`,rs(t))}),e.add(`corner`,Yx(t,r)),e},Jx.$inject=[`eventBus`,`snapping`],Jx.prototype.getSnapTargets=function(e,t){return ss(t).filter(function(t){return!Xx(t,e)&&!A(t)&&!Zx(t)&&!j(t)})};function Yx(e,t){var n=M(e),r=N(e),i={x:n.x,y:n.y};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(i.y=r.bottom):i.y=r.top,t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(i.x=r.left):i.x=r.right,i}function Xx(e,t){return e.host===t}function Zx(e){return!!e.hidden}function Qx(e){return e===`n`||e===`s`}function $x(e){return e===`e`||e===`w`}var eS=7,tS=1e3;function nS(e){this._canvas=e,this._asyncHide=ee(S(this.hide,this),tS)}nS.$inject=[`canvas`],nS.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:os(e,`x`),y:os(e,`y`)};b(r,function(r){var a=n.getSnapOrigin(r),o={x:e.x+a.x,y:e.y+a.y};if(b([`x`,`y`],function(e){var n;i[e]||(n=t.snap(o,r,e,eS),n!==void 0&&(i[e]={value:n,originValue:n-a[e]}))}),i.x&&i.y)return!1}),this.showSnapLine(`vertical`,i.x&&i.x.value),this.showSnapLine(`horizontal`,i.y&&i.y.value),b([`x`,`y`],function(t){var n=i[t];l(n)&&J(e,t,n.originValue)})},nS.prototype._createLine=function(e){var t=this._canvas.getLayer(`snap`),n=F(`path`);return P(n,{d:`M0,0 L0,0`}),I(n).add(`djs-snap-line`),L(t,n),{update:function(t){h(t)?e===`horizontal`?P(n,{d:`M-100000,`+t+` L+100000,`+t,display:``}):P(n,{d:`M `+t+`,-100000 L `+t+`, +100000`,display:``}):P(n,{display:`none`})}}},nS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine(`horizontal`),vertical:this._createLine(`vertical`)}},nS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},nS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},nS.prototype.hide=function(){b(this._snapLines,function(e){e.update()})};var rS={__depends__:[{__init__:[`createMoveSnapping`,`resizeSnapping`,`snapping`],createMoveSnapping:[`type`,Lx],resizeSnapping:[`type`,Jx],snapping:[`type`,nS]}],__init__:[`connectSnapping`,`createMoveSnapping`],connectSnapping:[`type`,Cx],createMoveSnapping:[`type`,Bx]},iS=300;function $(e,t,n,r){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=r,this._container=this._getBoxHtml(),this._searchInput=V($.INPUT_SELECTOR,this._container),this._resultsContainer=V($.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on([`canvas.destroy`,`diagram.destroy`,`drag.init`,`elements.changed`],this.close,this)}$.$inject=[`canvas`,`eventBus`,`selection`,`translate`],$.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:pt.bind(t,n,r,i)})}t(document,`html`,`click`,function(t){e.close(!1)}),t(this._container,$.INPUT_SELECTOR,`click`,function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,$.RESULT_SELECTOR,`mouseover`,function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,$.RESULT_SELECTOR,`click`,function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,$.INPUT_SELECTOR,`keydown`,function(e){Ut(`ArrowUp`,e)&&e.preventDefault(),Ut(`ArrowDown`,e)&&e.preventDefault()}),t(this._container,$.INPUT_SELECTOR,`keyup`,function(t){if(Ut(`Escape`,t))return e.close();if(Ut(`Enter`,t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}if(Ut(`ArrowUp`,t))return e._scrollToDirection(!0);if(Ut(`ArrowDown`,t))return e._scrollToDirection();Ut([`ArrowLeft`,`ArrowRight`],t)||e._search(t.delegateTarget.value)})},$.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){pt.unbind(e.el,e.type,e.listener)})},$.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)}),!n.length)this._selection.select(null);else{n.forEach(function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}});var r=V($.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},$.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},$.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},$.prototype._clearResults=function(){st(this._resultsContainer),this._results={},this._eventBus.fire(`searchPad.cleared`)},$.prototype._getCurrentResult=function(){return V($.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$.prototype._createResultNode=function(e,t){var n=gt($.RESULT_HTML);return e.primaryTokens.length>0&&aS(n,e.primaryTokens,$.RESULT_PRIMARY_HTML),aS(n,e.secondaryTokens,$.RESULT_SECONDARY_HTML),ft(n,$.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},$.prototype.registerProvider=function(e){this._searchProvider=e},$.prototype.open=function(){if(!this._searchProvider)throw 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,at(this._canvas.getContainer()).add(`djs-search-open`),at(this._container).add(`open`),this._searchInput.focus(),this._eventBus.fire(`searchPad.opened`))},$.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,at(this._canvas.getContainer()).remove(`djs-search-open`),at(this._container).remove(`open`),this._clearResults(),this._searchInput.value=``,this._searchInput.blur(),this._eventBus.fire(`searchPad.closed`),this._canvas.restoreFocus())},$.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$.prototype.isOpen=function(){return this._open},$.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&at(t).remove($.RESULT_SELECTED_CLASS);var n=ft(e,$.RESULT_ID_ATTRIBUTE),r=this._results[n].element;at(e).add($.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:iS}),this._selection.select(r),this._eventBus.fire(`searchPad.preselected`,r)}},$.prototype._select=function(e){var t=ft(e,$.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:iS}),this._selection.select(n),this._eventBus.fire(`searchPad.selected`,n)},$.prototype._getBoxHtml=function(){let e=gt($.BOX_HTML),t=V($.INPUT_SELECTOR,e);return t&&t.setAttribute(`aria-label`,this._translate(`Search in diagram`)),e};function aS(e,t,n){var r=oS(t),i=gt(n);i.innerHTML=r,e.appendChild(i)}function oS(e){var t=``;return e.forEach(function(e){var n=St(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?`<b class="`+$.RESULT_HIGHLIGHT_CLASS+`">`+n+`</b>`:n}),t===``?null:t}$.CONTAINER_SELECTOR=`.djs-search-container`,$.INPUT_SELECTOR=`.djs-search-input input`,$.RESULTS_CONTAINER_SELECTOR=`.djs-search-results`,$.RESULT_SELECTOR=`.djs-search-result`,$.RESULT_SELECTED_CLASS=`djs-search-result-selected`,$.RESULT_SELECTED_SELECTOR=`.`+$.RESULT_SELECTED_CLASS,$.RESULT_ID_ATTRIBUTE=`data-result-id`,$.RESULT_HIGHLIGHT_CLASS=`djs-search-highlight`,$.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
381
|
+
/>`},getPosition:e=>{let t=e.getBoundingClientRect();return{x:t.right+qb,y:t.top+t.height/2,placement:`right`}}})},Jb.prototype._updateEntries=function(){this._entries=this._palette.getEntries()};var Yb={__depends__:[Pb],__init__:[`palette`,`paletteTooltip`],palette:[`type`,Q],paletteTooltip:[`type`,Jb]},Xb=`crosshair`,Zb=`selected`,Qb=`djs-dragging-active-lasso`;function $b(e,t,n,r,a,o,s){this._selection=a,this._dragging=n,this._mouse=s;var c=this,l={create:function(e){var n=t.getActiveLayer(),r=e.frame=F(`rect`);P(r,{class:`djs-lasso-overlay`,width:1,height:1,x:0,y:0}),L(n,r),u(!0),this.update(e)},update:function(e){var n=e.frame,r=e.bbox;n&&r&&P(n,{x:r.x,y:r.y,width:r.width,height:r.height});var i=e.marked,a=e.lastMarked;if(i&&a){for(let e of a)i.has(e)||t.removeMarker(e,Zb);for(let e of i)a.has(e)||t.addMarker(e,Zb)}},remove:function(e){this.update(e),e.frame&&ke(e.frame),u(!1)}};function u(e){I(t.getContainer()).toggle(Qb,e)}function d(e){var t=r.getAll();return new Set(i(dt(t,e)))}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(){c.activateLasso(t.originalEvent,!0)})}),e.on(`lasso.end`,0,function(e){var t=e.context;c._select(Array.from(t.marked))}),e.on(`lasso.start`,function(e){var t=e.context;t.bbox=ex(e),t.add=Et(e),t.lastMarked=new Set(a.get()),t.marked=t.add?t.lastMarked:new Set,t.initialMarked=t.marked,l.create(t)}),e.on(`lasso.move`,function(e){var t=e.context,n=d(t.bbox=ex(e)),r=t.initialMarked.union(n);t.lastMarked=t.marked,t.marked=r,l.update(t)}),e.on(`lasso.cleanup`,function(e){var t=e.context;t.lastMarked=t.marked,t.marked=new Set(a.get()),l.remove(e.context)}),e.on(`element.mousedown`,1500,function(e){if(Et(e))return c.activateLasso(e.originalEvent),!0})}$b.$inject=[`eventBus`,`canvas`,`dragging`,`elementRegistry`,`selection`,`toolManager`,`mouse`],$b.prototype.activateLasso=function(e,t){this._dragging.init(e,`lasso`,{autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},$b.prototype.activateSelection=function(e,t){this._dragging.init(e,`lasso.selection`,{trapClick:!1,autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},$b.prototype._select=function(e){this._selection.select(e)},$b.prototype.select=function(e,t,n=[]){var r=i(dt(e,t));this._select([...n,...r])},$b.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},$b.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ex(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}}var tx={__depends__:[Np,np],__init__:[`lassoTool`],lassoTool:[`type`,$b]},nx=1500,rx=`grab`;function ix(e,t,n,r,i,a){this._dragging=n,this._mouse=a;var o=this,s=r.get(`keyboard`,!1);i.registerTool(`hand`,{tool:`hand`,dragging:`hand.move`}),e.on(`element.mousedown`,nx,function(e){if(Pt(e))return o.activateMove(e.originalEvent,!0),!1}),s&&s.addListener(nx,function(e){if(ax(e.keyEvent)&&!o.isActive()){var t=o._mouse.getLastMoveEvent();o.activateMove(t,!!t)}},`keyboard.keydown`),s&&s.addListener(nx,function(e){ax(e.keyEvent)&&o.isActive()&&o.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(){o.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!Pt(t)&&n&&e.once(`hand.move.ended`,function(e){o.activateHand(e.originalEvent,!0,!0)}),!1})}ix.$inject=[`eventBus`,`canvas`,`dragging`,`injector`,`toolManager`,`mouse`],ix.prototype.activateMove=function(e,t,n){typeof t==`object`&&(n=t,t=!1),this._dragging.init(e,`hand.move`,{autoActivate:t,cursor:rx,data:{context:n||{}}})},ix.prototype.activateHand=function(e,t,n){this._dragging.init(e,`hand`,{trapClick:!1,autoActivate:t,cursor:rx,data:{context:{reactivate:n}}})},ix.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},ix.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ax(e){return Zt(`Space`,e)}var ox={__depends__:[Np,np],__init__:[`handTool`],handTool:[`type`,ix]},sx=`connect-ok`,cx=`connect-not-ok`;function lx(e,t,n,r,i,a,o){var s=this;this._dragging=t,this._rules=a,this._mouse=o,i.registerTool(`global-connect`,{tool:`global-connect`,dragging:`global-connect.drag`}),e.on(`global-connect.hover`,function(e){var t=e.context,n=e.hover,i=t.canStartConnect=s.canStartConnect(n);i!==null&&(t.startTarget=n,r.addMarker(n,i?sx:cx))}),e.on([`global-connect.out`,`global-connect.cleanup`],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?sx:cx)}),e.on([`global-connect.ended`],function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(s.canStartConnect(r))return e.once(`element.out`,function(){e.once([`connect.ended`,`connect.canceled`],function(){e.fire(`global-connect.drag.ended`)}),n.start(null,r,i)}),!1})}lx.$inject=[`eventBus`,`dragging`,`connect`,`canvas`,`toolManager`,`rules`,`mouse`],lx.prototype.start=function(e,t){this._dragging.init(e,`global-connect`,{autoActivate:t,trapClick:!1,data:{context:{}}})},lx.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},lx.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},lx.prototype.canStartConnect=function(e){return this._rules.allowed(`connection.start`,{source:e})};var ux={__depends__:[bs,eo,Ya,Np,np],globalConnect:[`type`,lx]};function dx(e,t,n,r,i,a,o,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=a,this._globalConnect=o,this._translate=s,e.registerProvider(this)}dx.$inject=[`palette`,`create`,`elementFactory`,`spaceTool`,`lassoTool`,`handTool`,`globalConnect`,`translate`],dx.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,a=this._handTool,o=this._globalConnect,s=this._translate;function c(e,r,i,a,o){function s(r){var i=n.createShape(T({type:e},o));t.start(r,i)}return{group:r,className:i,title:a,action:{dragstart:s,click:s}}}function l(e){var r=n.createShape({type:`bpmn:SubProcess`,x:0,y:0,isExpanded:!0}),i=n.createShape({type:`bpmn:StartEvent`,x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function u(e){t.start(e,n.createParticipantShape())}return T(e,{"hand-tool":{group:`tools`,className:`bpmn-icon-hand-tool`,title:s(`Activate hand tool`),shortcut:ny.handTool.key,action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:`tools`,className:`bpmn-icon-lasso-tool`,title:s(`Activate lasso tool`),shortcut:ny.lassoTool.key,action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:`tools`,className:`bpmn-icon-space-tool`,title:s(`Activate create/remove space tool`),shortcut:ny.spaceTool.key,action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:`tools`,className:`bpmn-icon-connection-multi`,title:s(`Activate global connect tool`),shortcut:ny.globalConnectTool.key,action:{click:function(e){o.start(e)}}},"tool-separator":{group:`tools`,separator:!0},"create.start-event":c(`bpmn:StartEvent`,`event`,`bpmn-icon-start-event-none`,s(`Create start event`)),"create.intermediate-event":c(`bpmn:IntermediateThrowEvent`,`event`,`bpmn-icon-intermediate-event-none`,s(`Create intermediate/boundary event`)),"create.end-event":c(`bpmn:EndEvent`,`event`,`bpmn-icon-end-event-none`,s(`Create end event`)),"create.exclusive-gateway":c(`bpmn:ExclusiveGateway`,`gateway`,`bpmn-icon-gateway-none`,s(`Create gateway`)),"create.task":c(`bpmn:Task`,`activity`,`bpmn-icon-task`,s(`Create task`)),"create.data-object":c(`bpmn:DataObjectReference`,`data-object`,`bpmn-icon-data-object`,s(`Create data object reference`)),"create.data-store":c(`bpmn:DataStoreReference`,`data-store`,`bpmn-icon-data-store`,s(`Create data store reference`)),"create.subprocess-expanded":{group:`activity`,className:`bpmn-icon-subprocess-expanded`,title:s(`Create expanded sub-process`),action:{dragstart:l,click:l}},"create.participant-expanded":{group:`collaboration`,className:`bpmn-icon-participant`,title:s(`Create pool/participant`),action:{dragstart:u,click:u}},"create.group":c(`bpmn:Group`,`artifact`,`bpmn-icon-group`,s(`Create group`))}),e};var fx={__depends__:[Yb,$f,im,tx,ox,ux,Tt],__init__:[`paletteProvider`],paletteProvider:[`type`,dx]},px=250;function mx(e,t,n,r,i){B.call(this,e);function a(e){var a=e.canExecute.replacements;b(a,function(a){var o=a.oldElementId,s={type:a.newElementType};if(!e.visualReplacements[o]){var c=t.get(o);T(s,{x:c.x,y:c.y});var l=n.createShape(s);r.addShape(l,c.parent);var u=V(`[data-element-id="`+Lt(c.id)+`"]`,e.dragGroup);u&&P(u,{display:`none`});var d=i.addDragger(l,e.dragGroup);e.visualReplacements[o]=d,r.removeShape(l)}})}function o(e){var t=e.visualReplacements;b(t,function(n,r){var i=V(`[data-element-id="`+Lt(r)+`"]`,e.dragGroup);i&&P(i,{display:`inline`}),n.remove(),t[r]&&delete t[r]})}e.on(`shape.move.move`,px,function(e){var t=e.context,n=t.canExecute;t.visualReplacements||={},n&&n.replacements?a(t):o(t)})}mx.$inject=[`eventBus`,`elementRegistry`,`elementFactory`,`canvas`,`previewSupport`],z(mx,B);var hx={__depends__:[Ps],__init__:[`bpmnReplacePreview`],bpmnReplacePreview:[`type`,mx]},gx=1250,_x=40,vx=20,yx=10,bx=20,xx=[`x`,`y`],Sx=Math.abs;function Cx(e){e.on([`connect.hover`,`connect.move`,`connect.end`],gx,function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,a=t.source,o=t.target;e.originalEvent&&Jt(e.originalEvent)||(t.initialConnectionStart||=t.connectionStart,n&&i&&wx(e,i,jx(i)),i&&kx(n,[`bpmn:Association`,`bpmn:DataInputAssociation`,`bpmn:DataOutputAssociation`,`bpmn:SequenceFlow`])?(t.connectionStart=as(r),E(i,[`bpmn:Event`,`bpmn:Gateway`])&&Dx(e,as(i)),E(i,[`bpmn:Task`,`bpmn:SubProcess`])&&Tx(e,i),O(a,`bpmn:BoundaryEvent`)&&o===a.host&&Ex(e)):Ox(n,`bpmn:MessageFlow`)?(O(r,`bpmn:Event`)&&(t.connectionStart=as(r)),O(i,`bpmn:Event`)&&Dx(e,as(i))):t.connectionStart=t.initialConnectionStart)})}Cx.$inject=[`eventBus`];function wx(e,t,n){xx.forEach(function(r){var i=Ax(r,t);e[r]<t[r]+n?J(e,r,t[r]+n):e[r]>t[r]+i-n&&J(e,r,t[r]+i-n)})}function Tx(e,t){var n=as(t);xx.forEach(function(r){Mx(e,t,r)&&J(e,r,n[r])})}function Ex(e){var t=e.context,n=t.source,r=t.target;if(!Nx(t)){var i=as(n),a=xe(i,r,-10),o=[];/top|bottom/.test(a)&&o.push(`x`),/left|right/.test(a)&&o.push(`y`),o.forEach(function(t){var n=e[t],r;Sx(n-i[t])<_x&&(r=n>i[t]?i[t]+_x:i[t]-_x,J(e,t,r))})}}function Dx(e,t){J(e,`x`,t.x),J(e,`y`,t.y)}function Ox(e,t){return e&&e.type===t}function kx(e,t){return o(t,function(t){return Ox(e,t)})}function Ax(e,t){return e===`x`?t.width:t.height}function jx(e){return O(e,`bpmn:Task`)?yx:vx}function Mx(e,t,n){return e[n]>t[n]+bx&&e[n]<t[n]+Ax(n,t)-bx}function Nx(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Px(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Px.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Px.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Px.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||=this._defaultSnaps[e]=[],n.push(t)},Px.prototype.getSnapLocations=function(){return this._snapLocations},Px.prototype.setSnapLocations=function(e){this._snapLocations=e},Px.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Fx,n.initDefaults(this._defaultSnaps)),n};function Fx(){this._snapValues={}}Fx.prototype.add=function(e,t){var n=this._snapValues[e];n||=this._snapValues[e]={x:[],y:[]},n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Fx.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&ns(e[n],i[n],r)},Fx.prototype.initDefaults=function(e){var t=this;b(e||{},function(e,n){b(e,function(e){t.add(n,e)})})};var Ix=1250;function Lx(e,t,n){var r=this;this._elementRegistry=e,t.on([`create.start`,`shape.move.start`],function(e){r.initSnap(e)}),t.on([`create.move`,`create.end`,`shape.move.move`,`shape.move.end`],Ix,function(e){var t=e.context,i=t.shape,a=t.snapContext,o=t.target;if(!(e.originalEvent&&Jt(e.originalEvent))&&!os(e)&&o){var s=a.pointsForTarget(o);s.initialized||(s=r.addSnapTargetPoints(s,i,o),s.initialized=!0),n.snap(e,s)}}),t.on([`create.cleanup`,`shape.move.cleanup`],function(){n.hide()})}Lx.$inject=[`elementRegistry`,`eventBus`,`snapping`],Lx.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,r=n.shape,i=n.snapContext;i||=n.snapContext=new Px;var a=t.get(r.id)?as(r,e):{x:e.x+as(r).x,y:e.y+as(r).y},o={x:a.x-r.width/2,y:a.y-r.height/2},s={x:a.x+r.width/2,y:a.y+r.height/2};return i.setSnapOrigin(`mid`,{x:a.x-e.x,y:a.y-e.y}),j(r)||(i.setSnapOrigin(`top-left`,{x:o.x-e.x,y:o.y-e.y}),i.setSnapOrigin(`bottom-right`,{x:s.x-e.x,y:s.y-e.y})),i},Lx.prototype.addSnapTargetPoints=function(e,t,n){var r=this.getSnapTargets(t,n);return b(r,function(n){if(j(n))j(t)&&e.add(`mid`,as(n));else if(A(n)){if(n.waypoints.length<3)return;var r=n.waypoints.slice(1,-1);b(r,function(t){e.add(`mid`,t)})}else e.add(`mid`,as(n))}),!h(t.x)||!h(t.y)||this._elementRegistry.get(t.id)&&e.add(`mid`,as(t)),e},Lx.prototype.getSnapTargets=function(e,t){return ss(t).filter(function(e){return!Rx(e)})};function Rx(e){return!!e.hidden}var zx=1500;function Bx(e,t){t.invoke(Lx,this),e.on([`create.move`,`create.end`],zx,Wx),e.on([`create.move`,`create.end`,`shape.move.move`,`shape.move.end`],zx,function(e){var t=e.context,n=t.canExecute,r=t.target;n&&(n===`attach`||n.attach)&&!os(e)&&Vx(e,r)})}z(Bx,Lx),Bx.$inject=[`eventBus`,`injector`],Bx.prototype.initSnap=function(e){var t=Lx.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return b(n.outgoing,function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+`-docking`,Kx(i,r,e))}),b(n.incoming,function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+`-docking`,Kx(i,r,e))}),O(n,`bpmn:Participant`)&&t.setSnapLocations([`top-left`,`bottom-right`,`mid`]),t},Bx.prototype.addSnapTargetPoints=function(e,t,n){Lx.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);b(r,function(n){(Ux(n)||Hx([t,n],`bpmn:TextAnnotation`))&&(e.add(`top-left`,rs(n)),e.add(`bottom-right`,is(n)))});var i=this._elementRegistry;return b(t.incoming,function(n){if(i.get(t.id)){Gx(r,n.source)||e.add(`mid`,M(n.source));var a=n.waypoints[0];e.add(n.id+`-docking`,a.original||a)}}),b(t.outgoing,function(n){if(i.get(t.id)){Gx(r,n.target)||e.add(`mid`,M(n.target));var a=n.waypoints[n.waypoints.length-1];e.add(n.id+`-docking`,a.original||a)}}),O(n,`bpmn:SequenceFlow`)&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Bx.prototype.getSnapTargets=function(e,t){return Lx.prototype.getSnapTargets.call(this,e,t).filter(function(e){return!O(e,`bpmn:Lane`)})};function Vx(e,t){var n=N(t),r=Ld(e,t),i=e.context.shape,a=i.parent?{x:0,y:0}:M(i);/top/.test(r)?J(e,`y`,n.top-a.y):/bottom/.test(r)&&J(e,`y`,n.bottom-a.y),/left/.test(r)?J(e,`x`,n.left-a.x):/right/.test(r)&&J(e,`x`,n.right-a.x)}function Hx(e,t){return e.every(function(e){return O(e,t)})}function Ux(e){return O(e,`bpmn:SubProcess`)&&R(e)?!0:O(e,`bpmn:Participant`)}function Wx(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,a=t.left;(a&&a>=e.x||r&&r<=e.x)&&J(e,`x`,e.x),(n&&n>=e.y||i&&i<=e.y)&&J(e,`y`,e.y)}}function Gx(e,t){return e.indexOf(t)!==-1}function Kx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var qx=1250;function Jx(e,t){var n=this;e.on([`resize.start`],function(e){n.initSnap(e)}),e.on([`resize.move`,`resize.end`],qx,function(e){var r=e.context,i=r.shape,a=i.parent,o=r.direction,s=r.snapContext;if(!(e.originalEvent&&Jt(e.originalEvent))&&!os(e)){var c=s.pointsForTarget(a);c.initialized||(c=n.addSnapTargetPoints(c,i,a,o),c.initialized=!0),Qx(o)&&J(e,`x`,e.x),$x(o)&&J(e,`y`,e.y),t.snap(e,c)}}),e.on([`resize.cleanup`],function(){t.hide()})}Jx.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||=t.snapContext=new Px;var a=Yx(n,r);return i.setSnapOrigin(`corner`,{x:a.x-e.x,y:a.y-e.y}),i},Jx.prototype.addSnapTargetPoints=function(e,t,n,r){var i=this.getSnapTargets(t,n);return b(i,function(t){e.add(`corner`,is(t)),e.add(`corner`,rs(t))}),e.add(`corner`,Yx(t,r)),e},Jx.$inject=[`eventBus`,`snapping`],Jx.prototype.getSnapTargets=function(e,t){return ss(t).filter(function(t){return!Xx(t,e)&&!A(t)&&!Zx(t)&&!j(t)})};function Yx(e,t){var n=M(e),r=N(e),i={x:n.x,y:n.y};return t.indexOf(`n`)===-1?t.indexOf(`s`)!==-1&&(i.y=r.bottom):i.y=r.top,t.indexOf(`e`)===-1?t.indexOf(`w`)!==-1&&(i.x=r.left):i.x=r.right,i}function Xx(e,t){return e.host===t}function Zx(e){return!!e.hidden}function Qx(e){return e===`n`||e===`s`}function $x(e){return e===`e`||e===`w`}var eS=7,tS=1e3;function nS(e){this._canvas=e,this._asyncHide=ee(S(this.hide,this),tS)}nS.$inject=[`canvas`],nS.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:os(e,`x`),y:os(e,`y`)};b(r,function(r){var a=n.getSnapOrigin(r),o={x:e.x+a.x,y:e.y+a.y};if(b([`x`,`y`],function(e){var n;i[e]||(n=t.snap(o,r,e,eS),n!==void 0&&(i[e]={value:n,originValue:n-a[e]}))}),i.x&&i.y)return!1}),this.showSnapLine(`vertical`,i.x&&i.x.value),this.showSnapLine(`horizontal`,i.y&&i.y.value),b([`x`,`y`],function(t){var n=i[t];l(n)&&J(e,t,n.originValue)})},nS.prototype._createLine=function(e){var t=this._canvas.getLayer(`snap`),n=F(`path`);return P(n,{d:`M0,0 L0,0`}),I(n).add(`djs-snap-line`),L(t,n),{update:function(t){h(t)?e===`horizontal`?P(n,{d:`M-100000,`+t+` L+100000,`+t,display:``}):P(n,{d:`M `+t+`,-100000 L `+t+`, +100000`,display:``}):P(n,{display:`none`})}}},nS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine(`horizontal`),vertical:this._createLine(`vertical`)}},nS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},nS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},nS.prototype.hide=function(){b(this._snapLines,function(e){e.update()})};var rS={__depends__:[{__init__:[`createMoveSnapping`,`resizeSnapping`,`snapping`],createMoveSnapping:[`type`,Lx],resizeSnapping:[`type`,Jx],snapping:[`type`,nS]}],__init__:[`connectSnapping`,`createMoveSnapping`],connectSnapping:[`type`,Cx],createMoveSnapping:[`type`,Bx]},iS=300;function $(e,t,n,r){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=r,this._container=this._getBoxHtml(),this._searchInput=V($.INPUT_SELECTOR,this._container),this._resultsContainer=V($.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on([`canvas.destroy`,`diagram.destroy`,`drag.init`,`elements.changed`],this.close,this)}$.$inject=[`canvas`,`eventBus`,`selection`,`translate`],$.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:pt.bind(t,n,r,i)})}t(document,`html`,`click`,function(t){e.close(!1)}),t(this._container,$.INPUT_SELECTOR,`click`,function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,$.RESULT_SELECTOR,`mouseover`,function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,$.RESULT_SELECTOR,`click`,function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,$.INPUT_SELECTOR,`keydown`,function(e){Zt(`ArrowUp`,e)&&e.preventDefault(),Zt(`ArrowDown`,e)&&e.preventDefault()}),t(this._container,$.INPUT_SELECTOR,`keyup`,function(t){if(Zt(`Escape`,t))return e.close();if(Zt(`Enter`,t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}if(Zt(`ArrowUp`,t))return e._scrollToDirection(!0);if(Zt(`ArrowDown`,t))return e._scrollToDirection();Zt([`ArrowLeft`,`ArrowRight`],t)||e._search(t.delegateTarget.value)})},$.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){pt.unbind(e.el,e.type,e.listener)})},$.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)}),!n.length)this._selection.select(null);else{n.forEach(function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}});var r=V($.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},$.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},$.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},$.prototype._clearResults=function(){st(this._resultsContainer),this._results={},this._eventBus.fire(`searchPad.cleared`)},$.prototype._getCurrentResult=function(){return V($.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$.prototype._createResultNode=function(e,t){var n=gt($.RESULT_HTML);return e.primaryTokens.length>0&&aS(n,e.primaryTokens,$.RESULT_PRIMARY_HTML),aS(n,e.secondaryTokens,$.RESULT_SECONDARY_HTML),ft(n,$.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},$.prototype.registerProvider=function(e){this._searchProvider=e},$.prototype.open=function(){if(!this._searchProvider)throw 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,at(this._canvas.getContainer()).add(`djs-search-open`),at(this._container).add(`open`),this._searchInput.focus(),this._eventBus.fire(`searchPad.opened`))},$.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,at(this._canvas.getContainer()).remove(`djs-search-open`),at(this._container).remove(`open`),this._clearResults(),this._searchInput.value=``,this._searchInput.blur(),this._eventBus.fire(`searchPad.closed`),this._canvas.restoreFocus())},$.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$.prototype.isOpen=function(){return this._open},$.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&at(t).remove($.RESULT_SELECTED_CLASS);var n=ft(e,$.RESULT_ID_ATTRIBUTE),r=this._results[n].element;at(e).add($.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:iS}),this._selection.select(r),this._eventBus.fire(`searchPad.preselected`,r)}},$.prototype._select=function(e){var t=ft(e,$.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:iS}),this._selection.select(n),this._eventBus.fire(`searchPad.selected`,n)},$.prototype._getBoxHtml=function(){let e=gt($.BOX_HTML),t=V($.INPUT_SELECTOR,e);return t&&t.setAttribute(`aria-label`,this._translate(`Search in diagram`)),e};function aS(e,t,n){var r=oS(t),i=gt(n);i.innerHTML=r,e.appendChild(i)}function oS(e){var t=``;return e.forEach(function(e){var n=St(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?`<b class="`+$.RESULT_HIGHLIGHT_CLASS+`">`+n+`</b>`:n}),t===``?null:t}$.CONTAINER_SELECTOR=`.djs-search-container`,$.INPUT_SELECTOR=`.djs-search-input input`,$.RESULTS_CONTAINER_SELECTOR=`.djs-search-results`,$.RESULT_SELECTOR=`.djs-search-result`,$.RESULT_SELECTED_CLASS=`djs-search-result-selected`,$.RESULT_SELECTED_SELECTOR=`.`+$.RESULT_SELECTED_CLASS,$.RESULT_ID_ATTRIBUTE=`data-result-id`,$.RESULT_HIGHLIGHT_CLASS=`djs-search-highlight`,$.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
382
382
|
<div class="djs-search-input">
|
|
383
383
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
384
384
|
<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"/>
|