phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Xx.prototype._popAction=function(){var e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:O("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Xx.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=h(e)?e:[e],t.dirty=t.dirty.concat(e))},Xx.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Xx.prototype._revertedAction=function(e){this._stackIdx--},Xx.prototype._getHandler=function(e){return this._handlerMap[e]},Xx.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Zx={commandStack:["type",Xx]},Jx=new dc("tt");function Qx(e){var t=Te('');return ne(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function ew(e,t,n){ne(e,{left:t+"px",top:n+"px"})}function tw(e,t){e.style.display=!1===t?"none":""}var nw="djs-tooltip",iw="."+nw;function rw(e,t){this._eventBus=e,this._canvas=t,this._ids=Jx,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Qx(t.getContainer());var n=this;Ae.bind(this._tooltipRoot,iw,"mousedown",(function(e){e.stopPropagation()})),Ae.bind(this._tooltipRoot,iw,"mouseover",(function(e){n.trigger("mouseover",e)})),Ae.bind(this._tooltipRoot,iw,"mouseout",(function(e){n.trigger("mouseout",e)})),this._init()}rw.$inject=["eventBus","canvas"],rw.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},rw.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ie(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},rw.prototype.get=function(e){return"string"!==typeof e&&(e=e.id),this._tooltips[e]},rw.prototype.clearTimeout=function(e){if(e=this.get(e),e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},rw.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)}},rw.prototype.remove=function(e){var t=this.get(e);t&&(Be(t.html),Be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},rw.prototype.show=function(){tw(this._tooltipRoot)},rw.prototype.hide=function(){tw(this._tooltipRoot,!1)},rw.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},rw.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),y(i)&&(i=Te(i)),t=Te(''),ne(t,{position:"absolute"}),t.appendChild(i),e.type&&ce(t).add("djs-tooltip-"+e.type),e.className&&ce(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},rw.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;ew(n,t.x,t.y)},rw.prototype._updateTooltipVisibilty=function(e){C(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}function Tw(e,t){var n=[];return C(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;C(r.concat(o),(function(i){var r=i.source,o=i.target;(kw(e,r)||kw(e,o)||kw(t,r)||kw(t,o))&&(kw(n,i)||n.push(i))}))})),n}function kw(e,t){return-1!==e.indexOf(t)}function Rw(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Pw=Math.abs,Dw=Math.round,Mw={x:"width",y:"height"},Bw="crosshair",Ow={n:"top",w:"left",s:"bottom",e:"right"},jw=1500,Nw={n:"s",w:"e",s:"n",e:"w"},Fw=20;function Iw(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.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",jw,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=s.init(e,t)),n&&zw(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,a=t.resizingShapes,c=t.start;if(t.initialized){zw(e);var u={x:0,y:0};u[i]=Dw(e["d"+i]),s.makeSpace(o,a,u,r,c),n.once("spaceTool.ended",(function(e){s.activateSelection(e.originalEvent,!0,!0)}))}}))}function Lw(e){return{top:e.top-Fw,right:e.right+Fw,bottom:e.bottom+Fw,left:e.left-Fw}}function zw(e){var t,n,i=e.context,r=i.spaceToolConstraints;r&&(v(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),v(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),v(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),v(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function $w(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s,c,u={};return C(a,(function(e){var l,p,d,f=vn(e),h=E(e.children,(function(e){return!Gw(e)&&!Vw(e)&&!Hw(o,e)&&!Hw(a,e)})),m=E(e.children,(function(e){return!Gw(e)&&!Vw(e)&&Hw(o,e)}));h.length&&(p=Lw(vn(Wt(h))),l=i-f[Ow[n]]+p[Ow[n]],"n"===n?u.bottom=c=v(c)?Math.min(c,l):l:"w"===n?u.right=c=v(c)?Math.min(c,l):l:"s"===n?u.top=s=v(s)?Math.max(s,l):l:"e"===n&&(u.left=s=v(s)?Math.max(s,l):l)),m.length&&(d=Lw(vn(Wt(m))),l=i-d[Ow[Nw[n]]]+f[Ow[Nw[n]]],"n"===n?u.bottom=c=v(c)?Math.min(c,l):l:"w"===n?u.right=c=v(c)?Math.min(c,l):l:"s"===n?u.top=s=v(s)?Math.max(s,l):l:"e"===n&&(u.left=s=v(s)?Math.max(s,l):l));var g=r&&r[e.id];g&&("n"===n?(l=i+e[Mw[t]]-g[Mw[t]],u.bottom=c=v(c)?Math.min(c,l):l):"w"===n?(l=i+e[Mw[t]]-g[Mw[t]],u.right=c=v(c)?Math.min(c,l):l):"s"===n?(l=i-e[Mw[t]]+g[Mw[t]],u.top=s=v(s)?Math.max(s,l):l):"e"===n&&(l=i-e[Mw[t]]+g[Mw[t]],u.left=s=v(s)?Math.max(s,l):l))})),u}}function Hw(e,t){return-1!==e.indexOf(t)}function Gw(e){return!!e.waypoints}function Vw(e){return!!e.labelTarget}Iw.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Iw.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Bw,data:{context:{reactivate:n}},trapClick:!1})},Iw.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Bw,data:{context:{}}})},Iw.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Iw.prototype.init=function(e,t){var n=Pw(e.dx)>Pw(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Pw(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var o=Aw(n,i),a=this._canvas.getRootElement(),s=Gt(a,!0),c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=$w(c,n,o,r,u);return W(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Du("resize-"+("x"===n?"ew":"ns")),!0},Iw.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[];return C(e,(function(e){if(e.parent&&!Gw(e)){var s=e[t],c=s+e[Mw[t]];return n>0&&s>i||n<0&&ci&&r.allowed("shape.resize",{shape:e})?a.push(e):void 0}})),{movingShapes:o,resizingShapes:a}},Iw.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Iw.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var Ww="djs-dragging",Uw="djs-resizing",qw=250,Kw=Math.max;function Yw(e,t,n,i,r){function o(e,t){C(e,(function(e){r.addDragger(e,t),n.addMarker(e,Ww)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},a=nt("g");He(a,i.cls("djs-crosshair-group",["no-events"])),Ne(t,a);var s=nt("path");He(s,"d",o.x),qe(s).add("djs-crosshair"),Ne(a,s);var c=nt("path");He(c,"d",o.y),qe(c).add("djs-crosshair"),Ne(a,c),r.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){var t=e.context.crosshairGroup;li(t,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context,n=t.crosshairGroup;n&&Ye(n)})),e.on("spaceTool.move",qw,(function(e){var a=e.context,s=a.line,c=a.axis,u=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var p=n.getLayer("space");s=nt("path"),He(s,"d","M0,0 L0,0"),qe(s).add("djs-crosshair"),Ne(p,s),a.line=s;var d=nt("g");He(d,i.cls("djs-drag-group",["no-events"])),Ne(n.getActiveLayer(),d),o(u,d);var f=a.movingConnections=t.filter((function(e){var t=!1;C(u,(function(n){C(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;C(u,(function(t){C(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;C(l,(function(t){C(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return C(l,(function(t){C(t.incoming,(function(t){e===t&&(r=!0)}))})),Xw(e)&&(t||i)&&(n||r)}));o(f,d),a.dragGroup=d}if(!a.frameGroup){var h=nt("g");He(h,i.cls("djs-frame-group",["no-events"])),Ne(n.getActiveLayer(),h);var m=[];C(l,(function(e){var t=r.addFrame(e,h),i=t.getBBox();m.push({element:t,initialBounds:i}),n.addMarker(e,Uw)})),a.frameGroup=h,a.frames=m}var v={x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y};He(s,{d:v[c]});var g={x:"y",y:"x"},y={x:e.dx,y:e.dy};y[g[a.axis]]=0,li(a.dragGroup,y.x,y.y),C(a.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===a.direction?He(i,{width:Kw(r.width+y.x,5)}):(t=Kw(r.width-y.x,5),He(i,{width:t,x:r.x+r.width-t})),"s"===a.direction?He(i,{height:Kw(r.height+y.y,5)}):(n=Kw(r.height-y.y,5),He(i,{height:n,y:r.y+r.height-n}))}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;C(i,(function(e){n.removeMarker(e,Ww)})),C(r,(function(e){n.removeMarker(e,Ww)})),s&&(Ye(a),Ye(s)),C(o,(function(e){n.removeMarker(e,Uw)})),c&&Ye(c)}))}function Xw(e){return e.waypoints}Yw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Zw={__init__:["spaceToolPreview"],__depends__:[Tp,Mp,Sw,Ef,Hf],spaceTool:["type",Iw],spaceToolPreview:["type",Yw]};function Jw(e){this._model=e}function Qw(e,t,n,i){Cc.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||(t=i.connection,t.waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}function a(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}function s(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}function c(e){var t=e.context,n=t.oldRoot,i=n.children;C(i,(function(e){Ko(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function u(e){var t=e.context.shape;Ko(t,"bpmn:BaseElement")&&r.updateBounds(t)}function l(e){r.updateConnection(e.context)}function p(e){r.updateConnectionWaypoints(e.context.connection)}function d(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],t_(a)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],t_(s)),this.executed(["canvas.updateRoot"],c),this.reverted(["canvas.updateRoot"],c),this.executed(["shape.move","shape.create","shape.resize"],t_((function(e){"label"!==e.context.shape.type&&u(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],t_((function(e){"label"!==e.context.shape.type&&u(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&u({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],t_(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],t_(l)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],t_(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],t_(p)),this.executed("connection.reconnect",t_((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Xo(n),a=Xo(i),s=Xo(r);o.conditionExpression&&!Yo(s,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&a.default===o&&(t.oldDefault=a.default,delete a.default)}))),this.reverted("connection.reconnect",t_((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Xo(n),a=Xo(i),s=Xo(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(a.default=t.oldDefault,delete s.default)}))),this.executed(["element.updateAttachment"],t_(d)),this.reverted(["element.updateAttachment"],t_(d))}function e_(e){while(e&&!Ko(e,"bpmn:Definitions"))e=e.$parent;return e}function t_(e){return function(t){var n=t.context,i=n.shape||n.connection;Ko(i,"bpmn:BaseElement")&&e(t)}}function n_(e){if(Ko(e,"bpmn:Activity")){var t=Zo(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function i_(e,t,n){ei.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function r_(e,t,n){return C(n,(function(n){t=o_(e,t,n)})),t}function o_(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function a_(e){return Yo(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function s_(e,t){this._modeling=e,this._canvas=t}function c_(e){this._modeling=e}function u_(e,t){return k(e.outgoing,(function(e){return e.target===t}))}function l_(e,t){this._canvas=e,this._layouter=t}Jw.$inject=["moddle"],Jw.prototype._needsId=function(e){return Yo(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"])},Jw.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Ko(e,"bpmn:Activity")?"Activity":Ko(e,"bpmn:Event")?"Event":Ko(e,"bpmn:Gateway")?"Gateway":Yo(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},Jw.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Jw.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Jw.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},Jw.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Jw.prototype.createDiWaypoints=function(e){var t=this;return R(e,(function(e){return t.createDiWaypoint(e)}))},Jw.prototype.createDiWaypoint=function(e){return this.create("dc:Point",U(e,["x","y"]))},Jw.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Jw.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))},i(Qw,Cc),Qw.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Qw.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Qw.prototype.updateParent=function(e,t){if(!(e instanceof Xn)&&!(Ko(e,"bpmn:DataStoreReference")&&e.parent&&Ko(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Zo(e),o=n&&n.businessObject,a=Zo(n);Ko(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),Ko(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Ko(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),Ko(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Qw.prototype.updateBounds=function(e){var t=Zo(e),n=n_(e);if(n){var i=Nu(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=e instanceof Xn?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Qw.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(Ko(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),en(i,e)),Ko(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),tn(r,e)))},Qw.prototype.updateDiConnection=function(e,t,n){var i=Zo(e),r=Zo(t),o=Zo(n);i.sourceElement&&i.sourceElement.bpmnElement!==Xo(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Xo(n)&&(i.targetElement=n&&o)},Qw.prototype.updateDiParent=function(e,t){if(t&&!Ko(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(en(n,e),e.$parent=null)}},Qw.prototype.getLaneSet=function(e){var t,n;return Ko(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Ko(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Qw.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&(!Ko(e,"bpmn:DataInput")&&!Ko(e,"bpmn:DataOutput")||(Ko(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Ko(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Ko(e,"bpmn:FlowElement")){if(t)if(Ko(t,"bpmn:Participant"))t=t.processRef;else if(Ko(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Ko(t,"bpmn:Lane"));i="flowElements"}else if(Ko(e,"bpmn:Artifact")){while(t&&!Ko(t,"bpmn:Process")&&!Ko(t,"bpmn:SubProcess")&&!Ko(t,"bpmn:Collaboration")){if(Ko(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Ko(e,"bpmn:MessageFlow"))i="messageFlows";else if(Ko(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=e_(e.$parent||t),e.$parent&&(en(o.get("rootElements"),a),a.$parent=null),t&&(tn(o.get("rootElements"),a),a.$parent=o))}else Ko(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Ko(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&(s=e.$parent.get(i),en(s,e)),t?(s=t.get(i),s.push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);en(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Qw.prototype.updateConnectionWaypoints=function(e){var t=Zo(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Qw.prototype.updateConnection=function(e){var t,n=e.connection,i=Xo(n),r=n.source,o=Xo(r),a=n.target,s=Xo(n.target);if(Ko(i,"bpmn:DataAssociation"))Ko(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||s,this.updateSemanticParent(i,s,t)):Ko(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=s);else{var c=Ko(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(c&&(en(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==s&&(c&&(en(i.targetRef&&i.targetRef.get("incoming"),i),s&&s.get("incoming")&&s.get("incoming").push(i)),i.targetRef=s)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,a)},Qw.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},i(i_,ei),i_.$inject=["bpmnFactory","moddle","translate"],i_.prototype.baseCreate=ei.prototype.create,i_.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this.baseCreate(e,W({type:"label",di:n},_s,t))}return this.createBpmnElement(e,t)},i_.prototype.createBpmnElement=function(e,t){var n,i=this._translate;t=W({},t||{});var r,o,a=t.businessObject,s=t.di;if(!a){if(!t.type)throw new Error(i("no shape type specified"));a=this._bpmnFactory.create(t.type),Vo(a)}if(!a_(s)){var c=W({},s||{},{id:a.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(a,c):"connection"===e?this._bpmnFactory.createDiEdge(a,c):this._bpmnFactory.createDiShape(a,c)}return Ko(a,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=r_(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=o_(s,t,"isExpanded")),Ko(a,"bpmn:SubProcess")&&(t.collapsed=!wa(a,s)),Ko(a,"bpmn:ExclusiveGateway")&&(s.isMarkerVisible=!0),t.eventDefinitionType&&(r=a.get("eventDefinitions")||[],o=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(o.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(o),o.$parent=a,a.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(a,s),t=W({id:a.id},n,t,{businessObject:a,di:s}),this.baseCreate(e,t)},i_.prototype.getDefaultSize=function(e,t){var n=Xo(e);return t=t||Zo(e),Ko(n,"bpmn:SubProcess")?wa(n,t)?{width:350,height:200}:{width:100,height:80}:Ko(n,"bpmn:Task")?{width:100,height:80}:Ko(n,"bpmn:Gateway")?{width:50,height:50}:Ko(n,"bpmn:Event")?{width:36,height:36}:Ko(n,"bpmn:Participant")?wa(n,t)?{width:600,height:250}:{width:400,height:60}:Ko(n,"bpmn:Lane")?{width:400,height:100}:Ko(n,"bpmn:DataObjectReference")?{width:36,height:50}:Ko(n,"bpmn:DataStoreReference")?{width:50,height:50}:Ko(n,"bpmn:TextAnnotation")?{width:100,height:30}:Ko(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},i_.prototype.createParticipantShape=function(e){return m(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),!1!==e.isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},s_.$inject=["modeling","canvas"],s_.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;C(n,(function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},s_.prototype.postExecute=function(e){},c_.$inject=["modeling"],c_.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},c_.prototype.postExecute=function(e){var t=e.hints||{};u_(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))},l_.$inject=["canvas","layouter"],l_.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},l_.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var p_=Math.round;function d_(e){this._modeling=e}function f_(e){return!!e.waypoints}d_.$inject=["modeling"],d_.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;C(t,(function(e){v(e.x)||(e.x=0),v(e.y)||(e.y=0)}));var s=E(t,(function(e){return!e.hidden})),c=Wt(s);C(t,(function(e){f_(e)&&(e.waypoints=R(e.waypoints,(function(e){return{x:p_(e.x-c.x-c.width/2+r.x),y:p_(e.y-c.y-c.height/2+r.y)}}))),W(e,{x:p_(e.x-c.x-c.width/2+r.x),y:p_(e.y-c.y-c.height/2+r.y)})}));var u=It(t),l={};C(t,(function(e){if(f_(e))l[e.id]=v(i)?a.createConnection(l[e.source.id],l[e.target.id],i,e,e.parent||n,o):a.createConnection(l[e.source.id],l[e.target.id],e,e.parent||n,o);else{var t=W({},o);-1===u.indexOf(e)&&(t.autoResize=!1),l[e.id]=v(i)?a.createShape(e,U(e,["x","y","width","height"]),e.parent||n,i,t):a.createShape(e,U(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=M(l)};var h_=Math.round;function m_(e){this._canvas=e}function v_(e){m_.call(this,e)}m_.$inject=["canvas"],m_.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?W(t,n):W(t,{x:n.x-h_(t.width/2),y:n.y-h_(t.height/2)}),this._canvas.addShape(t,i,r),t},m_.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},i(v_,m_),v_.$inject=["canvas"];var g_=m_.prototype.execute;v_.prototype.execute=function(e){var t=e.shape;return b_(t),t.labelTarget=e.labelTarget,g_.call(this,e)};var y_=m_.prototype.revert;function b_(e){["width","height"].forEach((function(t){"undefined"===typeof e[t]&&(e[t]=0)}))}function x_(e,t){this._canvas=e,this._modeling=t}function w_(e,t){this._modeling=e,this._elementRegistry=t}function __(e,t){this._canvas=e,this._modeling=t}function E_(e){return e.waypoints}function C_(e){this._modeling=e}v_.prototype.revert=function(e){return e.shape.labelTarget=null,y_.call(this,e)},x_.$inject=["canvas","modeling"],x_.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;aw(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),aw(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},x_.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=nn(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},x_.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t},w_.$inject=["modeling","elementRegistry"],w_.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;C(i,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},__.$inject=["canvas","modeling"],__.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;aw(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),aw(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),aw(n.children,(function(e){E_(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},__.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=nn(i.children,n),t.removeShape(n),n},__.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return tn(i.children,n,r),t.addShape(n,i),n},C_.$inject=["modeling"];var S_={x:"y",y:"x"};function A_(e,t){this._layouter=e,this._canvas=t}function T_(){}function k_(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function R_(e){this._modeling=e}function P_(e){this._helper=new R_(e)}function D_(e){this._modeling=e,this._helper=new R_(e)}function M_(e){this._modeling=e}function B_(e){return e.original||e}function O_(e,t){this._modeling=e,this._rules=t}function j_(e){this._modeling=e}function N_(e){this._modeling=e}function F_(e){return W({},e)}function I_(e){return R(e.waypoints,(function(e){return e=F_(e),e.original&&(e.original=F_(e.original)),e}))}function L_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function z_(e,t,n){var i=L_(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i] required");var r=e.changed||this.getVisualReferences(n).concat(t),o=e.oldProperties||Q_(n,P(i));return eE(n,i),e.oldProperties=o,e.changed=r,r},J_.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return eE(n,t),i},J_.prototype.getVisualReferences=function(e){var t=this._elementRegistry;return Ko(e,"bpmn:DataObject")?tE(e,t):[]};var nE="default",iE="id",rE="di",oE={width:0,height:0};function aE(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function sE(e,t){return iE in e&&e[iE]!==t[iE]}function cE(e,t){var n=P(t),i=e.businessObject,r=Zo(e);return A(n,(function(e,n){return e[n]=n!==rE?i.get(n):uE(r,P(t.di)),e}),{})}function uE(e,t){return A(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}function lE(e,t){var n=e.businessObject,i=Zo(e);C(t,(function(e,t){t!==rE?n.set(t,e):i&&pE(i,e)}))}function pE(e,t){C(t,(function(t,n){e.set(n,t)}))}aE.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],aE.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=fE(e.properties),c=e.oldProperties||cE(t,s);return sE(s,a)&&(o.unclaim(a[iE]),r.updateId(t,s[iE]),o.claim(s[iE],a)),nE in s&&(s[nE]&&n.push(r.get(s[nE].id)),a[nE]&&n.push(r.get(a[nE].id))),lE(t,s),e.oldProperties=c,e.changed=n,n},aE.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Xo(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,oE)}},aE.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return lE(t,i),sE(n,r)&&(a.unclaim(n[iE]),o.updateId(t,i[iE]),a.claim(i[iE],r)),e.changed};var dE=["default"];function fE(e){var t=W({},e);return dE.forEach((function(n){n in e&&(t[n]=Xo(t[n]))})),t}function hE(e,t){this._canvas=e,this._modeling=t}function mE(e,t){this._modeling=e,this._spaceTool=t}function vE(e,t){this._modeling=e,this._translate=t}function gE(e,t){this._modeling=e,this._spaceTool=t}hE.$inject=["canvas","modeling"],hE.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Zo(r);t.setRootElement(n),t.removeRootElement(r),tn(a.rootElements,i),i.$parent=a,en(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r},hE.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Zo(n);t.setRootElement(r),t.removeRootElement(n),en(a.rootElements,i),i.$parent=null,tn(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s},mE.$inject=["modeling","spaceTool"],mE.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=tm(i),a=o===i,s=a?i:i.parent,c=em(s);c.length||n.createShape({type:"bpmn:Lane"},{x:i.x+Jh,y:i.y,width:i.width-Jh,height:i.height},s);var u=[];$t(o,(function(e){return u.push(e),e.label&&u.push(e.label),e===i?[]:E(e.children,(function(e){return e!==i}))}));var l="top"===r?-120:120,p="top"===r?i.y:i.y+i.height,d=p+("top"===r?10:-10),f="top"===r?"n":"s",h=t.calculateAdjustments(u,"y",l,d);t.makeSpace(h.movingShapes,h.resizingShapes,{x:0,y:l},f,d),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?Jh:0),y:p-("top"===r?120:0),width:i.width-(a?Jh:0),height:120},s)},vE.$inject=["modeling","translate"],vE.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=em(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,u,l,p,d=Math.round(i.height/r);for(p=0;p0||l.bottom<0?-n:n,a=s.calculateAdjustments(d,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(f,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var yE="flowNodeRef",bE="lanes";function xE(e){this._elementRegistry=e}function wE(e){this._moddle=e}xE.$inject=["elementRegistry"],xE.prototype.computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(e,t){var n=vn(t),i={x:e.x+e.width/2,y:e.y+e.height/2};return i.x>n.left&&i.xn.top&&i.y: must be specified as : with start/end in { h,v,t,r,b,l }");if(iC(n)){var i=zE(e,t,n),r=$E(e,t,n),o=HE(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return VE(e,t,n)}function UE(e,t,n){var i=WE(e,t,n);return i.unshift(e),i.push(t),aC(i)}function qE(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=S(o,"straight")[0]||"h:h",s=NE[a]||0,c=wn(e,t,s),u=tC(c,a);n=n||xn(e),i=i||xn(t);var l=u.split(":"),p=oC(n,e,l[0],rC(c)),d=oC(i,t,l[1],c);return UE(p,d,u)}function KE(e,t,n,i,r,o){h(n)&&(r=n,o=i,n=xn(e),i=xn(t)),o=W({preferredLayouts:[]},o),r=r||[];var a,s=o.preferredLayouts,c=-1!==s.indexOf("straight");return a=c&&ZE(e,t,n,i,o),a||(a=o.connectionEnd&&QE(t,e,i,r),a||(a=o.connectionStart&&JE(e,t,n,r),a||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:qE(e,t,n,i,o))))}function YE(e,t,n){return e>=t&&e<=n}function XE(e,t,n){var i={x:"width",y:"height"};return YE(t[e],n[e],n[e]+n[i[e]])}function ZE(e,t,n,i,r){var o,a,s={};return a=wn(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?XE(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:XE(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null):null}function JE(e,t,n,i){return eC(e,t,n,i)}function QE(e,t,n,i){var r=i.slice().reverse();return r=eC(e,t,n,r),r?r.reverse():null}function eC(e,t,n,i){function r(e){return e.length<3||!(e.length>4)&&!!w(e,(function(t,n){var i=e[n-1];return i&&rn(t,i)<3}))}function o(e,t,n){var i=sn(t,e);switch(i){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 a(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(ln(e[i],t,jE)||ln(e[i],n,jE))return e.slice(i);return e}if(r(i))return null;var s,c=i[0],u=i.slice();return u[0]=n,u[1]=o(u[1],c,n),s=a(u,e,t),s!==u&&(u=eC(e,t,n,s)),u&&sn(u)?null:u}function tC(e,t){if(iC(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 nC(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function iC(e){return e&&/t|r|b|l/.test(e)}function rC(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 oC(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function aC(e){return e.reduce((function(t,n,i){var r=t[t.length-1],o=e[i+1];return on(r,o,n,0)||t.push(n),t}),[])}var sC=-10,cC=40,uC={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},lC={top:"t",right:"r",bottom:"b",left:"l"};function pC(){}function dC(e){var t=e.host;return wn(xn(e),t,sC)}function fC(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:hC(e,t)}}function hC(e,t){return Ko(t,"bpmn:Participant")?"source":Ko(e,"bpmn:Participant")?"target":bC(t)?"source":bC(e)||Ko(t,"bpmn:Event")?"target":Ko(e,"bpmn:Event")?"source":null}function mC(e){return{preferredLayouts:["straight","h:h"],preserveDocking:vC(e)}}function vC(e){return bC(e)?"target":"source"}function gC(e,t){return e?e.original||e:xn(t)}function yC(e,t){return Ko(t,"bpmn:Activity")&&Ko(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function bC(e){return Ko(e,"bpmn:SubProcess")&&wa(e)}function xC(e,t){return e===t}function wC(e,t){return-1!==t.indexOf(e)}function _C(e){var t=/right|left/.exec(e);return t&&t[0]}function EC(e){var t=/top|bottom/.exec(e);return t&&t[0]}function CC(e,t){return uC[e]===t}function SC(e,t){var n=_C(e),i=uC[n];return-1!==t.indexOf(i)}function AC(e,t){var n=EC(e),i=uC[n];return-1!==t.indexOf(i)}function TC(e){return"right"===e||"left"===e}function kC(e,t){var n=t.waypoints,i=n&&n.length&&wn(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function RC(e,t,n){var i,r,o=xn(e),a=xn(t),s=dC(e),c=xC(e.host,t),u=wC(s,["top","right","bottom","left"]),l=wn(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return c?PC(s,u,e,t,n):(i=BC(s,l,u),r=OC(s,l,u),[i+":"+r])}function PC(e,t,n,i,r){var o,a=t?e:EC(e),s=lC[a];return o=t?TC(e)?DC("y",n,i,r)?"h":"b":DC("x",n,i,r)?"v":"l":"v",[s+":"+o]}function DC(e,t,n,i){var r=cC;return!(MC(e,i,n,r)||MC(e,i,{x:n.x+n.width,y:n.y+n.height},r)||MC(e,i,xn(t),r))}function MC(e,t,n,i){return Math.abs(t[e]-n[e])
'),ie(r,"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'
':''),a=Te(o);if(r.appendChild(a),!t.separator&&(ie(a,"data-action",n),t.title&&ie(a,"title",t.title),t.className&&pS(a,t.className),t.imageUrl)){var s=Te("
");ie(s,"src",t.imageUrl),a.appendChild(s)}})),this.open()},lS.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();i=a[ie(s,"data-action")],i&&(r=i.action,o=t.originalEvent||t,g(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},lS.prototype._layoutChanged=function(){this._toggleState({})},lS.prototype._needsCollapse=function(e,t){var n=50,i=46*Object.keys(t).length;return e