')).appendChild(o),e.type&&il(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Qe.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((Je(i)&&i>t.scale||Je(r)&&r
i&&(r=(1/t.scale||1)*i)),Je(r)&&(s="scale("+r+","+r+")"),Ze(a,s)},Qe.prototype._updateOverlaysVisibilty=function(e){var t=this;sn(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Qe.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){!function(e){t._updateRoot(e),t._updateOverlaysVisibilty(e),t.show()}(e.viewbox)}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});sn(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){rl(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(sn(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&il(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var ll={__init__:["overlays"],overlays:["type",sl]},pl={};pl.getOriginal=nt,pl.stopEvent=function(e,t){rt(e,t),it(e)},pl.toPoint=function(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null};var cl={};cl.isMac=function(){return/mac/i.test(navigator.platform)};var ul={},fl=pl.getOriginal,hl=cl.isMac;ul.isPrimaryButton=ot,ul.hasPrimaryModifier=function(e){var t=fl(e)||e;return!!ot(e)&&(hl()?t.metaKey:t.ctrlKey)},ul.hasSecondaryModifier=function(e){var t=fl(e)||e;return ot(e)&&t.shiftKey};var ml=ul.isPrimaryButton,dl=xn.createLine,yl=xn.updateLine,gl=500;at.$inject=["eventBus","elementRegistry","styles"];var vl={__init__:["interactionEvents"],interactionEvents:["type",at]},bl=_a.getBBox,xl=500;st.prototype.updateShapeOutline=function(e,t){hn(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},st.prototype.updateConnectionOutline=function(e,t){var n=bl(t);hn(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},st.$inject=["eventBus","styles","elementRegistry"];var wl={__init__:["outline"],outline:["type",st]};lt.$inject=["eventBus"];var El=lt;lt.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},lt.prototype.get=function(){return this._selectedElements},lt.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},lt.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();Xt(e)||(e=e?[e]:[]),t?sn(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var _l=ul.hasPrimaryModifier;pt.$inject=["eventBus","selection","canvas","elementRegistry"];var Al=pt,Sl="hover",Rl="selected";ct.$inject=["eventBus","canvas","selection","styles"];var Cl={__init__:["selectionVisuals","selectionBehavior"],__depends__:[vl,wl],selection:["type",El],selectionVisuals:["type",ct],selectionBehavior:["type",Al]},Ml=function(e,t,n){for(var i=e.length,r=t+(n?0:-1);n?r--:++r=Nl?Dl(t):null,l=t.length;s&&(o=Pl,a=!1,t=s);e:for(;++r]{1})/g,Wl=/([\n\r"]{1})/g,zl={"&":"&","<":"<",">":">",'"':"'"},Gl=ht,$l={width:"100%",height:"100%",position:"relative"};Xi(dt,Js);var Kl=dt;dt.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var o=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:o}),t(e,o);n.importDefinitions(i,function(e,i){var r=[].concat(o,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},dt.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},dt.prototype.saveSVG=function(e,t){t||(t=e,e={});var n=this.get("canvas"),i=n.getDefaultLayer(),r=ir("defs",n._svg),o=Gl(i),a=r?""+Gl(r)+"":"",s=i.getBBox();t(null,'\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n\n")},dt.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e,Zr.importBpmnDiagram(this,e,t)}catch(e){t(e)}},dt.prototype.getModules=function(){return this._modules},dt.prototype.destroy=function(){Js.prototype.destroy.call(this),rl(this._container)},dt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},dt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},dt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=ir(e)),e.appendChild(this._container),this._emit("attach",{})},dt.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},dt.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=Ai(Il(n,"additionalModules"),{canvas:Ai({},n.canvas,{container:e}),modules:o});Js.call(this,a),n&&n.container&&this.attachTo(n.container)},dt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},dt.prototype._createContainer=function(e){var t=ho('');return Ai(t.style,{width:mt(e.width),height:mt(e.height),position:e.position}),t},dt.prototype._createModdle=function(e){var t=Ai({},this._moddleExtensions,e.moddleExtensions);return new ya(t)},dt.prototype._modules=[Fr,jr,Cl,ll],dt.prototype._moddleExtensions={};var Hl={},Ul=pl.stopEvent;Hl.install=function(){return gt(!0),function(){gt(!1)}};var Yl={},ql=/^djs-cursor-.*$/;Yl.set=function(e){var t=il(document.body);t.removeMatching(ql),e&&t.add("djs-cursor-"+e)},Yl.unset=function(){this.set(null)};var Xl={};Xl.log10=function(e){return Math.log(e)/Math.log(10)},Xl.substract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Zl=to,Jl=Xl.substract,Ql=15;vt.$inject=["eventBus","canvas"];var ep={__init__:["moveCanvas"],moveCanvas:["type",vt]},tp={},np=Xl.log10;tp.getStepSize=function(e,t){var n=np(e.min),i=np(e.max);return(Math.abs(n)+Math.abs(i))/t},tp.cap=function(e,t){return Math.max(e.min,Math.min(e.max,t))};var ip=ul.hasPrimaryModifier,rp=ul.hasSecondaryModifier,op=cl.isMac,ap=tp.getStepSize,sp=tp.cap,lp=Xl.log10,pp={min:.2,max:4};bt.$inject=["eventBus","canvas","config.zoomScroll"];var cp=bt;bt.prototype.scroll=function(e){this._canvas.scroll(e)},bt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},bt.prototype.zoom=function(e,t){var n=ap(pp,20);this.totalDelta+=e,Math.abs(this.totalDelta)>.1&&(this._zoom(e,t,n),this.totalDelta=0)},bt.prototype._handleWheel=function(e){if(!Zl(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=ip(e),r=rp(e);if(i||r){n=op?0===e.deltaMode?1.25:50:0===e.deltaMode?.025:.5;var o={};r?o.dx=n*(e.deltaX||e.deltaY):o.dy=n*e.deltaY,this.scroll(o)}else{n=0===e.deltaMode?.025:.5;var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};this.zoom(e.deltaY*n/-5,s)}}},bt.prototype.stepZoom=function(e,t){var n=ap(pp,10);this._zoom(e,t,n)},bt.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=lp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(sp(pp,s),t)},bt.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Ll[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},bt.prototype._init=function(e){this.toggle(e)};var up={__init__:["zoomScroll"],zoomScroll:["type",cp]};Xi(xt,Kl);var fp=xt;return xt.prototype._navigationModules=[up,ep],xt.prototype._modules=[].concat(xt.prototype._modules,xt.prototype._navigationModules),fp});