o&&(p=0),m>l&&(d=0),this.view.setTranslate(Math.floor(p/2-a.x),Math.floor(d/2-a.y)),this.container.scrollLeft=(c-o)/2,this.container.scrollTop=(m-l)/2}else this.view.setTranslate(t?Math.floor(h.x-a.x*u+p*i/u):h.x,e?Math.floor(h.y-a.y*u+d*n/u):h.y)},mxGraph.prototype.zoom=function(t,e){e=null!=e?e:this.centerZoom;var i=Math.round(this.view.scale*t*100)/100,n=this.view.getState(this.getSelectionCell());if(t=i/this.view.scale,this.keepSelectionVisibleOnZoom&&null!=n){var r=new mxRectangle(n.x*t,n.y*t,n.width*t,n.height*t);this.view.scale=i,this.scrollRectToVisible(r)||(this.view.revalidate(),this.view.setScale(i))}else{var s=mxUtils.hasScrollbars(this.container);if(e&&!s){var o,l=this.container.offsetWidth,a=this.container.offsetHeight;if(t>1)l*=-(o=(t-1)/(2*i)),a*=-o;else l*=o=(1/t-1)/(2*this.view.scale),a*=o;this.view.scaleAndTranslate(i,this.view.translate.x+l,this.view.translate.y+a)}else{var h=this.view.translate.x,u=this.view.translate.y,p=this.container.scrollLeft,d=this.container.scrollTop;if(this.view.setScale(i),s){l=0,a=0;e&&(l=this.container.offsetWidth*(t-1)/2,a=this.container.offsetHeight*(t-1)/2),this.container.scrollLeft=(this.view.translate.x-h)*this.view.scale+Math.round(p*t+l),this.container.scrollTop=(this.view.translate.y-u)*this.view.scale+Math.round(d*t+a)}}}},mxGraph.prototype.zoomToRect=function(t){var e=this.container.clientWidth/t.width/(this.container.clientHeight/t.height);t.x=Math.max(0,t.x),t.y=Math.max(0,t.y);var i=Math.min(this.container.scrollWidth,t.x+t.width),n=Math.min(this.container.scrollHeight,t.y+t.height);if(t.width=i-t.x,t.height=n-t.y,e<1){var r=t.height/e,s=(r-t.height)/2;t.height=r;var o=Math.min(t.y,s);t.y=t.y-o,n=Math.min(this.container.scrollHeight,t.y+t.height),t.height=n-t.y}else{var l=t.width*e,a=(l-t.width)/2;t.width=l;var h=Math.min(t.x,a);t.x=t.x-h,i=Math.min(this.container.scrollWidth,t.x+t.width),t.width=i-t.x}var u=this.container.clientWidth/t.width,p=this.view.scale*u;mxUtils.hasScrollbars(this.container)?(this.view.setScale(p),this.container.scrollLeft=Math.round(t.x*u),this.container.scrollTop=Math.round(t.y*u)):this.view.scaleAndTranslate(p,this.view.translate.x-t.x/this.view.scale,this.view.translate.y-t.y/this.view.scale)},mxGraph.prototype.scrollCellToVisible=function(t,e){var i=-this.view.translate.x,n=-this.view.translate.y,r=this.view.getState(t);if(null!=r){var s=new mxRectangle(i+r.x,n+r.y,r.width,r.height);if(e&&null!=this.container){var o=this.container.clientWidth,l=this.container.clientHeight;s.x=s.getCenterX()-o/2,s.width=o,s.y=s.getCenterY()-l/2,s.height=l}var a=new mxPoint(this.view.translate.x,this.view.translate.y);if(this.scrollRectToVisible(s)){var h=new mxPoint(this.view.translate.x,this.view.translate.y);this.view.translate.x=a.x,this.view.translate.y=a.y,this.view.setTranslate(h.x,h.y)}}},mxGraph.prototype.scrollRectToVisible=function(t){var e=!1;if(null!=t){var i=this.container.offsetWidth,n=this.container.offsetHeight,r=Math.min(i,t.width),s=Math.min(n,t.height);if(mxUtils.hasScrollbars(this.container)){var o=this.container;t.x+=this.view.translate.x,t.y+=this.view.translate.y;var l=o.scrollLeft-t.x,a=Math.max(l-o.scrollLeft,0);l>0?o.scrollLeft-=l+2:(l=t.x+r-o.scrollLeft-o.clientWidth)>0&&(o.scrollLeft+=l+2);var h=o.scrollTop-t.y,u=Math.max(0,h-o.scrollTop);h>0?o.scrollTop-=h+2:(h=t.y+s-o.scrollTop-o.clientHeight)>0&&(o.scrollTop+=h+2),this.useScrollbarsForPanning||0==a&&0==u||this.view.setTranslate(a,u)}else{var p=-this.view.translate.x,d=-this.view.translate.y,c=this.view.scale;t.x+r>p+i&&(this.view.translate.x-=(t.x+r-i-p)/c,e=!0),t.y+s>d+n&&(this.view.translate.y-=(t.y+s-n-d)/c,e=!0),t.x1||1==r.length&&r[0]!=t)&&(n+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n")}var s=this.model.getDirectedEdgeCount(e,!0,t),o=this.model.getDirectedEdgeCount(i,!1,t);if(null!=this.multiplicities)for(var l=0;l0?n:null}return this.allowDanglingEdges?null:""},mxGraph.prototype.validateEdge=function(t,e,i){return null},mxGraph.prototype.validateGraph=function(t,e){t=null!=t?t:this.model.getRoot(),e=null!=e?e:new Object;for(var i=!0,n=this.model.getChildCount(t),r=0;r")):this.setCellWarning(s,null),i=i&&null==l}var a="";this.isCellCollapsed(t)&&!i&&(a+=(mxResources.get(this.containsValidationErrorsResource)||this.containsValidationErrorsResource)+"\n"),this.model.isEdge(t)?a+=this.getEdgeValidationError(t,this.model.getTerminal(t,!0),this.model.getTerminal(t,!1))||"":a+=this.getCellValidationError(t)||"";var h=this.validateCell(t,e);return null!=h&&(a+=h),null==this.model.getParent(t)&&this.view.validate(),a.length>0||!i?a:null},mxGraph.prototype.getCellValidationError=function(t){var e=this.model.getDirectedEdgeCount(t,!0),i=this.model.getDirectedEdgeCount(t,!1),n=this.model.getValue(t),r="";if(null!=this.multiplicities)for(var s=0;so.max||eo.max||i0?r:null},mxGraph.prototype.validateCell=function(t,e){return null},mxGraph.prototype.getBackgroundImage=function(){return this.backgroundImage},mxGraph.prototype.setBackgroundImage=function(t){this.backgroundImage=t},mxGraph.prototype.getFoldingImage=function(t){if(null!=t&&this.foldingEnabled&&!this.getModel().isEdge(t.cell)){var e=this.isCellCollapsed(t.cell);if(this.isCellFoldable(t.cell,!e))return e?this.collapsedImage:this.expandedImage}return null},mxGraph.prototype.convertValueToString=function(t){var e=this.model.getValue(t);if(null!=e){if(mxUtils.isNode(e))return e.nodeName;if("function"==typeof e.toString)return e.toString()}return""},mxGraph.prototype.getLabel=function(t){var e="";if(this.labelsVisible&&null!=t){var i=this.view.getState(t),n=null!=i?i.style:this.getCellStyle(t);mxUtils.getValue(n,mxConstants.STYLE_NOLABEL,!1)||(e=this.convertValueToString(t))}return e},mxGraph.prototype.isHtmlLabel=function(t){return this.isHtmlLabels()},mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels},mxGraph.prototype.setHtmlLabels=function(t){this.htmlLabels=t},mxGraph.prototype.isWrapping=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return null!=i&&"wrap"==i[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return null!=i&&"hidden"==i[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(t,e,i,n){var r=null;if(null!=t){if(null==t.control||e!=t.control.node&&e.parentNode!=t.control.node||(r=this.collapseExpandResource,r=mxUtils.htmlEntities(mxResources.get(r)||r).replace(/\\n/g,"
")),null==r&&null!=t.overlays&&t.overlays.visit((function(t,i){null!=r||e!=i.node&&e.parentNode!=i.node||(r=i.overlay.toString())})),null==r){var s=this.selectionCellsHandler.getHandler(t.cell);null!=s&&"function"==typeof s.getTooltipForNode&&(r=s.getTooltipForNode(e))}null==r&&(r=this.getTooltipForCell(t.cell))}return r},mxGraph.prototype.getTooltipForCell=function(t){return null!=t&&null!=t.getTooltip?t.getTooltip():this.convertValueToString(t)},mxGraph.prototype.getLinkForCell=function(t){return null},mxGraph.prototype.getCursorForMouseEvent=function(t){return this.getCursorForCell(t.getCell())},mxGraph.prototype.getCursorForCell=function(t){return null},mxGraph.prototype.getStartSize=function(t){var e=new mxRectangle,i=this.view.getState(t),n=null!=i?i.style:this.getCellStyle(t);if(null!=n){var r=parseInt(mxUtils.getValue(n,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE));mxUtils.getValue(n,mxConstants.STYLE_HORIZONTAL,!0)?e.height=r:e.width=r}return e},mxGraph.prototype.getImage=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_IMAGE]:null},mxGraph.prototype.isTransparentState=function(t){var e=!1;if(null!=t){var i=mxUtils.getValue(t.style,mxConstants.STYLE_STROKECOLOR,mxConstants.NONE),n=mxUtils.getValue(t.style,mxConstants.STYLE_FILLCOLOR,mxConstants.NONE);e=i==mxConstants.NONE&&n==mxConstants.NONE&&null==this.getImage(t)}return e},mxGraph.prototype.getVerticalAlign=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null},mxGraph.prototype.getIndicatorColor=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_INDICATOR_COLOR]:null},mxGraph.prototype.getIndicatorGradientColor=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null},mxGraph.prototype.getIndicatorShape=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_INDICATOR_SHAPE]:null},mxGraph.prototype.getIndicatorImage=function(t){return null!=t&&null!=t.style?t.style[mxConstants.STYLE_INDICATOR_IMAGE]:null},mxGraph.prototype.getBorder=function(){return this.border},mxGraph.prototype.setBorder=function(t){this.border=t},mxGraph.prototype.isSwimlane=function(t){if(null!=t&&this.model.getParent(t)!=this.model.getRoot()){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);if(null!=i&&!this.model.isEdge(t))return i[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE}return!1},mxGraph.prototype.isResizeContainer=function(){return this.resizeContainer},mxGraph.prototype.setResizeContainer=function(t){this.resizeContainer=t},mxGraph.prototype.isEnabled=function(){return this.enabled},mxGraph.prototype.setEnabled=function(t){this.enabled=t},mxGraph.prototype.isEscapeEnabled=function(){return this.escapeEnabled},mxGraph.prototype.setEscapeEnabled=function(t){this.escapeEnabled=t},mxGraph.prototype.isInvokesStopCellEditing=function(){return this.invokesStopCellEditing},mxGraph.prototype.setInvokesStopCellEditing=function(t){this.invokesStopCellEditing=t},mxGraph.prototype.isEnterStopsCellEditing=function(){return this.enterStopsCellEditing},mxGraph.prototype.setEnterStopsCellEditing=function(t){this.enterStopsCellEditing=t},mxGraph.prototype.isCellLocked=function(t){var e=this.model.getGeometry(t);return this.isCellsLocked()||null!=e&&this.model.isVertex(t)&&e.relative},mxGraph.prototype.isCellsLocked=function(){return this.cellsLocked},mxGraph.prototype.setCellsLocked=function(t){this.cellsLocked=t},mxGraph.prototype.getCloneableCells=function(t){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.isCellCloneable(t)})))},mxGraph.prototype.isCellCloneable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsCloneable()&&0!=i[mxConstants.STYLE_CLONEABLE]},mxGraph.prototype.isCellsCloneable=function(){return this.cellsCloneable},mxGraph.prototype.setCellsCloneable=function(t){this.cellsCloneable=t},mxGraph.prototype.getExportableCells=function(t){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.canExportCell(t)})))},mxGraph.prototype.canExportCell=function(t){return this.exportEnabled},mxGraph.prototype.getImportableCells=function(t){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.canImportCell(t)})))},mxGraph.prototype.canImportCell=function(t){return this.importEnabled},mxGraph.prototype.isCellSelectable=function(t){return this.isCellsSelectable()},mxGraph.prototype.isCellsSelectable=function(){return this.cellsSelectable},mxGraph.prototype.setCellsSelectable=function(t){this.cellsSelectable=t},mxGraph.prototype.getDeletableCells=function(t){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.isCellDeletable(t)})))},mxGraph.prototype.isCellDeletable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsDeletable()&&0!=i[mxConstants.STYLE_DELETABLE]},mxGraph.prototype.isCellsDeletable=function(){return this.cellsDeletable},mxGraph.prototype.setCellsDeletable=function(t){this.cellsDeletable=t},mxGraph.prototype.isLabelMovable=function(t){return!this.isCellLocked(t)&&(this.model.isEdge(t)&&this.edgeLabelsMovable||this.model.isVertex(t)&&this.vertexLabelsMovable)},mxGraph.prototype.isCellRotatable=function(t){var e=this.view.getState(t);return 0!=(null!=e?e.style:this.getCellStyle(t))[mxConstants.STYLE_ROTATABLE]},mxGraph.prototype.getMovableCells=function(t){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.isCellMovable(t)})))},mxGraph.prototype.isCellMovable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsMovable()&&!this.isCellLocked(t)&&0!=i[mxConstants.STYLE_MOVABLE]},mxGraph.prototype.isCellsMovable=function(){return this.cellsMovable},mxGraph.prototype.setCellsMovable=function(t){this.cellsMovable=t},mxGraph.prototype.isGridEnabled=function(){return this.gridEnabled},mxGraph.prototype.setGridEnabled=function(t){this.gridEnabled=t},mxGraph.prototype.isPortsEnabled=function(){return this.portsEnabled},mxGraph.prototype.setPortsEnabled=function(t){this.portsEnabled=t},mxGraph.prototype.getGridSize=function(){return this.gridSize},mxGraph.prototype.setGridSize=function(t){this.gridSize=t},mxGraph.prototype.getTolerance=function(){return this.tolerance},mxGraph.prototype.setTolerance=function(t){this.tolerance=t},mxGraph.prototype.isVertexLabelsMovable=function(){return this.vertexLabelsMovable},mxGraph.prototype.setVertexLabelsMovable=function(t){this.vertexLabelsMovable=t},mxGraph.prototype.isEdgeLabelsMovable=function(){return this.edgeLabelsMovable},mxGraph.prototype.setEdgeLabelsMovable=function(t){this.edgeLabelsMovable=t},mxGraph.prototype.isSwimlaneNesting=function(){return this.swimlaneNesting},mxGraph.prototype.setSwimlaneNesting=function(t){this.swimlaneNesting=t},mxGraph.prototype.isSwimlaneSelectionEnabled=function(){return this.swimlaneSelectionEnabled},mxGraph.prototype.setSwimlaneSelectionEnabled=function(t){this.swimlaneSelectionEnabled=t},mxGraph.prototype.isMultigraph=function(){return this.multigraph},mxGraph.prototype.setMultigraph=function(t){this.multigraph=t},mxGraph.prototype.isAllowLoops=function(){return this.allowLoops},mxGraph.prototype.setAllowDanglingEdges=function(t){this.allowDanglingEdges=t},mxGraph.prototype.isAllowDanglingEdges=function(){return this.allowDanglingEdges},mxGraph.prototype.setConnectableEdges=function(t){this.connectableEdges=t},mxGraph.prototype.isConnectableEdges=function(){return this.connectableEdges},mxGraph.prototype.setCloneInvalidEdges=function(t){this.cloneInvalidEdges=t},mxGraph.prototype.isCloneInvalidEdges=function(){return this.cloneInvalidEdges},mxGraph.prototype.setAllowLoops=function(t){this.allowLoops=t},mxGraph.prototype.isDisconnectOnMove=function(){return this.disconnectOnMove},mxGraph.prototype.setDisconnectOnMove=function(t){this.disconnectOnMove=t},mxGraph.prototype.isDropEnabled=function(){return this.dropEnabled},mxGraph.prototype.setDropEnabled=function(t){this.dropEnabled=t},mxGraph.prototype.isSplitEnabled=function(){return this.splitEnabled},mxGraph.prototype.setSplitEnabled=function(t){this.splitEnabled=t},mxGraph.prototype.isCellResizable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsResizable()&&!this.isCellLocked(t)&&"0"!=mxUtils.getValue(i,mxConstants.STYLE_RESIZABLE,"1")},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(t){this.cellsResizable=t},mxGraph.prototype.isTerminalPointMovable=function(t,e){return!0},mxGraph.prototype.isCellBendable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsBendable()&&!this.isCellLocked(t)&&0!=i[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(t){this.cellsBendable=t},mxGraph.prototype.isCellEditable=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isCellsEditable()&&!this.isCellLocked(t)&&0!=i[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(t){this.cellsEditable=t},mxGraph.prototype.isCellDisconnectable=function(t,e,i){return this.isCellsDisconnectable()&&!this.isCellLocked(t)},mxGraph.prototype.isCellsDisconnectable=function(){return this.cellsDisconnectable},mxGraph.prototype.setCellsDisconnectable=function(t){this.cellsDisconnectable=t},mxGraph.prototype.isValidSource=function(t){return null==t&&this.allowDanglingEdges||null!=t&&(!this.model.isEdge(t)||this.connectableEdges)&&this.isCellConnectable(t)},mxGraph.prototype.isValidTarget=function(t){return this.isValidSource(t)},mxGraph.prototype.isValidConnection=function(t,e){return this.isValidSource(t)&&this.isValidTarget(e)},mxGraph.prototype.setConnectable=function(t){this.connectionHandler.setEnabled(t)},mxGraph.prototype.isConnectable=function(){return this.connectionHandler.isEnabled()},mxGraph.prototype.setTooltips=function(t){this.tooltipHandler.setEnabled(t)},mxGraph.prototype.setPanning=function(t){this.panningHandler.panningEnabled=t},mxGraph.prototype.isEditing=function(t){if(null!=this.cellEditor){var e=this.cellEditor.getEditingCell();return null==t?null!=e:t==e}return!1},mxGraph.prototype.isAutoSizeCell=function(t){var e=this.view.getState(t),i=null!=e?e.style:this.getCellStyle(t);return this.isAutoSizeCells()||1==i[mxConstants.STYLE_AUTOSIZE]},mxGraph.prototype.isAutoSizeCells=function(){return this.autoSizeCells},mxGraph.prototype.setAutoSizeCells=function(t){this.autoSizeCells=t},mxGraph.prototype.isExtendParent=function(t){return!this.getModel().isEdge(t)&&this.isExtendParents()},mxGraph.prototype.isExtendParents=function(){return this.extendParents},mxGraph.prototype.setExtendParents=function(t){this.extendParents=t},mxGraph.prototype.isExtendParentsOnAdd=function(t){return this.extendParentsOnAdd},mxGraph.prototype.setExtendParentsOnAdd=function(t){this.extendParentsOnAdd=t},mxGraph.prototype.isExtendParentsOnMove=function(){return this.extendParentsOnMove},mxGraph.prototype.setExtendParentsOnMove=function(t){this.extendParentsOnMove=t},mxGraph.prototype.isRecursiveResize=function(t){return this.recursiveResize},mxGraph.prototype.setRecursiveResize=function(t){this.recursiveResize=t},mxGraph.prototype.isConstrainChild=function(t){return this.isConstrainChildren()&&!this.getModel().isEdge(this.getModel().getParent(t))},mxGraph.prototype.isConstrainChildren=function(){return this.constrainChildren},mxGraph.prototype.setConstrainChildren=function(t){this.constrainChildren=t},mxGraph.prototype.isConstrainRelativeChildren=function(){return this.constrainRelativeChildren},mxGraph.prototype.setConstrainRelativeChildren=function(t){this.constrainRelativeChildren=t},mxGraph.prototype.isAllowNegativeCoordinates=function(){return this.allowNegativeCoordinates},mxGraph.prototype.setAllowNegativeCoordinates=function(t){this.allowNegativeCoordinates=t},mxGraph.prototype.getOverlap=function(t){return this.isAllowOverlapParent(t)?this.defaultOverlap:0},mxGraph.prototype.isAllowOverlapParent=function(t){return!1},mxGraph.prototype.getFoldableCells=function(t,e){return this.model.filterCells(t,mxUtils.bind(this,(function(t){return this.isCellFoldable(t,e)})))},mxGraph.prototype.isCellFoldable=function(t,e){var i=this.view.getState(t),n=null!=i?i.style:this.getCellStyle(t);return this.model.getChildCount(t)>0&&0!=n[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(t,e,i){return null!=t&&(this.isSplitEnabled()&&this.isSplitTarget(t,e,i)||!this.model.isEdge(t)&&(this.isSwimlane(t)||this.model.getChildCount(t)>0&&!this.isCellCollapsed(t)))},mxGraph.prototype.isSplitTarget=function(t,e,i){if(this.model.isEdge(t)&&null!=e&&1==e.length&&this.isCellConnectable(e[0])&&null==this.getEdgeValidationError(t,this.model.getTerminal(t,!0),e[0])){var n=this.model.getTerminal(t,!0),r=this.model.getTerminal(t,!1);return!this.model.isAncestor(e[0],n)&&!this.model.isAncestor(e[0],r)}return!1},mxGraph.prototype.getDropTarget=function(t,e,i,n){if(!this.isSwimlaneNesting())for(var r=0;r=0;o--){var l=this.model.getChildAt(i,o),a=this.getCellAt(t,e,l,n,r,s);if(null!=a)return a;if(this.isCellVisible(l)&&(r&&this.model.isEdge(l)||n&&this.model.isVertex(l))){var h=this.view.getState(l);if(null!=h&&(null==s||!s(h,t,e))&&this.intersects(h,t,e))return l}}return null},mxGraph.prototype.intersects=function(t,e,i){if(null!=t){var n=t.absolutePoints;if(null!=n)for(var r=this.tolerance*this.tolerance,s=n[0],o=1;o0&&e>0&&e>r.width*s)return!0;if(r.height>0&&i>0&&i>r.height*s)return!0}return!1},mxGraph.prototype.getChildVertices=function(t){return this.getChildCells(t,!0,!1)},mxGraph.prototype.getChildEdges=function(t){return this.getChildCells(t,!1,!0)},mxGraph.prototype.getChildCells=function(t,e,i){t=null!=t?t:this.getDefaultParent(),e=null!=e&&e,i=null!=i&&i;for(var n=this.model.getChildCells(t,e,i),r=[],s=0;s0||n>0){var o=this.getModel(),l=t+i,a=e+n;if(null==r&&null==(r=this.getCurrentRoot())&&(r=o.getRoot()),null!=r)for(var h=o.getChildCount(r),u=0;u=t&&m.y+m.height<=a&&m.y>=e&&m.x+m.width<=l?s.push(p):this.getCells(t,e,i,n,p,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(t,e,i,n,r){var s=[];if((n||r)&&(null==i&&(i=this.getDefaultParent()),null!=i))for(var o=this.model.getChildCount(i),l=0;l=t)&&(!r||h.y>=e)&&s.push(a)}return s},mxGraph.prototype.findTreeRoots=function(t,e,i){e=null!=e&&e,i=null!=i&&i;var n=[];if(null!=t){for(var r=this.getModel(),s=r.getChildCount(t),o=null,l=0,a=0;a0||!i&&0==d&&p>0)&&n.push(h);var m=i?d-p:p-d;m>l&&(l=m,o=h)}}0==n.length&&null!=o&&n.push(o)}return n},mxGraph.prototype.traverse=function(t,e,i,n,r,s){if(null!=i&&null!=t&&(e=null==e||e,s=null!=s&&s,!(r=r||new mxDictionary).get(t))){r.put(t,!0);var o=i(t,n);if(null==o||o){var l=this.model.getEdgeCount(t);if(l>0)for(var a=0;a0?n.cells[0]:null;n.cells.length>1&&n.clear();var s=null!=r?this.model.getParent(r):this.getDefaultParent(),o=this.model.getChildCount(s);if(null==r&&o>0){var l=this.model.getChildAt(s,0);this.setSelectionCell(l)}else if(null!=r&&!e||null==this.view.getState(s)||null==this.model.getGeometry(s)){if(null!=r&&i){if(this.model.getChildCount(r)>0){l=this.model.getChildAt(r,0);this.setSelectionCell(l)}}else if(o>0){var a=s.getIndex(r);if(t){a++;l=this.model.getChildAt(s,a%o);this.setSelectionCell(l)}else{var h=--a<0?o-1:a;l=this.model.getChildAt(s,h);this.setSelectionCell(l)}}}else this.getCurrentRoot()!=s&&this.setSelectionCell(s)},mxGraph.prototype.selectAll=function(t,e){t=t||this.getDefaultParent();var i=e?this.model.filterDescendants(mxUtils.bind(this,(function(e){return e!=t&&null!=this.view.getState(e)})),t):this.model.getChildren(t);null!=i&&this.setSelectionCells(i)},mxGraph.prototype.selectVertices=function(t,e){this.selectCells(!0,!1,t,e)},mxGraph.prototype.selectEdges=function(t){this.selectCells(!1,!0,t)},mxGraph.prototype.selectCells=function(t,e,i,n){i=i||this.getDefaultParent();var r=mxUtils.bind(this,(function(i){return null!=this.view.getState(i)&&((n||0==this.model.getChildCount(i))&&this.model.isVertex(i)&&t&&!this.model.isEdge(this.model.getParent(i))||this.model.isEdge(i)&&e)})),s=this.model.filterDescendants(r,i);null!=s&&this.setSelectionCells(s)},mxGraph.prototype.selectCellForEvent=function(t,e){var i=this.isCellSelected(t);this.isToggleEvent(e)?i?this.removeSelectionCell(t):this.addSelectionCell(t):i&&1==this.getSelectionCount()||this.setSelectionCell(t)},mxGraph.prototype.selectCellsForEvent=function(t,e){this.isToggleEvent(e)?this.addSelectionCells(t):this.setSelectionCells(t)},mxGraph.prototype.createHandler=function(t){var e=null;if(null!=t)if(this.model.isEdge(t.cell)){var i=t.getVisibleTerminalState(!0),n=t.getVisibleTerminalState(!1),r=this.getCellGeometry(t.cell),s=this.view.getEdgeStyle(t,null!=r?r.points:null,i,n);e=this.createEdgeHandler(t,s)}else e=this.createVertexHandler(t);return e},mxGraph.prototype.createVertexHandler=function(t){return new mxVertexHandler(t)},mxGraph.prototype.createEdgeHandler=function(t,e){return e==mxEdgeStyle.Loop||e==mxEdgeStyle.ElbowConnector||e==mxEdgeStyle.SideToSide||e==mxEdgeStyle.TopToBottom?this.createElbowEdgeHandler(t):e==mxEdgeStyle.SegmentConnector||e==mxEdgeStyle.OrthConnector?this.createEdgeSegmentHandler(t):new mxEdgeHandler(t)},mxGraph.prototype.createEdgeSegmentHandler=function(t){return new mxEdgeSegmentHandler(t)},mxGraph.prototype.createElbowEdgeHandler=function(t){return new mxElbowEdgeHandler(t)},mxGraph.prototype.addMouseListener=function(t){null==this.mouseListeners&&(this.mouseListeners=[]),this.mouseListeners.push(t)},mxGraph.prototype.removeMouseListener=function(t){if(null!=this.mouseListeners)for(var e=0;e0){this.outline.getView().scale!=d&&(this.outline.getView().scale=d,t=!0);var c=this.outline.getView();c.currentRoot!=this.source.getView().currentRoot&&c.setCurrentRoot(this.source.getView().currentRoot);var m=this.source.view.translate,g=m.x+this.source.panDx,x=m.y+this.source.panDy,f=this.getOutlineOffset(d);null!=f&&(g+=f.x,x+=f.y),n.x<0&&(g-=n.x),n.y<0&&(x-=n.y),c.translate.x==g&&c.translate.y==x||(c.translate.x=g,c.translate.y=x,t=!0);var y=c.translate,v=(d=this.source.getView().scale)/c.scale,C=1/c.scale,E=this.source.container;this.bounds=new mxRectangle((y.x-m.x-this.source.panDx)/C,(y.y-m.y-this.source.panDy)/C,E.clientWidth/v,E.clientHeight/v),this.bounds.x+=this.source.container.scrollLeft*c.scale/d,this.bounds.y+=this.source.container.scrollTop*c.scale/d,(S=this.selectionBorder.bounds).x==this.bounds.x&&S.y==this.bounds.y&&S.width==this.bounds.width&&S.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw());var S=this.sizer.bounds,b=new mxRectangle(this.bounds.x+this.bounds.width-S.width/2,this.bounds.y+this.bounds.height-S.height/2,S.width,S.height);S.x==b.x&&S.y==b.y&&S.width==b.width&&S.height==b.height||(this.sizer.bounds=b,"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw()),t&&this.outline.view.revalidate()}}},mxOutline.prototype.mouseDown=function(t,e){if(this.enabled&&this.showViewport){var i=mxEvent.isMouseEvent(e.getEvent())?0:this.source.tolerance,n=this.source.allowHandleBoundsCheck&&(mxClient.IS_IE||i>0)?new mxRectangle(e.getGraphX()-i,e.getGraphY()-i,2*i,2*i):null;this.zoom=e.isSource(this.sizer)||null!=n&&mxUtils.intersects(shape.bounds,n),this.startX=e.getX(),this.startY=e.getY(),this.active=!0,this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)?(this.dx0=this.source.container.scrollLeft,this.dy0=this.source.container.scrollTop):(this.dx0=0,this.dy0=0)}e.consume()},mxOutline.prototype.mouseMove=function(t,e){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var i=this.getTranslateForEvent(e),n=i.x,r=i.y,s=null;if(this.zoom){var o=this.source.container;r=n/(o.clientWidth/o.clientHeight),s=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+n),Math.max(1,this.bounds.height+r)),this.selectionBorder.bounds=s,this.selectionBorder.redraw()}else{var l=this.outline.getView().scale;s=new mxRectangle(this.bounds.x+n,this.bounds.y+r,this.bounds.width,this.bounds.height),this.selectionBorder.bounds=s,this.selectionBorder.redraw(),n/=l,n*=this.source.getView().scale,r/=l,r*=this.source.getView().scale,this.source.panGraph(-n-this.dx0,-r-this.dy0)}var a=this.sizer.bounds;this.sizer.bounds=new mxRectangle(s.x+s.width-a.width/2,s.y+s.height-a.height/2,a.width,a.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),e.consume()}},mxOutline.prototype.getTranslateForEvent=function(t){return new mxPoint(t.getX()-this.startX,t.getY()-this.startY)},mxOutline.prototype.mouseUp=function(t,e){if(this.active){var i=this.getTranslateForEvent(e),n=i.x,r=i.y;if(Math.abs(n)>0||Math.abs(r)>0){if(this.zoom){var s=this.selectionBorder.bounds.width,o=this.source.getView().scale;this.source.zoomTo(Math.max(this.minScale,o-n*o/s),!1)}else if(!this.source.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.source.container)){this.source.panGraph(0,0),n/=this.outline.getView().scale,r/=this.outline.getView().scale;var l=this.source.getView().translate;this.source.getView().setTranslate(l.x-n,l.y-r)}this.update(),e.consume()}this.index=null,this.active=!1}},mxOutline.prototype.destroy=function(){null!=this.source&&(this.source.removeListener(this.panHandler),this.source.removeListener(this.refreshHandler),this.source.getModel().removeListener(this.updateHandler),this.source.getView().removeListener(this.updateHandler),mxEvent.removeListener(this.source.container,"scroll",this.updateHandler),this.source=null),null!=this.outline&&(this.outline.removeMouseListener(this),this.outline.destroy(),this.outline=null),null!=this.selectionBorder&&(this.selectionBorder.destroy(),this.selectionBorder=null),null!=this.sizer&&(this.sizer.destroy(),this.sizer=null)},__mxOutput.mxOutline=void 0!==mxOutline?mxOutline:void 0,mxMultiplicity.prototype.type=null,mxMultiplicity.prototype.attr=null,mxMultiplicity.prototype.value=null,mxMultiplicity.prototype.source=null,mxMultiplicity.prototype.min=null,mxMultiplicity.prototype.max=null,mxMultiplicity.prototype.validNeighbors=null,mxMultiplicity.prototype.validNeighborsAllowed=!0,mxMultiplicity.prototype.countError=null,mxMultiplicity.prototype.typeError=null,mxMultiplicity.prototype.check=function(t,e,i,n,r,s){var o="";(this.source&&this.checkTerminal(t,i,e)||!this.source&&this.checkTerminal(t,n,e))&&(null!=this.countError&&(this.source&&(0==this.max||r>=this.max)||!this.source&&(0==this.max||s>=this.max))&&(o+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&this.validNeighbors.length>0&&(this.checkNeighbors(t,e,i,n)||(o+=this.typeError+"\n")));return o.length>0?o:null},mxMultiplicity.prototype.checkNeighbors=function(t,e,i,n){for(var r=t.model.getValue(i),s=t.model.getValue(n),o=!this.validNeighborsAllowed,l=this.validNeighbors,a=0;a0;)e=e.concat(n),n=i.getParents(n);this.executeLayoutForCells(e)},mxLayoutManager.prototype.executeLayoutForCells=function(t){var e=mxUtils.sortCells(t,!0);e=e.concat(e.slice().reverse()),this.layoutCells(e)},mxLayoutManager.prototype.cellsMoved=function(t,e){if(null!=t&&null!=e)for(var i=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(e),mxEvent.getClientY(e)),n=this.getGraph().getModel(),r=0;r0){var e=this.getGraph().getModel();e.beginUpdate();try{for(var i=null,n=0;n1||null!=r.points&&r.points.length>0||null==n.getTerminal(i,!0)||null==n.getTerminal(i,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(e.getEvent())&&this.graph.isCellsCloneable())?this.start(i,e.getX(),e.getY()):this.delayedSelection&&(this.cell=i),this.cellWasClicked=!0,this.consumeMouseEvent(mxEvent.MOUSE_DOWN,e)}}},mxGraphHandler.prototype.getGuideStates=function(){var t=this.graph.getDefaultParent(),e=this.graph.getModel(),i=mxUtils.bind(this,(function(t){return null!=this.graph.view.getState(t)&&e.isVertex(t)&&null!=e.getGeometry(t)&&!e.getGeometry(t).relative}));return this.graph.view.getCellStates(e.filterDescendants(i,t))},mxGraphHandler.prototype.getCells=function(t){return!this.delayedSelection&&this.graph.isCellMovable(t)?[t]:this.graph.getMovableCells(this.graph.getSelectionCells())},mxGraphHandler.prototype.getPreviewBounds=function(t){var e=this.getBoundingBox(t);if(null!=e){if(e.width=Math.max(0,e.width-1),e.height=Math.max(0,e.height-1),e.width0)for(var i=this.graph.getModel(),n=0;n=2)&&e!=(this.target||s))}))}},mxGraphHandler.prototype.addStates=function(t,e){var i=this.graph.view.getState(t),n=0;if(null!=i&&null==e.get(t)){e.put(t,i),n++;for(var r=this.graph.model.getChildCount(t),s=0;ss||Math.abs(r.y)>s){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3));var o=i.isCloneEvent(e.getEvent())&&i.isCellsCloneable()&&this.isCloneEnabled(),l=i.isGridEnabledEvent(e.getEvent()),a=e.getCell(),h=!0,u=null;this.cloning=o,i.isDropEnabled()&&this.highlightEnabled&&(u=i.getDropTarget(this.cells,e.getEvent(),a,o));var p=i.getView().getState(u),d=!1;if(null==p||i.model.getParent(this.cell)==u&&!o){if(this.target=null,this.connectOnDrop&&null!=a&&1==this.cells.length&&i.getModel().isVertex(a)&&i.isCellConnectable(a)&&null!=(p=i.getView().getState(a))){var c=null==i.getEdgeValidationError(null,this.cell,a)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR;this.setHighlightColor(c),d=!0}}else this.target!=u&&(this.target=u,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),d=!0;null!=p&&d?this.highlight.highlight(p):this.highlight.hide(),this.livePreviewActive&&o?(this.resetLivePreview(),this.livePreviewActive=!1):this.maxLivePreview>=this.cellCount&&!this.livePreviewActive&&this.allowLivePreview?o&&this.livePreviewActive||(this.setHandlesVisibleForCells(this.graph.getSelectionCells(),!1),this.livePreviewActive=!0,this.livePreviewUsed=!0):this.livePreviewUsed||null!=this.shape||(this.shape=this.createPreviewShape(this.bounds)),null!=this.guide&&this.useGuidesForEvent(e)?(r=this.guide.move(this.bounds,r,l,o),h=!1):r=this.graph.snapDelta(r,this.bounds,!l,!1,!1),null!=this.guide&&h&&this.guide.hide(),i.isConstrainedEvent(e.getEvent())&&(Math.abs(r.x)>Math.abs(r.y)?r.y=0:r.x=0),this.currentDx==r.x&&this.currentDy==r.y||(this.currentDx=r.x,this.currentDy=r.y,this.updatePreview())}this.updateHint(e),this.consumeMouseEvent(mxEvent.MOUSE_MOVE,e),mxEvent.consume(e.getEvent())}},mxGraphHandler.prototype.updatePreview=function(t){this.livePreviewUsed&&!t?null!=this.cells&&this.updateLivePreview(this.currentDx,this.currentDy):this.updatePreviewShape()},mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx),Math.round(this.pBounds.y+this.currentDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())},mxGraphHandler.prototype.updateLivePreview=function(t,e){if(!this.suspended){var i=[];null!=this.allCells&&this.allCells.visit(mxUtils.bind(this,(function(n,r){var s=r.clone();i.push([r,s]),null!=r.shape&&(null==r.shape.originalPointerEvents&&(r.shape.originalPointerEvents=r.shape.pointerEvents),r.shape.pointerEvents=!1,null!=r.text&&(null==r.text.originalPointerEvents&&(r.text.originalPointerEvents=r.text.pointerEvents),r.text.pointerEvents=!1)),this.graph.model.isVertex(r.cell)&&(r.x+=t,r.y+=e,this.cloning||(r.view.graph.cellRenderer.redraw(r,!0),r.view.invalidate(r.cell),r.invalid=!1,null!=r.control&&null!=r.control.node&&(r.control.node.style.visibility="hidden")))})));for(var n=this.graph.view.scale,r=0;rthis.graph.tolerance||Math.abs(this.dy)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",e))}(this.active||this.panningTrigger)&&e.consume()},mxPanningHandler.prototype.mouseUp=function(t,e){if(this.active){if(null!=this.dx&&null!=this.dy){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){var i=this.graph.getView().scale,n=this.graph.getView().translate;this.graph.panGraph(0,0),this.panGraph(n.x+this.dx/i,n.y+this.dy/i)}e.consume()}this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",e))}this.reset()},mxPanningHandler.prototype.zoomGraph=function(t){var e=Math.round(this.initialScale*t.scale*100)/100;null!=this.minScale&&(e=Math.max(this.minScale,e)),null!=this.maxScale&&(e=Math.min(this.maxScale,e)),this.graph.view.scale!=e&&(this.graph.zoomTo(e),mxEvent.consume(t))},mxPanningHandler.prototype.reset=function(){this.panningTrigger=!1,this.mouseDownEvent=null,this.active=!1,this.dx=null,this.dy=null},mxPanningHandler.prototype.panGraph=function(t,e){this.graph.getView().setTranslate(t,e)},mxPanningHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.forcePanningHandler),this.graph.removeListener(this.gestureHandler),mxEvent.removeListener(document,"mouseup",this.mouseUpListener)},__mxOutput.mxPanningHandler=void 0!==mxPanningHandler?mxPanningHandler:void 0,mxPopupMenuHandler.prototype=new mxPopupMenu,mxPopupMenuHandler.prototype.constructor=mxPopupMenuHandler,mxPopupMenuHandler.prototype.graph=null,mxPopupMenuHandler.prototype.selectOnPopup=!0,mxPopupMenuHandler.prototype.clearSelectionOnBackground=!0,mxPopupMenuHandler.prototype.triggerX=null,mxPopupMenuHandler.prototype.triggerY=null,mxPopupMenuHandler.prototype.screenX=null,mxPopupMenuHandler.prototype.screenY=null,mxPopupMenuHandler.prototype.init=function(){mxPopupMenu.prototype.init.apply(this),mxEvent.addGestureListeners(this.div,mxUtils.bind(this,(function(t){this.graph.tooltipHandler.hide()})))},mxPopupMenuHandler.prototype.isSelectOnPopup=function(t){return this.selectOnPopup},mxPopupMenuHandler.prototype.mouseDown=function(t,e){this.isEnabled()&&!mxEvent.isMultiTouchEvent(e.getEvent())&&(this.hideMenu(),this.triggerX=e.getGraphX(),this.triggerY=e.getGraphY(),this.screenX=mxEvent.getMainEvent(e.getEvent()).screenX,this.screenY=mxEvent.getMainEvent(e.getEvent()).screenY,this.popupTrigger=this.isPopupTrigger(e),this.inTolerance=!0)},mxPopupMenuHandler.prototype.mouseMove=function(t,e){this.inTolerance&&null!=this.screenX&&null!=this.screenY&&(Math.abs(mxEvent.getMainEvent(e.getEvent()).screenX-this.screenX)>this.graph.tolerance||Math.abs(mxEvent.getMainEvent(e.getEvent()).screenY-this.screenY)>this.graph.tolerance)&&(this.inTolerance=!1)},mxPopupMenuHandler.prototype.mouseUp=function(t,e){if(this.popupTrigger&&this.inTolerance&&null!=this.triggerX&&null!=this.triggerY){var i=this.getCellForPopupEvent(e);this.graph.isEnabled()&&this.isSelectOnPopup(e)&&null!=i&&!this.graph.isCellSelected(i)?this.graph.setSelectionCell(i):this.clearSelectionOnBackground&&null==i&&this.graph.clearSelection(),this.graph.tooltipHandler.hide();var n=mxUtils.getScrollOrigin();this.popup(e.getX()+n.x+1,e.getY()+n.y+1,i,e.getEvent()),e.consume()}this.popupTrigger=!1,this.inTolerance=!1},mxPopupMenuHandler.prototype.getCellForPopupEvent=function(t){return t.getCell()},mxPopupMenuHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.gestureHandler),mxPopupMenu.prototype.destroy.apply(this)},__mxOutput.mxPopupMenuHandler=void 0!==mxPopupMenuHandler?mxPopupMenuHandler:void 0,mxUtils.extend(mxCellMarker,mxEventSource),mxCellMarker.prototype.graph=null,mxCellMarker.prototype.enabled=!0,mxCellMarker.prototype.hotspot=mxConstants.DEFAULT_HOTSPOT,mxCellMarker.prototype.hotspotEnabled=!1,mxCellMarker.prototype.validColor=null,mxCellMarker.prototype.invalidColor=null,mxCellMarker.prototype.currentColor=null,mxCellMarker.prototype.validState=null,mxCellMarker.prototype.markedState=null,mxCellMarker.prototype.setEnabled=function(t){this.enabled=t},mxCellMarker.prototype.isEnabled=function(){return this.enabled},mxCellMarker.prototype.setHotspot=function(t){this.hotspot=t},mxCellMarker.prototype.getHotspot=function(){return this.hotspot},mxCellMarker.prototype.setHotspotEnabled=function(t){this.hotspotEnabled=t},mxCellMarker.prototype.isHotspotEnabled=function(){return this.hotspotEnabled},mxCellMarker.prototype.hasValidState=function(){return null!=this.validState},mxCellMarker.prototype.getValidState=function(){return this.validState},mxCellMarker.prototype.getMarkedState=function(){return this.markedState},mxCellMarker.prototype.reset=function(){this.validState=null,null!=this.markedState&&(this.markedState=null,this.unmark())},mxCellMarker.prototype.process=function(t){var e=null;return this.isEnabled()&&(e=this.getState(t),this.setCurrentState(e,t)),e},mxCellMarker.prototype.setCurrentState=function(t,e,i){var n=null!=t&&this.isValidState(t);i=null!=i?i:this.getMarkerColor(e.getEvent(),t,n),this.validState=n?t:null,t==this.markedState&&i==this.currentColor||(this.currentColor=i,null!=t&&null!=this.currentColor?(this.markedState=t,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))},mxCellMarker.prototype.markCell=function(t,e){var i=this.graph.getView().getState(t);null!=i&&(this.currentColor=null!=e?e:this.validColor,this.markedState=i,this.mark())},mxCellMarker.prototype.mark=function(){this.highlight.setHighlightColor(this.currentColor),this.highlight.highlight(this.markedState),this.fireEvent(new mxEventObject(mxEvent.MARK,"state",this.markedState))},mxCellMarker.prototype.unmark=function(){this.mark()},mxCellMarker.prototype.isValidState=function(t){return!0},mxCellMarker.prototype.getMarkerColor=function(t,e,i){return i?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(t){var e=this.graph.getView(),i=this.getCell(t),n=this.getStateToMark(e.getState(i));return null!=n&&this.intersects(n,t)?n:null},mxCellMarker.prototype.getCell=function(t){return t.getCell()},mxCellMarker.prototype.getStateToMark=function(t){return t},mxCellMarker.prototype.intersects=function(t,e){return!this.hotspotEnabled||mxUtils.intersectsHotspot(t,e.getGraphX(),e.getGraphY(),this.hotspot,mxConstants.MIN_HOTSPOT_SIZE,mxConstants.MAX_HOTSPOT_SIZE)},mxCellMarker.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),this.highlight.destroy()},__mxOutput.mxCellMarker=void 0!==mxCellMarker?mxCellMarker:void 0,mxUtils.extend(mxSelectionCellsHandler,mxEventSource),mxSelectionCellsHandler.prototype.graph=null,mxSelectionCellsHandler.prototype.enabled=!0,mxSelectionCellsHandler.prototype.refreshHandler=null,mxSelectionCellsHandler.prototype.maxHandlers=100,mxSelectionCellsHandler.prototype.handlers=null,mxSelectionCellsHandler.prototype.isEnabled=function(){return this.enabled},mxSelectionCellsHandler.prototype.setEnabled=function(t){this.enabled=t},mxSelectionCellsHandler.prototype.getHandler=function(t){return this.handlers.get(t)},mxSelectionCellsHandler.prototype.reset=function(){this.handlers.visit((function(t,e){e.reset.apply(e)}))},mxSelectionCellsHandler.prototype.refresh=function(){var t=this.handlers;this.handlers=new mxDictionary;for(var e=this.graph.getSelectionCells(),i=0;ithis.graph.tolerance||Math.abs(e.getGraphY()-this.first.y)>this.graph.tolerance)&&this.updateCurrentState(e,s),null!=this.first){var o=null,l=s;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint?(o=this.constraintHandler.currentConstraint,l=this.constraintHandler.currentPoint.clone()):null!=this.previous&&!this.graph.isIgnoreTerminalEvent(e.getEvent())&&mxEvent.isShiftDown(e.getEvent())&&(Math.abs(this.previous.getCenterX()-s.x)0?this.waypoints[0]:l;null!=(m=this.getSourcePerimeterPoint(this.previous,c,e))&&(a=m)}}if(null==this.currentState&&this.movePreviewAway){var m=a;if(null!=this.edgeState&&this.edgeState.absolutePoints.length>=2){var g=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-2];null!=g&&(m=g)}var x=l.x-m.x,f=l.y-m.y,y=Math.sqrt(x*x+f*f);if(0==y)return;this.originalPoint=l.clone(),l.x-=4*x/y,l.y-=4*f/y}else this.originalPoint=null;if(null==this.shape){x=Math.abs(e.getGraphX()-this.first.x),f=Math.abs(e.getGraphY()-this.first.y);(x>this.graph.tolerance||f>this.graph.tolerance)&&(this.shape=this.createShape(),null!=this.edgeState&&this.shape.apply(this.edgeState),this.updateCurrentState(e,s))}if(null!=this.shape){if(null!=this.edgeState)this.shape.points=this.edgeState.absolutePoints;else{var v=[a];null!=this.waypoints&&(v=v.concat(this.waypoints)),v.push(l),this.shape.points=v}this.drawPreview()}null!=this.cursor&&(this.graph.container.style.cursor=this.cursor),mxEvent.consume(e.getEvent()),e.consume()}else this.isEnabled()&&this.graph.isEnabled()?this.previous!=this.currentState&&null==this.edgeState?(this.destroyIcons(),null!=this.currentState&&null==this.error&&null==this.constraintHandler.currentConstraint&&(this.icons=this.createIcons(this.currentState),null==this.icons&&(this.currentState.setCursor(mxConstants.CURSOR_CONNECT),e.consume())),this.previous=this.currentState):this.previous!=this.currentState||null==this.currentState||null!=this.icons||this.graph.isMouseDown||e.consume():this.constraintHandler.reset();if(!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(var C=!1,E=e.getSource(),S=0;S0?this.waypoints[this.waypoints.length-1]:new mxPoint(this.previous.getCenterX(),this.previous.getCenterY()),o=r(n.getPerimeterBounds(t),this.edgeState,s,!1);null!=o&&(i=o)}else i=new mxPoint(t.getCenterX(),t.getCenterY());return i},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(t,e,i){var n=null,r=t.view,s=r.getPerimeterFunction(t),o=new mxPoint(t.getCenterX(),t.getCenterY());if(null!=s){var l=mxUtils.getValue(t.style,mxConstants.STYLE_ROTATION,0),a=-l*(Math.PI/180);0!=l&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(a),Math.sin(a),o));var h=s(r.getPerimeterBounds(t),t,e,!1);null!=h&&(0!=l&&(h=mxUtils.getRotatedPoint(new mxPoint(h.x,h.y),Math.cos(-a),Math.sin(-a),o)),n=h)}else n=o;return n},mxConnectionHandler.prototype.updateIcons=function(t,e,i){},mxConnectionHandler.prototype.isStopEvent=function(t){return null!=t.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(t){var e=mxUtils.convertPoint(this.graph.container,t.getX(),t.getY()),i=Math.abs(e.x-this.first.x),n=Math.abs(e.y-this.first.y);if(null!=this.waypoints||this.mouseDownCounter>1&&(i>this.graph.tolerance||n>this.graph.tolerance)){null==this.waypoints&&(this.waypoints=[]);var r=this.graph.view.scale;e=new mxPoint(this.graph.snap(t.getGraphX()/r)*r,this.graph.snap(t.getGraphY()/r)*r);this.waypoints.push(e)}},mxConnectionHandler.prototype.checkConstraints=function(t,e){return null==t||null==e||null==t.point||null==e.point||!t.point.equals(e.point)||t.dx!=e.dx||t.dy!=e.dy||t.perimeter!=e.perimeter},mxConnectionHandler.prototype.mouseUp=function(t,e){if(!e.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(e))return this.addWaypointForEvent(e),void e.consume();var i=this.sourceConstraint,n=this.constraintHandler.currentConstraint,r=null!=this.previous?this.previous.cell:null,s=null;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(s=this.constraintHandler.currentFocus.cell),null==s&&null!=this.currentState&&(s=this.currentState.cell),null!=this.error||null!=r&&null!=s&&r==s&&!this.checkConstraints(i,n)?(null!=this.previous&&null!=this.marker.validState&&this.previous.cell==this.marker.validState.cell&&this.graph.selectCellForEvent(this.marker.source,e.getEvent()),null!=this.error&&this.error.length>0&&this.graph.validationAlert(this.error)):this.connect(r,s,e.getEvent(),e.getCell()),this.destroyIcons(),e.consume()}null!=this.first&&this.reset()},mxConnectionHandler.prototype.reset=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.cursor&&null!=this.graph.container&&(this.graph.container.style.cursor=""),this.destroyIcons(),this.marker.reset(),this.constraintHandler.reset(),this.originalPoint=null,this.currentPoint=null,this.edgeState=null,this.previous=null,this.error=null,this.sourceConstraint=null,this.mouseDownCounter=0,this.first=null,this.fireEvent(new mxEventObject(mxEvent.RESET))},mxConnectionHandler.prototype.drawPreview=function(){this.updatePreview(null==this.error),this.shape.redraw()},mxConnectionHandler.prototype.updatePreview=function(t){this.shape.strokewidth=this.getEdgeWidth(t),this.shape.stroke=this.getEdgeColor(t)},mxConnectionHandler.prototype.getEdgeColor=function(t){return t?mxConstants.VALID_COLOR:mxConstants.INVALID_COLOR},mxConnectionHandler.prototype.getEdgeWidth=function(t){return t?3:1},mxConnectionHandler.prototype.connect=function(t,e,i,n){if(null!=e||this.isCreateTarget(i)||this.graph.allowDanglingEdges){var r=this.graph.getModel(),s=!1,o=null;r.beginUpdate();try{if(null!=t&&null==e&&!this.graph.isIgnoreTerminalEvent(i)&&this.isCreateTarget(i)&&null!=(e=this.createTargetVertex(i,t))){if(n=this.graph.getDropTarget([e],i,n),s=!0,null!=n&&this.graph.getModel().isEdge(n))n=this.graph.getDefaultParent();else{var l=this.graph.getView().getState(n);if(null!=l)(p=r.getGeometry(e)).x-=l.origin.x,p.y-=l.origin.y}this.graph.addCell(e,n)}var a=this.graph.getDefaultParent();null!=t&&null!=e&&r.getParent(t)==r.getParent(e)&&r.getParent(r.getParent(t))!=r.getRoot()&&(a=r.getParent(t),null!=t.geometry&&t.geometry.relative&&null!=e.geometry&&e.geometry.relative&&(a=r.getParent(a)));var h=null,u=null;if(null!=this.edgeState&&(h=this.edgeState.cell.value,u=this.edgeState.cell.style),null!=(o=this.insertEdge(a,null,h,t,e,u))){this.graph.setConnectionConstraint(o,t,!0,this.sourceConstraint),this.graph.setConnectionConstraint(o,e,!1,this.constraintHandler.currentConstraint),null!=this.edgeState&&r.setGeometry(o,this.edgeState.cell.geometry);a=r.getParent(t);if(this.isInsertBefore(o,t,e,i,n)){for(var p=t;null!=p.parent&&null!=p.geometry&&p.geometry.relative&&p.parent!=o.parent;)p=this.graph.model.getParent(p);null!=p&&null!=p.parent&&p.parent==o.parent&&r.add(a,o,p.parent.getIndex(p))}var d=r.getGeometry(o);if(null==d&&((d=new mxGeometry).relative=!0,r.setGeometry(o,d)),null!=this.waypoints&&this.waypoints.length>0){var c=this.graph.view.scale,m=this.graph.view.translate;d.points=[];for(var g=0;g0){var a=this.graph.view.getState(e);if(null!=a){var h=a.x/s-r.x,u=a.y/s-r.y;Math.abs(h-i.x)<=l&&(i.x=Math.round(h)),Math.abs(u-i.y)<=l&&(i.y=Math.round(u))}}}return n},mxConnectionHandler.prototype.getAlignmentTolerance=function(t){return this.graph.isGridEnabled()?this.graph.gridSize/2:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(t,e,i,n){var r=null;if(null!=this.factoryMethod&&(r=this.factoryMethod(e,i,n)),null==r){(r=new mxCell(t||"")).setEdge(!0),r.setStyle(n);var s=new mxGeometry;s.relative=!0,r.setGeometry(s)}return r},mxConnectionHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getView().removeListener(this.changeHandler),this.changeHandler=null),null!=this.drillHandler&&(this.graph.removeListener(this.drillHandler),this.graph.getView().removeListener(this.drillHandler),this.drillHandler=null),null!=this.escapeHandler&&(this.graph.removeListener(this.escapeHandler),this.escapeHandler=null)},__mxOutput.mxConnectionHandler=void 0!==mxConnectionHandler?mxConnectionHandler:void 0,mxConstraintHandler.prototype.pointImage=new mxImage(mxClient.imageBasePath+"/point.gif",5,5),mxConstraintHandler.prototype.graph=null,mxConstraintHandler.prototype.enabled=!0,mxConstraintHandler.prototype.highlightColor=mxConstants.DEFAULT_VALID_COLOR,mxConstraintHandler.prototype.isEnabled=function(){return this.enabled},mxConstraintHandler.prototype.setEnabled=function(t){this.enabled=t},mxConstraintHandler.prototype.reset=function(){if(null!=this.focusIcons){for(var t=0;ta||Math.abs(l)>a)&&(null==this.div&&(this.div=this.createShape()),mxUtils.clearSelection(),this.update(r,s),e.consume())}},mxRubberband.prototype.createShape=function(){null==this.sharedDiv&&(this.sharedDiv=document.createElement("div"),this.sharedDiv.className="mxRubberband",mxUtils.setOpacity(this.sharedDiv,this.defaultOpacity)),this.graph.container.appendChild(this.sharedDiv);var t=this.sharedDiv;return mxClient.IS_SVG&&(!mxClient.IS_IE||document.documentMode>=10)&&this.fadeOut&&(this.sharedDiv=null),t},mxRubberband.prototype.isActive=function(t,e){return null!=this.div&&"none"!=this.div.style.display},mxRubberband.prototype.mouseUp=function(t,e){var i=this.isActive();this.reset(),i&&(this.execute(e.getEvent()),e.consume())},mxRubberband.prototype.execute=function(t){var e=new mxRectangle(this.x,this.y,this.width,this.height);this.graph.selectRegion(e,t)},mxRubberband.prototype.reset=function(){if(null!=this.div)if(mxClient.IS_SVG&&(!mxClient.IS_IE||document.documentMode>=10)&&this.fadeOut){var t=this.div;mxUtils.setPrefixedStyle(t.style,"transition","all 0.2s linear"),t.style.pointerEvents="none",t.style.opacity=0,window.setTimeout((function(){t.parentNode.removeChild(t)}),200)}else this.div.parentNode.removeChild(this.div);mxEvent.removeGestureListeners(document,null,this.dragHandler,this.dropHandler),this.dragHandler=null,this.dropHandler=null,this.currentX=0,this.currentY=0,this.first=null,this.div=null},mxRubberband.prototype.update=function(t,e){this.currentX=t,this.currentY=e,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var t=this.currentX-this.graph.panDx,e=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,t),this.y=Math.min(this.first.y,e),this.width=Math.max(this.first.x,t)-this.x,this.height=Math.max(this.first.y,e)-this.y;var i=mxClient.IS_VML?this.graph.panDx:0,n=mxClient.IS_VML?this.graph.panDy:0;this.div.style.left=this.x+i+"px",this.div.style.top=this.y+n+"px",this.div.style.width=Math.max(1,this.width)+"px",this.div.style.height=Math.max(1,this.height)+"px"}},mxRubberband.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),this.graph.removeListener(this.forceRubberbandHandler),this.graph.removeListener(this.panHandler),this.reset(),null!=this.sharedDiv&&(this.sharedDiv=null))},__mxOutput.mxRubberband=void 0!==mxRubberband?mxRubberband:void 0,mxHandle.prototype.cursor="default",mxHandle.prototype.image=null,mxHandle.prototype.ignoreGrid=!1,mxHandle.prototype.getPosition=function(t){},mxHandle.prototype.setPosition=function(t,e,i){},mxHandle.prototype.execute=function(){},mxHandle.prototype.copyStyle=function(t){this.graph.setCellStyles(t,this.state.style[t],[this.state.cell])},mxHandle.prototype.processEvent=function(t){var e=this.graph.view.scale,i=this.graph.view.translate,n=new mxPoint(t.getGraphX()/e-i.x,t.getGraphY()/e-i.y);null!=this.shape&&null!=this.shape.bounds&&(n.x-=this.shape.bounds.width/e/4,n.y-=this.shape.bounds.height/e/4);var r=-mxUtils.toRadians(this.getRotation()),s=-mxUtils.toRadians(this.getTotalRotation())-r;n=this.flipPoint(this.rotatePoint(this.snapPoint(this.rotatePoint(n,r),this.ignoreGrid||!this.graph.isGridEnabledEvent(t.getEvent())),s)),this.setPosition(this.state.getPaintBounds(),n,t),this.positionChanged(),this.redraw()},mxHandle.prototype.positionChanged=function(){null!=this.state.text&&this.state.text.apply(this.state),null!=this.state.shape&&this.state.shape.apply(this.state),this.graph.cellRenderer.redraw(this.state,!0)},mxHandle.prototype.getRotation=function(){return null!=this.state.shape?this.state.shape.getRotation():0},mxHandle.prototype.getTotalRotation=function(){return null!=this.state.shape?this.state.shape.getShapeRotation():0},mxHandle.prototype.init=function(){var t=this.isHtmlRequired();null!=this.image?(this.shape=new mxImageShape(new mxRectangle(0,0,this.image.width,this.image.height),this.image.src),this.shape.preserveImageAspect=!1):this.shape=this.createShape(t),this.initShape(t)},mxHandle.prototype.createShape=function(t){return new mxRectangleShape(new mxRectangle(0,0,mxConstants.HANDLE_SIZE,mxConstants.HANDLE_SIZE),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxHandle.prototype.initShape=function(t){t&&this.shape.isHtmlAllowed()?(this.shape.dialect=mxConstants.DIALECT_STRICTHTML,this.shape.init(this.graph.container)):(this.shape.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,null!=this.cursor&&this.shape.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(this.shape.node,this.graph,this.state),this.shape.node.style.cursor=this.cursor},mxHandle.prototype.redraw=function(){if(null!=this.shape&&null!=this.state.shape){var t=this.getPosition(this.state.getPaintBounds());if(null!=t){var e=mxUtils.toRadians(this.getTotalRotation());t=this.rotatePoint(this.flipPoint(t),e);var i=this.graph.view.scale,n=this.graph.view.translate;this.shape.bounds.x=Math.floor((t.x+n.x)*i-this.shape.bounds.width/2),this.shape.bounds.y=Math.floor((t.y+n.y)*i-this.shape.bounds.height/2),this.shape.redraw()}}},mxHandle.prototype.isHtmlRequired=function(){return null!=this.state.text&&this.state.text.node.parentNode==this.graph.container},mxHandle.prototype.rotatePoint=function(t,e){var i=this.state.getCellBounds(),n=new mxPoint(i.getCenterX(),i.getCenterY()),r=Math.cos(e),s=Math.sin(e);return mxUtils.getRotatedPoint(t,r,s,n)},mxHandle.prototype.flipPoint=function(t){if(null!=this.state.shape){var e=this.state.getCellBounds();this.state.shape.flipH&&(t.x=2*e.x+e.width-t.x),this.state.shape.flipV&&(t.y=2*e.y+e.height-t.y)}return t},mxHandle.prototype.snapPoint=function(t,e){return e||(t.x=this.graph.snap(t.x),t.y=this.graph.snap(t.y)),t},mxHandle.prototype.setVisible=function(t){null!=this.shape&&null!=this.shape.node&&(this.shape.node.style.display=t?"":"none")},mxHandle.prototype.reset=function(){this.setVisible(!0),this.state.style=this.graph.getCellStyle(this.state.cell),this.positionChanged()},mxHandle.prototype.destroy=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null)},__mxOutput.mxHandle=void 0!==mxHandle?mxHandle:void 0,mxVertexHandler.prototype.graph=null,mxVertexHandler.prototype.state=null,mxVertexHandler.prototype.singleSizer=!1,mxVertexHandler.prototype.index=null,mxVertexHandler.prototype.allowHandleBoundsCheck=!0,mxVertexHandler.prototype.handleImage=null,mxVertexHandler.prototype.tolerance=0,mxVertexHandler.prototype.rotationEnabled=!1,mxVertexHandler.prototype.parentHighlightEnabled=!1,mxVertexHandler.prototype.rotationRaster=!0,mxVertexHandler.prototype.rotationCursor="crosshair",mxVertexHandler.prototype.livePreview=!1,mxVertexHandler.prototype.manageSizers=!1,mxVertexHandler.prototype.constrainGroupByChildren=!1,mxVertexHandler.prototype.rotationHandleVSpacing=-16,mxVertexHandler.prototype.horizontalOffset=0,mxVertexHandler.prototype.verticalOffset=0,mxVertexHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.selectionBorder=this.createSelectionShape(this.bounds),this.selectionBorder.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.pointerEvents=!1,this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.selectionBorder.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.graph,this.state),this.graph.isCellMovable(this.state.cell)&&this.selectionBorder.setCursor(mxConstants.CURSOR_MOVABLE_VERTEX),mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()=2&&this.state.height>=2){var e=0;t&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",e++)),this.sizers.push(this.createSizer("n-resize",e++)),this.sizers.push(this.createSizer("ne-resize",e++)),this.sizers.push(this.createSizer("w-resize",e++)),this.sizers.push(this.createSizer("e-resize",e++)),this.sizers.push(this.createSizer("sw-resize",e++)),this.sizers.push(this.createSizer("s-resize",e++))),this.sizers.push(this.createSizer("se-resize",e++)));var i=this.graph.model.getGeometry(this.state.cell);null==i||i.relative||this.graph.isSwimlane(this.state.cell)||!this.graph.isLabelMovable(this.state.cell)||(this.labelShape=this.createSizer(mxConstants.CURSOR_LABEL_HANDLE,mxEvent.LABEL_HANDLE,mxConstants.LABEL_HANDLE_SIZE,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}else this.graph.isCellMovable(this.state.cell)&&!this.graph.isCellResizable(this.state.cell)&&this.state.width<2&&this.state.height<2&&(this.labelShape=this.createSizer(mxConstants.CURSOR_MOVABLE_VERTEX,mxEvent.LABEL_HANDLE,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}this.isRotationHandleVisible()&&(this.rotationShape=this.createSizer(this.rotationCursor,mxEvent.ROTATION_HANDLE,mxConstants.HANDLE_SIZE+3,mxConstants.HANDLE_FILLCOLOR),this.sizers.push(this.rotationShape)),this.customHandles=this.createCustomHandles(),this.redraw(),this.constrainGroupByChildren&&this.updateMinBounds()},mxVertexHandler.prototype.isRotationHandleVisible=function(){return this.graph.isEnabled()&&this.rotationEnabled&&this.graph.isCellRotatable(this.state.cell)&&(mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()=2&&this.state.height>=2},mxVertexHandler.prototype.isConstrainedEvent=function(t){return mxEvent.isShiftDown(t.getEvent())||"fixed"==this.state.style[mxConstants.STYLE_ASPECT]},mxVertexHandler.prototype.isCenteredEvent=function(t,e){return!1},mxVertexHandler.prototype.createCustomHandles=function(){return null},mxVertexHandler.prototype.updateMinBounds=function(){var t=this.graph.getChildCells(this.state.cell);if(t.length>0&&(this.minBounds=this.graph.view.getBounds(t),null!=this.minBounds)){var e=this.state.view.scale,i=this.state.view.translate;this.minBounds.x-=this.state.x,this.minBounds.y-=this.state.y,this.minBounds.x/=e,this.minBounds.y/=e,this.minBounds.width/=e,this.minBounds.height/=e,this.x0=this.state.x/e-i.x,this.y0=this.state.y/e-i.y}},mxVertexHandler.prototype.getSelectionBounds=function(t){return new mxRectangle(Math.round(t.x),Math.round(t.y),Math.round(t.width),Math.round(t.height))},mxVertexHandler.prototype.createParentHighlightShape=function(t){return this.createSelectionShape(t)},mxVertexHandler.prototype.createSelectionShape=function(t){var e=new mxRectangleShape(t,null,this.getSelectionColor());return e.strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxVertexHandler.prototype.getSelectionColor=function(){return mxConstants.VERTEX_SELECTION_COLOR},mxVertexHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.VERTEX_SELECTION_STROKEWIDTH},mxVertexHandler.prototype.isSelectionDashed=function(){return mxConstants.VERTEX_SELECTION_DASHED},mxVertexHandler.prototype.createSizer=function(t,e,i,n){var r=new mxRectangle(0,0,i=i||mxConstants.HANDLE_SIZE,i),s=this.createSizerShape(r,e,n);return s.isHtmlAllowed()&&null!=this.state.text&&this.state.text.node.parentNode==this.graph.container?(s.bounds.height-=1,s.bounds.width-=1,s.dialect=mxConstants.DIALECT_STRICTHTML,s.init(this.graph.container)):(s.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,s.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(s.node,this.graph,this.state),this.graph.isEnabled()&&s.setCursor(t),this.isSizerVisible(e)||(s.visible=!1),s},mxVertexHandler.prototype.isSizerVisible=function(t){return!0},mxVertexHandler.prototype.createSizerShape=function(t,e,i){if(null!=this.handleImage){var n=new mxImageShape(t=new mxRectangle(t.x,t.y,this.handleImage.width,this.handleImage.height),this.handleImage.src);return n.preserveImageAspect=!1,n}return e==mxEvent.ROTATION_HANDLE?new mxEllipse(t,i||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(t,i||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(t,e,i){null!=t&&(t.bounds.x=Math.floor(e-t.bounds.width/2),t.bounds.y=Math.floor(i-t.bounds.height/2),null!=t.node&&"none"!=t.node.style.display&&t.redraw())},mxVertexHandler.prototype.getHandleForEvent=function(t){var e=mxEvent.isMouseEvent(t.getEvent())?1:this.tolerance,i=this.allowHandleBoundsCheck&&(mxClient.IS_IE||e>0)?new mxRectangle(t.getGraphX()-e,t.getGraphY()-e,2*e,2*e):null;function n(e){return null!=e&&(t.isSource(e)||null!=i&&mxUtils.intersects(e.bounds,i)&&"none"!=e.node.style.display&&"hidden"!=e.node.style.visibility)}if(null!=this.customHandles&&this.isCustomHandleEvent(t))for(var r=this.customHandles.length-1;r>=0;r--)if(n(this.customHandles[r].shape))return mxEvent.CUSTOM_HANDLE-r;if(n(this.rotationShape))return mxEvent.ROTATION_HANDLE;if(n(this.labelShape))return mxEvent.LABEL_HANDLE;if(null!=this.sizers)for(r=0;r0||e.getState()==this.state)){var n=this.getHandleForEvent(e);null!=n&&(this.start(e.getGraphX(),e.getGraphY(),n),e.consume())}},mxVertexHandler.prototype.isLivePreviewBorder=function(){return null!=this.state.shape&&null==this.state.shape.fill&&null==this.state.shape.stroke},mxVertexHandler.prototype.start=function(t,e,i){if(null!=this.selectionBorder){this.livePreviewActive=this.livePreview&&0==this.graph.model.getChildCount(this.state.cell),this.inTolerance=!0,this.childOffsetX=0,this.childOffsetY=0,this.index=i,this.startX=t,this.startY=e;var n=this.state.view.graph.model,r=n.getParent(this.state.cell);if(this.state.view.currentRoot!=r&&(n.isVertex(r)||n.isEdge(r))&&(this.parentState=this.state.view.graph.view.getState(r)),this.selectionBorder.node.style.display=i==mxEvent.ROTATION_HANDLE?"inline":"none",this.livePreviewActive&&!this.isLivePreviewBorder()||(this.preview=this.createSelectionShape(this.bounds),mxClient.IS_SVG&&0!=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")||null==this.state.text||this.state.text.node.parentNode!=this.graph.container?(this.preview.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.preview.init(this.graph.view.getOverlayPane())):(this.preview.dialect=mxConstants.DIALECT_STRICTHTML,this.preview.init(this.graph.container))),i==mxEvent.ROTATION_HANDLE){var s=this.getRotationHandlePosition(),o=s.x-this.state.getCenterX(),l=s.y-this.state.getCenterY();this.startAngle=0!=o?180*Math.atan(l/o)/Math.PI+90:l<0?180:0,this.startDist=Math.sqrt(o*o+l*l)}if(this.livePreviewActive){this.hideSizers(),i==mxEvent.ROTATION_HANDLE?this.rotationShape.node.style.display="":i==mxEvent.LABEL_HANDLE?this.labelShape.node.style.display="":null!=this.sizers&&null!=this.sizers[i]?this.sizers[i].node.style.display="":i<=mxEvent.CUSTOM_HANDLE&&null!=this.customHandles&&this.customHandles[mxEvent.CUSTOM_HANDLE-i].setVisible(!0);var a=this.graph.getEdges(this.state.cell);this.edgeHandlers=[];for(var h=0;hthis.graph.tolerance||Math.abs(t.getGraphY()-this.startY)>this.graph.tolerance)&&(this.inTolerance=!1)},mxVertexHandler.prototype.updateHint=function(t){},mxVertexHandler.prototype.removeHint=function(){},mxVertexHandler.prototype.roundAngle=function(t){return Math.round(10*t)/10},mxVertexHandler.prototype.roundLength=function(t){return Math.round(100*t)/100},mxVertexHandler.prototype.mouseMove=function(t,e){e.isConsumed()||null==this.index?this.graph.isMouseDown||null==this.getHandleForEvent(e)||e.consume(!1):(this.checkTolerance(e),this.inTolerance||(this.index<=mxEvent.CUSTOM_HANDLE?null!=this.customHandles&&(this.customHandles[mxEvent.CUSTOM_HANDLE-this.index].processEvent(e),this.customHandles[mxEvent.CUSTOM_HANDLE-this.index].active=!0):this.index==mxEvent.LABEL_HANDLE?this.moveLabel(e):this.index==mxEvent.ROTATION_HANDLE?this.rotateVertex(e):this.resizeVertex(e),this.updateHint(e)),e.consume())},mxVertexHandler.prototype.moveLabel=function(t){var e=new mxPoint(t.getGraphX(),t.getGraphY()),i=this.graph.view.translate,n=this.graph.view.scale;this.graph.isGridEnabledEvent(t.getEvent())&&(e.x=(this.graph.snap(e.x/n-i.x)+i.x)*n,e.y=(this.graph.snap(e.y/n-i.y)+i.y)*n);var r=null!=this.rotationShape?this.sizers.length-2:this.sizers.length-1;this.moveSizerTo(this.sizers[r],e.x,e.y)},mxVertexHandler.prototype.rotateVertex=function(t){var e=new mxPoint(t.getGraphX(),t.getGraphY()),i=this.state.x+this.state.width/2-e.x,n=this.state.y+this.state.height/2-e.y;if(this.currentAlpha=0!=i?180*Math.atan(n/i)/Math.PI+90:n<0?180:0,i>0&&(this.currentAlpha-=180),this.currentAlpha-=this.startAngle,this.rotationRaster&&this.graph.isGridEnabledEvent(t.getEvent())){i=e.x-this.state.getCenterX(),n=e.y-this.state.getCenterY();var r=Math.sqrt(i*i+n*n);r-this.startDist<2?raster=15:r-this.startDist<25?raster=5:raster=1,this.currentAlpha=Math.round(this.currentAlpha/raster)*raster}else this.currentAlpha=this.roundAngle(this.currentAlpha);this.selectionBorder.rotation=this.currentAlpha,this.selectionBorder.redraw(),this.livePreviewActive&&this.redrawHandles()},mxVertexHandler.prototype.resizeVertex=function(t){var e=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),n=new mxPoint(t.getGraphX(),t.getGraphY()),r=this.graph.view.translate,s=this.graph.view.scale,o=Math.cos(-i),l=Math.sin(-i),a=l*(m=n.x-this.startX)+o*(g=n.y-this.startY);m=o*m-l*g,g=a;var h=this.graph.getCellGeometry(this.state.cell);if(this.unscaledBounds=this.union(h,m/s,g/s,this.index,this.graph.isGridEnabledEvent(t.getEvent()),1,new mxPoint(0,0),this.isConstrainedEvent(t),this.isCenteredEvent(this.state,t)),!h.relative){var u=this.graph.getMaximumGraphBounds();if(null!=u&&null!=this.parentState&&((u=mxRectangle.fromRectangle(u)).x-=(this.parentState.x-r.x*s)/s,u.y-=(this.parentState.y-r.y*s)/s),this.graph.isConstrainChild(this.state.cell)){var p=this.graph.getCellContainmentArea(this.state.cell);if(null!=p){var d=this.graph.getOverlap(this.state.cell);d>0&&((p=mxRectangle.fromRectangle(p)).x-=p.width*d,p.y-=p.height*d,p.width+=2*p.width*d,p.height+=2*p.height*d),null==u?u=p:(u=mxRectangle.fromRectangle(u)).intersect(p)}}null!=u&&(this.unscaledBounds.xu.x+u.width&&(this.unscaledBounds.width-=this.unscaledBounds.x+this.unscaledBounds.width-u.x-u.width),this.unscaledBounds.y+this.unscaledBounds.height>u.y+u.height&&(this.unscaledBounds.height-=this.unscaledBounds.y+this.unscaledBounds.height-u.y-u.height))}var c=this.bounds;this.bounds=new mxRectangle((null!=this.parentState?this.parentState.x:r.x*s)+this.unscaledBounds.x*s,(null!=this.parentState?this.parentState.y:r.y*s)+this.unscaledBounds.y*s,this.unscaledBounds.width*s,this.unscaledBounds.height*s),h.relative&&null!=this.parentState&&(this.bounds.x+=this.state.x-this.parentState.x,this.bounds.y+=this.state.y-this.parentState.y),o=Math.cos(i),l=Math.sin(i);var m,g,x=new mxPoint(this.bounds.getCenterX(),this.bounds.getCenterY()),f=o*(m=x.x-e.x)-l*(g=x.y-e.y)-m,y=l*m+o*g-g,v=this.bounds.x-this.state.x,C=this.bounds.y-this.state.y,E=o*v-l*C,S=l*v+o*C;this.bounds.x+=f,this.bounds.y+=y,this.unscaledBounds.x=this.roundLength(this.unscaledBounds.x+f/s),this.unscaledBounds.y=this.roundLength(this.unscaledBounds.y+y/s),this.unscaledBounds.width=this.roundLength(this.unscaledBounds.width),this.unscaledBounds.height=this.roundLength(this.unscaledBounds.height),this.graph.isCellCollapsed(this.state.cell)||0==f&&0==y?(this.childOffsetX=0,this.childOffsetY=0):(this.childOffsetX=this.state.x-this.bounds.x+E,this.childOffsetY=this.state.y-this.bounds.y+S),c.equals(this.bounds)||(this.livePreviewActive&&this.updateLivePreview(t),null!=this.preview&&this.drawPreview())},mxVertexHandler.prototype.updateLivePreview=function(t){var e=this.graph.view.scale,i=this.graph.view.translate,n=this.state.clone();this.state.x=this.bounds.x,this.state.y=this.bounds.y,this.state.origin=new mxPoint(this.state.x/e-i.x,this.state.y/e-i.y),this.state.width=this.bounds.width,this.state.height=this.bounds.height;var r=this.state.absoluteOffset;r=new mxPoint(r.x,r.y),this.state.absoluteOffset.x=0,this.state.absoluteOffset.y=0;var s=this.graph.getCellGeometry(this.state.cell);if(null!=s){var o=s.offset||this.EMPTY_POINT;null==o||s.relative||(this.state.absoluteOffset.x=this.state.view.scale*o.x,this.state.absoluteOffset.y=this.state.view.scale*o.y),this.state.view.updateVertexLabelOffset(this.state)}this.state.view.graph.cellRenderer.redraw(this.state,!0),this.state.view.invalidate(this.state.cell),this.state.invalid=!1,this.state.view.validate(),this.redrawHandles(),null!=this.state.control&&null!=this.state.control.node&&(this.state.control.node.style.visibility="hidden"),this.state.setState(n)},mxVertexHandler.prototype.mouseUp=function(t,e){if(null!=this.index&&null!=this.state){var i=new mxPoint(e.getGraphX(),e.getGraphY()),n=this.index;this.index=null,this.graph.getModel().beginUpdate();try{if(n<=mxEvent.CUSTOM_HANDLE)null!=this.customHandles&&(this.customHandles[mxEvent.CUSTOM_HANDLE-n].active=!1,this.customHandles[mxEvent.CUSTOM_HANDLE-n].execute());else if(n==mxEvent.ROTATION_HANDLE)if(null!=this.currentAlpha){var r=this.currentAlpha-(this.state.style[mxConstants.STYLE_ROTATION]||0);0!=r&&this.rotateCell(this.state.cell,r)}else this.rotateClick();else{var s=this.graph.isGridEnabledEvent(e.getEvent()),o=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),l=Math.cos(-o),a=Math.sin(-o),h=i.x-this.startX,u=i.y-this.startY,p=a*h+l*u;h=l*h-a*u,u=p;var d=this.graph.view.scale,c=this.isRecursiveResize(this.state,e);this.resizeCell(this.state.cell,this.roundLength(h/d),this.roundLength(u/d),n,s,this.isConstrainedEvent(e),c)}}finally{this.graph.getModel().endUpdate()}e.consume(),this.reset()}},mxVertexHandler.prototype.isRecursiveResize=function(t,e){return this.graph.isRecursiveResize(this.state)},mxVertexHandler.prototype.rotateClick=function(){},mxVertexHandler.prototype.rotateCell=function(t,e,i){if(0!=e){var n=this.graph.getModel();if(n.isVertex(t)||n.isEdge(t)){if(!n.isEdge(t)){var r=this.graph.view.getState(t),s=null!=r?r.style:this.graph.getCellStyle(t);if(null!=s){var o=(s[mxConstants.STYLE_ROTATION]||0)+e;this.graph.setCellStyles(mxConstants.STYLE_ROTATION,o,[t])}}var l=this.graph.getCellGeometry(t);if(null!=l){var a=this.graph.getCellGeometry(i);if(null==a||n.isEdge(i)||((l=l.clone()).rotate(e,new mxPoint(a.width/2,a.height/2)),n.setGeometry(t,l)),n.isVertex(t)&&!l.relative||n.isEdge(t))for(var h=n.getChildCount(t),u=0;u4?(f+=i,f=r?this.graph.snap(f/s)*s:Math.round(f/s)*s):n<3&&(x+=i,x=r?this.graph.snap(x/s)*s:Math.round(x/s)*s),0==n||3==n||5==n?(m+=e,m=r?this.graph.snap(m/s)*s:Math.round(m/s)*s):2!=n&&4!=n&&7!=n||(g+=e,g=r?this.graph.snap(g/s)*s:Math.round(g/s)*s);var C=g-m,E=f-x;if(l){var S=this.graph.getCellGeometry(this.state.cell);if(null!=S){var b=S.width/S.height;1==n||2==n||7==n||6==n?C=E*b:E=C/b,0==n&&(m=g-C,x=f-E)}}if(a){var T=y-(m+(C+=C-d)/2),w=v-(x+(E+=E-c)/2);m+=T,x+=w,g+=T,f+=w}C<0&&(m+=C,C=Math.abs(C)),E<0&&(x+=E,E=Math.abs(E));var L=new mxRectangle(m+o.x*s,x+o.y*s,C,E);return null!=this.minBounds&&(L.width=Math.max(L.width,this.minBounds.x*s+this.minBounds.width*s+Math.max(0,this.x0*s-L.x)),L.height=Math.max(L.height,this.minBounds.y*s+this.minBounds.height*s+Math.max(0,this.y0*s-L.y))),L},mxVertexHandler.prototype.redraw=function(t){this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.drawPreview(),t||this.redrawHandles()},mxVertexHandler.prototype.getHandlePadding=function(){var t=new mxPoint(0,0),e=this.tolerance;return null!=this.sizers&&this.sizers.length>0&&null!=this.sizers[0]&&(this.bounds.width<2*this.sizers[0].bounds.width+2*e||this.bounds.height<2*this.sizers[0].bounds.height+2*e)&&(e/=2,t.x=this.sizers[0].bounds.width+e,t.y=this.sizers[0].bounds.height+e),t},mxVertexHandler.prototype.redrawHandles=function(){var t=this.tolerance;this.horizontalOffset=0,this.verticalOffset=0;var e=this.bounds;if(null!=this.sizers&&this.sizers.length>0&&null!=this.sizers[0]){if(null==this.index&&this.manageSizers&&this.sizers.length>=8){var i=this.getHandlePadding();this.horizontalOffset=i.x,this.verticalOffset=i.y,0==this.horizontalOffset&&0==this.verticalOffset||((e=new mxRectangle(e.x,e.y,e.width,e.height)).x-=this.horizontalOffset/2,e.width+=this.horizontalOffset,e.y-=this.verticalOffset/2,e.height+=this.verticalOffset),this.sizers.length>=8&&(e.width<2*this.sizers[0].bounds.width+2*t||e.height<2*this.sizers[0].bounds.height+2*t?(this.sizers[0].node.style.display="none",this.sizers[2].node.style.display="none",this.sizers[5].node.style.display="none",this.sizers[7].node.style.display="none"):(this.sizers[0].node.style.display="",this.sizers[2].node.style.display="",this.sizers[5].node.style.display="",this.sizers[7].node.style.display=""))}var n=e.x+e.width,r=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],n,r);else{var s=e.x+e.width/2,o=e.y+e.height/2;if(this.sizers.length>=8){var l=["nw-resize","n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize"],a=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),h=Math.cos(a),u=Math.sin(a),p=Math.round(4*a/Math.PI),d=new mxPoint(e.getCenterX(),e.getCenterY()),c=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),h,u,d);this.moveSizerTo(this.sizers[0],c.x,c.y),this.sizers[0].setCursor(l[mxUtils.mod(0+p,l.length)]),c.x=s,c.y=e.y,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[1],c.x,c.y),this.sizers[1].setCursor(l[mxUtils.mod(1+p,l.length)]),c.x=n,c.y=e.y,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[2],c.x,c.y),this.sizers[2].setCursor(l[mxUtils.mod(2+p,l.length)]),c.x=e.x,c.y=o,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[3],c.x,c.y),this.sizers[3].setCursor(l[mxUtils.mod(7+p,l.length)]),c.x=n,c.y=o,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[4],c.x,c.y),this.sizers[4].setCursor(l[mxUtils.mod(3+p,l.length)]),c.x=e.x,c.y=r,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[5],c.x,c.y),this.sizers[5].setCursor(l[mxUtils.mod(6+p,l.length)]),c.x=s,c.y=r,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[6],c.x,c.y),this.sizers[6].setCursor(l[mxUtils.mod(5+p,l.length)]),c.x=n,c.y=r,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[7],c.x,c.y),this.sizers[7].setCursor(l[mxUtils.mod(4+p,l.length)]),c.x=s+this.state.absoluteOffset.x,c.y=o+this.state.absoluteOffset.y,c=mxUtils.getRotatedPoint(c,h,u,d),this.moveSizerTo(this.sizers[8],c.x,c.y)}else this.state.width>=2&&this.state.height>=2?this.moveSizerTo(this.sizers[0],s+this.state.absoluteOffset.x,o+this.state.absoluteOffset.y):this.moveSizerTo(this.sizers[0],this.state.x,this.state.y)}}if(null!=this.rotationShape){a=mxUtils.toRadians(null!=this.currentAlpha?this.currentAlpha:this.state.style[mxConstants.STYLE_ROTATION]||"0"),h=Math.cos(a),u=Math.sin(a),d=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),c=mxUtils.getRotatedPoint(this.getRotationHandlePosition(),h,u,d);null!=this.rotationShape.node&&(this.moveSizerTo(this.rotationShape,c.x,c.y),this.rotationShape.node.style.visibility=this.state.view.graph.isEditing()?"hidden":"")}if(null!=this.selectionBorder&&(this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")),null!=this.edgeHandlers)for(var m=0;m0)?new mxRectangle(t.getGraphX()-e,t.getGraphY()-e,2*e,2*e):null,n=null,r=null;function s(e){if(null!=e&&null!=e.node&&"none"!=e.node.style.display&&"hidden"!=e.node.style.visibility&&(t.isSource(e)||null!=i&&mxUtils.intersects(e.bounds,i))){var r=t.getGraphX()-e.bounds.getCenterX(),s=t.getGraphY()-e.bounds.getCenterY(),o=r*r+s*s;if(null==n||o<=n)return n=o,!0}return!1}if(null!=this.customHandles&&this.isCustomHandleEvent(t))for(var o=this.customHandles.length-1;o>=0;o--)if(s(this.customHandles[o].shape))return mxEvent.CUSTOM_HANDLE-o;if((t.isSource(this.state.text)||s(this.labelShape))&&(r=mxEvent.LABEL_HANDLE),null!=this.bends)for(o=0;omxEvent.VIRTUAL_HANDLE&&null!=this.customHandles)for(var s=0;s0&&this.isSnapToTerminalsEvent(t)){function l(t){if(null!=t){var e=t.x;Math.abs(n.x-e)0&&imxEvent.VIRTUAL_HANDLE&&(s[this.index-1]=o)}return null!=l?l:s},mxEdgeHandler.prototype.isOutlineConnectEvent=function(t){var e=mxUtils.getOffset(this.graph.container),i=t.getEvent(),n=mxEvent.getClientX(i),r=mxEvent.getClientY(i),s=document.documentElement,o=(window.pageXOffset||s.scrollLeft)-(s.clientLeft||0),l=(window.pageYOffset||s.scrollTop)-(s.clientTop||0),a=this.currentPoint.x-this.graph.container.scrollLeft+e.x-o,h=this.currentPoint.y-this.graph.container.scrollTop+e.y-l;return this.outlineConnect&&!mxEvent.isShiftDown(t.getEvent())&&(t.isSource(this.marker.highlight.shape)||mxEvent.isAltDown(t.getEvent())&&null!=t.getState()||this.marker.highlight.isHighlightAt(n,r)||(a!=n||h!=r)&&null==t.getState()&&this.marker.highlight.isHighlightAt(a,h))},mxEdgeHandler.prototype.updatePreviewState=function(t,e,i,n,r){var s=this.isSource?i:this.state.getVisibleTerminalState(!0),o=this.isTarget?i:this.state.getVisibleTerminalState(!1),l=this.graph.getConnectionConstraint(t,s,!0),a=this.graph.getConnectionConstraint(t,o,!1),h=this.constraintHandler.currentConstraint;if(null==h&&r&&(null!=i?(n.isSource(this.marker.highlight.shape)&&(e=new mxPoint(n.getGraphX(),n.getGraphY())),h=this.graph.getOutlineConstraint(e,i,n),this.constraintHandler.setFocus(n,i,this.isSource),this.constraintHandler.currentConstraint=h,this.constraintHandler.currentPoint=e):h=new mxConnectionConstraint),this.outlineConnect&&null!=this.marker.highlight&&null!=this.marker.highlight.shape){var u=this.graph.view.scale;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus?(this.marker.highlight.shape.stroke=r?mxConstants.OUTLINE_HIGHLIGHT_COLOR:"transparent",this.marker.highlight.shape.strokewidth=mxConstants.OUTLINE_HIGHLIGHT_STROKEWIDTH/u/u,this.marker.highlight.repaint()):this.marker.hasValidState()&&(this.marker.highlight.shape.stroke=this.marker.getValidState()==n.getState()?mxConstants.DEFAULT_VALID_COLOR:"transparent",this.marker.highlight.shape.strokewidth=mxConstants.HIGHLIGHT_STROKEWIDTH/u/u,this.marker.highlight.repaint())}this.isSource?l=h:this.isTarget&&(a=h),(this.isSource||this.isTarget)&&(null!=h&&null!=h.point?(t.style[this.isSource?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X]=h.point.x,t.style[this.isSource?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y]=h.point.y):(delete t.style[this.isSource?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X],delete t.style[this.isSource?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y])),t.setVisibleTerminalState(s,!0),t.setVisibleTerminalState(o,!1),this.isSource&&null==s||t.view.updateFixedTerminalPoint(t,s,!0,l),this.isTarget&&null==o||t.view.updateFixedTerminalPoint(t,o,!1,a),(this.isSource||this.isTarget)&&null==i&&(t.setAbsoluteTerminalPoint(e,this.isSource),null==this.marker.getMarkedState()&&(this.error=this.graph.allowDanglingEdges?null:"")),t.view.updatePoints(t,this.points,s,o),t.view.updateFloatingTerminalPoints(t,s,o)},mxEdgeHandler.prototype.mouseMove=function(t,e){if(null!=this.index&&null!=this.marker){if(this.currentPoint=this.getPointForEvent(e),this.error=null,!this.graph.isIgnoreTerminalEvent(e.getEvent())&&mxEvent.isShiftDown(e.getEvent())&&null!=this.snapPoint&&(Math.abs(this.snapPoint.x-this.currentPoint.x)mxEvent.VIRTUAL_HANDLE)null!=this.customHandles&&this.customHandles[mxEvent.CUSTOM_HANDLE-this.index].processEvent(e);else if(this.isLabel)this.label.x=this.currentPoint.x,this.label.y=this.currentPoint.y;else{this.points=this.getPreviewPoints(this.currentPoint,e);var i=this.isSource||this.isTarget?this.getPreviewTerminalState(e):null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint)this.currentPoint=this.constraintHandler.currentPoint.clone();else if(this.outlineConnect){var n=!(!this.isSource&&!this.isTarget)&&this.isOutlineConnectEvent(e);n?i=this.marker.highlight.state:null!=i&&i!=e.getState()&&null!=this.marker.highlight.shape&&(this.marker.highlight.shape.stroke="transparent",this.marker.highlight.repaint(),i=null)}null==i||this.isCellEnabled(i.cell)||(i=null,this.marker.reset());var r=this.clonePreviewState(this.currentPoint,null!=i?i.cell:null);this.updatePreviewState(r,this.currentPoint,i,e,n);var s=null==this.error?this.marker.validColor:this.marker.invalidColor;this.setPreviewColor(s),this.abspoints=r.absolutePoints,this.active=!0}this.updateHint(e,this.currentPoint),this.drawPreview(),mxEvent.consume(e.getEvent()),e.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(e)&&e.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(t,e){if(null!=this.index&&null!=this.marker){var i=this.state.cell,n=this.index;if(this.index=null,e.getX()!=this.startX||e.getY()!=this.startY){var r=!this.graph.isIgnoreTerminalEvent(e.getEvent())&&this.graph.isCloneEvent(e.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable();if(null!=this.error)this.error.length>0&&this.graph.validationAlert(this.error);else if(n<=mxEvent.CUSTOM_HANDLE&&n>mxEvent.VIRTUAL_HANDLE){if(null!=this.customHandles){(o=this.graph.getModel()).beginUpdate();try{this.customHandles[mxEvent.CUSTOM_HANDLE-n].execute()}finally{o.endUpdate()}}}else if(this.isLabel)this.moveLabel(this.state,this.label.x,this.label.y);else if(this.isSource||this.isTarget){var s=null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(s=this.constraintHandler.currentFocus.cell),null==s&&this.marker.hasValidState()&&null!=this.marker.highlight&&null!=this.marker.highlight.shape&&"transparent"!=this.marker.highlight.shape.stroke&&"white"!=this.marker.highlight.shape.stroke&&(s=this.marker.validState.cell),null!=s){var o,l=(o=this.graph.getModel()).getParent(i);o.beginUpdate();try{if(r){var a=o.getGeometry(i);r=this.graph.cloneCell(i);o.add(l,r,o.getChildCount(l)),null!=a&&(a=a.clone(),o.setGeometry(r,a));var h=o.getTerminal(i,!this.isSource);this.graph.connectCell(r,h,!this.isSource),i=r}i=this.connect(i,s,this.isSource,r,e)}finally{o.endUpdate()}}else if(this.graph.isAllowDanglingEdges()){var u=this.abspoints[this.isSource?0:this.abspoints.length-1];u.x=this.roundLength(u.x/this.graph.view.scale-this.graph.view.translate.x),u.y=this.roundLength(u.y/this.graph.view.scale-this.graph.view.translate.y);var p=this.graph.getView().getState(this.graph.getModel().getParent(i));null!=p&&(u.x-=p.origin.x,u.y-=p.origin.y),u.x-=this.graph.panDx/this.graph.view.scale,u.y-=this.graph.panDy/this.graph.view.scale,i=this.changeTerminalPoint(i,u,this.isSource,r)}}else this.active?i=this.changePoints(i,this.points,r):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().validate(this.state.cell))}null!=this.marker&&(this.reset(),i!=this.state.cell&&this.graph.setSelectionCell(i)),e.consume()}},mxEdgeHandler.prototype.reset=function(){if(this.active&&this.refresh(),this.error=null,this.index=null,this.label=null,this.points=null,this.snapPoint=null,this.isLabel=!1,this.isSource=!1,this.isTarget=!1,this.active=!1,this.livePreview&&null!=this.sizers)for(var t=0;t0&&e0&&null!=i){null==this.points&&(this.points=[]);for(var n=1;n0&&this.graph.isLabelMovable(t),null!=this.bends&&this.bends.length>0){var n=this.abspoints.length-1,r=this.abspoints[0],s=r.x,o=r.y;e=this.bends[0].bounds,this.bends[0].bounds=new mxRectangle(Math.floor(s-e.width/2),Math.floor(o-e.height/2),e.width,e.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw(),this.manageLabelHandle&&this.checkLabelHandle(this.bends[0].bounds);var l=this.abspoints[n],a=l.x,h=l.y,u=this.bends.length-1;e=this.bends[u].bounds,this.bends[u].bounds=new mxRectangle(Math.floor(a-e.width/2),Math.floor(h-e.height/2),e.width,e.height),this.bends[u].fill=this.getHandleFillColor(u),this.bends[u].redraw(),this.manageLabelHandle&&this.checkLabelHandle(this.bends[u].bounds),this.redrawInnerBends(r,l)}if(null!=this.abspoints&&null!=this.virtualBends&&this.virtualBends.length>0)for(var p=this.abspoints[0],d=0;d1?(t=n[1],e=n[n.length-2]):null!=i.points&&i.points.length>0&&(r=n[0]),r=null==r?new mxPoint(t.x+(e.x-t.x)/2,t.y+(e.y-t.y)/2):new mxPoint(this.graph.getView().scale*(r.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(r.y+this.graph.getView().translate.y+this.state.origin.y));var s=this.bends[1].bounds,o=s.width,l=s.height,a=new mxRectangle(Math.round(r.x-o/2),Math.round(r.y-l/2),o,l);this.manageLabelHandle?this.checkLabelHandle(a):null==this.handleImage&&this.labelShape.visible&&mxUtils.intersects(a,this.labelShape.bounds)&&(o=mxConstants.HANDLE_SIZE+3,l=mxConstants.HANDLE_SIZE+3,a=new mxRectangle(Math.floor(r.x-o/2),Math.floor(r.y-l/2),o,l)),this.bends[1].bounds=a,this.bends[1].redraw(),this.manageLabelHandle&&this.checkLabelHandle(this.bends[1].bounds)},__mxOutput.mxElbowEdgeHandler=void 0!==mxElbowEdgeHandler?mxElbowEdgeHandler:void 0,mxUtils.extend(mxEdgeSegmentHandler,mxElbowEdgeHandler),mxEdgeSegmentHandler.prototype.getCurrentPoints=function(){var t=this.state.absolutePoints;if(null!=t){var e=Math.max(1,this.graph.view.scale);if(2==t.length||3==t.length&&(Math.abs(t[0].x-t[1].x)0){var l=this.abspoints,a=l[0],h=l[1];o=[];for(var u=2;u1){var n=!1;if(4==i.length&&0==Math.round(i[1].x-i[2].x)&&0==Math.round(i[1].y-i[2].y))if(n=!0,0==Math.round(i[0].y-i[i.length-1].y)){var r=i[0].x+(i[i.length-1].x-i[0].x)/2;i[1]=new mxPoint(r,i[1].y),i[2]=new mxPoint(r,i[2].y)}else{var s=i[0].y+(i[i.length-1].y-i[0].y)/2;i[1]=new mxPoint(i[1].x,s),i[2]=new mxPoint(i[2].x,s)}for(var o=0;o0){null==this.div&&this.init();var n=mxUtils.getScrollOrigin();this.div.style.zIndex=this.zIndex,this.div.style.left=e+n.x+"px",this.div.style.top=i+mxConstants.TOOLTIP_VERTICAL_OFFSET+n.y+"px",mxUtils.isNode(t)?(this.div.innerHTML="",this.div.appendChild(t)):this.div.innerHTML=t.replace(/\n/g,"
"),this.div.style.visibility="",mxUtils.fit(this.div)}},mxTooltipHandler.prototype.destroy=function(){this.destroyed||(this.graph.removeMouseListener(this),mxEvent.release(this.div),null!=this.div&&null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.destroyed=!0,this.div=null)},__mxOutput.mxTooltipHandler=void 0!==mxTooltipHandler?mxTooltipHandler:void 0,mxUtils.extend(mxCellTracker,mxCellMarker),mxCellTracker.prototype.mouseDown=function(t,e){},mxCellTracker.prototype.mouseMove=function(t,e){this.isEnabled()&&this.process(e)},mxCellTracker.prototype.mouseUp=function(t,e){},mxCellTracker.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),mxCellMarker.prototype.destroy.apply(this))},__mxOutput.mxCellTracker=void 0!==mxCellTracker?mxCellTracker:void 0,mxCellHighlight.prototype.keepOnTop=!1,mxCellHighlight.prototype.graph=!0,mxCellHighlight.prototype.state=null,mxCellHighlight.prototype.spacing=2,mxCellHighlight.prototype.resetHandler=null,mxCellHighlight.prototype.setHighlightColor=function(t){this.highlightColor=t,null!=this.shape&&(this.shape.stroke=t)},mxCellHighlight.prototype.drawHighlight=function(){this.shape=this.createShape(),this.repaint(),this.keepOnTop||this.shape.node.parentNode.firstChild==this.shape.node||this.shape.node.parentNode.insertBefore(this.shape.node,this.shape.node.parentNode.firstChild)},mxCellHighlight.prototype.createShape=function(){var t=this.graph.cellRenderer.createShape(this.state);return t.svgStrokeTolerance=this.graph.tolerance,t.points=this.state.absolutePoints,t.apply(this.state),t.stroke=this.highlightColor,t.opacity=this.opacity,t.isDashed=this.dashed,t.isShadow=!1,t.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,t.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(t.node,this.graph,this.state),this.graph.dialect!=mxConstants.DIALECT_SVG?t.pointerEvents=!1:t.svgPointerEvents="stroke",t},mxCellHighlight.prototype.getStrokeWidth=function(t){return this.strokeWidth},mxCellHighlight.prototype.repaint=function(){null!=this.state&&null!=this.shape&&(this.shape.scale=this.state.view.scale,this.graph.model.isEdge(this.state.cell)?(this.shape.strokewidth=this.getStrokeWidth(),this.shape.points=this.state.absolutePoints,this.shape.outline=!1):(this.shape.bounds=new mxRectangle(this.state.x-this.spacing,this.state.y-this.spacing,this.state.width+2*this.spacing,this.state.height+2*this.spacing),this.shape.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.shape.strokewidth=this.getStrokeWidth()/this.state.view.scale,this.shape.outline=!0),null!=this.state.shape&&this.shape.setCursor(this.state.shape.getCursor()),(mxClient.IS_QUIRKS||8==document.documentMode)&&("transparent"==this.shape.stroke?(this.shape.stroke="white",this.shape.opacity=1):this.shape.opacity=this.opacity),this.shape.redraw())},mxCellHighlight.prototype.hide=function(){this.highlight(null)},mxCellHighlight.prototype.highlight=function(t){this.state!=t&&(null!=this.shape&&(this.shape.destroy(),this.shape=null),this.state=t,null!=this.state&&this.drawHighlight())},mxCellHighlight.prototype.isHighlightAt=function(t,e){var i=!1;if(null!=this.shape&&null!=document.elementFromPoint&&!mxClient.IS_QUIRKS)for(var n=document.elementFromPoint(t,e);null!=n;){if(n==this.shape.node){i=!0;break}n=n.parentNode}return i},mxCellHighlight.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getView().removeListener(this.repaintHandler),this.graph.getModel().removeListener(this.repaintHandler),null!=this.shape&&(this.shape.destroy(),this.shape=null)},__mxOutput.mxCellHighlight=void 0!==mxCellHighlight?mxCellHighlight:void 0,mxDefaultKeyHandler.prototype.editor=null,mxDefaultKeyHandler.prototype.handler=null,mxDefaultKeyHandler.prototype.bindAction=function(t,e,i){var n=mxUtils.bind(this,(function(){this.editor.execute(e)}));i?this.handler.bindControlKey(t,n):this.handler.bindKey(t,n)},mxDefaultKeyHandler.prototype.destroy=function(){this.handler.destroy(),this.handler=null},__mxOutput.mxDefaultKeyHandler=void 0!==mxDefaultKeyHandler?mxDefaultKeyHandler:void 0,mxDefaultPopupMenu.prototype.imageBasePath=null,mxDefaultPopupMenu.prototype.config=null,mxDefaultPopupMenu.prototype.createMenu=function(t,e,i,n){if(null!=this.config){var r=this.createConditions(t,i,n),s=this.config.firstChild;this.addItems(t,e,i,n,r,s,null)}},mxDefaultPopupMenu.prototype.addItems=function(t,e,i,n,r,s,o){for(var l=!1;null!=s;){if("add"==s.nodeName){var a=s.getAttribute("if");if(null==a||r[a]){var h=s.getAttribute("as");h=mxResources.get(h)||h;var u=mxUtils.eval(mxUtils.getTextContent(s)),p=s.getAttribute("action"),d=s.getAttribute("icon"),c=s.getAttribute("iconCls"),m=s.getAttribute("enabled-if"),g=null==m||r[m];l&&(e.addSeparator(o),l=!1),null!=d&&this.imageBasePath&&(d=this.imageBasePath+d);var x=this.addAction(e,t,h,d,u,p,i,o,c,g);this.addItems(t,e,i,n,r,s.firstChild,x)}}else"separator"==s.nodeName&&(l=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(t,e,i,n,r,s,o,l,a,h){return t.addItem(i,n,(function(t){"function"==typeof r&&r.call(e,e,o,t),null!=s&&e.execute(s,o,t)}),l,a,h)},mxDefaultPopupMenu.prototype.createConditions=function(t,e,i){var n=t.graph.getModel(),r=n.getChildCount(e),s=[];s.nocell=null==e,s.ncells=t.graph.getSelectionCount()>1,s.notRoot=n.getRoot()!=n.getParent(t.graph.getDefaultParent()),s.cell=null!=e;var o=null!=e&&1==t.graph.getSelectionCount();s.nonEmpty=o&&r>0,s.expandable=o&&t.graph.isCellFoldable(e,!1),s.collapsable=o&&t.graph.isCellFoldable(e,!0),s.validRoot=o&&t.graph.isValidRoot(e),s.emptyValidRoot=s.validRoot&&0==r,s.swimlane=o&&t.graph.isSwimlane(e);for(var l=this.config.getElementsByTagName("condition"),a=0;a0&&this.editor.execute(i)}));return this.toolbar.addItem(t,e,r,n)},mxDefaultToolbar.prototype.addSeparator=function(t){t=t||mxClient.imageBasePath+"/separator.gif",this.toolbar.addSeparator(t)},mxDefaultToolbar.prototype.addCombo=function(){return this.toolbar.addCombo()},mxDefaultToolbar.prototype.addActionCombo=function(t){return this.toolbar.addActionCombo(t)},mxDefaultToolbar.prototype.addActionOption=function(t,e,i){var n=mxUtils.bind(this,(function(){this.editor.execute(i)}));this.addOption(t,e,n)},mxDefaultToolbar.prototype.addOption=function(t,e,i){return this.toolbar.addOption(t,e,i)},mxDefaultToolbar.prototype.addMode=function(t,e,i,n,r){var s=mxUtils.bind(this,(function(){this.editor.setMode(i),null!=r&&r(this.editor)}));return this.toolbar.addSwitchMode(t,e,s,n)},mxDefaultToolbar.prototype.addPrototype=function(t,e,i,n,r,s){var o=mxUtils.bind(this,(function(){return"function"==typeof i?i():null!=i?this.editor.graph.cloneCell(i):null})),l=mxUtils.bind(this,(function(t,e){"function"==typeof r?r(this.editor,o(),t,e):this.drop(o(),t,e),this.toolbar.resetMode(),mxEvent.consume(t)})),a=this.toolbar.addMode(t,e,l,n,null,s);return this.installDropHandler(a,(function(t,e,i){l(e,i)})),a},mxDefaultToolbar.prototype.drop=function(t,e,i){var n=this.editor.graph,r=n.getModel();if(null!=i&&!r.isEdge(i)&&this.connectOnDrop&&n.isCellConnectable(i))this.connect(t,e,i);else{for(;null!=i&&!n.isValidDropTarget(i,[t],e);)i=r.getParent(i);this.insert(t,e,i)}},mxDefaultToolbar.prototype.insert=function(t,e,i){var n=this.editor.graph;if(n.canImportCell(t)){var r=mxEvent.getClientX(e),s=mxEvent.getClientY(e),o=mxUtils.convertPoint(n.container,r,s);return n.isSplitEnabled()&&n.isSplitTarget(i,[t],e)?n.splitEdge(i,[t],null,o.x,o.y):this.editor.addVertex(i,t,o.x,o.y)}return null},mxDefaultToolbar.prototype.connect=function(t,e,i){var n=this.editor.graph,r=n.getModel();if(null!=i&&n.isCellConnectable(t)&&n.isEdgeValid(null,i,t)){var s=null;r.beginUpdate();try{var o=r.getGeometry(i),l=r.getGeometry(t).clone();l.x=o.x+(o.width-l.width)/2,l.y=o.y+(o.height-l.height)/2;var a=this.spacing*n.gridSize,h=20*r.getDirectedEdgeCount(i,!0);this.editor.horizontalFlow?l.x+=(l.width+o.width)/2+a+h:l.y+=(l.height+o.height)/2+a+h,t.setGeometry(l);var u=r.getParent(i);if(n.addCell(t,u),n.constrainChild(t),s=this.editor.createEdge(i,t),null==r.getGeometry(s)){var p=new mxGeometry;p.relative=!0,r.setGeometry(s,p)}n.addEdge(s,u,i,t)}finally{r.endUpdate()}n.setSelectionCells([t,s]),n.scrollCellToVisible(t)}},mxDefaultToolbar.prototype.installDropHandler=function(t,e){var i=document.createElement("img");i.setAttribute("src",t.getAttribute("src"));var n=mxUtils.bind(this,(function(r){i.style.width=2*t.offsetWidth+"px",i.style.height=2*t.offsetHeight+"px",mxUtils.makeDraggable(t,this.editor.graph,e,i),mxEvent.removeListener(i,"load",n)}));mxClient.IS_IE?n():mxEvent.addListener(i,"load",n)},mxDefaultToolbar.prototype.destroy=function(){null!=this.resetHandler&&(this.editor.graph.removeListener("dblclick",this.resetHandler),this.editor.removeListener("escape",this.resetHandler),this.resetHandler=null),null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null)},__mxOutput.mxDefaultToolbar=void 0!==mxDefaultToolbar?mxDefaultToolbar:void 0,mxLoadResources?mxResources.add(mxClient.basePath+"/resources/editor"):mxClient.defaultBundles.push(mxClient.basePath+"/resources/editor"),mxEditor.prototype=new mxEventSource,mxEditor.prototype.constructor=mxEditor,mxEditor.prototype.askZoomResource="none"!=mxClient.language?"askZoom":"",mxEditor.prototype.lastSavedResource="none"!=mxClient.language?"lastSaved":"",mxEditor.prototype.currentFileResource="none"!=mxClient.language?"currentFile":"",mxEditor.prototype.propertiesResource="none"!=mxClient.language?"properties":"",mxEditor.prototype.tasksResource="none"!=mxClient.language?"tasks":"",mxEditor.prototype.helpResource="none"!=mxClient.language?"help":"",mxEditor.prototype.outlineResource="none"!=mxClient.language?"outline":"",mxEditor.prototype.outline=null,mxEditor.prototype.graph=null,mxEditor.prototype.graphRenderHint=null,mxEditor.prototype.toolbar=null,mxEditor.prototype.status=null,mxEditor.prototype.popupHandler=null,mxEditor.prototype.undoManager=null,mxEditor.prototype.keyHandler=null,mxEditor.prototype.actions=null,mxEditor.prototype.dblClickAction="edit",mxEditor.prototype.swimlaneRequired=!1,mxEditor.prototype.disableContextMenu=!0,mxEditor.prototype.insertFunction=null,mxEditor.prototype.forcedInserting=!1,mxEditor.prototype.templates=null,mxEditor.prototype.defaultEdge=null,mxEditor.prototype.defaultEdgeStyle=null,mxEditor.prototype.defaultGroup=null,mxEditor.prototype.groupBorderSize=null,mxEditor.prototype.filename=null,mxEditor.prototype.linefeed="
",mxEditor.prototype.postParameterName="xml",mxEditor.prototype.escapePostData=!0,mxEditor.prototype.urlPost=null,mxEditor.prototype.urlImage=null,mxEditor.prototype.horizontalFlow=!1,mxEditor.prototype.layoutDiagram=!1,mxEditor.prototype.swimlaneSpacing=0,mxEditor.prototype.maintainSwimlanes=!1,mxEditor.prototype.layoutSwimlanes=!1,mxEditor.prototype.cycleAttributeValues=null,mxEditor.prototype.cycleAttributeIndex=0,mxEditor.prototype.cycleAttributeName="fillColor",mxEditor.prototype.tasks=null,mxEditor.prototype.tasksWindowImage=null,mxEditor.prototype.tasksTop=20,mxEditor.prototype.help=null,mxEditor.prototype.helpWindowImage=null,mxEditor.prototype.urlHelp=null,mxEditor.prototype.helpWidth=300,mxEditor.prototype.helpHeight=260,mxEditor.prototype.propertiesWidth=240,mxEditor.prototype.propertiesHeight=null,mxEditor.prototype.movePropertiesDialog=!1,mxEditor.prototype.validating=!1,mxEditor.prototype.modified=!1,mxEditor.prototype.isModified=function(){return this.modified},mxEditor.prototype.setModified=function(t){this.modified=t},mxEditor.prototype.addActions=function(){this.addAction("save",(function(t){t.save()})),this.addAction("print",(function(t){new mxPrintPreview(t.graph,1).open()})),this.addAction("show",(function(t){mxUtils.show(t.graph,null,10,10)})),this.addAction("exportImage",(function(t){var e=t.getUrlImage();if(null==e||mxClient.IS_LOCAL)t.execute("show");else{var i=mxUtils.getViewXml(t.graph,1),n=mxUtils.getXml(i,"\n");mxUtils.submit(e,t.postParameterName+"="+encodeURIComponent(n),document,"_blank")}})),this.addAction("refresh",(function(t){t.graph.refresh()})),this.addAction("cut",(function(t){t.graph.isEnabled()&&mxClipboard.cut(t.graph)})),this.addAction("copy",(function(t){t.graph.isEnabled()&&mxClipboard.copy(t.graph)})),this.addAction("paste",(function(t){t.graph.isEnabled()&&mxClipboard.paste(t.graph)})),this.addAction("delete",(function(t){t.graph.isEnabled()&&t.graph.removeCells()})),this.addAction("group",(function(t){t.graph.isEnabled()&&t.graph.setSelectionCell(t.groupCells())})),this.addAction("ungroup",(function(t){t.graph.isEnabled()&&t.graph.setSelectionCells(t.graph.ungroupCells())})),this.addAction("removeFromParent",(function(t){t.graph.isEnabled()&&t.graph.removeCellsFromParent()})),this.addAction("undo",(function(t){t.graph.isEnabled()&&t.undo()})),this.addAction("redo",(function(t){t.graph.isEnabled()&&t.redo()})),this.addAction("zoomIn",(function(t){t.graph.zoomIn()})),this.addAction("zoomOut",(function(t){t.graph.zoomOut()})),this.addAction("actualSize",(function(t){t.graph.zoomActual()})),this.addAction("fit",(function(t){t.graph.fit()})),this.addAction("showProperties",(function(t,e){t.showProperties(e)})),this.addAction("selectAll",(function(t){t.graph.isEnabled()&&t.graph.selectAll()})),this.addAction("selectNone",(function(t){t.graph.isEnabled()&&t.graph.clearSelection()})),this.addAction("selectVertices",(function(t){t.graph.isEnabled()&&t.graph.selectVertices()})),this.addAction("selectEdges",(function(t){t.graph.isEnabled()&&t.graph.selectEdges()})),this.addAction("edit",(function(t,e){t.graph.isEnabled()&&t.graph.isCellEditable(e)&&t.graph.startEditingAtCell(e)})),this.addAction("toBack",(function(t,e){t.graph.isEnabled()&&t.graph.orderCells(!0)})),this.addAction("toFront",(function(t,e){t.graph.isEnabled()&&t.graph.orderCells(!1)})),this.addAction("enterGroup",(function(t,e){t.graph.enterGroup(e)})),this.addAction("exitGroup",(function(t){t.graph.exitGroup()})),this.addAction("home",(function(t){t.graph.home()})),this.addAction("selectPrevious",(function(t){t.graph.isEnabled()&&t.graph.selectPreviousCell()})),this.addAction("selectNext",(function(t){t.graph.isEnabled()&&t.graph.selectNextCell()})),this.addAction("selectParent",(function(t){t.graph.isEnabled()&&t.graph.selectParentCell()})),this.addAction("selectChild",(function(t){t.graph.isEnabled()&&t.graph.selectChildCell()})),this.addAction("collapse",(function(t){t.graph.isEnabled()&&t.graph.foldCells(!0)})),this.addAction("collapseAll",(function(t){if(t.graph.isEnabled()){var e=t.graph.getChildVertices();t.graph.foldCells(!0,!1,e)}})),this.addAction("expand",(function(t){t.graph.isEnabled()&&t.graph.foldCells(!1)})),this.addAction("expandAll",(function(t){if(t.graph.isEnabled()){var e=t.graph.getChildVertices();t.graph.foldCells(!1,!1,e)}})),this.addAction("bold",(function(t){t.graph.isEnabled()&&t.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_BOLD)})),this.addAction("italic",(function(t){t.graph.isEnabled()&&t.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_ITALIC)})),this.addAction("underline",(function(t){t.graph.isEnabled()&&t.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_UNDERLINE)})),this.addAction("alignCellsLeft",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_LEFT)})),this.addAction("alignCellsCenter",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_CENTER)})),this.addAction("alignCellsRight",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_RIGHT)})),this.addAction("alignCellsTop",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_TOP)})),this.addAction("alignCellsMiddle",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_MIDDLE)})),this.addAction("alignCellsBottom",(function(t){t.graph.isEnabled()&&t.graph.alignCells(mxConstants.ALIGN_BOTTOM)})),this.addAction("alignFontLeft",(function(t){t.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT)})),this.addAction("alignFontCenter",(function(t){t.graph.isEnabled()&&t.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER)})),this.addAction("alignFontRight",(function(t){t.graph.isEnabled()&&t.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_RIGHT)})),this.addAction("alignFontTop",(function(t){t.graph.isEnabled()&&t.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_TOP)})),this.addAction("alignFontMiddle",(function(t){t.graph.isEnabled()&&t.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE)})),this.addAction("alignFontBottom",(function(t){t.graph.isEnabled()&&t.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_BOTTOM)})),this.addAction("zoom",(function(t){var e=100*t.graph.getView().scale,i=parseFloat(mxUtils.prompt(mxResources.get(t.askZoomResource)||t.askZoomResource,e))/100;isNaN(i)||t.graph.getView().setScale(i)})),this.addAction("toggleTasks",(function(t){null!=t.tasks?t.tasks.setVisible(!t.tasks.isVisible()):t.showTasks()})),this.addAction("toggleHelp",(function(t){null!=t.help?t.help.setVisible(!t.help.isVisible()):t.showHelp()})),this.addAction("toggleOutline",(function(t){null==t.outline?t.showOutline():t.outline.setVisible(!t.outline.isVisible())})),this.addAction("toggleConsole",(function(t){mxLog.setVisible(!mxLog.isVisible())}))},mxEditor.prototype.configure=function(t){null!=t&&(new mxCodec(t.ownerDocument).decode(t,this),this.resetHistory())},mxEditor.prototype.resetFirstTime=function(){document.cookie="mxgraph=seen; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/"},mxEditor.prototype.resetHistory=function(){this.lastSnapshot=(new Date).getTime(),this.undoManager.clear(),this.ignoredChanges=0,this.setModified(!1)},mxEditor.prototype.addAction=function(t,e){this.actions[t]=e},mxEditor.prototype.execute=function(t,e,i){var n=this.actions[t];if(null!=n)try{var r=arguments;r[0]=this,n.apply(this,r)}catch(e){throw mxUtils.error("Cannot execute "+t+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+t,280,!0)},mxEditor.prototype.addTemplate=function(t,e){this.templates[t]=e},mxEditor.prototype.getTemplate=function(t){return this.templates[t]},mxEditor.prototype.createGraph=function(){var t=new mxGraph(null,null,this.graphRenderHint);return t.setTooltips(!0),t.setPanning(!0),this.installDblClickHandler(t),this.installUndoHandler(t),this.installDrillHandler(t),this.installChangeHandler(t),this.installInsertHandler(t),t.popupMenuHandler.factoryMethod=mxUtils.bind(this,(function(t,e,i){return this.createPopupMenu(t,e,i)})),t.connectionHandler.factoryMethod=mxUtils.bind(this,(function(t,e){return this.createEdge(t,e)})),this.createSwimlaneManager(t),this.createLayoutManager(t),t},mxEditor.prototype.createSwimlaneManager=function(t){var e=new mxSwimlaneManager(t,!1);return e.isHorizontal=mxUtils.bind(this,(function(){return this.horizontalFlow})),e.isEnabled=mxUtils.bind(this,(function(){return this.maintainSwimlanes})),e},mxEditor.prototype.createLayoutManager=function(t){var e=new mxLayoutManager(t),i=this;return e.getLayout=function(e){var n=null,r=i.graph.getModel();return null!=r.getParent(e)&&(i.layoutSwimlanes&&t.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),n=i.swimlaneLayout):i.layoutDiagram&&(t.isValidRoot(e)||null==r.getParent(r.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),n=i.diagramLayout)),n},e},mxEditor.prototype.setGraphContainer=function(t){null==this.graph.container&&(this.graph.init(t),this.rubberband=new mxRubberband(this.graph),this.disableContextMenu&&mxEvent.disableContextMenu(t),mxClient.IS_QUIRKS&&new mxDivResizer(t))},mxEditor.prototype.installDblClickHandler=function(t){t.addListener(mxEvent.DOUBLE_CLICK,mxUtils.bind(this,(function(e,i){var n=i.getProperty("cell");null!=n&&t.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,n),i.consume())})))},mxEditor.prototype.installUndoHandler=function(t){var e=mxUtils.bind(this,(function(t,e){var i=e.getProperty("edit");this.undoManager.undoableEditHappened(i)}));t.getModel().addListener(mxEvent.UNDO,e),t.getView().addListener(mxEvent.UNDO,e);var i=function(e,i){var n=i.getProperty("edit").changes;t.setSelectionCells(t.getSelectionCellsForChanges(n))};this.undoManager.addListener(mxEvent.UNDO,i),this.undoManager.addListener(mxEvent.REDO,i)},mxEditor.prototype.installDrillHandler=function(t){var e=mxUtils.bind(this,(function(t){this.fireEvent(new mxEventObject(mxEvent.ROOT))}));t.getView().addListener(mxEvent.DOWN,e),t.getView().addListener(mxEvent.UP,e)},mxEditor.prototype.installChangeHandler=function(t){var e=mxUtils.bind(this,(function(e,i){this.setModified(!0),1==this.validating&&t.validateGraph();for(var n=i.getProperty("edit").changes,r=0;r "+e.convertValueToString(i)+t),i=e.getModel().getParent(i);return this.getRootTitle()+t},mxEditor.prototype.getRootTitle=function(){var t=this.graph.getModel().getRoot();return this.graph.convertValueToString(t)},mxEditor.prototype.undo=function(){this.undoManager.undo()},mxEditor.prototype.redo=function(){this.undoManager.redo()},mxEditor.prototype.groupCells=function(){var t=null!=this.groupBorderSize?this.groupBorderSize:this.graph.gridSize;return this.graph.groupCells(this.createGroup(),t)},mxEditor.prototype.createGroup=function(){return this.graph.getModel().cloneCell(this.defaultGroup)},mxEditor.prototype.open=function(t){if(null!=t){var e=mxUtils.load(t).getXml();this.readGraphModel(e.documentElement),this.filename=t,this.fireEvent(new mxEventObject(mxEvent.OPEN,"filename",t))}},mxEditor.prototype.readGraphModel=function(t){new mxCodec(t.ownerDocument).decode(t,this.graph.getModel()),this.resetHistory()},mxEditor.prototype.save=function(t,e){if(null!=(t=t||this.getUrlPost())&&t.length>0){var i=this.writeGraphModel(e);this.postDiagram(t,i),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",t))},mxEditor.prototype.postDiagram=function(t,e){this.escapePostData&&(e=encodeURIComponent(e)),mxUtils.post(t,this.postParameterName+"="+e,mxUtils.bind(this,(function(i){this.fireEvent(new mxEventObject(mxEvent.POST,"request",i,"url",t,"data",e))})))},mxEditor.prototype.writeGraphModel=function(t){t=null!=t?t:this.linefeed;var e=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(e,t)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.swapStyles=function(t,e){var i=this.graph.getStylesheet().styles[e];this.graph.getView().getStylesheet().putCellStyle(e,this.graph.getStylesheet().styles[t]),this.graph.getStylesheet().putCellStyle(t,i),this.graph.refresh()},mxEditor.prototype.showProperties=function(t){if(null==(t=t||this.graph.getSelectionCell())&&null==(t=this.graph.getCurrentRoot())&&(t=this.graph.getModel().getRoot()),null!=t){this.graph.stopEditing(!0);var e=mxUtils.getOffset(this.graph.container),i=e.x+10,n=e.y;if(null==this.properties||this.movePropertiesDialog){var r=this.graph.getCellBounds(t);null!=r&&(i+=r.x+Math.min(200,r.width),n+=r.y)}else i=this.properties.getX(),n=this.properties.getY();this.hideProperties();var s=this.createProperties(t);null!=s&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,s,i,n,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(t){var e=this.graph.getModel(),i=e.getValue(t);if(mxUtils.isNode(i)){var n=new mxForm("properties");n.addText("ID",t.getId()).setAttribute("readonly","true");var r=null,s=null,o=null,l=null,a=null;e.isVertex(t)&&null!=(r=e.getGeometry(t))&&(s=n.addText("top",r.y),o=n.addText("left",r.x),l=n.addText("width",r.width),a=n.addText("height",r.height));for(var h=e.getStyle(t),u=n.addText("Style",h||""),p=i.attributes,d=[],c=0;c0?e.setStyle(t,u.value):e.setStyle(t,null);for(var i=0;i0&&this.graph.isSwimlane(t)?this.cycleAttributeValues[this.cycleAttributeIndex++%this.cycleAttributeValues.length]:null},mxEditor.prototype.cycleAttribute=function(t){if(null!=this.cycleAttributeName){var e=this.consumeCycleAttribute(t);null!=e&&t.setStyle(t.getStyle()+";"+this.cycleAttributeName+"="+e)}},mxEditor.prototype.addVertex=function(t,e,i,n){for(var r=this.graph.getModel();null!=t&&!this.graph.isValidDropTarget(t);)t=r.getParent(t);t=null!=t?t:this.graph.getSwimlaneAt(i,n);var s=this.graph.getView().scale,o=r.getGeometry(e),l=r.getGeometry(t);if(this.graph.isSwimlane(e)&&!this.graph.swimlaneNesting)t=null;else{if(null==t&&this.swimlaneRequired)return null;if(null!=t&&null!=l){var a=this.graph.getView().getState(t);if(null!=a){if(i-=a.origin.x*s,n-=a.origin.y*s,this.graph.isConstrainedMoving){var h=o.width,u=o.height,p=a.x+a.width;i+h>p&&(i-=i+h-p),n+u>(p=a.y+a.height)&&(n-=n+u-p)}}else null!=l&&(i-=l.x*s,n-=l.y*s)}}(o=o.clone()).x=this.graph.snap(i/s-this.graph.getView().translate.x-this.graph.gridSize/2),o.y=this.graph.snap(n/s-this.graph.getView().translate.y-this.graph.gridSize/2),e.setGeometry(o),null==t&&(t=this.graph.getDefaultParent()),this.cycleAttribute(e),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",e,"parent",t)),r.beginUpdate();try{null!=(e=this.graph.addCell(e,t))&&(this.graph.constrainChild(e),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",e)))}finally{r.endUpdate()}return null!=e&&(this.graph.setSelectionCell(e),this.graph.scrollCellToVisible(e),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",e))),e},mxEditor.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tasks&&this.tasks.destroy(),null!=this.outline&&this.outline.destroy(),null!=this.properties&&this.properties.destroy(),null!=this.keyHandler&&this.keyHandler.destroy(),null!=this.rubberband&&this.rubberband.destroy(),null!=this.toolbar&&this.toolbar.destroy(),null!=this.graph&&this.graph.destroy(),this.status=null,this.templates=null)},__mxOutput.mxEditor=void 0!==mxEditor?mxEditor:void 0;var mxCodecRegistry={codecs:[],aliases:[],register:function(t){if(null!=t){var e=t.getName();mxCodecRegistry.codecs[e]=t;var i=mxUtils.getFunctionName(t.template.constructor);i!=e&&mxCodecRegistry.addAlias(i,e)}return t},addAlias:function(t,e){mxCodecRegistry.aliases[t]=e},getCodec:function(t){var e=null;if(null!=t){var i=mxUtils.getFunctionName(t),n=mxCodecRegistry.aliases[i];if(null!=n&&(i=n),null==(e=mxCodecRegistry.codecs[i]))try{e=new mxObjectCodec(new t),mxCodecRegistry.register(e)}catch(t){}}return e}},codec;function mxCodec(t){this.document=t||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(t,e,i,n){for(var r in this.template=t,this.exclude=null!=e?e:[],this.idrefs=null!=i?i:[],this.mapping=null!=n?n:[],this.reverse=new Object,this.mapping)this.reverse[this.mapping[r]]=r}__mxOutput.mxCodecRegistry=void 0!==mxCodecRegistry?mxCodecRegistry:void 0,mxCodec.prototype.document=null,mxCodec.prototype.objects=null,mxCodec.prototype.elements=null,mxCodec.prototype.encodeDefaults=!1,mxCodec.prototype.putObject=function(t,e){return this.objects[t]=e,e},mxCodec.prototype.getObject=function(t){var e=null;if(null!=t&&null==(e=this.objects[t])&&null==(e=this.lookup(t))){var i=this.getElementById(t);null!=i&&(e=this.decode(i))}return e},mxCodec.prototype.lookup=function(t){return null},mxCodec.prototype.getElementById=function(t){return this.updateElements(),this.elements[t]},mxCodec.prototype.updateElements=function(){null==this.elements&&(this.elements=new Object,null!=this.document.documentElement&&this.addElement(this.document.documentElement))},mxCodec.prototype.addElement=function(t){if(t.nodeType==mxConstants.NODETYPE_ELEMENT){var e=t.getAttribute("id");if(null!=e)if(null==this.elements[e])this.elements[e]=t;else if(this.elements[e]!=t)throw new Error(e+": Duplicate ID")}for(t=t.firstChild;null!=t;)this.addElement(t),t=t.nextSibling},mxCodec.prototype.getId=function(t){var e=null;return null!=t&&null==(e=this.reference(t))&&t instanceof mxCell&&null==(e=t.getId())&&0==(e=mxCellPath.create(t)).length&&(e="root"),e},mxCodec.prototype.reference=function(t){return null},mxCodec.prototype.encode=function(t){var e=null;if(null!=t&&null!=t.constructor){var i=mxCodecRegistry.getCodec(t.constructor);null!=i?e=i.encode(this,t):mxUtils.isNode(t)?e=mxUtils.importNode(this.document,t,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(t.constructor))}return e},mxCodec.prototype.decode=function(t,e){this.updateElements();var i=null;if(null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT){var n=null;try{n=window[t.nodeName]}catch(t){}var r=mxCodecRegistry.getCodec(n);null!=r?i=r.decode(this,t,e):(i=t.cloneNode(!0)).removeAttribute("as")}return i},mxCodec.prototype.encodeCell=function(t,e,i){if(e.appendChild(this.encode(t)),null==i||i)for(var n=t.getChildCount(),r=0;r=0},mxObjectCodec.prototype.isReference=function(t,e,i,n){return mxUtils.indexOf(this.idrefs,e)>=0},mxObjectCodec.prototype.encode=function(t,e){var i=t.document.createElement(this.getName());return e=this.beforeEncode(t,e,i),this.encodeObject(t,e,i),this.afterEncode(t,e,i)},mxObjectCodec.prototype.encodeObject=function(t,e,i){for(var n in t.setAttribute(i,"id",t.getId(e)),e){var r=n,s=e[r];null==s||this.isExcluded(e,r,s,!0)||(mxUtils.isInteger(r)&&(r=null),this.encodeValue(t,e,r,s,i))}},mxObjectCodec.prototype.encodeValue=function(t,e,i,n,r){if(null!=n){if(this.isReference(e,i,n,!0)){var s=t.getId(n);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+i+"="+n);n=s}var o=this.template[i];(null==i||t.encodeDefaults||o!=n)&&(i=this.getAttributeName(i),this.writeAttribute(t,e,i,n,r))}},mxObjectCodec.prototype.writeAttribute=function(t,e,i,n,r){"object"!=typeof n?this.writePrimitiveAttribute(t,e,i,n,r):this.writeComplexAttribute(t,e,i,n,r)},mxObjectCodec.prototype.writePrimitiveAttribute=function(t,e,i,n,r){if(n=this.convertAttributeToXml(t,e,i,n,r),null==i){var s=t.document.createElement("add");"function"==typeof n?s.appendChild(t.document.createTextNode(n)):t.setAttribute(s,"value",n),r.appendChild(s)}else"function"!=typeof n&&t.setAttribute(r,i,n)},mxObjectCodec.prototype.writeComplexAttribute=function(t,e,i,n,r){var s=t.encode(n);null!=s?(null!=i&&s.setAttribute("as",i),r.appendChild(s)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+i+": "+n)},mxObjectCodec.prototype.convertAttributeToXml=function(t,e,i,n){return this.isBooleanAttribute(t,e,i,n)&&(n=1==n?"1":"0"),n},mxObjectCodec.prototype.isBooleanAttribute=function(t,e,i,n){return void 0===n.length&&(1==n||0==n)},mxObjectCodec.prototype.convertAttributeFromXml=function(t,e,i){var n=e.value;return this.isNumericAttribute(t,e,i)&&(n=parseFloat(n),!isNaN(n)&&isFinite(n)||(n=0)),n},mxObjectCodec.prototype.isNumericAttribute=function(t,e,i){return i.constructor==mxGeometry&&("x"==e.name||"y"==e.name||"width"==e.name||"height"==e.name)||i.constructor==mxPoint&&("x"==e.name||"y"==e.name)||mxUtils.isNumeric(e.value)},mxObjectCodec.prototype.beforeEncode=function(t,e,i){return e},mxObjectCodec.prototype.afterEncode=function(t,e,i){return i},mxObjectCodec.prototype.decode=function(t,e,i){var n=e.getAttribute("id"),r=t.objects[n];return null==r&&(r=i||this.cloneTemplate(),null!=n&&t.putObject(n,r)),e=this.beforeDecode(t,e,r),this.decodeNode(t,e,r),this.afterDecode(t,e,r)},mxObjectCodec.prototype.decodeNode=function(t,e,i){null!=e&&(this.decodeAttributes(t,e,i),this.decodeChildren(t,e,i))},mxObjectCodec.prototype.decodeAttributes=function(t,e,i){var n=e.attributes;if(null!=n)for(var r=0;r0&&(n=null),n},mxObjectCodec.prototype.addObjectValue=function(t,e,i,n){null!=i&&i!=n&&(null!=e&&e.length>0?t[e]=i:t.push(i))},mxObjectCodec.prototype.processInclude=function(t,e,i){if("include"==e.nodeName){var n=e.getAttribute("name");if(null!=n)try{var r=mxUtils.load(n).getDocumentElement();null!=r&&t.decode(r,i)}catch(t){}return!0}return!1},mxObjectCodec.prototype.beforeDecode=function(t,e,i){return e},mxObjectCodec.prototype.afterDecode=function(t,e,i){return i},__mxOutput.mxObjectCodec=void 0!==mxObjectCodec?mxObjectCodec:void 0,mxCodecRegistry.register((codec=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]),codec.isCellCodec=function(){return!0},codec.isNumericAttribute=function(t,e,i){return"value"!==e.nodeName&&mxObjectCodec.prototype.isNumericAttribute.apply(this,arguments)},codec.isExcluded=function(t,e,i,n){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||n&&"value"==e&&i.nodeType==mxConstants.NODETYPE_ELEMENT},codec.afterEncode=function(t,e,i){if(null!=e.value&&e.value.nodeType==mxConstants.NODETYPE_ELEMENT){var n=i;(i=mxUtils.importNode(t.document,e.value,!0)).appendChild(n);var r=n.getAttribute("id");i.setAttribute("id",r),n.removeAttribute("id")}return i},codec.beforeDecode=function(t,e,i){var n=e.cloneNode(!0),r=this.getName();if(e.nodeName!=r){var s=e.getElementsByTagName(r)[0];null!=s&&s.parentNode==e?(mxUtils.removeWhitespace(s,!0),mxUtils.removeWhitespace(s,!1),s.parentNode.removeChild(s),n=s):n=null,i.value=e.cloneNode(!0);var o=i.value.getAttribute("id");null!=o&&(i.setId(o),i.value.removeAttribute("id"))}else i.setId(e.getAttribute("id"));if(null!=n)for(var l=0;l=0},t.isExcluded=function(t,e,i,n){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||n&&null!=i&&("previous"==e||"parent"==e)&&!t.model.contains(i)},t.afterEncode=function(t,e,i){return this.isReference(e,"child",e.child,!0)?i.setAttribute("child",t.getId(e.child)):t.encodeCell(e.child,i),i},t.beforeDecode=function(t,e,i){if(null!=e.firstChild&&e.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var n=(e=e.cloneNode(!0)).firstChild;i.child=t.decodeCell(n,!1);var r=n.nextSibling;for(n.parentNode.removeChild(n),n=r;null!=n;){if(r=n.nextSibling,n.nodeType==mxConstants.NODETYPE_ELEMENT){var s=n.getAttribute("id");null==t.lookup(s)&&t.decodeCell(n)}n.parentNode.removeChild(n),n=r}}else{var o=e.getAttribute("child");i.child=t.getObject(o)}return e},t.afterDecode=function(t,e,i){return null!=i.child&&(null!=i.child.parent&&null!=i.previous&&i.child.parent!=i.previous&&(i.previous=i.child.parent),i.child.parent=i.previous,i.previous=i.parent,i.previousIndex=i.index),i},t}()),__mxOutput.mxChildChangeCodec="undefined"!=typeof mxChildChangeCodec?mxChildChangeCodec:void 0,mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return t.afterDecode=function(t,e,i){return i.previous=i.terminal,i},t}()),__mxOutput.mxTerminalChangeCodec="undefined"!=typeof mxTerminalChangeCodec?mxTerminalChangeCodec:void 0;var mxGenericChangeCodec=function(t,e){var i=new mxObjectCodec(t,["model","previous"],["cell"]);return i.afterDecode=function(t,i,n){return mxUtils.isNode(n.cell)&&(n.cell=t.decodeCell(n.cell,!1)),n.previous=n[e],n},i};mxCodecRegistry.register(mxGenericChangeCodec(new mxValueChange,"value")),mxCodecRegistry.register(mxGenericChangeCodec(new mxStyleChange,"style")),mxCodecRegistry.register(mxGenericChangeCodec(new mxGeometryChange,"geometry")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCollapseChange,"collapsed")),mxCodecRegistry.register(mxGenericChangeCodec(new mxVisibleChange,"visible")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCellAttributeChange,"value")),__mxOutput.mxGenericChangeCodec=void 0!==mxGenericChangeCodec?mxGenericChangeCodec:void 0,mxCodecRegistry.register(new mxObjectCodec(new mxGraph,["graphListeners","eventListeners","view","container","cellRenderer","editor","selection"])),__mxOutput.mxGraphCodec="undefined"!=typeof mxGraphCodec?mxGraphCodec:void 0,mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxGraphView);return t.encode=function(t,e){return this.encodeCell(t,e,e.graph.getModel().getRoot())},t.encodeCell=function(t,e,i){var n=e.graph.getModel(),r=e.getState(i),s=n.getParent(i);if(null==s||null!=r){var o=n.getChildCount(i),l=e.graph.getCellGeometry(i),a=null;if(s==n.getRoot()?a="layer":null==s?a="graph":n.isEdge(i)?a="edge":o>0&&null!=l?a="group":n.isVertex(i)&&(a="vertex"),null!=a){var h=t.document.createElement(a);if(null!=e.graph.getLabel(i)&&(h.setAttribute("label",e.graph.getLabel(i)),e.graph.isHtmlLabel(i)&&h.setAttribute("html",!0)),null==s){var u=e.getGraphBounds();null!=u&&(h.setAttribute("x",Math.round(u.x)),h.setAttribute("y",Math.round(u.y)),h.setAttribute("width",Math.round(u.width)),h.setAttribute("height",Math.round(u.height))),h.setAttribute("scale",e.scale)}else if(null!=r&&null!=l){for(var p in r.style){var d=r.style[p];"function"==typeof d&&"object"==typeof d&&(d=mxStyleRegistry.getName(d)),null!=d&&"function"!=typeof d&&"object"!=typeof d&&h.setAttribute(p,d)}var c=r.absolutePoints;if(null!=c&&c.length>0){var m=Math.round(c[0].x)+","+Math.round(c[0].y);for(p=1;p0&&i.appendChild(s)}}return i},t.getStringValue=function(t,e){var i=typeof e;return"function"==i?e=mxStyleRegistry.getName(e):"object"==i&&(e=null),e},t.decode=function(t,e,i){var n=i||new this.template.constructor,r=e.getAttribute("id");for(null!=r&&(t.objects[r]=n),e=e.firstChild;null!=e;){if(!this.processInclude(t,e,n)&&"add"==e.nodeName){var s=e.getAttribute("as");if(null!=s){var o=e.getAttribute("extend"),l=null!=o?mxUtils.clone(n.styles[o]):null;null==l&&(null!=o&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+o+" not found to extend"),l=new Object);for(var a=e.firstChild;null!=a;){if(a.nodeType==mxConstants.NODETYPE_ELEMENT){var h=a.getAttribute("as");if("add"==a.nodeName){var u=mxUtils.getTextContent(a),p=null;null!=u&&u.length>0&&mxStylesheetCodec.allowEval?p=mxUtils.eval(u):(p=a.getAttribute("value"),mxUtils.isNumeric(p)&&(p=parseFloat(p))),null!=p&&(l[h]=p)}else"remove"==a.nodeName&&delete l[h]}a=a.nextSibling}n.putCellStyle(s,l)}}e=e.nextSibling}return n},t}());mxStylesheetCodec.allowEval=!0,__mxOutput.mxStylesheetCodec=void 0!==mxStylesheetCodec?mxStylesheetCodec:void 0,mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxDefaultKeyHandler);return t.encode=function(t,e){return null},t.decode=function(t,e,i){if(null!=i)for(i.editor,e=e.firstChild;null!=e;){if(!this.processInclude(t,e,i)&&"add"==e.nodeName){var n=e.getAttribute("as"),r=e.getAttribute("action"),s=e.getAttribute("control");i.bindAction(n,r,s)}e=e.nextSibling}return i},t}()),__mxOutput.mxDefaultKeyHandlerCodec="undefined"!=typeof mxDefaultKeyHandlerCodec?mxDefaultKeyHandlerCodec:void 0;var mxDefaultToolbarCodec=mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxDefaultToolbar);return t.encode=function(t,e){return null},t.decode=function(t,e,i){if(null!=i){var n=i.editor;for(e=e.firstChild;null!=e;){if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(t,e,i))if("separator"==e.nodeName)i.addSeparator();else if("br"==e.nodeName)i.toolbar.addBreak();else if("hr"==e.nodeName)i.toolbar.addLine();else if("add"==e.nodeName){var r=e.getAttribute("as");r=mxResources.get(r)||r;var s=e.getAttribute("icon"),o=e.getAttribute("pressedIcon"),l=e.getAttribute("action"),a=e.getAttribute("mode"),h=e.getAttribute("template"),u="0"!=e.getAttribute("toggle"),p=mxUtils.getTextContent(e),d=null;if(null!=l)d=i.addItem(r,s,l,o);else if(null!=a){var c=mxDefaultToolbarCodec.allowEval?mxUtils.eval(p):null;d=i.addMode(r,s,a,o,c)}else if(null!=h||null!=p&&p.length>0){var m=n.templates[h],g=e.getAttribute("style");null!=m&&null!=g&&(m=n.graph.cloneCell(m)).setStyle(g);var x=null;null!=p&&p.length>0&&mxDefaultToolbarCodec.allowEval&&(x=mxUtils.eval(p)),d=i.addPrototype(r,s,m,o,x,u)}else{var f=mxUtils.getChildNodes(e);if(f.length>0)if(null==s)for(var y=i.addActionCombo(r),v=0;v0&&d.setAttribute("id",L)}}e=e.nextSibling}}return i},t}());return mxDefaultToolbarCodec.allowEval=!0,__mxOutput.mxDefaultToolbarCodec=void 0!==mxDefaultToolbarCodec?mxDefaultToolbarCodec:void 0,mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxDefaultPopupMenu);return t.encode=function(t,e){return null},t.decode=function(t,e,i){var n=e.getElementsByTagName("include")[0];return null!=n?this.processInclude(t,n,i):null!=i&&(i.config=e),i},t}()),__mxOutput.mxDefaultPopupMenuCodec="undefined"!=typeof mxDefaultPopupMenuCodec?mxDefaultPopupMenuCodec:void 0,mxCodecRegistry.register(function(){var t=new mxObjectCodec(new mxEditor,["modified","lastSnapshot","ignoredChanges","undoManager","graphContainer","toolbarContainer"]);return t.afterDecode=function(t,e,i){var n=e.getAttribute("defaultEdge");null!=n&&(e.removeAttribute("defaultEdge"),i.defaultEdge=i.templates[n]);var r=e.getAttribute("defaultGroup");return null!=r&&(e.removeAttribute("defaultGroup"),i.defaultGroup=i.templates[r]),i},t.decodeChild=function(t,e,i){if("Array"==e.nodeName){var n=e.getAttribute("as");if("templates"==n)return void this.decodeTemplates(t,e,i)}else if("ui"==e.nodeName)return void this.decodeUi(t,e,i);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},t.decodeUi=function(t,e,i){for(var n=e.firstChild;null!=n;){if("add"==n.nodeName){var r=n.getAttribute("as"),s=n.getAttribute("element"),o=n.getAttribute("style"),l=null;if(null!=s)null!=(l=document.getElementById(s))&&null!=o&&(l.style.cssText+=";"+o);else{var a=parseInt(n.getAttribute("x")),h=parseInt(n.getAttribute("y")),u=n.getAttribute("width"),p=n.getAttribute("height");(l=document.createElement("div")).style.cssText=o,new mxWindow(mxResources.get(r)||r,l,a,h,u,p,!1,!0).setVisible(!0)}"graph"==r?i.setGraphContainer(l):"toolbar"==r?i.setToolbarContainer(l):"title"==r?i.setTitleContainer(l):"status"==r?i.setStatusContainer(l):"map"==r&&i.setMapContainer(l)}else"resource"==n.nodeName?mxResources.add(n.getAttribute("basename")):"stylesheet"==n.nodeName&&mxClient.link("stylesheet",n.getAttribute("name"));n=n.nextSibling}},t.decodeTemplates=function(t,e,i){null==i.templates&&(i.templates=[]);for(var n=mxUtils.getChildNodes(e),r=0;r{t[mxgraph.mxConstants.STYLE_ENDARROW]=mxgraph.mxConstants.ARROW_BLOCK_THIN}],[FlowKind.MESSAGE_FLOW,t=>{t[mxgraph.mxConstants.STYLE_DASHED]=!0,t[mxgraph.mxConstants.STYLE_DASH_PATTERN]="8 5",t[mxgraph.mxConstants.STYLE_STARTARROW]=mxgraph.mxConstants.ARROW_OVAL,t[mxgraph.mxConstants.STYLE_STARTSIZE]=8,t[mxgraph.mxConstants.STYLE_STARTFILL]=!1,t[mxgraph.mxConstants.STYLE_ENDARROW]=mxgraph.mxConstants.ARROW_BLOCK_THIN,t[mxgraph.mxConstants.STYLE_ENDFILL]=!1}],[FlowKind.ASSOCIATION_FLOW,t=>{t[mxgraph.mxConstants.STYLE_DASHED]=!0,t[mxgraph.mxConstants.STYLE_DASH_PATTERN]="1 2",t[mxgraph.mxConstants.STYLE_ENDARROW]=mxgraph.mxConstants.ARROW_OPEN_THIN,t[mxgraph.mxConstants.STYLE_STARTARROW]=mxgraph.mxConstants.ARROW_OPEN_THIN,t[mxgraph.mxConstants.STYLE_STARTSIZE]=12}]]),this.specificSequenceFlowStyles=new Map([[SequenceFlowKind.DEFAULT,t=>{t[mxgraph.mxConstants.STYLE_STARTARROW]=MarkerIdentifier.ARROW_DASH}],[SequenceFlowKind.CONDITIONAL_FROM_ACTIVITY,t=>{t[mxgraph.mxConstants.STYLE_STARTARROW]=mxgraph.mxConstants.ARROW_DIAMOND_THIN,t[mxgraph.mxConstants.STYLE_STARTSIZE]=18,t[mxgraph.mxConstants.STYLE_STARTFILL]=!1}]]),this.specificAssociationFlowStyles=new Map([[AssociationDirectionKind.NONE,t=>{t[mxgraph.mxConstants.STYLE_STARTARROW]=void 0,t[mxgraph.mxConstants.STYLE_ENDARROW]=void 0,t[mxgraph.mxConstants.STYLE_EDGE]=void 0}],[AssociationDirectionKind.ONE,t=>{t[mxgraph.mxConstants.STYLE_STARTARROW]=void 0,t[mxgraph.mxConstants.STYLE_EDGE]=void 0}],[AssociationDirectionKind.BOTH,t=>{t[mxgraph.mxConstants.STYLE_EDGE]=void 0}]])}configureStyles(){mxgraph.mxConstants.RECTANGLE_ROUNDING_FACTOR=.1,this.configureDefaultVertexStyle(),this.configurePoolStyle(),this.configureLaneStyle(),this.configureTextAnnotationStyle(),this.configureActivityStyles(),this.configureEventStyles(),this.configureGatewayStyles(),this.configureDefaultEdgeStyle(),this.configureFlowStyles()}getStylesheet(){return this.graph.getStylesheet()}getDefaultVertexStyle(){return this.getStylesheet().getDefaultVertexStyle()}getDefaultEdgeStyle(){return this.getStylesheet().getDefaultEdgeStyle()}cloneDefaultVertexStyle(){const t=this.getDefaultVertexStyle();return mxgraph.mxUtils.clone(t)}cloneDefaultEdgeStyle(){const t=this.getDefaultEdgeStyle();return mxgraph.mxUtils.clone(t)}putCellStyle(t,e){this.getStylesheet().putCellStyle(t,e)}configureDefaultVertexStyle(){const t=this.getDefaultVertexStyle();this.configureCommonDefaultStyle(t)}configurePoolStyle(){const t=this.cloneDefaultVertexStyle();t[mxgraph.mxConstants.STYLE_SHAPE]=mxgraph.mxConstants.SHAPE_SWIMLANE,t[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_MIDDLE,t[mxgraph.mxConstants.STYLE_ALIGN]=mxgraph.mxConstants.ALIGN_CENTER,t[mxgraph.mxConstants.STYLE_STARTSIZE]=StyleDefault.POOL_LABEL_SIZE,this.graph.getStylesheet().putCellStyle(ShapeBpmnElementKind.POOL,t)}configureLaneStyle(){const t=this.cloneDefaultVertexStyle();t[mxgraph.mxConstants.STYLE_SHAPE]=mxgraph.mxConstants.SHAPE_SWIMLANE,t[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_MIDDLE,t[mxgraph.mxConstants.STYLE_ALIGN]=mxgraph.mxConstants.ALIGN_CENTER,t[mxgraph.mxConstants.STYLE_SWIMLANE_LINE]=0,t[mxgraph.mxConstants.STYLE_STARTSIZE]=StyleDefault.LANE_LABEL_SIZE,this.graph.getStylesheet().putCellStyle(ShapeBpmnElementKind.LANE,t)}configureEventStyles(){ShapeUtil.topLevelBpmnEventKinds().forEach(t=>{const e=this.cloneDefaultVertexStyle();e[mxgraph.mxConstants.STYLE_SHAPE]=t,e[mxgraph.mxConstants.STYLE_PERIMETER]=mxgraph.mxPerimeter.EllipsePerimeter,e[mxgraph.mxConstants.STYLE_VERTICAL_LABEL_POSITION]=mxgraph.mxConstants.ALIGN_BOTTOM,this.putCellStyle(t,e)})}configureTextAnnotationStyle(){const t=this.cloneDefaultVertexStyle();t[mxgraph.mxConstants.STYLE_SHAPE]=ShapeBpmnElementKind.TEXT_ANNOTATION,t[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_MIDDLE,t[mxgraph.mxConstants.STYLE_ALIGN]=mxgraph.mxConstants.ALIGN_LEFT,t[mxgraph.mxConstants.STYLE_SPACING_LEFT]=5,this.putCellStyle(ShapeBpmnElementKind.TEXT_ANNOTATION,t)}configureActivityStyles(){ShapeUtil.activityKinds().forEach(t=>{const e=this.cloneDefaultVertexStyle();e[mxgraph.mxConstants.STYLE_SHAPE]=t,e[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_MIDDLE,this.putCellStyle(t,e)})}configureGatewayStyles(){ShapeUtil.gatewayKinds().forEach(t=>{const e=this.cloneDefaultVertexStyle();e[mxgraph.mxConstants.STYLE_SHAPE]=t,e[mxgraph.mxConstants.STYLE_PERIMETER]=mxgraph.mxPerimeter.RhombusPerimeter,e[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_TOP,e[mxgraph.mxConstants.STYLE_LABEL_POSITION]=mxgraph.mxConstants.ALIGN_LEFT,e[mxgraph.mxConstants.STYLE_VERTICAL_LABEL_POSITION]=mxgraph.mxConstants.ALIGN_TOP,this.putCellStyle(t,e)})}configureDefaultEdgeStyle(){const t=this.getDefaultEdgeStyle();t[mxgraph.mxConstants.STYLE_EDGE]=mxgraph.mxConstants.EDGESTYLE_SEGMENT,t[mxgraph.mxConstants.STYLE_ENDSIZE]=12,t[mxgraph.mxConstants.STYLE_STROKEWIDTH]=1.5,t[mxgraph.mxConstants.STYLE_ROUNDED]=1,t[mxgraph.mxConstants.STYLE_ARCSIZE]=5,t[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN]=mxgraph.mxConstants.ALIGN_BOTTOM,delete t[mxgraph.mxConstants.STYLE_ENDARROW],this.configureCommonDefaultStyle(t)}configureCommonDefaultStyle(t){t[mxgraph.mxConstants.STYLE_FONTFAMILY]=StyleDefault.DEFAULT_FONT_FAMILY,t[mxgraph.mxConstants.STYLE_FONTSIZE]=StyleDefault.DEFAULT_FONT_SIZE,t[mxgraph.mxConstants.STYLE_FONTCOLOR]=StyleDefault.DEFAULT_FONT_COLOR,t[mxgraph.mxConstants.STYLE_FILLCOLOR]=StyleDefault.DEFAULT_FILL_COLOR,t[mxgraph.mxConstants.STYLE_STROKECOLOR]=StyleDefault.DEFAULT_STROKE_COLOR,t[mxgraph.mxConstants.STYLE_LABEL_BACKGROUNDCOLOR]=mxgraph.mxConstants.NONE,t[mxgraph.mxConstants.STYLE_WHITE_SPACE]="wrap"}configureEdgeStyles(t,e){t.forEach(t=>{const i=this.cloneDefaultEdgeStyle();(e.get(t)||(()=>{}))(i),this.graph.getStylesheet().putCellStyle(t.toString(),i)})}configureSequenceFlowStyles(){this.configureEdgeStyles(Object.values(SequenceFlowKind),this.specificSequenceFlowStyles)}configureAssociationFlowStyles(){this.configureEdgeStyles(Object.values(AssociationDirectionKind),this.specificAssociationFlowStyles)}configureFlowStyles(){this.configureEdgeStyles(Object.values(FlowKind),this.specificFlowStyles),this.configureSequenceFlowStyles(),this.configureAssociationFlowStyles()}computeStyle(t,e){const i=[t.bpmnElement.kind];let n;t instanceof Shape?n=this.computeShapeStyle(t):(i.push(...this.computeEdgeStyle(t)),n=new Map);const r=this.computeFontStyleValues(t),s=this.computeLabelStyleValues(t,e);return[].concat([...i]).concat([...n,...r,...s].filter(([,t])=>t&&"undefined"!=t).map(([t,e])=>t+"="+e)).join(";")}computeShapeStyle(t){const e=new Map,i=t.bpmnElement;if(i instanceof ShapeBpmnEvent)e.set(StyleIdentifier.BPMN_STYLE_EVENT_KIND,i.eventKind),(i instanceof ShapeBpmnBoundaryEvent||i instanceof ShapeBpmnStartEvent&&void 0!==i.isInterrupting)&&e.set(StyleIdentifier.BPMN_STYLE_IS_INTERRUPTING,String(i.isInterrupting));else if(i instanceof ShapeBpmnActivity){i instanceof ShapeBpmnSubProcess?e.set(StyleIdentifier.BPMN_STYLE_SUB_PROCESS_KIND,i.subProcessKind):i.kind===ShapeBpmnElementKind.TASK_RECEIVE&&e.set(StyleIdentifier.BPMN_STYLE_INSTANTIATING,String(i.instantiate));const t=i.markers;t.length>0&&e.set(StyleIdentifier.BPMN_STYLE_MARKERS,t.join(","))}else ShapeUtil.isPoolOrLane(i.kind)?e.set(mxgraph.mxConstants.STYLE_HORIZONTAL,t.isHorizontal?"0":"1"):i instanceof ShapeBpmnEventBasedGateway&&(e.set(StyleIdentifier.BPMN_STYLE_INSTANTIATING,String(i.instantiate)),e.set(StyleIdentifier.BPMN_STYLE_EVENT_BASED_GATEWAY_KIND,String(i.gatewayKind)));return e}computeEdgeStyle(t){const e=[],i=t.bpmnElement;return i instanceof SequenceFlow&&e.push(i.sequenceFlowKind),i instanceof AssociationFlow&&e.push(i.associationDirectionKind),e}computeFontStyleValues(t){var e;const i=new Map,n=null===(e=t.label)||void 0===e?void 0:e.font;return n&&(i.set(mxgraph.mxConstants.STYLE_FONTFAMILY,n.name),i.set(mxgraph.mxConstants.STYLE_FONTSIZE,n.size),i.set(mxgraph.mxConstants.STYLE_FONTSTYLE,StyleConfigurator.getFontStyleValue(n))),i}computeLabelStyleValues(t,e){const i=new Map,n=t.bpmnElement;return e?(i.set(mxgraph.mxConstants.STYLE_VERTICAL_ALIGN,mxgraph.mxConstants.ALIGN_TOP),t.bpmnElement.kind!=ShapeBpmnElementKind.TEXT_ANNOTATION&&i.set(mxgraph.mxConstants.STYLE_ALIGN,mxgraph.mxConstants.ALIGN_CENTER),t instanceof Shape&&(i.set(mxgraph.mxConstants.STYLE_LABEL_WIDTH,e.width+1),i.set(mxgraph.mxConstants.STYLE_LABEL_POSITION,mxgraph.mxConstants.ALIGN_TOP),i.set(mxgraph.mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxgraph.mxConstants.ALIGN_LEFT))):t instanceof Shape&&(n instanceof ShapeBpmnSubProcess||n instanceof ShapeBpmnCallActivity)&&!n.markers.includes(ShapeBpmnMarkerKind.EXPAND)&&i.set(mxgraph.mxConstants.STYLE_VERTICAL_ALIGN,mxgraph.mxConstants.ALIGN_TOP),i}computeMessageFlowIconStyle(t){return`shape=${StyleIdentifier.BPMN_STYLE_MESSAGE_FLOW_ICON};${StyleIdentifier.BPMN_STYLE_IS_INITIATING}=${t.messageVisibleKind}`}static getFontStyleValue(t){let e=0;return t.isBold&&(e+=mxgraph.mxConstants.FONT_BOLD),t.isItalic&&(e+=mxgraph.mxConstants.FONT_ITALIC),t.isStrikeThrough&&(e+=mxgraph.mxConstants.FONT_STRIKETHROUGH),t.isUnderline&&(e+=mxgraph.mxConstants.FONT_UNDERLINE),e}}function computeScaledIconSize(t,e,i,n){let r,s;t.heightt.setIconOriginForIconCentered(),shape:{x:e,y:i,w:n,h:r,strokeWidth:s.strokewidth||StyleUtils.getStrokeWidth(s.style)},icon:{isFilled:l,fillColor:s.fill||StyleUtils.getFillColor(s.style),strokeColor:s.stroke||StyleUtils.getStrokeColor(s.style),strokeWidth:a,margin:StyleUtils.getMargin(s.style)}}}class IconPainter{paintEmptyIcon(){}newBpmnCanvas({c:t,ratioFromParent:e,setIconOrigin:i,shape:n,icon:r},s){return new BpmnCanvas({mxCanvas:t,shapeConfiguration:n,iconConfiguration:{originalSize:s,style:r,ratioFromShape:e,setIconOrigin:i}})}paintEnvelopeIcon(t){const e={width:485.41,height:321.76},i=this.newBpmnCanvas(t,e),n=e.width,r=e.height;i.rect(0,0,n,r),i.fillAndStroke();const{icon:s}=t;s.isFilled&&i.setStrokeColor(s.fillColor),i.begin(),i.moveTo(0,0),i.lineTo(.5*n,.6*r),i.lineTo(n,0),i.moveTo(0,r),i.lineTo(n/3,.45*r),i.moveTo(n,r),i.lineTo(2*n/3,.45*r),i.stroke()}paintCircleIcon(t){const e={width:t.shape.w,height:t.shape.h},i=this.newBpmnCanvas(t,e),n=e.width,r=e.height;n>0&&r>0&&i.ellipse(0,0,n,r),t.icon.isFilled?i.fillAndStroke():i.stroke()}paintClockIcon(t){const e=this.newBpmnCanvas(t,{height:152,width:152});e.begin(),e.moveTo(184,60),e.curveTo(188.4,60,192,56.4,192,52),e.lineTo(192,48),e.curveTo(192,40,188.4,40,184,40),e.curveTo(179.6,40,176,43.6,176,48),e.lineTo(176,52),e.curveTo(176,56.4,179.6,60,184,60),e.close(),e.moveTo(184,308),e.curveTo(179.6,308,176,311.6,176,316),e.lineTo(176,320),e.curveTo(176,324.4,179.6,328,184,328),e.curveTo(188.4,328,192,324.4,192,320),e.lineTo(192,316),e.curveTo(192,311.6,188.4,308,184,308),e.close(),e.moveTo(52,176),e.lineTo(48,176),e.curveTo(43.6,176,40,179.6,40,184),e.curveTo(40,188.4,43.6,192,48,192),e.lineTo(52,192),e.curveTo(56.4,192,69,188.4,60,184),e.curveTo(60,179.6,56.4,176,52,176),e.close(),e.moveTo(320,176),e.lineTo(316,176),e.curveTo(311.6,176,308,179.6,308,184),e.curveTo(308,188.4,311.6,192,316,192),e.lineTo(320,192),e.curveTo(324.4,192,328,188.4,328,184),e.curveTo(328,179.6,324.4,176,320,176),e.moveTo(93.6,82.4),e.curveTo(90.4,79.2,85.6,79.2,82.4,82.4),e.curveTo(79.2,85.6,79.2,90.4,82.4,93.6),e.lineTo(85.2,96.4),e.curveTo(86.8,98,88.8,98.8,90.8,98.8),e.curveTo(92.8,98.8,94.4,98,96.4,96.4),e.curveTo(99.6,93.2,99.6,88.4,96.4,85.2),e.lineTo(93.6,82.4),e.moveTo(85.2,271.6),e.lineTo(82.4,274.4),e.curveTo(79.2,277.6,79.2,282.4,82.4,285.6),e.curveTo(84,287.2,86,288,88,288),e.curveTo(90,288,92,287.2,93.6,285.6),e.lineTo(96.4,282.8),e.curveTo(99.6,279.6,99.6,274.8,96.4,271.6),e.curveTo(93.2,268.4,88.4,268.4,85.2,271.6),e.moveTo(274.4,82.4),e.lineTo(271.6,85.2),e.curveTo(268.4,88.4,268.4,93.2,271.6,96.4),e.curveTo(273.298,98,275.2,98.8,277.2,98.8),e.curveTo(279.2,98.8,281.2,98,282.8,96.4),e.lineTo(285.6,93.6),e.curveTo(288.8,90.4,288.8,85.6,285.6,82.4),e.curveTo(282.4,79.2,277.6,79.2,274.4,82.4),e.moveTo(192,180.8),e.lineTo(192,108),e.curveTo(192,103.6,188.4,100,184,100),e.curveTo(179.6,100,176,103.6,176,108),e.lineTo(176,184),e.curveTo(176,186,176.8,188,178.4,189.6),e.lineTo(266,277.2),e.curveTo(267.6,278.8,269.6,279.6,271.6,279.6),e.curveTo(273.6,279.6,275.6,278.8,277.2,277.2),e.curveTo(280.4,274,280.4,269.2,277.2,266),e.lineTo(192,180.8),e.moveTo(184,0),e.curveTo(82.4,0,0,82.4,0,184),e.curveTo(0,285.6,82.4,368,184,368),e.curveTo(285.6,368,368,285.6,368,184),e.curveTo(368,82.4,285.6,0,184,0),e.moveTo(184,352),e.curveTo(91.2,352,16,276.8,16,184),e.curveTo(16,91.2,91.2,16,184,16),e.curveTo(276.8,16,352,91.2,352,184),e.curveTo(352,276.8,276.8,352,184,352),e.fillAndStroke()}paintTriangleIcon(t){const e=this.newBpmnCanvas(t,{height:735,width:849});e.begin(),e.moveTo(497,55),e.lineTo(817,609),e.curveTo(849,665,808,735,744,735),e.lineTo(105,735),e.curveTo(40,735,0,665,32,609),e.lineTo(352,55),e.curveTo(384,0,465,0,497,55),e.close(),e.fillAndStroke()}paintUpArrowheadIcon(t){const e=this.newBpmnCanvas(t,{height:50,width:40});e.begin(),e.moveTo(0,49.5),e.lineTo(19.5,1),e.curveTo(19.75,.25,20,0,20.25,.25),e.lineTo(40,49.5),e.curveTo(40,49.5,39.75,50,39.6,49.75),e.lineTo(20,30),e.lineTo(.4,49.75),e.curveTo(.4,49.75,.25,50,0,49.5),e.close(),e.fillAndStroke()}paintDoubleLeftArrowheadsIcon(t){const e=this.newBpmnCanvas(t,{height:53.5,width:105});e.begin(),e.moveTo(91.4,0),e.curveTo(91.4,0,91.2,0,91,.2),e.lineTo(50,25),e.curveTo(47.9,25.8,46.7,26.6,46.4,27.3),e.lineTo(46.4,0),e.curveTo(46.4,0,46.2,0,46,.2),e.lineTo(4.9,25),e.curveTo(2,26.2,0,27.3,4.9,28.5),e.lineTo(45.8,53),e.curveTo(46,53.3,46.2,53.5,46.4,53.5),e.lineTo(46.4,27),e.curveTo(46.6,27.3,47.8,28.1,49.9,29.9),e.lineTo(90.8,53.3),e.curveTo(91,53.3,91.2,53.5,91.4,53.5),e.lineTo(91.4,0),e.close(),e.fillAndStroke()}drawCrossIcon(t){const e=this.newBpmnCanvas(t,{height:1,width:1});return e.begin(),e.moveTo(.38,0),e.lineTo(.62,0),e.lineTo(.62,.38),e.lineTo(1,.38),e.lineTo(1,.62),e.lineTo(.62,.62),e.lineTo(.62,1),e.lineTo(.38,1),e.lineTo(.38,.62),e.lineTo(0,.62),e.lineTo(0,.38),e.lineTo(.38,.38),e.close(),e}paintListIcon(t){const e=this.newBpmnCanvas(t,{height:60,width:60});e.begin(),e.moveTo(0,0),e.lineTo(60,0),e.lineTo(60,60),e.lineTo(0,60),e.lineTo(0,0),e.close(),e.moveTo(5,5),e.lineTo(55,5),e.close(),e.moveTo(5,21.6),e.lineTo(55,21.6),e.close(),e.moveTo(5,38.3),e.lineTo(55,38.3),e.close(),e.moveTo(5,55),e.lineTo(55,55),e.close(),e.fillAndStroke()}paintXCrossIcon(t){const e=this.drawCrossIcon(t);e.rotateOnIconCenter(45),e.fillAndStroke()}paintPlusCrossIcon(t){this.drawCrossIcon(t).fillAndStroke()}paintPersonIcon(t){const e=this.newBpmnCanvas(Object.assign(Object.assign({},t),{icon:Object.assign(Object.assign({},t.icon),{isFilled:!0})}),{height:239.68,width:143.61});e.begin(),e.moveTo(124.31,150.29),e.lineTo(99.66,141.03),e.arcTo(6.43,6.43,0,0,1,95.51,135.03),e.lineTo(95.51,130.66),e.arcTo(47.75,47.75,0,0,0,119.51,89.25),e.lineTo(119.51,71.25),e.arcTo(47.62,47.62,0,0,0,101.18,33.64),e.arcTo(29.35,29.35,0,0,0,101.52,29.14),e.arcTo(29.68,29.68,0,0,0,42.17,29.14),e.arcTo(29.24,29.24,0,0,0,42.53,33.63),e.arcTo(47.65,47.65,0,0,0,24.14,71.23),e.lineTo(24.14,89.23),e.arcTo(47.7,47.7,0,0,0,48.19,130.63),e.lineTo(48.19,135.03),e.arcTo(6.43,6.43,0,0,1,44.03,141.03),e.lineTo(19.31,150.29),e.arcTo(29.81,29.81,0,0,0,.09,178.03),e.lineTo(.09,233.51),e.arcTo(5.63,5.63,0,1,0,11.34,233.51),e.lineTo(11.34,178.03),e.arcTo(18.19,18.19,0,0,1,11.57,175.17),e.lineTo(20.5,184.11),e.arcTo(12.32,12.32,0,0,1,24.14,192.89),e.lineTo(24.14,233.51),e.arcTo(5.63,5.63,0,1,0,35.39,233.51),e.lineTo(35.39,192.93),e.arcTo(23.5,23.5,0,0,0,28.46,176.2),e.lineTo(17.04,164.78),e.arcTo(18.34,18.34,0,0,1,23.29,160.78),e.lineTo(43.65,153.15),e.lineTo(66.22,175.72),e.lineTo(66.22,233.51),e.arcTo(5.63,5.63,0,1,0,77.47,233.51),e.lineTo(77.47,175.76),e.lineTo(100.04,153.19),e.lineTo(120.4,160.82),e.arcTo(18.39,18.39,0,0,1,126.65,164.82),e.lineTo(115.24,176.24),e.arcTo(23.5,23.5,0,0,0,108.31,192.93),e.lineTo(108.31,233.55),e.arcTo(5.63,5.63,0,1,0,119.56,233.55),e.lineTo(119.56,192.93),e.arcTo(12.35,12.35,0,0,1,123.19,184.15),e.lineTo(132.13,175.22),e.arcTo(18,18,0,0,1,132.36,178.08),e.lineTo(132.36,233.56),e.arcTo(5.63,5.63,0,0,0,143.61,233.56),e.lineTo(143.61,178.03),e.arcTo(29.81,29.81,0,0,0,124.31,150.29),e.close(),e.moveTo(71.85,10.72),e.arcTo(18.46,18.46,0,0,1,90.17,27.18),e.arcTo(47.68,47.68,0,0,0,53.53,27.18),e.arcTo(18.44,18.44,0,0,1,71.85,10.72),e.close(),e.moveTo(35.39,71.23),e.arcTo(36.46,36.46,0,0,1,108.31,71.23),e.lineTo(108.31,77.4),e.curveTo(82.12,75.4,56.97,60.55,56.71,60.4),e.arcTo(5.62,5.62,0,0,0,48.78,62.71),e.curveTo(46.24,67.79,40.45,71.89,35.39,74.62),e.close(),e.moveTo(35.39,89.23),e.lineTo(35.39,87.08),e.curveTo(40.55,84.85,49.73,80.08,55.67,72.66),e.curveTo(64.83,77.46,85.92,87.21,108.31,88.66),e.lineTo(108.31,89.24),e.arcTo(36.46,36.46,0,1,1,35.39,89.24),e.close(),e.moveTo(71.85,165.45),e.lineTo(54.06,147.69),e.arcTo(17.7,17.7,0,0,0,59.43,135.32),e.arcTo(47.57,47.57,0,0,0,84.27,135.32),e.arcTo(17.7,17.7,0,0,0,89.64,147.69),e.close(),e.fill()}paintGearIcon(t){const e=this.newBpmnCanvas(t,{height:100,width:100});IconPainter.paintGearIconBackground(e),e.translateIconOrigin(14,14),IconPainter.paintGearIconForeground(e)}static paintGearIconBackground(t){t.begin(),t.moveTo(2.06,24.62),t.lineTo(10.17,30.95),t.lineTo(9.29,37.73),t.lineTo(0,41.42),t.lineTo(2.95,54.24),t.lineTo(13.41,52.92),t.lineTo(17.39,58.52),t.lineTo(13.56,67.66),t.lineTo(24.47,74.44),t.lineTo(30.81,66.33),t.lineTo(37.88,67.21),t.lineTo(41.57,76.5),t.lineTo(54.24,73.55),t.lineTo(53.06,62.94),t.lineTo(58.52,58.52),t.lineTo(67.21,63.09),t.lineTo(74.58,51.88),t.lineTo(66.03,45.25),t.lineTo(66.92,38.62),t.lineTo(76.5,34.93),t.lineTo(73.7,22.26),t.lineTo(62.64,23.44),t.lineTo(58.81,18.42),t.lineTo(62.79,8.7),t.lineTo(51.74,2.21),t.lineTo(44.81,10.47),t.lineTo(38.03,9.43),t.lineTo(33.75,0),t.lineTo(21.52,3.24),t.lineTo(22.7,13.56),t.lineTo(18.13,17.54),t.lineTo(8.7,13.56),t.close();IconPainter.paintGearInnerCircle(t,24.8,39)}static paintGearIconForeground(t){t.begin(),t.moveTo(16.46,41.42),t.lineTo(24.57,47.75),t.lineTo(23.69,54.53),t.lineTo(14.4,58.22),t.lineTo(17.35,71.04),t.lineTo(27.81,69.72),t.lineTo(31.79,75.32),t.lineTo(27.96,84.46),t.lineTo(38.87,91.24),t.lineTo(45.21,83.13),t.lineTo(52.28,84.01),t.lineTo(55.97,93.3),t.lineTo(68.64,90.35),t.lineTo(67.46,79.74),t.lineTo(72.92,75.32),t.lineTo(81.61,79.89),t.lineTo(88.98,68.68),t.lineTo(80.43,62.05),t.lineTo(81.32,55.42),t.lineTo(90.9,51.73),t.lineTo(88.1,39.06),t.lineTo(77.04,40.24),t.lineTo(73.21,35.22),t.lineTo(77.19,25.5),t.lineTo(66.14,19.01),t.lineTo(59.21,27.27),t.lineTo(52.43,26.23),t.lineTo(48.15,16.8),t.lineTo(35.92,20.04),t.lineTo(37.1,30.36),t.lineTo(32.53,34.34),t.lineTo(23.1,30.36),t.close();IconPainter.paintGearInnerCircle(t,39.2,55.8),t.begin(),IconPainter.paintGearInnerCircle(t,39.2,55.8)}static paintGearInnerCircle(t,e,i){const n=13.5;t.moveTo(e,i),t.arcTo(n,n,0,1,1,e+27,i),t.arcTo(n,n,0,0,1,e,i),t.close(),t.fillAndStroke()}paintExpandIcon(t){const e={width:16,height:16},i=this.newBpmnCanvas(t,e),n=e.width,r=e.height;i.roundrect(0,0,n,r,2,2),i.stroke(),i.begin(),i.moveTo(n/2,r/4),i.lineTo(n/2,3*r/4),i.close(),i.moveTo(n/4,r/2),i.lineTo(3*n/4,r/2),i.close(),i.fillAndStroke()}paintLoopIcon(t){const{icon:e}=t;e.fillColor=e.strokeColor;const i=this.newBpmnCanvas(t,{width:22.49,height:21.62});i.begin(),i.moveTo(5.5,19.08),i.arcTo(8,8,0,1,1,10.5,21.08),i.stroke(),i.begin(),i.moveTo(7.5,14.08),i.lineTo(5.75,19.08),i.lineTo(0,17.08),i.close(),i.fillAndStroke()}paintSequentialMultiInstanceIcon(t){const e={width:16,height:16},i=this.newBpmnCanvas(t,e),{c:n,icon:r}=t;n.setFillColor(r.strokeColor);const s=e.width,o=e.height/5;i.rect(0,0,s,o),i.fill(),i.rect(0,2*o,s,o),i.fill(),i.rect(0,4*o,s,o),i.fill()}paintParallelMultiInstanceIcon(t){const e={width:16,height:16},i=this.newBpmnCanvas(t,e),{c:n,icon:r}=t;n.setFillColor(r.strokeColor);const s=e.width/5,o=e.height;i.begin(),i.rect(0,0,s,o),i.fill(),i.rect(2*s,0,s,o),i.fill(),i.rect(4*s,0,s,o),i.fill()}paintRightArrowIcon(t){const e=this.newBpmnCanvas(t,{width:512,height:415.23});e.setRoundLineJoin(),e.begin(),e.moveTo(512,207.61),e.lineTo(304.38,0),e.lineTo(304.38,135.39),e.lineTo(0,135.39),e.lineTo(0,279.84),e.lineTo(304.38,279.84),e.lineTo(304.38,415.23),e.lineTo(512,207.61),e.close(),e.fillAndStroke()}paintErrorIcon(t){const e=this.newBpmnCanvas(t,{width:72.44,height:71.82});e.begin(),e.moveTo(0,53.32),e.lineTo(19.48,0),e.lineTo(19.48,0),e.lineTo(50.85,40.07),e.lineTo(72.44,18.21),e.lineTo(53.12,71.82),e.lineTo(22.5,31.37),e.close(),e.fillAndStroke()}paintHandIcon(t){const e=this.newBpmnCanvas(t,{width:343.65,height:354.12});e.begin(),e.moveTo(231.66,336.39),e.curveTo(240.84,316.9,220.53,306.92,220.53,306.92),e.curveTo(215.2,303.67,188.58,287.43,140.67,258.19),e.lineTo(146.33,248.39),e.curveTo(223.98,269.38,267.12,281.04,275.75,283.38),e.curveTo(275.75,283.38,297.25,288,301.42,267.77),e.curveTo(306.34,245.29,288.32,238.63,288.32,238.63),e.curveTo(279.91,236.44,237.86,225.48,162.18,205.75),e.lineTo(165.2,194.8),e.curveTo(255.88,204.4,306.27,209.73,316.34,210.8),e.curveTo(316.34,210.8,339.89,212.16,341.76,189.55),e.curveTo(343.65,166.93,320.5,164.13,320.5,164.13),e.curveTo(310.43,163.1,260.04,157.99,169.35,148.77),e.lineTo(169.35,138.97),e.curveTo(253.41,132.12,300.11,128.32,309.45,127.56),e.curveTo(309.45,127.56,332.27,122.38,332.27,102.61),e.curveTo(332.27,82.85,305.48,81.87,305.48,81.87),e.curveTo(293.99,82.2,236.54,83.88,133.13,86.9),e.lineTo(127.61,81.87),e.curveTo(145.3,59.39,155.12,46.9,157.09,44.41),e.curveTo(157.09,44.41,171.12,26.8,156.78,12.72),e.curveTo(143.83,0,124.08,14.49,124.08,14.49),e.curveTo(116.45,19.41,78.35,44.06,9.77,88.43),e.lineTo(0,251.94),e.curveTo(122.84,308.79,191.09,340.37,204.74,346.69),e.curveTo(204.74,346.69,222.91,354.12,231.66,336.39),e.fillAndStroke()}paintScriptIcon(t){t.icon.fillColor=t.icon.strokeColor;const e=this.newBpmnCanvas(t,{width:458.75,height:461.64});e.begin(),e.moveTo(67.85,.57),e.curveTo(50.73,0,33.26,8.86,22.35,18.84),e.curveTo(8.11,32.15,0,50.77,0,70.26),e.curveTo(0,73.15,0,87.59,0,113.6),e.curveTo(55.4,113.6,86.18,113.6,92.33,113.6),e.curveTo(94.92,150.46,85.64,180.4,74.22,211.27),e.curveTo(40.16,298.07,30.77,339.83,55.56,410.87),e.curveTo(63.72,438.26,87.59,457.85,114.91,461.09),e.curveTo(216.96,460.85,294.9,461.64,388.41,461.2),e.curveTo(407.2,461.09,425.14,453.55,438.3,440.13),e.curveTo(451.46,426.71,458.75,403.06,458.46,384.26),e.curveTo(458.43,382.23,458.18,365.93,458.15,363.89),e.curveTo(432.12,364.24,406.09,364.04,380.06,364.04),e.curveTo(377.61,347.52,377.24,337.58,378.28,324.48),e.curveTo(380.5,296.47,389.08,273.36,398.59,247.1),e.curveTo(408.11,220.83,418.41,191.47,420.86,154.24),e.curveTo(422.11,135.34,421.4,110.24,417.77,86.75),e.curveTo(417.76,86.71,417.73,86.54,417.69,86.22),e.curveTo(417.64,85.95,417.61,85.79,417.6,85.76),e.curveTo(414.03,68.13,410.49,48.84,399.79,31.47),e.curveTo(389.09,14.11,366.95,.59,341.75,.59),e.curveTo(286.97,.59,122.63,.57,67.85,.57),e.close(),e.moveTo(85.04,72.68),e.curveTo(80.63,72.68,45.33,72.68,40.92,72.68),e.curveTo(40.46,58.4,47.15,51.87,50.27,48.75),e.curveTo(55.8,44.28,59.84,41,73.82,41),e.curveTo(78.45,52.13,82.23,62.71,85.04,72.68),e.close(),e.moveTo(364.94,52.9),e.curveTo(370,61.11,373.9,76.44,377.38,93.51),e.curveTo(380.35,113.1,381.01,136.42,380.02,151.57),e.curveTo(377.97,182.76,369.51,207.12,360.1,233.1),e.curveTo(350.69,259.09,340.27,286.77,337.53,321.27),e.curveTo(336.38,335.86,336.72,346.69,338.87,364.01),e.curveTo(326.35,364.01,263.75,364.01,151.06,364.01),e.curveTo(151.06,382.2,151.06,392.31,151.06,394.33),e.curveTo(147.77,404.8,138.9,418.2,127.43,419.94),e.curveTo(111.49,422.35,97.86,411.8,94.75,399.19),e.curveTo(65.14,321.99,94.93,275.54,112.57,225.47),e.curveTo(130.14,177.95,137.92,117.41,112.71,42.09),e.curveTo(192.88,41.9,274.33,42.21,342.89,41.98),e.curveTo(357.15,42.03,359.83,44.61,364.94,52.9),e.close(),e.moveTo(409.96,399.48),e.curveTo(409.96,408.42,398.54,425.67,392.02,425.67),e.curveTo(325.19,425.79,252.29,425.67,185.23,425.67),e.curveTo(189.88,424.43,194.66,405.64,194.66,399.48),e.curveTo(237.72,399.48,388.43,399.48,409.96,399.48),e.close(),e.fill(),e.begin(),e.moveTo(182.1,131.2),e.lineTo(182.1,151.68),e.lineTo(321.89,151.68),e.lineTo(321.89,131.2),e.lineTo(182.1,131.2),e.close(),e.moveTo(162.25,251.09),e.lineTo(162.25,271.49),e.lineTo(301.96,271.49),e.lineTo(301.96,251.09),e.lineTo(162.25,251.09),e.close(),e.fill()}paintTableIcon(t){const e=this.newBpmnCanvas(t,{width:640,height:640});e.begin(),e.moveTo(.19,.1),e.lineTo(298.78,.1),e.lineTo(298.78,198.88),e.lineTo(.19,198.88),e.lineTo(.19,.1),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(0,0),e.lineTo(298.78,0),e.lineTo(298.78,48.88),e.lineTo(0,48.88),e.lineTo(0,0),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(0,48.88),e.lineTo(98.78,48.88),e.lineTo(98.78,198.88),e.lineTo(0,198.88),e.lineTo(0,48.88),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(1.09,122.69),e.lineTo(298.78,122.69),e.close(),e.fillAndStroke(),e.setFillColor(t.icon.strokeColor),e.begin(),e.moveTo(0,0),e.lineTo(298.78,0),e.lineTo(298.78,48.88),e.lineTo(0,48.88),e.lineTo(0,0),e.close(),e.fillAndStroke()}paintPentagon(t){const e=this.newBpmnCanvas(t,{width:16,height:16});e.begin(),e.moveTo(16,6.5),e.lineTo(8,0),e.lineTo(0,6.5),e.lineTo(3,16),e.lineTo(13,16),e.lineTo(16,6.5),e.lineTo(8,0),e.stroke()}}class IconPainterProvider{static get(){return this.instance}static set(t){this.instance=t}}IconPainterProvider.instance=new IconPainter;class EventShape extends mxgraph.mxEllipse{constructor(t,e,i,n){super(t,e,i,n),this.iconPainter=IconPainterProvider.get(),this.iconPainters=new Map([[ShapeBpmnEventKind.MESSAGE,t=>this.iconPainter.paintEnvelopeIcon(Object.assign(Object.assign({},t),{ratioFromParent:.5}))],[ShapeBpmnEventKind.TERMINATE,t=>this.iconPainter.paintCircleIcon(Object.assign(Object.assign({},t),{ratioFromParent:.6}))],[ShapeBpmnEventKind.TIMER,t=>this.iconPainter.paintClockIcon(Object.assign(Object.assign({},t),{setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(5)}))],[ShapeBpmnEventKind.SIGNAL,t=>this.iconPainter.paintTriangleIcon(Object.assign(Object.assign({},t),{ratioFromParent:.55,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:StyleDefault.STROKE_WIDTH_THIN.valueOf()}),setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(4)}))],[ShapeBpmnEventKind.LINK,t=>this.iconPainter.paintRightArrowIcon(Object.assign(Object.assign({},t),{ratioFromParent:.55,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:1.5})}))],[ShapeBpmnEventKind.ERROR,t=>this.iconPainter.paintErrorIcon(Object.assign(Object.assign({},t),{ratioFromParent:.55,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:1.5})}))],[ShapeBpmnEventKind.COMPENSATION,t=>this.iconPainter.paintDoubleLeftArrowheadsIcon(Object.assign(Object.assign({},t),{ratioFromParent:.7,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:1.5})}))],[ShapeBpmnEventKind.CANCEL,t=>this.iconPainter.paintXCrossIcon(Object.assign(Object.assign({},t),{ratioFromParent:.78}))],[ShapeBpmnEventKind.ESCALATION,t=>this.iconPainter.paintUpArrowheadIcon(Object.assign(Object.assign({},t),{ratioFromParent:.55,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:StyleDefault.STROKE_WIDTH_THIN.valueOf()})}))],[ShapeBpmnEventKind.CONDITIONAL,t=>this.iconPainter.paintListIcon(Object.assign(Object.assign({},t),{ratioFromParent:.6,icon:Object.assign(Object.assign({},t.icon),{strokeWidth:1.5})}))]]),this.withFilledIcon=!1}paintVertexShape(t,e,i,n,r){this.markNonFullyRenderedEvents(t);const s=buildPaintParameter(t,e,i,n,r,this,.25,this.withFilledIcon);EventShape.setDashedOuterShapePattern(s,StyleUtils.getBpmnIsInterrupting(this.style)),this.paintOuterShape(s),EventShape.restoreOriginalOuterShapePattern(s),this.paintInnerShape(s)}markNonFullyRenderedEvents(t){}paintOuterShape({c:t,shape:{x:e,y:i,w:n,h:r}}){super.paintVertexShape(t,e,i,n,r)}paintInnerShape(t){(this.iconPainters.get(StyleUtils.getBpmnEventKind(this.style))||(()=>this.iconPainter.paintEmptyIcon()))(t)}static setDashedOuterShapePattern(t,e){t.c.save(),"false"===e&&(t.c.setDashed(!0,!1),t.c.setDashPattern("3 2"))}static restoreOriginalOuterShapePattern(t){t.c.restore()}}class StartEventShape extends EventShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}}class EndEventShape extends EventShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THICK){super(t,e,i,n),this.withFilledIcon=!0}}class IntermediateEventShape extends EventShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}paintOuterShape({c:t,shape:{x:e,y:i,w:n,h:r,strokeWidth:s}}){t.ellipse(e,i,n,r),t.fillAndStroke();const o=1.5*s;t.ellipse(.02*n+o+e,.02*r+o+i,.96*n-2*o,.96*r-2*o),t.stroke()}}class CatchIntermediateEventShape extends IntermediateEventShape{constructor(t,e,i,n){super(t,e,i,n)}}class ThrowIntermediateEventShape extends IntermediateEventShape{constructor(t,e,i,n){super(t,e,i,n),this.withFilledIcon=!0}}class BoundaryEventShape extends IntermediateEventShape{constructor(t,e,i,n){super(t,e,i,n)}}class GatewayShape extends mxgraph.mxRhombus{constructor(t,e,i,n){super(t,e,i,n),this.iconPainter=IconPainterProvider.get()}paintVertexShape(t,e,i,n,r){const s=buildPaintParameter(t,e,i,n,r,this);this.paintOuterShape(s),this.paintInnerShape(s)}paintOuterShape({c:t,shape:{x:e,y:i,w:n,h:r}}){super.paintVertexShape(t,e,i,n,r)}}class ExclusiveGatewayShape extends GatewayShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}paintInnerShape(t){this.iconPainter.paintXCrossIcon(Object.assign(Object.assign({},t),{icon:Object.assign(Object.assign({},t.icon),{isFilled:!0}),ratioFromParent:.5}))}}class ParallelGatewayShape extends GatewayShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}paintInnerShape(t){this.iconPainter.paintPlusCrossIcon(Object.assign(Object.assign({},t),{icon:Object.assign(Object.assign({},t.icon),{isFilled:!0}),ratioFromParent:.5}))}}class InclusiveGatewayShape extends GatewayShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}paintInnerShape(t){this.iconPainter.paintCircleIcon(Object.assign(Object.assign({},t),{ratioFromParent:.62,icon:Object.assign(Object.assign({},t.icon),{isFilled:!1,strokeWidth:StyleDefault.STROKE_WIDTH_THICK.valueOf()})}))}}class EventBasedGatewayShape extends GatewayShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n)}paintInnerShape(t){t=Object.assign(Object.assign({},t),{icon:Object.assign(Object.assign({},t.icon),{strokeWidth:1})}),this.iconPainter.paintCircleIcon(Object.assign(Object.assign({},t),{ratioFromParent:.55})),StyleUtils.getBpmnIsInstantiating(this.style)||this.iconPainter.paintCircleIcon(Object.assign(Object.assign({},t),{ratioFromParent:.45}));const e=Object.assign(Object.assign({},t),{ratioFromParent:.3});StyleUtils.getBpmnIsParallelEventBasedGateway(this.style)?this.iconPainter.paintPlusCrossIcon(e):this.iconPainter.paintPentagon(e)}}const referenceOrderedMarkers=[ShapeBpmnMarkerKind.LOOP,ShapeBpmnMarkerKind.MULTI_INSTANCE_PARALLEL,ShapeBpmnMarkerKind.MULTI_INSTANCE_SEQUENTIAL,ShapeBpmnMarkerKind.COMPENSATION,ShapeBpmnMarkerKind.EXPAND,ShapeBpmnMarkerKind.ADHOC];function orderActivityMarkers(t){const e=[];return referenceOrderedMarkers.forEach(i=>{t.includes(i)&&e.push(i)}),t.filter(t=>!e.includes(t)).forEach(t=>{e.push(t)}),e}function paintEnvelopeIcon(t,e){IconPainterProvider.get().paintEnvelopeIcon(Object.assign(Object.assign({},t),{setIconOrigin:t=>t.setIconOriginToShapeTopLeft(),ratioFromParent:.2,icon:Object.assign(Object.assign({},t.icon),{isFilled:e})}))}class BaseActivityShape extends mxgraph.mxRectangleShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n),this.iconPainter=IconPainterProvider.get(),this.isRounded=!0}paintForeground(t,e,i,n,r){super.paintForeground(t,e,i,n,r),this.paintMarkerIcons(buildPaintParameter(t,e,i,n,r,this,0,!1,1.5))}paintMarkerIcons(t){const e=StyleUtils.getBpmnMarkers(this.style);e&&orderActivityMarkers(e.split(",")).forEach((e,i,n)=>{switch((t=Object.assign(Object.assign({},t),{setIconOrigin:this.getIconOriginForMarkerIcon(n.length,i+1)})).c.save(),e){case ShapeBpmnMarkerKind.LOOP:this.iconPainter.paintLoopIcon(t);break;case ShapeBpmnMarkerKind.MULTI_INSTANCE_SEQUENTIAL:this.iconPainter.paintSequentialMultiInstanceIcon(t);break;case ShapeBpmnMarkerKind.MULTI_INSTANCE_PARALLEL:this.iconPainter.paintParallelMultiInstanceIcon(t);break;case ShapeBpmnMarkerKind.EXPAND:this.iconPainter.paintExpandIcon(t)}t.c.restore()})}getIconOriginForMarkerIcon(t,e){let i;if(1===t)i=t=>t.setIconOriginForIconBottomCentered();else{if(2!==t)throw new Error("NOT_IMPLEMENTED - to have a group of >2 markers in a row, centered in the task, implement this piece of code");i=t=>{t.setIconOriginForIconBottomCentered();const i=Math.pow(-1,e)*(StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_SIZE/2+StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_MARGIN);t.translateIconOrigin(i,0)}}return i}}class BaseTaskShape extends BaseActivityShape{constructor(t,e,i,n){super(t,e,i,n)}paintForeground(t,e,i,n,r){super.paintForeground(t,e,i,n,r),this.paintTaskIcon(buildPaintParameter(t,e,i,n,r,this))}}class TaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintEmptyIcon()}}class ServiceTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintGearIcon(Object.assign(Object.assign({},t),{setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(20)}))}}class UserTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintPersonIcon(Object.assign(Object.assign({},t),{setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(20)}))}}class ReceiveTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){if(!StyleUtils.getBpmnIsInstantiating(this.style))return void paintEnvelopeIcon(t,!1);const e=Object.assign(Object.assign({},t.shape),{w:20,h:20});this.iconPainter.paintCircleIcon({c:t.c,shape:e,icon:Object.assign(Object.assign({},t.icon),{isFilled:!1}),ratioFromParent:void 0,setIconOrigin:t=>t.setIconOriginToShapeTopLeft(4,4)}),e.x+=4,e.y+=4,this.iconPainter.paintEnvelopeIcon(Object.assign(Object.assign({},t),{shape:e,ratioFromParent:.65,setIconOrigin:t=>t.setIconOriginForIconCentered()}))}}class SendTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){paintEnvelopeIcon(t,!0)}}class ManualTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintHandIcon(Object.assign(Object.assign({},t),{ratioFromParent:.18,setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(20)}))}}class ScriptTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintScriptIcon(Object.assign(Object.assign({},t),{ratioFromParent:.22,setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(20)}))}}class CallActivityShape extends BaseActivityShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THICK){super(t,e,i,n)}}class SubProcessShape extends BaseActivityShape{constructor(t,e,i,n){super(t,e,i,n)}paintBackground(t,e,i,n,r){const s=StyleUtils.getBpmnSubProcessKind(this.style);t.save(),s===ShapeBpmnSubProcessKind.EVENT&&(t.setDashed(!0,!1),t.setDashPattern("1 2")),super.paintBackground(t,e,i,n,r),t.restore()}}class BusinessRuleTaskShape extends BaseTaskShape{constructor(t,e,i,n){super(t,e,i,n)}paintTaskIcon(t){this.iconPainter.paintTableIcon(Object.assign(Object.assign({},t),{ratioFromParent:.6,setIconOrigin:t=>t.setIconOriginToShapeTopLeftProportionally(15)}))}}class TextAnnotationShape extends mxgraph.mxRectangleShape{constructor(t,e,i,n=StyleDefault.STROKE_WIDTH_THIN){super(t,e,i,n),this.TEXT_ANNOTATION_BORDER_LENGTH=10}paintBackground(t,e,i,n,r){t.begin(),t.moveTo(e+this.TEXT_ANNOTATION_BORDER_LENGTH,i),t.lineTo(e,i),t.lineTo(e,i+r),t.lineTo(e+this.TEXT_ANNOTATION_BORDER_LENGTH,i+r),t.fillAndStroke()}}var MessageVisibleKind,FitType;!function(t){t.NONE="none",t.INITIATING="initiating",t.NON_INITIATING="non_initiating"}(MessageVisibleKind||(MessageVisibleKind={}));class MessageFlowIconShape extends mxgraph.mxRectangleShape{constructor(t,e,i,n){super(t,e,i,n),this.iconPainter=IconPainterProvider.get()}paintVertexShape(t,e,i,n,r){const s=buildPaintParameter(t,e,i,n,r,this,1,StyleUtils.getBpmnIsInitiating(this.style)===MessageVisibleKind.NON_INITIATING);this.iconPainter.paintEnvelopeIcon(s)}}function computeAllBpmnClassNames(t,e){const i=[];return i.push(computeBpmnBaseClassName(t)),e&&i.push("bpmn-label"),i}function computeBpmnBaseClassName(t){return t?"bpmn-"+t.replace(/([A-Z])/g,t=>"-"+t[0].toLowerCase()):""}function extractBpmnKindFromStyle(t){return t.style.split(";")[0]}class ShapeConfigurator{configureShapes(){this.initMxShapePrototype(),this.registerShapes()}registerShapes(){mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.EVENT_END,EndEventShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.EVENT_START,StartEventShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW,ThrowIntermediateEventShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.EVENT_INTERMEDIATE_CATCH,CatchIntermediateEventShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.EVENT_BOUNDARY,BoundaryEventShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.GATEWAY_EVENT_BASED,EventBasedGatewayShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.GATEWAY_EXCLUSIVE,ExclusiveGatewayShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.GATEWAY_INCLUSIVE,InclusiveGatewayShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.GATEWAY_PARALLEL,ParallelGatewayShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.SUB_PROCESS,SubProcessShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.CALL_ACTIVITY,CallActivityShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK,TaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_SERVICE,ServiceTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_USER,UserTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_RECEIVE,ReceiveTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_SEND,SendTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_MANUAL,ManualTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_SCRIPT,ScriptTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TASK_BUSINESS_RULE,BusinessRuleTaskShape),mxgraph.mxCellRenderer.registerShape(ShapeBpmnElementKind.TEXT_ANNOTATION,TextAnnotationShape),mxgraph.mxCellRenderer.registerShape(StyleIdentifier.BPMN_STYLE_MESSAGE_FLOW_ICON,MessageFlowIconShape)}initMxShapePrototype(){mxgraph.mxShape.prototype.createSvgCanvas=function(){const t=new mxgraph.mxSvgCanvas2D(this.node,!1);t.strokeTolerance=this.pointerEvents?this.svgStrokeTolerance:0,t.pointerEventsValue=this.svgPointerEvents;const e=this.getSvgScreenOffset();if(0!=e?this.node.setAttribute("transform","translate("+e+","+e+")"):this.node.removeAttribute("transform"),this.state&&this.state.cell){let t=computeAllBpmnClassNames(extractBpmnKindFromStyle(this.state.cell),this.dialect===mxgraph.mxConstants.DIALECT_STRICTHTML);const e=this.state.style[StyleIdentifier.BPMN_STYLE_EXTRA_CSS_CLASSES];e&&(t=t.concat(e)),this.node.setAttribute("class",t.join(" ")),this.node.setAttribute("data-bpmn-id",this.state.cell.id)}return t.minStrokeWidth=this.minSvgStrokeWidth,this.antiAlias||(t.format=function(t){return Math.round(parseFloat(t))}),t}}}class MarkerConfigurator{configureMarkers(){this.registerArrowDashMarker()}registerArrowDashMarker(){mxgraph.mxMarker.addMarker(MarkerIdentifier.ARROW_DASH,(t,e,i,n,r,s,o,l,a)=>{const h=r*(o+a+4),u=s*(o+a+4);return function(){t.begin(),t.moveTo(n.x-h/2-u/2,n.y-u/2+h/2),t.lineTo(n.x+u/2-3*h/2,n.y-3*u/2-h/2),t.stroke()}})}}function ensureInRange(t,e,i,n){let r=null==t?n:t;return r=Math.min(Math.max(r,e),i),r}function ensurePositiveValue(t){return Math.max(t||0,0)}function ensureValidZoomConfiguration(t){const e=null!=t?t:{};return e.debounceDelay=ensureInRange(e.debounceDelay,0,100,50),e.throttleDelay=ensureInRange(e.throttleDelay,0,100,50),e}!function(t){t.None="None",t.HorizontalVertical="HorizontalVertical",t.Horizontal="Horizontal",t.Vertical="Vertical",t.Center="Center"}(FitType||(FitType={}));var FUNC_ERROR_TEXT$1="Expected a function",NAN$1=NaN,symbolTag$1="[object Symbol]",reTrim$1=/^\s+|\s+$/g,reIsBadHex$1=/^[-+]0x[0-9a-f]+$/i,reIsBinary$1=/^0b[01]+$/i,reIsOctal$1=/^0o[0-7]+$/i,freeParseInt$1=parseInt,freeGlobal$1="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf$1="object"==typeof self&&self&&self.Object===Object&&self,root$1=freeGlobal$1||freeSelf$1||Function("return this")(),objectProto$1=Object.prototype,objectToString$1=objectProto$1.toString,nativeMax$1=Math.max,nativeMin$1=Math.min,now$1=function(){return root$1.Date.now()};function debounce$1(t,e,i){var n,r,s,o,l,a,h=0,u=!1,p=!1,d=!0;if("function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT$1);function c(e){var i=n,s=r;return n=r=void 0,h=e,o=t.apply(s,i)}function m(t){return h=t,l=setTimeout(x,e),u?c(t):o}function g(t){var i=t-a;return void 0===a||i>=e||i<0||p&&t-h>=s}function x(){var t=now$1();if(g(t))return f(t);l=setTimeout(x,function(t){var i=e-(t-a);return p?nativeMin$1(i,s-(t-h)):i}(t))}function f(t){return l=void 0,d&&n?c(t):(n=r=void 0,o)}function y(){var t=now$1(),i=g(t);if(n=arguments,r=this,a=t,i){if(void 0===l)return m(a);if(p)return l=setTimeout(x,e),c(a)}return void 0===l&&(l=setTimeout(x,e)),o}return e=toNumber$1(e)||0,isObject$1(i)&&(u=!!i.leading,s=(p="maxWait"in i)?nativeMax$1(toNumber$1(i.maxWait)||0,e):s,d="trailing"in i?!!i.trailing:d),y.cancel=function(){void 0!==l&&clearTimeout(l),h=0,n=a=r=l=void 0},y.flush=function(){return void 0===l?o:f(now$1())},y}function isObject$1(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function isObjectLike$1(t){return!!t&&"object"==typeof t}function isSymbol$1(t){return"symbol"==typeof t||isObjectLike$1(t)&&objectToString$1.call(t)==symbolTag$1}function toNumber$1(t){if("number"==typeof t)return t;if(isSymbol$1(t))return NAN$1;if(isObject$1(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=isObject$1(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(reTrim$1,"");var i=reIsBinary$1.test(t);return i||reIsOctal$1.test(t)?freeParseInt$1(t.slice(2),i?2:8):reIsBadHex$1.test(t)?NAN$1:+t}var lodash_debounce=debounce$1,FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(t,e,i){var n,r,s,o,l,a,h=0,u=!1,p=!1,d=!0;if("function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);function c(e){var i=n,s=r;return n=r=void 0,h=e,o=t.apply(s,i)}function m(t){return h=t,l=setTimeout(x,e),u?c(t):o}function g(t){var i=t-a;return void 0===a||i>=e||i<0||p&&t-h>=s}function x(){var t=now();if(g(t))return f(t);l=setTimeout(x,function(t){var i=e-(t-a);return p?nativeMin(i,s-(t-h)):i}(t))}function f(t){return l=void 0,d&&n?c(t):(n=r=void 0,o)}function y(){var t=now(),i=g(t);if(n=arguments,r=this,a=t,i){if(void 0===l)return m(a);if(p)return l=setTimeout(x,e),c(a)}return void 0===l&&(l=setTimeout(x,e)),o}return e=toNumber(e)||0,isObject(i)&&(u=!!i.leading,s=(p="maxWait"in i)?nativeMax(toNumber(i.maxWait)||0,e):s,d="trailing"in i?!!i.trailing:d),y.cancel=function(){void 0!==l&&clearTimeout(l),h=0,n=a=r=l=void 0},y.flush=function(){return void 0===l?o:f(now())},y}function throttle(t,e,i){var n=!0,r=!0;if("function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);return isObject(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),debounce(t,e,{leading:n,maxWait:e,trailing:r})}function isObject(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function isObjectLike(t){return!!t&&"object"==typeof t}function isSymbol(t){return"symbol"==typeof t||isObjectLike(t)&&objectToString.call(t)==symbolTag}function toNumber(t){if("number"==typeof t)return t;if(isSymbol(t))return NAN;if(isObject(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=isObject(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(reTrim,"");var i=reIsBinary.test(t);return i||reIsOctal.test(t)?freeParseInt(t.slice(2),i?2:8):reIsBadHex.test(t)?NAN:+t}var lodash_throttle=throttle;class BpmnMxGraph extends mxgraph.mxGraph{constructor(t){super(t),this.container=t,this.cumulativeZoomFactor=1}fit(t,e,i,n,r,s,o){const l=super.fit(t,e,i,n,r,s,o);return this.cumulativeZoomFactor=l,l}zoomActual(){super.zoomActual(),this.cumulativeZoomFactor=this.view.scale}customFit(t){this.zoomActual();const e=null==t?void 0:t.type;if(null==e||e==FitType.None)return;const i=ensurePositiveValue(null==t?void 0:t.margin);if(e!=FitType.Center){let t=!1,n=!1;switch(e){case FitType.Horizontal:n=!0;break;case FitType.Vertical:t=!0}this.fit(this.border,!1,i,!0,t,n)}else{const t=3,e=this.getGraphBounds(),n=this.container.clientWidth-i,r=this.container.clientHeight-i,s=e.width/this.view.scale,o=e.height/this.view.scale,l=Math.min(t,Math.min(n/s,r/o));this.cumulativeZoomFactor=l,this.view.scaleAndTranslate(l,(i+n-s*l)/(2*l)-e.x/this.view.scale,(i+r-o*l)/(2*l)-e.y/this.view.scale)}}static enforcePositiveValue(t){return Math.max(t||0,0)}zoomTo(t,e,i,n,r,s){if(null===t){const[t,e,o]=this.getScaleAndTranslationDeltas(i,n,r);s&&this.view.scaleAndTranslate(t,this.view.translate.x+e,this.view.translate.y+o)}else super.zoomTo(t,e)}createMouseWheelZoomExperience(t){t=ensureValidZoomConfiguration(t),mxgraph.mxEvent.addMouseWheelListener(lodash_debounce(this.getZoomHandler(!0),t.debounceDelay),this.container),mxgraph.mxEvent.addMouseWheelListener(lodash_throttle(this.getZoomHandler(!1),t.throttleDelay),this.container)}performZoom(t,e,i){const[n,r]=this.getRelativeEventCoordinates(e);this.zoomTo(null,null,t,n,r,i),i&&mxgraph.mxEvent.consume(e)}getZoomHandler(t){return(e,i)=>{const n=e;if(mxgraph.mxEvent.isConsumed(n))return;(n.ctrlKey||mxgraph.mxClient.IS_MAC&&n.metaKey)&&!n.altKey&&!n.shiftKey&&this.performZoom(i,n,t)}}getRelativeEventCoordinates(t){const e=this.container.getBoundingClientRect();return[t.clientX-e.left,t.clientY-e.top]}getScaleAndTranslationDeltas(t,e,i){let n=2*e,r=2*i;const[s,o]=this.calculateFactorAndScale(t);return[n,r]=this.calculateTranslationDeltas(s,o,n,r),[o,n,r]}calculateTranslationDeltas(t,e,i,n){if(t>1){const r=(t-1)/(2*e);i*=-r,n*=-r}else{const e=(1/t-1)/(2*this.view.scale);i*=e,n*=e}return[i,n]}calculateFactorAndScale(t){this.cumulativeZoomFactor*=t?Math.sqrt(1.25):Math.sqrt(.8);let e=this.cumulativeZoomFactor/this.view.scale;const i=Math.round(this.view.scale*e*100)/100;return e=i/this.view.scale,[e,i]}}class MxGraphConfigurator{constructor(t){this.container=t,this.graph=new BpmnMxGraph(t)}configure(t){return this.configureGraph(),this.configureNavigationSupport(t),new StyleConfigurator(this.graph).configureStyles(),(new ShapeConfigurator).configureShapes(),(new MarkerConfigurator).configureMarkers(),this.graph}configureGraph(){this.graph.setCellsLocked(!0),this.graph.setCellsSelectable(!1),this.graph.setEdgeLabelsMovable(!1),this.graph.setHtmlLabels(!0),this.graph.setConstrainChildren(!1),this.graph.setExtendParents(!1),this.graph.foldingEnabled=!1}configureNavigationSupport(t){var e,i;const n=this.graph.panningHandler;(null===(e=null==t?void 0:t.navigation)||void 0===e?void 0:e.enabled)?(n.addListener(mxgraph.mxEvent.PAN_START,this.getPanningHandler("grab")),n.addListener(mxgraph.mxEvent.PAN_END,this.getPanningHandler("default")),this.graph.panningHandler.usePopupTrigger=!1,n.isForcePanningEvent=t=>mxgraph.mxEvent.isLeftMouseButton(t.getEvent())||mxgraph.mxEvent.isMultiTouchEvent(t.getEvent()),this.graph.setPanning(!0),this.graph.createMouseWheelZoomExperience(null===(i=null==t?void 0:t.navigation)||void 0===i?void 0:i.zoom)):(this.graph.setPanning(!1),n.setPinchEnabled(!1),n.isForcePanningEvent=t=>!1)}getPanningHandler(t){return this.getPanningHandlerCallback(t).bind(this.graph)}getPanningHandlerCallback(t){return function(){this.isEnabled()&&(this.container.style.cursor=t)}}}class CoordinatesTranslator{constructor(t){this.graph=t}computeRelativeCoordinates(t,e){const i=this.getTranslateForRoot(t),n=e.x+i.x,r=e.y+i.y;return new mxgraph.mxPoint(n,r)}getTranslateForRoot(t){const e=this.graph.getModel(),i=new mxgraph.mxPoint(0,0);for(;null!=t;){const n=e.getGeometry(t);null!=n&&(i.x-=n.x,i.y-=n.y),t=e.getParent(t)}return i}computeEdgeCenter(t){const e=t.geometry.points,i=e[0],n=e[e.length-1];if(null!=i&&null!=n){const t=n.x-i.x,e=n.y-i.y;return new mxgraph.mxPoint(i.x+t/2,i.y+e/2)}}}class MxGraphRenderer{constructor(t,e,i){this.graph=t,this.coordinatesTranslator=e,this.styleConfigurator=i}render(t,e){this.insertShapesAndEdges(t),this.graph.customFit(null==e?void 0:e.fit)}insertShapesAndEdges({pools:t,lanes:e,subprocesses:i,otherFlowNodes:n,boundaryEvents:r,edges:s}){const o=this.graph.getModel();o.clear(),o.beginUpdate();try{this.insertShapes(t),this.insertShapes(e),this.insertShapes(i),this.insertShapes(n),this.insertShapes(r),this.insertEdges(s)}finally{o.endUpdate()}}insertShapes(t){t.forEach(t=>{this.insertShape(t)})}getParent(t){const e=this.getCell(t.parentId);return e||(ShapeUtil.isBoundaryEvent(t.kind)?void 0:this.graph.getDefaultParent())}insertShape(t){var e;const i=t.bpmnElement;if(i){const n=this.getParent(i);if(!n)return void console.warn("Not possible to insert shape %s: parent cell %s is not found",i.id,i.parentId);const r=t.bounds;let s=null===(e=t.label)||void 0===e?void 0:e.bounds;s=ShapeUtil.isPoolOrLane(i.kind)?void 0:s;const o=this.styleConfigurator.computeStyle(t,s);this.insertVertex(n,i.id,i.name,r,s,o)}}insertEdges(t){t.forEach(t=>{var e;const i=t.bpmnElement;if(i){const n=this.graph.getDefaultParent(),r=this.getCell(i.sourceRefId),s=this.getCell(i.targetRefId),o=null===(e=t.label)||void 0===e?void 0:e.bounds,l=this.styleConfigurator.computeStyle(t,o),a=this.graph.insertEdge(n,i.id,i.name,r,s,l);if(this.insertWaypoints(t.waypoints,a),o){a.geometry.width=o.width,a.geometry.height=o.height;const t=this.coordinatesTranslator.computeEdgeCenter(a);if(t){a.geometry.relative=!1;const e=this.coordinatesTranslator.computeRelativeCoordinates(a.parent,new mxgraph.mxPoint(o.x,o.y)),i=e.x+o.width/2-t.x,n=e.y-t.y;a.geometry.offset=new mxgraph.mxPoint(i,n)}}this.insertMessageFlowIconIfNeeded(t,a)}})}insertMessageFlowIconIfNeeded(t,e){if(t.bpmnElement instanceof MessageFlow&&t.messageVisibleKind!==MessageVisibleKind.NONE){const i=this.graph.insertVertex(e,"messageFlowIcon_of_"+e.id,void 0,0,0,20,14,this.styleConfigurator.computeMessageFlowIconStyle(t));i.geometry.relative=!0,i.geometry.offset=new mxgraph.mxPoint(-10,-7)}}insertWaypoints(t,e){t&&(e.geometry.points=t.map(t=>this.coordinatesTranslator.computeRelativeCoordinates(e.parent,new mxgraph.mxPoint(t.x,t.y))))}getCell(t){return this.graph.getModel().getCell(t)}insertVertex(t,e,i,n,r,s){const o=this.coordinatesTranslator.computeRelativeCoordinates(t,new mxgraph.mxPoint(n.x,n.y)),l=this.graph.insertVertex(t,e,i,o.x,o.y,n.width,n.height,s);if(r){const t=r.x-n.x,e=r.y-n.y;l.geometry.offset=new mxgraph.mxPoint(t,e)}return l}}function newMxGraphRenderer(t){return new MxGraphRenderer(t,new CoordinatesTranslator(t),new StyleConfigurator(t))}var util=createCommonjsModule((function(t,e){const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n="["+i+"][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",r=new RegExp("^"+n+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,i){if(e){const n=Object.keys(e),r=n.length;for(let s=0;s1){n[o]=[];for(let i in t.child[o])t.child[o].hasOwnProperty(i)&&n[o].push(convertToJson(t.child[o][i],e,o))}else{const r=convertToJson(t.child[o][0],e,o),s=!0===e.arrayMode&&"object"==typeof r||util.isTagNameInArrayMode(o,e.arrayMode,i);n[o]=s?[r]:r}}return n};var convertToJson_1=convertToJson,node2json={convertToJson:convertToJson_1},xmlNode=function(t,e,i){this.tagname=t,this.parent=e,this.child={},this.attrsMap={},this.val=i,this.addChild=function(t){Array.isArray(this.child[t.tagname])?this.child[t.tagname].push(t):this.child[t.tagname]=[t]}};const buildOptions$3=util.buildOptions;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,util.nameRegexp),!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const defaultOptions$2={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};var defaultOptions_1=defaultOptions$2;const props$2=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];var props_1=props$2;function processTagValue(t,e,i){return e&&(i.trimValues&&(e=e.trim()),e=parseValue(e=i.tagValueProcessor(e,t),i.parseNodeValue,i.parseTrueNumberOnly)),e}function resolveNameSpace(t,e){if(e.ignoreNameSpace){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}function parseValue(t,e,i){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/\.?0+$/,"")):e=Number.parseInt(t,10),i&&(e=String(e)===t?e:t)),e}return util.isExist(t)?t:""}const attrsRegx=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function buildAttributesMap(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const i=util.getAllMatches(t,attrsRegx),n=i.length,r={};for(let t=0;t",i,"Closing Tag is not closed.");let o=t.substring(i+2,s).trim();if(e.ignoreNameSpace){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1))}n&&(n.val?n.val=util.getValue(n.val)+""+processTagValue(o,r,e):n.val=processTagValue(o,r,e)),e.stopNodes.length&&e.stopNodes.includes(n.tagname)&&(n.child=[],null==n.attrsMap&&(n.attrsMap={}),n.val=t.substr(n.startIndex+1,i-n.startIndex-1)),n=n.parent,r="",i=s}else if("?"===t[i+1])i=findClosingIndex(t,"?>",i,"Pi Tag is not closed.");else if("!--"===t.substr(i+1,3))i=findClosingIndex(t,"--\x3e",i,"Comment is not closed.");else if("!D"===t.substr(i+1,2)){const e=findClosingIndex(t,">",i,"DOCTYPE is not closed.");i=t.substring(i,e).indexOf("[")>=0?t.indexOf("]>",i)+1:e}else if("!["===t.substr(i+1,2)){const s=findClosingIndex(t,"]]>",i,"CDATA is not closed.")-2,o=t.substring(i+9,s);if(r&&(n.val=util.getValue(n.val)+""+processTagValue(n.tagname,r,e),r=""),e.cdataTagName){const t=new xmlNode(e.cdataTagName,n,o);n.addChild(t),n.val=util.getValue(n.val)+e.cdataPositionChar,o&&(t.val=o)}else n.val=(n.val||"")+(o||"");i=s+2}else{const s=closingIndexForOpeningTag(t,i+1);let o=s.data;const l=s.index,a=o.indexOf(" ");let h=o;if(-1!==a&&(h=o.substr(0,a).replace(/\s\s*$/,""),o=o.substr(a+1)),e.ignoreNameSpace){const t=h.indexOf(":");-1!==t&&(h=h.substr(t+1))}if(n&&r&&"!xml"!==n.tagname&&(n.val=util.getValue(n.val)+""+processTagValue(n.tagname,r,e)),o.length>0&&o.lastIndexOf("/")===o.length-1){"/"===h[h.length-1]?(h=h.substr(0,h.length-1),o=h):o=o.substr(0,o.length-1);const t=new xmlNode(h,n,"");h!==o&&(t.attrsMap=buildAttributesMap(o,e)),n.addChild(t)}else{const t=new xmlNode(h,n);e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=l),h!==o&&(t.attrsMap=buildAttributesMap(o,e)),n.addChild(t),n=t}r="",i=l}else r+=t[i]}return i};function closingIndexForOpeningTag(t,e){let i,n="";for(let r=e;r"===e)return{data:n,index:r};"\t"===e&&(e=" ")}n+=e}}function findClosingIndex(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}var getTraversalObj_1=getTraversalObj,xmlstr2xmlnode={defaultOptions:defaultOptions_1,props:props_1,getTraversalObj:getTraversalObj_1};const defaultOptions$1={allowBooleanAttributes:!1},props$1=["allowBooleanAttributes"];var validate=function(t,e){e=util.buildOptions(e,defaultOptions$1,props$1);const i=[];let n=!1,r=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)l+=t[s];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),s--),!validateTagName(l)){let e;return e=0===l.trim().length?"There is an unnecessary space between tag name and backward slash ' ..'.":"Tag '"+l+"' is an invalid name.",getErrorObject("InvalidTag",e,getLineNumberForPosition(t,s))}const a=readAttributeStr(t,s);if(!1===a)return getErrorObject("InvalidAttr","Attributes for '"+l+"' have open quote.",getLineNumberForPosition(t,s));let h=a.value;if(s=a.index,"/"===h[h.length-1]){h=h.substring(0,h.length-1);const i=validateAttributeString(h,e);if(!0!==i)return getErrorObject(i.err.code,i.err.msg,getLineNumberForPosition(t,s-h.length+i.err.line));n=!0}else if(o){if(!a.tagClosed)return getErrorObject("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",getLineNumberForPosition(t,s));if(h.trim().length>0)return getErrorObject("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",getLineNumberForPosition(t,s));{const e=i.pop();if(l!==e)return getErrorObject("InvalidTag","Closing tag '"+e+"' is expected inplace of '"+l+"'.",getLineNumberForPosition(t,s));0==i.length&&(r=!0)}}else{const o=validateAttributeString(h,e);if(!0!==o)return getErrorObject(o.err.code,o.err.msg,getLineNumberForPosition(t,s-h.length+o.err.line));if(!0===r)return getErrorObject("InvalidXml","Multiple possible root nodes found.",getLineNumberForPosition(t,s));i.push(l),n=!0}for(s++;s0)||getErrorObject("InvalidXml","Invalid '"+JSON.stringify(i,null,4).replace(/\r?\n/g,"")+"' found.",1):getErrorObject("InvalidXml","Start tag expected.",1)};function readPI(t,e){for(var i=e;e5&&"xml"===n)return getErrorObject("InvalidXml","XML declaration allowed only at the start of the document.",getLineNumberForPosition(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function readCommentAndCDATA(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e