@syncfusion/ej2-diagrams
Version:
Feature-rich diagram control to create diagrams like flow charts, organizational charts, mind maps, and BPMN diagrams. Its rich feature set includes built-in shapes, editing, serializing, exporting, printing, overview, data binding, and automatic layouts.
10 lines • 1.56 MB
JavaScript
/*!
* filename: ej2-diagrams.min.js
* version : 32.1.21
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionData"),require("SyncfusionNavigations")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionPopups","SyncfusionData","SyncfusionNavigations"],e):"object"==typeof exports?exports.SyncfusionDiagrams=e(require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionData"),require("SyncfusionNavigations")):t.SyncfusionDiagrams=e(t.SyncfusionBase,t.SyncfusionPopups,t.SyncfusionData,t.SyncfusionNavigations)}(self,(t,e,i,r)=>(()=>{"use strict";var n={766:e=>{e.exports=t},74:t=>{t.exports=i},215:t=>{t.exports=r},197:t=>{t.exports=e}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var i=o[t]={exports:{}};return n[t](i,i.exports,a),i.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{a.r(s),a.d(s,{ActivityFlow:()=>ho,Annotation:()=>xe,AnnotationConstraints:()=>st,AvoidLineOverlapping:()=>kc,BasicShape:()=>bh,BezierSegment:()=>go,BezierSettings:()=>ao,BezierSmoothness:()=>Wt,BlazorAction:()=>$,BpmnActivity:()=>Oh,BpmnAnnotation:()=>Dh,BpmnDataObject:()=>xh,BpmnDiagrams:()=>mc,BpmnEvent:()=>Ph,BpmnFlow:()=>lo,BpmnGateway:()=>wh,BpmnShape:()=>Lh,BpmnSubEvent:()=>Ch,BpmnSubProcess:()=>Ah,BpmnTask:()=>Ih,BpmnTextAnnotation:()=>Mh,BpmnTransactionSubProcess:()=>Th,Canvas:()=>te,CanvasRenderer:()=>Md,ChildArrangement:()=>ot,ChildContainer:()=>Zh,ClassifierMultiplicity:()=>xo,ColumnDefinition:()=>br,Command:()=>Fo,CommandHandler:()=>ul,CommandManager:()=>Xo,ComplexHierarchicalTree:()=>Xc,ConnectTool:()=>jn,ConnectionDataSource:()=>Jd,ConnectionPointOrigin:()=>nt,Connector:()=>Co,ConnectorBridging:()=>Ac,ConnectorConstraints:()=>at,ConnectorDrawingTool:()=>Fn,ConnectorEditing:()=>ol,ConnectorFixedUserHandle:()=>Wi,ConnectorProperties:()=>Jc,ConnectorSegment:()=>co,ConnectorShape:()=>so,Container:()=>Gh,ContextMenuSettings:()=>Vo,ControlPointsVisibility:()=>Ht,CrudAction:()=>Kd,CustomCursorAction:()=>Il,DataBinding:()=>lc,DataMappingItems:()=>Zd,DataSource:()=>$d,Decorator:()=>no,Diagram:()=>sc,DiagramAction:()=>yt,DiagramConnectorSegment:()=>fo,DiagramConnectorShape:()=>Po,DiagramConstraints:()=>ct,DiagramContextMenu:()=>fc,DiagramElement:()=>Xt,DiagramEvent:()=>xt,DiagramEventHandler:()=>al,DiagramGradient:()=>Et,DiagramRenderer:()=>Go,DiagramShape:()=>_h,DiagramShapeStyle:()=>jt,DiagramTools:()=>pt,DiagramTooltip:()=>he,Ej1Serialization:()=>ip,ElementAction:()=>dt,ExpandTool:()=>Un,FixedUserHandle:()=>ji,FixedUserHandleTool:()=>Nn,FlipDirection:()=>tt,FlowShape:()=>Sh,FlowchartLayout:()=>Kc,FlowchartLayoutSettings:()=>il,FreeHandTool:()=>$n,Gradient:()=>Lt,GraphForceNode:()=>Hc,GraphLayoutManager:()=>_c,GridCell:()=>wr,GridPanel:()=>yr,GridRow:()=>Sr,Gridlines:()=>Wd,GroupableView:()=>Ut,Header:()=>Fh,HierarchicalTree:()=>Rc,Html:()=>mh,Hyperlink:()=>we,Image:()=>yh,ImageElement:()=>Jt,KeyGesture:()=>Yo,KeyModifiers:()=>ft,Keys:()=>mt,LabelDragTool:()=>Qn,LabelProperties:()=>$c,LabelResizeTool:()=>Kn,LabelRotateTool:()=>Jn,LabelTool:()=>Gn,Lane:()=>Xh,Layout:()=>rl,LayoutAnimation:()=>Mc,LineDistribution:()=>Bc,LineRouting:()=>Pl,LinearGradient:()=>zt,Margin:()=>Ot,Matrix:()=>x,MatrixTypes:()=>S,MethodArguments:()=>zh,MindMap:()=>Nc,MoveTool:()=>Hn,MultiplicityLabel:()=>wo,Native:()=>fh,NoOfSegments:()=>wt,Node:()=>Yh,NodeConstraints:()=>ht,NodeDrawingTool:()=>Yn,NodeFixedUserHandle:()=>Hi,NodeProperties:()=>tp,OrthogonalSegment:()=>uo,Overview:()=>Qo,Palette:()=>ap,Path:()=>uh,PathAnnotation:()=>Pe,PathElement:()=>Qt,PathPort:()=>ve,Phase:()=>Vh,Point:()=>o,PointPort:()=>ye,PolyLineDrawingTool:()=>qn,PolygonDrawingTool:()=>Zn,Port:()=>me,PortConstraints:()=>It,PortProperties:()=>ep,PortVisibility:()=>et,PrintAndExport:()=>hc,RadialGradient:()=>kt,RadialTree:()=>jc,RealAction:()=>bt,Rect:()=>w,RelationShip:()=>Io,RenderMode:()=>ut,RendererAction:()=>vt,ResizeTool:()=>_n,RotateTool:()=>Wn,RowDefinition:()=>vr,Ruler:()=>Oo,ScrollActions:()=>St,SelectTool:()=>Rn,Selector:()=>qh,SelectorConstraints:()=>rt,Shadow:()=>Dt,Shape:()=>gh,ShapeAnnotation:()=>Ie,ShapeStyle:()=>Bt,Size:()=>i,SnapConstraints:()=>it,SnapSettings:()=>_d,Snapping:()=>Oc,StackPanel:()=>Us,Stop:()=>Mt,StraightSegment:()=>po,StrokeStyle:()=>Rt,SwimLane:()=>Uh,SymbolDragSize:()=>sp,SymbolPalette:()=>dp,SymbolPaletteInfo:()=>Mi,SymbolPreview:()=>hp,SymbolSize:()=>Di,SymmetricLayout:()=>Wc,Text:()=>vh,TextDrawingTool:()=>Xn,TextElement:()=>Zt,TextStyle:()=>Nt,Thickness:()=>At,ThumbsConstraints:()=>lt,ToolBase:()=>Bn,Transform:()=>gt,UmlActivityShape:()=>Eh,UmlClass:()=>Rh,UmlClassAttribute:()=>kh,UmlClassMethod:()=>Bh,UmlClassifierShape:()=>Wh,UmlEnumeration:()=>Hh,UmlEnumerationMember:()=>jh,UmlInterface:()=>Nh,UmlSequenceActivationBox:()=>Ml,UmlSequenceDiagram:()=>Bl,UmlSequenceFragment:()=>kl,UmlSequenceFragmentCondition:()=>zl,UmlSequenceFragmentType:()=>Od,UmlSequenceMessage:()=>El,UmlSequenceMessageType:()=>Ad,UmlSequenceParticipant:()=>Ll,UndoRedo:()=>Dc,UserHandle:()=>No,Vector:()=>oo,ZoomPanTool:()=>Vn,addChildToContainer:()=>vn,alignChildBasedOnaPoint:()=>js,alignElement:()=>ws,alignLabelOnSegments:()=>Ta,arrangeChild:()=>ds,bBoxText:()=>V,bezierPoints:()=>So,canMeasureDecoratorPath:()=>Es,canResizeCorner:()=>Ja,canShowControlPoints:()=>ts,canShowCorner:()=>$a,changeOldFlipDirectionType:()=>Ra,checkBrowserInfo:()=>Ls,checkChildNodeInContainer:()=>fn,checkParentAsContainer:()=>un,checkPort:()=>Ts,checkPortRestriction:()=>es,cloneArray:()=>H,cloneBlazorObject:()=>Ms,cloneObject:()=>N,cloneSelectedObjects:()=>Is,completeRegion:()=>Ko,contains:()=>Tn,containsBounds:()=>_s,contextMenuBeforeItemRender:()=>Ft,contextMenuClick:()=>_t,contextMenuOpen:()=>Yt,cornersPointsBeforeRotation:()=>B,createHelper:()=>pn,deserialize:()=>Ba,extendArray:()=>_,extendObject:()=>W,findAngle:()=>ai,findAnnotation:()=>is,findBounds:()=>cn,findConnectorPoints:()=>Re,findDistance:()=>Ds,findMargin:()=>oi,findNearestPoint:()=>aa,findNodeByName:()=>Jo,findObjectIndex:()=>os,findObjectType:()=>$o,findParentInSwimlane:()=>Bs,findPath:()=>As,findPoint:()=>si,findPort:()=>rs,findPortIndex:()=>as,findPortToolToActivate:()=>Cn,findToolToActivate:()=>Pn,flipConnector:()=>bs,getAlignedPosition:()=>Ca,getAlignedPositionForPorts:()=>Ia,getAnnotationPosition:()=>Sa,getBasicShape:()=>ee,getBezierBounds:()=>bo,getBezierDirection:()=>Aa,getBezierPoints:()=>vo,getBounds:()=>R,getBpmnGatewayShapePathData:()=>bc,getBpmnLoopShapePathData:()=>wc,getBpmnShapePathData:()=>yc,getBpmnTaskShapePathData:()=>Sc,getBpmnTriggerShapePathData:()=>vc,getChild:()=>Da,getCollectionChangeEventArguements:()=>fs,getConnectorArrowType:()=>Ns,getConnectorDirection:()=>Os,getCursor:()=>Mn,getDecoratorShape:()=>Te,getDirection:()=>mo,getDropEventArguements:()=>ms,getElement:()=>gs,getFlippedPoint:()=>Hs,getFlowShape:()=>ke,getFreeHandPath:()=>p,getFunction:()=>J,getIconShape:()=>De,getInOutConnectPorts:()=>ns,getIndex:()=>z,getInternalProperties:()=>j,getIntersection:()=>di,getIntersectionPoints:()=>ci,getInterval:()=>ia,getLineSegment:()=>ua,getObjectFromCollection:()=>ss,getObjectType:()=>vs,getOffset:()=>K,getOffsetOfConnector:()=>Pa,getOffsetOfPorts:()=>xa,getOppositeDirection:()=>Ti,getOuterBounds:()=>Ci,getPathOffset:()=>Cs,getPathString:()=>v,getPoint:()=>ys,getPoints:()=>fa,getPolygonPath:()=>c,getPortDirection:()=>Pi,getPortShape:()=>Ce,getPortsPosition:()=>wa,getPreviewSize:()=>zs,getRectanglePath:()=>l,getSegmentThumbShapeHorizontal:()=>Ae,getSegmentThumbShapeVertical:()=>Oe,getSpaceValue:()=>ea,getString:()=>b,getSwimLaneChildren:()=>Ma,getSymbolSize:()=>ks,getTooltipOffset:()=>ma,getUMLActivityShapes:()=>Ga,getUMLFinalNode:()=>Ua,getUserHandlePosition:()=>Ka,groupHasType:()=>ha,hasSelection:()=>An,hasSingleConnection:()=>On,identityMatrix:()=>I,initFixedUserHandlesSymbol:()=>va,initTooltip:()=>de,insertObject:()=>ps,intersect2:()=>ga,intersect3:()=>pa,isDiagramChild:()=>sa,isEmptyVector:()=>yo,isLabelFlipped:()=>Ws,isPointOverConnector:()=>ca,isSelected:()=>Dn,menuClass:()=>uc,middleElement:()=>U,moveChildInStack:()=>In,multiplyMatrix:()=>D,orthoConnection2Segment:()=>fi,overFlow:()=>G,parsePathData:()=>d,pathSegmentCollection:()=>g,processPathData:()=>h,randomId:()=>E,removeChildInContainer:()=>ln,removeChildNodes:()=>Oa,removeGradient:()=>Za,removeItem:()=>qa,removeUnnecessaryNodes:()=>La,renderContainerHelper:()=>gn,renderStackHighlighter:()=>xn,rotateAfterFlip:()=>xs,rotateMatrix:()=>T,rotatePoint:()=>Q,rotateSize:()=>q,scaleElement:()=>hs,scaleMatrix:()=>A,scalePathData:()=>m,selectionHasConnector:()=>Rs,serialize:()=>Ea,setConnectorDefaults:()=>oa,setPortsEdges:()=>ra,setSwimLaneDefaults:()=>ta,setUMLActivityDefaults:()=>na,sort:()=>ba,sortNodeCollection:()=>cs,splitArrayCollection:()=>y,swapBounds:()=>qe,templateCompiler:()=>k,textAlignToString:()=>Y,transformPath:()=>u,transformPointByMatrix:()=>P,transformPointsByMatrix:()=>C,translateMatrix:()=>O,updateCanvasBounds:()=>dn,updateConnector:()=>Qa,updateContent:()=>Xa,updateDefaultValues:()=>da,updateHyperlink:()=>_a,updateLaneBoundsAfterAddChild:()=>wn,updateLaneBoundsWithSelector:()=>Sn,updateLayoutValue:()=>la,updatePathElement:()=>Ps,updatePortEdges:()=>Ss,updateScrollSettingsOffset:()=>ja,updateShape:()=>Fa,updateShapeContent:()=>Ya,updateStyle:()=>Ha,updateTooltip:()=>pe,updateUmlActivityNode:()=>Va,updateZindex:()=>yn,updatedSegment:()=>f,upgrade:()=>Na,whiteSpaceToString:()=>Z,wordBreakToString:()=>F});var t,e=a(766),i=function(){function t(t,e){this.width=t,this.height=e}return t.prototype.isEmpty=function(){return 0===this.height&&0===this.width},t.prototype.clone=function(){return new t(this.width,this.height)},t}(),r=(t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)},function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}),n=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},o=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),i.equals=function(t,e){return t===e||!(!t||!e)&&(!t||!e||t.x===e.x&&t.y===e.y)},i.isEmptyPoint=function(t){return!t.x||!t.y},i.transform=function(t,e,i){var r={x:0,y:0};return r.x=Math.round(100*(t.x+i*Math.cos(e*Math.PI/180)))/100,r.y=Math.round(100*(t.y+i*Math.sin(e*Math.PI/180)))/100,r},i.findLength=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},i.findAngle=function(t,e){var i=Math.atan2(e.y-t.y,e.x-t.x);return i=180*i/Math.PI,(i%=360)<0&&(i+=360),i},i.distancePoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},i.getLengthFromListOfPoints=function(t){for(var e=0,i=0;i<t.length-1;i++)e+=this.distancePoints(t[parseInt(i.toString(),10)],t[i+1]);return e},i.adjustPoint=function(t,e,i,r){var n,o=i?{x:t.x,y:t.y}:{x:e.x,y:e.y};return t.x===e.x?t.y<e.y&&i||t.y>e.y&&!i?o.y+=r:o.y-=r:t.y===e.y?t.x<e.x&&i||t.x>e.x&&!i?o.x+=r:o.x-=r:i?(n=this.findAngle(t,e),o=this.transform(t,n,r)):(n=this.findAngle(e,t),o=this.transform(e,n,r)),o},i.direction=function(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?t.x<e.x?"Right":"Left":t.y<e.y?"Bottom":"Top"},i.prototype.getClassName=function(){return"Point"},n([(0,e.Property)(0)],i.prototype,"x",void 0),n([(0,e.Property)(0)],i.prototype,"y",void 0),i}(e.ChildProperty);function h(t){var e,i=[],r=d(t);if(r.length>0)for(var n=0;n<r.length;n++){var o=r[parseInt(n.toString(),10)],a="";switch((a=o[0]).toLowerCase()){case"m":for(e=1;e<o.length;e++)i.push({command:a,x:o[parseInt(e.toString(),10)],y:o[e+1]}),e+=1,"m"===a?a="l":"M"===a&&(a="L");break;case"l":case"t":for(e=1;e<o.length;e++)i.push({command:a,x:o[parseInt(e.toString(),10)],y:o[e+1]}),e+=1;break;case"h":for(e=1;e<o.length;e++)i.push({command:a,x:o[parseInt(e.toString(),10)]});break;case"v":for(e=1;e<o.length;e++)i.push({command:a,y:o[parseInt(e.toString(),10)]});break;case"z":i.push({command:a});break;case"c":for(e=1;e<o.length;e++)i.push({command:a,x1:o[parseInt(e.toString(),10)],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]}),e+=5;break;case"s":for(e=1;e<o.length;e++)i.push({command:a,x2:o[parseInt(e.toString(),10)],y2:o[e+1],x:o[e+2],y:o[e+3]}),e+=3;break;case"q":for(e=1;e<o.length;e++)i.push({command:a,x1:o[parseInt(e.toString(),10)],y1:o[e+1],x:o[e+2],y:o[e+3]}),e+=3;break;case"a":for(e=1;e<o.length;e++)i.push({command:a,r1:o[parseInt(e.toString(),10)],r2:o[e+1],angle:o[e+2],largeArc:o[e+3],sweep:o[e+4],x:o[e+5],y:o[e+6]}),e+=6}}return i}function d(t){var e=/([a-z]+)|([+-]?(?:\d+\.?\d*|\.\d+))/gi,i=[],r=[],n={};e.lastIndex=0;var o=!1;for(n=e.exec(t);n;)"e"===n[1]?o=!0:n[1]?("zm"===n[1].toLowerCase()?(i.length&&r.push(i),r.push(["Z"]),i=[n[1].substring(1,2)]):(i.length&&r.push(i),i=[n[1]]),o=!1):(i.length||(i=[]),o||i.push(Number(n[2])),o=!1),n=e.exec(t);return i.length&&r.push(i),r}function l(t,e,i){var r,n,o,a="",s=[{x:0+t,y:0},{x:0+i-t,y:0},{x:0+i,y:0+t},{x:0+i,y:0+e-t},{x:0+i-t,y:0+e},{x:0+t,y:0+e},{x:0,y:0+e-t},{x:0,y:0+t}],h=[{x:0+i,y:0},{x:0+i,y:0+e},{x:0,y:0+e},{x:0,y:0}],d=0;for(a="M"+s[0].x+" "+s[0].y,o=0;o<s.length;o+=2)a+="L"+(r=s[o+1]).x+" "+r.y,n=s[o+2]||s[0],a+="Q"+h[parseInt(d.toString(),10)].x+" "+h[parseInt(d.toString(),10)].y+" "+n.x+" "+n.y,d++;return a}function c(t){var e,i,r="";for(r="M"+t[0].x+" "+t[0].y,i=1;i<t.length;i++)r+="L"+(e=t[parseInt(i.toString(),10)]).x+" "+e.y;return r+="Z"}function p(t){var e;for(e=0;e<t.length;e++)t[parseInt(e.toString(),10)].x=Math.round(t[parseInt(e.toString(),10)].x),t[parseInt(e.toString(),10)].y=Math.round(t[parseInt(e.toString(),10)].y);var i,r,n="";for(n="M"+t[0].x+" "+t[0].y,r=1;r<t.length;r++)n+="L"+(i=t[parseInt(r.toString(),10)]).x+" "+i.y;return n}function g(t){var e,i,r,n,o,a,s,h,d,l,c=[];for(s=0,h=0,l=0,d=t.length;l<d;++l){var p,g=t[l];p=g.command,"y1"in g&&(n=g.y1),"y2"in g&&(a=g.y2),"x1"in g&&(r=g.x1),"x2"in g&&(o=g.x2),"x"in g&&(s=g.x),"y"in g&&(h=g.y);var u=c[c.length-1];switch(p){case"M":c.push({command:"M",x:s,y:h});break;case"L":c.push({command:"L",x0:e,y0:i,x:s,y:h});break;case"H":c.push({command:"L",x0:e,y0:i,x:s,y:i});break;case"V":c.push({command:"L",x0:e,y0:i,x:e,y:h});break;case"C":c.push({command:"C",x0:e,y0:i,x1:r,y1:n,x2:o,y2:a,x:s,y:h});break;case"S":if(u){var f=void 0,m={x:2*e-(f="C"===u.command||"S"===u.command?{x:u.x2,y:u.y2}:{x:e,y:i}).x,y:2*i-f.y};c.push({command:"C",x0:e,y0:i,x1:m.x,y1:m.y,x2:o,y2:a,x:s,y:h})}break;case"Q":c.push({command:"Q",x0:e,y0:i,x1:r,y1:n,x:s,y:h});break;case"T":if(u){f=void 0,m={x:2*e-(f="Q"===u.command?{x:u.x1,y:u.y1}:{x:e,y:i}).x,y:2*i-f.y};c.push({command:"Q",x0:e,y0:i,x1:m.x,y1:m.y,x:s,y:h})}break;case"A":var y=g;y.command="A",c.push(y);break;case"Z":case"z":c.push({command:"Z"}),s=e,h=i}"M"!==p&&"m"!==p||h,e=s,i=h}return c}function u(t,e,i,r,n,o,a,s){var h,d,l,c,p,g,u,y,b;for(p=0,g=0,y=0,u=t.length;y<u;++y){var S=t[y],w=S.command;"x"in S&&(p=S.x),"y"in S&&(g=S.y),"y1"in S&&(d=S.y1),"y2"in S&&(c=S.y2),"x1"in S&&(h=S.x1),"x2"in S&&(l=S.x2),r?(void 0!==p&&(p=m(p,e,n,a)),void 0!==g&&(g=m(g,i,o,s)),void 0!==h&&(h=m(h,e,n,a)),void 0!==d&&(d=m(d,i,o,s)),void 0!==l&&(l=m(l,e,n,a)),void 0!==c&&(c=m(c,i,o,s))):(void 0!==p&&(p=Number((p+e).toFixed(2))),void 0!==g&&(g=Number((g+i).toFixed(2))),void 0!==h&&(h=Number((h+e).toFixed(2))),void 0!==d&&(d=Number((d+i).toFixed(2))),void 0!==l&&(l=Number((l+e).toFixed(2))),void 0!==c&&(c=Number((c+i).toFixed(2)))),(b=f(S,w,{x:p,y:g,x1:h,y1:d,x2:l,y2:c,r1:S.r1,r2:S.r2},r,e,i))&&(t[y]=b),"M"!==w&&"m"!==w||g}return v(t)}function f(t,e,i,r,n,o){switch(e){case"M":case"L":case"T":t.x=i.x,t.y=i.y;break;case"H":t.x=i.x;break;case"V":t.y=i.y;break;case"C":t.x=i.x,t.y=i.y,t.x1=i.x1,t.y1=i.y1,t.x2=i.x2,t.y2=i.y2;break;case"S":t.x=i.x,t.y=i.y,t.x2=i.x2,t.y2=i.y2;break;case"Q":t.x=i.x,t.y=i.y,t.x1=i.x1,t.y1=i.y1;break;case"A":var a=i.r1,s=i.r2;r&&(i.r1=a*=n,i.r2=s*=o),t.x=i.x,t.y=i.y,t.r1=i.r1,t.r2=i.r2;break;case"z":case"Z":t={command:"Z"}}return t}function m(t,e,i,r){return t!==i?t=r!==i?t*e-(Number(i)*e-Number(i))+(r-Number(i)):Number(t)*e-(Number(i)*e-Number(i)):r!==i&&(t=r),Number(t.toFixed(2))}function y(t){var e,i,r,n,o,a,s,h,d,l;for(s=0,h=0,l=0,d=t.length;l<d;++l){var c=t[parseInt(l.toString(),10)],p=c.command;if(/[MLHVCSQTA]/.test(p))"x"in c&&(c.x=s=c.x),"y"in c&&(c.y=h=c.y);else{"x1"in c&&(c.x1=r=s+c.x1),"x2"in c&&(c.x2=o=s+c.x2),"y1"in c&&(c.y1=n=h+c.y1),"y2"in c&&(c.y2=a=h+c.y2),"x"in c&&(c.x=s+=c.x),"y"in c&&(c.y=h+=c.y);var g=void 0;switch(p){case"m":case"M":g={command:"M",x:s,y:h};break;case"l":case"L":g={command:"L",x:s,y:h};break;case"h":case"H":g={command:"H",x:s};break;case"v":case"V":g={command:"V",y:h};break;case"c":case"C":g={command:"C",x:s,y:h,x1:r,y1:n,x2:o,y2:a};break;case"s":case"S":g={command:"S",x:s,y:h,x2:o,y2:a};break;case"q":case"Q":g={command:"Q",x:s,y:h,x1:r,y1:n};break;case"t":case"T":g={command:"T",x:s,y:h};break;case"a":case"A":(g={command:"A",x:s,y:h}).r1=c.r1,g.r2=c.r2,g.angle=c.angle,g.largeArc=c.largeArc,g.sweep=c.sweep;break;case"z":case"Z":g={command:"Z"},s=e,h=i,g=t[parseInt(l.toString(),10)]}g&&(t[parseInt(l.toString(),10)]=g)}"M"!==p&&"m"!==p||(e=s,i=h)}return t}function v(t){var e,i="";for(e=0;e<t.length;e++)i+=0===e?b(t[parseInt(e.toString(),10)]):" "+b(t[parseInt(e.toString(),10)]);return i}function b(t){var e="";switch(t.command){case"Z":case"z":e=t.command;break;case"M":case"m":case"L":case"l":case"T":case"t":e=t.command+" "+t.x+" "+t.y;break;case"C":case"c":e=t.command+" "+t.x1+" "+t.y1+" "+t.x2+" "+t.y2+" "+t.x+" "+t.y;break;case"Q":case"q":e=t.command+" "+t.x1+" "+t.y1+" "+t.x+" "+t.y;break;case"A":case"a":var i=t.command,r=t.angle,n=t.largeArc?"1":"0",o=t.sweep?"1":"0";e=i+" "+t.r1+" "+t.r2+" "+r+" "+n+" "+o+" "+t.x+" "+t.y;break;case"H":case"h":e=t.command+" "+t.x;break;case"V":case"v":e=t.command+" "+t.y;break;case"S":case"s":e=t.command+" "+t.x2+" "+t.y2+" "+t.x+" "+t.y}return e}var S,w=function(){function t(t,e,i,r){this.x=Number.MAX_VALUE,this.y=Number.MAX_VALUE,this.width=0,this.height=0,void 0===t||void 0===e?(t=e=Number.MAX_VALUE,i=r=0):(void 0===i&&(i=0),void 0===r&&(r=0)),this.x=t,this.y=e,this.width=i,this.height=r}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topLeft",{get:function(){return{x:this.left,y:this.top}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topRight",{get:function(){return{x:this.right,y:this.top}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomLeft",{get:function(){return{x:this.left,y:this.bottom}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomRight",{get:function(){return{x:this.right,y:this.bottom}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"middleLeft",{get:function(){return{x:this.left,y:this.y+this.height/2}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"middleRight",{get:function(){return{x:this.right,y:this.y+this.height/2}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topCenter",{get:function(){return{x:this.x+this.width/2,y:this.top}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomCenter",{get:function(){return{x:this.x+this.width/2,y:this.bottom}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"center",{get:function(){return{x:this.x+this.width/2,y:this.y+this.height/2}},enumerable:!0,configurable:!0}),t.prototype.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},t.prototype.uniteRect=function(t){var e=Math.max(isNaN(this.right)||this.x===Number.MAX_VALUE?t.right:this.right,t.right),i=Math.max(isNaN(this.bottom)||this.y===Number.MAX_VALUE?t.bottom:this.bottom,t.bottom);return this.x=Math.min(this.left,t.left),this.y=Math.min(this.top,t.top),this.width=e-this.x,this.height=i-this.y,this},t.prototype.unitePoint=function(t){if(this.x===Number.MAX_VALUE)return this.x=t.x,void(this.y=t.y);var e=Math.min(this.left,t.x),i=Math.min(this.top,t.y),r=Math.max(this.right,t.x),n=Math.max(this.bottom,t.y);this.x=e,this.y=i,this.width=r-this.x,this.height=n-this.y},t.prototype.Inflate=function(t){return this.x-=t,this.y-=t,this.width+=2*t,this.height+=2*t,this},t.prototype.intersects=function(t){return!(this.right<t.left||this.left>t.right||this.top>t.bottom||this.bottom<t.top)},t.prototype.containsRect=function(t){return this.left<=t.left&&this.right>=t.right&&this.top<=t.top&&this.bottom>=t.bottom},t.prototype.containsPoint=function(t,e){return void 0===e&&(e=0),this.left-e<=t.x&&this.right+e>=t.x&&this.top-e<=t.y&&this.bottom+e>=t.y},t.toBounds=function(e){for(var i=new t,r=0,n=e;r<n.length;r++){var o=n[r];i.unitePoint(o)}return i},t.empty=new t(Number.MAX_VALUE,Number.MIN_VALUE,0,0),t}();!function(t){t[t.Identity=0]="Identity",t[t.Translation=1]="Translation",t[t.Scaling=2]="Scaling",t[t.Unknown=4]="Unknown"}(S||(S={}));var x=function(t,e,i,r,n,o,a){this.m11=t,this.m12=e,this.m21=i,this.m22=r,this.offsetX=n,this.offsetY=o,this.type=a};function I(){return new x(1,0,0,1,0,0,S.Identity)}function P(t,e){var i=function(t,e,i){if(t.type===(S.Translation|S.Scaling))e*=t.m11,e+=t.offsetX,i*=t.m22,i+=t.offsetY;else{var r=i*t.m21+t.offsetX,n=e*t.m12+t.offsetY;e*=t.m11,e+=r,i*=t.m22,i+=n}return{x:e,y:i}}(t,e.x,e.y);return{x:Math.round(100*i.x)/100,y:Math.round(100*i.y)/100}}function C(t,e){for(var i=[],r=0,n=e;r<n.length;r++){var o=n[r];i.push(P(t,o))}return i}function T(t,e,i,r){D(t,function(t,e,i){var r=I(),n=Math.sin(t),o=Math.cos(t),a=e*(1-o)+i*n,s=i*(1-o)-e*n;return r.type=S.Unknown,M(r,o,n,-n,o,a,s),r}(.017453292519943295*(e%=360),i||0,r||0))}function A(t,e,i,r,n){void 0===r&&(r=0),void 0===n&&(n=0),D(t,function(t,e,i,r){var n=I();return n.type=i||r?S.Scaling|S.Translation:S.Scaling,M(n,t,0,0,e,i-t*i,r-e*r),n}(e,i,r,n))}function O(t,e,i){t.offsetX+=e,t.offsetY+=i,t.type|=S.Translation}function D(t,e){var i=t.type,r=e.type;if(i===S.Identity)return L(t,e),void(t.type=e.type);if(i!==S.Translation){var n=i<<4|r;switch(n){case 50:return t.m11*=e.m11,t.m22*=e.m22,t.offsetX*=e.m11,void(t.offsetY*=e.m22);case 51:return t.m11*=e.m11,t.m22*=e.m22,t.offsetX=e.m11*t.offsetX+e.offsetX,void(t.offsetY=e.m22*t.offsetY+e.offsetY);case 52:break;default:switch(n){case 66:case 67:case 68:break;default:return}}var o=I();return M(o,t.m11*e.m11+t.m12*e.m21,t.m11*e.m12+t.m12*e.m22,t.m21*e.m11+t.m22*e.m21,t.m21*e.m12+t.m22*e.m22,t.offsetX*e.m11+t.offsetY*e.m21+e.offsetX,t.offsetX*e.m12+t.offsetY*e.m22+e.offsetY),o.m21||o.m12?o.type=S.Unknown:((o.m11&&1!==o.m11||o.m22&&1!==o.m22)&&(o.type=S.Scaling),(o.offsetX||o.offsetY)&&(o.type|=S.Translation),(o.type&(S.Translation|S.Scaling))===S.Identity&&(o.type=S.Identity),o.type=S.Scaling|S.Translation),L(t,o),void(t.type=o.type)}var a=t.offsetX,s=t.offsetY;t.offsetX=a*e.m11+s*e.m21+e.offsetX,t.offsetY=a*e.m12+s*e.m22+e.offsetY,r!==S.Unknown?t.type=S.Translation|S.Scaling:t.type=S.Unknown}function M(t,e,i,r,n,o,a){t.m11=e,t.m12=i,t.m21=r,t.m22=n,t.offsetX=o,t.offsetY=a}function L(t,e){t.m11=e.m11,t.m12=e.m12,t.m21=e.m21,t.m22=e.m22,t.offsetX=e.offsetX,t.offsetY=e.offsetY,t.type=e.type}function E(){for(var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",i="",r=0;r<5;r++){if("undefined"!=typeof window&&"crypto"in window&&"getRandomValues"in crypto){var n=new Uint32Array(1);t=(window.msCrypto||window.crypto).getRandomValues(n)[0]%60}0===r&&t<10?r--:i+=e.substring(t,t+1)}return i}function z(t,e){if(t.nodes&&t.nodes.length>0)for(var i=0;i<t.nodes.length;i++)if(t.nodes[parseInt(i.toString(),10)].id===e)return i;if(t.connectors&&t.connectors.length>0)for(i=0;i<t.connectors.length;i++)if(t.connectors[parseInt(i.toString(),10)].id===e)return i;return null}function k(t){if(t){try{return"function"!=typeof t&&document.querySelectorAll(t).length?(0,e.compile)(document.querySelector(t).innerHTML.trim()):(0,e.compile)(t)}catch(i){return(0,e.compile)(t)}}}function B(t){new w;var e=t.offsetY-t.actualSize.height*t.pivot.y,i=t.offsetY+t.actualSize.height*(1-t.pivot.y),r=t.offsetX-t.actualSize.width*t.pivot.x,n=t.offsetX+t.actualSize.width*(1-t.pivot.x),o={x:r,y:e},a={x:n,y:e},s={x:r,y:i},h={x:n,y:i};return w.toBounds([o,a,s,h])}function R(t){var e=new w,i=B(t),r=i.middleLeft,n=i.topCenter,o=i.bottomCenter,a=i.middleRight,s=i.topLeft,h=i.topRight,d=i.bottomLeft,l=i.bottomRight;if(t.corners={topLeft:s,topCenter:n,topRight:h,middleLeft:r,middleRight:a,bottomLeft:d,bottomCenter:o,bottomRight:l},0!==t.rotateAngle||0!==t.parentTransform){var c=I();T(c,t.rotateAngle+t.parentTransform,t.offsetX,t.offsetY),t.corners.topLeft=s=P(c,s),t.corners.topCenter=n=P(c,n),t.corners.topRight=h=P(c,h),t.corners.middleLeft=r=P(c,r),t.corners.middleRight=a=P(c,a),t.corners.bottomLeft=d=P(c,d),t.corners.bottomCenter=o=P(c,o),t.corners.bottomRight=l=P(c,l)}return e=w.toBounds([s,h,d,l]),t.corners.left=e.left,t.corners.right=e.right,t.corners.top=e.top,t.corners.bottom=e.bottom,t.corners.center=e.center,t.corners.width=e.width,t.corners.height=e.height,e}function N(t,e,i,r){var n={},o="properties";if(t){i=t.propName;var a=t[""+o]||t,s=[],h=[];if((s=s.concat(Object.keys(a))).push("version"),i){var d=J(e);h=d?d(i):[],s=s.concat(h)}for(var l=j(i),c=0,p=s=s.concat(l);c<p.length;c++){var g=p[c];if("historyManager"!==g)if("wrapper"!==g)!(!t[""+g]||!t.hasOwnProperty("observers"))||(t[""+g]instanceof Array?n[""+g]=H(-1===l.indexOf(g)&&t[""+o]?t[""+o][""+g]:t[""+g],e,g,r):t[""+g]instanceof Array==!1&&t[""+g]instanceof HTMLElement?n[""+g]=t[""+g].cloneNode(!0).innerHTML:t[""+g]instanceof Array==!1&&t[""+g]instanceof Object?n[""+g]=N(-1===l.indexOf(g)&&t[""+o]?t[""+o][""+g]:t[""+g],void 0,void 0,r):n[""+g]=t[""+g]);else t[""+g]&&(n[""+g]={actualSize:{width:t[""+g].actualSize.width,height:t[""+g].actualSize.height},offsetX:t[""+g].offsetX,offsetY:t[""+g].offsetY})}}return n}function j(t){switch(t){case"nodes":case"children":return["inEdges","outEdges","parentId","processId","nodeId","umlIndex","isPhase","isLane"];case"connectors":return["parentId"];case"annotation":case"annotations":return["nodeId"];case"shape":return["hasHeader"];case"layers":return["objectZIndex"]}return[]}function H(t,e,i,r){var n;if(t){n=[];for(var o=0;o<t.length;o++)t[parseInt(o.toString(),10)]instanceof Array?n.push(t[parseInt(o.toString(),10)]):t[parseInt(o.toString(),10)]instanceof Object?n.push(N(t[parseInt(o.toString(),10)],e,i,r)):n.push(t[parseInt(o.toString(),10)])}return n}function W(t,e){var i="properties";if(t){e||(e={properties:{}});for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];if(t[""+o]instanceof Array){var a=_(t[""+o],e[""+i][""+o]);e[""+i][""+o]&&e[""+i][""+o].length||(e[""+o]=a)}else if(t[""+o]instanceof Array==!1&&t[""+o]instanceof HTMLElement)e[""+o]=t[""+o].cloneNode(!0).innerHtml;else if(t[""+o]instanceof Array==!1&&t[""+o]instanceof Object){var s=W(t[""+o],e[""+i][""+o]);s[""+i]&&!Object.keys(s[""+i]).length&&delete s[""+i],e[""+o]=s}else e[""+o]=void 0!==e[""+i][""+o]?e[""+o]:t[""+o]}}return e}function _(t,e){var i=[],r=!1;e||(e=[]),e.length||(r=!0);for(var n=0;n<t.length;n++)if(t[parseInt(n.toString(),10)]instanceof Array){_(t[parseInt(n.toString(),10)],e[parseInt(n.toString(),10)]);r&&i.push(_)}else if(t[parseInt(n.toString(),10)]instanceof Object){var o=W(t[parseInt(n.toString(),10)],e[parseInt(n.toString(),10)]);r&&i.push(o)}else i.push(t[parseInt(n.toString(),10)]);return i}function Y(t){var e="";switch(t){case"Center":e="center";break;case"Left":e="left";break;case"Right":e="right";break;case"Justify":e="justify"}return e}function F(t){var e="";switch(t){case"Wrap":e="breakall";break;case"NoWrap":e="keepall";break;case"WrapWithOverflow":e="normal";break;case"LineThrough":e="line-through"}return e}var X=document.createElement("canvas").getContext("2d");function V(t,e){return X.font=(e.bold?"bold":"normal")+" "+e.fontSize+"px "+e.fontFamily,X.measureText(t).width}function U(t,e){return(t+e)/2}function G(t,e){var i,r=0,n=0,o=0,a="";i=t.length;var s=0;do{o>0&&(r=n),n=Math.floor(U(r,i)),o=V(a+=t.substr(r,n),e)}while(o<=e.width);for(a=a.substr(0,r),s=r;s<i;s++)if((o=V(a+=t[parseInt(s.toString(),10)],e))>=e.width){t=t.substr(0,a.length-1);break}return"Ellipsis"===e.textOverflow?(t=t.substr(0,t.length-3),t+="..."):t=t.substr(0,t.length),t}function Z(t,e){if("NoWrap"===e&&"PreserveAll"===t)return"pre";var i="";switch(t){case"CollapseAll":i="nowrap";break;case"CollapseSpace":i="pre-line";break;case"PreserveAll":i="pre-wrap"}return i}function q(t,e){var r=I();T(r,e,0,0);var n=P(r,{x:0,y:0}),o=P(r,{x:t.width,y:0}),a=P(r,{x:0,y:t.height}),s=P(r,{x:t.width,y:t.height}),h=Math.min(n.x,o.x,a.x,s.x),d=Math.min(n.y,o.y,a.y,s.y),l=Math.max(n.x,o.x,a.x,s.x),c=Math.max(n.y,o.y,a.y,s.y);return new i(l-h,c-d)}function Q(t,e,i,r){if(0!==t){var n=I();return T(n,t,e,i),P(n,r)}return r}function K(t,e){return{x:t.x+e.desiredSize.width*e.pivot.x,y:t.y+e.desiredSize.height*e.pivot.y}}function J(t){return void 0!==t&&"string"==typeof t&&(t=(0,e.getValue)(t,window)),t}var $,tt,et,it,rt,nt,ot,at,st,ht,dt,lt,ct,pt,gt,ut,ft,mt,yt,vt,bt,St,wt,xt,It,Pt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ct=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Tt=function(t){if(t)switch(t.type){case"Linear":default:return zt;case"Radial":return kt}return zt},At=function(t,e,i,r){this.left=t,this.right=e,this.top=i,this.bottom=r},Ot=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)(0)],i.prototype,"left",void 0),Ct([(0,e.Property)(0)],i.prototype,"right",void 0),Ct([(0,e.Property)(0)],i.prototype,"top",void 0),Ct([(0,e.Property)(0)],i.prototype,"bottom",void 0),i}(e.ChildProperty),Dt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)(45)],i.prototype,"angle",void 0),Ct([(0,e.Property)(5)],i.prototype,"distance",void 0),Ct([(0,e.Property)(.7)],i.prototype,"opacity",void 0),Ct([(0,e.Property)("lightgrey")],i.prototype,"color",void 0),i}(e.ChildProperty),Mt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),i.prototype.getClassName=function(){return"Stop"},Ct([(0,e.Property)("")],i.prototype,"color",void 0),Ct([(0,e.Property)(0)],i.prototype,"offset",void 0),Ct([(0,e.Property)(1)],i.prototype,"opacity",void 0),i}(e.ChildProperty),Lt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Collection)([],Mt)],i.prototype,"stops",void 0),Ct([(0,e.Property)("None")],i.prototype,"type",void 0),Ct([(0,e.Property)("")],i.prototype,"id",void 0),i}(e.ChildProperty),Et=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)(0)],i.prototype,"x1",void 0),Ct([(0,e.Property)(0)],i.prototype,"x2",void 0),Ct([(0,e.Property)(0)],i.prototype,"y1",void 0),Ct([(0,e.Property)(0)],i.prototype,"y2",void 0),Ct([(0,e.Property)(0)],i.prototype,"cx",void 0),Ct([(0,e.Property)(0)],i.prototype,"cy",void 0),Ct([(0,e.Property)(0)],i.prototype,"fx",void 0),Ct([(0,e.Property)(0)],i.prototype,"fy",void 0),Ct([(0,e.Property)(50)],i.prototype,"r",void 0),i}(Lt),zt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)(0)],i.prototype,"x1",void 0),Ct([(0,e.Property)(0)],i.prototype,"x2",void 0),Ct([(0,e.Property)(0)],i.prototype,"y1",void 0),Ct([(0,e.Property)(0)],i.prototype,"y2",void 0),i}(Lt),kt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)(0)],i.prototype,"cx",void 0),Ct([(0,e.Property)(0)],i.prototype,"cy",void 0),Ct([(0,e.Property)(0)],i.prototype,"fx",void 0),Ct([(0,e.Property)(0)],i.prototype,"fy",void 0),Ct([(0,e.Property)(50)],i.prototype,"r",void 0),i}(Lt),Bt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)("white")],i.prototype,"fill",void 0),Ct([(0,e.Property)("black")],i.prototype,"strokeColor",void 0),Ct([(0,e.Property)("")],i.prototype,"strokeDashArray",void 0),Ct([(0,e.Property)(1)],i.prototype,"strokeWidth",void 0),Ct([(0,e.Property)(1)],i.prototype,"opacity",void 0),Ct([(0,e.ComplexFactory)(Tt)],i.prototype,"gradient",void 0),i}(e.ChildProperty),Rt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)("transparent")],i.prototype,"fill",void 0),i}(Bt),Nt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)("black")],i.prototype,"color",void 0),Ct([(0,e.Property)("Arial")],i.prototype,"fontFamily",void 0),Ct([(0,e.Property)(12)],i.prototype,"fontSize",void 0),Ct([(0,e.Property)(!1)],i.prototype,"italic",void 0),Ct([(0,e.Property)(!1)],i.prototype,"bold",void 0),Ct([(0,e.Property)("CollapseSpace")],i.prototype,"whiteSpace",void 0),Ct([(0,e.Property)("WrapWithOverflow")],i.prototype,"textWrapping",void 0),Ct([(0,e.Property)("Center")],i.prototype,"textAlign",void 0),Ct([(0,e.Property)("None")],i.prototype,"textDecoration",void 0),Ct([(0,e.Property)("Wrap")],i.prototype,"textOverflow",void 0),Ct([(0,e.Property)("transparent")],i.prototype,"fill",void 0),i}(Bt),jt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Pt(i,t),Ct([(0,e.Property)("white")],i.prototype,"fill",void 0),Ct([(0,e.Property)("Wrap")],i.prototype,"textOverflow",void 0),Ct([(0,e.Property)(1)],i.prototype,"strokeWidth",void 0),Ct([(0,e.ComplexFactory)(Tt)],i.prototype,"gradient",void 0),Ct([(0,e.Property)(1)],i.prototype,"opacity",void 0),Ct([(0,e.Property)(!1)],i.prototype,"italic",void 0),Ct([(0,e.Property)("")],i.prototype,"strokeDashArray",void 0),Ct([(0,e.Property)("black")],i.prototype,"color",void 0),Ct([(0,e.Property)(12)],i.prototype,"fontSize",void 0),Ct([(0,e.Property)("Arial")],i.prototype,"fontFamily",void 0),Ct([(0,e.Property)("CollapseSpace")],i.prototype,"whiteSpace",void 0),Ct([(0,e.Property)("Center")],i.prototype,"textAlign",void 0),Ct([(0,e.Property)("None")],i.prototype,"textDecoration",void 0),Ct([(0,e.Property)(!1)],i.prototype,"bold",void 0),Ct([(0,e.Property)("black")],i.prototype,"strokeColor",void 0),Ct([(0,e.Property)("WrapWithOverflow")],i.prototype,"textWrapping",void 0),i}(e.ChildProperty);!function(t){t[t.Default=0]="Default",t[t.expandNode=2]="expandNode",t[t.interaction=4]="interaction",t[t.GroupingInProgress=8]="GroupingInProgress",t[t.GroupClipboardInProcess=16]="GroupClipboardInProcess",t[t.ClearObject=32]="ClearObject"}($||($={})),function(t){t[t.Horizontal=1]="Horizontal",t[t.Vertical=2]="Vertical",t[t.Both=3]="Both",t[t.None=0]="None"}(tt||(tt={})),function(t){t[t.Visible=1]="Visible",t[t.Hidden=2]="Hidden",t[t.Hover=4]="Hover",t[t.Connect=8]="Connect"}(et||(et={})),function(t){t[t.None=0]="None",t[t.ShowHorizontalLines=1]="ShowHorizontalLines",t[t.ShowVerticalLines=2]="ShowVerticalLines",t[t.ShowLines=3]="ShowLines",t[t.SnapToHorizontalLines=4]="SnapToHorizontalLines",t[t.SnapToVerticalLines=8]="SnapToVerticalLines",t[t.SnapToLines=12]="SnapToLines",t[t.SnapToObject=16]="SnapToObject",t[t.All=31]="All"}(it||(it={})),function(t){t[t.None=1]="None",t[t.ConnectorSourceThumb=2]="ConnectorSourceThumb",t[t.ConnectorTargetThumb=4]="ConnectorTargetThumb",t[t.ResizeSouthEast=8]="ResizeSouthEast",t[t.ResizeSouthWest=16]="ResizeSouthWest",t[t.ResizeNorthEast=32]="ResizeNorthEast",t[t.ResizeNorthWest=64]="ResizeNorthWest",t[t.ResizeEast=128]="ResizeEast",t[t.ResizeWest=256]="ResizeWest",t[t.ResizeSouth=512]="ResizeSouth",t[t.ResizeNorth=1024]="ResizeNorth",t[t.Rotate=2048]="Rotate",t[t.UserHandle=4096]="UserHandle",t[t.ToolTip=8192]="ToolTip",t[t.ResizeAll=2046]="ResizeAll",t[t.All=16382]="All"}(rt||(rt={})),function(t){t.SamePoint="SamePoint",t.DifferentPoint="DifferentPoint"}(nt||(nt={})),function(t){t.Linear="Linear",t.Nonlinear="Nonlinear"}(ot||(ot={})),function(t){t[t.None=1]="None",t[t.Select=2]="Select",t[t.Delete=4]="Delete",t[t.Drag=8]="Drag",t[t.DragSourceEnd=16]="DragSourceEnd",t[t.DragTargetEnd=32]="DragTargetEnd",t[t.DragSegmentThumb=64]="DragSegmentThumb",t[t.AllowDrop=128]="AllowDrop",t[t.Bridging=256]="Bridging",t[t.BridgeObstacle=512]="BridgeObstacle",t[t.InheritBridging=1024]="InheritBridging",t[t.PointerEvents=2048]="PointerEvents",t[t.Tooltip=4096]="Tooltip",t[t.InheritTooltip=8192]="InheritTooltip",t[t.Interaction=4218]="Interaction",t[t.ReadOnly=16384]="ReadOnly",t[t.LineRouting=32768]="LineRouting",t[t.InheritLineRouting=65536]="InheritLineRouting",t[t.ConnectToNearByNode=131072]="ConnectToNearByNode",t[t.ConnectToNearByPort=262144]="ConnectToNearByPort",t[t.ConnectToNearByElement=393216]="ConnectToNearByElement",t[t.InheritSegmentThumbShape=524288]="InheritSegmentThumbShape",t[t.InheritSegmentThumbSize=1048576]="InheritSegmentThumbSize",t[t.Default=2043454]="Default"}(at||(at={})),function(t){t[t.ReadOnly=2]="ReadOnly",t[t.InheritReadOnly=4]="InheritReadOnly",t[t.Select=8]="Select",t[t.Drag=16]="Drag",t[t.Resize=32]="Resize",t[t.Rotate=64]="Rotate",t[t.Tooltip=128]="Tooltip",t[t.Interaction=120]="Interaction",t[t.None=0]="None"}(st||(st={})),function(t){t[t.None=0]="None",t[t.Select=2]="Select",t[t.Drag=4]="Drag",t[t.Rotate=8]="Rotate",t[t.Shadow=16]="Shadow",t[t.PointerEvents=32]="PointerEvents",t[t.Delete=64]="Delete",t[t.InConnect=128]="InConnect",t[t.OutConnect=256]="OutConnect",t[t.Individual=512]="Individual",t[t.Expandable=1024]="Expandable",t[t.AllowDrop=2048]="AllowDrop",t[t.Inherit=78]="Inherit",t[t.ResizeNorthEast=4096]="ResizeNorthEast",t[t.ResizeEast=8192]="ResizeEast",t[t.ResizeSouthEast=16384]="ResizeSouthEast",t[t.ResizeSouth=32768]="ResizeSouth",t[t.ResizeSouthWest=65536]="ResizeSouthWest",t[t.ResizeWest=131072]="ResizeWest",t[t.ResizeNorthWest=262144]="ResizeNorthWest",t[t.ResizeNorth=524288]="ResizeNorth",t[t.Resize=1044480]="Resize",t[t.AspectRatio=1048576]="AspectRatio",t[t.Tooltip=2097152]="Tooltip",t[t.InheritTooltip=4194304]="InheritTooltip",t[t.ReadOnly=8388608]="ReadOnly",t[t.HideThumbs=16777216]="HideThumbs",t[t.AllowMovingOutsideLane=33554432]="AllowMovingOutsideLane",t[t.Default=5240814]="Default"}(ht||(ht={})),function(t){t[t.None=0]="None",t[t.ElementIsPort=2]="ElementIsPort",t[t.ElementIsGroup=4]="ElementIsGroup",t[t.HorizontalLaneHeader=8]="HorizontalLaneHeader"}(dt||(dt={})),function(t){t[t.Rotate=2]="Rotate",t[t.ConnectorSource=4]="ConnectorSource",t[t.ConnectorTarget=8]="ConnectorTarget",t[t.ResizeNorthEast=16]="ResizeNorthEast",t[t.ResizeEast=32]="ResizeEast",t[t.ResizeSouthEast=64]="ResizeSouthEast",t[t.ResizeSouth=128]="ResizeSouth",t[t.ResizeSouthWest=256]="ResizeSouthWest",t[t.ResizeWest=512]="ResizeWest",t[t.ResizeNorthWest=1024]="ResizeNorthWest",t[t.ResizeNorth=2048]="ResizeNorth",t[t.Default=4094]="Default"}(lt||(lt={})),function(t){t[t.None=1]="None",t[t.Bridging=2]="Bridging",t[t.UndoRedo=4]="UndoRedo",t[t.Tooltip=8]="Tooltip",t[t.UserInteraction=16]="UserInteraction",t[t.ApiUpdate=32]="ApiUpdate",t[t.PageEditable=48]="PageEditable",t[t.Zoom=64]="Zoom",t[t.PanX=128]="PanX",t[t.PanY=256]="PanY",t[t.Pan=384]="Pan",t[t.ZoomTextEdit=512]="ZoomTextEdit",t[t.Virtualization=1024]="Virtualization",t[t.LineRouting=2048]="LineRouting",t[t.AvoidLineOverlapping=4096]="AvoidLineOverlapping",t[t.RestrictNegativeAxisDragDrop=8192]="RestrictNegativeAxisDragDrop",t[t.AutomaticPortCreation=16384]="AutomaticPortCreation",t[t.Default=500]="Default"}(ct||(ct={})),function(t){t[t.None=0]="None",t[t.SingleSelect=1]="SingleSelect",t[t.MultipleSelect=2]="MultipleSelect",t[t.ZoomPan=4]="ZoomPan",t[t.DrawOnce=8]="DrawOnce",t[t.ContinuousDraw=16]="ContinuousDraw",t[t.Default=3]="Default"}(pt||(pt={})),function(t){t[t.Self=1]="Self",t[t.Parent=2]="Parent"}(gt||(gt={})),function(t){t[t.Canvas=0]="Canvas",t[t.Svg=1]="Svg"}(ut||(ut={})),function(t){t[t.None=0]="None",t[t.Control=1]="Control",t[t.Meta=1]="Meta",t[t.Alt=2]="Alt",t[t.Shift=4]="Shift"}(ft||(ft={})),function(t){t[t.None=null]="None",t[t.Number0=0]="Number0",t[t.Number1=1]="Number1",t[t.Number2=2]="Number2",t[t.Number3=3]="Number3",t[t.Number4=4]="Number4",t[t.Number5=5]="Number5",t[t.Number6=6]="Number6",t[t.Number7=7]="Number7",t[t.Number8=8]="Number8",t[t.Number9=9]="Number9",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.Left=37]="Left",t[t.Up=38]="Up",t[t.Right=39]="Right",t[t.Down=40]="Down",t[t.Escape=27]="Escape",t[t.Space=32]="Space",t[t.PageUp=33]="PageUp",t[t.PageDown=34]="PageDown",t[t.End=35]="End",t[t.Home=36]="Home",t[t.Delete=46]="Delete",t[t.Tab=9]="Tab",t[t.Enter=13]="Enter",t[t.BackSpace=8]="BackSpace",t[t.F1=112]="F1",t[t.F2=113]="F2",t[t.F3=114]="F3",t[t.F4=115]="F4",t[t.F5=116]="F5",t[t.F6=117]="F6",t[t.F7=118]="F7",t[t.F8=119]="F8",t[t.F9=120]="F9",t[t.F10=121]="F10",t[t.F11=122]="F11",t[t.F12=123]="F12",t[t.Star=56]="Star",t[t.Plus=187]="Plus",t[t.Minus=189]="Minus",t[t.BracketLeft=219]="BracketLeft",t[t.BracketRight=221]="BracketRight"}(mt||(mt={})),function(t){t[t.Render=2]="Render",t[t.PublicMethod=4]="PublicMethod",t[t.ToolAction=8]="ToolAction",t[t.UndoRedo=16]="UndoRedo",t[t.TextEdit=32]="TextEdit",t[t.Group=64]="Group",t[t.Clear=128]="Clear",t[t.PreventClearSelection=256]="PreventClearSelection",t[t.Interactions=512]="Interactions",t[t.PreventHistory=1024]="PreventHistory",t[t.PreventIconsUpdate=2048]="PreventIconsUpdate",t[t.PreventCollectionChangeOnDragOver=4096]="PreventCollectionChangeOnDragOver",t[t.PreventZIndexOnDragging=8192]="PreventZIndexOnDragging",t[t.isGroupDragging=16384]="isGroupDragging",t[t.DragUsingMouse=32768]="DragUsingMouse",t[t.DecoratorPropertyChange=65536]="DecoratorPropertyChange",t[t.PreventLaneContainerUpdate=131072]="PreventLaneContainerUpdate"}(yt||(yt={})),function(t){t[t.None=2]="None",t[t.DrawSelectorBorder=4]="DrawSelectorBorder",t[t.PreventRenderSelector=8]="PreventRenderSelector"}(vt||(vt={})),function(t){t[t.None=0]="None",t[t.PreventDrag=2]="PreventDrag",t[t.PreventScale=4]="PreventScale",t[t.PreventDataInit=8]="PreventDataInit",t[t.hScrollbarMoved=16]="hScrollbarMoved",t[t.vScrollbarMoved=32]="vScrollbarMoved",t[t.AnimationClick=64]="AnimationClick",t[t.EnableGroupAction=128]="EnableGroupAction",t[t.PanInProgress=256]="PanInProgress",t[t.OverViewAction=512]="OverViewAction"}(bt||(bt={})),function(t){t[t.None=0]="None",t[t.PropertyChange=1024]="PropertyChange",t[t.Interaction=2048]="Interaction"}(St||(St={})),function(t){t[t.Zero=0]="Zero",t[t.One=1]="One",t[t.Two=2]="Two",t[t.Three=3]="Three",t[t.Four=4]="Four",t[t.Five=5]="Five"}(wt||(wt={})),function(t){t[t.collectionChange=0]="collectionChange",t[t.rotateChange=1]="rotateChange",t[t.positionChange=2]="positionChange",t[t.propertyChange=3]="propertyChange",t[t.selectionChange=4]="selectionChange",t[t.sizeChange=5]="sizeChange",t[t.drop=6]="drop",t[t.sourcePointChange=7]="sourcePointChange",t[t.targetPointChange=8]="targetPointChange",t[t.connectionChange=9]="connectionChange",t[t.animationComplete=10]="animationComplete",t[t.click=11]="click",t[t.doubleClick=12]="doubleClick",t[t.scrollChange=13]="scrollChange",t[t.dragEnter=14]="dragEnter",t[t.dragLeave=15]="dragLeave",t[t.dragOver=16]="dragOver",t[t.textEdit=17]="textEdit",t[t.paletteSelectionChange=18]="paletteSelectionChange",t[t.historyChange=19]="historyChange",t[t.mouseEnter=20]="mouseEnter",t[t.mouseLeave=21]="mouseLeave",t[t.mouseOver=22]="mouseOver",t[t.expandStateChange=23]="expandStateChange",t[t.segmentCollectionChange=24]="segmentCollectionChange",t[t.commandExecute=25]="commandExecute",t[t.historyStateChange=26]="historyStateChange",t[t.onUserHandleMouseDown=27]="onUserHandleMouseDown",t[t.onUserHandleMouseUp=28]="onUserHandleMouseUp",t[t.onUserHandleMouseEnter=29]="onUserHandleMouseEnter",t[t.onUserHandleMouseLeave=30]="onUserHandleMouseLeave",t[t.onImageLoad=31]="onImageLoad",t[t.onDoBindingInit=32]="onDoBindingInit",t[t.keyUp=33]="keyUp",t[t.keyDown=34]="keyDown",t[t.fixedUserHandleClick=35]="fixedUserHandleClick",t[t.elementDraw=36]="elementDraw",t[t.mouseWheel=37]="mouseWheel",t[t.segmentChange=38]="segmentChange",t[t.onFixedUserHandleMouseDown=39]="onFixedUserHandleMouseDown",t[t.onFixedUserHandleMouseUp=40]="onFixedUserHandleMouseUp",t[t.onFixedUserHandleMouseEnter=41]="onFixedUserHandleMouseEnter",t[t.onFixedUserHandleMouseLeave=42]="onFixedUserHandleMouseLeave",t[t.loaded=43]="loaded",t[t.layoutUpdated=44]="layoutUpdated",t[t.diagramImporting=45]="diagramImporting",t[t.diagramExporting=46]="diagramExporting"}(xt||(xt={})),function(t){t[t.None=1]="None",t[t.Drag=2]="Drag",t[t.Draw=4]="Draw",t[t.InConnect=8]="InConnect",t[t.OutConnect=16]="OutConnect",t[t.ToolTip=32]="ToolTip",t[t.InheritTooltip=64]="InheritTooltip",t[t.Default=24]="Default"}(It||(It={}));var Ht,Wt,_t="contextMenuClick",Yt="contextMenuOpen",Ft="contextMenuBeforeItemRender";!function(t){t[t.None=1]="None",t[t.Source=2]="Source",t[t.Target=4]="Target",t[t.Intermediate=8]="Intermediate",t[t.All=14]="All"}(Ht||(Ht={})),function(t){t[t.None=0]="None",t[t.SymmetricAngle=2]="SymmetricAngle",t[t.SymmetricDistance=4]="SymmetricDistance",t[t.Default=6]="Default"}(Wt||(Wt={}));var Xt=function(){function t(){this.pivot={x:.5,y:.5},this.isDirt=!0,this.isExport=!1,this.exportScaleValue={x:0,y:0},this.exportScaleOffset={x:0,y:0},this.canApplyStyle=!0,this.visible=!0,this.offsetX=0,this.offsetY=0,this.cornerRadius=0,this.minHeight=void 0,this.minWidth=void 0,this.maxWidth=void 0,this.maxHeight=void 0,this.width=void 0,this.height=void 0,this.rotateAngle=0,this.margin={left:0,right:0,top:0,bottom:0},this.connectionDirection="Auto",this.horizontalAlignment="Auto",this.verticalAlignment="Auto",this.flip=tt.None,this.flipMode="All",this.relativeMode="Point",this.transform=gt.Self|gt.Parent,this.style={fill:"white",strokeColor:"black",opacity:1,strokeWidth:1},this.desiredSize=new i,this.actualSize=new i,this.parentTransform=0,this.preventContainer=!1,this.isSvgRender=!1,this.bounds=new w(0,0,0,0),this.shadow=null,this.description="",this.staticSize=!1,this.shapeType="",this.isRectElement=!1,this.isCalculateDesiredSize=!0,this.flipOffset={x:0,y:0},this.elementActions=dt.None,this.inversedAlignment=!0,this.position=void 0,this.unitMode=void 0,this.float=!1,this.floatingBounds=void 0}return t.prototype.setOffsetWithRespectToBounds=function(t,e,i){this.unitMode=i,this.position={x:t,y:e}},t.prototype.getAbsolutePosition=function(t){if(void 0!==this.position)return"Absolute"===this.unitMode?this.position:{x:this.position.x*t.width,y:this.position.y*t.height}},Object.defineProperty(t.prototype,"outerBounds",{get:function(){return this.floatingBounds||this.bounds},set:function(t){this.floatingBounds=t},enumerable:!0,configurable:!0}),t.prototype.measure=function(t,e,r){var n=void 0!==this.width?this.width:(t.width||0)-this.margin.left-this.margin.right,o=void 0!==this.height?this.height:(t.height||0)-this.margin.top-this.margin.bottom;return this.id&&0===o&&this.elementActions&dt.HorizontalLaneHeader&&(o=this.actualSize.height),this.desiredSize=new i(n,o),this.isCalculateDesiredSize&&(this.desiredSize=this.validateDesiredSize(this.desiredSize,t)),this.desiredSize},t.prototype.arrange=function(t){return this.actualSize=t,this.updateBounds(),this.actualSize},t.prototype.updateBounds=function(){this.bounds=R(this)},t.prototype.validateDesiredSize=function(t,e){return!this.isRectElement||this.width||this.minWidth||this.maxWidth||(t.width=50),!this.isRectElement||this.height||this.minHeight||this.maxHeight||(t.height=50),(void 0===t||void 0!==this.width&&void 0!==this.height)&&((t=t||new i).width=void 0===this.width?(e.width||0)-this.margin.left-this.margin.right:this.width,t.height=void 0===this.height?(e.height||0)-this.margin.top-this.margin.bottom:this.height),void 0!==this.minWidth&&(t.width=Math.max(t.width,this.minWidth)),void 0!==this.minHeight&&(t.height=Math.max(t.height,this.minHeight)),void 0!==this.maxWidth&&0!==this.maxWidth&&(t.width=Math.min(t.width,this.maxWidth)),void 0!==this.maxHeight&&0!==this.maxHeight&&(t.height=Math.min(t.height,this.maxHeight)),t},t}(),Vt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ut=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.padding=new At(0,0,0,0),e.desiredBounds=void 0,e.measureChildren=!0,e.prevRotateAngle=0,e}return Vt(e,t),e.prototype.hasChildren=function(){return void 0!==this.children&&this.children.length>0},e.prototype.measure=function(t,r,n){this.desiredBounds=void 0;var o,a,s=void 0;if(this.hasChildren()){for(var h=0;h<this.children.length;h++){"Stretch"!==(o=this.children[parseInt(h.toString(),10)]).horizontalAlignment||t.width||(t.width=o.bounds.width),"Stretch"!==o.verticalAlignment||t.height||(t.height=o.bounds.height);var d="Stretch"===o.horizontalAlignment||"Stretch"===o.verticalAlignment;(this.measureChildren||d||o instanceof e&&void 0!==o.measureChildren)&&o.measure(t,r,n),a=this.GetChildrenBounds(o),"Stretch"!==o.horizontalAlignment&&"Stretch"!==o.verticalAlignment?void 0===this.desiredBounds?this.desiredBounds=a:this.desiredBounds.uniteRect(a):!this.actualSize||this.actualSize.width||this.actualSize.height||o.preventContainer||"Stretch"!==o.horizontalAlignment||"Stretch"!==o.verticalAlignment||(void 0===this.desiredBounds?this.desiredBounds=o.bounds:this.desiredBounds.uniteRect(o.bounds))}if(void 0!==this.desiredBounds&&0!==this.rotateAngle){var l={x:this.desiredBounds.x+this.desiredBounds.width*this.pivot.x,y:this.desiredBounds.y+this.desiredBounds.height*this.pivot.y},c=Q(this.rotateAngle,void 0,void 0,l);this.desiredBounds.x=c.x-this.desiredBounds.width*this.pivot.x,this.desiredBounds.y=c.y-this.desiredBounds.height*this.pivot.y}void 0!==this.desiredBounds&&(this.desiredBounds.width+=this.padding.left+this.padding.right,this.desiredBounds.height+=this.padding.top+this.padding.bottom,this.desiredBounds.x-=this.padding.left,this.desiredBounds.y-=this.padding.top),this.desiredBounds&&(s=new i(this.desiredBounds.width,this.desiredBounds.height))}return s=this.validateDesiredSize(s,t),this.stretchChildren(s),this.desiredSize=s,s},e.prototype.arrange=function(t){var i,r=this.desiredBounds;if(r){this.offsetX,this.offsetY;if(this.offsetX=r.x+r.width*this.pivot.x,this.offsetY=r.y+r.height*this.pivot.y,this.hasChildren())for(var n=0;n<this.children.length;n++){var o=!1;if("Stretch"===(i=this.children[parseInt(n.toString(),10)]).horizontalAlignment&&(i.offsetX=this.offsetX,i.parentTransform=this.parentTransform+this.rotateAngle,this.flip&&this.elementActions&dt.ElementIsGroup&&(i.parentTransform=this.flip===tt.Horizontal||this.flip===tt.Vertical?-i.parentTransform:i.parentTransform),o=!0),"Stretch"===i.verticalAlignment&&(i.offsetY=this.offsetY,i.parentTransform=this.parentTransform+this.rotateAngle,o=!0),(o||this.measureChildren||i instanceof e&&void 0!==i.measureChildren)&&i.arrange(i.desiredSize),0===n){var a=i.outerBounds;this.outerBounds=new w(a.x,a.y,a.width,a.height)}else this.outerBounds.uniteRect(i.outerBounds)}}return this.actualSize=t,this.updateBounds(),this.prevRotateAngle=this.rotateAngle,t},e.prototype.stretchChildren=function(t){if(this.hasChildren())for(var i=0,r=this.children;i<r.length;i++){var n=r[i];"Stretch"!==n.horizontalAlignment&&void 0!==n.desiredSize.width||(n.desiredSize.width=t.width-n.margin.left-n.margin.right),"Stretch"!==n.verticalAlignment&&void 0!==n.desiredSize.height||(n.desiredSize.height=t.height-n.margin.top-n.margin.bottom),n instanceof e&&n.stretchChildren(n.desiredSize)}},e.prototype.applyPadding=function(t){t.width+=this.padding.left+this.padding.right,t.height+=this.padding.top+this.padding.bottom},e.prototype.findChildOffsetFromCenter=function(t,e){var i=K({x:e.x-t.desiredSize.width/2,y:e.y-t.desiredSize.height/2},t);i=Q(t.rotateAngle,e.x,e.y,i),i=Q(this.rotateAngle+this.parentTransform,this.offsetX,this.offsetY,i),t.offsetX=i.x,t.offsetY=i.y},e.prototype.GetChildrenBounds=function(t){var e=t.desiredSize.clone(),i=(t.rotateAngle,this.rotateAngle,t.offsetX),r=t.offsetY,n=i-e.width*t.pivot.x,o=r-e.height*t.pivot.y,a=n+e.width,s=o+e.height,h={x:n,y:o},d={x:a,y:o},l={x:n,y:s},c={x:a,y:s};return h=Q(t.rotateAngle,t.offsetX,t.offsetY,h),d=Q(t.rotateAngle,t.offsetX,t.offsetY,d),l=Q(t.rotateAngle,t.offsetX,t.offsetY,l),c=Q(t.rotateAngle,t.offsetX,t.offsetY,c),0!==this.rotateAngle&&(h=Q(-this.rotateAngle,void 0,void 0,h),d=Q(-this.rotateAngle,void 0,void 0,d),l=Q(-this.rotateAngle,void 0,void 0,l),c=Q(-this.rotateAngle,void 0,void 0,c)),w.toBounds([h,d,l,c])},e}(Xt),Gt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Zt=function(t){function e(){var e=t.call(this)||this;return e.textContent="",e.canMeasure=!0,e.rotationReference="Parent",e.isLaneOrientation=!1,e.canConsiderBounds=!0,e.annotationVisibility="Visible",e.hyperlink={color:"blue"},e.doWrap=!0,e.textNodes=[],e.style={color:"black",fill:"transparent",strokeColor:"black",strokeWidth:1,fontFamily:"Arial",fontSize:12,whiteSpace:"CollapseSpace",textWrapping:"WrapWithOverflow",textAlign:"Center",italic:!1,bold:!1,textDecoration:"None",strokeDashArray:"",opacity:5,gradient:null,textOverflow:"Wrap"},e.style.fill="transparent",e.style.strokeColor="transparent",e}return Gt(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this.textContent},set:function(t){this.textContent!==t&&(this.textContent=t,this.isDirt=!0,this.doWrap=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.textNodes},set:function(t){this.textNodes=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"wrapBounds",{get:function(){return this.textWrapBounds},set:function(t){this.textWrapBounds=t},enumerable:!0,configurable:!0}),e.prototype.refreshTextElement=function(){this.isDirt=!0},e.prototype.measure=function(t){var e;return e=this.isDirt&&this.canMeasure?function(t,e,r,n,o){var a,s,h=new i(0,0),d=function(t,e){var i={fill:t.style.fill,stroke:t.style.strokeColor,angle:t.rotateAngle+t.parentTransform,pivotX:t.pivot.x,pivotY:t.pivot.y,strokeWidth:t.style.strokeWidth,dashArray:t.style.strokeDashArray,opacity:t.style.opacity,shadow:t.shadow,gradient:t.style.gradient,visible:t.visible,id:t.id,description:t.description,width:e||t.actualSize.width,height:t.actualSize.height,x:t.offsetX-t.actualSize.width*t.pivot.x+.5,y:t.offsetY-t.actualSize.height*t.pivot.y+.5};return i.fontSize=t.style.fontSize,i.fontFamily=t.style.fontFamily,i.textOverflow=t.style.textOverflow,i.textDecoration=t.style.textDecoration,i.doWrap=t.doWrap,i.whiteSpace=Z(t.style.whiteSpace,t.style.textWrapping),i.content=t.content,i.textWrapping=t.style.textWrapping,i.breakWord=F(t.style.textWrapping),i.textAlign=Y(t.style.textAlign),i.color=t.style.color,i.italic=t.style.italic,i.bold=t.style.bold,i.dashArray="",i.strokeWidth=0,i.fill="",i}(t,n);t.childNodes=a=function(t,e,i){var r,n,o=[],a=0,s=e||t.content;if("nowrap"!==t.whiteSpace&&"pre"!==t.whiteSpace)if("breakall"===t.breakWord)for(r="",r+=s[0],a=0;a<s.length;a++)if((n=V(r,t))>=t.width&&r.length>0)o[o.length]={text:r,x:0,dy:0,width:n},r="";else{(r+=s[a+1]||"").indexOf("\n")>-1&&(o[o.length]={text:r,x:0,dy:0,width:V(r,t)},r="");var h=V(r,t);Math.ceil(h)+2>=t.width&&r.length>0&&(o[o.length]={text:r,x:0,dy:0,width:h},r=""),a===s.length-1&&r.length>0&&(o[o.length]={text:r,x:0,dy:0,width:h},r="")}else o=function(t,e,i){var r,n,o,a,s=[],h="",d=0,l=0,c="nowrap"!==t.whiteSpace,p=e||t.content,g=p.split("\n");for(d=0;d<g.length;d++)for(r="NoWrap"!==t.textWrapping?g[parseInt(d.toString(),10)].split(" "):[g[parseInt(d.toString(),10)]],l=0;l<r.length;l++){h+=((0!==l||1===r.length)&&c&&h.length>0?" ":"")+r[parseInt(l.toString(),10)];var u=V(n=r[l+1]?h+" "+r[l+1]:h,t);Math.floor(u)>(i||t.width)-2&&h.length>0?(s[s.length]={text:h,x:0,dy:0,width:n===h?u:h===a?o:V(h,t)},h=""):l===r.length-1&&(s[s.length]={text:h,x:0,dy:0,width:u},h=""),a=n,o=u}return s}(t,e,i);else o[o.length]={text:s,x:0,dy:0,width:V(s,t)};return o}(d,o,t.isLaneOrientation?n:void 0),t.wrapBounds=s=function(t,e){var i,r,n={x:0,width:0},o=0;for(o=0;o<e.length;o++)r=i=e[parseInt(o.toString(),10)].width,i="left"===t.textAlign||"justify"===t.textAlign?0:"center"===t.textAlign?i>t.width&&("Ellipsis"===t.textOverflow||"Clip"===t.textOverflow)?0:-i/2:"right"===t.textAlign?-i:e.length>1?0:-i/2,e[parseInt(o.toString(),10)].dy=1.2*t.fontSize,e[parseInt(o.toString(),10)].x=i,n.x=Math.min(n.x,i),n.width=Math.max(n.width,r);return n}(d,a),h.width=s.width,t.wrapBounds.width>=n&&"Wrap"!==d.textOverflow&&(h.width=n);return h.height=a.length*t.style.fontSize*1.2,h}(this,this.style,this.content,this.isLaneOrientation?t.height:this.width||t.width):this.desiredSize,void 0===this.width||void 0===this.height?this.desiredSize=new i(e.width,e.height):this.desiredSize=new i(this.width,this.height),this.desiredSize=this.validateDesiredSize(this.desiredSize,t),this.desiredSize},e.prototype.arrange=function(t){return(t.width!==this.actualSize.width||t.height!==this.actualSize.height||this.isDirt)&&(this.doWrap=!0),this.actualSize=t,this.updateBounds(),this.isDirt=!1,this.actualSize},e}(Xt),qt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qt=function(t){function e(){var e=t.call(this)||this;return e.pathData="",e.transformPath=!0,e.absolutePath="",e.canMeasurePath=!1,e.absoluteBounds=new w,e}return qt(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.pathData},set:function(t){this.pathData!==t&&(this.pathData=t,this.isDirt=!0)},enumerable:!0,configurable:!0}),e.prototype.getPoints=function(){var t=this;return this.pointTimer||(this.pointTimer=setTimeout(function(){t.points=null,t.pointTimer=null},200)),this.points=this.points||function(t){var e,i,r=[],n="measureElement";window[""+n].style.visibility="visible";var o=Qh(window[""+n].children[2])[0];o.setAttributeNS(null,"d",t.data);var a=t.absoluteBounds,s=td(t,a,t);o.setAttributeNS(null,"d",s);var h=o.getTotalLength(),d=sc.prototype.getPathData(s);if(0===d.length){for(i=0;i<=h;i+=10)e=o.getPointAtLength(i),r.push({x:e.x,y:e.y});sc.prototype.setPathData(s,r)}else r=d;return window[""+n].style.visibility="hidden",r}(this),function(t,e){for(var i=[],r=t.offsetX-t.actualSize.width*t.pivot.x,n=t.offsetY-t.actualSize.height*t.pivot.y,o=0,a=e;o<a.length;o++){var s=a[o],h=void 0,d=r+s.x,l=n+s.y,c=r+t.actualSize.width-s.x,p=n+t.actualSize.height-s.y;switch(t.flip){case tt.Both:h={x:c,y:p};break;case tt.Horizontal:h={x:c,y:l};break;case tt.Vertical:h={x:d,y:p};break;default:h={x:d,y:l}}var g=void 0,u=t.rotateAngle+t.parentTransform;u&&T(g=I(),u,t.offsetX,t.offsetY),g&&(h=P(g,h)),i.push(h)}return i}(this,this.points)},e.prototype.measure=function(t){return this.staticSize&&void 0!==this.width&&void 0!==this.height?this.absoluteBounds=new w(this.offsetX-this.width*this.pivot.x,this.offsetY-this.height*this.pivot.y,this.width,this.height):(!this.isDirt||!this.transformPath&&void 0!==this.width&&void 0!==this.height||this.absoluteBounds&&0!==this.absoluteBounds.height)&&!this.canMeasurePath||(this.absoluteBounds=Jh(this.data?this.data:"")),"Point"!==this.relativeMode&&this.absoluteBounds&&0===this.absoluteBounds.width&&(this.absoluteBounds.width=this.style.strokeWidth),"Point"!==this.relativeMode&&this.absoluteBounds&&0===this.absoluteBounds.height&&(this.absoluteBounds.height=this.style.strokeWidth),void 0===this.width?this.desiredSize=new i(this.absoluteBounds.width,this.height||this.absoluteBounds.height):void 0===this.height?this.desiredSize=new i(this.width||this.absoluteBounds.width,this.absoluteBounds.height):this.desiredSize=new i(this.width,this.height),this.desiredSize=this.validateDesiredSize(this.desiredSize,t),this.canMeasurePath=!1,this.desiredSize},e.prototype.arrange=function(t){return(this.isDirt||this.actualSize.width!==t.width||this.actualSize.height!==t.height)&&(this.isDirt=!0,this.absolutePath=this.updatePath(this.data,this.absoluteBounds,t),this.staticSize||(this.points=null)),this.actualSize=this.desiredSize,this.updateBounds(),this.isDirt=!1,this.actualSize},e.prototype.updatePath=function(t,e,i){var r=!1,n="",o=-e.x,a=-e.y,s=[];return i.width===e.width&&i.height===e.height||(o=i.width/Number(e.width?e.width:1),a=i.height/Number(e.height?e.height:1),r=!0),s=y(s=h(t)),n=(r||this.isDirt)&&this.transformPath?u(s,o,a,r,e.x,e.y,0,0):v(s),r=!1,n},e}(Xt),Kt=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Jt=function(t){function e(){var e=t.call(this)||this;return e.imageSource="",e.imageScale="None",e.imageAlign="None",e.stretch="Stretch",e}return Kt(e,t),Object.defineProperty(e.prototype,"source",{get:function(){return this.imageSource},set:function(t){this.imageSource=t,this.isDirt=!0},enumerable:!0,configurable:!0}),e.prototype.measure=function(t,e,r){return this.isDirt&&("Stretch"!==this.stretch||void 0===this.width&&void 0===this.height)&&(this.contentSize=function(t,e,r,n){var o="measureElement";window[""+o].style.visibility="visible";var a=window[""+o].children[1];a.setAttribute("src",t);var s=a.getBoundingClientRect(),h=s.width,d=s.height;e=new i(h,d),window[""+o].style.visibility="hidden";var l=document.createElement("img");return l.setAttribute("src",t),Id(l,{id:r+"sf-imageNode"}),l.style.display="none",document.body.appendChild(l),l.onload=function(t){var e=t.currentTarget;n&&n(r,{width:e.width,height:e.height})},e}(this.source,this.contentSize,e,r),this.isDirt=!1),void 0!==this.width&&void 0!==this.height?(this.desiredSize=new i(this.width,this.height),this.contentSize=this.desiredSize):this.desiredSize=this.contentSize,this.desiredSize=this.validateDesiredSize(this.desiredSize,t),this.desiredSize},e.prototype.arrange=function(t){return this.actualSize=new i(this.desiredSize.width,this.desiredSize.height),this.updateBounds(),this.actualSize},e}(Xt),$t=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),te=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.measureChildren=void 0,e}return $t(e,t),e.prototype.measure=function(e,r,n){var o=void 0,a=void 0;if(this.hasChildren()){for(var s=0,h=this.children;s<h.length;s++){var d=h[s];d instanceof Zt?d.canMeasure&&(e.width=e.width||this.maxWidth||this.minWidth,d.measure(e)):d instanceof Zt||d.measure(e,r,n);var l=d.desiredSize.clone();0!==d.rotateAngle&&(l=q(l,d.rotateAngle));var c=l.width+d.margin.right,p=l.height+d.margin.bottom,g=new w(d.margin.left,d.margin.top,c,p);if(d.float)if(void 0!==d.getAbsolutePosition(l))continue;d instanceof Zt&&!(d instanceof Zt&&d.canConsiderBounds)||(void 0===a?a=g:a.uniteRect(g))}if(a){var u,f;u=Math.max(a.left,0),f=Math.max(a.top,0),o=new i(a.width+u,a.height+f)}}return o=t.prototype.validateDesiredSize.call(this,o,e),t.prototype.stretchChildren.call(this,o),o.width+=this.padding.left+this.padding.right,o.height+=this.padding.top+this.padding.bottom,this.desiredSize=o,o},e.prototype.arrange=function(e,i){if(this.outerBounds=new w,this.hasChildren())for(var r=this.offsetY-e.height*this.pivot.y+this.padding.top,n=this.offsetX-e.width*this.pivot.x+this.padding.left,o=0,a=this.children;o<a.length;o++){var s=a[o];if(0!==(s.transform>.Parent)){s.parentTransform=this.parentTransform+this.rotateAngle,(this.flip!==tt.None||this.elementActions&dt.ElementIsGroup)&&(this.flip!==tt.Horizontal&&this.flip!==tt.Vertical||s.elementActions&dt.ElementIsPort||this.setParentTransform(s));var h,d=s.desiredSize.clone(),l=void 0,c=n,p=r;if("Point"===s.relativeMode){var g=s.getAbsolutePosition(e);void 0!==g&&(c+=g.x,p+=g.y)}"Object"===s.relativeMode?(l=this.alignChildBasedOnParent(s,d,e,c,p),s.flip=this.flip):l=this.alignChildBasedOnaPoint(s,c,p),h={x:l.x+d.width/2,y:l.y+d.height/2},t.prototype.findChildOffsetFromCenter.call(this,s,h)}!i||"Stretch"!==s.horizontalAlignment&&"Stretch"!==s.verticalAlignment?s instanceof Zt&&s.canMeasure?(s.arrange(s.desiredSize),this.outerBounds.uniteRect(s.outerBounds)):s instanceof Zt||(s.arrange(s.desiredSize),this.outerBounds.uniteRect(s.outerBounds)):s.arrange(e)}return this.actualSize=e,this.updateBounds(),this.outerBounds.uniteRect(this.bounds),e},e.prototype.setParentTransform=function(t){"All"===this.flipMode||t instanceof Jt||!(t instanceof Jt||t instanceof Zt||t instanceof Qt)&&t instanceof Xt?t.parentTransform>0&&(t.parentTransform=-t.parentTransform):t instanceof Zt&&void 0===t.position?t.parentTransform=-t.parentTransform:"None"===this.flipMode?!(t.elementActions&dt.ElementIsPort)&&t instanceof Qt&&t.parentTransform>0&&(t.parentTransform=-t.parentTransform):t instanceof Qt?t.parentTransform>0&&(t.parentTransform=-t.parentTransform):"LabelText"!==this.flipMode&&"LabelAndLabelText"!==this.flipMode&&"PortAndLabelText"!==this.flipMode||t instanceof Zt&&t.parentTransform>0&&(t.parentTransform=-t.parentTransform)},e.prototype.alignChildBasedOnParent=function(t,e,i,r,n){switch(t.horizontalAlignment){case"Auto":case"Left":r+=t.margin.left;break;case"Right":r+=i.width-e.width-t.margin.right;break;case"Stretch":case"Center":r+=i.width/2-e.width/2}switch(t.verticalAlignment){case"Auto":case"Top":n+=t.margin.top;break;case"Bottom":n+=i.height-e.height-t.margin.bottom;break;case"Stretch":case"Center":n+=i.height/2-e.height/2}return{x:r,y:n}},e.prototype.alignChildBasedOnaPoint=function(t,e,i){switch(e+=t.margin.left-t.margin.right,i+=t.margin.top-t.margin.bottom,t.horizontalAlignment){case"Auto":case"Left":e=t.inversedAlignment?e:e-t.desiredSize.width;break;case"Stretch":case"Center":e-=t.desiredSize.width*t.pivot.x;break;case"Right":e=t.inversedAlignment?e-t.desiredSize.width:e}switch(t.verticalAlignment){case"Auto":case"Top":i=t.inversedAlignment?i:i-t.desiredSize.height;break;case"Stretch":case"Center":i-=t.desiredSize.height*t.pivot.y;break;case"Bottom":i=t.inversedAlignment?i-t.desiredSize.height:i}return{x:e,y:i}},e}(Ut);function ee(t){return ie[t.toString()]}var ie={Rectangle:"M0,0 L50,0 L50,50 L0,50 z",Ellipse:"M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Hexagon:"M30,0 L60,0 L90,30 L60,60 L30,60 L0,30 L30,0 z",Parallelogram:"M30,0 L60,0 L45,30 L15,30 z",Triangle:"M45,0 L90,45 L0,45 L45,0 z",Plus:"M696.6084,158.2656 L674.8074,158.2656 L674.8074,136.4656 L658.4084,136.4656 L658.4084,158.2656 L636.6084,158.2656L636.6084,174.6646 L658.4084,174.6646 L658.4084,196.4656 L674.8074,196.4656 L674.8074,174.6646 L696.6084,174.6646L696.6084,158.2656 z",Star:"M540.3643,137.9336 L546.7973,159.7016 L570.3633,159.7296 L550.7723,171.9366 L558.9053,194.9966 L540.3643,179.4996L521.8223,194.9966 L529.9553,171.9366 L510.3633,159.7296 L533.9313,159.7016 L540.3643,137.9336 z",Pentagon:"M30,0 L60,30 L50,70 L10,70 L0,30 L30,0 z",Heptagon:"M223.7783,195.7134 L207.1303,174.8364 L213.0713,148.8034 L237.1303,137.2174 L261.1883,148.8034 L267.1303,174.8364L250.4813,195.7134 L223.7783,195.7134 z",Octagon:"M98.7319,196.4653 L81.1579,178.8923 L81.1579,154.0393 L98.7319,136.4653 L123.5849,136.4653L141.1579,154.0393 L141.1579,178.8923 L123.5849,196.4653 L98.7319,196.4653 z",Trapezoid:"M127.2842,291.4492 L95.0322,291.4492 L81.1582,256.3152 L141.1582,256.3152 L127.2842,291.4492 z",Decagon:"M657.3379,302.4141 L642.3369,291.5161 L636.6089,273.8821 L642.3369,256.2481 L657.3379,245.3511 L675.8789,245.3511L690.8789,256.2481 L696.6089,273.8821L690.8789,291.5161 L675.8789,302.4141 L657.3379,302.4141 z",RightTriangle:"M836.293,292.9238 L776.293,292.9238 L776.293,254.8408 L836.293,292.9238 z",Cylinder:"M 542.802,362.009C 542.802,368.452 525.341,373.676 503.802,373.676C 482.263,373.676 464.802,368.452 464.802,362.009L 464.802,466.484C 464.802,472.928 482.263,478.151 503.802,478.151C 525.341,478.151 542.802,472.928 542.802,466.484L 542.802,362.016C 542.802,368.459 525.341,373.534 503.802,373.534C 482.263,373.534 464.802,368.31 464.802,361.867L 464.802,362.016C 464.802,355.572 482.263,350.349 503.802,350.349C 525.341,350.349 542.802,355.572 542.802,362.016",Diamond:"M397.784,287.875 L369.5,316.159 L341.216,287.875 L369.5,259.591 L397.784,287.875 z"},re=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ne=function(t){function e(e,i,r){var n=t.call(this)||this;return n.data="",n.nodeId="",n.diagramId="",n.scale="Stretch",n.diagramId=i,n.nodeId=e,n.templateFn=k(r),n}return re(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this.data},set:function(t){this.data=t,this.canReset||(this.canReset=!0,this.isTemplate||(this.template=Sd(this,!1)),this.canReset=!1,this.isDirt=!0)},enumerable:!0,configurable:!0}),e.prototype.getNodeTemplate=function(){return this.templateFn},e.prototype.measure=function(t){if(this.isDirt){var e=function(t){var e=window.measureElement.children[2];e.appendChild(t);var i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i;return n.x=i.left-r.left,n.y=i.top-r.top,e.removeChild(t),n}(this.template);this.contentSize=new i,this.contentSize.width=e.width,this.contentSize.height=e.height;var r=e.x,n=e.y;this.templatePosition={x:r,y:n},this.isDirt=!1}if(void 0===this.width||void 0===this.height){var o=function(t){var e="measureElement";window[e].style.visibility="visible";var i=window[e].children[2];i.appendChild(t);var r=i.getBoundingClientRect();return i.removeChild(t),window[e].style.visibility="hidden",r}(this.template);this.desiredSize=new i(o.width,o.height)}else this.desiredSize=new i(this.width,this.height);return this.desiredSize=this.validateDesiredSize(this.desiredSize,t),this.desiredSize},e.prototype.arrange=function(t){return this.actualSize=new i(this.desiredSize.width,this.desiredSize.height),this.updateBounds(),this.actualSize},e}(Xt),oe=a(197),ae=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),se=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},he=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return ae(i,t),se([(0,e.Property)("")],i.prototype,"content",void 0),se([(0,e.Property)("TopLeft")],i.prototype,"position",void 0),se([(0,e.Property)("Mouse")],i.prototype,"relativeMode",void 0),se([(0,e.Property)(!0)],i.prototype,"showTipPointer",void 0),se([(0,e.Property)("auto")],i.prototype,"width",void 0),se([(0,e.Property)("auto")],i.prototype,"height",void 0),se([(0,e.Property)("Auto")],i.prototype,"openOn",void 0),se([(0,e.Property)()],i.prototype,"animation",void 0),se([(0,e.Property)(!1)],i.prototype,"isSticky",void 0),i}(e.ChildProperty);function de(t){var e=new oe.Tooltip;e=ge(t.tooltip,e);var i=new oe.Tooltip(e);return i.beforeCollision=ce,i.beforeOpen=le,i.cssClass="e-diagram-tooltip",i.opensOn="custom",i.appendTo("#"+t.element.id),i.close(),i}function le(t){""!==this.content&&void 0!==this.content||(t.element.style.display="none")}function ce(t){t.collidedPosition&&t.collidedPosition!==this.position&&(t.element.style.display="none")}function pe(t,e){var i=t.tooltipObject;return ge(e?e.tooltip:t.tooltip,i),i}function ge(t,i){if(t.content){if(i.content=t.content,"string"==typeof t.content){i.content=(0,e.initializeCSPTemplate)(function(){return t.content})}i.position=t.position,i.showTipPointer=t.showTipPointer,i.width=t.width,i.height=t.height,t.animation?i.animation=t.animation:i.animation={close:{effect:"None"}}}else i.close();return i}var ue=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),fe=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},me=function(t){function i(e,i,r,n){var o=t.call(this,e,i,r,n)||this;return o.inEdges=[],o.outEdges=[],o}return ue(i,t),fe([(0,e.Property)("")],i.prototype,"id",void 0),fe([(0,e.Property)("Center")],i.prototype,"horizontalAlignment",void 0),fe([(0,e.Property)("Center")],i.prototype,"verticalAlignment",void 0),fe([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),fe([(0,e.Property)(12)],i.prototype,"width",void 0),fe([(0,e.Property)(12)],i.prototype,"height",void 0),fe([(0,e.Complex)({},Bt)],i.prototype,"style",void 0),fe([(0,e.Property)("Square")],i.prototype,"shape",void 0),fe([(0,e.Property)("Auto")],i.prototype,"connectionDirection",void 0),fe([(0,e.Property)(et.Connect)],i.prototype,"visibility",void 0),fe([(0,e.Property)("")],i.prototype,"pathData",void 0),fe([(0,e.Property)(It.Default)],i.prototype,"constraints",void 0),fe([(0,e.Property)()],i.prototype,"addInfo",void 0),fe([(0,e.Property)()],i.prototype,"outEdges",void 0),fe([(0,e.Property)()],i.prototype,"inEdges",void 0),fe([(0,e.Complex)({},he)],i.prototype,"tooltip",void 0),i}(e.ChildProperty),ye=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return ue(i,t),i.prototype.getClassName=function(){return"PointPort"},fe([(0,e.Complex)({x:.5,y:.5},o)],i.prototype,"offset",void 0),i}(me),ve=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return ue(i,t),i.prototype.getClassName=function(){return"PathPort"},fe([(0,e.Property)(.5)],i.prototype,"offset",void 0),fe([(0,e.Complex)({x:0,y:0},o)],i.prototype,"displacement",void 0),fe([(0,e.Property)("Center")],i.prototype,"alignment",void 0),i}(me),be=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Se=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},we=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return be(i,t),Se([(0,e.Property)("blue")],i.prototype,"color",void 0),Se([(0,e.Property)("")],i.prototype,"content",void 0),Se([(0,e.Property)("")],i.prototype,"link",void 0),Se([(0,e.Property)("None")],i.prototype,"textDecoration",void 0),Se([(0,e.Property)("NewTab")],i.prototype,"hyperlinkOpenState",void 0),i}(e.ChildProperty),xe=function(t){function i(e,i,r,n){var o=t.call(this,e,i,r,n)||this;return r.id||(e.parentObj&&e.parentObj.propName&&"phases"===e.parentObj.propName?o.id=e.parentObj.id:o.id=E()),o}return be(i,t),Se([(0,e.Property)("")],i.prototype,"content",void 0),Se([(0,e.Property)(void 0)],i.prototype,"template",void 0),Se([(0,e.Property)("String")],i.prototype,"annotationType",void 0),Se([(0,e.Property)(!0)],i.prototype,"visibility",void 0),Se([(0,e.Property)(st.InheritReadOnly)],i.prototype,"constraints",void 0),Se([(0,e.Complex)(void 0,we)],i.prototype,"hyperlink",void 0),Se([(0,e.Property)("")],i.prototype,"id",void 0),Se([(0,e.Property)()],i.prototype,"width",void 0),Se([(0,e.Property)()],i.prototype,"height",void 0),Se([(0,e.Property)(0)],i.prototype,"rotateAngle",void 0),Se([(0,e.Property)("Parent")],i.prototype,"rotationReference",void 0),Se([(0,e.Complex)({strokeWidth:0,strokeColor:"transparent",fill:"transparent"},Nt)],i.prototype,"style",void 0),Se([(0,e.Property)("Center")],i.prototype,"horizontalAlignment",void 0),Se([(0,e.Property)("Center")],i.prototype,"verticalAlignment",void 0),Se([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),Se([(0,e.Complex)({top:void 0,bottom:void 0,left:void 0,right:void 0},Ot)],i.prototype,"dragLimit",void 0),Se([(0,e.Property)("Shape")],i.prototype,"type",void 0),Se([(0,e.Complex)({},he)],i.prototype,"tooltip",void 0),Se([(0,e.Property)()],i.prototype,"addInfo",void 0),i}(e.ChildProperty),Ie=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return be(i,t),i.prototype.getClassName=function(){return"ShapeAnnotation"},Se([(0,e.Complex)({x:.5,y:.5},o)],i.prototype,"offset",void 0),i}(xe),Pe=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return be(i,t),i.prototype.getClassName=function(){return"PathAnnotation"},Se([(0,e.Property)(.5)],i.prototype,"offset",void 0),Se([(0,e.Complex)({x:0,y:0},o)],i.prototype,"displacement",void 0),Se([(0,e.Property)("Center")],i.prototype,"alignment",void 0),Se([(0,e.Property)(!1)],i.prototype,"segmentAngle",void 0),i}(xe);function Ce(t){return Me[t.toString()]}function Te(t,e){return"Custom"===t?e.pathData:Le[""+t]}function Ae(t){return Ee[""+t]}function Oe(t){return ze[""+t]}function De(t){var e;switch(t.shape){case"Minus":e="M0,50 L100,50";break;case"Plus":e="M0,-50 L0,50 M-50,0 L50,0";break;case"ArrowUp":e="M0,100 L50,0 L100,100 Z";break;case"ArrowDown":e="M0,0 L50,100 L100,0 Z";break;case"Path":e=t.pathData}return e}var Me={X:"M14,14 L106,106 M106,14 L14,106",Circle:"M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z",Square:"M0,0 L10,0 L10,10 L0,10 z"},Le={OpenArrow:"M15.9,23 L5,16 L15.9,9 L17,10.7 L8.7,16 L17,21.3Z",Square:"M0,0 L10,0 L10,10 L0,10 z",Fletch:"M14.8,10c0,0-3.5,6,0.2,12c0,0-2.5-6-10.9-6C4.1,16,11.3,16,14.8,10z",OpenFetch:"M6,17c-0.6,0-1-0.4-1-1s0.4-1,1-1c10.9,0,11-5,11-5c0-0.6,0.4-1,1-1s1,0.4,1,1C19,10.3,18.9,17,6,17C6,17,6,17,6,17z M18,23c-0.5,0-1-0.4-1-1c0-0.2-0.3-5-11-5c-0.6,0-1-0.5-1-1s0.4-1,1-1c0,0,0,0,0,0c12.9,0,13,6.7,13,7 C19,22.6,18.6,23,18,23z",IndentedArrow:"M17,10c0,0-4.5,5.5,0,12L5,16L17,10z",OutdentedArrow:"M14.6,10c0,0,5.4,6,0,12L5,16L14.6,10z",DoubleArrow:"M19,10 L19,22 L13,16Z M12,10 L12,22 L6,16Z",Arrow:"M15,10 L15,22 L5,16Z",Diamond:"M12,23l-7-7l7-7l6.9,7L12,23z",Circle:"M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z"},Ee={Square:"M0,0 L10,0 L10,10 L0,10 z",Rhombus:"M10,5 L5,10 L0,5 L5,0 L10,5 Z ",Rectangle:"M0,0 L15,0 L15,10 L0,10 z ",OpenArrow:"M15.9,23 L5,16 L15.9,9 L17,10.7 L8.7,16 L17,21.3Z",Fletch:"M9.82,0 C9.82,0,6.61,5,10,10 C10,10,7.71,5,0,5 C0,5,6.61,5,9.82,0 Z ",OpenFetch:"M0.71,5.71 C0.29,5.71,0,5.43,0,5 C0,4.57,0.29,4.29,0.71,4.29 C8.5,4.29,8.57,0.71,8.57,0.71 C8.57,0.29,8.86,0,9.29,0 C9.719999999999999,0,10,0.29,10,0.71 C10,0.93,9.93,5.71,0.71,5.71 C0.71,5.71,0.71,5.71,0.71,5.71 Z M9.29,10 C8.93,10,8.57,9.71,8.57,9.29 C8.57,9.14,8.36,5.71,0.71,5.71 C0.29,5.71,0,5.36,0,5 C0,4.64,0.29,4.29,0.71,4.29 C0.71,4.29,0.71,4.29,0.71,4.29 C9.93,4.29,10,9.07,10,9.29 C10,9.71,9.71,10,9.29,10 Z ",IndentedArrow:"M10,0 C10,0,6.25,4.58,10,10 L0,5 L10,0 Z ",OutdentedArrow:"M8,0 C8,0,12.5,5,8,10 L0,5 L8,0 Z ",DoubleArrow:"M19,10 L19,22 L13,16Z M12,10 L12,22 L6,16Z",Arrow:"M15,10 L15,22 L5,16Z",Diamond:"M10,5 L5,10 L0,5 L5,0 L10,5 Z ",Circle:"M10,5 C10,7.76,7.76,10,5,10 C2.24,10,0,7.76,0,5 C0,2.24,2.24,0,5,0 C7.76,0,10,2.24,10,5 Z ",Ellipse:"M15,5 C15,7.76,11.64,10,7.5,10 C3.36,10,0,7.76,0,5 C0,2.24,3.36,0,7.5,0 C11.64,0,15,2.24,15,5 Z "},ze={Square:"M0,0 L10,0 L10,10 L0,10 z",Rhombus:"M10,5 L5,10 L0,5 L5,0 L10,5 Z ",Rectangle:"M0,0 L15,0 L15,10 L0,10 z",OpenArrow:"M23,15.9 L16,5 L9,15.9 L10.7,17 L16,8.7 L21,17.3Z",Fletch:"M9.82,0 C9.82,0,6.61,5,10,10 C10,10,7.71,5,0,5 C0,5,6.61,5,9.82,0 Z ",OpenFetch:"M0.71,5.71 C0.29,5.71,0,5.43,0,5 C0,4.57,0.29,4.29,0.71,4.29 C8.5,4.29,8.57,0.71,8.57,0.71 C8.57,0.29,8.86,0,9.29,0 C9.719999999999999,0,10,0.29,10,0.71 C10,0.93,9.93,5.71,0.71,5.71 C0.71,5.71,0.71,5.71,0.71,5.71 Z M9.29,10 C8.93,10,8.57,9.71,8.57,9.29 C8.57,9.14,8.36,5.71,0.71,5.71 C0.29,5.71,0,5.36,0,5 C0,4.64,0.29,4.29,0.71,4.29 C0.71,4.29,0.71,4.29,0.71,4.29 C9.93,4.29,10,9.07,10,9.29 C10,9.71,9.71,10,9.29,10 Z ",IndentedArrow:"M10,0 C10,0,6.25,4.58,10,10 L0,5 L10,0 Z ",OutdentedArrow:"M8,0 C8,0,12.5,5,8,10 L0,5 L8,0 Z ",DoubleArrow:"M10,19 L22,19 L16,13Z M10,12 L22,12 L16,6Z",Arrow:"M10,15 L22,15 L16,5Z",Diamond:"M10,5 L5,10 L0,5 L5,0 L10,5 Z ",Circle:"M10,5 C10,7.76,7.76,10,5,10 C2.24,10,0,7.76,0,5 C0,2.24,2.24,0,5,0 C7.76,0,10,2.24,10,5 Z ",Ellipse:"M15,5 C15,7.76,11.64,10,7.5,10 C3.36,10,0,7.76,0,5 C0,2.24,3.36,0,7.5,0 C11.64,0,15,2.24,15,5 Z "};function ke(t){return Be[t.toString()]}var Be={Process:"M419.511,76.687L359.511,76.687L359.511,43.086L419.511,43.086z",Decision:"M 253.005,115.687L 200.567,146.071L 148.097,115.687L 200.534,85.304L 253.005,115.687 Z",Document:"M 60 31.9 c 0 0 -11 -7.7 -30 0 s -30 0 -30 0 V 0 h 60 V 31.9 Z",PreDefinedProcess:"M 0,0 L 50,0 L 50,50 L 0,50 Z M 8.334,0 L 8.334,50 M 41.667,0 L 41.667,50",Terminator:"M 269.711,29.33C 269.71,44.061 257.77,56 243.04,56L 158.058,56C 143.33,56 131.39,44.061 131.39,29.33L 131.39,29.33C 131.391,14.6057 143.33,2.669 158.058,2.669L 243.044,2.669C 257.772,2.669 269.711,14.6057 269.711,29.333 Z",PaperTap:"M0.0009,17.2042 L0.0009,47.165 C0.001,47.165 14.403,53.5455 25.00,47.165 C35.599,40.7852 44.403,43.5087 50.00,47.165L50.001,17.2042 M50.001,32.7987 L50.001,2.8405 C50.001,2.8405 35.599,-3.5427 25.001,2.8405C14.403,9.2237 5.599,6.494 0.0009,2.8405 L0.0009,32.7987",DirectData:"M 132.62 0 L 17.38 0 C 7.78 0 0 13.43 0 30 C 0 46.57 7.78 60 17.38 60 L 132.62 60 M 132.62 0C 123.02 0 115.24 13.43 115.24 30 C 115.24 46.57 123.02 60 132.62 60 C 142.22 60 150 46.57 150 30 C 150 13.43 142.22 0 132.62 0 z ",SequentialData:"M0.0029,24.999 C0.0029,11.1922 10.433,0.0021 23.295,0.0021 C36.159,0.00216 46.585,11.1922 46.585,24.999C46.585,38.8057 36.159,49.9979 23.295,49.9979 C10.433,49.9979 0.0029,38.8057 0.0029,24.999 z M23.294,49.999 L50.002,49.999",Sort:"M50.001,24.9971 L25.001,49.9971 L0.00097,24.9971 L25.001,-0.00286865 L50.001,24.9971 z M0.000976562,24.9971 L50.001,24.9971",MultiDocument:"M43.6826,40 C44.8746,40.6183 45.8586,41.3502 46.8366,42.1122 L46.8366,4.74487 L3.09857,4.74487 L3.09857,10.9544 M46.837,35.143 C48.027,35.765 49.025,36.604 50.003,37.369 L50.003,0.002 L6.264,0.002 L6.264,4.744 M43.682,47.113 L43.682,10.765 L0.0025,10.7652 L0.0025,47.1132 C0.0025,47.1132 12.5846,53.6101 21.8426,47.1132 C31.1006,40.6163 38.792,43.393 43.6826,47.1132 z",Collate:"M50.001,0.0028 L25.001,25.0029 L0.00097,0.0028 L50.001,0.002 z M0.0009,50.002 L25.001,25.002L50.001,50.002 L0.0009,50.0029 z",SummingJunction:"M7.3252,42.6768 L42.6772,7.3247 M42.6768,42.6768 L7.3248,7.3247 M0.0009,25.001 C0.0009,11.193 11.197,0.0009 25.001,0.0009 C38.809,0.0009 50.001,11.193 50.001,25.001 C50.001,38.809 38.809,50.001 25.001,50.001 C11.197,50.00 0.0009,38.809 0.0009,25.00 z",Or:"M 0 50 L 100 50 M 50 100 L 50 0.0 M 0 50 C 0 22.384 22.392 0 50 0 C 77.616 0 100 22.384 100 50 C 100 77.616 77.616 100 50 100 C 22.392 100 0 77.616 0 50 Z",InternalStorage:"M 0 3.81946A 2.5,3.81946 0 0,1 2.5,0L 47.5 0A 2.5,3.81946 0 0,1 50,3.81946L 50 45.836A 2.5,3.819446 0 0,1 47.5,49.652778L 2.5 49.652778A 2.5,3.819446 0 0,1 0,45.8336L 0 3.819446ZM 0 11.45834L 50 11.4583334M 12.5 0L 12.5 49.652778",Extract:"M0,35 L30,0 L60,35 Z",ManualOperation:"M46.4,28.8 L14.8,28.8 L0,0 L60,0 Z",Merge:"M60,0 L30,35 L0,0 Z",OffPageReference:"M60,33.3 L30.1,39 L0,33.3 L0,0 L60,0 Z",SequentialAccessStorage:"M 60 30 C 60 13.4 46.6 0 30 0 S 0 13.4 0 30 s 13.4 30 30 30 h 28.6 v -6.5 h -9.9C 55.5 48 60 39.5 60 30 Z",Annotation:"M49.9984,50.0029 L-0.00271199,50.0029 L-0.00271199,0.00286865 L49.9984,0.00286865",Annotation2:"M49.9977,50.0029 L25.416,50.0029 L25.416,0.00286865 L49.9977,0.00286865 M25.4166,25.0029 L-0.00227869,25.0029",Data:"M 10 0 L 40 0 L 30 40 L 0 40 Z",Card:"M275,60 L400,60 L400,110 L260,110 L260,75 Z",Delay:"M0,0 L12.029,0 C14.212999,0 16,1.7869979 16,3.9709952 C16,6.1549926 14.212999,7.9409904 12.029,7.9409904 L0,7.9409904 z",Preparation:"M 1048.17 572 C 1051.06 568.86 1055.17 567.05 1059.5 567 L 1094.51 567 C 1098.84 567.05 1102.95 568.86 1105.84 572 L 1126.43 595 C 1127.01 596.28 1127.01 597.72 1126.43 599 L 1105.84 622 C 1102.95 625.14 1098.84 626.95 1094.51 627 L 1059.5 627 C 1055.17 626.95 1051.06 625.14 1048.17 622 L 1027.58 599 C 1027 597.72 1027 596.28 1027.58 595 L 1048.17 572 Z",Display:"M47.8809,19.2914 L32.7968,-0.00594145 L11.3902,-0.00594145 C7.93166,-0.00594145 0.00124586,11.187 0.00124586,24.9968C0.00124586,38.8032 7.93166,49.9962 11.3902,49.9962 L32.7968,49.99 L47.615,31.038 C47.615,31.0388 52.798,24.9968 47.880,19.2914 z",ManualInput:"M 912 732 L 1006.85 707 C 1008.2 707 1009.5 707.53 1010.46 708.46 C 1011.41 709.4 1011.95 710.67 1011.95 712 L 1011.95 762C 1012 764.41 1010.28 766.52 1007.87 767 L 917.1 767 C 915.75 767 914.45 766.47 913.49 765.54 C 912.54 764.6 912 763.33 912 762 L 912 732 Z",LoopLimit:"M 8 9 L 27 9 L 33 15 L 33 26 C 33 27 33 27 32 27 L 4 27 C 3 27 2 27 2 26 L 2 15 L 8 9 Z",StoredData:"M 5.55 0L 50 0A 1.5,30 0 0,1 50,0A 5.555,25 0 0,0 50,50A 1.5,30 0 0,1 50,50L 5.555 50A 5.55,25 0 0,1 5.555,0Z"};function Re(t,e,i){var r;r="Straight"!==t.type&&t.sourceWrapper?t.sourceWrapper.corners.center:function(t){var e;if(t.sourcePortWrapper){var i=t.sourcePortWrapper;e={x:i.offsetX,y:i.offsetY}}else if(t.sourceID&&t.sourceWrapper)if(t.targetWrapper){var r=t.sourceWrapper.corners.center,n=t.targetWrapper.corners.center;e=di(t,t.sourceWrapper,r,n,!1)}else e=t.sourcePoint;else e=t.sourcePoint;return e}(t);var n=function(t,e,i,r,n){var a,s,h,d,l,c,p=t.sourceWrapper,g=t.targetWrapper,u=t.sourcePortWrapper,f=t.targetPortWrapper,m=[],y=oi(t),v={corners:a,point:e,direction:h,margin:{left:5,right:5,bottom:5,top:5}},b={corners:s,point:i,direction:d,margin:{left:5,right:5,bottom:5,top:5}};void 0!==p&&void 0!==g&&(l=B(p),c=B(g),v.corners=p.corners,b.corners=g.corners);u&&u.isPathPort&&f&&(i={x:f.offsetX,y:f.offsetY});if(void 0!==u){var S={x:u.offsetX,y:u.offsetY};"Left"===u.connectionDirection||"Top"===u.connectionDirection||"Bottom"===u.connectionDirection||"Right"===u.connectionDirection?v.direction=u.connectionDirection:u.isPathPort?v.direction=Ne(t.parentObj,t.sourceID,u,i):v.direction=Pi(S,l,p.bounds,!1)}if(void 0!==f){var w={x:f.offsetX,y:f.offsetY};"Left"===f.connectionDirection||"Right"===f.connectionDirection||"Bottom"===f.connectionDirection||"Top"===f.connectionDirection?b.direction=f.connectionDirection:f.isPathPort?b.direction=Ne(t.parentObj,t.targetID,f,e):b.direction=Pi(w,c,g.bounds,!1)}if("Bezier"===t.type&&!t.isBezierEditing&&t.segments.length>0)for(var x=t.segments.length-1;x>=0;){t.segments[parseInt(x.toString(),10)].isInternalSegment&&t.segments.pop(),x--}if(void 0!==p&&void 0!==g)return void 0!==v.direction&&void 0!==b.direction||(r?function(t,e,i){"LeftToRight"===i?(t.direction=t.direction?t.direction:"Right",e.direction=e.direction?e.direction:"Left"):"RightToLeft"===i?(t.direction=t.direction?t.direction:"Left",e.direction=e.direction?e.direction:"Right"):"TopToBottom"===i?(t.direction=t.direction?t.direction:"Bottom",e.direction=e.direction?e.direction:"Top"):"BottomToTop"===i&&(t.direction=t.direction?t.direction:"Top",e.direction=e.direction?e.direction:"Bottom")}(v,b,r):v.corners.top>b.corners.bottom&&Math.abs(v.corners.top-b.corners.bottom)>y?(v.direction=v.direction?v.direction:"Top",b.direction=b.direction?b.direction:"Bottom"):v.corners.bottom<b.corners.top&&Math.abs(v.corners.bottom-b.corners.top)>y?(v.direction=v.direction?v.direction:"Bottom",b.direction=b.direction?b.direction:"Top"):v.corners.right<b.corners.left&&Math.abs(v.corners.right-b.corners.left)>y||v.corners.right+y<b.corners.left||b.corners.right>=v.corners.left-y&&v.corners.left>b.corners.left?(v.direction=v.direction?v.direction:"Right",b.direction=b.direction?b.direction:"Left"):v.corners.left>b.corners.right&&Math.abs(v.corners.left-b.corners.right)>v.margin.left+v.margin.right||b.corners.right+y<v.corners.left||v.corners.right>=b.corners.left-y&&v.corners.left<b.corners.left?(v.direction=v.direction?v.direction:"Left",b.direction=b.direction?b.direction:"Right"):p.id!==g.id&&!l.equals(l,c)&&c.containsPoint(l.topCenter,v.margin.top)?(v.direction=v.direction?v.direction:"Bottom",b.direction=b.direction?b.direction:"Top"):(v.direction=v.direction?v.direction:"Top",b.direction=b.direction?b.direction:"Bottom")),function(t,e,i,r,n,a,s){var h,d=t.sourceWrapper,l=t.targetWrapper,c=t.sourcePortWrapper,p=t.targetPortWrapper,g=[],u=d.corners,f=l.corners,m=(f.center,{left:5,right:5,bottom:5,top:5}),y={left:5,right:5,bottom:5,top:5},v={corners:u,point:r,direction:e,margin:m},b={corners:f,point:n,direction:i,margin:y},S=qe(d,u,t.sourceWrapper.bounds),w=qe(l,f,t.targetWrapper.bounds),x=!1;t.sourceWrapper&&t.targetWrapper&&(x=function(t,e,i){for(var r=Ge(t,i.sourcePadding),n=Ge(e,i.targetPadding),o=0;o<r.length-1;o++)for(var a=r[parseInt(o.toString(),10)],s=0;s<n.length-1;s++){if(pa(a,n[parseInt(s.toString(),10)]).enabled)return!0}return!1}(t.sourceWrapper,t.targetWrapper,t));if(void 0!==c){switch(v.point={x:c.offsetX,y:c.offsetY},v.direction){case"Bottom":case"Top":v.point.y=v.point.y;break;case"Left":case"Right":v.point.x=v.point.x}t.sourcePadding&&!x&&(p&&(b.point={x:p.offsetX,y:p.offsetY}),v.point=Ue(t,v,b,!1))}else"Orthogonal"===t.type||"Bezier"===t.type?(t.segments&&t.segments.length>0&&t.segments[0].direction&&(v.direction=t.segments[0].direction),v.point=si(S,v.direction),h=si(S,Ti(v.direction)),v.point=di(t,d,v.point,h,!1)):v.point=d.corners.center;if(void 0!==p){switch(b.point={x:p.offsetX,y:p.offsetY},b.direction){case"Bottom":case"Top":b.point.y=b.point.y;break;case"Left":case"Right":b.point.x=b.point.x}t.targetPadding&&!x&&(b.point=Ue(t,v,b,!0))}else"Orthogonal"===t.type||"Bezier"===t.type?(b.point=si(w,b.direction),h=si(w,Ti(b.direction)),b.point=di(t,l,b.point,h,!0)):b.point=l.corners.center;if("Orthogonal"!==t.type){var I=void 0,P=void 0;if("Bezier"===t.type){if(t.bezierSettings.allowSegmentsReset||0===t.segments.length||!o.isEmptyPoint(t.segments[t.segments.length-1].point))return g=ni(t,v,b,void 0,a),g=Qe(t,v,b);Je(t)}else Je(t);if(void 0===t.sourcePortWrapper){v.point=v.corners.center,t.segments&&t.segments.length>0&&(P=t.segments[0],I=o.isEmptyPoint(P.point)?void 0:P);var C=void 0!==I?I.point:b.point;if("Bezier"===t.type&&t.segments.length>0&&t.segments[0].vector1.angle&&t.segments[0].vector1.distance){var T=Math.max(v.corners.width,v.corners.height);C=o.transform(v.point,t.segments[0].vector1.angle,T/2)}v.point=x?t.sourceWrapper.bounds.center:di(t,d,v.point,C,!1)}if(void 0===t.targetPortWrapper){b.point=b.corners.center,t.segments&&t.segments.length>1&&(P=t.segments[t.segments.length-2],I=o.isEmptyPoint(P.point)?void 0:P);var A=I?I.point:v.point;if("Bezier"===t.type&&t.segments.length>0&&t.segments[t.segments.length-1].vector2.angle&&t.segments[t.segments.length-1].vector2.distance){T=Math.max(v.corners.width,v.corners.height);A=o.transform(b.point,t.segments[0].vector2.angle,T/2)}b.point=x?t.targetWrapper.bounds.center:di(t,l,A,b.point,!0)}g=Qe(t,v,b)}else if("Orthogonal"===t.type&&t.segments&&t.segments.length>0&&null!==t.segments[0].direction)g=function(t,e,i,r,n,o,a,s){var h,d,l,c,p=[];Je(t);for(var g=0;g<t.segments.length;g++){if(d=t.segments[parseInt(g.toString(),10)],r&&e.direction===Ti(d.direction)&&(d.direction=e.direction),g>0&&t.segments[g-1].direction===d.direction)g=$e(t,g,e);else if(d.direction)e.point=He(e,t.segments[parseInt(g.toString(),10)]);else(f=t.segments[g-1])&&f.points&&f.points.length>0&&(e.point=f.points[f.points.length-1]);if(g===t.segments.length-1)if(ei(t,e),Ve(h=void 0===n?ti(t,e,i):Fe(t,e,i),t,e),d.points=[],h.length>=2)for(l=0;l<h.length;l++)if(t.selectedSegmentIndex)if(l===h.length-1&&h.length>2&&t.segments.length>2){var u={x:h[parseInt(l.toString(),10)].x,y:e.point.y};d.points=[],d.points.push(u),d.points.push(h[parseInt(l.toString(),10)]);var f=t.segments[g-1];t.segments.length<4&&f.points.pop(),f.points=f.points.concat(d.points)}else d.points.push(h[parseInt(l.toString(),10)]);else d.points.push(h[parseInt(l.toString(),10)]);else c=g;if(void 0===c||t.selectedSegmentIndex||(c===t.segments.length-1&&(t.segments[c-1].direction=null,t.segments[c-1].length=null),t.segments.splice(c,1)),r&&0===g){var m=Xe(t,r,o,s);m&&(e.point=m)}}return ii(t,p)}(t,v,b,c,p,d,0,s);else{if(!t.segments[0]){I=new uo(t,"segments",{type:"Orthogonal"},!0);t.segments.push(I)}t.segments[0].points=g=ni(t,v,b,void 0,a)}return g}(t,v.direction,b.direction,v.point,b.point,n,i);Je(t),(t.sourceWrapper||t.targetWrapper)&&function(t,e,i){var r=t.sourcePortWrapper,n=t.targetPortWrapper,o=t.sourceWrapper,a=e.point,s={left:0,right:0,top:0,bottom:0},h={x:0,y:0},d="Top";o?(a=i.point,s=e.margin):(o=t.targetWrapper,s=i.margin);if("Orthogonal"===t.type)if(t.segments&&t.segments.length>0&&t.sourceWrapper&&t.segments[0].direction)e.direction=t.segments[0].direction,h=di(t,o,h=si(o.corners,e.direction),si(o.corners,Ti(e.direction)),!1);else{var l={corners:null,direction:null,point:null,margin:null};ri(o,{corners:null,direction:null,point:a,margin:s},l,t),h=l.point,d=l.direction}else{var c=void 0;t.segments&&t.segments.length>1&&(c=o===t.sourceWrapper?t.segments[0].point:t.segments[t.segments.length-2].point),h=di(t,o,o.bounds.center,t.segments&&t.segments.length>1?c:a,o===t.targetWrapper)}o===t.sourceWrapper?(e.direction=e.direction||d,e.point=h,t.sourcePortWrapper&&(e.point={x:r.offsetX,y:r.offsetY},t.sourcePadding&&(e.point=Ue(t,e,i,!1)))):(i.direction=i.direction||d,i.point=h,t.targetPortWrapper&&(i.point={x:n.offsetX,y:n.offsetY},t.targetPadding&&(i.point=Ue(t,e,i,!0))))}(t,v,b);if("Straight"===t.type||"Bezier"===t.type)m=Qe(t,v,b);else if("Orthogonal"===t.type&&t.segments&&t.segments.length>0&&null!==t.segments[0].length&&null!==t.segments[0].direction)m=function(t,e,i,r,n,o,a,s){var h,d,l,c,p=[];if(Je(t),t.segments.length>0){for(var g=0;g<t.segments.length;g++){var u=t.segments[parseInt(g.toString(),10)];if(0===g&&void 0!==t.sourcePortWrapper&&(l=Pi({x:o.offsetX,y:o.offsetY},B(r),r.bounds,!1),u.direction===Ti(l)&&(u.direction=l)),g>0&&t.segments[g-1].direction===u.direction)g=$e(t,g,e);else{var f=t.segments[g-1];e.point=u.direction?He(e,u):f.points[f.points.length-1]}if(g===t.segments.length-1&&(a||n?t.targetWrapper&&void 0===t.targetPortWrapper?(ei(t,e),d=_e(t,e,i)):d=Fe(t,e,i):d=We(t,e,i),d))if(Ve(d,t,e),u.points=[],d.length>=2)for(h=0;h<d.length;h++)u.points.push(d[parseInt(h.toString(),10)]);else c=g;if(o&&0===g){var m=Xe(t,o,r,s);m&&(e.point=m)}}void 0!==c&&(c===t.segments.length-1&&(t.segments[c-1].direction=null,t.segments[c-1].length=null),t.segments.splice(c,1)),p=ii(t,p)}return p}(t,v,b,p,g,u,f,i);else{var I=void 0;v.direction?I=ui(p.bounds,v,20):v.direction=b.direction?void 0!==t.targetPortWrapper?b.direction:Ti(b.direction):o.direction(v.point,b.point),t.segments[0].points=m=mi(t,v,b,I)}return m}(t,r,t.targetPoint,e,i);return li(t,n[0],!1),li(t,n[n.length-1],!0),n}function Ne(t,e,i,r){var n=null,o=t.nameTable[""+e];if(i&&o){var a={x:i.offsetX,y:i.offsetY},s=function(t,e){for(var i=e.intermediatePoints,r=0;r<i.length-1;r++){var n=i[parseInt(r.toString(),10)],o=i[r+1];if(je(t,n,o))return n.x===o.x?"Vertical":"Horizontal"}if(i.length>=2){var a=i[i.length-2],s=i[i.length-1];return a.x===s.x?"Vertical":"Horizontal"}return null}(a,o);s&&(n="Horizontal"===s?r.y>a.y?"Bottom":"Top":r.x>a.x?"Right":"Left")}return n}function je(t,e,i){return e.x===i.x&&t.x===e.x?t.y>=Math.min(e.y,i.y)&&t.y<=Math.max(e.y,i.y):e.y===i.y&&t.y===e.y&&(t.x>=Math.min(e.x,i.x)&&t.x<=Math.max(e.x,i.x))}function He(t,e){t.direction=e.direction,e.points=[],e.points.push(t.point);var i="Left"===e.direction||"Top"===e.direction?-e.length:e.length,r="Left"===e.direction||"Right"===e.direction?0:90,n=hi(t.point,i,r);return e.points.push(n),n}function We(t,e,i){var r,n,o,a;(e.corners=t.sourceWrapper?t.sourceWrapper.corners:void 0,t.sourcePortWrapper)&&(o=Pi({x:t.sourcePortWrapper.offsetX,y:t.sourcePortWrapper.offsetY},B(t.sourceWrapper),t.sourceWrapper.bounds,!1),!e.corners||"Bottom"!==e.direction&&"Top"!==e.direction?!e.corners||"Left"!==e.direction&&"Right"!==e.direction||i.point.y>e.corners.top&&i.point.y<e.corners.bottom&&(n=e.point.x>i.point.x?"Left":"Right"):i.point.x>e.corners.left&&i.point.x<e.corners.right&&(n=e.point.y>i.point.y?"Top":"Bottom"));t.sourcePortWrapper&&o===Ti(n)?(("Left"===o||"Right"===o)&&e.point.y>=e.corners.top&&e.point.y<=e.corners.center.y&&i.point.y>=e.corners.top&&i.point.y<=e.corners.center.y?(e.direction="Top",a=e.point.y-e.corners.top+20):("Left"===o||"Right"===o)&&e.point.y>e.corners.center.y&&e.point.y<=e.corners.bottom&&i.point.y>e.corners.center.y&&i.point.y<=e.corners.bottom?(e.direction="Bottom",a=e.corners.bottom-e.point.y+20):("Top"===o||"Bottom"===o)&&e.point.x>=e.corners.left&&e.point.x<=e.corners.center.x&&i.point.x>=e.corners.left&&i.point.x<=e.corners.center.x?(e.direction="Left",a=e.point.x-e.corners.left+20):("Top"===o||"Bottom"===o)&&e.point.x<=e.corners.right&&e.point.x>e.corners.center.x&&i.point.x<=e.corners.right&&i.point.x<e.corners.center.x&&(e.direction="Right",a=e.corners.right-e.point.x+20),e.direction&&a&&(r=mi(t,e,i,a,!0))):(e.direction=n||Ke(e.direction,e.point,i.point),r=fi(e,i));return r}function _e(t,e,i){var r;i.corners=t.targetWrapper.corners,ri(t.targetWrapper,e,i,t);var n=Ke(i.direction,e.point,i.point);e.direction!==i.direction||"Left"!==e.direction&&"Right"!==e.direction?(e.direction=n,r=fi(e,i)):(e.direction=n,r=mi(t,e,i,t.targetWrapper.width/2+20),e.point=r[1],ri(t.targetWrapper,e,i,t),r=mi(t,e,i));return r}function Ye(t,e,i){var r,n;i.corners=t.targetWrapper.corners,"Left"!==e.direction&&"Right"!==e.direction?i.corners.center.y!==e.point.y||i.corners.left<=e.point.x&&e.point.x<=i.corners.right?i.corners.center.y===e.point.y&&"Bottom"===t.segments[t.segments.length-2].direction||i.corners.center.y>e.point.y&&e.point.y>=i.corners.top?(r="Top",n=e.point.y-i.corners.top+20):i.corners.center.y===e.point.y&&"Top"===t.segments[t.segments.length-2].direction||i.corners.center.y<e.point.y&&e.point.y<=i.corners.bottom?(r="Bottom",n=i.corners.bottom-e.point.y+20):void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&e.corners.top<=e.point.y&&e.point.y<=e.corners.bottom&&(r=e.direction,n=e.point.y>i.point.y?e.point.y-e.corners.top+20:e.corners.bottom-e.point.y+20):(r="Top",n=i.corners.height/2+20):i.corners.center.x!==e.point.x||i.corners.top<e.point.y&&e.point.y<=i.corners.bottom?i.corners.center.x===e.point.x&&"Right"===t.segments[t.segments.length-2].direction||i.corners.center.x>e.point.x&&e.point.x>=i.corners.left?(r="Left",n=e.point.x-i.corners.left+20):i.corners.center.x===e.point.x&&"Left"===t.segments[t.segments.length-2].direction||i.corners.center.x<=e.point.x&&e.point.x<=i.corners.right?(r="Right",n=i.corners.right-e.point.x+20):void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&e.corners.left<=e.point.x&&e.point.x<=e.corners.right&&(r=e.direction,n=e.point.x>i.point.x?e.point.x-e.corners.left+20:e.corners.right-e.point.x+20):(r="Left",n=i.corners.width/2+20);var a="Left"===r||"Top"===r?-n:n,s="Left"===r||"Right"===r?0:90,h=e.point;e.point=hi(e.point,a,s),e.direction=o.direction(e.point,i.point),void 0===t.sourcePortWrapper||void 0===t.targetPortWrapper||e.corners.center.x!==i.corners.center.x&&e.corners.center.y!==i.corners.center.y||(e.direction=i.direction);var d=mi(t,e,i);return d.splice(0,0,h),d}function Fe(t,e,i){var r,n;(i.corners=t.targetWrapper.corners,void 0!==t.sourcePortWrapper)&&(n=Pi({x:t.sourcePortWrapper.offsetX,y:t.sourcePortWrapper.offsetY},B(t.sourceWrapper),t.sourceWrapper.bounds,!1));var o=function(t,e,i,r){var n=!1;switch(i.direction){case"Left":void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&"Right"===r&&e.point.x>i.point.x&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom||("Bottom"===r&&e.point.y>i.point.y||"Top"===r&&e.point.y<i.point.y)&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right?(e.direction="Right"===r?e.point.y>i.point.y?"Top":"Bottom":e.point.x<i.point.x?"Right":"Left",n=!0):e.point.x>i.point.x&&(e.point.y>i.point.y||e.point.y<i.point.y)&&!(i.corners.top>e.point.y&&i.corners.bottom<e.point.y)?e.direction="Left":e.point.x<i.point.x&&e.point.y>i.point.y||e.point.x>i.point.x&&e.point.y<=i.point.y&&i.corners.top<e.point.y&&i.corners.center.y>=e.point.y?e.direction="Top":e.point.x<i.point.x&&e.point.y<i.point.y||e.point.x>i.point.x&&e.point.y>i.point.y&&i.corners.bottom<e.point.y&&i.corners.center.y>e.point.y?e.direction="Bottom":e.point.y===i.point.y&&e.point.x<i.point.x&&(e.direction="Right");break;case"Right":void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&("Bottom"===r&&e.point.y>i.point.y||"Top"===r&&e.point.y<i.point.y)&&e.point.x>i.point.x&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right?(e.direction=e.point.x>i.point.x?"Left":"Right",n=!0):void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&"Left"===r&&e.point.x<i.point.x&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom?(e.direction=e.point.y>i.point.y?"Top":"Bottom",n=!0):e.point.x<i.point.x&&i.corners.top<=e.point.y&&i.corners.bottom>=e.point.y&&e.point.y===i.point.y||e.point.y>i.point.y&&e.point.x>i.point.x?e.direction="Top":e.point.y<i.point.y&&e.point.x>i.point.x?e.direction="Bottom":e.point.x<i.point.x&&(e.point.y>i.point.y||e.point.y<i.point.y)?e.direction="Right":e.point.y===i.point.y&&e.point.x>i.point.x&&(e.direction="Left");break;case"Top":void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&"Bottom"===r&&e.point.y>i.point.y&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right||("Right"===r&&e.point.x>i.point.x||"Left"===r&&i.point.y>e.point.y&&i.point.x>e.point.x)&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom?(e.direction="Bottom"===r?e.point.x>i.point.x?"Left":"Right":e.point.y<i.point.y?"Bottom":"Top",n=!0):e.point.x===i.point.x&&e.point.y<i.point.y?e.direction="Bottom":e.point.y>i.point.y&&e.point.x>i.corners.left&&e.point.x<i.corners.right?e.direction="Left":e.point.y>=i.point.y?e.direction="Top":e.point.y<i.point.y&&e.point.x>i.point.x?e.direction="Left":e.point.y<i.point.y&&e.point.x<i.point.x&&(e.direction="Right");break;case"Bottom":void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&(("Right"===r||"Left"===r&&i.point.x>e.point.x)&&e.point.y>i.point.y&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom||"Top"===r&&e.point.y<i.point.y&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right)?(e.direction="Right"===r||"Left"===r?e.point.y>i.point.y?"Top":"Bottom":e.point.x>i.point.x?"Left":"Right",n=!0):e.point.y<i.point.y&&e.point.x>i.corners.left&&i.corners.right>e.point.x?e.point.y<i.point.y&&e.point.x>i.corners.left&&i.corners.center.x>=e.point.x?e.direction="Left":e.point.y<i.point.y&&e.point.x<i.corners.right&&i.corners.center.x<e.point.x&&(e.direction="Right"):e.point.y>i.point.y&&e.point.x>i.point.x?e.direction="Left":e.point.y>i.point.y&&e.point.x<i.point.x?e.direction="Right":e.point.y<=i.point.y&&(e.point.x>i.point.x||i.point.x>e.point.x)&&(e.direction="Bottom")}return n}(t,e,i,n);return!t.selectedSegmentIndex&&void 0!==t.sourcePortWrapper&&void 0!==t.targetPortWrapper&&i.direction===Ti(n)&&(("Left"===i.direction&&e.point.x>i.point.x||"Right"===i.direction&&e.point.x<i.point.x)&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom||"Bottom"===i.direction&&e.point.y<i.point.y&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right)?r=Ye(t,e,i):t.selectedSegmentIndex||e.direction!==i.direction?!t.selectedSegmentIndex&&("Left"===i.direction&&e.point.x>i.point.x||"Right"===i.direction&&e.point.x<i.point.x)&&("Top"===e.direction||"Bottom"===e.direction)&&e.point.y<=i.point.y&&i.corners.top<=e.point.y&&i.corners.bottom>=e.point.y||"Top"===i.direction&&e.point.y>i.point.y||"Bottom"===i.direction&&e.point.y<i.point.y&&i.corners.left<=e.point.x&&i.corners.right>=e.point.x?r=t.selectedSegmentIndex?fi(e,i):Ye(t,e,i):!t.selectedSegmentIndex&&void 0!==t.sourceWrapper&&void 0!==t.targetWrapper&&void 0!==t.targetPortWrapper&&("Left"===e.direction||"Right"===e.direction)&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom&&("Top"===i.direction||"Bottom"===i.direction)&&i.corners.center.x===e.corners.center.x?(e.direction="Top"===i.direction?"Bottom":"Top",r=mi(t,e,i,"Top"===i.direction?e.corners.bottom-e.point.y+20:e.point.y-e.corners.top+20)):!t.selectedSegmentIndex&&void 0!==t.sourceWrapper&&void 0!==t.targetWrapper&&void 0!==t.targetPortWrapper&&("Top"===e.direction||"Bottom"===e.direction)&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right&&("Left"===i.direction||"Right"===i.direction)&&i.corners.center.y===e.corners.center.y?(e.direction="Left"===i.direction?"Right":"Left",r=mi(t,e,i,"Left"===i.direction?e.corners.right-e.point.x+20:e.point.x-e.corners.left+20)):r=o?mi(t,e,i,"Left"===e.direction||"Right"===e.direction?"Left"===e.direction?e.point.x-e.corners.left+20:e.corners.right-e.point.x+20:"Top"===e.direction?e.point.y-e.corners.top+20:e.corners.bottom-e.point.y+20):fi(e,i):r=mi(t,e,i),r}function Xe(t,e,i,r){var n,a,s={x:e.offsetX,y:e.offsetY},h=B(i);a=e.isPathPort&&r?Ne(t.parentObj,t.sourceID,e,r):Pi(s,h,i.bounds,!1);var d=t.segments[0];return d.direction!==a&&(!function(t,e,i,r,n,o){var a,s,h=13,d=[];d.push(r);var l=r.y===n.y&&("Left"===e&&n.x<r.x||"Right"===e&&n.x>r.x)||r.x===n.x&&("Top"===e&&n.y<r.y||"Bottom"===e&&n.y>r.y);l||("Top"===e||"Bottom"===e?"Top"===e&&n.y<r.y&&n.y>r.y-h||"Bottom"===e&&n.y>r.y&&n.y<r.y+h?(s="Top"===e?i.top-h:i.bottom+h,d.push({x:r.x,y:s}),d.push({x:r.x+(n.x-r.x)/2,y:s}),d.push({x:r.x+(n.x-r.x)/2,y:n.y})):Math.abs(r.x-n.x)>h&&("Top"===e&&n.y<r.y||"Bottom"===e&&n.y>r.y)?d.push({x:r.x,y:n.y}):(s="Top"===e?i.top-h:i.bottom+h,a=n.x<r.x?i.left-h:i.right+h,d.push({x:r.x,y:s}),d.push({x:n.x,y:s})):"Left"===e&&n.x<r.x&&n.x>r.x-h||"right"===e&&n.x>r.x&&n.x<r.x+h?(a="Left"===e?i.left-h:i.right+h,d.push({x:a,y:r.y}),d.push({x:a,y:r.y+(n.y-r.y)/2}),d.push({x:n.x,y:r.y+(n.y-r.y)/2})):Math.abs(r.y-n.y)>h&&("Left"===e&&n.x<r.x||"Right"===e&&n.x>r.x)?d.push({x:n.x,y:r.y}):(a="Left"===e?i.left-h:i.right+h,d.push({x:a,y:r.y}),d.push({x:a,y:n.y})),o&&(d.push(t.points[0]),d.reverse()),t.points=d)}(d,a,h,d.points[0],d.points[d.points.length-1],!1),n=d.points[d.points.length-1],d.direction=o.direction(d.points[d.points.length-2],d.points[d.points.length-1])),n}function Ve(t,e,i){var r,n=e.segments[e.segments.length-2],a=n.points[n.points.length-1];("Top"!==n.direction&&"Bottom"!==n.direction||a.x!==t[1].x)&&("Left"!==n.direction&&"Right"!==n.direction||a.y!==t[1].y)||(n.points[n.points.length-1]=t[1],r=o.direction(n.points[0],n.points[n.points.length-1]),void 0!==e.sourceWrapper&&void 0===e.sourcePortWrapper&&r===Ti(n.direction)&&("Left"===n.direction||"Right"===n.direction?n.points[0].x="Right"===n.direction?n.points[0].x-e.sourceWrapper.corners.width:n.points[0].x+e.sourceWrapper.corners.width:n.points[0].y="Bottom"===n.direction?n.points[0].y-e.sourceWrapper.corners.height:n.points[0].y+e.sourceWrapper.corners.height),n.direction=r,n.length=o.distancePoints(n.points[0],n.points[n.points.length-1]),t.splice(0,1))}function Ue(t,e,i,r){var n=t.sourcePortWrapper,o=t.targetPortWrapper,a=r?t.targetPadding:t.sourcePadding,s=r?o:n,h=new w(s.bounds.x-a,s.bounds.y-a,s.actualSize.width+2*a,s.actualSize.height+2*a),d=[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft];d[d.length]=d[0];var l={x1:e.point.x,y1:e.point.y,x2:i.point.x,y2:i.point.y},c=r?i.point:e.point;return ci(l,d,!0,c)||c}function Ge(t,e){var i=[],r=fa(t,t.corners,e);r.push(r[0]);for(var n=0;n<r.length-1;n++)i.push(Ze(r[parseInt(n.toString(),10)],r[n+1]));return i}function Ze(t,e){return{x1:t.x,y1:t.y,x2:e.x,y2:e.y}}function qe(t,e,i){var r,n=t.rotateAngle+t.parentTransform;if(n){if(n<45)return e;if(n<=135)r={width:e.width,height:e.height,topLeft:e.bottomLeft,topCenter:e.middleLeft,topRight:e.topLeft,middleLeft:e.bottomCenter,center:i.center,middleRight:e.topCenter,bottomLeft:e.bottomRight,bottomCenter:e.middleRight,bottomRight:e.topRight,left:i.left,right:i.right,top:i.top,bottom:i.bottom};else if(n<=225)r={width:e.width,height:e.height,topLeft:e.bottomLeft,topCenter:e.bottomCenter,topRight:e.bottomRight,middleLeft:e.middleRight,center:i.center,middleRight:e.middleLeft,bottomLeft:e.topLeft,bottomCenter:e.topCenter,bottomRight:e.topRight,left:i.left,right:i.right,top:i.top,bottom:i.bottom};else{if(!(n<=315))return e;r={width:e.width,height:e.height,topLeft:e.topRight,topCenter:e.middleRight,topRight:e.bottomRight,middleLeft:e.topCenter,center:i.center,middleRight:e.bottomCenter,bottomLeft:e.topLeft,bottomCenter:e.middleLeft,bottomRight:e.bottomLeft,left:i.left,right:i.right,top:i.top,bottom:i.bottom}}return r}return e}function Qe(t,e,i){var r=[];if(t.segments&&t.segments.length>0){var n=void 0,a=[],s=e.point;for(n=0;n<t.segments.length;n++){var h=t.segments[parseInt(n.toString(),10)];if((a=[]).push(s),n!==t.segments.length-1?(a.push(h.point),s=h.point):a.push(i.point),t.segments[parseInt(n.toString(),10)].points=a,t.segments.length>1&&o.equals(h.points[0],h.points[1])&&t.segments.splice(n,1),h)for(var d=0;d<h.points.length;d++)(d>0||0===n)&&r.push(h.points[parseInt(d.toString(),10)])}}return r}function Ke(t,e,i){return"Top"===t||"Bottom"===t?i.x>e.x?"Right":"Left":i.y>e.y?"Bottom":"Top"}function Je(t){if("Straight"===t.type||"Bezier"===t.type){if(0===t.segments.length||t.segments.length>0&&!o.isEmptyPoint(t.segments[t.segments.length-1].point))if("Bezier"===t.type){var e=new go(t,"segments",{type:"Bezier",isInternalSegment:!0},!0);t.segments.push(e)}else{e=new po(t,"segments",{type:"Straight"},!0);t.segments.push(e)}}else{if(t.segments.length>0)for(var i=!1,r=0;r<t.segments.length;){var n=t.segments[parseInt(r.toString(),10)];i||n&&!(n instanceof uo||n instanceof po||n instanceof go)?(t.segments.splice(r,1),i=!0):r++}if(0===t.segments.length||t.segments[t.segments.length-1].direction){e=new uo(t,"segments",{type:"Orthogonal"},!0);t.segments.push(e)}}}function $e(t,e,i){var r=t.segments[parseInt(e.toString(),10)],n="Left"===r.direction||"Top"===r.direction?-r.length:r.length,o="Left"===r.direction||"Right"===r.direction?0:90,a=hi(i.point,n,o);return t.segments[e-1].length+=r.length,t.segments[e-1].points[1]=i.point=a,t.segments.splice(e,1),--e}function ti(t,e,i){var r,n;t.sourcePortWrapper&&(n=Pi({x:t.sourcePortWrapper.offsetX,y:t.sourcePortWrapper.offsetY},B(t.sourceWrapper),t.sourceWrapper.bounds,!1));ri(t.targetWrapper,e,i,t);var o=Ke(i.direction,e.point,i.point);if(void 0===t.sourcePortWrapper||e.direction!==i.direction||("Top"!==e.direction&&"Bottom"!==e.direction||e.corners.center.x!==i.corners.center.x)&&("Left"!==e.direction&&"Right"!==e.direction||e.corners.center.y!==i.corners.center.y))if(i.point.x>=e.corners.left&&i.point.x<=e.corners.right&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom){e.direction=i.point.y>e.point.y?"Bottom":"Top",r=mi(t,e,i,"Top"===e.direction?e.point.y-e.corners.top+20:e.corners.bottom-e.point.y+20)}else if(t.sourcePortWrapper&&n===Ti(o)){var a;("Left"===n||"Right"===n)&&e.point.y>=e.corners.top&&e.point.y<=e.corners.bottom?(e.direction=i.point.y>e.point.y?"Bottom":"Top",a=e.corners.height/2+20):("Top"===n||"Bottom"===n)&&e.point.x>=e.corners.left&&e.point.x<=e.corners.right&&(e.direction=i.point.x>e.point.x?"Right":"Left",a=e.corners.width/2+20),e.direction&&a?r=mi(t,e,i,a,!0):(e.direction=o,r=fi(e,i))}else if(!t.sourcePortWrapper||n!==i.direction||"Top"!==n&&"Bottom"!==n||e.corners.center.x!==i.corners.center.x)if(e.direction===i.direction)if(("Left"===e.direction||"Right"===e.direction)&&i.point.y>e.corners.top-20&&i.point.y<e.corners.bottom+20||("Top"===e.direction||"Bottom"===e.direction)&&i.point.x>e.corners.left-20&&i.point.x<e.corners.right+20){var s=e.direction;e.direction=o,r=yi(e,i,s,r,20,!1)}else e.direction=o,r=fi(e,i);else e.direction=o,r=fi(e,i);else{e.direction=i.point.y>e.point.y?"Bottom":"Top",r=mi(t,e,i,"Bottom"===e.direction?e.corners.bottom-e.point.y+20:e.point.y-e.corners.top+20)}else e.direction=o,r=mi(t,e,i,"Top"===o||"Bottom"===o?t.sourceWrapper.height/2+20:t.sourceWrapper.width/2+20),e.point=r[1],"Left"===o||"Right"===o?(i.direction=o,i.point="Left"===o?i.corners.middleLeft:i.corners.middleRight):ri(t.targetWrapper,e,i,t),r=mi(t,e,i);return r}function ei(t,e){if(void 0!==t.targetWrapper&&void 0===t.targetPortWrapper){if(B(t.targetWrapper).containsPoint(e.point,1)){var i=t.targetWrapper,r=t.segments[t.segments.length-2],n=r.points[r.points.length-1],a=Ti(r.direction);"Bottom"===a?n.y<i.corners.bottom+1&&(r.points[r.points.length-1].y=i.corners.bottom+20,r.length=o.distancePoints(r.points[0],r.points[r.points.length-1])):"Top"===a?n.y>i.corners.top-1&&(r.points[r.points.length-1].y=i.corners.top-20,r.length=o.distancePoints(r.points[0],r.points[r.points.length-1])):"Left"===a?n.x>i.corners.left-1&&(r.points[r.points.length-1].x=i.corners.left-20,r.length=o.distancePoints(r.points[0],r.points[r.points.length-1])):"Right"===a&&n.x<i.corners.right+1&&(r.points[r.points.length-1].x=i.corners.right+20,r.length=o.distancePoints(r.points[0],r.points[r.points.length-1])),e.point=r.points[r.points.length-1]}}}function ii(t,e){for(var i=0;i<t.segments.length;i++)for(var r=t.segments[parseInt(i.toString(),10)],n=0;n<r.points.length;n++)(n>0||0===i)&&e.push(r.points[parseInt(n.toString(),10)]);return e}function ri(t,e,i,r){var n,o={x:0,y:0},a=qe(t,t.corners,t.bounds),s=e.margin,h=e.point;if(a.bottomCenter.y+s.bottom<h.y)n="Bottom",o=a.bottomCenter;else if(a.topCenter.y-s.top>h.y)n="Top",o=a.topCenter;else if(a.middleLeft.x-s.left>h.x)n="Left",o=a.middleLeft;else if(a.middleRight.x+s.right<h.x)n="Right",o=a.middleRight;else{var d=Math.abs(h.y-a.topCenter.y),l=Math.abs(h.x-a.middleRight.x),c=Math.abs(h.y-a.bottomCenter.y),p=Math.abs(h.x-a.middleLeft.x),g=Number.MAX_VALUE;g=d,n="Top",o=a.topCenter,g>l&&(g=l,n="Right",o=a.middleRight),g>c&&(g=c,n="Bottom",o=a.bottomCenter),g>p&&(n="Left",o=a.middleLeft)}i.point=o,i.direction=n;var u=si(a,Ti(i.direction));i.point=di(r,t,i.point,u,t===r.targetWrapper)}function ni(t,e,i,r,n){var a,s,h;if((a=function(t,e){var i=!1;switch(t){case"Left":switch(e){case"Right":case"Bottom":i=!0}break;case"Top":switch(e){case"Left":case"Right":case"Bottom":i=!0}break;case"Bottom":if("Right"===e)i=!0}return i}(e.direction,i.direction))&&Ii(e,i),"Right"===e.direction&&"Left"===i.direction)h=function(t,e,i,r){var n,o=t.sourcePortWrapper,a=Math.round(Math.abs(e.point.y-i.point.y)),s={x:Math.max(e.point.x,e.corners.right),y:e.point.y},h={x:Math.min(i.point.x,i.corners.left),y:i.point.y},d=oi(t);if(r){var l=h;h=s,s=l}e.corners.bottom+d<i.corners.top-d||e.corners.top-d>i.corners.bottom+d||("Bezier"!==t.type||i.corners.left-e.corners.right<=2*d&&i.corners.left-e.corners.right>=5)&&(d=0);e.margin={left:d,right:d,top:d,bottom:d},i.margin={left:d,right:d,top:d,bottom:d},n=0===a&&(e.corners.right<i.corners.left||r&&e.corners.right<i.corners.left)?wt.One:e.point.x+e.margin.right<i.point.x-i.margin.left||t.sourceWrapper!==t.targetWrapper&&(B(t.sourceWrapper).containsPoint(h)||B(t.targetWrapper).containsPoint(s))?wt.Three:(e.corners.bottom<=i.corners.top||e.corners.top>=i.corners.top||void 0!==o&&o.offsetY<=i.corners.top||void 0===o&&e.corners.right<=i.corners.top||void 0!==o&&o.offsetY>=i.corners.bottom||void 0===o&&(e.corners.right,i.corners.bottom),wt.Five);return n}(t,e,i,a);else if("Right"===e.direction&&"Right"===i.direction)h=function(t,e,i){var r,n=t.sourcePortWrapper,o=t.targetPortWrapper,a=e.point.x-i.point.x,s=e.point.y-i.point.y,h=oi(t);i.margin={left:h,right:h,top:h,bottom:h},e.margin={left:h,right:h,top:h,bottom:h},r=e.corners.right>=i.corners.right?void 0!==n&&(n.offsetY<i.corners.top-i.margin.top||n.offsetY>i.corners.bottom+i.margin.bottom)||void 0===n&&e.corners.middleRight.y<i.corners.top||void 0!==n&&n.offsetY>i.corners.bottom+i.margin.bottom&&e.corners.top>i.corners.bottom||void 0===n&&e.corners.middleRight.y>i.corners.bottom||void 0!==n&&n.offsetY<i.corners.top-i.margin.top&&e.corners.bottom>i.corners.top||void 0===n&&e.corners.middleRight.y>i.corners.bottom?wt.Three:e.corners.right<i.corners.left||i.corners.right<e.corners.left?wt.Five:0===a||0===s?wt.One:wt.Three:void 0!==o&&e.corners.bottom<o.offsetY-i.margin.top||void 0===o&&e.corners.bottom<i.corners.middleRight.y||void 0!==o&&e.corners.top>o.offsetY+i.margin.right||void 0===o&&e.corners.top>i.corners.middleRight.y||void 0!==o&&(void 0!==n&&n.offsetX<i.corners.left&&n.offsetX!==o.offsetX&&Math.abs(e.corners.right-i.corners.left)<=20||void 0===n&&e.corners.right<i.corners.left&&e.corners.center.x!==i.corners.center.x&&e.corners.center.y!==i.corners.center.y)?wt.Three:e.corners.right<i.corners.left?wt.Five:0===a||0===s?wt.One:wt.Three;return r}(t,e,i);else if("Right"===e.direction&&"Top"===i.direction)h=function(t,e,i,r){var n,o=t.targetPortWrapper,a=t.sourcePortWrapper,s={x:Math.max(e.point.x,e.corners.right),y:e.point.y},h={x:i.point.x,y:Math.min(i.point.y,i.corners.top)},d=oi(t);if(i.margin={left:d,right:d,top:d,bottom:d},e.margin={top:d,bottom:d,left:d,right:d},r){var l=a;a=o,o=l;var c=s;s=h,h=c}n=void 0!==a&&a.offsetY<i.corners.top-i.margin.top||void 0===a&&e.corners.bottom<i.corners.top-i.margin.top?e.corners.bottom<i.corners.top?void 0!==o&&e.corners.right+e.margin.right<o.offsetX||void 0===o&&e.corners.right+e.margin.right<i.corners.topCenter.x?wt.Two:wt.Four:void 0!==o&&e.corners.left>o.offsetX||void 0===o&&e.corners.left>i.corners.topCenter.x?wt.Four:wt.Two:void 0!==a&&Math.abs(e.corners.right-i.corners.left)<=5&&Math.abs(a.offsetY-i.corners.top)<=5||void 0!==o&&e.corners.right<i.corners.left&&Math.abs(o.offsetX-e.corners.topCenter.x)>=25&&e.corners.middleRight.y+e.margin.right<o.offsetY?wt.Two:e.corners.right<i.corners.left?wt.Four:t.sourceWrapper!==t.targetWrapper&&(B(t.sourceWrapper).containsPoint(h)||B(t.targetWrapper).containsPoint(s))?wt.Two:wt.Four;return n}(t,e,i,a);else if("Right"===e.direction&&"Bottom"===i.direction)h=function(t,e,i,r){var n,o=oi(t);e.margin={left:o,right:o,top:o,bottom:o},i.margin={left:o,right:o,top:o,bottom:o};var a=t.sourcePortWrapper,s=t.targetPortWrapper;if(r){var h=a;a=s,s=h}n=void 0!==a&&a.offsetY>i.corners.bottom+i.margin.bottom||void 0===a&&e.corners.middleRight.y>i.corners.bottom+i.margin.bottom?e.corners.top>i.corners.bottom?void 0!==s&&e.corners.right+e.margin.right<s.offsetX||void 0===s&&e.corners.right+e.margin.right<i.corners.bottomCenter.x?wt.Two:wt.Four:void 0!==s&&e.corners.left>s.offsetX||void 0===s&&e.corners.left>i.corners.bottomCenter.x?wt.Four:wt.Two:void 0!==a&&Math.abs(e.corners.right-i.corners.left)<=25&&Math.abs(a.offsetY-i.corners.bottom)<=25?wt.Two:(e.corners.right,i.corners.left,wt.Four);return n}(t,e,i,a);else if("Bottom"===e.direction&&"Top"===i.direction)h=function(t,e,i){var r,n=e.point.x-i.point.x,o=oi(t);e.corners.right+o<i.corners.left-o||e.corners.left-o>i.corners.right+o||("Bezier"!==t.type||i.corners.top-e.corners.bottom<=2*o&&i.corners.top-e.corners.bottom>=5)&&(o=0);e.margin={left:o,right:o,top:o,bottom:o},i.margin={left:o,right:o,top:o,bottom:o},r=0===n&&e.corners.bottom<i.corners.top?wt.One:e.corners.bottom+e.margin.bottom<i.corners.top-i.margin.top?wt.Three:(e.corners.right+e.margin.right<i.corners.left-i.margin.left||(e.corners.left,e.margin.left,i.corners.right,i.margin.right),wt.Five);return r}(t,e,i);else if("Bottom"===e.direction&&"Bottom"===i.direction){var d=oi(t);e.margin={left:d,right:d,top:d,bottom:d},i.margin={left:d,right:d,top:d,bottom:d},h=function(t,e,i){var r,n=t.sourcePortWrapper,o=t.targetPortWrapper,a=Math.round(Math.abs(e.point.x-i.point.x)),s=Math.round(Math.abs(i.point.y-i.point.y));r=e.corners.bottom<i.corners.bottom?void 0!==n&&n.offsetX<i.corners.left-i.margin.left||void 0===n&&e.corners.bottomCenter.x<i.corners.left-i.margin.left||void 0!==n&&n.offsetX>i.corners.right+i.margin.right||void 0===n&&e.corners.bottomCenter.x>i.corners.right+i.margin.right?wt.Three:e.corners.bottom<i.corners.top?wt.Five:0===a||0===s?wt.One:wt.Three:void 0!==o&&e.corners.left-e.margin.left>o.offsetX||void 0===o&&e.corners.left>i.corners.left||void 0!==o&&e.corners.right+e.margin.right<o.offsetX||void 0===o&&e.corners.right<i.corners.right?wt.Three:e.corners.top>i.corners.bottom?wt.Five:0===a||0===s?wt.One:wt.Three;return r}(t,e,i)}else"Bottom"===e.direction&&"Left"===i.direction?h=function(t,e,i,r){var n,o=t.sourcePortWrapper,a=t.targetPortWrapper,s=oi(t);if(i.margin={left:s,right:s,top:s,bottom:s},e.margin={top:s,bottom:s,left:s,right:s},r){var h=o;o=a,a=h}n=void 0!==o&&o.offsetX<i.corners.left-i.margin.left||void 0===o&&e.corners.bottomCenter.x<i.corners.bottomLeft.x-i.margin.left?e.corners.right<i.corners.left?void 0!==a&&e.corners.bottom+e.margin.bottom<a.offsetY||void 0===a&&e.corners.bottom+e.margin.bottom<i.corners.middleLeft.y?wt.Two:wt.Four:void 0!==a&&e.corners.top>a.offsetY||void 0===a&&e.corners.top>i.corners.middleLeft.y?wt.Four:wt.Two:void 0!==a&&Math.abs(e.corners.right-i.corners.left)<=25&&Math.abs(a.offsetY-e.corners.bottom)<=25?wt.Two:wt.Four;return n}(t,e,i,a):"Left"===e.direction&&"Left"===i.direction?h=function(t,e,i){var r=t.sourcePortWrapper,n=t.targetPortWrapper,o=oi(t);e.margin={left:o,right:o,top:o,bottom:o},i.margin={left:o,right:o,top:o,bottom:o};var a,s=Math.round(Math.abs(e.point.x-i.point.x)),h=Math.round(Math.abs(e.point.y-i.point.y));a=e.corners.left<i.corners.left?void 0!==n&&e.corners.bottom+e.margin.bottom<n.offsetY||void 0===n&&e.corners.bottom+e.margin.bottom<i.corners.middleLeft.y||void 0!==n&&e.corners.top-e.margin.top>n.offsetY||void 0===n&&e.corners.top-e.margin.top>i.corners.middleLeft.y?wt.Three:e.corners.right<i.corners.left||i.corners.right<e.corners.left?wt.Five:0===s||0===h?wt.One:wt.Three:void 0!==r&&r.offsetY<i.corners.top-i.margin.top||void 0===r&&e.corners.middleLeft.y<i.corners.top||void 0!==r&&r.offsetY>i.corners.bottom+i.margin.bottom||void 0===r&&e.corners.middleLeft.y>i.corners.bottom+i.margin.bottom?wt.Three:e.corners.left>i.corners.right?wt.Five:0===s||0===h?wt.One:wt.Three;return a}(t,e,i):"Left"===e.direction&&"Top"===i.direction?h=function(t,e,i,r){var n,o=t.sourcePortWrapper,a=oi(t);i.margin={left:a,right:a,top:a,bottom:a},e.margin={top:a,bottom:a,left:a,right:a};var s=t.targetPortWrapper,h={x:Math.min(e.point.x,e.corners.left),y:e.point.y},d={x:i.point.x,y:Math.min(i.point.y,i.corners.top)};if(r){var l=o;o=s,s=l;var c=h;h=d,d=c}n=void 0!==o&&o.offsetY<i.corners.top-i.margin.top||void 0===o&&(e.corners.bottom<i.corners.top-i.margin.top||e.corners.middleLeft.y<i.corners.top-i.margin.top)?e.corners.bottom<i.corners.top?void 0!==s&&e.corners.left-e.margin.left>s.offsetX||void 0===s&&e.corners.left-e.margin.left>i.corners.topCenter.x?wt.Two:wt.Four:void 0!==s&&e.corners.right<s.offsetX||void 0===s&&e.corners.right<i.corners.topCenter.x?wt.Four:wt.Two:void 0!==o&&Math.abs(e.corners.left-i.corners.right)<=25&&Math.abs(o.offsetY-i.corners.top)<=25||t.sourceWrapper!==t.targetWrapper&&(B(t.sourceWrapper).containsPoint(d)||B(t.targetWrapper).containsPoint(h))?wt.Two:(e.corners.left,i.corners.right,wt.Four);return n}(t,e,i,a):"Top"===e.direction&&"Top"===i.direction&&(h=function(t,e,i){var r,n=t.sourcePortWrapper,o=t.targetPortWrapper,a=Math.round(Math.abs(e.point.x-i.point.x)),s=Math.round(Math.abs(e.point.y-i.point.y)),h=oi(t);i.margin={left:h,right:h,top:h,bottom:h},e.margin={top:h,bottom:h,left:h,right:h},r=e.corners.top<i.corners.top?void 0!==o&&e.corners.left-e.margin.left>o.offsetX||void 0===o&&e.corners.left>i.corners.left||void 0!==o&&e.corners.right+e.margin.right<o.offsetX||void 0===o&&e.corners.right<i.corners.right?wt.Three:e.corners.bottom<i.corners.top?wt.Five:0===a||0===s?wt.One:wt.Three:void 0!==n&&n.offsetX>i.corners.right+i.margin.right||void 0===n&&e.corners.left>i.corners.right||void 0!==n&&n.offsetX<i.corners.left-i.margin.left||void 0===n&&e.corners.bottomRight.x<i.corners.left?wt.Three:e.corners.top>i.corners.bottom?wt.Five:0===a||0===s?wt.One:wt.Three;return r}(t,e,i));return a&&Ii(e,i),s=function(t,e,i,r,n,o){var a,s,h=t.sourceWrapper,d=t.targetWrapper,l=h.corners,c=d.corners,p=20,g={corners:i.corners,point:i.point,direction:i.direction,margin:i.margin},u={corners:r.corners,point:r.point,direction:r.direction,margin:r.margin};if(!(g.direction===u.direction&&e!==wt.Five||g.direction!==Ti(u.direction)&&e!==wt.Three))switch(g.direction){case"Left":l.middleLeft.x>c.middleRight.x&&(s=(l.middleLeft.x-c.middleRight.x)/2,p=o?s:Math.min(p,s));break;case"Right":l.middleRight.x<c.middleLeft.x&&(s=(c.middleLeft.x-l.middleRight.x)/2,p=o?s:Math.min(p,s));break;case"Top":l.topCenter.y>c.bottomCenter.y&&(s=(l.topCenter.y-c.bottomCenter.y)/2,p=o?s:Math.min(p,s));break;case"Bottom":l.bottomCenter.y<c.topCenter.y&&(s=(c.topCenter.y-l.bottomCenter.y)/2,p=o?s:Math.min(p,s))}p=ui(l,g,p);var f="Bezier"===t.type;n&&(p=Math.max(p,n));e===wt.One&&(a=[g.point,u.point]);e===wt.Two&&(a=fi(g,u));e===wt.Three&&(a=mi(t,g,u,p,void 0,f));if(e===wt.Four){a=yi(g,u,void 0,a,p,f)}e===wt.Five&&(a=function(t,e,i,r){void 0===i&&(i=20);void 0===r&&(r=!1);r&&(i=20);var n,o,a=i,s=t.corners.left-t.margin.left,h=t.corners.right+t.margin.right,d=t.corners.bottom+t.margin.bottom,l=t.corners.top-t.margin.top,c=e.corners.left-e.margin.left,p=e.corners.right+e.margin.right,g=e.corners.bottom+e.margin.bottom,u=e.corners.top-e.margin.top;switch(t.direction){case"Left":(l>u&&l<g||d<g&&d>u)&&s>c&&s<=p&&i>=20&&(a=t.point.x-e.corners.left+a),r&&t.direction===e.direction&&t.corners.left>e.corners.left&&t.corners.left-e.corners.right>=20&&(a=(t.corners.left-e.corners.right)/2),o=hi(t.point,a,180);break;case"Top":(s>c&&s<p||h<p&&h>c)&&l>u&&l<=g&&i>=20&&(a=t.point.y-e.corners.top+a),r&&t.direction===e.direction&&t.corners.top>e.corners.top&&t.corners.top-e.corners.bottom>=20&&(a=(t.corners.top-e.corners.bottom)/2),o=hi(t.point,a,270);break;case"Right":(l>u&&l<g||d<g&&d>u)&&h<p&&h>=c&&i>=20&&(a=e.corners.right-t.point.x+a),r&&t.direction===e.direction&&t.corners.right<e.corners.right&&e.corners.left-t.corners.right>=20&&(a=(e.corners.left-t.corners.right)/2),o=hi(t.point,a,0);break;case"Bottom":(s>c&&s<p||h<p&&h>c)&&d<g&&d>=u&&i>=20&&(a=e.corners.bottom-t.point.y+a),r&&t.direction===e.direction&&t.corners.bottom<e.corners.bottom&&e.corners.top-t.corners.bottom>=20&&(a=(e.corners.top-t.corners.bottom)/2),o=hi(t.point,a,90)}n=[t.point,o];var f=void 0;if("Top"===t.direction||"Bottom"===t.direction){var m=t.direction;t.direction=o.x>e.point.x?"Left":"Right",t.point=o,n=yi(t,e,m,n,f=r?.5*Math.abs(o.x-e.point.x):f,r)}else{m=t.direction;t.direction=o.y>e.point.y?"Top":"Bottom",t.point=o,n=yi(t,e,m,n,f=r?.5*Math.abs(o.y-e.point.y):f,r)}return n}(g,u,p,f));return a}(t,h,e,i,r,n),"Bezier"===t.type&&function(t,e,i){if("Bezier"===t.type)if(0===t.segments.length){var r=i[0],n=i[i.length-1];if(e===wt.One){var a=Math.min(20,.5*o.findLength(r,n)),s={angle:ai(r,n),distance:a},h={angle:ai(n,r),distance:a},d=o.direction(r,n),l=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:s,vector2:h,orientation:"Left"===d||"Right"===d?"Horizontal":"Vertical"},!0);t.segments.push(l)}else if(e===wt.Two){s={angle:ai(r,g=i[1]),distance:.5*o.findLength(r,g)},h={angle:ai(n,g),distance:.5*o.findLength(n,g)},d=o.direction(r,g),l=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:s,vector2:h,orientation:"Left"===d||"Right"===d?"Horizontal":"Vertical"},!0);t.segments.push(l)}else if(e===wt.Three){var c=i[1],p=i[i.length-2],g={x:.5*(c.x+p.x),y:.5*(c.y+p.y)},u=(s={angle:ai(r,c),distance:.5*o.findLength(r,c)},h={angle:ai(g,c),distance:.5*o.findLength(g,c)},o.direction(r,c)),f=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:s,vector2:h,point:g,orientation:"Left"===u||"Right"===u?"Horizontal":"Vertical"},!0);t.segments.push(f);var m={angle:ai(g,p),distance:.5*o.findLength(g,p)},y={angle:ai(n,p),distance:.5*o.findLength(n,p)},v=o.direction(g,p),b=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:m,vector2:y,orientation:"Left"===v||"Right"===v?"Horizontal":"Vertical"},!0);t.segments.push(b)}else if(e===wt.Four){c=i[1],p=i[2];var S=i[3],w={x:.5*(c.x+p.x),y:.5*(c.y+p.y)},x={x:.5*(p.x+S.x),y:.5*(p.y+S.y)};s={angle:ai(r,c),distance:.5*o.findLength(r,c)},h={angle:ai(w,c),distance:.5*o.findLength(w,c)},u=o.direction(r,c),f=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:s,vector2:h,point:w,orientation:"Left"===u||"Right"===u?"Horizontal":"Vertical"},!0);t.segments.push(f);m={angle:ai(w,p),distance:.5*o.findLength(w,p)},y={angle:ai(x,p),distance:.5*o.findLength(x,p)},v=o.direction(w,p),b=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:m,vector2:y,point:x,orientation:"Left"===v||"Right"===v?"Horizontal":"Vertical"},!0);t.segments.push(b);var I={angle:ai(x,S),distance:.5*o.findLength(x,S)},P={angle:ai(n,S),distance:.5*o.findLength(n,S)},C=o.direction(x,S),T=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:I,vector2:P,orientation:"Left"===C||"Right"===C?"Horizontal":"Vertical"},!0);t.segments.push(T)}else if(e===wt.Five){c=i[1],p=i[2],S=i[3];var A=i[4],O=(w={x:.5*(c.x+p.x),y:.5*(c.y+p.y)},x={x:.5*(p.x+S.x),y:.5*(p.y+S.y)},{x:.5*(S.x+A.x),y:.5*(S.y+A.y)});s={angle:ai(r,c),distance:.5*o.findLength(r,c)},h={angle:ai(w,c),distance:.5*o.findLength(w,c)},u=o.direction(r,c),f=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:s,vector2:h,point:w,orientation:"Left"===u||"Right"===u?"Horizontal":"Vertical"},!0);t.segments.push(f);m={angle:ai(w,p),distance:.5*o.findLength(w,p)},y={angle:ai(x,p),distance:.5*o.findLength(x,p)},v=o.direction(w,p),b=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:m,vector2:y,point:x,orientation:"Left"===v||"Right"===v?"Horizontal":"Vertical"},!0);t.segments.push(b);I={angle:ai(x,S),distance:.5*o.findLength(x,S)},P={angle:ai(O,S),distance:.5*o.findLength(O,S)},C=o.direction(x,S),T=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:I,vector2:P,point:O,orientation:"Left"===C||"Right"===C?"Horizontal":"Vertical"},!0);t.segments.push(T);var D={angle:ai(O,A),distance:.5*o.findLength(O,A)},M={angle:ai(n,A),distance:.5*o.findLength(n,A)},L=o.direction(O,A),E=new go(t,"segments",{type:"Bezier",isInternalSegment:!0,vector1:D,vector2:M,orientation:"Left"===L||"Right"===L?"Horizontal":"Vertical"},!0);t.segments.push(E)}else{l=new go(t,"segments",{type:"Bezier"},!0);t.segments.push(l)}}else for(var z=0;z<t.segments.length;z++)t.bezierSettings.allowSegmentsReset&&(t.segments[parseInt(z.toString(),10)].isInternalSegment=!0)}(t,h,s),s}function oi(t){return t.connectorSpacing>=13?13:t.connectorSpacing<=1?1:t.connectorSpacing}function ai(t,e){var i={x:e.x,y:t.y},r=o.findLength(i,e),n=o.findLength(e,t),a=Math.asin(r/n);return a=180*a/Math.PI,t.x<e.x?t.y>e.y&&(a=360-a):a=t.y<e.y?180-a:180+a,a}function si(t,e){var i;switch(e){case"Left":i=t.middleLeft;break;case"Top":i=t.topCenter;break;case"Right":i=t.middleRight;break;case"Bottom":i=t.bottomCenter}return i}function hi(t,e,i){return o.transform(t,i,e)}function di(t,e,i,r,n){i={x:i.x,y:i.y},r={x:r.x,y:r.y};var a,s,h=n?t.targetWrapper:t.sourceWrapper,d=n?t.targetPadding:t.sourcePadding,l=n||"Orthogonal"===t.type||"Bezier"===t.type?i:r,c=h,p=Q(-h.parentTransform,h.offsetX,h.offsetY,i),g=Q(-h.parentTransform,h.offsetX,h.offsetY,r);if("Orthogonal"===t.type||"Bezier"===t.type){p.x===g.x&&(p.y<g.y?p.y-=5:p.y+=5),p.y===g.y&&(p.x<g.x?p.x-=5:p.x+=5),i=Q(h.parentTransform,h.offsetX,h.offsetY,p)}else if(n){var u=o.findAngle(i,r);r=o.transform({x:r.x,y:r.y},u,Math.max(h.actualSize.width,h.actualSize.height))}else{u=o.findAngle(r,i);i=o.transform({x:i.x,y:i.y},u,Math.max(h.actualSize.width,h.actualSize.height))}return(t.sourcePadding||t.targetPadding)&&(a=new w(h.bounds.x-d,h.bounds.y-d,h.actualSize.width+2*d,h.actualSize.height+2*d)),h instanceof Qt&&h.data?(s=a?[a.topLeft,a.topRight,a.bottomRight,a.bottomLeft]:c.getPoints(),c.data.split("m").length-1+(c.data.split("M").length-1)==1&&(s[s.length]=s[0])):(s=a?[a.topLeft,a.topRight,a.bottomRight,a.bottomLeft]:fa(h,h.corners))[s.length]=s[0],ci({x1:i.x,y1:i.y,x2:r.x,y2:r.y},s,!0,l)||i}function li(t,e,i){return e.x=Math.round(100*e.x)/100,e.y=Math.round(100*e.y)/100,i?t.targetPoint=e:t.sourcePoint=e,e}function ci(t,e,i,r){var n,a=e.length,s={x1:e[0].x,y1:e[0].y,x2:e[1].x,y2:e[1].y},h=pi(t,s);if(h&&(n=o.distancePoints(h,r)),isNaN(n)||n>0)for(var d=1;d<a-1;d++){var l=pi(t,s={x1:e[parseInt(d.toString(),10)].x,y1:e[parseInt(d.toString(),10)].y,x2:e[d+1].x,y2:e[d+1].y});if(l){var c=o.distancePoints(l,r);if((isNaN(n)||n>c)&&(n=c,h=l),n>=0&&n<=1)break}}return h}function pi(t,e){var i,r,n,o,a,s,h,d,l,c,p,g,u=t.x1,f=t.y1,m=t.x2,y=t.y2,v=e.x1,b=e.y1,S=e.x2,w=e.y2;if(c=(i=y-f)*S+(n=u-m)*w+(a=m*f-u*y),0!==(l=i*v+n*b+a)&&0!==c&&gi(l,c))return null;if(d=(r=w-b)*m+(o=v-S)*y+(s=S*b-v*w),0!==(h=r*u+o*f+s)&&0!==d&&gi(h,d))return null;var x=i*o-r*n;return 0===x?null:(p=x<0?-x/2:x/2,p=0,{x:(g=n*s-o*a)<0?(g-p)/x:(g+p)/x,y:(g=r*a-i*s)<0?(g-p)/x:(g+p)/x})}function gi(t,e){return t*e>=0}function ui(t,e,i){switch(e.direction){case"Left":e.point.x>t.left&&(i=e.point.x-t.left>i?e.point.x-t.left+i:i);break;case"Right":e.point.x<t.right&&(i=t.right-e.point.x>i?t.right-e.point.x+i:i);break;case"Top":e.point.y>t.top&&(i=e.point.y-t.top>i?e.point.y-t.top+i:i);break;case"Bottom":e.point.y<t.bottom&&(i=t.bottom-e.point.y>i?t.bottom-e.point.y+i:i)}return i}function fi(t,e){var i;switch(t.direction){case"Left":case"Right":var r={x:e.point.x,y:t.point.y};i=o.equals(t.point,r)||o.equals(e.point,r)?[t.point,e.point]:[t.point,r,e.point];break;case"Top":case"Bottom":var n={x:t.point.x,y:e.point.y};i=o.equals(t.point,n)||o.equals(e.point,n)?[t.point,e.point]:[t.point,n,e.point]}return i}function mi(t,e,i,r,n,o){void 0===o&&(o=!1),r||(r=20),o&&e.direction!==i.direction&&(r="Left"===e.direction||"Right"===e.direction?Math.floor(.5*Math.abs(e.point.x-i.point.x)):Math.floor(.5*Math.abs(e.point.y-i.point.y)));var a,s,h,d=t.sourcePortWrapper,l=i.point.x-e.point.x,c=i.point.y-e.point.y;if(!n&&(Math.abs(l)<.001||Math.abs(c)<.001)&&void 0===i.direction)return[e.point,i.point];if(void 0===t.targetWrapper&&Math.abs(l)<=31&&Math.abs(c)<=31){if("Left"===e.direction||"Right"===e.direction?Math.abs(c)<12&&(e.direction=e.point.y>i.point.y?"Top":"Bottom"):Math.abs(l)<12&&(e.direction=e.point.x>i.point.x?"Left":"Right"),Math.abs(l)>12||Math.abs(c)>12)return fi(e,i);r+=5}return"Left"===e.direction||"Right"===e.direction?("Right"===e.direction?(void 0!==i.direction&&"Right"===i.direction&&(r=Math.max(e.point.x,i.point.x)-e.point.x+r),e.point.x>i.point.x&&void 0===d&&(r=-r)):(void 0!==i.direction&&"Left"===i.direction&&(r=e.point.x-Math.min(e.point.x,i.point.x)+r),(e.point.x>i.point.x||void 0!==d||"Left"===e.direction)&&(r=-r)),h=i.point.y-e.point.y,a=hi(e.point,r,0),0!==(h=i.point.y-a.y)&&(s=hi(a,i.point.y-a.y,90))):"Top"!==e.direction&&"Bottom"!==e.direction||("Bottom"===e.direction?void 0!==i.direction&&"Bottom"===i.direction&&(r=Math.max(e.point.y,i.point.y)-e.point.y+r):(void 0!==i.direction&&"Top"===i.direction&&(r=e.point.y-Math.min(e.point.y,i.point.y)+r),(e.point.y>i.point.y||void 0!==d||"Top"===e.direction)&&(r=-r)),h=i.point.x-e.point.x,a=(e.direction,hi(e.point,r,90)),0!==(h=i.point.x-a.x)&&(s=hi(a,i.point.x-a.x,0))),0===h?[e.point,i.point]:[e.point,a,s,i.point]}function yi(t,e,i,r,n,o){var a;switch(void 0===n&&(n=20),void 0===o&&(o=!1),void 0===i?(t.margin={left:2,right:2,top:2,bottom:2},e.margin={left:0,right:5,top:0,bottom:5},o&&(t.margin={left:10,right:10,top:10,bottom:10},e.margin={left:10,right:10,top:10,bottom:10},"Left"===t.direction?(n=Si(t,e,i,n),t.corners.left-e.corners.right>=5&&(n=Math.abs(t.point.x-t.corners.left)+.5*Math.floor(t.corners.left-e.corners.right))):"Right"===t.direction?(n=wi(t,e,n,i),e.corners.left-t.corners.right>=5&&(n=Math.abs(t.point.x-t.corners.right)+.5*Math.floor(e.corners.left-t.corners.right))):"Top"===t.direction?(n=bi(t,e,i,n),t.corners.top-e.corners.bottom>=5&&(n=Math.abs(t.point.y-t.corners.top)+.5*Math.floor(t.corners.top-e.corners.bottom))):"Bottom"===t.direction&&(n=xi(t,e,n,i),e.corners.top-t.corners.bottom>=5&&(n=Math.abs(t.point.y-t.corners.bottom)+.5*Math.floor(e.corners.top-t.corners.bottom))))):("Bottom"===t.direction?o?e.corners.top-t.corners.bottom<20&&(n=e.corners.bottom-t.point.y+25):e.corners.top>t.corners.bottom&&e.corners.top-t.corners.bottom<20&&(n=(e.corners.top-t.corners.bottom)/2):"Top"===t.direction?o?t.corners.top-e.corners.bottom<20&&(n=t.point.y-e.corners.top+25):e.corners.bottom<t.corners.top&&t.corners.top-e.corners.bottom<20&&(n=(t.corners.top-e.corners.bottom)/2):"Right"===t.direction?o?e.corners.left-t.corners.right<20&&(n=e.corners.right-t.point.x+25):e.corners.left>t.corners.right&&e.corners.left-t.corners.right<20&&(n=(e.corners.left-t.corners.right)/2):"Left"===t.direction&&(o?t.corners.left-e.corners.right<20&&(n=t.point.x-e.corners.left+25):e.corners.right<t.corners.left&&t.corners.left-e.corners.right<20&&(n=(t.corners.left-e.corners.right)/2)),i===e.direction&&o&&("Bottom"===e.direction&&t.point.y>e.point.y||"Top"===e.direction&&t.point.y<e.point.y?"Left"===t.direction?n=Si(t,e,i,20):"Right"===t.direction&&(n=wi(t,e,20,i)):("Right"===e.direction&&t.point.x>e.point.x||"Left"===e.direction&&t.point.x<e.point.x)&&("Top"===t.direction?n=bi(t,e,i,20):"Bottom"===t.direction&&(n=xi(t,e,20,i))))),t.direction){case"Left":n=o?n:Si(t,e,i,n),a=hi(t.point,n,180);break;case"Right":n=o?n:wi(t,e,n,i),a=hi(t.point,n,0);break;case"Top":n=o?n:bi(t,e,i,n),a=hi(t.point,n,270);break;case"Bottom":n=o?n:xi(t,e,n,i),a=hi(t.point,n,90)}return void 0!==r?r.push(a):r=[t.point,a],"Top"===t.direction||"Bottom"===t.direction?vi(a,"horizontal",t,e,r,o):"Right"!==t.direction&&"Left"!==t.direction||vi(a,"vertical",t,e,r,o),r}function vi(t,e,i,r,n,o){var a,s,h;"horizontal"===e?(i.margin={left:0,right:10,top:0,bottom:10},r.margin={left:0,right:10,top:0,bottom:10}):"vertical"===e&&(i.margin={left:10,right:0,top:10,bottom:0},r.margin={left:10,right:0,top:10,bottom:0});var d=20;if("horizontal"===e){switch(r.direction){case"Left":if(i.corners.right+i.margin.right<r.corners.left-r.margin.left&&(r.corners.left-i.margin.right-i.corners.right>d||i.corners.top-i.margin.top<=r.point.y&&i.corners.bottom+i.margin.bottom>=r.point.y))if(!o||"Top"!==i.direction&&"Bottom"!==i.direction){l=Math.min(Math.abs(r.corners.left-i.corners.right)/2,20);d=i.corners.right-t.x+l}else{var l=Math.abs(r.corners.left-i.corners.right)/2;d=i.corners.right-t.x+l}else d="Top"===i.direction&&t.y>r.point.y||"Bottom"===i.direction&&t.y<r.point.y?Math.min(r.corners.left,t.x)-t.x-20:t.x>=i.corners.left-i.margin.left&&t.x<=i.corners.right+i.margin.right?Math.min(r.corners.left,i.corners.left)-t.x-20:r.corners.left-t.x-20;break;case"Right":if(i.corners.left-i.margin.left>r.corners.right+r.margin.right&&(i.corners.left-i.margin.right-r.corners.right>d||i.corners.top-i.margin.top<=r.point.y&&i.corners.bottom+i.margin.bottom>=r.point.y))if(!o||"Top"!==i.direction&&"Bottom"!==i.direction){l=Math.min(Math.abs(i.corners.left-r.corners.right)/2,20);d=i.corners.left-t.x-l}else{var l=Math.abs(i.corners.left-r.corners.right)/2;d=i.corners.left-t.x-l}else d="Top"===i.direction&&t.y>r.point.y||"Bottom"===i.direction&&t.y<r.point.y?Math.max(r.corners.right,t.x)-t.x+20:t.x>=i.corners.left-i.margin.left&&t.x<=i.corners.right+i.margin.right?Math.max(r.corners.right,i.corners.right)-t.x+20:r.corners.right-t.x+20}a=hi(t,d,0),s=hi(a,r.point.y-t.y,90),h=r.point}else if("vertical"===e){switch(r.direction){case"Top":if(i.corners.bottom+i.margin.bottom<r.corners.top-r.margin.top&&(r.corners.top-i.margin.top-i.corners.bottom>d||i.corners.left-i.margin.left<=r.point.x&&i.corners.right+i.margin.right>=r.point.x))if(!o||"Right"!==i.direction&&"Left"!==i.direction){l=Math.min(Math.abs(r.corners.top-i.corners.bottom)/2,20);d=i.corners.bottom-t.y+l}else{l=Math.abs(r.corners.top-i.corners.bottom)/2;d=i.corners.bottom-t.y+l}else d="Left"===i.direction&&t.x>r.point.x||"Right"===i.direction&&t.x<r.point.x?Math.min(r.corners.top,t.y)-t.y-20:t.y>=i.corners.top-i.margin.top&&t.y<=i.corners.bottom+i.margin.bottom?Math.min(r.corners.top,i.corners.top)-t.y-20:r.corners.top-t.y-20;break;case"Bottom":if(i.corners.top-i.margin.top>r.corners.bottom+r.margin.bottom&&(i.corners.top-i.margin.top-r.corners.bottom>d||i.corners.left-i.margin.left<=r.point.x&&i.corners.right+i.margin.right>=r.point.x))if(!o||"Right"!==i.direction&&"Left"!==i.direction){l=Math.min(Math.abs(i.corners.top-r.corners.bottom)/2,20);d=i.corners.top-t.y-l}else{l=Math.abs(i.corners.top-r.corners.bottom)/2;d=i.corners.top-t.y-l}else d="Left"===i.direction&&t.x>r.point.x||"Right"===i.direction&&t.x<r.point.x?Math.max(r.corners.bottom,t.y)-t.y+20:t.y>=i.corners.top-i.margin.top&&t.y<=i.corners.bottom+i.margin.bottom?Math.max(r.corners.bottom,i.corners.bottom)-t.y+20:r.corners.bottom-t.y+20}a=hi(t,d,90),s=hi(a,r.point.x-t.x,0),h=r.point}n.push(a),n.push(s),n.push(h)}function bi(t,e,i,r){return t.corners.top-t.margin.top>e.corners.top+e.margin.top&&t.corners.top-t.margin.top<=e.corners.bottom+e.margin.bottom?(("Right"===e.direction&&t.point.x<e.point.x||"Left"===e.direction&&t.point.x>e.point.x)&&(r+=t.corners.top-e.corners.top),r+=t.point.y-t.corners.top):void 0!==i&&"Left"!==i&&"Right"===e.direction&&t.point.x<e.point.x||void 0!==i&&"Right"!==i&&"Left"===e.direction&&e.point.x<t.point.x?r+=Math.abs(t.point.y-e.corners.bottom):r+=t.point.y-t.corners.top,r}function Si(t,e,i,r){return t.corners.left-t.margin.left>e.corners.left-e.margin.left&&t.corners.left-t.margin.left<=e.corners.right+e.margin.right?(("Bottom"===e.direction&&t.point.y<e.point.y||"Top"===e.direction&&t.point.y>e.point.y)&&(r+=t.corners.left-e.corners.left),r+=t.point.x-t.corners.left):void 0!==i&&"Top"!==i&&"Bottom"===e.direction&&t.point.y<e.point.y||void 0!==i&&"Bottom"!==i&&"Top"===e.direction&&e.point.y<t.point.y?r+=Math.abs(t.point.x-e.corners.right):r+=t.point.x-t.corners.left,r}function wi(t,e,i,r){return t.corners.right+t.margin.right<e.corners.right+e.margin.right&&t.corners.right+t.margin.right>=e.corners.left-e.margin.left?(("Bottom"===e.direction&&t.point.y<e.point.y||"Top"===e.direction&&t.point.y>e.point.y)&&(i+=e.corners.right-t.corners.right),i+=t.corners.right-t.point.x):void 0!==r&&"Top"!==r&&"Bottom"===e.direction&&t.point.y<e.point.y||void 0!==r&&"Bottom"!==r&&"Top"===e.direction&&e.point.y<t.point.y?i+=Math.abs(t.point.x-e.corners.right):i+=t.corners.right-t.point.x,i}function xi(t,e,i,r){return t.corners.bottom+t.margin.bottom<e.corners.bottom+e.margin.bottom&&t.corners.bottom+t.margin.bottom>=e.corners.top-e.margin.top?(("Right"===e.direction&&t.point.x<e.point.x||"Left"===e.direction&&t.point.x>e.point.x)&&(i+=e.corners.bottom-t.corners.bottom),i+=t.corners.bottom-t.point.y):void 0!==r&&"Left"!==r&&"Right"===e.direction&&t.point.x<e.point.x||void 0!==r&&"Right"!==r&&"Left"===e.direction&&e.point.x<t.point.x?i+=Math.abs(t.point.y-e.corners.bottom):i+=t.corners.bottom-t.point.y,i}function Ii(t,e){var i=t.direction;t.direction=e.direction,e.direction=i;var r=t.point;t.point=e.point,e.point=r;var n=t.corners;t.corners=e.corners,e.corners=n}function Pi(t,e,i,r){var n=void 0===e?i:e,o=n.topLeft,a=n.topRight,s=n.bottomRight,h=n.bottomLeft,d=n.center,l=ai(d,t),c=ai(d,s),p=ai(d,h),g=ai(d,o),u=ai(d,a);return l>g&&l<u?"Top":l>=c&&l<p?"Bottom":l>=p&&l<=g?"Left":"Right"}function Ci(t){var e=t.wrapper.children[0].bounds;return"None"!==t.sourceDecorator.shape&&e.uniteRect(t.wrapper.children[1].bounds),"None"!==t.targetDecorator.shape&&e.uniteRect(t.wrapper.children[2].bounds),e}function Ti(t){switch(t){case"Top":return"Bottom";case"Bottom":return"Top";case"Left":return"Right";case"Right":return"Left"}return"auto"}var Ai=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Oi=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Di=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ai(i,t),Oi([(0,e.Property)()],i.prototype,"width",void 0),Oi([(0,e.Property)()],i.prototype,"height",void 0),i}(e.ChildProperty),Mi=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ai(i,t),Oi([(0,e.Property)()],i.prototype,"width",void 0),Oi([(0,e.Property)()],i.prototype,"height",void 0),Oi([(0,e.Property)()],i.prototype,"fit",void 0),Oi([(0,e.Property)()],i.prototype,"description",void 0),Oi([(0,e.Property)()],i.prototype,"template",void 0),Oi([(0,e.Property)()],i.prototype,"tooltip",void 0),i}(e.ChildProperty),Li=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ei=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},zi=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Li(i,t),Ei([(0,e.Property)("")],i.prototype,"id",void 0),Ei([(0,e.Property)(Number.MIN_VALUE)],i.prototype,"zIndex",void 0),Ei([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),Ei([(0,e.Property)(!0)],i.prototype,"visible",void 0),Ei([(0,e.Complex)({},he)],i.prototype,"tooltip",void 0),Ei([(0,e.Property)(!1)],i.prototype,"excludeFromLayout",void 0),Ei([(0,e.Property)()],i.prototype,"addInfo",void 0),Ei([(0,e.Property)(tt.None)],i.prototype,"flip",void 0),Ei([(0,e.Property)("All")],i.prototype,"flipMode",void 0),Ei([(0,e.Complex)({},Mi)],i.prototype,"symbolInfo",void 0),i}(e.ChildProperty),ki=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Bi=function(t){function e(e,i,r,n){var o=t.call(this)||this;return o.data="",o.nodeId="",o.annotationId="",o.diagramId="",o.diagramId=i,o.nodeId=e,o.annotationId=r,o.templateFn=k(n),o}return ki(e,t),e.prototype.getNodeTemplate=function(){return this.templateFn},Object.defineProperty(e.prototype,"content",{get:function(){return this.data},set:function(t){this.data=t,this.canReset||(this.canReset=!0,this.isTemplate||(this.template=Sd(this,!0)),this.canReset=!1,this.isDirt=!0)},enumerable:!0,configurable:!0}),e}(Xt),Ri=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ni=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},ji=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ri(i,t),Ni([(0,e.Property)("")],i.prototype,"id",void 0),Ni([(0,e.Property)("transparent")],i.prototype,"fill",void 0),Ni([(0,e.Property)("black")],i.prototype,"iconStrokeColor",void 0),Ni([(0,e.Property)(0)],i.prototype,"iconStrokeWidth",void 0),Ni([(0,e.Property)(!0)],i.prototype,"visibility",void 0),Ni([(0,e.Property)(10)],i.prototype,"width",void 0),Ni([(0,e.Property)(10)],i.prototype,"height",void 0),Ni([(0,e.Property)("transparent")],i.prototype,"handleStrokeColor",void 0),Ni([(0,e.Property)(1)],i.prototype,"handleStrokeWidth",void 0),Ni([(0,e.Property)("")],i.prototype,"pathData",void 0),Ni([(0,e.Property)(0)],i.prototype,"cornerRadius",void 0),Ni([(0,e.Complex)({left:0,right:0,top:0,bottom:0},Ot)],i.prototype,"padding",void 0),Ni([(0,e.Complex)({},he)],i.prototype,"tooltip",void 0),i}(e.ChildProperty),Hi=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ri(i,t),Ni([(0,e.Complex)({x:0,y:0},o)],i.prototype,"offset",void 0),Ni([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),i}(ji),Wi=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ri(i,t),Ni([(0,e.Property)(.5)],i.prototype,"offset",void 0),Ni([(0,e.Property)("Center")],i.prototype,"alignment",void 0),Ni([(0,e.Complex)({x:0,y:0},o)],i.prototype,"displacement",void 0),i}(ji);function _i(t){if(t){return t instanceof Ie||t instanceof Pe?t.constraints&st.Select:t instanceof Co?t.constraints&at.Select:t.constraints&ht.Select}return 1}function Yi(t){if(t){return t instanceof Ie||t instanceof Pe?t.constraints&st.Drag:t instanceof Co?t.constraints&at.Drag:t instanceof qh?1:t.constraints&ht.Drag}return 1}function Fi(t,e){return t instanceof Co?t.constraints&at.PointerEvents:t.constraints&ht.PointerEvents}function Xi(t){return t instanceof Co?t.constraints&at.Delete:t.constraints&ht.Delete}function Vi(t){return t.constraints&at.DragSourceEnd}function Ui(t){return t.constraints&at.DragTargetEnd}function Gi(t){return t.constraints&at.DragSegmentThumb}function Zi(t){return t instanceof Ie||t instanceof Pe?t.constraints&st.Rotate:t.constraints&ht.Rotate}function qi(t){return t.constraints&ht.Shadow}function Qi(t){return t instanceof Yh&&t.constraints&ht.InConnect?t.constraints&ht.InConnect:0}function Ki(t){return t&&t.constraints&&!(t.constraints&It.None)&&t.constraints&It.InConnect?t.constraints&It.InConnect:0}function Ji(t){return t instanceof Yh&&t.constraints&ht.OutConnect?t.constraints&ht.OutConnect:0}function $i(t){return t&&t.constraints&&!(t.constraints&It.None)&&t.constraints&It.OutConnect?t.constraints&It.OutConnect:0}function tr(t,e){var i=0;return t instanceof Ie||t instanceof Pe?i=t.constraints&st.Resize:t&&("SouthEast"===e?i=t.constraints&ht.ResizeSouthEast:"East"===e?i=t.constraints&ht.ResizeEast:"NorthEast"===e?i=t.constraints&ht.ResizeNorthEast:"South"===e?i=t.constraints&ht.ResizeSouth:"North"===e?i=t.constraints&ht.ResizeNorth:"SouthWest"===e?i=t.constraints&ht.ResizeSouthWest:"West"===e?i=t.constraints&ht.ResizeWest:"NorthWest"===e&&(i=t.constraints&ht.ResizeNorthWest)),i}function er(t){return t instanceof Co?t.constraints&at.AllowDrop:t.constraints&ht.AllowDrop}function ir(t){return t.constraints&ct.Virtualization}function rr(t){return t.tool&pt.SingleSelect}function nr(t){return t.tool&pt.MultipleSelect}function or(t){return t.tool&pt.ZoomPan}function ar(t){return t.tool&pt.ContinuousDraw}function sr(t){return t.tool&pt.DrawOnce}function hr(t){return t.tool&pt.SingleSelect||t.tool&pt.MultipleSelect}function dr(t){return t.constraints&ct.UserInteraction}function lr(t){return t.constraints&ct.ZoomTextEdit}function cr(t){return function(t){return t.constraints&ct.ApiUpdate}(t)||t.diagramActions&yt.ToolAction}function pr(t,e){return t.constraints&It.Draw}function gr(t,e){return t.constraints&It.Drag}function ur(t){return!(t&vt.DrawSelectorBorder)}function fr(t){return!!(t&vt.PreventRenderSelector)}var mr=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),yr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.childTable=[],e.cellStyle={},e.desiredRowHeight=[],e.desiredCellWidth=[],e}return mr(e,t),e.prototype.rowDefinitions=function(){return this.rowDefns},e.prototype.columnDefinitions=function(){return this.colDefns},e.prototype.addObject=function(t,e,i,r,n){if(this.rows.length>=e){var o=this.rows[parseInt(e.toString(),10)];if(o.cells.length>i){n=n||1,r=r||1;var a=o.cells[parseInt(i.toString(),10)];a.columnSpan=Math.max(n,a.columnSpan),a.rowSpan=Math.max(r,a.rowSpan);var s=new xr;(s=t).rowId=e,s.columnId=i,s.columnSpan=n,this.childTable[s.id]=s,this.addObjectToCell(s,a)}}},e.prototype.addObjectToCell=function(t,e){e.children||(e.children=[]),t.style.strokeColor="black",t.style.strokeWidth=1,e.children.push(t)},e.prototype.updateProperties=function(t,e,i,r){this.offsetX=t,this.offsetY=e,this.width=i,this.height=r},e.prototype.setDefinitions=function(t,e){this.rowDefns=t,this.colDefns=e,this.children=[],this.rows=this.rows||[];for(var i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)],n=new Sr;n.cells=[];var o=new br;o.width=this.width;var a=this.colDefns;(void 0===a||a.length<1)&&(a=[o]),this.addCellInRow(a,r,n),this.rows.push(n)}},e.prototype.addCellInRow=function(t,e,i){for(var r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],o=new wr;o.children=[],this.cellStyle.fill="none",this.cellStyle.strokeColor="none",o.id=E(),o.style=this.cellStyle,o.desiredCellWidth=o.minWidth=n.width,o.desiredCellHeight=o.minHeight=e.height,i.cells.push(o),this.children.push(o)}},e.prototype.calculateSize=function(){for(var t=this.rows||[],e=0,i=0,r=0;r<t.length;r++){var n=this.rows[parseInt(r.toString(),10)];i=0;for(var o=0;o<n.cells.length;o++)if(i+=n.cells[parseInt(o.toString(),10)].desiredCellWidth,o===n.cells.length-1&&(this.width&&this.width!==i&&(n.cells[parseInt(o.toString(),10)].desiredCellWidth+=this.width-i,n.cells[parseInt(o.toString(),10)].minWidth=n.cells[parseInt(o.toString(),10)].desiredCellWidth,n.cells[parseInt(o.toString(),10)].children&&n.cells[parseInt(o.toString(),10)].children.length&&(n.cells[parseInt(o.toString(),10)].children[0].width=n.cells[parseInt(o.toString(),10)].desiredCellWidth),this.colDefns[parseInt(o.toString(),10)].width=n.cells[parseInt(o.toString(),10)].desiredCellWidth),e+=n.cells[parseInt(o.toString(),10)].desiredCellHeight,r===t.length-1&&this.height&&this.height!==e)){var a=this.height-e;if(a>0){for(var s=0;s<n.cells.length;s++)n.cells[parseInt(s.toString(),10)].desiredCellHeight+=a,n.cells[parseInt(s.toString(),10)].minHeight=n.cells[parseInt(s.toString(),10)].desiredCellHeight=n.cells[parseInt(s.toString(),10)].desiredCellHeight,n.cells[parseInt(s.toString(),10)].children&&n.cells[parseInt(s.toString(),10)].children.length&&(n.cells[parseInt(s.toString(),10)].children[0].height=n.cells[parseInt(s.toString(),10)].desiredCellHeight);this.rowDefns[parseInt(r.toString(),10)].height+=a}}}},e.prototype.updateRowHeight=function(t,e,r,n,o){var a=this.rows[parseInt(t.toString(),10)];this.rowDefns[parseInt(t.toString(),10)].height=e,void 0!==this.height&&(this.height+=e-a.cells[0].desiredCellHeight);for(var s=0;s<a.cells.length;s++)a.cells[parseInt(s.toString(),10)].desiredCellHeight=a.cells[parseInt(s.toString(),10)].minHeight=e,a.cells[parseInt(s.toString(),10)].children&&a.cells[parseInt(s.toString(),10)].children.length&&(a.cells[parseInt(s.toString(),10)].children[0].height=e,this.setTextRefresh(a.cells[parseInt(s.toString(),10)].children[0]));if(this.desiredRowHeight[parseInt(t.toString(),10)]=e,this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize),r){var h=void 0!==n?this.calculateCellHeightBasedOnChildren(t,n):this.calculateCellHeight(t);h>e&&!o&&this.updateRowHeight(t,h,!1)}},e.prototype.setTextRefresh=function(t){if(t.children&&t.children.length)for(var e=t.children,i=0;i<e.length;i++)e[parseInt(i.toString(),10)]instanceof Zt&&e[parseInt(i.toString(),10)].refreshTextElement(),e[parseInt(i.toString(),10)]instanceof te&&this.setTextRefresh(e[parseInt(i.toString(),10)])},e.prototype.updateColumnWidth=function(t,e,r,n,o){this.colDefns[parseInt(t.toString(),10)].width=e,void 0!==this.width&&(this.width+=e-this.rows[this.rows.length-1].cells[parseInt(t.toString(),10)].desiredCellWidth);for(var a=0;a<this.rows.length;a++)this.setTextRefresh(this.rows[parseInt(a.toString(),10)].cells[0]),this.rows[parseInt(a.toString(),10)].cells[parseInt(t.toString(),10)].desiredCellWidth=this.rows[parseInt(a.toString(),10)].cells[parseInt(t.toString(),10)].minWidth=e,this.rows[parseInt(a.toString(),10)].cells[parseInt(t.toString(),10)].children&&this.rows[parseInt(a.toString(),10)].cells[parseInt(t.toString(),10)].children.length&&(this.rows[parseInt(a.toString(),10)].cells[parseInt(t.toString(),10)].children[0].width=e);if(this.desiredCellWidth[parseInt(t.toString(),10)]=e,this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize),r){var s=void 0!==n?this.calculateCellWidthBasedOnChildren(t,n):this.calculateCellWidth(t);s>e&&!o&&this.updateColumnWidth(t,s,!1)}},e.prototype.calculateCellWidth=function(t){for(var e,i,r,n=0;n<this.rows.length;n++)1===(r=this.rows[parseInt(n.toString(),10)].cells[parseInt(t.toString(),10)]).columnSpan&&(i=r.outerBounds.width>r.bounds.width&&(0===r.children.length||void 0===r.children[0].maxWidth)?r.outerBounds.width:r.bounds.width,e=e?e<i?i:e:i);return e},e.prototype.calculateCellHeight=function(t){for(var e,i,r,n=this.rows[parseInt(t.toString(),10)],o=0;o<n.cells.length;o++)i=(r=n.cells[parseInt(o.toString(),10)]).outerBounds.height>r.bounds.height?r.outerBounds.height:r.bounds.height,e=e?e<i?i:e:i;return e},e.prototype.calculateCellSizeBasedOnChildren=function(t,e,i,r){var n,o=t&&t.children.length>0?t.children[0]:void 0;if(o&&1===t.columnSpan){n="Width"===e?o.bounds.right:o.bounds.bottom,r||(r="Width"===e?o.bounds.width:o.bounds.height);for(var a=0;a<o.children.length;a++){var s=o.children[parseInt(a.toString(),10)];if(s instanceof te&&-1===s.id.indexOf("header")){var h=("Width"===e?s.bounds.right:s.bounds.bottom)+i;if(h>n){var d=h-n+("Width"===e?o.bounds.width:o.bounds.height);r&&(r=r<d?d:r)}}}}return r},e.prototype.calculateCellWidthBasedOnChildren=function(t,e){for(var i,r,n=0;n<this.rows.length;n++)r=this.rows[parseInt(n.toString(),10)].cells[parseInt(t.toString(),10)],i=this.calculateCellSizeBasedOnChildren(r,"Width",e,i);return i},e.prototype.calculateCellHeightBasedOnChildren=function(t,e){for(var i,r,n=this.rows[parseInt(t.toString(),10)],o=0;o<n.cells.length;o++)r=n.cells[parseInt(o.toString(),10)],i=this.calculateCellSizeBasedOnChildren(r,"Height",e,i);return i},e.prototype.addRow=function(t,e,r){this.rowDefns.length>0?this.rowDefns.splice(t,0,e):this.rowDefns.push(e);var n=new Sr;n.cells=[],(new br).width=this.width;var o=this.colDefns;this.addCellInRow(o,e,n),t>this.rows.length-1?this.rows.push(n):this.rows.splice(t,0,n),r&&(this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize))},e.prototype.addColumn=function(t,e,r){var n,o,a,s,h=this.rows;this.colDefns.length>0?this.colDefns.splice(t,0,e):this.colDefns.push(e),void 0!==this.width&&(this.width+=e.width);for(var d=0;d<h.length;d++)n=h[parseInt(d.toString(),10)],o=this.rowDefns[parseInt(d.toString(),10)],a=e,(s=new wr).style=this.cellStyle,s.desiredCellWidth=s.minWidth=a.width,s.desiredCellHeight=s.minHeight=o.height,s.children=[],t>n.cells.length-1?n.cells.push(s):n.cells.splice(t,0,s),this.children.push(s);r&&(this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize))},e.prototype.removeRow=function(t){var e,r,n=this.rows[parseInt(t.toString(),10)];this.height-=this.rowDefns[parseInt(t.toString(),10)].height;for(var o=0;o<n.cells.length;o++)e=n.cells[parseInt(o.toString(),10)],this.children.splice(this.children.indexOf(e),1),(r=document.getElementById(e.id+"_groupElement"))&&r.parentElement&&r.parentElement.removeChild(r);this.rows.splice(t,1),this.rowDefns.splice(t,1),this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize)},e.prototype.removeColumn=function(t){var e,r,n=this.rows;this.width-=this.colDefns[parseInt(t.toString(),10)].width;for(var o=0;o<n.length;o++)e=n[parseInt(o.toString(),10)].cells[parseInt(t.toString(),10)],this.children.splice(this.children.indexOf(e),1),(r=document.getElementById(e.id+"_groupElement"))&&r.parentElement&&r.parentElement.removeChild(r),n[parseInt(o.toString(),10)].cells.splice(t,1);this.colDefns.splice(t,1),this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize)},e.prototype.updateRowIndex=function(t,e){var r=this.rows[parseInt(t.toString(),10)];this.rows.splice(t,1),this.rows.splice(e,0,r);var n=this.rowDefns[parseInt(t.toString(),10)];this.rowDefns.splice(t,1),this.rowDefns.splice(e,0,n),this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize)},e.prototype.updateColumnIndex=function(t,e,r){for(var n,o,a=t;a<this.rows.length;a++)n=this.rows[parseInt(a.toString(),10)],o=this.rows[parseInt(a.toString(),10)].cells[parseInt(e.toString(),10)],n.cells.splice(e,1),n.cells.splice(r,0,o);var s=this.colDefns[parseInt(e.toString(),10)];this.colDefns.splice(e,1),this.colDefns.splice(r,0,s);var h=this.desiredCellWidth[parseInt(e.toString(),10)];this.desiredCellWidth.splice(e,1),this.desiredCellWidth.splice(r,0,h),this.measure(new i(this.width,this.height)),this.arrange(this.desiredSize)},e.prototype.measure=function(e){var r=void 0;if(void 0!==this.rows&&this.rows.length>0){var n=0,o=0;r=new i(0,0),this.calculateSize();for(var a=0,s=this.rows;a<s.length;a++){o=0;for(var h=0,d=(u=s[a]).cells;h<d.length;h++){var l=(v=d[h]).measure(new i(v.desiredCellWidth,v.desiredCellHeight));1===v.rowSpan&&(0===o||void 0===this.desiredRowHeight[parseInt(n.toString(),10)]?this.desiredRowHeight[parseInt(n.toString(),10)]=l.height:this.desiredRowHeight[parseInt(n.toString(),10)]=Math.max(l.height,this.desiredRowHeight[parseInt(n.toString(),10)])),1===v.columnSpan&&(0===n||void 0===this.desiredCellWidth[parseInt(o.toString(),10)]?this.desiredCellWidth[parseInt(o.toString(),10)]=l.width:this.desiredCellWidth[parseInt(o.toString(),10)]=Math.max(l.width,this.desiredCellWidth[parseInt(o.toString(),10)]),n===this.rows.length-1&&(r.width+=this.desiredCellWidth[parseInt(o.toString(),10)])),o++}r.height+=this.desiredRowHeight[parseInt(n.toString(),10)],n++}n=o=0;for(var c=0,p=0,g=this.rows;p<g.length;p++){var u;o=0;for(var f=0,m=0,y=(u=g[p]).cells;m<y.length;m++){var v;if(1!==(v=y[m]).columnSpan){v.desiredSize.width=0;for(var b=0;b<v.columnSpan;b++)b+o<u.cells.length&&(v.desiredSize.width+=this.desiredCellWidth[b+o],v.minWidth=v.desiredSize.width,v.measure(v.desiredSize));o++}else v.desiredSize.width=this.desiredCellWidth[parseInt(f.toString(),10)],v.measure(v.desiredSize);if(1!==v.rowSpan){v.desiredSize.height=0;for(b=0;b<v.rowSpan;b++)b+c<this.rows.length&&(v.desiredSize.height+=this.desiredRowHeight[b+c],v.minHeight=v.desiredSize.height,v.measure(v.desiredSize))}else v.desiredSize.height=this.desiredRowHeight[parseInt(c.toString(),10)],v.measure(v.desiredSize);n++,f++}c++}}return void 0===r&&(r=t.prototype.validateDesiredSize.call(this,r,e)),t.prototype.stretchChildren.call(this,r),this.desiredSize=r,r},e.prototype.arrange=function(t,e){var r=0,n=0;if(void 0!==this.rows&&this.rows.length>0){for(var o=this.offsetX-t.width*this.pivot.x,a=this.offsetY-t.height*this.pivot.y,s=o,h=0,d=this.rows;h<d.length;h++){s=o,r=0;for(var l=0,c=(f=d[h]).cells;l<c.length;l++){var p=c[l],g=Math.max(this.desiredCellWidth[parseInt(r.toString(),10)],p.desiredSize.width),u=Math.max(this.desiredRowHeight[parseInt(n.toString(),10)],p.desiredSize.height);p.offsetX=s+g*p.pivot.x,p.offsetY=a+u*p.pivot.y,s+=this.desiredCellWidth[parseInt(r.toString(),10)],p.arrange(new i(g,u)),r++}a+=this.desiredRowHeight[parseInt(n.toString(),10)],n++}if(e){p=void 0;var f=void 0,m=void 0,y=void 0,v=void 0;for(n=0;n<this.rows.length;n++)for(f=this.rows[parseInt(n.toString(),10)],r=0;r<f.cells.length;r++)if((p=f.cells[parseInt(r.toString(),10)]).columnSpan>1&&this.children.splice(this.children.indexOf(p)+1,p.columnSpan-1),p.rowSpan>1)for(m=n,y=0;m+p.rowSpan-1<this.rows.length&&y<p.rowSpan-1;m++,y++)v=this.rows[m+1].cells[parseInt(r.toString(),10)],this.children.splice(this.children.indexOf(v),1)}}return this.actualSize=t,this.updateBounds(),t},e}(Ut),vr=function(){this.height=void 0},br=function(){this.width=void 0},Sr=function(){this.cells=null},wr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.columnSpan=1,e.rowSpan=1,e}return mr(e,t),e}(te),xr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.rowId=0,e.columnId=0,e.rowSpan=1,e.columnSpan=1,e}return mr(e,t),e}(Xt);function Ir(t,e,i){i.width||0!==i.shape.phases.length||(i.width=100);var r=[],n=[],o=0,a=i.shape,s="Horizontal"===a.orientation;if(a.header&&a.hasHeader&&Ar(r,a.header.height),function(t,e,i){var r,n=0,o=i.shape;if(t.length>0)for(var a=0;a<t.length;a++)n+=t[parseInt(a.toString(),10)].height;if(e){if(o.phases.length>0&&o.phaseSize&&(n+=o.phaseSize,Ar(t,o.phaseSize)),o.lanes.length>0)for(a=0;a<o.lanes.length;a++)n+=r=o.lanes[parseInt(a.toString(),10)].height,a===o.lanes.length-1&&n<i.height&&(r+=i.height-n),Ar(t,r)}else if(o.phases.length>0){var s=0;for(a=0;a<o.phases.length;a++){var h=o.phases[parseInt(a.toString(),10)].offset;s+=0===a?h:h-=s,n+=r=h,a===o.phases.length-1&&n<i.height&&(r+=i.height-n),Ar(t,r)}}else(n+=r=o.lanes[0].height)<i.height&&(r+=i.height-n),Ar(t,r)}(r,s,i),function(t,e,i){var r,n,o,a,s=0,h=i.shape;if(h.phases.length>0&&"Horizontal"===h.orientation)for(a=0;a<h.phases.length;a++)r=h.phases[parseInt(a.toString(),10)].offset,s+=0===a?r:r-=s,n=Or(r),a===h.phases.length-1&&s<i.width&&(n.width+=i.width-s),t.push(n);else if(e)n=Or(i.width),t.push(n);else{for(h.phaseSize&&h.phases.length>0?h.lanes.length+1:h.lanes.length,h.phaseSize&&h.phases.length>0&&(s+=h.phaseSize,n=Or(h.phaseSize),t.push(n)),o=0;o<h.lanes.length;o++)s+=h.lanes[parseInt(o.toString(),10)].width,n=Or(h.lanes[parseInt(o.toString(),10)].width),o===h.lanes.length-1&&s<i.width&&(n.width+=i.width-s),t.push(n);0===h.phases.length&&0===h.lanes.length&&(n=Or(i.width),t.push(n))}}(n,s,i),t.setDefinitions(r,n),a.header&&a.hasHeader&&(!function(t,e,i){for(var r=0,n=t.columnDefinitions(),o=i.shape,a=0;a<n.length;a++)r+=n[parseInt(a.toString(),10)].width;o.header.id=o.header.id||E();var s={id:i.id+o.header.id,annotations:[N(o.header.annotation)],style:o.header.style?o.header.style:void 0,offsetX:i.offsetX,offsetY:i.offsetY,rowIndex:0,columnIndex:0,maxWidth:r,pivot:i.pivot,container:{type:"Canvas",orientation:"Horizontal"}};_i(i)||(s.constraints&=~ht.Select);var h=Pr(e,t,i,s,!0);t.addObject(h,0,0,1,t.columnDefinitions().length)}(t,e,i),o++),a.phases.length>0&&a.phaseSize){for(var h=0;h<a.phases.length;h++)""===a.phases[parseInt(h.toString(),10)].id&&(a.phases[parseInt(h.toString(),10)].id=E()),Cr(t,e,i,o,s,h);o++}if(a.lanes.length>0)for(h=0;h<a.lanes.length;h++)""===a.lanes[parseInt(h.toString(),10)].id&&(a.lanes[parseInt(h.toString(),10)].id=E()),Tr(t,e,i,o,h,s),o++}function Pr(t,e,r,n,o,a,s,h){var d=new Yh(t,"nodes",n,!0);if(d.parentId=r.id,d.isHeader=!!o,d.isPhase=!!a,d.isLane=!!s,d.pivot=r.pivot,h&&(d[""+(a?"PhaseHeaderParent":"LaneHeaderParent")]=h),d.constraints&=~(ht.InConnect|ht.OutConnect),d.constraints|=ht.HideThumbs,t.initObject(d),t.nodes.push(d),d.wrapper.children.length>0){for(var l=0;l<d.wrapper.children.length;l++){var c=d.wrapper.children[parseInt(l.toString(),10)];c instanceof Xt&&(c.isCalculateDesiredSize=!1),c instanceof Zt&&(c.canConsiderBounds=!1,(!o&&"Vertical"===r.shape.orientation&&a||"Vertical"!==r.shape.orientation&&s)&&(c.isLaneOrientation=!0,c.refreshTextElement()))}d.wrapper.measure(new i(void 0,void 0)),d.wrapper.arrange(d.wrapper.desiredSize)}return d.wrapper}function Cr(t,e,i,r,n,o){var a,s=0,h=0,d=i.shape;n?(h=o,s=r,a=t.columnDefinitions()[parseInt(o.toString(),10)].width):s=d.header&&d.hasHeader?o+1:o;var l={annotations:[N(d.phases[parseInt(o.toString(),10)].header.annotation)],maxWidth:a,id:i.id+d.phases[parseInt(o.toString(),10)].id+"_header",addInfo:d.phases[parseInt(o.toString(),10)].addInfo,offsetX:i.offsetX,offsetY:i.offsetY,style:d.phases[parseInt(o.toString(),10)].style,rowIndex:s,columnIndex:h,pivot:i.pivot,container:{type:"Canvas",orientation:n?"Horizontal":"Vertical"}};l["Horizontal"===d.orientation?"height":"width"]=d.phaseSize,l.annotations[0].rotateAngle=n?0:270,_i(i)||(l.constraints&=~ht.Select),d.phases[parseInt(o.toString(),10)].header.id=l.id;var c=Pr(e,0,i,l,!1,!0,!1,d.phases[parseInt(o.toString(),10)].id);t.addObject(c,s,h)}function Tr(t,e,i,r,n,o){for(var a,s,h,d,l,c=i.shape,p=c.phases.length||1,g=c.header&&c.hasHeader?1:0,u=o?r:g,f=c.phaseSize&&c.phases.length>0?1:0,m=0;m<p;m++){var y=o?m:n+f;if(h=t.rows[parseInt(u.toString(),10)].cells[parseInt(y.toString(),10)],d={id:i.id+c.lanes[parseInt(n.toString(),10)].id+m,rowIndex:u,columnIndex:y,width:h.minWidth,height:h.minHeight,offsetX:i.offsetX,offsetY:i.offsetY,style:c.lanes[parseInt(n.toString(),10)].style,addInfo:c.lanes[parseInt(n.toString(),10)].addInfo,pivot:i.pivot,constraints:ht.Default|ht.ReadOnly|ht.AllowDrop,container:{type:"Canvas",orientation:o?"Horizontal":"Vertical"}},_i(i)||(d.constraints&=~ht.Select),s=Pr(e,0,i,d,!1,!1,!0),c.phases&&c.phases.length>0&&c.phases[parseInt(m.toString(),10)]){var v=e.nameTable[c.phases[parseInt(m.toString(),10)].header.id];v&&v.laneGrids.splice(n,0,d.id)}s.children[0].isCalculateDesiredSize=!1,0===m&&((a={id:i.id+c.lanes[parseInt(n.toString(),10)].id+"_"+m+"_header",style:c.lanes[parseInt(n.toString(),10)].header.style,annotations:[N(c.lanes[parseInt(n.toString(),10)].header.annotation)],offsetX:i.offsetX,offsetY:i.offsetY,rowIndex:u,columnIndex:y,pivot:i.pivot,container:{type:"Canvas",orientation:o?"Horizontal":"Vertical"}}).annotations[0].rotateAngle=o?270:0,c.lanes[parseInt(n.toString(),10)].header.id=a.id,o?a.width=c.lanes[n].header.width:a.height=c.lanes[parseInt(n.toString(),10)].header.height,_i(i)||(a.constraints&=~ht.Select),l=Pr(e,0,i,a,!1,!1,!0,c.lanes[parseInt(n.toString(),10)].id),o&&(l.children[0].elementActions=l.children[0].elementActions|dt.HorizontalLaneHeader),s.children.push(l)),t.addObject(s,u,y),o||u++,y=o?m:n+1}}function Ar(t,e){var i=new vr;i.height=e,t.push(i)}function Or(t){var e=new br;return e.width=t,e}function Dr(t,e,i,r){for(var n,o,a,s,h,d,l,c=[],p=0,g=e.rowDefinitions().length,u=0;u<g;u++)for(d=e.rows[parseInt(u.toString(),10)],s=0;s<d.cells.length;s++)if((h=d.cells[parseInt(s.toString(),10)].children[0])&&h.children&&h.children.length)for(a=1;a<h.children.length;a++)if(n=h.children[parseInt(a.toString(),10)],(o=t.getObject(n.id))&&(o.inEdges.length>0||o.outEdges.length>0))for(l=o.inEdges.concat(o.outEdges),p=0;p<l.length;p++)-1===c.indexOf(l[parseInt(p.toString(),10)])&&c.push(l[parseInt(p.toString(),10)]);return c}function Mr(t){var e=t.wrapper;if(e.measure(new i(t.width,t.height)),e.children[0]instanceof yr){var r=e.children[0],n=!1;(r.width&&r.width<r.desiredSize.width||void 0===r.width&&void 0!==r.desiredSize.width)&&(n=!0,r.width=r.desiredSize.width),(r.height&&r.height<r.desiredSize.height||void 0===r.height&&void 0!==r.desiredSize.height)&&(n=!0,r.height=r.desiredSize.height),n&&r.measure(new i(r.width,r.height))}e.arrange(e.desiredSize)}function Lr(t,e,i){var r,n,o,a,s,h,d,l,c,p=e.wrapper.children[0];for(r=i;r<p.rows.length;r++)for(d=p.rows[parseInt(r.toString(),10)],n=0;n<d.cells.length;n++)if((l=d.cells[parseInt(n.toString(),10)]).children&&l.children.length>0)for(o=0;o<l.children.length;o++){if(c=l.children[parseInt(o.toString(),10)],(s=t.nameTable[c.id]).isLane&&c.children.length>1)for(a=1;a<c.children.length;a++)(h=t.nameTable[c.children[parseInt(a.toString(),10)].id])&&h.isLane&&(h.rowIndex=r,h.columnIndex=n);s.rowIndex=r,s.columnIndex=n}}function Er(t,e){var r,n,o,a,s,h,d,l,c=e.wrapper.children[0],p=e.shape,g=p.padding,u=p.lanes,f=c.bounds.y,m=p.phaseSize>0?p.phases.length:0,y="Horizontal"===p.orientation,v=y?p.phases.length||1:u.length+1,b=y?(p.header&&p.hasHeader?1:0)+(p.phases.length>0?1:0)+p.lanes.length:(p.header&&p.hasHeader?1:0)+p.phases.length;if(0===m&&!y&&p.lanes.length&&(b+=1),y?(r=(p.header&&p.hasHeader?1:0)+(m>0?1:0),n=0):(r=p.header&&p.hasHeader?1:0,n=m>0?1:0),u.length>0)for(f+=p.header&&p.hasHeader?p.header.height:0,h=0;h<u.length;h++){for(d=0;d<u[parseInt(h.toString(),10)].children.length;d++)if((o=u[parseInt(h.toString(),10)].children[parseInt(d.toString(),10)]).offsetX=u[parseInt(h.toString(),10)].width,o.offsetY=u[parseInt(h.toString(),10)].height,t.initObject(o),t.nodes.push(o),a=o.wrapper,y){for(l=n;l<v;l++)if(s=c.rows[parseInt(r.toString(),10)].cells[parseInt(l.toString(),10)],a.margin.left<s.bounds.right-c.bounds.x){o.parentId=s.children[0].id,l>n?a.margin.left=a.margin.left-(s.bounds.left-c.bounds.left):s.children[0].children[1].actualSize.width+g>=a.margin.left&&(a.margin.left=s.children[0].children[1].actualSize.width+g),a.margin.left<g&&(a.margin.left=g),a.margin.top<g&&(a.margin.top=g),zr(a,o,t);break}}else for(var S=r;S<b;S++)if(s=c.rows[parseInt(S.toString(),10)].cells[parseInt(n.toString(),10)],a.margin.top<s.bounds.bottom-f){o.parentId=s.children[0].id,S>r?a.margin.top=a.margin.top-(s.bounds.top-f):s.children[0].children[1].actualSize.height+g>=a.margin.top&&(a.margin.top=s.children[0].children[1].actualSize.height+g),a.margin.left<g&&(a.margin.left=g),a.margin.top<g&&(a.margin.top=g),zr(a,o,t);break}y?r++:n++}c.measure(new i(e.width,e.height)),c.arrange(c.desiredSize),function(t,e){var i,r,n,o,a,s,h=t.columnDefinitions(),d=t.rowDefinitions(),l=_r(e);"Vertical"===e.shape.orientation&&0===l&&(l=e.shape.header&&e.shape.hasHeader?1:0);var c=e.shape.padding;for(i=0;i<h.length;i++)t.updateColumnWidth(i,h[parseInt(i.toString(),10)].width,!0,c);for(i=l;i<d.length;i++)t.updateRowHeight(i,d[parseInt(i.toString(),10)].height,!0,c);for(r=0;r<d.length;r++)for(s=t.rows[parseInt(r.toString(),10)],i=0;i<h.length;i++)if((o=s.cells[parseInt(i.toString(),10)]).children&&o.children.length>0)for(n=0;n<o.children.length;n++)(a=o.children[parseInt(n.toString(),10)]).maxWidth&&(a.maxWidth=o.actualSize.width),a.maxHeight&&(a.maxHeight=o.actualSize.height)}(c,e),e.width=e.wrapper.width=c.width,e.height=e.wrapper.height=c.height,Fr(t,e),e.wrapper.measure(new i(e.width,e.height)),e.wrapper.arrange(c.desiredSize),function(t){if("SwimLane"===t.shape.type)for(var e=t.shape.lanes,i=void 0,r=void 0,n=0;n<e.length;n++){i=e[parseInt(n.toString(),10)];for(var o=0;o<i.children.length;o++)(r=i.children[parseInt(o.toString(),10)]).offsetX=r.wrapper.offsetX,r.offsetY=r.wrapper.offsetY}}(e),Br(e,t),kr(e)}function zr(t,e,r){t.measure(new i(e.width,e.height)),t.arrange(t.desiredSize);var n=r.getObject(e.parentId);r.addChild(n,e.id)}function kr(t){if("SwimLane"===t.shape.type&&!t.shape.isLane&&!t.shape.isPhase){var e=void 0,i=void 0,r=void 0,n=void 0,o=void 0,a=t.shape.lanes,s=_r(t),h=t.wrapper.children[0].rowDefinitions(),d=t.wrapper.children[0].columnDefinitions(),l=void 0,c=void 0;for(i=0;i<a.length;i++,s++)if(e=a[parseInt(i.toString(),10)],"Horizontal"===t.shape.orientation)for(o=h[parseInt(s.toString(),10)].height,e.height!==o&&(e.height=o),r=0;r<d.length;r++)l=d[parseInt(r.toString(),10)].width,e.width!==l&&(e.width=l);else for(o=d[parseInt(s.toString(),10)].width,e.width!==o&&(e.width=o),n=0;n<h.length;n++)c=h[parseInt(n.toString(),10)].height,e.height!==c&&(e.height=c)}}function Br(t,e){var i,r,n,o,a=t.shape,s=a.phases,h=a.header&&a.hasHeader?1:0,d=t.wrapper.children[0],l=d.bounds.y+(a.header&&a.hasHeader?a.header.height:0);if("SwimLane"===t.shape.type&&(t=e.getObject(t.id)||t,s.length>0))if(d=t.wrapper.children[0],"Horizontal"===a.orientation)for(n=a.header&&a.hasHeader?d.rows[1]:d.rows[0],i=0;i<s.length;i++)r=(o=n.cells[parseInt(i.toString(),10)].children[0]).bounds.right-d.bounds.x,s[parseInt(i.toString(),10)].offset!==r&&(s[parseInt(i.toString(),10)].offset=r),e.nameTable[o.id].maxWidth=o.maxWidth;else for(i=0;i<s.length;i++)r=(o=d.rows[h+i].cells[0].children[0]).bounds.bottom-l,s[parseInt(i.toString(),10)].offset!==r&&(s[parseInt(i.toString(),10)].offset=r),e.nameTable[o.id].maxWidth=o.maxWidth}function Rr(t,e){if(t&&t.length>0){var i=void 0;e.lineRoutingModule&&e.constraints&ct.LineRouting&&(e.avoidLineOverlappingModule&&e.avoidLineOverlappingModule.removeConnectors(t),e.lineRoutingModule.renderVirtualRegion(e,!0));for(var r=0;r<t.length;r++)i=e.getObject(t[parseInt(r.toString(),10)]),e.lineRoutingModule&&e.constraints&ct.LineRouting&&"Orthogonal"===i.type?e.lineRoutingModule.refreshConnectorSegments(e,i,!0):e.connectorPropertyChange(i,{},{sourceID:i.sourceID,targetID:i.targetID})}}function Nr(t,e,r,n){var o,a,s,h,d,l,c,p,g=t.getObject(e.parentId),u=g.shape,f=g.wrapper.children[0],m=u.lanes,y=Dr(t,f,e.rowIndex);if("Horizontal"===u.orientation&&e.rowIndex!==r.rowIndex||"Vertical"===u.orientation&&e.columnIndex!==r.columnIndex){if("Horizontal"===u.orientation)h=e.rowIndex,d=r.rowIndex,o=(u.header&&u.hasHeader?1:0)+(u.phases.length&&u.phaseSize?1:0),c=e.rowIndex-o,p=r.rowIndex-o,m[parseInt(c.toString(),10)].canMove&&(c<p?n&&r.wrapper.offsetY>n.y&&(d+=p>0?-1:1,p+=p>0?-1:1):n&&r.wrapper.offsetY<n.y&&(d+=1,p+=1),h!==d&&(f.updateRowIndex(h,d),jr(c,p,g,t)));else if(h=e.columnIndex,d=r.columnIndex,o=u.phases.length&&u.phaseSize?1:0,c=e.columnIndex-o,p=r.columnIndex-o,u.header&&u.hasHeader?1:0,m[parseInt(c.toString(),10)].canMove&&(c<p?n&&r.wrapper.offsetX>n.x&&(d+=p>0?-1:1,p+=p>0?-1:1):n&&r.wrapper.offsetX<n.x&&(d+=1,p+=1),h!==d)){if(!(0!==u.phaseSize&&0!==u.phases.length||0!==d&&0!==h)&&u.header&&u.hasHeader){var v=0===d?h:d;f.rows[0].cells[parseInt(v.toString(),10)].children=f.rows[0].cells[0].children,f.rows[0].cells[parseInt(v.toString(),10)].columnSpan=f.rows[0].cells[0].columnSpan,f.rows[0].cells[0].children=[]}f.updateColumnIndex(0,h,d),jr(c,p,g,t)}h!==d&&(l=m[parseInt(c.toString(),10)]).canMove&&(a={target:N(r),source:N(e)},l=m[parseInt(c.toString(),10)],m.splice(c,1),m.splice(p,0,l),s={type:"LanePositionChanged",redoObject:{target:N(a.source),source:N(a.target)},undoObject:a,category:"Internal"},t.diagramActions&yt.UndoRedo||t.commandHandler.addHistoryEntry(s),Lr(t,g,0),Rr(y,t),function(t,e){for(var i,r,n=0;n<t.length;n++){i=t[parseInt(n.toString(),10)];for(var o=0;o<i.children.length;o++)(r=e.nameTable[i.children[parseInt(o.toString(),10)].id]).offsetX=r.wrapper.offsetX,r.offsetY=r.wrapper.offsetY}}(m,t),g.wrapper.measure(new i(g.width,g.height)),g.wrapper.arrange(g.wrapper.desiredSize),t.updateDiagramObject(g))}t.updateDiagramElementQuad()}function jr(t,e,i,r){var n=i.shape.phases;if(n&&n.length>0)for(var o=0;o<n.length;o++){var a=i.id+n[parseInt(o.toString(),10)].id+"_header",s=r.nameTable[""+a];if(s&&s.laneGrids&&t>=0&&e>=0&&t<s.laneGrids.length&&e<s.laneGrids.length){var h=s.laneGrids.splice(t,1)[0];s.laneGrids.splice(e,0,h)}}}function Hr(t,e,i,r,n,o){var a,s,h=t.getObject(i.id),d=h.shape,l=d.header&&d.hasHeader?1:0,c=d.lanes,p=d.phases,g=r.wrapper.actualSize.width,u=r.wrapper.actualSize.height,f=(e.wrapper.actualSize.width,e.wrapper.actualSize.height,!1);t.diagramActions&yt.UndoRedo&&(f=!0);var m=h.wrapper.children[0];if("SwimLane"===h.shape.type)if("Horizontal"===d.orientation)if(e.isPhase){for(var y=e.columnIndex;y<p.length;y++){if(p[parseInt(y.toString(),10)].offset+=n,b=t.nameTable[p[parseInt(y.toString(),10)].header.id]){var v=m.rows[b.rowIndex].cells[b.columnIndex].minWidth;p[parseInt(y.toString(),10)].offset<v&&!f&&(p[parseInt(y.toString(),10)].offset=v)}}for(a=0;a<c.length;a++)c[parseInt(a.toString(),10)].width=f?g:e.wrapper.width}else l=d.phaseSize&&d.phases.length>0?l+1:l,c[e.rowIndex-l].height=f?u:e.wrapper.height;else if(e.isPhase){for(y=e.rowIndex-l;y<p.length;y++){var b;if(p[parseInt(y.toString(),10)].offset+=o,b=t.nameTable[p[parseInt(y.toString(),10)].header.id]){var S=m.rows[b.rowIndex].cells[b.columnIndex].minHeight;p[parseInt(y.toString(),10)].offset<S&&!f&&(p[parseInt(y.toString(),10)].offset=S)}}for(s=0;s<c.length;s++)c[parseInt(s.toString(),10)].height=e.wrapper.height}else l=d.phaseSize&&d.phases.length>0?1:0,c[e.columnIndex-l].width=e.wrapper.width}function Wr(t,e){var i,r=t.shape,n=r.header&&r.hasHeader?1:0;return"Horizontal"===r.orientation?(n+=r.phases.length>0?1:0,i=e.rowIndex-n):i=e.columnIndex-(r.phaseSize&&r.phases.length>0?1:0),i}function _r(t){var e=0,i=t.shape;return"Horizontal"===i.orientation&&(e=i.header&&i.hasHeader?1:0),i.phases.length>0&&i.phaseSize&&(e+=1),e}function Yr(t,e,i,r){var n=t.shape;if(n.phases.length>0){var o=e.nameTable[n.phases[parseInt(r.toString(),10)].header.id];o&&o.maxWidth<i.outerBounds.width&&(o.maxWidth=i.outerBounds.width,o.wrapper.maxWidth=i.outerBounds.width)}}function Fr(t,e){if(e.shape.header&&e.shape.hasHeader){var i=e.wrapper.children[0].rows[0].cells[0].children[0].id,r=t.nameTable[""+i];r&&r.isHeader&&(r.maxWidth<e.width||r.wrapper.maxWidth<e.width)&&(r.maxWidth=e.width,r.wrapper.maxWidth=e.width)}}function Xr(t,e,i,r){var n,o=t.nameTable[e.id];if("SwimLane"===o.shape.type){t.protectPropertyChange(!0);var a=o.wrapper.children[0],s=a.bounds,h=o.shape,d=void 0,l=!1,c=void 0,p=void 0,g=void 0,u=void 0,f=void 0,m=void 0,y=void 0,v=void 0,b=new Xh(h,"lanes",i,!0);i.height=i.height||b.height,i.width=i.width||b.width,p="Vertical"===h.orientation||h.header&&h.hasHeader?1:0,"Horizontal"===h.orientation&&(l=!0,p=h.phases.length>0?p+1:p);var S=Dr(t,a),w=void 0!==r?r:h.lanes.length;if(p+=w,n={element:b,cause:t.diagramActions,diagramAction:t.itemType,state:"Changing",type:"Addition",cancel:!1,laneIndex:w},t.triggerEvent(xt.collectionChange,n),!n.cancel){if(l){var x=new vr;x.height=i.height,a.addRow(p,x,!1),o.height=void 0!==o.height?o.height+i.height:o.height,o.wrapper.height=a.height=o.height}else{var I=new br;I.width=i.width,a.addColumn(w+1,I,!1),o.width&&(o.width+=i.width,o.wrapper.width=a.width=o.width),h.hasHeader&&(a.rows[0].cells[0].columnSpan+=1)}t.diagramActions&yt.UndoRedo||(b.id=""===b.id?E():b.id),void 0!==r?h.lanes.splice(r,0,b):h.lanes.push(b),n={element:b,cause:t.diagramActions,diagramAction:t.itemType,state:"Changed",type:"Addition",cancel:!1,laneIndex:w},t.triggerEvent(xt.collectionChange,n),Tr(a,t,o,p,w,l),d="Horizontal"===h.orientation?t.nameTable[a.rows[parseInt(p.toString(),10)].cells[0].children[0].id]:h.header&&h.hasHeader?t.nameTable[a.rows[1].cells[parseInt(p.toString(),10)].children[0].id]:t.nameTable[a.rows[0].cells[parseInt(p.toString(),10)].children[0].id],t.diagramActions&yt.UndoRedo||(c={type:"LaneCollectionChanged",changeType:"Insert",undoObject:N(b),redoObject:N(d),category:"Internal"},t.addHistoryEntry(c)),Lr(t,o,"Horizontal"===h.orientation?p:h.header&&h.hasHeader?1:0),Mr(o),Fr(t,o);if((g=i.children)&&g.length>0)for(u=0;u<g.length;u++){v={x:(y=g[parseInt(u.toString(),10)]).wrapper.offsetX,y:y.wrapper.offsetY};var P={left:0,right:0,top:0,bottom:0};if("Horizontal"===h.orientation)for(P.bottom=s.y-a.bounds.y,a.rows[parseInt(p.toString(),10)].cells[parseInt(u.toString(),10)],f=0;f<a.rows[parseInt(p.toString(),10)].cells.length;f++)Vr(t,a.rows[parseInt(p.toString(),10)].cells[parseInt(f.toString(),10)],v,y,P);else t:for(var C=0;C<=a.rows.length;C++)for(m=0;m<a.rows[parseInt(C.toString(),10)].cells.length;m++)if(P.right=s.x-a.bounds.x,Vr(t,a.rows[parseInt(C.toString(),10)].cells[parseInt(m.toString(),10)],v,y,P))break t}Rr(S,t),t.drag(o,s.x-a.bounds.x,s.y-a.bounds.y)}t.itemType="PublicMethod",t.protectPropertyChange(!1)}}function Vr(t,e,i,r,n){var o=!1;if(e.children&&e.children.length>0){var a=e.children[0],s=t.nameTable[a.id];(function(t,e,i){var r=i.left||0,n=i.right||0,o=i.top||0,a=i.bottom||0;return t.left-r<=e.x&&t.right+n>=e.x&&t.top-o<=e.y&&t.bottom+a>=e.y})(a.bounds,i,n)&&(t.addChild(s,r),o=!0)}return o}function Ur(t,e,i){if("SwimLane"===e.shape.type){var r=void 0,n=void 0,o=void 0,a=void 0,s=void 0,h=void 0,d=void 0,l=e.wrapper.bounds.x,c=e.wrapper.bounds.y,p=e.shape,g=p.padding,u=p.phases,f=void 0,m=e.wrapper.children[0],y="Horizontal"===p.orientation;r=p.header&&p.hasHeader?0:-1,p.phases.length>0&&(r+=1,0);var v=y?p.lanes[0].header.width:p.lanes[0].header.height;if(i.offset>v){for(d=0;d<u.length;d++)if(o=u[parseInt(d.toString(),10)],a=d>0?u[d-1]:o,o.offset>i.offset){if(f=d>0?i.offset-a.offset:i.offset,y){var b=m.columnDefinitions()[parseInt(d.toString(),10)];b.width-=f,(s=t.nameTable[p.phases[parseInt(d.toString(),10)].header.id]).maxWidth=s.wrapper.maxWidth=b.width,m.updateColumnWidth(d,b.width,!1);var S=new br;S.width=f,h=d,m.addColumn(d,S,!1);break}var w=m.rowDefinitions()[d+r];w.height-=f,s=t.nameTable[p.phases[parseInt(d.toString(),10)].header.id],m.updateRowHeight(d+r,w.height,!1);var x=new vr;x.height=f,h=d,m.addRow(d+r,x,!1);break}if(t.diagramActions&yt.UndoRedo&&void 0===h)(M=t.historyManager.currentEntry.next).isLastPhase&&function(t,e,i,r,n){var o=e.shape,a=o.phases[t-2],s=i.previousPhase.offset;if(n){var h=r.columnDefinitions()[t-1],d=new br;t>1?(d.width=h.width-(s-a.offset),h.width=s-a.offset):(d.width=h.width-s,h.width=s),r.updateColumnWidth(t-1,h.width,!1),r.addColumn(t,d,!1)}else{h=r.rowDefinitions()[parseInt(t.toString(),10)];var l=new vr;t>1?(l.height=i.undoObject.offset-s,h.height=s-a.offset):(l.height=h.height-s,h.height=s),r.updateRowHeight(t,h.height,!1),r.addRow(1+t,l,!1)}}(h=u.length,e,M,m,y);if(h>=0){var I=new Vh(e.shape,"phases",i,!0);if(t.diagramActions&yt.UndoRedo||(I.id+=E()),p.phases.splice(h,0,I),Cr(m,t,e,r,y,h),y){if(n=t.nameTable[m.rows[parseInt(r.toString(),10)].cells[parseInt(h.toString(),10)].children[0].id],0===h&&p.header&&p.hasHeader){m.rows[0].cells[0].children=m.rows[0].cells[1].children,m.rows[0].cells[1].children=[];for(var P=m.rows[0],C=0;C<P.cells.length;C++)P.cells[parseInt(C.toString(),10)].minWidth=void 0,P.cells[parseInt(C.toString(),10)].columnSpan=0===C?m.rows[0].cells.length:1}!function(t,e,i,r,n,o){var a,s,h=e.shape,d=_r(e);h.header&&h.hasHeader&&(i.rows[0].cells[0].columnSpan=i.rows[0].cells.length);for(a=d;a<i.rows.length;a++)Gr(t,e,(s=i.rows[parseInt(a.toString(),10)]).cells[r-1],s.cells[parseInt(r.toString(),10)],s.cells[r+1],a,r,o);Lr(t,e,1)}(t,e,m,h,0,i);var T=m.columnDefinitions();if(m.updateColumnWidth(h,T[parseInt(h.toString(),10)].width,!0,g),n.maxWidth=n.wrapper.maxWidth=T[parseInt(h.toString(),10)].width,T.length>h+1){var A=t.nameTable[m.rows[parseInt(r.toString(),10)].cells[h+1].children[0].id];m.updateColumnWidth(h+1,T[h+1].width,!0,g),A.maxWidth=A.wrapper.maxWidth=T[h+1].width}e.width=e.wrapper.width=e.wrapper.children[0].width=m.width}else{n=t.nameTable[m.rows[r+h].cells[0].children[0].id];var O=m.rowDefinitions(),D=O[r+h].height;!function(t,e,i,r,n,o){for(var a,s,h=i.rows[parseInt(r.toString(),10)],d=i.rows[r+1],l=i.rows[r-1],c=1;c<h.cells.length;c++)a=h.cells[parseInt(c.toString(),10)],s=d?d.cells[parseInt(c.toString(),10)]:void 0,Gr(t,e,l?l.cells[parseInt(c.toString(),10)]:void 0,a,s,r,c,o);Lr(t,e,1)}(t,e,m,r+h,0,i),m.updateRowHeight(r+h,D,!0,g),O.length>r+h+1&&(D=O[r+h+1].height,m.updateRowHeight(r+h+1,D,!0,g)),e.height=e.wrapper.height=e.wrapper.children[0].height=m.actualSize.height}if(Mr(e),e.width=e.wrapper.actualSize.width,Fr(t,e),t.drag(e,l-e.wrapper.bounds.x,c-e.wrapper.bounds.y),Br(e,t),t.commandHandler.select(n),!(t.diagramActions&yt.UndoRedo)){var M={type:"PhaseCollectionChanged",changeType:"Insert",undoObject:N(I),redoObject:N(n),category:"Internal"};t.addHistoryEntry(M)}t.updateDiagramObject(e)}}}}function Gr(t,e,i,r,n,o,a,s){var h,d,l,c=e.shape,p="Horizontal"===c.orientation,g=e.wrapper.children[0],u=r.desiredCellWidth,f=r.desiredCellHeight,m=p?e.shape.hasHeader?o:o+1:a;i?(h=p?i.bounds.x+i.bounds.width:i.bounds.x,d=p?i.bounds.y:i.bounds.y+i.bounds.height):(h=g.bounds.x,d=n.bounds.y),!p&&n&&n.bounds&&(h=n.bounds.x,d=n.bounds.y);for(var y=new w(h,d,u,f),v=e.shape.hasHeader?o-1:o,b=e.id+(p?c.lanes[m-2]:c.lanes[m-1]).id,S=(p?a-1:v-1).toString()+(p?a:v).toString(),x=b+S;Object.prototype.hasOwnProperty.call(t.nameTable,x);)x=b+(S=(p?a-1:v-1).toString()+S);var I={id:x,rowIndex:o,columnIndex:a,width:r.minWidth,height:r.minHeight,style:(p?c.lanes[m-2]:c.lanes[m-1]).style,constraints:ht.Default|ht.AllowDrop,container:{type:"Canvas",orientation:p?"Horizontal":"Vertical"}},P=c.hasHeader?0:-1;if(s.laneGrids&&s.laneGrids.length>0){var C=p?o-(2+P):a-1;t.nameTable[s.laneGrids[parseInt(C.toString(),10)]]||(I.id=s.laneGrids[parseInt(C.toString(),10)])}var T=p?a:o-1;if(c.phases[parseInt(T.toString(),10)]){var A=t.nameTable[c.phases[parseInt(T.toString(),10)].header.id];A&&A.laneGrids.push(I.id)}var O=Pr(t,0,e,I,!1,!1,!0);if(O.children[0].isCalculateDesiredSize=!1,g.addObject(O,o,a),n&&n.children&&n.children.length)for(l=0;l<n.children.length;l++)p?t.nameTable[n.children[parseInt(l.toString(),10)].id].columnIndex+=1:t.nameTable[n.children[parseInt(l.toString(),10)].id].rowIndex+=1;!function(t,e,i,r,n,o,a){var s,h,d,l=t.nameTable[n.id],c=e||a,p=t.nameTable[l.parentId],g=p.shape.padding;if(c.children&&c.children[0].children.length>1)for(var u=1;u<c.children[0].children.length;u++)s=c.children[0].children[parseInt(u.toString(),10)],d=t.nameTable[s.id],h=o?{x:s.bounds.x,y:s.bounds.center.y}:{x:s.bounds.center.x,y:s.bounds.top},r.containsPoint(h)?(i.children[0].children.push(s),c.children[0].children.splice(u,1),u--,t.deleteChild(d,void 0,!0),d.isLane||(d.parentId=n.id),l.children||(l.children=[]),e||(o?d.margin.left=d.wrapper.bounds.x-c.children[0].bounds.right:d.margin.top=d.wrapper.bounds.y-c.children[0].bounds.bottom),l.children.push(s.id),d.zIndex=l.zIndex+1,t.removeElements(d)):e&&(o?(d.margin.left-=i.desiredCellWidth,g>d.margin.left&&(d.margin.left=g)):(d.margin.top-=i.desiredCellHeight,g>d.margin.top&&(d.margin.top=g)))}(t,n,r,y,O,p,i)}function Zr(t,e,i){if("SwimLane"===e.shape.type&&("ResizeSouth"===i||"ResizeEast"===i)){var r=e.shape,n=e.wrapper.children[0],o=void 0,a=void 0;"ResizeSouth"===i?"Vertical"===r.orientation?o=n.rows[n.rows.length-1].cells[0]:(a=n.rows.length-1,o=n.rows[parseInt(a.toString(),10)].cells[n.rows[parseInt(a.toString(),10)].cells.length-1]):(a=r.header&&r.hasHeader?1:0,o=n.rows[parseInt(a.toString(),10)].cells[n.rows[parseInt(a.toString(),10)].cells.length-1]),t.commandHandler.select(t.nameTable[o.children[0].id])}}function qr(t,e,i,r,n,o){var a,s,h,d,l,c,p,g=E(),u=t.shape,f=u.phases,m=t.offsetX-t.wrapper.actualSize.width/2,y=t.offsetY-t.wrapper.actualSize.height/2,v=[];if("Vertical"===u.orientation&&(y+=u.header&&u.hasHeader?u.header.height:0),!o)for(n||(t.id+=g,u&&u.header&&u.hasHeader?u.header.id+=g:u.header=void 0),a=0;f&&a<f.length;a++)f[parseInt(a.toString(),10)].id+=g;var b=n?[i.childTable[r.id]]:u.lanes;for(a=0;b&&a<b.length;a++)for(h=b[parseInt(a.toString(),10)],o||(h.id+=g),s=0;h.children&&s<h.children.length;s++)d=h.children[parseInt(s.toString(),10)],v.push(d.id),c=d.wrapper.offsetX-d.width/2,p=d.wrapper.offsetY-d.height/2,d.zIndex=Number.MIN_VALUE,d.inEdges=d.outEdges=[],(o||i&&(1===i.pasteIndex||0===i.pasteIndex))&&("Vertical"===u.orientation?d.margin.top=p-y:d.margin.left=c-m),o||(d.id+=g);if(!o){if(n){if(l={shape:{lanes:b,phases:f,phaseSize:u.phaseSize,type:"SwimLane",orientation:u.orientation,header:{annotation:{content:"Title"},height:50}}},"Horizontal"===u.orientation){var S=0;u.hasHeader&&(S=u.header.height),l.width=t.wrapper.actualSize.width,l.height=r.wrapper.actualSize.height+S+u.phaseSize,l.offsetX=t.wrapper.offsetX+10*i.pasteIndex,l.offsetY=r.wrapper.offsetY+10*i.pasteIndex}else l.width=r.wrapper.actualSize.width,l.height=t.wrapper.actualSize.height,l.offsetX=r.wrapper.offsetX+10*i.pasteIndex,l.offsetY=t.wrapper.offsetY+10*i.pasteIndex;t=l}if(0!==i.pasteIndex&&(t.offsetX+=10,t.offsetY+=10),e.itemType="Clipboard",t.zIndex=Number.MIN_VALUE,t=e.add(t),!n)for(var w=0,x=Object.keys(i.childTable);w<x.length;w++){var I=x[w],P=i.childTable[""+I];P.parentSwimlaneId&&P.parentSwimlaneId+g===t.id?(P.id+=g,-1!==v.indexOf(P.sourceID)&&(P.sourceID+=g),-1!==v.indexOf(P.targetID)&&(P.targetID+=g),P.zIndex=Number.MIN_VALUE,e.add(P),P.parentSwimlaneId+=g):-1!==v.indexOf(P.sourceID)?P.sourceID+=g:-1!==v.indexOf(P.targetID)&&(P.targetID+=g)}"SVG"!==e.mode&&e.refreshDiagramLayer(),e.select([t])}return t}function Qr(t,e,r,n){var o,a=e.nodes[0];if(n||un(t,a,!0)){var s=void 0,h=void 0,d=void 0,l=new Xt;r&&(d=t.nameTable[""+r].parentId,s=a=t.nameTable[""+r]);var c=r?s.wrapper:a.wrapper,p=t.nameTable[d||a.parentId];p&&"Grid"===p.container.type&&((o=new te).children=[],!n&&a.isHeader||("Horizontal"===p.container.orientation&&a.isPhase||"Vertical"===p.container.orientation&&(a.rowIndex>0&&a.columnIndex>0||a.isLane)?(h=cn(p,s?s.columnIndex:a.columnIndex,!(!p.shape.header||!p.shape.hasHeader)),o.offsetX=h.center.x,o.offsetY=h.center.y,l.width=h.width,l.height=h.height):(o.offsetX=p.offsetX,o.offsetY=c.offsetY,l.width=p.wrapper.actualSize.width,l.height=c.actualSize.height),("Vertical"===p.container.orientation&&a.isPhase||"Horizontal"===p.container.orientation&&a.isLane)&&(o.pivot=a.pivot)),o.children.push(l),o.measure(new i),o.arrange(o.desiredSize))}return o}function Kr(t,e,i,r,n){n=void 0!==n?n:Wr(e,i);for(var o=!1,a=e.shape.lanes[parseInt(n.toString(),10)],s=a.children.length-1;s>=0;s--)r?r.id===a.children[parseInt(s.toString(),10)].id&&a.children.splice(s,1):(t.removeDependentConnector(a.children[parseInt(s.toString(),10)]),t.diagramActions&yt.UndoRedo||(t.diagramActions=t.diagramActions|yt.UndoRedo,o=!0),t.remove(a.children[parseInt(s.toString(),10)]),a.children.splice(s,1),o&&(t.diagramActions=t.diagramActions&~yt.UndoRedo))}function Jr(t){return t.children[0]}function $r(t,e){e&&(t.nodes.splice(t.nodes.indexOf(e),1),t.removeFromAQuad(e),t.removeObjectsFromLayer(e),delete t.nameTable[e.id],t.removeElements(e))}function tn(t,e,i,r){var n;if("SwimLane"===i.shape.type){var o=i.shape,a=void 0;if(1===o.lanes.length)t.remove(i);else{var s=i.wrapper.bounds.x,h=i.wrapper.bounds.y,d=void 0,l=void 0,c=void 0,p=void 0,g=void 0,u=i.wrapper.children[0];if(a=r?o.lanes.indexOf(r):Wr(i,e),n={element:e,cause:t.diagramActions,diagramAction:t.itemType,state:"Changing",type:"Removal",cancel:!1,laneIndex:a},t.triggerEvent(xt.collectionChange,n),!n.cancel){var f=o.lanes[parseInt(a.toString(),10)],m=f.children;f.children=[];for(var y=0;y<m.length;y++){var v=t.getObject(m[parseInt(y.toString(),10)].id);v&&f.children.push(v)}var b=N(o.lanes[parseInt(a.toString(),10)]);if(Kr(t,i,e,void 0,a),!(t.diagramActions&yt.UndoRedo)){var S={type:"LaneCollectionChanged",changeType:"Remove",undoObject:b,redoObject:N(e),category:"Internal"};t.addHistoryEntry(S)}o.lanes.splice(a,1);var w=e?"Horizontal"===o.orientation?e.rowIndex:e.columnIndex:_r(i)+a;if("Horizontal"===o.orientation){for(d=u.rows[parseInt(w.toString(),10)],l=0;l<d.cells.length;l++)if((c=d.cells[parseInt(l.toString(),10)])&&c.children.length>0)for(p=0;p<c.children.length;p++)rn(t,g=c.children[parseInt(p.toString(),10)]),en(g,i,t);u.removeRow(w)}else{for(i.width=void 0!==i.width?i.width-u.rows[0].cells[parseInt(w.toString(),10)].actualSize.width:i.width,l=0;l<u.rows.length;l++)if((c=u.rows[parseInt(l.toString(),10)].cells[parseInt(w.toString(),10)])&&c.children.length>0)for(p=0;p<c.children.length;p++)rn(t,g=c.children[parseInt(p.toString(),10)]),en(g,i,t);u.removeColumn(w)}n={element:e,cause:t.diagramActions,diagramAction:t.itemType,state:"Changed",type:"Removal",cancel:!1,laneIndex:a},t.triggerEvent(xt.collectionChange,n),i.width=i.wrapper.width=u.width,i.height=i.wrapper.height=u.height,Mr(i),"Vertical"===i.shape.orientation&&(w=0),Lr(t,i,w),t.drag(i,s-i.wrapper.bounds.x,h-i.wrapper.bounds.y),t.updateDiagramObject(i)}}}}function en(t,e,i){var r=t.id,n=e.shape.phases;if(n&&n.length>0)for(var o=0;o<n.length;o++){var a=e.id+n[parseInt(o.toString(),10)].id+"_header",s=i.nameTable[""+a],h=s.laneGrids.indexOf(r);-1!==h&&s.laneGrids.splice(h,1)}}function rn(t,e){var i,r;if(e instanceof te){if(e.children.length>0)for(i=0;i<e.children.length;i++)e.children[parseInt(i.toString(),10)]instanceof te&&rn(t,e.children[parseInt(i.toString(),10)]);r=t.getObject(e.id),$r(t,r)}}function nn(t,e,i,r){t.protectPropertyChange(!0);i.wrapper.bounds.x,i.wrapper.bounds.y;var n,o=!1,a=i.shape,s=i.wrapper.children[0],h=r?a.phases.indexOf(r):function(t,e){var i=e.shape,r=i.header&&i.hasHeader?1:0;return"Horizontal"===i.orientation?t.columnIndex:t.rowIndex-r}(e,i),d=a.phases.length;if(a.phases.length>1){h===d-1&&(o=!0,n=N(a.phases[h-1]));var l=N(a.phases[parseInt(h.toString(),10)]);if(a.phases.splice(h,1),!(t.diagramActions&yt.UndoRedo)){var c={type:"PhaseCollectionChanged",changeType:"Remove",undoObject:l,previousPhase:n,redoObject:N(e),category:"Internal",isLastPhase:o};c.undoObject.laneGrids=e.laneGrids,c.redoObject.laneGrids=e.laneGrids,t.addHistoryEntry(c)}"Horizontal"===a.orientation?function(t,e,i,r){var n,o,a,s,h,d,l,c,p,g,u,f;for(r=void 0!==r?r:i.columnIndex,l=0;l<e.rows.length;l++)if((n=e.rows[parseInt(l.toString(),10)]).cells.length>1&&(o=n.cells[parseInt(r.toString(),10)],h=(a=n.cells.length-1===r?n.cells[r-1]:n.cells[r+1]).children[0],o.children.length>0))if(s=o.children[0],u=t.nameTable[s.id],0===a.children.length&&o.children.length>0)a.children=o.children,a.columnSpan=o.columnSpan-1;else{for(c=0;c<s.children.length;c++){if((g=s.children[parseInt(c.toString(),10)])instanceof te){if((f=t.nameTable[g.id]).isLane||(f.parentId=h.id),n.cells.length-1===r&&(f.margin.left=f.wrapper.bounds.x-h.bounds.x,g.margin.left=f.wrapper.bounds.x-h.bounds.x),h.children.push(g),t.nameTable[h.id]){var m=t.nameTable[h.id];m.children||(m.children=[]),m.children.push(g.id)}s.children.splice(c,1),c--,u&&u.children&&-1!==u.children.indexOf(f.id)&&u.children.splice(u.children.indexOf(f.id),1)}if(n.cells.length-1!==r)for(p=0;p<h.children.length;p++){var y=h.children[parseInt(p.toString(),10)];if(y instanceof te){var v=t.nameTable[y.id];v.margin.left=v.wrapper.bounds.x-s.bounds.x,y.margin.left=v.wrapper.bounds.x-s.bounds.x}}}if(u&&u.isPhase){var b=t.nameTable[h.id];b&&(h.maxWidth=b.wrapper.maxWidth=b.wrapper.maxWidth+=u.wrapper.maxWidth)}$r(t,u)}var S=e.columnDefinitions()[parseInt(r.toString(),10)].width;e.removeColumn(r),r<e.columnDefinitions().length?(d=e.columnDefinitions()[parseInt(r.toString(),10)].width,d+=S,e.updateColumnWidth(r,d,!0)):(d=e.columnDefinitions()[r-1].width,d+=S,e.updateColumnWidth(r-1,d,!0))}(t,s,e,h):function(t,e,i,r,n){var o,a,s,h,d,l,c,p,g=n.shape,u=void 0!==r?g.hasHeader&&g.header?r+1:r:i.rowIndex,f=e.rows[parseInt(u.toString(),10)],m=n.wrapper.bounds.y,y=g.phases.length;void 0!==g.header&&g.hasHeader&&(m+=e.rowDefinitions()[0].height);var v=r===y?e.rows[u-1]:e.rows[u+1];for(s=0;s<f.cells.length;s++)if(o=f.cells[parseInt(s.toString(),10)],l=v.cells[parseInt(s.toString(),10)].children[0],o.children.length>0){var b=o.children[0],S=t.nameTable[b.id];if(r<y)for(d=0;d<l.children.length;d++)(c=l.children[parseInt(d.toString(),10)])instanceof te&&((p=t.nameTable[c.id]).margin.top=p.wrapper.bounds.y-(0===r?m:b.bounds.y),c.margin.top=p.wrapper.bounds.y-(0===r?m:b.bounds.y));for(h=0;h<b.children.length;h++)(c=b.children[parseInt(h.toString(),10)])instanceof te&&((p=t.nameTable[c.id]).parentId=l.id,r===y&&(p.margin.top=p.wrapper.bounds.y-(0===r?m:l.bounds.y),c.margin.top=p.wrapper.bounds.y-(0===r?m:l.bounds.y)),l.children.push(c),b.children.splice(h,1),h--,S.children&&-1!==S.children.indexOf(p.id)&&S.children.splice(S.children.indexOf(p.id),1));$r(t,S)}var w=e.rowDefinitions()[parseInt(u.toString(),10)].height;e.removeRow(u),u<e.rowDefinitions().length?(a=e.rowDefinitions()[parseInt(u.toString(),10)].height,a+=w,e.updateRowHeight(u,a,!0)):(a=e.rowDefinitions()[u-1].height,a+=w,e.updateRowHeight(u-1,a,!0))}(t,s,e,h,i),Fr(t,i),Lr(t,i,i.isHeader?1:0),Br(i,t),t.protectPropertyChange(!1),t.updateDiagramObject(i)}}function on(t,e,r){var n=t.nameTable[e.parentId];if(n&&n.isLane){var o=t.nameTable[n.parentId],a=o.wrapper.children[0];t.multiselect||(a.updateColumnWidth(n.columnIndex,a.columnDefinitions()[n.columnIndex].width,!0,r),a.updateRowHeight(n.rowIndex,a.rowDefinitions()[n.rowIndex].height,!0,r));var s=n.wrapper,h=void 0;e.diffX=e.diffX||0,e.diffY=e.diffY||0,e.diffX>0&&(e.margin.left+=e.diffX+r),e.diffY>0&&(e.margin.top+=e.diffY+r),e.margin.left<r&&(e.margin.left=r),e.margin.top<r&&(e.margin.top=r);for(var d=0;d<s.children.length;d++){var l=s.children[parseInt(d.toString(),10)];if(l instanceof te){var c=t.nameTable[l.id];if(c.isLane){h=c.wrapper;break}}}h&&("Horizontal"===o.shape.orientation?e.margin.left<r+h.actualSize.width&&(e.margin.left=r+h.actualSize.width):e.margin.top<r+h.actualSize.height&&(e.margin.top=r+h.actualSize.height)),o.wrapper.measure(new i(o.width,o.height)),o.wrapper.arrange(o.wrapper.desiredSize),e.offsetX=e.wrapper.offsetX,e.offsetY=e.wrapper.offsetY,t.nodePropertyChange(e,{},{margin:{left:e.margin.left,top:e.margin.top}}),e.isResized=!1,a.measure(new i(a.width,a.height)),a.arrange(a.desiredSize),o.width=o.wrapper.width=o.wrapper.children[0].actualSize.width,o.height=o.wrapper.height=o.wrapper.children[0].actualSize.height}}function an(t,e){var i;if(t.isLane){var r=e.getObject(t.parentId);if(r&&"SwimLane"===r.shape.type&&t.isLane){var n=Wr(r,t);i=r.shape.lanes[parseInt(n.toString(),10)]}}return i}function sn(t,e,i){return!(!t.isLane||!e.isLane||t.id===e.id||t.parentId!==e.parentId||an(t,i)!==an(e,i))}function hn(t,e){if(t.isLane){var i=an(t,e);if(e.eventHandler.action.includes("Resize")||i.canMove)return!0}return!1}function dn(t,e,i,r){var n,o=!1;if(un(t,e,!0)){t.protectPropertyChange(!0);var a=(n=t.nameTable[e.parentId]).wrapper;if(t.selectedItems.nodes.length>1?t.multiselect=!0:t.multiselect=!1,n&&"Canvas"===n.container.type){if(r||a.bounds.x<=i.x&&a.bounds.right>=i.x&&a.bounds.y<=i.y&&a.bounds.bottom>=i.y&&!t.multiselect){var s=void 0,h=a.bounds.y,d=a.bounds.x,l=t.nameTable[n.parentId]||n;if("SwimLane"===l.shape.type)o=wn(n,l,e,t,!0);else{var c=t.nameTable[n.parentId]||n,p=c.shape;s=c.wrapper,a.actualSize.width<a.outerBounds.width&&!(a.bounds.x>a.outerBounds.x)&&(void 0!==n.rowIndex?(s.updateColumnWidth(n.columnIndex,a.outerBounds.width,!0),"Horizontal"===p.orientation&&p.phaseSize&&Yr(c,t,a,n.columnIndex),Fr(t,c),t.drag(c,d-a.bounds.x,h-a.bounds.y)):t.scale(n,1+(a.outerBounds.width-a.actualSize.width)/a.actualSize.width,1,a.outerBounds.x<a.bounds.x?{x:1,y:.5}:{x:0,y:.5})),a.actualSize.height<a.outerBounds.height&&!(a.bounds.y>a.outerBounds.y)&&(void 0!==n.rowIndex?(s.updateRowHeight(n.rowIndex,a.outerBounds.height,!0),t.drag(c,d-a.bounds.x,h-a.bounds.y)):t.scale(n,1,1+(a.outerBounds.height-a.actualSize.height)/a.actualSize.height,a.outerBounds.y<a.bounds.y?{x:.5,y:1}:{x:.5,y:0}))}}t.select([e]),Rr([],t)}t.protectPropertyChange(!1)}return o}function ln(t,e,i,r){var n;if(un(t,e,!0)&&!t.cancelPositionChange){var o=t.isProtectedOnChange;t.protectPropertyChange(!0);var a=(n=t.nameTable[e.parentId]).wrapper;if(n&&"Canvas"===n.container.type&&!(r||a.bounds.x<=i.x&&a.bounds.right>=i.x&&a.bounds.y<=i.y&&a.bounds.bottom>=i.y||e.constraints&ht.AllowMovingOutsideLane)){var s=N(e);t.clearSelection(),mn(t,e),e.parentId="",e.parentObj=t,e.propName="nodes";var h={type:"ChildCollectionChanged",category:"Internal",undoObject:s,redoObject:N(e)};t.addHistoryEntry(h),t.commandHandler.isContainer&&(t.commandHandler.isContainer=!1,t.endGroupAction()),bn(e,t)}t.protectPropertyChange(o)}}function cn(t,e,i){for(var r=new w,n="SwimLane"===t.shape.type?t.wrapper.children[0].rows:t.wrapper.rows,o=i?1:0;o<n.length;o++)r.uniteRect(n[parseInt(o.toString(),10)].cells[parseInt(e.toString(),10)].bounds);return r}function pn(t,e){for(var i,r={},n=0,o=Object.keys(e);n<o.length;n++){var a=o[n];r[""+a]=e[""+a]}return vs(e)===Yh&&((i=new Yh(t,"nodes",r,!0)).id=e.id,t.initObject(i)),t.updateDiagramObject(i),i}function gn(t,i){var r,n,o;if(t.enableServerDataBinding(!1),!(0,e.isBlazor)())if(t.selectedObject.helperObject)o=t.selectedObject.helperObject;else if(t.selectedItems.nodes.length>0||t.selectedItems.connectors.length>0){i instanceof qh&&i.nodes.length+i.connectors.length===1?(r=i.nodes.length>0?i.nodes[0]:i.connectors[0],n=t.selectedItems.wrapper.children[0]):(r=i,n=t.selectedItems.wrapper),t.selectedObject.actualObject=r;var a=r instanceof qh&&r.nodes.length>0?r.nodes[0]:r;if(t.selectedObject.actualObject=r,!t.currentSymbol&&(a.isLane&&hn(a,t)&&un(t,a)||!a.isLane&&un(t,a)||t.constraints&ct.LineRouting&&t.selectedItems.nodes.length>0))o=pn(t,{id:"helper",rotateAngle:n.rotateAngle,offsetX:n.offsetX,offsetY:n.offsetY,minWidth:n.minWidth,minHeight:n.minHeight,maxWidth:n.maxWidth,maxHeight:n.maxHeight,width:n.actualSize.width,height:n.actualSize.height,pivot:n.pivot,style:{strokeDashArray:"2 2",fill:"transparent",strokeColor:"#7D7D7D",strokeWidth:2}}),t.selectedObject.helperObject=o}return t.enableServerDataBinding(!0),o}function un(t,e,i){var r=i?t.nameTable[e.parentId]:t.nameTable[e.parentId]||e;return!(!r||!r.container)}function fn(t,e){var r=t.nameTable[e.parentId];if(e.laneMargin={left:e.margin.left,right:e.margin.right,top:e.margin.top,bottom:e.margin.bottom},e.hasTextAnnotation)for(var n=0;n<e.outEdges.length;n++){var o=t.nameTable[e.outEdges[parseInt(n.toString(),10)]];if(o.isBpmnAnnotationConnector){var a=t.nameTable[o.targetID],s={width:e.wrapper.actualSize.width,height:e.wrapper.actualSize.height,offsetX:e.wrapper.offsetX,offsetY:e.wrapper.offsetY},h=e.wrapper.offsetX,d=e.wrapper.offsetY,l=t.getTextAnnotationOffset(e,a,s,h,d),c=l.x-h,p=l.y-d;(c||p||e.width!==e.wrapper.actualSize.width||e.height!==e.wrapper.actualSize.height)&&(e.isResized=!0,e.resizeDif||(e.resizeDif=[]),e.resizeDif[a.id]={x:c,y:p})}}r&&"Canvas"===r.container.type&&(e.margin.left=e.offsetX-r.wrapper.bounds.x-e.width/2,e.margin.top=e.offsetY-r.wrapper.bounds.y-e.height/2),t.nodePropertyChange(e,{},{width:e.width,height:e.height,offsetX:e.offsetX,offsetY:e.offsetY,margin:{left:e.margin.left,right:e.margin.right,top:e.margin.top,bottom:e.margin.bottom},rotateAngle:e.rotateAngle}),t.undoRedoModule&&r&&r.isLane&&t.undoRedoModule.checkRedo&&(e.margin.left<0||e.margin.top<0)&&mn(t,e),r&&!r.isLane&&(r.wrapper.measure(new i),r.wrapper.arrange(r.wrapper.desiredSize))}function mn(t,e){if(e.parentId&&""!==e.parentId){var i=t.nameTable[e.parentId];if(i.isLane&&i.parentId)for(var r=t.nameTable[i.parentId],n=i.id.slice(r.id.length),o=n.substring(0,n.length-1),a=r.shape.lanes,s=void 0,h=0;h<a.length;h++)if(o===(s=a[parseInt(h.toString(),10)]).id)for(var d=0;d<s.children.length;d++)s.children[parseInt(d.toString(),10)].id===e.id&&(s.children.splice(d,1),d--);t.deleteChild(e)}}function yn(t,e,i){for(var r=i.commandHandler.getObjectLayer(t.id),n=r.zIndexTable,o=e.zIndex+1;void 0!==n[parseInt(o.toString(),10)];)o++;delete r.zIndexTable[t.zIndex],t.zIndex=o,r.zIndexTable[parseInt(o.toString(),10)]=t.id}function vn(t,e,i,r,n,o){if(!t.currentSymbol){t.protectPropertyChange(!0);var a=t.nameTable[e.parentId];i=t.getObject(i.id)||i,a&&a.zIndex>i.zIndex&&o&&yn(i,a,t);var s=-1!==t.nodes.indexOf(i)?i.id:i;if("Canvas"!==e.container.type||n){if(a){var h=a.wrapper.bounds,d=e.wrapper.bounds;if("Horizontal"===a.shape.orientation)i.margin.left-=d.x-h.x;else{var l=e.parentId+a.shape.lanes[0].id+"_0_header";i.margin.top-=d.y-h.y-t.nameTable[""+l].wrapper.bounds.height}}}else{var c=i.wrapper.offsetX-i.wrapper.actualSize.width*i.pivot.x-(e.wrapper.offsetX-e.wrapper.actualSize.width*e.wrapper.pivot.x),p=i.wrapper.offsetY-i.wrapper.actualSize.height*i.pivot.y-(e.wrapper.offsetY-e.wrapper.actualSize.height*e.wrapper.pivot.y);i.margin.left=c,i.margin.top=p}var g=t.nameTable[e.id];if(g.children||(g.children=[]),-1===g.children.indexOf(i.id)){mn(t,i),t.getObject(i.id)&&t.removeElements(i);var u=N(i);if(t.addChild(g,s),i=t.getObject(i.id),g.isLane&&g.parentId)for(var f=(a=t.nameTable[g.parentId]).shape.lanes,m=g.id.slice(a.id.length),y=m.substring(0,m.length-1),v=0;v<f.length;v++)g.isLane&&y===f[parseInt(v.toString(),10)].id&&((i.parentObj instanceof sc||i.parentObj instanceof Xh)&&(i.parentObj=f[parseInt(v.toString(),10)],i.propName="children"),t.nameTable.hasOwnProperty(i.id)||f[parseInt(v.toString(),10)].children.push(i));if(t.updateDiagramObject(i),bn(i,t),g.parentId?r||(t.multiselect?(on(t,i,20),t.updateDiagramElementQuad()):wn(g,a,i,t)):t.updateDiagramObject(g),!(t.diagramActions&yt.UndoRedo)){var b={type:"ChildCollectionChanged",category:"Internal",undoObject:u,redoObject:N(i),historyAction:n?"AddNodeToLane":void 0};t.addHistoryEntry(b)}}else!r&&t.multiselect&&(on(t,i,20),t.updateDiagramElementQuad());t.protectPropertyChange(!1)}}function bn(t,e){var i=id(t.id+"_groupElement",e.element.id),r=id(t.parentId?t.parentId+"_groupElement":e.element.id+"_diagramLayer",e.element.id);i&&r&&r.appendChild(i)}function Sn(t,e,i,r){wn(t,i.nameTable[t.parentId],e,i,r,!0)}function wn(t,e,i,r,n,o){var a,s,h=N(t),d=!1,l=e.shape.padding,c=t.wrapper.bounds,p=t.wrapper.outerBounds,g=i.wrapper.bounds;if(e&&"SwimLane"===e.shape.type&&(c.right<g.right+l||c.bottom<g.bottom+l||o&&c.top>g.top+l)){var u=e.wrapper.children[0],f=u.bounds.x,m=u.bounds.y,y=void 0,v=void 0,b=t.wrapper.children.find(function(t){return t.id.includes("header")}),S="Horizontal"===e.shape.orientation;if(c.right<g.right+l&&p.x<=c.x&&(S&&b?(v=b?b.width:0,y=g.right-c.right+(c.left-g.left)+v+2*l):y=g.right-c.right+(c.left-g.left)+2*l,s=!0,u.updateColumnWidth(t.columnIndex,c.width+y,!0,l)),c.bottom<g.bottom+l&&p.y<=c.y&&(!S&&b?(v=b?b.height:0,y=g.bottom-c.bottom+(c.top-g.top)+v+2*l):y=g.bottom-c.bottom+(c.top-g.top)+2*l,a=!0,u.updateRowHeight(t.rowIndex,c.height+y,!0,l)),o&&c.top>g.top-l&&p.y<=c.y&&(!S&&b?(v=b?b.height:0,y=c.top-g.top+(g.bottom-c.bottom)+v+2*l):y=c.top-g.top+(g.bottom-c.bottom)+2*l,y>0&&(a=!0,u.updateRowHeight(t.rowIndex,c.height+y,!0,l))),r.isRowHeightUpdate=a,!(r.diagramActions&yt.UndoRedo)){if(n&&(r.startGroupAction(),d=!0),a){var w={category:"Internal",type:"RowHeightChanged",undoObject:h,redoObject:N(t)};r.addHistoryEntry(w)}if(s){w={category:"Internal",type:"ColumnWidthChanged",undoObject:h,redoObject:N(t)};r.addHistoryEntry(w)}}e.width=e.wrapper.width=u.width,e.height=e.wrapper.height=u.height,Mr(e),"Horizontal"===e.shape.orientation&&Yr(e,r,t.wrapper,t.columnIndex),Fr(r,e),r.drag(e,f-u.bounds.x,m-u.bounds.y),Br(e,r),kr(e)}return o||on(r,i,l),r.updateDiagramElementQuad(),d}function xn(t,e,i,r,n,o){var a=nd(r.element.id);r.diagramRenderer.renderStackHighlighter(t,a,r.scroller.transform,e,i,n,o)}function In(t,e,i,r){var n=t,o=i.nameTable[n.parentId],a=i.nameTable[n.parentId];if(e&&a&&a.container&&"Stack"===a.container.type&&e.container&&"Stack"===e.container.type&&a.id!==e.parentId){var s=a.wrapper.children.indexOf(n.wrapper);s>-1&&(i.nameTable[n.id].parentId=e.id,a.wrapper.children.splice(s,1))}if(e&&e.parentId&&n.parentId&&"Drag"===r&&a.container&&"Stack"===a.container.type){var h=o.wrapper.children.indexOf(e.wrapper),d=o.wrapper.children.indexOf(n.wrapper),l={targetIndex:h,target:e,sourceIndex:d,source:t};o.wrapper.children.splice(d,1),o.wrapper.children.splice(h,0,n.wrapper);var c={type:"StackChildPositionChanged",redoObject:{targetIndex:d,target:e,sourceIndex:h,source:t},undoObject:l,category:"Internal"};i.commandHandler.addHistoryEntry(c)}}function Pn(t,e,i,r,n,a,s){if(a&&a.length>1&&n&&n.length>1)return"PinchZoom";if(r.currentSymbol)return"Drag";if("PortDraw"===r.eventHandler.action&&(r.tool&=~pt.DrawOnce),(sr(r)||ar(r))&&r.drawingObject)return"Draw";if(An(r)&&((g=r.selectedItems).wrapper&&$a(g.constraints,"UserHandle")))for(var h=0,d=g.userHandles;h<d.length;h++){var l=d[h];if(l.visible&&!(l.disableConnectors&&r.selectedItems.connectors.length>0||l.disableNodes&&r.selectedItems.nodes.length>0))if(Tn(i,m=Ka(g,l,r.scroller.transform),l.size/(2*r.scroller.transform.scale)))return l.name}if(An(r)){var c=r.selectedItems.annotation?r.selectedItems.wrapper.children[0]:r.selectedItems.wrapper,p=c.bounds,g=r.selectedItems,u=0,f=0,m=void 0;if(c.flippedPoint?(u=c.flippedPoint.x,f=c.flippedPoint.y,m=new w(u,f,p.width,p.height)):m=new w(p.x,p.y,p.width,p.height),On(r)&&!r.selectedItems.annotation){var y=r.selectedItems.connectors[0],v=r.selectedItems.handleSize/2/r.scrollSettings.currentZoom,b=r.selectedItems.handleSize/2/r.scrollSettings.currentZoom;if($a(g.constraints,"ResizeAll")){if($a(g.constraints,"ConnectorSourceThumb")&&Vi(y)&&Tn(i,y.sourcePoint,v))return"ConnectorSourceEnd";if($a(g.constraints,"ConnectorTargetThumb")&&Ui(y)&&Tn(i,y.targetPoint,b))return"ConnectorTargetEnd";var S=function(t,e,i,r){var n=e.handleSize/2/r.scrollSettings.currentZoom,a=e.handleSize/2/r.scrollSettings.currentZoom;if("Bezier"===t.type&&r.connectorEditingToolModule)for(var s=0;s<t.segments.length;s++){var h=t.segments[parseInt(s.toString(),10)];if(Tn(i,o.isEmptyPoint(h.point1)?h.bezierPoint1:h.point1,a)&&(0===s&&ts(t.bezierSettings.controlPointsVisibility,"Source")||0!==s&&ts(t.bezierSettings.controlPointsVisibility,"Intermediate")))return"BezierSourceThumb";if(Tn(i,o.isEmptyPoint(h.point2)?h.bezierPoint2:h.point2,n)&&(s===t.segments.length-1&&ts(t.bezierSettings.controlPointsVisibility,"Target")||s!==t.segments.length-1&&ts(t.bezierSettings.controlPointsVisibility,"Intermediate")))return"BezierTargetThumb"}if(r.connectorEditingToolModule&&Gi(t)){var d=t.constraints&at.InheritSegmentThumbSize?r.segmentThumbSize:t.segmentThumbSize,l=d>20&&"Straight"!==t.type?d/2:10;if(l/=r.scrollSettings.currentZoom,"Straight"===t.type||"Bezier"===t.type)for(s=0;s<t.segments.length;s++){if(Tn(i,(h=t.segments[parseInt(s.toString(),10)]).point,l))return"SegmentEnd"}else for(s=0;s<t.segments.length;s++){var c={x:0,y:0};if((h=t.segments[parseInt(s.toString(),10)]).allowDrag)for(var p=0;p<h.points.length-1;p++){if(o.distancePoints(h.points[parseInt(p.toString(),10)],h.points[p+1])>=50&&(c.x=(h.points[parseInt(p.toString(),10)].x+h.points[p+1].x)/2,c.y=(h.points[parseInt(p.toString(),10)].y+h.points[p+1].y)/2,Tn(i,c,l)))return"OrthoThumb"}}}else Gi(t)&&console.warn('[WARNING] :: Module "ConnectorEditing" is not available in Diagram component! You either misspelled the module name or forgot to load it.');return null}(y,g,i,r);if("OrthoThumb"===S)return S;if($a(g.constraints,"ConnectorSourceThumb")&&Vi(y)&&S)return S;if($a(g.constraints,"ConnectorTargetThumb")&&Ui(y)&&S)return S}}else{var x=r.selectedItems.handleSize/2/r.scroller.currentZoom,C=10/r.scroller.currentZoom,A=I(),O=c.offsetX,D=c.offsetY;c.flippedPoint&&(O=O+c.flippedPoint.x-c.corners.topLeft.x,D=D+c.flippedPoint.y-c.corners.topLeft.y),T(A,c.rotateAngle+c.parentTransform,O,D);var M=O-c.pivot.x*c.actualSize.width,L=D-c.pivot.y*c.actualSize.height,E={x:M+(.5===c.pivot.x?2*c.pivot.x:c.pivot.x)*c.actualSize.width/2,y:L-30/r.scroller.currentZoom};E=P(A,E);var z=!!r.selectedItems.annotation,k=!(!z||!Zi(r.selectedItems.annotation));if($a(g.constraints,"Rotate")&&Tn(i,E,C)&&r.selectedItems.thumbsConstraints<.Rotate){if(z&&k)return"LabelRotate";if(!z)return"Rotate"}if(m.Inflate(x),m.containsPoint(i)){var S=function(t,e,i,r,n,o){var a,s=t.selectedItems;1===t.selectedItems.nodes.length&&0===t.selectedItems.connectors.length&&t.selectedItems.nodes[0].container&&!s.annotation&&(a=function(t,e,i,r,n){var o=10/t.scroller.currentZoom,a=t.selectedItems,s=e.actualSize.width,h=e.actualSize.height,d=new w(r,n,e.style.strokeWidth,h),l=new w(r+s,n,e.style.strokeWidth,h),c=new w(r,n,s,e.style.strokeWidth),p=new w(r,n+h,s,e.style.strokeWidth),g=un(t,t.selectedItems.nodes[0],!0)?t.nameTable[t.selectedItems.nodes[0].parentId]:t.selectedItems.nodes[0];if(Ja(a.constraints,"ResizeEast",a.thumbsConstraints,a)&&l.containsPoint(i,o))return"ResizeEast";if(Ja(a.constraints,"ResizeSouth",a.thumbsConstraints,a)&&p.containsPoint(i,o))return"ResizeSouth";if("Grid"!==g.container.type){if(Ja(a.constraints,"ResizeWest",a.thumbsConstraints,a)&&d.containsPoint(i,o))return"ResizeWest";if(Ja(a.constraints,"ResizeNorth",a.thumbsConstraints,a)&&c.containsPoint(i,o))return"ResizeNorth"}return null}(t,e,i,n,o));a||!s.annotation&&t.selectedItems.nodes[0]&&(t.selectedItems.nodes[0].isPhase||t.selectedItems.nodes[0].isLane||"SwimLane"===t.selectedItems.nodes[0].shape.type)||(a=function(t,e,i,r,n,o){var a=40/t.scroller.currentZoom,s=t.selectedItems.handleSize/2/t.scroller.currentZoom,h=t.selectedItems,d=!!h.annotation;if(e.actualSize.width>=a&&e.actualSize.height>=a){if(Ja(h.constraints,"ResizeSouthEast",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n+e.actualSize.width,y:o+e.actualSize.height}),s))return d?"LabelResizeSouthEast":"ResizeSouthEast";if(Ja(h.constraints,"ResizeSouthWest",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n,y:o+e.actualSize.height}),s))return d?"LabelResizeSouthWest":"ResizeSouthWest";if(Ja(h.constraints,"ResizeNorthEast",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n+e.actualSize.width,y:o}),s))return d?"LabelResizeNorthEast":"ResizeNorthEast";if(Ja(h.constraints,"ResizeNorthWest",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n,y:o}),s))return d?"LabelResizeNorthWest":"ResizeNorthWest"}if(Ja(h.constraints,"ResizeEast",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n+e.actualSize.width,y:o+e.actualSize.height/2}),s))return d?"LabelResizeEast":"ResizeEast";if(Ja(h.constraints,"ResizeWest",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n,y:o+e.actualSize.height/2}),s))return d?"LabelResizeWest":"ResizeWest";if(Ja(h.constraints,"ResizeSouth",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n+e.actualSize.width/2,y:o+e.actualSize.height}),s))return d?"LabelResizeSouth":"ResizeSouth";if(Ja(h.constraints,"ResizeNorth",h.thumbsConstraints,h)&&Tn(i,P(r,{x:n+e.actualSize.width/2,y:o}),s))return d?"LabelResizeNorth":"ResizeNorth";return null}(t,e,i,r,n,o));if(a)return a;return null}(r,c,i,A,M,L);if(S)return S}}}if(or(r)&&!t)return"Pan";if((s instanceof ye||s instanceof ve)&&(!or(r)||rr(r)||nr(r))&&"None"!==(S=Cn(r,s)))return S;if((s instanceof Ie||s instanceof Pe)&&!or(r)&&_i(s))return Dn(r,s,void 0,e)&&Yi(s)?"LabelDrag":"LabelSelect";if(null!==t){if(!(t instanceof Yh||t instanceof Co))return"Select";if(e&&e.id){var B=e.id.split(t.id)[1];if(B&&B.match("^_icon"))return"LayoutAnimation"}if(e&&e.id)for(var R=void 0,N=0;N<t.fixedUserHandles.length;N++)if(R=t.fixedUserHandles[parseInt(N.toString(),10)].id,e.id&&e.id.indexOf(R)>-1)return"FixedUserHandle";if(e instanceof Zt&&e.hyperlink.link)return"Hyperlink";if(!Yi(t)||!Dn(r,t,!1)||void 0!==r.selectedItems.annotation)return t&&or(r)&&!hr(r)?"Pan":r.selectedItems.nodes.length&&r.selectedItems.nodes[0].isLane&&r.selectedItems.wrapper&&r.selectedItems.wrapper.bounds.containsPoint(i)?"Drag":"Select";if(t instanceof Co&&!Tn(i,t.sourcePoint,t.hitPadding)&&!Tn(i,t.targetPoint,t.hitPadding)||!(t instanceof Co))return"Drag"}return"Select"}function Cn(t,e,i,r){if(gr(e)&&(es(e,et.Hover)||es(e,et.Visible))){if(e.constraints&It.Drag)return"PortDrag"}else if(pr(e)&&(es(e,et.Hover)||es(e,et.Visible))&&e.constraints&It.Draw){t.drawingObject={};var n={type:"Orthogonal",sourcePortID:e.id};return t.drawingObject=n,t.tool|=pt.DrawOnce,t.currentDrawingObject=n,"PortDraw"}return"None"}function Tn(t,e,i){return t.x>=e.x-i&&t.x<=e.x+i&&t.y>=e.y-i&&t.y<=e.y+i}function An(t){return t.selectedItems.nodes.length>0||t.selectedItems.connectors.length>0}function On(t){return 1===t.selectedItems.connectors.length&&!t.selectedItems.nodes.length}function Dn(t,e,i,r){if(void 0===i&&(i=!0),e instanceof qh)return!0;if(e instanceof Yh)for(;e;){if(-1!==t.selectedItems.nodes.indexOf(e)&&void 0===t.selectedItems.annotation)return!0;if(-1!==t.selectedItems.selectedObjects.indexOf(e)&&void 0===t.selectedItems.annotation)return!0;if(i)break;var n=e;e=t.nameTable[e.parentId],n&&t.nameTable[n.parentId]&&"Container"===t.nameTable[n.parentId].shape.type&&(e=void 0)}else if(e instanceof Co){if(-1!==t.selectedItems.connectors.indexOf(e)&&void 0===t.selectedItems.annotation)return!0}else if((e instanceof Ie||e instanceof Pe)&&t.selectedItems.annotation&&t.selectedItems.wrapper.children[0].id===r.id)return!0;return!1}function Mn(t,e){if(e+=360,e%=360,-1===t.indexOf("Resize"))return Ln[""+t];var i=Ln[""+t];return e>=0&&e<25||e>=160&&e<=205||e>=340&&e<=360?i:e>=25&&e<=70||e>=205&&e<=250?"n-resize"===i||"s-resize"===i?"ne-resize":"nw-resize"===i||"se-resize"===i?"n-resize":"e-resize"===i||"w-resize"===i?"nw-resize":"e-resize":e>=70&&e<=115||e>=250&&e<=295?"n-resize"===i||"s-resize"===i?"e-resize":"nw-resize"===i||"se-resize"===i?"ne-resize":"e-resize"===i||"w-resize"===i?"n-resize":"nw-resize":e>=115&&e<=155||e>=295&&e<=340?"n-resize"===i||"s-resize"===i?"nw-resize":"nw-resize"===i||"se-resize"===i?"e-resize":"e-resize"===i||"w-resize"===i?"ne-resize":Ln[""+t]:"n-resize"}var Ln={None:"default",Rotate:"crosshair",Select:"default",Drag:"move",ResizeWest:"w-resize",ResizeEast:"e-resize",ResizeSouth:"s-resize",ResizeNorth:"n-resize",Draw:"crosshair",PortDraw:"crosshair",ResizeNorthEast:"ne-resize",ResizeNorthWest:"nw-resize",ResizeSouthEast:"se-resize",ResizeSouthWest:"sw-resize",ConnectorSourceEnd:"move",ConnectorTargetEnd:"move",BezierSourceThumb:"move",BezierTargetThumb:"move",OrthoThumb:"move",SegmentEnd:"move",Pan:"grab",Hyperlink:"pointer",PortDrag:"pointer",LabelSelect:"pointer",LabelDrag:"move",LabelRotate:"crosshair",LabelResizeWest:"w-resize",LabelResizeEast:"e-resize",LabelResizeSouth:"s-resize",LabelResizeNorth:"n-resize",LabelResizeNorthEast:"ne-resize",LabelResizeNorthWest:"nw-resize",LabelResizeSouthEast:"se-resize",LabelResizeSouthWest:"sw-resize"},En=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),zn=function(t,e,i,r){return new(i||(i=Promise))(function(n,o){function a(t){try{h(r.next(t))}catch(t){o(t)}}function s(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,s)}h((r=r.apply(t,e||[])).next())})},kn=function(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bn=function(){function t(t,e){void 0===e&&(e=!1),this.commandHandler=null,this.inAction=!1,this.isProtectChange=!1,this.currentElement=null,this.blocked=!1,this.isTooltipVisible=!1,this.childTable={},this.undoElement={nodes:[],connectors:[]},this.checkProperty=!0,this.undoParentElement={nodes:[],connectors:[]},this.undoContainerElement={nodes:[],connectors:[]},this.toolName="ToolBase",this.commandHandler=t,this.isProtectChange=e}return t.prototype.startAction=function(t){this.currentElement=t,this.inAction=!0},t.prototype.mouseDown=function(t){this.currentElement=t.source,this.startPosition=this.currentPosition=this.prevPosition=t.position,this.isTooltipVisible=!0,this.startAction(t.source),this.checkProperty=!0,this.mouseDownElement=t.source},t.prototype.checkPropertyValue=function(){this.checkProperty&&this.commandHandler.startTransaction(this.isProtectChange)},t.prototype.mouseMove=function(t){return this.currentPosition=t.position,this.inAction&&(this.commandHandler.startTransaction(this.isProtectChange),this.checkProperty=!1),!this.blocked},t.prototype.mouseUp=function(t){this.checkPropertyValue(),this.currentPosition=t.position,this.isTooltipVisible=!1,this.commandHandler.endTransaction(this.isProtectChange),this.endAction(),this.mouseDownElement=null},t.prototype.endAction=function(){this.isTooltipVisible||this.commandHandler.closeTooltip(),this.commandHandler=null,this.currentElement=null,this.currentPosition=null,this.inAction=!1,this.blocked=!1},t.prototype.mouseWheel=function(t){this.currentPosition=t.position},t.prototype.mouseLeave=function(t){this.mouseUp(t)},t.prototype.updateSize=function(t,e,i,r,n,o){t=this.commandHandler.renderContainerHelper(t)||t;var a,s={snapped:!1,offset:0,left:!1,right:!1},h={snapped:!1,offset:0,top:!1,bottom:!1},d=this.currentPosition.x-this.startPosition.x,l=this.currentPosition.y-this.startPosition.y,c=!(t instanceof Zt)&&this.commandHandler.snappingModule&&this.commandHandler.snappingModule.canSnap(),p=c?this.commandHandler.snappingModule.getLayer():null,g=t instanceof Zt?o:t.rotateAngle;T(a=I(),-g,0,0);t.offsetX,t.offsetY;var u=t.width,f=t.height;t.pivot.x,t.pivot.y;var m,y=0,v=0,b=t instanceof Zt?t.actualSize.width:t.width,S=t instanceof Zt?t.actualSize.height:t.height;switch(r){case"ResizeWest":d=(m=P(a,{x:d,y:l})).x,l=m.y,v=1,d=c?this.commandHandler.snappingModule.snapLeft(s,h,p,d,l,t,i===e,n):d,l=0,y=(n.width-d)/b;break;case"ResizeEast":d=(m=P(a,{x:d,y:l})).x,l=m.y,d=c?this.commandHandler.snappingModule.snapRight(s,h,p,d,l,t,i===e,n):d,l=0,y=(n.width+d)/b,v=1;break;case"ResizeNorth":y=1,d=(m=P(a,{x:d,y:l})).x,l=m.y,l=c?this.commandHandler.snappingModule.snapTop(s,h,p,d,l,t,i===e,n):l,v=(n.height-l)/S;break;case"ResizeSouth":y=1,d=(m=P(a,{x:d,y:l})).x,l=m.y,l=c?this.commandHandler.snappingModule.snapBottom(s,h,p,d,l,t,i===e,n):l,v=(n.height+l)/S;break;case"ResizeNorthEast":d=(m=P(a,{x:d,y:l})).x,l=m.y,d=c?this.commandHandler.snappingModule.snapRight(s,h,p,d,l,t,i===e,n):d,l=c?this.commandHandler.snappingModule.snapTop(s,h,p,d,l,t,i===e,n):l,y=(n.width+d)/b,v=(n.height-l)/S;break;case"ResizeNorthWest":d=(m=P(a,{x:d,y:l})).x,l=m.y,l=c?this.commandHandler.snappingModule.snapTop(s,h,p,d,l,t,i===e,n):l,d=c?this.commandHandler.snappingModule.snapLeft(s,h,p,d,l,t,i===e,n):d,y=(n.width-d)/b,v=(n.height-l)/S;break;case"ResizeSouthEast":d=(m=P(a,{x:d,y:l})).x,l=m.y,l=c?this.commandHandler.snappingModule.snapBottom(s,h,p,d,l,t,i===e,n):l,d=c?this.commandHandler.snappingModule.snapRight(s,h,p,d,l,t,i===e,n):d,v=(n.height+l)/S,y=(n.width+d)/b;break;case"ResizeSouthWest":d=(m=P(a,{x:d,y:l})).x,l=m.y,l=c?this.commandHandler.snappingModule.snapBottom(s,h,p,d,l,t,i===e,n):l,d=c?this.commandHandler.snappingModule.snapLeft(s,h,p,d,l,t,i===e,n):d,y=(n.width-d)/b,v=(n.height+l)/S}return{width:y,height:v}},t.prototype.getPivot=function(t){switch(t){case"ResizeWest":return{x:1,y:.5};case"ResizeEast":return{x:0,y:.5};case"ResizeNorth":return{x:.5,y:1};case"ResizeSouth":return{x:.5,y:0};case"ResizeNorthEast":return{x:0,y:1};case"ResizeNorthWest":return{x:1,y:1};case"ResizeSouthEast":return{x:0,y:0};case"ResizeSouthWest":return{x:1,y:0}}return{x:.5,y:.5}},t.prototype.getShapeType=function(){return"Image"===this.commandHandler.diagram.drawingObject.shape.type||"HTML"===this.commandHandler.diagram.drawingObject.shape.type||"Native"===this.commandHandler.diagram.drawingObject.shape.type||"Path"===this.commandHandler.diagram.drawingObject.shape.type?this.commandHandler.diagram.drawingObject.shape.type:this.commandHandler.diagram.drawingObject.shape.shape},t.prototype.triggerElementDrawEvent=function(t,e,i,r,n){var o={source:t,state:e,objectType:i,cancel:!1,elementType:r};this.commandHandler.triggerEvent(xt.elementDraw,o),n&&o.cancel&&(this.commandHandler.diagram.resetTool(),this.inAction=!1)},t}(),Rn=function(t){function e(e,i,r){var n=t.call(this,e,!0)||this;return n.action=r,n}return En(e,t),e.prototype.mouseDown=function(e){this.inAction=!0,t.prototype.mouseDown.call(this,e)},e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),this.inAction&&!1===o.equals(this.currentPosition,this.prevPosition)){var i=w.toBounds([this.prevPosition,this.currentPosition]);this.commandHandler.clearSelectedItems(),this.commandHandler.drawSelectionRectangle(i.x,i.y,i.width,i.height)}return!this.blocked},e.prototype.mouseUp=function(e,i){if(this.checkPropertyValue(),!this.commandHandler.isUserHandle(this.currentPosition))if(!1===o.equals(this.currentPosition,this.prevPosition)&&this.inAction){var r=w.toBounds([this.prevPosition,this.currentPosition]);this.commandHandler.doRubberBandSelection(r)}else{var n=this.commandHandler.getSelectedObject();this.commandHandler.hasSelection()&&e.info&&e.info.ctrlKey?e&&e.source&&(this.commandHandler.isSelected(e.source)?1===e.clickCount&&this.commandHandler.unSelect(e.source):this.commandHandler.selectObjects([e.source],!0)):2===i&&n.some(function(t){return t===e.source})||(this.commandHandler.clearSelection(null===e.source),"LabelSelect"===this.action?this.commandHandler.labelSelect(e.source,e.sourceWrapper,n):e.source&&this.commandHandler.selectObjects([e.source],!1,n))}this.inAction=!1,t.prototype.mouseUp.call(this,e)},e.prototype.mouseLeave=function(t){this.inAction&&this.mouseUp(t)},e}(Bn),Nn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return En(e,t),e.prototype.mouseUp=function(e){this.checkPropertyValue(),this.inAction=!1;for(var i,r=e.source,n=e.sourceWrapper.id,o=0;o<r.fixedUserHandles.length;o++)n.indexOf(r.fixedUserHandles[parseInt(o.toString(),10)].id)>-1&&(i=r.fixedUserHandles[parseInt(o.toString(),10)]);var a={fixedUserHandle:i,element:e.source},s=xt.fixedUserHandleClick;this.commandHandler.triggerEvent(s,a),t.prototype.mouseUp.call(this,e)},e}(Bn),jn=function(t){function i(e,i){var r=t.call(this,e,!0)||this;return r.isConnected=!1,r.endPoint=i,r.toolName="ConnectTool",r}return En(i,t),i.prototype.mouseDown=function(e){return zn(this,void 0,void 0,function(){var i,r,n,a,s;return kn(this,function(h){if(this.inAction=!0,this.undoElement=void 0,this instanceof Fn||(this.undoElement=N(e.source)),t.prototype.mouseDown.call(this,e),e.source&&e.source.connectors&&({x:this.prevPosition.x,y:this.prevPosition.y},i=e.source.connectors[0],this.oldConnector=N(i)),"BezierSourceThumb"===this.endPoint||"BezierTargetThumb"===this.endPoint)for(r=0;r<i.segments.length;r++)n=i.segments[parseInt(r.toString(),10)],a=o.isEmptyPoint(n.point1)?n.bezierPoint1:n.point1,s=o.isEmptyPoint(n.point2)?n.bezierPoint2:n.point2,this.currentElement.handleSize!==i.hitPadding&&(i.hitPadding=this.currentElement.handleSize),(Tn(this.currentPosition,a,i.hitPadding)||Tn(this.currentPosition,s,i.hitPadding))&&(this.selectedSegment=n);return this.currentPosition=e.position,[2]})})},i.prototype.mouseUp=function(i){return zn(this,void 0,void 0,function(){var r,n,a,s,h,d,l,c,p,g,u,f,m,y;return kn(this,function(v){return r="ConnectorDrawingTool"===this.toolName,n=!(i&&i.source&&i.source.connectors&&i.source.connectors.length),(r||n)&&this.inAction?(this.checkPropertyValue(),this.commandHandler.updateSelector(),this.commandHandler.removeSnap(),Bn.prototype.mouseUp(i),[2]):(!(0,e.isBlazor)()&&this.isConnected&&i.source&&i.source.connectors&&(y=i.source.connectors[0],a="ConnectorSourceEnd"===this.endPoint?"sourceID":"targetID",s="ConnectorSourceEnd"===this.endPoint?"sourcePortID":"targetPortID",g={connector:y,oldValue:{nodeId:this.oldConnector[""+a],portId:this.oldConnector[""+s]},newValue:{nodeId:y[""+a],portId:y[""+s]},cancel:!1,state:"Changed",connectorEnd:this.endPoint},y[""+a]===this.oldConnector[""+a]&&y[""+s]===this.oldConnector[""+s]||(this.commandHandler.triggerEvent(xt.connectionChange,g),this.isConnected=!1)),this.checkPropertyValue(),this.commandHandler.updateSelector(),this.commandHandler.removeSnap(),this instanceof Fn||("ConnectorSourceEnd"!==this.endPoint||!i.source.connectors.length||o.equals(i.source.connectors[0].sourcePoint,this.undoElement.connectors[0].sourcePoint)&&i.source.connectors[0].sourceID===this.undoElement.connectors[0].sourceID)&&("ConnectorTargetEnd"!==this.endPoint||o.equals(i.source.connectors[0].targetPoint,this.undoElement.connectors[0].targetPoint)&&i.source.connectors[0].targetID===this.undoElement.connectors[0].targetID)?this instanceof Fn||"BezierTargetThumb"!==this.endPoint&&"BezierSourceThumb"!==this.endPoint||this.undoElement&&i.source&&(f=N(i.source),m={type:"SegmentChanged",redoObject:f,undoObject:this.undoElement,category:"Internal"},this.commandHandler.addHistoryEntry(m)):(h=void 0,d=void 0,y=void 0,i.source&&i.source.connectors&&"ConnectorSourceEnd"===this.endPoint?(h={x:this.oldConnector.sourcePoint.x,y:this.oldConnector.sourcePoint.y},y=i.source.connectors[0],d={x:y.sourcePoint.x,y:y.sourcePoint.y}):i.source&&i.source.connectors&&"ConnectorTargetEnd"===this.endPoint&&(h={x:this.oldConnector.targetPoint.x,y:this.oldConnector.targetPoint.y},y=i.source.connectors[0],d={x:y.targetPoint.x,y:y.targetPoint.y}),l=void 0,c=void 0,i.target&&(p=this.commandHandler.findTarget(i.targetWrapper,i.target,"ConnectorSourceEnd"===this.endPoint,!0),c=p.id,p instanceof ye&&(l=p.id,c=i.target.id)),this.commandHandler.diagram.diagramActions&yt.ToolAction&&(this.commandHandler.diagram.diagramActions&=~yt.ToolAction),g={connector:y,state:"Completed",targetNode:c,oldValue:h,newValue:d,cancel:!1,targetPort:l},this.undoElement&&i.source&&(f=void 0,f=N(i.source),m={type:"ConnectionChanged",redoObject:N(f),undoObject:N(this.undoElement),category:"Internal"},this.commandHandler.addHistoryEntry(m)),u="ConnectorSourceEnd"===this.endPoint?xt.sourcePointChange:xt.targetPointChange,this.commandHandler.triggerEvent(u,g)),this.canCancel=void 0,this.tempArgs=void 0,i.source&&i.source.connectors&&(y=i.source.connectors[0]).isBezierEditing&&(y.isBezierEditing=!1),t.prototype.mouseUp.call(this,i),[2])})})},i.prototype.mouseMove=function(i){var r,n=this;if(t.prototype.mouseMove.call(this,i),!(this instanceof Fn)&&("ConnectorSourceEnd"===this.endPoint&&o.equals(i.source.connectors[0].sourcePoint,this.undoElement.connectors[0].sourcePoint)||"ConnectorTargetEnd"===this.endPoint&&o.equals(i.source.connectors[0].targetPoint,this.undoElement.connectors[0].targetPoint))){var a=void 0,s=void 0;i.source&&i.source.connectors&&(a={x:this.prevPosition.x,y:this.prevPosition.y},s=i.source.connectors[0]);var h=void 0,d=void 0;if(i.target)d=i.target.id,(S=this.commandHandler.findTarget(i.targetWrapper,i.target,"ConnectorSourceEnd"===this.endPoint,!0))instanceof ye||S instanceof Ch?h=S.id:d=S.id;var l={connector:s,state:"Start",targetNode:d,oldValue:a,newValue:a,cancel:!1,targetPort:h},c="ConnectorSourceEnd"===this.endPoint?xt.sourcePointChange:xt.targetPointChange;this.commandHandler.triggerEvent(c,l)}if(this.currentPosition=i.position,this.currentPosition&&this.prevPosition){var p=this.currentPosition.x-this.prevPosition.x,g=this.currentPosition.y-this.prevPosition.y,u=void 0,f=(a=void 0,void 0),m=void 0;this.currentPosition=this.commandHandler.snapConnectorEnd(this.currentPosition);var y=void 0;i.source&&i.source.connectors&&(u={x:this.currentPosition.x,y:this.currentPosition.y},a={x:this.prevPosition.x,y:this.prevPosition.y},y=i.source.connectors[0]);var v=void 0,b=void 0,S=void 0;i.target&&((S=this.commandHandler.findTarget(i.targetWrapper,i.target,"ConnectorSourceEnd"===this.endPoint,!0))instanceof ye||S instanceof ve?v=S.id:b=S.id);l={connector:y,state:"Progress",targetNode:b,oldValue:a,newValue:u,cancel:!1,targetPort:v};if(!(this instanceof Fn)){c="ConnectorSourceEnd"===this.endPoint?xt.sourcePointChange:xt.targetPointChange;this.commandHandler.triggerEvent(c,l)}if(i.target&&(f=ns(i.target,!0),m=ns(i.target,!1)),!l.cancel&&this.inAction&&void 0!==this.endPoint&&(0!==p||0!==g))if("ConnectorSourceEnd"===this.endPoint&&y&&"Orthogonal"===y.type&&y.segments&&y.segments.length>0){var w=y.segments[0].direction,x=function(t,e,r){n.blocked=!n.commandHandler.dragConnectorEnds(n.endPoint,i.source,r||n.currentPosition,n.selectedSegment,e?i.target:void 0,t)},I=y.sourcePortID!==v||y.sourceID!==b;if(!I||b||v)if(v&&y.sourcePortID!==v)this.checkConnect(S)&&(x(v,i.target.id),r=this.commandHandler.connect(this.endPoint,i,this.canCancel),this.isConnected=!0);else if(S instanceof Yh)if(I&&this.commandHandler.canDisconnect(this.endPoint,i,v,b)&&(r=this.commandHandler.disConnect(i.source,this.endPoint,this.canCancel)),Ji(S)){var P=b?this.commandHandler.diagram.nameTable[""+b].wrapper.corners:void 0;x(void 0,i.target.id,function(){if(!w||!P)return n.currentPosition;switch(w){case"Bottom":return P.bottomCenter;case"Top":return P.topCenter;case"Left":return P.middleLeft;case"Right":return P.middleRight;default:return n.currentPosition}}()),r=this.commandHandler.connect(this.endPoint,i,this.canCancel),this.isConnected=!0}else x(void 0,void 0);else S instanceof ve&&(this.blocked=!this.commandHandler.dragConnectorEnds(this.endPoint,i.source,this.currentPosition,this.selectedSegment,i.target,v),r=this.commandHandler.connect(this.endPoint,i,this.canCancel));else this.commandHandler.canDisconnect(this.endPoint,i,v,b)&&(r=this.commandHandler.disConnect(i.source,this.endPoint,this.canCancel),this.isConnected=!0,x(v,b))}else if(l.cancel||(this.blocked=!this.commandHandler.dragConnectorEnds(this.endPoint,i.source,this.currentPosition,this.selectedSegment,i.target,v),this.commandHandler.updateSelector()),i.target&&("ConnectorSourceEnd"===this.endPoint&&(Ji(i.target)||$i(m))||"ConnectorTargetEnd"===this.endPoint&&(Qi(i.target)||Ki(f)))){this.commandHandler.canDisconnect(this.endPoint,i,v,b)&&(r=this.commandHandler.disConnect(i.source,this.endPoint,this.canCancel),this.isConnected=!0);var C=this.commandHandler.findTarget(i.targetWrapper,i.target,"ConnectorSourceEnd"===this.endPoint,!0);if(C instanceof Yh)(Qi(C)&&"ConnectorTargetEnd"===this.endPoint||Ji(C)&&"ConnectorSourceEnd"===this.endPoint)&&(r=this.commandHandler.connect(this.endPoint,i,this.canCancel),this.isConnected=!0);else this.checkConnect(C)&&(this.isConnected=!0,r=this.commandHandler.connect(this.endPoint,i,this.canCancel))}else-1===this.endPoint.indexOf("Bezier")&&(this.isConnected=!0,r=this.commandHandler.disConnect(i.source,this.endPoint,this.canCancel),this.commandHandler.updateSelector());if(this.commandHandler.canEnableDefaultTooltip()){var T=this.getTooltipContent(i.position);this.commandHandler.showTooltip(i.source,i.position,(0,e.initializeCSPTemplate)(function(){return T}),"ConnectTool",this.isTooltipVisible),this.isTooltipVisible=!1}else this.isTooltipVisible&&(this.commandHandler.closeTooltip(),this.isTooltipVisible=!1);r&&(this.tempArgs=r)}return this.prevPosition=this.currentPosition,!this.blocked},i.prototype.mouseLeave=function(t){this.mouseUp(t)},i.prototype.getTooltipContent=function(t){return"X:"+Math.round(t.x)+" Y:"+Math.round(t.y)},i.prototype.checkConnect=function(t){return!(!Ki(t)||"ConnectorTargetEnd"!==this.endPoint)||(!(!$i(t)||"ConnectorSourceEnd"!==this.endPoint)||!(t.constraints&It.None||Ki(t)||$i(t))&&(void 0===t.constraints||(t.constraints&It.Default&~(It.InConnect|It.OutConnect))>0))},i.prototype.endAction=function(){t.prototype.endAction.call(this),this.prevPosition=null,this.endPoint=null},i}(Bn),Hn=function(t){function i(e,i){var r=t.call(this,e,!0)||this;return r.currentTarget=null,r.isStartAction=!1,r.canCancel=!1,r.canTrigger=!1,r.objectType=i,r}return En(i,t),i.prototype.mouseDown=function(e){if(e.source instanceof Yh||e.source instanceof Co){var i=this.commandHandler.getSelectedObject();this.commandHandler.selectObjects([e.source],e.info&&e.info.ctrlKey,i);var r={nodes:[],connectors:[]};e.source instanceof Yh?r.nodes.push(N(e.source)):r.connectors.push(N(e.source)),this.undoElement=N(r);var n=e.source.wrapper;this.undoElement.offsetX=n.offsetX,this.undoElement.offsetY=n.offsetY}else this.undoElement=N(e.source);this.commandHandler.trackConnectorChange(this.undoElement),this.undoParentElement=this.commandHandler.getSubProcess(e.source),this.undoContainerElement=this.commandHandler.getContainer(e.source),"Port"===this.objectType&&(this.portId=e.sourceWrapper.id),this.commandHandler.insertBlazorConnector(e.source),t.prototype.mouseDown.call(this,e),this.initialOffset={x:0,y:0}},i.prototype.getPort=function(t){for(var e,i=t.source.id,r=t.source.ports,n=0;n<r.length;n++)if(t.sourceWrapper.id===i+"_"+r[parseInt(n.toString(),10)].id){e=r[parseInt(n.toString(),10)];break}return e},i.prototype.mouseUp=function(e,i){return zn(this,void 0,void 0,function(){var r,n,o,a,s,h,d,l,c,p,g,u,f,m,y,v,b,S,w,x,I,P,C,T,A,O,D,M,L;return kn(this,function(E){if(this.checkPropertyValue(),a=!1,h={nodes:[],connectors:[]},"Port"!==this.objectType){if(e.source instanceof Yh||e.source instanceof Co?(e.source instanceof Yh?h.nodes.push(N(e.source)):h.connectors.push(N(e.source)),o=N(h),d=e.source.wrapper,o.offsetX=d.offsetX,o.offsetY=d.offsetY):o=N(e.source),this.commandHandler.trackConnectorChange(o),"helper"===(s=this.commandHandler.renderContainerHelper(e.source)||e.source||this.commandHandler.renderContainerHelper(e.source)).id||"helper"!==s.id){if(l=!1,s instanceof qh&&(c=N(s)).selectedObjects.length===this.undoElement.selectedObjects.length)for(M=0;M<c.selectedObjects.length;M++)if(c.selectedObjects[parseInt(M.toString(),10)].id!==this.undoElement.selectedObjects[parseInt(M.toString(),10)].id){l=!0;break}if(p=s instanceof qh,g=s instanceof qh&&s.selectedObjects&&1===s.selectedObjects.length,u=s instanceof qh&&Math.round(s.width)===Math.round(this.undoElement.width)&&Math.round(s.height)===Math.round(this.undoElement.height),f=s.offsetX!==this.undoElement.offsetX||s.offsetY!==this.undoElement.offsetY,m=s.sourcePoint!==this.undoElement.sourcePoint,y=s.targetPoint!==this.undoElement.targetPoint,!l&&(p&&(u||g)||!p)&&(f||m||y)||this.isSelectionHasConnector(s)){if(e.source&&(n={offsetX:e.source.wrapper.offsetX,offsetY:e.source.wrapper.offsetY},r={offsetX:e.source.wrapper.offsetX,offsetY:e.source.wrapper.offsetY}),L={source:e.source,state:"Completed",oldValue:this.intialValue,newValue:n,target:this.currentTarget,targetPosition:this.currentPosition,allowDrop:!0,cancel:!1},L={source:e.source,state:"Completed",oldValue:this.intialValue,newValue:n,target:this.currentTarget,targetPosition:this.currentPosition,allowDrop:L.allowDrop,cancel:L.cancel},v=!0,"helper"===s.id)if(this.canTrigger){if((o.nodes.length>1||o.connectors.length>1)&&this.commandHandler.diagram.lineRoutingModule&&this.commandHandler.diagram.constraints&ct.LineRouting){for(b=this.commandHandler.diagram.nameTable,M=0;M<o.nodes.length;M++)if(!b[o.nodes[parseInt(M.toString(),10)].parentId]||!b[o.nodes[parseInt(M.toString(),10)].parentId].isLane){v=!1;break}}else v=!0;this.commandHandler.triggerEvent(xt.positionChange,L),this.connectorEndPointChangeEvent(L)}else v=!1;else this.commandHandler.triggerEvent(xt.positionChange,L),this.connectorEndPointChangeEvent(L);!i&&v&&(this.commandHandler.startGroupAction(),a=!0,T={type:"PositionChanged",redoObject:N(o),undoObject:N(this.undoElement),category:"Internal"},o.nodes[0]&&o.nodes[0].processId&&(S={type:"SizeChanged",category:"Internal",undoObject:this.undoParentElement,redoObject:this.commandHandler.getSubProcess(e.source)},this.commandHandler.addHistoryEntry(S)),o.nodes[0]&&o.nodes[0].parentId&&"Container"===this.commandHandler.diagram.nameTable[o.nodes[0].parentId].shape.type&&(w={type:"SizeChanged",category:"Internal",undoObject:this.undoContainerElement,redoObject:this.commandHandler.getContainer(e.source)},this.commandHandler.addHistoryEntry(w)),this.commandHandler.addHistoryEntry(T))}}if(this.commandHandler.snapPoint(this.prevPosition,this.currentPosition,0,0),this.commandHandler.removeSnap(),this.commandHandler.removeHighlighter(),e.source&&this.currentTarget&&er(this.currentTarget)&&this.commandHandler.isDroppable(e.source,this.currentTarget)){if(x=!0,this.commandHandler.drop(this.currentElement,this.currentTarget,this.currentPosition),this.currentTarget&&this.currentTarget instanceof Co&&!0===this.commandHandler.diagram.enableConnectorSplit)if(this.currentElement&&this.currentElement instanceof Yh){if(void 0!==this.currentElement.children)for(M=0;M<this.currentElement.children.length;M++)this.currentElement.children[parseInt(M.toString(),10)]!==this.currentTarget.sourceID&&this.currentElement.children[parseInt(M.toString(),10)]!==this.currentTarget.targetID||(x=!1);else this.currentElement.id!==this.currentTarget.sourceID&&this.currentElement.id!==this.currentTarget.targetID||(x=!1);x&&this.commandHandler.connectorSplit(this.currentElement,this.currentTarget)}else if(this.currentElement instanceof qh&&!this.commandHandler.PreventConnectorSplit){if(this.currentElement.nodes[0].children)for(M=0;M<this.currentElement.nodes[0].children.length;M++)this.currentElement.nodes[0].children[parseInt(M.toString(),10)]!==this.currentTarget.sourceID&&this.currentElement.nodes[0].children[parseInt(M.toString(),10)]!==this.currentTarget.targetID||(x=!1);else this.currentElement.nodes[0].id!==this.currentTarget.sourceID&&this.currentElement.nodes[0].id!==this.currentTarget.targetID||(x=!1);x&&(this.commandHandler.connectorSplit(this.currentElement.nodes[0],this.currentTarget),this.commandHandler.PreventConnectorSplit=!1)}if(L={element:e.source,target:this.currentTarget,position:this.currentPosition,cancel:!1},this.commandHandler.triggerEvent(xt.drop,L),!L.cancel&&e.source&&this.commandHandler.isParentAsContainer(this.currentTarget)&&!this.commandHandler.isTargetSubProcess(this.currentTarget)){for(I=e.source instanceof qh?e.source.nodes:[e.source],P=!1,M=0;M<I.length;M++){if(I[0].parentId!==I[parseInt(M.toString(),10)].parentId){0;break}0}for(this.commandHandler.diagram.selectedItems.nodes.length!==I.length&&(I=this.commandHandler.diagram.selectedItems.nodes),this.commandHandler.diagram.selectedItems.nodes.length>1?(I=this.calculateDiff(this.commandHandler.diagram.selectedItems,this.currentTarget,this.commandHandler.diagram),this.commandHandler.diagram.multiselect=!0):this.commandHandler.diagram.multiselect=!1,M=0;M<I.length;M++)I[parseInt(M.toString(),10)].container||this.commandHandler.diagram.cancelPositionChange||(P=!0,this.commandHandler.updateLaneChildrenZindex(I[parseInt(M.toString(),10)],this.currentTarget),this.commandHandler.dropChildToContainer(this.currentTarget,I[parseInt(M.toString(),10)]),this.commandHandler.renderContainerHelper(I[parseInt(M.toString(),10)]));I.length>1&&(C=this.commandHandler.diagram.nameTable.helper)&&Sn(this.currentTarget,C,this.commandHandler.diagram),a&&this.commandHandler.isContainer&&P&&this.commandHandler.endGroupAction()}}e.source&&this.currentTarget&&this.commandHandler.dropAnnotation(e.source,this.currentTarget),this.commandHandler.updateSelector(),a&&!this.commandHandler.isContainer&&this.commandHandler.endGroupAction()}else{if(h.nodes.push(N(e.source)),e.portId=this.portId,o=N(h),T={type:"PortPositionChanged",objectId:this.portId,redoObject:N(o),undoObject:N(this.undoElement),category:"Internal"},this.commandHandler.addHistoryEntry(T),A=this.getPort(e)){for(O=this.undoElement.nodes.length>0?this.undoElement.nodes[0].ports:[],D=this.undoElement.connectors.length>0?this.undoElement.connectors[0].ports:[],M=0;M<O.length;M++)if(A.id===O[parseInt(M.toString(),10)].id){r={offsetX:O[parseInt(M.toString(),10)].offset.x,offsetY:O[parseInt(M.toString(),10)].offset.y},n={offsetX:A.offset.x,offsetY:A.offset.y};break}for(M=0;M<D.length;M++)if(A.id===D[parseInt(M.toString(),10)].id){r={offset:D[parseInt(M.toString(),10)].offset},n={offset:A.offset};break}}L={source:A,state:"Completed",oldValue:r,newValue:n,target:this.currentTarget,targetPosition:this.currentPosition,allowDrop:!0,cancel:!1},this.commandHandler.triggerEvent(xt.positionChange,L)}return t.prototype.mouseUp.call(this,e),[2]})})},i.prototype.clearDiff=function(t){t.forEach(function(t,e){delete t.diffX,delete t.diffY})},i.prototype.calculateDiff=function(t,e,i){this.clearDiff(t.nodes);var r,n,o=t.wrapper.bounds.left,a=t.wrapper.bounds.top,s=e.wrapper.bounds.left,h=e.wrapper.bounds.top,d=i.nameTable[e.parentId];0===e.columnIndex&&d&&"Horizontal"===d.shape.orientation&&(s+=50),1===e.rowIndex&&d&&"Vertical"===d.shape.orientation&&(h+=50),r=o<s?s-o:0,n=a<h?h-a:0;var l=t.nodes;return l.forEach(function(t,e){t.diffX=r,t.diffY=n}),l},i.prototype.connectorEndPointChangeEvent=function(t,e){var i=t.source;if(i instanceof qh&&i.nodes.length>0)for(var r=0;r<i.nodes.length;r++){var n=i.nodes[parseInt(r.toString(),10)];if(n&&n.inEdges.length>0)for(var o=0;o<n.inEdges.length;o++){var a=this.commandHandler.diagram.getObject(n.inEdges[parseInt(o.toString(),10)]);this.triggerEndPointEvent(a,t,e,"targetPointChange")}if(n&&n.outEdges.length>0)for(o=0;o<n.outEdges.length;o++){a=this.commandHandler.diagram.getObject(n.outEdges[parseInt(o.toString(),10)]);this.triggerEndPointEvent(a,t,e,"sourcePointChange")}}},i.prototype.triggerEndPointEvent=function(t,e,i,r){var n={connector:t,state:e.state,targetNode:t.targetID,targetPort:t.targetPortID,sourceNode:t.sourceID,sourcePort:t.sourcePortID,oldValue:{x:t.targetPoint.x,y:t.targetPoint.y},newValue:{x:t.targetPoint.x+(i?i.x:0),y:t.targetPoint.y+(i?i.y:0)},cancel:e.cancel};this.commandHandler.triggerEvent("targetPointChange"===r?xt.targetPointChange:xt.sourcePointChange,n)},i.prototype.isSelectionHasConnector=function(t){return!(!(t.nodes&&t.connectors&&t.nodes.length>0&&t.connectors.length>0)||t.width===this.undoElement.width&&t.height===this.undoElement.height)},i.prototype.mouseMove=function(i){t.prototype.mouseMove.call(this,i);var r,n,a=!1;(r=this.commandHandler.renderContainerHelper(i.source)||i.source)instanceof Yh||r instanceof Co?r instanceof Yh?r.offsetX===this.undoElement.nodes[0].offsetX&&r.offsetY===this.undoElement.nodes[0].offsetY&&(a=!0):o.equals(r.sourcePoint,this.undoElement.connectors[0].sourcePoint)&&o.equals(r.targetPoint,this.undoElement.connectors[0].targetPoint)&&(a=!0):r.wrapper.offsetX===this.undoElement.wrapper.offsetX&&r.wrapper.offsetY===this.undoElement.wrapper.offsetY&&(a=!0),r&&(n={offsetX:r.wrapper.offsetX,offsetY:r.wrapper.offsetY});var s={source:r,state:"Start",oldValue:n,newValue:n,target:i.target,targetPosition:i.position,allowDrop:!0,cancel:!1};if(s={source:r,state:"Start",oldValue:n,newValue:n,target:i.target,targetPosition:i.position,allowDrop:s.allowDrop,cancel:s.cancel},"Port"===this.objectType){if(O=this.getPort(i)){for(var h=this.undoElement.nodes.length>0?this.undoElement.nodes[0].ports:[],d=this.undoElement.connectors.length>0?this.undoElement.connectors[0].ports:[],l=0;l<h.length;l++)if(n={offsetX:O.offset.x,offsetY:O.offset.y},O.offset.x!==h[parseInt(l.toString(),10)].offset.x||O.offset.y!==h[parseInt(l.toString(),10)].offset.y){a=!1;break}for(l=0;l<d.length;l++)if(n={offset:O.offset},O.offset!==d[parseInt(l.toString(),10)].offset){a=!1;break}}s={source:O,state:"Start",oldValue:n,newValue:n,target:i.target,targetPosition:i.position,allowDrop:!0,cancel:!1}}if(!this.isStartAction&&(this.intialValue={offsetX:r.wrapper.offsetX,offsetY:r.wrapper.offsetY},this.commandHandler.diagram.lineRoutingModule&&this.commandHandler.diagram.constraints&ct.LineRouting&&"ComplexHierarchicalTree"!==this.commandHandler.diagram.layout.type)){var c=R(r.wrapper);c.Inflate(40);for(var p=0,g=this.commandHandler.diagram.spatialSearch.findObjects(c);p<g.length;p++){var u=g[p];u instanceof Co&&this.commandHandler.diagram.routedConnectors.indexOf(u.id)}}if(a&&!(0,e.isBlazor)()&&(this.commandHandler.triggerEvent(xt.positionChange,s),this.connectorEndPointChangeEvent(s),this.isStartAction=!0),this.commandHandler.diagram.cancelPositionChange=s.cancel,this.currentPosition=i.position,"Port"!==this.objectType){this.currentPosition.x,this.prevPosition.x,this.currentPosition.y,this.prevPosition.y;var f,m=this.initialOffset.x+(this.currentPosition.x-this.prevPosition.x),y=this.initialOffset.y+(this.currentPosition.y-this.prevPosition.y);this.commandHandler.dragOverElement(i,this.currentPosition),this.commandHandler.disConnect(i.source),this.commandHandler.removeSnap();var v=void 0,b=this.commandHandler.snapPoint(this.prevPosition,this.currentPosition,m,y);this.initialOffset.x=m-b.x,this.initialOffset.y=y-b.y,r&&(f={offsetX:r.wrapper.offsetX,offsetY:r.wrapper.offsetY},v={offsetX:r.wrapper.offsetX+b.x,offsetY:r.wrapper.offsetY+b.y}),this.currentTarget&&i.target!==this.currentTarget&&this.commandHandler.removeChildFromBPmn(i.source,i.target,this.currentTarget),this.currentTarget=i.target;var S={source:r,state:"Progress",oldValue:f,newValue:v,target:i.target,targetPosition:i.position,allowDrop:!0,cancel:!1};if(this.commandHandler.triggerEvent(xt.positionChange,S),this.commandHandler.diagram.cancelPositionChange=S.cancel,this.canTrigger=!0,this.connectorEndPointChangeEvent(S,b),!S.cancel&&!this.canCancel){this.blocked=!this.commandHandler.dragSelectedObjects(b.x,b.y);var w=!this.commandHandler.mouseOver(this.currentElement,this.currentTarget,this.currentPosition);this.blocked=this.blocked||w}if(this.commandHandler.removeStackHighlighter(),this.commandHandler.renderStackHighlighter(i),this.currentTarget&&i.source!==this.currentTarget&&this.commandHandler.isDroppable(i.source,this.currentTarget)&&"helper"!==i.source.id){var x=i.source instanceof qh?i.source.nodes[0]||i.source.connectors[0]:i.source;this.commandHandler.isParentAsContainer(x,!0)||"SwimLane"===x.shape.type||x.shape.isPhase||(this.currentTarget.isLane?this.commandHandler.renderStackHighlighter(i,this.currentTarget):this.commandHandler.drawHighlighter(this.currentTarget))}else this.commandHandler.removeHighlighter();if(this.commandHandler.canEnableDefaultTooltip()){var C=this.getTooltipContent(i.source);this.commandHandler.showTooltip(i.source,i.position,(0,e.initializeCSPTemplate)(function(){return C}),"MoveTool",this.isTooltipVisible),this.isTooltipVisible=!1}else this.isTooltipVisible&&(this.commandHandler.closeTooltip(),this.isTooltipVisible=!1)}else{var A,O,D=I(),M=i.source;v=void 0,h=this.undoElement.nodes.length>0?this.undoElement.nodes[0].ports:[],d=this.undoElement.connectors.length>0?this.undoElement.connectors[0].ports:[];if(O=this.getPort(i)){for(l=0;l<h.length;l++){A={offsetX:O.offset.x,offsetY:O.offset.y};break}for(l=0;l<d.length;l++){A={offset:O.offset};break}}T(D,-M.rotateAngle||-M.wrapper.rotateAngle,M.offsetX||M.wrapper.offsetX,M.offsetY||M.wrapper.offsetY);var L=P(D,{x:this.prevPosition.x,y:this.prevPosition.y}),E=P(D,{x:i.position.x,y:i.position.y});if(this.commandHandler.portDrag(i.source,i.sourceWrapper,E.x-L.x,E.y-L.y),O){for(l=0;l<h.length;l++){v={offsetX:O.offset.x,offsetY:O.offset.y};break}for(l=0;l<d.length;l++){v={offset:O.offset};break}}var z={source:O,state:"Progress",oldValue:A,newValue:v,target:i.target,targetPosition:i.position,allowDrop:!0,cancel:!1};this.commandHandler.triggerEvent(xt.positionChange,z)}return this.prevPosition=this.currentPosition,!this.blocked},i.prototype.getTooltipContent=function(t){return"X:"+Math.round(t.wrapper.bounds.x)+" Y:"+Math.round(t.wrapper.bounds.y)},i.prototype.mouseLeave=function(t){this.mouseUp(t)},i.prototype.endAction=function(){t.prototype.endAction.call(this),this.currentTarget=null,this.prevPosition=null},i}(Bn),Wn=function(t){function i(e){var i=t.call(this,e,!0)||this;return i.rotateStart=!1,i}return En(i,t),i.prototype.mouseDown=function(e){if(this.undoElement=N(e.source),this.undoElement.nodes[0]&&this.undoElement.nodes[0].children)for(var i=this.commandHandler.getAllDescendants(this.undoElement.nodes[0],[]),r=0;r<i.length;r++){var n=this.commandHandler.cloneChild(i[parseInt(r.toString(),10)].id);this.childTable[i[parseInt(r.toString(),10)].id]=N(n)}this.commandHandler.trackConnectorChange(this.undoElement),t.prototype.mouseDown.call(this,e)},i.prototype.mouseUp=function(e){return zn(this,void 0,void 0,function(){var i,r,n,o,a,s;return kn(this,function(h){return this.checkPropertyValue(),i=this.commandHandler.renderContainerHelper(e.source)||e.source,this.undoElement.rotateAngle!==i.wrapper.rotateAngle&&(r={rotateAngle:this.undoElement.rotateAngle},n={rotateAngle:i.wrapper.rotateAngle},o={source:e.source,state:"Completed",oldValue:r,newValue:n,cancel:!1},this.commandHandler.triggerEvent(xt.rotateChange,o),void 0,a=N(e.source),this.commandHandler.trackConnectorChange(a),s={type:"RotationChanged",redoObject:N(a),undoObject:N(this.undoElement),category:"Internal",childTable:this.childTable},this.commandHandler.addHistoryEntry(s),this.rotateStart=!1),this.commandHandler.updateSelector(),this.canCancel=void 0,this.tempArgs=void 0,t.prototype.mouseUp.call(this,e),[2]})})},i.prototype.mouseMove=function(i){var r;if(t.prototype.mouseMove.call(this,i),r=this.commandHandler.renderContainerHelper(i.source)||i.source,this.undoElement.rotateAngle===r.wrapper.rotateAngle&&!this.rotateStart){var n={rotateAngle:r.wrapper.rotateAngle},a={source:i.source,state:"Start",oldValue:n,newValue:n,cancel:!1};this.commandHandler.triggerEvent(xt.rotateChange,a),this.rotateStart=!0}this.currentPosition=i.position;var s={x:r.wrapper.offsetX,y:r.wrapper.offsetY},h=o.findAngle(s,this.currentPosition)+90,d=this.commandHandler.snapAngle(h);h=((h=0!==d?d:h)+360)%360;var l={rotateAngle:r.wrapper.rotateAngle},c={rotateAngle:h},p=(i.source,!1),g={source:i.source,state:"Progress",oldValue:l,newValue:c,cancel:p};if(this.commandHandler.triggerEvent(xt.rotateChange,g),g.cancel||(this.blocked=!this.commandHandler.rotateSelectedItems(h-r.wrapper.rotateAngle)),this.commandHandler.canEnableDefaultTooltip()){var u=this.getTooltipContent(i.source);this.commandHandler.showTooltip(i.source,i.position,(0,e.initializeCSPTemplate)(function(){return u}),"RotateTool",this.isTooltipVisible),this.isTooltipVisible=!1}return!this.blocked},i.prototype.getTooltipContent=function(t){return Math.round(t.rotateAngle%360).toString()+"°"},i.prototype.mouseLeave=function(t){this.mouseUp(t)},i.prototype.endAction=function(){t.prototype.endAction.call(this)},i}(Bn),_n=function(t){function i(e,i){var r=t.call(this,e,!0)||this;return r.resizeStart=!1,r.initialBounds=new w,r.canCancel=!1,r.corner=i,r}return En(i,t),i.prototype.mouseDown=function(e){if(this.undoElement=N(e.source),this.undoParentElement=this.commandHandler.getSubProcess(e.source),this.undoContainerElement=this.commandHandler.getContainer(e.source),t.prototype.mouseDown.call(this,e),this.undoElement.nodes[0]&&this.undoElement.nodes[0].children)for(var i=this.commandHandler.getAllDescendants(this.undoElement.nodes[0],[]),r=0;r<i.length;r++){var n=this.commandHandler.cloneChild(i[parseInt(r.toString(),10)].id);this.childTable[i[parseInt(r.toString(),10)].id]=N(n)}this.commandHandler.trackConnectorChange(this.undoElement),this.commandHandler.checkSelection(e.source,this.corner),t.prototype.mouseDown.call(this,e),this.initialBounds.x=e.source.wrapper.offsetX,this.initialBounds.y=e.source.wrapper.offsetY,this.initialBounds.height=e.source.wrapper.actualSize.height,this.initialBounds.width=e.source.wrapper.actualSize.width},i.prototype.mouseUp=function(e,i){return zn(this,void 0,void 0,function(){var r,n,o,a,s,h,d,l;return kn(this,function(c){return this.checkPropertyValue(),this.commandHandler.removeSnap(),this.commandHandler.updateSelector(),r=this.commandHandler.renderContainerHelper(e.source)||e.source,this.undoElement.offsetX===r.wrapper.offsetX&&this.undoElement.offsetY===r.wrapper.offsetY&&this.undoElement.width===r.wrapper.bounds.width&&this.undoElement.height===r.wrapper.bounds.height||(n=this.updateSize(e.source,this.currentPosition,this.prevPosition,this.corner,this.initialBounds),this.blocked=this.scaleObjects(n.width,n.height,this.corner,this.currentPosition,this.prevPosition,r),o={width:e.source.wrapper.actualSize.width,height:e.source.wrapper.actualSize.height},a={source:e.source,state:"Completed",oldValue:this.startValues,newValue:o,cancel:!1},this.commandHandler.triggerEvent(xt.sizeChange,a),s=N(e.source),this.commandHandler.trackConnectorChange(s),h={type:"SizeChanged",redoObject:N(s),undoObject:N(this.undoElement),category:"Internal",childTable:this.childTable},this.resizeStart=!1,i||(this.commandHandler.startGroupAction(),s.nodes[0]&&s.nodes[0].processId&&(d={type:"SizeChanged",redoObject:this.commandHandler.getSubProcess(e.source),undoObject:this.undoParentElement,category:"Internal"},this.commandHandler.addHistoryEntry(d)),s.nodes[0]&&s.nodes[0].parentId&&"Container"===this.commandHandler.diagram.nameTable[s.nodes[0].parentId].shape.type&&(l={type:"SizeChanged",redoObject:this.commandHandler.getContainer(e.source),undoObject:this.undoContainerElement,category:"Internal"},this.commandHandler.addHistoryEntry(l)),this.commandHandler.addHistoryEntry(h),this.commandHandler.endGroupAction())),t.prototype.mouseUp.call(this,e),[2,!this.blocked]})})},i.prototype.mouseMove=function(i){var r;if(t.prototype.mouseMove.call(this,i),r=this.commandHandler.renderContainerHelper(i.source)||i.source,this.undoElement.offsetX===r.wrapper.offsetX&&this.undoElement.offsetY===r.wrapper.offsetY&&!this.resizeStart){var n={width:i.source.wrapper.actualSize.width,height:i.source.wrapper.actualSize.height};this.startValues=n;var o={source:i.source,state:"Start",oldValue:n,newValue:this.currentElement,cancel:!1};this.commandHandler.triggerEvent(xt.sizeChange,o),this.resizeStart=!0}this.currentPosition=i.position;var a={x:this.currentPosition.x-this.startPosition.x,y:this.currentPosition.y-this.startPosition.y};a=Q(-this.currentElement.wrapper.rotateAngle,void 0,void 0,a);this.currentElement.wrapper.actualSize.width,a.x,this.currentElement.wrapper.actualSize.width,this.currentElement.wrapper.actualSize.height,a.y,this.currentElement.wrapper.actualSize.height;a=this.getChanges(a),this.commandHandler.removeSnap();var s=this.updateSize(i.source,this.startPosition,this.currentPosition,this.corner,this.initialBounds);if(this.blocked=!this.scaleObjects(s.width,s.height,this.corner,this.startPosition,this.currentPosition,r),this.commandHandler.canEnableDefaultTooltip()){var h=this.getTooltipContent(i.source);this.commandHandler.showTooltip(i.source,i.position,(0,e.initializeCSPTemplate)(function(){return h}),"ResizeTool",this.isTooltipVisible),this.isTooltipVisible=!1}else this.isTooltipVisible&&(this.commandHandler.closeTooltip(),this.isTooltipVisible=!1);return this.prevPosition=this.currentPosition,!this.blocked},i.prototype.mouseLeave=function(t){this.mouseUp(t)},i.prototype.getTooltipContent=function(t){return"W:"+Math.round(t.wrapper.bounds.width)+" H:"+Math.round(t.wrapper.bounds.height)},i.prototype.getChanges=function(t){switch(this.corner){case"ResizeEast":return{x:t.x,y:0};case"ResizeSouthEast":return t;case"ResizeSouth":return{x:0,y:t.y};case"ResizeNorth":return{x:0,y:-t.y};case"ResizeNorthEast":return{x:t.x,y:-t.y};case"ResizeNorthWest":return{x:-t.x,y:-t.y};case"ResizeWest":return{x:-t.x,y:0};case"ResizeSouthWest":return{x:-t.x,y:t.y}}return t},i.prototype.scaleObjects=function(t,e,i,r,n,o){var a=this.commandHandler.diagram.selectedItems;(o instanceof qh&&1===o.nodes.length&&o.nodes[0].constraints&ht.AspectRatio||o instanceof Yh&&"helper"===o.id&&1===a.nodes.length&&a.nodes[0].constraints&ht.AspectRatio)&&("ResizeWest"===i||"ResizeEast"===i||"ResizeNorth"===i||"ResizeSouth"===i?1===e&&1===t||(e=t=Math.max(1===e?0:e,1===t?0:t)):e=t=Math.max(e,t));var s={width:o.width,height:o.height};this.blocked=this.commandHandler.scaleSelectedItems(t,e,this.getPivot(this.corner));var h,d={width:o.width,height:o.height};return h={source:o,state:"Progress",oldValue:s,newValue:d,cancel:{source:o,state:"Progress",oldValue:s,newValue:d,cancel:!1}.cancel},this.commandHandler.triggerEvent(xt.sizeChange,h),(h.cancel||this.canCancel)&&this.commandHandler.scaleSelectedItems(1/t,1/e,this.getPivot(this.corner)),this.blocked},i}(Bn),Yn=function(t){function e(e,i){var r=t.call(this,e,!0)||this;return r.sourceObject=i,r}return En(e,t),e.prototype.mouseDown=function(e){t.prototype.mouseDown.call(this,e),this.inAction=!0,this.commandHandler.setFocus(),this.triggerElementDrawEvent(e.source,"Start","Node",this.getShapeType(),!0)},e.prototype.mouseMove=function(e){var i;t.prototype.mouseMove.call(this,e);var r={offsetX:this.currentPosition.x,width:3,height:3,offsetY:this.currentPosition.y};if(this.drawingObject||(this.drawingObject=this.commandHandler.drawObject(r)),this.triggerElementDrawEvent(this.drawingObject,"Progress","Node",this.getShapeType(),!1),this.inAction&&!1===o.equals(this.currentPosition,this.prevPosition)){var n=w.toBounds([this.prevPosition,this.currentPosition]);(i=this.commandHandler.checkBoundaryConstraints(void 0,void 0,n))&&this.commandHandler.updateNodeDimension(this.drawingObject,n)}return i},e.prototype.mouseUp=function(e){this.checkPropertyValue();var i=w.toBounds([this.prevPosition,this.currentPosition]);this.commandHandler.checkBoundaryConstraints(void 0,void 0,i),this.drawingObject&&this.drawingObject instanceof Yh&&(this.commandHandler.addObjectToDiagram(this.drawingObject),this.triggerElementDrawEvent(this.drawingObject,"Completed","Node",this.getShapeType(),!1),this.drawingObject=null),t.prototype.mouseUp.call(this,e),this.inAction=!1},e.prototype.endAction=function(){t.prototype.endAction.call(this)},e.prototype.mouseLeave=function(t){this.inAction&&this.mouseUp(t)},e}(Bn),Fn=function(t){function e(e,i,r){var n=t.call(this,e,i)||this;return n.sourceObject=r,n.toolName="ConnectorDrawingTool",n}return En(e,t),e.prototype.mouseDown=function(e){return zn(this,void 0,void 0,function(){return kn(this,function(i){return t.prototype.mouseDown.call(this,e),this.inAction=!0,this.commandHandler.setFocus(),this.triggerElementDrawEvent(e.source,"Start","Connector",this.commandHandler.diagram.drawingObject.type,!0),[2]})})},e.prototype.mouseMove=function(e){if(this.commandHandler.enableServerDataBinding(!1),this.inAction){var i={sourcePoint:this.currentPosition,targetPoint:this.currentPosition};if(this.drawingObject||(this.drawingObject=this.commandHandler.drawObject(i)),e.source=this.drawingObject,this.triggerElementDrawEvent(e.source,"Progress","Connector",this.drawingObject.type,!1),e.actualObject&&(e.actualObject.parentId||e.actualObject.children)&&""===this.drawingObject.sourceID&&""===this.drawingObject.targetID&&this.setTarget(e),(e.target&&e.target instanceof Yh||e.actualObject&&e.sourceWrapper&&Ts(e.actualObject,e.sourceWrapper))&&("ConnectorTargetEnd"!==this.endPoint||Qi(e.target))){if(e.sourceWrapper&&e.actualObject&&!e.actualObject.isPhase&&!e.actualObject.isLane){var r=e.sourceWrapper.id.split("_")[0],n=e.sourceWrapper.id.split("_")[1],o=e.actualObject.ports.find(function(t){return t.id===n});if(o&&Ki(o)&&!$i(o)&&e.sourceWrapper instanceof Qt){if(this.endPoint="ConnectorTargetEnd",e.targetWrapper=e.sourceWrapper,e.sourceWrapper=null,!e.target||e.target&&e.target.id!==r){var a=this.commandHandler.diagram.nameTable[""+r];e.target=a||e.target}this.commandHandler.connect(this.endPoint,e),this.endPoint="ConnectorSourceEnd"}else this.commandHandler.connect(this.endPoint,e),this.endPoint="ConnectorTargetEnd"}}else""===this.drawingObject.targetID&&(this.endPoint="ConnectorTargetEnd")}return this.inAction||(this.commandHandler.updateSelector(),e.source&&!e.source.isLane&&e.sourceWrapper&&this.commandHandler.renderHighlighter(e,!0)),t.prototype.mouseMove.call(this,e),this.commandHandler.enableServerDataBinding(!0),!this.blocked},e.prototype.setTarget=function(t){t.target?t.sourceWrapper.id.includes(t.target.id)||t.target.parentId&&t.sourceWrapper.id.includes(t.target.parentId)&&(t.target=this.commandHandler.diagram.nameTable[t.target.parentId]):t.sourceWrapper.id.includes(t.actualObject.id)?t.target=t.actualObject:t.actualObject.parentId&&t.sourceWrapper.id.includes(t.actualObject.parentId)&&(t.target=this.commandHandler.diagram.nameTable[t.actualObject.parentId])},e.prototype.mouseUp=function(e){return zn(this,void 0,void 0,function(){return kn(this,function(i){return this.commandHandler.enableServerDataBinding(!1),this.checkPropertyValue(),this.drawingObject&&this.drawingObject instanceof Co&&(this.commandHandler.addObjectToDiagram(this.drawingObject),this.triggerElementDrawEvent(this.drawingObject,"Completed","Connector",this.drawingObject.type,!1),this.drawingObject=null),this.inAction=!1,this.commandHandler&&(this.commandHandler.enableServerDataBinding(!0),t.prototype.mouseUp.call(this,e)),[2]})})},e.prototype.endAction=function(){t.prototype.endAction.call(this)},e.prototype.mouseLeave=function(t){this.inAction&&this.mouseUp(t)},e}(jn),Xn=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseDown=function(e){t.prototype.mouseDown.call(this,e),this.commandHandler.clearSelection();var i={shape:{type:"Text"},offsetX:this.currentPosition.x,offsetY:this.currentPosition.y};e.source||(this.drawingNode=this.commandHandler.drawObject(i))},e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),this.drawingNode)this.drawingNode.style.strokeColor="black",this.drawingNode.style.strokeDashArray="2 2",this.drawingNode.style.fill="transparent";else{var i={shape:{type:"Text"},offsetX:this.currentPosition.x,width:30,height:30,offsetY:this.currentPosition.y};this.drawingNode=this.commandHandler.drawObject(i),this.drawingNode.style.strokeDashArray="2 2",this.drawingNode.style.fill="transparent"}if(this.inAction&&!1===o.equals(this.currentPosition,this.prevPosition)){var r=w.toBounds([this.prevPosition,this.currentPosition]);this.commandHandler.updateNodeDimension(this.drawingNode,r)}return!this.blocked},e.prototype.mouseUp=function(e){this.checkPropertyValue(),this.drawingNode?(this.drawingNode.style.strokeColor="none",this.drawingNode.style.fill="none"):this.drawingNode=e.source,this.drawingNode&&this.drawingNode instanceof Yh&&this.commandHandler.addText(this.drawingNode,this.currentPosition),t.prototype.mouseUp.call(this,e),this.inAction=!1},e.prototype.endAction=function(){t.prototype.endAction.call(this)},e}(Bn),Vn=function(t){function e(e,i){var r=t.call(this,e)||this;return r.zooming=i,r}return En(e,t),e.prototype.mouseDown=function(e){t.prototype.mouseDown.call(this,e),this.inAction=!0,this.commandHandler.setBlazorDiagramProps(!0)},e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),this.inAction)if(this.zooming||!1!==o.equals(this.currentPosition,this.prevPosition)){if(e.moveTouches&&e.moveTouches.length&&e.moveTouches.length>=2){var i=e.startTouches[0],r=e.startTouches[1],n=e.moveTouches[0],a=e.moveTouches[1],s=this.getDistance(n,a)/this.getDistance(i,r),h=e.position;1!==s&&this.commandHandler.zoom(s,0,0,h),this.updateTouch(i,n),this.updateTouch(r,a)}}else{var d=this.currentPosition.x-this.prevPosition.x,l=this.currentPosition.y-this.prevPosition.y;this.commandHandler.scroll(d,l,this.currentPosition)}return this.commandHandler.dataBinding(),!this.blocked},e.prototype.mouseUp=function(e){this.commandHandler.setBlazorDiagramProps(!1),this.checkPropertyValue(),this.commandHandler.updatePanState(!1),t.prototype.mouseUp.call(this,e),this.inAction=!1},e.prototype.endAction=function(){t.prototype.endAction.call(this)},e.prototype.getDistance=function(t,e){var i=e.pageX-t.pageX,r=e.pageY-t.pageY;return Math.sqrt(i*i+r*r)},e.prototype.updateTouch=function(t,e){t.pageX=e.pageX,t.pageY=e.pageY},e}(Bn),Un=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseUp=function(e){this.checkPropertyValue(),this.commandHandler.initExpand(e),t.prototype.mouseUp.call(this,e)},e}(Bn),Gn=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseUp=function(e){this.checkPropertyValue();var i="_blank",r="",n=window.innerHeight,o=window.innerWidth,a=window.screenTop,s=window.screenLeft;"CurrentTab"===e.sourceWrapper.hyperlink.hyperlinkOpenState?i="_self":"NewWindow"===e.sourceWrapper.hyperlink.hyperlinkOpenState&&(r="height="+n+",width="+o+",top="+a+",left="+s),window.open(e.sourceWrapper.hyperlink.link,i,r).focus(),t.prototype.mouseUp.call(this,e)},e}(Bn),Zn=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseDown=function(e){if(t.prototype.mouseDown.call(this,e),this.inAction=!0,this.drawingObject){var i=void 0,r=this.drawingObject.shape;i={x:(i=r.points[r.points.length-1]).x,y:i.y},this.drawingObject.shape.points.push(i)}else{this.startPoint={x:this.startPosition.x,y:this.startPosition.y};var n={offsetX:this.currentPosition.x,offsetY:this.currentPosition.y,width:5,height:5,shape:{type:"Basic",shape:"Polygon",points:[{x:this.startPoint.x,y:this.startPoint.y},{x:this.currentPosition.x,y:this.currentPosition.y}]}};this.triggerElementDrawEvent(e.source,"Start","Node",this.getShapeType(),!0),this.drawingObject=this.commandHandler.drawObject(n)}},e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),this.inAction){var i=this.drawingObject.shape;if(i.points[i.points.length-1].x=this.currentPosition.x,i.points[i.points.length-1].y=this.currentPosition.y,this.drawingObject.wrapper.children[0].data=c(this.drawingObject.shape.points),this.triggerElementDrawEvent(this.drawingObject,"Progress","Node",this.getShapeType(),!1),this.inAction&&!1===o.equals(this.currentPosition,this.prevPosition)){var r=w.toBounds(this.drawingObject.shape.points);this.commandHandler.updateNodeDimension(this.drawingObject,r)}}return!0},e.prototype.mouseUp=function(e,i){this.checkPropertyValue(),t.prototype.mouseMove.call(this,e),this.inAction&&(this.inAction=!1,this.commandHandler.addObjectToDiagram(this.drawingObject),this.triggerElementDrawEvent(this.drawingObject,"Completed","Node",this.getShapeType(),!1)),this.endAction()},e.prototype.mouseWheel=function(e){t.prototype.mouseWheel.call(this,e),this.mouseMove(e)},e.prototype.endAction=function(){this.inAction=!1,this.drawingObject=null},e}(Bn),qn=function(t){function e(e){var i=t.call(this,e,!0)||this;return i.connectorEndPoint="ConnectorSourceEnd",i}return En(e,t),e.prototype.mouseMove=function(e){t.prototype.mouseMove.call(this,e);if(this.inAction){var i=this.drawingObject;this.currentPosition=this.commandHandler.snapConnectorEnd(this.currentPosition),i.targetPoint=this.currentPosition,this.triggerElementDrawEvent(this.drawingObject,"Progress","Connector",this.commandHandler.diagram.drawingObject.type,!1),this.commandHandler.updateConnectorPoints(i),e.source=this.drawingObject,e.target&&!e.target.isLane&&e.targetWrapper&&this.canConnect(e.targetWrapper,e.target,this.connectorEndPoint,"In")&&this.commandHandler.renderHighlighter(e,"ConnectorSourceEnd"===this.connectorEndPoint),"ConnectorSourceEnd"===this.connectorEndPoint&&e.actualObject&&e.actualObject instanceof Yh&&e.sourceWrapper&&(""!==e.source.sourceID&&e.source.sourceID===e.source.targetID||this.commandHandler.connect(this.connectorEndPoint,e)),this.connectorEndPoint="ConnectorTargetEnd"}return this.inAction||(this.commandHandler.updateSelector(),e.source&&!e.source.isLane&&e.sourceWrapper&&this.canConnect(e.sourceWrapper,e.source,this.connectorEndPoint,"Out")&&this.commandHandler.renderHighlighter(e,!0)),!0},e.prototype.mouseDown=function(e){if(t.prototype.mouseDown.call(this,e),this.inAction=!0,this.drawingObject){var i=this.drawingObject,r=void 0;(r=new po(i,"segments",{type:"Straight"},!0)).point=this.currentPosition,i.segments[i.segments.length-1]=r}else{var n={id:"Connector",type:"Straight",sourcePoint:this.currentPosition,targetPoint:this.currentPosition};this.triggerElementDrawEvent(e.source,"Start","Connector",this.commandHandler.diagram.drawingObject.type,!0),this.inAction&&(this.drawingObject=this.commandHandler.drawObject(n))}},e.prototype.mouseWheel=function(e){t.prototype.mouseWheel.call(this,e),this.mouseMove(e)},e.prototype.mouseUp=function(e){if(this.checkPropertyValue(),t.prototype.mouseMove.call(this,e),this.inAction&&this.drawingObject){if("ConnectorTargetEnd"===this.connectorEndPoint){var i=this.commandHandler.diagram.eventHandler,r=i.hoverElement;if(r){r=r instanceof Yh?r:r.parentObj;var n=i.getConnectorPadding(e),o=this.commandHandler.diagram.findElementUnderMouse(r,this.currentPosition,this.commandHandler.diagram,n);o&&o.bounds.containsPoint(this.currentPosition,n)&&(e.actualObject=r,e.target=r,e.targetWrapper=o,this.drawingObject.sourceID!==e.target.id&&this.commandHandler.connect(this.connectorEndPoint,e))}}var a=this.drawingObject;a.segments[a.segments.length-1].point={x:0,y:0},this.commandHandler.addObjectToDiagram(this.drawingObject),this.triggerElementDrawEvent(this.drawingObject,"Completed","Connector",this.commandHandler.diagram.drawingObject.type,!1)}this.endAction()},e.prototype.endAction=function(){this.drawingObject=null,this.inAction=!1},e.prototype.canConnect=function(t,e,i,r){var n=!1,o=this.commandHandler.findTarget(t,e,"ConnectorSourceEnd"===i,!0);return o instanceof ye?n=Boolean("In"===r?"ConnectorTargetEnd"===this.connectorEndPoint&&Ki(o):"ConnectorSourceEnd"===this.connectorEndPoint&&$i(o)):o instanceof Yh&&(n=Boolean("In"===r?"ConnectorTargetEnd"===this.connectorEndPoint&&Qi(o):"ConnectorSourceEnd"===this.connectorEndPoint&&Ji(o))),n},e}(Bn),Qn=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseDown=function(e){this.inAction=!0,this.undoElement=N(e.source),this.annotationId=e.sourceWrapper.id,t.prototype.mouseDown.call(this,e)},e.prototype.mouseMove=function(e){t.prototype.mouseMove.call(this,e);var i=this.currentPosition.x-this.prevPosition.x,r=this.currentPosition.y-this.prevPosition.y,n=e.source;if(n instanceof Yh){var o=I();T(o,-n.rotateAngle,0,0);var a=P(o,{x:i,y:r});i=a.x,r=a.y}return this.inAction&&(this.commandHandler.labelDrag(e.source,e.sourceWrapper,i,r),this.commandHandler.updateSelector()),this.prevPosition=this.currentPosition,!this.blocked},e.prototype.mouseUp=function(e){this.checkPropertyValue();var i=e.source;this.inAction=!1;var r={type:"AnnotationPropertyChanged",objectId:this.annotationId,undoObject:N(this.undoElement),category:"Internal",redoObject:N(i)};this.commandHandler.addHistoryEntry(r),t.prototype.mouseUp.call(this,e)},e.prototype.mouseLeave=function(t){this.mouseUp(t)},e}(Bn),Kn=function(t){function e(e,i){var r=t.call(this,e,!0)||this;return r.corner=i,r}return En(e,t),e.prototype.mouseDown=function(e){this.inAction=!0;var i=e.source.nodes.length?e.source.nodes[0]:e.source.connectors[0];this.annotationId=e.source.wrapper.children[0].id,this.undoElement=N(i);var r=e.source.wrapper.children[0];this.initialBounds={x:r.offsetX,y:r.offsetY,width:r.actualSize.width,height:r.actualSize.height},t.prototype.mouseDown.call(this,e)},e.prototype.mouseMove=function(e){return t.prototype.mouseMove.call(this,e),this.inAction&&this.resizeObject(e),!this.blocked},e.prototype.mouseUp=function(e){this.checkPropertyValue();var i=e.source.nodes.length?e.source.nodes[0]:e.source.connectors[0];this.inAction=!1;var r={type:"AnnotationPropertyChanged",objectId:this.annotationId,redoObject:N(i),undoObject:N(this.undoElement),category:"Internal"};this.commandHandler.addHistoryEntry(r),t.prototype.mouseUp.call(this,e)},e.prototype.mouseLeave=function(t){this.mouseUp(t)},e.prototype.resizeObject=function(t){var e;e=t.source.nodes.length?t.source.nodes[0]:t.source.connectors[0];var i,r,n=t.source.wrapper.children[0],o={x:n.offsetX,y:n.offsetY},a=n.rotateAngle;a=((a+=e instanceof Yh?e.rotateAngle:0)+360)%360;var s=I(),h=this.corner.slice(5),d=this.updateSize(n,this.startPosition,this.currentPosition,h,this.initialBounds,a),l=n.offsetX-n.actualSize.width*n.pivot.x,c=n.offsetY-n.actualSize.height*n.pivot.y,p=this.getPivot(h);if(n.flippedPoint){if(n.flip===tt.Horizontal&&"Center"!==n.horizontalAlignment){if(p.x=1-p.x,0!==a)a=0===(g=(a%360+360)%360)?0:360-g}else if(n.flip===tt.Vertical&&"Center"!==n.verticalAlignment){var g;if(p.y=1-p.y,0!==a)a=0===(g=(a%360+360)%360)?0:360-g}n.flip===tt.Both&&("Center"!==n.horizontalAlignment&&(p.x=1-p.x),"Center"!==n.verticalAlignment&&(p.y=1-p.y))}T(s,a,o.x,o.y);var u=P(s,p={x:l+n.actualSize.width*p.x,y:c+n.actualSize.height*p.y});d.x=u.x,d.y=u.y,i=(i=d.width)<0?1:i,r=(r=d.height)<0?1:r,this.commandHandler.labelResize(e,t.source.annotation,i,r,d,t.source),this.commandHandler.updateSelector()},e}(Bn),Jn=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseDown=function(e){this.inAction=!0,this.annotationId=e.source.wrapper.children[0].id;var i=e.source.nodes.length?e.source.nodes[0]:e.source.connectors[0];this.undoElement=N(i),t.prototype.mouseDown.call(this,e)},e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),e.source&&this.inAction){var i,r=e.source.nodes[0]?e.source.nodes[0]:e.source.connectors[0];i=e.source.annotation,this.commandHandler.labelRotate(r,i,this.currentPosition,e.source),this.commandHandler.updateSelector()}return this.prevPosition=this.currentPosition,!this.blocked},e.prototype.mouseUp=function(e){this.checkPropertyValue(),this.inAction=!1;var i=e.source.nodes.length?e.source.nodes[0]:e.source.connectors[0],r={type:"AnnotationPropertyChanged",objectId:this.annotationId,redoObject:N(i),undoObject:N(this.undoElement),category:"Internal"};this.commandHandler.addHistoryEntry(r),t.prototype.mouseUp.call(this,e)},e.prototype.mouseLeave=function(t){this.mouseUp(t)},e}(Bn),$n=function(t){function e(e){return t.call(this,e,!0)||this}return En(e,t),e.prototype.mouseMove=function(e){if(t.prototype.mouseMove.call(this,e),this.inAction){var i=this.drawingObject.shape,r=this.currentPosition;if(r=this.commandHandler.snapConnectorEnd(this.currentPosition),i.points.push(r),this.drawingObject.wrapper.children[0].data=p(this.drawingObject.shape.points),i.data=p(i.points),this.triggerElementDrawEvent(e.source,"Progress","Connector",this.drawingObject.type,!1),this.inAction&&!1===o.equals(this.currentPosition,this.prevPosition)){var n=w.toBounds(this.drawingObject.shape.points);this.commandHandler.updateNodeDimension(this.drawingObject,n)}}return!0},e.prototype.mouseDown=function(e){t.prototype.mouseDown.call(this,e),this.inAction=!0,this.startPoint={x:this.startPosition.x,y:this.startPosition.y};var i={offsetX:this.currentPosition.x,offsetY:this.currentPosition.y,width:5,height:5,style:{strokeColor:"black",strokeWidth:1,fill:"transparent"},shape:{type:"Path",points:[{x:this.startPoint.x,y:this.startPoint.y},{x:this.currentPosition.x,y:this.currentPosition.y}]}};this.triggerElementDrawEvent(e.source,"Start","Connector",this.commandHandler.diagram.drawingObject.type,!0),this.drawingObject=this.commandHandler.drawObject(i)},e.prototype.mouseUp=function(e){this.checkPropertyValue();if(this.inAction){this.inAction=!1;var i=this.drawingObject.shape,r=i.points;this.commandHandler.addObjectToDiagram(this.drawingObject);var n=this.drawingObject.id,o=this.commandHandler.diagram.nameTable[""+n];this.commandHandler.diagram.remove(o),r=this.pointReduction(r,10);var a={};this.commandHandler.diagram.drawingObject.bezierSettings&&(a=this.commandHandler.diagram.drawingObject.bezierSettings),void 0===a.allowSegmentsReset&&(a.allowSegmentsReset=!1);var s={id:"newConnector"+E(),type:"Bezier",sourcePoint:{x:r[0].x,y:r[0].y},targetPoint:{x:r[r.length-1].x,y:r[r.length-1].y},segments:[],bezierSettings:a};this.drawingObject=this.commandHandler.drawObject(s),this.drawingObject=this.bezierCurveSmoothness(r,.5,this.drawingObject,i),this.commandHandler.updateConnectorPoints(this.drawingObject),this.commandHandler.addObjectToDiagram(this.drawingObject),this.triggerElementDrawEvent(this.drawingObject,"Completed","Connector",this.commandHandler.diagram.drawingObject.type,!1),t.prototype.mouseUp.call(this,e)}},e.prototype.pointReduction=function(t,e){if(null===t||t.length<3)return t;var i=t.length-1,r=[];for(r.push(0),r.push(i);t[parseInt((0).toString(),10)]===t[parseInt(i.toString(),10)];)i--;this.reduction(t,0,i,e,r);var n=[];return r.sort(function(t,e){return t-e}),r.forEach(function(e){n.push(t[parseInt(e.toString(),10)])}),n},e.prototype.reduction=function(t,e,i,r,n){for(var o=0,a=0,s=e;s<i;s++){var h=this.perpendicularDistance(t[parseInt(e.toString(),10)],t[parseInt(i.toString(),10)],t[parseInt(s.toString(),10)]);h>o&&(o=h,a=s)}o>r&&0!==a&&(n.push(a),this.reduction(t,e,a,r,n),this.reduction(t,a,i,r,n))},e.prototype.perpendicularDistance=function(t,e,i){return Math.abs(.5*(t.x*e.y-e.x*t.y+(e.x*i.y-i.x*e.y)+(i.x*t.y-t.x*i.y)))/Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))*2},e.prototype.bezierCurveSmoothness=function(t,e,i,r){if(t.length<3)return i;for(var n=0;n<t.length-1;n++){var a=t[parseInt(n.toString(),10)].x,s=t[parseInt(n.toString(),10)].y,h=t[n+1].x,d=t[n+1].y,l=void 0,c=void 0;if(0===n){var p=t[parseInt(n.toString(),10)];l=p.x,c=p.y}else l=t[n-1].x,c=t[n-1].y;var g=void 0,u=void 0;if(n===t.length-2){var f=t[n+1];g=f.x,u=f.y}else g=t[n+2].x,u=t[n+2].y;var m=(l+a)/2,y=(c+s)/2,v=(a+h)/2,b=(s+d)/2,S=(h+g)/2,w=(d+u)/2,x={},I={},P={},C={};x.x=l,x.y=c,I.x=a,I.y=s,P.x=h,P.y=d,C.x=g,C.y=u;var T=o.findLength(x,I),A=o.findLength(I,P),O=T/(T+A),D=A/(A+o.findLength(P,C)),M=m+(v-m)*O,L=y+(b-y)*O,E=v+(S-v)*D,z=b+(w-b)*D,k=M+(v-M)*e+a-M,B=L+(b-L)*e+s-L,R=E+(v-E)*e+h-E,N=z+(b-z)*e+d-z,j=new go(r,"segments",{type:"Bezier"},!0),H={x:k,y:B},W={x:R,y:N},_={x:a,y:s},Y={x:h,y:d};j.type="Bezier",i.segments[parseInt(n.toString(),10)]=j,0===n&&(H={x:a,y:s}),n===t.length-2&&(W={x:h,y:d}),i.segments[parseInt(n.toString(),10)].vector1={angle:ai(_,H),distance:o.findLength(_,H)},i.segments[parseInt(n.toString(),10)].vector2={angle:ai(Y,W),distance:o.findLength(Y,W)},i.segments[parseInt(n.toString(),10)].point=Y}return i},e}(Bn),to=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),eo=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},io=function(t){if(t)switch(t.type){case"Bpmn":return lo;case"UmlActivity":return ho;case"UmlClassifier":return Io;default:return so}return so},ro=function(t){if(t)switch(t.type){case"Straight":default:return po;case"Bezier":return go;case"Orthogonal":return uo}},no=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)(10)],i.prototype,"width",void 0),eo([(0,e.Property)(10)],i.prototype,"height",void 0),eo([(0,e.Property)("Arrow")],i.prototype,"shape",void 0),eo([(0,e.Complex)({fill:"black",strokeColor:"black",strokeWidth:1},Bt)],i.prototype,"style",void 0),eo([(0,e.Complex)({x:0,y:.5},o)],i.prototype,"pivot",void 0),eo([(0,e.Property)("")],i.prototype,"pathData",void 0),i}(e.ChildProperty),oo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)(0)],i.prototype,"angle",void 0),eo([(0,e.Property)(0)],i.prototype,"distance",void 0),i}(e.ChildProperty),ao=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)(Ht.All)],i.prototype,"controlPointsVisibility",void 0),eo([(0,e.Property)("FreeForm")],i.prototype,"segmentEditOrientation",void 0),eo([(0,e.Property)(Wt.Default)],i.prototype,"smoothness",void 0),eo([(0,e.Property)(!0)],i.prototype,"allowSegmentsReset",void 0),i}(e.ChildProperty),so=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("None")],i.prototype,"type",void 0),i}(e.ChildProperty),ho=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("Object")],i.prototype,"flow",void 0),eo([(0,e.Property)(30)],i.prototype,"exceptionFlowHeight",void 0),i}(so),lo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("Sequence")],i.prototype,"flow",void 0),eo([(0,e.Property)("Normal")],i.prototype,"sequence",void 0),eo([(0,e.Property)("Default")],i.prototype,"message",void 0),eo([(0,e.Property)("Default")],i.prototype,"association",void 0),i}(so),co=function(t){function i(e,i,r,n){var o=t.call(this,e,i,r,n)||this;return o.points=[],o}return to(i,t),eo([(0,e.Property)("Straight")],i.prototype,"type",void 0),eo([(0,e.Property)(!0)],i.prototype,"allowDrag",void 0),i}(e.ChildProperty),po=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),i.prototype.getClassName=function(){return"StraightSegment"},eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point",void 0),i}(co),go=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),i.prototype.getClassName=function(){return"BezierSegment"},i.prototype.getPoints=function(t,e){var i=[];if(i.length>0||null!=e){var r=i.length>0?i[i.length-1]:e,n=this.bezireToPoly(r,t);i.push.apply(i,n)}return i},i.prototype.bezireToPoly=function(t,e){var i=[];if(e){var r=e,n=t,o=r.bezierPoint1,a=r.bezierPoint2,s={x:r.points[1].x,y:r.points[1].y};this.flattenCubicBezier(i,n,o,a,s,10)}return i},i.prototype.flattenCubicBezier=function(t,e,i,r,n,a){var s,h=(o.findLength(e,i)+o.findLength(i,r)+o.findLength(r,n))/a;for(s=0;s<=h;s++){var d=s/h,l=(1-d)*(1-d)*(1-d)*e.x+3*d*(1-d)*(1-d)*i.x+3*d*d*(1-d)*r.x+d*d*d*n.x,c=(1-d)*(1-d)*(1-d)*e.y+3*d*(1-d)*(1-d)*i.y+3*d*d*(1-d)*r.y+d*d*d*n.y;t.push({x:l,y:c})}},eo([(0,e.Property)("Horizontal")],i.prototype,"orientation",void 0),eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point1",void 0),eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point2",void 0),eo([(0,e.Complex)({angle:0,distance:0},oo)],i.prototype,"vector1",void 0),eo([(0,e.Complex)({angle:0,distance:0},oo)],i.prototype,"vector2",void 0),i}(po),uo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),i.prototype.getClassName=function(){return"OrthogonalSegment"},eo([(0,e.Property)(null)],i.prototype,"length",void 0),eo([(0,e.Property)(null)],i.prototype,"direction",void 0),i}(co),fo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),i.prototype.getClassName=function(){return"DiagramConnectorSegment"},eo([(0,e.Property)("Straight")],i.prototype,"type",void 0),eo([(0,e.Property)(!0)],i.prototype,"allowDrag",void 0),eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point",void 0),eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point1",void 0),eo([(0,e.Complex)({x:0,y:0},o)],i.prototype,"point2",void 0),eo([(0,e.Complex)({angle:0,distance:0},oo)],i.prototype,"vector1",void 0),eo([(0,e.Complex)({angle:0,distance:0},oo)],i.prototype,"vector2",void 0),eo([(0,e.Property)(null)],i.prototype,"length",void 0),eo([(0,e.Property)(null)],i.prototype,"direction",void 0),i}(e.ChildProperty);function mo(t,e,i){var r=t.center,n=i?45:180/(2+2/(t.height/t.width)),o=n,a=180-n,s=a+2*n,h=360-n,d=ai(e,r);return d>o&&d<a?"top":d>a&&d<s?"right":d>s&&d<h?"bottom":"left"}function yo(t){return!t.distance&&!t.angle}function vo(t,e,i){var r=60,n={x:0,y:0};switch(i||(i=Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?t.x<e.x?"right":"left":t.y<e.y?"bottom":"top"),i){case"bottom":case"top":r=Math.min(.45*Math.abs(t.y-e.y),r),n={x:t.x,y:t.y+("bottom"===i?r:-r)};break;case"right":case"left":r=Math.min(.45*Math.abs(t.x-e.x),r),n={x:t.x+("right"===i?r:-r),y:t.y}}return n}function bo(t,e,i,r,n){var o=0,a=0,s=0,h=0,d=Number((n.distance(e,t)+n.distance(i,e)+n.distance(r,i))/3);if(0!==d)for(var l=0;l<=d;l++){var c=l/d,p=(1-c)*(1-c)*(1-c)*t.x+3*c*(1-c)*(1-c)*e.x+3*c*c*(1-c)*i.x+c*c*c*r.x,g=(1-c)*(1-c)*(1-c)*t.y+3*c*(1-c)*(1-c)*e.y+3*c*c*(1-c)*i.y+c*c*c*r.y;0===l?(o=s=p,a=h=g):(o=Math.min(p,o),a=Math.min(g,a),s=Math.max(p,s),h=Math.max(g,h))}return{x:o,y:a,width:s-o,height:h-a,left:o,top:a,right:o+(s-o),bottom:a+(h-a),center:{x:(o+(s-o))/2,y:(a+(h-a))/2}}}function So(t,e,i,r,n,o,a){var s={x:0,y:0},h=o/a,d=(1-h)*(1-h)*(1-h)*e.x+3*h*(1-h)*(1-h)*i.x+3*h*h*(1-h)*r.x+h*h*h*n.x;s.x=d;var l=(1-h)*(1-h)*(1-h)*e.y+3*h*(1-h)*(1-h)*i.y+3*h*h*(1-h)*r.y+h*h*h*n.y;return s.y=l,s}var wo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)(!0)],i.prototype,"optional",void 0),eo([(0,e.Property)(void 0)],i.prototype,"lowerBounds",void 0),eo([(0,e.Property)(void 0)],i.prototype,"upperBounds",void 0),i}(e.ChildProperty),xo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("OneToOne")],i.prototype,"type",void 0),eo([(0,e.Complex)({},wo)],i.prototype,"target",void 0),eo([(0,e.Complex)({},wo)],i.prototype,"source",void 0),i}(e.ChildProperty),Io=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("UmlClassifier")],i.prototype,"type",void 0),eo([(0,e.Property)("Aggregation")],i.prototype,"relationship",void 0),eo([(0,e.Property)("Default")],i.prototype,"associationType",void 0),eo([(0,e.Complex)({},xo)],i.prototype,"multiplicity",void 0),i}(so),Po=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return to(i,t),eo([(0,e.Property)("None")],i.prototype,"type",void 0),eo([(0,e.Property)("Default")],i.prototype,"associationType",void 0),eo([(0,e.Property)("Aggregation")],i.prototype,"relationship",void 0),eo([(0,e.Complex)({},xo)],i.prototype,"multiplicity",void 0),eo([(0,e.Property)("Sequence")],i.prototype,"bpmnFlow",void 0),eo([(0,e.Property)("Default")],i.prototype,"message",void 0),eo([(0,e.Property)("Normal")],i.prototype,"sequence",void 0),eo([(0,e.Property)("Default")],i.prototype,"association",void 0),eo([(0,e.Property)("Object")],i.prototype,"umlActivityFlow",void 0),eo([(0,e.Property)(30)],i.prototype,"exceptionFlowHeight",void 0),i}(e.ChildProperty),Co=function(t){function r(e,i,r,n){var o=t.call(this,e,i,r,n)||this;return o.parentId="",o.showDefaultTooltipForPalette=!0,o.bridges=[],o.status="None",o.outEdges=[],o.inEdges=[],o.shape&&"UmlActivity"===o.shape.type&&na(r,o),r&&r.shape&&"None"!==r.shape.type&&oa(r,o),o}return to(r,t),r.prototype.setPortID=function(t,e){if(this.targetID&&this.sourceID)for(var i=t.nameTable[this.targetID],r=t.nameTable[this.sourceID],n=e?i&&i.ports:r&&r.ports,o=void 0,a=0;n&&a<n.length;a++)o=n[parseInt(a.toString(),10)],this.targetPortID===o.id&&e?!(o.constraints&It.None)&&o.constraints&It.InConnect||(this.targetPortID=""):this.sourcePortID!==o.id||e||!(o.constraints&It.None)&&o.constraints&It.OutConnect||(this.sourcePortID="")},r.prototype.init=function(t){var e;this.id||(this.id=E()),this.sourcePortID&&this.setPortID(t),this.targetPortID&&this.setPortID(t,!0);var i=new te,r=new Qt;r.id=this.id+"_path";var n=new Qt,a=new Qt;r=this.getSegmentElement(this,r);var s=[];s="Bezier"===this.type?this.intermediatePoints:this.getConnectorPoints(this.type),s=this.clipDecorators(this,s);var h=w.toBounds(s);switch(i.width=h.width,i.height=h.height,i.offsetX=h.x+i.pivot.x*h.width,i.offsetY=h.y+i.pivot.y*h.height,this.shape.type){case"Bpmn":switch(this.shape.flow){case"Sequence":e=this.getBpmnSequenceFlow();break;case"Association":(e=new Qt).visible=!1,this.getBpmnAssociationFlow();break;case"Message":e=this.getBpmnMessageFlow(),r=this.getSegmentElement(this,r),this.updateShapePosition(this,e)}break;case"UmlActivity":switch(this.shape.flow){case"Object":this.getUMLObjectFlow();break;case"Exception":this.getUMLExceptionFlow(r)}break;case"UmlClassifier":this.getConnectorRelation()}var d=this.intermediatePoints;if("Bezier"===this.type){var l=this.segments[0],c=this.segments[this.segments.length-1];d=[o.isEmptyPoint(c.point2)?c.bezierPoint2:c.point2,o.isEmptyPoint(l.point1)?l.bezierPoint1:l.point1]}var p=t.getDescription;if(n=this.getDecoratorElement(s[0],d[1],this.sourceDecorator,!0,p),a=this.getDecoratorElement(s[s.length-1],d[d.length-2],this.targetDecorator,!1,p),n.id=this.id+"_srcDec",a.id=this.id+"_tarDec",r.style=this.style,r.style.fill="transparent",void 0!==p){var g=p(this,t);r.description=g||this.id}i.style.strokeColor="transparent",i.style.fill="transparent",i.style.strokeWidth=0,i.children=[r,n,a],i.id=this.id,void 0!==e&&i.children.push(e),i.offsetX=r.offsetX,i.offsetY=r.offsetY,i.width=r.width,i.height=r.height;for(var u=0;this.annotations,u<this.annotations.length;u++)i.children.push(this.getAnnotationElement(this.annotations[parseInt(u.toString(),10)],this.intermediatePoints,h,p,t.element.id,t.annotationTemplate));for(u=0;this.fixedUserHandles,u<this.fixedUserHandles.length;u++)i.children.push(this.getFixedUserHandle(this.fixedUserHandles[parseInt(u.toString(),10)],this.intermediatePoints,h,t.fixedUserHandleTemplate,t.element.id));return this.initPorts(p,i,h),this.wrapper=i,i},r.prototype.initPorts=function(t,e,i){for(var r=0;this.ports,r<this.ports.length;r++)e.children.push(this.initPort(this.ports[parseInt(r.toString(),10)],this.intermediatePoints,i,t))},r.prototype.initPort=function(t,e,i,r){var n=new Qt;n.height=t.height,n.width=t.width,n.margin=t.margin,t.shape=t.shape||"Square";var o,a="Custom"===t.shape?t.pathData:Ce(t.shape);n.data=a,n.horizontalAlignment=t.horizontalAlignment,n.verticalAlignment=t.verticalAlignment,n=this.initPortWrapper(t,e,i,n,this);var s=J(r);return s&&(o=s(n,this)),n.description=o||n.id,n.elementActions=n.elementActions|dt.ElementIsPort,n.isPathPort=!0,n},r.prototype.initPortWrapper=function(t,e,i,r,n){t.id=t.id||E();var o={x:0,y:0},a=wa(e,t,i),s=a.point;r.id=this.id+"_"+t.id;var h=t.style;r.style={fill:h.fill,strokeColor:h.strokeColor,gradient:null,opacity:h.opacity,strokeDashArray:h.strokeDashArray,strokeWidth:h.strokeWidth},0===i.width&&(i.width=this.style.strokeWidth),0===i.height&&(i.height=this.style.strokeWidth);var d=(s.x-i.x)/i.width,l=(s.y-i.y)/i.height;o.x=i.width*d,o.y=i.height*l;var c,p,g=Ta(t,a.angle,e),u=g.hAlign,f=g.vAlign;return"left"===u?(c="Left",o.x+=t.displacement.x):"right"===u?(c="Right",o.x-=t.displacement.x):"center"===u&&(c="Center"),"top"===f?(p="Top",o.y+=t.displacement.y):"bottom"===f?(p="Bottom",o.y-=t.displacement.y):"center"===f&&(p="Center"),r.horizontalAlignment=c,r.verticalAlignment=p,(r=n&&"Label"!==n.flipMode&&"None"!==n.flipMode?Ss(r,this.flip,t):Ss(r,"None",t)).float=!0,r.connectionDirection=t.connectionDirection,r.setOffsetWithRespectToBounds(o.x,o.y,"Absolute"),r.relativeMode="Point",r.visible=!(!es(t,et.Visible)||es(t,et.Hover)||es(t,et.Connect)),r.elementActions=r.elementActions|dt.ElementIsPort,r},r.prototype.getConnectorRelation=function(){var t=this.shape;"Association"===t.relationship?(this.sourceDecorator.shape="None",this.targetDecorator.shape="None"):"Inheritance"===t.relationship?(this.sourceDecorator.shape="None",this.targetDecorator.shape="Arrow"):"Composition"===t.relationship||"Aggregation"===t.relationship?(this.sourceDecorator.shape="Diamond",this.targetDecorator.shape="None"):"Dependency"===t.relationship?(this.sourceDecorator.shape="None",this.targetDecorator.shape="OpenArrow"):"Realization"===t.relationship&&(this.sourceDecorator.shape="None",this.targetDecorator.shape="Arrow"),"BiDirectional"===t.associationType&&(this.sourceDecorator.shape="OpenArrow",this.targetDecorator.shape="OpenArrow"),"Directional"===t.associationType&&(this.sourceDecorator.shape="None",this.targetDecorator.shape="OpenArrow");var e,i,r="",n="";t.multiplicity.source&&(t.multiplicity.source.lowerBounds=t.multiplicity.source.lowerBounds,t.multiplicity.source.upperBounds=t.multiplicity.source.upperBounds),t.multiplicity.target&&(t.multiplicity.target.lowerBounds=t.multiplicity.target.lowerBounds,t.multiplicity.target.upperBounds=t.multiplicity.target.upperBounds);var o=t.multiplicity.source,a=t.multiplicity.target;i=o.upperBounds?o.lowerBounds+"..."+o.upperBounds:o.lowerBounds,e=a.upperBounds?a.lowerBounds+"..."+a.upperBounds:a.lowerBounds,"ManyToOne"===t.multiplicity.type&&(t.multiplicity.target.optional=!1,r=i||"*",n="1"),"OneToMany"===t.multiplicity.type&&(t.multiplicity.source.optional=!1,n=e||"*",r="1"),"ManyToMany"===t.multiplicity.type&&(r=i||"*",n=e||"*"),"OneToOne"===t.multiplicity.type&&(t.multiplicity.target.optional=!1,t.multiplicity.source.optional=!1,r="1",n="1"),this.annotations=[{id:this.id+"sourcelabel",content:r,offset:0,alignment:"Before",margin:{right:5,bottom:5}},{id:this.id+"targetlabel",content:n,offset:1,alignment:"Before",margin:{right:5,bottom:5}}]},r.prototype.getBpmnSequenceFlow=function(){var t=new Qt,e=new Qt;if("Normal"===this.shape.sequence&&"Bezier"!==this.type&&(this.targetDecorator.shape="Arrow"),"Default"===this.shape.sequence){t=this.getSegmentElement(this,t);var i=this.intermediatePoints;e=Ps(i,this),this.targetDecorator.shape="Arrow"}return"Conditional"===this.shape.sequence&&(this.targetDecorator.shape="Arrow",this.sourceDecorator.shape="Diamond",e.id=this.id+this.shape.type),e},r.prototype.getUMLObjectFlow=function(){if(this.annotations)for(var t=0;t<this.annotations.length;t++)this.annotations[parseInt(t.toString(),10)].content="["+this.annotations[parseInt(t.toString(),10)].content+"]"},r.prototype.getUMLExceptionFlow=function(t){this.type="Straight";var e=this.shape.exceptionFlowHeight/2,i={x:(this.targetPoint.x+this.sourcePoint.x)/2,y:(this.targetPoint.y+this.sourcePoint.y)/2},r=i.x-this.sourcePoint.x,n=i.y-this.sourcePoint.y,o=e/Math.sqrt(r*r+n*n),a={x:i.x-r*o,y:i.y-n*o},s={x:i.x+r*o,y:i.y+n*o},h=I();T(h,315,i.x,i.y),this.segments=[];var d=new po(this,"segments",{type:"Straight",point:P(h,s)},!0);this.segments.push(d),d=new po(this,"segments",{type:"Straight",point:P(h,a)},!0),this.segments.push(d),t=this.getSegmentElement(this,t)},r.prototype.getBpmnAssociationFlow=function(){"Default"===this.shape.association&&(this.targetDecorator.shape="None",this.style.strokeDashArray="2 2"),"Directional"===this.shape.association&&(this.targetDecorator.shape="OpenArrow",this.style.strokeDashArray="2 2"),"BiDirectional"===this.shape.association&&(this.targetDecorator.shape="OpenArrow",this.sourceDecorator.shape="OpenArrow",this.style.strokeDashArray="2 2")},r.prototype.getFixedUserHandle=function(t,e,i,r,n){var o;if(""===t.pathData&&r)(o=new Bi(this.id,n,void 0,r)).isTemplate=!0,o.template=Sd(o,!0,t),t.id=t.id||E(),o.id=this.id+"_"+t.id;else{(o=new te).children=[],t.id=t.id||E(),o.id=this.id+"_"+t.id;var a=va(t,o);o.children.push(a)}return o.float=!0,o.visible=t.visibility,o.width=t.width,o.height=t.height,o.style.strokeWidth=t.handleStrokeWidth,o.style.fill=t.fill,o.style.strokeColor=t.handleStrokeColor,o.cornerRadius=t.cornerRadius,this.updateAnnotation(t,e,i,o),o.description=o.id,o},r.prototype.getBpmnMessageFlow=function(){var t=new Qt;return this.targetDecorator.shape="Arrow",this.targetDecorator.width=10,this.targetDecorator.height=10,this.sourceDecorator.shape="Circle",this.sourceDecorator.style.fill="white",this.targetDecorator.style.fill="white","InitiatingMessage"!==this.shape.message&&"NonInitiatingMessage"!==this.shape.message||(t.id=this.id+"_"+this.shape.message,t.width=25,t.height=15,t.data="M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0",t.horizontalAlignment="Center",t.verticalAlignment="Center",t.transform=gt.Self,t.style.fill="NonInitiatingMessage"===this.shape.message?"lightgrey":"white"),t},r.prototype.distance=function(t,e){return Ds(t,e)},r.prototype.findPath=function(t,e){return As(t,e)},r.prototype.getAnnotationElement=function(t,i,r,n,o,a){var s,h;if(t.content=t.content||"",t.id=t.id||E(),o&&(t.template||"Template"===t.annotationType||a&&""===t.content)){var d=document.getElementById(o).ej2_instances[0];s=new Bi(this.id,o,t.id,a),t.template&&"function"==typeof t.template&&d.isReact&&(s.templateFn=(0,e.compile)(t.template),s.isTemplate=!0),void 0!==t.height||"String"!==t.annotationType||!t.template&&""!==t.content||(t.height=r.height),s=Td(s,t,a,d)}else{s=new Zt;var l=t.hyperlink.link?t.hyperlink:void 0;s.style=t.style,s.style.color=l?l.color||s.hyperlink.color:t.style.color,s.hyperlink.link=t.hyperlink.link||void 0,s.hyperlink.hyperlinkOpenState=t.hyperlink.hyperlinkOpenState||void 0,s.hyperlink.textDecoration=t.hyperlink.textDecoration||void 0,s.content=l?l.content||s.hyperlink.link:t.content}s.constraints=t.constraints,s.visible=t.visibility,s.annotationVisibility=s.visible?"Visible":"Collapsed",s.rotateAngle=t.rotateAngle,s.horizontalAlignment=t.horizontalAlignment,s.verticalAlignment=t.verticalAlignment,s.width=t.width,s.height=t.height,void 0===r.width||t.template||(s.width=(t.width||r.width)-t.margin.left-t.margin.right),s.margin=t.margin,s.id=this.id+"_"+t.id,0===r.width&&(r.width=this.style.strokeWidth),0===r.height&&(r.height=this.style.strokeWidth);var c=J(n);return c&&(h=c(t,this)),s.description=h||s.id,this.updateAnnotation(t,i,r,s),s},r.prototype.updateAnnotation=function(t,e,i,r,n){var o={x:0,y:0};r instanceof Zt&&!n&&r.refreshTextElement(),r.width=t.width||i.width;var a=Sa(e,t,i),s=a.point;t instanceof Pe&&t.segmentAngle&&(r.rotateAngle=t.rotateAngle+a.angle,r.rotateAngle=(r.rotateAngle+360)%360),0===i.width&&(i.width=this.style.strokeWidth),0===i.height&&(i.height=this.style.strokeWidth);var h=(s.x-i.x)/i.width,d=(s.y-i.y)/i.height;o.x=i.width*h,o.y=i.height*d;var l,c,p=Ta(t,a.angle,e),g=p.hAlign,u=p.vAlign;"left"===g?(l="Left",o.x+=t.displacement.x):"right"===g?(l="Right",o.x-=t.displacement.x):"center"===g&&(l="Center"),"top"===u?(c="Top",o.y+=t.displacement.y):"bottom"===u?(c="Bottom",o.y-=t.displacement.y):"center"===u&&(c="Center"),r.horizontalAlignment=l,r.verticalAlignment=c,r.setOffsetWithRespectToBounds(o.x,o.y,"Absolute"),r.relativeMode="Point"},r.prototype.getConnectorPoints=function(t,e,i,r){var n=Re(this,i,r).slice(0);return n&&n.length>0&&(this.sourcePoint=n[0],this.targetPoint=n[n.length-1]),n},r.prototype.clipDecorator=function(t,e,i,r){var n,a,s={x:0,y:0},h=e.length;n=i?e[0]:e[h-1],a=i?e[1]:e[h-2];var d=o.distancePoints(n,a);d=0===d?1:d;var l=1,c=i?t.sourceWrapper:t.targetWrapper;c&&(l=c.style.strokeWidth,r&&r&yt.DecoratorPropertyChange&&(l=1));var p=l-1;return s.x=Math.round(n.x+p*(a.x-n.x)/d),s.y=Math.round(n.y+p*(a.y-n.y)/d),(i&&"None"!==t.sourceDecorator.shape||!i&&"None"!==t.targetDecorator.shape)&&(s=o.adjustPoint(s,a,!0,r&yt.DecoratorPropertyChange?0:l/2)),s},r.prototype.clipDecorators=function(t,e,i){return"None"!==t.sourceDecorator.shape&&(e[0]=this.clipDecorator(t,e,!0,i)),"None"!==t.targetDecorator.shape&&(e[e.length-1]=this.clipDecorator(t,e,!1,i)),e},r.prototype.updateSegmentElement=function(t,e,i,r){var n=new w,a=this.getSegmentPath(t,e,r);if("Bezier"===t.type){if(this.segments.length>0)for(var s=0;s<this.segments.length;s++){var h=this.segments[parseInt(s.toString(),10)],d=t.segments[parseInt(s.toString(),10)],l=o.isEmptyPoint(h.point1)?d.bezierPoint1:d.point1,c=o.isEmptyPoint(h.point2)?d.bezierPoint2:d.point2;n.uniteRect(bo(h.points[0],l,c,h.points[1],t))}}else n=w.toBounds(e);return i.width=n.width,i.height=n.height,i.offsetX=n.x+i.width/2,i.offsetY=n.y+i.height/2,i.data=a,t.wrapper&&(t.wrapper.offsetX=i.offsetX,t.wrapper.offsetY=i.offsetY,t.wrapper.width=n.width,t.wrapper.height=n.height),i},r.prototype.getSegmentElement=function(t,e,i,r,n){void 0===n&&(n=!0);var o;return n&&bs(t),o=this.getConnectorPoints(t.type,void 0,i),this.intermediatePoints=o,e.staticSize=!0,e=this.updateSegmentElement(t,o,e,r)},r.prototype.getDecoratorElement=function(t,e,i,r,n){var o=new Qt;if(o.transform=gt.Self,this.updateDecoratorElement(o,t,e,i),void 0!==n){var a=n(i,this);o.description=a||"source"}return o},r.prototype.bridgePath=function(t,e,i){var r=e;if(t.bridges.length>0)if("Straight"===t.type&&t.segments.length<2)for(var n=0;n<t.bridges.length;n++){(o=t.bridges[parseInt(n.toString(),10)]).rendered||(r+=" L"+o.startPoint.x+" "+o.startPoint.y,r+=o.path,o.rendered=!0)}else if("Orthogonal"===t.type||"Straight"===t.type&&t.segments.length>1)for(n=0;n<t.bridges.length;n++){var o;(o=t.bridges[parseInt(n.toString(),10)]).segmentPointIndex===i&&(o.rendered||o.segmentPointIndex===i&&(r+=" L"+o.startPoint.x+" "+o.startPoint.y,r+=o.path,o.rendered=!0))}return r},r.prototype.updateDecoratorElement=function(t,e,r,n){t.offsetX=e.x,t.offsetY=e.y;var a=o.findAngle(e,r),s=Te(n.shape,n),h=new i(n.width,n.height);t.pivot.x=n.pivot.x,t.pivot.y=n.pivot.y,t.style=n.style,t.rotateAngle=a,t.data=s,t.canMeasurePath=!0,t.width=h.width,t.height=h.height},r.prototype.getSegmentPath=function(t,e,i){for(var r,n,a,s="",h=[],d=0;d<e.length;)h.push({x:e[parseInt(d.toString(),10)].x,y:e[parseInt(d.toString(),10)].y}),d++;for(var l=0;l<t.bridges.length;l++){t.bridges[parseInt(l.toString(),10)].rendered=!1}if(h=this.clipDecorators(t,h,i),this.cornerRadius>0&&"Bezier"!==this.type)for(var c=0;c<h.length-1;c++){r=h[parseInt(c.toString(),10)],0===c&&(s="M"+r.x+" "+r.y);var p=o.distancePoints(h[parseInt(c.toString(),10)],h[c+1]);p>0&&(n=c<h.length-2?p<2*this.cornerRadius?o.adjustPoint(h[parseInt(c.toString(),10)],h[c+1],!1,p/2):o.adjustPoint(h[parseInt(c.toString(),10)],h[c+1],!1,this.cornerRadius):h[c+1],c>0&&(p<2*this.cornerRadius?(a=o.adjustPoint(h[parseInt(c.toString(),10)],h[c+1],!0,p/2),c<h.length-2&&(n=null)):a=o.adjustPoint(h[parseInt(c.toString(),10)],h[c+1],!0,this.cornerRadius)),a&&(s+="Q"+r.x+" "+r.y+" "+a.x+" "+a.y),n&&(t.bridges.length>0&&(s=this.bridgePath(t,s,c),"Orthogonal"===t.type&&(s=this.bridgePath(t,s,c+1))),s+=" L"+n.x+" "+n.y))}else if("Bezier"===this.type){var g=void 0,u=void 0;if(this.parentObj.element){var f=this.parentObj.element.ej2_instances[0].eventHandler.action;g=this.parentObj.element.ej2_instances[0].eventHandler.tool instanceof _n,u=f.includes("PortDraw")||f.includes("Drag")}for(var m=void 0,y=this.segments,v=0;v<y.length;v++)h.length>2&&(y[parseInt(v.toString(),10)].bezierPoint1={x:0,y:0},y[parseInt(v.toString(),10)].bezierPoint2={x:0,y:0}),!o.isEmptyPoint(y[parseInt(v.toString(),10)].point1)||y[parseInt(v.toString(),10)].vector1.angle||y[parseInt(v.toString(),10)].vector1.distance?y[parseInt(v.toString(),10)].vector1.angle||y[parseInt(v.toString(),10)].vector1.distance?y[parseInt(v.toString(),10)].bezierPoint1=o.transform(h[parseInt(v.toString(),10)],y[parseInt(v.toString(),10)].vector1.angle,y[parseInt(v.toString(),10)].vector1.distance):y[parseInt(v.toString(),10)].bezierPoint1={x:y[parseInt(v.toString(),10)].point1.x||y[parseInt(v.toString(),10)].bezierPoint1.x,y:y[parseInt(v.toString(),10)].point1.y||y[parseInt(v.toString(),10)].bezierPoint1.y}:(!t.sourceID&&!this.sourcePortID||!this.sourceWrapper||u||g||(m=mo(this.sourceWrapper.bounds,h[parseInt(v.toString(),10)],!0)),y[parseInt(v.toString(),10)].bezierPoint1=vo(h[parseInt(v.toString(),10)],h[v+1],m)),!o.isEmptyPoint(y[parseInt(v.toString(),10)].point2)||y[parseInt(v.toString(),10)].vector2.angle||y[parseInt(v.toString(),10)].vector2.distance?y[parseInt(v.toString(),10)].vector2.angle||y[parseInt(v.toString(),10)].vector2.distance?y[parseInt(v.toString(),10)].bezierPoint2=o.transform(h[v+1],y[parseInt(v.toString(),10)].vector2.angle,y[parseInt(v.toString(),10)].vector2.distance):y[parseInt(v.toString(),10)].bezierPoint2={x:y[parseInt(v.toString(),10)].point2.x||y[parseInt(v.toString(),10)].bezierPoint2.x,y:y[parseInt(v.toString(),10)].point2.y||y[parseInt(v.toString(),10)].bezierPoint2.y}:(!t.targetID&&!this.targetPortID||!this.targetWrapper||u||g||(m=mo(this.targetWrapper.bounds,h[v+1],!0)),y[parseInt(v.toString(),10)].bezierPoint2=vo(h[v+1],h[parseInt(v.toString(),10)],m));h.splice(1,0,{x:y[0].bezierPoint1.x,y:y[0].bezierPoint1.y}),h.splice(h.length-1,0,{x:y[y.length-1].bezierPoint2.x,y:y[y.length-1].bezierPoint2.y}),h=this.clipDecorators(t,h,i);for(var b=0;b<y.length;b++){0===b&&(s="M"+h[0].x+" "+h[0].y);var S=b===y.length-1?h[h.length-1].x+" "+h[h.length-1].y:y[parseInt(b.toString(),10)].points[y[parseInt(b.toString(),10)].points.length-1].x+" "+y[parseInt(b.toString(),10)].points[y[parseInt(b.toString(),10)].points.length-1].y;s+="C"+y[parseInt(b.toString(),10)].bezierPoint1.x+" "+y[parseInt(b.toString(),10)].bezierPoint1.y+" "+y[parseInt(b.toString(),10)].bezierPoint2.x+" "+y[parseInt(b.toString(),10)].bezierPoint2.y+" "+S}}else for(var w=0;w<h.length;w++)r=h[parseInt(w.toString(),10)],0===w&&(s="M"+r.x+" "+r.y),w>0&&(s=this.bridgePath(t,s,w),s+=" L"+r.x+" "+r.y);return s},r.prototype.updateShapeElement=function(t){var e;switch(t.shape.type){case"Bpmn":t.wrapper.children[3]instanceof Qt&&(e=t.wrapper.children[3]),"Message"===t.shape.flow&&this.updateShapePosition(t,e);break;case"UmlActivity":"Exception"===t.shape.flow&&this.getUMLExceptionFlow(t.wrapper.children[0])}},r.prototype.updateShapePosition=function(t,e){var i=this.intermediatePoints,r=Cs(i,e,.5);e.offsetX=r.x,e.offsetY=r.y},r.prototype.scale=function(t,e,i,r,n){var o=0,a=0;if(this.wrapper&&this.wrapper.outerBounds){var s=Ci(this),h=Math.abs((this.wrapper.bounds.width||this.style.strokeWidth||1)-2),d=Math.abs((this.wrapper.bounds.height||this.style.strokeWidth||1)-2);o=s.width-h,a=s.height-d,t=Math.abs((i-Math.max(o,a))/h),e=Math.abs((r-Math.max(o,a))/d),o=a=Math.min(o,a)}t=e=Math.min(t,e);var l=I();T(l,-(n=n||this.wrapper).rotateAngle,n.offsetX,n.offsetY),A(l,t,e,n.offsetX,n.offsetY),T(l,n.rotateAngle,n.offsetX,n.offsetY);var c=C(l,this.intermediatePoints);return this.sourcePoint=c[0],this.targetPoint=c[c.length-1],Qa(this,c=this.intermediatePoints=Re(this)),{x:o,y:a}},r.prototype.getClassName=function(){return"Connector"},eo([(0,e.ComplexFactory)(io)],r.prototype,"shape",void 0),eo([(0,e.Property)(at.Default)],r.prototype,"constraints",void 0),eo([(0,e.Property)(10)],r.prototype,"bridgeSpace",void 0),eo([(0,e.Collection)([],Pe)],r.prototype,"annotations",void 0),eo([(0,e.Complex)({},o)],r.prototype,"sourcePoint",void 0),eo([(0,e.Complex)({},o)],r.prototype,"targetPoint",void 0),eo([(0,e.Collection)([],Wi)],r.prototype,"fixedUserHandles",void 0),eo([(0,e.CollectionFactory)(ro)],r.prototype,"segments",void 0),eo([(0,e.Property)("")],r.prototype,"sourceID",void 0),eo([(0,e.Property)("")],r.prototype,"targetID",void 0),eo([(0,e.Property)(10)],r.prototype,"hitPadding",void 0),eo([(0,e.Property)(0)],r.prototype,"connectionPadding",void 0),eo([(0,e.Property)("Straight")],r.prototype,"type",void 0),eo([(0,e.Property)("Circle")],r.prototype,"segmentThumbShape",void 0),eo([(0,e.Property)(10)],r.prototype,"segmentThumbSize",void 0),eo([(0,e.Property)(0)],r.prototype,"cornerRadius",void 0),eo([(0,e.Complex)({shape:"None"},no)],r.prototype,"sourceDecorator",void 0),eo([(0,e.Complex)({shape:"Arrow"},no)],r.prototype,"targetDecorator",void 0),eo([(0,e.Complex)({},he)],r.prototype,"tooltip",void 0),eo([(0,e.Property)("")],r.prototype,"sourcePortID",void 0),eo([(0,e.Property)("")],r.prototype,"targetPortID",void 0),eo([(0,e.Property)(0)],r.prototype,"sourcePadding",void 0),eo([(0,e.Complex)({},Di)],r.prototype,"previewSize",void 0),eo([(0,e.Complex)({},Di)],r.prototype,"dragSize",void 0),eo([(0,e.Property)(0)],r.prototype,"targetPadding",void 0),eo([(0,e.Property)(13)],r.prototype,"connectorSpacing",void 0),eo([(0,e.Complex)({strokeWidth:1,strokeColor:"black"},Rt)],r.prototype,"style",void 0),eo([(0,e.Property)(null)],r.prototype,"maxSegmentThumb",void 0),eo([(0,e.Property)(!1)],r.prototype,"allowNodeOverlap",void 0),eo([(0,e.Complex)({},ao)],r.prototype,"bezierSettings",void 0),eo([(0,e.Collection)([],ve)],r.prototype,"ports",void 0),eo([(0,e.Property)(null)],r.prototype,"wrapper",void 0),r}(zi),To=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ao=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Oo=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.offset=0,r.scale=1,r}return To(r,t),r.prototype.preRender=function(){this.unWireEvents(),this.wireEvents()},r.prototype.render=function(){this.updateRulerGeometry(),this.renderComplete()},r.prototype.getModuleName=function(){return"Ruler"},r.prototype.destroy=function(){this.unWireEvents(),this.notify("destroy",{}),t.prototype.destroy.call(this),this.element.classList.remove("e-ruler")},r.prototype.getPersistData=function(){return this.addOnPersist(["loaded"])},r.prototype.onPropertyChanged=function(t,e){for(var i=0,r=Object.keys(t);i<r.length;i++){switch(r[i]){case"length":case"interval":case"segmentWidth":case"tickAlignment":case"markerColor":case"thickness":this.updateRuler()}}},r.prototype.updateRulerGeometry=function(){this.element.style.textAlign="left",this.renderRulerSpace(),this.updateRuler()},r.prototype.renderRulerSpace=function(){var t=this.getRulerGeometry(),e=document.getElementById(this.element.id+"_ruler_space");return e||(e=ud("div",{id:this.element.id+"_ruler_space",style:"height:"+t.height+"px;width:"+t.width+"px;cssFloat:left;"}),this.element.appendChild(e)),e},r.prototype.updateRuler=function(){var t=this.getRulerSize(),e=this.getRulerGeometry(),r=0,n=0,o=new i,a=this.getRulerSVG(e);if(a&&(r=this.length,o.height=t,n=this.offset,r&&r!==1/0)){var s=r+this.segmentWidth,h=n;this.updateSegments(h,s+Math.abs(h),a,t)}},r.prototype.updateSegments=function(t,e,i,r){for(var n=t,o={trans:0};n<e;){var a=this.getNewSegment(n,i);a&&(i.appendChild(a.segment),n=this.updateSegment(t,e,a,n,o,r))}},r.prototype.updateSegment=function(t,e,i,r,n,o){var a=this.updateSegmentWidth(this.scale);r===t?(this.startValue=Math.floor(t/a)*a/this.scale,this.startValue=this.startValue%1!=0?Number(this.startValue.toFixed(1)):this.startValue,i.label.textContent=this.startValue.toString(),this.defStartValue=r=this.startValue*this.scale,"Horizontal"===this.orientation?this.hRulerOffset=t-r:this.vRulerOffset=t-r):(this.startValue=r/this.scale,this.startValue=this.startValue%1!=0?Number(this.startValue.toFixed(1)):this.startValue,i.label.textContent=this.startValue.toString()),this.updateTickLabel(i,o);var s="Horizontal"===this.orientation?n.trans+.5+",0.5":"0.5,"+(n.trans+.5);return i.segment.setAttribute("transform","translate("+s+")"),n.trans+=a,r+=a},r.prototype.updateTickLabel=function(t,e){var i=t.segment.lastChild.getBBox(),r="Horizontal"===this.orientation,n="RightOrBottom"===this.tickAlignment,o=r?2:0,a=r?n?e/2+5.5-5.5:e/2+5.5:i.height,s=n?-(i.width+2)+","+(e/2-i.height):-(i.width+2)+","+(e/2-i.height/2),h=r?{x:o,y:a}:{x:o,y:a,transform:"rotate(270)translate("+s+")"};wd(t.segment.lastChild,h)},r.prototype.getNewSegment=function(t,e){var i=this.createNewTicks(t,e);return{segment:i,label:this.createTickLabel(e,i)}},r.prototype.createNewTicks=function(t,e){for(var i,r,n=this.updateSegmentWidth(this.scale),o=fd("g",{class:"e-ruler-segment"}),a=0;a<this.interval;a++)r=n/this.interval,i=this.createTick(e,r,a+1,t),o.appendChild(i);return o},r.prototype.getLinePoint=function(t,e,i){var r=this.updateSegmentWidth(this.scale),n=this.getRulerSize();return i=(e*=i-1)%r===0?n:.3*n},r.prototype.createTick=function(t,e,i,r){var n=this.getLinePoint(t,e,i),o=this.getRulerSize(),a="Horizontal"===this.orientation,s="RightOrBottom"===this.tickAlignment,h=J(this.arrangeTick),d={ruler:undefined,tickLength:n,tickInterval:this.segmentWidth/this.interval*(i-1)};h&&h(d),n=d.tickLength;var l=e*(i-1),c=fd("line",{x1:a?l:s?o:0,y1:a?s?o:o-(o-n):l,x2:a?l:s?o-n:o-(o-n),y2:a?s?o-n:0:l,"stroke-width":"1",stroke:"black"});return c.setAttribute("class","e-ruler-tick"),c},r.prototype.createTickLabel=function(t,e){var i;if(e){i=fd("text",{class:"e-ruler-tick-label"}),e.appendChild(i)}return i},r.prototype.updateSegmentWidth=function(t){if(100!==this.segmentWidth)return this.segmentWidth;var e,i=1;for(e=100,e=100/Math.pow(2,Math.round(Math.log(t)/Math.log(2)));e>100;)i/=10,e/=10;for(;e<25;)i*=10,e*=10;return e>=25&&e%25!=0&&(e=25*Math.round(e/25)),e*t/i},r.prototype.createMarkerLine=function(t,e,i){var r;return e&&((r=t.getElementById(e.id+"_marker"))&&r.parentNode.removeChild(r),r=fd("line",i)),r},r.prototype.drawRulerMarker=function(t,e,i){var r,n,o,a,s,h,d,l="Horizontal"===this.orientation,c=t.getElementsByTagName("svg");for(s=0;s<c.length;s++){c[parseInt(s.toString(),10)]&&(r=c[parseInt(s.toString(),10)]);break}if(r){n=this.getRulerSize(),h={id:t.id+"_marker",x1:0,y1:0,x2:l?0:n,y2:l?n:0,stroke:this.markerColor,"stroke-width":1.5,class:"e-d-ruler-marker"},d=this.createMarkerLine(r,t,h),o=this.scale,a=this.offset-this.defStartValue;var p=(l?e.x:e.y)*o+i+a;d.setAttribute("transform","translate("+(l?p+.5+" 0.5":"0.5 "+(p+.5))+")"),r.appendChild(d)}},r.prototype.getRulerGeometry=function(){return new i(this.element?this.element.getBoundingClientRect().width:0,this.element?this.element.getBoundingClientRect().height:0)},r.prototype.getRulerSize=function(){return this.thickness},r.prototype.getRulerSVG=function(t){var e,i,r=this.getRulerSize();if(this.element&&(e=document.getElementById(this.element.id+"_ruler_space"))){if(i=fd("svg",{id:this.element.id+"_Ruler_svg",width:"Horizontal"===this.orientation?t.width+200:r+"px",height:"Horizontal"===this.orientation?r:t.height+200+"px",style:"position:inherit;"}),e.childNodes.length>0)for(var n=e.childNodes.length-1;n>=0;n--)e.childNodes[parseInt(n.toString(),10)].parentNode.removeChild(e.childNodes[parseInt(n.toString(),10)]);e.appendChild(i)}return i},r.prototype.wireEvents=function(){},r.prototype.unWireEvents=function(){},Ao([(0,e.Property)(5)],r.prototype,"interval",void 0),Ao([(0,e.Property)(100)],r.prototype,"segmentWidth",void 0),Ao([(0,e.Property)("Horizontal")],r.prototype,"orientation",void 0),Ao([(0,e.Property)("RightOrBottom")],r.prototype,"tickAlignment",void 0),Ao([(0,e.Property)("red")],r.prototype,"markerColor",void 0),Ao([(0,e.Property)(25)],r.prototype,"thickness",void 0),Ao([(0,e.Property)(null)],r.prototype,"arrangeTick",void 0),Ao([(0,e.Property)(400)],r.prototype,"length",void 0),r}(e.Component);function Do(t,e){var i=document.getElementById(t.element.id+(e?"_hRuler":"_vRuler")),r=Eo(t),n=zo(t),o=e?"margin-left:"+r.width+"px;":"margin-top:"+r.height+"px;";if(!i){var a="height:"+(e?r.height:n.height+100)+"px;overflow:hidden;width:"+(e?n.width+100:r.width)+"px;position:absolute;font-size:11px;"+o;i=ud("div",{id:t.element.id+(e?"_hRuler":"_vRuler"),style:a})}t.element.insertBefore(i,t.element.firstChild);var s=e?t.rulerSettings.horizontalRuler:t.rulerSettings.verticalRuler,h=new Oo(s);h.orientation=e?"Horizontal":"Vertical",h.length=(e?n.width:n.height)+s.segmentWidth,h.appendTo("#"+t.element.id+(e?"_hRuler":"_vRuler")),e?t.hRuler=h:t.vRuler=h;var d=document.getElementById(t.element.id+(e?"_hRuler":"_vRuler"));e?t.hRuler.element=d:t.vRuler.element=d}function Mo(t){var e=-t.scroller.horizontalOffset,i=-t.scroller.verticalOffset;t&&t.rulerSettings.showRulers?(t.hRuler.length=0,t.vRuler.length=0,void 0!==e&&t.hRuler.element&&ko(t,t.hRuler,e,!0),void 0!==i&&t.vRuler.element&&ko(t,t.vRuler,i,!1)):Lo(t)}function Lo(t){bd(t.element.id+"_hRuler"),bd(t.element.id+"_vRuler"),bd(t.element.id+"_overlapRuler")}function Eo(t){var e=0,r=0;return t.rulerSettings.showRulers&&(e=t.rulerSettings.horizontalRuler.thickness,r=t.rulerSettings.verticalRuler.thickness),new i(r,e)}function zo(t){var e=Eo(t),r=t.scroller.viewPortHeight,n=t.scroller.viewPortWidth;return n<t.element.clientWidth-e.width&&(n=t.element.clientWidth-e.width),r<t.element.clientHeight-e.height&&(r=t.element.clientHeight-e.height),t.hRuler&&t.hRuler.length&&(n=t.hRuler.length),t.vRuler&&t.vRuler.length&&(r=t.vRuler.length),new i(n,r)}function ko(t,e,i,r){var n=Eo(t),o=zo(t),a=r?t.rulerSettings.horizontalRuler:t.rulerSettings.verticalRuler;!function(t,e,i){var r=document.getElementById(t.element.id+(i?"_hRuler":"_vRuler")),n=i?t.hRuler:t.vRuler;r&&t&&e&&(r.style.width=(i?e.width+n.segmentWidth:n.thickness)+"px",r.style.height=(i?n.thickness:e.height+n.segmentWidth)+"px",(r=document.getElementById(t.element.id+"_overlapRuler"))&&(i?r.style.height=n.thickness+"px":r.style.width=n.thickness+"px"))}(t,o,r),function(t,e,i){var r=document.getElementById(t.element.id+(i?"_hRuler_ruler_space":"_vRuler_ruler_space")),n=i?t.hRuler:t.vRuler;r&&t&&e&&(r.style.width=(i?e.width+2*n.segmentWidth:n.thickness)+"px",r.style.height=(i?n.thickness:e.height+2*n.segmentWidth)+"px")}(t,o,r),e.offset=i,e.scale=t.scroller.currentZoom,e.length=(r?o.width:o.height)+100,e.arrangeTick=J(a.arrangeTick),e.dataBind();var s=r?t.hRuler.element:t.vRuler.element;r?s.style.marginLeft=n.width-e.hRulerOffset+"px":s.style.marginTop=n.height-e.vRulerOffset+"px"}var Bo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ro=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},No=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Bo(i,t),i.prototype.getClassName=function(){return"UserHandle"},Ro([(0,e.Property)("")],i.prototype,"name",void 0),Ro([(0,e.Property)("")],i.prototype,"pathData",void 0),Ro([(0,e.Property)("")],i.prototype,"content",void 0),Ro([(0,e.Property)("")],i.prototype,"source",void 0),Ro([(0,e.Property)("#000000")],i.prototype,"backgroundColor",void 0),Ro([(0,e.Property)("Top")],i.prototype,"side",void 0),Ro([(0,e.Property)("")],i.prototype,"borderColor",void 0),Ro([(0,e.Property)(.5)],i.prototype,"borderWidth",void 0),Ro([(0,e.Property)(25)],i.prototype,"size",void 0),Ro([(0,e.Property)("white")],i.prototype,"pathColor",void 0),Ro([(0,e.Property)(10)],i.prototype,"displacement",void 0),Ro([(0,e.Property)(!0)],i.prototype,"visible",void 0),Ro([(0,e.Property)(0)],i.prototype,"offset",void 0),Ro([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),Ro([(0,e.Property)("Center")],i.prototype,"horizontalAlignment",void 0),Ro([(0,e.Property)("Center")],i.prototype,"verticalAlignment",void 0),Ro([(0,e.Property)(!1)],i.prototype,"disableNodes",void 0),Ro([(0,e.Property)(!1)],i.prototype,"disableConnectors",void 0),Ro([(0,e.Complex)({},he)],i.prototype,"tooltip",void 0),Ro([(0,e.Property)("")],i.prototype,"template",void 0),i}(e.ChildProperty);function jo(t){return Ho[t.toString()]}var Ho={Action:"M 90 82.895 C 90 86.819 86.776 90 82.8 90 H 7.2 C 3.224 90 0 86.819 0 82.895 V 7.105 C 0 3.181 3.224 0 7.2 0 h 75.6 C 86.776 0 90 3.181 90 7.105 V 82.895 Z",Decision:"M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z",MergeNode:"M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z",InitialNode:"M10,19.5c-5.238,0-9.5-4.262-9.5-9.5S4.762,0.5,10,0.5s9.5,4.262,9.5,9.5S15.238,19.5,10,19.5z",ForkNode:"m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z",JoinNode:"m0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z",TimeEvent:"M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z",AcceptingEvent:"M17.8336 32.164 L29.64 24 L17.32 16 L48.1664 16 L48.5 32 Z",SendSignal:"M48.164 31.8336 L56 23.832 L47.836 16 L16.168 16 L16.1668 31.8336 Z",ReceiveSignal:"M48.1664 31.8336 L39.836 24 L47.836 16 L16.168 16 L16.168 31.836 Z",StructuredNode:"M0,0 L50,0 L50,50 L0,50 z",Note:"M20 12 L4 12 L4 22 L22 22 L22 14 L20 14 L20 12 L22 14 Z"},Wo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),_o=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Yo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Wo(i,t),_o([(0,e.Property)()],i.prototype,"key",void 0),_o([(0,e.Property)()],i.prototype,"keyModifiers",void 0),i}(e.ChildProperty),Fo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Wo(i,t),i.prototype.getClassName=function(){return"Command"},_o([(0,e.Property)("")],i.prototype,"name",void 0),_o([(0,e.Property)()],i.prototype,"canExecute",void 0),_o([(0,e.Property)()],i.prototype,"execute",void 0),_o([(0,e.Complex)({},Yo)],i.prototype,"gesture",void 0),_o([(0,e.Property)("")],i.prototype,"parameter",void 0),i}(e.ChildProperty),Xo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Wo(i,t),_o([(0,e.Collection)([],Fo)],i.prototype,"commands",void 0),i}(e.ChildProperty),Vo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Wo(i,t),_o([(0,e.Property)()],i.prototype,"show",void 0),_o([(0,e.Property)()],i.prototype,"showCustomMenuOnly",void 0),_o([(0,e.Property)()],i.prototype,"items",void 0),i}(e.ChildProperty),Uo=function(){function t(){}return t.prototype.renderShadow=function(t,e,i,r){void 0===i&&(i=null);var n,a,s=o.transform({x:0,y:0},t.shadow.angle,t.shadow.distance);r&&(a=r.getElementById(e.id+"_shadow")),a||(n=i?"path":"rect",a=document.createElementNS("http://www.w3.org/2000/svg",n),e.appendChild(a));var h={id:e.id+"_shadow",fill:t.shadow.color,stroke:t.shadow.color,opacity:t.shadow.opacity.toString(),transform:"rotate("+t.angle+","+(t.x+t.width*t.pivotX)+","+(t.y+t.height*t.pivotY)+")translate("+(t.x+s.x)+","+(t.y+s.y)+")",rx:t.cornerRadius||0,ry:t.cornerRadius||0,"stroke-dasharray":t.dashArray};if(r){var d=r.getElementById(e.id);d&&d.insertBefore(a,d.firstChild)}wd(a,h),i?i&&this.renderPath(a,t,i):wd(a,{width:t.width,height:t.height})},t.prototype.parseDashArray=function(t){return[]},t.prototype.drawRectangle=function(t,e,i,r,n,o,a,s,h){var d,l,c,p;if(e.shadow&&!r&&this.renderShadow(e,t,void 0,o),d=e.id===t.id?e.id+"_container":e.id,o&&(l=o.getElementById(d)),l&&!n||(l=document.createElementNS("http://www.w3.org/2000/svg","rect"),t.appendChild(l)),o&&!e.shadow&&(c=o.getElementById(e.id+"_groupElement_shadow"))&&c.parentNode.removeChild(c),o&&(c=o.getElementById(e.id+"_groupElement_shadow"))&&(c.style.visibility=e.visible?"visible":"hidden"),s)p={id:d,x:e.x.toString(),y:e.y.toString(),width:e.width.toString(),height:e.height.toString(),visibility:e.visible?"visible":"hidden",transform:"rotate("+e.angle+","+(e.x+e.width/2)+","+(e.y+e.height/2)+")",rx:e.cornerRadius||0,ry:e.cornerRadius||0,opacity:e.opacity};else{var g=e.x,u=e.y,f=e.width,m=e.height,y=e.visible,v=e.angle,b=e.pivotX,S=e.pivotY,w=e.cornerRadius,x=void 0===w?0:w,I=e.opacity;p={id:d,x:g+"",y:u+"",width:f+"",height:m+"",visibility:y?"visible":"hidden",transform:"rotate("+v+","+(g+f*b)+","+(u+m*S)+")",rx:x,ry:x,opacity:void 0===I?1:I}}a&&(p.role="img",p["aria-label"]=a);var P=e.class||"";h||(P.includes("e-diagram-resize-handle")||P.includes("e-diagram-endpoint-handle")||P.includes("e-diagram-bezier-control-handle"))&&(P+=" e-disabled"),e.class&&(p.class=P);a||(p["pointer-events"]="none"),wd(l,p),this.setSvgStyle(l,e,i)},t.prototype.updateSelectionRegion=function(t,e){var i;i=t.parentNode.getElementById(e.id);var r={id:e.id,x:e.x.toString(),y:e.y.toString(),width:e.width.toString(),height:e.height.toString(),transform:"rotate("+e.angle+","+(e.x+e.width*e.pivotX)+","+(e.y+e.height*e.pivotY)+")",class:"e-diagram-selected-region"};i||(i=document.createElementNS("http://www.w3.org/2000/svg","rect"),t.appendChild(i)),this.setSvgStyle(i,e),wd(i,r)},t.prototype.createGElement=function(t,e){return fd(t,e)},t.prototype.drawLine=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","line");this.setSvgStyle(i,e);var r=e.x+e.width*e.pivotX,n=e.y+e.height*e.pivotY,o={id:e.id,x1:e.startPoint.x+e.x,y1:e.startPoint.y+e.y,x2:e.endPoint.x+e.x,y2:e.endPoint.y+e.y,stroke:e.stroke,"stroke-width":e.strokeWidth.toString(),opacity:e.opacity.toString(),transform:"rotate("+e.angle+" "+r+" "+n+")",visibility:e.visible?"visible":"hidden"};e.class&&(o.class=e.class),wd(i,o),t.appendChild(i)},t.prototype.drawCircle=function(t,e,i,r){var n=document.createElementNS("http://www.w3.org/2000/svg","circle");this.setSvgStyle(n,e);var o=e.class||"";i||(o+=" e-disabled");var a={id:e.id,cx:e.centerX,cy:e.centerY,r:e.radius,visibility:e.visible?"visible":"hidden",class:o};r&&(a.role="img",a["aria-label"]=r),n.style.display=e.visible?"block":"none",wd(n,a),t.appendChild(n)},t.prototype.drawPath=function(t,e,i,r,n,o,a){var s,d,l=[];if(l=g(l=h(e.data)),e.shadow&&this.renderShadow(e,t,l,n),n&&!e.shadow&&(s=n.getElementById(e.id+"_groupElement_shadow"))&&s.parentNode.removeChild(s),n&&(s=n.getElementById(e.id+"_groupElement_shadow"))&&(s.style.visibility=e.visible?"visible":"hidden"),n&&(d=n.getElementById(e.id)),!d||r)if(d=document.createElementNS("http://www.w3.org/2000/svg","path"),t.parentElement&&"diagram_nativeLayer"===t.parentElement.id){var c=document.createElementNS("http://www.w3.org/2000/svg","g");c.id=e.id+"_groupElement",t.appendChild(c),c.appendChild(d)}else t.appendChild(d);this.renderPath(d,e,l);var p={};p=a?{id:e.id,transform:"rotate("+e.angle+","+(e.x+e.width*e.pivotX)+","+(e.y+e.height*e.pivotY)+")translate("+e.x+","+e.y+"),scale("+a+")",visibility:e.visible?"visible":"hidden",opacity:e.opacity}:{id:e.id,transform:"rotate("+e.angle+","+(e.x+e.width*e.pivotX)+","+(e.y+e.height*e.pivotY)+")translate("+e.x+","+e.y+")",visibility:e.visible?"visible":"hidden",opacity:e.opacity},o&&(p.role="img",p["aria-label"]=o),e.class&&(p.class=e.class),wd(d,p),this.setSvgStyle(d,e,i)},t.prototype.renderPath=function(t,e,i){var r,n,o,a,s,h,d,l,c=i,p="";for(s=0,h=0,l=0,d=c.length;l<d;++l){var g=c[parseInt(l.toString(),10)],u=g.command;switch("x1"in g&&(r=g.x1),"x2"in g&&(o=g.x2),"y1"in g&&(n=g.y1),"y2"in g&&(a=g.y2),"x"in g&&(s=g.x),"y"in g&&(h=g.y),u){case"M":p=p+"M"+s.toString()+","+h.toString()+" ";break;case"L":p=p+"L"+s.toString()+","+h.toString()+" ";break;case"C":p=p+"C"+r.toString()+","+n.toString()+","+o.toString()+","+a.toString()+",",p+=s.toString()+","+h.toString()+" ";break;case"Q":p=p+"Q"+r.toString()+","+n.toString()+","+s.toString()+","+h.toString()+" ";break;case"A":p=p+"A"+g.r1.toString()+","+g.r2.toString()+","+g.angle.toString()+",",p+=g.largeArc.toString()+","+g.sweep+","+s.toString()+","+h.toString()+" ";break;case"Z":case"z":p+="Z "}}t.setAttribute("d",p)},t.prototype.setSvgFontStyle=function(t,e){t.style.fontStyle=e.italic?"italic":"normal",t.style.fontWeight=e.bold?"bold":"normal",t.style.fontSize=e.fontSize.toString()+"px",t.style.fontFamily=e.fontFamily},t.prototype.drawText=function(t,e,i,r,n,o,a){if(void 0!==e.content){var s=a.groupElement,h=void 0,d=void 0,l=void 0,c=void 0,p=void 0,g=void 0,u=0,f=0,m=0,y=void 0,v=void 0;if(i&&(y=i.getElementById(e.id+"_text")),y){if(e.doWrap)for(;y.firstChild;)y.removeChild(y.firstChild)}else if(e.doWrap=!0,y=document.createElementNS("http://www.w3.org/2000/svg","text"),"pre-wrap"===e.whiteSpace&&y.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s&&(v=document.getElementById(s.id+"_content_groupElement")),v&&s&&s.children&&s.children[0]instanceof ne){var b=this.createGElement("g",{id:r+"_groupElement"});v.appendChild(b),b.appendChild(y)}else t.appendChild(y);var S=e.x+e.width*e.pivotX,w=e.y+e.height*e.pivotY,x=0;if(e.doWrap||"Wrap"!==e.textOverflow){for(;y.firstChild;)y.removeChild(y.firstChild);for(this.setSvgStyle(y,e,n),this.setSvgFontStyle(y,e),h=document.createTextNode(e.content),d=e.childNodes,l=e.wrapBounds,c=this.svgLabelAlign(e,l,d),l.width>e.width&&"Wrap"!==e.textOverflow&&"NoWrap"===e.textWrapping&&(d[0].text=G(e.content,e)),m=0;m<d.length;m++)if(g=document.createElementNS("http://www.w3.org/2000/svg","tspan"),h=document.createTextNode(d[parseInt(m.toString(),10)].text),(p=d[parseInt(m.toString(),10)]).x=Cd(p,d,m,e),u="justify"===e.textAlign||"left"===e.textAlign?0:c.x+p.x-l.x,f=c.y+p.dy*m+.8*e.fontSize,"Clip"!==e.textOverflow&&"Ellipsis"!==e.textOverflow||"WrapWithOverflow"!==e.textWrapping&&"Wrap"!==e.textWrapping||!s)this.alignText(y,g,p,h,u,f,m,e,d);else{var I=e.isHorizontalLane?s.actualSize.width:s.actualSize.height;if(!(f<I))break;if("Ellipsis"===e.textOverflow&&d[m+1]){var P=d[m+1];c.y+P.dy*(m+1)+.8*e.fontSize>I&&(p.text=p.text.slice(0,p.text.length-3),p.text=p.text.concat("..."),h.data=p.text)}this.alignText(y,g,p,h,u,f,m,e,d),x+=p.dy}}x&&e.isHorizontalLane&&(S=e.parentOffsetX+e.pivotX,w=e.parentOffsetY+e.pivotY,e.y=e.parentOffsetY-x*e.pivotY+.5),e.textDecoration&&"LineThrough"===e.textDecoration&&(e.textDecoration=F(e.textDecoration));var C={id:e.id+"_text",fill:e.color,visibility:e.visible?"visible":"hidden","text-decoration":e.textDecoration,transform:"rotate("+e.angle+","+S+","+w+")translate("+e.x+","+e.y+")",opacity:e.opacity};r&&(C.role="img",C["aria-label"]=r),wd(y,C)}},t.prototype.alignText=function(t,e,i,r,n,o,a,s,h){if("justify"!==s.textAlign)this.setText(t,e,i,r,n,o,s);else if(a!==h.length-1){var d=s.width;this.setText(t,e,i,r,n,o,s,d,"spacing")}else this.setText(t,e,i,r,n,o,s)},t.prototype.setText=function(t,e,i,r,n,o,a,s,h){var d={x:n.toString(),y:o.toString()};"justify"===a.textAlign&&(d.textLength=(s||0).toString(),d.lengthAdjust=h||"spacing"),wd(e,d),t.setAttribute("fill",i.text),e.appendChild(r),t.appendChild(e)},t.prototype.drawImage=function(t,e,i,r){var n;i&&(n=i.getElementById(e.id+"image")),n||(n=document.createElementNS("http://www.w3.org/2000/svg","image"),t.appendChild(n));var o=new Image;o.src=e.source;var a="None"!==e.scale?e.scale:"",s=e.alignment,h=s.charAt(0).toLowerCase()+s.slice(1);"Stretch"!==a&&(h+=" "+a.charAt(0).toLowerCase()+a.slice(1)),wd(n,{id:e.id+"image",x:e.x.toString(),y:e.y.toString(),transform:"rotate("+e.angle+","+(e.x+e.width*e.pivotX)+","+(e.y+e.height*e.pivotY)+")",width:e.width.toString(),visibility:e.visible?"visible":"hidden",height:e.height.toString(),preserveAspectRatio:h,opacity:e.opacity.toString()}),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o.src.toString())},t.prototype.drawHTMLContent=function(t,e,i,r,n){var o,a;if(e&&(o=e.querySelector("#"+t.id+"_html_element")),!o){if(!(a=e.querySelector("#"+t.id+"_html_element")||e.querySelector("#"+t.nodeId+"_html_element")))a=ud("div",{id:t.nodeId+"_html_element",class:"foreign-object"});var s={id:t.id+"_html_element",class:"foreign-object"};o=ud("div",s);var h=document.getElementById(t.diagramId).ej2_instances[0],d=!1;if(e.parentNode&&e.parentNode.parentNode&&e.parentNode.parentNode.parentNode&&e.parentNode.parentNode.parentNode.classList.contains("e-overview")&&(d=!0),d)h.isReact?h.renderReactTemplates(function(){o.appendChild(t.template.cloneNode(!0))}):o.appendChild(t.template.cloneNode(!0));else{if("string"==typeof t.template){var l=document.createElement("div");l.innerHTML=t.template,t.template=l,h.selectedItems.userHandles.filter(function(e){return e.name===t.id.split("_shape")[0]&&""!==e.template})[0].template=t.template}t.isTemplate&&t.template?h instanceof sc?o.appendChild(t.template):o.appendChild(t.template.cloneNode(!0)):t.template&&o.appendChild(t.template.cloneNode(!0))}void 0!==n&&e.childNodes.length>n&&e.insertBefore(o,e.childNodes[parseInt(n.toString(),10)]),a.appendChild(o),e.appendChild(a)}var c=B(t).topLeft;o.style.height=t.actualSize.height+"px",o.style.width=t.actualSize.width+"px",o.style.left=c.x+"px",o.style.top=c.y+"px",o.style.position="absolute",o.style.transform="rotate("+(t.rotateAngle+t.parentTransform)+"deg)",o.style.pointerEvents=r?"all":"none",o.style.visibility=t.visible?"visible":"hidden",o.style.opacity=t.style.opacity.toString()},t.prototype.drawNativeContent=function(t,e,i,r,n){var o,a;if(n&&(o=n.getElementById(t.id+"_native_element"),a=n.getElementById(t.id+"_clip")),!o){(o=document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute("id",t.id+"_native_element"),o.appendChild(t.template.cloneNode(!0));var s=this.createGElement("g",{id:t.id+"_inner_native_element"});s.appendChild(o),e.appendChild(s)}a&&o.removeChild(a),o.style.visibility=t.visible?"visible":"hidden",o.style.opacity=t.style.opacity?t.style.opacity.toString():"1",this.setNativTransform(t,o,i,r),"Slice"===t.scale&&this.drawClipPath(t,o,i,r,n),wd(o,t.description?{role:"img","aria-label":t.description}:{})},t.prototype.setNativTransform=function(t,e,i,r){var n=0!==t.contentSize.width?t.contentSize.width:1,o=0!==t.contentSize.height?t.contentSize.height:1,a=t.templatePosition.x*r/n,s=t.templatePosition.y*i/o;e.setAttribute("transform","rotate("+t.parentTransform+","+t.offsetX+","+t.offsetY+") translate("+(t.offsetX-a-r*t.pivot.x)+","+(t.offsetY-s-i*t.pivot.y)+") scale("+r/n+","+i/o+")")},t.prototype.drawClipPath=function(t,e,i,r,n){var o=t.contentSize.width,a=t.contentSize.height,s=t.width/(r/o),h=t.height/(i/a),d=t.templatePosition.x+(t.width>=t.height?0:(o-s)/2),l=t.templatePosition.y+(t.height>=t.width?0:(a-h)/2),c=n.getElementById(t.id+"_clip");(c=document.createElementNS("http://www.w3.org/2000/svg","clipPath")).setAttribute("id",t.id+"_clip"),e.appendChild(c);var p=n.getElementById(t.id+"_clip_rect");return p=document.createElementNS("http://www.w3.org/2000/svg","rect"),c.appendChild(p),wd(p,{id:t.id+"_clip_rect",width:s.toString(),height:h.toString(),x:d.toString(),y:l.toString()}),Ls()?e.setAttribute("clip-path","url("+location.protocol+"//"+location.host+location.pathname+"#"+t.id+"_clip)"):e.setAttribute("clip-path","url(#"+t.id+"_clip)"),e},t.prototype.renderGradient=function(t,e,i){var r,n,o,a,s,h=ld(i),d=h.getElementById(i+"gradient_pattern");if(d||(d=fd("defs",{id:i+"gradient_pattern"}),h.insertBefore(d,h.firstChild)),Za(e.id),"None"!==t.gradient.type){for(var l=0;l<t.gradient.stops.length;l++)r=r?Math.max(r,t.gradient.stops[parseInt(l.toString(),10)].offset):t.gradient.stops[parseInt(l.toString(),10)].offset,n=n?Math.min(n,t.gradient.stops[parseInt(l.toString(),10)].offset):t.gradient.stops[parseInt(l.toString(),10)].offset;"Linear"===t.gradient.type?((s=t.gradient).id=e.id+"_linear",o=this.createLinearGradient(s),d.appendChild(o)):((a=t.gradient).id=e.id+"_radial",o=this.createRadialGradient(a),d.appendChild(o));for(l=0;l<t.gradient.stops.length;l++){var c=t.gradient.stops[parseInt(l.toString(),10)],p=n<0?(r+c.offset)/(2*r):c.offset/r,g=document.createElementNS("http://www.w3.org/2000/svg","stop");wd(g,{offset:p.toString(),style:"stop-color:"+c.color}),o.appendChild(g)}}return o},t.prototype.createLinearGradient=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");return wd(e,{id:t.id,x1:t.x1+"%",y1:t.y1+"%",x2:t.x2+"%",y2:t.y2+"%"}),e},t.prototype.createRadialGradient=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","radialGradient");return wd(e,{id:t.id,cx:t.cx+"%",cy:t.cy+"%",r:t.r+"%",fx:t.fx+"%",fy:t.fy+"%"}),e},t.prototype.setSvgStyle=function(t,e,i){if(e.canApplyStyle||void 0===e.canApplyStyle){"none"===e.fill&&(e.fill="transparent"),"none"===e.stroke&&(e.stroke="transparent");var r=[],n=void 0;if(e.dashArray)r=(new Md).parseDashArray(e.dashArray);if(e.gradient&&"None"!==e.gradient.type&&i){var o=this.renderGradient(e,t,i);n=Ls()?"url("+location.protocol+"//"+location.host+location.pathname+"#"+o.id+")":"url(#"+o.id+")"}else n=e.fill;e.stroke&&t.setAttribute("stroke",e.stroke),void 0!==e.strokeWidth&&null!==e.strokeWidth&&t.setAttribute("stroke-width",e.strokeWidth.toString()),r&&t.setAttribute("stroke-dasharray",r.toString()||"none"),n&&t.setAttribute("fill",n)}},t.prototype.svgLabelAlign=function(t,e,r){var n=new i(e.width,r.length*(1.2*t.fontSize)),o={x:0,y:0},a=.5*t.width,s=.5*t.height;return"left"===t.textAlign||"justify"===t.textAlign?a=0:"center"===t.textAlign?a=e.width>t.width&&("Ellipsis"===t.textOverflow||"Clip"===t.textOverflow)&&"NoWrap"===t.textWrapping?0:.5*t.width:"right"===t.textAlign&&(a=1*t.width),o.x=0+a+(e?e.x:0),o.y=1.2+s-n.height/2,o},t}(),Go=function(){function t(t,e,i){this.renderer=null,this.isSvgMode=!0,this.touchMove=void 0,this.transform={x:0,y:0},this.diagramId=t,this.element=id(this.diagramId),this.svgRenderer=e,this.isSvgMode=i,this.renderer=i?new Uo:new Md}return t.prototype.setCursor=function(t,e){t.style.cursor=e},t.prototype.setLayers=function(){this.iconSvgLayer=this.element.getElementsByClassName("e-ports-expand-layer")[0],this.adornerSvgLayer=this.element.getElementsByClassName("e-adorner-layer")[0],this.nativeSvgLayer=this.element.getElementsByClassName("e-native-layer")[0],this.diagramSvgLayer=this.element.getElementsByClassName("e-diagram-layer")[0]},t.prototype.getAdornerLayer=function(){return ad(this.diagramId)},t.prototype.getParentSvg=function(t,e,i){return this.diagramId&&t&&t.id?t.id.split("_icon_content").length>1||t.id.split("_nodeport").length>1||t.elementActions&dt.ElementIsPort?this.iconSvgLayer:e&&"selector"===e?this.adornerSvgLayer:t instanceof ne?this.nativeSvgLayer:this.diagramSvgLayer:i},t.prototype.getParentElement=function(t,e,i,r){var n=e;if(i&&this.diagramId&&t&&t.id){t.id.split("_icon_content").length>1?(n=i.getElementById(this.diagramId+"_diagramExpander"),e=null):t.id.split("_nodeport").length>1?n=i.getElementById(this.diagramId+"_diagramPorts"):t instanceof ne?(n=i.getElementById(this.diagramId+"_nativeLayer"),e=null):t.elementActions&dt.ElementIsPort?(n=i.getElementById(this.diagramId+"_diagramPorts"),e=null):n=i.getElementById(this.diagramId+"_diagramLayer");var o=this.getGroupElement(t,e||n,r);n=o.g,o.svg&&(i=o.svg)}return{g:n,svg:i}},t.prototype.getGroupElement=function(t,e,i){var r,n,o=this.getParentSvg(t);if(e&&o){if(o&&!(r=o.getElementById(t.id+"_groupElement"))&&o!==this.nativeSvgLayer){var a=this.nativeSvgLayer;r=a.getElementById(t.id+"_groupElement"),n=a}r||(r=this.svgRenderer.createGElement("g",{id:t.id+"_groupElement"}),void 0!==i&&e.childNodes.length>i?e.insertBefore(r,e.childNodes[parseInt(i.toString(),10)]):e.appendChild(r))}return{g:r,svg:n}},t.prototype.renderElement=function(t,e,i,r,n,o,a,s,h,d,l){t instanceof Ut?(t.id=t.id?t.id:E(),this.renderContainer(t,e,i,r,n,o,a,s,h,d,l)):t instanceof Jt?this.renderImageElement(t,e,r,n,a):t instanceof Qt?this.renderPathElement(t,e,r,n,a,h,l):t instanceof Zt?this.renderTextElement(t,e,r,n,a,d):t instanceof ne?this.renderNativeElement(t,e,r,n,a):t instanceof Bi?this.renderHTMLElement(t,e,i,r,n,a,s):this.renderRect(t,e,r,n,h)},t.prototype.drawSelectionRectangle=function(t,e,i,r,n,o){t=(t+o.tx)*o.scale,e=(e+o.ty)*o.scale;var a={width:i*o.scale,height:r*o.scale,x:t+.5,y:e+.5,fill:"transparent",stroke:"gray",angle:0,pivotX:.5,pivotY:.5,strokeWidth:1,dashArray:"6 3",opacity:1,visible:!0,id:n.id+"_selected_region"},s=this.getAdornerLayer();this.svgRenderer.updateSelectionRegion(s,a)},t.prototype.renderHighlighter=function(t,e,i){var r=t.actualSize.width||2,n=t.actualSize.height||2,o=t.offsetX-r*t.pivot.x,a=t.offsetY-n*t.pivot.y;o=(o+i.tx)*i.scale,a=(a+i.ty)*i.scale;var s={width:r*i.scale,height:n*i.scale,x:o,y:a,fill:"transparent",stroke:"#8CC63F",angle:t.rotateAngle,pivotX:t.pivot.x,pivotY:t.pivot.y,strokeWidth:4,dashArray:"",opacity:1,cornerRadius:0,visible:!0,id:e.id+"_highlighter",class:"e-diagram-highlighter"};this.svgRenderer.drawRectangle(e,s,this.diagramId,void 0,void 0,e)},t.prototype.renderSelectionRectangle=function(t,e,i,r){var n=t.actualSize.width||2,o=t.actualSize.height||2,a=t.offsetX-n*t.pivot.x,s=t.offsetY-o*t.pivot.y;a=(a+i.tx)*i.scale,s=(s+i.ty)*i.scale;var h={width:n*i.scale,height:o*i.scale,x:a,y:s,fill:"transparent",stroke:"#00cc00",angle:t.rotateAngle,pivotX:t.pivot.x,pivotY:t.pivot.y,strokeWidth:r?2:1,dashArray:"",opacity:1,cornerRadius:0,visible:!0,id:t.id+"_highlighter",class:r?"e-diagram-first-selection-indicator e-diagram-selection-indicator":"e-diagram-selection-indicator"},d=this.getParentSvg(t,"selector");this.svgRenderer.drawRectangle(e,h,this.diagramId,void 0,void 0,d)},t.prototype.renderSelectionLine=function(t,e,i,r){var n=this.getBaseAttributes(t,i);n.data=t.absolutePath,n.id=n.id+"_highlighter";var o=t.description?t.description:t.id;this.isSvgMode||(n.x=t.flipOffset.x?t.flipOffset.x:n.x,n.y=t.flipOffset.y?t.flipOffset.y:n.y),i&&(n.x=n.x*i.scale,n.y=n.y*i.scale),n.stroke="#00cc00",n.strokeWidth=r?2:1,n.class=r?"e-diagram-first-selection-indicator e-diagram-selection-indicator":"e-diagram-selection-indicator";var a=this.getParentSvg(t,"selector");this.svgRenderer.drawPath(e,n,this.diagramId,void 0,a,o,i.scale)},t.prototype.renderStackHighlighter=function(t,e,i,r,n,o,a){var s,d=t.actualSize.width||2,l=t.offsetX-d*t.pivot.x,c=t.actualSize.height||2,p=t.offsetY-c*t.pivot.y;l=(l+i.tx)*i.scale;var g=t.bounds,f="";if(p=(p+i.ty)*i.scale,r)if(o){s="M 0 0 L "+((b=d*i.scale)+2)+" 0 Z";var m=g.x,v=g.y;m=t.actualSize.width/Number(g.width?g.width:1)*i.scale,v=t.actualSize.height/Number(g.height?g.height:1)*i.scale;f=u(y(h("M7,4 L8,4 8,7 11,7 11,8 8,8 8,11 7,11 7,8 4,8 4,7 7,7 z M7.5,0.99999994C3.9160004,1 1,3.9160004 0.99999994,7.5 1,11.084 3.9160004,14 7.5,14 11.084,14 14,11.084 14,7.5 14,3.9160004 11.084,1 7.5,0.99999994 z M7.5,0 C11.636002,0 15,3.3639984 15,7.5 15,11.636002 11.636002,15 7.5,15 3.3640003,15 0,11.636002 0,7.5 0,3.3639984 3.3640003,0 7.5,0 z")),m+b+2,v-8,!1,g.x,g.y,0,0),n.y>=t.offsetY&&(p+=c)}else{var b;a&&n.y>=t.offsetY&&(p+=c*i.scale),s="M -10 -10 L 0 0 Z M -10 10 L 0 0 Z M 0 0 L "+(b=d*i.scale)+" 0 Z M "+b+" 0 L "+(b+10)+" 10 Z L "+(b+10)+" -10 Z"}else s="M 10 -10 L 0 0 Z M -10 -10 L 0 0 Z M 0 0 L 0 "+(b=c*i.scale)+" Z M 0 "+b+" L -10 "+(b+10)+" Z L 10 "+(b+10)+" Z",n.x>=t.offsetX&&(l+=d*i.scale);var S={data:s+f,width:d*i.scale,height:c*i.scale,x:l,y:p,fill:"transparent",stroke:"#8CC63F",angle:t.rotateAngle,pivotX:t.pivot.x,pivotY:t.pivot.y,strokeWidth:1,dashArray:"",opacity:1,visible:!0,id:e.id+"_stack_highlighter",class:"e-diagram-highlighter"};this.svgRenderer.drawPath(e,S,this.diagramId)},t.prototype.drawLine=function(t,e){this.svgRenderer.drawLine(t,e)},t.prototype.drawPath=function(t,e){this.svgRenderer.drawPath(t,e,this.diagramId)},t.prototype.renderResizeHandle=function(t,e,i,r,n,o,a,s,h,d,l){var c=t.offsetX-t.actualSize.width*t.pivot.x,p=t.offsetY-t.actualSize.height*t.pivot.y,g=t.actualSize.height,u=t.actualSize.width;if(!d&&i<.Rotate&&ur(this.rendererActions)&&!fr(this.rendererActions))this.renderPivotLine(t,e,o,n,a),this.renderRotateThumb(t,e,o,n,a);else if(this.touchMove){var f=document.getElementById("rotateThumb");f&&f.setAttribute("visibility","hidden")}this.renderBorder(t,e,o,s,h,d);var m=t.actualSize.width*r,y=t.actualSize.height*r;h||!ur(this.rendererActions)||fr(this.rendererActions)||t.isTextAnnotation||(m>=40&&y>=40&&(n&rt.ResizeNorthWest&&this.renderCircularHandle("resizeNorthWest",t,c,p,e,$a(n,"ResizeNorthWest"),i<.ResizeNorthWest,o,void 0,a,{"aria-label":"Thumb to resize the selected object on top left side direction"},void 0,"e-diagram-resize-handle e-northwest",l),n&rt.ResizeNorthEast&&this.renderCircularHandle("resizeNorthEast",t,c+u,p,e,$a(n,"ResizeNorthEast"),i<.ResizeNorthEast,o,void 0,a,{"aria-label":"Thumb to resize the selected object on top right side direction"},void 0,"e-diagram-resize-handle e-northeast",l),n&rt.ResizeSouthWest&&this.renderCircularHandle("resizeSouthWest",t,c,p+g,e,$a(n,"ResizeSouthWest"),i<.ResizeSouthWest,o,void 0,a,{"aria-label":"Thumb to resize the selected object on bottom left side direction"},void 0,"e-diagram-resize-handle e-southwest",l),n&rt.ResizeSouthEast&&this.renderCircularHandle("resizeSouthEast",t,c+u,p+g,e,$a(n,"ResizeSouthEast"),i<.ResizeSouthEast,o,void 0,a,{"aria-label":"Thumb to resize the selected object on bottom right side direction"},void 0,"e-diagram-resize-handle e-southeast",l)),n&rt.ResizeNorth&&this.renderCircularHandle("resizeNorth",t,c+u/2,p,e,$a(n,"ResizeNorth"),i<.ResizeNorth,o,void 0,a,{"aria-label":"Thumb to resize the selected object on top side direction"},void 0,"e-diagram-resize-handle e-north",l),n&rt.ResizeSouth&&this.renderCircularHandle("resizeSouth",t,c+u/2,p+g,e,$a(n,"ResizeSouth"),i<.ResizeSouth,o,void 0,a,{"aria-label":"Thumb to resize the selected object on bottom side direction"},void 0,"e-diagram-resize-handle e-south",l),n&rt.ResizeWest&&this.renderCircularHandle("resizeWest",t,c,p+g/2,e,$a(n,"ResizeWest"),i<.ResizeWest,o,void 0,a,{"aria-label":"Thumb to resize the selected object on left side direction"},void 0,"e-diagram-resize-handle e-west",l),n&rt.ResizeEast&&this.renderCircularHandle("resizeEast",t,c+u,p+g/2,e,$a(n,"ResizeEast"),i<.ResizeEast,o,void 0,a,{"aria-label":"Thumb to resize the selected object on right side direction"},void 0,"e-diagram-resize-handle e-east",l));var v=document.getElementById(this.diagramId+"_SelectorElement");if(t.flippedPoint&&v){var b=document.getElementById(t.id+"_groupElement").getAttribute("transform");if(b.includes("scale"))b="translate("+(t.flippedPoint.x-t.corners.topLeft.x)+","+(t.flippedPoint.y-t.corners.topLeft.y)+")";b&&v.setAttribute("transform",b)}else v&&v.setAttribute("transform","")},t.prototype.renderEndPointHandle=function(t,e,i,r,n,a,s,h,d,l){var c,p,g=t.sourcePoint,u=t.targetPoint,f=t.wrapper;if(this.renderCircularHandle("connectorSourceThumb",f,g.x,g.y,e,$a(r,"ConnectorSourceThumb"),i<.ConnectorSource,n,a,void 0,{"aria-label":"Thumb to move the source point of the connector"},void 0,"e-diagram-endpoint-handle e-sourceend",l),this.renderCircularHandle("connectorTargetThumb",f,u.x,u.y,e,$a(r,"ConnectorTargetThumb"),i<.ConnectorTarget,n,s,void 0,{"aria-label":"Thumb to move the target point of the connector"},void 0,"e-diagram-endpoint-handle e-targetend",l),h)if("Straight"===t.type&&t.segments.length>0)for(c=0;c<t.segments.length-1;c++){p=t.segments[parseInt(c.toString(),10)];var m="e-diagram-straight-segment-handle";this.renderCircularHandle("segementThumb_"+(c+1),f,p.point.x,p.point.y,e,!0,i<.ConnectorSource,n,a,null,null,c,m,l)}else if("Bezier"===t.type&&t.segments.length>0)for(c=0;c<t.segments.length-1;c++){p=t.segments[parseInt(c.toString(),10)];m="e-diagram-bezier-segment-handle";this.renderBezierHandle("segementThumb_"+(c+1),f,p.point.x,p.point.y,e,!0,t,n,a,null,c,m,l)}else if(t.maxSegmentThumb){var y=t.segments.length<=t.maxSegmentThumb?0:1,v=t.segments.length<=t.maxSegmentThumb?t.segments.length:t.segments.length-1;for(t.maxSegmentThumb>=3&&3===t.segments.length&&(y=1,v=t.segments.length-1),y=t.segments.length>t.maxSegmentThumb+2?2:y,v=t.segments.length>t.maxSegmentThumb+2?t.segments.length-2:v,1===t.segments.length&&t.segments[0].points.length<=2&&(y=1,v=t.segments.length),c=y;c<v;c++){b=t.segments[parseInt(c.toString(),10)];this.renderOrthogonalThumbs("orthoThumb_"+(c+1),f,b,e,$a(r,"ConnectorSourceThumb"),n,t)}}else for(c=0;c<t.segments.length;c++){var b=t.segments[parseInt(c.toString(),10)];this.renderOrthogonalThumbs("orthoThumb_"+(c+1),f,b,e,$a(r,"ConnectorSourceThumb"),n,t)}if("Bezier"===t.type&&d){var S=t.segments.length-1,w=null!=t.bezierSettings?t.bezierSettings.controlPointsVisibility:null;for(c=0;c<=S;c++){var x=t.segments[parseInt(c.toString(),10)],I=o.isEmptyPoint(x.point1)?x.bezierPoint1:x.point1;(null!=w&&0===c&&ts(w,"Source")||0!==c&&ts(w,"Intermediate"))&&(this.renderCircularHandle("bezierPoint_"+(c+1)+"_1",f,I.x,I.y,e,$a(r,"ConnectorSourceThumb"),i<.ConnectorSource,n,void 0,void 0,{"aria-label":"Thumb to move the source point of the connector"},void 0,"e-diagram-bezier-control-handle e-source",l),$a(r,"ConnectorSourceThumb")&&this.renderBezierLine("bezierLine_"+(c+1)+"_1",f,e,x.points[0],o.isEmptyPoint(x.point1)?x.bezierPoint1:x.point1,n)),I=o.isEmptyPoint(x.point2)?x.bezierPoint2:x.point2,(null!=w&&c===S&&ts(w,"Target")||c!==S&&ts(w,"Intermediate"))&&(this.renderCircularHandle("bezierPoint_"+(c+1)+"_2",f,I.x,I.y,e,$a(r,"ConnectorTargetThumb"),i<.ConnectorTarget,n,void 0,void 0,{"aria-label":"Thumb to move the target point of the connector"},void 0,"e-diagram-bezier-control-handle e-target",l),$a(r,"ConnectorTargetThumb")&&this.renderBezierLine("bezierLine_"+(c+1)+"_2",f,e,x.points[1],o.isEmptyPoint(x.point2)?x.bezierPoint2:x.point2,n))}}},t.prototype.renderOrthogonalThumbs=function(t,e,i,r,n,a,s){var h,d,l,c,p=0;if(s.maxSegmentThumb){var g=i.points.length<3?0:1,u=i.points.length<3?i.points.length-1:i.points.length-2;for(g=1===s.segments.length?g:0,u=1===s.segments.length?u:i.points.length-1,p=g;p<u;p++)l=o.distancePoints(i.points[parseInt(p.toString(),10)],i.points[p+1]),h=i.points[parseInt(p.toString(),10)].y.toFixed(2)===i.points[p+1].y.toFixed(2)?"horizontal":"vertical",d=!!(l>=50&&i.allowDrag),this.renderOrthogonalThumb(t+"_"+(p+1),e,(i.points[parseInt(p.toString(),10)].x+i.points[p+1].x)/2,(i.points[parseInt(p.toString(),10)].y+i.points[p+1].y)/2,r,d,h,a,s,c)}else for(p=0;p<i.points.length-1;p++)l=o.distancePoints(i.points[parseInt(p.toString(),10)],i.points[p+1]),h=i.points[parseInt(p.toString(),10)].y.toFixed(2)===i.points[p+1].y.toFixed(2)?"horizontal":"vertical",c=o.direction(i.points[parseInt(p.toString(),10)],i.points[p+1]),d=!!(l>=50&&i.allowDrag),this.renderOrthogonalThumb(t+"_"+(p+1),e,(i.points[parseInt(p.toString(),10)].x+i.points[p+1].x)/2,(i.points[parseInt(p.toString(),10)].y+i.points[p+1].y)/2,r,d,h,a,s,c)},t.prototype.renderOrthogonalThumb=function(t,e,r,n,o,a,s,h,d,l){var c,p,g=0,u=document.getElementById(this.diagramId);u&&(p=u.ej2_instances[0]);var f=d.constraints&at.InheritSegmentThumbShape?p.segmentThumbShape:d.segmentThumbShape,m=d.constraints&at.InheritSegmentThumbSize?p.segmentThumbSize:d.segmentThumbSize;if(c="horizontal"===s?Ae(f):Oe(f),"Arrow"===f||"DoubleArrow"===f||"OpenArrow"===f)switch(l){case"Bottom":case"Right":g=180;break;default:g=0}else if("Fletch"===f||"OpenFetch"===f||"IndentedArrow"===f||"OutdentedArrow"===f)switch(l){case"Bottom":g=-90;break;case"Top":g=90;break;case"Right":g=180;break;default:g=0}var y={x:(r+h.tx)*h.scale-m/2,y:(n+h.ty)*h.scale-m/2,angle:g,fill:"#e2e2e2",stroke:"black",strokeWidth:1,dashArray:"",data:c,width:m,height:m,pivotX:.5,pivotY:.5,opacity:1,visible:a,id:t,class:"e-diagram-ortho-segment-handle"},v=Jh(y.data),b=new i(y.width,y.height),S=new Qt;if(y.data=S.updatePath(y.data,v,b),this.touchMove){var w=document.getElementById(t);w?this.updateSegmentPosition(w,y):this.svgRenderer.drawPath(o,y,this.diagramId)}else this.svgRenderer.drawPath(o,y,this.diagramId)},t.prototype.renderPivotLine=function(t,e,i,r,n){var o=t,a=!!(r&rt.Rotate);n&&(a=!1);var s=this.getBaseAttributes(o,i);s.fill="None",s.stroke="black",s.strokeWidth=1,s.dashArray="2,3",s.visible=a;var h=i.scale;s.x*=h,s.y*=h,s.width*=h,s.height*=h,s.id="pivotLine",s.class="e-diagram-pivot-line";var d={x:o.actualSize.width*o.pivot.x*h,y:-20},l={x:o.actualSize.width*o.pivot.x*h,y:0};s.startPoint=d,s.endPoint=l,this.svgRenderer.drawLine(e,s)},t.prototype.renderBezierLine=function(t,e,i,r,n,o){var a=this.getBaseAttributes(e,o);a.id=t,a.stroke="black",a.strokeWidth=1,a.dashArray="3,3",a.fill="None",a.class="e-diagram-bezier-control-line",a.x=0,a.y=0;var s=o.scale,h={x:(r.x+o.tx)*s,y:(r.y+o.ty)*s},d={x:(n.x+o.tx)*s,y:(n.y+o.ty)*s};a.startPoint=h,a.endPoint=d,this.svgRenderer.drawLine(i,a)},t.prototype.renderCircularHandle=function(t,e,i,r,n,o,a,s,h,d,l,c,p,g){var u=e,f={x:i,y:r};if(0!==u.rotateAngle||0!==u.parentTransform){var m=I();T(m,u.rotateAngle+u.parentTransform,u.offsetX,u.offsetY),f=P(m,f)}var y=this.getBaseAttributes(u);if(y.stroke="black",y.strokeWidth=1,void 0!==c?(y.id="segmentEnd_"+c,y.fill="#e2e2e2"):y.fill=h?"#8CC63F":"white",y.cornerRadius=g/2,y.angle=e.rotateAngle,y.id=t,y.visible=o,y.class=p,y.width=g,y.height=g,y.x=(f.x+s.tx)*s.scale,y.y=(f.y+s.ty)*s.scale,y.x=y.x-y.width/2,y.y=y.y-y.height/2,h&&(y.class+=" e-connected"),d&&(y.visible=!1),this.touchMove){var v=document.getElementById(t);if(v)this.updateResizeHandle(v,y);else{var b=this.getParentSvg(e,"selector");this.svgRenderer.drawRectangle(n,y,this.diagramId,!0,!0,b,l,!0,a)}}else{b=this.getParentSvg(e,"selector");this.svgRenderer.drawRectangle(n,y,this.diagramId,!0,!0,b,l,!0,a)}},t.prototype.updateResizeHandle=function(t,e){wd(t,{id:e.id,x:e.x.toString(),y:e.y.toString(),width:e.width.toString(),height:e.height.toString(),visibility:e.visible?"visible":"hidden",transform:"rotate("+e.angle+","+(e.x+e.width/2)+","+(e.y+e.height/2)+")",rx:e.cornerRadius||0,ry:e.cornerRadius||0,opacity:e.opacity})},t.prototype.renderBezierHandle=function(t,e,r,n,o,a,s,h,d,l,c,p,g){var u,f=document.getElementById(this.diagramId);f&&(u=f.ej2_instances[0]);var m=e,y={x:r,y:n};if(0!==m.rotateAngle||0!==m.parentTransform){var v=I();T(v,m.rotateAngle+m.parentTransform,m.offsetX,m.offsetY),y=P(v,y)}var b=s.constraints&at.InheritSegmentThumbShape?u.segmentThumbShape:s.segmentThumbShape,S=s.constraints&at.InheritSegmentThumbSize?u.segmentThumbSize:s.segmentThumbSize,w=Oe(b),x=this.getBaseAttributes(m);x.stroke="black",x.strokeWidth=1,void 0!==c?(x.id="segmentEnd_"+c,x.fill="#e2e2e2"):x.fill=d?"#8CC63F":"white",x.angle=e.rotateAngle,x.id=t,x.visible=a,x.class=p,x.width=S,x.height=S,x.data=w,x.x=(y.x+h.tx)*h.scale,x.y=(y.y+h.ty)*h.scale,x.x=x.x-x.width/2,x.y=x.y-x.height/2,d&&(x.class+=" e-connected"),l&&(x.visible=!1);var C=Jh(x.data),A=new i(x.width,x.height),O=new Qt;if(x.data=O.updatePath(x.data,C,A),this.touchMove){var D=document.getElementById(t);if(D)this.updateSegmentPosition(D,x);else{var M=this.getParentSvg(e,"selector");this.svgRenderer.drawPath(o,x,this.diagramId,!0,M)}}else{M=this.getParentSvg(e,"selector");this.svgRenderer.drawPath(o,x,this.diagramId,!0,M)}},t.prototype.updateSegmentPosition=function(t,e){wd(t,{id:e.id,transform:"rotate("+e.angle+","+(e.x+e.width*e.pivotX)+","+(e.y+e.height*e.pivotY)+")translate("+e.x+","+e.y+")",visibility:e.visible?"visible":"hidden",opacity:e.opacity})},t.prototype.renderBorder=function(t,e,i,r,n,o){var a=t,s=this.getBaseAttributes(a,i);s.x*=i.scale,s.y*=i.scale,s.width*=i.scale,s.height*=i.scale,s.fill="transparent",s.stroke="#097F7F",s.strokeWidth=1.2,s.gradient=null,s.dashArray="6,3",s.class="e-diagram-selector",o&&(s.class+=" e-diagram-lane"),s.id="borderRect",s.id=this.rendererActions&vt.DrawSelectorBorder?"borderRect_symbol":"borderRect",r||(s.class+=" e-disabled"),n&&(s.class+=" e-thick-border"),s.cornerRadius=0;var h=this.getParentSvg(t,"selector");this.svgRenderer.drawRectangle(e,s,this.diagramId,void 0,!0,h)},t.prototype.renderUserHandler=function(t,e,r,n,o,a){for(var s,d=t.wrapper,l=0,c=t.userHandles;l<c.length;l++){var p=c[l];s=!0,(p.disableConnectors&&t.connectors.length>0||p.disableNodes&&t.nodes.length>0||"Drag"===o&&a)&&(s=!1);var g=document.getElementById(p.name+"_template_hiddenUserHandle");g&&(p.template=g.childNodes[0].cloneNode(!0));var f=Ka(t,p,r);if(f.x=(f.x+r.tx)*r.scale,f.y=(f.y+r.ty)*r.scale,p.visible&&(p.visible=!!(t.constraints&rt.UserHandle)),s)if(p.pathData){var m=p.pathData?p.pathData:p.content,v=this.getBaseAttributes(d);v.id=p.name+"_userhandle",v.fill=p.backgroundColor,v.stroke=p.borderColor,v.strokeWidth=p.borderWidth,v.centerX=f.x,v.centerY=f.y,v.radius=.5*p.size,v.class="e-diagram-userhandle-circle",v.angle=0,v.visible=p.visible,v.opacity=1,this.svgRenderer.drawCircle(e,v,1,{"aria-label":p.name+"user handle"});var b=[];b=y(b=h(m));var S=Jh(m),w=u(b,(p.size-.45*p.size)/S.width,(p.size-.45*p.size)/S.height,!0,S.x,S.y,0,0);S=Jh(w);var x={x:f.x-S.width/2,y:f.y-S.height/2,angle:0,id:"",class:"e-diagram-userhandle-path",fill:p.pathColor,stroke:p.backgroundColor,strokeWidth:.5,dashArray:"",data:w,width:p.size-5,height:p.size-5,pivotX:0,pivotY:0,opacity:1,visible:p.visible};this.svgRenderer.drawPath(e,x,this.diagramId,void 0,void 0,{"aria-label":p.name+"user handle"})}else if(p.content){var I=new ne(p.name,this.diagramId);I.content=p.content,I.offsetX=f.x,I.offsetY=f.y,I.id=p.name+"_shape",I.horizontalAlignment="Center",I.verticalAlignment="Center",I.visible=p.visible,I.setOffsetWithRespectToBounds(f.x,f.y,"Fraction"),I.relativeMode="Object",I.description=p.name||"User handle",I.measure(new i(p.size,p.size)),I.arrange(I.desiredSize),this.svgRenderer.drawNativeContent(I,e,p.size,p.size,this.adornerSvgLayer)}else if(p.source){var P=new Jt;(x=this.getBaseAttributes(P,r)).width=p.size,x.height=p.size,x.x=f.x-p.size/2,x.y=f.y-p.size/2,x.sourceWidth=p.size,x.sourceHeight=p.size,x.alignment=P.imageAlign,x.source=p.source,x.scale=P.imageScale,x.visible=p.visible,x.description=p.name||"User handle",x.id=p.name+"_",this.renderer.drawImage(e,x,this.adornerSvgLayer,!1)}else{var C=new Bi(p.name,this.diagramId);C.offsetX=f.x,C.offsetY=f.y,C.id=p.name+"_shape",C.visible=p.visible,C.relativeMode="Object",C.template=p.template,C.measure(new i(p.size,p.size)),C.arrange(C.desiredSize),this.svgRenderer.drawHTMLContent(C,n,void 0,!0,void 0)}}},t.prototype.renderRotateThumb=function(t,e,r,n,o){new Qt;var a,s=new i;s.width=18,s.height=16;var h=t.offsetY-t.actualSize.height*t.pivot.y,d=t.offsetX-t.actualSize.width*t.pivot.x,l=!!(n&rt.Rotate);o&&(l=!1);var c=d+t.pivot.x*t.actualSize.width,p=h;if(c=(c+r.tx)*r.scale,p=(p+r.ty)*r.scale,a={x:c-.5*s.width,y:p-30-.5*s.height},0!==t.rotateAngle||0!==t.parentTransform){var g=I();T(g,t.rotateAngle+t.parentTransform,(r.tx+t.offsetX)*r.scale,(r.ty+t.offsetY)*r.scale),a=P(g,a)}var u={x:a.x,y:a.y,angle:t.rotateAngle+t.parentTransform,fill:"#231f20",stroke:"black",strokeWidth:.5,dashArray:"",data:"M 16.856144362449648 10.238890446662904 L 18.000144362449646 3.437890446662903L 15.811144362449646 4.254890446662903 C 14.837144362449646 2.5608904466629028 13.329144362449647 1.2598904466629026 11.485144362449645 0.5588904466629026 C 9.375144362449646 - 0.24510955333709716 7.071144362449646 - 0.18010955333709716 5.010144362449646 0.7438904466629028 C 2.942144362449646 1.6678904466629028 1.365144362449646 3.341890446662903 0.558144362449646 5.452890446662903 C - 0.244855637550354 7.567890446662903 - 0.17985563755035394 9.866890446662904 0.7431443624496461 11.930890446662904 C 1.6681443624496461 13.994890446662904 3.343144362449646 15.575890446662903 5.457144362449647 16.380890446662903 C 6.426144362449647 16.7518904466629 7.450144362449647 16.9348904466629 8.470144362449647 16.9348904466629 C 9.815144362449647 16.9348904466629 11.155144362449647 16.6178904466629 12.367144362449647 15.986890446662901 L 11.351144362449647 14.024890446662901 C 9.767144362449647 14.8468904466629 7.906144362449647 14.953890446662902 6.237144362449647 14.3178904466629 C 4.677144362449647 13.7218904466629 3.444144362449647 12.5558904466629 2.758144362449647 11.028890446662901 C 2.078144362449646 9.501890446662903 2.031144362449646 7.802890446662903 2.622144362449646 6.243890446662903 C 3.216144362449646 4.6798904466629025 4.387144362449646 3.442890446662903 5.914144362449646 2.760890446662903 C 7.437144362449646 2.078890446662903 9.137144362449646 2.0298904466629026 10.700144362449645 2.6258904466629027 C 11.946144362449646 3.100890446662903 12.971144362449646 3.9538904466629026 13.686144362449646 5.049890446662903 L 11.540144362449645 5.850890446662903 L 16.856144362449648 10.238890446662904 Z",width:20,height:20,pivotX:0,pivotY:0,opacity:1,visible:l,id:(t.id,"rotateThumb"),class:"e-diagram-rotate-handle"};if(this.touchMove){var f=document.getElementById("rotateThumb");f?this.updateSegmentPosition(f,u):this.svgRenderer.drawPath(e,u,this.diagramId,!0,void 0,{"aria-label":"Thumb to rotate the selected object"})}else this.svgRenderer.drawPath(e,u,this.diagramId,!0,void 0,{"aria-label":"Thumb to rotate the selected object"})},t.prototype.renderPathElement=function(t,e,i,r,n,o,a){var s=this.getBaseAttributes(t,i,o);if(s.data=t.absolutePath,s.data=t.absolutePath,t.isPathPort&&a){s.x=a[t.id]?a[t.id].cx:s.x,s.y=a[t.id]?a[t.id].cy:s.y,t.bounds.x=s.x,t.bounds.y=s.y;var d=document.getElementById(this.diagramId);d&&"PortDrag"!==d.ej2_instances[0].eventHandler.currentAction&&(t.offsetX=s.x+t.width/2,t.offsetY=s.y+t.height/2)}var l=t.description?t.description:t.id;if(t.isExport){var c=t.absoluteBounds,p=h(s.data),g=this.findAndStoreArcValues(p);s.arc=g,s.data=td(t,c,void 0,s)}this.renderer.drawPath(e,s,this.diagramId,void 0,r,l,void 0,this,t)},t.prototype.findAndStoreArcValues=function(t){var e=[];return t.forEach(function(t){if("A"===t.command){var i={r1:t.r1/2,r2:t.r2/2};e.push(i)}}),e},t.prototype.renderSvgGridlines=function(t,e,i,r,n,o){var a=document.createElementNS("http://www.w3.org/2000/svg","pattern"),s=document.createElementNS("http://www.w3.org/2000/svg","defs");s.setAttribute("id",this.diagramId+"_grid_pattern_defn"),(t.constraints&it.ShowHorizontalLines||t.constraints&it.ShowVerticalLines)&&a.setAttribute("id",this.diagramId+"_pattern");var h=0,d=0,l=0,c=0,p=1,g=!1,u="Lines"===t.gridType,f=u?t.verticalGridlines.lineIntervals:t.verticalGridlines.dotIntervals,m=u?t.horizontalGridlines.lineIntervals:t.horizontalGridlines.dotIntervals;if(r.showRulers&&r.dynamicGrid&&n&&o)l=o.updateSegmentWidth(i.scale),c=n.updateSegmentWidth(i.scale),t.horizontalGridlines.scaledIntervals=[l/n.interval],t.verticalGridlines.scaledIntervals=[c/o.interval],g=!0;else{for(var y=0;y<f.length;y+=1)h+=f[parseInt(y.toString(),10)];for(y=0;y<m.length;y+=1)d+=m[parseInt(y.toString(),10)];p=this.scaleSnapInterval(t,i.scale)}h=g?c:h*p,d=g?l:d*p,wd(a,{id:this.diagramId+"_pattern",x:0,y:0,width:h,height:d,patternUnits:"userSpaceOnUse"}),this.horizontalSvgGridlines(a,h,d,p,t,r,o,g,u,m),this.verticalSvgGridlines(a,h,d,p,t,r,n,g,u,f),s.appendChild(a),e.appendChild(s)},t.prototype.horizontalSvgGridlines=function(t,e,i,r,n,o,a,s,h,d){var l,c=0,p=[];if(n.constraints&it.ShowHorizontalLines){n.horizontalGridlines.lineDashArray&&(p=this.renderer.parseDashArray(n.horizontalGridlines.lineDashArray)),o.showRulers&&o.dynamicGrid&&a&&(d=this.updateLineIntervals(d,o,a,i,h)),d=ia(d,h);for(var g=0;g<d.length;g+=2){c=ea(d,h,g,c);l=document.createElementNS("http://www.w3.org/2000/svg",h?"path":"circle");var u=h?c+d[parseInt(g.toString(),10)]/2:c;u=s?u:u*r,h?(wd(l,""===p.toString()?{"stroke-width":d[parseInt(g.toString(),10)],d:"M0,"+u+" L"+e+","+u+" Z",class:1.25===d[parseInt(g.toString(),10)]?"e-diagram-thick-grid":"e-diagram-thin-grid",stroke:n.horizontalGridlines.lineColor}:{"stroke-width":d[parseInt(g.toString(),10)],stroke:n.horizontalGridlines.lineColor,d:"M0,"+u+" L"+e+","+u+" Z",class:1.25===d[parseInt(g.toString(),10)]?"e-diagram-thick-grid":"e-diagram-thin-grid",dashArray:p.toString()}),t.appendChild(l),c+=d[g+1]+d[parseInt(g.toString(),10)]):(this.renderDotGrid(g,t,n,0,u,r,!0),c+=d[parseInt(g.toString(),10)])}}},t.prototype.renderDotGrid=function(t,e,i,r,n,o,a){var s,h,d,l=a?i.verticalGridlines.dotIntervals:i.horizontalGridlines.dotIntervals;l=ia(l,!1);for(var c=1;c<l.length;c+=2)s=c===l.length-1?l[0]:l[c-1],d=r,d*=o,wd(h=document.createElementNS("http://www.w3.org/2000/svg","circle"),{cx:a?d:n,cy:a?n:d,fill:i.horizontalGridlines.lineColor,r:s}),e.appendChild(h),r+=l[parseInt(c.toString(),10)]+l[c-1]},t.prototype.verticalSvgGridlines=function(t,e,i,r,n,o,a,s,h,d){var l,c=0,p=[];if(n.constraints&it.ShowVerticalLines){n.verticalGridlines.lineDashArray&&(p=this.renderer.parseDashArray(n.verticalGridlines.lineDashArray)),o.showRulers&&o.dynamicGrid&&a&&(d=this.updateLineIntervals(d,o,a,e,h));d=ia(d,h);for(var g=0;g<d.length;g+=2){c=ea(d,h,g,c);var u=h?c+d[parseInt(g.toString(),10)]/2:c;u=s?u:u*r,l=document.createElementNS("http://www.w3.org/2000/svg",h?"path":"circle");h?(wd(l,""===p.toString()?{"stroke-width":d[parseInt(g.toString(),10)],d:"M"+u+",0 L"+u+","+i+" Z",class:1.25===d[parseInt(g.toString(),10)]?"e-diagram-thick-grid":"e-diagram-thin-grid",stroke:n.verticalGridlines.lineColor}:{"stroke-width":d[parseInt(g.toString(),10)],class:1.25===d[parseInt(g.toString(),10)]?"e-diagram-thick-grid":"e-diagram-thin-grid",stroke:n.verticalGridlines.lineColor,d:"M"+u+",0 L"+u+","+i+" Z",dashArray:p.toString()}),t.appendChild(l),c+=d[g+1]+d[parseInt(g.toString(),10)]):(this.renderDotGrid(g,t,n,0,u,r,!1),c+=d[parseInt(g.toString(),10)])}}},t.prototype.updateGrid=function(t,e,i,r,n,o){var a=e.getElementById(this.diagramId+"_grid_rect"),s=!1;if(a){var h=e.getElementById(this.diagramId+"_pattern");h&&h.parentNode.removeChild(h);var d=0,l=0,c=1,p="Lines"===t.gridType,g=p?t.verticalGridlines.lineIntervals:t.verticalGridlines.dotIntervals,u=p?t.horizontalGridlines.lineIntervals:t.horizontalGridlines.dotIntervals;r.showRulers&&r.dynamicGrid&&o&&n?(d=o.updateSegmentWidth(i.scale),l=n.updateSegmentWidth(i.scale),s=!0,t.horizontalGridlines.scaledIntervals=[d/n.interval],t.verticalGridlines.scaledIntervals=[l/o.interval]):c=this.scaleSnapInterval(t,i.scale);for(var f=0,m=0;m<u.length;m+=1)f+=u[parseInt(m.toString(),10)];var y=0;for(m=0;m<g.length;m+=1)y+=g[parseInt(m.toString(),10)];var v={x:-i.tx*i.scale,y:-i.ty*i.scale};wd(a,v),y=s?l:y*c,f=s?d:f*c,v={id:this.diagramId+"_pattern",x:0,y:0,width:y,height:f,patternUnits:"userSpaceOnUse"},wd(h=document.createElementNS("http://www.w3.org/2000/svg","pattern"),v),this.horizontalSvgGridlines(h,y,f,c,t,r,o,s,p,u),this.verticalSvgGridlines(h,y,f,c,t,r,n,s,p,g);var b=e.getElementById(this.diagramId+"_grid_pattern_defn");b&&b.appendChild(h)}},t.prototype.updateLineIntervals=function(t,e,i,r,n){for(var o=[],a=r/i.interval,s=n?i.interval:i.interval+1,h=0;h<2*s;h++)o[parseInt(h.toString(),10)]=h%2==0?n?0===h?1.25:.25:0:n?a-o[h-1]:a;return o},t.prototype.scaleSnapInterval=function(t,e){if(e>=2)for(;e>=2;)e/=2;else if(e<=.5)for(;e<=.5;)e*=2;var i;if(t.horizontalGridlines.scaledIntervals=t.horizontalGridlines.snapIntervals,t.verticalGridlines.scaledIntervals=t.verticalGridlines.snapIntervals,1!==e){var r=t.horizontalGridlines;for(r.scaledIntervals=[],i=0;i<r.snapIntervals.length;i++)r.scaledIntervals[parseInt(i.toString(),10)]=r.snapIntervals[parseInt(i.toString(),10)]*e;for((r=t.verticalGridlines).scaledIntervals=[],i=0;i<r.snapIntervals.length;i++)r.scaledIntervals[parseInt(i.toString(),10)]=r.snapIntervals[parseInt(i.toString(),10)]*e}return e},t.prototype.renderTextElement=function(t,e,i,r,n,o){var a=this.getBaseAttributes(t,i);o&&(a.x=o[t.id]?o[t.id].cx:a.x,a.y=o[t.id]?o[t.id].cy:a.y,t.bounds.x=a.x,t.bounds.y=a.y,t.isExport&&(a.x=a.x*Math.min(t.exportScaleValue.x||t.exportScaleValue.y),a.y=a.y*Math.min(t.exportScaleValue.x||t.exportScaleValue.y))),a.cornerRadius=0,a.whiteSpace=Z(t.style.whiteSpace,t.style.textWrapping),a.content=t.content,a.breakWord=F(t.style.textWrapping),a.textAlign=Y(t.style.textAlign),a.color=t.style.color,a.italic=t.style.italic,a.bold=t.style.bold,a.fontSize=t.style.fontSize,a.fontFamily=t.style.fontFamily,a.textOverflow=t.style.textOverflow,a.textWrapping=t.style.textWrapping,a.textDecoration=t.style.textDecoration,a.doWrap=t.doWrap,a.wrapBounds=t.wrapBounds,a.childNodes=t.childNodes,a.isHorizontalLane=t.isLaneOrientation,a.id=t.id?t.id:E(),t.isLaneOrientation&&(a.parentOffsetX=this.groupElement.offsetX,a.parentOffsetY=this.groupElement.offsetY,a.parentWidth=this.groupElement.actualSize.width,a.parentHeight=this.groupElement.actualSize.height),a.dashArray="",a.strokeWidth=0,a.fill=t.style.fill;var s=t.description?t.description:t.content?t.content:t.id;("Wrap"===t.style.textWrapping||"WrapWithOverflow"===t.style.textWrapping)&&this.groupElement&&a.height>this.groupElement.actualSize.height&&("Clip"===t.style.textOverflow||"Ellipsis"===t.style.textOverflow)&&(a.y=a.y+(a.height-this.groupElement.actualSize.height)/2),this.renderer.drawRectangle(e,a,this.diagramId,void 0,void 0,r,void 0,void 0,void 0,this,t),this.renderer.drawText(e,a,r,s,this.diagramId,t.isExport&&Math.min(t.exportScaleValue.x||t.exportScaleValue.y),this,t),this.isSvgMode&&(t.doWrap=!1)},t.prototype.renderNativeElement=function(t,e,i,r,n){var o,a,s=this.getParentSvg(t,void 0,e)||r,h=this.getParentElement(t,e,s).g||e,d=this.getBaseAttributes(t,i);switch(d.fill="transparent",d.cornerRadius=t.cornerRadius,d.stroke="transparent",this.renderer.drawRectangle(e,d,this.diagramId,void 0,void 0,r),t.scale){case"None":o=t.contentSize.width,a=t.contentSize.height;break;case"Stretch":o=t.actualSize.width,a=t.actualSize.height;break;case"Meet":o=a=t.actualSize.width<=t.actualSize.height?t.actualSize.width:t.actualSize.height;break;case"Slice":o=a=t.actualSize.width>=t.actualSize.height?t.actualSize.width:t.actualSize.height}this.svgRenderer&&this.svgRenderer.drawNativeContent(t,h,a,o,s)},t.prototype.renderHTMLElement=function(t,e,i,r,n,o,a){var s=this.getBaseAttributes(t,r);s.fill="transparent",s.cornerRadius=t.cornerRadius,s.stroke="transparent",this.renderer.drawRectangle(e,s,this.diagramId,void 0,void 0,n),this.svgRenderer&&this.svgRenderer.drawHTMLContent(t,i.children[0],r,sa(i),a)},t.prototype.renderImageElement=function(t,e,i,r,n){var o,a,s,h,d=this.getBaseAttributes(t,i);d.cornerRadius=0,this.renderer.drawRectangle(e,d,this.diagramId,void 0,void 0,r);var l,c=t.contentSize.width,p=t.contentSize.height,g=d.width/c,u=d.height/p;if("Stretch"===t.stretch)o=c*(l=Math.min(g,u)),a=p*l;else switch(t.stretch){case"Meet":o=c*(l=Math.min(g,u)),a=p*l,d.x+=Math.abs(d.width-o)/2,d.y+=Math.abs(d.height-a)/2;break;case"Slice":o=c*(l=Math.max(g,u)),a=p*l,s=d.width/o*c,h=d.height/a*p;break;case"None":o=c,a=p}d.width=o,d.height=a,d.sourceWidth=s,d.sourceHeight=h,d.source=t.source,d.alignment=t.imageAlign,d.scale=t.imageScale,d.description=t.description?t.description:t.id,this.renderer.drawImage(e,d,r,n,this,t)},t.prototype.renderContainer=function(t,e,i,r,n,o,a,s,h,d,l){var c,p={svg:n,g:e},g=document.getElementById(this.diagramId);if(g&&(c=g.ej2_instances[0]),this.diagramId&&(n=this.getParentSvg(t)||n,this.isSvgMode)){var u=this.getParentElement(t,e,n,s).g||e;n=this.getParentSvg(this.hasNativeParent(t.children))||n;var f=this.getParentElement(this.hasNativeParent(t.children),u,n,s);p.svg=f.svg||n,p.g=f.g||u,o?(n&&(n.getElementById(p.g.id)||e.appendChild(p.g)),e=p.g):e=p.g}if(t&&t.id&&t.id.endsWith("_transaction_events")&&0!==t.flip&&(this.transactionBounds=t.bounds),this.renderRect(t,e,r,n),this.groupElement=t,t.hasChildren()){for(var m,y=void 0,v=0,b=t.children;v<b.length;v++){var S=b[v];this.groupElement=t,n=this.getParentSvg(this.hasNativeParent(t.children)||S)||n,this.isSvgMode&&(y=(m=this.getParentElement(this.hasNativeParent(t.children)||S,e,n)).g||e,m.svg&&(n=m.svg)),this.isSvgMode||"Object"===S.relativeMode&&(S.flip=t.flip,S.id&&(S.id.includes("_0_compensation")||S.id.includes("_0_adhoc"))&&t.children[0].flip&&(S.flip=t.children[0].flip));var w=y;this.renderElement(S,y||e,i,r,n,!0,a,s,h,d,l),t.children&&t.children[0]instanceof ne&&(S instanceof Zt||S.elementActions&dt.ElementIsPort)&&(w=document.getElementById(S.id+"_groupElement")),S instanceof Zt&&w&&this.renderFlipTextElement(t,w,S,S.flip,S.flipMode)}var x=void 0;c&&c.selectedItems&&c.selectedItems.nodes&&c.selectedItems.nodes.length>0&&(x=c.selectedItems.nodes[0]);var I,P=void 0,C=!1,T=t.id.includes("group_container")?t.id.split("group_container")[0]:t.id;c&&c.selectedItems&&(I=c.getObject(T)),(x=I)&&x.flipMode&&(C=!0);var A="";if(x&&(A=x.children?x.id+"group_container":x.id+"_content_groupElement"),(c instanceof sc&&c.nameTable[""+T]&&"connectors"!==c.nameTable[""+T].propName||c instanceof Qo)&&(C&&x||c instanceof Qo)){if(t.children&&t.children[0]instanceof ne)P=c instanceof Qo?document.querySelector(".e-overview g[id="+T+"_content_inner_native_element]"):document.getElementById(x.id+"_content_inner_native_element");else if(t.children&&t.children[0]instanceof Bi){if(c instanceof Qo)P=document.querySelector("#"+c.id+"_htmlLayer_div").querySelector("#"+T+"_content_html_element");else P=document.getElementById(x.id+"_content_html_element");P||(P=document.getElementById(A))}else P=document.getElementById(A);P&&this.renderFlipElement(t,P,t.flip)}}},t.prototype.renderFlipTextElement=function(t,e,i,r,n,o){var a={},s=1,h=1,d=0,l=0,c=0,p=0;if(r!==tt.None){var g=t.rotateAngle;0===t.rotateAngle&&t.id.includes("group_container")&&(g=t.parentTransform);var u=i.getAbsolutePosition(i.desiredSize);if(!u){var f=i.desiredSize;u={x:.5*f.width,y:.5*f.height}}if(u&&""!==i.content)if("All"===n||"LabelAndLabelText"===n){if(r!==tt.Horizontal&&r!==tt.Both||(d=t.bounds.center.x,c=-t.bounds.center.x,s=-1),r!==tt.Vertical&&r!==tt.Both||(l=t.bounds.center.y,p=-t.bounds.center.y,h=-1),r===tt.Horizontal||r===tt.Vertical){var m=Math.sin(g*Math.PI/180);if(void 0!==u.y&&!isNaN(u.y)){var y=u.y/i.desiredSize.height;isNaN(y)||(c+=-t.desiredSize.height*m*(-2*y+1))}if(void 0!==u.x&&!isNaN(u.x)){var v=u.x/i.desiredSize.width;isNaN(v)||(p+=t.desiredSize.width*m*(-2*v+1))}}a={transform:"translate("+d+","+l+") scale("+s+","+h+") translate("+c+","+p+")"}}else if("LabelText"===n||"PortAndLabelText"===n)r!==tt.Horizontal&&r!==tt.Both||(d=i.offsetX,c=-i.offsetX,s=-1),r!==tt.Vertical&&r!==tt.Both||(l=i.offsetY,p=-i.offsetY,h=-1),a={transform:"translate("+d+","+l+") scale("+s+","+h+") translate("+c+","+p+")"};else if("PortAndLabel"===n||"Label"===n){var b=this.flipLabel(t,i,u,r);a={transform:"translate("+(b.x-i.offsetX)+","+(b.y-i.offsetY)+")"}}}else a={transform:"translate(0,0)"};return o?a:(this.setFlipAttributes(t,e,a,s,h,!1),{})},t.prototype.renderFlipElement=function(t,e,i,r){var n={},o=1,a=1,s=0,h=0,d=0,l=0;i!==tt.None?(i!==tt.Horizontal&&i!==tt.Both||(s=t.bounds.center.x,d=-t.bounds.center.x,o=-1),i!==tt.Vertical&&i!==tt.Both||(h=t.bounds.center.y,l=-t.bounds.center.y,a=-1),n={transform:"translate("+s+","+h+") scale("+o+","+a+") translate("+d+","+l+")"}):n={transform:"translate(0,0)"};var c=t&&t.children&&t.children.length&&t.children[0]instanceof Bi;return r?n:(this.setFlipAttributes(t,e,n,o,a,c),{})},t.prototype.setFlipAttributes=function(t,e,i,r,n,o){if(i)if(o){var a=e.id.split("_preview");e=(document.getElementById(a[0]+"_html_div")||gd(this.diagramId).children[0]).querySelector("#"+t.id+"_content_html_element");var s=t.flip===tt.None||t.flip===tt.Both?1:-1;e&&(e.style.transform="scale("+r+","+n+")rotate("+(s*t.rotateAngle+t.parentTransform)+"deg)")}else wd(e,i)},t.prototype.flipLabel=function(t,e,i,r){if(r!==tt.None){var n=t.offsetX-t.desiredSize.width/2,o=t.offsetY-t.desiredSize.height/2,a=.5,s=.5;"Left"===e.horizontalAlignment||"Auto"===e.horizontalAlignment?a=0:"Right"===e.horizontalAlignment&&(a=1),"Top"===e.verticalAlignment||"Auto"===e.verticalAlignment?s=0:"Bottom"===e.verticalAlignment&&(s=1);var h=i.x/e.desiredSize.width,d=i.y/e.desiredSize.height,l=n+t.desiredSize.width*h,c=o+t.desiredSize.height*d,p=(a-.5)*e.desiredSize.width,g=(s-.5)*e.desiredSize.height,u=r===tt.Horizontal||r===tt.Both,f=r===tt.Vertical||r===tt.Both;u&&(l=n+t.desiredSize.width*(1-h),c-=f?0:g),f&&(c=o+t.desiredSize.height*(1-d),l-=u?0:p),u&&!f?l+=p:f&&!u?c+=g:u&&f&&(l+=p,c+=g);var m={x:l,y:c};return Q(t.rotateAngle+t.parentTransform,t.offsetX,t.offsetY,m)}},t.prototype.hasNativeParent=function(t,e){if(t&&t.length>0){var i=t[0];if(i instanceof ne)return i;i.children&&i.children.length&&this.hasNativeParent(i.children,e++||0)}},t.prototype.renderRect=function(t,e,i,r,n){var o=this.getBaseAttributes(t,i,n);o.cornerRadius=t.cornerRadius||0,t.isExport&&(o.cornerRadius*=t.exportScaleValue.x);var a=t.description?t.description:t.id;this.renderer.drawRectangle(e,o,this.diagramId,t.isExport,void 0,r,a,void 0,void 0,this,t)},t.prototype.drawRect=function(t,e){e.cornerRadius=0,this.svgRenderer.drawRectangle(t,e,this.diagramId)},t.prototype.getBaseAttributes=function(t,e,i){var r={width:t.actualSize.width,height:t.actualSize.height,x:t.offsetX-t.actualSize.width*t.pivot.x,y:t.offsetY-t.actualSize.height*t.pivot.y,fill:t.style.fill,stroke:t.style.strokeColor,angle:t.rotateAngle+t.parentTransform,pivotX:t.pivot.x,pivotY:t.pivot.y,strokeWidth:t.style.strokeWidth,dashArray:t.style.strokeDashArray||"",opacity:t.style.opacity,shadow:t.shadow,gradient:t.style.gradient,visible:t.visible,id:t.id,description:t.description,canApplyStyle:t.canApplyStyle,shapeType:t.shapeType};return"Page"===t.rotationReference&&(r.angle=t.rotateAngle),i&&(r.x=r.x-.5,r.y=r.y-.5),t.isExport&&(r.width*=t.exportScaleValue.x,r.height*=t.exportScaleValue.y,r.x*=t.exportScaleValue.x,r.y*=t.exportScaleValue.y,r.strokeWidth*=t.exportScaleValue.x),t.flip?(r.flip=t.flip,t.flip!==tt.Horizontal&&t.flip!==tt.Vertical||!(t instanceof Jt||t.isRectElement)||this.isSvgMode||(r.isImage=!0)):r.flip=tt.None,t.flipMode&&(r.flipMode=t.flipMode),e&&(r.x+=e.tx,r.y+=e.ty),r},t.renderSvgBackGroundImage=function(t,e,i,r,n,o){if(t.source){var a=ld(e.id).getElementById(e.id+"_image");if(!a){var s=function(t){var e=id(t),i=e.getElementsByClassName("e-background-image-layer");return i[0]}(e.id);(a=document.createElementNS("http://www.w3.org/2000/svg","image")).setAttribute("id",e.id+"_image"),s.appendChild(a)}var h=new Image;h.src=t.source,a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.src.toString());var d="None"!==t.scale?t.scale:"",l=t.align,c=l.charAt(0).toLowerCase()+l.slice(1);d&&(c+=" "+d.charAt(0).toLowerCase()+d.slice(1)),wd(a,{id:e.id+"_image",x:i,y:r,width:n,height:o,preserveAspectRatio:c})}},t.prototype.transformLayers=function(t,e){var i=t.tx*t.scale,r=t.ty*t.scale,n="domTable";if(i!==this.transform.x||r!==this.transform.y||0===i||0===r){if(e)window[""+n][this.diagramId+"_diagramLayer"]||(window[""+n][this.diagramId+"_diagramLayer"]=this.diagramSvgLayer.getElementById(this.diagramId+"_diagramLayer")),window[""+n][this.diagramId+"_diagramLayer"].setAttribute("transform","translate("+t.tx*t.scale+","+t.ty*t.scale+"),scale("+t.scale+")");var o=function(t){var e="domTable",i=null;if(window[e][t+"_gridline"])i=window[e][t+"_gridline"];else{i=dd(t).getElementById(t+"_gridline"),window[e][t+"_gridline"]=i}return i}(this.diagramId);return o.setAttribute("transform","translate("+t.tx*t.scale+","+t.ty*t.scale+")"),window[""+n][this.diagramId+"_diagramPorts"]||(window[""+n][this.diagramId+"_diagramPorts"]=this.iconSvgLayer.getElementById(this.diagramId+"_diagramPorts")),window[""+n][this.diagramId+"_diagramPorts"].setAttribute("transform","translate("+t.tx*t.scale+","+t.ty*t.scale+"),scale("+t.scale+")"),window[""+n][this.diagramId+"_diagramExpander"]||(window[""+n][this.diagramId+"_diagramExpander"]=this.iconSvgLayer.getElementById(this.diagramId+"_diagramExpander")),window[""+n][this.diagramId+"_diagramExpander"].setAttribute("transform","translate("+t.tx*t.scale+","+t.ty*t.scale+"),scale("+t.scale+")"),window[""+n][this.diagramId+"_nativeLayer"]||(window[""+n][this.diagramId+"_nativeLayer"]=this.nativeSvgLayer.getElementById(this.diagramId+"_nativeLayer")),window[""+n][this.diagramId+"_nativeLayer"].setAttribute("transform","translate("+t.tx*t.scale+","+t.ty*t.scale+"),scale("+t.scale+")"),gd(this.diagramId).children[0].style.transform="translate("+t.tx*t.scale+"px,"+t.ty*t.scale+"px)scale("+t.scale+")",this.transform={x:t.tx*t.scale,y:t.ty*t.scale},!0}return!1},t.prototype.updateNode=function(t,e,i,r,n,o,a){this.renderElement(t,e,i,r,this.getParentSvg(t),void 0,void 0,n,null,o,a)},t}(),Zo=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),qo=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Qo=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.mode="Canvas",r.id="overview",r.actionName="",r.startPoint=null,r.currentPoint=null,r.prevPoint=null,r.scale=null,r.inAction=!1,r.viewPortRatio=1,r.horizontalOffset=0,r.verticalOffset=0,r.model={},r.event=!0,r.overviewid=88123,r.prevTransform="",r.model={width:r.width,height:r.height},r}return Zo(r,t),r.prototype.onPropertyChanged=function(t,e){for(var i=0,r=Object.keys(t);i<r.length;i++){switch(r[i]){case"sourceID":this.setParent(t.sourceID);break;case"width":case"height":this.renderCanvas(),this.setParent(this.sourceID)}}},r.prototype.getPersistData=function(){return this.addOnPersist(["loaded"])},r.prototype.preRender=function(){if(""===this.element.id){var t=document.getElementsByClassName("e-overview").length;this.element.id="overview_"+this.overviewid+"_"+t}this.id=this.element.id?this.element.id:this.id,this.element.style.background="transparent",this.unWireEvents(),this.wireEvents(),this.element.classList.add("e-overview")},r.prototype.render=function(){this.diagramRenderer=new Go(this.element.id,new Uo,!1),this.renderCanvas(),this.setParent(this.sourceID),this.renderComplete()},r.prototype.getSizeValue=function(t){return t.toString().indexOf("px")>0||t.toString().indexOf("%")>0?t.toString():t.toString()+"px"},r.prototype.renderCanvas=function(t){var e=document.getElementById(this.element.id+"_canvas");e||(e=ud("div",{}),this.element.appendChild(e)),Id(e,{id:this.element.id+"_canvas",class:"drawing",style:"position:relative; height:"+this.getSizeValue(this.model.height)+"; width:"+this.getSizeValue(this.model.width)+";style:-ms-touch-action: none;touch-action: none;"}),this.element.setAttribute("tabindex",String(-1)),this.element.style.overflow="hidden",this.element.style.height=String(this.model.height),this.element.style.width=String(this.model.width),this.canvas=e},r.prototype.setParent=function(t){var e=document.getElementById(t);if(this.parent){var i=this.parent;this.parent=null,i.setOverview(null,this.element.id),this.removeDocument(this)}this.parent=this.getDiagram(e,"ej2_instances"),this.parent&&this.parent.setOverview(this)},r.prototype.getDiagram=function(t,e){for(var i,r=t[""+e].length,n=0;n<r;n++)if(yd(t[""+e][parseInt(n.toString(),10)].element,"e-diagram")){i=t[""+e][parseInt(n.toString(),10)];break}return i},r.prototype.unWireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchMoveEvent,r=e.Browser.isPointer?"pointerleave":"mouseleave",n=e.Browser.touchEndEvent;e.EventHandler.remove(this.element,t,this.mouseDown),e.EventHandler.remove(this.element,i,this.mouseMove),e.EventHandler.remove(this.element,n,this.mouseUp),e.EventHandler.remove(this.element,r,this.documentMouseUp),e.EventHandler.remove(window,"resize",this.windowResize);var o=document.getElementById(this.sourceID+"content");o&&e.EventHandler.remove(o,"scroll",this.scrolled)},r.prototype.wireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchEndEvent,r=e.Browser.touchMoveEvent,n=e.Browser.isPointer?"pointerleave":"mouseleave";e.EventHandler.add(this.element,t,this.mouseDown,this),e.EventHandler.add(this.element,r,this.mouseMove,this),e.EventHandler.add(this.element,i,this.mouseUp,this),e.EventHandler.add(this.element,n,this.documentMouseUp,this),e.EventHandler.add(window,"resize",this.windowResize,this);var o=document.getElementById(this.sourceID+"content");o&&e.EventHandler.add(o,"scroll",this.scrolled,this)},r.prototype.initializeOverviewLayers=function(){this.htmlLayer=document.getElementById(this.element.id+"_htmlLayer"),this.overviewLayer=document.getElementById(this.element.id+"_overviewlayer"),this.diagramCanvas=document.getElementById(this.element.id+"_diagramLayer"),this.nativeLayer=pd(this.element.id),this.context2d=this.diagramCanvas.getContext("2d")},r.prototype.renderDocument=function(t){t.canvas=this.canvas;var e=document.getElementById(this.canvas.id+"_svg");e&&e.parentNode.removeChild(e);var i=fd("svg",{id:this.canvas.id+"_svg",version:"1.1",class:"overview_svg"});this.svg=i,t.svg=i,t.canvas.appendChild(i);var r=document.getElementById(this.element.id),n=r.clientWidth||r.offsetWidth,o=r.clientHeight||r.offsetHeight,a=r.getBoundingClientRect(),s=window.screenX<0?-1*window.screenX:window.screenX,h=window.screenY<0?-1*window.screenY:window.screenY;if(0===n){var d=Math.floor(window.innerWidth-s-Math.floor(a.left));n=d>0?d:Math.floor(window.innerWidth)}if(0===o){var l=Math.floor(window.innerHeight-h-Math.floor(a.top));o=l>0?l:Math.floor(window.innerHeight)}n>0&&(i.setAttribute("width",String(n)),this.model.height=o),o>0&&(i.setAttribute("height",String(o)),this.model.width=n),t.diagramLayerDiv||(t.diagramLayerDiv=ud("div",{}),t.diagramLayer=Md.createCanvas(this.element.id+"_diagramLayer",this.model.width,this.model.height),t.diagramLayer.style.position="absolute",t.diagramLayer.style.left="0px",t.diagramLayer.style.top="0px",t.diagramLayerDiv.appendChild(t.diagramLayer),t.canvas.appendChild(t.diagramLayerDiv));var c={id:this.element.id+"_diagramLayer_div",style:"width:"+this.model.width+"px; height:"+this.model.height+"px;position:absolute;top:0px;left:0px"};Id(t.diagramLayerDiv,c),this.renderHtmlLayer(t.canvas),this.renderNativeLayer(t.canvas,t),this.addOverviewRectPanel(t)},r.prototype.removeDocument=function(t){var e=document.getElementById(this.canvas.id+"_svg");this.canvas.removeChild(e);var i=document.getElementById(this.element.id+"_htmlLayer");this.canvas.removeChild(i);var r=document.getElementById(this.element.id+"_diagramLayer_div");this.canvas.removeChild(r),t.diagramLayerDiv=null,t.diagramLayer=null;window.domTable[this.id+"html_layer"]=null},r.prototype.renderHtmlLayer=function(t){var e=ud("div",{id:this.element.id+"_htmlLayer",class:"e-html-layer",style:"pointer-events:none;position:absolute;top:0px;left:0px;"}),i=ud("div",{id:this.element.id+"_htmlLayer_div",style:"position:absolute;top:0px;left:0px;"});return e.appendChild(i),t.appendChild(e),e},r.prototype.renderNativeLayer=function(t,e){if(!document.getElementById(this.element.id+"_nativeLayer_svg")){var i=this.parent.createSvg(this.element.id+"_nativeLayer_svg",this.model.width,this.model.height),r=fd("g",{id:this.element.id+"_nativeLayer"});i.appendChild(r),e.diagramLayerDiv.appendChild(i),wd(i,{class:"e-native-layer"})}},r.prototype.addOverviewRectPanel=function(t){var e=document.getElementById(this.canvas.id+"_overviewsvg");e&&e.parentNode.removeChild(e),e=fd("svg",{id:this.canvas.id+"_overviewsvg",class:"overviewsvg",version:"1.1",style:"position:absolute;left:0px;top:0px; aria-label:Specifies overview",width:this.model.width,height:this.model.height}),t.canvas.appendChild(e);var i=fd("g",{id:this.element.id+"_overviewlayer",style:"pointer-events:none"});e.appendChild(i);var r=fd("rect",{fill:"transparent",width:"100%",height:"100%",class:"overviewbackrect",id:this.canvas.id+"overviewbackrect"});r.style.pointerEvents="none",i.appendChild(r);var n=fd("g",{id:this.canvas.id+"overviewhandle",style:"pointer-events:all"});i.appendChild(n);var o=fd("rect",{id:this.canvas.id+"overviewrect",fill:"transparent"});n.appendChild(o),this.renderOverviewCorner("left",n),this.renderOverviewCorner("right",n),this.renderOverviewCorner("top",n),this.renderOverviewCorner("bottom",n),this.renderOverviewCorner("topleft",n),this.renderOverviewCorner("topright",n),this.renderOverviewCorner("bottomleft",n),this.renderOverviewCorner("bottomright",n)},r.prototype.renderOverviewCorner=function(t,e){this.svg;var i,r=fd(i="top"===t||"bottom"===t||"right"===t||"left"===t?"rect":"circle",{id:this.canvas.id+"visible"+t,class:"overview-resizer"});e.appendChild(r);var n=fd(i,{id:this.canvas.id+t,class:"overviewresizer",fill:"transparent"});e.appendChild(n)},r.prototype.updateOverviewRectangle=function(){var t=this.currentPoint.x-this.prevPoint.x,e=this.currentPoint.y-this.prevPoint.y,r=new i;r.width=0,r.height=0;var n=0,o=0;switch(this.resizeDirection){case"left":r.width-=t,r.height-=t/this.viewPortRatio,n=t,o=t/this.viewPortRatio,o/=2;break;case"right":r.width+=t,r.height+=t/this.viewPortRatio,o=t/this.viewPortRatio,o/=-2;break;case"top":r.height-=e,r.width-=e*this.viewPortRatio,o=e,n=e*this.viewPortRatio,n/=2;break;case"bottom":r.height+=e,r.width+=e*this.viewPortRatio,n=e*this.viewPortRatio,n/=-2;break;case"topleft":Math.abs(e)>Math.abs(t)?t=e*this.viewPortRatio:e=t/this.viewPortRatio,r.width-=t,r.height-=e,n=t,o=e;break;case"topright":Math.abs(e)>Math.abs(t)?t=-e*this.viewPortRatio:e=-t/this.viewPortRatio,o=e,r.width+=t,r.height-=e;break;case"bottomleft":Math.abs(e)>Math.abs(t)?t=-e*this.viewPortRatio:e=-t/this.viewPortRatio,n=t,r.width-=t,r.height+=e;break;case"bottomright":Math.abs(e)>Math.abs(t)?t=e*this.viewPortRatio:e=t/this.viewPortRatio,r.width+=t,r.height+=e}this.updateHelper(n,o,r,undefined,undefined)},r.prototype.updateHelper=function(t,e,i,r,n){var o,a,s,h=this.element.id+"_canvas_overviewsvg",d=document.getElementById(h).getElementById("helper");if(i)o=(s=d.getBBox()).x+t,a=s.y+e,r=s.width+i.width,n=s.height+i.height;else{var l,c;l=this.currentPoint.x>this.startPoint.x?this.currentPoint.x-this.prevPoint.x:this.prevPoint.x-this.currentPoint.x,c=this.currentPoint.y>this.startPoint.y?this.currentPoint.y-this.prevPoint.y:this.prevPoint.y-this.currentPoint.y;Math.abs(c)>Math.abs(l)?(l=this.viewPortRatio*c,!1):(c=l/this.viewPortRatio,!1),s=d.getBBox(),o=this.startPoint.x>this.currentPoint.x?s.x-l:s.x,a=this.startPoint.y>this.currentPoint.y?s.y-c:s.y,r=s.width+l,n=s.height+c}wd(this.helper,{id:this.helper.id,x:o,y:a,width:Math.max(0,r),height:Math.max(0,n)})},r.prototype.updateOverviewrect=function(t,e,i,r){Id(document.getElementById(this.canvas.id+"overviewrect"),{x:t,y:e,width:Math.max(1,i),height:Math.max(1,r)}),this.updateOverviewCorner("top",t+8,e+1,Math.max(0,i-16),2),this.updateOverviewCorner("bottom",t+8,e+r+3,Math.max(0,i-16),2),this.updateOverviewCorner("left",t-2,e+11,2,Math.max(0,r-16)),this.updateOverviewCorner("right",t+i,e+11,2,Math.max(0,r-16)),this.updateOverviewCorner("topleft",t,e+3,5,5),this.updateOverviewCorner("topright",t+i,e+3,5,5),this.updateOverviewCorner("bottomleft",t,e+r+3,5,5),this.updateOverviewCorner("bottomright",t+i,e+r+3,5,5)},r.prototype.updateOverviewCorner=function(t,e,i,r,n){var o,a,s="visible"+t;"top"===t||"bottom"===t||"right"===t||"left"===t?(o={x:e,y:i,width:r,height:n,fill:"#ED1C24"},a={x:e-2,y:i-2,width:2===r?4:r,height:2===n?4:n}):(o={cx:e,cy:i,r:4,fill:"#ED1C24"},a={cx:e,cy:i,r:6,fill:"transparent"}),Id(document.getElementById(this.canvas.id+s),o),Id(document.getElementById(this.canvas.id+t),a)},r.prototype.translateOverviewRectangle=function(){Number(this.model.width),Number(this.model.height);var t=this.currentPoint.x-this.prevPoint.x,e=this.currentPoint.y-this.prevPoint.y,i=this.element.getElementsByClassName("overviewsvg")[0].getElementById(this.canvas.id+"overviewrect").getBBox(),r=i.x+t,n=i.y+e,o=i.width,a=i.height;this.updateOverviewrect(r,n,o,a),this.updateParentView(this.parent.scroller.currentZoom,r,n,o,a,null)},r.prototype.renderOverviewRect=function(t,e,i,r){var n=Number(this.model.width),o=Number(this.model.height),a=i/n*this.contentWidth,s=r/o*this.contentHeight,h=Math.max(this.parent.scroller.viewPortWidth/a,this.parent.scroller.viewPortHeight/s);if(h>=.25&&h<=30){this.updateParentView(h,t,e,i,r,{x:0,y:0});var d=this.scrollOverviewRect(this.parent.scroller.horizontalOffset,this.parent.scroller.verticalOffset,this.parent.scroller.currentZoom,!0);if(this.helper){var l=this.element.getElementsByTagName("rect")[10].getBBox();d.x=l.x,d.y=l.y}"pan"===this.actionName?this.updateOverviewrect(-d.x,-d.y,d.width,d.height):this.updateOverviewrect(d.x,d.y,d.width,d.height)}},r.prototype.scrollOverviewRect=function(t,e,i,r){if(!this.actionName||r){var n=Number(this.model.width),o=Number(this.model.height),a=Math.min(this.contentWidth/n,this.contentHeight/o),s=new w,h=s.x=t/i/a,d=s.y=e/i/a,l=0;this.parent.rulerSettings.showRulers&&(l=25);var c=document.getElementById(this.parent.element.id+"content"),p=0,g=0;c&&(p=c.offsetWidth-c.clientWidth,g=c.offsetHeight-c.clientHeight);var u=s.width=(this.parent.scroller.viewPortWidth-l-p)/i/a,f=s.height=(this.parent.scroller.viewPortHeight-l-g)/i/a;if(r){var m=new w;return m.x=h,m.y=d,m.width=u,m.height=f,m}this.updateOverviewrect(-h,-d,u,f)}return null},r.prototype.updateParentView=function(t,i,r,n,o,a){var s,h,d=Number(this.model.width),l=Number(this.model.height),c=i*(this.contentWidth/d)*t,p=r*(this.contentHeight/l)*t;this.parent.scroller.getPageBounds();1===t&&"pan"!==this.actionName||(s=-c-this.parent.scroller.horizontalOffset,h=-p-this.parent.scroller.verticalOffset),this.parent.setBlazorDiagramProps(!0),this.parent.realActions|=bt.OverViewAction;"scale"===this.actionName||"draw"===this.actionName?this.parent.scroller.zoom(t/this.parent.scroller.currentZoom,s,h,a):(0,e.isBlazor)()?this.parent.scroller.zoom(1,s,h,a):this.parent.pan(s,h,a,!0)},r.prototype.updateHtmlLayer=function(t){var e=gd(t.element.id),i=this.parent.scroller.getPageBounds(!0),r=i.width,n=i.height,o=Math.max(r,this.parent.scroller.viewPortWidth),a=Math.max(n,this.parent.scroller.viewPortHeight/this.parent.scroller.currentZoom),s=Math.min(Number(this.model.width)/o,Number(this.model.height)/a);e.style.transform="scale("+s+") translate("+this.parent.scroller.transform.tx+"px,"+this.parent.scroller.transform.ty+"px)"},r.prototype.updateView=function(t){var e=this.parent.scroller.getPageBounds(),i=e.width,r=e.height,n=Number(this.model.width),o=Number(this.model.height),a=Math.max(i,this.parent.scroller.viewPortWidth),s=Math.max(r,this.parent.scroller.viewPortHeight);this.contentWidth=a=Math.max(a,n/o*s),this.contentHeight=s=Math.max(s,o/n*a);var h=Math.min(n/a,o/s),d="scale("+h+") translate("+-e.x+"px, "+-e.y+"px)";d===this.prevTransform&&this.htmlLayer.style.transform||(this.htmlLayer.style.transform=d,this.htmlLayer.style.webkitTransform=d,this.prevTransform=d),this.overviewLayer.setAttribute("transform","translate("+-e.x*h+","+-e.y*h+")"),this.horizontalOffset=e.x*h,this.verticalOffset=e.y*h;var l=Number(this.model.width)/this.contentWidth,c=Number(this.model.height)/this.contentHeight;l=Math.min(l,c);var p=this.parent.scroller.transform,g=p.tx,u=p.ty;this.nativeLayer.setAttribute("transform","translate("+g*l+","+u*c+"),scale("+l+")"),this.context2d.setTransform(l,0,0,l,0,0),this.context2d.fillStyle="red",this.scrollOverviewRect(this.parent.scroller.horizontalOffset,this.parent.scroller.verticalOffset,this.parent.scroller.currentZoom)},r.prototype.scrolled=function(t){if(this.event){var e=this.scrollOverviewRect(this.parent.scroller.horizontalOffset,this.parent.scroller.verticalOffset,this.parent.scroller.currentZoom,!0);this.updateOverviewrect(-e.x,-e.y,e.width,e.height),this.updateView(this)}},r.prototype.updateCursor=function(t){if(yd(t.target,"overviewresizer"))switch(t.target.id){case this.canvas.id+"left":this.canvas.style.cursor="w-resize";break;case this.canvas.id+"right":this.canvas.style.cursor="e-resize";break;case this.canvas.id+"top":this.canvas.style.cursor="n-resize";break;case this.canvas.id+"bottom":this.canvas.style.cursor="s-resize";break;case this.canvas.id+"topleft":this.canvas.style.cursor="nw-resize";break;case this.canvas.id+"topright":this.canvas.style.cursor="ne-resize";break;case this.canvas.id+"bottomleft":this.canvas.style.cursor="sw-resize";break;case this.canvas.id+"bottomright":this.canvas.style.cursor="se-resize"}else this.canvas.style.cursor="default"},r.prototype.mouseMove=function(t){if(this.event=!1,this.updateCursor(t),this.currentPoint=this.mousePosition(t),this.actionName)switch(this.actionName){case"draw":this.inAction||this.startPoint.x===this.currentPoint.x&&this.startPoint.y===this.currentPoint.y||(this.initHelper(),this.inAction=!0),this.inAction&&this.updateHelper();break;case"scale":this.inAction||(this.initHelper(),this.inAction=!0),this.updateOverviewRectangle();break;case"pan":(this.startPoint.x!==this.currentPoint.x||this.startPoint.y===this.currentPoint.y||this.inAction)&&(this.inAction=!0,this.translateOverviewRectangle())}this.prevPoint=this.currentPoint},r.prototype.documentMouseUp=function(t){this.inAction=!1,this.actionName="",this.helper&&(this.helper.parentNode.removeChild(this.helper),this.helper=null),this.event=!0,document.getElementById(this.canvas.id+"overviewhandle").style.pointerEvents="all"},r.prototype.windowResize=function(t){var e=this;return this.resizeTo&&clearTimeout(this.resizeTo),this.resizeTo=setTimeout(function(){var t=document.getElementById(e.element.id).getBoundingClientRect();e.model.width=t.width>0?t.width:e.model.width,e.model.height=t.height>0?t.height:e.model.height,e.renderCanvas(),e.setParent(e.sourceID)},10),!1},r.prototype.mouseDown=function(t){if(t.target.id===this.canvas.id+"_overviewsvg"&&(this.actionName="draw"),t.target.id===this.canvas.id+"overviewrect"&&(this.actionName="pan"),yd(t.target,"overviewresizer"))switch(this.actionName="scale",t.target.id){case this.canvas.id+"left":this.resizeDirection="left";break;case this.canvas.id+"right":this.resizeDirection="right";break;case this.canvas.id+"top":this.resizeDirection="top";break;case this.canvas.id+"bottom":this.resizeDirection="bottom";break;case this.canvas.id+"topleft":this.resizeDirection="topleft";break;case this.canvas.id+"topright":this.resizeDirection="topright";break;case this.canvas.id+"bottomleft":this.resizeDirection="bottomleft";break;case this.canvas.id+"bottomright":this.resizeDirection="bottomright"}this.startPoint=this.prevPoint=this.mousePosition(t),this.viewPortRatio=this.parent.scroller.viewPortWidth/this.parent.scroller.viewPortHeight,document.getElementById(this.canvas.id+"overviewhandle").style.pointerEvents="none"},r.prototype.mouseUp=function(t){if(this.currentPoint=this.mousePosition(t),this.actionName)if(this.startPoint.x!==this.currentPoint.x||this.startPoint.y!==this.currentPoint.y){if("pan"===this.actionName);else if(this.helper){var e=this.element.getElementsByTagName("rect")[10].getBBox();this.resizeDirection=this.resizeDirection||"";var i=e.x,r=e.y,n=e.width,o=e.height;"topleft"===this.resizeDirection||"topright"===this.resizeDirection||"bottomleft"===this.resizeDirection||this.resizeDirection;this.renderOverviewRect(i,r,n,o)}}else if(t.target.id===this.canvas.id+"_overviewsvg"||"helper"===t.target.id){var a=this.element.id+"_canvas_overviewsvg";n=(e=document.getElementById(a).getElementById(this.canvas.id+"overviewrect").getBBox()).width,o=e.height;this.inAction=!0,this.actionName="pan",this.renderOverviewRect(this.currentPoint.x-n/2,this.currentPoint.y-o/2,n,o),this.inAction=!1}this.helper&&(this.helper.parentNode.removeChild(this.helper),this.helper=null),this.actionName="",this.startPoint=null,this.currentPoint=null,this.prevPoint=null,this.helper=null,this.viewPortRatio=1,this.resizeDirection="",this.inAction=!1,this.event=!0,document.getElementById(this.canvas.id+"overviewhandle").style.pointerEvents="all"},r.prototype.initHelper=function(){var t=this.element.id+"_canvas_overviewsvg",e=document.getElementById(t),i=this.startPoint.x,r=this.startPoint.y,n=1,o=1;if("scale"===this.actionName){var a=e.getElementById(this.canvas.id+"overviewrect").getBBox();i=a.x,r=a.y,n=a.width,o=a.height}var s=fd("rect",{id:"helper",x:i,y:r,width:n,height:o,fill:"transparent",stroke:"gray","stroke-dasharray":"2 2","shape-rendering":"crispEdges"});e.getElementById(this.element.id+"_overviewlayer").appendChild(s),this.helper=s},r.prototype.mousePosition=function(t){var e,i,r;if(-1!==t.type.indexOf("touch")){var n=(e=t).changedTouches[0].clientX,o=e.changedTouches[0].clientY;i=n-this.element.offsetLeft,r=o-this.element.offsetTop}else i=t.clientX,r=t.clientY;var a=this.element.getBoundingClientRect();return i-=a.left,r-=a.top,{x:i+this.horizontalOffset,y:r+this.verticalOffset}},r.prototype.destroy=function(){if(this.unWireEvents(),this.notify("destroy",{}),t.prototype.destroy.call(this),document.getElementById(this.element.id)){this.element.classList.remove("e-overview");var e=document.getElementById(this.element.id+"_canvas");e&&this.element.removeChild(e)}this.parent.views.splice(this.parent.views.indexOf(this.element.id),1),this.diagramLayerDiv=null,this.canvas=null,this.parent=null},r.prototype.getModuleName=function(){return"Overview"},qo([(0,e.Property)("100%")],r.prototype,"width",void 0),qo([(0,e.Property)("100%")],r.prototype,"height",void 0),qo([(0,e.Property)("")],r.prototype,"sourceID",void 0),qo([(0,e.Event)()],r.prototype,"created",void 0),r}(e.Component);function Ko(t,e){for(var i=[],r=0;r<e.length;r++){var n=e[parseInt(r.toString(),10)];t.containsRect(n.wrapper.bounds)&&i.push(n)}return i}function Jo(t,e){for(var i=0;i<t.length;i++)if(t[parseInt(i.toString(),10)].id===e)return!0;return!1}function $o(t){var e;return t&&(t.type?e="Connector":t.shape&&!t.type&&(e="Node")),e}function ta(t,e){e instanceof Yh&&(t.shape.header||(e.shape.hasHeader=!1))}function ea(t,e,i,r){return r=e?r:void 0!==t[i-1]?t[i-1]+r:0}function ia(t,e){var i=[];if(e)i=t;else{for(var r=0;r<t.length;r++)i.push(t[parseInt(r.toString(),10)]);i.push(t[i.length-2]),i.push(t[i.length-2])}return i}function ra(t){for(var e=0;e<t.ports.length;e++)t.ports[parseInt(e.toString(),10)].inEdges=[],t.ports[parseInt(e.toString(),10)].outEdges=[];return t}function na(t,e){if(e instanceof Yh)switch(t.shape.shape){case"JoinNode":t.width||(e.width=20),t.height||(e.height=90),t.style&&t.style.fill||(e.style.fill="black");break;case"ForkNode":t.width||(e.width=90),t.height||(e.height=20),t.style&&t.style.fill||(e.style.fill="black");break;case"InitialNode":case"FinalNode":t.style&&t.style.fill||(e.style.fill="black")}else switch(t.shape.flow){case"Object":t.style&&t.style.strokeDashArray||(e.style.strokeDashArray="8 4"),t.style&&t.style.strokeWidth||(e.style.strokeWidth=2),t.targetDecorator&&t.targetDecorator.shape||(e.targetDecorator.shape="OpenArrow");break;case"Control":t.style&&t.style.strokeWidth||(e.style.strokeWidth=2),t.targetDecorator&&t.targetDecorator.shape||(e.targetDecorator.shape="OpenArrow"),t.sourceDecorator&&t.sourceDecorator.shape||(e.sourceDecorator.shape="None")}}function oa(t,e){switch(t.shape.type){case"Bpmn":switch(t.shape.flow){case"Sequence":("Normal"===t.shape.sequence&&"Bezier"!==t.type||"Default"===t.shape.sequence||"Conditional"===t.shape.sequence)&&(e.targetDecorator&&e.targetDecorator.style&&(e.targetDecorator.style.fill=t.targetDecorator&&t.targetDecorator.style&&t.targetDecorator.style.fill||"black"),"Conditional"===t.shape.sequence&&e.sourceDecorator&&(e.sourceDecorator.style&&(e.sourceDecorator.style.fill=t.sourceDecorator&&t.sourceDecorator.style&&t.sourceDecorator.style.fill||"white"),e.sourceDecorator.width=t.sourceDecorator&&t.sourceDecorator.width||20,e.sourceDecorator.height=t.sourceDecorator&&t.sourceDecorator.width||10));break;case"Association":"Default"!==t.shape.association&&"Directional"!==t.shape.association&&"BiDirectional"!==t.shape.association||(e.targetDecorator&&e.targetDecorator.style&&(e.targetDecorator.style.fill=t.targetDecorator&&t.targetDecorator.style&&t.targetDecorator.style.fill||"black"),"BiDirectional"===t.shape.association&&e.sourceDecorator&&e.sourceDecorator.style&&(e.sourceDecorator.style.fill=t.sourceDecorator&&t.sourceDecorator.style&&t.sourceDecorator.style.fill||"white",e.sourceDecorator.width=t.sourceDecorator&&t.sourceDecorator.width||5,e.sourceDecorator.height=t.sourceDecorator&&t.sourceDecorator.height||10));break;case"Message":e.style&&!e.style.strokeDashArray&&(e.style.strokeDashArray=t.style&&t.style.strokeDashArray||"4 4")}break;case"UmlActivity":if("Exception"===t.shape.flow)"Directional"!==t.shape.association&&"BiDirectional"!==t.shape.association||(e.style.strokeDashArray=t.style&&t.style.strokeDashArray||"2 2");break;case"UmlClassifier":var i=!1;"Association"===t.shape.relationship?i=!0:"Inheritance"===t.shape.relationship?(e.targetDecorator&&e.targetDecorator.style&&(e.targetDecorator.style.fill=t.targetDecorator&&t.targetDecorator.style&&t.targetDecorator.style.fill||"white"),e.style&&(i=!0)):"Composition"===t.shape.relationship?(e.sourceDecorator&&e.sourceDecorator.style&&(e.sourceDecorator.style.fill=t.sourceDecorator&&t.sourceDecorator.style&&t.sourceDecorator.style.fill||"black"),i=!0):"Aggregation"===t.shape.relationship||void 0===t.shape.relationship?(e.sourceDecorator&&e.sourceDecorator.style&&(e.sourceDecorator.style.fill=t.sourceDecorator&&t.sourceDecorator.style&&t.sourceDecorator.style.fill||"white"),i=!0):"Dependency"===t.shape.relationship?(e.sourceDecorator&&e.sourceDecorator.style&&(e.sourceDecorator.style.fill=t.sourceDecorator&&t.sourceDecorator.style&&t.sourceDecorator.style.fill||"white"),i=!0,e.style.strokeDashArray="4 4"):"Realization"===t.shape.relationship&&(e.targetDecorator&&e.targetDecorator.style&&(e.targetDecorator.style.fill=t.targetDecorator&&t.targetDecorator.style&&t.targetDecorator.style.fill||"white"),i=!0,e.style.strokeDashArray="4 4"),i&&(e.style.strokeWidth=t.style&&t.style.strokeWidth||2)}}function aa(t,e,i){var r;r=o.findLength(e,t)>o.findLength(i,t)?i:e;var n=o.findAngle(e,i),a=o.findAngle(r,t),s=o.findLength(r,t),h=a+2*(n-a);return{x:r.x+s*Math.cos(h*Math.PI/180),y:r.y+s*Math.sin(h*Math.PI/180)}}function sa(t){var e=t.parentElement;do{if(yd(e,"e-diagram"))return!0;e=e.parentElement}while(e);return!1}function ha(t,e,i){if(t&&t.children&&t.children.length>0)for(var r=void 0,n=0;n<t.children.length;n++)return(r=i[t.children[parseInt(n.toString(),10)]]).shape.type===e||ha(r,e,i);return!1}function da(t,e,i,r,n){if(i&&(t instanceof Co||t&&(t.shape&&"SwimLane"!==t.shape.type||void 0===t.shape)))for(var o=void 0,a=0,s=Object.keys(i);a<s.length;a++){var h=s[a];if(o=i[""+h],"shape"===h&&o.type&&(t.shape={type:o.type}),o)if(Array.isArray(o)&&o.length&&o.length>0&&"annotations"!==n&&"ports"!==n)if(t[""+h].length>0)for(var d=0;d<=t[""+h].length;d++)da(t[""+h],e?e[""+h]:void 0,i[""+h],"annotations"===h||"ports"===h?t:void 0,h);else da(t[""+h],e?e[""+h]:void 0,i[""+h],"annotations"===h||"ports"===h?t:void 0,h);else if(o instanceof Object&&e&&"annotations"!==n&&"ports"!==n)da(t[""+h],e[""+h],i[""+h]);else if("annotations"!==n&&"ports"!==n&&e&&!e[""+h]||!e&&t&&(t[""+h]||void 0!==t[""+h]))t[""+h]=i[""+h];else{var l=void 0;"annotations"!==n&&"ports"!==n||("annotations"===n?(t[""+h]&&da(t[""+h],e[""+h],i[""+h]),t[""+h]||(vs(r)===Co?(l=new Pe(r,"annotations",i[""+h]),r.annotations.push(l)):(l=new Ie(r,"annotations",i[""+h]),r.annotations.push(l)))):t[""+h]?da(t[""+h],e[""+h],i[""+h]):(l=new ye(r,"ports",i[""+h]),r.ports.push(l)))}}}function la(t,e,i,r){var n,o="Role";if(e)for(var a=0,s=Object.keys(e);a<s.length;a++){var h=s[a];if(n=e[""+h],"getAssistantDetails"===h){if(r.data[""+o]===e[""+h].root)for(var d=e[""+h].assistants,l=0;l<d.length;l++)for(var c=0;c<i.length;c++)i[parseInt(c.toString(),10)].data[""+o]===d[parseInt(l.toString(),10)]&&(t.assistants.push(i[parseInt(c.toString(),10)].id),t.children.splice(0,1))}else n&&(t[""+h]=e[""+h])}!t.hasSubTree&&e.canEnableSubTree&&(t.orientation=r.layoutInfo.orientation,t.type=r.layoutInfo.type,r.layoutInfo.offset!==t.offset&&void 0!==r.layoutInfo.offset&&(t.offset=r.layoutInfo.offset)),r.layoutInfo.hasSubTree=t.hasSubTree}function ca(t,e){for(var i="Bezier"===t.type?function(t){var e=[];if("Bezier"===t.type)for(var i=0,r=0;r<t.segments.length;r++)for(var n=t.segments[parseInt(r.toString(),10)],a=o.isEmptyPoint(n.point1)?n.bezierPoint1:n.point1,s=o.isEmptyPoint(n.point2)?n.bezierPoint2:n.point2,h=Number((t.distance(a,n.points[0])+t.distance(s,a)+t.distance(n.points[1],s))/1.5),d=0;d<h-1;d+=10)e[parseInt(i.toString(),10)]=So(0,n.points[0],o.isEmptyPoint(n.point1)?n.bezierPoint1:n.point1,o.isEmptyPoint(n.point2)?n.bezierPoint2:n.point2,n.points[1],d,h),i++;return e}(t):t.intermediatePoints,r=0;r<i.length-1;r++){var n=i[parseInt(r.toString(),10)],a=i[r+1],s=w.toBounds([n,a]);if(s.Inflate(t.hitPadding),s.containsPoint(e)){var h=aa(e,n,a),d=pa({x1:n.x,x2:a.x,y1:n.y,y2:a.y},{x1:e.x,x2:h.x,y1:e.y,y2:h.y});if(d.enabled){var l=o.findLength(e,d.intersectPt);if(Math.abs(l)<t.hitPadding)return!0}else{var c=w.toBounds([e,e]);if(c.Inflate(3),c.containsPoint(n)||c.containsPoint(a))return!0}if(o.equals(e,h))return!0}}if(t.annotations.length>0||t.ports.length>0){var p=t.wrapper.children;for(r=3;r<p.length;r++){if(p[parseInt(r.toString(),10)].bounds.containsPoint(e))return!0}}return!1}function pa(t,e){var i={x:0,y:0},r=t,n=e,o=(n.y2-n.y1)*(r.x2-r.x1)-(n.x2-n.x1)*(r.y2-r.y1),a=(n.x2-n.x1)*(r.y1-n.y1)-(n.y2-n.y1)*(r.x1-n.x1),s=(r.x2-r.x1)*(r.y1-n.y1)-(r.y2-r.y1)*(r.x1-n.x1);if(0===o||(t.x1===e.x1||t.y1===e.y1)&&(t.x2===e.x2||t.y2===e.y2)&&(0===a||0===s)&&o>0)return{enabled:!1,intersectPt:i};var h=a/o,d=s/o;return h>=0&&h<=1&&d>=0&&d<=1?(i.x=r.x1+h*(r.x2-r.x1),i.y=r.y1+h*(r.y2-r.y1),{enabled:!0,intersectPt:i}):{enabled:!1,intersectPt:i}}function ga(t,e,i,r){var n=pa(ua(t.x,t.y,e.x,e.y),ua(i.x,i.y,r.x,r.y));return n.enabled?n.intersectPt:{x:0,y:0}}function ua(t,e,i,r){return{x1:Number(t)||0,y1:Number(e)||0,x2:Number(i)||0,y2:Number(r)||0}}function fa(t,e,i){var r=[];i=i||0;var n={x:e.topLeft.x-i,y:e.topLeft.y},o={x:e.topRight.x+i,y:e.topRight.y},a={x:e.bottomRight.x,y:e.bottomRight.y-i},s={x:e.bottomLeft.x,y:e.bottomLeft.y+i};return r.push(n),r.push(o),r.push(a),r.push(s),r}function ma(t,e,i,r){var n=i instanceof Yh?i.constraints&ht.InheritTooltip:i instanceof Co?i.constraints&at.InheritTooltip:i.constraints&It.InheritTooltip,o=i instanceof Yh?i.constraints&ht.Tooltip:i instanceof Co?i.constraints&at.Tooltip:i.constraints&It.ToolTip,a="Mouse"===(!n&&o?i.tooltip.relativeMode:t.tooltip.relativeMode);"Mouse"===r?a=!0:"Object"===r&&(a=!1);var s=function(t,e,i,r){var n,o={},a=document.getElementById(i.element.id);if(t instanceof Yh||t instanceof Co)n=t.wrapper.bounds;else{var s=i.findObjectsUnderMouse(e),h=i.findObjectUnderMouse(s,"Select",!1);n=i.findElementUnderMouse(h,e,i).bounds}var d=a.getBoundingClientRect();switch(i.tooltipObject.position){case"BottomCenter":o=ya(e,n.bottomCenter,i,r,d.width/2,d.height);break;case"BottomLeft":case"LeftBottom":o=ya(e,n.bottomLeft,i,r,0,d.height);break;case"BottomRight":case"RightBottom":o=ya(e,n.bottomRight,i,r,d.width,d.height);break;case"LeftCenter":o=ya(e,n.middleLeft,i,r,0,d.height/2);break;case"LeftTop":case"TopLeft":o=ya(e,n.topLeft,i,r,0,0);break;case"RightCenter":o=ya(e,n.middleRight,i,r,d.width,d.height/2);break;case"RightTop":case"TopRight":o=ya(e,n.topRight,i,r,d.width,0);break;case"TopCenter":o=ya(e,n.topCenter,i,r,d.width/2,0)}return o}(i,e,t,a),h=Eo(t);return{x:s.x+h.width,y:s.y+h.height}}function ya(t,e,i,r,n,o){var a={},s=i.scroller.transform.scale,h=i.scroller.horizontalOffset,d=i.scroller.verticalOffset;return h=i.modifyClientOffset(h,!0),d=i.modifyClientOffset(d,!0),a.x=(r?t.x:e.x)*s+h-n,a.y=(r?t.y:e.y)*s+d-o,a}function va(t,e){var i=new Qt;return i.data=t.pathData,i.height=t.height>10?t.height-(t.padding.bottom+t.padding.top):t.height,i.width=t.width>10?t.width-(t.padding.left+t.padding.right):t.width,i.visible=t.visibility,i.id=e.id+"_shape",i.inversedAlignment=!1,i.horizontalAlignment="Center",i.verticalAlignment="Center",i.style={fill:t.iconStrokeColor,strokeColor:t.iconStrokeColor,strokeWidth:t.iconStrokeWidth},i.setOffsetWithRespectToBounds(.5,.5,"Fraction"),i.relativeMode="Object",i.description=e.description||"",i}function ba(t,e){var i,r=0,n=0;for(r=0;r<t.length;r++)for(n=r+1;n<t.length;n++){var o=R(t[parseInt(r.toString(),10)].wrapper),a=R(t[parseInt(n.toString(),10)].wrapper);"Top"===e||"Bottom"===e||"BottomToTop"===e||"Middle"===e?o.center.y>a.center.y&&(i=t[parseInt(r.toString(),10)],t[parseInt(r.toString(),10)]=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=i):o.center.x>a.center.x&&(i=t[parseInt(r.toString(),10)],t[parseInt(r.toString(),10)]=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=i)}return t}function Sa(t,e,i){var r=Pa(t,e),n=o.findAngle(t[r.index],t[r.index+1]),a=Ca(e),s=o.transform(r.point,n+45,a);return r.point=s,r.angle=n,r}function wa(t,e,i){var r=xa(t,e),n=o.findAngle(t[r.index],t[r.index+1]),a=Ia(e),s=o.transform(r.point,n+45,a);return r.point=s,r.angle=n,r}function xa(t,e){for(var i,r,n,a,s=0,h=e.offset,d=[],l=0;l<t.length-1;l++)s+=o.distancePoints(t[parseInt(l.toString(),10)],t[l+1]),d.push(s);for(var c=h*s,p=0;p<d.length;p++){if(d[parseInt(p.toString(),10)]>=c)return r=o.findAngle(t[parseInt(p.toString(),10)],t[p+1]),{point:i=o.transform(t[parseInt(p.toString(),10)],r,c-(n||0)),index:a=p};n=d[parseInt(p.toString(),10)]}return{point:i,index:a}}function Ia(t){var e=0;switch(t.alignment){case"Center":case"After":e=0;break;case"Before":e=-0}return e}function Pa(t,e){for(var i,r,n,a,s=0,h=e.offset,d=[],l=0;l<t.length-1;l++)s+=o.distancePoints(t[parseInt(l.toString(),10)],t[l+1]),d.push(s);for(var c=h*s,p=0;p<d.length;p++){if(d[parseInt(p.toString(),10)]>=c)return r=o.findAngle(t[parseInt(p.toString(),10)],t[p+1]),{point:i=o.transform(t[parseInt(p.toString(),10)],r,c-(n||0)),index:a=p};n=d[parseInt(p.toString(),10)]}return{point:i,index:a}}function Ca(t){var e;e=t instanceof Wi?0:void 0===t.content?10:0;var i=0;switch(t.alignment){case"Center":i=0;break;case"Before":i=-(0+e);break;case"After":i=0+e}return i}function Ta(t,i,r){i%=360;var n,o,a=225;switch(t.alignment){case"Before":i>=45&&i<=135?(o="right",n=.5===t.offset?"center":"top"):i>=a&&i<=315?(o="left",n=.5===t.offset?"center":"bottom"):i>45&&i<a?(n="top",o=.5===t.offset?"center":"right"):(n="bottom",o=.5===t.offset?"center":"left");break;case"After":i>=45&&i<=135?(o="left",n=.5===t.offset?"center":"top"):i>=a&&i<=315?(o="right",n=.5===t.offset?"center":"bottom"):i>45&&i<a?(n="bottom",o=.5===t.offset?"center":"right"):(n="top",o=.5===t.offset?"center":"left");break;case"Center":o=(0,e.isNullOrUndefined)(t.horizontalAlignment)?"center":t.horizontalAlignment.toLowerCase(),n=(0,e.isNullOrUndefined)(t.verticalAlignment)?"center":t.verticalAlignment.toLowerCase()}if(0===t.offset||1===t.offset)switch(Aa(r[0],r[1])){case"left":o=0===t.offset?"right":"left";break;case"right":o=0===t.offset?"left":"right";break;case"bottom":n=0===t.offset?"top":"bottom";break;case"top":n=0===t.offset?"bottom":"top"}return{hAlign:o,vAlign:n}}function Aa(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?t.x<e.x?"right":"left":t.y<e.y?"bottom":"top"}function Oa(t,e){if(t instanceof Yh&&t.children)for(var i=0;i<t.children.length;i++)e.nameTable[t.children[parseInt(i.toString(),10)]].children&&Oa(t,e),e.removeFromAQuad(e.nameTable[t.children[parseInt(i.toString(),10)]]),e.removeObjectsFromLayer(e.nameTable[t.children[parseInt(i.toString(),10)]]),delete e.nameTable[t.children[parseInt(i.toString(),10)]]}function Da(t,e){if(t&&t.children&&t.children.length>0)for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)];r instanceof te&&Da(r,e)}return-1===e.indexOf(t.id)&&e.push(t.id),e}function Ma(t){for(var e,i,r=[],n=0;n<t.length;n++)if("SwimLane"===(e=t[parseInt(n.toString(),10)]).shape.type){i=e.wrapper.children[0].childTable;for(var o=0,a=Object.keys(i);o<a.length;o++){r=Da(i[""+a[o]],r)}}return r}function La(t,e){var i=e.nodes;if(i)for(var r=0;r<i.length;r++)-1!==t.indexOf(i[parseInt(r.toString(),10)].id)&&(i.splice(r,1),r--)}function Ea(t){var e=Ma(t.nodes),i=N(t,t.getCustomProperty);return i.isScrollOffsetInverted=t.isScrollOffsetInverted,i.selectedItems.nodes=[],i.selectedItems.connectors=[],i.selectedItems.wrapper=null,t.serializationSettings.preventDefaults&&(i=za(i,t)),t.nodes.forEach(function(r){if("SwimLane"===r.shape.type){var n=t.commandHandler.findProcesses(r);n.forEach(function(t){i.nodes.forEach(function(e){if(e.id===t){var i=e.wrapper;e.offsetX=i.offsetX,e.offsetY=i.offsetY}})}),n.length>0&&(e=e.filter(function(t){return!n.includes(t)}))}}),La(e,i),JSON.stringify(i)}function za(t,e,i,r){i=function(t,e){var i,r=[],n="getClassName";if(t[n]){var a=new sc;switch(t[n]()){case"Diagram":i=a;break;case"Node":i=new Yh(a,"",r);break;case"Path":i=new uh(a,"",r);break;case"Native":i=new fh(a,"",r);break;case"Html":i=new mh(a,"",r);break;case"Image":i=new yh(a,"",r);break;case"Text":i=new vh(a,"",r);break;case"BasicShape":i=new bh(a,"",r);break;case"FlowShape":i=new Sh(a,"",r);break;case"BpmnShape":i=new Lh(a,"",r);break;case"UmlActivityShape":i=new Eh(a,"",r);break;case"UmlClassifierShape":i=new Wh(a,"",r);break;case"SwimLane":i=new Uh(a,"",r),t.header&&(i.header=new Fh(a,"",r),i.header.style.fill="");break;case"ShapeAnnotation":i=new Ie(a,"",r);break;case"PointPort":i=new ye(a,"",r);break;case"BpmnGateway":i=new wh(a,"",r);break;case"BpmnDataObject":i=new xh(a,"",r);break;case"BpmnEvent":i=new Ph(a,"",r);break;case"BpmnSubEvent":i=new Ch(a,"",r);break;case"BpmnActivity":i=new Oh(a,"",r);break;case"BpmnAnnotation":i=new Dh(a,"",r);break;case"MethodArguments":i=new zh(a,"",r);break;case"UmlClassAttribute":i=new kh(a,"",r);break;case"UmlClassMethod":i=new Bh(a,"",r);break;case"UmlClass":i=new Rh(a,"",r);break;case"UmlInterface":i=new Nh(a,"",r);break;case"UmlEnumerationMember":i=new jh(a,"",r);break;case"UmlEnumeration":i=new Hh(a,"",r);break;case"Lane":i=new Xh(a,"",r);break;case"Phase":i=new Vh(a,"",r);break;case"ChildContainer":i=new Zh;break;case"Connector":i=new Co(a,"",r);break;case"StraightSegment":i=new po(a,"",r);break;case"BezierSegment":i=new go(a,"",r);break;case"OrthogonalSegment":i=new uo(a,"",r);break;case"PathAnnotation":i=new Pe(a,"",r);break;case"Stop":i=new Mt(a,"",r);break;case"Point":i=e||new o(a,"",r);break;case"UserHandle":i=new No(a,"",r);break;case"Command":i=new Fo(a,"",r)}}else i=e;return parent=void 0,e=void 0,i}(e,i);for(var n=[],a=0,s=n=n.concat(Object.keys(t));a<s.length;a++){var h=s[a];e instanceof Yh&&(r="shape"===h),t[""+h]instanceof Array?ka(t,i,e,h):t[""+h]instanceof Object&&i&&i[""+h]?"wrapper"!==h&&(t[""+h]=za(t[""+h],e[""+h],i[""+h],r)):(i&&t[""+h]===i[""+h]||void 0===t[""+h])&&(r&&"type"===h||e instanceof Uh&&"orientation"===h||e instanceof Ie&&"content"===h||delete t[""+h]),"[]"!==JSON.stringify(t[""+h])&&"{}"!==JSON.stringify(t[""+h])&&void 0!==t[""+h]||delete t[""+h]}return i=void 0,n=void 0,t}function ka(t,e,i,r){if(0===t[""+r].length)delete t[""+r];else if(t[r].every(function(t){return"number"==typeof t})){var n=void 0,o=!0;for(n=0;n<t[""+r].length;n++)o=!(!o||t[""+r][parseInt(n.toString(),10)]!==e[""+r][parseInt(n.toString(),10)]);o&&delete t[""+r]}else{n=void 0;if(t[""+r]&&"layers"!==r)for(n=t[""+r].length-1;n>=0;n--)"nodes"!==r&&"connectors"!==r||(t[""+r][parseInt(n.toString(),10)].wrapper=null),"dataManager"!==r&&(t[""+r][parseInt(n.toString(),10)]=za(t[""+r][parseInt(n.toString(),10)],i[""+r][parseInt(n.toString(),10)],void 0!==e[""+r]?e[""+r][parseInt(n.toString(),10)]:[]),"[]"!==JSON.stringify(t[""+r][parseInt(n.toString(),10)])&&"{}"!==JSON.stringify(t[""+r][parseInt(n.toString(),10)])&&void 0!==t[""+r][parseInt(n.toString(),10)]||t[""+r].splice(n,1))}t=void 0}function Ba(t,e){e.enableServerDataBinding(!1);var i=e.blazorActions;e.blazorActions=e.addConstraints(i,$.ClearObject),e.clear(),e.blazorActions=e.removeConstraints(i,$.ClearObject),e.protectPropertyChange(!0);for(var r=e.dataSourceSettings.doBinding,n=e.setNodeTemplate,o=e.getDescription,a=e.getCustomProperty,s={},h=0,d=e.commandManager.commands;h<d.length;h++){var l=d[h];s[l.name]={execute:l.execute,canExecute:l.canExecute}}var c,p=e.rulerSettings.horizontalRuler.arrangeTick,g=e.rulerSettings.verticalRuler.arrangeTick,u=e.layout.getLayoutInfo,f=e.layout.getBranch,m=e.getNodeDefaults,y=e.getConnectorDefaults;c=Na(c=t instanceof Object?t:JSON.parse(t)),e.contextMenuSettings=c.contextMenuSettings||{},e.constraints=c.constraints||ct.Default,e.tool=c.tool||pt.Default,e.bridgeDirection=c.bridgeDirection||"Top",e.pageSettings=c.pageSettings||{},e.drawingObject=c.drawingObject||void 0,e.tooltip=c.tooltip||{},e.addInfo=c.addInfo||void 0,e.getDescription=o,e.scrollSettings=c.scrollSettings||{},c.isScrollOffsetInverted&&ja(e),e.commandManager=c.commandManager||{},c.layers&&c.layers.length>0&&function(t){var e,i,r,n=[];for(e=0;e<t.layers.length;e++){for(i=0;i<t.layers[e].objects.length;i++)if(t.nodes)for(r=0;r<t.nodes.length;r++)t.layers[e].objects[i]===t.nodes[r].id&&n.push(t.layers[e].objects[i]);for(i=0;i<t.layers[e].objects.length;i++)if(t.connectors)for(r=0;r<t.connectors.length;r++)t.layers[e].objects[i]===t.connectors[r].id&&n.push(t.layers[e].objects[i]);t.layers[e].objects=n,n=[]}}(c),e.layers=c.layers||[],e.rulerSettings.horizontalRuler.arrangeTick=p,e.rulerSettings.verticalRuler.arrangeTick=g;for(var v=0,b=e.commandManager.commands;v<b.length;v++){var S=b[v];s[S.name]&&(S.execute=s[S.name].execute,S.canExecute=s[S.name].canExecute)}if(e.backgroundColor=c.backgroundColor||"transparent",e.basicElements=c.basicElements||[],c.connectors)for(var w=0;w<c.connectors.length;w++)"Bezier"===c.connectors[w].type&&c.connectors[w].segments&&c.connectors[w].segments.length>0&&c.connectors[w].bezierSettings&&c.connectors[w].bezierSettings.allowSegmentsReset&&(c.connectors[w].segments=[]);if(e.connectors=c.connectors||[],e.dataSourceSettings=c.dataSourceSettings||{},e.dataSourceSettings.doBinding=r,e.height=c.height||"100%",e.setNodeTemplate=n,e.getConnectorDefaults=y,e.getNodeDefaults=m,e.getCustomProperty=a,e.mode=c.mode||"SVG",c.nodes)for(w=0;w<c.nodes.length;w++)c.nodes[w].shape&&"SwimLane"===c.nodes[w].shape.type&&(null==c.nodes[w].wrapper&&(c.nodes[w].wrapper={actualSize:{width:c.nodes[w].width,height:c.nodes[w].height},offsetX:c.nodes[w].offsetX,offsetY:c.nodes[w].offsetY}),qr(c.nodes[w],void 0,void 0,void 0,void 0,!0));e.nodes=c.nodes||[],Ra(e.nodes),Ra(e.connectors),e.rulerSettings=c.rulerSettings||{},e.snapSettings=c.snapSettings||{},e.width=c.width||"100%",e.layout=c.layout||{},c.layout&&"None"!==c.layout.type&&(e.canLayout=!1),e.layout.getLayoutInfo=J(u),e.layout.getBranch=J(f),e.diagramActions=0,e.isLoading=!0,e.protectPropertyChange(!1);var x;e.deserializing=!0;for(w=0;w<e.views.length;w++)x=e.views[e.views[w]],e.blazorActions=e.addConstraints(i,$.ClearObject),x.refresh(),x instanceof Qo&&x.onPropertyChanged({sourceID:x.sourceID},{}),e.blazorActions=e.removeConstraints(i,$.ClearObject),x instanceof sc&&e.element.classList.add("e-diagram");e.deserializing=!1;var I={name:"loaded",diagram:e};return e.triggerEvent(xt.loaded,I),c.selectedItems&&(c.selectedItems.nodes=[],c.selectedItems.connectors=[],c.selectedItems.selectedObjects=[]),e.selectedItems=c.selectedItems,e.enableServerDataBinding(!0),e.canLayout=!0,e.swimlaneChildTable={},e.swimlaneZIndexTable={},e.nodes.forEach(function(t){"SwimLane"===t.shape.type&&e.commandHandler.findProcesses(t).forEach(function(t){var i=e.nameTable[t];i&&e.nameTable[i.processId]&&e.nameTable[i.processId].wrapper.children.push(i.wrapper)})}),c.isScrollOffsetInverted&&(e.protectPropertyChange(!0),ja(e),e.protectPropertyChange(!1)),c}function Ra(t){for(var e=t.filter(function(t){return"string"==typeof t.flip}),i=0,r=e;i<r.length;i++){var n=r[i];switch(n.flip){case"Horizontal":n.flip=tt.Horizontal;break;case"Vertical":n.flip=tt.Vertical;break;case"Both":n.flip=tt.Both;break;case"None":n.flip=tt.None}}}function Na(t){if(t&&(void 0===t.version||t.version<17.1)&&t.nodes)for(var e=0,i=t.nodes;e<i.length;e++){var r=i[e];if(r&&r.ports&&r.ports.length>0)for(var n=0,o=r.ports;n<o.length;n++){var a=o[n];a&&a.constraints&&a.constraints===It.None&&(a.constraints=It.Default)}}return t}function ja(t){t.scrollSettings&&t.scrollSettings.horizontalOffset&&(t.scrollSettings.horizontalOffset=-t.scrollSettings.horizontalOffset),t.scrollSettings&&t.scrollSettings.verticalOffset&&(t.scrollSettings.verticalOffset=-t.scrollSettings.verticalOffset)}function Ha(t,e){var i=e.style,r=e;e.canApplyStyle=!0;for(var n=0,o=Object.keys(t);n<o.length;n++){switch(o[n]){case"fill":i.fill=t.fill,i instanceof Rt&&(i.fill="transparent");break;case"textOverflow":i.textOverflow=t.textOverflow;break;case"opacity":i.opacity=t.opacity;break;case"strokeColor":i.strokeColor=t.strokeColor;break;case"strokeDashArray":i.strokeDashArray=t.strokeDashArray;break;case"strokeWidth":i.strokeWidth=t.strokeWidth;break;case"bold":i.bold=t.bold;break;case"color":i.color=t.color;break;case"textWrapping":i.textWrapping=t.textWrapping;break;case"fontFamily":i.fontFamily=t.fontFamily;break;case"fontSize":i.fontSize=t.fontSize;break;case"italic":i.italic=t.italic;break;case"textAlign":i.textAlign=t.textAlign;break;case"whiteSpace":i.whiteSpace=t.whiteSpace;break;case"textDecoration":i.textDecoration=t.textDecoration;break;case"gradient":if(i.gradient){Wa(t.gradient,i.gradient);break}}}e instanceof Zt&&r.refreshTextElement()}function Wa(t,e){for(var i=0,r=Object.keys(t);i<r.length;i++){switch(r[i]){case"type":e.type=t.type;break;case"x1":e.x1=t.x1;break;case"x2":e.x2=t.x2;break;case"y1":e.y1=t.y1;break;case"y2":e.y2=t.y2;break;case"cx":e.cx=t.cx;break;case"cy":e.cy=t.cy;break;case"fx":e.fx=t.fx;break;case"fy":e.fy=t.fy;break;case"r":e.r=t.r;break;case"stops":e.stops=t.stops}}}function _a(t,e,i){for(var r=e,n=r.hyperlink,o=0,a=Object.keys(t);o<a.length;o++){switch(a[o]){case"color":r.style.color=n.color=t.color;break;case"content":r.content=n.content=t.content||n.link;break;case"link":var s=i.style;r.style.color=t.link?n.color:s.color,r.style.textDecoration=t.link?n.textDecoration:i.style.textDecoration,r.content=t.link?n.content||t.link:i.content,n.link=t.link;break;case"textDecoration":r.style.textDecoration=n.textDecoration=t.textDecoration;break;case"hyperlinkOpenState":n.hyperlinkOpenState=t.hyperlinkOpenState}}}function Ya(t,e,i){t.width=e.width,t.height=e.height,t.minHeight=e.minHeight,t.maxHeight=e.maxHeight,t.minWidth=e.minWidth,t.maxWidth=e.maxWidth,t.horizontalAlignment=e.wrapper.children[0].horizontalAlignment,t.verticalAlignment=e.wrapper.children[0].verticalAlignment,t.relativeMode=e.wrapper.children[0].relativeMode,t.visible=e.wrapper.children[0].visible,e.shape instanceof vh&&(t.margin=e.shape.margin),t.id=e.wrapper.children[0].id,t.style=e.style;for(var r=0,n=i.views;r<n.length;r++){var o=n[r];bd(e.id+"_groupElement",o),bd(e.id+"_content_groupElement",o),bd(e.id+"_html_element",o)}e.wrapper.children.splice(0,1),e.wrapper.children.splice(0,0,t)}function Fa(t,i,r,n){var o=new Xt;switch(t.shape.type){case"Path":var a=new Qt;a.data=i.shape.data,Ya(o=a,i,n);break;case"Image":var s=new Jt;s.source=i.shape.source,s.imageAlign=i.shape.align,s.imageScale=i.shape.scale,Ya(o=s,i,n);break;case"Text":Ya(o=new Zt,i,n);break;case"Basic":var h="Rectangle"===i.shape.shape?new Xt:new Qt;(0,e.isBlazor)()||"Polygon"!==i.shape.shape?h.data=ee(i.shape.shape):h.data=c(i.shape.points),(0,e.isBlazor)()||"Rectangle"!==i.shape.shape||(h.cornerRadius=i.shape.cornerRadius),Ya(o=h,i,n);break;case"Flow":var d=new Qt,l=i.shape.shape;d.data=ke(l),Ya(o=d,i,n);break;case"Native":var p=new ne(t.id,n.element.id);p.content=i.shape.content,p.scale=i.shape.scale,Ya(o=p,i,n);break;case"HTML":var g=new Bi(i.id,n.element.id);g.content=i.shape.content,Ya(o=g,i,n)}void 0===t.shape.type||t.shape.type===r.shape.type?Xa(t,i,n,r):(o.width=i.wrapper.children[0].width,o.height=i.wrapper.children[0].height,i.shape instanceof vh&&(o.margin=i.shape.margin),o.style=i.style,i.wrapper.children[0]=o)}function Xa(t,i,r,n){if(Object.keys(t.shape).length>0)if("Path"===i.shape.type&&void 0!==t.shape.data)i.wrapper.children[0].data=t.shape.data;else if("Text"===i.shape.type&&void 0!==t.shape.content)i.wrapper.children[0].content=t.shape.content;else if("Image"===i.shape.type&&void 0!==t.shape.source)i.wrapper.children[0].source=t.shape.source;else if("Native"===i.shape.type){for(var o=void 0,a=0;a<r.views.length;a++)o=id(i.wrapper.children[0].id+"_native_element",r.views[parseInt(a.toString(),10)]),void 0!==t.shape.content&&o&&(o.removeChild(o.children[0]),i.wrapper.children[0].content=t.shape.content,o.appendChild(Sd(i.wrapper.children[0],!1)));i.wrapper.children[0].scale=t.shape.scale?t.shape.scale:i.wrapper.children[0].scale}else if("HTML"===i.shape.type){var s=void 0;for(a=0;a<r.views.length;a++)(s=id(i.wrapper.children[0].id+"_html_element",r.views[parseInt(a.toString(),10)]))&&(s.removeChild(s.children[0]),i.wrapper.children[0].content=t.shape.content,s.appendChild(Sd(i.wrapper.children[0],!0)))}else if("Flow"===i.shape.type&&void 0!==t.shape.shape){i.shape.shape=t.shape.shape;var h=ke(i.shape.shape.toString());i.wrapper.children[0].data=h}else if("UmlActivity"!==i.shape.type||(0,e.isBlazor)()||void 0===t.shape.shape){if(void 0!==t.shape.cornerRadius)i.children&&i.children.length>0?i.wrapper.cornerRadius=t.shape.cornerRadius:i.wrapper.children[0].cornerRadius=t.shape.cornerRadius;else if("Basic"===i.shape.type&&n&&"Rectangle"===n.shape.shape){var d=new Qt,l=ee(i.shape.shape);d.data=l,Ya(d,i,r)}else if(void 0!==t.shape.shape){i.shape.shape=t.shape.shape;var c=ee(i.shape.shape.toString());i.wrapper.children[0].data=c}}else Va(i,t);i.wrapper.children[0].canMeasurePath=!0}function Va(t,i){(0,e.isBlazor)()?t.shape.umlActivityShape=i.shape.umlActivityShape:t.shape.shape=i.shape.shape;var r=jo(((0,e.isBlazor)()?t.shape.umlActivityShape:t.shape.shape).toString());((0,e.isBlazor)()||"InitialNode"!==t.shape.shape)&&((0,e.isBlazor)()||"ForkNode"!==t.shape.shape&&"JoinNode"!==t.shape.shape)?(0,e.isBlazor)()||"FinalNode"!==t.shape.shape||t instanceof Yh&&(t.wrapper=Ua(t)):t.wrapper.children[0].style.fill="black",r&&(t.wrapper.children[0].data=r)}function Ua(t){var e=new te;e.style.fill="transparent";var i="M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50",r=new Qt;r.data=i,r.id=t.id+"_0_finalNode",r.horizontalAlignment="Center",r.verticalAlignment="Center",r.relativeMode="Object",r.style.strokeColor=t.style.strokeColor,r.style.strokeWidth=t.style.strokeWidth;var n=new Qt;return n.data=i,n.id=t.id+"_1_finalNode",n.horizontalAlignment="Center",n.verticalAlignment="Center",n.relativeMode="Object",n.style.fill=t.style.fill,n.style.strokeColor=t.style.strokeColor,n.style.strokeWidth=t.style.strokeWidth,e.children=[r,n],e.children[0].width=t.width,e.children[0].height=t.height,e.children[1].height=t.height/1.5,e.children[1].width=t.width/1.5,e.style.strokeWidth=0,e.style.strokeColor="transparent",e}function Ga(t,e,i){var r=i.shape.shape,n=jo(r);switch(t.data=n,e=t,r){case"StructuredNode":if(i.annotations)for(var o=0;o<i.annotations.length;o++)i.annotations[parseInt(o.toString(),10)].content="<<"+i.annotations[parseInt(o.toString(),10)].content+">>";e=t;break;case"FinalNode":e=Ua(i)}return e}function Za(t){bd(t+"_linear"),bd(t+"_radial")}function qa(t,e){var i=t.indexOf(e);i>=0&&t.splice(i,1)}function Qa(t,e,i){var r;t.intermediatePoints=e,t.updateSegmentElement(t,e,t.wrapper.children[0],i);var n=t.sourceDecorator;if("Bezier"===t.type){var a=t.segments[0],s=t.segments[t.segments.length-1];r=[o.isEmptyPoint(s.point2)?s.bezierPoint2:s.point2,o.isEmptyPoint(a.point1)?a.bezierPoint1:a.point1]}else r=t.intermediatePoints;e=t.clipDecorators(t,e,i);var h=t.wrapper.children[0];h.canMeasurePath=!0,h=t.wrapper.children[1],t.updateDecoratorElement(h,e[0],r[1],n);var d=t.targetDecorator;h=t.wrapper.children[2],t.updateDecoratorElement(h,e[e.length-1],r[r.length-2],d),t.updateShapeElement(t)}function Ka(t,e,i){var r,n=t.wrapper,o=(n.bounds,e.offset),a=e.size/i.scale,s=e.margin,h=n.offsetX-n.actualSize.width*n.pivot.x,d=n.offsetY-n.actualSize.height*n.pivot.y;if(r={x:0,y:0},t.nodes.length>0){switch(e.side){case"Top":r.x+=h+o*n.actualSize.width,r.y+=d-a;break;case"Bottom":r.x+=h+o*n.actualSize.width,r.y+=d+n.actualSize.height+a;break;case"Left":r.x+=h-a,r.y+=d+o*n.actualSize.height;break;case"Right":r.x+=h+n.actualSize.width+a,r.y+=d+o*n.actualSize.height}r.x+=(s.left-s.right)/i.scale+a/2*("Center"===e.horizontalAlignment?0:"Right"===e.horizontalAlignment?-1:1),r.y+=(s.top-s.bottom)/i.scale+a/2*("Center"===e.verticalAlignment?0:"Top"===e.verticalAlignment?-1:1)}else if(t.connectors.length>0){var l=t.connectors[0],c={offset:o},p=Pa(l.intermediatePoints,c),g=p.index;r=p.point;var u,f=Sa(l.intermediatePoints,c).angle;T(u=I(),-f,l.intermediatePoints[parseInt(g.toString(),10)].x,l.intermediatePoints[parseInt(g.toString(),10)].y),(r=P(u,r)).x+=s.left-s.right+a/2*("Center"===e.horizontalAlignment?0:"Right"===e.horizontalAlignment?-1:1),r.y+=s.top-s.bottom+a/2*("Center"===e.verticalAlignment?0:"Top"===e.verticalAlignment?-1:1),T(u=I(),f,l.intermediatePoints[parseInt(g.toString(),10)].x,l.intermediatePoints[parseInt(g.toString(),10)].y),r=P(u,r)}0===n.rotateAngle&&0===n.parentTransform||(T(u=I(),n.rotateAngle+n.parentTransform,n.offsetX,n.offsetY),r=P(u,r));return r}function Ja(t,e,i,r){if(r.annotation){if(tr(r.annotation))return!0}else if(rt[""+e]&t&<[""+e]&i)return!0;return!1}function $a(t,e){return!!(rt[""+e]&t)}function ts(t,e){return!!(Ht[""+e]&t)}function es(t,e){return t.visibility&e}function is(t,e){var i;if("Text"===t.shape.type)i=t.shape;else{var r=e.split("_");e=r[r.length-1];for(var n=0;n<t.annotations.length;n++)e===t.annotations[parseInt(n.toString(),10)].id&&(i=t.annotations[parseInt(n.toString(),10)])}return i}function rs(t,e){if(e){var i=e.split("_");e=i[i.length-1]}if(t)for(var r=0;r<t.ports.length;r++)if(e===t.ports[parseInt(r.toString(),10)].id)return t.ports[parseInt(r.toString(),10)]}function ns(t,e){var i={},r=0;if(t.ports){var n=t.ports;for(r=0;r<n.length;r++)e?n[parseInt(r.toString(),10)].constraints&It.InConnect&&(i=n[parseInt(r.toString(),10)]):n[parseInt(r.toString(),10)].constraints&It.OutConnect&&(i=n[parseInt(r.toString(),10)])}return i}function os(t,e,i){for(var r=i?t.annotations:t.ports,n=0;n<r.length;n++)if(r[parseInt(n.toString(),10)].id===e)return n.toString();return"-1"}function as(t,e,i){for(var r=t.ports,n=0;n<r.length;n++)if(r[parseInt(n.toString(),10)].id===e)return n.toString();return"-1"}function ss(t,e){var i;for(i=0;i<t.length;i++)if(e===t[parseInt(i.toString(),10)].id)return!0;return!1}function hs(t,e,i,r){if(void 0!==t.width&&void 0!==t.height&&(t.width*=e,t.height*=i),t instanceof Ut){var n=I(),o=r.width||r.actualSize.width,a=r.height||r.actualSize.height;if(void 0!==o&&void 0!==a){var s=r.offsetX-o*r.pivot.x,h=r.offsetY-a*r.pivot.y,d={x:s+o*r.pivot.x,y:h+a*r.pivot.y};d=Q(r.rotateAngle,r.offsetX,r.offsetY,d),T(n,-r.rotateAngle,d.x,d.y),A(n,e,i,d.x,d.y),T(n,r.rotateAngle,d.x,d.y);for(var l=0,c=t.children;l<c.length;l++){var p=c[l];if(void 0!==p.width&&void 0!==p.height){var g=P(n,{x:p.offsetX,y:p.offsetY});p.offsetX=g.x,p.offsetY=g.y,hs(p,e,i,r)}}}}}function ds(t,e,r,n,o,a){for(var s,h=t.children,d=!1,l=!1,c=1.5,p=0;p<h.length;p++)if(s=n[h[parseInt(p.toString(),10)]])if(s.children)ds(s,e,r,n,o,a);else if(s.offsetX-=e,s.offsetY-=r,!o){n[s.id]=s;var g=s.initContainer();g.children||(g.children=[]);var u=s.init(a);g.children.push(u),g.measure(new i(s.width,s.height)),g.arrange(g.desiredSize),0===g.bounds.x&&(d=!0),0===g.bounds.y&&(l=!0)}(d||l)&&t.children.forEach(function(t){var e=n[""+t];e&&e.wrapper&&e.wrapper.children&&e.wrapper.children.length>0&&(d&&(e.wrapper.children[0].bounds.x+=c,e.wrapper.children[0].offsetX+=c),l&&(e.wrapper.children[0].bounds.y+=c,e.wrapper.children[0].offsetY+=c))})}function ls(t,e){var i,r;return(i=t instanceof Yh&&"Native"!==t.shape.type&&"HTML"!==t.shape.type||t instanceof Co?1:t instanceof Yh&&"HTML"!==t.shape.type?2:3)!==(r=e instanceof Yh&&"Native"!==e.shape.type&&"HTML"!==e.shape.type||e instanceof Co?1:e instanceof Yh&&"HTML"!==e.shape.type?2:3)?i-r:t.zIndex-e.zIndex}function cs(t){return t.sort(ls)}function ps(t,e,i){if(0===i.length)i.push(t);else if(1===i.length)i[0][""+e]>t[""+e]?i.splice(0,0,t):i.push(t);else if(i.length>1){for(var r=0,n=i.length-1,o=Math.floor((r+n)/2);o!==r;)if(i[parseInt(o.toString(),10)][""+e]<t[""+e])r=o,o=Math.floor((r+n)/2);else{if(!(i[parseInt(o.toString(),10)][""+e]>t[""+e]))break;n=o,o=Math.floor((r+n)/2)}i[parseInt(n.toString(),10)][""+e]<t[""+e]?i.push(t):i[parseInt(r.toString(),10)][""+e]>t[""+e]?i.splice(r,0,t):i[parseInt(r.toString(),10)][""+e]<t[""+e]&&i[parseInt(n.toString(),10)][""+e]>t[""+e]&&i.splice(n,0,t)}}function gs(t){var e=document.getElementById(t.diagramId).ej2_instances,i=e?e[0]:null,r=t.nodeId,n=i.nodes;void 0===n&&(n=function(t){for(var e=[],i=0;i<t.palettes.length;i++)for(var r=t.palettes[parseInt(i.toString(),10)].symbols,n=0;n<r.length;n++)r[parseInt(n.toString(),10)]instanceof Yh&&e.push(r[parseInt(n.toString(),10)]);return e}(i));for(var o="length",a=0;n&&a<n[""+o];a++)if(n[parseInt(a.toString(),10)].id===r)return t.annotationId?us(n[parseInt(a.toString(),10)],t):n[parseInt(a.toString(),10)];var s=i.connectors;for(a=0;s&&a<s[""+o];a++)if(s[parseInt(a.toString(),10)].id===r)return t.annotationId?us(s[parseInt(a.toString(),10)],t):s[parseInt(a.toString(),10)];var h=i.enterObject||{};return h.id===r||h.children?h.children&&ha(h,"HTML",i.enterTable)?i.enterTable[""+r]||null:h:null}function us(t,e){var i,r=t.annotations;for(i=0;r&&i<r.length;i++)if(e.annotationId&&r[parseInt(i.toString(),10)].id===e.annotationId)return r[parseInt(i.toString(),10)];return t}function fs(t,e,i,r){return t}function ms(t,e){return e}function ys(t,e,i,r,n,o,a,s){var h={x:0,y:0},d=I();switch(T(d,n,o,a),s.x){case 0:switch(s.y){case 0:h=P(d,{x:t,y:e});break;case.5:h=P(d,{x:t,y:e+r/2});break;case 1:h=P(d,{x:t,y:e+r})}break;case.5:switch(s.y){case 0:h=P(d,{x:t+i/2,y:e});break;case.5:h=P(d,{x:t+i/2,y:e+r/2});break;case 1:h=P(d,{x:t+i/2,y:e+r})}break;case 1:switch(s.y){case 0:h=P(d,{x:t+i,y:e});break;case.5:h=P(d,{x:t+i,y:e+r/2});break;case 1:h=P(d,{x:t+i,y:e+r})}}return{x:h.x,y:h.y}}var vs=function(t){return t&&(t=void 0!==t.sourceID||void 0!==t.sourcePoint||void 0!==t.targetID||void 0!==t.targetPoint||void 0!==t.type?Co:Yh),t},bs=function(t,e,i,r,n,o){if(!t.sourceID||!t.targetID)if(e||i||(e=o===tt.Horizontal||o===tt.Both,i=o===tt.Vertical||o===tt.Both),t.wrapper){var a={x:t.sourcePoint.x,y:t.sourcePoint.y},s={x:t.targetPoint.x,y:t.targetPoint.y},h=void 0,d=void 0,l=0;if(n&&t.parentId){var c=r.nameTable[t.parentId];c.wrapper&&(d={x:(h=r.groupBounds).center.x,y:h.center.y},l=c.rotateAngle||0)}if(n){if(n&&d)if(0!==l){var p=I(),g=I(),u=I(),f=I(),m=I();(p=I())[4]=-d.x,p[5]=-d.y,g=I();var y=-l*Math.PI/180;g[0]=Math.cos(y),g[1]=Math.sin(y),g[2]=-Math.sin(y),g[3]=Math.cos(y),u=I(),e&&(u[0]=-1),i&&(u[3]=-1),f=I();var v=l*Math.PI/180;f[0]=Math.cos(v),f[1]=Math.sin(v),f[2]=-Math.sin(v),f[3]=Math.cos(v),(m=I())[4]=d.x,m[5]=d.y;var b=function(t,e,i,r){var n={x:t.x,y:t.y},o=t.x-e.x,a=t.y-e.y,s=-l*Math.PI/180,h=o*Math.cos(s)-a*Math.sin(s),d=o*Math.sin(s)+a*Math.cos(s),c=h,p=d;i&&(c=-h),r&&(p=-d);var g=l*Math.PI/180,u=c*Math.cos(g)-p*Math.sin(g),f=c*Math.sin(g)+p*Math.cos(g);return n.x=e.x+u,n.y=e.y+f,n};t.sourceID||t.targetID?t.sourceID&&!t.targetID?t.targetPoint=b(s,d,e,i):!t.sourceID&&t.targetID&&(t.sourcePoint=b(a,d,e,i)):(t.sourcePoint=b(a,d,e,i),t.targetPoint=b(s,d,e,i))}else t.sourceID||t.targetID?t.sourceID&&!t.targetID?(e&&(t.targetPoint.x=2*d.x-s.x),i&&(t.targetPoint.y=2*d.y-s.y)):!t.sourceID&&t.targetID&&(e&&(t.sourcePoint.x=2*d.x-a.x),i&&(t.sourcePoint.y=2*d.y-a.y)):(e&&(t.sourcePoint.x=2*d.x-a.x,t.targetPoint.x=2*d.x-s.x),i&&(t.sourcePoint.y=2*d.y-a.y,t.targetPoint.y=2*d.y-s.y))}else e&&(t.sourcePoint.x=s.x,t.targetPoint.x=a.x),i&&(t.sourcePoint.y=s.y,t.targetPoint.y=a.y),r&&!n&&(t.sourceID="",t.targetID="",r.updateConnectorProperties(t));r&&(r.connectorFlipInProgress=!0,r.updateConnectorProperties(t),r.connectorFlipInProgress=!1)}else{a={x:t.sourcePoint.x,y:t.sourcePoint.y},s={x:t.targetPoint.x,y:t.targetPoint.y};t.flip===tt.Horizontal?(t.sourcePoint.x=s.x,t.targetPoint.x=a.x):t.flip===tt.Vertical?(t.sourcePoint.y=s.y,t.targetPoint.y=a.y):t.flip===tt.Both&&(t.sourcePoint=s,t.targetPoint=a)}},Ss=function(t,e,i){var r=i.offset.x,n=i.offset.y;return e===tt.Horizontal?(r=1-i.offset.x,n=i.offset.y):e===tt.Vertical?(r=i.offset.x,n=1-i.offset.y):e===tt.Both&&(r=1-i.offset.x,n=1-i.offset.y),t.setOffsetWithRespectToBounds(r,n,"Fraction"),t},ws=function(t,e,r,n,o,a,s,h){if(t.hasChildren())for(var d=0,l=t.children;d<l.length;d++){var c=l[d],p=void 0;if(c instanceof te){(p=n.nameTable[c.id])&&(a&&(p.flip^=tt.Horizontal),s&&(p.flip^=tt.Vertical));var g=n.nameTable[c.id];if(g&&g instanceof Co&&(a||s||o)){bs(g,a,s,n,!0,o),a&&(g.wrapper.flip^=tt.Horizontal),s&&(g.wrapper.flip^=tt.Vertical);continue}}var u=t.rotateAngle*(Math.PI/180),f=c.offsetX-e,m=c.offsetY-r,y=f*Math.cos(u)+m*Math.sin(u),v=-f*Math.sin(u)+m*Math.cos(u);(a||o===tt.Horizontal||o===tt.Both)&&(y=-y),(s||o===tt.Vertical||o===tt.Both)&&(v=-v);var b=e+(y*Math.cos(u)-v*Math.sin(u)),S=r+(y*Math.sin(u)+v*Math.cos(u));if(c instanceof Zt||c.elementActions&dt.ElementIsPort||(c.offsetX=b,c.offsetY=S,p&&(p.offsetX=b,p.offsetY=S),c.flipOffset.x=b-c.desiredSize.width/2,c.flipOffset.y=S-c.desiredSize.height/2),h||(c instanceof te||c instanceof Ut)&&(a&&(c.flip^=tt.Horizontal),s&&(c.flip^=tt.Vertical),c.id.includes("group_container")||c.id.endsWith("_transaction_events")||!c.children||(a&&(c.children[0].flip^=tt.Horizontal),s&&(c.children[0].flip^=tt.Vertical)),ws(c,e,r,n,o,a,s,h)),c.measure(new i(c.bounds.width,c.bounds.height)),c.arrange(c.desiredSize),!n.groupBounds){var w=n.nameTable[c.id];w&&n.updateConnectorEdges(w)}}},xs=function(t,e){if((!t.children||0===t.children.length)&&t instanceof Yh){var i=(t.rotateAngle%360+360)%360;t.rotateAngle=0===i?0:360-i,e.nodePropertyChange(t,{},{rotateAngle:t.rotateAngle},void 0,!0)}else{for(var r=[],n=0,o=t.children;n<o.length;n++){var a=o[n],s=e.nameTable[""+a];r[""+a]=s.rotateAngle}var h=(t.rotateAngle%360+360)%360;t.rotateAngle=0===h?0:360-h,e.nodePropertyChange(t,{},{rotateAngle:t.rotateAngle},void 0,!0);for(var d=0,l=t.children;d<l.length;d++){var c=l[d];if((a=e.nameTable[""+c])instanceof Yh){var p=r[a.id];if(a){var g=(p%360+360)%360;a.rotateAngle=0===g?0:360-g,e.nodePropertyChange(a,{},{rotateAngle:a.rotateAngle},void 0,!0)}}}}},Is=function(t){var e=t.selectedItems.nodes,i=t.selectedItems.connectors,r=t.allowServerDataBinding,n=t.isProtectedOnChange;t.protectPropertyChange(!0),t.allowServerDataBinding=!1,t.selectedItems.nodes=[],t.selectedItems.connectors=[],t.allowServerDataBinding=r,t.protectPropertyChange(n);for(var o=N(t.selectedItems),a=0;a<e.length;a++)t.selectedItems.nodes.push(t.nameTable[e[a].id]);for(a=0;a<i.length;a++)t.selectedItems.connectors.push(t.nameTable[i[a].id]);return o},Ps=function(t,e){for(var i,r=new Qt,n=0;n<t.length-1;n++){i=As(t[n],t[n+1]),r.data=i[0],r.id=e.id+"_"+e.shape.sequence;var o=Cs(t,e);r.offsetX=o.x,r.offsetY=o.y,r.rotateAngle=45,r.transform=gt.Self;break}return r},Cs=function(t,e,i){for(var r,n,a,s=0,h=0;h<t.length-1;h++)s+=Ds(t[parseInt(h.toString(),10)],t[h+1]);a=i?s*i:s/2>30?10:s/2;for(var d=0,l=0;l<t.length-1;l++){var c=Ds(t[parseInt(l.toString(),10)],t[l+1]);if(d+c>=a){var p=a-d;r=ai(t[l],t[l+1]),n=o.transform(t[l],r,p);break}d+=c}return n},Ts=function(t,e){if(t instanceof Yh||t instanceof Co)for(var i=0;i<t.ports.length;i++)if(t.ports[i].id===e.id.split("_").splice(1).join("_"))return!0;return!1},As=function(t,e){var i={x:t.x,y:t.y},r=Ds(t,e);r=Math.min(10,r/2);var n=ai(t,e),a=o.transform({x:i.x,y:i.y},n,r),s=o.transform({x:a.x,y:a.y},n,-11),h=o.transform({x:s.x,y:s.y},n,22);return["M"+s.x+" "+s.y+" L"+h.x+" "+h.y,a]},Os=function(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?t.x<e.x?"Right":"Left":t.y<e.y?"Bottom":"Top"},Ds=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))};function Ms(t){return t}function Ls(){return(navigator.platform.indexOf("Mac")>=0||navigator.platform.indexOf("iPad")>=0||navigator.platform.indexOf("iPhone")>=0||navigator.platform.indexOf("MacIntel")>=0)&&("safari"===e.Browser.info.name||"webkit"===e.Browser.info.name)}function Es(t){return-1!==t.indexOf("shape")||-1!==t.indexOf("pathData")||-1!==t.indexOf("width")||-1!==t.indexOf("height")}function zs(t,e,r){var n=ks(t,e,r,"width"),o=ks(t,e,r,"height");return new i(n,o)}function ks(t,e,i,r){return void 0!==e.previewSize[""+r]?e.previewSize[""+r]:void 0!==t.symbolPreview[""+r]?t.symbolPreview[""+r]:e[""+r]||i.actualSize[""+r]}function Bs(t,e,i){return t&&t.parentId&&(i=(t=e.nameTable[t.parentId]).parentId?Bs(t,e,i):t.id),i}function Rs(t,e){return t.selectedItems.connectors.length>1&&0===t.selectedItems.nodes.length&&0!==e.rotateAngle}function Ns(t){if(t.arrowType&&""!==t.arrowType.trim())switch(t.arrowType){case"single-line-arrow":default:return{targetDecorator:"Arrow",strokeWidth:1};case"double-line-arrow":return{targetDecorator:"Arrow",strokeWidth:2};case"dotted-arrow":return{targetDecorator:"Arrow",strokeDashArray:"2,2"};case"single-line":return{targetDecorator:"None",strokeWidth:1};case"double-line":return{targetDecorator:"None",strokeWidth:2};case"dotted":return{targetDecorator:"None",strokeDashArray:"2,2"};case"wiggly-arrow":return{targetDecorator:"None",strokeWidth:1,opacity:0}}return{targetDecorator:"Arrow",strokeWidth:1}}function js(t,e,i){switch(e+=t.margin.left-t.margin.right,i+=t.margin.top-t.margin.bottom,t.horizontalAlignment){case"Auto":case"Left":e=t.inversedAlignment?e:e-t.desiredSize.width;break;case"Stretch":case"Center":e-=t.desiredSize.width*t.pivot.x;break;case"Right":e=t.inversedAlignment?e-t.desiredSize.width:e}switch(t.verticalAlignment){case"Auto":case"Top":i=t.inversedAlignment?i:i-t.desiredSize.height;break;case"Stretch":case"Center":i-=t.desiredSize.height*t.pivot.y;break;case"Bottom":i=t.inversedAlignment?i-t.desiredSize.height:i}return{x:e,y:i}}function Hs(t,e){var i=e.position.x,r=e.position.y;e.flip===tt.Horizontal?i=1-i:(e.flip===tt.Vertical||(i=1-i),r=1-r);var n=i*t.width,o=r*t.height,a=t.offsetY-t.height*e.pivot.y+t.padding.top,s=t.offsetX-t.width*e.pivot.x+t.padding.left,h={horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,margin:e.margin,desiredSize:e.desiredSize,inversedAlignment:e.inversedAlignment,pivot:e.pivot};e.flip!==tt.Horizontal&&e.flip!==tt.Both||(h.horizontalAlignment="Left"===h.horizontalAlignment||"Auto"===e.horizontalAlignment?"Right":"Right"===h.horizontalAlignment?"Left":h.horizontalAlignment),e.flip!==tt.Vertical&&e.flip!==tt.Both||(h.verticalAlignment="Top"===h.verticalAlignment||"Auto"===e.verticalAlignment?"Bottom":"Bottom"===h.verticalAlignment?"Top":h.verticalAlignment);var d=js(h,s+=n,a+=o),l={x:d.x+e.desiredSize.width/2,y:d.y+e.desiredSize.height/2},c=e.rotateAngle;if(0!==c||0!==e.parentTransform){var p=K({x:d.x,y:d.y},e);p=Q(e.rotateAngle,l.x,l.y,p),d=B({offsetX:(p=Q(t.rotateAngle+t.parentTransform,t.offsetX,t.offsetY,p)).x,offsetY:p.y,pivot:e.pivot,actualSize:e.actualSize}).topLeft;var g=I();T(g,c+e.parentTransform,p.x,p.y),d=P(g,d)}return d}function Ws(t){return!(!t||t.flip===tt.None||"Label"!==t.flipMode&&"PortAndLabel"!==t.flipMode&&"LabelAndLabelText"!==t.flipMode&&"All"!==t.flipMode)}function _s(t,e,i){return void 0===i&&(i=0),t.left-i<=e.x&&t.right+i>=e.x&&t.top-i<=e.y&&t.bottom+i>=e.y}var Ys=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Fs=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Xs=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ys(i,t),Fs([(0,e.Property)("None")],i.prototype,"shape",void 0),Fs([(0,e.Property)("white")],i.prototype,"fill",void 0),Fs([(0,e.Property)("Auto")],i.prototype,"horizontalAlignment",void 0),Fs([(0,e.Property)("Auto")],i.prototype,"verticalAlignment",void 0),Fs([(0,e.Property)(10)],i.prototype,"width",void 0),Fs([(0,e.Property)(10)],i.prototype,"height",void 0),Fs([(0,e.Complex)({x:.5,y:1},o)],i.prototype,"offset",void 0),Fs([(0,e.Property)("#1a1a1a")],i.prototype,"borderColor",void 0),Fs([(0,e.Property)(1)],i.prototype,"borderWidth",void 0),Fs([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),Fs([(0,e.Property)("")],i.prototype,"pathData",void 0),Fs([(0,e.Property)("")],i.prototype,"content",void 0),Fs([(0,e.Property)(0)],i.prototype,"cornerRadius",void 0),Fs([(0,e.Complex)({left:2,right:2,top:2,bottom:2},Ot)],i.prototype,"padding",void 0),Fs([(0,e.Property)("#1a1a1a")],i.prototype,"iconColor",void 0),i}(e.ChildProperty),Vs=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Us=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.orientation="Vertical",e.measureChildren=void 0,e.considerPadding=!0,e}return Vs(e,t),e.prototype.measure=function(t){var e="Horizontal"===this.orientation?this.updateHorizontalStack:this.updateVerticalStack;return this.desiredSize=this.measureStackPanel(t,e),this.desiredSize},e.prototype.arrange=function(t){var e="Horizontal"===this.orientation?this.arrangeHorizontalStack:this.arrangeVerticalStack;return this.actualSize=this.arrangeStackPanel(t,e),this.updateBounds(),this.actualSize},e.prototype.measureStackPanel=function(e,i){var r=void 0;if(void 0!==this.children&&this.children.length>0)for(var n=0,o=this.children;n<o.length;n++){var a=o[n];a.parentTransform=this.rotateAngle+this.parentTransform,this.measureChildren?a.measure(a.desiredSize):a.measure(e);var s=a.desiredSize.clone();this.applyChildMargin(a,s),0!==a.rotateAngle&&(s=q(s,a.rotateAngle)),void 0===r?r=s:a.preventContainer||i(s,r)}return r=t.prototype.validateDesiredSize.call(this,r,e),this.stretchChildren(r),this.considerPadding&&this.applyPadding(r),r},e.prototype.arrangeStackPanel=function(e,i){if(void 0!==this.children&&this.children.length>0){var r=void 0,n=void 0;r=this.offsetX-e.width*this.pivot.x+this.padding.left,n=this.offsetY-e.height*this.pivot.y+this.padding.top;for(var o=0,a=this.children;o<a.length;o++){var s=a[o],h=s.desiredSize.clone(),d=h;"Vertical"===this.orientation?n+=s.margin.top:r+=s.margin.left,0!==s.rotateAngle&&(d=q(h,s.rotateAngle));var l=i(r,n,s,this,e,d);t.prototype.findChildOffsetFromCenter.call(this,s,l),s.arrange(h,!0),"Vertical"===this.orientation?n+=d.height+s.margin.bottom:r+=d.width+s.margin.right}}return e},e.prototype.updateHorizontalStack=function(t,e){e.height=Math.max(t.height,e.height),e.width+=t.width},e.prototype.updateVerticalStack=function(t,e){e.width=Math.max(t.width,e.width),e.height+=t.height},e.prototype.arrangeHorizontalStack=function(t,e,i,r,n,o){var a=0;if("Top"===i.verticalAlignment)a=e+i.margin.top+o.height/2;else if("Bottom"===i.verticalAlignment){a=r.offsetY+n.height*(1-r.pivot.y)-r.padding.bottom-i.margin.bottom-o.height/2}else a=r.offsetY-n.height*r.pivot.y+n.height/2,i.margin.top&&(a=e+i.margin.top+o.height/2);return{x:t+o.width/2,y:a}},e.prototype.arrangeVerticalStack=function(t,e,i,r,n,o){var a=0;if("Left"===i.horizontalAlignment)a=t+i.margin.left+o.width/2;else if("Right"===i.horizontalAlignment){a=r.offsetX+n.width*(1-r.pivot.x)-r.padding.right-i.margin.right-o.width/2}else a=r.offsetX-n.width*r.pivot.x+n.width/2,i.margin.left&&(a=t+i.margin.left+o.width/2);return{x:a,y:e+o.height/2}},e.prototype.stretchChildren=function(t){if(void 0!==this.children&&this.children.length>0)for(var e=0,i=this.children;e<i.length;e++){var r=i[e];"Vertical"===this.orientation?"Stretch"===r.horizontalAlignment&&(r.desiredSize.width=t.width-(r.margin.left+r.margin.right)):"Stretch"===r.verticalAlignment&&(r.desiredSize.height=t.height-(r.margin.top+r.margin.bottom))}},e.prototype.applyChildMargin=function(t,e){e.height+=t.margin.top+t.margin.bottom,e.width+=t.margin.left+t.margin.right},e}(Ut);function Gs(t,e,i){var r,n="NoWrap";"Class"===e.shape.classifier?r=e.shape.classShape:"Enumeration"===e.shape.classifier?r=e.shape.enumerationShape:"Interface"===e.shape.classifier&&(r=e.shape.interfaceShape),e.container={type:"Stack",orientation:"Vertical"},e.constraints=(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Resize),e.style={fill:e.style.fill,strokeColor:e.style.strokeColor,strokeWidth:1.5},e.children=[],e.maxWidth&&(n="Wrap");var o=new Yh(i,"nodes",{id:e.id+"_umlClass_header",offsetX:e.offsetX,offsetY:e.offsetY,annotations:[{id:"name",content:r.name,offset:{x:.5,y:.65},margin:{left:10,right:10},style:{bold:!0,fontSize:14,color:r.style.color,fill:r.style.fill,textWrapping:n}},{content:"<<"+e.shape.classifier+">>",margin:{left:10,right:10},id:"class",style:{fontSize:r.style.fontSize,color:r.style.color,fill:r.style.fill,textWrapping:n},offset:{x:.5,y:.3},constraints:st.ReadOnly}],constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),verticalAlignment:"Stretch",horizontalAlignment:"Stretch",style:{fill:e.style.fill,strokeColor:"black"===e.style.strokeColor?"#ffffff00":e.style.strokeColor}},!0);return i.initObject(o),i.nodes.push(o),i.UpdateBlazorDiagramModel(o,"Node"),e.children.push(o.id),function(t,e,i,r){if("Enumeration"===t.shape.classifier){var n=i.members;if(n&&n.length){Zs(t,e);for(var o="",a=0;a<n.length;a++){var s=n[parseInt(a.toString(),10)];if(""!==s.name&&(o+=s.name),a!==n.length){var h=Qs(t,s),d=new Yh(e,"nodes",{id:E()+"_umlMember",annotations:[{id:"name",content:o,offset:{x:0,y:.5},style:{bold:!0,fontSize:h.fontSize,color:h.color,fill:h.fill,textWrapping:r,italic:h.italic,fontFamily:h.fontFamily,whiteSpace:h.whiteSpace,textAlign:h.textAlign,textDecoration:h.textDecoration,textOverflow:h.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],verticalAlignment:"Stretch",horizontalAlignment:"Stretch",style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor,textWrapping:r},constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),minHeight:25},!0);e.initObject(d),e.nodes.push(d),e.UpdateBlazorDiagramModel(d,"Node"),t.children.push(d.id),o="",s.isSeparator&&a!==n.length-1&&Zs(t,e,s.separatorStyle),s.isSeparator&&a===n.length-1&&(s.isSeparator=!1)}}}}else{var l=i.attributes;if(l.length){var c="";Zs(t,e);for(a=0;a<l.length;a++){var p=void 0,g=l[parseInt(a.toString(),10)];if(p=g.scope&&"Public"===g.scope?" +":g.scope&&"Private"===g.scope?"-":g.scope&&"Protected"===g.scope?"#":"~",""!==g.name&&p&&(c+=p+" "+g.name+" : "+g.type),a!==l.length){h=Qs(t,g),d=new Yh(e,"nodes",{id:E()+"_umlProperty",style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor},annotations:[{id:"name",content:c,offset:{x:0,y:.5},style:{bold:!0,fontSize:h.fontSize,color:h.color,fill:h.fill,textWrapping:r,italic:h.italic,fontFamily:h.fontFamily,whiteSpace:h.whiteSpace,textAlign:h.textAlign,textDecoration:h.textDecoration,textOverflow:h.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],verticalAlignment:"Stretch",horizontalAlignment:"Stretch",constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),minHeight:25},!0);e.initObject(d),e.nodes.push(d),e.UpdateBlazorDiagramModel(d,"Node"),t.children.push(d.id),c="",g.isSeparator&&a!==l.length-1&&Zs(t,e,g.separatorStyle),g.isSeparator&&a===l.length-1&&(g.isSeparator=!1)}}}}}(e,i,r,n),function(t,e,i,r){if(i.methods&&i.methods.length){var n=i.methods;Zs(t,e);for(var o="",a="",s=void 0,h=0;h<n.length;h++){var d=n[parseInt(h.toString(),10)];if(s=d.scope&&"Public"===d.scope?" +":d.scope&&"Private"===d.scope?"-":d.scope&&"Protected"===d.scope?"#":"~",d.parameters)for(var l=0;l<d.parameters.length;l++)d.parameters[parseInt(l.toString(),10)].type?o+=d.parameters[parseInt(l.toString(),10)].name+":"+d.parameters[parseInt(l.toString(),10)].type:o+=d.parameters[parseInt(l.toString(),10)].name,l!==d.parameters.length-1&&(o+=",");if(""!==d.name&&(s&&(a+=s+" "+d.name+"("+o+") : "+d.type),o=""),h!==n.length){var c=Qs(t,d),p=new Yh(e,"nodes",{id:E()+"_umlMethods",verticalAlignment:"Stretch",horizontalAlignment:"Stretch",annotations:[{id:"name",content:a,offset:{x:0,y:.5},style:{bold:!0,fontSize:c.fontSize,color:c.color,fill:c.fill,textWrapping:r,italic:c.italic,fontFamily:c.fontFamily,whiteSpace:c.whiteSpace,textAlign:c.textAlign,textDecoration:c.textDecoration,textOverflow:c.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor},minHeight:25,constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize)},!0);e.initObject(p),e.nodes.push(p),e.UpdateBlazorDiagramModel(p,"Node"),t.children.push(p.id),a="",d.isSeparator&&h!==n.length-1&&Zs(t,e,d.separatorStyle),d.isSeparator&&h===n.length-1&&(d.isSeparator=!1)}}}}(e,i,r,n),e.offsetX=e.offsetX,e.offsetY=e.offsetY,e.style.fill=e.style.fill,e.borderColor=e.borderColor,i.initObject(e),t}function Zs(t,e,i){var r=new Yh(e,"nodes",{id:E()+"_path",height:1,constraints:ht.Default&~ht.Select,verticalAlignment:"Stretch",horizontalAlignment:"Stretch",style:{strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor,fill:i?i.fill:"white"}},!0);e.initObject(r),e.nodes.push(r),t.children.push(r.id)}function qs(t,e,i){var r=new Yh(e,"nodes",{id:E()+"_path",height:1,constraints:ht.Default&~ht.Select,verticalAlignment:"Stretch",horizontalAlignment:"Stretch",style:{strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor,fill:"white"}},!0);r.parentId=t.id,r.umlIndex=i,e.add(r)}function Qs(t,e){var i={},r=e.style;return i.fill="transparent"!==r.fill?r.fill:t.style.fill,i.color=r.color,i.fontFamily="Arial"!==r.fontFamily?r.fontFamily:t.style.fontFamily,i.italic=r.italic,i.bold=r.bold,i.whiteSpace=r.whiteSpace,i.textAlign=r.textAlign,i.textWrapping=r.textWrapping,i.textDecoration=r.textDecoration,i.textOverflow=r.textOverflow,i.fontSize=12!==r.fontSize?r.fontSize:t.style.fontSize,i.strokeColor="black"!==r.strokeColor?r.strokeColor:t.style.strokeColor,i.strokeWidth=1!==r.strokeWidth?r.strokeWidth:t.style.strokeWidth,i}var Ks=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Js=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},$s=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ks(i,t),Js([(0,e.Property)("Horizontal")],i.prototype,"orientation",void 0),Js([(0,e.Property)("Center")],i.prototype,"type",void 0),Js([(0,e.Property)(void 0)],i.prototype,"offset",void 0),Js([(0,e.Property)(!1)],i.prototype,"enableRouting",void 0),Js([(0,e.Property)([])],i.prototype,"children",void 0),Js([(0,e.Property)("")],i.prototype,"assistants",void 0),Js([(0,e.Property)("")],i.prototype,"level",void 0),Js([(0,e.Property)("")],i.prototype,"hasSubTree",void 0),Js([(0,e.Property)("")],i.prototype,"rows",void 0),i}(e.ChildProperty);function th(t,e,r){return t=function(t,e,r){var n=new te;eh(n,e),n.id=e.id+"_container";var o=function(t,e){var r=new i(t.width,t.height);e instanceof Qt||(r.width=r.width||50,r.height=r.height||50);if(e.actualSize.width&&e.actualSize.height)return e.actualSize;void 0!==t.maxWidth&&(r.width=Math.min(r.width,t.maxWidth));void 0!==t.maxHeight&&(r.height=Math.min(r.height,t.maxHeight));void 0!==t.minWidth&&(r.width=Math.max(r.width,t.minWidth));void 0!==t.minHeight&&(r.height=Math.max(r.height,t.minHeight));return r}(e,t);if(e.width=o.width,e.height=o.height,t.id=e.id+"_content",t.width=o.width,t.height=o.height,eh(t,e),n.children=[t],e.shape.header&&e.shape.hasHeader){var a=function(t,e){var r=e.shape;r.header.id=r.header.id||E();var n={id:e.id+r.header.id,annotations:[N(r.header.annotation)],style:r.header.style,offsetX:e.offsetX,offsetY:e.offsetY,height:r.header.height,width:e.width},o=function(t,e,r,n){var o=new Yh(t,"nodes",r,!0);if(o.parentId=e.id,o.isHeader=n,o.constraints&=~(ht.InConnect|ht.OutConnect),o.constraints|=ht.HideThumbs,t.initObject(o),t.nodes.push(o),o.wrapper.children.length>0){for(var a=0;a<o.wrapper.children.length;a++){var s=o.wrapper.children[parseInt(a.toString(),10)];s instanceof Xt&&(s.isCalculateDesiredSize=!1),s instanceof Zt&&(s.canConsiderBounds=!1)}o.wrapper.measure(new i(void 0,void 0)),o.wrapper.arrange(o.wrapper.desiredSize)}return o.wrapper.measure(new i(void 0,void 0)),o.wrapper.arrange(o.wrapper.desiredSize),o.wrapper}(t,e,n,!0);return o}(r,e);n.children.push(a)}var s=e.shape;if(e.shape.children&&e.shape.children.length>0)for(var h=0;h<s.children.length;h++){var d=r.nameTable[s.children[parseInt(h.toString(),10)]];if(d&&(!d.parentId||d.parentId===e.id)){d.parentId=e.id,d.margin.left||(d.margin.left=10),d.margin.top||(d.margin.top=10),!e.shape.header||!e.shape.hasHeader||r.isLoading||r.diagramActions&yt.UndoRedo||(d.margin.top+=e.shape.header.height);var l=e.offsetX-e.width*e.pivot.x+(d.margin.left+d.width*d.pivot.x),c=e.offsetY-e.height*e.pivot.y+(d.margin.top+d.height*d.pivot.y);d.offsetX===l&&d.offsetY===c||(d.offsetX=l,d.offsetY=c),n.children.push(d.wrapper),ih(r,d)}}return n.width=e.width,n.height=e.height,n}(t,e,r),t}function eh(t,e){t.style.fill=e.style.fill,t.style.strokeColor=e.style.strokeColor,t.style.strokeWidth=e.style.strokeWidth,t.style.strokeDashArray=e.style.strokeDashArray,t.style.opacity=e.style.opacity,t.style.gradient=e.style.gradient,0!==(e.constraints&ht.Shadow)&&e.visible&&(t.shadow=e.shadow)}function ih(t,e){var i=e,r=t.getIndex(i,i.id),n=t.layers.indexOf(t.commandHandler.getObjectLayer(e.id)),o=t.layers[parseInt(n.toString(),10)];t.nodes.splice(Number(r),1),delete o.zIndexTable[i.zIndex],i.zIndex=o.objectZIndex+1,t.nodes.push(i),o.zIndexTable[i.zIndex]=i.id}function rh(t,e,r){var n=r.nameTable[t.id].shape;if(r.currentSymbol&&"Container"===t.shape.type)e.parentId=t.id;else{n.children=n.children||[];var o=N(e),a=r.nameTable[e.id].wrapper,s=r.nameTable[t.id].wrapper;a.margin.top=a.offsetY-a.actualSize.height/2-(t.offsetY-t.actualSize.height/2),a.margin.left=a.offsetX-a.actualSize.width/2-(t.offsetX-t.actualSize.width/2),r.nameTable[e.id].parentId=t.id,n.children.push(e.id),s.children[0].children.push(r.nameTable[e.id].wrapper),oh(nh(t,e.id,r),e,r,!1),a.margin.left<0&&(a.margin.left=10),(a.margin.top<0||n.hasHeader&&a.margin.top<n.header.height)&&(a.margin.top=10,n.hasHeader&&(a.margin.top+=n.header.height)),s.measure(new i(void 0,void 0)),s.arrange(s.desiredSize);var h={type:"PositionChanged",undoObject:{nodes:[o]},redoObject:{nodes:[N(e)]},category:"Internal"};if(r.addHistoryEntry(h),"SVG"===r.mode)e.zIndex<t.zIndex&&(r.moveSvgNode(e.id),ih(r,e)),id(t.id+"_groupElement").appendChild(id(e.id+"_groupElement"))}}function nh(t,e,i){var r,n=t.shape.children;if(n&&n.length)for(var o=0;o<n.length;o++){var a=n[parseInt(o.toString(),10)];e!==a&&(r=r?i.nameTable[""+a].wrapper.bounds.uniteRect(r):i.nameTable[""+a].wrapper.bounds)}return r||i.nameTable[""+e].wrapper.bounds}function oh(t,e,i,r){var n,o,a=i.nameTable[e.parentId],s={x:.5,y:.5},h=a.wrapper.actualSize,d=0;a.shape.hasHeader&&(d=a.shape.header.height),a.wrapper.bounds.left+e.margin.left+e.width>a.wrapper.bounds.right?(s.x=0,n=(e.wrapper.margin.left+e.wrapper.bounds.width)/h.width):e.margin.left<0&&(s.x=1,n=(e.wrapper.bounds.x+e.wrapper.bounds.width)/a.wrapper.bounds.x),a.wrapper.bounds.top+e.margin.top+e.height>a.wrapper.bounds.bottom?(s.y=0,o=(e.wrapper.margin.top+e.wrapper.bounds.height)/h.height):e.margin.top<d&&!r&&(s.y=1,o=(e.wrapper.bounds.y+e.wrapper.bounds.height)/a.wrapper.bounds.y),(n>0||o>0)&&a.constraints&ht.Resize&&i.commandHandler.scale(i.nameTable[e.parentId],n||1,o||1,s)}function ah(t,e){var r=t.shape.children;if(r)for(var n=0,o=r;n<o.length;n++){var a=o[n],s=e.nameTable[""+a];s&&(e.updateConnectorEdges(s),s.wrapper.measure(new i(s.wrapper.width,s.wrapper.height)),s.wrapper.arrange(s.wrapper.desiredSize),s.shape.children&&s.shape.children.length&&ah(s,e))}}function sh(t,e,i,r){for(var n=0,o=t.children;n<o.length;n++){var a=o[n];if(a.id===e){if(t.children.splice(t.children.indexOf(a),1),!r){var s=document.getElementById(a.id+"_groupElement"),h=document.getElementById(i.element.id+"_diagramLayer");s.parentElement.removeChild(s),h.appendChild(s)}}else a.children&&sh(a,e,i,r)}}function hh(t,e,r){var n=t.id,o=r.nameTable[""+n],a=N(o);o||(r.add(t),o=r.nameTable[""+n]),t.parentId=e;var s=r.nameTable[""+e],h=s.shape;if(h.children||(h.children=[]),o&&s){o.parentId=e,(o.margin.top<=0||s.shape.hasHeader&&o.margin.top<s.shape.header.height)&&(o.margin.top=10,s.shape.hasHeader&&(o.margin.top+=s.shape.header.height)),o.margin.left<=0&&(o.margin.left=10);var d=s.offsetX-s.width*s.pivot.x+(o.margin.left+o.width*o.pivot.x),l=s.offsetY-s.height*s.pivot.y+(o.margin.top+o.height*o.pivot.y);o.offsetX===d&&o.offsetY===l||(o.offsetX=d,o.offsetY=l);var c=h.children;if(c.indexOf(n)<0&&c.push(n),s.wrapper.children.push(o.wrapper),s.wrapper.measure(new i),s.wrapper.arrange(s.wrapper.desiredSize),r.refreshDiagramLayer(),!(r.diagramActions&yt.UndoRedo||r.historyManager.currentEntry&&"CollectionChanged"===r.historyManager.currentEntry.type)){var p={type:"PositionChanged",undoObject:{nodes:[a]},redoObject:{nodes:[N(o)]},category:"Internal"};r.addHistoryEntry(p)}if("SVG"===r.mode)id(e+"_groupElement").appendChild(id(t.id+"_groupElement"))}}function dh(t,e){var i=t.id,r=e.nameTable[t.parentId];if(r){var n=r.shape.children;sh(r.wrapper,i,e,!0);var o=n.indexOf(i);n.splice(o,1),t.parentId="",e.refreshDiagramLayer(),e.updateSelector()}}var lh=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ch=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},ph=function(t){if(t)switch(t.type){case"Basic":default:return bh;case"Flow":return Sh;case"Path":return uh;case"Image":return yh;case"Text":return vh;case"Bpmn":return Lh;case"Native":return fh;case"HTML":return mh;case"UmlActivity":return Eh;case"UmlClassifier":return Wh;case"SwimLane":return Uh;case"Container":return t.header||(t.hasHeader=!1),Gh}return bh},gh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Property)("Basic")],i.prototype,"type",void 0),i}(e.ChildProperty),uh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Path"},ch([(0,e.Property)("Path")],i.prototype,"type",void 0),ch([(0,e.Property)("")],i.prototype,"data",void 0),i}(gh),fh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Native"},ch([(0,e.Property)("Native")],i.prototype,"type",void 0),ch([(0,e.Property)("")],i.prototype,"content",void 0),ch([(0,e.Property)("Stretch")],i.prototype,"scale",void 0),i}(gh),mh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Html"},ch([(0,e.Property)("HTML")],i.prototype,"type",void 0),ch([(0,e.Property)("")],i.prototype,"content",void 0),i}(gh),yh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Image"},ch([(0,e.Property)("Image")],i.prototype,"type",void 0),ch([(0,e.Property)("")],i.prototype,"source",void 0),ch([(0,e.Property)("None")],i.prototype,"scale",void 0),ch([(0,e.Property)("None")],i.prototype,"align",void 0),i}(gh),vh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Text"},ch([(0,e.Property)("Text")],i.prototype,"type",void 0),ch([(0,e.Property)("")],i.prototype,"content",void 0),ch([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),i}(gh),bh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BasicShape"},ch([(0,e.Property)("Basic")],i.prototype,"type",void 0),ch([(0,e.Property)("Rectangle")],i.prototype,"shape",void 0),ch([(0,e.Property)(0)],i.prototype,"cornerRadius",void 0),ch([(0,e.Collection)([],o)],i.prototype,"points",void 0),i}(gh),Sh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"FlowShape"},ch([(0,e.Property)("Flow")],i.prototype,"type",void 0),ch([(0,e.Property)("Terminator")],i.prototype,"shape",void 0),i}(gh),wh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnGateway"},ch([(0,e.Property)("None")],i.prototype,"type",void 0),i}(e.ChildProperty),xh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnDataObject"},ch([(0,e.Property)("None")],i.prototype,"type",void 0),ch([(0,e.Property)(!1)],i.prototype,"collection",void 0),i}(e.ChildProperty),Ih=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Property)("None")],i.prototype,"type",void 0),ch([(0,e.Property)("None")],i.prototype,"loop",void 0),ch([(0,e.Property)(!1)],i.prototype,"call",void 0),ch([(0,e.Property)(!1)],i.prototype,"compensation",void 0),i}(e.ChildProperty),Ph=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnEvent"},ch([(0,e.Property)("Start")],i.prototype,"event",void 0),ch([(0,e.Property)("None")],i.prototype,"trigger",void 0),i}(e.ChildProperty),Ch=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnSubEvent"},ch([(0,e.Property)("None")],i.prototype,"trigger",void 0),ch([(0,e.Property)("Start")],i.prototype,"event",void 0),ch([(0,e.Property)("")],i.prototype,"id",void 0),ch([(0,e.Complex)({},o)],i.prototype,"offset",void 0),ch([(0,e.Collection)([],Ie)],i.prototype,"annotations",void 0),ch([(0,e.Collection)([],ye)],i.prototype,"ports",void 0),ch([(0,e.Property)()],i.prototype,"width",void 0),ch([(0,e.Property)()],i.prototype,"height",void 0),ch([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),ch([(0,e.Property)("Center")],i.prototype,"horizontalAlignment",void 0),ch([(0,e.Property)("Center")],i.prototype,"verticalAlignment",void 0),ch([(0,e.Property)(!0)],i.prototype,"visible",void 0),i}(e.ChildProperty),Th=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Complex)({id:"success",event:"End",offset:{x:1,y:.5}},Ch)],i.prototype,"success",void 0),ch([(0,e.Complex)({id:"failure",event:"Intermediate",trigger:"Error",offset:{x:.25,y:1}},Ch)],i.prototype,"failure",void 0),ch([(0,e.Complex)({id:"cancel",event:"Intermediate",trigger:"Cancel",offset:{x:.75,y:1}},Ch)],i.prototype,"cancel",void 0),i}(e.ChildProperty),Ah=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Property)("None")],i.prototype,"type",void 0),ch([(0,e.Property)(!1)],i.prototype,"adhoc",void 0),ch([(0,e.Property)("Default")],i.prototype,"boundary",void 0),ch([(0,e.Property)(!1)],i.prototype,"compensation",void 0),ch([(0,e.Property)("None")],i.prototype,"loop",void 0),ch([(0,e.Property)(!0)],i.prototype,"collapsed",void 0),ch([(0,e.Collection)([],Ch)],i.prototype,"events",void 0),ch([(0,e.Complex)({},Th)],i.prototype,"transaction",void 0),ch([(0,e.Property)(void 0)],i.prototype,"processes",void 0),i}(e.ChildProperty),Oh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnActivity"},ch([(0,e.Property)("Task")],i.prototype,"activity",void 0),ch([(0,e.Complex)({},Ih)],i.prototype,"task",void 0),ch([(0,e.Complex)({},Ah)],i.prototype,"subProcess",void 0),i}(e.ChildProperty),Dh=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnAnnotation"},ch([(0,e.Property)("")],i.prototype,"text",void 0),ch([(0,e.Property)("")],i.prototype,"id",void 0),ch([(0,e.Property)(0)],i.prototype,"angle",void 0),ch([(0,e.Property)()],i.prototype,"height",void 0),ch([(0,e.Property)()],i.prototype,"width",void 0),ch([(0,e.Property)(0)],i.prototype,"length",void 0),i}(e.ChildProperty),Mh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Property)("")],i.prototype,"textAnnotationTarget",void 0),ch([(0,e.Property)("Auto")],i.prototype,"textAnnotationDirection",void 0),i}(e.ChildProperty),Lh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"BpmnShape"},ch([(0,e.Property)("Bpmn")],i.prototype,"type",void 0),ch([(0,e.Property)("Event")],i.prototype,"shape",void 0),ch([(0,e.Complex)({},Ph)],i.prototype,"event",void 0),ch([(0,e.Complex)({},wh)],i.prototype,"gateway",void 0),ch([(0,e.Complex)({},xh)],i.prototype,"dataObject",void 0),ch([(0,e.Complex)({},Oh)],i.prototype,"activity",void 0),ch([(0,e.Complex)({},Dh)],i.prototype,"annotation",void 0),ch([(0,e.Collection)([],Dh)],i.prototype,"annotations",void 0),ch([(0,e.Complex)({},Mh)],i.prototype,"textAnnotation",void 0),i}(gh),Eh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlActivityShape"},ch([(0,e.Property)("UmlActivity")],i.prototype,"type",void 0),ch([(0,e.Property)("Action")],i.prototype,"shape",void 0),i}(gh),zh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"MethodArguments"},ch([(0,e.Property)("")],i.prototype,"name",void 0),ch([(0,e.Property)("")],i.prototype,"type",void 0),ch([(0,e.Complex)({},Nt)],i.prototype,"style",void 0),i}(e.ChildProperty),kh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlClassAttribute"},ch([(0,e.Property)("Public")],i.prototype,"scope",void 0),ch([(0,e.Property)(!1)],i.prototype,"isSeparator",void 0),ch([(0,e.Complex)({fill:"#F9F9F9",strokeColor:"#CCCCCC"},Bt)],i.prototype,"separatorStyle",void 0),i}(zh),Bh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlClassMethod"},ch([(0,e.Collection)([],zh)],i.prototype,"parameters",void 0),i}(kh),Rh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlClass"},ch([(0,e.Property)("")],i.prototype,"name",void 0),ch([(0,e.Collection)([],kh)],i.prototype,"attributes",void 0),ch([(0,e.Collection)([],Bh)],i.prototype,"methods",void 0),ch([(0,e.Complex)({},Nt)],i.prototype,"style",void 0),i}(e.ChildProperty),Nh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlInterface"},ch([(0,e.Property)(!1)],i.prototype,"isSeparator",void 0),ch([(0,e.Complex)({fill:"#F9F9F9",strokeColor:"#CCCCCC"},Bt)],i.prototype,"separatorStyle",void 0),i}(Rh),jh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlEnumerationMember"},ch([(0,e.Property)("")],i.prototype,"name",void 0),ch([(0,e.Property)("")],i.prototype,"value",void 0),ch([(0,e.Property)(!1)],i.prototype,"isSeparator",void 0),ch([(0,e.Complex)({fill:"#F9F9F9",strokeColor:"#CCCCCC"},Bt)],i.prototype,"separatorStyle",void 0),ch([(0,e.Complex)({},Nt)],i.prototype,"style",void 0),i}(e.ChildProperty),Hh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlEnumeration"},ch([(0,e.Property)("")],i.prototype,"name",void 0),ch([(0,e.Collection)([],jh)],i.prototype,"members",void 0),ch([(0,e.Complex)({},Nt)],i.prototype,"style",void 0),i}(e.ChildProperty),Wh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"UmlClassifierShape"},ch([(0,e.Property)("UmlClassifier")],i.prototype,"type",void 0),ch([(0,e.Complex)({},Rh)],i.prototype,"classShape",void 0),ch([(0,e.Complex)({},Nh)],i.prototype,"interfaceShape",void 0),ch([(0,e.Complex)({},Hh)],i.prototype,"enumerationShape",void 0),ch([(0,e.Property)("Class")],i.prototype,"classifier",void 0),i}(gh),_h=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"DiagramShape"},ch([(0,e.Property)("Basic")],i.prototype,"type",void 0),ch([(0,e.Property)("Rectangle")],i.prototype,"basicShape",void 0),ch([(0,e.Property)("Terminator")],i.prototype,"flowShape",void 0),ch([(0,e.Property)("Event")],i.prototype,"bpmnShape",void 0),ch([(0,e.Property)("Action")],i.prototype,"umlActivityShape",void 0),ch([(0,e.Property)("")],i.prototype,"data",void 0),ch([(0,e.Property)("")],i.prototype,"content",void 0),ch([(0,e.Property)("")],i.prototype,"textContent",void 0),ch([(0,e.Property)("Stretch")],i.prototype,"scale",void 0),ch([(0,e.Property)("")],i.prototype,"source",void 0),ch([(0,e.Property)("None")],i.prototype,"align",void 0),ch([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),ch([(0,e.Property)(0)],i.prototype,"cornerRadius",void 0),ch([(0,e.Collection)([],o)],i.prototype,"points",void 0),ch([(0,e.Complex)({},xh)],i.prototype,"dataObject",void 0),ch([(0,e.Complex)({},Ph)],i.prototype,"event",void 0),ch([(0,e.Complex)({},wh)],i.prototype,"gateway",void 0),ch([(0,e.Collection)([],Dh)],i.prototype,"annotations",void 0),ch([(0,e.Complex)({},Oh)],i.prototype,"activity",void 0),ch([(0,e.Complex)({},Dh)],i.prototype,"annotation",void 0),ch([(0,e.Complex)({},Hh)],i.prototype,"enumerationShape",void 0),ch([(0,e.Property)("Class")],i.prototype,"classifier",void 0),ch([(0,e.Complex)({},Rh)],i.prototype,"classShape",void 0),ch([(0,e.Complex)({},Nh)],i.prototype,"interfaceShape",void 0),i}(e.ChildProperty),Yh=function(t){function r(e,i,r,n){var o,a=t.call(this,e,i,r,n)||this;return a.isCanvasUpdate=!1,a.status="None",a.parentId="",a.showDefaultTooltipForPalette=!0,a.processId="",a.umlIndex=-1,a.outEdges=[],a.inEdges=[],a.isHeader=!1,a.isLane=!1,a.isPhase=!1,a.laneGrids=[],a.children&&a.children.length>0&&((o=r).style&&o.style.fill||(a.style.fill="transparent"),o.style&&o.style.strokeColor||(a.style.strokeColor="transparent")),a.shape&&"UmlActivity"===a.shape.type&&na(r,a),!a.shape||"SwimLane"!==a.shape.type&&"Container"!==a.shape.type||ta(r,a),a.ports&&a.ports.length&&ra(a),a}return lh(r,t),Object.defineProperty(r.prototype,"actualSize",{get:function(){return null!==this.wrapper?this.wrapper.actualSize:new i(this.width||0,this.height||0)},enumerable:!0,configurable:!0}),r.prototype.init=function(t){var i,r;i="SwimLane"!==this.shape.type?new Xt:new yr;switch(this.shape.changedProperties={},this.shape.oldProperties={},this.shape.type){case"Path":if((0,e.isBlazor)()||"Freehand"!==this.type){var n=new Qt;n.data=this.shape.data,i=n}else{(d=new Qt).data=p(this.shape.points),i=d}break;case"Image":var o=new Jt;o.source=this.shape.source,o.imageAlign=this.shape.align,o.imageScale=this.shape.scale,i=o;break;case"Text":var a=new Zt;a.content=this.shape.content,i=a,r=this.style,i.style=r;break;case"Basic":if((0,e.isBlazor)()||"Rectangle"!==this.shape.shape)if((0,e.isBlazor)()||"Polygon"!==this.shape.shape){var s=new Qt,h=ee(this.shape.shape);s.data=h,i=s}else{var d;(d=new Qt).data=c(this.shape.points),i=d}else(i=s=new Xt).cornerRadius=this.shape.cornerRadius;break;case"Flow":var l=new Qt,g=ke(this.shape.shape);l.data=g,i=l;break;case"UmlActivity":i=Ga(new Qt,i,this);break;case"Bpmn":if(t.bpmnModule){this.shape.activity&&"SubProcess"===this.shape.activity.activity&&!1===this.shape.activity.subProcess.collapsed&&(this.flip=tt.None,this.wrapper.flip=tt.None),i=t.bpmnModule.initBPMNContent(i,this,t),this.wrapper.elementActions=this.wrapper.elementActions|dt.ElementIsGroup;var u=this.shape.activity.subProcess;if(u.processes&&u.processes.length)for(var f=0,m=this.shape.activity.subProcess.processes;f<m.length;f++){var y=m[f];!t.nameTable[""+y]||t.nameTable[""+y].processId&&t.nameTable[""+y].processId!==this.id||(t.nameTable[""+y].processId=this.id,u.collapsed&&t.updateElementVisibility(t.nameTable[""+y].wrapper,t.nameTable[""+y],!u.collapsed),i.children.push(t.nameTable[""+y].wrapper))}}else console.warn('[WARNING] :: Module "BpmnDiagrams" is not available in Diagram component! You either misspelled the module name or forgot to load it.');break;case"Native":t.initNodeTemplate=!0;var v=new ne(this.id,t.element.id,t.nodeTemplate);!this.shape.content&&!t.nodeTemplate||this.shape.content&&("string"==typeof this.shape.content||!t.isReact)?v.content=this.shape.content:t.nodeTemplate&&(v.isTemplate=!0,v.template=v.content=Sd(v,!1,this)),this.shape.content&&"function"==typeof this.shape.content&&t.isReact&&(v.isTemplate=!0,v.templateFn=(0,e.compile)(this.shape.content),v.template=v.content=Sd(v,!1,this)),v.scale=this.shape.scale,i=v,t.initNodeTemplate=!1;break;case"HTML":t.initNodeTemplate=!0;var b=new Bi(this.id,t.element.id,void 0,t.nodeTemplate);!this.shape.content||"string"!=typeof this.shape.content&&t.isReact?t.nodeTemplate&&(b.isTemplate=!0,b.template=b.content=Sd(b,!0,this)):b.content=this.shape.content,this.shape.content&&"function"==typeof this.shape.content&&t.isReact&&(b.isTemplate=!0,b.templateFn=(0,e.compile)(this.shape.content),b.template=b.content=Sd(b,!0,this)),i=b,t.initNodeTemplate=!1;break;case"UmlClassifier":i=Gs(i,this,t);break;case"Container":this.constraints|=ht.ReadOnly|ht.AllowDrop,this.flip=tt.None,this.wrapper.flip=tt.None,i=th(i,this,t);break;case"SwimLane":this.annotations=[],this.ports=[],this.flip=tt.None,this.wrapper.flip=tt.None,i.cellStyle.fill="none",i.cellStyle.strokeColor="none",this.container={type:"Grid",orientation:this.shape.orientation},i.id=this.id,i.pivot=this.pivot,this.container.orientation=this.shape.orientation,this.constraints|=ht.HideThumbs,Ir(i,t,this)}return i.id=this.id+"_content",i.relativeMode="Object","Basic"===this.shape.type&&"Rectangle"===this.shape.shape?i.shapeType="Rectangle":i.shapeType="Others",void 0!==this.width&&(i.width=this.width),i.horizontalAlignment="Stretch",void 0!==this.height&&(i.height=this.height),void 0!==this.minHeight&&(i.minHeight=this.minHeight),void 0!==this.maxHeight&&(i.maxHeight=this.maxHeight),void 0!==this.minWidth&&(i.minWidth=this.minWidth),void 0!==this.maxWidth&&(i.maxWidth=this.maxWidth),(0,e.isBlazor)()||"Rectangle"!==this.shape.shape||this.shape.cornerRadius||(i.isRectElement=!0),i.verticalAlignment="Stretch",this.shape instanceof vh&&(i.margin=this.shape.margin),!qi(this)||"Freehand"===this.type||"Bpmn"===this.shape.type&&"TextAnnotation"!==this.shape.shape||0!==(this.constraints&ht.Shadow)&&this.visible&&(i.shadow=this.shadow),"Bpmn"===this.shape.type&&((0,e.isBlazor)()||"Message"!==this.shape.shape)&&((0,e.isBlazor)()||"DataSource"!==this.shape.shape)||"UmlActivity"===this.shape.type&&((0,e.isBlazor)()||"FinalNode"===this.shape.shape)||"Text"!==this.shape.type&&(i.style=this.style,this.oldGradientValue=this.style.gradient?N(this.style.gradient):null),(this.wrapper.elementActions&dt.ElementIsGroup||this.flip!==tt.Horizontal)&&this.flip!==tt.Vertical||(i.flip=this.flip,i.flipMode=this.flipMode),i},r.prototype.initContainer=function(){var t;if(this.id||(this.id=E()),!this.container||this.shape instanceof Uh||"Container"===this.shape.type)t=this.children?new Ut:new te;else switch(this.container.type){case"Canvas":t=new te;break;case"Stack":t=new Us;break;case"Grid":(t=new yr).setDefinitions(this.rows,this.columns)}return t.id=this.id,t.offsetX=this.offsetX,t.offsetY=this.offsetY,t.visible=this.visible,t.horizontalAlignment=this.horizontalAlignment,t.verticalAlignment=this.verticalAlignment,this.container&&"SwimLane"!==this.shape.type&&(t.width=this.width,t.height=this.height,"Stack"===this.container.type&&(t.orientation=this.container.orientation)),t.style.fill=this.backgroundColor,t.style.strokeColor=this.borderColor,t.style.strokeWidth=this.borderWidth,t.rotateAngle=this.rotateAngle,t.minHeight=this.minHeight,t.minWidth=this.minWidth,t.maxHeight=this.maxHeight,t.maxWidth=this.maxWidth,t.pivot=this.pivot,t.margin=this.margin,t.flip=this.flip,t.flipMode=this.flipMode,this.wrapper=t,t},r.prototype.initPorts=function(t,e){for(var i=0;this.ports,i<this.ports.length;i++)this.initPort(t,e,this.ports[parseInt(i.toString(),10)])},r.prototype.initPort=function(t,e,i){var r,n,o=this.wrapper;r=this.initPortWrapper(i,this);var a=J(t);a&&(n=a(r,this)),r.description=n||r.id,r.inversedAlignment=o.inversedAlignment,r.elementActions=r.elementActions|dt.ElementIsPort,e.children.push(r)},r.prototype.getIconOffet=function(t,e){var i,r;return"BottomToTop"===t.orientation?(i=e.offset.x,r=1-e.offset.y):"LeftToRight"===t.orientation?(i=e.offset.y,r=e.offset.x):"RightToLeft"===t.orientation?(i=1-e.offset.y,r=e.offset.x):(i=e.offset.x,r=e.offset.y),{x:i,y:r}},r.prototype.initIcons=function(t,e,i,r){var n,o=this.wrapper,a=this.isExpanded?this.expandIcon:this.collapseIcon;if("None"!==a.shape){var s=new te;s.float=!0;s.id=this.id+"_icon_content",s.children=[],s.height=a.height,s.width=a.width,s.style.strokeColor="transparent",s.margin=a.margin,s.horizontalAlignment="Center",s.verticalAlignment="Center",s.visible=this.visible,s.cornerRadius=a.cornerRadius,n=this.getIconOffet(e,a),s.setOffsetWithRespectToBounds(n.x,n.y,"Fraction"),s.relativeMode="Point",this.initIconSymbol(a,s,t,r);var h=void 0,d=J(t);d&&(h=d(a,this)),s.description=h||s.id,s.inversedAlignment=o.inversedAlignment,i.children.push(s)}},r.prototype.initFixedUserHandles=function(t,e,i){var r;if(""===t.pathData&&e)(r=new Bi(this.id,i,void 0,e)).isTemplate=!0,r.template=Sd(r,!0,t),t.id=t.id||E(),r.id=this.id+"_"+t.id;else{var n=this.wrapper;(r=new te).children=[],t.id=t.id||E(),r.id=this.id+"_"+t.id;var o=va(t,r);r.children.push(o),r.inversedAlignment=n.inversedAlignment}r.float=!0,r.height=t.height,r.width=t.width,r.style.strokeColor=t.handleStrokeColor,r.style.fill=t.fill,r.style.strokeWidth=t.handleStrokeWidth,r.margin=t.margin,r.visible=t.visibility,r.cornerRadius=t.cornerRadius,r.horizontalAlignment="Center",r.verticalAlignment="Center";var a=this.getfixedUserHandleOffet(t);return r.setOffsetWithRespectToBounds(a.x,a.y,"Fraction"),r.relativeMode="Point",r.description=r.id,r},r.prototype.getfixedUserHandleOffet=function(t){return{x:t.offset.x,y:t.offset.y}},r.prototype.initAnnotations=function(t,e,i,r,n){for(var o,a=0;this.annotations,a<this.annotations.length;a++){o=this.initAnnotationWrapper(this.annotations[parseInt(a.toString(),10)],i,r,a,n);var s=void 0,h=J(t);h&&(s=h(o,this)),o.description=s||o.id,o.inversedAlignment=e.inversedAlignment,e.children.push(o)}},r.prototype.initPortWrapper=function(t,e){t.id=t.id||E();var i=new Qt;i.height=t.height,i.width=t.width,i.connectionDirection=t.connectionDirection,t.shape=t.shape||"Square";var r="Custom"===t.shape?t.pathData:Ce(t.shape);i.id=this.id+"_"+t.id,i.margin=t.margin,i.data=r,e&&"Bpmn"===e.shape.type&&(i.flip=this.flip);var n=t.style;return i.style={fill:n.fill,strokeColor:n.strokeColor,gradient:null,opacity:n.opacity,strokeDashArray:n.strokeDashArray,strokeWidth:n.strokeWidth},i.horizontalAlignment=t.horizontalAlignment,i.verticalAlignment=t.verticalAlignment,i="None"!==this.flipMode&&"Label"!==this.flipMode&&"LabelText"!==this.flipMode&&"LabelAndLabelText"!==this.flipMode?Ss(i,this.flip,t):Ss(i,tt.None,t),void 0===this.width&&void 0===this.height||(i.float=!0),i.relativeMode="Point",i.visible=!(!es(t,et.Visible)||es(t,et.Hover)||es(t,et.Connect)),i.elementActions=i.elementActions|dt.ElementIsPort,i},r.prototype.initAnnotationWrapper=function(t,i,r,n,o){t.content=t.content||"",t.id=t.id||n+"annotation"||0;var a,s=t;if(i&&(t.template||"Template"===t.annotationType||o&&""===t.content)){a=new Bi(this.id,i,t.id,o);var h=document.getElementById(i).ej2_instances[0];t.template&&"function"==typeof t.template&&h.isReact&&(a.templateFn=(0,e.compile)(t.template),a.isTemplate=!0),a=Td(a,t,o,h)}else{(a=new Zt).canMeasure=!r;var d=t.style,l=t.hyperlink.link?t.hyperlink:void 0;a.style={fill:d.fill,strokeColor:d.strokeColor,strokeWidth:d.strokeWidth,bold:d.bold,textWrapping:d.textWrapping,color:l?l.color||a.hyperlink.color:d.color,whiteSpace:d.whiteSpace,fontFamily:d.fontFamily,fontSize:d.fontSize,italic:d.italic,gradient:null,opacity:d.opacity,strokeDashArray:d.strokeDashArray,textAlign:d.textAlign,textOverflow:t.style.textOverflow,textDecoration:l?l.textDecoration||a.hyperlink.textDecoration:d.textDecoration},a.hyperlink.link=t.hyperlink.link||void 0,a.hyperlink.hyperlinkOpenState=t.hyperlink.hyperlinkOpenState||void 0,a.hyperlink.content=t.hyperlink.content||void 0,a.hyperlink.textDecoration=t.hyperlink.textDecoration||void 0,a.content=l?l.content||a.hyperlink.link:t.content}return a.constraints=t.constraints,a.height=t.height,a.width=t.width,a.visible=t.visibility,a.annotationVisibility=a.visible?"Visible":"Collapsed",a.rotateAngle=t.rotateAngle,a.rotationReference=t.rotationReference,a.id=this.id+"_"+t.id,void 0===this.width||t.template||void 0===t.width&&("Wrap"!==t.style.textWrapping&&"WrapWithOverflow"!==t.style.textWrapping||(a.width=this.width)),a.margin=t.margin,a.horizontalAlignment=t.horizontalAlignment,a.verticalAlignment=t.verticalAlignment,a.setOffsetWithRespectToBounds(s.offset.x,s.offset.y,"Fraction"),void 0===this.width&&void 0===this.height||(a.float=!0),a.relativeMode="Point",a},r.prototype.initIconContainer=function(t,e){var i=new Xt;return i.id=e.id+"_rect",i.height=t.height,i.width=t.width,i.visible=e.visible,i.margin=t.margin,i.cornerRadius=t.cornerRadius,i.style={fill:t.fill,strokeColor:t.borderColor,strokeWidth:t.borderWidth},i.setOffsetWithRespectToBounds(.5,.5,"Fraction"),i.horizontalAlignment="Center",i.verticalAlignment="Center",i.relativeMode="Object",i.description=i.description||"Click here to expand or collapse",i},r.prototype.initIconSymbol=function(t,e,i,r){var n;if(e.children.push(this.initIconContainer(t,e)),"Template"===t.shape)(n=new ne(this.id,r)).content=t.content,n.height=10,n.width=10;else{(n=new Qt).data=De(t);var o=Jh(n.data);n.height=o.height<10?o.height:10-(t.padding.bottom+t.padding.top),n.width=o.width<10?o.width:10-(t.padding.left+t.padding.right)}n.id=e.id+"_shape",n.horizontalAlignment="Center",n.verticalAlignment="Center",n.visible=e.visible,n.visible=e.visible,n.style={fill:"black",strokeColor:t.iconColor,strokeWidth:t.borderWidth},n.setOffsetWithRespectToBounds(.5,.5,"Fraction"),n.relativeMode="Object",n.description=e.description||"Click here to expand or collapse",e.children.push(n)},r.prototype.getClassName=function(){return"Node"},ch([(0,e.Collection)([],Ie)],r.prototype,"annotations",void 0),ch([(0,e.Property)(0)],r.prototype,"offsetX",void 0),ch([(0,e.Complex)({},$s)],r.prototype,"layoutInfo",void 0),ch([(0,e.Property)(0)],r.prototype,"offsetY",void 0),ch([(0,e.Collection)([],ye)],r.prototype,"ports",void 0),ch([(0,e.Property)(!0)],r.prototype,"isExpanded",void 0),ch([(0,e.Collection)([],Hi)],r.prototype,"fixedUserHandles",void 0),ch([(0,e.Complex)({},Xs)],r.prototype,"expandIcon",void 0),ch([(0,e.Complex)({},Xs)],r.prototype,"collapseIcon",void 0),ch([(0,e.Complex)({x:.5,y:.5},o)],r.prototype,"pivot",void 0),ch([(0,e.Property)()],r.prototype,"width",void 0),ch([(0,e.Property)()],r.prototype,"height",void 0),ch([(0,e.Property)()],r.prototype,"minWidth",void 0),ch([(0,e.Property)()],r.prototype,"minHeight",void 0),ch([(0,e.Property)()],r.prototype,"maxWidth",void 0),ch([(0,e.Property)()],r.prototype,"maxHeight",void 0),ch([(0,e.Property)(0)],r.prototype,"rotateAngle",void 0),ch([(0,e.Complex)({fill:"white"},Nt)],r.prototype,"style",void 0),ch([(0,e.Property)("transparent")],r.prototype,"backgroundColor",void 0),ch([(0,e.Property)("none")],r.prototype,"borderColor",void 0),ch([(0,e.Property)(0)],r.prototype,"borderWidth",void 0),ch([(0,e.Property)()],r.prototype,"data",void 0),ch([(0,e.ComplexFactory)(ph)],r.prototype,"shape",void 0),ch([(0,e.Complex)({},Di)],r.prototype,"previewSize",void 0),ch([(0,e.Complex)({},Di)],r.prototype,"dragSize",void 0),ch([(0,e.Property)(null)],r.prototype,"wrapper",void 0),ch([(0,e.Property)(ht.Default)],r.prototype,"constraints",void 0),ch([(0,e.Complex)({},Dt)],r.prototype,"shadow",void 0),ch([(0,e.Property)()],r.prototype,"children",void 0),ch([(0,e.Complex)({left:0,right:0,top:0,bottom:0},Ot)],r.prototype,"padding",void 0),ch([(0,e.Property)(null)],r.prototype,"container",void 0),ch([(0,e.Property)("Left")],r.prototype,"horizontalAlignment",void 0),ch([(0,e.Property)("Top")],r.prototype,"verticalAlignment",void 0),ch([(0,e.Property)()],r.prototype,"rows",void 0),ch([(0,e.Property)()],r.prototype,"columns",void 0),ch([(0,e.Property)()],r.prototype,"rowIndex",void 0),ch([(0,e.Property)()],r.prototype,"columnIndex",void 0),ch([(0,e.Property)()],r.prototype,"rowSpan",void 0),ch([(0,e.Property)()],r.prototype,"columnSpan",void 0),ch([(0,e.Property)("")],r.prototype,"branch",void 0),r}(zi),Fh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),ch([(0,e.Property)("")],i.prototype,"id",void 0),ch([(0,e.Complex)({},Ie)],i.prototype,"annotation",void 0),ch([(0,e.Complex)({fill:"#FFFFFF",strokeColor:"#CCCCCC"},Bt)],i.prototype,"style",void 0),ch([(0,e.Property)(50)],i.prototype,"height",void 0),ch([(0,e.Property)(50)],i.prototype,"width",void 0),i}(e.ChildProperty),Xh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Lane"},ch([(0,e.Property)("")],i.prototype,"id",void 0),ch([(0,e.Complex)({fill:"#F9F9F9",strokeColor:"#CCCCCC"},Bt)],i.prototype,"style",void 0),ch([(0,e.Collection)([],Yh)],i.prototype,"children",void 0),ch([(0,e.Property)(100)],i.prototype,"height",void 0),ch([(0,e.Property)(100)],i.prototype,"width",void 0),ch([(0,e.Complex)({style:{fill:"#E7F4FF",strokeColor:"#CCCCCC"},annotation:{content:"Function"}},Fh)],i.prototype,"header",void 0),ch([(0,e.Property)(!0)],i.prototype,"canMove",void 0),ch([(0,e.Property)()],i.prototype,"addInfo",void 0),i}(e.ChildProperty),Vh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.getClassName=function(){return"Phase"},ch([(0,e.Property)("")],i.prototype,"id",void 0),ch([(0,e.Complex)({fill:"#FFFFFF",strokeColor:"#CCCCCC"},Bt)],i.prototype,"style",void 0),ch([(0,e.Complex)({annotation:{content:"Phase"}},Fh)],i.prototype,"header",void 0),ch([(0,e.Property)(100)],i.prototype,"offset",void 0),ch([(0,e.Property)()],i.prototype,"addInfo",void 0),i}(e.ChildProperty),Uh=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.padding=20,e.hasHeader=!0,e}return lh(i,t),i.prototype.getClassName=function(){return"SwimLane"},ch([(0,e.Property)("SwimLane")],i.prototype,"type",void 0),ch([(0,e.Property)(20)],i.prototype,"phaseSize",void 0),ch([(0,e.Collection)([],Vh)],i.prototype,"phases",void 0),ch([(0,e.Property)("Horizontal")],i.prototype,"orientation",void 0),ch([(0,e.Collection)([],Xh)],i.prototype,"lanes",void 0),ch([(0,e.Complex)({style:{fill:"#E7F4FF",strokeColor:"#CCCCCC"},annotation:{content:"Function"}},Fh)],i.prototype,"header",void 0),ch([(0,e.Property)(!1)],i.prototype,"isLane",void 0),ch([(0,e.Property)(!1)],i.prototype,"isPhase",void 0),i}(gh),Gh=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasHeader=!0,e}return lh(i,t),i.prototype.getClassName=function(){return"Container"},ch([(0,e.Property)("Container")],i.prototype,"type",void 0),ch([(0,e.Complex)({},Fh)],i.prototype,"header",void 0),ch([(0,e.Property)()],i.prototype,"children",void 0),i}(gh),Zh=function(){function t(){}return t.prototype.getClassName=function(){return"ChildContainer"},ch([(0,e.Property)("Canvas")],t.prototype,"type",void 0),ch([(0,e.Property)("Vertical")],t.prototype,"orientation",void 0),t}(),qh=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lh(i,t),i.prototype.init=function(t){var e=new Ut;if(e.measureChildren=!1,e.children=[],this.annotation){var i=this.nodes.length>0?t.nameTable[this.nodes[0].id].wrapper:t.nameTable[this.connectors[0].id].wrapper,r=t.getWrapper(i,this.annotation.id);e.children.push(r)}else if(this.nodes||this.connectors){for(var n=0;n<this.nodes.length;n++){r=t.nameTable[this.nodes[parseInt(n.toString(),10)].id].wrapper;e.children.push(r)}for(var o=0;o<this.connectors.length;o++){r=t.nameTable[this.connectors[parseInt(o.toString(),10)].id].wrapper;e.children.push(r)}}var a=t.isProtectedOnChange;return t.protectPropertyChange(!1),this.wrapper=e,t.protectPropertyChange(a),e},ch([(0,e.Property)(null)],i.prototype,"wrapper",void 0),ch([(0,e.Property)(14)],i.prototype,"handleSize",void 0),ch([(0,e.Collection)([],Yh)],i.prototype,"nodes",void 0),ch([(0,e.Collection)([],Co)],i.prototype,"connectors",void 0),ch([(0,e.Property)()],i.prototype,"width",void 0),ch([(0,e.Property)()],i.prototype,"height",void 0),ch([(0,e.Property)(0)],i.prototype,"rotateAngle",void 0),ch([(0,e.Property)(0)],i.prototype,"offsetX",void 0),ch([(0,e.Property)(0)],i.prototype,"offsetY",void 0),ch([(0,e.Complex)({x:.5,y:.5},o)],i.prototype,"pivot",void 0),ch([(0,e.Property)("CompleteIntersect")],i.prototype,"rubberBandSelectionMode",void 0),ch([(0,e.Collection)([],No)],i.prototype,"userHandles",void 0),ch([(0,e.Property)(rt.All)],i.prototype,"constraints",void 0),ch([(0,e.Property)()],i.prototype,"setTooltipTemplate",void 0),ch([(0,e.Collection)([],Yh)],i.prototype,"selectedObjects",void 0),ch([(0,e.Property)(!1)],i.prototype,"canToggleSelection",void 0),i}(e.ChildProperty);function Qh(t){var i,r=[];if("msie"===e.Browser.info.name||"edge"===e.Browser.info.name)for(var n=0;n<t.childNodes.length;n++)1===(i=t.childNodes[parseInt(n.toString(),10)]).nodeType&&r.push(i);else r=t.children;return r}var Kh={};function Jh(t){if(t){if(Kh[""+t])return Kh[""+t];var e="measureElement";window[""+e].style.visibility="visible";var i=Qh(window[""+e].children[2])[0];i.setAttribute("d",t);var r=i.getBBox(),n=new w(r.x,r.y,r.width,r.height);return window[""+e].style.visibility="hidden",Kh[""+t]=n,n}return new w(0,0,0,0)}function $h(t,e,r,n,o){var a=new i,s=ud("span",{style:"position:absolute; display:inline-block; line-height:normal; left:0px; top:0px"});return t.bold&&(s.style.fontWeight="bold"),t.italic&&(s.style.fontStyle="italic"),void 0!==r&&(s.style.width=r.toString()+"px"),void 0!==n&&(s.style.height=n.toString()+"px"),void 0!==o&&(s.style.maxWidth=o.toString()+"px"),s.style.fontFamily=t.fontFamily,s.style.fontSize=t.fontSize+"px",s.style.color=t.color,s.textContent=e,s.style.whiteSpace=Z(t.whiteSpace,t.textWrapping),s.style.wordBreak=void 0!==o?"break-word":F(t.textWrapping),document.body.appendChild(s),a.width=s.offsetWidth,a.height=s.offsetHeight,document.body.removeChild(s),a}function td(t,e,i,r){var n,o=0,a=0,s=!1,d=e;return 0===d.x&&0===d.y||(o=0-Number(d.x),a=0-Number(d.y)),(t.actualSize.width!==d.width||t.actualSize.height!==d.height||r)&&(o=(r&&r.width||t.actualSize.width)/Number(d.width?d.width:1),a=(r&&r.height||t.actualSize.height)/Number(d.height?d.height:1),s=!0),n=u(y(h(t.data)),o,a,s,d.x,d.y,0,0),s=!1,n}function ed(t){return id(t).getElementsByClassName("e-diagram-layer")[0]}function id(t,i){var r;return i&&(r=document.getElementById(i)),"msie"===e.Browser.info.name||"edge"===e.Browser.info.name?r?r.querySelector("#"+t):document.getElementById(t):r?r.querySelector("#"+CSS.escape(t)):document.getElementById(t)}function rd(t,e,i){var r,n,o="";"native"===i?(r=pd(t),o="_content_groupElement"):"html"===i?(r=gd(t).childNodes[0],o="_html_element"):(r=ed(n=t).getElementById(n+"_diagramLayer"),o="_groupElement");var a=e+o,s=document.getElementById(a);if(s&&r.contains(s))return Array.prototype.indexOf.call(r.childNodes,s)}function nd(t){return id(t).getElementsByClassName("e-adorner-layer")[0]}function od(t){return nd(t).getElementById(t+"_SelectorElement")}function ad(t){return nd(t).getElementById(t+"_diagramAdorner")}function sd(t){return id(t).getElementsByClassName("e-userHandle-layer")[0]}function hd(t){return id(t).getElementsByClassName("e-native-layer")[0]}function dd(t){return id(t).getElementsByClassName("e-grid-layer")[0]}function ld(t){return id(t).getElementsByClassName("e-background-layer")[0].parentNode}function cd(t){return id(t).getElementsByClassName("e-background-layer")[0]}function pd(t){return hd(t).getElementById(t+"_nativeLayer")}function gd(t){var e=null,i="domTable";window[i][t+"html_layer"]?e=window[i][t+"html_layer"]:(e=id(t).getElementsByClassName("e-html-layer")[0],window[i][t+"html_layer"]=e);return e}function ud(t,i){var r=(0,e.createElement)(t);return Id(r,i),r}function fd(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return wd(i,e),i}function md(t,e,i){for(var r=t;r&&!(i?r.id===e:yd(r,e));)r=r.parentNode;return r}function yd(t,e){return(" "+("object"==typeof t.className?t.className.animVal:t.className)+" ").indexOf(" "+e+" ")>-1}function vd(t,e,i){t=[];for(var r=0,n=i.length;r<n;r++)t.push({pageX:i[parseInt(r.toString(),10)].clientX,pageY:i[parseInt(r.toString(),10)].clientY,pointerId:null});return t}function bd(t,e){var i=id(t,e);i&&i.parentNode.removeChild(i)}function Sd(t,i,r){var n;if(i){n=ud("div",{style:"height: 100%; width: 100%"})}else n=document.createElementNS("http://www.w3.org/2000/svg","g");var o,a=document.getElementById(t.diagramId).ej2_instances[0];a.initNodeTemplate&&a instanceof sc||(o=gs(t));var s,h,d={};if(!o&&a.initNodeTemplate?(d=d=a.tempTable&&a.tempTable[t.nodeId]||d,s="nodeTemplate"):o instanceof Yh?(d=o,s="nodeTemplate"):(d=o,s="annotationTemplate"),"string"!=typeof t.content&&"function"!=typeof t.content||t.isTemplate)if(t.isTemplate){p=void 0;if(a.isReact)p=t.getNodeTemplate()(N(r),a,s+"_"+("nodeTemplate"===s?r.id:t.nodeId+r.id),void 0,void 0,!1,n);else if(a.isVue||a.isVue3){p=t.getNodeTemplate()?t.getNodeTemplate()(N(r),a,s+"_"+("nodeTemplate"===s?r.id:t.nodeId+r.id),void 0,void 0,!1,n):(p="nodeTemplate"===s?(0,e.compile)(a.nodeTemplate):(0,e.compile)(a.annotationTemplate))(N(r),a,s+"_"+("nodeTemplate"===s?r.id:t.nodeId+r.id),void 0,void 0,!1,n)}else p=t.getNodeTemplate()(N(r),a,s+"_"+("nodeTemplate"===s?r.id:t.nodeId+r.id),void 0,void 0,!1);if(p)for(var l=0;l<p.length;l++)n.appendChild(p[parseInt(l.toString(),10)])}else t.content&&t.content.outerHTML&&n.appendChild(t.content);else{var c=document.getElementById(t.content);if(c)n.appendChild(c);else for(var p=void 0,g=0,u=(p=(0,e.compile)(t.content))(d,a,s,"");g<u.length;g++)h=u[g],n.appendChild(h)}return t.isTemplate?n:n.cloneNode(!0)}function wd(t,e){for(var i=Object.keys(e),r=0;r<i.length;r++)t&&"style"!==i[parseInt(r.toString(),10)]?t.setAttribute(i[parseInt(r.toString(),10)],e[i[parseInt(r.toString(),10)]]):xd(t,e[i[parseInt(r.toString(),10)]])}function xd(t,e){for(var i=e.split(";"),r=0;r<i.length;r++){var n=i[parseInt(r.toString(),10)].split(":");2===n.length&&(t.style[n[0].trim()]=n[1].trim())}}function Id(t,e){for(var i=Object.keys(e),r=0;r<i.length;r++)"style"!==i[parseInt(r.toString(),10)]?t.setAttribute(i[parseInt(r.toString(),10)],e[i[parseInt(r.toString(),10)]]):xd(t,e[i[parseInt(r.toString(),10)]])}function Pd(){var t="measureElement";if(window[""+t])window[""+t].usageCount+=1;else{var e=ud("div",{id:"measureElement",style:"visibility:hidden ; height: 0px ; width: 0px; overflow: hidden;"}),i=ud("span",{style:"display:inline-block ; line-height: normal"});e.appendChild(i);var r=ud("img",{alt:"measureElementImage",src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"});e.appendChild(r);var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),e.appendChild(n);var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",""),n.appendChild(o);document.createTextNode("");var a=document.createElementNS("http://www.w3.org/2000/svg","text");a.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),n.appendChild(a),window[""+t]=e,window[""+t].usageCount=1,document.body.appendChild(e);var s="measureElementCount";window[""+s]?window[""+s]++:window[""+s]=1}}function Cd(t,e,i,r){return!(e.length>=1&&0===t.x)||"Clip"!==r.textOverflow&&"Ellipsis"!==r.textOverflow||"Wrap"!==r.textWrapping&&"WrapWithOverflow"!==r.textWrapping||(t.x=e[i-1]?e[i-1].x:-t.width/2),t.x}function Td(t,e,i,r){return i&&!e.template||e.template&&"function"==typeof e.template&&r.isReact?(t.isTemplate=!0,t.template=t.content=Sd(t,!0,e)):t.content=e.template,t}var Ad,Od,Dd,Md=function(){function t(){}return t.getContext=function(t){return t.getContext("2d")},t.setCanvasSize=function(t,e,i){t&&(t.setAttribute("width",e.toString()),t.setAttribute("height",i.toString()))},t.prototype.renderGradient=function(t,e,i,r){var n,o,a;if("None"!==t.gradient.type){for(var s=0;s<t.gradient.stops.length;s++)n=void 0!==n?t.gradient.stops[parseInt(s.toString(),10)].offset:Math.max(n,t.gradient.stops[parseInt(s.toString(),10)].offset),o=void 0!==o?t.gradient.stops[parseInt(s.toString(),10)].offset:Math.min(o,t.gradient.stops[parseInt(s.toString(),10)].offset);if("Linear"===t.gradient.type){var h=t.gradient,d=h.x1,l=h.x2,c=h.y1,p=h.y2;if(h.controlParent instanceof sc&&"SVG"===h.controlParent.mode&&(d=t.width?d*t.width/100:d,l=t.width?l*t.width/100:l,c=t.height?c*t.height/100:c,p=t.height?p*t.height/100:p,d!==l&&c!==p)){var g=l-d,u=p-c,f=Math.atan2(u,g),m=f*(180/Math.PI)%360,y=(90-(m=m<0?m+360:m))*(Math.PI/180),v=g*Math.sin(f)+u*Math.cos(f);l=d+v*Math.cos(y),p=c+v*Math.sin(y)}a=e.createLinearGradient(i+d,r+c,i+l,r+p)}else{var b=t.gradient;a=e.createRadialGradient(i+b.fx,r+b.fy,0,i+b.cx,r+b.cy,b.r)}for(s=0;s<t.gradient.stops.length;s++){var S=t.gradient.stops[parseInt(s.toString(),10)],w=o<0?(n+S.offset)/(2*n):S.offset/n;a.addColorStop(w,S.color)}e.fillStyle=a}return e},t.prototype.renderShadow=function(e,i,r){void 0===r&&(r=null);var n=t.getContext(i);n.save(),n.beginPath(),n.strokeStyle=n.fillStyle=e.shadow.color,n.globalAlpha=e.shadow.opacity;var a=o.transform({x:0,y:0},e.shadow.angle,e.shadow.distance),s=e.x+a.x,h=e.y+a.y,d=s+e.width*e.pivotX,l=h+e.height*e.pivotY;this.rotateContext(i,e.angle,d,l),r?(n.translate(s,h),this.renderPath(i,e,r),n.translate(-s,-h)):(n.rect(s,h,e.width,e.height),n.fillRect(s,h,e.width,e.height)),n.fill(),n.stroke(),n.closePath(),n.restore()},t.createCanvas=function(t,e,i){var r=ud("canvas",{id:t});return this.setCanvasSize(r,e,i),r},t.prototype.setStyle=function(e,i){var r=t.getContext(e);"none"===i.fill&&(i.fill="transparent"),"none"===i.stroke&&(i.stroke="transparent"),r.strokeStyle=i.stroke,r.lineWidth=i.strokeWidth,0===i.strokeWidth&&(r.strokeStyle="transparent"),r.globalAlpha=i.opacity;var n=[];i.dashArray&&(n=this.parseDashArray(i.dashArray)),r.setLineDash(n),i.gradient&&"None"!==i.gradient.type?"Rectangle"===i.shapeType?this.renderGradient(i,r,i.x,i.y):this.renderGradient(i,r,0,0):r.fillStyle=i.fill},t.prototype.rotateContext=function(e,i,r,n){var o=t.getContext(e);o.translate(r,n),o.rotate(i*Math.PI/180),o.translate(-r,-n)},t.prototype.setFontStyle=function(e,i){var r=t.getContext(e),n="";i.italic&&(n+="italic "),i.bold&&(n+="bold "),n+=i.fontSize+"px ",n+=i.fontFamily,r.font=n},t.prototype.parseDashArray=function(t){for(var e=[],i=-1!==t.indexOf(" ")?" ":",",r=0,n=t.split(i);r<n.length;r++){var o=n[r];e.push(Number(o))}return e},t.prototype.drawRoundedRect=function(e,i){var r=t.getContext(e);r.beginPath();var n=i.x,o=i.y,a=i.width,s=i.height,h=n+a/2,d=o+s/2;r.beginPath(),this.setStyle(e,i),r.moveTo(n,d),r.quadraticCurveTo(n,o,h,o),r.quadraticCurveTo(n+a,o,n+a,d),r.quadraticCurveTo(n+a,o+s,h,o+s),r.quadraticCurveTo(n,o+s,n,d),r.fill(),r.stroke()},t.prototype.drawRectangle=function(e,i,r,n,o,a,s,h,d,c,p){if(!0===i.visible)if(i.cornerRadius)!n&&(i.width<30||i.height<30)?this.drawRoundedRect(e,i):(i.data=l(i.cornerRadius,i.height,i.width),this.drawPath(e,i,r,o,a,s,void 0,c,p));else{var g=t.getContext(e);i.shadow&&this.renderShadow(i,e),g.save(),g.beginPath();i.cornerRadius;var u=i.x+i.width*i.pivotX,f=i.y+i.height*i.pivotY;if(i.textWrapping&&i.wrapBounds)this.applyFlipAndRotate(g,i,e,u,f,c,p);else{var m=i.isImage?-i.angle:i.angle;this.rotateContext(e,m,u,f)}this.setStyle(e,i),g.rect(i.x,i.y,i.width,i.height),g.fillRect(i.x,i.y,i.width,i.height),g.fill(),g.stroke(),g.closePath(),g.restore()}},t.prototype.drawPath=function(e,i,r,n,o,a,s,d,l){var c=[];c=g(c=h(i.data)),i.shadow&&this.renderShadow(i,e,c);var p=t.getContext(e);p.save(),p.beginPath();var u=i.y+i.height*i.pivotY,f=i.x+i.width*i.pivotX;this.applyFlipAndRotate(p,i,e,f,u,d,l),this.setStyle(e,i),p.translate(i.x,i.y),this.renderPath(e,i,c),p.fill(),p.translate(-i.x,-i.y),p.stroke(),p.restore()},t.prototype.renderPath=function(e,i,r){if(!0===i.visible){var n,o=0,a=t.getContext(e),s=void 0,h=void 0,d=void 0,l=void 0,c=void 0,p=void 0,g=void 0,u=void 0,f=void 0,m=r;for(g=0,u=0,f=0,n=m.length;f<n;++f){var y=m[parseInt(f.toString(),10)],v=y.command;switch("x1"in y&&(d=y.x1),"x2"in y&&(c=y.x2),"y1"in y&&(l=y.y1),"y2"in y&&(p=y.y2),"x"in y&&(g=y.x),"y"in y&&(u=y.y),v){case"M":a.moveTo(g,u),y.x=g,y.y=u;break;case"L":a.lineTo(g,u),y.x=g,y.y=u;break;case"C":a.bezierCurveTo(d,l,c,p,g,u),y.x=g,y.y=u,y.x1=d,y.y1=l,y.x2=c,y.y2=p;break;case"Q":a.quadraticCurveTo(d,l,g,u),y.x=g,y.y=u,y.x1=d,y.y1=l;break;case"A":var b={x:s,y:h},S=void 0,w=void 0;i.arc&&i.arc.length>0?(S=0===y.r1?i.arc[parseInt(o.toString(),10)].r1:y.r1,w=0===y.r2?i.arc[parseInt(o.toString(),10)].r2:y.r2,o++):(S=y.r1,w=y.r2);var x=y.angle*(Math.PI/180),I=y.largeArc,P=y.sweep,C={x:g,y:u},T={x:Math.cos(x)*(b.x-C.x)/2+Math.sin(x)*(b.y-C.y)/2,y:-Math.sin(x)*(b.x-C.x)/2+Math.cos(x)*(b.y-C.y)/2},A=Math.pow(T.x,2)/Math.pow(S,2)+Math.pow(T.y,2)/Math.pow(w,2);A>1&&(S*=Math.sqrt(A),w*=Math.sqrt(A));var O=Math.pow(w,2)*Math.pow(T.x,2),D=(I===P?-1:1)*Math.sqrt((Math.pow(S,2)*Math.pow(w,2)-Math.pow(S,2)*Math.pow(T.y,2)-O)/(Math.pow(S,2)*Math.pow(T.y,2)+Math.pow(w,2)*Math.pow(T.x,2)));isNaN(D)&&(D=0);var M={x:D*S*T.y/w,y:D*-w*T.x/S},L={x:(b.x+C.x)/2+Math.cos(x)*M.x-Math.sin(x)*M.y,y:(b.y+C.y)/2+Math.sin(x)*M.x+Math.cos(x)*M.y},E=this.a([1,0],[(T.x-M.x)/S,(T.y-M.y)/w]),z=[(T.x-M.x)/S,(T.y-M.y)/w],k=[(-T.x-M.x)/S,(-T.y-M.y)/w],B=this.a(z,k);this.r(z,k)<=-1&&(B=Math.PI),this.r(z,k)>=1&&(B=0);var R=E+(P?1:-1)*(B/2);Math.cos(R),Math.sin(R);if(y.centp=L,y.xAxisRotation=x,y.rx=S,y.ry=w,y.a1=E,y.ad=B,y.sweep=P,null!=a){var N=S>w?S:w,j=S>w?1:S/w,H=S>w?w/S:1;a.save(),a.translate(L.x,L.y),a.rotate(x),a.scale(j,H),a.arc(0,0,N,E,E+B,!P),a.scale(1/j,1/H),a.rotate(-x),a.translate(-L.x,-L.y),a.restore()}break;case"Z":case"z":a.closePath(),g=s,u=h}s=g,h=u}}},t.prototype.drawText=function(e,i,r,n,o,a,s,h){if(i.content&&!0===i.visible){var d=s.groupElement,l=t.getContext(e);l.save(),this.setStyle(e,i),a&&(i.fontSize*=a);var c=i.x+i.width*i.pivotX,p=i.y+i.height*i.pivotY;this.applyFlipAndRotate(l,i,e,c,p,s,h),this.setFontStyle(e,i);var g,u=0;g=i.childNodes;var f=i.wrapBounds;if(l.fillStyle=i.color,f){var m=this.labelAlign(i,f,g);for(u=0;u<g.length;u++){var y=g[parseInt(u.toString(),10)];y.x=Cd(y,g,u,i);var v=m.x+(a?y.x*a:y.x)-f.x,b=m.y+(a?y.dy*a:y.dy)*u+.8*i.fontSize;if(f.width>i.width&&"Wrap"!==i.textOverflow&&"NoWrap"===i.textWrapping&&(y.text=G(y.text,i)),"Clip"!==i.textOverflow&&"Ellipsis"!==i.textOverflow||"Wrap"!==i.textWrapping)l.fillText(y.text,v,b);else if(b<d.actualSize.height+d.bounds.y){if("Ellipsis"===i.textOverflow&&g[u+1]){var S=g[u+1];m.y+S.dy*(u+1)+.8*i.fontSize>d.actualSize.height+d.bounds.y&&(y.text=y.text.slice(0,y.text.length-3),y.text=y.text.concat("..."))}l.fillText(y.text,v,b)}if("Underline"===i.textDecoration||"Overline"===i.textDecoration||"LineThrough"===i.textDecoration){var w=v,x=void 0,I=v+l.measureText(y.text).width,P=void 0;switch(i.textDecoration){case"Underline":x=b+2,P=b+2;break;case"Overline":x=m.y+y.dy*u,P=m.y+y.dy*u;break;case"LineThrough":x=(b+m.y+y.dy*u)/2+2,P=(b+m.y+y.dy*u)/2+2}l.beginPath(),l.moveTo(w,x),l.lineTo(I,P),l.strokeStyle=i.color,l.lineWidth=.08*i.fontSize,l.globalAlpha=i.opacity,l.stroke()}}}l.restore()}},t.prototype.applyFlipAndRotate=function(t,e,i,r,n,o,a){if(e.flip!==tt.None&&o&&a&&!(a.elementActions&dt.ElementIsPort)){var s=o.groupElement,h=a,d=void 0;if(a instanceof Zt&&a.position?d=o.renderFlipTextElement(s,i,h,e.flip,e.flipMode,!0):(a instanceof Qt||a instanceof Jt||a instanceof Zt&&!a.position||a instanceof Xt)&&(d=o.renderFlipElement(s,i,e.flip,!0)),(d=this.setElementTransform(a,o)||d)&&d.transform)for(var l=/(translate|scale|rotate)\(([^)]+)\)/g,c=void 0;null!==(c=l.exec(d.transform));){var p=c[1],g=c[2].split(",").map(function(t){return parseFloat(t.trim())});switch(p){case"translate":var u=g[0]||0,f=g[1]||0;t.translate(u,f);break;case"scale":var m=g[0]||1,y=g[1]||m;t.scale(m,y)}}}this.rotateContext(i,e.angle,r,n)},t.prototype.setElementTransform=function(t,e){for(var i=0,r=["_cancel_1_event","_cancel_0_event","_cancel_2_trigger","_success_0_event","_success_1_event","_success_2_trigger","_failure_0_event","_failure_1_event","_failure_2_trigger"];i<r.length;i++){var n=r[i];if(t.id.endsWith(n)){var o=e.transactionBounds,a=0,s=0,h=1,d=1,l=0,c=0;return 1!==t.flip&&3!==t.flip||(h=-1,l=-(a=o.center.x)),2!==t.flip&&3!==t.flip||(d=-1,c=-(s=o.center.y)),{transform:"translate("+a+","+s+") scale("+h+","+d+") translate("+l+","+c+")"}}}return null},t.prototype.loadImage=function(t,e,i,r,n){var o=new Image;o.src=e.source,this.image(t,o,e.x,e.y,e.width,e.height,e)},t.prototype.drawImage=function(e,i,r,n,o,a){var s=this;if(i.visible){var h=t.getContext(e);h.save();var d=i.x+i.width*i.pivotX,l=i.y+i.height*i.pivotY,c=new Image;c.src=i.source,this.setStyle(e,i);var p=h.canvas.id.split("_");p[p.length-1];this.applyFlipAndRotate(h,i,e,d,l,o,a),n?c.onload=function(){s.loadImage(h,i,e,d,l)}:this.loadImage(h,i,e,d,l),h.restore()}},t.prototype.image=function(t,e,i,r,n,o,a){t.beginPath();var s=e.width,h=e.height,d=n,l=o,c=0,p=0;if(a&&"None"!==a.alignment){var g=a.alignment.toLowerCase().substr(1,3),u=a.alignment.toLowerCase().substr(5,3);if("Slice"===a.scale){var f=function(){c=d,p=h*d/s},m=function(){c=s*l/h,p=l};d>l?(f(),l>p&&m()):d===l?s>h?m():f():(m(),d>c&&f());var y=this.getSliceOffset(g,c,d,s),v=this.getSliceOffset(u,p,l,h),b=s-y,S=h-v,w=c-y*(c/s),x=p-v*(p/h),I=ud("canvas",{width:n.toString(),height:o.toString()});I.getContext("2d").drawImage(e,y,v,b,S,0,0,w,x),t.drawImage(I,i,r,n,o)}else if("Meet"===a.scale){var P=h/s,C=l/d;c=C>P?d:l/P,p=C>P?d*P:l,i+=this.getMeetOffset(g,c,d),r+=this.getMeetOffset(u,p,l),t.drawImage(e,0,0,s,h,i,r,c,p)}else t.drawImage(e,i,r,n,o)}else t.drawImage(e,i,r,n,o);t.closePath()},t.prototype.getSliceOffset=function(t,e,i,r){switch(t){case"min":default:return 0;case"mid":return(e-i)/2*r/e;case"max":return(e-i)*r/e}},t.prototype.getMeetOffset=function(t,e,i){var r=Math.max(e,i),n=Math.min(e,i);switch(t){case"min":default:return 0;case"mid":return(r-n)/2;case"max":return r-n}},t.prototype.m=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},t.prototype.r=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(this.m(t)*this.m(e))},t.prototype.a=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(this.r(t,e))},t.prototype.labelAlign=function(t,e,r){var n=new i(e.width,r.length*(1.2*t.fontSize)),o={x:0,y:0},a=t.x,s=t.y,h=.5*t.width,d=.5*t.height;return"left"===t.textAlign?h=0:"center"===t.textAlign?h=e.width>t.width&&("Ellipsis"===t.textOverflow||"Clip"===t.textOverflow)&&"NoWrap"===t.textWrapping?0:.5*t.width:"right"===t.textAlign&&(h=1*t.width),o.x=a+h+(e?e.x:0),o.y=s+d-n.height/2,o},t}(),Ld=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ed=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},zd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ld(i,t),Ed([(0,e.Property)("")],i.prototype,"source",void 0),Ed([(0,e.Property)("transparent")],i.prototype,"color",void 0),Ed([(0,e.Property)("None")],i.prototype,"scale",void 0),Ed([(0,e.Property)("None")],i.prototype,"align",void 0),i}(e.ChildProperty),kd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ld(i,t),Ed([(0,e.Property)("Page")],i.prototype,"mode",void 0),Ed([(0,e.Property)("PageSettings")],i.prototype,"region",void 0),Ed([(0,e.Complex)({top:25,bottom:25,left:25,right:25},Ot)],i.prototype,"margin",void 0),Ed([(0,e.Property)(!1)],i.prototype,"canZoomIn",void 0),Ed([(0,e.Property)(void 0)],i.prototype,"customBounds",void 0),Ed([(0,e.Property)(!1)],i.prototype,"canFit",void 0),i}(e.ChildProperty),Bd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ld(i,t),Ed([(0,e.Property)(null)],i.prototype,"width",void 0),Ed([(0,e.Property)(null)],i.prototype,"height",void 0),Ed([(0,e.Complex)({},Ot)],i.prototype,"margin",void 0),Ed([(0,e.Property)("Landscape")],i.prototype,"orientation",void 0),Ed([(0,e.Property)("Infinity")],i.prototype,"boundaryConstraints",void 0),Ed([(0,e.Complex)({},zd)],i.prototype,"background",void 0),Ed([(0,e.Property)(!1)],i.prototype,"multiplePage",void 0),Ed([(0,e.Property)(!1)],i.prototype,"showPageBreaks",void 0),Ed([(0,e.Complex)({},kd)],i.prototype,"fitOptions",void 0),i}(e.ChildProperty),Rd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ld(i,t),Ed([(0,e.Property)(0)],i.prototype,"horizontalOffset",void 0),Ed([(0,e.Property)(0)],i.prototype,"verticalOffset",void 0),Ed([(0,e.Property)(1)],i.prototype,"currentZoom",void 0),Ed([(0,e.Property)(0)],i.prototype,"viewPortWidth",void 0),Ed([(0,e.Property)(0)],i.prototype,"viewPortHeight",void 0),Ed([(0,e.Property)(.2)],i.prototype,"minZoom",void 0),Ed([(0,e.Property)(30)],i.prototype,"maxZoom",void 0),Ed([(0,e.Property)("Diagram")],i.prototype,"scrollLimit",void 0),Ed([(0,e.Property)()],i.prototype,"scrollableArea",void 0),Ed([(0,e.Property)(!1)],i.prototype,"canAutoScroll",void 0),Ed([(0,e.Property)(100)],i.prototype,"autoScrollFrequency",void 0),Ed([(0,e.Complex)({left:15,right:15,top:15,bottom:15},Ot)],i.prototype,"autoScrollBorder",void 0),Ed([(0,e.Complex)({left:0,right:0,top:0,bottom:0},Ot)],i.prototype,"padding",void 0),Ed([(0,e.Property)(.2)],i.prototype,"zoomFactor",void 0),i}(e.ChildProperty),Nd=function(){function t(){this.services={}}return t.prototype.register=function(t,e){this.services[""+t]=e},t.prototype.getService=function(t){return this.services[""+t]},t}(),jd=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Hd=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Wd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return jd(i,t),Hd([(0,e.Property)("lightgray")],i.prototype,"lineColor",void 0),Hd([(0,e.Property)("")],i.prototype,"lineDashArray",void 0),Hd([(0,e.Property)([1.25,18.75,.25,19.75,.25,19.75,.25,19.75,.25,19.75])],i.prototype,"lineIntervals",void 0),Hd([(0,e.Property)([1,19,.5,19.5,.5,19.5,.5,19.5,.5,19.5])],i.prototype,"dotIntervals",void 0),Hd([(0,e.Property)([20])],i.prototype,"snapIntervals",void 0),i}(e.ChildProperty),_d=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return jd(i,t),Hd([(0,e.Complex)({},Wd)],i.prototype,"horizontalGridlines",void 0),Hd([(0,e.Complex)({},Wd)],i.prototype,"verticalGridlines",void 0),Hd([(0,e.Property)(it.All)],i.prototype,"constraints",void 0),Hd([(0,e.Property)(5)],i.prototype,"snapAngle",void 0),Hd([(0,e.Property)("Lines")],i.prototype,"gridType",void 0),Hd([(0,e.Property)(5)],i.prototype,"snapObjectDistance",void 0),Hd([(0,e.Property)("#07EDE1")],i.prototype,"snapLineColor",void 0),i}(e.ChildProperty),Yd=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Fd=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Xd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Yd(i,t),Fd([(0,e.Property)(5)],i.prototype,"interval",void 0),Fd([(0,e.Property)(100)],i.prototype,"segmentWidth",void 0),Fd([(0,e.Property)("Horizontal")],i.prototype,"orientation",void 0),Fd([(0,e.Property)("RightOrBottom")],i.prototype,"tickAlignment",void 0),Fd([(0,e.Property)("red")],i.prototype,"markerColor",void 0),Fd([(0,e.Property)(25)],i.prototype,"thickness",void 0),Fd([(0,e.Property)(null)],i.prototype,"arrangeTick",void 0),i}(e.ChildProperty),Vd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Yd(i,t),Fd([(0,e.Property)(!1)],i.prototype,"showRulers",void 0),Fd([(0,e.Property)(!0)],i.prototype,"dynamicGrid",void 0),Fd([(0,e.Complex)({orientation:"Horizontal"},Xd)],i.prototype,"horizontalRuler",void 0),Fd([(0,e.Complex)({orientation:"Vertical"},Xd)],i.prototype,"verticalRuler",void 0),i}(e.ChildProperty),Ud=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Gd=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Zd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ud(i,t),Gd([(0,e.Property)("")],i.prototype,"property",void 0),Gd([(0,e.Property)("")],i.prototype,"field",void 0),i}(e.ChildProperty),qd=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qd=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Kd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return qd(i,t),Qd([(0,e.Property)("")],i.prototype,"read",void 0),Qd([(0,e.Property)("")],i.prototype,"create",void 0),Qd([(0,e.Property)("")],i.prototype,"update",void 0),Qd([(0,e.Property)("")],i.prototype,"destroy",void 0),Qd([(0,e.Property)()],i.prototype,"customFields",void 0),i}(e.ChildProperty),Jd=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return qd(i,t),Qd([(0,e.Property)("")],i.prototype,"id",void 0),Qd([(0,e.Property)("")],i.prototype,"sourceID",void 0),Qd([(0,e.Property)("")],i.prototype,"targetID",void 0),Qd([(0,e.Property)(null)],i.prototype,"sourcePointX",void 0),Qd([(0,e.Property)(null)],i.prototype,"sourcePointY",void 0),Qd([(0,e.Property)(null)],i.prototype,"targetPointX",void 0),Qd([(0,e.Property)(null)],i.prototype,"targetPointY",void 0),Qd([(0,e.Property)(null)],i.prototype,"dataManager",void 0),Qd([(0,e.Complex)({},Kd)],i.prototype,"crudAction",void 0),i}(e.ChildProperty),$d=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return qd(i,t),Qd([(0,e.Property)("")],i.prototype,"id",void 0),Qd([(0,e.Property)(null)],i.prototype,"dataManager",void 0),Qd([(0,e.Property)(null)],i.prototype,"dataSource",void 0),Qd([(0,e.Property)("")],i.prototype,"root",void 0),Qd([(0,e.Property)("")],i.prototype,"parentId",void 0),Qd([(0,e.Property)()],i.prototype,"doBinding",void 0),Qd([(0,e.Collection)([],Zd)],i.prototype,"dataMapSettings",void 0),Qd([(0,e.Complex)({},Kd)],i.prototype,"crudAction",void 0),Qd([(0,e.Complex)({},Jd)],i.prototype,"connectionDataSource",void 0),i}(e.ChildProperty),tl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),el=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},il=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return tl(i,t),el([(0,e.Property)("LeftInFlow")],i.prototype,"yesBranchDirection",void 0),el([(0,e.Property)("RightInFlow")],i.prototype,"noBranchDirection",void 0),el([(0,e.Property)(["Yes","True"])],i.prototype,"yesBranchValues",void 0),el([(0,e.Property)(["No","False"])],i.prototype,"noBranchValues",void 0),i}(e.ChildProperty),rl=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return tl(i,t),el([(0,e.Property)("")],i.prototype,"fixedNode",void 0),el([(0,e.Property)(30)],i.prototype,"horizontalSpacing",void 0),el([(0,e.Property)("SamePoint")],i.prototype,"connectionPointOrigin",void 0),el([(0,e.Property)("Nonlinear")],i.prototype,"arrangement",void 0),el([(0,e.Property)(30)],i.prototype,"verticalSpacing",void 0),el([(0,e.Property)(30)],i.prototype,"maxIteration",void 0),el([(0,e.Property)(40)],i.prototype,"springFactor",void 0),el([(0,e.Property)(50)],i.prototype,"springLength",void 0),el([(0,e.Complex)({left:50,top:50,right:0,bottom:0},Ot)],i.prototype,"margin",void 0),el([(0,e.Property)("Auto")],i.prototype,"horizontalAlignment",void 0),el([(0,e.Property)("Auto")],i.prototype,"verticalAlignment",void 0),el([(0,e.Property)("TopToBottom")],i.prototype,"orientation",void 0),el([(0,e.Property)("Auto")],i.prototype,"connectionDirection",void 0),el([(0,e.Property)("Default")],i.prototype,"connectorSegments",void 0),el([(0,e.Property)("None")],i.prototype,"type",void 0),el([(0,e.Property)()],i.prototype,"getLayoutInfo",void 0),el([(0,e.Property)()],i.prototype,"layoutInfo",void 0),el([(0,e.Property)()],i.prototype,"getBranch",void 0),el([(0,e.Property)()],i.prototype,"bounds",void 0),el([(0,e.Property)(!0)],i.prototype,"enableAnimation",void 0),el([(0,e.Property)(!1)],i.prototype,"enableRouting",void 0),el([(0,e.Property)("")],i.prototype,"root",void 0),el([(0,e.Complex)({},il)],i.prototype,"flowchartLayoutSettings",void 0),i}(e.ChildProperty),nl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ol=function(t){function i(e,i){var r=t.call(this,e,!0)||this;return r.oldValue=null,r.endPoint=i,r}return nl(i,t),i.prototype.mouseDown=function(e){var i,r=!0;if(e.source&&e.source.connectors&&(i=e.source.connectors[0]),e.info&&e.actualObject&&(r=e.info.ctrlKey&&"Orthogonal"!==e.actualObject.type),i&&r){this.inAction=!0,this.undoElement=N(e.source),t.prototype.mouseDown.call(this,e);var n=i.constraints&at.InheritSegmentThumbSize?this.commandHandler.diagram.segmentThumbSize:i.segmentThumbSize,o=n>20&&"Straight"!==i.type?n/2:10;o/=this.commandHandler.diagram.scrollSettings.currentZoom;for(var a=0;a<i.segments.length;a++){var s=i.segments[parseInt(a.toString(),10)];if("OrthoThumb"===this.endPoint)for(var h=0;h<s.points.length-1;h++){var d={x:0,y:0};d.x=(s.points[parseInt(h.toString(),10)].x+s.points[h+1].x)/2,d.y=(s.points[parseInt(h.toString(),10)].y+s.points[h+1].y)/2,Tn(this.currentPosition,d,o)&&(this.selectedSegment=s,this.segmentIndex=h)}else Tn(this.currentPosition,s.point,o)&&(this.selectedSegment=s)}}},i.prototype.mouseMove=function(i){if(t.prototype.mouseMove.call(this,i),this.currentPosition=i.position,this.currentPosition&&this.prevPosition){var r=this.currentPosition.y-this.prevPosition.y,n=this.currentPosition.x-this.prevPosition.x;this.currentPosition=this.commandHandler.snapConnectorEnd(this.currentPosition);var a=void 0,s=void 0,h=!1;i.source&&i.source.connectors&&(a=i.source.connectors[0]),o.equals(this.startPosition,this.prevPosition)&&(h=!0),null===this.oldValue&&(this.oldValue=N(this.selectedSegment));var d=(this.oldValue,this.oldValue,this.selectedSegment);if(d={source:a,state:"Start",oldValue:this.oldValue,newValue:this.oldValue,segment:this.selectedSegment,cancel:!1},h&&!(0,e.isBlazor)()&&this.commandHandler.triggerEvent(xt.segmentChange,d),d.cancel&&this.commandHandler.diagram.resetTool(),this.inAction&&void 0!==this.selectedSegment&&void 0!==this.endPoint&&(0!==n||0!==r)&&!d.cancel){if("OrthoThumb"===this.endPoint)this.blocked=!this.dragOrthogonalSegment(a,this.selectedSegment,this.currentPosition,this.segmentIndex),null===this.oldValue.length&&null===this.oldValue.direction&&(this.oldValue=N(this.selectedSegment)),s=N(this.selectedSegment);else{var l=this.currentPosition.x-this.selectedSegment.point.x,c=this.currentPosition.y-this.selectedSegment.point.y,p=a.segments.indexOf(this.selectedSegment);this.blocked=!this.commandHandler.dragControlPoint(a,l,c,!1,p),s=N(this.selectedSegment)}this.commandHandler.updateSelector(),this.currentPosition=i.position;var g={source:a,state:"Progress",oldValue:this.oldValue,newValue:s,segment:this.selectedSegment,cancel:!1};this.commandHandler.triggerEvent(xt.segmentChange,g)}}return this.prevPosition=this.currentPosition,!this.blocked},i.prototype.mouseUp=function(e){var i,r;if(e.source&&e.source.connectors&&(r={segments:(i=e.source.connectors[0]).segments}),e&&e.source&&e.info&&e.info.ctrlKey&&e.info.shiftKey&&"Straight"===i.type)this.addOrRemoveSegment(i,this.currentPosition);else if("OrthoThumb"===this.endPoint&&this.selectedSegment){var n=i.segments.indexOf(this.selectedSegment),a=i.segments[n-1],s=i.segments[n+1];if(n===i.segments.length-2&&this.updateLastSegment(i,this.selectedSegment))i.segments.splice(i.segments.length-2,1);else if(a&&Math.abs(a.length)<5&&a.length>0)1!==n&&this.removePrevSegment(i,n);else if(s){var h=o.distancePoints(s.points[0],s.points[1]),d=s.length||0===s.length?s.length:h;Math.abs(d)<=5&&this.removeNextSegment(i,n)}this.commandHandler.updateEndPoint(i,r),i.selectedSegmentIndex=0}if(this.undoElement){var l={type:"SegmentChanged",redoObject:N(e.source),undoObject:this.undoElement,category:"Internal"};this.commandHandler.addHistoryEntry(l)}if(i.isBezierEditing&&(i.isBezierEditing=!1),this.prevPosition!==this.startPosition){var c={source:i,state:"Completed",oldValue:this.oldValue,newValue:N(this.selectedSegment),cancel:!1,segment:this.selectedSegment};this.commandHandler.triggerEvent(xt.segmentChange,c)}t.prototype.mouseUp.call(this,e)},i.prototype.removePrevSegment=function(t,e){var i=t.segments[e-2],r=t.segments[e+1];if(r&&!((r.length||0===r.length?r.length:o.distancePoints(r.points[0],r.points[1]))<=5)){var n=t.segments.slice(e-1,e+1),a={element:t,removeSegments:n,type:"Removal",cancel:!1};if(this.commandHandler.triggerEvent(xt.segmentCollectionChange,a),!a.cancel){var s=t.segments[e+1];t.segments.splice(e-1,2);var h=this.selectedSegment;"Left"===h.direction||"Right"===h.direction?(i.points[i.points.length-1].x=s.points[0].x,s.points[0].y=i.points[i.points.length-1].y):(i.points[i.points.length-1].y=s.points[0].y,s.points[0].x=i.points[i.points.length-1].x),(h.length||0===h.length)&&this.findSegmentDirection(i),this.findSegmentDirection(s)}}},i.prototype.findSegmentDirection=function(t){t.direction&&(t.length||0===t.length)&&(t.length=o.distancePoints(t.points[0],t.points[t.points.length-1]),t.direction=o.direction(t.points[0],t.points[t.points.length-1]))},i.prototype.removeNextSegment=function(t,e){var i,r,n=this.selectedSegment,a=t.segments[e-1],s=t.segments[e+2],h=t.segments[e+1];if(h.length||0===h.length?(i=t.segments.slice(e,2),r={element:t,removeSegments:i,type:"Removal",cancel:!1},r={element:t,removeSegments:i,type:"Removal",cancel:!1},this.commandHandler.triggerEvent(xt.segmentCollectionChange,r),r.cancel||(t.segments.splice(e,2),"Top"===n.direction||"Bottom"===n.direction?(s.points[0].y=n.points[0].y,a.points[a.points.length-1].x=s.points[0].x):(s.points[0].x=n.points[0].x,a.points[a.points.length-1].y=s.points[0].y))):(i=t.segments.slice(e+1,1),r={element:t,removeSegments:i,type:"Removal",cancel:!1},this.commandHandler.triggerEvent(xt.segmentCollectionChange,r),r.cancel||(t.segments.splice(e+1,1),"Top"===n.direction||"Bottom"===n.direction?a.points[a.points.length-1].x=h.points[h.points.length-1].x:a.points[a.points.length-1].y=h.points[h.points.length-1].y,this.findSegmentDirection(a),n.length=n.direction=null)),a&&s&&!r.cancel&&(a.length=o.distancePoints(a.points[0],s.points[0]),a.direction=o.direction(a.points[0],s.points[0]),s.length||0===s.length)){s.length=o.distancePoints(a.points[a.points.length-1],s.points[s.points.length-1]);var d=a.points,l=s.points;s.direction=o.direction(d[d.length-1],l[l.length-1])}},i.prototype.addOrRemoveSegment=function(t,e,i){for(var r,n,o=[],a={segments:t.segments},s=0;s<t.segments.length;s++){if(Tn(e,(d=t.segments[parseInt(s.toString(),10)]).point,t.hitPadding)){n=s,r=!0,o.push(d);var h={element:t,removeSegments:o,type:"Removal",cancel:!1};i&&i.triggerEvent(xt.segmentCollectionChange,h)}}if(this.commandHandler||(this.commandHandler=i),r&&void 0!==n){if(t.segments&&t.segments[parseInt(n.toString(),10)]&&"Straight"===t.segments[parseInt(n.toString(),10)].type){var d=t.segments[parseInt(n.toString(),10)],l=t.segments[n+1];l&&(t.segments.splice(n,1),l.points[0]=d.points[0])}}else{this.commandHandler.enableServerDataBinding(!1);var c=this.findIndex(t,e);if(t.segments&&t.segments[parseInt(c.toString(),10)]&&"Straight"===t.segments[parseInt(c.toString(),10)].type){d=t.segments[parseInt(c.toString(),10)];var p=new po(t,"segments",{type:"Straight",point:e},!0);p.points[0]=d.points[0],p.points[1]=e,d.points[0]=e,t.segments.splice(c,0,p),r=!0,o.push(d);h={element:t,addSegments:o,type:"Addition",cancel:!1};this.commandHandler.triggerEvent(xt.segmentCollectionChange,h)}this.commandHandler.enableServerDataBinding(!0)}r&&this.commandHandler.updateEndPoint(t,a)},i.prototype.findIndex=function(t,e){for(var i=[],r=0;r<t.segments.length;r++){var n=t.segments[parseInt(r.toString(),10)],o=w.toBounds([n.points[0],n.points[1]]);o.Inflate(t.hitPadding),o.containsPoint(e)&&i.push(n)}if(1===i.length)return t.segments.indexOf(i[0]);var a=void 0,s=void 0,h=void 0,d=void 0,l=void 0,c=void 0;for(r=0;r<i.length;r++)d=i[parseInt(r.toString(),10)],l=(e.y-d.points[0].y)/(d.points[1].y-e.y),c=(e.x-d.points[0].x)/(d.points[1].x-e.x),a=Math.abs(l-c),0===r&&(s=a,h=0),a<s&&(s=a,h=r);return t.segments.indexOf(i[parseInt(h.toString(),10)])},i.prototype.dragOrthogonalSegment=function(t,e,i,r){var n={x:0,y:0},o={segments:t.segments};n.x=(e.points[parseInt(r.toString(),10)].x+e.points[r+1].x)/2,n.y=(e.points[parseInt(r.toString(),10)].y+e.points[r+1].y)/2;var a=i.y-n.y,s=i.x-n.x,h=t.segments.indexOf(e),d=!1;return t.allowNodeOverlap&&(t.selectedSegmentIndex=h||r),-1!==h&&(0===h&&1===t.segments.length&&2===e.points.length?(h=this.addSegments(t,e,s,a,h),d=!0):h!==t.segments.length-1||null!==e.direction&&null!==e.length?0===h&&(h=this.insertFirstSegment(t,e,s,a,h),d=!0):(h=this.addTerminalSegment(t,e,s,a,r),d=!0),h&&(d&&(this.selectedSegment=e=t.segments[parseInt(h.toString(),10)],this.segmentIndex=0),this.updateAdjacentSegments(t,h,s,a),this.commandHandler.updateEndPoint(t,o))),!0},i.prototype.addSegments=function(t,e,i,r,n){var a,s=[],h=o.distancePoints(e.points[0],e.points[1]),d=o.direction(e.points[0],e.points[1]);s.push(new uo(t,"segments",{type:"Orthogonal",direction:d,length:h/4},!0));var l=e.points[0].y===e.points[1].y?r>0?"Bottom":"Top":i>0?"Right":"Left",c=e.points[0].x===e.points[1].x?r:i;s.push(new uo(t,"segments",{type:"Orthogonal",direction:l,length:c},!0)),s.push(new uo(t,"segments",{type:"Orthogonal",direction:d,length:h/2},!0));var p={element:t,addSegments:s,type:"Addition",cancel:!1};return this.commandHandler.triggerEvent(xt.segmentCollectionChange,p),p.cancel||(t.segments=s.concat(t.segments),a=n+2),a},i.prototype.insertFirstSegment=function(t,e,i,r,n){var a,s,h,d,l,c=[];if(t.sourcePortID&&e.length&&t.segments[0].points.length>2)for(var p=void 0,g=0;g<e.points.length-1;g++){var u=o.distancePoints(e.points[parseInt(g.toString(),10)],e.points[g+1]),f=o.direction(e.points[parseInt(g.toString(),10)],e.points[g+1]);0===(l=new uo(t,"segments",{type:"Orthogonal",direction:f,length:u},!0)).length&&(!p||"Top"!==p.direction&&"Bottom"!==p.direction?l.direction=r>0?"Bottom":"Top":l.direction=i>0?"Right":"Left"),p=l,c.push(l)}else h={type:"Orthogonal",direction:e.direction,length:e.length/3},c.push(new uo(t,"segments",h,!0)),"Bottom"===e.direction||"Top"===e.direction?(s=Math.abs(i),a=i>0?"Right":"Left"):(s=Math.abs(r),a=r>0?"Bottom":"Top"),l=new uo(t,"segments",{type:"Orthogonal",direction:a,length:s},!0),c.push(l);var m={element:t,addSegments:c,type:"Addition",cancel:!1};if(this.commandHandler.triggerEvent(xt.segmentCollectionChange,m),!m.cancel){if(t.sourcePortID&&e.length&&t.segments[0].points.length>2)t.segments.splice(0,1),d=1;else{var y=t.segments[1];y&&y.length&&(y.length=a!==y.direction?y.length+s:y.length-s),d=2,e.length=2*e.length/3}t.segments=c.concat(t.segments)}return d},i.prototype.updateAdjacentSegments=function(t,e,i,r){var n=t.segments[parseInt(e.toString(),10)],o=n.points[n.points.length-1],a=n.points[0],s=!0;if("Orthogonal"===n.type&&(n.points[0]=a,n.points[n.points.length-1]=o,t.segments[e-1]&&(s=this.updatePreviousSegment(i,r,t,e)),t.segments.length-1>e&&s)){var h=t.segments[e+1];this.updateNextSegment(t,n,h,i,r)}},i.prototype.addTerminalSegment=function(t,e,i,r,n){var a,s,h,d,l=t.segments.indexOf(e),c=[],p=t.segments.pop(),g=t.segments[t.segments.length-1];a=g&&"Orthogonal"===g.type?g:null;for(var u=0;u<e.points.length-2;u++)h=o.distancePoints(e.points[parseInt(u.toString(),10)],e.points[u+1]),d=o.direction(e.points[parseInt(u.toString(),10)],e.points[u+1]),s=new uo(t,"segments",{type:"Orthogonal",length:h,direction:d},!0),c.push(s),a=s;var f=n;if((2===e.points.length||f===e.points.length-2)&&(a&&(a.length+=5),void 0!==f)){h=2*o.distancePoints(e.points[e.points.length-2],e.points[e.points.length-1])/3,d=o.direction(e.points[e.points.length-2],e.points[e.points.length-1]);var m=new uo(t,"segments",{type:"Orthogonal",length:h,direction:d});c.push(m)}var y=new uo(t,"segments",{type:"Orthogonal"},!0);c.push(y);var v={element:t,addSegments:c,type:"Addition",cancel:!1};return this.commandHandler.triggerEvent(xt.segmentCollectionChange,v),v.cancel?t.segments.push(p):(t.segments=t.segments.concat(c),l+=n),this.commandHandler.updateEndPoint(t),l},i.prototype.updatePortSegment=function(t,e,i,r,n){if(1===i&&2===t.points.length&&t.length<0){var o=e.sourceWrapper.corners,a=e.segments[parseInt(i.toString(),10)],s=e.segments[i+1],h=void 0,d=[];h=new uo(e,"segments",{type:"Orthogonal",length:13,direction:t.direction}),d.push(h);var l=void 0;l="Left"===a.direction?a.points[0].x-(o.middleLeft.x-20):"Right"===a.direction?o.middleRight.x+20-a.points[0].x:"Bottom"===a.direction?o.bottomCenter.y+20-a.points[0].y:a.points[0].y-(o.topCenter.y-20),h=new uo(e,"segments",{type:"Orthogonal",length:l,direction:a.direction}),d.push(h),a.length=a.length-l,s&&s.length&&s.direction&&(s.direction===t.direction?s.length-=13:s.direction===Ti(t.direction)&&(s.length+=13)),e.segments=d.concat(e.segments),this.selectedSegment=e.segments[3]}},i.prototype.updatePreviousSegment=function(t,e,i,r){var n=i.segments[parseInt(r.toString(),10)],o=i.segments[r-1];o.points[o.points.length-1]=n.points[0];var a=!i.sourceID||""!==i.sourcePortID,s=!0;return"Orthogonal"===o.type&&("Bottom"===o.direction?o.length+=e:"Top"===o.direction?o.length-=e:"Right"===o.direction?o.length+=t:o.length-=t,""!==i.sourcePortID&&o.length<0&&!i.allowNodeOverlap?this.updatePortSegment(o,i,r,t,e):i.sourceID&&""===i.sourcePortID&&o.length<0&&1===r&&(s=!1,this.updateFirstSegment(i,n)),a&&this.changeSegmentDirection(o,i)),s},i.prototype.changeSegmentDirection=function(t,e){e.maxSegmentThumb||t.length<0&&(t.direction=Ti(t.direction),t.length*=-1)},i.prototype.updateNextSegment=function(t,e,i,r,n){i.points[0]=e.points[e.points.length-1],i&&"Orthogonal"===i.type&&(i.length||0===i.length)&&("Left"===i.direction||"Right"===i.direction?0!==r&&(i.length="Right"===i.direction?i.length-r:i.length+r,(i.length||0===i.length)&&this.changeSegmentDirection(i,t)):0!==n&&(i.length="Bottom"===i.direction?i.length-n:i.length+n,(i.length||0===i.length)&&this.changeSegmentDirection(i,t)))},i.prototype.updateFirstSegment=function(t,e){var i,r=t.segments.indexOf(e),n=!1,a=t.segments[parseInt(r.toString(),10)],s=t.segments[r-1],h={segments:t.segments};if(s.length<0&&t.sourceID){var d=t.sourceWrapper.corners,l=[],c=void 0,p=!1;this.changeSegmentDirection(a,t);var g=t.segments[r+1],u=t.segments[r+2];switch(g&&this.changeSegmentDirection(g,t),u&&this.changeSegmentDirection(u,t),s.direction){case"Top":case"Bottom":i=a.length>0&&"Left"===a.direction?d.middleLeft:d.middleRight,a.length>d.width/2?Math.abs(s.length)<d.height/2&&(s.length=o.distancePoints(d.center,s.points[s.points.length-1]),a.points[0].x=i.x,a.length=o.distancePoints(a.points[0],a.points[a.points.length-1]),a.length-=20,n=!0):(g&&g.direction&&g.length&&(g.points[0].y=i.y,g.points[0].x=g.points[g.points.length-1].x="Right"===a.direction?i.x+20:i.x-20),n=!0,p=!0);break;case"Left":case"Right":i=a.length>0&&"Top"===a.direction?d.topCenter:d.bottomCenter,a.length>d.height/2?Math.abs(s.length)<d.width/2&&(s.length=o.distancePoints(d.center,s.points[s.points.length-1]),a.points[0].y=i.y,a.length=o.distancePoints(a.points[0],a.points[a.points.length-1]),a.length-=20,n=!0):(g&&g.direction&&g.length&&(g.points[0].x=i.x,g.points[0].y=g.points[g.points.length-1].y="Bottom"===a.direction?i.y+20:i.y-20),n=!0,p=!0)}this.changeSegmentDirection(s,t),this.changeSegmentDirection(a,t),n&&(c={type:"Orthogonal",direction:a.direction,length:20},l.push(new uo(t,"segments",c,!0)),p&&(g&&g.direction&&g.length&&(g.length=o.distancePoints(g.points[0],g.points[g.points.length-1])),u&&u.direction&&u.length&&(u.length=o.distancePoints(g.points[g.points.length-1],u.points[u.points.length-1])),t.segments.splice(r-1,2)),t.segments=l.concat(t.segments)),this.selectedSegment=p?t.segments[r-1]:t.segments[r+1],this.commandHandler.updateEndPoint(t,h)}},i.prototype.updateLastSegment=function(t,e){if(t.targetID&&""===t.targetPortID){var i=void 0,r=void 0,n=void 0,o=void 0,a=t.targetWrapper.corners,s=e.points[0],h=e.points[e.points.length-1];return"Right"===e.direction||"Left"===e.direction?(i={x:s.x,y:s.y},r={x:"Left"===e.direction?h.x-a.width/2:h.x+a.width/2,y:h.y},n={x:a.center.x,y:a.center.y-a.height},o={x:a.center.x,y:a.center.y+a.height}):(i={x:s.x,y:s.y},r={x:h.x,y:"Bottom"===e.direction?h.y+a.height/2:h.y-a.height/2},n={x:a.center.x-a.width,y:a.center.y},o={x:a.center.x+a.width,y:a.center.y}),pa({x1:i.x,y1:i.y,x2:r.x,y2:r.y},{x1:n.x,y1:n.y,x2:o.x,y2:o.y}).enabled}return!1},i.prototype.destroy=function(){},i.prototype.getModuleName=function(){return"ConnectorEditingTool"},i}(Bn),al=function(){function t(t,e){this.currentAction="None",this.previousAction="None",this.previousTarget=null,this.touchArgs=void 0,this.focus=!1,this.isBlocked=!1,this.isMouseDown=!1,this.inAction=!1,this.doingAutoScroll=!1,this.diagram=null,this.objectFinder=null,this.tool=null,this.eventArgs=null,this.previousElement=null,this.isKeyUp=!0,this.keyCount=0,this.isNudgeKey=!1,this.commandObj={},this.keyArgs={},this.diagram=t,this.objectFinder=new sl,this.commandHandler=e}return Object.defineProperty(t.prototype,"action",{get:function(){return this.currentAction},set:function(t){t!==this.currentAction&&("PortDraw"===this.currentAction&&(this.diagram.tool&=~pt.DrawOnce,this.diagram.currentDrawingObject&&(this.diagram.currentDrawingObject=null),this.tool&&(this.tool.drawingObject&&(this.tool.drawingObject=null),this.tool.mouseUp({position:this.currentPosition})),this.tool=null),"Rotate"===t||"LabelRotate"===t?this.diagram.diagramCanvas.classList.add("e-diagram-rotate"):"Rotate"!==this.currentAction&&"LabelRotate"!==this.currentAction||this.diagram.diagramCanvas.classList.remove("e-diagram-rotate"),this.currentAction=t,"None"===this.currentAction||"Select"===this.currentAction||this.diagram.diagramActions&yt.TextEdit||this.currentPosition&&this.commandHandler.isUserHandle(this.currentPosition)||"FixedUserHandle"===this.currentAction?this.diagram.diagramActions=this.diagram.diagramActions&~yt.ToolAction:this.diagram.diagramActions=this.diagram.diagramActions|yt.ToolAction,this.diagram.setCursor(this.diagram.getCursor(t,this.inAction)))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blocked",{get:function(){return this.isBlocked},set:function(t){this.isBlocked=t,this.blocked?this.diagram.setCursor("not-allowed"):this.diagram.setCursor(this.diagram.getCursor(this.action,this.inAction))},enumerable:!0,configurable:!0}),t.prototype.getMousePosition=function(t){var e,r,n;-1!==t.type.indexOf("touch")?(r=(e=t).changedTouches[0].clientX,n=e.changedTouches[0].clientY):(r=t.clientX,n=t.clientY),r=this.diagram.modifyClientOffset(r),n=this.diagram.modifyClientOffset(n);var o=new i;o=Eo(this.diagram);var a=this.diagram.element.getBoundingClientRect();return this.diagram.modifyBounds(a),r=r+this.diagram.diagramCanvas.scrollLeft-a.left-o.width,n=n+this.diagram.diagramCanvas.scrollTop-a.top-o.height,r/=this.diagram.scroller.transform.scale,n/=this.diagram.scroller.transform.scale,{x:r-=this.diagram.scroller.transform.tx,y:n-=this.diagram.scroller.transform.ty}},t.prototype.windowResize=function(t){var e=this;return this.resizeTo&&clearTimeout(this.resizeTo),this.resizeTo=setTimeout(function(){e.updateViewPortSize(e.diagram.element)},300),!1},t.prototype.updateViewPortSize=function(t){var e=document.getElementById(t.id);if(e){var r=e.getBoundingClientRect();this.diagram.modifyBounds(r),this.diagram.scroller.setViewPortSize(r.width,r.height);var n=new i;n=Eo(this.diagram);var o=this.diagram.getSizeValue(this.diagram.width,n.width),a=this.diagram.getSizeValue(this.diagram.height,n.height);if(this.diagram.diagramCanvas.style.width=o,this.diagram.diagramCanvas.style.height=a,this.diagram.scroller.setSize(),this.diagram.transformLayers(),this.diagram.rulerSettings.showRulers&&Mo(this.diagram),this.diagram.views.length>1)for(var s=0,h=this.diagram.views;s<h.length;s++){var d=h[s],l=this.diagram.views[""+d];l instanceof Qo&&l.onPropertyChanged({sourceID:l.sourceID},{})}}},t.prototype.canHideResizers=function(){return(this.tool instanceof Hn||this.tool instanceof Wn)&&this.isMouseDown},t.prototype.updateCursor=function(){if(1===this.diagram.selectedItems.nodes.length||1===this.diagram.selectedItems.connectors.length){var t=[];t=t.concat(this.diagram.selectedItems.nodes,this.diagram.selectedItems.connectors),this.blocked=!(this.eventArgs&&this.eventArgs.source&&!Yi(this.eventArgs.source))&&(this.isMouseDown&&1===t.length&&this.tool instanceof Rn&&!Yi(t[0]))}},t.prototype.isForeignObject=function(t,e){var i=t;if(i&&"img"!==i.tagName.toLowerCase())for(;null!==i.parentNode;){if("string"==typeof i.className&&(!e&&-1!==i.className.indexOf("foreign-object")||e&&-1!==i.className.indexOf("e-diagram-text-edit")))return i;i=i.parentNode}return null},t.prototype.isMetaKey=function(t){return"mousewheel"===t.type?t.ctrlKey:navigator.platform.match("Mac")?t.metaKey:t.ctrlKey},t.prototype.renderUmlHighLighter=function(t){this.diagram.commandHandler.removeStackHighlighter();var e=this.diagram.selectedItems.nodes[0];if(e&&e.container&&"Stack"===e.container.type&&"UmlClassifier"===e.shape.type&&!e.wrapper.bounds.containsPoint(this.currentPosition)){var i=this.diagram.findObjectsUnderMouse({x:this.currentPosition.x-20,y:this.currentPosition.y}),r=this.diagram.findObjectUnderMouse(i,this.action,this.inAction);if(r&&r.parentId&&r.parentId===e.id){var n="Vertical"===this.diagram.nameTable[r.parentId].container.orientation;xn(r.wrapper,n,t.position,this.diagram,!0)}}},t.prototype.isDeleteKey=function(t,e){return navigator.platform.match("Mac")&&"Backspace"===t&&"delete"===e},t.prototype.isMouseOnScrollBar=function(t){var e,i,r,n,o,a=t.offsetX,s=t.offsetY,h=this.diagram.diagramCanvas,d=h.offsetHeight,l=h.offsetWidth;return!!(d<h.scrollHeight&&(e={x:l-17,y:0},i={x:l,y:0},r={x:l-17,y:d},n={x:l,y:d},o=w.toBounds([e,i,r,n]),0!==this.diagram.scroller.verticalOffset&&(o.x=o.x-this.diagram.scroller.horizontalOffset,o.y=o.y-this.diagram.scroller.verticalOffset),o.containsPoint({x:a,y:s})))||!!(l<h.scrollWidth&&(e={x:0,y:d-17},i={x:l,y:d-17},r={x:0,y:d},n={x:l,y:d},o=w.toBounds([e,i,r,n]),0!==this.diagram.scroller.horizontalOffset&&(o.x=o.x-this.diagram.scroller.horizontalOffset,o.y=o.y-this.diagram.scroller.verticalOffset),o.containsPoint({x:a,y:s})))},t.prototype.updateVirtualization=function(){var t=this,e=setInterval(function(i){t.diagram.removeVirtualObjects(e)},50);setTimeout(function(){t.diagram.deleteVirtualObject=!0},50)},t.prototype.checkPreviousAction=function(){if(this.action!==this.previousAction&&this.diagram.selectedItems.userHandles.length)for(var t=0;t<this.diagram.selectedItems.userHandles.length;t++)this.previousAction&&this.diagram.selectedItems.userHandles[parseInt(t.toString(),10)]&&(this.checkUserHandleEvent(xt.onUserHandleMouseLeave),this.previousAction="None");this.action!==this.previousAction&&(this.checkFixedUserHandleEvent(xt.onFixedUserHandleMouseLeave,this.targetItem,this.previousTarget),this.previousTarget=null,this.targetItem=null)},t.prototype.checkUserHandleEvent=function(t){if(this.diagram.selectedItems&&this.diagram.selectedItems.userHandles.length>0)for(var e=t===xt.onUserHandleMouseLeave?this.previousAction:this.action,i={element:void 0},r=0;r<this.diagram.selectedItems.userHandles.length;r++)(e===this.diagram.selectedItems.userHandles[parseInt(r.toString(),10)].name||t===xt.onUserHandleMouseUp&&"Select"===e)&&(i.element=this.diagram.selectedItems.userHandles[parseInt(r.toString(),10)],this.userHandle(t,r,i,null))},t.prototype.userHandle=function(t,e,i,r){if(t===xt.onUserHandleMouseEnter||t===xt.onFixedUserHandleMouseEnter){if(this.previousAction=this.action,i.element.tooltip&&"Auto"===i.element.tooltip.openOn&&""!==i.element.tooltip.content){pe(this.diagram,i.element);var n=void 0;i.element.pathData?t===xt.onUserHandleMouseEnter?n=document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_userhandle"):t===xt.onFixedUserHandleMouseEnter&&(n=document.getElementById(r.id+"_"+r.fixedUserHandles[parseInt(e.toString(),10)].id+"_groupElement")):n=i.element.source?document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_image"):i.element.content?document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_shape_native_element"):document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_shape_html_element"),"Auto"===i.element.tooltip.openOn&&i.element!==this.isUserHandleHover&&(this.isUserHandleHover=i.element,this.diagram.tooltipObject.open(n))}this.diagram.triggerEvent(t,i)}if(t===xt.onUserHandleMouseDown?(this.userHandleObject=this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name,this.diagram.triggerEvent(t,i)):t===xt.onFixedUserHandleMouseDown&&this.diagram.triggerEvent(t,i),t===xt.onUserHandleMouseUp){var o=void 0;o=i.element.pathData?document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_userhandle"):i.element.source?document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_image"):i.element.content?document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_shape_native_element"):document.getElementById(this.diagram.selectedItems.userHandles[parseInt(e.toString(),10)].name+"_shape_html_element"),this.commandHandler.isUserHandle(this.currentPosition)&&o&&o.id&&o.id.split(this.userHandleObject).length>1&&this.diagram.triggerEvent(t,i)}else t===xt.onFixedUserHandleMouseUp&&this.diagram.triggerEvent(t,i);t!==xt.onUserHandleMouseLeave&&t!==xt.onFixedUserHandleMouseLeave||(this.diagram.tooltipObject&&"Custom"!==this.diagram.tooltipObject.openOn&&(this.isUserHandleHover=null,this.diagram.tooltipObject.close()),this.diagram.triggerEvent(t,i))},t.prototype.checkFixedUserHandleEvent=function(t,e,i){if(e&&e.fixedUserHandles.length>0)for(var r={element:void 0},n=void 0,o=void 0,a=0;a<e.fixedUserHandles.length;a++)n=e.fixedUserHandles[parseInt(a.toString(),10)].id,i&&i.id&&i.id.indexOf(n)>-1&&(o=n,this.previousTarget=i,this.targetItem=e),o===e.fixedUserHandles[parseInt(a.toString(),10)].id&&(r.element=e.fixedUserHandles[parseInt(a.toString(),10)],this.userHandle(t,a,r,e))},t.prototype.mouseDown=function(t){var e=this;if("touchstart"===t.type&&(this.timeOutTapHold=setTimeout(function(){"Select"!==e.action&&"Drag"!==e.action||e.mouseMove(t,void 0)},500)),!(!0===this.inAction&&(this.tool instanceof Yn||this.tool instanceof Fn)||!0===this.inAction&&t.buttons&&t.buttons&t.buttons-1)){this.focus=!0;var i=t.touches,r=!!document.getElementsByClassName("e-dragclone")[0];if(this.isMouseOnScrollBar(t)&&!r)return this.isScrolling=!0,void t.preventDefault();if(this.checkFixedUserHandleEvent(xt.onFixedUserHandleMouseDown,this.targetItem,this.previousTarget),this.checkUserHandleEvent(xt.onUserHandleMouseDown),!this.checkEditBoxAsTarget(t)&&dr(this.diagram)||or(this.diagram)&&!hr(this.diagram))if(this.diagram.restrictedDeltaValue={x:0,y:0},"Select"!==this.action&&"Drag"!==this.action||this.diagram.updatePortVisibility(this.hoverElement,et.Hover,!0),!(this.tool instanceof Zn||this.tool instanceof qn)||2!==t.button&&2!==t.buttons)if(!0===this.inAction&&!0===this.isMouseDown&&(this.tool instanceof Zn||this.tool instanceof qn))this.isMouseDown=!0,this.eventArgs={},this.getMouseEventArgs(this.currentPosition,this.eventArgs),this.eventArgs.position=this.currentPosition,this.tool.mouseDown(this.eventArgs);else{this.isMouseDown=!0,this.currentPosition=this.prevPosition=this.getMousePosition(t),this.eventArgs={},this.diagram.textEditing&&!this.isMouseOnScrollBar(t)&&(this.diagram.endEdit(),this.diagram.textEditing=!1,"Canvas"===this.diagram.mode&&1!==this.diagram.scroller.currentZoom&&this.diagram.refreshDiagramLayer());var n=this.getTargetElement();this.action=this.diagram.findActionToBeDone(n.obj,n.sourceElement,this.currentPosition,n.target);var o=this.isMetaKey(t);if(o&&t.shiftKey&&this.diagram.connectorEditingToolModule?this.action="SegmentEnd":(o||t.shiftKey)&&(rr(this.diagram)||nr(this.diagram))&&(this.action="Select"),this.diagram.constraints&ct.AutomaticPortCreation&&t.ctrlKey&&this.eventArgs.actualObject&&this.createPortAutomaticallyAndActivateTool(!0),this.tool=this.diagram.getTool(this.action),this.tool||(this.action="Select",this.tool=this.diagram.getTool(this.action)),this.getMouseEventArgs(this.currentPosition,this.eventArgs),o||t.shiftKey){var a=o&&t.shiftKey?{ctrlKey:o,shiftKey:t.shiftKey}:{ctrlKey:!0};this.eventArgs.info=a}this.eventArgs.position=this.currentPosition;var s=this.diagram.selectedItems.nodes;if(this.tool.mouseDown(this.eventArgs),this.diagram.selectedItems.canToggleSelection&&s&&this.diagram.selectedItems.nodes&&this.tool instanceof Hn)for(var h=0;h<s.length;h++)s[parseInt(h.toString(),10)].id!==this.diagram.selectedItems.nodes[parseInt(h.toString(),10)].id&&(this.isSwimlaneSelected=!0);this.initialEventArgs={source:this.eventArgs.source,sourceWrapper:this.eventArgs.sourceWrapper},this.initialEventArgs.position=this.currentPosition,this.initialEventArgs.info=this.eventArgs.info,this.inAction=!1,"touchstart"===t.type&&(i&&i.length>=2&&(this.touchStartList=vd(this.touchStartList,0,i)),i||t.preventDefault())}else{this.diagram,this.currentPosition,t.buttons,this.eventArgs.actualObject,0===t.button||t.button;this.inAction=!1,this.tool.mouseUp(this.eventArgs)}this.isForeignObject(t.target)||this.isForeignObject(t.target,!0)||i||t.preventDefault()}},t.prototype.deletePortAutomatically=function(){if(this.hoverElement instanceof ye||this.hoverElement instanceof ve)for(var t=this.hoverElement,e=this.diagram.nameTable[t.parentObj.id],i=0;i<e.ports.length;i++)e.ports[parseInt(i.toString(),10)].id===t.id&&0===t.inEdges.length&&0===t.outEdges.length&&this.diagram.removePorts(e,[t])},t.prototype.createPortAutomaticallyAndActivateTool=function(t){var e=this.findObjectsUnderMouse(this.currentPosition);if(this.hoverElement)if(this.hoverElement instanceof Yh){var i=this.hoverElement,r=i.wrapper.bounds,n=(this.currentPosition.x-r.x)/r.width,o=(this.currentPosition.y-r.y)/r.height,a=void 0;if(i.ports&&i.ports.length>0?((a=N(i.ports[0])).id="port"+E(),a.offset={x:n,y:o},a.constraints|=It.Draw):a={id:"port"+E(),offset:{x:n,y:o},visibility:et.Visible,constraints:It.Default|It.Draw},t){this.diagram.addPorts(i,[a]);var s=Cn(this.diagram,i.ports[i.ports.length-1]);this.action="PortDraw"===s?s:this.action}else{if(this.eventArgs.source instanceof Co&&this.eventArgs.target instanceof Yh){if(this.eventArgs.target.id===i.id)this.diagram.addPorts(i,[a]),(l=this.eventArgs.source).targetID=i.id,l.targetPortID=a.id}else this.eventArgs.source instanceof Co&&e[0]instanceof Co&&this.addAutomaticPortCreationForConnector(e,this.eventArgs)}}else if(this.hoverElement instanceof Co){var h=this.hoverElement,d=this.findConnectorOffset(h.intermediatePoints);a=void 0;if(h.ports&&h.ports.length>0?((a=N(h.ports[0])).id="port"+E(),a.offset=d,a.constraints|=It.Draw):a={id:"port"+E(),offset:d,visibility:et.Visible,constraints:It.Default|It.Draw},t)this.diagram.addPorts(h,[a]),this.diagram.drawingObject={sourcePortID:a.id,sourceID:h.id,type:"Orthogonal"},this.action="PortDraw";else if(this.eventArgs.source instanceof Co&&this.eventArgs.target instanceof Co){var l,c=this.eventArgs.target;(l=this.eventArgs.source).id!==h.id&&c.id===h.id&&(this.diagram.addPorts(h,[a]),l.targetID=h.id,l.targetPortID=a.id)}else this.eventArgs.source instanceof Co&&e[0]instanceof Co&&this.addAutomaticPortCreationForConnector(e,this.eventArgs)}else if(this.hoverElement instanceof ye||this.hoverElement instanceof ve){0===(a=this.hoverElement).inEdges.length&&0===a.outEdges.length&&(this.action="PortDraw")}},t.prototype.addAutomaticPortCreationForConnector=function(t,e){var i=t[0],r=this.findConnectorOffset(i.intermediatePoints),n={id:"port"+E(),offset:r,visibility:et.Visible,constraints:It.Default|It.Draw};this.diagram.addPorts(i,[n]);var o=e.source;o.targetID=i.id,o.targetPortID=n.id},t.prototype.findConnectorOffset=function(t){for(var e=0,i=[],r=0;r<t.length-1;r++){var n=t[r+1].x-t[parseInt(r.toString(),10)].x,o=t[r+1].y-t[parseInt(r.toString(),10)].y,a=Math.hypot(n,o);i.push(a),e+=a}for(var s=0,h=1/0,d=0,l=0;d<t.length-1;d++){var c=t[parseInt(d.toString(),10)],p=t[d+1],g=this.getProjectionOnSegment(this.currentPosition,c,p),u=Math.hypot(this.currentPosition.x-g.x,this.currentPosition.y-g.y);u<h&&(h=u,s=l+Math.hypot(g.x-c.x,g.y-c.y)),l+=i[parseInt(d.toString(),10)]}return s/e},t.prototype.getProjectionOnSegment=function(t,e,i){var r=i.x-e.x,n=i.y-e.y,o=r*r+n*n;if(0===o)return e;var a=((t.x-e.x)*r+(t.y-e.y)*n)/o;return a=Math.max(0,Math.min(1,a)),{x:e.x+a*r,y:e.y+a*n}},t.prototype.mouseMoveExtend=function(t,e){(this.tool instanceof Zn||this.tool instanceof qn)&&this.tool.mouseMove(this.eventArgs),this.diagram.scrollSettings.canAutoScroll?this.checkAutoScroll(t):this.blocked||this.tool instanceof Zn||this.tool instanceof qn||this.tool.mouseMove(this.eventArgs),this.eventArgs.target&&(this.hoverElement=this.eventArgs.target);var i=!(this.eventArgs.target instanceof Yh||this.eventArgs.target instanceof Co)||!(e instanceof Yh||e instanceof Co);this.tool instanceof jn&&this.diagram.updatePortVisibility(this.hoverElement instanceof Yh||this.hoverElement instanceof Co?this.hoverElement:this.hoverNode,et.Connect|et.Hover,i),this.hoverElement instanceof Yh&&this.hoverNode instanceof Yh&&this.hoverNode&&this.hoverNode.id!==this.hoverElement.id&&this.diagram.updatePortVisibility(this.hoverNode,et.Connect|et.Hover,!0),this.hoverElement instanceof Co&&this.hoverElement.ports.length>0&&this.diagram.updatePortVisibility(this.hoverElement,et.Connect|et.Hover,!0),this.previousElement instanceof Yh&&this.hoverElement&&this.previousElement.id!==this.hoverElement.id&&this.diagram.updatePortVisibility(this.previousElement,et.Connect|et.Hover,!0),this.previousElement=this.hoverElement,""!==this.diagram.tooltip.content&&(this.hoverElement=null),this.hoverNode=i?null:e},t.prototype.checkAction=function(t){if("LabelSelect"===this.action&&this.eventArgs.sourceWrapper&&(this.eventArgs.sourceWrapper instanceof Zt||this.eventArgs.sourceWrapper instanceof Bi)){var e=this.commandHandler.findTarget(this.eventArgs.sourceWrapper,this.eventArgs.source);!Dn(this.diagram,e,!1,this.eventArgs.sourceWrapper)&&Yi(e)&&(this.action="LabelDrag",this.tool=this.getTool(this.action),this.tool.mouseDown(this.initialEventArgs))}else Yi(t)&&_i(t)&&this.initialEventArgs&&this.initialEventArgs.source&&"Select"===this.action&&(!Dn(this.diagram,this.eventArgs.source,!1)&&this.eventArgs.source instanceof qh&&this.getMouseEventArgs(this.currentPosition,this.eventArgs),t instanceof Co&&(!(t instanceof Co)||Tn(this.currentPosition,t.sourcePoint,t.hitPadding)||Tn(this.currentPosition,t.targetPoint,t.hitPadding))||(this.action="Drag"),this.tool=this.getTool(this.action),this.tool.mouseDown(this.initialEventArgs))},t.prototype.isSwimlaneElements=function(t){return!t||!(t.isLane||t.isPhase||t.isHeader)},t.prototype.canShowTouchTooltip=function(t){return!!("touchstart"===t.type&&this.diagram.tool&pt.SingleSelect&&this.diagram.tool&pt.ZoomPan)&&(this.isMouseDown=!1,!0)},t.prototype.mouseMove=function(t,e){var i,r;if(this.focus=!0,"touchmove"===t.type&&(this.touchArgs={target:t.target,type:"touchmove"}),this.isScrolling)t.preventDefault();else if(dr(this.diagram)||or(this.diagram)&&!hr(this.diagram)){this.currentPosition=this.getMousePosition(t);var n=this.diagram.findObjectsUnderMouse(this.currentPosition),a=this.diagram.findObjectUnderMouse(n,this.action,this.inAction);i=this.diagram,r=this.currentPosition,i.rulerSettings.showRulers&&(i.hRuler.drawRulerMarker(i.hRuler.element,r,i.scroller.horizontalOffset),i.vRuler.drawRulerMarker(i.vRuler.element,r,i.scroller.verticalOffset));var s=!1,h=void 0;if("touchmove"===t.type&&(e=t.touches)&&e.length>1&&(this.touchMoveList=vd(this.touchMoveList,0,e),"PinchZoom"!==this.action&&(s=!0)),!1===o.equals(this.currentPosition,this.prevPosition)||this.inAction||this.canShowTouchTooltip(t)){if(!1===this.isMouseDown||s){this.eventArgs={};var d=null,l=void 0;if(null!==a){if((d=this.diagram.findElementUnderMouse(a,this.currentPosition,this.diagram))&&(l=this.commandHandler.findTarget(d,a)),(l instanceof Ie||l instanceof Pe)&&(l.tooltip&&""!==l.tooltip.content||(l=a)),l!==this.hoverElement){var c=this.getContent();this.hoverElement&&"Auto"===this.hoverElement.tooltip.openOn&&""!==c&&this.elementLeave(),this.diagram.updatePortVisibility(this.hoverElement,et.Hover,!0),a instanceof Yh&&(this.hoverNode=a);var p=!0;!this.isSwimlaneElements(a)&&this.hoverElement&&this.isSwimlaneElements(this.hoverElement)&&(p=!1),this.hoverElement=p?a:this.hoverElement;var g,u=void 0;(g=this.diagram.findElementUnderMouse(a,this.currentPosition,this.diagram))instanceof Qt&&((u=this.commandHandler.findTarget(g,a))instanceof ye||u instanceof ve)&&this.hoverElement.constraints&It.ToolTip&&(this.hoverElement=u);var f=void 0;g instanceof Zt&&((f=this.commandHandler.findTarget(g,a))instanceof Ie||f instanceof Pe)&&f.constraints&st.Tooltip&&(this.hoverElement=f),p?this.elementEnter(this.currentPosition,!1):this.hoverElement=a}else this.hoverElement&&this.hoverElement===l&&this.hoverElement.tooltip.content&&void 0!==this.diagram.tooltipObject&&"Mouse"===this.hoverElement.tooltip.relativeMode&&this.setTooltipOffset(this.currentPosition);d&&(h=this.commandHandler.findTarget(d,a))}this.action=this.diagram.findActionToBeDone(a,d,this.currentPosition,h),this.checkFixedUserHandleEvent(xt.onFixedUserHandleMouseEnter,a,d),this.checkUserHandleEvent(xt.onUserHandleMouseEnter),this.checkPreviousAction(),this.getMouseEventArgs(this.currentPosition,this.eventArgs),this.tool=this.getTool(this.action),this.mouseEvents(),this.tool instanceof Fn||this.tool instanceof qn||this.tool instanceof Zn?this.tool.mouseMove(this.eventArgs):e&&this.tool instanceof Vn&&this.tool.mouseDown(this.eventArgs),this.updateCursor(),this.renderUmlHighLighter(this.eventArgs);var m=!1;this.hoverElement&&!(this.tool instanceof Vn)&&a instanceof Yh&&this.isSwimlaneElements(a)&&(0===this.diagram.selectedItems.nodes.length||!Dn(this.diagram,this.hoverElement))||this.hoverElement instanceof Co||(m=!0),this.hoverElement&&!(this.tool instanceof Vn)&&a instanceof Co&&(0===this.diagram.selectedItems.connectors.length||!Dn(this.diagram,this.hoverElement))||this.hoverElement instanceof Yh||(m=!0),this.diagram.updatePortVisibility(this.hoverElement,et.Hover,m);var y=this.getContent();null===a&&this.hoverElement&&"Auto"===this.hoverElement.tooltip.openOn&&y&&(this.hoverElement=null,this.elementLeave()),s=!1}else{if(this.eventArgs.position=this.currentPosition,"Drag"===this.action&&!Dn(this.diagram,this.eventArgs.source,!1)&&this.eventArgs.source instanceof qh&&this.getMouseEventArgs(this.currentPosition,this.eventArgs),this.mouseEvents(),t.ctrlKey||t.shiftKey){var v=t.ctrlKey&&t.shiftKey?{ctrlKey:t.ctrlKey,shiftKey:t.shiftKey}:{ctrlKey:!0};this.eventArgs.info=v}this.checkAction(a);var b=this.getConnectorPadding(this.eventArgs);this.getMouseEventArgs(this.currentPosition,this.eventArgs,this.eventArgs.source,b),t.ctrlKey&&this.diagram.lineRoutingModule&&this.diagram.constraints&ct.LineRouting&&this.diagram.selectedItems.nodes.length+this.diagram.selectedItems.connectors.length>1&&(this.eventArgs.source=this.diagram.selectedItems),this.updateCursor(),this.inAction=!0,this.initialEventArgs=null,"Drag"!==this.action&&"Rotate"!==this.action||(this.diagram.diagramActions=this.diagram.diagramActions|yt.Interactions);var S=this.diagram.scroller.getPageBounds();this.tool&&this.mouseMoveExtend(t,a);var w=this.diagram.scroller.getPageBounds();if(a&&(S.width!==w.width||S.height!==w.height||S.x!==w.x||S.y!==w.y)&&this.diagram.views&&this.diagram.views.overview){var x=this.diagram.views.overview;x.updateView(x)}}this.prevPosition=this.currentPosition,this.isForeignObject(t.target,!0)||t.preventDefault()}}},t.prototype.getContent=function(){var t,e=this.hoverElement instanceof Yh&&this.hoverElement.constraints&ht.Tooltip||this.hoverElement instanceof Co&&this.hoverElement.constraints&at.Tooltip||(this.hoverElement instanceof ye||this.hoverElement instanceof ve)&&this.hoverElement.constraints&It.ToolTip||(this.hoverElement instanceof Ie||this.hoverElement instanceof Pe)&&this.hoverElement.constraints&st.Tooltip,i=this.hoverElement;i instanceof Yh&&i.children&&i.children.length>0&&(t=this.findIntersectChild(i));var r=e?this.hoverElement.tooltip.content:this.diagram.tooltip.content;return r=t?t.tooltip.content:r},t.prototype.findIntersectChild=function(t){for(var e,i=new w(this.currentPosition.x,this.currentPosition.y,8,8),r=0;r<t.children.length;r++)if((e=this.diagram.getObject(t.children[parseInt(r.toString(),10)])).wrapper.outerBounds.intersects(i))return e;return null},t.prototype.checkAutoScroll=function(t){var e=this.startAutoScroll(t);if(!e&&this.doingAutoScroll)this.doingAutoScroll=!1,clearInterval(this.timeOutValue);else if(e){if((this.tool instanceof Yn||this.tool instanceof Fn||this.tool instanceof Hn||this.tool instanceof _n||this.tool instanceof Rn||this.tool instanceof jn)&&this.inAction){var i=this,r=this.diagram.scrollSettings.autoScrollFrequency;(r<10||isNaN(r))&&(r=100),this.diagram.scrollSettings.canAutoScroll&&e&&!this.doingAutoScroll&&(this.doingAutoScroll=!0,this.timeOutValue=setInterval(function(n){i.doAutoScroll(e,t,r)},r))}}else this.blocked=!this.tool.mouseMove(this.eventArgs)},t.prototype.mouseUp=function(t){clearTimeout(this.timeOutTapHold),this.touchArgs=void 0,this.diagram.diagramRenderer.touchMove=void 0,this.commandHandler.annotationRestrictDeltaValue={x:0,y:0},this.eventArgs&&this.eventArgs.target&&this.eventArgs.target!==this.hoverNode&&this.eventArgs.target!==this.lastObjectUnderMouse&&(this.hoverNode=this.eventArgs.target,this.lastObjectUnderMouse=this.eventArgs.target);var e=!1;(this.tool instanceof Hn||this.tool instanceof Wn)&&(e=!0),this.checkFixedUserHandleEvent(xt.onFixedUserHandleMouseUp,this.targetItem,this.previousTarget),this.checkUserHandleEvent(xt.onUserHandleMouseUp),"SVG"===this.diagram.mode&&ir(this.diagram)&&this.updateVirtualization();var i,r=this.diagram.selectedItems.nodes,n=this.diagram.selectedItems.connectors;this.diagram.previousSelectedObject=null,this.diagram.diagramRenderer.rendererActions=this.diagram.removeConstraints(this.diagram.diagramRenderer.rendererActions,vt.DrawSelectorBorder);var o=t.touches;if(this.isScrolling)return this.isScrolling=!1,void t.preventDefault();if(!this.checkEditBoxAsTarget(t)&&dr(this.diagram)||or(this.diagram)&&!hr(this.diagram)){if(this.tool&&(!(this.tool instanceof Zn||this.tool instanceof qn)||(this.tool instanceof Zn||this.tool instanceof qn)&&2===t.detail)){if(!this.isForeignObject(t.target)&&this.isMouseDown&&document.getElementById(this.diagram.element.id+"content").focus(),!this.inAction&&3!==t.which&&"Drag"===this.action){this.action="Select";var a=this.diagram.selectedItems.nodes.concat(this.diagram.selectedItems.connectors),s=this.diagram.findObjectsUnderMouse(this.currentPosition),h=this.diagram.findObjectUnderMouse(s,this.action,this.inAction),d=!0;if(!t.ctrlKey&&this.isMouseDown&&this.diagram.selectedItems.nodes.length+this.diagram.selectedItems.connectors.length>1&&1===t.which&&!(this.diagram.diagramActions&yt.PreventClearSelection)&&(d=!1,this.commandHandler.clearSelection()),(!Dn(this.diagram,h)||!d)&&(this.commandHandler.selectObjects([h],void 0,a),this.diagram.selectedItems.canToggleSelection)){var l=this.diagram.selectedItems.nodes;l?l[0].parentObj instanceof Xh&&(i=!0):this.diagram.selectedItems.connectors.length>0&&(i=!0)}}var c=!1,p=this.updateContainerProperties();this.eventArgs.actualObject&&this.eventArgs.actualObject instanceof Yh&&("Container"===this.eventArgs.actualObject.shape.type||this.eventArgs.actualObject.shape.activity&&this.eventArgs.actualObject.shape.activity.subProcess&&this.eventArgs.actualObject.shape.activity.subProcess.processes)&&this.diagram.updateDiagramElementQuad();var g=void 0;if(this.addUmlNode(),this.inAction=!1,this.isMouseDown=!1,this.diagram.selectedObject.helperObject&&(g=this.updateContainerBounds()),this.tool&&(this.tool.prevPosition||this.tool instanceof Gn)){this.eventArgs.position=this.currentPosition;var u=this.getConnectorPadding(this.eventArgs);this.getMouseEventArgs(this.currentPosition,this.eventArgs,this.eventArgs.source,u);var f=this.isMetaKey(t);if(f||t.shiftKey){var m=f&&t.shiftKey?{ctrlKey:f,shiftKey:t.shiftKey}:{ctrlKey:!0};this.eventArgs.info=m}if(this.diagram.diagramActions&yt.Interactions&&(this.diagram.diagramActions=this.diagram.diagramActions&~yt.Interactions),this.eventArgs.clickCount=t.detail,this.diagram.selectedObject.helperObject&&(this.tool instanceof Hn||this.tool instanceof _n)){if(this.diagram.selectedObject.actualObject&&""!==this.diagram.selectedObject.actualObject.parentId){var y=this.diagram.getObject(this.diagram.selectedObject.actualObject.parentId);y&&y.isLane&&(this.commandHandler.isContainer=!0)}(c=this.diagram.lineRoutingModule&&this.diagram.nameTable.helper&&this.eventArgs.target&&this.eventArgs.target.isLane&&(this.eventArgs.source instanceof qh&&this.eventArgs.source.nodes.length>0&&""===this.eventArgs.source.nodes[0].parentId||""===this.eventArgs.source.parentId))&&(this.diagram.diagramActions=this.diagram.diagramActions|yt.PreventLaneContainerUpdate),this.tool.mouseUp(this.eventArgs,p.isPreventHistory)}else{if(this.diagram.selectedItems.canToggleSelection){var v=void 0,b=void 0;if(this.diagram.selectedItems.nodes.length>0)for(var S=0;S<this.diagram.selectedItems.nodes.length;S++){this.diagram.selectedItems.nodes[parseInt(S.toString(),10)].isLane||this.diagram.selectedItems.nodes[parseInt(S.toString(),10)].isPhase||this.diagram.selectedItems.nodes[parseInt(S.toString(),10)].parentObj instanceof Xh||this.diagram.selectedItems.nodes[parseInt(S.toString(),10)].parentObj instanceof Vh||(v=""!==this.diagram.selectedItems.nodes[parseInt(S.toString(),10)].parentId)}var w=this.diagram.selectedItems.nodes;for(S=0;S<r.length;S++)(r.length>1&&w[0].id===r[parseInt(S.toString(),10)].id||n.length>0)&&(b=!0);!this.isSwimlaneSelected&&!i&&!b&&this.tool instanceof Hn&&"Select"===this.currentAction&&(!v||this.diagram.selectedItems.connectors.length>0)&&this.commandHandler.clearSelection(!0)}this.diagram.constraints&ct.AutomaticPortCreation&&t.ctrlKey&&this.createPortAutomaticallyAndActivateTool(!1),this.isSwimlaneSelected=!1,this.tool instanceof Rn?this.tool.mouseUp(this.eventArgs,t.button):this.tool.mouseUp(this.eventArgs),this.diagram.constraints&ct.AutomaticPortCreation&&t.ctrlKey&&this.deletePortAutomatically(),!this.diagram.checkMenu||-1===window.navigator.userAgent.indexOf("Linux")&&-1===window.navigator.userAgent.indexOf("X11")||(!t.pageY&&t instanceof TouchEvent&&t.changedTouches?(window.getSelection().removeAllRanges(),this.diagram.contextMenuModule.contextMenu.open(t.changedTouches[0].pageY,t.changedTouches[0].pageX,this.diagram.element),t.preventDefault()):this.diagram.contextMenuModule.contextMenu.open(t.pageY,t.pageX,this.diagram.element),this.diagram.checkMenu=!1)}p.hasStack&&this.diagram.endGroupAction()}if(g&&this.diagram.endGroupAction(),this.updateContainerBounds(!0),2!==this.eventArgs.clickCount&&("Select"!==this.action&&this.commandHandler.updateSelectedNodeProperties(this.eventArgs.source),c)){this.diagram.diagramActions=this.diagram.diagramActions&~yt.PreventLaneContainerUpdate;var x=this.eventArgs.source instanceof qh?this.eventArgs.source.nodes:[this.eventArgs.source];if(x)for(S=0;S<x.length;S++)x[parseInt(S.toString(),10)].container||(this.commandHandler.dropChildToContainer(this.eventArgs.target,x[parseInt(S.toString(),10)]),this.commandHandler.renderContainerHelper(x[parseInt(S.toString(),10)]))}if(this.diagram.selectedObject&&this.diagram.selectedObject.helperObject){var I=this.isSwimlaneChild(this.diagram.selectedObject.actualObject),P=this.diagram.selectedObject.actualObject&&this.diagram.selectedObject.actualObject.width===this.diagram.selectedObject.helperObject.width&&this.diagram.selectedObject.actualObject.height===this.diagram.selectedObject.helperObject.height;this.diagram.remove(this.diagram.selectedObject.helperObject),this.commandHandler.isTargetSubProcess(this.diagram.selectedObject.actualObject)&&""===this.diagram.selectedObject.actualObject.parentId&&this.swapProcessChildInDom(this.diagram.element.id+"_diagramLayer",this.diagram.selectedObject.actualObject),this.diagram.selectedObject={helperObject:void 0,actualObject:void 0},(this.diagram.diagramActions&yt.PublicMethod&&this.diagram.constraints&ct.LineRouting||I&&P)&&(this.diagram.diagramActions=this.diagram.diagramActions&~yt.PublicMethod)}if(this.blocked=!1,this.hoverElement){var C=et.Connect;Dn(this.diagram,this.hoverElement)&&(C|=et.Hover),this.diagram.updatePortVisibility(this.hoverElement,C,!0),this.hoverElement=null}this.touchStartList=null,this.touchMoveList=null,this.tool instanceof Xn||(this.tool=null)}o||t.preventDefault(),this.diagram.currentDrawingObject=void 0;var T=this.diagram.selectedItems,A=!1;if(this.commandHandler.isUserHandle(this.currentPosition)&&this.isForeignObject(t.target)&&(A=!0),!this.inAction&&T.wrapper&&T.userHandles.length>0&&!A&&this.diagram.renderSelector(!0),!this.inAction&&!this.diagram.currentSymbol&&this.eventArgs){var O=this.getTargetElement(),D={element:O.target instanceof ye||O.target instanceof ve||O.target instanceof No||O.target instanceof Hi||O.target instanceof Wi?O.target:this.eventArgs.source||this.diagram,position:this.eventArgs.position,count:t.detail,actualObject:this.eventArgs.actualObject,button:0===t.button?"Left":1===t.button?"Middle":"Right"};this.diagram.tool!==pt.ZoomPan&&this.diagram.triggerEvent(xt.click,D)}this.eventArgs={}}this.diagram.diagramActions=this.diagram.diagramActions&~yt.PreventLaneContainerUpdate,e&&this.updateAnnotation(this.diagram.selectedItems),this.previousElement=null,this.eventArgs={},this.diagram.commandHandler.removeStackHighlighter()},t.prototype.isSwimlaneChild=function(t){if(t.shape&&"SwimLane"!==t.shape.type){var e=this.diagram.nameTable[t.parentId];if(!e)return!1;var i=e.parentId?this.diagram.nameTable[e.parentId]:e;return i&&i.shape&&"SwimLane"===i.shape.type}return!1},t.prototype.updateAnnotation=function(t){var e=t.nodes;if(e.length>0)for(var i=0;i<e.length;i++){var r=e[parseInt(i.toString(),10)];this.diagram.updateConnectorEdges(r)}},t.prototype.swapProcessChildInDom=function(t,e){var i=document.getElementById(t);if(e.shape.activity.subProcess.processes)for(var r=0;r<e.shape.activity.subProcess.processes.length;r++){var n=document.getElementById(e.shape.activity.subProcess.processes[parseInt(r.toString(),10)]+"_groupElement");n&&i.appendChild(n)}},t.prototype.getTargetElement=function(){var t,e=this.objectFinder.findObjectsUnderMouse(this.currentPosition,this.diagram,this.eventArgs,null,this.action),i=this.objectFinder.findObjectUnderMouse(this.diagram,e,this.action,this.inAction,this.eventArgs,this.currentPosition);if("None"!==this.previousAction&&this.diagram.selectedItems.userHandles)for(var r=0;r<this.diagram.selectedItems.userHandles.length;r++){var n=this.diagram.selectedItems.userHandles[parseInt(r.toString(),10)];this.previousAction===n.name&&(t=n)}var o=null;return null!==i&&(o=this.diagram.findElementUnderMouse(i,this.currentPosition,this.diagram))&&(t=this.commandHandler.findTarget(o,i)),{obj:i,sourceElement:o,target:t}},t.prototype.getConnectorPadding=function(t){var e,i=t.source;if(i&&i instanceof qh&&i.connectors.length){var r=i.connectors[0];e=r.constraints&at.ConnectToNearByPort?r.connectionPadding:0}else i&&i instanceof Co&&"PortDraw"===this.action&&this.tool instanceof Fn&&i.constraints&at.ConnectToNearByPort&&(e=i.connectionPadding);return e||0},t.prototype.addSwimLaneObject=function(t){var e,i,r,n,o,a,s=0,h=t.shape,d=this.objectFinder.findObjectsUnderMouse(this.currentPosition,this.diagram,this.eventArgs,null,this.action);if(i||(i=this.diagram.findObjectUnderMouse(d,this.action,this.inAction)),this.diagram.clearSelectorLayer(),i&&!(i.isLane||i.isPhase||i.isHeader))for(var l=0;l<d.length;l++){var c=this.diagram.nameTable[d[parseInt(l.toString(),10)].id];(c.isLane||c.isPhase||c.isHeader)&&(i=c)}if(i&&(h.isPhase||h.isLane&&i.isLane)){var p=i.parentId;e=this.diagram.nameTable[""+p]}var g=null;if(e&&(r=e.shape,o=h.isLane?h.orientation===r.orientation:h.orientation!==r.orientation,h.isLane&&h.orientation!==r.orientation&&(o=!0,g="Horizontal"===h.orientation?"height":"width")),o&&i){if(r&&r.header&&r.hasHeader&&"Horizontal"===r.orientation&&(s=1),r.phases&&r.phases.length>0&&(s+=1),h.isPhase){a="Horizontal"===r.orientation?this.currentPosition.x-e.wrapper.bounds.x:this.currentPosition.y-(e.wrapper.bounds.y+(r.hasHeader?r.header.height:0));var u={id:E(),offset:a,header:{annotation:{content:void 0===h.phases[0].header?"Phase":h.phases[0].header.annotation.content,style:void 0===h.phases[0].header?{}:h.phases[0].header.annotation.style}},style:void 0===h.phases[0]?{}:h.phases[0].style};this.diagram.addPhases(e,[u])}else{var f={id:E(),style:h.lanes[0].style,canMove:h.lanes[0].canMove,header:{annotation:{content:h.lanes[0].header.annotation.content,style:h.lanes[0].header.annotation.style},style:h.lanes[0].header.style}};if("Horizontal"===h.orientation?f.height=h.lanes[0].height:f.width=h.lanes[0].width,"Horizontal"===r.orientation?(n=i.rowIndex?i.rowIndex:this.diagram.nameTable[i.parentId].rowIndex,i.wrapper.offsetY<this.currentPosition.y&&(n+=1)):(n=i.columnIndex?i.columnIndex:this.diagram.nameTable[i.parentId].columnIndex,this.currentPosition.x<i.wrapper.bounds.center.x&&(n-=1)),r.lanes.length>n)f.header.width=r.lanes[parseInt(n.toString(),10)].header.width,f.header.height=r.lanes[parseInt(n.toString(),10)].header.height;else{var m=void 0;m="Horizontal"===r.orientation?i.rowIndex<3?0:n-s-1:n-1,f.header.width=r.lanes[parseInt(m.toString(),10)].header.width,f.header.height=r.lanes[parseInt(m.toString(),10)].header.height}g&&("height"===g?(f.width=f.height,delete f.height):(f.height=f.width,delete f.width)),this.diagram.addLanes(e,[f],"Horizontal"===r.orientation?n-s:n)}this.commandHandler.select(e)}else if(h.isLane){var y={id:E(),width:t.width,height:t.height,addInfo:t.addInfo,shape:{type:"SwimLane",header:{annotation:{content:void 0===h.header?"Header":h.header.annotation.content,style:void 0===h.header?{}:h.header.annotation.style},height:50,style:h.header?h.header.style:h.lanes[0].header.style},phases:[{id:E(),header:{annotation:{content:void 0===h.phases||void 0===h.phases[0].header?"Phase":h.phases[0].header.annotation.content,style:void 0===h.phases||void 0===h.phases[0].header?{}:h.phases[0].header.annotation.style},style:void 0===h.phases||void 0===h.phases[0].header?{}:h.phases[0].header.style},style:void 0===h.phases?{}:h.phases[0].style}],lanes:[{id:E(),height:t.height,width:t.width,style:h.lanes[0].style,canMove:h.lanes[0].canMove,header:{annotation:{content:h.lanes[0].header.annotation.content,style:h.lanes[0].header.annotation.style},style:h.lanes[0].header.style}}],orientation:h.orientation}};"Vertical"===h.orientation&&(y.width+=20),y.offsetX=this.currentPosition.x+y.width/2,y.offsetY=this.currentPosition.y+y.height/2,y.style=t.style,this.diagram.add(y)}},t.prototype.mouseLeave=function(t){(this.tool&&this.inAction&&this.tool.mouseLeave(this.eventArgs),this.diagram.selectedObject.helperObject)&&(this.updateContainerProperties(),this.updateContainerBounds()&&this.diagram.endGroupAction());this.eventArgs&&this.eventArgs.source&&(this.diagram.updatePortVisibility(this.eventArgs.source,et.Hover,!0),this.hoverElement=null),this.eventArgs&&!this.eventArgs.source&&this.hoverElement&&(this.hoverElement=null),this.tool instanceof jn&&this.eventArgs&&this.eventArgs.target&&this.eventArgs.target instanceof Yh&&(this.diagram.updatePortVisibility(this.eventArgs.target,et.Hover|et.Connect,!0),this.hoverElement=null);var e=this.diagram.selectedItems;e&&e.wrapper&&(Rs(this.diagram,e)||this.diagram.renderSelector(!0)),(this.diagram.diagramActions&yt.Interactions||this.diagram.diagramActions&yt.ToolAction)&&(this.diagram.diagramActions=this.diagram.diagramActions&~yt.ToolAction),this.isMouseDown=!1,this.focus=!1,this.touchStartList=null,this.touchMoveList=null,this.elementLeave(),this.commandHandler.removeSnap(),this.inAction=!1,this.eventArgs={},this.diagram.selectedObject&&this.diagram.selectedObject.helperObject&&(this.diagram.remove(this.diagram.selectedObject.helperObject),this.diagram.selectedObject={helperObject:void 0,actualObject:void 0}),this.tool=null,function(){var t,e,i=document.getElementsByClassName("e-d-ruler-marker");if(i&&i.length>0)for(e=i.length-1;e>=0;e--)(t=i[parseInt(e.toString(),10)])&&t.parentNode.removeChild(t)}(),"Rotate"===this.action&&this.diagram.diagramCanvas.classList.remove("e-diagram-rotate"),t.preventDefault()},t.prototype.mouseWheel=function(t){this.diagram.blazorActions|=$.interaction;var e={event:t,cancel:!1};if(this.diagram.triggerEvent(xt.mouseWheel,e),!e.cancel){var i=t.wheelDelta>0||-40*t.detail>0,r=this.getMousePosition(t);if(this.diagram.tooltipObject.close(),this.isMetaKey(t)){var n=this.diagram.scrollSettings.zoomFactor;i?this.diagram.zoomTo({type:"ZoomIn",zoomFactor:n,focusPoint:r}):this.diagram.zoomTo({type:"ZoomOut",zoomFactor:n,focusPoint:r}),t.preventDefault()}else{var o=this.diagram.scroller.horizontalOffset,a=this.diagram.scroller.verticalOffset,s=i?10:-10;this.tool&&(this.tool instanceof Zn||this.tool instanceof qn)&&(this.eventArgs={},this.getMouseEventArgs(r,this.eventArgs),this.eventArgs.position=r,this.tool.mouseWheel(this.eventArgs)),this.diagram.scrollActions|=St.Interaction;var h=!0;if(t.isTrusted){var d=!1;(Math.abs(t.deltaY)<100&&-0===Math.abs(t.deltaX)||Math.abs(t.deltaX)<100&&-0===Math.abs(t.deltaY))&&(d=!0);var l=!1;if(0===t.deltaX&&0===t.deltaY||(l=navigator.userAgent.includes("Macintosh")),l)Math.abs(t.deltaX)>Math.abs(t.deltaY)?(t.shiftKey||t.deltaX&&-0!==t.deltaX&&(d||!l))&&this.diagram.scroller.zoom(1,s,0,r,h,void 0,d):!t.deltaY||-0===t.deltaY||!d&&l||this.diagram.scroller.zoom(1,0,s,r,h,void 0,d);else t.shiftKey||t.deltaX&&-0!==t.deltaX&&(d||!l)?this.diagram.scroller.zoom(1,s,0,r,h,void 0,d):!t.deltaY||-0===t.deltaY||!d&&l||this.diagram.scroller.zoom(1,0,s,r,h,void 0,d)}else t.shiftKey||t.deltaX&&-0!==t.deltaX?this.diagram.scroller.zoom(1,s,0,r,h):this.diagram.scroller.zoom(1,0,s,r,h);this.diagram.scrollActions&=~St.Interaction,o===this.diagram.scroller.horizontalOffset&&a===this.diagram.scroller.verticalOffset||t.preventDefault()}if(this.diagram.textEditing){if(this.diagram.isTriggerEvent=!0,this.diagram.activeLabel.parentId){var c=this.diagram.getObject(this.diagram.activeLabel.parentId);this.diagram.startTextEdit(c,this.diagram.activeLabel.id)}this.diagram.isTriggerEvent=!1}this.diagram.blazorActions=this.diagram.blazorActions&~$.interaction}},t.prototype.keyDown=function(t){if(t.fromMouseEvents&&(t.ctrlKey&&(this.keyArgs.keyModifiers=1),t.shiftKey&&(this.keyArgs.keyModifiers=4),t.shiftKey&&t.ctrlKey&&(this.keyArgs.keyModifiers=5)),!(this.diagram.diagramActions&yt.TextEdit)&&!this.checkEditBoxAsTarget(t)||"Escape"===t.key||27===t.keyCode){var i=void 0,r=t.keyCode?t.keyCode:t.which,n=t.key;"ArrowDown"!==n&&"ArrowUp"!==n&&"ArrowLeft"!==n&&"ArrowRight"!==n||(this.isNudgeKey=!0);var o=this.isMetaKey(t);if(this.diagram.commandManager&&this.diagram.commands)for(var a=this.diagram.commands,s=0,h=Object.keys(a);s<h.length;s++){var d=h[s];if((i=this.diagram.commands[""+d])&&(i.gesture.keyModifiers||i.gesture.key)&&(r===i.gesture.key||mt[i.gesture.key]&&n===mt[i.gesture.key]||n===mt[i.gesture.key].split("Number")[1]||this.isDeleteKey(n,d))&&(!i.gesture.keyModifiers&&!t.altKey&&!t.shiftKey&&!o||i.gesture.keyModifiers&&(o||t.altKey||t.shiftKey)&&this.altKeyPressed(i.gesture.keyModifiers)&&t.altKey||this.shiftKeyPressed(i.gesture.keyModifiers)&&t.shiftKey||this.ctrlKeyPressed(i.gesture.keyModifiers)&&o&&this.keyArgs.keyModifiers===i.gesture.keyModifiers)){var l=J(i.canExecute);if((0,e.isBlazor)()||l&&l({keyDownEventArgs:KeyboardEvent,parameter:i.parameter})){if(t.preventDefault(),"Escape"===t.key)if(this.checkEditBoxAsTarget(t))document.getElementById(this.diagram.diagramCanvas.id).focus();else if(this.diagram.currentSymbol){this.diagram.removeFromAQuad(this.diagram.currentSymbol),this.diagram.removeObjectsFromLayer(this.diagram.nameTable[this.diagram.currentSymbol.id]),this.diagram.removeElements(this.diagram.currentSymbol);var c=this.diagram.currentSymbol;c instanceof Yh&&"Bpmn"===c.shape.type&&"TextAnnotation"===c.shape.shape&&this.diagram.removeDependentConnector(c),Oa(this.diagram.currentSymbol,this.diagram),delete this.diagram.nameTable[this.diagram.currentSymbol.id],this.diagram.droppable.sourceElement.draggable.intDestroy();var p=this.diagram.droppable.selectedSymbols;p.parentNode.removeChild(p);var g=this.diagram.diagramActions;this.diagram.diagramActions=this.diagram.addConstraints(g,yt.PreventClearSelection),this.tool.mouseUp(this.eventArgs),this.diagram.diagramRenderer.rendererActions=this.diagram.removeConstraints(this.diagram.diagramRenderer.rendererActions,vt.DrawSelectorBorder),this.diagram.previousSelectedObject&&this.diagram.select(this.diagram.previousSelectedObject),this.action="Select",this.diagram.previousSelectedObject=null,this.diagram.currentSymbol=null,this.diagram.diagramActions=this.diagram.removeConstraints(g,yt.PreventClearSelection),this.isMouseDown=!1}else this.inAction&&this.diagram.drawingObject&&this.tool&&this.tool.inAction&&(this.tool.mouseUp(this.eventArgs),this.tool=null,this.isMouseDown=!1);if(i.execute&&(this.commandObj=i,this.diagram.tool!==pt.ZoomPan)){var u=J(i.execute);this.isNudgeKey?(this.isKeyUp||(this.keyArgs.oldValue={offsetX:this.diagram.selectedItems.offsetX,offsetY:this.diagram.selectedItems.offsetY},this.keyCount++,this.keyCount>4&&(u({keyDownEventArgs:KeyboardEvent,parameter:i.parameter,type:"KEYDOWN"}),this.keyCount=0,this.keyArgs.newValue={offsetX:this.diagram.selectedItems.offsetX,offsetY:this.diagram.selectedItems.offsetY},this.diagram.triggerEvent(xt.positionChange,this.keyArgs))),this.isKeyUp=!1):u({keyDownEventArgs:KeyboardEvent,parameter:i.parameter})}break}}}}this.diagram.selectedItems.nodes.length?this.diagram.selectedItems.nodes:this.diagram.selectedItems.connectors;var f=this.diagram.selectedItems;this.keyArgs={element:f,key:t.key,keyCode:t.keyCode?t.keyCode:t.which},this.getKeyModifier(this.keyArgs,t),this.diagram.diagramActions&yt.TextEdit&&this.getlabel(this.keyArgs,t),this.diagram.triggerEvent(xt.keyDown,this.keyArgs)},t.prototype.getlabel=function(t,e){var i=this.diagram.activeLabel;t.target=this.diagram.element.id+"_editBox";var r=this.diagram.nameTable[i.parentId];if(document.getElementById(this.diagram.element.id+"_editBox")){t.text=document.getElementById(this.diagram.element.id+"_editBox").value;for(var n=0;n<r.annotations.length;n++)if(r.annotations[parseInt(n.toString(),10)].id===i.id){t.label=r.annotations[parseInt(n.toString(),10)];break}}},t.prototype.getKeyModifier=function(t,e){t.keyModifiers=ft.None,e.ctrlKey&&(t.keyModifiers|=ft.Control),e.shiftKey&&(t.keyModifiers|=ft.Shift),e.altKey&&(t.keyModifiers|=ft.Alt),this.isMetaKey(e)&&(t.keyModifiers|=ft.Meta)},t.prototype.keyUp=function(t){var e=this.diagram.selectedItems;this.keyArgs={element:e,key:t.key,keyCode:t.keyCode?t.keyCode:t.which,oldValue:{offsetX:e.offsetX,offsetY:e.offsetY},newValue:{offsetX:e.offsetX,offsetY:e.offsetY}};this.diagram.selectedItems.nodes.length?this.diagram.selectedItems.nodes:this.diagram.selectedItems.connectors;(this.getKeyModifier(this.keyArgs,t),this.diagram.diagramActions&yt.TextEdit&&this.getlabel(this.keyArgs,t),this.diagram.triggerEvent(xt.keyUp,this.keyArgs),!this.isKeyUp&&this.isNudgeKey)&&(J(this.commandObj.execute)({keyDownEventArgs:KeyboardEvent,parameter:this.commandObj.parameter,type:"KEYUP"}),this.keyArgs.newValue={offsetX:this.diagram.selectedItems.offsetX,offsetY:this.diagram.selectedItems.offsetY},this.diagram.triggerEvent(xt.positionChange,this.keyArgs),this.isNudgeKey=!1,this.keyCount=0)},t.prototype.startAutoScroll=function(t){var i=this.getMousePosition(t);i.x*=this.diagram.scroller.currentZoom,i.y*=this.diagram.scroller.currentZoom;var r,n=Eo(this.diagram),o=this.diagram.scrollSettings.autoScrollBorder;if("mozilla"===e.Browser.info.name&&0===this.diagram.scroller.viewPortWidth){var a=document.getElementById(this.diagram.element.id).getBoundingClientRect();a.width!==this.diagram.scroller.viewPortWidth&&this.diagram.scroller.setViewPortSize(a.width,a.height)}return this.diagram.scrollSettings.canAutoScroll&&(i.x+this.diagram.scroller.horizontalOffset+o.right+n.width>=this.diagram.scroller.viewPortWidth-18?r="right":i.x+this.diagram.scroller.horizontalOffset<o.left?r="left":i.y+this.diagram.scroller.verticalOffset+o.bottom+n.height>this.diagram.scroller.viewPortHeight-18?r="bottom":i.y+this.diagram.scroller.verticalOffset<o.top&&(r="top")),r},t.prototype.doAutoScroll=function(t,e,i,r){var n=t;if((this.tool instanceof Yn||this.tool instanceof Fn||this.tool instanceof Hn||this.tool instanceof _n||this.tool instanceof Rn||this.tool instanceof jn)&&this.inAction){var o=this.getMousePosition(e),a=(this.diagram.scrollSettings.autoScrollBorder,0),s=0,h=!1,d="",l={x:o.x,y:o.y};switch(this.tool instanceof _n&&("ResizeSouthEast"===this.tool.corner||"ResizeSouthWest"===this.tool.corner||"ResizeNorthWest"===this.tool.corner||"ResizeNorthEast"===this.tool.corner)&&(h=!0,d=this.tool.corner),n){case"right":l.x=o.x+10,a=10,h&&("ResizeSouthEast"===d?(l.y=o.y+10,s=10):(l.y=o.y-10,s=-10));break;case"left":l.x=o.x-10,a=-10,h&&("ResizeNorthWest"===d?(l.y=o.y-10,s=-10):(l.y=o.y+10,s=10));break;case"bottom":l.y=o.y+10,s=10,h&&("ResizeSouthEast"===d?(l.x=o.x+10,a=10):(l.x=o.x-10,a=-10));break;case"top":l.y=o.y-10,s=-10,h&&("ResizeNorthEast"===d?(l.x=o.x+10,a=10):(l.x=o.x-10,a=-10))}this.eventArgs.position={x:l.x,y:l.y},this.currentPosition=this.eventArgs.position;var c=this.objectFinder.findObjectsUnderMouse(this.currentPosition,this.diagram,this.eventArgs,null,this.action);this.eventArgs.target=this.diagram.findObjectUnderMouse(c,this.action,this.inAction),this.tool.mouseMove(this.eventArgs),this.diagram.scrollActions|=St.Interaction,this.diagram.scroller.zoom(1,-a,-s,o,!0),this.diagram.scrollActions&=~St.Interaction}},t.prototype.mouseEvents=function(){for(var t=this.diagram.findObjectsUnderMouse(this.currentPosition),i=0;i<t.length;i++)this.eventArgs.actualObject===t[parseInt(i.toString(),10)]&&t.splice(i,1);var r={targets:{}};if((0,e.isBlazor)()||(r={targets:t,element:this.eventArgs.source===this.eventArgs.actualObject?void 0:this.eventArgs.source,actualObject:this.eventArgs.actualObject}),this.lastObjectUnderMouse&&this.diagram.mouseLeave&&(!this.eventArgs.actualObject||this.lastObjectUnderMouse!==this.eventArgs.actualObject)){var n={targets:void 0,element:this.lastObjectUnderMouse,actualObject:void 0};this.diagram.triggerEvent(xt.mouseLeave,n),this.lastObjectUnderMouse=null}(!this.lastObjectUnderMouse&&this.eventArgs.source||this.lastObjectUnderMouse!==this.eventArgs.actualObject)&&(this.lastObjectUnderMouse=this.eventArgs.actualObject,void 0!==this.eventArgs.actualObject&&this.diagram.triggerEvent(xt.mouseEnter,r)),this.eventArgs.actualObject&&this.diagram.triggerEvent(xt.mouseOver,r)},t.prototype.elementEnter=function(t,e){if(!e){var i=this.hoverElement instanceof Yh&&this.hoverElement.constraints&ht.Tooltip||this.hoverElement instanceof Co&&this.hoverElement.constraints&at.Tooltip||(this.hoverElement instanceof ye||this.hoverElement instanceof ve)&&this.hoverElement.constraints&It.ToolTip||(this.hoverElement instanceof Ie||this.hoverElement instanceof Pe)&&this.hoverElement.constraints&st.Tooltip,r=this.getContent(),n=void 0;this.diagram.tooltipObject&&(this.diagram.tooltipObject.windowCollision=!0),this.hoverElement&&this.hoverElement.children&&this.hoverElement.children.length>0&&(n=this.findIntersectChild(this.hoverElement),""===r&&(r=this.hoverElement.tooltip.content)),"Auto"===this.hoverElement.tooltip.openOn&&""!==r&&pe(this.diagram,i?this.hoverElement:void 0),this.hoverElement.tooltip.content&&("Mouse"===this.hoverElement.tooltip.relativeMode?this.setTooltipOffset(t):(this.diagram.tooltipObject.offsetX=0,this.diagram.tooltipObject.offsetY=0));var o=this.diagram.findObjectsUnderMouse(this.currentPosition),a=this.diagram.findObjectUnderMouse(o,this.action,this.inAction);if(null!==a){var s=void 0;if(this.hoverElement.tooltip.isSticky&&(this.diagram.tooltipObject.isSticky=!0),a instanceof Yh&&a.children&&a.children.length>0&&(a=n||a),a.ports&&(this.hoverElement instanceof ye||this.hoverElement instanceof ve))s=document.getElementById(a.id+"_"+this.hoverElement.id);else if(a.annotations&&(this.hoverElement instanceof Ie||this.hoverElement instanceof Pe))s=document.getElementById(a.id+"_"+this.hoverElement.id);else{var h=a.shape&&a.shape instanceof fh?"_content_native_element":"_groupElement";s=document.getElementById(a.id+h)}"Auto"===this.hoverElement.tooltip.openOn&&""!==r&&(this.diagram.tooltipObject.close(),this.diagram.tooltipObject.openOn=this.hoverElement.tooltip.openOn,this.diagram.tooltipObject.dataBind()),d=this.hoverElement,l=this.diagram,c=0,d instanceof Co?d.constraints&at.Tooltip?c=d.constraints&at.Tooltip:d.constraints&at.InheritTooltip&&(c=l.constraints&ct.Tooltip):d instanceof ye||d instanceof ve?d.constraints&It.ToolTip?c=d.constraints&It.ToolTip:d.constraints&It.InheritTooltip&&(c=l.constraints&ct.Tooltip):d instanceof Ie||d instanceof Pe?d.constraints&st.Tooltip&&(c=d.constraints&st.Tooltip):d.constraints&ht.Tooltip?c=d.constraints&ht.Tooltip:d.constraints&ht.InheritTooltip&&(c=l.constraints&ct.Tooltip),c&&"Auto"===this.hoverElement.tooltip.openOn&&(this.diagram.tooltipObject.target=this.hoverElement.id,"Mouse"===this.hoverElement.tooltip.relativeMode?this.diagram.tooltipObject.open(this.diagram.element):this.diagram.tooltipObject.open(s))}}var d,l,c},t.prototype.elementLeave=function(){this.diagram.tooltipObject&&!this.diagram.tooltipObject.isSticky&&"Custom"!==this.diagram.tooltipObject.openOn&&this.diagram.tooltipObject.close()},t.prototype.setTooltipOffset=function(t){var e=this.updatePointBasedOnScale(t),i=ma(this.diagram,e,this.hoverElement);this.diagram.tooltipObject.offsetX=i.x,this.diagram.tooltipObject.offsetY=i.y},t.prototype.updatePointBasedOnScale=function(t){var e=this.diagram.scaleValue;return{x:t.x*e,y:t.y*e}},t.prototype.altKeyPressed=function(t){return!!(t&ft.Alt)},t.prototype.ctrlKeyPressed=function(t){return!!(t&ft.Control)},t.prototype.shiftKeyPressed=function(t){return!!(t&ft.Shift)},t.prototype.scrolled=function(t){this.diagram.updateScrollOffset()},t.prototype.isMobileOrIPadDevice=function(){var t=navigator.userAgent||navigator.vendor||window.opera;return"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1?"iOS (iPad)":/iPhone|iPad|iPod/.test(t)&&!window.MSStream?"iOS":/android/i.test(t)?"Android":/Mobile|Tablet/.test(t)?"Mobile":"Desktop"},t.prototype.doubleClick=function(t){if(dr(this.diagram)){var e=this.isMobileOrIPadDevice(),i=this.diagram.tool;"Desktop"!==e&&this.tool&&(this.tool instanceof Zn||this.tool instanceof qn)&&(this.diagram.tool=0);var r=void 0,n=this.diagram.findObjectsUnderMouse(this.currentPosition),o=this.diagram.findObjectUnderMouse(n,this.action,this.inAction);if(null!==o&&dr(this.diagram)){if(r=this.diagram.findElementUnderMouse(o,this.currentPosition,this.diagram),this.tool&&(this.tool instanceof Zn||this.tool instanceof qn)){this.currentPosition,t.detail;this.diagram.tool=i,this.tool.mouseUp(this.eventArgs),this.isMouseDown=!1,this.eventArgs={},this.tool=null,t.preventDefault()}else{var a=this.diagram.commandHandler.getObjectLayer(o.id);if(a&&!a.lock&&a.visible&&!(this.diagram.diagramActions&yt.TextEdit)){this.diagram.startTextEdit(o,r instanceof Zt?r.id.split(o.id+"_")[1]:void 0)}}}var s={source:o||this.diagram,position:this.currentPosition,count:t.detail};this.diagram.triggerEvent(xt.doubleClick,s)}},t.prototype.itemClick=function(t,e){var i=t;return un(this.diagram,i,!0)?i:null},t.prototype.inputChange=function(t){var e,i,r,n,o,a,s,h,d,l=document.getElementById(this.diagram.element.id+"_editBox"),c=document.getElementById(this.diagram.element.id+"_editTextBoxDiv"),p=l.value,g=p.split("\n");(!(n=this.diagram.selectedItems.nodes[0]?this.diagram.selectedItems.nodes[0]:this.diagram.selectedItems.connectors[0])&&this.tool instanceof Xn||n&&"SwimLane"===n.shape.type)&&(n=this.diagram.nameTable[this.diagram.activeLabel.parentId]),n&&("Text"!==n.shape.type&&n.annotations.length>0||"Text"===n.shape.type)&&(r=this.diagram.getWrapper(n.wrapper,this.diagram.activeLabel.id),e=(e=n.wrapper.bounds.width<r.bounds.width?n.wrapper.bounds.width:r.bounds.width)>90?e:90,s=$h(r.style,p,void 0,void 0,e),i=Number(l.style.fontSize.split("px")[0]),g.length>1&&""===g[g.length-1]&&(s.height=s.height+i),h=this.diagram.scroller.transform,d=lr(this.diagram)?h.scale:1,a=(90>(a=s.width)?90:a)*d,o=(12>s.height?12:s.height)*d,c.style.left=(r.bounds.center.x+h.tx)*h.scale-a/2-2.5+"px",c.style.top=(r.bounds.center.y+h.ty)*h.scale-o/2-3+"px",r.flipTransformOffset&&(c.style.left=parseFloat(c.style.left)+r.flipTransformOffset.x+"px",c.style.top=parseFloat(c.style.top)+r.flipTransformOffset.y+"px"),c.style.width=a+"px",c.style.height=o+"px",l.style.minHeight="12px",l.style.minWidth="90px",l.style.width=a+"px",l.style.height=o+"px")},t.prototype.isAddTextNode=function(t,e){return!!(this.tool instanceof Xn||e)&&(this.tool=null,t&&!ar(this.diagram)&&(this.diagram.drawingObject=void 0,this.diagram.currentDrawingObject=void 0),!ss(this.diagram.nodes,t.id)&&!ss(this.diagram.connectors,t.id))},t.prototype.checkEditBoxAsTarget=function(t){return!(!t.target||t.target.id!==this.diagram.element.id+"_editBox")},t.prototype.getMouseEventArgs=function(t,e,i,r){var n,o,a;if(e.position=t,i?(o=this.diagram.findObjectsUnderMouse(this.currentPosition,i),n=this.diagram.findTargetObjectUnderMouse(o,this.action,this.inAction,e.position,i)):"Drag"===this.action||"ConnectorSourceEnd"===this.action||"SegmentEnd"===this.action||"OrthoThumb"===this.action||"BezierSourceThumb"===this.action||"BezierTargetThumb"===this.action||"ConnectorTargetEnd"===this.action||-1!==this.action.indexOf("Rotate")||-1!==this.action.indexOf("Resize")?(n=this.diagram.selectedItems,!this.diagram.currentSymbol&&"Drag"===this.action&&n&&this.diagram.selectedItems.nodes.length>0&&"SwimLane"===this.diagram.selectedItems.nodes[0].shape.type&&(o=this.diagram.findObjectsUnderMouse(this.currentPosition),n=this.diagram.findObjectUnderMouse(o,this.action,this.inAction))):(o=this.diagram.findObjectsUnderMouse(this.currentPosition),n=this.diagram.findObjectUnderMouse(o,this.action,this.inAction)),n&&n.isHeader&&-1===["LabelSelect","LabelDrag"].indexOf(this.currentAction)&&(n=this.diagram.nameTable[n.parentId],this.eventArgs.actualObject=n),n){var s=void 0,h=void 0,d=void 0;if(((a=this.diagram.findElementUnderMouse(n,this.currentPosition,this.diagram,r))&&n.ports&&n.ports.length&&!Ts(n,a)||!a||!n)&&o&&o.length&&i instanceof qh)for(s=i.connectors[0],d=o.length-1;d>=0;d--)if(((h=o[parseInt(d.toString(),10)])instanceof Yh||h instanceof Co)&&s&&s.connectionPadding){if(n=h,a=this.diagram.findElementUnderMouse(n,this.currentPosition,this.diagram,r),s.constraints&at.ConnectToNearByPort&&n&&n.ports&&n.ports.length&&Ts(n,a))break;if((h instanceof Yh||h instanceof Co)&&s&&s.connectionPadding&&h.wrapper.outerBounds.containsPoint(this.currentPosition)&&s.constraints&at.ConnectToNearByNode&&!(s.constraints&at.ConnectToNearByPort)){n=h,a=this.diagram.findElementUnderMouse(n,this.currentPosition,this.diagram,0);break}}}return i?(e.target=n,e.targetWrapper=a):(e.source=n,e.sourceWrapper=a),e.actualObject=this.eventArgs.actualObject,e.source instanceof qh&&void 0===e.actualObject&&(e.source.nodes.length>0||e.source.connectors.length>0)&&(e.actualObject=e.source.nodes.length>0?this.diagram.nameTable[e.source.nodes[0].id]:this.diagram.nameTable[e.source.connectors[0].id]),e.startTouches=this.touchStartList,e.moveTouches=this.touchMoveList,e},t.prototype.resetTool=function(){this.action="Select",this.hoverElement=null,this.hoverNode=null,this.tool=this.diagram.getTool(this.action),this.updateCursor()},t.prototype.updateTool=function(){if(this.currentPosition){var t=this.diagram.findObjectsUnderMouse(this.currentPosition),e=this.diagram.findObjectUnderMouse(t,this.action,this.inAction),i=null,r=void 0;null!==e&&(i=this.diagram.findElementUnderMouse(e,this.currentPosition,this.diagram)),i&&(r=this.commandHandler.findTarget(i,e)),this.action=this.diagram.findActionToBeDone(e,i,this.currentPosition,r)}else this.action="Select"},t.prototype.getTool=function(t){switch(t){case"Select":return new Rn(this.commandHandler,!0);case"Drag":return new Hn(this.commandHandler);case"Rotate":return new Wn(this.commandHandler);case"LayoutAnimation":return new Un(this.commandHandler);case"FixedUserHandle":return new Nn(this.commandHandler,!0);case"Hyperlink":return new Gn(this.commandHandler);case"ResizeSouthEast":case"ResizeSouthWest":case"ResizeNorthEast":case"ResizeNorthWest":case"ResizeSouth":case"ResizeNorth":case"ResizeWest":case"ResizeEast":return new _n(this.commandHandler,t);case"ConnectorSourceEnd":case"ConnectorTargetEnd":case"BezierSourceThumb":case"BezierTargetThumb":return new jn(this.commandHandler,t);case"SegmentEnd":case"OrthoThumb":return new ol(this.commandHandler,t);case"Draw":var e="shape",i=$o(this.diagram.drawingObject);if("Node"===i&&"Text"===this.diagram.drawingObject.shape.type)return new Xn(this.commandHandler);if("Connector"===i&&"Freehand"===this.diagram.drawingObject.type)return new $n(this.commandHandler);if("Node"===i&&"Polygon"===this.diagram.drawingObject.shape[""+e]&&!this.diagram.drawingObject.shape.points)return new Zn(this.commandHandler);if("Node"===i||"Node"===i&&"Polygon"===this.diagram.drawingObject.shape[""+e]&&this.diagram.drawingObject.shape.points)return new Yn(this.commandHandler,this.diagram.drawingObject);if("Connector"===i&&"Polyline"===this.diagram.drawingObject.type)return new qn(this.commandHandler);if("Connector"===i)return new Fn(this.commandHandler,"ConnectorSourceEnd",this.diagram.drawingObject);break;case"Pan":return new Vn(this.commandHandler,!1);case"PinchZoom":return new Vn(this.commandHandler,!0);case"PortDrag":return new Hn(this.commandHandler,"Port");case"PortDraw":return new Fn(this.commandHandler,"ConnectorSourceEnd",this.diagram.drawingObject);case"LabelSelect":return new Rn(this.commandHandler,!0,"LabelSelect");case"LabelDrag":return new Qn(this.commandHandler);case"LabelResizeSouthEast":case"LabelResizeSouthWest":case"LabelResizeNorthEast":case"LabelResizeNorthWest":case"LabelResizeSouth":case"LabelResizeNorth":case"LabelResizeWest":case"LabelResizeEast":return new Kn(this.commandHandler,t);case"LabelRotate":return new Jn(this.commandHandler)}return null},t.prototype.getCursor=function(t){var e=this.diagram.selectedItems.annotation?this.diagram.selectedItems.wrapper.children[0]:this.diagram.selectedItems;return Mn(t,this.diagram.selectedItems.annotation?e.rotateAngle+e.parentTransform:e.rotateAngle)},t.prototype.findElementUnderMouse=function(t,e,i,r){return this.objectFinder.findElementUnderSelectedItem(t,e,i,r)},t.prototype.findObjectsUnderMouse=function(t,e){return this.objectFinder.findObjectsUnderMouse(t,this.diagram,this.eventArgs,e)},t.prototype.findObjectUnderMouse=function(t,e,i){return this.objectFinder.findObjectUnderMouse(this.diagram,t,e,i,this.eventArgs,this.currentPosition)},t.prototype.findTargetUnderMouse=function(t,e,i,r,n){return this.objectFinder.findObjectUnderMouse(this.diagram,t,e,i,this.eventArgs,r,n)},t.prototype.findActionToBeDone=function(t,e,i,r){return Pn(t,e,this.currentPosition,this.diagram,this.touchStartList,this.touchMoveList,r)},t.prototype.updateContainerBounds=function(t){var e=!1;if(this.diagram.selectedObject.helperObject&&this.diagram.selectedObject.actualObject)for(var i=this.diagram.selectedObject.actualObject,r=this.diagram.selectedObject.actualObject instanceof qh?i.nodes:[i],n=0;n<r.length;n++){var o=r[parseInt(n.toString(),10)],a=this.tool instanceof _n,s=this.diagram.nameTable[o.parentId];t?ln(this.diagram,o,this.currentPosition,a):((!s||s&&"SwimLane"!==s.shape.type)&&this.diagram.updateDiagramObject(o),e=dn(this.diagram,o,this.currentPosition,a),this.diagram.updateSelector(),(o.isLane||o.isPhase)&&(this.diagram.clearSelection(),this.commandHandler.selectObjects([o])))}return e},t.prototype.updateContainerProperties=function(){var t,e,i,r,n=!1,o=!1,a={hasStack:!1,isPreventHistory:!1};if(this.diagram.selectedObject.helperObject){var s=this.diagram.findObjectsUnderMouse(this.currentPosition),h=this.diagram.findObjectUnderMouse(s,this.action,this.inAction);if(t=this.diagram.selectedObject.helperObject,(r=this.diagram.selectedObject.actualObject)instanceof Yh){if("SwimLane"===r.shape.type&&(i=Dr(this.diagram,r.wrapper.children[0])),"SwimLane"!==r.shape.type&&r.parentId&&"SwimLane"===this.diagram.getObject(r.parentId).shape.type&&h instanceof Yh&&this.diagram.getObject(h.parentId)&&"SwimLane"!==this.diagram.getObject(h.parentId).shape.type&&(h=this.diagram.getObject(h.parentId)),"Drag"===this.currentAction&&r.container&&"Canvas"===r.container.type&&r.parentId&&"SwimLane"===this.diagram.getObject(r.parentId).shape.type&&h&&h.container&&"Canvas"===h.container.type&&h.isLane&&r.isLane&&h.parentId===r.parentId)h!==r&&Nr(this.diagram,r,h,this.currentPosition),a.isPreventHistory=!0;else{if(!(M=this.diagram.nameTable[r.parentId])||M&&"SwimLane"!==M.shape.type)if(M&&M.isLane&&r.constraints&ht.AllowMovingOutsideLane){var d=this.diagram.getObject(M.parentId),l=void 0,c=void 0;if("Vertical"===d.shape.orientation)l=d.wrapper.bounds.x+d.shape.phaseSize,c=d.wrapper.bounds.y+d.shape.header.height;else{var p=d.shape.header.height+d.shape.phaseSize;l=d.wrapper.bounds.x,c=d.wrapper.bounds.y+p}var g=d.wrapper.bounds.bottomRight.x-l,u=d.wrapper.bounds.bottomRight.y-c;new w(l,c,g,u).containsPoint(this.currentPosition)&&(r.offsetX=t.offsetX,r.offsetY=t.offsetY,r.width=t.width,r.height=t.height,r.rotateAngle=t.rotateAngle)}else if(1===this.diagram.selectedItems.nodes.length)r.offsetX=t.offsetX,r.offsetY=t.offsetY,r&&r.shape&&"UmlClassifier"!==r.shape.type&&(r.width=t.width,r.height=t.height),r.rotateAngle=t.rotateAngle;else if(this.diagram.selectedItems.nodes.length>1)for(var f=t.offsetX-this.diagram.selectedItems.offsetX,m=t.offsetY-this.diagram.selectedItems.offsetY,y=t.rotateAngle-this.diagram.selectedItems.rotateAngle,v=0;v<this.diagram.selectedItems.nodes.length;v++)this.diagram.selectedItems.nodes[parseInt(v.toString(),10)].offsetX+=f,this.diagram.selectedItems.nodes[parseInt(v.toString(),10)].offsetY+=m,this.diagram.selectedItems.nodes[parseInt(v.toString(),10)].rotateAngle+=y;var b=void 0;if(M&&M.container&&"Stack"===M.container.type&&(this.diagram.startGroupAction(),o=!0),!h&&M&&M.container&&"Stack"===M.container.type&&"Drag"===this.action){var S=M.wrapper.children.indexOf(r.wrapper);if(b={targetIndex:void 0,target:void 0,sourceIndex:S,source:N(r)},S>-1){var x=M.children;x.splice(x.indexOf(r.id),1),this.diagram.nameTable[r.id].parentId="",e=!0,M.wrapper.children.splice(S,1)}}if(In(r,h,this.diagram,this.action),(M=un(this.diagram,r)?this.diagram.nameTable[r.parentId]:this.diagram.nameTable[r.parentId]||r)&&M.container&&"Canvas"===M.container.type&&(M.wrapper.maxWidth=M.maxWidth=M.wrapper.actualSize.width,M.wrapper.maxHeight=M.maxHeight=M.wrapper.actualSize.height,n=!0),un(this.diagram,r,!0)&&M&&"Canvas"===M.container.type)if(this.diagram.selectedItems.nodes.length>1)for(v=0;v<this.diagram.selectedItems.nodes.length;v++)fn(this.diagram,this.diagram.selectedItems.nodes[parseInt(v.toString(),10)]);else fn(this.diagram,r);else a=this.updateContainerPropertiesExtend(M,r,i,t,a);if(this.diagram.lineRoutingModule&&this.diagram.constraints&ct.LineRouting&&!un(this.diagram,r,!0)&&(r.children&&(this.diagram.realActions|=bt.EnableGroupAction),this.diagram.nodePropertyChange(r,{},{width:r.width,height:r.height,offsetX:r.offsetX,offsetY:r.offsetY}),r.children&&(this.diagram.realActions&=~bt.EnableGroupAction)),r.shape.lanes&&this.updateLaneChildNode(r),n&&(M.maxWidth=M.wrapper.maxWidth=void 0,M.maxHeight=M.wrapper.maxHeight=void 0),e){this.diagram.nodePropertyChange(M,{},{offsetX:M.offsetX,offsetY:M.offsetY,width:M.width,height:M.height,rotateAngle:M.rotateAngle});var I={redoObject:{sourceIndex:void 0,source:b.source},type:"StackChildPositionChanged",undoObject:b,category:"Internal"};this.diagram.diagramActions&yt.UndoRedo||this.diagram.addHistoryEntry(I)}r&&r.container&&("Stack"===r.container.type||"Canvas"===r.container.type&&""===r.parentId)&&(r&&r.shape&&"UmlClassifier"===r.shape.type&&(r.wrapper.measureChildren=!0),this.diagram.nodePropertyChange(r,{},{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height,rotateAngle:r.rotateAngle}),r&&r.shape&&"UmlClassifier"===r.shape.type&&(r.wrapper.measureChildren=!1))}Rr(i,this.diagram),a.hasStack=o}else if(r instanceof qh){f=t.offsetX-r.offsetX,m=t.offsetY-r.offsetY,y=t.rotateAngle-r.rotateAngle,g=t.width-r.width,u=t.height-r.height;var P=t.width/r.width,C=t.height/r.height;if(this.tool.corner){var T=this.tool.getPivot(this.tool.corner);for(v=0;v<r.nodes.length;v++){var A=(L=r.nodes[parseInt(v.toString(),10)]).wrapper,O=r.wrapper,D=ys(l=O.offsetX-O.actualSize.width*O.pivot.x,c=O.offsetY-O.actualSize.height*O.pivot.y,O.actualSize.width,O.actualSize.height,O.rotateAngle,O.offsetX,O.offsetY,T);this.diagram.commandHandler.scaleObject(P,C,D,L,A,r)}}else for(v=0;v<r.nodes.length;v++){var M,L=r.nodes[parseInt(v.toString(),10)];(M=this.diagram.nameTable[L.parentId])&&"SwimLane"!==M.shape.type&&un(this.diagram,L,!0)&&"Canvas"===M.container.type&&(L.offsetX+=f,L.offsetY+=m,L&&L.shape&&"UmlClassifier"!==L.shape.type&&(L.width+=g,L.height+=u),L.rotateAngle+=y,fn(this.diagram,L))}}}return r&&(r.isPhase||r.isLane||r.shape&&"SwimLane"===r.shape.type)&&this.diagram.updateDiagramElementQuad(),a},t.prototype.updateLaneChildNode=function(t){for(var e=0;e<t.shape.lanes.length;e++)if(t.shape.lanes[parseInt(e.toString(),10)].children&&t.shape.lanes[parseInt(e.toString(),10)].children.length>0)for(var i=0;i<t.shape.lanes[parseInt(e.toString(),10)].children.length;i++){var r=t.shape.lanes[parseInt(e.toString(),10)].children[parseInt(i.toString(),10)].id,n=this.diagram.nameTable[""+r];n&&(n.offsetX=n.wrapper.offsetX,n.offsetY=n.wrapper.offsetY)}},t.prototype.updateContainerPropertiesExtend=function(t,e,r,n,o){if("ResizeEast"===this.currentAction||"ResizeSouth"===this.currentAction||"SwimLane"===e.shape.type){var a=N(e),s=!1;if(t&&t.container&&"Grid"===t.container.type){var h="SwimLane"===t.shape.type,d=h?t.wrapper.children[0]:t.wrapper,l=h?t.shape.padding:void 0,c=t.wrapper.bounds.x,p=t.wrapper.bounds.y;if(void 0!==e.columnIndex&&"Horizontal"===t.container.orientation&&(h&&e.isPhase||!h&&1===e.rowIndex)||"Vertical"===t.container.orientation&&(!h&&e.rowIndex>0&&e.columnIndex>0||h&&e.isLane)){"Horizontal"===t.container.orientation&&e.isPhase&&e.wrapper.width>e.maxWidth&&(e.maxWidth=e.wrapper.width,e.wrapper.maxWidth=e.wrapper.width);var g=n.wrapper.actualSize.width-e.wrapper.actualSize.width;if(d.updateColumnWidth(e.columnIndex,n.width,!0,l),Hr(this.diagram,e,t,n,g),e.isPhase){var u=t.shape.phases[e.columnIndex].header.id,f=this.diagram.nameTable[""+u];f.maxWidth<n.width&&(f.maxWidth=n.width,f.wrapper.maxWidth=n.width)}"SwimLane"===t.shape.type&&(t.width=t.width?d.width:t.width,Fr(this.diagram,t),t.wrapper.width=t.width,r=Dr(this.diagram,d,e.rowIndex))}else if(void 0!==e.rowIndex){s=!0;var m=n.wrapper.actualSize.height-e.wrapper.actualSize.height;d.updateRowHeight(e.rowIndex,n.height,!0,l),Hr(this.diagram,e,t,n,void 0,m),"SwimLane"===t.shape.type&&(t.height=t.height?d.height:t.height,t.wrapper.height=t.height,r=Dr(this.diagram,d,e.rowIndex))}"SwimLane"===t.shape.type&&(o.isPreventHistory=!0),this.diagram.nodePropertyChange(t,{},{offsetX:t.offsetX,offsetY:t.offsetY,rotateAngle:t.rotateAngle}),this.diagram.drag(t,c-t.wrapper.bounds.x,p-t.wrapper.bounds.y)}else e&&e.shape&&"UmlClassifier"===e.shape.type&&(e.wrapper.measureChildren=!0),this.diagram.nodePropertyChange(e,{},{offsetX:e.offsetX,offsetY:e.offsetY,width:e.width,height:e.height,rotateAngle:e.rotateAngle}),e.wrapper.measureChildren=!1;if(e.wrapper.measure(new i(e.wrapper.width,e.wrapper.height)),e.wrapper.arrange(e.wrapper.desiredSize),"ResizeEast"===this.currentAction||"ResizeSouth"===this.currentAction){var y={category:"Internal",type:s?"RowHeightChanged":"ColumnWidthChanged",undoObject:a,redoObject:N(e)};this.diagram.addHistoryEntry(y)}}return Rr(r,this.diagram),o},t.prototype.addUmlNode=function(){var t,e,i=this.diagram.selectedItems.nodes[0],r=this.diagram.findObjectsUnderMouse({x:this.currentPosition.x+20,y:this.currentPosition.y}),n=this.diagram.findObjectUnderMouse(r,this.action,this.inAction);if(n||(r=this.diagram.findObjectsUnderMouse({x:this.currentPosition.x-20,y:this.currentPosition.y}),n=this.diagram.findObjectUnderMouse(r,this.action,this.inAction)),i&&i.container&&"Stack"===i.container.type&&n&&n.parentId&&n.parentId===i.id){var o=n,a=nd(this.diagram.element.id);if(a.getElementById(a.id+"_stack_highlighter")){var s=i.wrapper.children.indexOf(n.wrapper)+1;this.diagram.enableServerDataBinding(!1);var h=new Yh(this.diagram,"nodes",{style:{fill:i.style.fill,strokeColor:"black"===i.style.strokeColor?"#ffffff00":i.style.strokeColor},annotations:n.annotations,verticalAlignment:"Stretch",horizontalAlignment:"Stretch",constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),minHeight:25},!0);h.annotations[0].content=" + Name : Type";o.id.split("_");h.id=E()+h.id,h.parentId=i.id,h.zIndex=-1,h.umlIndex=s,this.diagram.startGroupAction();var d={name:"Name",type:"Type"};if("Class"===i.shape.classifier&&(n.id.includes("_umlProperty")&&i.shape.classShape.attributes.length>0?(t=new kh(i,"",d),i.shape.classShape.attributes.push(t)):n.id.includes("_umlMethods")&&i.shape.classShape.methods.length>0&&(e=new Bh(i,"",d),i.shape.classShape.methods.push(e))),"Interface"===i.shape.classifier&&(n.id.includes("_umlProperty")&&i.shape.interfaceShape.attributes.length>0?(t=new kh(i,"",d),i.shape.classShape.attributes.push(t)):n.id.includes("_umlMethods")&&i.shape.interfaceShape.methods.length>0&&(e=new Bh(i,"",d),i.shape.interfaceShape.methods.push(e))),"Enumeration"===i.shape.classifier&&n.id.includes("_umlMember")&&i.shape.enumerationShape.members.length>0){var l=new jh(i,"",d);i.shape.enumerationShape.members.push(l)}i.wrapper.children.indexOf(h.wrapper);this.diagram.enableServerDataBinding(!0),this.diagram.add(h),this.diagram.updateConnectorEdges(i),this.diagram.clearSelection(),this.diagram.select([this.diagram.nameTable[h.id]]),this.diagram.endGroupAction(),this.diagram.startTextEdit()}}},t}(),sl=function(){function t(){}return t.prototype.findObjectsUnderMouse=function(t,e,i,r,n){var o,a,s,h,d=[];r&&r instanceof qh&&r.nodes.length+r.connectors.length===1&&(r=r.nodes[0]||r.connectors[0]).children&&0===r.children.length&&(i.actualObject=r);for(var l,c=r&&r instanceof Co&&(r.constraints&at.ConnectToNearByNode||r.constraints&at.ConnectToNearByPort)&&r.connectionPadding||0,p={},g=0,u=e.spatialSearch.findObjects(new w(t.x-50-c,t.y-50-c,100+c,100+c));g<u.length;g++){var f=t;a=(M=u[g]).wrapper.outerBounds;var m=!M.rotateAngle&&a.containsPoint(f,c);if((M!==r||e.currentDrawingObject instanceof Co)&&M instanceof Co?M!==e.currentDrawingObject:M.wrapper.visible)if((C=e.commandHandler.getObjectLayer(M.id))&&!C.lock&&C.visible){if(l=p[C.zIndex]=p[C.zIndex]||[],M.rotateAngle){a=B(o=M.wrapper);for(var y=0,v=o.children;y<v.length;y++)s=v[y],T(h=I(),-(s.rotateAngle+s.parentTransform),s.offsetX,s.offsetY),f=P(h,t),B(s).containsPoint(f,c)&&(m=!0)}if((!r||!1===Dn(e,M))&&Fi(M)&&(M instanceof Co?ca(M,t):m||M.flip)){var b=M instanceof Co&&M.hitPadding||0;this.findElementUnderMouse(M,t,e,c||b)&&"helper"!==M.id&&ps(M,"zIndex",l)}}}for(var S=0,x=e.layers;S<x.length;S++){var C,A=p[(C=x[S]).zIndex];A&&A.length>1&&(A=cs(A));for(var O=0,D=d=d.concat(A||[]);O<D.length;O++){var M,L="eventHandler";if("Bpmn"===(M=D[O]).shape.type&&M.processId&&(!(e[""+L].tool instanceof Hn)||e[""+L].tool instanceof Hn&&er(M)))(j=d.indexOf(e.nameTable[M.processId]))>-1&&d.splice(j,1);if("UmlClassifier"===M.shape.type&&M.container&&"Stack"===M.container.type)(j=d.indexOf(e.nameTable[e.nameTable[M.id].wrapper.children[0].id]))>-1&&d.splice(j,1)}}for(var E=0;E<d.length;E++){var z=e.nameTable[d[parseInt(E.toString(),10)].parentId];if(z)for(var k=this.findElementUnderMouse(z,t,e),R=0;R<z.ports.length;R++)if(k&&k.id.match("_"+z.ports[parseInt(R.toString(),10)].id+"$")){var N=z.ports[parseInt(R.toString(),10)];if(gr(N)||pr(N))return d}for(;z;){var j;if(-1===(j=d.indexOf(z)))break;d.splice(j,1),z=e.nameTable[z.parentId]}}if(this.checkSwimlane(d,e),i&&!i.source)for(E=0;E<d.length;E++){var H=e.nameTable[d[parseInt(E.toString(),10)].parentId];if(H&&"SwimLane"===H.shape.type)for(R=0;R<d.length;R++){d[parseInt(R.toString(),10)]instanceof Co&&d.splice(E,1)}}return d},t.prototype.checkSwimlane=function(t,e){for(var i,r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],o=void 0,a=void 0;n instanceof Yh&&(o=t[parseInt(r.toString(),10)].parentId,a=n),""===o&&(i="SwimLane"!==a.shape.type);var s=e.nameTable[""+o];if(s&&s.isLane&&e.nameTable[s.parentId].zIndex>n.zIndex&&(t[parseInt(r.toString(),10)]=s),r>0&&i&&a&&(a.isLane||a.isPhase||a.isHeader)&&t[parseInt(r.toString(),10)].zIndex<t[r-1].zIndex){var h=t[parseInt(r.toString(),10)];t[parseInt(r.toString(),10)]=t[r-1],t[r-1]=h}}if(t.length>=2)for(var d=t.length-1;d>=0;d--)if(t[parseInt(d.toString(),10)].parentId){var l=Bs(t[parseInt(d.toString(),10)],e,""),c=Bs(t[d-1],e,""),p=e.nameTable[""+l],g=e.nameTable[""+c];g&&l!==c&&p.zIndex<g.zIndex&&t.splice(d,1)}},t.prototype.isTarget=function(t,e,i){var r,n=e.selectedItems.connectors[0];if(!(r="ConnectorSourceEnd"===i?e.nameTable[n.targetID]:r=e.nameTable[n.sourceID])||r.processId&&!t.processId||r.processId!==t.processId||(r.processId!==t.processId&&(t=null),t&&t.parentId&&"UmlClassifier"===e.nameTable[t.parentId].shape.type&&(t=e.nameTable[t.parentId])),"ConnectorSourceEnd"===i&&n.targetID){var o=e.nameTable[n.targetID];if(o&&o.shape&&"TextAnnotation"===o.shape.shape){var a=n.id.split("_");("Bpmn"===o.shape.type&&"Bpmn"!==t.shape.type||a[0]===t.id||"TextAnnotation"===t.shape.shape)&&(t=null),t&&t.parentId&&"UmlClassifier"===e.nameTable[t.parentId].shape.type&&(t=e.nameTable[t.parentId])}}return t&&(r&&t.id===r.processId||r&&"Container"===t.shape.type&&t.id===r.parentId||("ConnectorSourceEnd"===i||"ConnectorTargetEnd"===i)&&t.id===n.parentId)&&(t=null),t},t.prototype.findObjectUnderMouse=function(t,e,i,r,n,o,a){var s,h,d="eventHandler",l="endPoint",c=null;if(null===n&&(n={}),0!==e.length)if(a&&a instanceof qh&&a.nodes.length+a.connectors.length===1&&(a=a.nodes[0]||a.connectors[0]),"ConnectorSourceEnd"===i&&a||"PortDraw"===i||(sr(t)||ar(t))&&vs(t.drawingObject)===Co)for(var p=t.selectedItems.connectors[0],g=e.length-1;g>=0;g--){h=ns(e[parseInt(g.toString(),10)],!1),s=ns(e[parseInt(g.toString(),10)],!0);var u=t[""+d].tool,f=this.findTargetElement(e[parseInt(g.toString(),10)].wrapper,o,t,void 0);if("Draw"===i&&f&&(e[parseInt(g.toString(),10)]instanceof Yh||e[parseInt(g.toString(),10)]instanceof Co)&&!Ts(e[parseInt(g.toString(),10)],f)&&(u&&"ConnectorSourceEnd"===u[""+l]&&!Ji(e[parseInt(g.toString(),10)])||u&&"ConnectorTargetEnd"===u[""+l]&&!Qi(e[parseInt(g.toString(),10)])))return c;if(e[parseInt(g.toString(),10)]instanceof Yh||e[parseInt(g.toString(),10)]instanceof Co&&(Ji(e[parseInt(g.toString(),10)])||$i(h)||Qi(e[parseInt(g.toString(),10)])||Ki(s)||"PortDraw"===i&&u instanceof jn&&"ConnectorTargetEnd"===u[""+l]&&(Qi(e[parseInt(g.toString(),10)])||Ki(s))))return c=e[parseInt(g.toString(),10)],p&&(c=this.isTarget(c,t,i)),n.actualObject=c,c}else if("ConnectorTargetEnd"===i&&a){for(g=e.length-1;g>=0;g--)if(s=ns(e[parseInt(g.toString(),10)],!0),(e[parseInt(g.toString(),10)]instanceof Yh||e[parseInt(g.toString(),10)]instanceof Co)&&(Qi(e[parseInt(g.toString(),10)])||Ki(s)))return c=e[parseInt(g.toString(),10)],c=this.isTarget(c,t,i),n.actualObject=c,c}else{if(a&&("Drag"===i||t[""+d].tool instanceof Hn)){var m=0;for(g=0;g<e.length;g++){var y=e[parseInt(g.toString(),10)];a!==y&&(y instanceof Co||!o||y.wrapper.bounds.containsPoint(o))&&er(y)&&(c?(c=m>=y.zIndex?c:y,m=Math.max(m,y.zIndex)):m=(c=y).zIndex)}return c&&"Bpmn"===c.shape.type&&(t.selectedItems.nodes.length>0&&"Bpmn"===t.selectedItems.nodes[0].shape.type&&"TextAnnotation"!==t.selectedItems.nodes[0].shape.shape||(c=null)),c&&(n.actualObject=c),c}if("Select"!==i&&"Pan"!==i||!t[""+d].tool)if("Pan"===i||"LayoutAnimation"===i){for(g=e.length-1;g>=0;g--)if(e[parseInt(g.toString(),10)]instanceof Yh||e[parseInt(g.toString(),10)]instanceof Co){f=this.findTargetElement(e[parseInt(g.toString(),10)].wrapper,o,t,void 0);if("Pan"===i||f&&(f.id.match("_icon_content_shape$")||f.id.match("_icon_content_rect$")))return e[parseInt(g.toString(),10)]}}else c=e[e.length-1],n&&c&&(n.actualObject=c);else{for(var g=e.length-1;g>=0;g--)if(e[parseInt(g.toString(),10)]instanceof Co){var v=e[g-1];if(e[g-1]instanceof Yh&&v.ports){if((f=this.findTargetElement(v.wrapper,o,t,void 0))&&(f.id.match("_icon_content_shape$")||f.id.match("_icon_content_rect$")))return v;for(var b=0;b<v.ports.length;b++)if(f&&f.id.match("_"+v.ports[parseInt(b.toString(),10)].id+"$")&&pr(v.ports[parseInt(b.toString(),10)]))return v}}if(c=e[e.length-1],n.actualObject=c,!t[""+d].itemClick(c,!0)&&c.parentId&&t.nameTable[c.parentId]&&"Container"!==t.nameTable[c.parentId].shape.type)for(var S=c,w=Dn(t,S);S&&(!Dn(t,S)||w)&&(c=S,""===S.tooltip.content);)S=t.nameTable[S.parentId]}}return c},t.prototype.findElementUnderSelectedItem=function(t,e,i,r){return t instanceof qh?1!==t.nodes.length||t.connectors&&t.connectors.length?t.nodes&&!t.nodes.length||1!==t.connectors.length?null:this.findElementUnderMouse(t.connectors[0],e,i):this.findElementUnderMouse(t.nodes[0],e,i):this.findElementUnderMouse(t,e,i,r)},t.prototype.findElementUnderMouse=function(t,e,i,r){return this.findTargetElement(t.wrapper,e,i,r)},t.prototype.findTargetElement=function(t,e,i,r){for(var n=t.children.length-1;n>=0;n--){var o=t.children[parseInt(n.toString(),10)],a=void 0;if(o instanceof Zt&&Ws(o)&&o.position){var s=Hs({width:t.desiredSize.width,height:t.desiredSize.height,padding:t.padding,offsetX:t.offsetX,offsetY:t.offsetY,parentTransform:t.parentTransform,rotateAngle:t.rotateAngle},o);o.flippedPoint=s;var h=s.x-o.corners.topLeft.x,d=s.y-o.corners.topLeft.y;s?(a={left:o.bounds.x+h,top:o.bounds.y+d,right:o.bounds.x+h+o.bounds.width,bottom:o.bounds.y+d+o.bounds.height},o.flippedPoint=s):o.flippedPoint=void 0}else o.flippedPoint=void 0;if(o&&(a?_s(a,e,r||0):o.outerBounds.containsPoint(e,r||0)))if(o.visible){if(o instanceof Ut){var l=this.findTargetElement(o,e,i);if(l)return l}var c="Clip"===o.style.textOverflow||"Ellipsis"===o.style.textOverflow;if((a?_s(a,e,r||0):o.bounds.containsPoint(e,r||0))&&!c)return o;if(t.bounds.containsPoint(e,r||0)&&c)return o}else if(o instanceof Qt&&t&&t.id){var p=void 0;if(t.id.includes("group_container")){var g=t.id.slice(0,-15);p=i.getObject(g)}else p=i.getObject(t.id);if(rs(p,o.id))return o}}return t.bounds.containsPoint(e,r)&&"none"!==t.style.fill?t:null},t}(),hl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),dl=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},ll=function(t){function i(e,i,r,n){var o=t.call(this,e,i,r,n)||this;return o.objectZIndex=-1,o.zIndexTable={},o.objects=[],o}return hl(i,t),dl([(0,e.Property)("")],i.prototype,"id",void 0),dl([(0,e.Property)(!0)],i.prototype,"visible",void 0),dl([(0,e.Property)(!1)],i.prototype,"lock",void 0),dl([(0,e.Property)()],i.prototype,"objects",void 0),dl([(0,e.Property)()],i.prototype,"addInfo",void 0),dl([(0,e.Property)(-1)],i.prototype,"zIndex",void 0),i}(e.ChildProperty),cl=function(){return cl=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},cl.apply(this,arguments)},pl=function(t,e,i,r){return new(i||(i=Promise))(function(n,o){function a(t){try{h(r.next(t))}catch(t){o(t)}}function s(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,s)}h((r=r.apply(t,e||[])).next())})},gl=function(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ul=function(){function t(t){this.clipboardData={},this.diagramObject={},this.newSelectedObjects={},this.oldSelectedObjects={},this.changedNodeZIndexes={},this.connectorsTable=[],this.PreventConnectorSplit=!1,this.processTable={},this.containerChildTable={},this.isContainer=!1,this.canUpdateTemplate=!1,this.cloningInProgress=!1,this.clonedChildrenTable={},this.annotationRestrictDeltaValue={x:0,y:0},this.childTable={},this.objectStore=[],this.parentTable={},this.blazor="Blazor",this.blazorInterop="sfBlazor",this.cloneGroupChildCollection=[],this.diagram=t}return Object.defineProperty(t.prototype,"snappingModule",{get:function(){return this.diagram.snappingModule},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layoutAnimateModule",{get:function(){return this.diagram.layoutAnimateModule},enumerable:!0,configurable:!0}),t.prototype.startTransaction=function(t){this.state={element:this.diagram.selectedItems,backup:null},t&&this.diagram.protectPropertyChange(!0),ad(this.diagram.element.id).style.pointerEvents="none"},t.prototype.endTransaction=function(t){this.state=null,t&&this.diagram.protectPropertyChange(!1),ad(this.diagram.element.id).style.pointerEvents="all"},t.prototype.setFocus=function(){document.getElementById(this.diagram.element.id).focus()},t.prototype.showTooltip=function(t,i,r,n,o){var a,s,h=this,d=!1;if(t instanceof qh?1===t.nodes.length&&0===t.connectors.length?(a=t.nodes[0].id,t.nodes[0].shape&&t.nodes[0].shape instanceof fh&&(d=!0)):0===t.nodes.length&&1===t.connectors.length?a=t.connectors[0].id:s=document.getElementById(this.diagram.element.id+"_SelectorElement"):t instanceof Yh?(a=t.id,t.shape&&t.shape instanceof fh&&(d=!0)):a=t.id,(0,e.isNullOrUndefined)(s)&&!(0,e.isNullOrUndefined)(a)){var l=d?"_content_native_element":"_groupElement";s=document.getElementById(a+l)}if(o&&(this.diagram.tooltipObject.position="BottomCenter",this.diagram.tooltipObject.animation={open:{delay:0,duration:0}},this.diagram.tooltipObject.openDelay=0,this.diagram.tooltipObject.closeDelay=0),this.diagram.selectedItems.setTooltipTemplate){var c=void 0,p=J(this.diagram.selectedItems.setTooltipTemplate);p&&(c=p(t,this.diagram)),r=c instanceof HTMLElement?c.cloneNode(!0):c||r}this.diagram.tooltipObject.isSticky=!1,t.tooltip&&(this.diagram.tooltipObject.openOn=t.tooltip.openOn),this.diagram.tooltipObject.content="string"==typeof r?(0,e.initializeCSPTemplate)(function(){return r}):r,this.diagram.tooltipObject.offsetX=0,this.diagram.tooltipObject.offsetY=0,this.diagram.tooltipObject.refresh(s),o&&setTimeout(function(){h.diagram.tooltipObject.open(s)},1)},t.prototype.connectorSplit=function(t,e){var i=t.id,r=N(e),n=this.diagram.connectors.indexOf(e),o=this.diagram.nodes.indexOf(t),a=N(t),s={},h={},d={offsetX:a.offsetX,offsetY:a.offsetY},l={sourceID:r.sourceID,sourcePoint:r.sourcePoint,sourcePortID:r.sourcePortID,targetID:r.targetID,targetPoint:r.targetPoint,targetPortID:r.targetPortID};s[parseInt(n.toString(),10)]=l,h[parseInt(o.toString(),10)]=d;var c={},p={},g={},u={};if(""!==r.sourceID&&""!==r.targetID?u.targetID=this.ConnectorTargetChange(e,i):""!==r.sourceID&&""===r.targetID?(this.nodeOffsetChange(g,a,e.targetPoint),u.targetID=this.ConnectorTargetChange(e,i)):(""===r.sourceID&&""===r.targetID||""===r.sourceID&&""!==r.targetID)&&(this.nodeOffsetChange(g,a,e.sourcePoint),u.sourceID=this.ConnectorSourceChange(e,i)),c[parseInt(n.toString(),10)]=u,p[parseInt(o.toString(),10)]=g,this.diagram.nodePropertyChange(t,d,g),this.diagram.updateSelector(),this.diagram.connectorPropertyChange(e,l,u),""!==r.sourceID&&""!==r.targetID){var f={id:"connector "+i,constraints:at.Default|at.AllowDrop,sourceID:i};f.type=r.type,f.style=r.style,f.sourceDecorator=r.sourceDecorator,f.targetDecorator=r.targetDecorator,f.targetID=r.targetID,""!==r.targetPortID&&(f.targetPortID=r.targetPortID),this.diagram.add(f)}var m={type:"PropertyChanged",redoObject:{nodes:p},undoObject:{nodes:h},category:"Internal"};this.diagram.addHistoryEntry(m);var y={type:"PropertyChanged",redoObject:{connectors:c},undoObject:{connectors:s},category:"Internal"};this.diagram.addHistoryEntry(y)},t.prototype.nodeOffsetChange=function(t,e,i){t.offsetX=e.offsetX=i.x,t.offsetY=e.offsetY=i.y},t.prototype.ConnectorTargetChange=function(t,e){return t.targetID=e,e},t.prototype.ConnectorSourceChange=function(t,e){return t.sourceID=e,e},t.prototype.closeTooltip=function(){this.diagram.tooltipObject.close()},t.prototype.canEnableDefaultTooltip=function(){return!!(this.diagram.selectedItems.constraints&rt.ToolTip)},t.prototype.updateSelector=function(){this.diagram.updateSelector()},t.prototype.triggerEvent=function(t,e){return pl(this,void 0,void 0,function(){return gl(this,function(i){switch(i.label){case 0:return t!==xt.drop&&t!==xt.positionChange&&t!==xt.connectionChange?[3,3]:this.diagram.currentSymbol?[2]:(t===xt.drop&&(e.source=this.diagram),this.diagram.currentDrawingObject instanceof Co&&t!==xt.positionChange?[4,this.diagram.triggerEvent(t,e)]:[3,2]);case 1:return[2,i.sent()];case 2:if(this.diagram.currentDrawingObject&&t!==xt.positionChange)return[2];i.label=3;case 3:return[4,this.diagram.triggerEvent(t,e)];case 4:return[2,i.sent()]}})})},t.prototype.dragOverElement=function(t,e){if(this.diagram.currentSymbol){var i={element:t.source,target:t.target,mousePosition:e,diagram:this.diagram};this.triggerEvent(xt.dragOver,i)}},t.prototype.disConnect=function(t,e,i){var r,n,o={},a={};if(t instanceof qh?n=t.connectors[0]:t instanceof Co&&this.diagram.currentDrawingObject&&this.diagram.currentDrawingObject instanceof Co?n=this.diagram.currentDrawingObject:this.diagram.eventHandler.tool&&this.diagram.eventHandler.tool instanceof Fn&&this.diagram.eventHandler.tool.drawingObject&&(n=this.diagram.eventHandler.tool.drawingObject),t&&n&&(On(this.diagram)||this.diagram.currentDrawingObject))if(!e||"ConnectorSourceEnd"!==e&&"ConnectorTargetEnd"!==e){if("OrthoThumb"!==e&&"SegmentEnd"!==e&&(n.sourceID||n.targetID)){o={sourceID:n.sourceID,sourcePortID:n.sourcePortID,targetID:n.targetID,targetPortID:n.targetPortID},n.sourceID="",n.sourcePortID="",n.targetID="",n.targetPortID="";var s={connector:n,oldValue:o,newValue:a={sourceID:n.sourceID,sourcePortID:n.sourcePortID,targetID:n.targetID,targetPortID:n.targetPortID},cancel:!1,state:"Changing",connectorEnd:e};this.triggerEvent(xt.connectionChange,s),s.cancel?(n.sourceID=o.sourceID,n.sourcePortID=o.sourcePortID,n.targetID=o.targetID,n.targetPortID=o.targetPortID):(this.diagram.connectorPropertyChange(n,o,a),this.diagram.updateDiagramObject(n),s={connector:n,oldValue:o,newValue:a,cancel:!1,state:"Changed",connectorEnd:e},this.triggerEvent(xt.connectionChange,s))}}else{var h="ConnectorSourceEnd"===e?"sourceID":"targetID",d="ConnectorSourceEnd"===e?"sourcePortID":"targetPortID";n[""+h]&&(o[""+h]=n[""+h],n[""+h]="",a[""+h]=n[""+h],(n.sourcePortID||n.targetPortID)&&(o[""+d]=n[""+d],n[""+d]="",a[""+d]=n[""+d]),r=this.connectionEventChange(n,o,a,e,i))}return r},t.prototype.trackConnectorChange=function(t){if(t.nodes&&t.nodes.length>0)for(var e=0,i=t.nodes;e<i.length;e++)for(var r=i[e],n=0,o=r.outEdges.concat(r.inEdges);n<o.length;n++){var a=o[n],s=this.diagram.getObject(a);if(s&&s.segments&&("Bezier"===s.type?s.segments.length>=1:s.segments.length>1)&&-1===t.connectors.indexOf(s)){var h=N(s);t.connectors.push(h)}}},t.prototype.connectionEventChange=function(t,e,i,r,n){var o,a="ConnectorSourceEnd"===r?"sourceID":"targetID",s="ConnectorSourceEnd"===r?"sourcePortID":"targetPortID";if(this.enableCloneObject){var h=N(o=this.diagram.nameTable[i[""+a]]);this.diagram.insertValue(h,!0)}var d={cancel:!1,state:"Changing",connectorEnd:r,connector:t,oldValue:{nodeId:e[""+a],portId:e[""+s]},newValue:{nodeId:i[""+a],portId:i[""+s]}};if(this.triggerEvent(xt.connectionChange,d),d.cancel&&(t[""+a]=e[""+a],t[""+s]=e[""+s],i=e),this.diagram.connectorPropertyChange(t,e,i),this.diagram.updateDiagramObject(t),d={connector:t,oldValue:{nodeId:e[""+a],portId:e[""+s]},newValue:{nodeId:i[""+a],portId:i[""+s]},cancel:!1,state:"Changing",connectorEnd:r},this.enableCloneObject&&void 0===o){h=N(o=this.diagram.nameTable[e[""+a]]);this.diagram.insertValue(h,!0)}this.diagram.bpmnModule&&(t.isBpmnAnnotationConnector&&(this.diagram.nameTable[t.targetID].shape.textAnnotation.textAnnotationTarget=t.sourceID))},t.prototype.findTarget=function(t,i,r,n){if(i instanceof Yh){if(t&&t.id===i.id+"_content")return i;if(r&&"Bpmn"===i.shape.type&&!(0,e.isBlazor)()&&"Activity"===i.shape.shape&&"Transaction"===i.shape.activity.subProcess.type){var o=i.shape.activity.subProcess.transaction;if(o.success.visible&&0===t.id.indexOf(i.id+"_success"))return o.success;if(o.cancel.visible&&0===t.id.indexOf(i.id+"_cancel"))return o.cancel;if(o.failure.visible&&0===t.id.indexOf(i.id+"_failure"))return o.failure}if(t instanceof Qt||t instanceof Bi){var a=this.findMatch(i.ports,i.id,t.id);if(a)return a;var s=this.findMatch(i.fixedUserHandles,i.id,t.id);if(s)return s}}if(i instanceof Co){if(t&&t.id===i.id+"_path")return i;if(t instanceof Qt||t instanceof Bi){var h=this.findMatch(i.ports,i.id,t.id);if(h)return h;var d=this.findMatch(i.fixedUserHandles,i.id,t.id);if(d)return d}}if(!n)for(var l=void 0,c=0;c<i.annotations.length;c++)if(l=i.annotations[parseInt(c.toString(),10)],t.id===i.id+"_"+l.id)return l;return i},t.prototype.findMatch=function(t,e,i){for(var r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)];if(i===e+"_"+n.id||i===e+"_"+n.id+"_shape")return n}},t.prototype.canDisconnect=function(t,e,i,r){var n;e.source instanceof qh?n=e.source.connectors[0]:e.source instanceof Co&&this.diagram.currentDrawingObject&&(n=this.diagram.currentDrawingObject);this.findTarget(e.targetWrapper,e.target,"ConnectorSourceEnd"===t,!0);var o="ConnectorSourceEnd"===t?"sourcePortID":"targetPortID";return n[""+("ConnectorSourceEnd"===t?"sourceID":"targetID")]!==r||n[""+o]!==i},t.prototype.connect=function(t,e,i){var r,n,o,a,s={},h={};e.source instanceof qh?o=e.source.connectors[0]:e.source instanceof Co&&this.diagram.currentDrawingObject&&this.diagram.currentDrawingObject instanceof Co?o=this.diagram.currentDrawingObject:this.diagram.eventHandler.tool&&(this.diagram.eventHandler.tool instanceof qn||this.diagram.eventHandler.tool instanceof Fn)&&this.diagram.eventHandler.tool.drawingObject&&(o=this.diagram.eventHandler.tool.drawingObject);var d=this.findTarget(e.targetWrapper||e.sourceWrapper,e.target||e.actualObject,"ConnectorSourceEnd"===t,!0),l="ConnectorSourceEnd"===t?"sourceID":"targetID",c="ConnectorSourceEnd"===t?"sourcePortID":"targetPortID";if(d instanceof Yh)h[""+l]=o[""+l],o[""+l]=d.id,s[""+l]=o[""+l],h[""+c]=o[""+c],a=this.connectionEventChange(o,h,s,t,i);else if(d instanceof me||d instanceof Ch){r=o[""+l],n=o[""+c],o[""+c]=d.id,o[""+l]=e.target&&e.target.id||e.actualObject.id,s[""+l]=o[""+l],s[""+c]=o[""+c];var p={connector:o,oldValue:{nodeId:r,portId:n},newValue:{nodeId:s[""+l],portId:s[""+c]},cancel:!1,state:"Changing",connectorEnd:t};this.triggerEvent(xt.connectionChange,p),p.cancel?(o[""+l]=r,o[""+c]=n,s[""+l]=r,s[""+c]=n):(this.diagram.connectorPropertyChange(o,h,s),this.diagram.updateDiagramObject(o),p={connector:o,oldValue:{nodeId:r,portId:n},newValue:{nodeId:s[""+l],portId:s[""+c]},cancel:!1,state:"Changing",connectorEnd:t})}return this.updateSelector(),this.renderHighlighter(e,void 0,"ConnectorSourceEnd"===t),a},t.prototype.cut=function(){this.clipboardData.pasteIndex=0,this.diagram.undoRedoModule&&this.diagram.historyManager.startGroupAction(),this.clipboardData.clipObject=this.copyObjects(),this.diagram.undoRedoModule&&this.diagram.historyManager.endGroupAction(),"SVG"!==this.diagram.mode&&this.diagram.refreshDiagramLayer()},t.prototype.addLayer=function(t,e,i){void 0===i&&(i=!0),t.id=t.id||E(),t.zIndex=this.diagram.layers.length;var r=this.diagram.allowServerDataBinding;this.diagram.enableServerDataBinding(!1),t=new ll(this.diagram,"layers",t,!0),this.diagram.enableServerDataBinding(r),t.objectZIndex=-1,t.zIndexTable={},this.diagram.layers.push(t),this.diagram.layerZIndexTable[t.zIndex]=t.id,this.diagram.activeLayer=t;t.objects;if(e)for(var n=0;n<e.length;n++)this.diagram.add(e[parseInt(n.toString(),10)])},t.prototype.getObjectLayer=function(t){var e=this.diagram.layers;if(e.length>1)for(var i=0;i<e.length;i++){if(e[parseInt(i.toString(),10)].objects.indexOf(t)>-1)return e[parseInt(i.toString(),10)]}return this.diagram.activeLayer},t.prototype.getLayer=function(t){for(var e=this.diagram.layers,i=0;i<e.length;i++)if(e[parseInt(i.toString(),10)].id===t)return e[parseInt(i.toString(),10)]},t.prototype.removeLayer=function(t,e){void 0===e&&(e=!0);var i=this.getLayer(t);if(i){for(var r=this.diagram.layers.indexOf(i),n=i.objects,o=n.length-1;o>=0;o--)this.diagram.unSelect(this.diagram.nameTable[n[parseInt(o.toString(),10)]]),this.diagram.remove(this.diagram.nameTable[n[parseInt(o.toString(),10)]]),"default_layer"!==i.id&&this.diagram.activeLayer.id===t&&(this.diagram.activeLayer=this.diagram.layers[this.diagram.layers.length-1]);delete this.diagram.layerZIndexTable[i.zIndex],this.diagram.layers.splice(r,1),"SVG"!==this.diagram.mode&&this.diagram.refreshDiagramLayer()}},t.prototype.moveObjects=function(t,e){this.diagram.startGroupAction();for(var i={},r=[],n=0;n<t.length;n++){if((f=this.diagram.nameTable[t[parseInt(n.toString(),10)]])instanceof Yh){var o={inEdges:f.inEdges,outEdges:f.outEdges};i[""+f.id]=N(o)}else if(f instanceof Co){o={sourceID:f.sourceID,targetID:f.targetID,sourcePortID:f.sourcePortID,targetPortID:f.targetPortID};i[""+f.id]=N(o)}}var a,s=this.getLayer(e)||this.diagram.activeLayer;this.diagram.setActiveLayer(s.id);for(var h=0,d=t;h<d.length;h++){n=d[h];if(this.getObjectLayer(n).objects.indexOf(n)>-1){if(r=[],(a=this.diagram.nameTable[""+n]).children)for(var l=0,c=a.children;l<c.length;l++){var p=c[l];r.push(this.diagram.nameTable[""+p])}this.diagram.unSelect(a),this.diagram.deleteDependentConnector=!1,this.diagram.remove(this.diagram.nameTable[""+n]),this.diagram.deleteDependentConnector=!0;for(var g=null,u=0;u<s.objects.length;u++){var f,m=s.objects[parseInt(u.toString(),10)];(f=this.diagram.nameTable[""+m])&&(null===g||f.zIndex>g)&&(g=f.zIndex)}if(r.length>0){for(var y=void 0,v=0;v<r.length;v++){(p=r[parseInt(v.toString(),10)]).zIndex=g+2+v,y=this.diagram.add(p),this.setConnectorDetails(y||p,i),a.children.push(y.id)}a.zIndex=g+1,y=this.diagram.add(a),this.setConnectorDetails(y||a,i)}else{a.zIndex=g+1;y=this.diagram.add(a);this.setConnectorDetails(y||a,i)}if(a.parentId){var b=a.parentId,S=this.diagram.nameTable[""+b];this.diagram.addChildToGroup(S,a.id)}}}this.diagram.endGroupAction()},t.prototype.setConnectorDetails=function(t,e){var i=e[t.id];if(t instanceof Yh){if(i){if(i.inEdges&&i.inEdges.length>0)for(var r=0;r<i.inEdges.length;r++){this.diagram.nameTable[i.inEdges[parseInt(r.toString(),10)]].targetID=t.id}if(i.outEdges&&i.outEdges.length>0)for(r=0;r<i.outEdges.length;r++){this.diagram.nameTable[i.outEdges[parseInt(r.toString(),10)]].sourceID=t.id}}}else t instanceof Co&&i&&(t.sourceID=i.sourceID,t.targetID=i.targetID,t.sourcePortID=i.sourcePortID,t.targetPortID=i.targetPortID)},t.prototype.cloneLayer=function(t){this.diagram.layers;var e=this.getLayer(t);if(e){var i=[],r={id:t+"_"+E(),objects:[],visible:!0,lock:!1};this.addLayer(r,null,!0),r.zIndex=this.diagram.layers.length-1;i.length;for(var n=0,o=e.objects;n<o.length;n++){var a=o[n];i.push(this.diagram.nameTable[""+a])}this.paste(i)}},t.prototype.copy=function(){return this.clipboardData.pasteIndex=1,this.clipboardData.clipObject=this.copyObjects(),this.clipboardData.clipObject},t.prototype.copyObjects=function(){var t=[],e=[];this.clipboardData.childTable={};var i={};if(this.diagram.selectedItems.connectors.length>0){t=t.concat(this.diagram.selectedItems.connectors);for(var r=0;r<t.length;r++){var n=void 0;n=this.diagram.bpmnModule&&t[parseInt(r.toString(),10)].isBpmnAnnotationConnector?N(this.diagram.nameTable[t[parseInt(r.toString(),10)].targetID]):N(t[parseInt(r.toString(),10)]),e.push(n)}}if(this.diagram.selectedItems.nodes.length>0){t=t.concat(this.diagram.selectedItems.nodes);var o=function(t){if(!a.diagram.selectedItems.nodes[parseInt(t.toString(),10)].isPhase){var r;a.diagram.selectedItems.nodes.forEach(function(t){t.isLane&&(r=t.parentId,i[parseInt(r.toString(),10)]=i[parseInt(r.toString(),10)]||[],-1===i[parseInt(r.toString(),10)].indexOf(t.id)&&i[parseInt(r.toString(),10)].push(t.id))});var n=N(a.diagram.selectedItems.nodes[parseInt(t.toString(),10)]),o=e.filter(function(t){return t.isLane}),s=!1;if(n.isLane)for(var h=0,d=o;h<d.length;h++){if(sn(d[h],n,a.diagram)){s=!0;break}}if(!((n.isLane||n.isHeader)&&a.checkSwimlaneInSelection(n,e)||function(t,e){return t.parentId&&-1!==e.selectedItems.nodes.indexOf(e.nameTable[t.parentId])}(n,a.diagram)||s)){n.wrapper&&n.offsetX!==n.wrapper.offsetX&&(n.offsetX=n.wrapper.offsetX),n.wrapper&&n.offsetY!==n.wrapper.offsetY&&(n.offsetY=n.wrapper.offsetY);a.copyProcesses(n),a.copyContainerChild(n),e.push(N(n));var l=I();if(T(l,-n.rotateAngle,n.offsetX,n.offsetY),n.children){for(var c=a.clipboardData.childTable,p=void 0,g=a.getAllDescendants(n,[],!0),u=0;u<g.length;u++){var f=c[(p=a.diagram.nameTable[g[parseInt(u.toString(),10)].id]).id]=N(p),m=P(l,{x:f.wrapper.offsetX,y:f.wrapper.offsetY});p instanceof Yh&&(f.offsetX=m.x,f.offsetY=m.y,f.rotateAngle-=n.rotateAngle)}a.clipboardData.childTable=c}if("SwimLane"===n.shape.type){var y=a.diagram.getObject(a.diagram.selectedItems.nodes[parseInt(t.toString(),10)].id),v=(c=a.clipboardData.childTable,Dr(a.diagram,y.wrapper.children[0]));for(u=0;u<v.length;u++){var b=a.diagram.getObject(v[parseInt(u.toString(),10)]);c[b.id]=N(b),c[b.id].parentSwimlaneId=n.id}}if(n&&n.isLane){c=a.clipboardData.childTable,y=a.diagram.getObject(n.parentId);if(0===a.clipboardData.pasteIndex&&y&&y.shape&&y.shape.lanes&&y.shape.lanes.length===i[parseInt(r.toString(),10)].length)return{value:[]};var S=an(n,a.diagram);c[n.id]=N(S),c[n.id].width=y.wrapper.actualSize.width}}}},a=this;for(r=0;r<this.diagram.selectedItems.nodes.length;r++){var s=o(r);if("object"==typeof s)return s.value}}if(this.sortByZIndex(e,"zIndex"),this.diagram.selectedItems.nodes.some(function(t){return"SwimLane"===t.shape.type})&&(e=this.removeDuplicateObjects(e)),0===this.clipboardData.pasteIndex){this.startGroupAction();for(var h=0,d=t;h<d.length;h++){var l=d[h];this.diagram.nameTable[l.id]&&(this.diagram.itemType="Clipboard",this.diagram.remove(l))}this.endGroupAction()}return e},t.prototype.findProcesses=function(t){var e=[];return t.shape.lanes.forEach(function(t){t.children&&t.children.forEach(function(t){var i=t.shape.activity;i&&i.subProcess.processes&&i.subProcess.processes.forEach(function(t){e.push(t)})})}),e},t.prototype.removeDuplicateObjects=function(t){for(var e={},i=0;i<t.length;i++)e[t[parseInt(i.toString(),10)].id]=t[parseInt(i.toString(),10)];var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.push(e[""+n]);var o,a=function(t){if(r[parseInt(t.toString(),10)].parentId){var e=s.diagram.getObject(r[parseInt(t.toString(),10)].parentId);e&&e.isLane&&e.parentId&&r.some(function(t){return t.id===e.parentId})&&(r.splice(t,1),t--)}o=t},s=this;for(i=0;i<r.length;i++)a(i),i=o;var h=Object.keys(this.clipboardData.childTable);return r.filter(function(t){return-1===h.indexOf(t.id)||t.isLane})},t.prototype.checkSwimlaneInSelection=function(t,e){return this.diagram.selectedItems.nodes.some(function(e){return e.id===t.parentId})},t.prototype.copyProcesses=function(t){var e=[];"Bpmn"===t.shape.type&&t.shape.activity&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length>0?e=t.shape.activity.subProcess.processes:"SwimLane"===t.shape.type&&(e=this.findProcesses(t));for(var i=0,r=e;i<r.length;i++){var n=r[i];this.processTable[""+n]=N(this.diagram.nameTable[""+n]),this.processTable[""+n].shape.activity.subProcess.processes&&this.processTable[""+n].shape.activity.subProcess.processes.length>0&&this.copyProcesses(this.processTable[""+n])}this.clipboardData.processTable=this.processTable},t.prototype.copyContainerChild=function(t){var e=[];if("Container"===t.shape.type&&t.shape.children&&t.shape.children.length>0&&(e=t.shape.children),t.children&&t.children.length>0)for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)],n=this.diagram.nameTable[""+r];n&&"Container"===n.shape.type&&n.shape.children.length>0&&(e=e.concat(n.shape.children))}for(var o=0,a=e;o<a.length;o++){var s=a[o];this.containerChildTable[""+s]=N(this.diagram.nameTable[""+s]),this.containerChildTable[""+s].shape.children&&this.containerChildTable[""+s].shape.children.length>0&&this.copyContainerChild(this.containerChildTable[""+s])}this.clipboardData.containerChildTable=this.containerChildTable},t.prototype.group=function(){var t=this;this.oldSelectedObjects=Is(this.diagram);var e=this.diagram.isProtectedOnChange;this.diagram.protectPropertyChange(!0),this.diagram.diagramActions=this.diagram.diagramActions|yt.Group;var i=[],r={};r.id="group"+E(),(r=new Yh(this.diagram,"nodes",r,!0)).children=[],i=(i=this.diagram.selectedItems.nodes).concat(this.diagram.selectedItems.connectors),this.diagram.connectors.forEach(function(e){var r=t.diagram.nameTable[e.sourceID],n=t.diagram.nameTable[e.targetID],o=r&&r.processId&&Dn(t.diagram,t.diagram.nameTable[r.processId]),a=n&&n.processId&&Dn(t.diagram,t.diagram.nameTable[n.processId]);i.some(function(t){return t.id===e.id})||!o&&!a||i.push(e)});for(var n=i.sort(function(t,e){return t.zIndex-e.zIndex}),o={},a=0;a<n.length;a++)n[parseInt(a.toString(),10)].parentId||n[parseInt(a.toString(),10)].processId||(r.children.push(n[parseInt(a.toString(),10)].id),o[n[parseInt(a.toString(),10)].id]=n[parseInt(a.toString(),10)].zIndex);if(r.children.length>0){this.diagram.itemType="Group";var s=this.diagram.add(r),h=this.getObjectLayer(s.id);this.updateGroupInZindexTable(s,o,h),s&&this.select(s),r.annotations=s.annotations,r.ports=s.ports,r.zIndex=s.zIndex,r.style=s.style;var d={type:"Group",undoObject:r,redoObject:r,category:"Internal"};this.addHistoryEntry(d),this.diagram.diagramActions=this.diagram.diagramActions&~yt.Group,this.diagram.protectPropertyChange(e)}},t.prototype.updateGroupInZindexTable=function(t,e,i){var r=i.zIndexTable;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=e[""+n];r[parseInt(o.toString(),10)]===n&&delete r[parseInt(o.toString(),10)]}if(t.children&&t.children.length)for(var a=0,s=t.children;a<s.length;a++){n=s[a];var h=this.diagram.nameTable[""+n];h&&(r[h.zIndex]=h.id)}},t.prototype.unGroup=function(t){var i=this.diagram.isProtectedOnChange;this.diagram.protectPropertyChange(!0),this.diagram.diagramActions=this.diagram.diagramActions|yt.Group;var r=[];if(t){var n=this.diagram.nameTable[t.id];r.push(n)}else r=this.diagram.selectedItems.nodes;this.diagram.startGroupAction();for(var o=0;o<r.length;o++){for(var a=r[parseInt(o.toString(),10)],s=N(a),h=[],d=0;d<a.children.length;d++)h.push(a.children[parseInt(d.toString(),10)]);if(a.children){a.ports&&a.ports.length>0&&this.diagram.removePorts(a,a.ports),a.annotations&&a.annotations.length>0&&!(0,e.isBlazor)()&&this.diagram.removeLabels(a,a.annotations);for(var l=this.diagram.nameTable[a.parentId],c=a.children.length-1;c>=0;c--){this.diagram.nameTable[a.children[parseInt(c.toString(),10)]].parentId="";var p=a.children[parseInt(c.toString(),10)];this.diagram.deleteChild(this.diagram.nameTable[a.children[parseInt(c.toString(),10)]],a),a.parentId&&p&&this.diagram.addChild(l,p)}this.resetDependentConnectors(a.inEdges,!0),this.resetDependentConnectors(a.outEdges,!1);var g={type:"UnGroup",undoObject:s,redoObject:s,category:"Internal"};this.diagram.diagramActions&yt.UndoRedo||this.addHistoryEntry(g),a.parentId&&this.diagram.deleteChild(a,l)}this.diagram.removeNode(a,h),this.clearSelection()}this.diagram.endGroupAction(),this.diagram.diagramActions=this.diagram.diagramActions&~yt.Group,this.diagram.protectPropertyChange(i)},t.prototype.resetDependentConnectors=function(t,e){for(var i=0;i<t.length;i++){var r=this.diagram.nameTable[t[parseInt(i.toString(),10)]],n=N(r),o=void 0;e?(r.targetID="",r.targetPortID="",o={targetID:r.targetID,targetPortID:r.targetPortID}):(r.sourceID="",r.sourcePortID="",o={sourceID:r.sourceID,sourcePortID:r.sourcePortID}),this.diagram.connectorPropertyChange(r,{},o);var a={type:"ConnectionChanged",undoObject:{connectors:[n],nodes:[]},redoObject:{connectors:[N(r)],nodes:[]},category:"Internal"};this.diagram.diagramActions&yt.UndoRedo||this.addHistoryEntry(a)}},t.prototype.paste=function(t){if(t||this.clipboardData.clipObject){this.diagram.protectPropertyChange(!0);var e=t?this.getNewObject(t):this.clipboardData.clipObject;if(e){var i=1!==e.length,r=!1,n={},o={};this.clonedChildrenTable={},0!==this.clipboardData.pasteIndex&&this.clearSelection(),this.diagram.undoRedoModule&&(r=!0,this.diagram.historyManager.startGroupAction());for(var a=0,s=e;a<s.length;a++){n[(l=s[a]).id]=l}var h=[];i&&(this.diagram.isServerUpdate=!0);for(var d=0;d<e.length;d++){var l;if((l=e[parseInt(d.toString(),10)]).parentId)"SwimLane"!==this.diagram.getObject(l.parentId).shape.type&&l.parentId&&(l.parentId="");if(vs(l)===Co){var c=N(l),p=c.sourceID;c.sourceID="",n[""+p]&&o[""+p]&&(c.sourceID=o[""+p]),this.clonedChildrenTable[""+p]&&(c.sourceID=this.clonedChildrenTable[""+p]),p=c.targetID,c.targetID="",n[""+p]&&o[""+p]&&(c.targetID=o[""+p]),this.clonedChildrenTable[""+p]&&(c.targetID=this.clonedChildrenTable[""+p]);var g=!0;if(c.targetID){var u=this.diagram.nameTable[c.targetID];"TextAnnotation"===u.shape.shape&&u.inEdges&&u.inEdges.length>0&&(g=!1)}if(g){var f=this.cloneConnector(c,i);h.push(f),o[l.id]=f.id}}else{l.shape&&"Bpmn"===l.shape.type&&(l.processId=""),this.cloningInProgress=!0;var m=this.cloneNode(l,i);if(this.cloningInProgress=!1,h.push(m),m){o[l.id]=m.id;var y=l.inEdges;if(y)for(var v=0,b=y;v<b.length;v++){if(n[""+(x=b[v])]&&o[""+x])(I=this.diagram.nameTable[o[""+x]]).targetID=o[l.id],this.diagram.connectorPropertyChange(I,{targetID:"",targetPortID:""},{targetID:I.targetID,targetPortID:I.targetPortID})}if(y=l.outEdges)for(var S=0,w=y;S<w.length;S++){var x,I;if(n[""+(x=w[S])]&&o[""+x])(I=this.diagram.nameTable[o[""+x]]).sourceID=o[l.id],this.diagram.connectorPropertyChange(I,{sourceID:"",sourcePortID:""},{sourceID:I.sourceID,sourcePortID:I.sourcePortID})}}}}i&&(this.diagram.isServerUpdate=!1,this.diagram.select(h,!0)),!0===r&&(this.diagram.historyManager.endGroupAction(),r=!1),"SVG"!==this.diagram.mode&&this.diagram.refreshDiagramLayer(),this.clipboardData.pasteIndex++,this.diagram.protectPropertyChange(!1)}}},t.prototype.getNewObject=function(t){var e,i=[];this.clipboardData.pasteIndex=1;for(var r=0;r<t.length;r++)e=N(t[parseInt(r.toString(),10)]),i.push(e);return i},t.prototype.cloneConnector=function(t,e){var i=N(t);this.translateObject(i),i.zIndex=Number.MIN_VALUE,this.diagram.itemType="Clipboard";var r=this.diagram.add(i);return this.diagram.isServerUpdate||this.selectObjects([r],e),r},t.prototype.cloneNode=function(t,e,i,r){var n,o,a,s={},h=N(t),d=this.diagram.nameTable[t.parentId];t.shape&&"Bpmn"===t.shape.type&&t.shape.activity&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length&&(o=h.shape.activity.subProcess.processes,h.zIndex=Number.MIN_VALUE,h.shape.activity.subProcess.processes=void 0),t.shape&&"Container"===t.shape.type&&t.shape.children&&t.shape.children.length&&(a=h.shape.children,h.zIndex=Number.MIN_VALUE,h.shape.children=void 0),t.shape&&"SwimLane"===t.shape.type?qr(t,this.diagram,this.clipboardData):d&&"SwimLane"===d.shape.type?qr(N(d),this.diagram,this.clipboardData,t,!0):!t.children||!t.children.length||i&&i.length?(this.translateObject(h,r),h.zIndex=Number.MIN_VALUE,i&&(h.children=i),h.shape&&"TextAnnotation"===h.shape.shape&&(h.isTextAnnotationCopied=!0),this.diagram.itemType="Clipboard",n=this.diagram.add(h)):n=this.cloneGroup(t,e),t.shape&&"SwimLane"===t.shape.type&&(o=this.findProcesses(t));for(var l=0,c=Object.keys(s);l<c.length;l++){var p=c[l];this.diagram.add(s[""+p])}return o&&o.length&&("Bpmn"===t.shape.type?(n.shape.activity.subProcess.processes=o,this.cloneSubProcesses(n)):"SwimLane"===t.shape.type&&this.cloneSubProcesses(t)),a&&a.length&&(n.shape.children=a,this.cloneSubProcesses(n)),n&&!this.diagram.isServerUpdate&&this.selectObjects([n],e),n},t.prototype.cloneSubProcesses=function(t){var e=this,i=[];if("Bpmn"===t.shape.type&&t.shape.activity&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length)i=t.shape.activity.subProcess.processes,this.cloneProcessess(i,t);else if("Container"===t.shape.type&&t.shape.children&&t.shape.children.length)for(var r=[],n={},o=t.shape.children,a=0;a<o.length;a++){for(var s=0,h=(w=this.diagram.nameTable[o[parseInt(a.toString(),10)]]||this.clipboardData.containerChildTable[o[parseInt(a.toString(),10)]]).outEdges;s<h.length;s++){var d=h[s];r.indexOf(d)<0&&r.push(d)}for(var l=0,c=w.inEdges;l<c.length;l++){d=c[l];r.indexOf(d)<0&&r.push(d)}var p=N(this.clipboardData.containerChildTable[o[parseInt(a.toString(),10)]]);p.parentId=t.id;var g=this.cloneNode(p,!1);n[o[parseInt(a.toString(),10)]]=g.id,o[parseInt(a.toString(),10)]=g.id,this.clonedChildrenTable[p.id]=g.id,hh(g,t.id,this.diagram);for(var u=function(t){var e=f.diagram.nameTable[""+t]||f.diagram.connectorTable[""+t];if(!f.clipboardData.clipObject.find(function(t){return t.id===e.id})){var i=N(e);n[i.sourceID]&&n[i.targetID]&&(i.zIndex=-1,i.id+=E(),i.sourceID=n[i.sourceID],i.targetID=n[i.targetID],r.splice(r.indexOf(t),1),i.zIndex=Number.MIN_VALUE,f.diagram.add(i))}},f=this,m=0,y=r;m<y.length;m++){u(S=y[m])}}if("SwimLane"===t.shape.type)for(var v=void 0,b=t.shape.lanes,S=0;S<b.length;S++){var w=b[parseInt(S.toString(),10)].children;for(d=0;d<w.length;d++){var x=w[parseInt(d.toString(),10)].shape.activity;x&&x.subProcess.processes&&(i=x.subProcess.processes,v=w[parseInt(d.toString(),10)],i.forEach(function(t){e.diagram.nameTable[""+t]&&(e.clipboardData.processTable[""+t]=e.diagram.nameTable[""+t])}),this.diagram.isServerUpdate=!0,this.cloneProcessess(i,v),this.diagram.isServerUpdate=!1)}}},t.prototype.cloneProcessess=function(t,e){for(var i=[],r={},n=this.diagram.nameTable[e.id],o=0;o<t.length;o++){for(var a=this.diagram.nameTable[t[parseInt(o.toString(),10)]]||this.clipboardData.processTable[t[parseInt(o.toString(),10)]],s=0,h=a.outEdges;s<h.length;s++){var d=h[s];i.indexOf(d)<0&&i.push(d)}for(var l=0,c=a.inEdges;l<c.length;l++){d=c[l];i.indexOf(d)<0&&i.push(d)}var p=N(this.clipboardData.processTable[t[parseInt(o.toString(),10)]]);p.processId=n.id;var g=this.cloneNode(p,!1);r[t[parseInt(o.toString(),10)]]=g.id,n.shape.activity.subProcess.processes[parseInt(o.toString(),10)]=g.id,t[parseInt(o.toString(),10)]=g.id,this.diagram.addProcess(g,n.id);for(var u=0,f=i;u<f.length;u++){var m=f[u],y=N(this.diagram.nameTable[""+m]||this.diagram.connectorTable[""+m]);r[y.sourceID]&&r[y.targetID]&&(y.zIndex=-1,y.id+=E(),y.sourceID=r[y.sourceID],y.targetID=r[y.targetID],i.splice(i.indexOf(m),1),y.zIndex=Number.MIN_VALUE,this.diagram.add(y))}}},t.prototype.cloneGroup=function(t,e){var r,n,o,a=[],s=[],h=[],d=[];s=s.concat(t.children);var l=E(),c=[];if(this.diagram.blazorActions|=$.GroupClipboardInProcess,this.clipboardData.childTable||t.children.length>0)for(var p=0;p<s.length;p++){var g=void 0;this.clipboardData.childTable&&(g=this.clipboardData.childTable[s[parseInt(p.toString(),10)]])||(g=this.diagram.nameTable[s[parseInt(p.toString(),10)]]),g.parentId="",g&&(vs(g)===Co?h.push(g):(o=this.cloneNode(g,e,void 0,l),d.push(g.id),a.push(o.id),c.push(o)))}for(var u=0;u<h.length;u++){if(h[parseInt(u.toString(),10)].sourceID||h[parseInt(u.toString(),10)].targetID)for(var f=0;f<d.length;f++)h[parseInt(u.toString(),10)].sourceID===d[parseInt(f.toString(),10)]&&(r=h[parseInt(u.toString(),10)].sourceID,h[parseInt(u.toString(),10)].sourceID+=l),h[parseInt(u.toString(),10)].targetID===d[parseInt(f.toString(),10)]&&(n=h[parseInt(u.toString(),10)].targetID,h[parseInt(u.toString(),10)].targetID+=l);o=this.cloneConnector(h[parseInt(u.toString(),10)],e),h[parseInt(u.toString(),10)].sourceID=r,h[parseInt(u.toString(),10)].targetID=n,a.push(o.id),c.push(o)}var m=this.cloneNode(t,e,a);return c.push(m),m&&m.container&&m.shape&&"UmlClassifier"===m.shape.type&&(this.diagram.updateDiagramObject(m),m.wrapper.measure(new i)),this.diagram.blazorActions&=~$.GroupClipboardInProcess,this.diagram.isServerUpdate?this.cloneGroupChildCollection=c:this.diagram.UpdateBlazorDiagramModelCollection(void 0,c,void 0,!0),m},t.prototype.translateObject=function(t,e){t.id+=e||E();var i=10*this.clipboardData.pasteIndex;if(vs(t)===Co){if(t.sourcePoint={x:t.sourcePoint.x+i,y:t.sourcePoint.y+i},t.targetPoint={x:t.targetPoint.x+i,y:t.targetPoint.y+i},"Bezier"===t.type)for(var r=t.segments,n=0;n<r.length;n++)o.isEmptyPoint(r[parseInt(n.toString(),10)].point1)||(r[parseInt(n.toString(),10)].point1={x:r[parseInt(n.toString(),10)].point1.x+i,y:r[parseInt(n.toString(),10)].point1.y+i}),o.isEmptyPoint(r[parseInt(n.toString(),10)].point2)||(r[parseInt(n.toString(),10)].point2={x:r[parseInt(n.toString(),10)].point2.x+i,y:r[parseInt(n.toString(),10)].point2.y+i});if(("Straight"===t.type||"Bezier"===t.type)&&t.segments&&t.segments.length>0)for(r=t.segments,n=0;n<r.length-1;n++)r[parseInt(n.toString(),10)].point.x+=i,r[parseInt(n.toString(),10)].point.y+=i}else t.offsetX+=i,t.offsetY+=i},t.prototype.drawObject=function(t){var e;t&&t.shape&&"Text"===t.shape.type&&(t.width=this.diagram.drawingObject.width?this.diagram.drawingObject.width:50,t.height=this.diagram.drawingObject.height?this.diagram.drawingObject.height:20);for(var i=N(this.diagram.drawingObject),r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];i[""+o]=t[""+o]}return vs(this.diagram.drawingObject)===Yh||vs(this.diagram.drawingObject)===Co&&"Freehand"===this.diagram.drawingObject.type&&"Bezier"!==t.type?(e=new Yh(this.diagram,"nodes",i,!0)).id=(this.diagram.drawingObject.id||"node")+E():(e=new Co(this.diagram,"connectors",i,!0)).id=(this.diagram.drawingObject&&this.diagram.drawingObject.id?this.diagram.drawingObject.id:"connector")+E(),this.diagram.initObject(e),this.diagram.updateDiagramObject(e),this.diagram.currentDrawingObject=e,e},t.prototype.addObjectToDiagram=function(t){this.diagram.removeFromAQuad(t),this.diagram.removeObjectsFromLayer(this.diagram.nameTable[t.id]),delete this.diagram.nameTable[t.id],t instanceof Co&&"Bezier"===t.type&&t.segments.length>0&&this.diagram.drawingObject&&"Bezier"===this.diagram.drawingObject.type&&(t.segments=[]),this.diagram.itemType="DrawingTool";var e=this.diagram.add(t);"SVG"!==this.diagram.mode&&this.diagram.refreshDiagramLayer(),this.selectObjects([e]),t&&!ar(this.diagram)&&(this.diagram.tool&=~pt.DrawOnce,this.diagram.currentDrawingObject=void 0)},t.prototype.enableServerDataBinding=function(t){this.diagram.enableServerDataBinding(t)},t.prototype.addText=function(t,e){var i=this.diagram.findElementUnderMouse(t,e,this.diagram);this.diagram.startTextEdit(t,i instanceof Zt?i.id.split("_")[1]:void 0)},t.prototype.isUserHandle=function(t){var e=this.diagram.selectedItems;if(e.wrapper&&$a(e.constraints,"UserHandle"))for(var i=0,r=e.userHandles;i<r.length;i++){var n=r[i];if(n.visible&&!(n.disableConnectors&&this.diagram.selectedItems.connectors.length>0||n.disableNodes&&this.diagram.selectedItems.nodes.length>0))if(Tn(t,Ka(e,n,this.diagram.scroller.transform),n.size/(2*this.diagram.scroller.transform.scale)))return!0}return!1},t.prototype.selectObjects=function(t,i,r){return pl(this,void 0,void 0,function(){var n,o,a,s,h,d,l,c,p,g,u;return gl(this,function(f){if(n={oldValue:r||this.getSelectedObject(),newValue:t,cause:this.diagram.diagramActions,state:"Changing",type:"Addition",cancel:!1},t.length>0&&t[0]&&t[0].isLane)for(o=this.diagram.getObject(t[0].parentId),t[0].shape.header=[],a=0;a<t.length;a++)for(c=0;c<o.shape.lanes.length;c++)s=t[0].id.split(t[0].parentId),s[1].slice(0,-1)===o.shape.lanes[parseInt(c.toString(),10)].id&&t[0].shape.header.push(o.shape.lanes[parseInt(c.toString(),10)].header);if(this.diagram.enableServerDataBinding(!1),(0,e.isBlazor)()?this.oldSelectedObjects=Is(this.diagram):this.diagram.triggerEvent(xt.selectionChange,n),h=this.diagram.selectedItems.annotation?[this.diagram.selectedItems.annotation]:this.diagram.selectedItems.nodes.concat(this.diagram.selectedItems.connectors),d=nr(this.diagram),(l=rr(this.diagram))||d){if(!d&&(t.length>1||i&&1===t.length)){if(1!==t.length)return[2];this.clearSelection()}if(!(l||d||1!==t.length||i&&An(this.diagram)))return this.clearSelection(),[2]}if(!n.cancel){for(c=0;c<t.length;c++)if(p=t[parseInt(c.toString(),10)])if(An(this.diagram)){if((c>0||i)&&p.children&&!p.parentId)for(g=0;g<this.diagram.selectedItems.nodes.length;g++)(u=this.diagram.nameTable[this.diagram.selectedItems.nodes[parseInt(g.toString(),10)].parentId])&&(u=this.findParent(u))&&p.id===u.id&&this.selectGroup(p);this.selectProcesses(p),this.selectBpmnSubProcesses(p)&&this.select(p,c>0||i,!0)}else this.select(p,c>0||i,!0);void 0===r&&(r=h),n={oldValue:r||[],newValue:this.getSelectedObject(),cause:this.diagram.diagramActions,state:"Changed",type:"Addition",cancel:!1},this.diagram.renderSelector(i||t&&t.length>1),(0,e.isBlazor)()||this.diagram.triggerEvent(xt.selectionChange,n),this.diagram.enableServerDataBinding(!0)}return[2]})})},t.prototype.findParent=function(t){return t.parentId&&(t=this.diagram.nameTable[t.parentId],this.findParent(t)),t},t.prototype.selectProcesses=function(t){if(this.hasProcesses(t))for(var e=t.shape.activity.subProcess.processes,i=0;i<e.length;i++){var r=this.diagram.nameTable[e[parseInt(i.toString(),10)]];this.hasProcesses(r)&&this.selectObjects([r],!0),this.unSelect(r)}else if(t&&"Container"===t.shape.type&&t.shape.children&&t.shape.children.length>0){var n=t.shape.children;for(i=0;i<n.length;i++){(r=this.diagram.nameTable[n[parseInt(i.toString(),10)]])&&"Container"===r.shape.type&&r.shape.children&&r.shape.children.length>0&&this.selectObjects([r],!0),this.unSelect(r)}}},t.prototype.selectGroup=function(t){for(var e=0;e<t.children.length;e++){var i=this.diagram.nameTable[t.children[parseInt(e.toString(),10)]];i.children&&this.selectGroup(i),this.unSelect(this.diagram.nameTable[t.children[parseInt(e.toString(),10)]])}},t.prototype.selectBpmnSubProcesses=function(t){var e,i=!0;if(t.processId)i=!Dn(this.diagram,this.diagram.nameTable[t.processId])&&this.selectBpmnSubProcesses(this.diagram.nameTable[t.processId]);else if(t.parentId&&this.diagram.nameTable[t.parentId]&&"Container"===this.diagram.nameTable[t.parentId].shape.type)i=!Dn(this.diagram,this.diagram.nameTable[t.parentId])&&this.selectBpmnSubProcesses(this.diagram.nameTable[t.parentId]);else if(t instanceof Co){if(t.sourceID&&this.diagram.nameTable[t.sourceID]&&this.diagram.nameTable[t.sourceID].processId&&(e=this.diagram.nameTable[t.sourceID].processId),t.targetID&&this.diagram.nameTable[t.targetID]&&this.diagram.nameTable[t.targetID].processId&&(e=this.diagram.nameTable[t.targetID].processId),e){if(Dn(this.diagram,this.diagram.nameTable[""+e]))return!1;i=this.selectBpmnSubProcesses(this.diagram.nameTable[""+e])}}else t.parentId&&this.diagram.nameTable[t.parentId]&&"UmlClassifier"===this.diagram.nameTable[t.parentId].shape.type&&Dn(this.diagram,this.diagram.nameTable[t.parentId])&&(i=!1);return i},t.prototype.hasProcesses=function(t){return!!(t&&"Bpmn"===t.shape.type&&t.shape.activity&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length>0)},t.prototype.select=function(t,e,i){var r=this.getObjectLayer(t.id);if(_i(t)&&!(t instanceof qh)&&!Dn(this.diagram,t)&&r&&!r.lock&&r.visible&&t.wrapper.visible){(e=!!An(this.diagram)&&e)||this.clearSelection(),this.diagram.enableServerDataBinding(!1);var n=this.diagram.selectedItems;if(t instanceof Yh)if(t.isHeader){var o=this.diagram.nameTable[t.parentId];n.nodes.push(o)}else n.nodes.push(t);else n.connectors.push(t);if(n.selectedObjects.push(t),e)n.wrapper.rotateAngle=n.rotateAngle=0,n.wrapper.children.push(t.wrapper);else if(n.init(this.diagram),1===n.nodes.length&&0===n.connectors.length){var a=Qr(this.diagram,n);a&&(n.wrapper.children[0]=a),n.rotateAngle=n.nodes[0].rotateAngle,n.wrapper.rotateAngle=n.nodes[0].rotateAngle,n.wrapper.pivot=n.nodes[0].pivot}i||this.diagram.renderSelector(e),this.diagram.enableServerDataBinding(!0)}},t.prototype.labelSelect=function(t,i,r){this.oldSelectedObjects=Is(this.diagram);var n=this.findTarget(i,t),o={oldValue:r||this.getSelectedObject(),newValue:[n],cause:this.diagram.diagramActions,state:"Changing",type:"Addition",cancel:!1};if((0,e.isBlazor)()?this.oldSelectedObjects=Is(this.diagram):this.diagram.triggerEvent(xt.selectionChange,o),!o.cancel){var a=this.diagram.selectedItems,s=this.diagram.allowServerDataBinding;this.diagram.allowServerDataBinding=!1,a.nodes=a.connectors=[],this.diagram.allowServerDataBinding=s,t instanceof Yh?a.nodes[0]=t:a.connectors[0]=t,a.annotation=n,a.init(this.diagram),this.diagram.renderSelector(!1),o={oldValue:r||[],newValue:[a.annotation],cause:this.diagram.diagramActions,state:"Changed",type:"Addition",cancel:!1},(0,e.isBlazor)()||this.diagram.triggerEvent(xt.selectionChange,o)}},t.prototype.unSelect=function(t){[].push(t);var i=this.diagram.selectedItems.nodes.concat(this.diagram.selectedItems.connectors),r=i.filter(function(e){return e.id!==t.id}),n={oldValue:i,newValue:r,cause:this.diagram.diagramActions,state:"Changing",type:"Removal",cancel:!1};if(this.diagram.currentSymbol||(0,e.isBlazor)()||this.diagram.triggerEvent(xt.selectionChange,n),Dn(this.diagram,t)){var o=this.diagram.selectedItems,a=void 0;t instanceof Yh?(a=o.nodes.indexOf(t,0),o.nodes.splice(a,1)):(a=o.connectors.indexOf(t,0),o.connectors.splice(a,1)),a=o.selectedObjects.indexOf(t,0),o.selectedObjects.splice(a,1),n={oldValue:i,newValue:r,cause:this.diagram.diagramActions,state:"Changed",type:"Removal",cancel:!1},(n={oldValue:i,newValue:r,cause:this.diagram.diagramActions,state:"Changed",type:"Removal",cancel:n.cancel}).cancel||(a=o.wrapper.children.indexOf(t.wrapper,0),o.wrapper.children.splice(a,1),this.diagram.updateSelector(),this.diagram.currentSymbol||this.diagram.triggerEvent(xt.selectionChange,n))}},t.prototype.moveSvgNode=function(t,e){var i=this.diagram.nameTable[""+e];if("Native"===i.shape.type||"HTML"===i.shape.type)this.updateNativeNodeIndex(t,e);else{var r=id(e+"_groupElement",this.diagram.element.id),n=id(t+"_groupElement",this.diagram.element.id);r.parentNode.insertBefore(n,r)}},t.prototype.moveAfterSvgNode=function(t,e){var i=this.diagram.nameTable[""+e];if(!i||"HTML"!==i.shape.type&&"Native"!==i.shape.type){a=id(e+"_groupElement",this.diagram.element.id),o=id(t+"_groupElement",this.diagram.element.id);a.insertAdjacentElement("afterend",o)}else for(var r=0;r<this.diagram.views.length;r++){var n="HTML"===i.shape.type?"_html_element":"_content_groupElement",o=id(t+n,this.diagram.views[parseInt(r.toString(),10)]),a=e?id(e+n,this.diagram.views[parseInt(r.toString(),10)]):o.parentElement.firstChild;o&&a&&o.parentNode.id===a.parentNode.id&&a.insertAdjacentElement("afterend",o)}},t.prototype.sendLayerBackward=function(t){var e=this.getLayer(t);if(e&&0!==e.zIndex){var i=e.zIndex;if("SVG"===this.diagram.mode){var r=e.objects,n=this.getLayer(this.diagram.layerZIndexTable[i-1]).objects[0];if(n)for(var o=0,a=r;o<a.length;o++){var s=a[o];this.moveSvgNode(s,n)}}var h=this.getLayer(this.diagram.layerZIndexTable[i-1]);h.zIndex=h.zIndex+1,e.zIndex=e.zIndex-1;var d=this.diagram.layerZIndexTable[parseInt(i.toString(),10)];this.diagram.layerZIndexTable[parseInt(i.toString(),10)]=this.diagram.layerZIndexTable[i-1],this.diagram.layerZIndexTable[i-1]=d,this.diagram.layers[h.zIndex]=h,this.diagram.layers[e.zIndex]=e,"Canvas"===this.diagram.mode&&this.diagram.refreshDiagramLayer()}},t.prototype.bringLayerForward=function(t){var e=this.getLayer(t);if(e&&e.zIndex<this.diagram.layers.length-1){var i=e.zIndex,r=this.getLayer(this.diagram.layerZIndexTable[i+1]);if("SVG"===this.diagram.mode)for(var n=e.objects[0],o=0,a=r.objects;o<a.length;o++){var s=a[o];s&&this.moveSvgNode(s,n)}r.zIndex=r.zIndex-1,e.zIndex=e.zIndex+1;var h=this.diagram.layerZIndexTable[parseInt(i.toString(),10)];this.diagram.layerZIndexTable[parseInt(i.toString(),10)]=this.diagram.layerZIndexTable[i+1],this.diagram.layerZIndexTable[i+1]=h,this.diagram.layers[r.zIndex]=r,this.diagram.layers[e.zIndex]=e,"Canvas"===this.diagram.mode&&this.diagram.refreshDiagramLayer()}},t.prototype.sendToBack=function(t){if(this.diagram.protectPropertyChange(!0),An(this.diagram)||t){var e=this.diagram.selectedItems,i=[];t&&t.id?i.push(t):i=(i=i.concat(e.nodes)).concat(e.connectors);var r=t&&t.id,n=N(this.diagram.selectedItems);i=i.slice().sort(function(t,e){return t.zIndex-e.zIndex});for(var o,a=this.diagram.layers.indexOf(this.getObjectLayer(i[0].id)),s=this.diagram.layers[parseInt(a.toString(),10)].objects,h=null,d=0;d<s.length;d++){var l=this.diagram.nameTable[s[parseInt(d.toString(),10)]];(null===h||l.zIndex<h)&&(h=l.zIndex,o=l)}var c=i.some(function(t){return t.id===o.id});if(c){var p=i.every(function(t,e){return 0===e||t.zIndex===i[e-1].zIndex+1});if(p)return void this.diagram.protectPropertyChange(!1)}for(d=i.length-1;d>=0;d--){N(i[parseInt(d.toString(),10)]);r=i[parseInt(d.toString(),10)].id;var g=this.diagram.nameTable[""+r].zIndex,u=this.diagram.layers.indexOf(this.getObjectLayer(r));this.updateLayerZindexTable(u);for(var f=this.diagram.layers[parseInt(u.toString(),10)].zIndexTable,m=this.diagram.layers[parseInt(u.toString(),10)].objects,y=null,v=0;v<m.length;v++){l=this.diagram.nameTable[m[parseInt(v.toString(),10)]];(null===y||l.zIndex<y)&&(y=l.zIndex,l.id)}var b=JSON.parse(JSON.stringify(f)),S=0;if(1!==this.diagram.nodes.length&&(void 0===this.diagram.nameTable[""+r].children||this.checkObjectBehind(r,f,g))){if((l=this.diagram.nameTable[""+r]).zIndex>y&&"SwimLane"!==l.shape.type){var w=N(l),x=null;l.children?(x=this.findMaxZIndex(l)-l.zIndex,l.zIndex=y-1-x,this.updateGroupZindex(l,"SendToBack",y)):l.zIndex=y-1,this.triggerOrderCommand(w,l,l)}else"SwimLane"===l.shape.type&&(S=this.swapZIndexObjects(g,f,r,b));if("SVG"===this.diagram.mode){for(var I="SwimLane"!==this.diagram.nameTable[""+r].shape.type?y:S,P=f[parseInt(I.toString(),10)];!P&&I<g;)P=f[++I];(P=this.resetTargetNode(r,P,I,f))&&(P=this.diagram.nameTable[""+P].parentId?this.checkParentExist(P):P,this.moveSvgNode(r,P)),this.updateNativeNodeIndex(r),this.updateLayerZindexTable(u)}else this.diagram.refreshCanvasLayers(),this.updateLayerZindexTable(u)}}var C={type:"SendToBack",category:"Internal",undoObject:n,redoObject:N(this.diagram.selectedItems)};this.diagram.diagramActions&yt.UndoRedo||this.addHistoryEntry(C),this.refreshOverviewLayer()}this.diagram.protectPropertyChange(!1)},t.prototype.findMaxZIndex=function(t){var e=this,i=null,r=function(t){for(var n=0;n<t.children.length;n++){var o=e.diagram.nameTable[t.children[parseInt(n.toString(),10)]];(null===i||o.zIndex>i)&&(i=o.zIndex),o.children&&r(o)}};return r(t),i},t.prototype.updateGroupZindex=function(t,e,i){var r,n=this;void 0===r&&(r=t.zIndex+1);var o=function(t){for(var e=0;e<t.children.length;e++){var i=n.diagram.nameTable[t.children[parseInt(e.toString(),10)]];i.children?(i.zIndex=r++,o(i)):i.zIndex=r++}};o(t)},t.prototype.updateLayerZindexTable=function(t){var e=this.diagram.layers[parseInt(t.toString(),10)];e.zIndexTable={};for(var i=0;i<e.objects.length;i++){var r=this.diagram.nameTable[e.objects[parseInt(i.toString(),10)]];e.zIndexTable[r.zIndex]=r.id}},t.prototype.swapZIndexObjects=function(t,e,i,r){for(var n=0,o=0,a=-1,s=1,h=0;h<=t;h++)e[parseInt(h.toString(),10)]&&this.diagram.nameTable[e[parseInt(h.toString(),10)]].parentId===i&&(-1===a&&(a=h),o++);for(h=0;h<=t;h++)if(e[parseInt(h.toString(),10)]&&s<=o){for(;!e[parseInt(a.toString(),10)];)a++;e[parseInt(h.toString(),10)]=e[parseInt(a.toString(),10)],this.diagram.nameTable[e[parseInt(h.toString(),10)]].zIndex=h,a++,s++}var d=0;for(h=0;h<o;h++){for(;!e[parseInt(d.toString(),10)];)d++;n=this.diagram.nameTable[e[parseInt(d.toString(),10)]].zIndex,d++}for(n+=1;!e[parseInt(n.toString(),10)];)++n;d=0,e[parseInt(n.toString(),10)]=this.diagram.nameTable[""+i].id,this.diagram.nameTable[""+i].zIndex=n;for(h=n+=1;h<=t;h++)if(e[parseInt(h.toString(),10)]){for(;!r[parseInt(d.toString(),10)];)d++;e[parseInt(h.toString(),10)]=r[parseInt(d.toString(),10)],this.diagram.nameTable[e[parseInt(h.toString(),10)]].zIndex=h,d++}return n},t.prototype.resetTargetNode=function(t,e,i,r){return"SwimLane"===this.diagram.nameTable[""+t].shape.type&&void 0!==this.diagram.nameTable[""+e].parentId&&""!==this.diagram.nameTable[""+e].parentId&&this.diagram.nameTable[this.diagram.nameTable[""+e].parentId].isLane?(i+=1,r[parseInt(i.toString(),10)]?(e=r[parseInt(i.toString(),10)],this.resetTargetNode(t,e,i,r)):e):e},t.prototype.checkParentExist=function(t){for(var e=t;this.diagram.nameTable[""+e].parentId;)e=this.diagram.nameTable[""+e].parentId;return e},t.prototype.checkObjectBehind=function(t,e,i){return!0},t.prototype.bringToFront=function(t){if(this.diagram.protectPropertyChange(!0),An(this.diagram)||t){var e=t&&t.id,i=this.diagram.selectedItems,r=[];t&&t.id?r.push(t):r=(r=r.concat(i.nodes)).concat(i.connectors);var n=N(this.diagram.selectedItems);r=r.slice().sort(function(t,e){return t.zIndex-e.zIndex});for(var o,a=this.diagram.layers.indexOf(this.getObjectLayer(r[0].id)),s=this.diagram.layers[parseInt(a.toString(),10)].objects,h=null,d=0;d<s.length;d++){var l=this.diagram.nameTable[s[parseInt(d.toString(),10)]];(null===h||l.zIndex>h)&&(h=l.zIndex,o=l)}var c=r.some(function(t){return t.id===o.id});if(c){var p=r.every(function(t,e){return 0===e||t.zIndex===r[e-1].zIndex+1});if(p)return void this.diagram.protectPropertyChange(!1)}for(d=0;d<r.length;d++){N(r[parseInt(d.toString(),10)]);e=r[parseInt(d.toString(),10)].id;var g=this.diagram.layers.indexOf(this.getObjectLayer(e));this.updateLayerZindexTable(g);for(var u=this.diagram.layers[parseInt(g.toString(),10)].zIndexTable,f=this.diagram.layers[parseInt(g.toString(),10)].objects,m=null,y=0;y<f.length;y++){var v=this.diagram.nameTable[f[parseInt(y.toString(),10)]];(null===m||v.zIndex>m)&&(m=v.zIndex)}for(var b=JSON.parse(JSON.stringify(u)),S=Number(Object.keys(u).sort(function(t,e){return Number(t)-Number(e)}).reverse()[0]),w=this.diagram.nameTable[""+e].zIndex,x=[],I=0;I<=S;I++)x.push(u[parseInt(I.toString(),10)]);if("SwimLane"===this.diagram.nameTable[""+e].shape.type)for(var P=S;P>=w;P--)if(u[parseInt(P.toString(),10)]&&this.diagram.nameTable[u[parseInt(P.toString(),10)]].parentId!==e){S=P;break}var C=this.diagram.nameTable[""+e];if(C.zIndex<m&&"SwimLane"!==C.shape.type){var T=N(C);C.children?this.findMaxZIndex(C)<m&&(C.zIndex=m+1,this.updateGroupZindex(C,"BringToFront",m)):C.zIndex=m+1,this.triggerOrderCommand(T,C,C)}else if("SwimLane"===C.shape.type){for(var A=0,O=-1,D=0,M=0,L=JSON.parse(JSON.stringify(u)),E=0;E<=w;E++)if(u[parseInt(E.toString(),10)]&&this.diagram.nameTable[u[parseInt(E.toString(),10)]].parentId===e&&-1===O){O=E,D=E;break}for(var z=0;z<=S;z++)if(b[parseInt(z.toString(),10)]&&b[parseInt(z.toString(),10)]!==e&&this.diagram.nameTable[b[parseInt(z.toString(),10)]].parentId!==e){var k=this.diagram.nameTable[b[parseInt(z.toString(),10)]],B=this.diagram.nameTable[""+e];k.zIndex>=B.zIndex&&A++}for(var R=O,j=0;j<=A;j++){for(;!u[parseInt(R.toString(),10)];)R++;M=this.diagram.nameTable[u[parseInt(R.toString(),10)]].zIndex,R++}for(var H=M;H<=S;H++){for(;!L[parseInt(O.toString(),10)];)O++;for(;!u[parseInt(H.toString(),10)];)H++;u[parseInt(H.toString(),10)]=L[parseInt(O.toString(),10)],this.diagram.nameTable[u[parseInt(H.toString(),10)]].zIndex=H,O++}u[parseInt(S.toString(),10)]=this.diagram.nameTable[""+e].id,this.diagram.nameTable[""+e].zIndex=S,R=w+1;for(var W=D,_=0;_<A;_++){for(;!b[parseInt(R.toString(),10)];)R++;for(;this.diagram.nameTable[b[parseInt(R.toString(),10)]].parentId===e;)R++;for(;!u[parseInt(W.toString(),10)];)W++;u[parseInt(W.toString(),10)]=b[parseInt(R.toString(),10)],this.diagram.nameTable[u[parseInt(W.toString(),10)]].zIndex=W,R++,W++}}if("SVG"===this.diagram.mode){var Y="SwimLane"!==this.diagram.nameTable[""+e].shape.type?m:0,F=u[parseInt(Y.toString(),10)];(F=this.resetTargetNode(e,F,Y,u))&&(F=this.diagram.nameTable[""+F].parentId?this.checkParentExist(F):F,this.moveAfterSvgNode(e,F));var X=this.diagram.diagramLayer,V=id(e+"_groupElement",this.diagram.element.id),U=this.diagram.selectedItems.nodes;if(U.length>0&&("Native"===U[0].shape.type||"HTML"===U[0].shape.type)){V.parentNode.removeChild(V);for(W=0;W<this.diagram.views.length;W++){var G=(V=id(e+("HTML"===U[0].shape.type?"_html_element":"_content_groupElement"),this.diagram.views[parseInt(W.toString(),10)])).parentNode.lastChild;G.parentNode.insertBefore(V,G.nextSibling)}var Z=gd(this.diagram.element.id);this.diagram.diagramRenderer.renderElement(this.diagram.nameTable[""+e].wrapper,X,Z)}this.updateLayerZindexTable(g)}else this.diagram.refreshCanvasLayers(),this.updateLayerZindexTable(g)}var q={type:"BringToFront",category:"Internal",undoObject:n,redoObject:N(this.diagram.selectedItems)};this.diagram.diagramActions&yt.UndoRedo||this.addHistoryEntry(q),this.refreshOverviewLayer()}this.diagram.protectPropertyChange(!1)},t.prototype.triggerOrderCommand=function(t,e,i){var r={zIndex:N(t).zIndex},n={zIndex:e.zIndex},o={element:i,cause:this.diagram.diagramActions,diagramAction:this.diagram.getDiagramAction(this.diagram.diagramActions),oldValue:r,newValue:n};this.diagram.triggerEvent(xt.propertyChange,o)},t.prototype.checkGroupNode=function(t,e,i){return i[""+e].parentId===i[""+t].parentId},t.prototype.sortByZIndex=function(t,e,i){if("BringForward"===i){var r=e||"zIndex";t=t.sort(function(t,e){return e[""+r]-t[""+r]})}else{var n=e||"zIndex";t=t.sort(function(t,e){return t[""+n]-e[""+n]})}return t},t.prototype.refreshOverviewLayer=function(){for(var t=0,e=this.diagram.views;t<e.length;t++){var i=e[t],r=this.diagram.views[""+i],n=gd(r.element.id);r instanceof sc||this.diagram.renderDiagramElements(r.diagramLayer,r.diagramRenderer,n,void 0,void 0,void 0)}},t.prototype.orderCommands=function(t,i,r){var n=this,o=i.nodes;o=o.concat(i.connectors);for(var a,s=this.diagram.layers.indexOf(this.getObjectLayer(o[0].id)),h=this.diagram.layers[parseInt(s.toString(),10)].objects,d=null,l=0;l<h.length;l++){var c=this.diagram.nameTable[h[parseInt(l.toString(),10)]];(null===d||c.zIndex<d)&&(d=c.zIndex,a=c)}for(var p,g=o.some(function(t){return t.id===a.id}),u=null,f=0;f<h.length;f++){c=this.diagram.nameTable[h[parseInt(f.toString(),10)]];(null===u||c.zIndex>u)&&(u=c.zIndex,p=c)}var m=o.some(function(t){return t.id===p.id});if(t){var y=i.selectedObjects;if(y=y.slice().sort(function(t,e){return t.zIndex-e.zIndex}),"SendBackward"===r)for(l=0;l<y.length;l++)this.sendBackward(y[parseInt(l.toString(),10)]);else if("SendForward"===r)for(l=y.length-1;l>=0;l--)this.sendForward(y[parseInt(l.toString(),10)]);else if("BringToFront"===r){if(!m)for(l=0;l<y.length;l++)this.bringToFront(y[parseInt(l.toString(),10)])}else if("SendToBack"===r&&!g)for(l=y.length-1;l>=0;l--)this.sendToBack(y[parseInt(l.toString(),10)])}else{var v=o[0],b=this.getObjectLayer(v.id),S=b.zIndex,w=b.zIndexTable,x=void 0;if("SendBackward"===r||"SendToBack"===r){o=o.slice().sort(function(t,e){return t.zIndex-e.zIndex});for(l=0;l<o.length;l++){var I=o[parseInt(l.toString(),10)];if((z=this.diagram.nameTable[o[parseInt(l.toString(),10)].id]).zIndex=I.zIndex,this.diagram.layers[parseInt(S.toString(),10)].zIndexTable[I.zIndex]=I.id,x=I.id,"SendToBack"===r&&("SwimLane"===o[0].shape.type&&this.bringToFront(o[0]),z.children&&this.updateGroupZindex(z,"",null),this.updateLayerZindexTable(b.zIndex)),"SVG"===this.diagram.mode){for(var P=(k=this.diagram.nameTable[""+x]).zIndex,C=this.diagram.layers.indexOf(this.getObjectLayer(x)),T=this.diagram.layers[parseInt(C.toString(),10)].objects,A=null,O=function(t){var e=D.diagram.nameTable[T[parseInt(t.toString(),10)]];if(e.isHeader||e.isLane||e.isPhase)return"continue";var r=!0;i.selectedObjects.forEach(function(t){r=n.notChildOfSelectedNode(e,t)}),r&&e.zIndex<P&&(null===A||e.zIndex>A)&&(i.selectedObjects[0].shape.type===e.shape.type||"Native"!==i.selectedObjects[0].shape.type&&"Native"!==e.shape.type&&"HTML"!==i.selectedObjects[0].shape.type&&"HTML"!==e.shape.type)&&(A=e.zIndex)},D=this,M=0;M<T.length;M++)O(M);c=this.diagram.nameTable[""+x];var L=A,E=void 0;(0,e.isNullOrUndefined)(L)||(E=w[parseInt(L.toString(),10)]),E&&(E=this.diagram.nameTable[""+E].parentId?this.checkParentExist(E):E,"SendBackward"===r?""===k.parentId&&this.moveAfterSvgNode(x,E):"SendToBack"===r&&"SwimLane"!==o[0].shape.type&&this.moveAfterSvgNode(x,E)),this.refreshOverviewLayer()}else this.diagram.refreshCanvasLayers()}}else if("SendForward"===r||"BringToFront"===r){o=o.slice().sort(function(t,e){return t.zIndex-e.zIndex});for(l=0;l<o.length;l++){var z;I=o[parseInt(l.toString(),10)];if((z=this.diagram.nameTable[o[parseInt(l.toString(),10)].id]).zIndex=I.zIndex,this.diagram.layers[parseInt(S.toString(),10)].zIndexTable[I.zIndex]=I.id,x=I.id,"BringToFront"===r&&("SwimLane"===o[0].shape.type&&this.sendToBack(o[0]),z.children&&this.updateGroupZindex(z,"",null),this.updateLayerZindexTable(b.zIndex)),"SVG"===this.diagram.mode){P=(k=this.diagram.nameTable[""+x]).zIndex,C=this.diagram.layers.indexOf(this.getObjectLayer(x)),T=this.diagram.layers[parseInt(C.toString(),10)].objects;for(var k,B=null,R=function(t){var e=N.diagram.nameTable[T[parseInt(t.toString(),10)]];if(e.isHeader||e.isLane||e.isPhase)return"continue";var r=!0;i.selectedObjects.forEach(function(t){r=n.notChildOfSelectedNode(e,t)});var o=i.selectedObjects.some(function(t){return t.id===e.id});!o&&r&&e.zIndex>P&&(null===B||e.zIndex<B)&&(i.selectedObjects[0].shape.type===e.shape.type||"Native"!==i.selectedObjects[0].shape.type&&"Native"!==e.shape.type&&"HTML"!==i.selectedObjects[0].shape.type&&"HTML"!==e.shape.type)&&(B=e.zIndex)},N=this,j=T.length-1;j>=0;j--)R(j);c=this.diagram.nameTable[""+x],L=B,E=void 0;(0,e.isNullOrUndefined)(L)||(E=w[parseInt(L.toString(),10)]),E&&(E=this.diagram.nameTable[""+E].parentId?this.checkParentExist(E):E,"SendForward"===r?""===k.parentId&&this.moveSvgNode(x,E):"BringToFront"===r&&"SwimLane"!==o[0].shape.type&&this.moveSvgNode(x,E)),this.refreshOverviewLayer()}else this.diagram.refreshCanvasLayers()}}}},t.prototype.sendForward=function(t){var e=this;if(this.diagram.protectPropertyChange(!0),An(this.diagram)||t){var i=this.diagram.selectedItems,r=[];t&&t.id?r.push(t):r=(r=r.concat(i.nodes)).concat(i.connectors),this.sortByZIndex(r);var n=t&&t.id,o=N(this.diagram.selectedItems);this.diagram.startGroupAction();for(var a=[],s=function(t){N(r[parseInt(t.toString(),10)]);n=r[parseInt(t.toString(),10)].id;var i=h.diagram.layers.indexOf(h.getObjectLayer(n)),s=N(h.diagram.nameTable),d=h.diagram.layers[parseInt(i.toString(),10)].zIndexTable,l=h.diagram.nameTable[""+n],c=[],p=h.diagram.spatialSearch.findObjects(l.wrapper.bounds);p.length>2&&(p=h.sortByZIndex(p,void 0,"BringForward"));for(var g=function(t){if(l.id!==t.id){var e=h.getObjectLayer(t.id).zIndex,r=h.diagram.selectedItems.selectedObjects.some(function(e){return e.id===t.id});(1===h.diagram.selectedItems.selectedObjects.length||!r)&&i===e&&Number(h.diagram.nameTable[""+n].zIndex)<Number(t.zIndex)&&""===t.parentId&&l.wrapper.bounds.intersects(t.wrapper.bounds)&&(l.shape.type===t.shape.type||"Native"!==l.shape.type&&"HTML"!==l.shape.type&&"Native"!==t.shape.type&&"HTML"!==t.shape.type)&&c.push(t)}},u=0,f=p;u<f.length;u++){g(m=f[u])}for(var m=c.length-1;m>=0;m--){h.diagram.nameTable[c[parseInt(m.toString(),10)].id].parentId===n&&c.splice(m,1)}if(c.length>0){var y=h.diagram.nameTable[c[c.length-1].id];if(y.parentId){var v=Bs(y,h.diagram,""),b=h.diagram.nameTable[""+v];b.id!==n&&(c[0]=b)}var S={};for(m=0;m<h.diagram.nodes.length;m++){var w=h.diagram.nodes[parseInt(m.toString(),10)];S[w.id]=w.zIndex}for(var x=0;x<h.diagram.connectors.length;x++){var I=h.diagram.connectors[parseInt(x.toString(),10)];S[I.id]=I.zIndex}var P=c[0].zIndex,C=(d[parseInt(P.toString(),10)],{});c.forEach(function(t){C[t.id]=t.zIndex});var T=[];if(l){var A=l.zIndex;Object.keys(C).length>0&&(Object.values(C).forEach(function(t){t>=A&&T.push(t)}),0!==T.length&&h.updateZIndexBySendForward(l,T,i))}var O=[];if(Object.keys(h.changedNodeZIndexes).forEach(function(t){if((s[""+t]?s[""+t].zIndex:null)!==e.changedNodeZIndexes[""+t]){var i=N(s[""+t]);O.push(i)}}),h.updateLayerZindexTable(i),O.forEach(function(t){if(!o.nodes.some(function(e){return e.id===t.id})){var e=N(t);o.nodes.push(e)}}),"SVG"===h.diagram.mode){var D=c[c.length-1].id;c[c.length-1];h.moveAfterSvgNode(n,D),h.updateNativeNodeIndex(D,n)}else h.diagram.refreshCanvasLayers();Object.keys(h.changedNodeZIndexes).forEach(function(t){if((s[""+t]?s[""+t].zIndex:null)!==e.changedNodeZIndexes[""+t]){var i=N(e.diagram.nameTable[""+t]);a.push(i)}})}},h=this,d=r.length-1;d>=0;d--)s(d);var l=N(this.diagram.selectedItems);a.forEach(function(t){if(!l.nodes.some(function(e){return e.id===t.id})){var e=N(t);l.nodes.push(e)}});var c={type:"SendForward",category:"Internal",undoObject:o,redoObject:l};!(this.diagram.diagramActions&yt.UndoRedo)&&a.length>0&&this.addHistoryEntry(c),this.diagram.endGroupAction(),a.length>0&&this.refreshOverviewLayer()}this.diagram.protectPropertyChange(!1)},t.prototype.updateZIndexBySendForward=function(t,e,i){var r,n=N(t),o=Math.min.apply(Math,e),a=this.diagram.layers[parseInt(i.toString(),10)].zIndexTable[parseInt(o.toString(),10)];this.diagram.nameTable[""+a].children&&(o=this.findGreatestChildZIndex(this.diagram.nameTable[""+a]));var s=this.diagram.layers[parseInt(i.toString(),10)].objects,h=this.diagram.nodes.filter(function(t){return-1!==s.indexOf(t.id)});this.diagram.connectors.filter(function(t){return-1!==s.indexOf(t.id)}).forEach(function(t){h.push(t)});var d=h.filter(function(e){return e.zIndex===o&&e.id!==t.id});t.children?(t.zIndex=o+1,this.updateGroupZindex(t,"BringForward",t.zIndex),r=this.findGreatestChildZIndex(t)):(t.zIndex=o+1,r=t.zIndex),this.triggerOrderCommand(n,t,t);for(var l=h.slice().sort(function(t,e){return t.zIndex-e.zIndex}),c=!0,p=0;p<l.length;p++){var g=l[parseInt(p.toString(),10)];if(t.children&&(c=this.notChildOfSelectedNode(g,t)),g.zIndex>o&&g!==t&&g.parentId!==t.id&&c&&d&&d.length>0&&g.parentId!==d[0].id){var u=N(g);if(!(g.zIndex<=r+1))break;g.zIndex=r+1,r++,this.triggerOrderCommand(u,g,g)}var f=g.zIndex;this.changedNodeZIndexes.hasOwnProperty(g.id),this.changedNodeZIndexes[g.id]=f}},t.prototype.findGreatestChildZIndex=function(t){var e=this,i=t.zIndex,r=function(t){for(var n=0;n<t.children.length;n++){var o=e.diagram.nameTable[t.children[parseInt(n.toString(),10)]];o.children?r(o):o.zIndex>i&&(i=o.zIndex)}};return r(t),i},t.prototype.notChildOfSelectedNode=function(t,e){var i=this,r=!0,n=function(t,e){for(var o=0;o<e.children.length;o++){var a=i.diagram.nameTable[e.children[parseInt(o.toString(),10)]];if(a.id===t.id)return r=!1;a.children&&n(t,a)}return r};return e.children&&n(t,e),r},t.prototype.sendBackward=function(t){var e=this;if(this.diagram.protectPropertyChange(!0),An(this.diagram)||t){var i=this.diagram.selectedItems,r=[];t&&t.id?r.push(t):r=(r=r.concat(i.nodes)).concat(i.connectors),this.sortByZIndex(r);var n=t&&t.id,o=N(this.diagram.selectedItems);this.diagram.startGroupAction();for(var a=[],s=function(t){N(r[parseInt(t.toString(),10)]);n=r[parseInt(t.toString(),10)].id;var i=h.diagram.layers.indexOf(h.getObjectLayer(n)),s=N(h.diagram.nameTable),d=h.diagram.layers[parseInt(i.toString(),10)].zIndexTable,l=h.diagram.nameTable[""+n],c=[],p=h.diagram.spatialSearch.findObjects(l.wrapper.bounds);p.length>2&&(p=h.sortByZIndex(p));for(var g=function(t){if(l.id!==t.id){var e=h.getObjectLayer(t.id).zIndex,r=h.diagram.selectedItems.selectedObjects.some(function(e){return e.id===t.id});(1===h.diagram.selectedItems.selectedObjects.length||!r)&&i===e&&Number(h.diagram.nameTable[""+n].zIndex)>Number(t.zIndex)&&""===t.parentId&&l.wrapper.bounds.intersects(t.wrapper.bounds)&&(l.shape.type===t.shape.type||"Native"!==l.shape.type&&"HTML"!==l.shape.type&&"Native"!==t.shape.type&&"HTML"!==t.shape.type)&&c.push(t)}},u=0,f=p;u<f.length;u++){g(m=f[u])}for(var m=c.length-1;m>=0;m--){(y=h.diagram.nameTable[c[parseInt(m.toString(),10)].id]).parentId===n&&c.splice(m,1)}if(c.length>0){var y;if((y=h.diagram.nameTable[c[c.length-1].id]).parentId){var v=Bs(y,h.diagram,""),b=h.diagram.nameTable[""+v];n!==b.id&&(c[c.length-1]=b)}var S={};for(m=0;m<h.diagram.nodes.length;m++){var w=h.diagram.nodes[parseInt(m.toString(),10)];S[w.id]=w.zIndex}for(var x=0;x<h.diagram.connectors.length;x++){var I=h.diagram.connectors[parseInt(x.toString(),10)];S[I.id]=I.zIndex}var P=c[c.length-1].zIndex,C=(d[parseInt(P.toString(),10)],{});c.forEach(function(t){C[t.id]=t.zIndex});var T=[];if(l){var A=l.zIndex;Object.keys(C).length>0&&(Object.values(C).forEach(function(t){t<=A&&T.push(t)}),0!==T.length&&h.updateZIndexBySendBackward(l,T,i))}var O=[];if(Object.keys(h.changedNodeZIndexes).forEach(function(t){if((s[""+t]?s[""+t].zIndex:null)!==e.changedNodeZIndexes[""+t]){var i=N(s[""+t]);O.push(i)}}),h.updateLayerZindexTable(i),O.forEach(function(t){if(!o.nodes.some(function(e){return e.id===t.id})){var e=N(t);o.nodes.push(e)}}),"SVG"===h.diagram.mode){var D=c[c.length-1].id,M=c[c.length-1];M&&"HTML"!==M.shape.type&&"Native"!==M.shape.type&&h.moveSvgNode(n,D);var L=h.diagram.nameTable[""+D];L.children&&L.children.length>0?h.updateNativeNodeIndex(n):h.updateNativeNodeIndex(n,D)}else h.diagram.refreshCanvasLayers();Object.keys(h.changedNodeZIndexes).forEach(function(t){if((s[""+t]?s[""+t].zIndex:null)!==e.changedNodeZIndexes[""+t]){var i=N(e.diagram.nameTable[""+t]);a.push(i)}})}},h=this,d=0;d<r.length;d++)s(d);var l=N(this.diagram.selectedItems);a.forEach(function(t){if(!l.nodes.some(function(e){return e.id===t.id})){var e=N(t);l.nodes.push(e)}});var c={type:"SendBackward",category:"Internal",undoObject:o,redoObject:l};!(this.diagram.diagramActions&yt.UndoRedo)&&a.length>0&&this.addHistoryEntry(c),this.diagram.endGroupAction(),a.length>0&&this.refreshOverviewLayer()}this.diagram.protectPropertyChange(!1)},t.prototype.updateZIndexBySendBackward=function(t,e,i){var r=N(t),n=Math.max.apply(Math,e),o=this.diagram.layers[parseInt(i.toString(),10)].objects,a=this.diagram.nodes.filter(function(t){return-1!==o.indexOf(t.id)});this.diagram.connectors.filter(function(t){return-1!==o.indexOf(t.id)}).forEach(function(t){a.push(t)});var s,h,d=a.filter(function(e){return e.zIndex===n&&e.id!==t.id});t.children?(s=this.findMaxZIndex(t)-t.zIndex,t.zIndex=n-1-s,this.updateGroupZindex(t,"SendBackward",t.zIndex),h=this.findLowestChildZIndex(t)):(t.zIndex=n-1,h=t.zIndex),this.triggerOrderCommand(r,t,t);for(var l=a.slice().sort(function(t,e){return e.zIndex-t.zIndex}),c=!0,p=0;p<l.length;p++){var g=l[parseInt(p.toString(),10)];if(t.children&&(c=this.notChildOfSelectedNode(g,t)),g.zIndex<n&&g!==t&&g.parentId!==t.id&&c&&d&&d.length>0&&g.parentId!==d[0].id){var u=N(g);if(!(g.zIndex>=h-1))break;g.zIndex=h-1,h--,this.triggerOrderCommand(u,g,g)}var f=g.zIndex;this.changedNodeZIndexes.hasOwnProperty(g.id),this.changedNodeZIndexes[""+g.id]=f}},t.prototype.findLowestChildZIndex=function(t){for(var e=t.zIndex,i=0;i<t.children.length;i++){var r=this.diagram.nameTable[t.children[parseInt(i.toString(),10)]];r.zIndex<e&&(e=r.zIndex)}return e},t.prototype.updateNativeNodeIndex=function(t,e){var i=this.diagram.selectedItems.nodes[0]||this.diagram.getObject(e);if(!i||"HTML"!==i.shape.type&&"Native"!==i.shape.type){if(e){var r=this.diagram.nameTable[""+e];if(r&&("HTML"===r.shape.type||"Native"===r.shape.type)){s=id(e+"_groupElement",this.diagram.element.id);(a=id(t+"_groupElement",this.diagram.element.id))&&s&&s.parentNode.insertBefore(a,s)}}}else for(var n=0;n<this.diagram.views.length;n++){var o="HTML"===i.shape.type?"_html_element":"_content_groupElement",a=id(t+o,this.diagram.views[parseInt(n.toString(),10)]),s=e?id(e+o,this.diagram.views[parseInt(n.toString(),10)]):a.parentElement.firstChild;a&&s&&a.parentNode.id===s.parentNode.id&&s.parentNode.insertBefore(a,s)}},t.prototype.initSelectorWrapper=function(){var t=this.diagram.selectedItems;t.init(this.diagram),1===t.nodes.length&&0===t.connectors.length&&(t.rotateAngle=t.nodes[0].rotateAngle,t.wrapper.rotateAngle=t.nodes[0].rotateAngle,t.wrapper.pivot=t.nodes[0].pivot)},t.prototype.doRubberBandSelection=function(t){this.clearSelectionRectangle();var e=[],i=[];e=this.diagram.getNodesConnectors(e),(i="CompleteIntersect"===this.diagram.selectedItems.rubberBandSelectionMode?Ko(t,e):this.diagram.spatialSearch.findObjects(t)).length&&this.selectObjects(i,!0)},t.prototype.clearSelectionRectangle=function(){var t=nd(this.diagram.element.id).getElementById(this.diagram.element.id+"_diagramAdorner_selected_region");t&&(0,e.remove)(t)},t.prototype.dragConnectorEnds=function(t,e,i,r,n,o){var a,s,h,d=!1;return e instanceof qh?a=e.connectors[0]:e instanceof Co&&this.diagram.currentDrawingObject&&(this.clearSelection(),a=this.diagram.currentDrawingObject),!!(a&&a instanceof Co)&&("BezierSourceThumb"!==t&&"BezierTargetThumb"!==t||(d=!0,a.isBezierEditing=!0),"ConnectorSourceEnd"===t||"BezierSourceThumb"===t?(s=i.x-(d?r.bezierPoint1.x:a.sourcePoint.x),h=i.y-(d?r.bezierPoint1.y:a.sourcePoint.y),this.dragSourceEnd(a,s,h,null,i,t,void 0,n,o,void 0,r)):(s=i.x-(d?r.bezierPoint2.x:a.targetPoint.x),h=i.y-(d?r.bezierPoint2.y:a.targetPoint.y),this.dragTargetEnd(a,s,h,null,i,t,void 0,r)))},t.prototype.getSelectedObject=function(){var t=this.diagram.selectedItems;return t.annotation?[t.annotation]:t.nodes.concat(t.connectors)},t.prototype.enableCloneObject=function(t){},t.prototype.getBlazorOldValues=function(t,e){},t.prototype.clearObjectSelection=function(t){var e=this.diagram.selectedItems,i=[];-1===(i=i.concat(e.nodes,e.connectors)).indexOf(t)&&(this.clearSelection(i.length>0),this.selectObjects([t],!0))},t.prototype.clearSelection=function(t,i){return pl(this,void 0,void 0,function(){var i,r,n,o;return gl(this,function(a){return i=this.diagram.allowServerDataBinding,this.diagram.enableServerDataBinding(!1),An(this.diagram)&&(r=this.diagram.selectedItems,n=this.getSelectedObject(),this.diagram.currentSymbol&&(this.diagram.previousSelectedObject=n),o={oldValue:n,newValue:[],cause:this.diagram.diagramActions,state:"Changing",type:"Removal",cancel:!1},t&&((0,e.isBlazor)()||this.diagram.triggerEvent(xt.selectionChange,o)),o.cancel||(r.offsetX=0,r.offsetY=0,r.width=0,r.height=0,r.rotateAngle=0,r.nodes=[],r.connectors=[],r.wrapper=null,r.annotation=void 0,r.selectedObjects=[],this.diagram.clearSelectorLayer(),t&&(o={oldValue:n,newValue:[],cause:this.diagram.diagramActions,state:"Changed",type:"Removal",cancel:!1},(0,e.isBlazor)()||this.diagram.triggerEvent(xt.selectionChange,o))),this.diagram.enableServerDataBinding(i)),[2]})})},t.prototype.clearSelectedItems=function(){var t=this.diagram.selectedItems.nodes?this.diagram.selectedItems.nodes.length:0,e=this.diagram.selectedItems.connectors?this.diagram.selectedItems.connectors.length:0;this.clearSelection(t+e>0)},t.prototype.removeStackHighlighter=function(){var t=nd(this.diagram.element.id),e=t.getElementById(t.id+"_stack_highlighter");e&&e.parentNode.removeChild(e)},t.prototype.renderStackHighlighter=function(t,e){var i,r,n,o=this.diagram.selectedItems.nodes[0];if(!e){var a=this.diagram.findObjectsUnderMouse(t.position);if((e=this.diagram.findObjectUnderMouse(a,"Drag",!0))&&!(e.isLane||e.isPhase||e.isHeader))for(var s=0;s<a.length;s++){var h=this.diagram.nameTable[a[parseInt(s.toString(),10)].id];(!h.isLane||h.isPhase||h.isHeader)&&(e=h,this.diagram.parentObject=e)}}if(o&&e&&e.isLane&&o.shape&&!o.shape.isPhase&&(r=this.diagram.nameTable[e.parentId],this.diagram.currentSymbol&&"SwimLane"===r.shape.type&&(i=!0),o&&!o.parentId&&"SwimLane"!==o.shape.type||o&&o.parentId&&this.diagram.nameTable[o.parentId]&&this.diagram.nameTable[o.parentId].isLane&&o.parentId!==e.parentId&&o.parentId!==e.id)){n=this.diagram.selectedItems;var d=Qr(this.diagram,n,e.id,!0);this.diagram.renderSelector(!1,!0,d),n.wrapper.children[0]=n.nodes[0].wrapper}if(o&&e&&e.parentId&&o.shape&&o.shape.isPhase&&"SwimLane"===this.diagram.nameTable[e.parentId].shape.type){d=this.diagram.nameTable[e.parentId].wrapper;this.diagram.renderSelector(!1,!0,d)}if(i&&this.diagram.currentSymbol.shape.isLane||o&&e&&o.parentId&&e.parentId&&!o.isPhase&&o.parentId===e.parentId&&o.id!==e.id&&r&&r.container&&("Stack"===r.container.type||"Grid"===r.container.type)){d=void 0;var l="Vertical"===r.container.orientation,c="Stack"===r.container?l:!l;"Grid"===r.container.type&&e.isLane&&("Horizontal"===r.shape.orientation&&e.rowIndex!==o.rowIndex||"Vertical"===r.shape.orientation&&e.columnIndex!==o.columnIndex||this.diagram.currentSymbol&&this.diagram.currentSymbol.shape.orientation===r.container.orientation)&&(n=this.diagram.selectedItems,(o.isLane&&hn(o,this.diagram)||!o.isLane)&&(d=Qr(this.diagram,n,e.id,i)));var p="Stack"===r.container.type?e.wrapper:d;p&&xn(p,c,t.position,this.diagram,!1,!0)}},t.prototype.insertBlazorConnector=function(t){if(t instanceof qh)for(var e=0;e<t.connectors.length;e++)this.diagram.insertBlazorConnector(t.connectors[parseInt(e.toString(),10)]);else this.diagram.insertBlazorConnector(t)},t.prototype.drag=function(t,e,i){var r;if(!this.diagram.rotateUsingButton&&t.shape&&"SwimLane"!==t.shape.type&&(this.diagram.eventHandler.currentAction="Drag"),Yi(t)&&this.checkBoundaryConstraints(e,i,t.wrapper.bounds)&&cr(this.diagram))if(t instanceof Yh){var n={offsetX:t.offsetX,offsetY:t.offsetY};if(t.offsetX+=e,t.offsetY+=i,t.children&&!t.container){un(this.diagram,t,!0)||(this.diagram.diagramActions=this.diagram.diagramActions|yt.isGroupDragging);for(var o=this.getAllDescendants(t,[]),a=0;a<o.length;a++)r=this.diagram.nameTable[o[parseInt(a.toString(),10)].id],this.drag(r,e,i);this.updateInnerParentProperties(t),this.diagram.diagramActions=this.diagram.diagramActions&~yt.isGroupDragging}if(un(this.diagram,t,!0)?fn(this.diagram,t):(t&&t.shape&&"UmlClassifier"===t.shape.type&&(t.wrapper.measureChildren=!0),this.diagram.nodePropertyChange(t,n,{offsetX:t.offsetX,offsetY:t.offsetY},void 0,void 0,!1),t.wrapper.measureChildren=!1),"SwimLane"===t.shape.type&&!this.diagram.currentSymbol){var s=t.wrapper.children[0];Rr(Dr(this.diagram,s),this.diagram)}}else{var h=t,d=N(t),l=(n={sourcePoint:d.sourcePoint,targetPoint:d.targetPoint},"Bezier"===h.type),c=!1;h.sourceWrapper?c=!0:this.dragSourceEnd(h,e,i,!0,null,"",l),h.targetWrapper?c=!0:this.dragTargetEnd(h,e,i,!0,null,"",l);var p=!1;if(t instanceof Co&&(p=!0),!c||p){this.dragControlPoint(h,e,i,!0);var g={sourcePoint:h.sourcePoint,targetPoint:h.targetPoint};this.diagram.connectorPropertyChange(h,n,g)}}for(var u=0,f=this.diagram.views;u<f.length;u++){var m=f[u],y=this.diagram.views[m];y instanceof Qo&&this.diagram.refreshCanvasDiagramLayer(y)}},t.prototype.connectorSegmentChange=function(t,e,i){var r,n,a=!0;if(!1===e.equals(e,t.wrapper.bounds)&&t.outEdges.length>0)for(var s=0;s<t.outEdges.length;s++){var h=this.diagram.nameTable[t.outEdges[parseInt(s.toString(),10)]];if(a=""!==h.targetID?!this.isSelected(this.diagram.nameTable[h.targetID]):!this.isSelected(this.diagram.nameTable[h.id]),"Orthogonal"===h.type&&h.segments&&h.segments.length>1)if(i){if(!this.isSelected(this.diagram.nameTable[h.id])){var d=h.segments[0],l=h.segments[1],c=si(qe(t.wrapper,t.wrapper.corners,t.wrapper.bounds),d.direction),p=fi({corners:void 0,point:c=di(h,h.sourceWrapper,c,{x:h.sourceWrapper.offsetX,y:h.sourceWrapper.offsetY},!1),margin:void 0,direction:d.direction},{corners:void 0,point:l.points[1],margin:void 0,direction:void 0});d.length=o.distancePoints(p[0],p[1]),l.direction&&l.length&&(l.length=o.distancePoints(p[1],p[2]))}}else if(a){switch(h.segments[0].direction){case"Bottom":r=t.wrapper.bounds.bottomCenter.x-e.bottomCenter.x,n=t.wrapper.bounds.bottomCenter.y-e.bottomCenter.y;break;case"Top":r=t.wrapper.bounds.topCenter.x-e.topCenter.x,n=t.wrapper.bounds.topCenter.y-e.topCenter.y;break;case"Left":r=t.wrapper.bounds.middleLeft.x-e.middleLeft.x,n=t.wrapper.bounds.middleLeft.y-e.middleLeft.y;break;case"Right":r=t.wrapper.bounds.middleRight.x-e.middleRight.x,n=t.wrapper.bounds.middleRight.y-e.middleRight.y}this.dragSourceEnd(h,r,n,!0,null,"ConnectorSourceEnd",void 0,void 0,void 0,!(t.parentId&&this.diagram.diagramActions&yt.isGroupDragging))}}},t.prototype.updateEndPoint=function(t,e){t.sourcePoint,t.targetPoint,t.sourceID&&t.sourceID,t.targetID&&t.targetID,t.sourcePortID&&t.sourcePortID,t.targetPortID&&t.targetPortID,t.segments&&t.segments;var i={sourcePoint:t.sourcePoint,targetPoint:t.targetPoint};t.sourceID&&(i.sourceID=t.sourceID),t.targetID&&(i.targetID=t.targetID),t.sourcePortID&&(i.sourcePortID=t.sourcePortID),t.targetPortID&&(i.targetPortID=t.targetPortID),t.segments&&(i.segments=t.segments),this.diagram.connectorPropertyChange(t,e||{},i),this.diagram.updateSelector()},t.prototype.dragSourceEnd=function(t,e,i,r,n,o,a,s,h,d,l){var c=this.diagram.nameTable[t.id],p={},g=this.checkBoundaryConstraints(e,i,c.wrapper.bounds);if(Vi(c)&&g&&"BezierSourceThumb"!==o&&cr(this.diagram)){if(p=N(p={sourcePoint:c.sourcePoint}),this.diagram.constraints&ct.RestrictNegativeAxisDragDrop){var u=c.sourcePoint.x+e,f=c.sourcePoint.y+i;c.sourcePoint.x=u<0?0:u,c.sourcePoint.y=f<0?0:f}else c.sourcePoint.x+=e,c.sourcePoint.y+=i;"ConnectorSourceEnd"===o&&"Orthogonal"===c.type&&this.changeSegmentLength(c,s,h,d),"Bpmn"===c.shape.type&&"Default"===c.shape.sequence&&"Sequence"===c.shape.flow&&this.updatePathElementOffset(c)}if("Bezier"===c.type)if(p={sourcePoint:c.sourcePoint},l)this.translateBezierPoints(t,""===o?"ConnectorSourceEnd":o,e,i,l,n,!a);else for(var m=0;m<t.segments.length;m++)this.translateBezierPoints(t,""===o?"ConnectorSourceEnd":o,e,i,t.segments[parseInt(m.toString(),10)],n,!a);return r||this.updateEndPoint(c,p),this.diagram.realActions&bt.AnimationClick||this.diagram.refreshCanvasLayers(),g},t.prototype.updatePathElementOffset=function(t){t.wrapper.children.splice(3,1);var e=new Qt,i=t.intermediatePoints;e=Ps(i,t),t.wrapper.children.splice(3,0,e)},t.prototype.getDirection=function(t,e){var i;return"Right"===t||"Left"===t?i=e.points[0].x<e.points[1].x?"Right":"Left":"Top"!==t&&"Bottom"!==t||(i=e.points[0].y<e.points[1].y?"Bottom":"Top"),i},t.prototype.changeSegmentLength=function(t,e,i,r){var n=!e||this.canConnect(t,e);if(t.segments&&t.segments[0].direction&&(!e&&""===t.sourceID||r)&&n){if((A=t.segments[0]).direction!==this.getDirection(A.direction,A)&&(t.segments.splice(0,1),null===t.segments[0].direction))return;var a,s=t.segments[0],h=t.segments[1],d=this.diagram.nameTable[t.sourceID],l=void 0;s.points[0]=t.sourcePoint,"Top"===s.direction||"Bottom"===s.direction?(s.points[s.points.length-1].x=t.sourcePoint.x,h.points[0].y=s.points[s.points.length-1].y):(s.points[s.points.length-1].y=t.sourcePoint.y,h.points[0].x=s.points[s.points.length-1].x),s.direction&&(s.length||0===s.length)&&(s.length=o.distancePoints(s.points[0],s.points[s.points.length-1])),h.direction&&(h.length||0===h.length)&&(h.length=o.distancePoints(s.points[s.points.length-1],h.points[h.points.length-1]),h.direction=o.direction(s.points[s.points.length-1],h.points[h.points.length-1]));var c=s.points,p=s.direction,g=c[0],u=c[c.length-1];switch(p){case"Left":a=g.x-u.x;break;case"Right":a=u.x-g.x;break;case"Top":a=g.y-u.y;break;case"Bottom":a=u.y-g.y}if(""!==t.sourcePortID&&(s.length<10||a<0))if(t.segments.length>2){var f=t.segments[2],m=t.segments[3],y=o.direction(f.points[0],f.points[1]);if(s.direction===Ti(y))"Right"===s.direction?f.points[0].x=s.points[s.points.length-1].x=d.wrapper.corners.middleRight.x+20:"Left"===s.direction?f.points[0].x=s.points[s.points.length-1].x=d.wrapper.corners.middleLeft.x-20:"Top"===s.direction?f.points[0].y=s.points[s.points.length-1].y=d.wrapper.corners.topCenter.y-20:f.points[0].y=s.points[s.points.length-1].y=d.wrapper.corners.bottomCenter.y+20,f.direction&&f.length&&(f.length=o.distancePoints(f.points[0],f.points[f.points.length-1])),s.length=o.distancePoints(s.points[0],s.points[s.points.length-1]);else if(s.direction===y&&f.direction&&f.length){var v=20-a;if(s.length=20,f.length-=v,m&&f.length<5){var b=t.segments[1],S=b.length,w=0;w=b.direction===m.direction?Math.abs(S+m.length):Math.abs(S-m.length),m.length=w;var x=m.direction,I=s.points[s.points.length-1],P=m.points[m.points.length-1];m.direction=o.direction(I,P),x!==m.direction&&x!==Ti(m.direction)&&(m.direction=Ti(x));var C=t.segments[4];if(C){var T=0;"Bottom"===p?s.points[0].y>m.points[0].y&&(T=Math.abs(s.points[0].y-m.points[0].y),T+=20):"Top"===p?s.points[0].y<m.points[0].y&&(T=Math.abs(s.points[0].y-m.points[0].y),T+=20):"Left"===p?s.points[0].x<m.points[0].x&&(T=Math.abs(s.points[0].x-m.points[0].x),T+=20):"Right"===p&&s.points[0].x>m.points[0].x&&(T=Math.abs(s.points[0].x-m.points[0].x),T+=20),C.length+=T}t.segments.splice(1,2)}}else s.length=20}else s.length=20;else if(s.length<1)if(""!==t.sourceID){if("Right"===h.direction?(l=d.wrapper.corners.middleRight,h.points[h.points.length-1].y=l.y):"Left"===h.direction?(l=d.wrapper.corners.middleLeft,h.points[h.points.length-1].y=l.y):"Top"===h.direction?(l=d.wrapper.corners.topCenter,h.points[h.points.length-1].x=l.x):(l=d.wrapper.corners.bottomCenter,h.points[h.points.length-1].x=l.x),h.length=o.distancePoints(l,h.points[h.points.length-1]),t.segments.length>2)(f=t.segments[2]).direction&&f.length&&(f.length=o.distancePoints(h.points[h.points.length-1],f.points[f.points.length-1]));t.segments.splice(0,1)}else t.segments.splice(0,1)}else if(t.segments&&t.segments[0].direction)if(e&&e instanceof Yh&&!i){var A=t.segments[0],O=t.segments[1],D=A.direction,M=t.sourcePoint,L=this.diagram.nameTable[e.id],E=L.wrapper?L.wrapper.corners:void 0,z=function(){if(!D||!E)return M;switch(D){case"Bottom":return E.bottomCenter;case"Top":return E.topCenter;case"Left":return E.middleLeft;case"Right":return E.middleRight;default:return M}}();t.sourcePoint.x=z.x,t.sourcePoint.y=z.y,A.points[0]=z;var k=A.points[A.points.length-1];if("Top"===D||"Bottom"===D?(k.x=z.x,O.points[0].y=k.y):(k.y=z.y,O.points[0].x=k.x),A.length=o.distancePoints(A.points[0],k),O.direction){var B=O.points[O.points.length-1];O.length=o.distancePoints(k,B),O.direction=o.direction(k,B)}}else e&&e instanceof Yh&&i&&t.sourcePortID!==i&&this.changeSourceEndToPort(t,e,i)},t.prototype.canConnect=function(t,e){return!(!Qi(e)||!Ji(e))},t.prototype.changeSourceEndToPort=function(t,e,i){var r=this.diagram.getWrapper(e.wrapper,i),n={x:r.offsetX,y:r.offsetY};t.sourcePoint.x=n.x,t.sourcePoint.y=n.y;var a=Pi(n,B(e.wrapper),e.wrapper.bounds),s=t.segments[0],h=t.segments[1],d="Top"===a||"Bottom"===a,l=20;if(s.direction!==a){if(s.direction!==Ti(a)){if(h.direction===a){if(t.segments.splice(0,1),t.segments.length>1){s=h,h=t.segments[1],s.points[0]=n;var c=s.points[s.points.length-1];if(d?c.x=n.x:c.y=n.y,s.length=o.distancePoints(s.points[0],c),h.direction){w=h.points[h.points.length-1];h.length=o.distancePoints(c,w),h.direction=o.direction(c,w)}}return}t.segments.slice(0,-2).filter(function(t){return t.isTerminal}).length>1&&(this.removeTerminalSegment(t),s=t.segments[0],h=t.segments[1]);var p=new uo(t,"segments",{type:"Orthogonal",direction:a,length:l,isTerminal:!0},!0),g=s.points[0],u=s.points[s.points.length-1];if(d?(g.x=n.x,g.y=u.y="Top"===a?n.y-l:n.y+l):(g.y=n.y,g.x=u.x="Right"===a?n.x+l:n.x-l),s.length=o.distancePoints(g,u),h.direction){w=h.points[h.points.length-1];h.length=o.distancePoints(u,w),h.direction=o.direction(u,w)}return t.segments=[p].concat(t.segments),t.sourcePoint.x=n.x,void(t.sourcePoint.y=n.y)}var f=t.segments.length>2?t.segments[2]:void 0,m=s.points.length-1,y=cl({},s.points[parseInt(m.toString(),10)]),v=s.points[s.points.length-1];if(s.points[0]=n,d?(v.x=n.x,v.y="Top"===a?n.y-l:n.y+l,h.points[0].x=v.x,h.points[0].y=v.y,h.points[h.points.length-1].y=v.y):(v.y=n.y,v.x="Right"===a?n.x+l:n.x-l,h.points[0].x=v.x,h.points[0].y=v.y,h.points[h.points.length-1].x=v.x),s.length=o.distancePoints(s.points[0],v),h.direction){w=h.points[h.points.length-1];h.length=o.distancePoints(v,w),h.direction=o.direction(v,w)}var b=d?Math.abs(y.y-v.y):Math.abs(y.x-v.x);f&&f.direction&&(s.direction===f.direction?f.length+=b:f.length-=b)}else{s.points[0]=n;var S=s.points[s.points.length-1];if(d?S.x=n.x:S.y=n.y,s.length=o.distancePoints(s.points[0],S),h.direction){var w=h.points[h.points.length-1];h.length=o.distancePoints(S,w),h.direction=o.direction(S,w)}}},t.prototype.removeTerminalSegment=function(t,e){for(var i=0;i<t.segments.length-2;i++){var r=t.segments[0];r.isTerminal&&(e?r.isTerminal=!1:(t.segments.splice(i,1),i--))}},t.prototype.translateBezierPoints=function(t,e,i,r,n,a,s){var h=t.segments.indexOf(n),d=t.segments[parseInt(h.toString(),10)],l=h>0?t.segments[h-1]:null,c=null!==l?l.point:t.sourcePoint,p=h===t.segments.length-1?t.targetPoint:d.point;if(d)if("BezierSourceThumb"===e&&(d.vector1.angle||d.vector1.distance)){var g=d.vector1.distance,u=d.vector1.angle;d.vector1={distance:t.distance(c,a),angle:o.findAngle(c,a)};var f=d.vector1.distance-g,m=d.vector1.angle-u;this.translateSubsequentSegment(t,n,!0,f,m)}else if("BezierTargetThumb"===e&&(d.vector2.angle||d.vector2.distance)){g=d.vector2.distance,u=d.vector2.angle;d.vector2={distance:t.distance(p,a),angle:o.findAngle(p,a)};f=d.vector2.distance-g,m=d.vector2.angle-u;this.translateSubsequentSegment(t,n,!1,f,m)}else("ConnectorSourceEnd"===e&&!t.sourceID||"ConnectorTargetEnd"===e&&!t.targetID)&&s&&yo(d.vector1)&&yo(d.vector2)?(o.isEmptyPoint(d.point1)&&(d.bezierPoint1=vo(t.sourcePoint,t.targetPoint)),o.isEmptyPoint(d.point2)&&(d.bezierPoint2=vo(t.targetPoint,t.sourcePoint))):"BezierSourceThumb"===e||"ConnectorSourceEnd"===e&&!s&&yo(d.vector1)?(d.bezierPoint1.x+=i,d.bezierPoint1.y+=r,o.isEmptyPoint(d.point1)&&!s||(d.point1={x:d.bezierPoint1.x,y:d.bezierPoint1.y}),0===i&&0===r||!0!==n.isInternalSegment||(n.isInternalSegment=!1)):("BezierTargetThumb"===e||"ConnectorTargetEnd"===e&&!s&&yo(d.vector2))&&(d.bezierPoint2.x+=i,d.bezierPoint2.y+=r,o.isEmptyPoint(d.point2)&&!s||(d.point2={x:d.bezierPoint2.x,y:d.bezierPoint2.y}),0===i&&0===r||!0!==n.isInternalSegment||(n.isInternalSegment=!1))},t.prototype.translateSubsequentSegment=function(t,e,i,r,n){var o=t.segments.indexOf(e);t.segments[parseInt(o.toString(),10)];t.bezierSettings.smoothness&Wt.SymmetricAngle||(n=null),t.bezierSettings.smoothness&Wt.SymmetricDistance||(r=null),null==r&&null==n||(i?0!==o&&this.updatePreviousBezierSegment(t,o,r,n):o!==t.segments.length-1&&this.updateNextBezierSegment(t,o,r,n))},t.prototype.updatePreviousBezierSegment=function(t,e,i,r){var n=t.segments[e-1],o=n.vector2.distance+i,a=(n.vector2.angle+r)%360;a<0&&(a+=360),n.vector2={distance:o,angle:a}},t.prototype.updateNextBezierSegment=function(t,e,i,r){var n=t.segments[e+1],o=n.vector1.distance+i,a=(n.vector1.angle+r)%360;a<0&&(a+=360),n.vector1={distance:o,angle:a}},t.prototype.dragTargetEnd=function(t,e,i,r,n,a,s,h){var d,l=this.diagram.nameTable[t.id],c=this.checkBoundaryConstraints(e,i,l.wrapper.bounds);if(Ui(l)&&"BezierTargetThumb"!==a&&c&&cr(this.diagram)){if(d=N(d={targetPoint:l.targetPoint}),this.diagram.constraints&ct.RestrictNegativeAxisDragDrop){var p=l.targetPoint.x+e,g=l.targetPoint.y+i;l.targetPoint.x=p<0?0:p,l.targetPoint.y=g<0?0:g}else l.targetPoint.x+=e,l.targetPoint.y+=i;if("ConnectorTargetEnd"===a&&"Orthogonal"===l.type&&l.segments&&l.segments.length>0){var u=l.segments[l.segments.length-2];u&&2===l.segments[l.segments.length-1].points.length&&("Left"===u.direction||"Right"===u.direction?u.points[u.points.length-1].x=l.targetPoint.x:u.points[u.points.length-1].y=l.targetPoint.y,u.length=o.distancePoints(u.points[0],u.points[u.points.length-1]),u.direction=o.direction(u.points[0],u.points[u.points.length-1]))}"Bpmn"===l.shape.type&&"Default"===l.shape.sequence&&"Sequence"===l.shape.flow&&this.updatePathElementOffset(l)}if("Bezier"===l.type)if(d={targetPoint:l.targetPoint},h)this.translateBezierPoints(t,""===a?"ConnectorTargetEnd":a,e,i,h,n,!s);else for(var f=0;f<t.segments.length;f++)this.translateBezierPoints(t,""===a?"ConnectorTargetEnd":a,e,i,t.segments[parseInt(f.toString(),10)],n,!s);return r||this.updateEndPoint(l,d),this.diagram.realActions&bt.AnimationClick||this.diagram.refreshCanvasLayers(),c},t.prototype.dragControlPoint=function(t,e,i,r,n){var o=this.diagram.nameTable[t.id];if(("Straight"===o.type||"Bezier"===o.type)&&o.segments.length>0){if(void 0!==n&&o.segments[parseInt(n.toString(),10)])if("Bezier"===o.type){var a=o.segments[parseInt(n.toString(),10)],s=a.isInternalSegment;s&&null!==o.bezierSettings&&"FreeForm"!==o.bezierSettings.segmentEditOrientation?("Horizontal"===a.orientation?a.point.x+=e:a.point.y+=i,this.updateDirectionalBezierCurve(o)):(a.point.x+=e,a.point.y+=i),s&&(o.isBezierEditing=!0)}else o.segments[parseInt(n.toString(),10)].point.x+=e,o.segments[parseInt(n.toString(),10)].point.y+=i;else for(var h=0;h<o.segments.length-1;h++)o.segments[parseInt(h.toString(),10)].point.x+=e,o.segments[parseInt(h.toString(),10)].point.y+=i;r||this.updateEndPoint(o)}return!0},t.prototype.updateDirectionalBezierCurve=function(t){var e=[];e.push(t.sourcePoint);for(var i=0;i<t.segments.length-1;i++){var r=t.segments[parseInt(i.toString(),10)];"Horizontal"===r.orientation?e.push({x:r.point.x,y:e[e.length-1].y}):e.push({x:e[e.length-1].x,y:r.point.y}),i===t.segments.length-2&&("Horizontal"===r.orientation?e.push({x:r.point.x,y:t.targetPoint.y}):e.push({x:t.targetPoint.x,y:r.point.y}))}e.push(t.targetPoint);var n=e[0],a=e[e.length-1];if(t.segments.length>1){var s=e[1],h=e[2],d={x:.5*(s.x+h.x),y:.5*(s.y+h.y)},l=t.segments[0];l.vector1.angle=ai(n,s),l.vector1.distance=.5*o.findLength(n,s),l.vector2.angle=ai(d,s),l.vector2.distance=.5*o.findLength(d,s),l.point=d;var c=t.segments[1];if(c.vector1.angle=ai(d,h),c.vector1.distance=.5*o.findLength(d,h),t.segments.length>2){var p=e[3],g={x:.5*(h.x+p.x),y:.5*(h.y+p.y)};c.vector2.angle=ai(g,h),c.vector2.distance=.5*o.findLength(g,h),c.point=g;var u=t.segments[2];if(u.vector1.angle=ai(g,p),u.vector1.distance=.5*o.findLength(g,p),t.segments.length>3){var f=e[4],m={x:.5*(p.x+f.x),y:.5*(p.y+f.y)};u.vector2.angle=ai(m,p),u.vector2.distance=.5*o.findLength(m,p),u.point=m;var y=t.segments[3];y.vector1.angle=ai(m,f),y.vector1.distance=.5*o.findLength(m,f),y.vector2.angle=ai(a,f),y.vector2.distance=.5*o.findLength(a,f)}else u.vector2.angle=ai(a,p),u.vector2.distance=.5*o.findLength(a,p)}else c.vector2.angle=ai(a,h),c.vector2.distance=.5*o.findLength(a,h)}},t.prototype.rotateObjects=function(t,e,i,r,n){r=r||{};var o,a=I();T(a,i,r.x,r.y);for(var s=0,h=e;s<h.length;s++){var d=h[s];if(d instanceof Yh){if(Zi(d)&&cr(this.diagram)){if(!1!==n||t!==d){o={offsetX:d.wrapper.offsetX,offsetY:d.wrapper.offsetY,rotateAngle:d.rotateAngle},d.rotateAngle=(d.rotateAngle+i+360)%360;var l=P(a,{x:d.wrapper.offsetX,y:d.wrapper.offsetY});d.offsetX=l.x,d.offsetY=l.y,this.diagram.nodePropertyChange(d,o,{offsetX:d.offsetX,offsetY:d.offsetY,rotateAngle:d.rotateAngle})}var c=this.diagram.nameTable[d.parentId];if(d.processId){var p=this.diagram.nameTable[d.processId],g=this.diagram.bpmnModule.getChildrenBound(p,d.id,this.diagram);this.diagram.bpmnModule.updateSubProcessess(g,d,this.diagram)}else if(c&&c.shape instanceof Gh){g=nh(c,d.id,this.diagram);oh(0,d,this.diagram,!1)}d.children&&d.children.length&&!d.container&&this.getChildren(d,e)}}else this.rotatePoints(d,i,r||{x:d.wrapper.offsetX,y:d.wrapper.offsetY});this.diagram.updateDiagramObject(d)}this.diagram.refreshCanvasLayers(),this.diagram.updateSelector()},t.prototype.snapConnectorEnd=function(t){return this.diagram.snapSettings.constraints&it.SnapToLines&&this.snappingModule&&this.diagram.snappingModule.snapConnectorEnd(t),t},t.prototype.snapAngle=function(t){return this.diagram.snapSettings.constraints&it.SnapToLines&&this.snappingModule?this.snappingModule.snapAngle(this.diagram,t):0},t.prototype.rotatePoints=function(t,e,i){if(!t.sourceWrapper||!t.targetWrapper){var r=I();T(r,e,i.x,i.y),t.sourcePoint=P(r,t.sourcePoint),t.targetPoint=P(r,t.targetPoint),"Bpmn"===t.shape.type&&"Default"===t.shape.sequence&&"Sequence"===t.shape.flow&&this.updatePathElementOffset(t);var n={sourcePoint:t.sourcePoint,targetPoint:t.targetPoint};if(this.diagram.connectorPropertyChange(t,{},n),t.segments&&t.segments.length>0){var o=this.diagram.getProtectPropertyChangeValue();this.diagram.protectPropertyChange(!0);var a=t;a.segments=[],this.diagram.connectorPropertyChange(a,{},{segments:a.segments}),this.diagram.protectPropertyChange(o)}}},t.prototype.updateInnerParentProperties=function(t){var e=this.diagram.isProtectedOnChange;this.diagram.protectPropertyChange(!0);for(var i=this.getAllDescendants(t,[],!1,!0),r=0;r<i.length;r++){var n=this.diagram.nameTable[i[parseInt(r.toString(),10)].id];n.offsetX=n.wrapper.offsetX,n.offsetY=n.wrapper.offsetY,n.width=n.wrapper.width,n.height=n.wrapper.height}this.diagram.protectPropertyChange(e)},t.prototype.scale=function(t,e,r,n,o,a){var s=this.diagram.nameTable[t.id],h=s,d=s.wrapper;o||(o=t);var l=o.wrapper,c=ys(l.offsetX-l.actualSize.width*l.pivot.x,l.offsetY-l.actualSize.height*l.pivot.y,l.actualSize.width,l.actualSize.height,l.rotateAngle,l.offsetX,l.offsetY,n);if(void 0!==d.actualSize.width&&void 0!==d.actualSize.height&&cr(this.diagram)){if(h.children&&!h.container){for(var p=0,g=this.getAllDescendants(h,[]);p<g.length;p++){var u=g[p];this.scaleObject(e,r,c,u,d,o)}t.wrapper.measure(new i),t.wrapper.arrange(t.wrapper.desiredSize),this.diagram.updateGroupOffset(s),this.updateInnerParentProperties(h)}else this.scaleObject(e,r,c,s,d,o);var f=R(t.wrapper);if(!this.checkBoundaryConstraints(void 0,void 0,f)&&a)return this.scale(t,1/e,1/r,n,void 0,!0),!1;this.diagram.updateDiagramObject(t)}return!0},t.prototype.getAllDescendants=function(t,e,i,r){for(var n=t,o=[],a=0;a<n.children.length;a++)(t=this.diagram.nameTable[n.children[parseInt(a.toString(),10)]])&&(t.children?(i&&e.push(t),r&&o.push(t),e=this.getAllDescendants(t,e)):e.push(t));return r?o:e},t.prototype.getChildren=function(t,e){var i=t;if(t.children&&t.children.length)for(var r=0;r<i.children.length;r++)(t=this.diagram.nameTable[i.children[parseInt(r.toString(),10)]])&&e.push(t);return e},t.prototype.cloneChild=function(t){return this.diagram.nameTable[""+t]},t.prototype.scaleObject=function(t,e,i,r,n,o,a){e=e<0?1:e;var s={};if(1!==(t=t<0?1:t)||1!==e){var h=void 0,d=void 0;if(r instanceof Yh){var l=r,c=void 0,p=void 0;if(s={width:r.wrapper.actualSize.width,height:r.wrapper.actualSize.height,offsetX:r.wrapper.offsetX,offsetY:r.wrapper.offsetY,margin:{top:l.margin.top,left:l.margin.left}},"Bpmn"===l.shape.type&&l.shape.activity.subProcess.processes&&l.shape.activity.subProcess.processes.length>0&&(p=this.diagram.bpmnModule.getChildrenBound(l,l.id,this.diagram),c=l.wrapper.bounds.containsRect(p)),"Container"===l.shape.type&&l.shape.children&&l.shape.children.length>0&&(p=nh(l,l.id,this.diagram),c=l.wrapper.bounds.containsRect(p)),h=l.wrapper.actualSize.width*t,d=l.wrapper.actualSize.height*e,"SwimLane"===l.shape.type&&(t<1||e<1)){var g="SwimLane"===r.shape.type?r.shape.padding:void 0,u="Horizontal"===l.shape.orientation?l.shape.phases[l.shape.phases.length-1]:l.shape.lanes[l.shape.lanes.length-1],f=this.diagram.nameTable[u.header.id];r.wrapper.children[0].updateColumnWidth(f.columnIndex,h,!0,g),h=f.actualSize.width,d=r.height}var m=(l.constraints&ht.AspectRatio)===ht.AspectRatio,y=void 0!==l.minWidth&&0!==l.minWidth,v=void 0!==l.maxWidth&&0!==l.maxWidth,b=void 0!==l.minHeight&&0!==l.minHeight,S=void 0!==l.maxHeight&&0!==l.maxHeight;if(m){var w=l.wrapper.actualSize;y&&b?d/l.minHeight<h/l.minWidth?d<l.minHeight&&(d=l.minHeight,h=l.minHeight*(w.width/w.height)):h<l.minWidth&&(h=l.minWidth,d=l.minWidth*(w.height/w.width)):y?h<l.minWidth&&(h=l.minWidth,d=l.minWidth*(w.height/w.width)):b&&d<l.minHeight&&(d=l.minHeight,h=l.minHeight*(w.width/w.height)),v&&S?d/l.maxHeight>h/l.maxWidth?d>l.maxHeight&&(d=l.maxHeight,h=l.maxHeight*(w.width/w.height)):h>l.maxWidth&&(h=l.maxWidth,d=l.maxWidth*(w.height/w.width)):v?h>l.maxWidth&&(h=l.maxWidth,d=l.maxWidth*(w.height/w.width)):S&&d>l.maxHeight&&(d=l.maxHeight,h=l.maxHeight*(w.width/w.height))}else v&&(h=Math.min(l.maxWidth,h)),y&&(h=Math.max(l.minWidth,h)),b&&(d=Math.max(l.minHeight,d)),S&&(d=Math.min(l.maxHeight,d));c&&(h=Math.max(h,p.right-l.wrapper.bounds.x),d=Math.max(d,p.bottom-l.wrapper.bounds.y)),t=h/l.actualSize.width,e=d/l.actualSize.height}var x=I();o||(o=r);var C=o.wrapper;if(T(x,-C.rotateAngle,i.x,i.y),A(x,t,e,i.x,i.y),T(x,C.rotateAngle,i.x,i.y),r instanceof Yh){var O=(l=r).wrapper.offsetX-l.wrapper.actualSize.width*l.pivot.x,D=l.wrapper.offsetY-l.wrapper.actualSize.height*l.pivot.y,M=!(this.diagram.undoRedoModule&&this.diagram.checkUndoRedo&&("Bpmn"===l.shape.type||l.parentId&&this.diagram.nameTable[l.parentId])),L=P(x,{x:l.wrapper.offsetX,y:l.wrapper.offsetY}),E=M?L.x:s.offsetX,z=M?L.y:s.offsetY,k=l.processId?this.diagram.nameTable[l.processId]:l.parentId?this.diagram.nameTable[l.parentId]:void 0;if(h>0){var B=l.margin.left+h,R=!k||void 0===k.maxWidth||B<k.maxWidth;k&&l.processId&&B>k.wrapper.actualSize.width&&(R=!!(k.constraints&ht.Resize)),R&&(l.width=h,l.offsetX=E)}if(d>0){var N=l.margin.top+d,j=!k||void 0===k.maxHeight||N<k.maxHeight;k&&l.processId&&N>k.wrapper.actualSize.height&&(j=!!(k.constraints&ht.Resize)),j&&(l.height=d,l.offsetY=z)}var H=l.wrapper.offsetX-l.wrapper.actualSize.width*l.pivot.x,W=l.wrapper.offsetY-l.wrapper.actualSize.height*l.pivot.y,_=this.diagram.nameTable[l.processId],Y=0;!_&&this.diagram.nameTable[l.parentId]&&"Container"===this.diagram.nameTable[l.parentId].shape.type&&(_=this.diagram.nameTable[l.parentId]).shape.hasHeader&&(Y=_.shape.header.height),_&&(H=l.offsetX-l.width*l.pivot.x,W=l.offsetY-l.height*l.pivot.y),_&&(l.margin.top-Y+(W-D)<=0||l.margin.left+(H-O)<=0)?"Drag"!==this.diagram.eventHandler.currentAction?this.diagram.nodePropertyChange(r,{},{margin:{top:l.margin.top,left:l.margin.left}}):this.diagram.nodePropertyChange(r,{},{width:l.width,height:l.height,margin:{top:l.margin.top,left:l.margin.left}}):un(this.diagram,r,!0)?fn(this.diagram,r):a||this.diagram.nodePropertyChange(r,s,{width:l.width,height:l.height,offsetX:l.offsetX,offsetY:l.offsetY,margin:{top:l.margin.top+(W-D),left:l.margin.left+(H-O)}})}else{var F=r,X={sourcePoint:F.sourcePoint,targetPoint:F.targetPoint};F.sourceWrapper&&F.targetWrapper||this.scaleConnector(F,x,X,t,e,i)}var V=this.diagram.nameTable[r.processId],U=this.diagram.nameTable[r.parentId];if(V){V.wrapper.bounds,r.wrapper.bounds,p=this.diagram.bpmnModule.getChildrenBound(V,r.id,this.diagram);this.diagram.bpmnModule.updateSubProcessess(p,r,this.diagram)}else if(U&&U.shape instanceof Gh){p=nh(U,r.id,this.diagram);oh(0,r,this.diagram,!0)}}},t.prototype.scaleConnector=function(t,e,i,r,n,o){t.sourcePoint=P(e,t.sourcePoint),t.targetPoint=P(e,t.targetPoint),"Bpmn"===t.shape.type&&"Default"===t.shape.sequence&&"Sequence"===t.shape.flow&&this.updatePathElementOffset(t);var a={sourcePoint:t.sourcePoint,targetPoint:t.targetPoint};this.diagram.connectorPropertyChange(t,i,a);var s=this.diagram.selectedItems;if(Rs(this.diagram,s)){var h=N(this.diagram.selectedItems),d={offsetX:h.offsetX,offsetY:h.offsetY,height:h.height,width:h.width,rotateAngle:h.rotateAngle},l=new Yh(this.diagram,"nodes",d,!0);l.wrapper=h.wrapper,l.wrapper.rotateAngle=s.rotateAngle,this.scaleObject(r,n,o,l,l.wrapper,l,!0),s.wrapper.actualSize.width=l.width,s.wrapper.actualSize.height=l.height,s.wrapper.offsetX=l.offsetX,s.wrapper.offsetY=l.offsetY,this.diagram.selectedItems.connectors[0].id!==t.id&&this.measureSelector(s)}},t.prototype.measureSelector=function(t){var e,i=void 0,r=[];r=N(this.diagram.selectedItems).connectors;for(var n={x:this.diagram.selectedItems.offsetX,y:this.diagram.selectedItems.offsetY},o=0;o<r.length;o++){var a=I();T(a,-t.rotateAngle,n.x,n.y),r[parseInt(o.toString(),10)].sourcePoint=P(a,r[parseInt(o.toString(),10)].sourcePoint),r[parseInt(o.toString(),10)].targetPoint=P(a,r[parseInt(o.toString(),10)].targetPoint);var s={x:r[parseInt(o.toString(),10)].sourcePoint.x,y:r[parseInt(o.toString(),10)].sourcePoint.y},h={x:r[parseInt(o.toString(),10)].targetPoint.x,y:r[parseInt(o.toString(),10)].targetPoint.y};e=this.calculateBounds(s,h),void 0===i?i=e:i.uniteRect(e)}var d={};void 0!==i&&(d={x:i.x+i.width*t.wrapper.pivot.x,y:i.y+i.height*t.wrapper.pivot.y});var l={offsetX:d.x,offsetY:d.y,height:i.height,width:i.width,rotateAngle:0},c=new Yh(this.diagram,"nodes",l,!0),p=I();T(p,t.rotateAngle,n.x,n.y),c.rotateAngle+=t.rotateAngle,c.rotateAngle=(c.rotateAngle+360)%360;var g=P(p,{x:c.offsetX,y:c.offsetY});c.offsetX=g.x,c.offsetY=g.y,t.wrapper.actualSize.width=i.width,t.wrapper.actualSize.height=i.height,t.wrapper.offsetX=c.offsetX,t.wrapper.offsetY=c.offsetY;var u=od(this.diagram.element.id);this.diagram.diagramRenderer.renderResizeHandle(t.wrapper,u,t.thumbsConstraints,this.diagram.scroller.currentZoom,t.constraints,this.diagram.scroller.transform,!1,Yi(t),null,null,t.handleSize)},t.prototype.calculateBounds=function(t,e){var i=Math.min(t.x,e.x),r=Math.max(t.x,e.x),n=Math.min(t.y,e.y),o=Math.max(t.y,e.y);return new w(i,n,r-i,o-n)},t.prototype.portDrag=function(t,e,i,r){var n,o,a=this.findTarget(e,t),s=R(t.wrapper);a&&gr(a,this.diagram)&&(t instanceof Yh?(n=this.getPortChanges(t,a),a.offset.x+=i/s.width,a.offset.y+=r/s.height,a.offset.x=Math.max(0,Math.min(1,a.offset.x)),a.offset.y=Math.max(0,Math.min(1,a.offset.y)),o=this.getPortChanges(t,a),this.diagram.nodePropertyChange(t,n,o)):(n=this.getConnectorPortChanges(t,a),this.updatePortOffset(t,a,i,r),a.alignment="Center",o=this.getConnectorPortChanges(t,a),this.diagram.connectorPropertyChange(t,n,o)),this.diagram.updateDiagramObject(t))},t.prototype.labelDrag=function(t,e,i,r){var n=this.findTarget(e,t),o=B(t.wrapper),a=this.getAnnotationChanges(t,n),s=this.getSelectedObject();if(n instanceof Ie){var h=e.flippedPoint&&e.flip===tt.Horizontal||e.flip===tt.Both?-1:1,d=e.flippedPoint&&e.flip===tt.Vertical||e.flip===tt.Both?-1:1;if(this.diagram.constraints&ct.RestrictNegativeAxisDragDrop){this.annotationRestrictDeltaValue=this.annotationRestrictDeltaValue||{x:0,y:0},this.annotationRestrictDeltaValue.x>0&&(this.annotationRestrictDeltaValue.x-=i,i=this.annotationRestrictDeltaValue.x>0?0:-this.annotationRestrictDeltaValue.x,this.annotationRestrictDeltaValue.x=Math.max(0,this.annotationRestrictDeltaValue.x)),this.annotationRestrictDeltaValue.y>0&&(this.annotationRestrictDeltaValue.y-=r,r=this.annotationRestrictDeltaValue.y>0?0:-this.annotationRestrictDeltaValue.y,this.annotationRestrictDeltaValue.y=Math.max(0,this.annotationRestrictDeltaValue.y));var l=Math.cos(e.parentTransform*Math.PI/180),c=Math.sin(e.parentTransform*Math.PI/180),p={x:t.offsetX+((o.x+n.offset.x*o.width+i-t.offsetX)*l-(o.y+n.offset.y*o.height+r-t.offsetY)*c),y:t.offsetY+((o.x+n.offset.x*o.width+i-t.offsetX)*c+(o.y+n.offset.y*o.height+r-t.offsetY)*l)},g=(e.parentTransform+e.rotateAngle)%360,u=this.getRotatedAnnotationCorners(p,e.actualSize.width,e.actualSize.height,g),f=u.map(function(t){return t.x}),m=u.map(function(t){return t.y}),y=Math.min.apply(Math,f),v=Math.min.apply(Math,m);(y<0||v<0)&&(i=0,r=0,0===e.parentTransform&&(y<0&&(this.annotationRestrictDeltaValue.x+=-y),v<0&&(this.annotationRestrictDeltaValue.y+=-v)))}n.offset.x+=h*i/o.width,n.offset.y+=d*r/o.height}else this.updatePathAnnotationOffset(t,n,i,r),n instanceof Pe&&(n.alignment="Center");var b=this.getAnnotationChanges(t,n);t instanceof Yh?this.diagram.nodePropertyChange(t,a,b):this.diagram.connectorPropertyChange(t,a,b),this.diagram.updateDiagramObject(t),Dn(this.diagram,n,!1,e)||this.labelSelect(t,e,s);for(var S=0,w=this.diagram.views;S<w.length;S++){var x=w[S],I=this.diagram.views[x];I instanceof sc||this.diagram.refreshCanvasDiagramLayer(I)}},t.prototype.getRotatedAnnotationCorners=function(t,e,i,r){var n=Math.cos(r*Math.PI/180),o=Math.sin(r*Math.PI/180),a=e/2,s=i/2;return[{x:t.x+(-a*n- -s*o),y:t.y+(-a*o+-s*n)},{x:t.x+(a*n- -s*o),y:t.y+(a*o+-s*n)},{x:t.x+(-a*n-s*o),y:t.y+(-a*o+s*n)},{x:t.x+(a*n-s*o),y:t.y+(a*o+s*n)}]},t.prototype.updatePathAnnotationOffset=function(t,e,i,r,n,a){var s,h,d,l,c,p=this.diagram.getWrapper(t.wrapper,e.id),g=p.offsetX,u=p.offsetY,f=t.intermediatePoints,m=0;switch(e.verticalAlignment){case"Center":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u+r});break;case"Top":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u-p.actualSize.height/2+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u-p.actualSize.height/2+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u-p.actualSize.height/2+r});break;case"Bottom":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u+p.actualSize.height/2+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u+p.actualSize.height/2+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u+p.actualSize.height/2+r})}var y=this.getInterceptWithSegment(c,f),v=f[f.length-1];if(d=o.getLengthFromListOfPoints(f),y.length>0){if(e.dragLimit=e.dragLimit?e.dragLimit:{},e.dragLimit.top||e.dragLimit.bottom||e.dragLimit.left||e.dragLimit.right){var b={minDistance:null};v=this.getRelativeOffset(c,f,b);var S={minDistance:null};if(l=this.getRelativeOffset(c,y,S),null!=b&&S.minDistance<b.minDistance)v=l;else v=Pa(t.intermediatePoints,e).point}else v=l=y[y.length-1];if(v){var x=void 0;for(x=0;x<f.length;x++){if(null!=h){if(w.toBounds([h,f[parseInt(x.toString(),10)]]).containsPoint(v)){m+=o.findLength(h,v);break}m+=o.findLength(h,f[parseInt(x.toString(),10)])}h=f[parseInt(x.toString(),10)]}s={x:m/d,y:0}}this.updateLabelMargin(t,e,s,c,a,i,r)}else this.updateLabelMargin(t,e,null,c,a,i,r)},t.prototype.updatePortOffset=function(t,e,i,r,n,a){var s,h,d,l,c,p=this.diagram.getWrapper(t.wrapper,e.id),g=p.offsetX,u=p.offsetY,f=t.intermediatePoints,m=0;switch(e.verticalAlignment){case"Center":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u+r});break;case"Top":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u-p.actualSize.height/2+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u-p.actualSize.height/2+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u-p.actualSize.height/2+r});break;case"Bottom":"Center"===e.horizontalAlignment?c=n||{x:g+i,y:u+p.actualSize.height/2+r}:"Right"===e.horizontalAlignment?c=n||{x:g+p.actualSize.width/2+i,y:u+p.actualSize.height/2+r}:"Left"===e.horizontalAlignment&&(c=n||{x:g-p.actualSize.width/2+i,y:u+p.actualSize.height/2+r})}var y=this.getInterceptWithSegment(c,f),v=f[f.length-1];if(d=o.getLengthFromListOfPoints(f),y.length>0){v=l=y[y.length-1];var b={minDistance:null};v=this.getRelativeOffset(c,f,b);var S={minDistance:null};if(l=this.getRelativeOffset(c,y,S),null!=b&&S.minDistance<b.minDistance)v=l;else v=Pa(t.intermediatePoints,e).point;if(v){var x=void 0;for(x=0;x<f.length;x++){if(null!=h){if(w.toBounds([h,f[parseInt(x.toString(),10)]]).containsPoint(v)){m+=o.findLength(h,v);break}m+=o.findLength(h,f[parseInt(x.toString(),10)])}h=f[parseInt(x.toString(),10)]}s={x:m/d,y:0}}this.updateLabelMargin(t,e,s,c,a,i,r)}else this.updateLabelMargin(t,e,null,c,a,i,r)},t.prototype.getRelativeOffset=function(t,e,i){var r,n,o,a;for(a=0;a<e.length;a++)o=e[parseInt(a.toString(),10)],n=Math.round(Math.sqrt(Math.pow(t.x-o.x,2)+Math.pow(t.y-o.y,2))),null!==i.minDistance&&Math.min(Math.abs(i.minDistance),Math.abs(n))!==Math.abs(n)||(r=o,i.minDistance=n);return r},t.prototype.dragLimitValue=function(t,e,i,r){var n=!1,o=!1;return i.x>=e.x-t.left-r.width/2&&i.x<=e.x+t.right+r.width/2&&(n=!0),i.y>=e.y-t.top-r.height/2&&i.y<=e.y+t.bottom+r.height/2&&(o=!0),{x:n,y:o}},t.prototype.updateLabelMargin=function(t,e,i,r,n,a,s){if(i=i||{x:e.offset,y:0},e&&i&&i.x>0&&i.x<1){var h=o.getLengthFromListOfPoints(t.intermediatePoints),d=this.getPointAtLength(h*i.x,t.intermediatePoints,0),l=this.diagram.scrollSettings.currentZoom,c=e.dragLimit?e.dragLimit:{left:0,right:0,top:0,bottom:0};if(c.top||c.bottom||c.left||c.right||e instanceof ve){this.diagram.getWrapper(t.wrapper,e.id);var p=new w(0,0,0,0),g=this.diagram.getWrapper(t.wrapper,e.id);p.x=g.offsetX/l+a,p.y=g.offsetY/l+s,p.width=e instanceof ve?0:g.bounds.width/l,p.height=e instanceof ve?0:g.bounds.height/l;var u=new w(d.x-(c.left||0)-p.width/2,d.y-(c.top||0)-p.height/2,(c.left||0)+(c.right||0)+p.width,(c.top||0)+(c.bottom||0)+p.height);if(u.containsPoint(r));else for(var f=[d,r],m=0,y=this.boundsInterSects(f,u,!1);m<y.length;m++){r=y[m]}var v=this.dragLimitValue(c,d,r,p);e.margin={left:v.x?r.x-d.x:e.margin.left,top:v.y?r.y-d.y:e.margin.top,right:0,bottom:0}}else e.margin={left:r.x-d.x,top:r.y-d.y,right:0,bottom:0};e.offset=i.x,n&&(e.width=n.width,e.height=n.height)}},t.prototype.boundsInterSects=function(t,e,i){var r;if(e){var n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height},{x:e.x,y:e.y}];r=this.intersect(t,n,i)}return r},t.prototype.intersect=function(t,e,i){for(var r=[],n=0;n<t.length-1;n++)for(var o=0;o<e.length-1;o++){var a=ga(t[n],t[n+1],e[o],e[o+1]);0!==a.x&&0!==a.y&&r.push(a)}return r},t.prototype.getPointAtLength=function(t,e,i){for(var r,n,a=0,s={x:0,y:0},h=0;h<e.length;h++)if(n=e[h],r){var d=o.findLength(r,n),l=void 0,c=void 0,p=void 0,g=void 0;if(a+d>=t){l=t-a,c=o.findAngle(r,n),p=l*Math.cos(c*Math.PI/180),g=l*Math.sin(c*Math.PI/180),s={x:r.x+p,y:r.y+g};break}a+=d,r=n}else r=n;return s},t.prototype.getInterceptWithSegment=function(t,e){for(var i,r,n=[],a=[],s=[],h=o.findLength({x:0,y:0},{x:this.diagram.scroller.viewPortWidth,y:this.diagram.scroller.viewPortHeight}),d=1;d<e.length;d++){s=[e[d-1],e[d]],a=[],r=Math.round(o.findAngle(s[0],s[1])%360),i=Math.round(o.findAngle(s[1],s[0])%360);var l=r>0&&r<=90||r>180&&r<=270?90:-90;a.push(o.transform(t,r+l,h)),a.push(o.transform(t,i+l,h));var c=pa({x1:s[0].x,y1:s[0].y,x2:s[1].x,y2:s[1].y},{x1:a[0].x,y1:a[0].y,x2:a[1].x,y2:a[1].y});c.enabled&&n.push(c.intersectPt)}return n},t.prototype.getAnnotationChanges=function(t,e){var i={};return i[os(t,e.id,!0)]={width:e.width,height:e.height,offset:t instanceof Yh?{x:e.offset.x,y:e.offset.y}:e.offset,rotateAngle:e.rotateAngle,margin:{left:e.margin.left,right:e.margin.right,top:e.margin.top,bottom:e.margin.bottom},horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,alignment:t instanceof Co?e.alignment:void 0},{annotations:i}},t.prototype.getConnectorPortChanges=function(t,e){var i={};return i[as(t,e.id)]={width:e.width,height:e.height,offset:e.offset,margin:{left:e.margin.left,right:e.margin.right,top:e.margin.top,bottom:e.margin.bottom},horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,alignment:t instanceof Co?e.alignment:void 0},{ports:i}},t.prototype.getPortChanges=function(t,e){var i={};return i[os(t,e.id,!1)]={offset:e.offset},{ports:i}},t.prototype.labelRotate=function(t,e,i,r){var n,o;n=this.getAnnotationChanges(t,e);I(),e.rotateAngle;var a=this.diagram.getWrapper(t.wrapper,e.id),s=0,h=0;a.flippedPoint&&(s=a.flippedPoint.x-a.corners.topLeft.x,h=a.flippedPoint.y-a.corners.topLeft.y);var d=ai({x:a.offsetX+s,y:a.offsetY+h},i)+90,l=this.snapAngle(d);(d=0!==l?l:d,e instanceof Pe&&e.segmentAngle)&&(d-=Sa(t.intermediatePoints,e,t.wrapper.bounds).angle);d=(d+360)%360,e.rotateAngle+=d-(e.rotateAngle+a.parentTransform),e instanceof Pe&&(e.alignment="Center");var c=a.rotateAngle;a.rotateAngle=e.rotateAngle,r.wrapper.rotateAngle=r.rotateAngle=e.rotateAngle,a.rotateAngle=this.diagram.canRotateOnNegativeAxis(a)?e.rotateAngle:e.rotateAngle=c,o=this.getAnnotationChanges(t,e),t instanceof Yh?this.diagram.nodePropertyChange(t,n,o):this.diagram.connectorPropertyChange(t,n,o),this.diagram.updateDiagramObject(t);for(var p=0,g=this.diagram.views;p<g.length;p++){var u=g[p],f=this.diagram.views[u];f instanceof sc||this.diagram.refreshCanvasDiagramLayer(f)}},t.prototype.labelResize=function(t,e,r,n,o,a){var s,h,d;s=this.getAnnotationChanges(t,e);var l=a.wrapper.children[0];if(r&&1!==r||n&&1!==n){var c=I(),p=I();T(c,-t.rotateAngle,t.offsetX,t.offsetY),T(p,-(d=(l.rotateAngle+(t instanceof Yh?t.rotateAngle:0)+360)%360),o.x,o.y),A(p,r,n,o.x,o.y),T(p,d,o.x,o.y);var g=P(p,{x:l.offsetX,y:l.offsetY}),u=l.actualSize.height*n,f=l.actualSize.width*r;if(this.diagram.constraints&ct.RestrictNegativeAxisDragDrop){var m=P(p,{x:l.offsetX,y:l.offsetY});if(this.getRotatedAnnotationCorners(m,f,u,d).some(function(t){return t.x<0||t.y<0}))return r=1,n=1,f=l.actualSize.width,void(u=l.actualSize.height)}var y=this.findTarget(l,t);if(y instanceof Pe&&(g.y+="Top"===y.verticalAlignment?-u/2:"Bottom"===y.verticalAlignment?u/2:0,g.x+="Left"===y.horizontalAlignment?-f/2:"Right"===y.horizontalAlignment?f/2:0),y instanceof Pe)this.updatePathAnnotationOffset(t,e,0,0,g,new i(f,u));else{var v=B(t.wrapper);(g=P(c,g)).x=g.x-l.margin.left+l.margin.right,g.y=g.y-l.margin.top+l.margin.bottom,g.y+="Top"===y.verticalAlignment?-u/2:"Bottom"===y.verticalAlignment?u/2:0,g.x+="Left"===y.horizontalAlignment?-f/2:"Right"===y.horizontalAlignment?f/2:0;var b=v.width/(g.x-v.x),S=v.height/(g.y-v.y);if(f>1){y.width=f;var w=y.offset.x;y.offset.x=1/b,!l.flippedPoint||l.flip!==tt.Horizontal&&l.flip!==tt.Both||"Center"!==l.horizontalAlignment||(y.offset.x=w+w-y.offset.x)}if(u>1){y.height=u;var x=y.offset.y;y.offset.y=1/S,!l.flippedPoint||l.flip!==tt.Vertical&&l.flip!==tt.Both||"Center"!==l.verticalAlignment||(y.offset.y=x+x-y.offset.y)}}}e instanceof Pe&&(e.alignment="Center"),h=this.getAnnotationChanges(t,e),t instanceof Yh?this.diagram.nodePropertyChange(t,s,h):this.diagram.connectorPropertyChange(t,s,h),this.diagram.updateDiagramObject(t);for(var C=0,O=this.diagram.views;C<O.length;C++){var D=O[C],M=this.diagram.views[D];M instanceof sc||this.diagram.refreshCanvasDiagramLayer(M)}},t.prototype.getSubProcess=function(t){var e,i={nodes:[],connectors:[]};return t instanceof Yh?e=t.processId:t&&t.nodes&&t.nodes.length&&t.nodes[0].processId&&(e=t.nodes[0].processId),e?(i.nodes.push(N(this.diagram.nameTable[e])),i):i},t.prototype.getContainer=function(t){var e,i={nodes:[],connectors:[]};return t instanceof Yh?e=t.parentId:t&&t.nodes&&t.nodes.length&&t.nodes[0].parentId&&(e=t.nodes[0].parentId),e?(i.nodes.push(N(this.diagram.nameTable[e])),i):i},t.prototype.checkBoundaryConstraints=function(t,e,i,r){var n=this.diagram.pageSettings,o=this.diagram.pageSettings.boundaryConstraints,a=this.diagram.scroller;if("Page"===o||"Diagram"===o){var s=i?void 0:this.diagram.selectedItems.wrapper.bounds,h="Page"===o?n.width:a.viewPortWidth,d="Page"===o?n.height:a.viewPortHeight,l=i,c=(i?l.right:s.right)+(t||0),p=(i?l.left:s.left)+(t||0),g=(i?l.top:s.top)+(e||0),u=(i?l.bottom:s.bottom)+(e||0);return!!(c<=h&&p>=0&&u<=d&&g>=0||"None"!==this.diagram.layout.type&&r)}return!0},t.prototype.dragSelectedObjects=function(t,e){var i=this,r=this.diagram.selectedItems;this.state&&!this.state.backup&&(this.state.backup={},this.state.backup.offsetX=r.offsetX,this.state.backup.offsetY=r.offsetY),r=gn(this.diagram,r)||r;var n=this.diagram.selectedItems.nodes.filter(function(t){return"SwimLane"===t.shape.type}),o=[];if(n.length>0&&!this.diagram.currentSymbol&&this.diagram.selectedItems.nodes.length+this.diagram.selectedItems.connectors.length>1){var a=this.diagram.selectedItems.nodes.filter(function(t){return""===t.parentId||"SwimLane"!==i.diagram.nameTable[t.parentId].shape.type});if(a.length>0){for(var s=0;s<a.length;s++)(this.diagram.nameTable[a[parseInt(s.toString(),10)].parentId]&&this.diagram.nameTable[a[parseInt(s.toString(),10)].parentId].isLane||"SwimLane"===a[parseInt(s.toString(),10)].shape.type)&&(a.splice(s,1),s--);var h=n.filter(function(t,e,i){return e===i.findIndex(function(e){return e.id===t.id})});for(s=0;s<h.length;s++)o=o.concat(Dr(this.diagram,h[s].wrapper.children[0]));(a.length>0||h.length>1||this.diagram.selectedItems.connectors.length>0)&&(a=a.concat(h),this.diagram.selectedItems.nodes.splice(0,this.diagram.selectedItems.nodes.length),a.forEach(function(t){i.diagram.selectedItems.nodes.push(t)}),r=this.diagram.selectedItems,this.diagram.selectedObject.helperObject=void 0)}}if(this.checkBoundaryConstraints(t,e)){this.diagram.diagramActions=this.diagram.diagramActions|yt.PreventZIndexOnDragging|yt.DragUsingMouse;var d=this.diagram.selectedObject.actualObject;return(d&&d instanceof Yh&&d.isLane&&hn(d,this.diagram)||!d||!d.isLane)&&(this.diagram.drag(r,t,e),Rr(o,this.diagram)),this.diagram.diagramActions=this.diagram.diagramActions&~(yt.PreventZIndexOnDragging|yt.DragUsingMouse),this.diagram.refreshCanvasLayers(),this.checkHtmlObjectDrag(r),!0}return!1},t.prototype.checkHtmlObjectDrag=function(t){var e=!1;this.diagram.views&&this.diagram.views.length>1&&(t instanceof qh?e=t.nodes.some(function(t){return t.shape&&"HTML"===t.shape.type}):t.shape&&"HTML"===t.shape.type&&(e=!0),e&&this.resetOverviewCanvas())},t.prototype.resetOverviewCanvas=function(){for(var t=0,e=this.diagram.views;t<e.length;t++){var i=e[t],r=this.diagram.views[i];if(!(r instanceof sc)){var n=document.getElementById(r.canvas.id+"overviewrect"),o=Number(n.getAttribute("x")),a=Number(n.getAttribute("y")),s=Number(n.getAttribute("width")),h=Number(n.getAttribute("height"));Id(n,{x:o,y:a,width:Math.max(1,s),height:Math.max(1,h)})}}},t.prototype.scaleSelectedItems=function(t,e,i){var r=this.diagram.selectedItems;this.state&&!this.state.backup&&(this.state.backup={},this.state.backup.offsetX=r.offsetX,this.state.backup.offsetY=r.offsetY,this.state.backup.width=r.width,this.state.backup.height=r.height,this.state.backup.pivot=i),r=gn(this.diagram,r)||r;if(!isNaN(t)&&isFinite(t)||(t=1),!isNaN(e)&&isFinite(e)||(e=1),r&&r.connectors&&r.connectors.length>0&&r.wrapper&&r.wrapper.actualSize){var n=r.wrapper.actualSize.width||r.width||0,o=r.wrapper.actualSize.height||r.height||0;n>0&&n*t<10&&(t=10/n),o>0&&o*e<10&&(e=10/o)}return r.width*t<1&&(t=1),r.height*e<1&&(e=1),this.diagram.scale(r,t,e,i)},t.prototype.rotateSelectedItems=function(t){var e=this.diagram.selectedItems;return this.state&&!this.state.backup&&(this.state.backup={},this.state.backup.angle=e.rotateAngle),e=gn(this.diagram,e)||e,this.diagram.rotate(e,t,void 0,!0)},t.prototype.hasSelection=function(){return An(this.diagram)},t.prototype.isSelected=function(t){return Dn(this.diagram,t)},t.prototype.initExpand=function(t){var e=this.diagram.isProtectedOnChange;this.diagram.protectPropertyChange(!0);var i=t.target||t.source,r={isExpanded:i.isExpanded};i.isExpanded=!i.isExpanded,this.diagram.preventNodesUpdate=!0,this.diagram.diagramActions|=yt.PreventIconsUpdate,this.diagram.nodePropertyChange(i,r,{isExpanded:i.isExpanded}),this.diagram.diagramActions=this.diagram.diagramActions&~yt.PreventIconsUpdate,this.diagram.preventNodesUpdate=!1;for(var n=0,o=this.diagram.views;n<o.length;n++){var a=o[n],s=this.diagram.views[a];s instanceof sc||this.diagram.refreshCanvasDiagramLayer(s)}this.diagram.protectPropertyChange(e)},t.prototype.expandNode=function(t,e,i){var r=this.diagram.preventNodesUpdate,n=t.isExpanded;this.diagram.preventNodesUpdate=!0,this.expandCollapse(t,n,this.diagram,void 0),t.isExpanded=n;var o=this.diagram.layout.fixedNode;this.diagram.layout.fixedNode=t.id,this.diagram.diagramActions!=yt.Render&&this.diagram.layoutAnimateModule&&this.diagram.layout.enableAnimation&&this.diagram.organizationalChartModule&&(this.diagram.organizationalChartModule.isAnimation=!0),this.diagram.blazorActions|=$.expandNode;var a={};if(i||(this.layoutAnimateModule&&this.layoutAnimateModule.setIntervalObject.length>0&&(this.layoutAnimateModule.stopCurrentAnimation(this.objectStore[0],e,t),this.objectStore=[]),a=this.diagram.doLayout(),this.objectStore.push(a)),this.canUpdateTemplate=!1,this.diagram.blazorActions&=~$.expandNode,this.diagram.preventNodesUpdate=r,this.diagram.layoutAnimateModule&&this.diagram.organizationalChartModule&&!i)this.diagram.allowServerDataBinding=!1,this.layoutAnimateModule.expand(this.diagram.layout.enableAnimation,a,t,this.diagram);else{var s={element:N(t),state:!!t.isExpanded};this.triggerEvent(xt.expandStateChange,s),this.diagram.lineRoutingModule&&this.diagram.constraints&ct.LineRouting&&"ComplexHierarchicalTree"!==this.diagram.layout.type&&this.diagram.resetSegments()}return this.diagram.layout.fixedNode=""===o?"":this.diagram.layout.fixedNode,a},t.prototype.getparentexpand=function(t,e,i,r){for(var n,o=0;o<t.inEdges.length;o++){var a=e.nameTable[t.inEdges[o]],s=e.nameTable[a.sourceID];if(s.isExpanded&&!i&&s.id!==r.sourceID&&a.visible)return!1;n=!0}return n},t.prototype.expandCollapse=function(t,e,i,r){if(r&&0!==r.length||(r=[]),!r.some(function(e){return e.id===t.id})){r.push(t);for(var n=0;n<t.outEdges.length;n++){var o=i.nameTable[t.outEdges[n]],a=i.nameTable[o.targetID],s=this.getparentexpand(a,i,e,o);o.visible=e;var h={visible:a.visible,style:{opacity:a.wrapper.style.opacity}},d={visible:a.visible,style:{opacity:a.wrapper.style.opacity}};s&&(a.isExpanded&&this.expandCollapse(a,e,i,r),a.visible=e,a.style.opacity=this.diagram.layoutAnimateModule&&this.diagram.layout.enableAnimation&&e?.1:a.style.opacity,i.nodePropertyChange(a,h,d)),i.connectorPropertyChange(o,h,d)}}},t.prototype.updateNodeDimension=function(t,e){t instanceof Yh&&(t.offsetX=e.x+e.width/2,t.offsetY=e.y+e.height/2,t.width=e.width,t.height=e.height,t.wrapper.children[0].canMeasurePath=!0,this.diagram.nodePropertyChange(t,{},{width:e.width,height:e.height,offsetX:t.offsetX,offsetY:t.offsetY}),"SVG"!==this.diagram.mode&&this.diagram.refreshDiagramLayer())},t.prototype.updateConnectorPoints=function(t,e){t instanceof Co&&"Bezier"!==t.type?(this.diagram.connectorPropertyChange(t,{},{targetPoint:t.targetPoint}),this.diagram.updateDiagramObject(t)):(this.diagram.connectorPropertyChange(t,{},{segments:t.segments}),this.diagram.updateDiagramObject(t))},t.prototype.updateSelectedNodeProperties=function(t){if(this.diagram.lineRoutingModule&&this.diagram.constraints&ct.LineRouting){this.diagram.protectPropertyChange(!0);var e=[],i=[],r=this.diagram.selectedObject.actualObject,n=this.diagram.selectedObject.helperObject,o=r instanceof qh?N(r):void 0;if(n&&r){var a=n.offsetX-r.offsetX,s=n.offsetY-r.offsetY,h=n.width-r.width,d=n.height-r.height,l=n.rotateAngle-r.rotateAngle;if(this.diagram.selectedItems.nodes.length+this.diagram.selectedItems.connectors.length>0&&(this.diagram.selectedItems.wrapper.rotateAngle=this.diagram.selectedItems.rotateAngle=n.rotateAngle),!(r instanceof Yh&&"SwimLane"!==r.shape.type)||r.isLane||r.isPhase||r.isHeader||un(this.diagram,r)){if(r instanceof qh){var c=n.width/r.width,p=n.height/r.height,g=this.diagram.eventHandler.tool.getPivot(this.diagram.eventHandler.tool.corner);if(this.diagram.eventHandler.tool.corner)for(var u=0;u<r.nodes.length;u++){var f=(x=r.nodes[parseInt(u.toString(),10)]).wrapper,m=r.wrapper,y=ys(m.offsetX-m.actualSize.width*m.pivot.x,m.offsetY-m.actualSize.height*m.pivot.y,m.actualSize.width,m.actualSize.height,m.rotateAngle,m.offsetX,m.offsetY,g);this.diagram.commandHandler.scaleObject(c,p,y,x,f,r)}else{for(u=0;u<r.nodes.length;u++){if((x=r.nodes[u])instanceof Yh&&"SwimLane"!==x.shape.type&&!un(this.diagram,x)&&!x.isLane&&!x.isPhase&&!x.isHeader){x.constraints&ht.Drag&&(x.offsetX+=a,x.offsetY+=s),x.width+=h,x.height+=d;var v=x.rotateAngle;x.rotateAngle+=l;var b=v!==x.rotateAngle,S={offsetX:x.offsetX,offsetY:x.offsetY,width:x.width,height:x.height,rotateAngle:x.rotateAngle};b||delete S.rotateAngle,this.diagram.nodePropertyChange(x,{},S),e=e.concat(this.diagram.spatialSearch.findObjects(r.wrapper.outerBounds))}}if(this.diagram.lineRoutingModule)for(u=0;u<r.connectors.length;u++){var w={sourcePoint:(I=r.connectors[u]).sourcePoint,targetPoint:I.targetPoint,sourceID:I.sourceID,targetID:I.targetID,sourcePortID:I.sourcePortID,targetPortID:I.targetPortID};this.diagram.connectorPropertyChange(I,{},w,void 0,!0)}}}}else r.offsetX===r.wrapper.offsetX&&r.offsetY===r.wrapper.offsetY&&r.width===r.wrapper.width&&r.height===r.wrapper.height&&r.rotateAngle===r.wrapper.rotateAngle||(r.offsetX+=a,r.offsetY+=s,r.width+=h,r.height+=d,r.rotateAngle+=l,this.diagram.nodePropertyChange(r,{},{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height,rotateAngle:r.rotateAngle},!1,!0)),e=this.diagram.spatialSearch.findObjects(r.wrapper.outerBounds)}else{var x;if(t instanceof Co?e.push(t):t instanceof qh&&t.connectors.length&&(e=e.concat(t.connectors)),t instanceof qh)if(-1!==this.diagram.nodes.indexOf(t.nodes[0]))!((x=r||t.nodes[0])instanceof Yh&&"SwimLane"!==x.shape.type)||un(this.diagram,x)||x.isLane||x.isPhase||x.isHeader||(e=e.concat(this.diagram.spatialSearch.findObjects(x.wrapper.outerBounds)))}for(u=0;u<e.length;u++)e[u]instanceof Co&&-1===i.indexOf(e[u].id)&&i.push(e[u].id);(i.length>0||this.diagram.routedConnectors.length>0)&&(this.diagram.avoidLineOverlappingModule&&(this.diagram.avoidLineOverlappingModule.removeConnectors(i),this.diagram.avoidLineOverlappingModule.removeConnectors(this.diagram.routedConnectors)),this.diagram.lineRoutingModule.renderVirtualRegion(this.diagram,!0)),this.diagram.lineRoutingModule.skipObstacleCheck=!0;for(u=0;u<this.diagram.routedConnectors.length;u++){var I=this.diagram.nameTable[this.diagram.routedConnectors[u]];this.ReRouteConnector(I)}this.diagram.lineRoutingModule.skipObstacleCheck=!1;for(u=0;u<i.length;u++){I=this.diagram.nameTable[i[u]];-1===this.diagram.routedConnectors.indexOf(I.id)&&this.ReRouteConnector(I)}if(this.diagram.routedConnectors=[],n&&r&&o&&"Drag"===this.diagram.eventHandler.currentAction){var P=!1,C=this.diagram.nameTable;for(u=0;u<r.nodes.length;u++)C[r.nodes[u].parentId]&&C[r.nodes[u].parentId].isLane||(P=!0);if(P){var T=N(r);this.diagram.startGroupAction();var A={type:"PositionChanged",redoObject:N(T),undoObject:o,category:"Internal"};this.diagram.addHistoryEntry(A),this.diagram.endGroupAction()}}this.updateSelector(),this.diagram.protectPropertyChange(!1)}},t.prototype.drawSelectionRectangle=function(t,e,i,r){this.diagram.drawSelectionRectangle(t,e,i,r)},t.prototype.ReRouteConnector=function(t){if(t instanceof Co&&"Orthogonal"===t.type&&t.sourceID&&t.targetID&&t.sourceID!=t.targetID&&"ComplexHierarchicalTree"!==this.diagram.layout.type){var e=this.diagram.getObject(t.sourceID),i=this.diagram.getObject(t.targetID),r=i.offsetX>e.offsetX?i.wrapper.outerBounds.middleLeft.x-e.wrapper.outerBounds.middleRight.x:e.wrapper.outerBounds.middleLeft.x-i.wrapper.outerBounds.middleRight.x,n=i.offsetY>e.offsetY?i.wrapper.outerBounds.topCenter.y-e.wrapper.outerBounds.bottomCenter.y:e.wrapper.outerBounds.topCenter.y-i.wrapper.outerBounds.bottomCenter.y;(r>30||n>30)&&this.diagram.lineRoutingModule.refreshConnectorSegments(this.diagram,t,!0)}},t.prototype.startGroupAction=function(){this.diagram.startGroupAction()},t.prototype.endGroupAction=function(){this.diagram.endGroupAction()},t.prototype.removeChildFromBPmn=function(t,e,i){var r=this,n=this.diagram.nameTable[t.id]||t.nodes[0];if(i)if(n&&n.processId&&n.processId===i.wrapper.id){N(n).processId=n.processId;var o=this.diagram.nameTable[n.processId].shape.activity.subProcess.processes||[];if(n.hasTextAnnotation)n.outEdges.concat(n.inEdges).forEach(function(t){var e=r.diagram.nameTable[t].targetID,i=o.indexOf(e);-1!==i&&(o.splice(i,1),r.diagram.bpmnModule.removeChildFromBPMN(r.diagram.nameTable[n.processId].wrapper,e,r.diagram),r.diagram.nameTable[e].processId="")});o.splice(o.indexOf(n.id),1),this.diagram.bpmnModule.removeChildFromBPMN(this.diagram.nameTable[n.processId].wrapper,n.id,this.diagram),this.diagram.nameTable[n.id].processId="",n.offsetX=n.wrapper.offsetX,n.offsetY=n.wrapper.offsetY}else if(n&&n.parentId&&n.parentId===i.wrapper.id&&this.diagram.nameTable[n.parentId].shape instanceof Gh){N(n).parentId=n.parentId;var a=this.diagram.nameTable[n.parentId].shape.children||[];a.splice(a.indexOf(n.id),1),sh(this.diagram.nameTable[n.parentId].wrapper,n.id,this.diagram),this.diagram.nameTable[n.id].parentId="",n.offsetX=n.wrapper.offsetX,n.offsetY=n.wrapper.offsetY}},t.prototype.isDroppable=function(t,i){var r=this.diagram.nameTable[t.id]||t.nodes[0]||t.connectors[0];return(r instanceof Yh||r instanceof Co)&&(!(0,e.isBlazor)()&&"TextAnnotation"===r.shape.shape||("Group"===i.shape.shape&&(i.shape.activity.subProcess.collapsed=!1),(!r||"Bpmn"!==r.shape.type||r.processId!==i.id&&r.id!==i.processId&&("Bpmn"!==i.shape.type||i instanceof Co||!i.shape.activity||!i.shape.activity.subProcess||!i.shape.activity.subProcess.collapsed))&&((!r||r.parentId!==i.id&&r.id!==i.parentId||"Container"!==i.shape.type||i instanceof Co)&&!(r&&"Container"===r.shape.type&&i.isLane||r&&"SwimLane"===r.shape.type&&"Container"===i.shape.type))))},t.prototype.renderHighlighter=function(t,e,i){new w;if(t.target instanceof Yh||t.target instanceof Co||e&&(t.source instanceof Yh||t.source instanceof Co)){var r=e?t.source:t.target,n=e?t.sourceWrapper:t.targetWrapper,o=this.findTarget(n,r,i,!0),a=void 0;if(o instanceof Ch)for(var s=o.id,h=t.target,d=0,l=h.wrapper.children[0].children[0].children[2].children;d<l.length;d++){var c=l[d];if(c.id===h.id+"_"+s){a=c.children[0];break}}else a=o instanceof Yh?o.wrapper:e?t.sourceWrapper:t.targetWrapper;!a||o instanceof Co||this.diagram.renderHighlighter(a)}},t.prototype.mouseOver=function(t,e,i){return!0},t.prototype.snapPoint=function(t,e,i,r){var n,o=this.diagram.selectedItems,a=e.x<t.x,s=e.y<t.y,h=n={x:i,y:r};return this.snappingModule&&(o.nodes.length>0&&o.nodes[0].constraints&ht.Drag||o.connectors.length>0&&o.connectors[0].constraints&at.Drag)&&(h=this.diagram.snappingModule.snapPoint(this.diagram,o,a,s,n,t,e)),h},t.prototype.removeSnap=function(){this.diagram.snapSettings.constraints&it.SnapToObject&&this.snappingModule&&this.snappingModule.removeGuidelines(this.diagram)},t.prototype.dropAnnotation=function(t,i){if(t instanceof Yh||t instanceof qh){var r=t instanceof Yh?t:t.nodes[0];if(this.diagram.bpmnModule&&"Bpmn"===i.shape.type&&!(0,e.isBlazor)()&&"TextAnnotation"===r.shape.shape){r.hasTarget=i.id,r.shape.annotation.nodeId=i.id,this.diagram.currentSymbol||(this.diagram.addTextAnnotation(r.shape.annotation,i),r.shape.annotation.nodeId="",this.diagram.remove(r)),this.diagram.refreshDiagramLayer()}}},t.prototype.drop=function(t,e,i){if(this.diagram.bpmnModule&&"Container"!==e.shape.type){var r=t instanceof Yh?[t]:t.nodes;if(r){for(var n=0;n<r.length;n++){var o=r[n];if(o&&"Bpmn"===o.shape.type&&e instanceof Yh&&"Bpmn"===e.shape.type&&!(e instanceof Co)&&(this.diagram.bpmnModule.dropBPMNchild(e,o,this.diagram),o.hasTextAnnotation))for(var a=0;a<o.outEdges.length;a++){var s=this.diagram.nameTable[o.outEdges[parseInt(a.toString(),10)]];if(s.isBpmnAnnotationConnector){var h=this.diagram.nameTable[s.targetID];this.diagram.bpmnModule.dropBPMNchild(e,h,this.diagram)}}}this.diagram.refreshDiagramLayer()}}else if("Container"===e.shape.type){for(var d=t instanceof Yh?[t]:t.nodes,l=0;l<d.length;l++){rh(e,d[l],this.diagram)}this.diagram.refreshDiagramLayer()}},t.prototype.addHistoryEntry=function(t){this.diagram.addHistoryEntry(t)},t.prototype.align=function(t,e,i){if(t.length>0){var r=0;t[0]=this.diagram.nameTable[t[0].id]||t[0];var n="Object"===i?R(t[0].wrapper):this.diagram.selectedItems.wrapper.bounds,o={nodes:[],connectors:[]},a={nodes:[],connectors:[]};for(r="Object"===i?r+1:r;r<t.length;r++){var s=0,h=0;t[r]=this.diagram.nameTable[t[r].id]||t[r];var d=R(t[r].wrapper);"Left"===e?s=n.left+d.width/2-d.center.x:"Right"===e?s=n.right-d.width/2-d.center.x:"Top"===e?h=n.top+d.height/2-d.center.y:"Bottom"===e?h=n.bottom-d.height/2-d.center.y:"Center"===e?s=n.center.x-d.center.x:"Middle"===e&&(h=n.center.y-d.center.y),o=this.storeObject(o,t[r]),this.drag(t[r],s,h),this.diagram.updateSelector(),a=this.storeObject(a,t[r])}o=N(o),a=N(a);var l={type:"Align",category:"Internal",undoObject:N(o),redoObject:N(a)};this.addHistoryEntry(l)}},t.prototype.distribute=function(t,e){if(t.length>0){var i=0,r=0,n=0,o=0,a=0,s=0,h=0,d=0,l=0,c={nodes:[],connectors:[]},p={nodes:[],connectors:[]};for(i=0;i<t.length;i++)t[i]=this.diagram.nameTable[t[i].id]||t[i];for(t=ba(t,e),i=1;i<t.length;i++)r=r+t[i].wrapper.bounds.topRight.x-t[i-1].wrapper.bounds.topRight.x,n=n+t[i].wrapper.bounds.topLeft.x-t[i-1].wrapper.bounds.topLeft.x,o=o+t[i].wrapper.bounds.topRight.y-t[i-1].wrapper.bounds.topRight.y,a=a+t[i].wrapper.bounds.bottomRight.y-t[i-1].wrapper.bounds.bottomRight.y,s=s+t[i].wrapper.bounds.center.x-t[i-1].wrapper.bounds.center.x,h=h+t[i].wrapper.bounds.center.y-t[i-1].wrapper.bounds.center.y,d=d+t[i].wrapper.bounds.topRight.y-t[i-1].wrapper.bounds.bottomRight.y,l=l+t[i].wrapper.bounds.middleLeft.x-t[i-1].wrapper.bounds.middleRight.x;for(i=1;i<t.length-1;i++){var g=0,u=0,f=R(t[i-1].wrapper),m=R(t[i].wrapper);"Center"===e?g=f.center.x-m.center.x+s/(t.length-1):"RightToLeft"===e?g=f.middleRight.x-m.middleLeft.x+l/(t.length-1):"Right"===e?g=f.topRight.x-m.topRight.x+r/(t.length-1):"Left"===e?g=f.topLeft.x-m.topLeft.x+n/(t.length-1):"Middle"===e?u=f.center.y-m.center.y+h/(t.length-1):"Top"===e?u=f.topRight.y-m.topRight.y+o/(t.length-1):"Bottom"===e?u=f.bottomRight.y-m.bottomRight.y+a/(t.length-1):"BottomToTop"===e&&(u=f.bottomRight.y-m.topRight.y+d/(t.length-1)),c=this.storeObject(c,t[i]),this.drag(t[i],g,u),this.diagram.updateSelector(),p=this.storeObject(p,t[i])}c=N(c),p=N(p);var y={type:"Distribute",category:"Internal",undoObject:N(c),redoObject:N(p)};this.addHistoryEntry(y)}},t.prototype.sameSize=function(t,e){if(t.length>0){var i=0,r={x:.5,y:.5};t[0]=this.diagram.nameTable[t[0].id]||t[0];var n=R(t[0].wrapper),o={nodes:[],connectors:[]},a={nodes:[],connectors:[]};for(i=1;i<t.length;i++){t[parseInt(i.toString(),10)]=this.diagram.nameTable[t[parseInt(i.toString(),10)].id]||t[0];var s=R(t[parseInt(i.toString(),10)].wrapper),h=1,d=1;"Width"===e?h=n.width/s.width:"Height"===e?d=n.height/s.height:"Size"===e&&(h=n.width/s.width,d=n.height/s.height),o=this.storeObject(o,t[parseInt(i.toString(),10)]),this.scale(t[parseInt(i.toString(),10)],h,d,r),a=this.storeObject(a,t[parseInt(i.toString(),10)])}this.diagram.updateSelector(),o=N(o),a=N(a);var l={type:"Sizing",category:"Internal",undoObject:N(o),redoObject:N(a)};this.addHistoryEntry(l)}},t.prototype.storeObject=function(t,e){return e instanceof Yh?t.nodes.push(N(e)):t.connectors.push(N(e)),t},t.prototype.updatePanState=function(t){if(t)this.diagram.realActions=this.diagram.realActions|bt.PanInProgress;else{this.diagram.dataBind();var e=this.diagram.scrollSettings,i=this.diagram.initialScrollValues;this.diagram.realActions=this.diagram.realActions&~bt.PanInProgress;var r={oldValue:{VerticalOffset:i?i.VerticalOffset:e.verticalOffset,HorizontalOffset:i?i.HorizontalOffset:e.horizontalOffset,ViewportHeight:i?i.ViewportHeight:e.viewPortHeight,ViewportWidth:i?i.ViewportWidth:e.viewPortWidth,CurrentZoom:i?i.CurrentZoom:e.currentZoom},newValue:{VerticalOffset:e.verticalOffset,HorizontalOffset:e.horizontalOffset,ViewportHeight:e.viewPortHeight,ViewportWidth:e.viewPortWidth,CurrentZoom:e.currentZoom},source:this.diagram,panState:"Completed"};this.triggerEvent(xt.scrollChange,r)}},t.prototype.dataBinding=function(){this.diagram.dataBind()},t.prototype.setBlazorDiagramProps=function(t){this.diagram.setBlazorDiagramProps(t)},t.prototype.scroll=function(t,e,i){var r=this.diagram.constraints&ct.PanX,n=function(t){return t.constraints&ct.PanY}(this.diagram);this.diagram.pan((t=r?t:0)*this.diagram.scroller.currentZoom,(e=n?e:0)*this.diagram.scroller.currentZoom,i,!0)},t.prototype.drawHighlighter=function(t){this.diagram.renderHighlighter(t.wrapper)},t.prototype.removeHighlighter=function(){this.diagram.clearHighlighter()},t.prototype.renderContainerHelper=function(t){return gn(this.diagram,t)},t.prototype.isParentAsContainer=function(t,e){return un(this.diagram,t,e)},t.prototype.isTargetSubProcess=function(t){return!!(t&&t.shape&&"Bpmn"===t.shape.type&&t.shape.activity&&"SubProcess"===t.shape.activity.activity)},t.prototype.dropChildToContainer=function(t,e){if(!(this.diagram.diagramActions&yt.PreventLaneContainerUpdate)&&(vn(this.diagram,t,e),e.hasTextAnnotation))for(var i=0;i<e.outEdges.length;i++){var r=this.diagram.nameTable[e.outEdges[parseInt(i.toString(),10)]];if(r.isBpmnAnnotationConnector){var n=this.diagram.nameTable[r.targetID];vn(this.diagram,t,n)}}},t.prototype.updateLaneChildrenZindex=function(t,e){var i=this.findLeastIndexObject(t,e),r=this.diagram.nameTable[e.parentId];if(r&&r.zIndex>i.zIndex){for(var n=this.diagram.layers.indexOf(this.diagram.getActiveLayer()),o=this.diagram.layers[parseInt(n.toString(),10)].zIndexTable,a=JSON.parse(JSON.stringify(o)),s=i.zIndex,h=r.zIndex,d=h;d>=s;d--)if(s!==d)o[d-1]?(o[parseInt(d.toString(),10)]=o[d-1],this.diagram.nameTable[o[parseInt(d.toString(),10)]].zIndex=d):(o[d-1]=o[parseInt(d.toString(),10)],this.diagram.nameTable[o[d-1]].zIndex=d,delete o[parseInt(d.toString(),10)]);else this.swapZIndexObjects(h,o,r.id,a);"SVG"===this.diagram.mode?(this.moveSvgNode(e.parentId,i.id),this.updateNativeNodeIndex(e.parentId,i.id)):this.diagram.refreshCanvasLayers()}},t.prototype.findLeastIndexConnector=function(t,e,i){for(var r=0;r<t.length;r++){var n=this.diagram.nameTable[t[parseInt(r.toString(),10)]];i.zIndex>n.zIndex&&(i=n)}return i},t.prototype.findLeastIndexObject=function(t,e){var i=t;return t instanceof Yh&&(i=this.findLeastIndexConnector(t.inEdges,e,i),i=this.findLeastIndexConnector(t.outEdges,e,i)),i},t.prototype.checkSelection=function(t,e){var i;if(1===t.nodes.length&&0===t.connectors.length)if(un(this.diagram,t.nodes[0],!0)){i="SwimLane"===t.nodes[0].shape?t.nodes[0]:this.diagram.nameTable[t.nodes[0].parentId];var r=t.nodes[0];if("SwimLane"===i.shape.type){var n="Horizontal"===i.shape.orientation;(r.isPhase&&(n&&"ResizeSouth"===e||!n&&"ResizeEast"===e)||r.isLane&&(n&&"ResizeEast"===e||!n&&"ResizeSouth"===e))&&Zr(this.diagram,i,e)}else if("Grid"===i.container.type)if("Horizontal"===i.container.orientation&&1===r.rowIndex||"Vertical"===i.container.orientation&&r.rowIndex>0&&r.columnIndex>0){if("ResizeSouth"===e)for(var o=0;o<this.diagram.nodes.length;o++){if((a=this.diagram.nodes[parseInt(o.toString(),10)]).rowIndex===i.rows.length-1&&0===a.columnIndex){this.select(a);break}}}else if("ResizeEast"===e)for(o=0;o<this.diagram.nodes.length;o++){var a;if(1===(a=this.diagram.nodes[parseInt(o.toString(),10)]).rowIndex&&a.columnIndex===i.columns.length-1){this.select(a);break}}}else Zr(this.diagram,t.nodes[0],e)},t.prototype.zoom=function(t,e,i,r){this.diagram.scroller.zoom(t,e*this.diagram.scroller.currentZoom,i*this.diagram.scroller.currentZoom,r)},t}(),fl=function(){function t(t){this.transform={tx:0,ty:0,scale:1},this.oldCollectionObjects=[],this.removeCollection=[],this.vPortWidth=0,this.vPortHeight=0,this.currentZoomFActor=1,this.hOffset=0,this.vOffset=0,this.scrolled=!1,this.hScrollSize=0,this.vScrollSize=0,this.diagram=t,this.objects=[],this.transform=t.scroller?t.scroller.transform:{tx:0,ty:0,scale:1},this.vPortWidth=t.scrollSettings.viewPortWidth,this.vPortHeight=t.scrollSettings.viewPortHeight,this.currentZoomFActor=t.scrollSettings.currentZoom,this.hOffset=t.scrollSettings.horizontalOffset,this.vOffset=t.scrollSettings.verticalOffset}return Object.defineProperty(t.prototype,"viewPortHeight",{get:function(){return this.vPortHeight},set:function(t){this.vPortHeight=t,this.diagram.scrollSettings.viewPortHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentZoom",{get:function(){return this.currentZoomFActor||1},set:function(t){this.currentZoomFActor=t,this.diagram.scrollSettings.currentZoom=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewPortWidth",{get:function(){return this.vPortWidth},set:function(t){this.vPortWidth=t,this.diagram.scrollSettings.viewPortWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"horizontalOffset",{get:function(){return this.hOffset},set:function(t){this.hOffset=t,Math.abs(this.hOffset-this.diagram.scrollSettings.horizontalOffset)>1&&(this.diagram.realActions=this.diagram.realActions|bt.hScrollbarMoved,this.scrolled=!0),this.diagram.scrollSettings.horizontalOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"verticalOffset",{get:function(){return this.vOffset},set:function(t){this.vOffset=t,Math.abs(this.vOffset-this.diagram.scrollSettings.verticalOffset)>1&&(this.diagram.realActions=this.diagram.realActions|bt.vScrollbarMoved,this.scrolled=!0),this.diagram.scrollSettings.verticalOffset=t},enumerable:!0,configurable:!0}),t.prototype.getBounds=function(){var t=this.diagram.spatialSearch.getPageBounds(0,0);return(t.x<0||t.y<0)&&!this.diagram.pageSettings.multiplePage?this.getPageBounds(void 0,void 0,!0,!0):this.getPageBounds(void 0,void 0,!0)},t.prototype.updateScrollOffsets=function(t,e){var i,r,n=this.getBounds();n.x*=this.currentZoom,n.y*=this.currentZoom,n.width*=this.currentZoom,n.height*=this.currentZoom,i=Math.max(0,t-n.left),r=Math.max(0,e-n.top),void 0!==t&&void 0!==e?(this.horizontalOffset=i,this.verticalOffset=r,this.diagram.setOffset(i,r)):this.diagram.setOffset(-this.horizontalOffset-n.x,-this.verticalOffset-n.y),this.transform={tx:Math.max(this.horizontalOffset,-n.left)/this.currentZoom,ty:Math.max(this.verticalOffset,-n.top)/this.currentZoom,scale:this.currentZoom}},t.prototype.setScrollOffset=function(t,e){this.scrolled=!1;var i=this.getBounds();i.x*=this.currentZoom,i.y*=this.currentZoom,i.width*=this.currentZoom,i.height*=this.currentZoom;var r=-i.left,n=-i.top,o=r-t;o!==this.horizontalOffset&&(r<this.horizontalOffset&&this.horizontalOffset>o?this.horizontalOffset-=t:this.horizontalOffset=o);var a=n-e;a!==this.verticalOffset&&(n<this.verticalOffset&&this.verticalOffset>a?this.verticalOffset-=e:this.verticalOffset=a),this.transform={tx:Math.max(this.horizontalOffset,-i.left)/this.currentZoom,ty:Math.max(this.verticalOffset,-i.top)/this.currentZoom,scale:this.currentZoom},this.setSize()},t.prototype.getObjects=function(t,e){for(var i=[],r=new Set(e),n=0;n<t.length;n++)r.has(t[parseInt(n.toString(),10)])||i.push(t[parseInt(n.toString(),10)]);return i},t.prototype.virtualizeElements=function(){for(var t,e=this.viewPortWidth/this.currentZoom,i=this.viewPortHeight/this.currentZoom,r=this.diagram.spatialSearch.findObjects(new w(-this.horizontalOffset/this.currentZoom,-this.verticalOffset/this.currentZoom,e,i)),n=[],o=0;o<r.length;o++){var a=r[parseInt(o.toString(),10)].shape;if("Bpmn"===a.type&&a&&a.activity&&a.activity.subProcess&&a.activity.subProcess.processes&&a.activity.subProcess.processes.length>0){for(var s=0;s<a.activity.subProcess.processes.length;s++)n.push(a.activity.subProcess.processes[parseInt(s.toString(),10)]);n.push(r[parseInt(o.toString(),10)].id)}else""!==r[parseInt(o.toString(),10)].processId&&void 0!==r[parseInt(o.toString(),10)].processId||n.push(r[parseInt(o.toString(),10)].id)}t=n;var h=[];for(o=0;o<r.length;o++){var d=r[parseInt(o.toString(),10)].shape;if("Bpmn"===d.type&&d&&d.activity&&d.activity.subProcess&&d.activity.subProcess.processes&&d.activity.subProcess.processes.length>0){h.push(r[parseInt(o.toString(),10)].id);for(var l=0;l<d.activity.subProcess.processes.length;l++)h.push(d.activity.subProcess.processes[parseInt(l.toString(),10)])}else""!==r[parseInt(o.toString(),10)].processId&&void 0!==r[parseInt(o.toString(),10)].processId||h.push(r[parseInt(o.toString(),10)].id)}var c={};for(s=0;s<h.length;s++)c[h[parseInt(s.toString(),10)]]=s;this.diagram.protectPropertyChange(!0);for(o=0;o<r.length;o++){var p=r[parseInt(o.toString(),10)].id;p in c&&(r[parseInt(o.toString(),10)].zIndex=c[""+p])}this.diagram.protectPropertyChange(!1);var g=this.getObjects(t,this.oldCollectionObjects);0===this.oldCollectionObjects.length&&(this.oldCollectionObjects=t);var u=this.getObjects(this.oldCollectionObjects,t);this.diagram.updateVirtualObjects(g,!1,u),this.oldCollectionObjects=t},t.prototype.setSize=function(t){var e=this.getPageBounds(void 0,void 0,!0);e.x*=this.currentZoom,e.y*=this.currentZoom,e.width*=this.currentZoom,e.height*=this.currentZoom;var i=Math.min(e.x,-this.horizontalOffset),r=Math.min(e.y,-this.verticalOffset),n=(this.horizontalOffset,this.viewPortWidth,e.right,this.verticalOffset,this.viewPortHeight,e.bottom,this.scrollerWidth),o=this.scrollerWidth;-this.verticalOffset<=e.y&&-this.verticalOffset+this.viewPortHeight>=e.bottom&&(o=0),-this.horizontalOffset<=e.x&&-this.horizontalOffset+this.viewPortWidth>=e.right&&(n=0),this.hScrollSize=n,this.vScrollSize=o;var a=this.diagramWidth,s=this.diagramHeight;this.diagramWidth=Math.max(e.right,-this.horizontalOffset+this.viewPortWidth-o)-i,this.diagramHeight=Math.max(e.bottom,-this.verticalOffset+this.viewPortHeight-n)-r,a===this.diagramWidth&&s===this.diagramHeight||"Diagram"===this.diagram.scrollSettings.scrollLimit||this.diagram.setSize(this.diagramWidth,this.diagramHeight);var h=e.height>this.viewPortHeight||e.width>this.viewPortWidth;"Diagram"===this.diagram.scrollSettings.scrollLimit&&(a===this.diagramWidth&&s===this.diagramHeight&&1===this.currentZoom||this.diagram.diagramActions&&t&&(!this.diagram.diagramActions||!t||0===this.verticalOffset&&this.verticalOffset!==t.y||0===this.horizontalOffset&&this.horizontalOffset!==t.x)?t&&a===this.diagramWidth&&s===this.diagramHeight&&(this.diagram.diagramCanvas.scrollHeight>this.viewPortHeight&&t.y<0&&this.horizontalOffset===t.x&&0===this.verticalOffset||this.diagram.diagramCanvas.scrollWidth>this.viewPortWidth&&t.x<0&&this.verticalOffset===t.y&&0===this.horizontalOffset)&&(this.verticalOffset=t.y,this.horizontalOffset=t.x,this.transform={tx:Math.max(t.x,-e.left)/this.currentZoom,ty:Math.max(t.y,-e.top)/this.currentZoom,scale:this.currentZoom}):(this.diagram.scrollActions&St.Interaction&&t&&h&&(this.transform={tx:Math.max(t.x,-e.left/this.currentZoom)/this.currentZoom,ty:Math.max(t.y,-e.top/this.currentZoom)/this.currentZoom,scale:this.currentZoom},this.horizontalOffset=t.x,this.verticalOffset=t.y),this.diagram.setSize(this.diagramWidth,this.diagramHeight),this.diagram.scrollActions&St.PropertyChange||!t||h&&(this.horizontalOffset=t.x,this.verticalOffset=t.y,this.transform={tx:Math.max(t.x,-e.left)/this.currentZoom,ty:Math.max(t.y,-e.top)/this.currentZoom,scale:this.currentZoom}))),this.diagram.transformLayers(),this.diagram.element.style.overflow="hidden"},t.prototype.setViewPortSize=function(t,e){this.viewPortWidth=t,this.viewPortHeight=e},t.prototype.getPageBounds=function(t,e,i,r){var n,o=new w;if("Content"===e||r||null===this.diagram.pageSettings.width||null===this.diagram.pageSettings.height){var a=t?void 0:0;n=this.diagram.spatialSearch.getPageBounds(a,a)}else{var s=this.diagram.pageSettings.width,h=this.diagram.pageSettings.height,d=0,l=0;if(this.diagram.pageSettings.multiplePage){if((o=this.diagram.spatialSearch.getPageBounds(0,0)).right>s)s*=c=Math.ceil(o.right/s);if(o.bottom>h)h*=c=Math.ceil(o.bottom/h);if(o.left<0&&Math.abs(o.left)>d){var c=Math.ceil(Math.abs(o.left)/this.diagram.pageSettings.width);d=this.diagram.pageSettings.width*c}if(o.top<0&&Math.abs(o.top)>l){c=Math.ceil(Math.abs(o.top)/this.diagram.pageSettings.height);l=this.diagram.pageSettings.height*c}}n=new w(-d,-l,s+d,h+l)}if(i){var p=this.diagram.scrollSettings.padding;n.x-=p.left,n.y-=p.top,n.width+=p.left+p.right,n.height+=p.top+p.bottom}return n},t.prototype.getPageBreak=function(t){for(var e=0,i=0,r=-1,n=[],o=0,a=0,s=0,h=0,d=this.diagram.pageSettings.margin.left,l=this.diagram.pageSettings.margin.right,c=this.diagram.pageSettings.margin.top,p=this.diagram.pageSettings.margin.bottom,g=1,u=1,f={x1:o,y1:s,x2:a,y2:h};t.width>e;)(e+=this.diagram.pageSettings.width?this.diagram.pageSettings.width:t.width)===this.diagram.pageSettings.width&&(f={x1:t.left+d,y1:t.top+c,x2:t.left+d,y2:t.bottom-p},n[++r]=f),e<t.width&&(f={x1:o=t.topLeft.x+this.diagram.pageSettings.width*g,y1:s=t.topLeft.y+c,x2:a=t.bottomLeft.x+this.diagram.pageSettings.width*g,y2:h=t.bottomLeft.y-p},n[++r]=f,g++),t.width===e&&(f={x1:t.right-l,y1:t.top+c,x2:t.right-l,y2:t.bottom-p},n[++r]=f);for(;t.height>i;)(i+=this.diagram.pageSettings.height?this.diagram.pageSettings.height:t.height)===this.diagram.pageSettings.height&&(f={x1:t.left+d,y1:t.top+c,x2:t.right-l,y2:t.top+c},n[++r]=f),i<t.height&&(f={x1:o=t.topLeft.x+d,y1:s=t.topLeft.y+this.diagram.pageSettings.height*u,x2:a=t.topRight.x-l,y2:h=t.topRight.y+this.diagram.pageSettings.height*u},n[++r]=f,u++),t.height===i&&(f={x1:t.left+d,y1:t.bottom-p,x2:t.right-l,y2:t.bottom-p},n[++r]=f);return n},t.prototype.zoom=function(t,e,i,r,n,o,a,s){if(this.diagram.constraints&ct.Zoom&&1!==t||function(t){return t.constraints&ct.Pan}(this.diagram)&&1===t){var h=I();if(A(h,this.currentZoom,this.currentZoom),O(h,this.horizontalOffset,this.verticalOffset),r=P(h,r=r||{x:(this.viewPortWidth/2-this.horizontalOffset)/this.currentZoom,y:(this.viewPortHeight/2-this.verticalOffset)/this.currentZoom}),this.currentZoom*t<=this.diagram.scrollSettings.maxZoom&&(this.currentZoom*t>=this.diagram.scrollSettings.minZoom||s||t>=1)){this.currentZoom*=t;var d=this.getPageBounds(void 0,void 0,!0);d.x*=this.currentZoom,d.y*=this.currentZoom;var l=I();A(l,t,t,r.x,r.y),O(l,e||0,i||0),D(h,l);var c=P(h,{x:0,y:0});if(1===t&&(c=this.applyScrollLimit(c.x,c.y,n,o,a)),a=-d.y>=c.y&&-d.x>=c.x&&a,(this.diagram.scrollActions&St.PropertyChange||!(this.diagram.scrollActions&St.Interaction)||"Diagram"!==this.diagram.scrollSettings.scrollLimit||a)&&(this.transform={tx:Math.max(c.x,-d.left)/this.currentZoom,ty:Math.max(c.y,-d.top)/this.currentZoom,scale:this.currentZoom},this.horizontalOffset=c.x,this.verticalOffset=c.y),this.setSize(c),"SVG"!==this.diagram.mode&&ir(this.diagram)&&this.diagram.scroller.virtualizeElements(),"SVG"===this.diagram.mode||ir(this.diagram)||this.diagram.refreshDiagramLayer(),this.diagram.setOffset(-this.horizontalOffset-d.x,-this.verticalOffset-d.y),Mo(this.diagram),this.diagram.views&&this.diagram.views.overview){var p=this.diagram.views.overview,g=p.scrollOverviewRect(p.parent.scroller.horizontalOffset,p.parent.scroller.verticalOffset,p.parent.scroller.currentZoom,!0);p.updateOverviewrect(-g.x,-g.y,g.width,g.height),p.updateView(p)}}}},t.prototype.fitToPage=function(t){var e=(t=t||{}).mode,i=t.region,r=t.margin||{},n=t.canZoomIn,o=t.customBounds,a=t.canZoomOut;r.bottom=r.bottom||25,r.top=r.top||25,r.left=r.left||25,r.right=r.right||25;var s,h=o,d=-this.horizontalOffset,l=-this.verticalOffset;if("PageSettings"===(i=i||"PageSettings")&&this.diagram.pageSettings.width&&this.diagram.pageSettings.height||this.diagram.nodes.length>0||this.diagram.connectors.length>0){e=e||"Page","CustomBounds"!==i&&(h=this.getPageBounds(!0,i,!0));var c={x:0,y:0};r.left+r.right>this.viewPortWidth&&(this.viewPortWidth<=100?(r.left=5,r.right=5):(r.left=25,r.right=25)),r.top+r.bottom>this.viewPortHeight&&(this.viewPortHeight<=100?(r.top=5,r.bottom=5):(r.top=25,r.bottom=25)),c.x=(this.viewPortWidth-(r.left+r.right))/h.width,c.y=(this.viewPortHeight-(r.top+r.bottom))/h.height,!n&&h.width-this.horizontalOffset<this.viewPortWidth&&h.height-this.verticalOffset<this.viewPortHeight&&(c.x=Math.min(this.currentZoom,c.x),c.y=Math.min(this.currentZoom,c.y));var p=void 0,g=void 0,u=void 0;switch(e){case"Width":s=(p=c.x)/this.currentZoom,d+=(g=(this.viewPortWidth-h.width*p)/2-h.x*p)+(r.left-r.right)/2*p,l-=-this.verticalOffset*s,l="CustomBounds"!==i?l:l-this.verticalOffset*s;break;case"Height":s=(p=c.y)/this.currentZoom,g=(this.viewPortWidth-h.width*p)/2-h.x*p,u=(this.viewPortHeight-h.height*p)/2-h.y*p,d+=g+(r.left-r.right)/2*p,l+=u+(r.top-r.bottom)/2*p;break;case"Page":s=(p=Math.min(c.x,c.y))/this.currentZoom,g=(this.viewPortWidth-h.width*p)/2-h.x*p,u=(this.viewPortHeight-h.height*p)/2-h.y*p,d+=g+(r.left-r.right)/2*p,l+=u+(r.top-r.bottom)/2*p}this.zoom(s,d,l,{x:0,y:0},!0,void 0,void 0,a)}else s=1/this.currentZoom,this.zoom(s,d,l,{x:0,y:0},!0,void 0,void 0,a)},t.prototype.bringIntoView=function(t,e){var i=0,r=0,n=this.currentZoom,o=t,a=-this.horizontalOffset,s=-this.verticalOffset;o=new w(o.x*n,o.y*n,o.width*n,o.height*n);new w(a,s,this.viewPortWidth,this.viewPortHeight).containsRect(o)||(o.right>-a+this.viewPortWidth&&(i=o.right-this.viewPortWidth,i+=20),o.x<-a&&(i=o.x),o.bottom>-s+this.viewPortHeight&&(r=o.bottom-this.viewPortHeight,r+=20),o.y<-s&&(r=o.y),this.zoom(1,-this.horizontalOffset-i,-this.verticalOffset-r,null,void 0,e))},t.prototype.bringToCenter=function(t){var e=this.currentZoom,i=new w(t.x*e,t.y*e,t.width*e,t.height*e),r=i.x+i.width/2-this.viewPortWidth/2,n=i.y+i.height/2-this.viewPortHeight/2;r*=-1,n*=-1,this.zoom(1,-this.horizontalOffset-r,-this.verticalOffset-n,null)},t.prototype.applyScrollLimit=function(t,e,i,r,n){if("Infinity"===this.diagram.scrollSettings.scrollLimit&&(void 0!==i||r||(t=-t,e=-e)),"Infinity"!==this.diagram.scrollSettings.scrollLimit){var o=void 0;if("Limited"===this.diagram.scrollSettings.scrollLimit){var a=this.diagram.scrollSettings.scrollableArea;o=new w(a.x,a.y,a.width,a.height)}o=o||(n?this.getPageBounds(!1,void 0,!0):this.getPageBounds(!0,void 0,!0));var s="eventHandler";"Pan"===this.diagram[""+s].currentAction&&this.diagram[""+s].inAction&&(o=this.getPageBounds(!1,void 0,!0)),o.x*=this.currentZoom,o.y*=this.currentZoom,o.width*=this.currentZoom,o.height*=this.currentZoom,void 0!==i&&(t*=-1,e*=-1),r&&(t*=-1,e*=-1);var h=Math.max(o.right,this.viewPortWidth);if(!r&&!(t<=o.x&&(t+this.viewPortWidth>=o.right||t>=o.right-this.viewPortWidth)||t>=o.x&&t+this.viewPortWidth<=h))if(t>=o.x)t=Math.max(o.x,Math.min(t,t-(t+this.viewPortWidth-this.vScrollSize-h)));else{var d=o.right-this.viewPortWidth;t=Math.min(d,o.x)}var l=Math.max(o.bottom,this.viewPortHeight);if(!r&&!(e<=o.y&&e+this.viewPortHeight>=o.bottom||e>=o.y&&e+this.viewPortHeight<=l))if(e>=o.y)e=Math.max(o.y,Math.min(e,e-(e+this.viewPortHeight-this.hScrollSize-l)));else{d=o.bottom-this.viewPortHeight;e=Math.min(o.y,d)}t*=-1,e*=-1}return{x:t,y:e}},t}(),ml=function(){function t(t,e,i,r,n){this.objects=[],this.left=t,this.top=e,this.width=i,this.height=r,this.spatialSearch=n}return t.prototype.findQuads=function(t,e){null!=this.first&&this.first.isIntersect(t)&&this.first.findQuads(t,e),null!=this.second&&this.second.isIntersect(t)&&this.second.findQuads(t,e),null!=this.third&&this.third.isIntersect(t)&&this.third.findQuads(t,e),null!=this.fourth&&this.fourth.isIntersect(t)&&this.fourth.findQuads(t,e),this.objects.length>0&&e.push(this)},t.prototype.isIntersect=function(t){return!(this.left+this.width<t.left||this.top+this.height<t.top||this.left>t.right||this.top>t.bottom)},t.prototype.selectQuad=function(){for(var t,e=null,i=this;null!=i;)t=i.getQuad(e),i=t.source,e=t.target||e;return e},t.prototype.getQuad=function(e){var i=this.width/2,r=this.height/2;if(i>=1e3&&r>=1e3){var n=this.left+i,o=this.top+r;if(this.spatialSearch.childRight<=n){if(this.spatialSearch.childBottom<=o){if(!this.first)(a=new t(this.left,this.top,i,r,this.spatialSearch)).parent=this,this.first=a;return{source:this.first}}if(this.spatialSearch.childTop>=o){if(!this.third)(a=new t(this.left,o,i,r,this.spatialSearch)).parent=this,this.third=a;return{source:this.third}}}else if(this.spatialSearch.childLeft>=n){if(this.spatialSearch.childBottom<=o){if(!this.second)(a=new t(n,this.top,i,r,this.spatialSearch)).parent=this,this.second=a;return{source:this.second}}if(this.spatialSearch.childTop>=o){var a;if(!this.fourth)(a=new t(n,o,i,r,this.spatialSearch)).parent=this,this.fourth=a;return{source:this.fourth}}}}return this.objects.push(this.spatialSearch.childNode),{target:this}},t.prototype.isContained=function(){return this.spatialSearch.childLeft>=this.left&&this.spatialSearch.childRight<=this.left+this.width&&this.spatialSearch.childTop>=this.top&&this.spatialSearch.childBottom<=this.top+this.height},t.prototype.addIntoAQuad=function(t){var e={};this.spatialSearch.setCurrentNode(t);for(var i=null;!e.isAdded;)i=(e=this.spatialSearch.parentQuad.add(i)).quad;return i},t.prototype.add=function(e){if(e=null,this.isContained())return{isAdded:!0,quad:e=this.selectQuad()};var i=void 0,r=!(0!==this.objects.length||this.first||this.second||this.third||this.fourth),n=2*this.width,o=2*this.height;return this.spatialSearch.childLeft<this.left?this.spatialSearch.childTop<this.top?(i=new t(this.left-this.width,this.top-this.height,n,o,this.spatialSearch),r||(i.fourth=this)):(i=new t(this.left-this.width,this.top,n,o,this.spatialSearch),r||(i.second=this)):this.spatialSearch.childTop<this.top?(i=new t(this.left,this.top-this.height,n,o,this.spatialSearch),r||(i.third=this)):(i=new t(this.left,this.top,n,o,this.spatialSearch),r||(i.first=this)),this.parent=i,this.spatialSearch.parentQuad=i,{isAdded:!1,quad:e}},t}(),yl=function(){function t(t){this.quadSize=500,this.objectTable=t,this.parentQuad=new ml(0,0,2*this.quadSize,2*this.quadSize,this),this.pageLeft=Number.MAX_VALUE,this.pageRight=-Number.MAX_VALUE,this.pageTop=Number.MAX_VALUE,this.pageBottom=-Number.MAX_VALUE,this.quadTable={}}return t.prototype.removeFromAQuad=function(t){if(this.quadTable[t.id]){var e=this.quadTable[t.id],i=this.objectIndex(e.objects,t);-1!==i&&(e.objects.splice(i,1),this.update(e),delete this.quadTable[t.id])}},t.prototype.update=function(t){if(t.parent&&0===t.objects.length&&null==t.first&&null==t.second&&null==t.third&&null==t.fourth){var e=t.parent;e.first===t?e.first=null:e.second===t?e.second=null:e.third===t?e.third=null:e.fourth===t&&(e.fourth=null),this.update(t.parent)}else t!==this.parentQuad||t.first||t.second||t.third||t.fourth||(t.left=0,t.width=1e3,t.top=0,t.height=1e3)},t.prototype.addIntoAQuad=function(t){var e=this.parentQuad.addIntoAQuad(t);this.quadTable[t.id]=e},t.prototype.objectIndex=function(t,e){for(var i=0;i<t.length;i++)if(t[parseInt(i.toString(),10)].id===e.id)return i;return-1},t.prototype.updateQuad=function(t){this.setCurrentNode(t);var e=t.outerBounds;if(isNaN(e.x)||isNaN(e.y)||isNaN(e.width)||isNaN(e.height))return!1;this.quadTable[t.id]?this.quadTable[t.id].isContained()||(this.removeFromAQuad(t),this.addIntoAQuad(t)):this.addIntoAQuad(t);if(!this.isWithinPageBounds(e)||this.leftElement===t||this.topElement===t||this.rightElement===t||this.bottomElement===t){var i=!1;return this.pageLeft===this.childLeft&&t===this.leftElement||(this.pageLeft>=this.childLeft?(this.pageLeft=this.childLeft,this.leftElement=t,i=!0):t===this.leftElement&&(this.pageLeft=Number.MAX_VALUE,this.findLeft(this.parentQuad),i=!0)),this.pageTop===this.childTop&&t===this.topElement||(this.pageTop>=this.childTop?(this.pageTop=this.childTop,this.topElement=t,i=!0):t===this.topElement&&(this.pageTop=Number.MAX_VALUE,this.findTop(this.parentQuad),i=!0)),this.pageBottom===this.childBottom&&t===this.bottomElement||(this.pageBottom<=this.childBottom?(i=!0,this.pageBottom=this.childBottom,this.bottomElement=t):t===this.bottomElement&&(this.pageBottom=-Number.MAX_VALUE,this.findBottom(this.parentQuad),i=!0)),this.pageRight===this.childRight&&t===this.rightElement||(this.pageRight<=this.childRight?(this.pageRight=this.childRight,this.rightElement=t,i=!0):t===this.rightElement&&(this.pageRight=-Number.MAX_VALUE,this.findRight(this.parentQuad),i=!0)),i}return this.setCurrentNode(null),!1},t.prototype.isWithinPageBounds=function(t){return t.left>=this.pageLeft&&t.right<=this.pageRight&&t.top>=this.pageTop&&t.bottom<=this.pageBottom},t.prototype.findQuads=function(t){var e=[];return this.parentQuad.findQuads(t,e),e},t.prototype.findObjects=function(t){for(var e=[],i=0,r=this.findQuads(t);i<r.length;i++)for(var n=0,o=r[i].objects;n<o.length;n++){var a=o[n];(a.outerBounds.intersects(t)||Ws(a))&&e.push(this.objectTable[a.id])}return e},t.prototype.updateBounds=function(t,e){var i=!1;return e?(this.topElement&&t.id===this.topElement.id&&(i=this.updateTop()),this.leftElement&&t.id===this.leftElement.id&&(i=this.updateLeft()),this.rightElement&&t.id===this.rightElement.id&&(i=this.updateRight()),this.bottomElement&&t.id===this.bottomElement.id&&(i=this.updateBottom())):(t===this.topElement&&(i=this.updateTop()),t===this.leftElement&&(i=this.updateLeft()),t===this.rightElement&&(i=this.updateRight()),t===this.bottomElement&&(i=this.updateBottom())),i},t.prototype.updateTop=function(){return this.pageTop=Number.MAX_VALUE,this.topElement=null,this.findTop(this.parentQuad),!0},t.prototype.updateBottom=function(){return this.pageBottom=-Number.MAX_VALUE,this.bottomElement=null,this.findBottom(this.parentQuad),!0},t.prototype.updateLeft=function(){return this.pageLeft=Number.MAX_VALUE,this.leftElement=null,this.findLeft(this.parentQuad),!0},t.prototype.updateRight=function(){return this.pageRight=-Number.MAX_VALUE,this.rightElement=null,this.findRight(this.parentQuad),!0},t.prototype.findBottom=function(t){t.third||t.fourth?(t.third&&this.findBottom(t.third),t.fourth&&this.findBottom(t.fourth)):(t.second&&this.findBottom(t.second),t.first&&this.findBottom(t.first));for(var e=0,i=t.objects;e<i.length;e++){var r=i[e];this.pageBottom<=r.outerBounds.bottom&&(this.pageBottom=r.outerBounds.bottom,this.bottomElement=r)}},t.prototype.findRight=function(t){(t.second||t.fourth)&&(t.second&&this.findRight(t.second),t.fourth&&this.findRight(t.fourth)),t.first&&this.findRight(t.first),t.third&&this.findRight(t.third);for(var e=0,i=t.objects;e<i.length;e++){var r=i[e];this.pageRight<=r.outerBounds.right&&(this.pageRight=r.outerBounds.right,this.rightElement=r)}},t.prototype.findLeft=function(t){t.first||t.third?(t.first&&this.findLeft(t.first),t.third&&this.findLeft(t.third)):(t.second&&this.findLeft(t.second),t.fourth&&this.findLeft(t.fourth));for(var e=0,i=t.objects;e<i.length;e++){var r=i[e];this.pageLeft>=r.outerBounds.left&&(this.pageLeft=r.outerBounds.left,this.leftElement=r)}},t.prototype.findTop=function(t){t.first||t.second?(t.first&&this.findTop(t.first),t.second&&this.findTop(t.second)):(t.third&&this.findTop(t.third),t.fourth&&this.findTop(t.fourth));for(var e=0,i=t.objects;e<i.length;e++){var r=i[e];this.pageTop>=r.outerBounds.top&&(this.pageTop=r.outerBounds.top,this.topElement=r)}},t.prototype.setCurrentNode=function(t){if(this.childNode=t,t){var e=t.outerBounds;this.childLeft=Number(e.left),this.childTop=Number(e.top),this.childRight=Number(e.right),this.childBottom=Number(e.bottom)}else this.childLeft=Number.MAX_VALUE,this.childTop=Number.MAX_VALUE,this.childRight=-Number.MAX_VALUE,this.childBottom=-Number.MAX_VALUE},t.prototype.getPageBounds=function(t,e){if(this.pageLeft===Number.MAX_VALUE)return new w(0,0,0,0);var i=void 0!==t?Math.min(this.pageLeft,0):this.pageLeft,r=void 0!==e?Math.min(this.pageTop,0):this.pageTop;return new w(Math.round(i),Math.round(r),Math.round(this.pageRight-i),Math.round(this.pageBottom-r))},t.prototype.getQuad=function(t){return this.quadTable[t.id]},t}(),vl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),bl=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Sl=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return vl(i,t),bl([(0,e.Property)(!1)],i.prototype,"preventDefaults",void 0),i}(e.ChildProperty),wl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xl=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Il=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return wl(i,t),xl([(0,e.Property)("")],i.prototype,"action",void 0),xl([(0,e.Property)("")],i.prototype,"cursor",void 0),i}(e.ChildProperty),Pl=function(){function t(){this.size=20,this.intermediatePoints=[],this.gridCollection=[],this.startArray=[],this.targetGridCollection=[],this.sourceGridCollection=[],this.considerWalkable=[],this.skipObstacleCheck=!1,this.nonWalkableGrids=[]}return t.prototype.lineRouting=function(t){var e=t.connectors.length;if(this.renderVirtualRegion(t),e>0)for(var i=0;i<e;i++){var r=t.connectors[parseInt(i.toString(),10)];"Orthogonal"===r.type&&r.visible&&this.refreshConnectorSegments(t,r,!0)}},t.prototype.renderVirtualRegion=function(t,e){var i=this.size;(t.spatialSearch.pageTop<0||t.spatialSearch.pageLeft<0)&&(i=this.size+this.size/2);var r=t.spatialSearch.pageRight+i,n=t.spatialSearch.pageBottom+i,o=t.spatialSearch.pageLeft-i,a=t.spatialSearch.pageTop-i;if(o=o<0?o-20:0,a=a<0?a-20:0,e&&(this.width!==r-o||this.height!==n-a||this.diagramStartX!==o||this.diagramStartY!==a)||void 0===e){this.width=r-o,this.height=n-a,this.diagramStartX=o,this.diagramStartY=a,this.gridCollection=[],this.noOfRows=this.width/this.size,this.noOfCols=this.height/this.size;for(var s=this.size,h=this.diagramStartX<0?this.diagramStartX:0,d=this.diagramStartY<0?this.diagramStartY:0,l=0;l<this.noOfCols;l++){for(var c=0;c<this.noOfRows;c++){0===l&&this.gridCollection.push([0]);var p={x:h,y:d,width:s,height:s,gridX:c,gridY:l,walkable:!0,tested:void 0,nodeId:[]};this.gridCollection[parseInt(c.toString(),10)][parseInt(l.toString(),10)]=p,h+=s}h=this.diagramStartX<0?this.diagramStartX:0,d+=s}0!==this.nonWalkableGrids.length&&(this.nonWalkableGrids.length=0)}var g=this.findNodes(t.nodes);this.updateNodesInVirtualRegion(g)},t.prototype.findNodes=function(t){for(var e,i=[],r=0;r<t.length;r++)"SwimLane"===(e=t[parseInt(r.toString(),10)]).shape.type||e.isLane||e.isPhase||e.isHeader||!e.visible||i.push(e);return i},t.prototype.updateNodesInVirtualRegion=function(t){for(var e=this.size,i=0,r=this.nonWalkableGrids;i<r.length;i++){(d=r[i]).walkable=!0,d.tested=void 0,d.nodeId=[],d.parentNodeId=""}0!==this.nonWalkableGrids.length&&(this.nonWalkableGrids.length=0);for(var n=0;n<t.length;n++){var o=t[parseInt(n.toString(),10)],a=o.wrapper.bounds;if(a)for(var s=0,h=this.getGridsIntersectBounds(a);s<h.length;s++){var d=h[s],l=new w(d.x,d.y,e,e);this.intersectRect(l,a)&&(d.nodeId.push(o.id),d.walkable=!1,this.nonWalkableGrids.push(d),""!==o.parentId&&(d.parentNodeId=o.parentId))}}},t.prototype.getGridsIntersectBounds=function(t){for(var e=[],i=t.topLeft.x,r=t.bottomRight.x,n=t.topLeft.y,o=t.bottomRight.y,a=this.size,s=Math.floor((i-this.diagramStartX)/a),h=Math.floor((n-this.diagramStartY)/a),d=Math.floor((r-this.diagramStartX)/a),l=Math.floor((o-this.diagramStartY)/a),c=s;c<=d;c++)for(var p=h;p<=l;p++){var g=this.gridCollection[parseInt(c.toString(),10)];if(g){var u=g[parseInt(p.toString(),10)];u&&-1===e.indexOf(u)&&e.push(u)}}return e},t.prototype.intersectRect=function(t,e){return!(e.left>=t.right||e.right<=t.left||e.top>=t.bottom||e.bottom<=t.top)},t.prototype.findEndPoint=function(t,e,i){var r,n;if(e&&""!==t.sourcePortID&&t.sourcePortWrapper||!e&&""!==t.targetPortID&&t.targetPortWrapper){n=Pi(r=e?{x:t.sourcePortWrapper.offsetX,y:t.sourcePortWrapper.offsetY}:{x:t.targetPortWrapper.offsetX,y:t.targetPortWrapper.offsetY},void 0,e?t.sourceWrapper.bounds:t.targetWrapper.bounds);var o=e?t.sourcePortWrapper.bounds:t.targetPortWrapper.bounds;r=i?"Top"===n?{x:o.topCenter.x,y:o.topCenter.y}:"Left"===n?{x:o.middleLeft.x,y:o.middleLeft.y}:"Right"===n?{x:o.middleRight.x,y:o.middleRight.y}:{x:o.bottomCenter.x,y:o.bottomCenter.y}:{x:o.center.x,y:o.center.y}}else r=e&&this.startNode||!e&&this.targetNode?e?{x:this.startNode.wrapper.offsetX,y:this.startNode.wrapper.offsetY}:{x:this.targetNode.wrapper.offsetX,y:this.targetNode.wrapper.offsetY}:e?{x:t.sourcePoint.x,y:t.sourcePoint.y}:{x:t.targetPoint.x,y:t.targetPoint.y};return r},t.prototype.getGridsIntersect=function(t,e){var i=[],r=Math.min(t.x,e.x),n=Math.min(t.y,e.y),o=Math.max(t.x,e.x),a=Math.max(t.y,e.y),s=this.size,h=Math.floor((r-this.diagramStartX)/s),d=Math.floor((n-this.diagramStartY)/s),l=Math.floor((o-this.diagramStartX)/s),c=Math.floor((a-this.diagramStartY)/s);if(o-r>a-n)for(var p=h;p<=l;p++){if(u=this.gridCollection[parseInt(p.toString(),10)])(f=u[parseInt(d.toString(),10)])&&-1===i.indexOf(f)&&i.push(f)}else for(var g=d;g<=c;g++){var u,f;if(u=this.gridCollection[parseInt(h.toString(),10)])(f=u[parseInt(g.toString(),10)])&&-1===i.indexOf(f)&&i.push(f)}return i},t.prototype.isPathWalkable=function(t,e,i,r){for(var n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),a=Math.max(t.x,e.x),s=Math.max(t.y,e.y),h=this.getGridsIntersect(t,e),d=0;d<h.length;d++){var l=h[parseInt(d.toString(),10)];if((!r||-1===l.nodeId.indexOf(r.sourceID)&&-1===l.nodeId.indexOf(r.targetID))&&!l.walkable)for(var c=a-n>s-o,p=0,g=l.nodeId;p<g.length;p++){var u=g[p],f=i.nameTable[""+u];if(f){var m=f.wrapper.bounds;if(c){if(m.top-5<o&&m.bottom+5>s)return!1}else if(m.left-5<n&&m.right+5>a)return!1}}}return!0},t.prototype.checkObstaclesIntersect=function(t,e,i){for(var r=1;r<t.length;r++){var n=t[r-1],o=t[parseInt(r.toString(),10)];if(!this.isPathWalkable(n,o,i,e))return!1}return!0},t.prototype.refreshConnectorSegments=function(t,e,i,r){if(e.sourceID&&e.targetID&&e.sourceID!==e.targetID)if(!this.skipObstacleCheck&&e.segments&&e.segments.length<2&&e.intermediatePoints&&this.checkObstaclesIntersect(e.intermediatePoints,e,t))t.avoidLineOverlappingModule&&i&&(t.avoidLineOverlappingModule.addConnector(e),t.avoidLineOverlappingModule.refreshModifiedConnectors(t));else{var n,o,a,s,h,d,l,c,p,g,u,f=e.sourceID,m=e.targetID,y=e.sourcePortID,v=e.targetPortID;if(function(t,e){var i=0;return t.constraints&at.LineRouting?i=t.constraints&at.LineRouting:t.constraints&at.InheritLineRouting&&(i=e.constraints&ct.LineRouting),i}(e,t)||r){this.startNode=t.nameTable[""+f],this.targetNode=t.nameTable[""+m],this.intermediatePoints=[],this.startArray=[],this.targetGridCollection=[],this.sourceGridCollection=[],this.startGrid=void 0,this.targetGrid=void 0;for(var b=0;b<this.noOfCols;b++)for(var S=0;S<this.noOfRows;S++)this.gridCollection[parseInt(S.toString(),10)][parseInt(b.toString(),10)].tested=this.gridCollection[parseInt(S.toString(),10)][parseInt(b.toString(),10)].parent=void 0,this.gridCollection[parseInt(S.toString(),10)][parseInt(b.toString(),10)].previousDistance=this.gridCollection[parseInt(S.toString(),10)][parseInt(b.toString(),10)].afterDistance=void 0,this.gridCollection[parseInt(S.toString(),10)][parseInt(b.toString(),10)].totalDistance=void 0;n=this.findEndPoint(e,!0),o=this.findEndPoint(e,!1);for(b=0;b<this.noOfRows;b++)for(S=0;S<this.noOfCols;S++){a=this.gridCollection[parseInt(b.toString(),10)][parseInt(S.toString(),10)];var x=new w(a.x,a.y,a.width,a.height);if(!x.containsPoint(n)||this.startGrid||-1===a.nodeId.indexOf(f)&&""!==f||(this.startGrid=(y&&this.startGrid,a)),!x.containsPoint(o)||this.targetGrid||-1===a.nodeId.indexOf(m)&&""!==m||(this.targetGrid=(v&&this.targetGrid,a)),!y&&this.startNode){var I=this.startNode.wrapper.bounds;x.containsPoint(I.topCenter)&&!s&&(s=a),x.containsPoint(I.middleLeft)&&!d&&(d=a),x.containsPoint(I.middleRight)&&!l&&(l=a),x.containsPoint(I.bottomCenter)&&!h&&(h=a)}if(!v&&this.targetNode){I=this.targetNode.wrapper.bounds;x.containsPoint(I.topCenter)&&!p&&(p=a),x.containsPoint(I.middleLeft)&&!u&&(u=a),x.containsPoint(I.middleRight)&&!c&&(c=a),x.containsPoint({x:I.bottomCenter.x,y:I.bottomCenter.y})&&!g&&(g=a)}}this.findEdgeBoundary(y,d,l,s,h,!0),this.findEdgeBoundary(v,u,c,p,g,!1),this.startGrid.totalDistance=0,this.startGrid.previousDistance=0,this.intermediatePoints.push({x:this.startGrid.gridX,y:this.startGrid.gridY}),this.startArray.push(this.startGrid),e&&u&&c&&p&&g&&this.checkObstacles(e,t,u,c,p,g);t:for(;this.startArray.length>0;){var P=this.startArray.pop();if(P){for(b=0;b<this.targetGridCollection.length;b++){var C=this.targetGridCollection[parseInt(b.toString(),10)];if(P&&P.gridX===C.gridX&&P.gridY===C.gridY){if(this.getIntermediatePoints(P),this.optimizeIntermediatePoints(),P.nodeId&&P.nodeId.length>1&&(e.segments=[]),this.updateConnectorSegments(t,this.intermediatePoints,this.gridCollection,e,i)){this.considerWalkable=[];break t}this.targetGridCollection.splice(this.targetGridCollection.indexOf(C),1),P=this.startArray.pop()}}P&&this.findPath(P)}}}}},t.prototype.checkChildNodes=function(t,e){var i=!1,r=!1;if(t.nodeId.length>=1&&!e)for(var n=0;n<t.nodeId.length;n++){for(var o=t.nodeId[parseInt(n.toString(),10)],a=0;a<t.nodeId.length;a++)this.targetNode.parentId===t.nodeId[parseInt(a.toString(),10)]&&(r=!0);i=!r&&this.targetNode.id===o}else 1===t.nodeId.length&&(i=!0);return i},t.prototype.findEdgeBoundary=function(t,e,i,r,n,o){var a,s=o?this.sourceGridCollection:this.targetGridCollection;if(!t&&(o?this.startNode:this.targetNode)){for(var h=e.gridX;h<=i.gridX;h++)a=this.gridCollection[parseInt(h.toString(),10)][e.gridY],(this.checkChildNodes(a,o)&&(h===e.gridX||h===i.gridX)||h!==e.gridX&&h!==i.gridX)&&s.push(a);for(h=r.gridY;h<=n.gridY;h++)a=this.gridCollection[r.gridX][parseInt(h.toString(),10)],(this.checkChildNodes(a,o)&&(h===r.gridY||h===n.gridY)||h!==r.gridY&&h!==n.gridY)&&-1===s.indexOf(a)&&s.push(a)}else s.push(o?this.startGrid:this.targetGrid)},t.prototype.checkObstacles=function(t,e,i,r,n,o){var a,s=this.findNearestNeigbours(this.startGrid,this.gridCollection,!0);0===s.length&&(""!==t.sourcePortID?"Top"===(a=Pi({x:t.sourcePortWrapper.offsetX,y:t.sourcePortWrapper.offsetY},void 0,t.sourceWrapper.bounds))?this.resetGridColl(this.startGrid,"top",!0):"Right"===a?this.resetGridColl(this.startGrid,"right",!0):"Bottom"===a?this.resetGridColl(this.startGrid,"bottom",!0):this.resetGridColl(this.startGrid,"left",!0):(this.resetGridColl(this.startGrid,"top",!0),this.resetGridColl(this.startGrid,"right",!0),this.resetGridColl(this.startGrid,"bottom",!0),this.resetGridColl(this.startGrid,"left",!0)));0===(s=this.findNearestNeigbours(this.targetGrid,this.gridCollection,!1)).length&&(""!==t.targetPortID?"Top"===(a=Pi({x:t.targetPortWrapper.offsetX,y:t.targetPortWrapper.offsetY},void 0,t.targetWrapper.bounds))?this.resetGridColl(this.targetGrid,"top",!0):"Right"===a?this.resetGridColl(this.targetGrid,"right",!0):"Bottom"===a?this.resetGridColl(this.targetGrid,"bottom",!0):this.resetGridColl(this.targetGrid,"left",!0):(this.resetGridColl(this.targetGrid,"top",!1),this.resetGridColl(this.targetGrid,"right",!1),this.resetGridColl(this.targetGrid,"bottom",!1),this.resetGridColl(this.targetGrid,"left",!1)));if(this.targetGridCollection.length>1&&this.targetGridCollection[0].nodeId.length>1)for(var h=0;h<=1;h++){for(var d=this.targetGridCollection[parseInt(h.toString(),10)].gridX,l=this.targetGridCollection[parseInt(h.toString(),10)].gridY,c=this.targetGridCollection[parseInt(h.toString(),10)].nodeId,p=void 0,g=0;g<c.length;g++)if(this.targetNode.id!==c[parseInt(g.toString(),10)]){p=c[parseInt(g.toString(),10)];break}var u=void 0,f=void 0,m=void 0;e.nameTable[this.targetNode.id]&&(u=e.nameTable[this.targetNode.id].wrapper),e.nameTable[""+p]&&(f=e.nameTable[""+p].wrapper),u&&f&&(m=this.contains(f.bounds,u.bounds));for(var y=void 0,v=0;v<c.length;v++)this.targetNode.parentId===c[parseInt(v.toString(),10)]&&(y=!0);if(!this.gridCollection[parseInt(d.toString(),10)][parseInt(l.toString(),10)].walkable&&m&&!y){var b=void 0,S=void 0;b=this.getEndvalue(i,"left"),S=i.gridX-b.gridX,this.changeValue(i,S,"left"),S=(b=this.getEndvalue(r,"right")).gridX-r.gridX,this.changeValue(r,S,"right"),b=this.getEndvalue(n,"top"),S=n.gridY-b.gridY,this.changeValue(n,S,"top"),b=this.getEndvalue(o,"bottom"),S=o.gridY-b.gridY,this.changeValue(o,S,"top")}}},t.prototype.contains=function(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom},t.prototype.getEndvalue=function(t,e){return this.gridCollection[t.gridX][t.gridY].walkable?t:"left"===e?this.getEndvalue(this.gridCollection[t.gridX-1][t.gridY],e):"right"===e?this.getEndvalue(this.gridCollection[t.gridX+1][t.gridY],e):"top"===e?this.getEndvalue(this.gridCollection[t.gridX][t.gridY-1],e):"bottom"===e?this.getEndvalue(this.gridCollection[t.gridX][t.gridY+1],e):t},t.prototype.changeValue=function(t,e,i){var r;t.walkable||this.considerWalkable.push(t);for(var n=0;n<=e;n++)"left"===i?r=this.gridCollection[t.gridX-n][t.gridY]:"right"===i?r=this.gridCollection[t.gridX+n][t.gridY]:"top"===i?r=this.gridCollection[t.gridX][t.gridY-n]:"bottom"===i&&(r=this.gridCollection[t.gridX][t.gridY+n]),r.walkable||this.considerWalkable.push(r)},t.prototype.getIntermediatePoints=function(t){var e;for(this.intermediatePoints=[];t;)this.intermediatePoints.push({x:t.gridX,y:t.gridY}),t=t.parent;this.intermediatePoints.reverse(),this.intermediatePoints.length>=1&&void 0!==this.intermediatePoints[0]&&void 0!==this.intermediatePoints[1]&&(this.intermediatePoints[0].x===this.intermediatePoints[1].x?this.intermediatePoints[0].y<this.intermediatePoints[1].y?(e=this.neigbour(this.startGrid,"bottom",void 0,!0),this.intermediatePoints[0].y+=e-1):(e=this.neigbour(this.startGrid,"top",void 0,!0),this.intermediatePoints[0].y-=e-1):this.intermediatePoints[0].x<this.intermediatePoints[1].x?(e=this.neigbour(this.startGrid,"right",void 0,!0),this.intermediatePoints[0].x+=e-1):(e=this.neigbour(this.startGrid,"left",void 0,!0),this.intermediatePoints[0].x-=e-1))},t.prototype.optimizeIntermediatePoints=function(){this.intermediatePoints=this.removePointsInSameLine(this.intermediatePoints),this.intermediatePoints=this.getValidPoints(this.intermediatePoints)},t.prototype.removePointsInSameLine=function(t){if(t.length<3)return t;for(var e=[t[0]],i=1;i<t.length-1;i++){var r=e[e.length-1],n=t[parseInt(i.toString(),10)],o=t[i+1];this.arePointsInSameLine(r,n,o)||e.push(n)}return e.push(t[t.length-1]),e},t.prototype.arePointsInSameLine=function(t,e,i){return(e.x-t.x)*(i.y-t.y)===(i.x-t.x)*(e.y-t.y)},t.prototype.getValidPoints=function(t){if(t.length<4)return t;for(var e=1;e<t.length-3;){var i=t[parseInt(e.toString(),10)],r=t[e+1],n=t[e+2],o=t[e+3];if(i.x===r.x){if(r.y<i.y&&o.y<n.y||r.y>i.y&&o.y>n.y){for(var a=i.x<n.x?1:-1,s=r.y<i.y?-1:1,h=i.x+a,d=i.y,l=!1;h!==o.x||d!==o.y;){if(!this.isWalkable(h,d)){l=!1;break}l=!0,h!==n.x?h+=a:d+=s}if(l){i.x=n.x,t.splice(e+1,2);continue}}}else if(i.y===r.y&&(r.x<i.x&&o.x<n.x||r.x>i.x&&o.x>n.x)){for(var c=i.y<n.y?1:-1,p=r.x<i.x?-1:1,g=i.y+c,u=i.x,f=!1;u!==o.x||g!==o.y;){if(!this.isWalkable(u,g)){f=!1;break}f=!0,g!==n.y?g+=c:u+=p}if(f){i.y=n.y,t.splice(e+1,2);continue}}e++}return t},t.prototype.updateConnectorSegments=function(t,e,i,r,n){var o,a,s,h,d,l,c,p,g,u=[],f=[],m=r.targetWrapper,y=r.sourceWrapper,v=this.findEndPoint(r,!0);""===r.targetPortID&&r.targetWrapper||(a=this.findEndPoint(r,!1,!0));for(var b=0;b<e.length;b++)(d=i[e[parseInt(b.toString(),10)].x][e[parseInt(b.toString(),10)].y])&&(s=d.x+d.width/2,h=d.y+d.height/2,f.push({x:s,y:h}),b>=1&&f.length>1&&(p=f[f.length-2].x!==f[f.length-1].x?f[f.length-2].x>f[f.length-1].x?"Left":"Right":f[f.length-2].y>f[f.length-1].y?"Top":"Bottom"),b>=2&&g===p&&f.length>1&&f.splice(f.length-2,1),g=p);if(f&&f.length>1){for(var S=0;S<f.length-1;S++){var w=f[parseInt(S.toString(),10)],x=f[S+1];if(w.x!==x.x){if(0===S&&""===r.sourcePortID&&y&&(v=w.x>x.x?y.bounds.middleLeft:y.bounds.middleRight),S===f.length-2&&""===r.targetPortID&&m&&(a=w.x>x.x?m.bounds.middleRight:m.bounds.middleLeft),0===S&&v){if(w.x=v.x,w.y=x.y=v.y,""===r.sourcePortID){var I=w.x>x.x?"Left":"Right";v=di(r,0,v,si(y.bounds,Ti(I)),!1)}w.x=v.x}S===f.length-2&&a&&(S>0&&r.targetDecorator&&a.x-x.x<0&&Math.abs(a.x-w.x)<r.targetDecorator.width+1&&(w.x=f[S-1].x-=this.size/2),S>0&&r.targetDecorator&&a.x-x.x>0&&Math.abs(a.x-w.x)<r.targetDecorator.width+1&&(w.x=f[S-1].x+=this.size/2),x.x=a.x,w.y=x.y=a.y)}else{if(0===S&&""===r.sourcePortID&&y&&(v=w.y>x.y?y.bounds.topCenter:y.bounds.bottomCenter),S===f.length-2&&""===r.targetPortID&&m&&(a=w.y>x.y?m.bounds.bottomCenter:m.bounds.topCenter),0===S&&v){if(w.y=v.y,w.x=x.x=v.x,""===r.sourcePortID){var P=w.y>x.y?"Top":"Bottom";v=di(r,0,v,si(y.bounds,Ti(P)),!1)}w.y=v.y}S===f.length-2&&a&&(S>0&&r.targetDecorator&&a.y-x.y<0&&Math.abs(a.y-w.y)<r.targetDecorator.height+1&&(w.y=f[S-1].y-=this.size/2),S>0&&r.targetDecorator&&a.y-x.y>0&&Math.abs(a.y-w.y)<r.targetDecorator.height+1&&(w.y=f[S-1].y+=this.size/2),x.y=a.y,w.x=x.x=a.x)}}if(t.avoidLineOverlappingModule&&n){t.avoidLineOverlappingModule.addConnector(r,f);var C=t.avoidLineOverlappingModule.getModifiedConnector();C.has(r)&&(u=t.avoidLineOverlappingModule.getModifiedConnectorSegments(r),C.delete(r)),C.size>0&&t.avoidLineOverlappingModule.refreshModifiedConnectors(t)}if(0===u.length)for(S=0;S<f.length-1;S++){w=f[parseInt(S.toString(),10)],x=f[S+1];w.x!==x.x?w.x>x.x?(l="Left",c=w.x-x.x):(l="Right",c=x.x-w.x):w.y>x.y?(l="Top",c=w.y-x.y):(l="Bottom",c=x.y-w.y),o={type:"Orthogonal",length:c,direction:l},u.push(o)}}if(u&&u.length>0){var T=u[u.length-1];if(1===u.length&&(T.length-=20),T.length<10&&2===u.length&&(u.pop(),u.length>0&&(u[0].length-=20,T=u[0])),r.targetDecorator&&("Top"===T.direction||"Bottom"===T.direction)&&T.length>r.targetDecorator.height+1||("Right"===T.direction||"Left"===T.direction)&&T.length>r.targetDecorator.width+1)return!n&&t.avoidLineOverlappingModule||(r.segments=u),n&&t.connectorPropertyChange(r,{},{type:"Orthogonal",segments:u}),!0}return!1},t.prototype.findPath=function(t){for(var e,i=[],r=this.findNearestNeigbours(t,this.gridCollection,!0),n=0;n<r.length;n++)if(null!==(e=this.findIntermediatePoints(r[parseInt(n.toString(),10)].gridX,r[parseInt(n.toString(),10)].gridY,t.gridX,t.gridY,this.targetGrid.gridX,this.targetGrid.gridY))){var o=this.gridCollection[e.x][e.y],a=this.octile(Math.abs(e.x-t.gridX),Math.abs(e.y-t.gridY));t.parent&&t.parent.parent&&o.gridX!==t.parent.gridX&&o.gridY!==t.parent.gridY&&(a+=.1);var s=t.previousDistance+a;o.previousDistance&&!(o.previousDistance>s)||e.x===t.gridX&&e.y===t.gridY||(i.push(e),o.previousDistance=s,o.afterDistance=o.afterDistance||this.manhattan(Math.abs(e.x-this.targetGrid.gridX),Math.abs(e.y-this.targetGrid.gridY)),o.totalDistance=o.previousDistance+o.afterDistance,o.parent=t)}if(i.length>0)for(n=0;n<i.length;n++){o=this.gridCollection[i[parseInt(n.toString(),10)].x][i[parseInt(n.toString(),10)].y];-1===this.startArray.indexOf(o)&&this.startArray.push(o)}this.sorting(this.startArray)},t.prototype.sorting=function(t){return t.sort(function(t,e){return e.totalDistance-t.totalDistance})},t.prototype.octile=function(t,e){var i=Math.SQRT2-1;return e>t?i*t+e:i*e+t},t.prototype.manhattan=function(t,e){return t+e},t.prototype.findNearestNeigbours=function(t,e,i){var r=[],n=t.parent;if(n){var o=(t.gridX-n.gridX)/Math.max(Math.abs(t.gridX-n.gridX),1),a=(t.gridY-n.gridY)/Math.max(Math.abs(t.gridY-n.gridY),1);0!==o?(this.isWalkable(t.gridX,t.gridY-1,!0)&&-1===this.sourceGridCollection.indexOf(e[t.gridX][t.gridY-1])&&r.push(e[t.gridX][t.gridY-1]),this.isWalkable(t.gridX,t.gridY+1,!0)&&this.sourceGridCollection.indexOf(e[t.gridX][t.gridY+1])&&r.push(e[t.gridX][t.gridY+1]),this.isWalkable(t.gridX+o,t.gridY,!0)&&-1===this.sourceGridCollection.indexOf(e[t.gridX+o][t.gridY])&&r.push(e[t.gridX+o][t.gridY])):0!==a&&(this.isWalkable(t.gridX-1,t.gridY,!0)&&-1===this.sourceGridCollection.indexOf(e[t.gridX-1][t.gridY])&&r.push(e[t.gridX-1][t.gridY]),this.isWalkable(t.gridX+1,t.gridY,!0)&&-1===this.sourceGridCollection.indexOf(e[t.gridX+1][t.gridY])&&r.push(e[t.gridX+1][t.gridY]),this.isWalkable(t.gridX,t.gridY+a,!0)&&-1===this.sourceGridCollection.indexOf(e[t.gridX][t.gridY+a])&&r.push(e[t.gridX][t.gridY+a]))}else this.neigbour(t,"top",r,i),this.neigbour(t,"right",r,i),this.neigbour(t,"bottom",r,i),this.neigbour(t,"left",r,i);return r},t.prototype.neigbour=function(t,e,i,r){for(var n,o=1;o>0;){var a="top"===e||"bottom"===e?t.gridX:"left"===e?t.gridX-o:t.gridX+o,s="right"===e||"left"===e?t.gridY:"top"===e?t.gridY-o:t.gridY+o;if((n=this.gridCollection[parseInt(a.toString(),10)][parseInt(s.toString(),10)])&&(r&&-1===this.sourceGridCollection.indexOf(n)||!r&&-1===this.targetGridCollection.indexOf(n)))return i&&this.isWalkable(a,s)&&i.push(n),o;if(!(a>0&&s>0))break;o++}return null},t.prototype.resetGridColl=function(t,e,i){for(var r,n=1;n>0;){var o="top"===e||"bottom"===e?t.gridX:"left"===e?t.gridX-n:t.gridX+n,a="right"===e||"left"===e?t.gridY:"top"===e?t.gridY-n:t.gridY+n;if((r=this.gridCollection[parseInt(o.toString(),10)][parseInt(a.toString(),10)])&&(i&&-1===this.sourceGridCollection.indexOf(r)||!i&&-1===this.targetGridCollection.indexOf(r))){if(this.isWalkable(o,a))break;var s=this.gridCollection[parseInt(o.toString(),10)][parseInt(a.toString(),10)];this.considerWalkable.push(s)}if(!(o>0&&a>0))break;"top"===e||"left"===e?n--:n++}return null},t.prototype.isWalkable=function(t,e,i){if(t>=0&&t<this.noOfRows&&e>=0&&e<this.noOfCols){var r=this.gridCollection[parseInt(t.toString(),10)][parseInt(e.toString(),10)];if(r&&(r.walkable||(1===r.nodeId.length||2===r.nodeId.length&&r.parentNodeId||-1!==this.considerWalkable.indexOf(r))&&(-1!==this.sourceGridCollection.indexOf(r)||-1!==this.targetGridCollection.indexOf(r)||-1!==this.considerWalkable.indexOf(r)))&&(i&&!r.parent||!i))return!0}return!1},t.prototype.findIntermediatePoints=function(t,e,i,r,n,o){for(var a=t-i,s=e-r,h=t,d=e,l=0;l<this.targetGridCollection.length;l++)if(t===this.targetGridCollection[parseInt(l.toString(),10)].gridX&&e===this.targetGridCollection[parseInt(l.toString(),10)].gridY)return{x:t,y:e};if(!this.isWalkable(t,e))return null;var c=this.gridCollection[parseInt(t.toString(),10)][parseInt(e.toString(),10)];if(c.tested)return{x:t,y:e};if(c.tested=!0,0!==a&&(a=a>0?1:-1,this.isWalkable(h,d-1)&&!this.isWalkable(h-a,d-1)||this.isWalkable(h,d+1)&&!this.isWalkable(h-a,d+1)))return{x:t,y:e};if(0!==s){if(s=s>0?1:-1,this.isWalkable(h-1,d)&&!this.isWalkable(h-1,d-s)||this.isWalkable(h+1,d)&&!this.isWalkable(h+1,d-s))return{x:t,y:e};if(this.findIntermediatePoints(h+1,d,h,d,n,o)||this.findIntermediatePoints(h-1,d,h,d,n,o))return{x:t,y:e}}return this.findIntermediatePoints(h+a,d+s,h,d,n,o)},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"LineRouting"},t}(),Cl=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Tl=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},Al=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Cl(i,t),Tl([(0,e.Property)(!0)],i.prototype,"inversedAlignment",void 0),i}(e.ChildProperty),Ol=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Dl=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a};!function(t){t.Synchronous="Synchronous",t.Asynchronous="Asynchronous",t.Reply="Reply",t.Create="Create",t.Delete="Delete",t.Self="Self"}(Ad||(Ad={})),function(t){t.Alternative="Alternative",t.Loop="Loop",t.Optional="Optional"}(Od||(Od={})),function(t){t.Solid="Solid",t.Dashed="Dashed",t.SolidArrow="SolidArrow",t.DashedArrow="DashedArrow",t.Bidirectional="Bidirectional",t.DashedBidirectional="DashedBidirectional",t.OpenArrow="OpenArrow",t.DashedOpenArrow="DashedOpenArrow"}(Dd||(Dd={}));var Ml=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ol(i,t),Dl([(0,e.Property)(void 0)],i.prototype,"id",void 0),Dl([(0,e.Property)(void 0)],i.prototype,"startMessageID",void 0),Dl([(0,e.Property)(void 0)],i.prototype,"endMessageID",void 0),i}(e.ChildProperty),Ll=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=100,e.height=50,e}return Ol(i,t),Dl([(0,e.Property)(void 0)],i.prototype,"id",void 0),Dl([(0,e.Property)("")],i.prototype,"content",void 0),Dl([(0,e.Property)(!1)],i.prototype,"isActor",void 0),Dl([(0,e.Property)(!1)],i.prototype,"showDestructionMarker",void 0),Dl([(0,e.Collection)([],Ml)],i.prototype,"activationBoxes",void 0),i}(e.ChildProperty),El=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ol(i,t),Dl([(0,e.Property)(void 0)],i.prototype,"id",void 0),Dl([(0,e.Property)(void 0)],i.prototype,"fromParticipantID",void 0),Dl([(0,e.Property)(void 0)],i.prototype,"toParticipantID",void 0),Dl([(0,e.Property)("")],i.prototype,"content",void 0),Dl([(0,e.Property)("Synchronous")],i.prototype,"type",void 0),i}(e.ChildProperty),zl=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ol(i,t),Dl([(0,e.Property)("")],i.prototype,"content",void 0),Dl([(0,e.Property)([])],i.prototype,"messageIds",void 0),Dl([(0,e.Property)(void 0)],i.prototype,"fragmentIds",void 0),i}(e.ChildProperty),kl=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ol(i,t),Dl([(0,e.Property)(void 0)],i.prototype,"id",void 0),Dl([(0,e.Property)("Optional")],i.prototype,"type",void 0),Dl([(0,e.Collection)([],zl)],i.prototype,"conditions",void 0),i}(e.ChildProperty),Bl=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.isLoadedFromMermaid=!1,e.hideFootBox=!0,e.activationWidth=20,e.initialLifelineLength=100,e.messageSpacing=50,e.participantWidth=100,e.participantHeight=50,e.margin=0,e}return Ol(i,t),i.prototype.parse=function(t,e){this.diagram=e,this.diagram.clear(),Jl.clearLifelines(),Gl.clearMessages();var i=new ec(e);this.model=i.parse(t),this.isLoadedFromMermaid=!0},i.prototype.loadDiagramFromMermaid=function(t,e){new Vl(e).render(this.model,this),this.mermaidData=t},i.prototype.generateMermaidFromModel=function(){return(new ic).generateMermaidText(this)},i.prototype.updateUmlSequenceDiagram=function(t){this.diagram||(this.diagram=t),this.diagram.clear(),Jl.clearLifelines(),Gl.clearMessages(),this.model=new Rl(this.diagram),this.model.isLoadedFromMermaid=!1,this.model.updateParticipants(this.participants),this.model.updateMessages(this.messages),this.model.updateActivations(this.participants),this.model.updateFragments(this.fragments)},i.prototype.render=function(){new Vl(this.diagram).render(this.model,this),this.isLoadedFromMermaid=!1},Dl([(0,e.Collection)([],Ll)],i.prototype,"participants",void 0),Dl([(0,e.Collection)([],El)],i.prototype,"messages",void 0),Dl([(0,e.Collection)([],kl)],i.prototype,"fragments",void 0),Dl([(0,e.Property)(100)],i.prototype,"spaceBetweenParticipants",void 0),i}(e.ChildProperty),Rl=function(){function t(t){this.maxParticipantWidth=100,this.maxParticipantHeight=50,this.isLoadedFromMermaid=!1,this.diagram=t,Nl.clearMessageMapping(),this.participants=new Map,this.messages=[],this.activations=[],this.fragments=[],this.affectedParticipants=[],this.destroyedParticipants=[],this.destroyAtEndParticipants=[],this.aliases=new Map}return t.prototype.addParticipant=function(t){Nl.updateNodeColor(t,"#6495ED"),this.diagram.nodes.push(t),this.participants.set(t.id,t),this.addLifeLine(t)},t.prototype.addLifeLine=function(t){var e=new Co(this.diagram,"connectors",{id:t.id+"_Lifeline"},!0);Nl.updateConnectorStyles(e,"Dashed"),this.diagram.connectors.push(e),Jl.lifelines.set(t.id,e)},t.prototype.addMessage=function(t){this.diagram.connectors.push(t),this.messages.push(t)},t.prototype.addActivation=function(t){Nl.updateNodeColor(t.node,"#6495ED"),this.activations.push(t)},t.prototype.addFragment=function(t){t.node&&this.diagram.nodes.push(t.node),this.fragments.push(t)},t.prototype.addAlias=function(t,e){this.aliases.set(t,e)},t.prototype.updateParticipants=function(t){this.participants.clear();for(var e=0,i=0,r=0,n=t;r<n.length;r++){var o=n[r];if(o.id){var a=new Yh(this.diagram,"nodes",{id:o.id.toString(),width:o.width,height:o.height,data:o},!0);Nl.updateNodeShape(a,o.isActor),Nl.updateAnnotation(a,o.content,o.isActor),o.showDestructionMarker&&this.destroyAtEndParticipants.push(o.id.toString()),this.addParticipant(a),o.width>e&&(e=o.width),o.height>i&&(i=o.height)}else console.warn("[WARNING] :: Participant ID cannot be undefined.")}this.maxParticipantWidth=e,this.maxParticipantHeight=i},t.prototype.updateMessages=function(t){this.messages=[],this.affectedParticipants=[];for(var e=0,i=t;e<i.length;e++){var r=i[e];if(r.id){var n=null,o=null;if(r.type===Ad.Self?o=n=this.getNodeFromId(r.fromParticipantID||r.toParticipantID):(n=this.getNodeFromId(r.fromParticipantID),o=this.getNodeFromId(r.toParticipantID)),n&&o){var a=new Co(this.diagram,"connectors",{id:r.id.toString()},!0);Nl.addOrUpdateParticipantDetails(a,n.id,o.id,r.type,null),Nl.updateConnectorStyles(a,r.type.toString()),Nl.updateAnnotation(a,r.content),r.type===Ad.Create?(Nl.addOrUpdateParticipantDetails(a,n.id,o.id,Ad.Create,r.toParticipantID.toString()),this.affectedParticipants.push(r.toParticipantID.toString())):r.type===Ad.Delete&&(Nl.addOrUpdateParticipantDetails(a,n.id,o.id,Ad.Delete,r.toParticipantID.toString()),-1===this.affectedParticipants.indexOf(r.toParticipantID.toString())&&this.affectedParticipants.push(r.toParticipantID.toString()),this.destroyedParticipants.push(r.toParticipantID.toString())),this.addMessage(a)}}else console.warn("[WARNING] :: Message ID cannot be undefined.")}},t.prototype.updateActivations=function(t){this.activations=[];for(var e=0,i=t;e<i.length;e++){var r=i[e];if(r.id&&r.activationBoxes&&r.activationBoxes.length>0)for(var n=0,o=r.activationBoxes;n<o.length;n++){var a=o[n];if(a.startMessageID&&a.endMessageID){var s=this.getNodeFromId(r.id),h=a.id?a.id.toString():E(),d=new Yh(this.diagram,"nodes",{id:s.id+"_Activation_"+h,minHeight:10,minWidth:10,data:a},!0);Nl.updateNodeShape(d,!1);var l=this.getConnectorFromId(a.startMessageID),c=this.getConnectorFromId(a.endMessageID);if(l&&c){var p=Nl.getParticipantDetails(l),g=Nl.getParticipantDetails(c),u=new Hl(l.id,p.sourceParticipantName,p.targetParticipantName,Nl.getAnnotation(l),0),f=new Hl(c.id,g.sourceParticipantName,g.targetParticipantName,Nl.getAnnotation(c),0),m=new jl(d,s.id,u,f,0);this.addActivation(m)}else console.warn("[WARNING] :: Activation or deactivation connector details not found.")}}}},t.prototype.updateFragments=function(t){this.fragments=[];for(var e=0,i=t;e<i.length;e++){var r=i[e];if(r.id){var n=this.processFragment(r);this.removeChildFragmentsFromCollection(n),this.addFragment(n)}else console.warn("[WARNING] :: Fragment ID cannot be null.")}},t.prototype.removeChildFragmentsFromCollection=function(t){for(var e=0,i=t.childFragments;e<i.length;e++){var r=i[e],n=this.fragments.indexOf(r);-1!==n&&this.fragments.splice(n,1),this.removeChildFragmentsFromCollection(r)}},t.prototype.processFragment=function(t){for(var e=new Wl(t.id.toString(),t.type,[],[],new Yh(this.diagram,"nodes",{id:t.id.toString()+"_Fragment",data:t,shape:{type:"Path"},style:{fill:"transparent",strokeColor:"#000000",strokeWidth:1}},!0),0),i=0,r=t.conditions;i<r.length;i++){var n=r[i],o=new _l(n.content,[],[],new Yl);if(n.fragmentIds)for(var a=function(t){var i=s.fragments.find(function(e){return e.id===t});i?(o.nestedFragments.push(i),e.childFragments.push(i)):console.warn("[WARNING] :: Please ensure that all child fragments are defined in the collection before their respective parent fragments.")},s=this,h=0,d=n.fragmentIds;h<d.length;h++){a(d[h])}this.processSequenceMessageIds(o,n.messageIds),t.type===Od.Alternative&&this.populateConditionAltBlockDetails(o),e.conditions.push(o)}return e},t.prototype.populateConditionAltBlockDetails=function(t){for(var e=function(e){t.altBlockDetails.connectors.some(function(t){return t.id===e.id})||t.altBlockDetails.connectors.push(new Fl(e.id,e.source,e.target,e.message,-1,"",!1,-1))},i=0,r=t.connectors;i<r.length;i++){e(r[i])}for(var n=0,o=t.nestedFragments;n<o.length;n++){var a=o[n];this.addChildFragmentConnectors(t,a)}},t.prototype.addChildFragmentConnectors=function(t,e){for(var i=0,r=e.conditions;i<r.length;i++){for(var n=r[i],o=function(i){t.altBlockDetails.connectors.some(function(t){return t.id===i.id})||t.altBlockDetails.connectors.push(new Fl(i.id,i.source,i.target,i.message,-1,e.id.toString(),!0,-1))},a=0,s=n.connectors;a<s.length;a++){o(s[a])}for(var h=0,d=n.nestedFragments;h<d.length;h++){var l=d[h];this.addChildFragmentConnectors(t,l)}}},t.prototype.processSequenceMessageIds=function(t,e){for(var i=0,r=e;i<r.length;i++){var n=r[i];void 0!==n&&""!==n&&this.processConnector(t,n)}},t.prototype.processConnector=function(t,e){var i=this.getConnectorFromId(e);if(i){var r=Nl.getParticipantDetails(i),n=new Hl(i.id.toString(),r.sourceParticipantName,r.targetParticipantName,Nl.getAnnotation(i),0);t.connectors.push(n)}},t.prototype.getNodeFromId=function(t){var e;return t?this.participants.has(t.toString())?e=this.participants.get(t.toString()):console.warn("[WARNING] :: Participant '"+t.toString()+"' not found."):console.warn("[WARNING] :: ParticipantID is null."),e},t.prototype.getConnectorFromId=function(t){var e=this.messages.find(function(e){return e.id.toString()===t.toString()});return e||console.warn("[WARNING] :: Message ID '"+t.toString()+"' is not found."),e},t}(),Nl=function(){function t(){}return t.addOrUpdateParticipantDetails=function(t,e,i,r,n){var o=new Xl(e,i,n,r);this.messageMapping.set(t,o)},t.getParticipantDetails=function(t){return this.messageMapping.get(t)},t.clearMessageMapping=function(){this.messageMapping.clear()},t.updateAnnotation=function(t,e,i){var r=e.trim();if(t instanceof Yh){if(t.annotations=[{content:r,horizontalAlignment:"Center"}],i){var n=t.annotations[0];n.style.textWrapping="NoWrap",n.offset={x:.5,y:1},n.margin={left:0,top:6,right:0,bottom:0}}}else t.annotations=[{content:r,style:{textWrapping:"NoWrap"},margin:{left:0,top:-10,right:0,bottom:0},rotationReference:"Page"}]},t.getAnnotation=function(t){return t.annotations[0].content},t.updateNodeShape=function(t,e){t.shape=e?{type:"Path",data:$l}:{type:"Path",data:tc}},t.isActor=function(t){var e=t.shape;return"Path"===e.type&&e.data===$l},t.updateNodeColor=function(t,e){t.style={fill:e,strokeColor:"#000000",strokeWidth:1}},t.updateConnectorStyles=function(t,e){t.segments=[{type:"Straight"}];var i={fill:"black",strokeColor:"black",strokeWidth:1};t.sourceDecorator={shape:"None",style:i},t.targetDecorator={shape:"None",style:i};var r={strokeColor:"black",strokeWidth:1},n={strokeColor:"black",strokeWidth:1,strokeDashArray:"5,5"};if(this.isMermaidConnectorType(e))switch(e){case"Solid":t.style=r;break;case"Dashed":t.style=n;break;case"SolidArrow":t.style=r,t.targetDecorator.shape="Arrow";break;case"DashedArrow":t.style=n,t.targetDecorator.shape="Arrow";break;case"Bidirectional":t.style=r,t.sourceDecorator.shape="Arrow",t.targetDecorator.shape="Arrow";break;case"DashedBidirectional":t.style=n,t.sourceDecorator.shape="Arrow",t.targetDecorator.shape="Arrow";break;case"OpenArrow":t.style=r,t.targetDecorator.shape="OpenArrow";break;case"DashedOpenArrow":t.style=n,t.targetDecorator.shape="OpenArrow"}else if(this.isUmlSequenceMessageType(e))switch(e){case"Synchronous":case"Delete":t.style=r,t.targetDecorator.shape="Arrow";break;case"Asynchronous":case"Create":t.style=r,t.targetDecorator.shape="OpenArrow";break;case"Reply":t.style=n,t.targetDecorator.shape="OpenArrow";break;case"Self":t.type="Orthogonal",t.segments=[{type:"Orthogonal",length:20,direction:"Left"},{type:"Orthogonal",length:50,direction:"Bottom"},{type:"Orthogonal",length:20,direction:"Right"}],t.style=r,t.targetDecorator.shape="Arrow"}},t.removeConnectableConstraintForNode=function(t){t&&(t.constraints=ht.Default&~(ht.InConnect|ht.OutConnect))},t.isMermaidConnectorType=function(t){return-1!==["Solid","Dashed","SolidArrow","DashedArrow","Bidirectional","DashedBidirectional","OpenArrow","DashedOpenArrow"].indexOf(t)},t.isUmlSequenceMessageType=function(t){return-1!==["Synchronous","Asynchronous","Create","Delete","Reply","Self"].indexOf(t)},t.messageMapping=new Map,t}(),jl=function(){function t(t,e,i,r,n){this._node=null,this.node=t,this.participantName=e,this.activateConnectorDetails=i,this.deactivateConnectorDetails=r,this.depth=n}return Object.defineProperty(t.prototype,"node",{get:function(){return this._node},set:function(t){this._node=t,this._node.annotations=null,Nl.removeConnectableConstraintForNode(this._node)},enumerable:!0,configurable:!0}),t}(),Hl=function(t,e,i,r,n){this.id="",this.index=-1,this.source="",this.target="",this.message="",this.id=t,this.index=n,this.source=e,this.target=i,this.message=r},Wl=function(){function t(t,e,i,r,n,o,a){this.id="",this.conditions=[],this.depth=0,this.index=0,this.childFragments=[],this.id=t,this.type=e,this.conditions=i,this.childFragments=r,this.node=n,this.index=o,this.depth=a,this.fragmentStartIndex=-1,this.fragmentEndIndex=-1}return Object.defineProperty(t.prototype,"node",{get:function(){return this._node},set:function(t){this._node=t,Nl.removeConnectableConstraintForNode(this._node)},enumerable:!0,configurable:!0}),t}(),_l=function(t,e,i,r){this.content="",this.connectors=[],this.altBlockDetails=new Yl,this.nestedFragments=[],this.conditionStartIndex=-1,this.conditionEndIndex=-1,this.content=t,this.nestedFragments=e,this.connectors=i,this.altBlockDetails=r},Yl=function(){this.connectors=[]},Fl=function(t){function e(e,i,r,n,o,a,s,h){var d=t.call(this,e,i,r,n,o)||this;return d.fragmentID="",d.inFragment=!1,d.fragmentIndex=-1,d.fragmentID=a,d.inFragment=s,d.fragmentIndex=h,d}return Ol(e,t),e}(Hl),Xl=function(t,e,i,r){this.sourceParticipantName=t,this.targetParticipantName=e,this.affectedParticipantName=i,this.messageType=r},Vl=function(){function t(t){this.diagram=t}return t.prototype.render=function(t,e){e.messageSpacing=50,Ul.render(this.diagram,t,e),Gl.render(this.diagram,t,e);for(var i=0;i<this.diagram.nodes.length;i++){var r=this.diagram.nodes[parseInt(i.toString(),10)];this.diagram.preventNodesUpdate=!0,this.diagram.nodePropertyChange(r,{},{offsetX:r.offsetX,offsetY:r.offsetY,width:r.width,height:r.height,annotations:r.annotations,ports:r.ports},!0),this.diagram.preventNodesUpdate=!1}for(i=0;i<this.diagram.connectors.length;i++){var n=this.diagram.connectors[parseInt(i.toString(),10)];this.diagram.preventConnectorsUpdate=!0,this.diagram.connectorPropertyChange(n,{},{sourcePoint:n.sourcePoint,targetPoint:n.targetPoint,sourceID:n.sourceID,targetID:n.targetID,sourcePortID:n.sourcePortID,targetPortID:n.targetPortID,sourcePadding:n.sourcePadding,targetPadding:n.targetPadding,sourceDecorator:n.sourceDecorator,targetDecorator:n.targetDecorator,annotations:n.annotations,ports:n.ports,constraints:n.constraints,segments:n.segments},!0),this.diagram.preventConnectorsUpdate=!1}Ql.render(this.diagram,t,e),Kl.render(this.diagram,t,e)},t}(),Ul=function(){function t(){}return t.render=function(t,e,i){this.diagram=t,this.model=e,this.settings=i;var r=[];e.participants.forEach(function(t,e){return r.push(t)}),this.updateParticipantsSize(r);for(var n=this.getUpdatedMargin(),o=i.margin+n.x,a=0;a<r.length;a++){var s=r[parseInt(a.toString(),10)];s.offsetX=o,s.offsetY=i.margin+n.y;var h=0;if(a<r.length-1){var d=r[a+1];Nl.isActor(d)&&e.isLoadedFromMermaid&&this.resizeWithAspectRatio(d,e.maxParticipantHeight),h=d.width>0?d.width:this.model.maxParticipantWidth}o+=s.width/2+i.spaceBetweenParticipants+h/2,Jl.render(t,e,s,i)}},t.updateParticipantsSize=function(t){for(var e=0,i=t;e<i.length;e++){var r=i[e];if(Nl.isActor(r)){var n=r.annotations[0];n.style.textWrapping="NoWrap",n.offset={x:.5,y:1},n.margin={left:0,top:6,right:0,bottom:0},this.model.isLoadedFromMermaid?this.resizeWithAspectRatio(r,this.model.maxParticipantHeight):this.resizeWithAspectRatio(r,50)}else r.width>0||(r.width=this.model.maxParticipantWidth),r.height>0||(r.height=this.model.maxParticipantHeight)}},t.resizeWithAspectRatio=function(t,e){t.width=e,t.height=1.5*t.width},t.getUpdatedMargin=function(){var t=0,e=0,i=!0;return this.model.participants.forEach(function(r,n){r.width;var o=r.height/2;i&&(t=r.width/2,i=!1),o>e&&(e=o)}),{x:t,y:e}},t}(),Gl=function(){function t(){}return t.render=function(t,e,i){this.diagram=t,this.model=e,this.settings=i,this.messageLayouts=[],this.model.participants.forEach(function(t,i){t.height>e.maxParticipantHeight&&(e.maxParticipantHeight=t.height)});var r=i.messageSpacing+e.maxParticipantHeight;this.adjustMessageSpacing(e,i);for(var n=0;n<e.messages.length;n++){var o=e.messages[parseInt(n.toString(),10)];r=this.storeLayoutInfo(r,o),r+=i.messageSpacing}ql.adjustMessagePositionsForFragments(e,this.messageLayouts,i.messageSpacing);var a=this.calculateRequiredLifelineLength();this.model.participants.forEach(function(t,e){Jl.updateLifelineLength(t,a)}),this.updateCreateMessage(),this.updateDestroyMessage(),this.renderMessagesOnLifeline()},t.adjustMessageSpacing=function(t,e){var i=e.messageSpacing;t.maxParticipantHeight>100&&(i+=.5*(t.maxParticipantHeight-100)),this.settings.messageSpacing=Math.max(i,e.messageSpacing)},t.storeLayoutInfo=function(t,e){return this.messageLayouts.push(new Zl(e.id.toString(),t,e)),this.isSelfMessage(e)&&(t+=this.settings.messageSpacing),this.isCreateMessage(e)&&(t+=this.settings.messageSpacing/2),t},t.calculateRequiredLifelineLength=function(){if(!this.messageLayouts||0===this.messageLayouts.length)return this.getTopAndBottomPadding();for(var t=0,e=0,i=this.messageLayouts;e<i.length;e++){var r=i[e];r.yPosition>t&&(t=r.yPosition)}return t+this.settings.messageSpacing},t.getTopAndBottomPadding=function(){return 2*(this.settings.messageSpacing+this.model.maxParticipantHeight)},t.isSelfMessage=function(t){var e=Nl.getParticipantDetails(t);return!!e&&e.sourceParticipantName===e.targetParticipantName},t.isCreateMessage=function(t){var e=Nl.getParticipantDetails(t);return e&&e.messageType===Ad.Create},t.updateCreateMessage=function(){for(var t=function(t){var i=Nl.getParticipantDetails(t);if(i&&i.messageType===Ad.Create){var r=void 0;if(i.affectedParticipantName&&e.model.participants.has(i.affectedParticipantName)){r=e.model.participants.get(i.affectedParticipantName);var n=e.messageLayouts.find(function(e){return e.messageID===t.id.toString()});n&&(r.offsetY=n.yPosition,Jl.updateLifelinePosition(r,n.yPosition))}}},e=this,i=0,r=this.model.messages;i<r.length;i++){t(r[i])}},t.updateDestroyMessage=function(){for(var t=function(t){var i=Nl.getParticipantDetails(t);if(i&&i.messageType===Ad.Delete){var r=void 0;if(i.affectedParticipantName&&e.model.participants.has(i.affectedParticipantName)){r=e.model.participants.get(i.affectedParticipantName);var n=e.messageLayouts.find(function(e){return e.messageID===t.id.toString()});n&&Jl.updateLifelineToDestroy(r,t,n.yPosition)}}},e=this,i=0,r=this.model.messages;i<r.length;i++){t(r[i])}},t.renderMessagesOnLifeline=function(){Jl.clearPorts();for(var t=0,e=this.messageLayouts;t<e.length;t++){var i=e[t],r=i.connector,n=Nl.getParticipantDetails(r);if(n){var o=this.getLifeline(this.model.participants,n.sourceParticipantName),a=this.getLifeline(this.model.participants,n.targetParticipantName);this.isSelfMessage(r)?this.renderSelfMessage(o,r,i.yPosition):this.renderNormalMessage(o,a,r,i.yPosition)}}},t.renderNormalMessage=function(t,e,i,r){var n=this.createPort(t,r),o=this.createPort(e,r);this.applyActivationPadding(n,i,r,!0),this.applyActivationPadding(o,i,r,!1),this.assignPortOrPoint(i,n,t,r,!0),this.assignPortOrPoint(i,o,e,r,!1),i.sourcePortID||(i.sourcePoint.y=r),i.targetPortID||(i.targetPoint.y=r)},t.renderSelfMessage=function(t,e,i){var r=this.createPort(t,i),n=this.createPort(t,i+this.settings.messageSpacing);this.applyActivationPadding(r,e,i,!0),this.applyActivationPadding(n,e,i+this.settings.messageSpacing,!1),e.type="Orthogonal",e.segments=[{type:"Orthogonal",length:20,direction:"Left"},{type:"Orthogonal",length:50,direction:"Bottom"},{type:"Orthogonal",length:20,direction:"Right"}],this.assignPortOrPoint(e,r,t,i,!0),this.assignPortOrPoint(e,n,t,i,!1)},t.applyActivationPadding=function(t,e,i,r){var n=Nl.getParticipantDetails(e);if(n&&this.model.activations){var o=r?n.sourceParticipantName:n.targetParticipantName;this.isWithinActivation(o,i,e)&&(r?e.sourcePadding=this.settings.activationWidth/2-t.height/2:e.targetPadding=this.settings.activationWidth/2-t.height/2)}},t.isWithinActivation=function(t,e,i){var r=this.model.messages.findIndex(function(t){return t.id.toString()===i.id.toString()});if(-1===r)return!1;for(var n=function(e){if(e.participantName===t&&e.activateConnectorDetails&&e.deactivateConnectorDetails){var i=o.model.messages.findIndex(function(t){return t.id.toString()===e.activateConnectorDetails.id}),n=o.model.messages.findIndex(function(t){return t.id.toString()===e.deactivateConnectorDetails.id});if(-1!==i&&-1!==n){var a=Nl.getParticipantDetails(o.model.messages[parseInt(i.toString(),10)]);if(a&&a.sourceParticipantName===a.targetParticipantName&&r===i)return{value:!1};if(r>=i&&r<=n)return{value:!0}}}},o=this,a=0,s=this.model.activations;a<s.length;a++){var h=n(s[a]);if("object"==typeof h)return h.value}return!1},t.createPort=function(t,e){var i=this.getLifelineSourceY(t),r=this.calculateLifelineLength(t,i),n=this.calculateLengthFraction(e,i,r);n=n>1?1:n;var o=new ve(this.diagram,"ports",{id:E(),offset:n});return this.addPortToLifeline(t,o),o},t.assignPortOrPoint=function(t,e,i,r,n){var o=i.sourcePoint.x;if(1===e.offset)n?t.sourcePoint={x:o,y:r}:t.targetPoint={x:o,y:r};else if(n)t.sourceID=i.id,t.sourcePortID=e.id;else{var a=Nl.getParticipantDetails(t);if(a&&a.messageType===Ad.Create&&a.affectedParticipantName&&a.targetParticipantName===a.affectedParticipantName){var s=void 0;this.model.participants.has(a.affectedParticipantName)&&(s=this.model.participants.get(a.affectedParticipantName),t.targetID=s.id,t.targetPadding=0)}t.targetID||(t.targetID=i.id,t.targetPortID=e.id)}},t.addPortToLifeline=function(t,e){this.diagram.addPorts(t,[e]),this.diagram.protectPropertyChange(!0)},t.getLifelineSourceY=function(t){return t.sourcePoint.y},t.calculateLifelineLength=function(t,e){return t.targetPoint.y-e},t.calculateLengthFraction=function(t,e,i){return(t-e)/i},t.getLifeline=function(t,e){return Jl.lifelines.get(e)},t.clearMessages=function(){this.messageLayouts=[]},t.messageLayouts=[],t}(),Zl=function(t,e,i){this.messageID=t,this.yPosition=e,this.connector=i},ql=function(){function t(){}return t.adjustMessagePositionsForFragments=function(t,e,i){for(var r=0,n=t.fragments;r<n.length;r++){var o=n[r];this.computeFragmentMessageRange(o,t)}var a=[];this.collectAllFragments(t.fragments,a),a.sort(function(t,e){return t.fragmentStartIndex-e.fragmentStartIndex});for(var s=0,h=a;s<h.length;s++){if(!((o=h[s]).fragmentStartIndex<0)){var d=o.childFragments&&o.childFragments.length>0?1.5*i:i,l=.7*i;if(this.shiftMessages(e,o.fragmentStartIndex,d),o.fragmentEndIndex>=0&&o.fragmentEndIndex+1<e.length&&this.shiftMessages(e,o.fragmentEndIndex+1,l),o.type===Od.Alternative){for(var c=0,p=o.conditions;c<p.length;c++){var g=p[c];this.computeConditionMessageRange(g,t)}for(var u=o.conditions.filter(function(t){return t.conditionStartIndex>=0}).sort(function(t,e){return t.conditionStartIndex-e.conditionStartIndex}),f=.8*i,m=1;m<u.length;m++){var y=u[parseInt(m.toString(),10)].conditionStartIndex;y>=0&&y<e.length&&this.shiftMessages(e,y,f)}}}}},t.collectAllFragments=function(t,e){for(var i=0,r=t;i<r.length;i++){var n=r[i];e.push(n),n.childFragments&&n.childFragments.length>0&&this.collectAllFragments(n.childFragments,e)}},t.computeFragmentMessageRange=function(t,e){for(var i=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,n=0,o=t.conditions;n<o.length;n++)for(var a=function(t){var n=e.messages.findIndex(function(e){return e.id.toString()===t.id});n>=0&&n<i&&(i=n),n>r&&(r=n)},s=0,h=o[n].connectors;s<h.length;s++){a(h[s])}for(var d=0,l=t.childFragments;d<l.length;d++){var c=l[d];this.computeFragmentMessageRange(c,e),c.fragmentStartIndex>=0&&c.fragmentStartIndex<i&&(i=c.fragmentStartIndex),c.fragmentEndIndex>r&&(r=c.fragmentEndIndex)}i===Number.MAX_SAFE_INTEGER&&(i=-1),r===Number.MIN_SAFE_INTEGER&&(r=-1),t.fragmentStartIndex=i,t.fragmentEndIndex=r},t.computeConditionMessageRange=function(t,e){for(var i=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,n=function(t){var n=e.messages.findIndex(function(e){return e.id.toString()===t.id});if(n<0)return"continue";n<i&&(i=n),n>r&&(r=n)},o=0,a=t.connectors;o<a.length;o++){n(a[o])}i===Number.MAX_SAFE_INTEGER&&(i=-1),r===Number.MIN_SAFE_INTEGER&&(r=-1),t.conditionStartIndex=i,t.conditionEndIndex=r},t.shiftMessages=function(t,e,i){if(0!==i)for(var r=e;r<t.length;r++)t[parseInt(r.toString(),10)].yPosition+=i},t}(),Ql=function(){function t(){}return t.render=function(t,e,i){this.diagram=t,this.model=e,this.settings=i;for(var r=0,n=e.activations;r<n.length;r++){var o=n[r];this.renderActivation(o)}},t.renderActivation=function(t){var e=this.model.messages.find(function(e){var i=Nl.getParticipantDetails(e);return null!=e.id&&e.id===t.activateConnectorDetails.id.toString()&&null!=i&&i.sourceParticipantName===t.activateConnectorDetails.source&&i.targetParticipantName===t.activateConnectorDetails.target&&Nl.getAnnotation(e)===t.activateConnectorDetails.message}),i=this.model.messages.find(function(e){var i=Nl.getParticipantDetails(e);return null!=e.id&&e.id===t.deactivateConnectorDetails.id.toString()&&null!=i&&i.sourceParticipantName===t.deactivateConnectorDetails.source&&i.targetParticipantName===t.deactivateConnectorDetails.target&&Nl.getAnnotation(e)===t.deactivateConnectorDetails.message}),r=this.getParticipantByName(t.participantName),n=e?{x:e.sourcePoint.x,y:e.sourcePoint.y}:{x:0,y:0},o=i?{x:i.targetPoint.x,y:i.targetPoint.y}:{x:0,y:0};t.depth=this.calculateActivationDepth(t,n,o);var a=Nl.getParticipantDetails(e);a&&(a.sourceParticipantName===a.targetParticipantName?n.y=e.targetPoint.y:a.messageType===Ad.Create&&a.targetParticipantName===t.participantName&&(n.y+=r.height/2+(Nl.isActor(r)?15:5)));var s=t.node;s.offsetX=r.offsetX+t.depth*(this.settings.activationWidth/4),s.offsetY=n.y+(o.y-n.y)/2,s.width=this.settings.activationWidth,s.height=Math.abs(n.y-o.y),this.diagram.add(s)},t.calculateActivationDepth=function(t,e,i){for(var r=this,n=0,o=0,a=this.model.activations.filter(function(e){return e.participantName===t.participantName&&e!==t&&r.isOverlapping(t,e)}).sort(function(t,e){return t.activateConnectorDetails.index-e.activateConnectorDetails.index});o<a.length;o++){var s=a[o],h=this.getStartPoint(s);e.y>h&&n++}return n},t.isOverlapping=function(t,e){var i=this.getStartPoint(t),r=this.getEndPoint(t),n=this.getStartPoint(e);return i<this.getEndPoint(e)&&n<r},t.getStartPoint=function(t){var e=this.model.messages.find(function(e){return e.id.toString()===t.activateConnectorDetails.id.toString()});return e?e.sourcePoint.y:0},t.getEndPoint=function(t){var e=this.model.messages.find(function(e){return e.id.toString()===t.deactivateConnectorDetails.id.toString()});return e?e.targetPoint.y:0},t.getParticipantByName=function(t){return this.model.participants.has(t)?this.model.participants.get(t):null},t}(),Kl=function(){function t(){}return t.render=function(t,e,i){this.diagram=t,this.model=e,this.settings=i;for(var r=0,n=e.fragments;r<n.length;r++){var o=n[r];this.renderFragment(o)}},t.renderFragment=function(t){for(var e=0,i=t.childFragments;e<i.length;e++){var r=i[e];this.renderFragment(r)}switch(t.type){case Od.Optional:case Od.Loop:this.renderGeneralFragment(t);break;case Od.Alternative:this.renderAlternativeFragment(t)}},t.renderGeneralFragment=function(t){for(var e=0,i=t.conditions;e<i.length;e++){var r=i[e],n=this.calculateFragmentBoundary(r,t);if(n&&0!==n.width&&0!==n.height){this.createFragmentNode(t,r.content,n);var o=t.node;this.diagram.preventNodesUpdate=!0,this.diagram.nodePropertyChange(o,{shape:{type:"Path"}},{shape:o.shape},!0),this.diagram.preventNodesUpdate=!1}}},t.renderAlternativeFragment=function(t){var e=this.calculateAltFragmentBoundary(t);if(e&&0!==e.width&&0!==e.height){this.createFragmentNode(t,t.conditions[0].content,e);var i=t.node;this.updateAlternativeFragmentShape(t,i),this.diagram.preventNodesUpdate=!0,this.diagram.nodePropertyChange(i,{shape:{type:"Path"}},{shape:i.shape},!0),this.diagram.preventNodesUpdate=!1}},t.updateAlternativeFragmentShape=function(t,e){var i=e.wrapper.bounds,r=this.getAlternateFragmentShape(i);r=this.appendConditionDottedLines(t,e,i,r),e.shape={type:"Path",data:r}},t.getAlternateFragmentShape=function(t){var e=t.width,i=t.height,r=19.7,n="M "+t.x+" "+t.y+" L "+(t.x+e)+" "+t.y+" L "+(t.x+e)+" "+(t.y+i)+" L "+t.x+" "+(t.y+i)+" Z";return n+" "+n+" "+("M "+t.x+" "+t.y+" H "+(t.x+40)+" V "+(t.y+9.85+r/6)+" C "+(t.x+40-7.6)+" "+(t.y+r)+" "+(t.x+40)+" "+(t.y+9.85+r/6)+" "+(t.x+40-7.6)+" "+(t.y+r)+" H "+t.x+" Z")},t.appendConditionDottedLines=function(t,e,i,r){for(var n=0;n<t.conditions.length-1;n++){var o=t.conditions[parseInt(n.toString(),10)],a=t.conditions[n+1],s=this.calculateCenterYBetweenConditions(o,a);0===s&&(s=i.top+i.height/(t.conditions.length+1)*(n+1)),r+=this.createDashedLinePath(e,i,s),this.addAnnotationForAlternativeCondition(e,s,i,a)}return r},t.createDashedLinePath=function(t,e,i){for(var r="M "+e.x+" "+i+" ",n=Math.floor(e.width/10),o=0;o<n;o++)r+="l 5 0 ",r+="m 5 0 ";return r},t.addAnnotationForAlternativeCondition=function(t,e,i,r){var n=this.calculateAnnotationYOffset(e,t.height,i.y),o=new Ie(t,"annotations",{content:"["+r.content+"]",offset:{x:0,y:n},horizontalAlignment:"Left",margin:{left:9,top:15,right:5,bottom:5},style:{bold:!0}});this.diagram.addLabels(t,[o]),this.diagram.protectPropertyChange(!0)},t.calculateAnnotationYOffset=function(t,e,i){var r=t-i;return Math.max(0,Math.min(r,e))/e},t.calculateFragmentBoundary=function(t,e){var i=void 0;if(t.connectors&&t.connectors.length>0){var r=this.getMessagesFromConnectorDetails(t.connectors);i=this.getBoundaryFromMessages(r)}var n=this.calculateChildFragmentBoundary(e),o=this.model.maxParticipantWidth/4;if(i||n){if(!i){var a=new w(n.left-o,n.top-o,n.width+2*o,n.height+2*o);return this.adjustCombinedBoundary(a,i,n)}return n?this.combineBoundaries(i,n):i}},t.getBoundaryFromMessages=function(t){var e=this.getMinCoordinates(t),i=this.getMaxCoordinates(t),r=this.hasCreateMessage(t),n=this.hasSelfMessage(t),o=this.model.maxParticipantWidth/4;r&&(o+=this.model.maxParticipantWidth/3),n&&(o+=this.model.maxParticipantWidth/6);for(var a=this.settings.messageSpacing/3,s=e.x-o,h=e.y-a,d=i.x-e.x+2*o,l=i.y-e.y+2*a,c=0,p=t;c<p.length;c++){var g=p[c];if(g.targetID&&this.diagram.getObject(g.targetID)instanceof Yh){var u=this.diagram.getObject(g.targetID);if(u&&u instanceof Yh&&u.wrapper){var f=u.wrapper.bounds,m=f.x+f.width+o,y=f.y+f.height+a;d=Math.max(d,m-s),l=Math.max(l,y-h)}}}var v=t[t.length-1],b=Nl.getParticipantDetails(v);return b&&b.messageType===Ad.Delete&&(l+=25),new w(s,h,d,l)},t.hasSelfMessage=function(t){for(var e=0,i=t;e<i.length;e++){var r=i[e],n=Nl.getParticipantDetails(r);if(n&&n.sourceParticipantName===n.targetParticipantName)return!0}return!1},t.hasCreateMessage=function(t){for(var e=0,i=t;e<i.length;e++){var r=i[e];if(r.targetID&&this.diagram.getObject(r.targetID)instanceof Yh)return!0}return!1},t.calculateChildFragmentBoundary=function(t){if(t.childFragments&&0!==t.childFragments.length){for(var e=[],i=0;i<t.childFragments.length;i++){for(var r=t.childFragments[parseInt(i.toString(),10)],n=[],o=0;o<r.conditions.length;o++)for(var a=r.conditions[parseInt(o.toString(),10)].connectors,s=0;s<a.length;s++)n.push(a[parseInt(s.toString(),10)]);var h=this.getMessagesFromConnectorDetails(n),d=this.getBoundaryFromMessages(h),l=this.calculateChildFragmentBoundary(r),c=this.combineBoundaries(d,l);c&&e.push(c)}if(0!==e.length){var p=Math.min.apply(null,e.map(function(t){return t.left})),g=Math.min.apply(null,e.map(function(t){return t.top})),u=Math.max.apply(null,e.map(function(t){return t.right})),f=Math.max.apply(null,e.map(function(t){return t.bottom}));return new w(p,g,u-p,f-g)}}},t.combineBoundaries=function(t,e){if(!e)return t;var i=this.model.maxParticipantWidth/4,r=new w(Math.min(t.left,e.left)-i,Math.min(t.top,e.top)-i,Math.max(t.right,e.right)-Math.min(t.left,e.left)+2*i,Math.max(t.bottom,e.bottom)-Math.min(t.top,e.top)+2*i);return this.adjustCombinedBoundary(r,t,e)},t.adjustCombinedBoundary=function(t,e,i){var r=this.settings.messageSpacing/2;return!e&&i||e&&i&&e.top>i.top?new w(t.left,t.top-r,t.width,t.height+r):t},t.getMinCoordinates=function(t){for(var e=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],o=Math.min(n.sourcePoint.x,n.targetPoint.x),a=Math.min(n.sourcePoint.y,n.targetPoint.y);o<e&&(e=o),a<i&&(i=a)}return{x:e,y:i}},t.getMaxCoordinates=function(t){for(var e=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],o=Math.max(n.sourcePoint.x,n.targetPoint.x),a=Math.max(n.sourcePoint.y,n.targetPoint.y);o>e&&(e=o),a>i&&(i=a)}return{x:e,y:i}},t.calculateAltFragmentBoundary=function(t){var e=[].concat.apply([],t.conditions.map(function(t){return t.connectors})),i=void 0;if(e.length>0){var r=this.getMessagesFromConnectorDetails(e);i=this.getBoundaryFromMessages(r)}var n=this.calculateChildFragmentBoundary(t),o=this.model.maxParticipantWidth/4;if(i||n){if(!i){var a=new w(n.x-o,n.y-o,n.width+2*o,n.height+2*o);return this.adjustCombinedBoundary(a,i,n)}return n?this.combineBoundaries(i,n):i}},t.getMessagesFromConnectorDetails=function(t){for(var e=[],i=0;i<t.length;i++){for(var r=t[parseInt(i.toString(),10)],n=[],o=0;o<this.model.messages.length;o++){var a=this.model.messages[parseInt(o.toString(),10)],s=Nl.getParticipantDetails(a);null!=a.id&&a.id.toString()===r.id.toString()&&null!=s&&this.stringEquals(s.sourceParticipantName,r.source)&&this.stringEquals(s.targetParticipantName,r.target)&&this.stringEquals(Nl.getAnnotation(a),r.message)&&n.push(a)}Array.prototype.push.apply(e,n)}return e},t.stringEquals=function(t,e){return t.toString().toLowerCase()===e.toString().toLowerCase()},t.getMessageFromConnectorDetails=function(t,e,i,r){return this.model.messages.find(function(n){var o=Nl.getParticipantDetails(n);return null!=n.id&&n.id.toString().toLowerCase()===t.toLowerCase()&&null!=o&&o.sourceParticipantName.toLowerCase()===e.toLowerCase()&&o.targetParticipantName.toLowerCase()===i.toLowerCase()&&Nl.getAnnotation(n).toLowerCase()===r.toLowerCase()})},t.calculateCenterYBetweenConditions=function(t,e){var i=0,r=0;if(t.altBlockDetails.connectors.length>0){var n=t.altBlockDetails.connectors[t.altBlockDetails.connectors.length-1];if(n.inFragment){i=(-1!==n.fragmentIndex?this.diagram.getObject(n.fragmentIndex.toString()+"_Fragment"):this.diagram.getObject(n.fragmentID+"_Fragment")).wrapper.bounds.bottomLeft.y}else{var o=this.getMessageFromConnectorDetails(n.id,n.source,n.target,n.message);o&&(i=o.targetPoint.y)}}if(e.altBlockDetails.connectors.length>0){var a=e.altBlockDetails.connectors[0];if(a.inFragment){r=(-1!==a.fragmentIndex?this.diagram.getObject(a.fragmentIndex.toString()+"_Fragment"):this.diagram.getObject(a.fragmentID+"_Fragment")).wrapper.bounds.topLeft.y}else{var s=this.getMessageFromConnectorDetails(a.id,a.source,a.target,a.message);s&&(r=s.targetPoint.y)}}return 0!==i&&0!==r?i+(r-i)/2:0===i&&0!==r?r-20:0===r&&0!==i?i+10:0},t.createFragmentNode=function(t,e,i){var r=this.getFragmentType(t.type),n=Math.max(i.width,this.model.maxParticipantWidth),o=i.height+this.settings.messageSpacing,a=0===t.index?t.id.toString():t.index.toString(),s=i.x+i.width/2,h=i.y+i.height/2-this.settings.messageSpacing/2,d=[this.createAnnotation(r),this.createAnnotation(e?"["+e+"]":"",30)],l=t.node;l?(l.id=a+"_Fragment",this.diagram.addLabels(l,d),this.diagram.protectPropertyChange(!0),l.width=n,l.height=o,l.offsetX=s,l.offsetY=h,l.shape={type:"Path",data:this.getGeneralFragmentShape(n,o)},this.diagram.preventNodesUpdate=!0,this.diagram.nodePropertyChange(l,{},{offsetX:l.offsetX,offsetY:l.offsetY,width:l.width,height:l.height,annotations:l.annotations},!0),this.diagram.preventNodesUpdate=!1):(t.node=new Yh(this.diagram,"nodes",{id:a+"_Fragment",annotations:d,width:n,height:o,offsetX:s,offsetY:h,shape:{type:"Path",data:this.getGeneralFragmentShape(n,o)},style:{fill:"transparent",strokeColor:"#000000",strokeWidth:1}},!0),t.node=this.diagram.add(t.node))},t.getGeneralFragmentShape=function(t,e){var i="M 0,0 L "+t+",0 L "+t+","+e+" L 0,"+e+" Z";return i+" "+i+" M 0,0 H 40 V 12 C 32 20 40 12 32 20 H 0 Z"},t.getFragmentType=function(t){switch(t){case Od.Alternative:return"alt";case Od.Loop:return"loop";case Od.Optional:return"opt";default:throw new Error("Invalid fragment type")}},t.createAnnotation=function(t,e){return void 0===e&&(e=9),{content:t,offset:{x:0,y:0},horizontalAlignment:"Left",verticalAlignment:"Top",margin:{left:9,top:e,right:5,bottom:5},style:{bold:!0}}},t}(),Jl=function(){function t(){}return t.render=function(t,e,i,r){this.diagram=t,this.model=e,this.settings=r;var n={x:i.offsetX,y:i.offsetY+e.maxParticipantHeight},o={x:n.x,y:n.y+r.initialLifelineLength},a=null;r.hideFootBox||-1!==e.destroyedParticipants.indexOf(i.id.toString())||-1!==e.destroyAtEndParticipants.indexOf(i.id.toString())||((a=this.renderFootBoxNode(i)).offsetX=o.x,a.offsetY=o.y),this.createCenterPort(i),this.createLifelineConnector(i,a,o)},t.createCenterPort=function(t){var e=new ye(this.diagram,"ports",{id:t.id+"_center_port",shape:null});this.diagram.addPorts(t,[e]),this.diagram.protectPropertyChange(!0)},t.createLifelineConnector=function(t,e,i){var r=this.lifelines.get(t.id);if(e&&e.ports&&e.ports.length>0){var n=e.ports[0];r.targetPortID=n.id,r.targetID=e.id;var o=e.height/2;r.targetPadding=-(o+n.height/2),r.targetPoint={x:e.offsetX,y:e.offsetY-o}}else r.targetPoint=i;if(t&&t.ports&&t.ports.length>0){n=t.ports[0];r.sourcePortID=n.id,r.sourceID=t.id;var a=Nl.isActor(t)?t.height/2+t.height/6:t.height/2;r.sourcePadding=a-n.height/2,r.sourcePoint={x:t.offsetX,y:t.offsetY+a}}return r.annotations=null,r.sourceDecorator={shape:"None"},r.targetDecorator={shape:"None"},r.constraints=r.constraints&~(at.DragSourceEnd|at.Delete),r},t.renderFootBoxNode=function(t){var e=new Yh(this.diagram,"nodes",{id:"FootBox_"+t.id,width:t.width,height:t.height,shape:t.shape,annotations:t.annotations,style:t.style,ports:[{id:t.id+"_center_port",shape:null}]},!0);return this.diagram.add(e)},t.updateLifelineLength=function(t,e){var i=this.lifelines.get(t.id);if(this.settings.hideFootBox)i.targetPoint={x:i.targetPoint.x,y:t.offsetY+this.model.maxParticipantHeight+e},-1!==this.model.destroyAtEndParticipants.indexOf(t.id.toString())&&-1===this.model.destroyedParticipants.indexOf(t.id.toString())&&this.updateDestroyMark(i);else{var r=i.targetID,n=t.offsetY+this.model.maxParticipantHeight+e;if(r)this.diagram.nodes.find(function(t){return t.id===r}).offsetY=n;else-1!==this.model.destroyAtEndParticipants.indexOf(t.id.toString())&&-1===this.model.destroyedParticipants.indexOf(t.id.toString())&&(i.targetPoint={x:i.targetPoint.x,y:n},this.updateDestroyMark(i))}},t.updateLifelinePosition=function(t,e){var i=this.lifelines.get(t.id),r=Nl.isActor(t)?t.height/2+t.height/6:t.height/2;i.sourcePoint={x:i.sourcePoint.x,y:e+r}},t.updateLifelineToDestroy=function(t,e,i){var r=this.lifelines.get(t.id);i+=20,r.targetPoint={x:r.targetPoint.x,y:i},this.updateDestroyMark(r)},t.updateDestroyMark=function(t){t.targetDecorator={shape:"Custom",pathData:"M 0,0 L 25,25 M 25,0 L 0,25",pivot:{x:.5,y:.5},style:{fill:"none",strokeColor:"#000000",strokeWidth:1}}},t.clearLifelines=function(){this.lifelines.clear()},t.clearPorts=function(){this.lifelines.forEach(function(t,e){t.ports=[]})},t.lifelines=new Map,t}(),$l="M4.5000001,12.548 L18.5,12.548 C20.709,12.548 22.5,14.335995 22.5,16.542004 L22.5,32.516996 19.5,32.516996 19.5,24.529997 17.5,24.529997 17.5,43.5 12.5,43.5 12.5,35.512999 C12.5,34.960997 12.052002,34.514006 11.5,34.514006 10.947998,34.514006 10.5,34.960997 10.5,35.512999 L10.5,43.5 5.4999996,43.5 5.4999996,24.529997 3.5000001,24.529997 3.5000001,32.516996 0.5,32.516996 0.5,16.542004 C0.50000012,14.335995 2.2910005,12.548 4.5000001,12.548 z M11.499001,0.5 C14.305002,0.5 16.580004,2.795001 16.580004,5.6260009 16.580004,8.4570012 14.305002,10.752001 11.499001,10.752002 8.6939994,10.752001 6.4189988,8.4570012 6.4189988,5.6260009 6.4189988,2.795001 8.6939994,0.5 11.499001,0.5 z",tc="M242,1078L231,1078L231,1067L242,1067z",ec=function(){function t(t){this.lines=[],this.activationCache=new Map,this.fragmentStack=[],this.currentCondition=null,this.diagram=t,this.sequenceDiagramModel=new Rl(t),this.sequenceDiagramModel.isLoadedFromMermaid=!0}return t.prototype.parse=function(t){this.lines=t.split(/\r?\n/).filter(function(t){return t.trim().length>0});for(var e=1;e<=this.lines.length;e++){var i=this.lines[e-1];this.parseLine(i.trim(),e)}return this.sequenceDiagramModel},t.prototype.parseLine=function(t,e){/^\s*(create|destroy)\b/i.test(t)?this.parseCreateOrDestroyMessage(t,e):/^\s*(participant|actor)\b/i.test(t)?this.parseParticipant(t):/\w+\s*(<<-{1,2}|-{1,2}>>?|<<-{1,2}>>?|-{1,2}\))\s*\w+/i.test(t)?this.parseConnector(t,e):/^(?!\s*(alt|else if|else|opt|loop|end)\b)(?!\w+\s*--?\)\s*\w+\s*:)(?=.*(?:activate|deactivate)\b|.*[+-])/i.test(t)?this.parseActivation(t,e):/^\s*(alt|else if|else|opt|loop|end)(?:\s+(.*))?/i.test(t)&&this.parseFragment(t,e)},t.prototype.parseCreateOrDestroyMessage=function(t,e){if(/^\s*create\b/i.test(t)){if(!(p=t.match(/create\s+(participant|actor)\s+(\w+)(?:\s+as\s+(.+))?/i)))return void console.warn("[WARNING] :: Invalid create syntax: '"+t+"'.");var i=p[1],r=p[3]?p[2]:null,n=p[3]||p[2],o=r||n;this.createOrGetParticipant(n,r,"actor"===i.toLowerCase());for(var a=e,s=null;a<this.lines.length&&(!(s=this.lines[parseInt(a.toString(),10)].trim())||s.startsWith("%%"));)a++;if(a<this.lines.length&&/\w+\s*(-\)|<<-{1,2}|-{1,2}>>?|<<-{1,2}>>?|\(-{1,2}\))\s*\w+\s*:\s*.+/.test(s))if(g=s.match(/(\w+)\s*(-\)|<<-{1,2}|-{1,2}>>?|<<-{1,2}>>?|\(-{1,2}\))\s*(\w+)\s*:\s*(.+)/)){var h=g[1],d=(g[2],g[3]),l=g[4];if(h.toLowerCase()===o.toLowerCase()||d.toLowerCase()===o.toLowerCase()){var c=new Co(this.diagram,"connectors",{id:(a+1).toString()},!0);Nl.addOrUpdateParticipantDetails(c,h,d,Ad.Create,o),Nl.updateAnnotation(c,l),Nl.updateConnectorStyles(c,Ad.Create.toString()),this.sequenceDiagramModel.affectedParticipants.push(o),this.sequenceDiagramModel.addMessage(c),this.registerConnectorInCondition(c,a+1)}}}else{var p;if(!(p=t.match(/destroy\s+(\w+)/i)))return void console.warn("[WARNING] :: Invalid destroy syntax: '"+t+"'.");n=p[1];if(!this.sequenceDiagramModel.participants.has(n))return void console.warn("[WARNING] :: Participant '"+n+"' not found for destroy.");var g;for(a=e,s=null;a<this.lines.length&&(!(s=this.lines[parseInt(a.toString(),10)].trim())||s.startsWith("%%"));)a++;if(a<this.lines.length&&/\w+\s*(<<-{1,2}|-{1,2}>>?|\(-{1,2}\)|<<-{1,2}>>?)\s*\w+\s*:\s*.+/.test(s))if(g=s.match(/(\w+)\s*(<<-{1,2}|-{1,2}>>?|\(-{1,2}\)|<<-{1,2}>>?)\s*(\w+)\s*:\s*(.+)/)){h=g[1],g[2],d=g[3],l=g[4];if(h.toLowerCase()===n.toLowerCase()||d.toLowerCase()===n.toLowerCase()){var u=new Co(this.diagram,"connectors",{id:(a+1).toString()},!0);Nl.addOrUpdateParticipantDetails(u,h,d,Ad.Delete,n),Nl.updateAnnotation(u,l),Nl.updateConnectorStyles(u,Ad.Delete.toString()),-1===this.sequenceDiagramModel.affectedParticipants.indexOf(n)&&this.sequenceDiagramModel.affectedParticipants.push(n),this.sequenceDiagramModel.destroyedParticipants.push(n),this.sequenceDiagramModel.addMessage(u),this.registerConnectorInCondition(u,a+1)}}}},t.prototype.parseParticipant=function(t){var e=/^(participant|actor)\s+([A-Za-z0-9._/\-\s]+?)(?:\s+as\s+(.+))?$/i.exec(t);if(e){var i=e[1],r=e[3]?e[2]:null,n=e[3]?e[3]:e[2];this.createOrGetParticipant(n,r,"actor"===i.toLowerCase())}else console.warn("[WARNING] :: Invalid participant syntax: '"+t+"'.")},t.prototype.parseConnector=function(t,e){if(!this.sequenceDiagramModel.messages.some(function(t){return t.id.toString()===e.toString()})){var i=(t=this.removeActivationSymbols(t)).match(/([\w/.\-_ ]+?)\s*(<<-{1,2}|-{1,2}>>?|\(-{1,2}\)|-{1,2}\)|<<-{1,2}>>?)\s*([\w/.\-_ ]+?)\s*:\s*(.+)/);if(i){var r=i[1],n=i[2],o=i[3],a=i[4];this.createOrGetParticipant(r),this.createOrGetParticipant(o);var s=new Co(this.diagram,"connectors",{id:e.toString()},!0);Nl.addOrUpdateParticipantDetails(s,r,o,Ad.Synchronous,null),Nl.updateAnnotation(s,a),Nl.updateConnectorStyles(s,this.getMermaidConnectorTypeFromArrow(n).toString()),this.sequenceDiagramModel.addMessage(s),this.registerConnectorInCondition(s,e)}else console.warn("[WARNING] :: Invalid connector syntax: '"+t+"'.")}},t.prototype.parseActivation=function(t,e){var i,r,n,o;if(t.startsWith("activate")||t.startsWith("deactivate")){if(!(p=t.match(/(activate|deactivate)\s+(\w+)/i)))return void console.warn("[WARNING] :: Invalid activation syntax: '"+t+"'.");var a=p[1].toLowerCase();if(i=p[2],this.createOrGetParticipant(i),e>1)for(var s=e-2;s>=0;){var h=this.lines[parseInt(s.toString(),10)].trim();if(h&&!h.startsWith("%%")){var d=h.match(/(\w+)\s*(<<-{1,2}|-{1,2}>>?|\(-{1,2}\)|-{1,2}\)|<<-{1,2}>>?)\s*(\w+)\s*:\s*(.+)/);if(d){r=d[1],n=d[3],o=d[4],e=s+2;break}s--}else s--}if("activate"===a)this.activationCache.has(i)||this.activationCache.set(i,[]),this.activationCache.get(i).push(new Hl((e-1).toString(),r,n,o,e));else if(this.activationCache.has(i)&&this.activationCache.get(i).length>0){var l=this.activationCache.get(i).pop(),c=new Yh(this.diagram,"nodes",{id:i+"_Activation_"+E(),minHeight:10,minWidth:10},!0);Nl.updateNodeShape(c,!1),this.sequenceDiagramModel.addActivation(new jl(c,i,l,new Hl((e-1).toString(),r,n,o,e))),0===this.activationCache.get(i).length&&this.activationCache.delete(i)}}else{var p;if(this.parseConnector(t,e),!(p=t.match(/(\w+)\s*(-+>|->>|-->|-->|<<->>|<<-->>|-x|--x|-\)|--\)|-x|--)>\s*(\+|-)\s*(\w+)\s*:\s*(.+)/)))return void console.warn("[WARNING] :: Invalid activation syntax: '"+t+"'.");r=p[1];var g=p[3];if(n=p[4],o=p[5],i="+"===g?n:r,this.createOrGetParticipant(r),this.createOrGetParticipant(i),"+"===g)this.activationCache.has(i)||this.activationCache.set(i,[]),this.activationCache.get(i).push(new Hl(e.toString(),r,n,o,e));else if("-"===g&&this.activationCache.has(i)&&this.activationCache.get(i).length>0){l=this.activationCache.get(i).pop(),c=new Yh(this.diagram,"nodes",{id:i+"_Activation_"+E(),minHeight:10,minWidth:10},!0);Nl.updateNodeShape(c,!1),this.sequenceDiagramModel.addActivation(new jl(c,i,l,new Hl(e.toString(),r,n,o,e))),0===this.activationCache.get(i).length&&this.activationCache.delete(i)}}},t.prototype.parseFragment=function(t,e){var i=this,r=t.match(/(alt|else|opt|loop|end)(?:\s+(.*))?/i),n=r[1].toLowerCase(),o=r[2]||null;if("end"===n){if(0===this.fragmentStack.length)return void console.warn("[WARNING] :: Unmatched 'end' found.");var a=this.fragmentStack.pop();if(null!==this.currentCondition&&(a.conditions.some(function(t){return t.content===i.currentCondition.content})||a.conditions.push(this.currentCondition),this.currentCondition=null),a.conditions.forEach(function(t){i.populateConditionAltBlockDetails(t,a)}),this.fragmentStack.length>0){var s=this.fragmentStack[this.fragmentStack.length-1];s.childFragments.push(a),s.type===Od.Alternative&&s.conditions.length>0&&s.conditions[s.conditions.length-1].nestedFragments.push(a)}else this.sequenceDiagramModel.addFragment(a)}else{var h=null;if(this.fragmentStack.length>0&&(h=this.fragmentStack[this.fragmentStack.length-1]),"alt"===n||"opt"===n||"loop"===n){var d=new Wl("",Od.Optional,[],[],null,e,this.fragmentStack.length);switch(n){case"alt":d.type=Od.Alternative;break;case"opt":d.type=Od.Optional;break;case"loop":d.type=Od.Loop}this.fragmentStack.push(d),h=d}if(h&&("alt"===n||"opt"===n||"loop"===n||"else if"===n||"else"===n)){var l=new _l(o,[],[],new Yl);h.conditions.some(function(t){return t.content===l.content})?this.currentCondition=h.conditions.find(function(t){return t.content===l.content})||null:(this.currentCondition=l,h.conditions.push(l))}}},t.prototype.populateConditionAltBlockDetails=function(t,e){for(var i=0,r=t.connectors;i<r.length;i++){var n=r[i];t.altBlockDetails.connectors.push(new Fl(n.id,n.source,n.target,n.message,-1,"",!1,-1))}t.altBlockDetails.connectors.sort(function(t,e){return parseInt(t.id,10)-parseInt(e.id,10)});for(var o=0,a=t.nestedFragments;o<a.length;o++){var s=a[o];this.addChildFragmentConnectors(t,s)}},t.prototype.addChildFragmentConnectors=function(t,e){for(var i=0,r=e.conditions;i<r.length;i++){var n=r[i];if(-1!==t.nestedFragments.indexOf(e)){for(var o=0,a=n.connectors;o<a.length;o++){var s=a[o];t.altBlockDetails.connectors.push(new Fl(s.id,s.source,s.target,s.message,-1,"",!0,e.index))}for(var h=0,d=e.childFragments;h<d.length;h++){var l=d[h];this.addChildFragmentConnectors(t,l)}}}t.altBlockDetails.connectors.sort(function(t,e){return parseInt(t.id,10)-parseInt(e.id,10)})},t.prototype.registerConnectorInCondition=function(t,e){var i=Nl.getParticipantDetails(t);if(this.currentCondition){var r=new Hl(e.toString(),i.sourceParticipantName,i.targetParticipantName,Nl.getAnnotation(t),e);this.currentCondition.connectors.push(r)}else if(this.fragmentStack.length>0){var n=this.fragmentStack[this.fragmentStack.length-1];if(n.conditions.length>0){var o=n.conditions[n.conditions.length-1];r=new Hl(e.toString(),i.sourceParticipantName,i.targetParticipantName,Nl.getAnnotation(t),e);o.connectors.push(r)}}},t.prototype.createOrGetParticipant=function(t,e,i){if(void 0===e&&(e=""),void 0===i&&(i=!1),t&&""!==t.trim()){if(!this.sequenceDiagramModel.participants.has(e||t)){var r=new Yh(this.diagram,"nodes",{id:e||t},!0);Nl.updateNodeShape(r,i),Nl.updateAnnotation(r,t,i),this.sequenceDiagramModel.addParticipant(r),e&&this.sequenceDiagramModel.addAlias(e,t)}}else console.warn("[WARNING] :: Participant name cannot be null or empty.")},t.prototype.getMermaidConnectorTypeFromArrow=function(t){switch(t){case"->":return Dd.Solid;case"--\x3e":return Dd.Dashed;case"->>":default:return Dd.SolidArrow;case"--\x3e>":return Dd.DashedArrow;case"<<->>":return Dd.Bidirectional;case"<<--\x3e>":return Dd.DashedBidirectional;case"-)":return Dd.OpenArrow;case"--)":return Dd.DashedOpenArrow}},t.prototype.removeActivationSymbols=function(t){return t.replace(/(->>\s*)(\+|-)(\s*\w+)/g,function(t,e,i,r){return e+r})},t}(),ic=function(){function t(){}return t.prototype.generateMermaidText=function(t){for(var e="sequenceDiagram\n",i=new Set(t.messages.filter(function(t){return t.type===Ad.Create}).map(function(t){return t.toParticipantID})),r=0,n=t.participants;r<n.length;r++){var o=n[r];o.id&&!i.has(o.id)&&(e+=" "+this.getParticipantContent(o)+"\n")}for(var a=this.buildActivationLookup(t.participants,!0),s=this.buildActivationLookup(t.participants,!1),h=[],d=function(i){for(var r=l.getContextChainForMessage(i.id,t.fragments);h.length>r.length;){var n=h.length,o=Array(4*n+1).join(" ");e+=o+"end\n",h.pop()}for(var d,c=0;c<h.length&&c<r.length&&h[parseInt(c.toString(),10)].fragment.id.toString()===r[parseInt(c.toString(),10)].fragment.id.toString();){if(h[parseInt(c.toString(),10)].condition.content!==r[parseInt(c.toString(),10)].condition.content){for(;h.length>c+1;){o=Array(4*h.length+1).join(" ");e+=o+"end\n",h.pop()}var p=Array(4*(c+1)+1).join(" ");e+=p+"else "+r[parseInt(c.toString(),10)].condition.content+"\n",h[parseInt(c.toString(),10)]=r[parseInt(c.toString(),10)]}c++}d=c;for(var g=h.length-1;g>=d;g--){o=Array(4*(g+1)+1).join(" ");e+=o+"end\n",h.pop()}for(g=d;g<r.length;g++){o=Array(4*(h.length+1)+1).join(" ");e+=o+l.getFragmentType(r[parseInt(g.toString(),10)].fragment.type)+" "+r[parseInt(g.toString(),10)].condition.content+"\n",h.push(r[parseInt(g.toString(),10)])}var u=Array(4*(h.length+1)+1).join(" ");if(i.toParticipantID&&i.type===Ad.Create){var f=t.participants.find(function(t){return t.id.toString()===i.toParticipantID.toString()});f&&(e+=u+"create "+l.getParticipantContent(f)+"\n")}if(i.toParticipantID&&i.type===Ad.Delete){var m=t.participants.find(function(t){return t.id.toString()===i.toParticipantID.toString()});m&&(e+=u+"destroy "+m.id+"\n")}e+=u+l.getParticipantContentByID(t,i.fromParticipantID)+l.getArrowType(i.type)+l.getParticipantContentByID(t,i.toParticipantID)+": "+i.content+"\n",e=l.handleActivationsAndDeactivations(e,i,a,s,h.length+1)},l=this,c=0,p=t.messages;c<p.length;c++){d(p[c])}for(var g=h.length-1;g>=0;g--){var u=Array(4*(g+1)+1).join(" ");e+=u+"end\n"}return e},t.prototype.getContextChainForMessage=function(t,e){for(var i=[],r=0;r<e.length;r++)for(var n=e[parseInt(r.toString(),10)],o=0;o<n.conditions.length;o++){var a=n.conditions[parseInt(o.toString(),10)];if(this.isMessageIdInCondition(a,t))return i.push({fragment:n,condition:a}),i}return i},t.prototype.isMessageIdInCondition=function(t,e){for(var i=0;i<t.messageIds.length;i++){if(t.messageIds[parseInt(i.toString(),10)].toString()===e.toString())return!0}return!1},t.prototype.handleActivationsAndDeactivations=function(t,e,i,r,n){void 0===n&&(n=1);var o=" ".repeat(4*n),a=i.get(e.id.toString());a&&a.forEach(function(e){t+=o+"activate "+e+"\n"});var s=r.get(e.id.toString());return s&&s.forEach(function(e){t+=o+"deactivate "+e+"\n"}),t},t.prototype.buildActivationLookup=function(t,e){var i=new Map;return t.forEach(function(t){t.activationBoxes.forEach(function(r){var n=(e?r.startMessageID:r.endMessageID).toString(),o=t.id.toString();i.has(n)||i.set(n,[]),i.get(n).push(o)})}),i},t.prototype.getArrowType=function(t){switch(t){case Ad.Synchronous:case Ad.Delete:return"->>";case Ad.Asynchronous:case Ad.Create:return"--\x3e";case Ad.Reply:return"--\x3e>";default:return"->>"}},t.prototype.getFragmentType=function(t){switch(t){case Od.Alternative:return"alt";case Od.Loop:return"loop";case Od.Optional:return"opt";default:throw new Error("Invalid fragment type")}},t.prototype.getParticipantContent=function(t){return(t.isActor?"actor":"participant")+" "+t.id+" as "+t.content},t.prototype.getParticipantContentByID=function(t,e){return t.participants.find(function(t){return t.id&&t.id.toString()===e.toString()}).id.toString()},t}(),rc=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),nc=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},oc=function(t,e,i,r){return new(i||(i=Promise))(function(n,o){function a(t){try{h(r.next(t))}catch(t){o(t)}}function s(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,s)}h((r=r.apply(t,e||[])).next())})},ac=function(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},sc=function(t){function r(e,i){var r,n,o=t.call(this,e,i)||this;o.version=17.1,o.checkMenu=!1,o.isServerUpdate=!1,o.oldNodeObjects=[],o.oldDiagramObject={},o.oldConnectorObjects=[],o.preventOverviewRefresh=!1,o.canEnableBlazorObject=!1,o.connectorTable={},o.groupTable={},o.scrollActions=St.None,o.blazorActions=$.Default,o.activeLabel={id:"",parentId:"",isGroup:!1,text:void 0},o.textEditing=!1,o.isTriggerEvent=!1,o.preventNodesUpdate=!1,o.preventConnectorsUpdate=!1,o.callBlazorModel=!0,o.isRowHeightUpdate=!1,o.selectionConnectorsList=[],o.deleteVirtualObject=!1,o.canLayout=!0,o.cancelPositionChange=!1,o.isRefreshed=!1,o.swimlaneChildTable={},o.swimlaneZIndexTable={},o.canExpand=!1,o.itemType="PublicMethod",o.changedConnectorCollection=[],o.changedNodesCollection=[],o.previousNodeCollection=[],o.previousConnectorCollection=[],o.crudDeleteNodes=[],o.previousSelectedObjects=[],o.blazorAddorRemoveCollection=[],o.blazorRemoveIndexCollection=[],o.diagramid=88123,o.portCenterPoint=[],o.selectedObject={helperObject:void 0,actualObject:void 0},o.deleteDependentConnector=!0,o.scaleValue=1,o.routedConnectors=[],o.pathDataStorage=new Map,o.isUndo=!1,o.connectorOrRotatedGroups=[],o.connectorFlipInProgress=!1,o.overviewObject=void 0,o.checkUndoRedo=!1,o.activeLayerObjectsSet=new Set,o.isScrollOffsetInverted=!0,o.initNodeTemplate=!1,o.tempTable={},o.deserializing=!1,o.mermaidNodeBaseCollection=[],o.bangShape="M0 0 a15.470625686645507,15.470625686645507 1 0,0 25.78437614440918,-3.7200001525878905 a15.470625686645507,15.470625686645507 1 0,0 25.78437614440918,0 a15.470625686645507,15.470625686645507 1 0,0 25.78437614440918,0 a15.470625686645507,15.470625686645507 1 0,0 25.78437614440918,3.7200001525878905 a15.470625686645507,15.470625686645507 1 0,0 15.470625686645507,12.276000503540038 a12.376500549316406,12.376500549316406 1 0,0 0,12.648000518798828 a15.470625686645507,15.470625686645507 1 0,0 -15.470625686645507,12.276000503540038 a15.470625686645507,15.470625686645507 1 0,0 -25.78437614440918,5.580000228881835 a15.470625686645507,15.470625686645507 1 0,0 -25.78437614440918,0 a15.470625686645507,15.470625686645507 1 0,0 -25.78437614440918,0 a15.470625686645507,15.470625686645507 1 0,0 -25.78437614440918,-5.580000228881835 a15.470625686645507,15.470625686645507 1 0,0 -10.313750457763673,-12.276000503540038 a12.376500549316406,12.376500549316406 1 0,0 0,-12.648000518798828 a15.470625686645507,15.470625686645507 1 0,0 10.313750457763673,-12.276000503540038 H0 V0 Z",o.cloudShape="M0 0 a16.18875045776367,16.18875045776367 0 0,1 26.981250762939453,-10.792500305175782 a37.77375106811523,37.77375106811523 1 0,1 43.17000122070313,-10.792500305175782 a26.981250762939453,26.981250762939453 1 0,1 37.77375106811523,21.585000610351564 a16.18875045776367,16.18875045776367 1 0,1 16.18875045776367,13.020000534057615 a21.585000610351564,21.585000610351564 1 0,1 -16.18875045776367,24.180000991821288 a26.981250762939453,16.18875045776367 1 0,1 -26.981250762939453,16.18875045776367 a37.77375106811523,37.77375106811523 1 0,1 -53.962501525878906,0 a16.18875045776367,16.18875045776367 1 0,1 -26.981250762939453,-16.18875045776367 a16.18875045776367,16.18875045776367 1 0,1 -10.792500305175782,-13.020000534057615 a21.585000610351564,21.585000610351564 1 0,1 10.792500305175782,-24.180000991821288 H0 V0 Z",o.renderTimer=null,o.ignoreCollectionWatch=!0;for(var a=0;e&&e.nodes&&a<e.nodes.length;a++)r=e.nodes[parseInt(a.toString(),10)],n=o.nodes[parseInt(a.toString(),10)],r.children&&r.children.length>0&&(r.style&&r.style.fill||(n.style.fill="transparent"),r.style&&r.style.strokeColor||(n.style.strokeColor="transparent")),r.shape&&"UmlActivity"===r.shape.type&&na(r,n),!r.shape||"SwimLane"!==r.shape.type&&"Container"!==r.shape.type||ta(r,n),o.nodeDefaults&&da(n,r,o.nodeDefaults),o.updateAnnotationText(n.annotations);if(e&&e.connectors)for(a=0;e&&e.connectors&&a<e.connectors.length;a++)r=e.connectors[parseInt(a.toString(),10)],n=o.connectors[parseInt(a.toString(),10)],o.connectorDefaults&&da(n,r,o.connectorDefaults),o.updateAnnotationText(n.annotations);for(a=0;e&&e.connectors&&a<e.connectors.length;a++){var s=e.connectors[parseInt(a.toString(),10)],h=o.connectors[parseInt(a.toString(),10)];s.shape&&"None"!==s.shape.type&&oa(s,h)}return o}return rc(r,t),r.prototype.updateAnnotationText=function(t){},r.prototype.clearCollection=function(t){for(var e,i=[],r=0,n=Object.keys(this.nameTable);r<n.length;r++){var o=n[r];(e=this.nameTable[""+o])&&(t&&e instanceof Co||!t&&e instanceof Yh)&&i.push(e)}this.clearObjects(i)},r.prototype.onPropertyChanged=function(e,i){var n=this;if(this.rotateUsingButton)this.rotateUsingButton=!1;else{var o=!0,a=!1,s=!1,h=void 0;if(this.diagramActions&yt.Render){for(var d=0,l=Object.keys(e);d<l.length;d++){switch(l[d]){case"width":case"height":this.element.style.width=this.getSizeValue(this.width),this.element.style.height=this.getSizeValue(this.height),this.eventHandler.updateViewPortSize(this.element);for(var c=0,p=this.views;c<p.length;c++){var g=p[c];(tt=this.views[""+g])instanceof r||tt.updateView(tt)}break;case"nodes":if(e.nodes.length>0&&0===i.nodes.length)this.clearCollection(),s=!0;else{for(var u=0,f=Object.keys(e.nodes);u<f.length;u++){var m=f[u],y=Number(m),v=this.nodes[parseInt(y.toString(),10)],b=e.nodes[parseInt(y.toString(),10)];e.nodes[parseInt(y.toString(),10)].style&&e.nodes[parseInt(y.toString(),10)].style.gradient&&(this.updateGradient(e.nodes[parseInt(y.toString(),10)],i.nodes[parseInt(y.toString(),10)],this.nodes[parseInt(y.toString(),10)]),this.nodes[parseInt(y.toString(),10)].oldGradientValue=N(e.nodes[parseInt(y.toString(),10)].style.gradient)),a=a||void 0!==b.excludeFromLayout,e.nodes[y]&&e.nodes[y].shape&&e.nodes[y].shape.textAnnotation&&""!==e.nodes[y].shape.textAnnotation.textAnnotationTarget&&(h=N(this.nameTable[v.inEdges[0]])),this.nodePropertyChange(v,i.nodes[parseInt(y.toString(),10)],b,void 0,!0,!0);var S={element:Ms(v),cause:this.diagramActions,diagramAction:this.getDiagramAction(this.diagramActions),oldValue:Ms(i.nodes[parseInt(y.toString(),10)]),newValue:Ms(e.nodes[parseInt(y.toString(),10)])};this.triggerEvent(xt.propertyChange,S),o&&(o=!1)}"Canvas"===this.mode&&this.refreshDiagramLayer()}break;case"connectors":if(e.connectors.length>0&&0===i.connectors.length)this.clearCollection(!0),s=!0;else{for(var w=0,x=Object.keys(e.connectors);w<x.length;w++){m=x[w],y=Number(m),v=this.connectors[parseInt(y.toString(),10)],b=e.connectors[parseInt(y.toString(),10)];var I={sourcePoint:{x:v.sourcePoint.x,y:v.sourcePoint.y},targetPoint:{x:v.targetPoint.x,y:v.targetPoint.y}};b&&(b.sourceDecorator||b.targetDecorator)&&(this.diagramActions|=yt.DecoratorPropertyChange),this.connectorPropertyChange(v,i.connectors[parseInt(y.toString(),10)],b,!0,!0),e.connectors[parseInt(y.toString(),10)].sourceID&&!e.connectors[parseInt(y.toString(),10)].sourcePoint&&(i.connectors[parseInt(y.toString(),10)].sourcePoint={x:I.sourcePoint.x,y:I.sourcePoint.y},e.connectors[parseInt(y.toString(),10)].sourcePoint={x:v.sourcePoint.x,y:v.sourcePoint.y}),e.connectors[parseInt(y.toString(),10)].targetID&&!e.connectors[parseInt(y.toString(),10)].targetPoint&&(i.connectors[parseInt(y.toString(),10)].targetPoint={x:I.targetPoint.x,y:I.targetPoint.y},e.connectors[parseInt(y.toString(),10)].targetPoint={x:v.targetPoint.x,y:v.targetPoint.y}),b&&(b.sourceDecorator||b.targetDecorator)&&(this.diagramActions=this.diagramActions&~yt.DecoratorPropertyChange);S={element:Ms(v),cause:this.diagramActions,diagramAction:this.getDiagramAction(this.diagramActions),oldValue:Ms(i.connectors[parseInt(y.toString(),10)]),newValue:Ms(e.connectors[parseInt(y.toString(),10)])};this.triggerEvent(xt.propertyChange,S),v&&v.parentId&&"UmlClassifier"===this.nameTable[v.parentId].shape.type&&this.updateConnectorEdges(this.nameTable[v.parentId]||v),o&&(o=!1)}this.updateBridging(),"Canvas"===this.mode&&this.refreshDiagramLayer()}break;case"bridgeDirection":this.updateBridging(),"Canvas"===this.mode&&this.refreshDiagramLayer();break;case"backgroundColor":this.intOffPageBackground();break;case"pageSettings":this.validatePageSize(),this.updatePage();break;case"selectedItems":if(e.selectedItems.userHandles&&this.selectedItems.wrapper&&this.selectedItems.userHandles&&this.selectedItems.userHandles.length>0){this.renderSelector(!0);break}if(e.selectedItems.constraints){this.renderSelector(!0);break}break;case"snapSettings":this.updateSnapSettings(e);break;case"commandManager":this.initCommands();break;case"layout":a=!0;break;case"segmentThumbShape":this.updateSelector();break;case"dataSourceSettings":this.clear(),"None"===this.layout.type?s=!0:(this.initObjects(),a=!0);break;case"tooltip":de(this);break;case"rulerSettings":this.updateRulerSettings(e);break;case"layers":this.updateLayer(e);break;case"scrollSettings":this.scrollActions|=St.PropertyChange,this.updateScrollSettings(e,i),this.scrollActions&=~St.PropertyChange;break;case"locale":e.locale!==i.locale&&t.prototype.refresh.call(this);break;case"contextMenuSettings":if(void 0!==e.contextMenuSettings.showCustomMenuOnly&&(this.contextMenuSettings.showCustomMenuOnly=e.contextMenuSettings.showCustomMenuOnly),void 0!==e.contextMenuSettings.show&&(this.contextMenuSettings.show=e.contextMenuSettings.show),e.contextMenuSettings.items){for(var P=e.contextMenuSettings.items,C=0,T=Object.keys(P);C<T.length;C++){m=T[C],y=Number(m);this.contextMenuSettings.items[parseInt(y.toString(),10)]=P[parseInt(y.toString(),10)]}this.contextMenuModule?this.contextMenuModule.refreshItems():console.warn('[WARNING] :: Module "DiagramContextMenu" is not available in Diagram component! You either misspelled the module name or forgot to load it.')}break;case"serializationSettings":void 0!==e.serializationSettings.preventDefaults&&(this.serializationSettings.preventDefaults=e.serializationSettings.preventDefaults);break;case"tool":this.eventHandler.updateTool();break;case"constraints":(e.constraints&ct.LineRouting)===(i.constraints&ct.LineRouting)&&(e.constraints&ct.AvoidLineOverlapping)===(i.constraints&ct.AvoidLineOverlapping)||this.resetSegments()}}if(a&&!s){if(i.layout&&"DifferentPoint"===i.layout.connectionPointOrigin&&"SamePoint"===e.layout.connectionPointOrigin||i.layout&&e.layout&&!e.layout.enableRouting&&i.layout.enableRouting){for(var A=0;A<this.nodes.length;A++){var O=this.nodes[parseInt(A.toString(),10)];if(O.ports&&O.ports.length>0){for(var D=[],M=O.ports.length-1;M>=0;M--)"LineDistribution"===O.ports[parseInt(M.toString(),10)].id.split("_")[1]&&D.push(O.ports[parseInt(M.toString(),10)]);this.removePorts(O,D)}}for(M=0;M<this.connectors.length;M++){var L=this.connectors[parseInt(M.toString(),10)],E=L.sourcePortID,z=L.targetPortID;L.sourcePortID="",L.targetPortID="",L.sourcePortWrapper=void 0,L.targetPortWrapper=void 0,L.segments=[],this.connectorPropertyChange(L,{sourcePortID:E,targetPortID:z},{sourcePortID:"",targetPortID:""})}}this.doLayout(),this.renderReactTemplates()}if(o&&this.propertyChange){S={element:this,cause:this.diagramActions,diagramAction:this.getDiagramAction(this.diagramActions),oldValue:i,newValue:e};this.triggerEvent(xt.propertyChange,S)}if(!s&&this.canLogChange()&&this.modelChanged(e,i)){var k,B=[],R=[],j=void 0,H=void 0;if(e.nodes&&Object.keys(e.nodes).length>0)for(var W=0,_=Object.keys(e.nodes);W<_.length;W++){m=_[W];if(j=parseInt(m,10),B.push(this.nodes[parseInt(j.toString(),10)].id),e.nodes[parseInt(j.toString(),10)]&&e.nodes[parseInt(j.toString(),10)].shape&&e.nodes[parseInt(j.toString(),10)].shape.lanes)for(var Y=0,F=Object.keys(e.nodes[parseInt(j.toString(),10)].shape.lanes);Y<F.length;Y++){var X=F[Y];H=parseInt(X,10)}}if(e.connectors&&Object.keys(e.connectors).length>0)for(var V=0,U=Object.keys(e.connectors);V<U.length;V++){m=U[V];var G=parseInt(m,10);R.push(this.connectors[parseInt(G.toString(),10)].id)}if(k=B.concat(R),0===R.filter(function(t){return n.nameTable[""+t].isBpmnAnnotationConnector}).length)if(e.nodes&&e.nodes[j]&&e.nodes[j].shape&&e.nodes[j].shape.textAnnotation&&""!==e.nodes[j].shape.textAnnotation.textAnnotationTarget){var Z=this.nameTable[this.nodes[parseInt(j.toString(),10)].inEdges[0]];this.startGroupAction();var q={type:"ConnectionChanged",undoObject:h,redoObject:N(Z),category:"Internal"},Q={type:"PropertyChanged",undoObject:i,redoObject:e,category:"Internal"};this.historyManager&&(this.addHistoryEntry(q),this.addHistoryEntry(Q,k)),this.endGroupAction()}else{Q={type:"PropertyChanged",undoObject:i,redoObject:e,category:"Internal"};this.historyManager&&!this.isRowHeightUpdate&&(this.addHistoryEntry(Q,k),e.nodes&&e.nodes[j]&&e.nodes[j].shape&&e.nodes[j].shape.lanes&&e.nodes[j].shape.lanes[H]&&e.nodes[j].shape.lanes[H].children&&!(this.diagramActions&yt.UndoRedo)&&this.endGroupAction()),this.isRowHeightUpdate=!1}}this.resetDiagramActions(),s&&(this.initObjects(!0),this.refreshDiagramLayer(),a&&this.doLayout());var K=1===Object.keys(e).length&&void 0!==e.scrollSettings;if(!s)for(var J=0,$=this.views;J<$.length;J++){var tt=$[J];(g=this.views[""+tt])instanceof r||(e.scrollSettings&&(e.scrollSettings.currentZoom,i.scrollSettings.currentZoom),K||this.refreshCanvasDiagramLayer(g))}}}},r.prototype.updateSnapSettings=function(t){(void 0!==t.snapSettings.constraints||t.snapSettings.horizontalGridlines||t.snapSettings.verticalGridlines||t.snapSettings.gridType)&&this.diagramRenderer.updateGrid(this.snapSettings,dd(this.element.id),this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler)},r.prototype.updateGradient=function(t,e,i){if(i.oldGradientValue)for(var r=i,n=i,o=e.style.gradient,a=e.style.gradient,s=0,h=Object.keys(t.style.gradient);s<h.length;s++){switch(h[s]){case"type":r.type&&(o.type=r.type);break;case"x1":r.x1&&(o.x1=r.x1);break;case"x2":r.x2&&(o.x2=r.x2);break;case"y1":r.y1&&(o.y1=r.y1);break;case"y2":r.y2&&(o.y2=r.y2);break;case"cx":n.cx&&(a.cx=n.cx);break;case"cy":n.cy&&(a.cy=n.cy);break;case"fx":n.fx&&(a.fx=n.fx);break;case"fy":n.fy&&(a.fy=n.fy);break;case"r":n.r&&(a.r=n.r);break;case"stops":if(i.oldGradientValue.stops){var d=Object.values(N(i.oldGradientValue.stops));d.pop(),e.style.gradient.stops=d}}}},r.prototype.updateRulerSettings=function(t){void 0!==t.rulerSettings.dynamicGrid&&this.diagramRenderer.updateGrid(this.snapSettings,dd(this.element.id),this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler),void 0!==t.rulerSettings.showRulers?(this.intOffPageBackground(),this.scroller.setSize(),this.renderRulers()):void 0===t.rulerSettings.horizontalRuler&&void 0===t.rulerSettings.verticalRuler||(void 0!==t.rulerSettings.horizontalRuler.thickness||void 0!==t.rulerSettings.verticalRuler.thickness?(Lo(this),this.intOffPageBackground(),this.scroller.setSize(),this.renderRulers()):Mo(this)),this.diagramRenderer.updateGrid(this.snapSettings,dd(this.element.id),this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler)},r.prototype.getPersistData=function(){return this.addOnPersist(["loaded"])},r.prototype.preRender=function(){this.initializePrivateVariables(),this.isProtectedOnChange=!0,this.serviceLocator=new Nd,this.initializeServices(),this.setCulture();var t="measureElement";window[""+t]&&(window[""+t]=null),this.initDiagram(),this.initViews(),this.unWireEvents(),this.wireEvents(),this.element.classList.add("e-diagram")},r.prototype.initializePrivateVariables=function(){if(""===this.element.id){var t=document.getElementsByClassName("e-diagram").length;this.element.id="diagram_"+this.diagramid+"_"+t}this.defaultLocale={Copy:"Copy",Cut:"Cut",Paste:"Paste",Undo:"Undo",Redo:"Redo",SelectAll:"Select All",Grouping:"Grouping",Group:"Group",UnGroup:"Un Group",Order:"Order",BringToFront:"Bring To Front",MoveForward:"Move Forward",SendToBack:"Send To Back",SendBackward:"Send Backward"},this.layerZIndex=-1,this.layerZIndexTable={},void 0===this.swimlaneChildTable&&void 0===this.swimlaneZIndexTable&&(this.swimlaneChildTable={},this.swimlaneZIndexTable={}),this.activeLayerObjectsSet||(this.activeLayerObjectsSet=new Set),this.isScrollOffsetInverted||(this.isScrollOffsetInverted=!0),this.connectorOrRotatedGroups||(this.connectorOrRotatedGroups=[]),this.refreshing&&!this.deserializing&&this.nodes.some(function(t){return"SwimLane"===t.shape.type})&&(this.getSwimlaneChildTable(),this.removeSwimlaneChildOnRefresh()),this.nameTable={},this.pathTable={},this.groupTable={},this.commands={},this.isLoading||(this.views=[]),this.commandHandler=new ul(this),this.eventHandler=new al(this,this.commandHandler),this.spatialSearch=new yl(this.nameTable),this.scroller=new fl(this)},r.prototype.removeSwimlaneChildOnRefresh=function(){La(Ma(this.nodes),this),this.nodes.forEach(function(t){var e=t.shape;if(e&&e.lanes&&e.lanes.length>0){var i=t.offsetX-t.wrapper.actualSize.width/2,r=t.offsetY-t.wrapper.actualSize.height/2,n="Vertical"===e.orientation;n&&"Vertical"===e.orientation&&(r+=e.header&&e.hasHeader?e.header.height:0),e.lanes.forEach(function(t){t.children&&t.children.length>0&&t.children.forEach(function(t){var e=t.wrapper.offsetX-t.width/2,o=t.wrapper.offsetY-t.height/2;n?t.margin.top=o-r:t.margin.left=e-i})})}})},r.prototype.initializeServices=function(){this.serviceLocator.register("localization",this.localeObj=new e.L10n(this.getModuleName(),this.defaultLocale,this.locale))},r.prototype.setCulture=function(){this.localeObj=new e.L10n(this.getModuleName(),this.defaultLocale,this.locale)},r.prototype.getSwimlaneChildTable=function(){for(var t,e,i=[],r=0;r<this.nodes.length;r++)if("SwimLane"===(t=this.nodes[parseInt(r.toString(),10)]).shape.type){e=t.wrapper.children[0].childTable;for(var n=0,o=Object.keys(e);n<o.length;n++){i=Da(e[""+o[n]],i)}for(var a=0;a<i.length;a++)this.nameTable[i[parseInt(a.toString(),10)]]&&(this.swimlaneChildTable[i[parseInt(a.toString(),10)]]=this.nameTable[i[parseInt(a.toString(),10)]].zIndex);this.swimlaneZIndexTable[t.id]=t.zIndex}},r.prototype.render=function(){if(this.refreshing&&this.dataSourceSettings.dataSource&&!this.isLoading&&(this.nodes=[],this.connectors=[]),!this.refreshing){var t={diagram:this,name:"load"};this.trigger("load",t)}this.isRefreshed=!1,this.ignoreCollectionWatch=!0;window.domTable={};var i=[];this.dataSourceSettings.crudAction.read&&this.renderInitialCrud(),this.initHistory(),this.diagramRenderer=new Go(this.element.id,new Uo,"SVG"===this.mode),this.initLayers(),this.initializeDiagramLayers(),this.diagramRenderer.setLayers(),this.initObjects(!0);for(var r=this.nodes,n=0;n<r.length;n++)r[parseInt(n.toString(),10)].isExpanded||i.push(r[parseInt(n.toString(),10)]);if(i.length)for(n=i.length-1;n>=0;n--)0===n?this.commandHandler.expandNode(i[parseInt(n.toString(),10)],this,!1):this.commandHandler.expandNode(i[parseInt(n.toString(),10)],this,!0);if(this.canLayout&&this.doLayout(),this.updateFromModel(),this.lineRoutingModule){this.lineRoutingModule.lineRouting(this)}else this.constraints&ct.LineRouting&&console.warn('[WARNING] :: Module "LineRouting" is not available in Diagram component! You either misspelled the module name or forgot to load it.');this.validatePageSize(),this.renderPageBreaks(),this.diagramRenderer.renderSvgGridlines(this.snapSettings,dd(this.element.id),this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler),this.commandHandler.initSelectorWrapper(),this.notify("initial-load",{}),this.trigger("load"),this.scroller.setSize(),this.scroller.updateScrollOffsets(),this.isRefreshed||this.refreshDiagramLayer(),(this.scrollSettings.verticalOffset>0||this.scrollSettings.horizontalOffset>0)&&this.updateScrollOffset(),e.Browser.isDevice&&(this.tool=pt.ZoomPan|pt.SingleSelect),this.notify("initial-end",{}),this.isProtectedOnChange=!1,this.tooltipObject=de(this),this.diagramActions=yt.Render,this.initCommands();var o=document.getElementsByClassName(this.element.id+"_hiddenUserHandleTemplate");!function(t,e,i,r){var n,o,a,s,h,d=document.getElementById(r).ej2_instances[0];if(t&&e){n=k(t);for(var l=0,c=i.userHandles;l<c.length;l++)if(o=c[l],n){for(a=n(N(o),d,"userHandleTemplate_"+o.name,void 0,void 0,!1),s=0;s<a.length;s++)(h=ud("div",{style:"height: 100%; width: 100%; pointer-events: all",id:o.name+"_template_hiddenUserHandle"})).appendChild(a[s]);e[0].appendChild(h)}}}(this.userHandleTemplate,o,this.selectedItems,this.element.id),this.isLoading=!1,this.refreshRoutingConnectors(),this.renderComplete(),this.updateFitToPage(),this.refreshing&&(this.renderReactTemplates(),this.updateViews())},r.prototype.updateViews=function(){this.overviewObject&&this.overviewObject.view&&this.overviewObject.view instanceof Qo&&this.overviewObject.view.setParent(this.element.id)},r.prototype.updateFitToPage=function(){this.pageSettings&&this.pageSettings.fitOptions&&this.pageSettings.fitOptions.canFit&&this.fitToPage(this.pageSettings.fitOptions)},r.prototype.updateTemplate=function(){},r.prototype.renderInitialCrud=function(){var t,i=this;i.dataSourceSettings.crudAction.read&&((t=new e.Fetch(i.dataSourceSettings.crudAction.read,"GET")).onSuccess=function(t){i.dataSourceSettings.dataManager?i.dataSourceSettings.dataManager=JSON.parse(t):i.dataSourceSettings.dataSource=JSON.parse(t),i.dataBind()},t.send().then());i.dataSourceSettings.connectionDataSource.crudAction.read&&((t=new e.Fetch(i.dataSourceSettings.connectionDataSource.crudAction.read,"GET")).onSuccess=function(t){i.dataSourceSettings.connectionDataSource.dataManager=JSON.parse(t),i.dataBind()},t.send().then())},r.prototype.getModuleName=function(){return"diagram"},r.prototype.getClassName=function(){return"Diagram"},r.prototype.requiredModules=function(){var t=[];return t.push({member:"Bpmn",args:[]}),t.push({member:"Bridging",args:[]}),t.push({member:"ConnectorEditingTool",args:[]}),this.constraints&ct.UndoRedo&&t.push({member:"UndoRedo",args:[]}),("OrganizationalChart"===this.layout.type||"HierarchicalTree"===this.layout.type||this.layout.enableAnimation)&&t.push({member:"LayoutAnimate",args:[]}),this.snapSettings.constraints&&t.push({member:"Snapping",args:[this]}),t.push({member:"Ej1Serialization",args:[this]}),t.push({member:"PrintandExport",args:[this]}),this.contextMenuSettings.show&&t.push({member:"contextMenu",args:[this,this.serviceLocator]}),"OrganizationalChart"!==this.layout.type&&"HierarchicalTree"!==this.layout.type||t.push({member:"OrganizationalChart",args:[this]}),"ComplexHierarchicalTree"===this.layout.type&&t.push({member:"ComplexHierarchicalTree",args:[]}),"MindMap"===this.layout.type&&t.push({member:"MindMapChart",args:[]}),"RadialTree"===this.layout.type&&t.push({member:"RadialTree",args:[]}),"SymmetricalLayout"===this.layout.type&&t.push({member:"SymmetricalLayout",args:[]}),"Flowchart"===this.layout.type&&t.push({member:"FlowchartLayout",args:[]}),(this.dataSourceSettings.dataManager||this.dataSourceSettings.dataSource||this.dataSourceSettings.crudAction.read||this.dataSourceSettings.connectionDataSource.crudAction.read)&&t.push({member:"DataBinding",args:[]}),this.constraints&ct.LineRouting&&t.push({member:"LineRouting",args:[]}),this.constraints&ct.AvoidLineOverlapping&&t.push({member:"AvoidLineOverlapping",args:[this]}),(this.layout&&("ComplexHierarchicalTree"===this.layout.type||"HierarchicalTree"===this.layout.type)||"Linear"===this.layout.arrangement||this.layout.enableRouting)&&t.push({member:"LineDistribution",args:[]}),t},r.prototype.removeUserHandlesTemplate=function(){if(this.selectedItems.userHandles.length)for(var t=0;t<this.selectedItems.userHandles.length;t++)for(var e=0,i=this.views;e<i.length;e++){var r=i[e];bd(this.selectedItems.userHandles[parseInt(t.toString(),10)].name+"_template_hiddenUserHandle",r)}},r.prototype.destroy=function(){if(clearInterval(this.renderTimer),this.renderTimer=null,this.hRuler&&this.vRuler&&(this.hRuler.destroy(),this.vRuler.destroy()),this.tooltipObject.destroy(),this.droppable.destroy(),this.unWireEvents(),this.notify("destroy",{}),t.prototype.destroy.call(this),this.removeUserHandlesTemplate(),this.clearTemplate(),document.getElementById(this.element.id)){this.element.classList.remove("e-diagram");for(var e=document.getElementsByClassName("e-diagram-tooltip");e.length>0;)e[0].parentNode.removeChild(e[0]);var i=document.getElementById(this.element.id+"content");i&&this.element.removeChild(i);var r="measureElement";if(window[""+r]){window[""+r].usageCount-=1;var n="measureElementCount";window[""+n]--,0===window[""+n]&&(window[""+r].parentNode.removeChild(window[""+r]),window[""+r]=null)}Kh={}}window.domTable={};for(var o=0;o<this.layers.length;o++){this.layers[parseInt(o.toString(),10)].zIndexTable={}}this.diagramActions=void 0},r.prototype.wireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchEndEvent,r=e.Browser.touchMoveEvent,n=e.Browser.isPointer?"pointerleave":"mouseleave",o=e.Browser.isPointer,a="mozilla"===e.Browser.info.name?o?"mousewheel":"DOMMouseScroll":"mousewheel";e.EventHandler.add(this.diagramCanvas,t,this.eventHandler.mouseDown,this.eventHandler),e.EventHandler.add(this.diagramCanvas,r,this.eventHandler.mouseMove,this.eventHandler),e.EventHandler.add(this.diagramCanvas,i,this.eventHandler.mouseUp,this.eventHandler),e.EventHandler.add(this.diagramCanvas,n,this.eventHandler.mouseLeave,this.eventHandler),e.EventHandler.add(this.diagramCanvas,"keydown",this.eventHandler.keyDown,this.eventHandler),e.EventHandler.add(this.diagramCanvas,"keyup",this.eventHandler.keyUp,this.eventHandler),e.EventHandler.add(this.diagramCanvas,"dblclick",this.eventHandler.doubleClick,this.eventHandler),e.EventHandler.add(this.diagramCanvas,"scroll",this.eventHandler.scrolled,this.eventHandler),e.EventHandler.add(this.diagramCanvas,a,this.eventHandler.mouseWheel,this.eventHandler),e.EventHandler.add(window,"resize",this.eventHandler.windowResize,this.eventHandler),this.initDroppables()},r.prototype.unWireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchMoveEvent,r=e.Browser.isPointer?"pointerleave":"mouseleave",n=e.Browser.isPointer,o="mozilla"===e.Browser.info.name?n?"mousewheel":"DOMMouseScroll":"mousewheel",a=e.Browser.touchEndEvent;e.EventHandler.remove(this.diagramCanvas,t,this.eventHandler.mouseDown),e.EventHandler.remove(this.diagramCanvas,i,this.eventHandler.mouseMove),e.EventHandler.remove(this.diagramCanvas,a,this.eventHandler.mouseUp),e.EventHandler.remove(this.diagramCanvas,r,this.eventHandler.mouseLeave),e.EventHandler.remove(this.diagramCanvas,"keydown",this.eventHandler.keyDown),e.EventHandler.remove(this.diagramCanvas,"keyup",this.eventHandler.keyUp),e.EventHandler.remove(this.diagramCanvas,"dblclick",this.eventHandler.doubleClick),e.EventHandler.remove(this.diagramCanvas,"scroll",this.eventHandler.scrolled),e.EventHandler.remove(this.diagramCanvas,o,this.eventHandler.mouseWheel),e.EventHandler.remove(window,"resize",this.eventHandler.windowResize)},r.prototype.select=function(t,e,i){null!=t&&this.commandHandler.selectObjects(t,e,i)},r.prototype.getDiagramAction=function(t){var e;return 2===t&&yt.Render?e="Render":t&yt.UndoRedo?e="UndoRedo":t&yt.PublicMethod?e="PublicMethod":t&yt.ToolAction?e="ToolAction":t&yt.TextEdit?e="TextEdit":t&yt.Group?e="Group":t&yt.Interactions?e="Interactions":t&yt.PreventHistory?e="PreventHistory":t&yt.DecoratorPropertyChange?e="DecoratorPropertyChange":t&yt.PreventZIndexOnDragging?e="PreventZIndexOnDragging":t&yt.isGroupDragging?e="isGroupDragging":t&yt.DragUsingMouse&&(e="DragUsingMouse"),e},r.prototype.selectAll=function(){var t;t=this.getObjectsOfLayer(this.activeLayer.objects),this.select(t)},r.prototype.unSelect=function(t){t&&Dn(this,t)&&this.commandHandler.unSelect(t)},r.prototype.clearSelection=function(){this.commandHandler.clearSelection(!0)},r.prototype.updateViewPort=function(){var t=this.getZoomingAttribute();this.updateBlazorDiagramProperties(t),this.eventHandler.updateViewPortSize(this.element),this.updateBlazorDiagramProperties(t,!0)},r.prototype.cutCommand=function(){this.cut(),this.itemType="PublicMethod"},r.prototype.cut=function(){this.commandHandler.cut()},r.prototype.addProcess=function(t,e){this.bpmnModule&&this.bpmnModule.addProcess(t,e,this)},r.prototype.removeProcess=function(t){this.bpmnModule&&this.bpmnModule.removeProcess(t,this)},r.prototype.pasteCommand=function(){this.paste()},r.prototype.paste=function(t){this.commandHandler.paste(t)},r.prototype.fitToPage=function(t){var e=this.getZoomingAttribute();this.updateBlazorDiagramProperties(e),this.scroller.fitToPage(t),this.updateBlazorDiagramProperties(e,!0)},r.prototype.bringIntoView=function(t){var e=this.getZoomingAttribute();this.updateBlazorDiagramProperties(e),this.scroller.bringIntoView(t,!0),this.updateBlazorDiagramProperties(e,!0)},r.prototype.bringToCenter=function(t){var e=this.getZoomingAttribute();this.updateBlazorDiagramProperties(e),this.scroller.bringToCenter(t),this.updateBlazorDiagramProperties(e,!0)},r.prototype.copyCommand=function(){this.copy()},r.prototype.copy=function(){return this.commandHandler.copy()},r.prototype.group=function(){this.selectedItems.nodes.concat(this.selectedItems.connectors).length>1&&(this.callBlazorModel=!1,this.insertBlazorDiagramObjects(this.selectedItems),this.commandHandler.group(),this.callBlazorModel=!0,this.commandHandler.getBlazorOldValues())},r.prototype.unGroup=function(){this.callBlazorModel=!1,this.insertBlazorDiagramObjects(this.selectedItems),this.commandHandler.unGroup(),this.callBlazorModel=!0,this.commandHandler.getBlazorOldValues()},r.prototype.sendToBack=function(){this.commandHandler.sendToBack()},r.prototype.setActiveLayer=function(t){var e=this.commandHandler.getLayer(t);this.activeLayer=e;var i=e.objects;this.activeLayerObjectsSet.clear();for(var r=0,n=i;r<n.length;r++){var o=n[r];this.activeLayerObjectsSet.add(o)}},r.prototype.addLayer=function(t,e){this.commandHandler.addLayer(t,e)},r.prototype.removeLayer=function(t){this.commandHandler.removeLayer(t,(0,e.isBlazor)())},r.prototype.moveObjects=function(t,e){N(this.layers);this.enableServerDataBinding(!1),this.commandHandler.moveObjects(t,e)},r.prototype.layerObjectUpdate=function(){},r.prototype.sendLayerBackward=function(t){this.layerObjectUpdate(),this.commandHandler.sendLayerBackward(t)},r.prototype.bringLayerForward=function(t){this.layerObjectUpdate(),this.commandHandler.bringLayerForward(t)},r.prototype.cloneLayer=function(t){this.commandHandler.cloneLayer(t)},r.prototype.bringToFront=function(){this.commandHandler.bringToFront()},r.prototype.moveForward=function(){this.commandHandler.sendForward()},r.prototype.sendBackward=function(){this.commandHandler.sendBackward()},r.prototype.getObject=function(t){return this.nameTable[""+t]},r.prototype.getNodeObject=function(t){return N(this.nameTable[""+t])},r.prototype.getConnectorObject=function(t){return N(this.nameTable[""+t])},r.prototype.getActiveLayer=function(){return this.activeLayer},r.prototype.nudgeCommand=function(t,e,i){if(this.eventHandler.keyArgs&&void 0!==this.eventHandler.keyArgs.keyModifiers&&0!==this.eventHandler.keyArgs.keyModifiers)return null;if("object"!=typeof t&&(this.selectedItems.nodes.length||this.selectedItems.connectors.length)>0){var r=void 0;e.type&&"KEYDOWN"===e.type&&(r=e.type),this.nudge(t,void 0,void 0,r)}},r.prototype.nudge=function(t,e,i,r){var n=0,o=0;"Left"===t||"Right"===t?n=("Left"===t?-1:1)*(e||1):o=("Up"===t?-1:1)*(i||1),"KEYDOWN"===r&&(n*=5,o*=5),this.restrictedDeltaValue={x:0,y:0};var a=this.selectedItems,s=this.selectedItems.wrapper.children[0];if(s instanceof Zt)this.commandHandler.labelDrag(a.nodes[0],s,n,o);else{var h=N(this.selectedItems);this.protectPropertyChange(!0),this.drag(a,n,o),this.protectPropertyChange(!1);var d={type:"PositionChanged",redoObject:N(this.selectedItems),undoObject:h,category:"Internal"};this.addHistoryEntry(d)}this.refreshCanvasLayers()},r.prototype.insertBlazorDiagramObjects=function(t){},r.prototype.drag=function(t,e,r){if(this.insertBlazorDiagramObjects(t),this.bpmnModule&&t instanceof Yh&&(!this.nameTable[t.parentId]||"Container"!==this.nameTable[t.parentId].shape.type)){if(this.bpmnModule.updateAnnotationDrag(t,this,e,r))return}else if(t instanceof Yh&&this.nameTable[t.parentId]&&"Container"===this.nameTable[t.parentId].shape.type)return void function(t,e,r,n){var o=e.nameTable[t.parentId],a=0;o.shape.hasHeader&&(a=o.shape.header.height);var s={top:t.margin.top+n-a>=0?t.margin.top+n:t.margin.top,left:t.margin.left+r>=0?t.margin.left+r:t.margin.left};s.top===t.margin.top&&s.left===t.margin.left||e.nodePropertyChange(t,{},{margin:s}),nh(o,t.id,e),oh(0,t,e,!0),o.wrapper.measure(new i(void 0,void 0)),o.wrapper.arrange(o.wrapper.desiredSize),e.updateSelector(),ah(o,e)}(t,this,e,r);if((t instanceof qh&&t.wrapper||t&&"helper"===t.id&&t.wrapper)&&this.constraints&ct.RestrictNegativeAxisDragDrop){var n=t.wrapper.bounds;if(n){if(this.restrictedDeltaValue.x>0&&(this.restrictedDeltaValue.x-=e,this.restrictedDeltaValue.x>0?e=0:(e=-1*this.restrictedDeltaValue.x,this.restrictedDeltaValue.x=0)),this.restrictedDeltaValue.y>0&&(this.restrictedDeltaValue.y-=r,this.restrictedDeltaValue.y>0?r=0:(r=-1*this.restrictedDeltaValue.y,this.restrictedDeltaValue.y=0)),n.x+e<0){var o=-(n.x+e);this.restrictedDeltaValue.x+=o,e+=o}if(n.y+r<0){var a=-(n.y+r);this.restrictedDeltaValue.y+=a,r+=a}}}if(t instanceof qh){if(this.preventConnectorsUpdate=!0,t.nodes&&t.nodes.length){for(var s=0,h=t.nodes;s<h.length;s++){var d=h[s];if(this.callBlazorModel=!1,this.drag(d,e,r),d.parentId){var l=this.nameTable[d.parentId];if(l.isLane)t.nodes.length>1&&(this.preventConnectorsUpdate=!1),wn(l,this.nameTable[l.parentId],d,this)}}this.callBlazorModel=!0}if(t.connectors&&t.connectors.length){this.callBlazorModel=!1;for(var c=0,p=t.connectors;c<p.length;c++){var g=p[c];this.drag(g,e,r),-1===this.selectionConnectorsList.indexOf(g)&&this.selectionConnectorsList.push(g)}this.callBlazorModel=!0}this.updateSelector(),this.diagramActions&yt.DragUsingMouse&&this.updatePage()}else t instanceof Yh&&this.bpmnModule&&this.bpmnModule.updateAnnotationDrag(t,this,e,r),this.commandHandler.drag(t,e,r);if(t instanceof qh){this.preventConnectorsUpdate=!1;for(var u=0,f=this.selectionConnectorsList;u<f.length;u++){var m=f[u];this.updateConnectorProperties(this.nameTable[m.id]),"Bpmn"===m.shape.type&&"Default"===m.shape.sequence&&"Sequence"===m.shape.flow&&this.commandHandler.updatePathElementOffset(m)}this.selectionConnectorsList=[]}!this.callBlazorModel||this.blazorActions&$.interaction||this.blazorActions&$.GroupClipboardInProcess||this.commandHandler.getBlazorOldValues(),t&&t.shape&&"Container"===t.shape.type&&this.updateChildOffset(t,e,r)},r.prototype.updateChildOffset=function(t,e,i){var r=this,n=t.shape.children;!n||n.length<1||n.forEach(function(t){var n=r.nameTable[""+t];n&&n.shape&&("Container"===n.shape.type&&r.updateChildOffset(n,e,i),n.offsetX+=e,n.offsetY+=i)})},r.prototype.disableStackContainerPadding=function(t,e){if(t instanceof Us&&(t.considerPadding=e),t.children)for(var i=0,r=t.children;i<r.length;i++){var n=r[i];this.disableStackContainerPadding(n,!1)}},r.prototype.checkSize=function(t,e,i){if(!t||!t.wrapper||!t.wrapper.bounds)return!0;if(t.constraints&&t.constraints&ht.AspectRatio)return!0;var r=t.wrapper.bounds,n=r.width*e,o=r.height*i;if(void 0!==t.minWidth&&n<t.minWidth||void 0!==t.minHeight&&o<t.minHeight||void 0!==t.maxWidth&&n>t.maxWidth||void 0!==t.maxHeight&&o>t.maxHeight)return!1;if(t.children&&t.children.length>0)for(var a=0,s=t.children;a<s.length;a++){var h=s[a],d=this.nameTable[""+h];if(d&&!this.checkSize(d,e,i))return!1}return!0},r.prototype.scale=function(t,e,i,r){this.disableStackContainerPadding(t.wrapper,!1),this.insertBlazorDiagramObjects(t);var n=!0;if(t.id&&(t=this.nameTable[t.id]||t),(t instanceof qh&&t.wrapper||t&&"helper"===t.id&&t.wrapper)&&this.constraints&ct.RestrictNegativeAxisDragDrop){var o=t.wrapper.bounds;if(o){var a=t.wrapper,s=ys(a.offsetX-a.actualSize.width*a.pivot.x,a.offsetY-a.actualSize.height*a.pivot.y,a.actualSize.width,a.actualSize.height,a.rotateAngle,a.offsetX,a.offsetY,r),h=I();T(h,-t.rotateAngle,s.x,s.y),A(h,e,i,s.x,s.y),T(h,t.rotateAngle,s.x,s.y);var d={x:o.x+.5*o.width,y:o.y+.5*o.height},l=P(h,d);if(t.rotateAngle%360==0){var c=l.x-o.width*e*.5;c<0&&(e=Math.round(o.width*e+c)/o.width);var p=l.y-o.height*i*.5;p<0&&(i=Math.round(o.height*i+p)/o.height)}else{var g=[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x,y:o.y+o.height},{x:o.x+o.width,y:o.y+o.height}].map(function(t){return P(h,t)}),u=Math.min.apply(Math,g.map(function(t){return t.x})),f=Math.min.apply(Math,g.map(function(t){return t.y}));(u<0||f<0)&&(e=1,i=1)}}}if(t instanceof qh){if(t.nodes&&t.nodes.length){this.callBlazorModel=!1;for(var m=0,y=t.nodes;m<y.length;m++){var v=y[m];if(!this.checkSize(v,e,i))return!1}for(var b=0,S=t.nodes;b<S.length;b++){v=S[b];n=this.commandHandler.scale(v,e,i,r,t),this.commandHandler.checkBoundaryConstraints(void 0,void 0,t.wrapper.bounds)||this.commandHandler.scale(v,1/e,1/i,r,t)}this.callBlazorModel=!0}if(t.connectors&&t.connectors.length){this.callBlazorModel=!1;for(var w=0,x=t.connectors;w<x.length;w++){var C=x[w];this.commandHandler.scale(C,e,i,r,t),this.commandHandler.checkBoundaryConstraints(void 0,void 0,t.wrapper.bounds)||this.commandHandler.scale(C,1/e,1/i,r,t)}this.callBlazorModel=!0}Rs(this,this.selectedItems)||this.updateSelector(),this.refreshCanvasLayers()}else this.commandHandler.scale(t,e,i,r,t.children?t:void 0);return!this.callBlazorModel||this.blazorActions&$.interaction||this.blazorActions&$.GroupClipboardInProcess||this.commandHandler.getBlazorOldValues(),this.disableStackContainerPadding(t.wrapper,!0),n},r.prototype.rotate=function(t,e,i,r){var n,o,a=[];if(!r){if((n=N(t)).nodes&&n.nodes.length>0&&n.nodes[0].children){this.fromUndo||(this.rotateUsingButton=!0);for(var s=this.commandHandler.getAllDescendants(n.nodes[0],[]),h=0;h<s.length;h++){var d=this.commandHandler.cloneChild(s[parseInt(h.toString(),10)].id);a[s[parseInt(h.toString(),10)].id]=N(d)}}e<0&&(e=(e+360)%360)}if(this.insertBlazorDiagramObjects(t),t.id&&(t=this.nameTable[t.id]||t),t)if(i=i||{x:t.wrapper.offsetX,y:t.wrapper.offsetY},t instanceof qh){this.callBlazorModel=!1,t.rotateAngle+=e,t.wrapper.rotateAngle+=e;var l=R(t.wrapper);if(!(o=this.commandHandler.checkBoundaryConstraints(void 0,void 0,l))||!this.canRotateOnNegativeAxis(t.wrapper))return t.rotateAngle-=e,t.wrapper.rotateAngle-=e,!1;var c=[];c=(c=c.concat(t.nodes)).concat(t.connectors),this.commandHandler.rotateObjects(t,c,e,i),this.callBlazorModel=!0}else this.commandHandler.rotateObjects(t,[t],e,i);if(!this.callBlazorModel||this.blazorActions&$.interaction||this.commandHandler.getBlazorOldValues(),!r&&!this.fromUndo&&n.nodes&&n.nodes.length>0&&n.nodes[0].children){var p={type:"RotationChanged",redoObject:N(t),undoObject:N(n),category:"Internal",childTable:a};this.commandHandler.addHistoryEntry(p),this.commandHandler.updateSelector()}return o},r.prototype.canRotateOnNegativeAxis=function(t){return!(this.constraints&ct.RestrictNegativeAxisDragDrop)||R(t).left>=0&&R(t).top>=0},r.prototype.dragSourceEnd=function(t,e,i){this.insertBlazorDiagramObjects(t),this.commandHandler.dragSourceEnd(t,e,i),this.callBlazorModel&&this.commandHandler.getBlazorOldValues()},r.prototype.dragTargetEnd=function(t,e,i){this.insertBlazorDiagramObjects(t),this.commandHandler.dragTargetEnd(t,e,i),this.callBlazorModel&&this.commandHandler.getBlazorOldValues()},r.prototype.findObjectsUnderMouse=function(t,e){return this.eventHandler.findObjectsUnderMouse(t,e)},r.prototype.findObjectUnderMouse=function(t,e,i){return this.eventHandler.findObjectUnderMouse(t,e,i)},r.prototype.findTargetObjectUnderMouse=function(t,e,i,r,n){return this.eventHandler.findTargetUnderMouse(t,e,i,r,n)},r.prototype.findElementUnderMouse=function(t,e,i,r){return this.eventHandler.findElementUnderMouse(t,e,i,r)},r.prototype.findActionToBeDone=function(t,e,i,r){return this.eventHandler.findActionToBeDone(t,e,i,r)},r.prototype.updateConnectorPort=function(t){if(t.ports.length)for(var e=void 0,r=0,n=t.ports;r<n.length;r++){var o=n[r];e=this.getWrapper(t.wrapper,o.id),t.initPortWrapper(o,t.intermediatePoints,t.wrapper.bounds,e)}t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize)},r.prototype.getTool=function(t){var e,i=J(this.getCustomTool);return i&&(e=i(t))?e:this.eventHandler.getTool(t)},r.prototype.getCursor=function(t,e){var i,r=J(this.getCustomCursor);if(r&&(i=r(t,e)))return i;if(this.customCursor.length)for(var n=0;n<this.customCursor.length;n++)if(this.customCursor[parseInt(n.toString(),10)].action===t)return this.customCursor[parseInt(n.toString(),10)].cursor;return this.eventHandler.getCursor(t)},r.prototype.initHistory=function(){this.undoRedoModule&&this.undoRedoModule.initHistory(this)},r.prototype.addHistoryEntry=function(t,e){if(this.undoRedoModule&&this.constraints&ct.UndoRedo&&(!this.currentSymbol||this.checkCurrentSymbol(this.currentSymbol,t))){if(t.undoObject&&"helper"===t.undoObject.id)return;var i=this.undoRedoModule.addHistoryEntry(t,this);"StartGroup"!==t.type&&"EndGroup"!==t.type&&i&&this.historyChangeTrigger(t,"CustomAction",e)}},r.prototype.checkCurrentSymbol=function(t,e){var i=!1;if(e.undoObject&&e.redoObject){var r=e.undoObject,n=e.undoObject;return!(!n.id||!r.id||n.id===t.id||r.id===t.id)||i}return i},r.prototype.addCustomHistoryEntry=function(t){},r.prototype.historyChangeTrigger=function(t,e,i){var r={},n="oldValue",o="newValue",a=[];if("Internal"===t.category){switch(t&&t.redoObject&&t.redoObject.nodes instanceof Array&&t.redoObject.connectors instanceof Array?a=t.redoObject.nodes.concat(t.redoObject.connectors):t.redoObject&&a.push(t.redoObject),r.type=t.type,t.type){case"PositionChanged":case"ConnectionChanged":"Undo"===e?(r[""+n]={offsetX:t.redoObject.offsetX,offsetY:t.redoObject.offsetY},r[""+o]={offsetX:t.undoObject.offsetX,offsetY:t.undoObject.offsetY}):(r[""+n]={offsetX:t.undoObject.offsetX,offsetY:t.undoObject.offsetY},r[""+o]={offsetX:t.redoObject.offsetX,offsetY:t.redoObject.offsetY});break;case"RotationChanged":"Undo"===e?(r[""+n]={rotateAngle:t.redoObject.rotateAngle},r[""+o]={rotateAngle:t.undoObject.rotateAngle}):(r[""+n]={rotateAngle:t.undoObject.rotateAngle},r[""+o]={rotateAngle:t.redoObject.rotateAngle});break;case"SizeChanged":"Undo"===e?(r[""+n]={offsetX:t.redoObject.offsetX,offsetY:t.redoObject.offsetY,width:t.redoObject.width,height:t.redoObject.height},r[""+o]={offsetX:t.undoObject.offsetX,offsetY:t.undoObject.offsetY,width:t.undoObject.width,height:t.undoObject.height}):(r[""+n]={offsetX:t.undoObject.offsetX,offsetY:t.undoObject.offsetY,width:t.undoObject.width,height:t.undoObject.height},r[""+o]={offsetX:t.redoObject.offsetX,offsetY:t.redoObject.offsetY,width:t.redoObject.width,height:t.redoObject.height});break;case"CollectionChanged":r[t.changeType]=a}var s=[],h=[];if(void 0===i&&"PropertyChanged"===t.type){for(var d=0;d<Object.keys(t.undoObject).length;d++)if("nodes"===Object.keys(t.undoObject)[parseInt(d.toString(),10)])for(var l=0,c=Object.keys(t.undoObject.nodes);l<c.length;l++){var p=c[l],g=parseInt(p,10);s.push(this.nodes[parseInt(g.toString(),10)].id)}for(d=0;d<Object.keys(t.undoObject).length;d++)if("connectors"===Object.keys(t.undoObject)[parseInt(d.toString(),10)])for(var u=0,f=Object.keys(t.undoObject.connectors);u<f.length;u++){p=f[u],g=parseInt(p,10);h.push(this.connectors[parseInt(g.toString(),10)].id)}i=s.concat(h)}var m={cause:t.category,source:a,change:r,action:e,sourceId:i};a.length&&this.triggerEvent(xt.historyChange,m)}},r.prototype.startGroupAction=function(){this.diagramActions&yt.UndoRedo||this.addHistoryEntry({type:"StartGroup",category:"Internal"})},r.prototype.endGroupAction=function(){this.diagramActions&yt.UndoRedo||this.addHistoryEntry({type:"EndGroup",category:"Internal"})},r.prototype.undo=function(){this.canEnableBlazorObject=!0,this.callBlazorModel=!1,this.undoRedoModule&&this.constraints&ct.UndoRedo?(this.isUndo=!0,this.undoRedoModule.undo(this),this.isUndo=!1):this.constraints&ct.UndoRedo&&console.warn('[WARNING] :: Module "UndoRedo" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),this.commandHandler.getBlazorOldValues(),this.callBlazorModel=!0,this.canEnableBlazorObject=!1},r.prototype.redo=function(){this.canEnableBlazorObject=!0,this.callBlazorModel=!1,this.undoRedoModule&&this.constraints&ct.UndoRedo?this.undoRedoModule.redo(this):this.constraints&ct.UndoRedo&&console.warn('[WARNING] :: Module "UndoRedo" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),this.commandHandler.getBlazorOldValues(),this.callBlazorModel=!0,this.canEnableBlazorObject=!1},r.prototype.getBlazorDiagramObjects=function(t){if(t)for(var e=0;e<t.length;e++)this.insertBlazorDiagramObjects(t[parseInt(e.toString(),10)]);else this.insertBlazorDiagramObjects(this.selectedItems);this.callBlazorModel=!1,this.canEnableBlazorObject=!0},r.prototype.align=function(t,e,i){this.getBlazorDiagramObjects(e),e||(e=(e=[]).concat(this.selectedItems.nodes,this.selectedItems.connectors)),this.diagramActions=this.diagramActions|yt.PublicMethod,this.commandHandler.align(e,t,i||"Object"),this.commandHandler.getBlazorOldValues(),this.callBlazorModel=!0,this.canEnableBlazorObject=!1},r.prototype.distribute=function(t,e){this.getBlazorDiagramObjects(e);var i=[];e||(e=(e=[]).concat(this.selectedItems.nodes),this.selectedItems.connectors.forEach(function(t){t.sourceWrapper||t.targetWrapper?-1===i.indexOf(t)&&i.push(t):-1===e.indexOf(t)&&e.push(t)})),this.diagramActions=this.diagramActions|yt.PublicMethod,this.commandHandler.distribute(e,t);for(var r=0,n=i;r<n.length;r++){var o=n[r];this.updateConnectorProperties(o)}this.commandHandler.getBlazorOldValues(),this.canEnableBlazorObject=!1,this.callBlazorModel=!0},r.prototype.sameSize=function(t,e){this.getBlazorDiagramObjects(e),e||(e=(e=[]).concat(this.selectedItems.nodes,this.selectedItems.connectors)),this.diagramActions=this.diagramActions|yt.PublicMethod,this.commandHandler.sameSize(e,t),this.commandHandler.getBlazorOldValues(),this.canEnableBlazorObject=!1,this.callBlazorModel=!0},r.prototype.updateBlazorDiagramProperties=function(t,e){},r.prototype.getZoomingAttribute=function(){var t=[];return t.push("scrollSettings"),t.push("snapSettings"),t},r.prototype.zoom=function(t,e){var i=this.getZoomingAttribute();this.updateBlazorDiagramProperties(i),this.scroller.zoom(t,0,0,e),this.blazorActions&$.interaction||this.updateBlazorDiagramProperties(i,!0)},r.prototype.zoomTo=function(t){var e=this.getZoomingAttribute();this.updateBlazorDiagramProperties(e);var i=t.zoomFactor?t.zoomFactor:.2;i="ZoomOut"===t.type?1/(1+i):1+i,this.scroller.zoom(i,0,0,t.focusPoint),this.updateBlazorDiagramProperties(e,!0)},r.prototype.pan=function(t,e,i,r){var n=this.getZoomingAttribute();this.updateBlazorDiagramProperties(n),this.setCursor("grabbing"),this.scroller.zoom(1,t,e,i,r),this.updateBlazorDiagramProperties(n,!0)},r.prototype.reset=function(){var t=this.getZoomingAttribute();this.updateBlazorDiagramProperties(t),this.scroller.zoom(1/this.scroller.currentZoom,-this.scroller.horizontalOffset,-this.scroller.verticalOffset,{x:0,y:0}),this.updateBlazorDiagramProperties(t,!0)},r.prototype.resetSegments=function(){if(this.constraints&ct.LineRouting&&this.lineRoutingModule)this.lineRoutingModule.lineRouting(this);else{this.protectPropertyChange(!0);for(var t=void 0,e=0;e<this.connectors.length;e++)(t=this.connectors[parseInt(e.toString(),10)]).segments=[],this.connectorPropertyChange(t,{},{segments:t.segments}),this.avoidLineOverlappingModule&&this.avoidLineOverlappingModule.removeConnector(t);this.protectPropertyChange(!1)}},r.prototype.setBlazorDiagramProps=function(t){var e=this.getZoomingAttribute();t?this.updateBlazorDiagramProperties(e):this.updateBlazorDiagramProperties(e,!0)},r.prototype.triggerEvent=function(t,e){return oc(this,void 0,void 0,function(){return ac(this,function(i){switch(i.label){case 0:return e&&this.updateEventValue(e),[4,this.trigger(xt[""+t],e)];case 1:return[2,i.sent()]}})})},r.prototype.updateEventValue=function(t){var e=t.element;t.element&&e instanceof qh&&e.nodes.length+e.connectors.length===1&&(t.element=1===e.nodes.length?e.nodes[0]:e.connectors[0])},r.prototype.addNodeToLane=function(t,e,i){if(this.nameTable[""+e]){var r=this.nameTable[""+e];if(this.protectPropertyChange(!0),this.undoRedoModule&&this.historyManager.startGroupAction(),this.nameTable[t.id]||(t.offsetX=r.wrapper.bounds.width+r.wrapper.bounds.x,t.offsetY=r.wrapper.bounds.height+r.wrapper.bounds.y,t=this.add(t)),t.parentId="",r.shape.phases.length)for(var n=0;n<r.shape.phases.length;n++){d=e+i+n;if(this.nameTable[""+d]&&this.nameTable[""+d].isLane){var o=this.nameTable[""+d].wrapper.bounds,a={x:o.x+(o.x-r.wrapper.bounds.x+t.margin.left+t.wrapper.bounds.width/2),y:o.y+r.wrapper.bounds.y-t.margin.top};if("Horizontal"===r.shape.orientation)a.y=o.y;else{a.x=o.x;var s=this.nameTable[""+d].parentId+r.shape.lanes[0].id+"_0_header";a.y=o.y+(r.wrapper.bounds.y-this.nameTable[""+s].wrapper.bounds.height+t.margin.top+t.wrapper.bounds.height/2)}var h=r.shape.phases[parseInt(n.toString(),10)];if(t.margin.left<=h.offset){this.addChildToPhase(t,r,d);break}if(d===e+i+(r.shape.phases.length-1)||o.containsPoint(a)){this.addChildToPhase(t,r,d);break}}}else{var d=e+i+"0";this.nameTable[""+d]&&(this.commandHandler.updateLaneChildrenZindex(t,this.nameTable[""+d]),vn(this,this.nameTable[""+d],t,void 0,!0),wn(this.nameTable[""+d],r,t,this))}this.undoRedoModule&&this.historyManager.endGroupAction(),this.protectPropertyChange(!1)}this.updateDiagramElementQuad()},r.prototype.addChildToPhase=function(t,e,i){this.commandHandler.updateLaneChildrenZindex(t,this.nameTable[""+i]),vn(this,this.nameTable[""+i],t,void 0,!0),wn(this.nameTable[""+i],e,t,this)},r.prototype.showTooltip=function(t){t&&t.id&&!t.wrapper&&(t=this.nameTable[t.id]);var e=R(t.wrapper),i={x:0,y:0},r=t.tooltip.content?t.tooltip.content:"X:"+Math.round(e.x)+" Y:"+Math.round(e.y);t&&"Custom"===t.tooltip.openOn&&(i=t instanceof Yh?{x:t.offsetX+t.width/2,y:t.offsetY+t.height/2}:{x:t.targetPoint.x,y:t.targetPoint.x},this.commandHandler.showTooltip(t,i,r,"SelectTool",!0))},r.prototype.hideTooltip=function(t){t&&"Custom"===t.tooltip.openOn&&this.tooltipObject.close()},r.prototype.addNode=function(t,e){return this.add(t,e)},r.prototype.addChildToGroup=function(t,e){var i=t&&t.shape&&"Container"===t.shape.type,r=this.allowServerDataBinding;this.enableServerDataBinding(!1);var n=this.isProtectedOnChange;this.protectPropertyChange(!0),t=this.getObject(t.id);var o=!(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.Group||this.diagramActions&yt.PreventHistory);if(i&&!e.id){var a=this.getObject(e);a?e=a:e.id=E()}o&&this.startGroupAction();var s=e.id;if(i)hh(e,t.id,this);else{s=this.addChild(t,e);var h=this.nameTable[e]?this.nameTable[e]:e,d=document.getElementById(h.id+"_groupElement"),l=document.getElementById(t.id+"_groupElement");l&&d&&l.appendChild(d)}if(o){var c={};c[""+s]=N(this.getObject(s));var p={type:"AddChildToGroupNode",changeType:"Insert",undoObject:N(t),redoObject:N(t),category:"Internal",objectId:s,childTable:c};this.addHistoryEntry(p),this.endGroupAction()}this.protectPropertyChange(n),this.enableServerDataBinding(r),this.updateSelector()},r.prototype.removeChildFromGroup=function(t,e){var i=t&&t.shape&&"Container"===t.shape.type,r=this.allowServerDataBinding;this.enableServerDataBinding(!1);var n=this.isProtectedOnChange;this.protectPropertyChange(!0);var o=N(t=this.getObject(t.id)),a=!(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.Group||this.diagramActions&yt.PreventHistory),s=e.id||(this.nameTable[e]?this.nameTable[e].id:e);if(a&&this.startGroupAction(),i){if(a){(l={})[""+s]=N(this.getObject(s));var h={type:"RemoveChildFromGroupNode",changeType:"Remove",undoObject:o,redoObject:N(t),category:"Internal",objectId:s,childTable:l};this.addHistoryEntry(h),dh(e instanceof Yh?e:this.nameTable[""+s],this)}}else{var d=this.removeChild(t,e);if(a){var l;(l={})[""+d]=N(this.getObject(d));h={type:"RemoveChildFromGroupNode",changeType:"Remove",undoObject:N(o),redoObject:N(t),category:"Internal",objectId:d,childTable:l};this.addHistoryEntry(h)}var c=this.nameTable[e]?this.nameTable[e]:e,p=c.zIndex,g=this.layers.indexOf(this.commandHandler.getObjectLayer(c.id)),u=this.layers[parseInt(g.toString(),10)].objects[p+1],f=document.getElementById(u+"_groupElement"),m=document.getElementById(c.id+"_groupElement"),y=document.getElementById(t.id+"_groupElement");y&&m&&(u&&f?y.contains(f)?y.insertBefore(m,f):y.parentNode.contains(f)&&f.parentElement===y.parentElement?y.parentNode.insertBefore(m,f):y.parentNode.appendChild(m):y.parentNode.appendChild(m))}a&&this.endGroupAction(),this.protectPropertyChange(n),this.enableServerDataBinding(r),this.updateSelector()},r.prototype.getHistoryStack=function(t){var e=[],i=t?this.historyManager.undoStack:this.historyManager.redoStack;if(void 0!==this.historyManager.stackLimit){for(var r=i.length-1;r>=0;r--)if(e.push(i[parseInt(r.toString(),10)]),e.length>this.historyManager.stackLimit)return e}else e=i;return e},r.prototype.getEdges=function(t){return t.outEdge?this.nameTable[t.id].outEdges:this.nameTable[t.id].inEdges},r.prototype.getParentId=function(t){return this.nameTable[""+t].parentId},r.prototype.addConnector=function(t){return this.add(t)},r.prototype.UpdateBlazorDiagramModelCollection=function(t,e,i,r){},r.prototype.UpdateBlazorDiagramModel=function(t,e,i,r){},r.prototype.UpdateBlazorLabelOrPortObjects=function(t,e,i,r){},r.prototype.addBlazorDiagramObjects=function(){},r.prototype.removeNodeEdges=function(t,e,i){var r=this.nameTable[""+t],n=i?r.outEdges:r.inEdges;if(n.length>0)for(var o=0;o<n.length;o++)n[parseInt(o.toString(),10)]===e&&n.splice(o,1)},r.prototype.insertBlazorConnector=function(t){},r.prototype.add=function(t,e){var n,o=this.isProtectedOnChange;this.protectPropertyChange(!0);var a=!1;if(t){var s=void 0;if(s={element:t=N(t),cause:this.diagramActions,diagramAction:this.itemType,state:"Changing",type:"Addition",cancel:!1},this.parentObject&&(s.parentId=this.parentObject.id),"helper"===t.id||this.diagramActions&yt.PreventCollectionChangeOnDragOver||this.triggerEvent(xt.collectionChange,s),s.cancel&&this.drawingObject){this.removeElements(s.element),this.tooltipObject.close();var h=this.getObject(s.element.sourceID),d=void 0;if(vs(s.element)===Co){if(s.element.sourceID&&(this.removeNodeEdges(s.element.sourceID,s.element.id,!0),h.ports.length>0)){for(var l=0;l<h.ports.length;l++){var c=h.ports[parseInt(l.toString(),10)];c.id===s.element.sourcePortID&&(d=!(c.outEdges.length>0))}this.removePortEdges(h,s.element.sourcePortID,s.element.id,d)}s.element.targetID&&this.removeNodeEdges(s.element.targetID,s.element.id,!1)}}this.diagramActions=this.diagramActions|yt.PublicMethod,t.id=t.id||E();var p=this.activeLayer;if(!s.cancel&&p&&!p.lock){if(p.objects.indexOf(t.id)<0&&!p.lock&&(p.visible||(p.visible=!0,this.dataBind()),p.objects.push(t.id),this.activeLayerObjectsSet.add(t.id)),vs(t)===Co)(n=new Co(this,"connectors",t,!0)).status="New",this.nameTable[n.targetID]&&"TextAnnotation"===this.nameTable[n.targetID].shape.shape&&(n.isBpmnAnnotationConnector=!0,n.constraints=n.constraints&~at.Delete),da(n,t,this.connectorDefaults),this.connectors.push(n),this.initObject(n,p),!1===t.visible&&this.updateElementVisibility(n.wrapper,n,t.visible),this.updateEdges(n),this.insertBlazorConnector(n);else{if(da(n=new Yh(this,"nodes",t,!0),t,this.nodeDefaults),n.parentId=t.parentId?t.parentId:n.parentId,n.umlIndex=t.umlIndex,n.status="New",(a="TextAnnotation"===n.shape.shape)&&!t.isTextAnnotationCopied&&(n.inEdges=t.inEdges?t.inEdges:n.inEdges),this.nodes.push(n),this.initObject(n,p,void 0,e),a&&this.bpmnModule)for(l=0;l<this.bpmnModule.bpmnTextAnnotationConnector.length;l++)null===this.bpmnModule.bpmnTextAnnotationConnector[parseInt(l.toString(),10)].wrapper&&this.initConnectors(this.bpmnModule.bpmnTextAnnotationConnector[parseInt(l.toString(),10)],void 0,!0);if(this.updateTemplate(),this.bpmnModule&&n.shape.activity&&n.shape.activity.subProcess.processes&&n.shape.activity.subProcess.processes.length&&this.bpmnModule.updateDocks(n,this),this.lineRoutingModule&&this.constraints&ct.LineRouting){var g=this.spatialSearch.findObjects(n.wrapper.outerBounds);for(l=0;l<g.length;l++){var u=g[parseInt(l.toString(),10)];u instanceof Co&&this.connectorPropertyChange(u,{},{sourceID:u.sourceID,targetID:u.targetID,sourcePortID:u.sourcePortID,targetPortID:u.targetPortID,sourcePoint:u.sourcePoint,targetPoint:u.targetPoint})}}else this.constraints&ct.LineRouting&&console.warn('[WARNING] :: Module "LineRouting" is not available in Diagram component! You either misspelled the module name or forgot to load it.');if(n.umlIndex>-1&&t.parentId&&this.nameTable[t.parentId]&&"UmlClassifier"===this.nameTable[t.parentId].shape.type){var f=this.nameTable[t.parentId];f.children.splice(n.umlIndex,0,n.id),f.wrapper.children.splice(n.umlIndex,0,n.wrapper),f.wrapper.measure(new i),f.wrapper.arrange(f.wrapper.desiredSize),this.updateDiagramObject(f)}}if(s={element:n,cause:this.diagramActions,diagramAction:this.itemType,state:"Changed",type:"Addition",cancel:!1},this.parentObject&&(s.parentId=this.parentObject.id),"helper"===t.id||this.diagramActions&yt.PreventCollectionChangeOnDragOver||this.triggerEvent(xt.collectionChange,s),!(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.Group||this.diagramActions&yt.PreventHistory)){var m=void 0,y={type:"CollectionChanged",changeType:"Insert",undoObject:N(m=t&&t.shape&&"SwimLane"===t.shape.type||t&&t.shape&&"Bpmn"===t.shape.type?t:n),redoObject:N(m),category:"Internal"};this.addHistoryEntry(y)}if(this.parentObject=void 0,"SVG"===this.mode){if(this.updateSvgNodes(n),this.updateTextElementValue(n),this.updateDiagramObject(n),a){var v=this.nameTable[n.inEdges[0]];this.updateDiagramObject(v)}n.shape.activity&&n.shape.activity.subProcess.processes&&n.shape.activity.subProcess.processes.length&&this.updateProcesses(n),this.updateBridging()}}}if(this.protectPropertyChange(o),this.resetDiagramActions(yt.PublicMethod),n&&this.layers.length>1&&this.moveNode(n),this.views)for(var b=0,S=this.views;b<S.length;b++){var w=S[b],x=this.views[""+w];x instanceof r||this.refreshCanvasDiagramLayer(x)}return this.renderReactTemplates(),this.itemType="PublicMethod",n},r.prototype.addElements=function(t){for(var e=0;e<t.length;e++)this.add(t[parseInt(e.toString(),10)]);this.pathDataStorage&&this.pathDataStorage.clear()},r.prototype.getPathData=function(t){return this.pathDataStorage||(this.pathDataStorage=new Map),this.pathDataStorage.has(t)?this.pathDataStorage.get(t):[]},r.prototype.setPathData=function(t,e){0===(this.pathDataStorage.get(t)||[]).length&&this.pathDataStorage.set(t,e)},r.prototype.updateSvgNodes=function(t){if(t.children)for(var e=0,i=t.children;e<i.length;e++){var r=i[e];if(this.nameTable[""+r]&&this.nameTable[""+r].parentId){var n=id(r+"_groupElement",this.element.id);n&&n.parentNode.removeChild(n)}}},r.prototype.updateProcesses=function(t){if(this.bpmnModule&&t&&t.shape&&t.shape.activity&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length){var e=t.shape.activity.subProcess.processes;this.moveSvgNode(t.id);for(var i=0,r=e;i<r.length;i++){var n=r[i];this.moveSvgNode(n);for(var o=[],a=(o=o.concat(this.nameTable[""+n].outEdges,this.nameTable[""+n].inEdges)).length-1;a>=0;a--)this.moveSvgNode(o[parseInt(a.toString(),10)])}for(var s=0,h=e;s<h.length;s++){n=h[s];this.nameTable[""+n].shape.activity.subProcess.processes&&this.nameTable[""+n].shape.activity.subProcess.processes.length&&this.updateProcesses(this.nameTable[""+n])}}else this.moveSvgNode(t.id)},r.prototype.moveSvgNode=function(t){var e=id(t+"_groupElement",this.element.id),i=e.parentElement;e.parentNode.removeChild(e),i.appendChild(e)},r.prototype.addTextAnnotation=function(t,e){this.bpmnModule&&this.getBPMNTextAnnotation(e,this,t,!0)},r.prototype.spliceConnectorEdges=function(t,e){var i=[],r=e?this.nameTable[t.sourceID]:this.nameTable[t.targetID];if(r){for(var n=(i=e?r.outEdges:r.inEdges).length-1;n>=0;n--)i[parseInt(n.toString(),10)]===t.id&&i.splice(n,1);for(var o=0;r.ports&&o<r.ports.length;o++){var a=!e;this.removePortEdges(r,r.ports[parseInt(o.toString(),10)].id,t.id,a)}}},r.prototype.removeDependentConnector=function(t){if(t)for(var e=void 0,i=[],r=(i=i.concat(t.outEdges,t.inEdges)).length-1;r>=0;r--)if(e=this.nameTable[i[parseInt(r.toString(),10)]])if(this.connectorTable[e.id]=N(e),e.isBpmnAnnotationConnector){var n=this.nameTable[e.targetID];this.removeObjectsFromLayer(e);var o=this.connectors.indexOf(e);-1!==o&&this.connectors.splice(o,1),this.removeElements(e),this.removeFromAQuad(e),delete this.nameTable[e.id];var a=this.nameTable[e.sourceID];if(a){var s=a.outEdges.indexOf(e.id);-1!==s&&a.outEdges.splice(s,1)}t.id!==e.targetID&&this.remove(n)}else this.remove(e)},r.prototype.removeObjectsFromLayer=function(t){if(t.children)for(var e=0;e<t.children.length;e++){var i=this.nameTable[t.children[parseInt(e.toString(),10)]];i&&this.removeObjectsFromLayer(i)}var r=this.layers.indexOf(this.commandHandler.getObjectLayer(t.id)),n=this.layers[parseInt(r.toString(),10)].objects.indexOf(t.id);n>-1&&(Dn(this,t)&&this.unSelect(t),this.layers[parseInt(r.toString(),10)].objects.splice(n,1),this.activeLayerObjectsSet.delete(t.id),delete this.layers[parseInt(r.toString(),10)].zIndexTable[this.nameTable[t.id].zIndex])},r.prototype.removeElements=function(t){if("SVG"===this.mode||"Canvas"===this.mode&&"Native"===t.shape.type){var e=id(t.id+"_groupElement",this.element.id),i=t;if(i.ports&&i.ports.length>0)for(var n=0;n<i.ports.length;n++){var o=i.ports[parseInt(n.toString(),10)],a=id(i.id+"_"+o.id+"_groupElement",this.element.id);a&&a.parentNode.removeChild(a)}e&&e.parentNode.removeChild(e)}if(this.refreshCanvasLayers(),t.wrapper){var s=t.wrapper.children,h=void 0;if(s){s.length>0&&!(t.wrapper instanceof te)&&(s=s[0].children);for(n=0;n<s.length;n++){if(s[parseInt(n.toString(),10)]instanceof ne||s[parseInt(n.toString(),10)].id&&s[parseInt(n.toString(),10)].id.indexOf("icon_content")>0){s[parseInt(n.toString(),10)].id.indexOf("icon_content")>0&&"SVG"===this.mode&&((h=id(s[parseInt(n.toString(),10)].id+"_shape_groupElement",this.element.id))&&h.parentNode.removeChild(h),(h=id(s[parseInt(n.toString(),10)].id+"_rect_groupElement",this.element.id))&&h.parentNode.removeChild(h));for(var d=0,l=this.views;d<l.length;d++){var c=l[d];bd(s[parseInt(n.toString(),10)].id+"_groupElement",c);var p=this.scroller.removeCollection.indexOf(t.id);this.scroller.removeCollection.splice(p,1)}}else if(s[parseInt(n.toString(),10)]instanceof Bi)for(var g=0,u=this.views;g<u.length;g++){c=u[g];if(this.views[""+c]instanceof r||!this.preventOverviewRefresh){bd(t.id+"_html_element",c),bd(s[parseInt(n.toString(),10)].id+"_html_element",c);var f=!0,m=this.nameTable[t.parentId];(this.isAngular||this.isReact||this.isVue)&&(m&&m.isLane||this.constraints&ct.Virtualization)&&(f=!1),f&&(this.clearTemplate(["nodeTemplate_"+t.id]),s[parseInt(n.toString(),10)].annotationId&&this.clearTemplate(["annotationTemplate_"+t.id+s[parseInt(n.toString(),10)].annotationId]))}}Za(s[parseInt(n.toString(),10)].id)}}}},r.prototype.removeCommand=function(){this.itemType="KeyboardDelete",this.remove(),this.itemType="PublicMethod"},r.prototype.remove=function(t){var i,r=[];r=r.concat(this.selectedItems.nodes,this.selectedItems.connectors);var n=!1;if(t){if(t=this.nameTable[t.id],this.insertBlazorConnector(t),t&&(Xi(t)||this.diagramActions&yt.Clear)&&(i={element:t,cause:this.diagramActions,diagramAction:this.itemType,state:"Changing",type:"Removal",cancel:!1},this.diagramActions&yt.Clear||"helper"===t.id||this.triggerEvent(xt.collectionChange,i),!i.cancel)){if(Xi(t)&&t&&t.shape&&"SwimLane"===t.shape.type&&function(t,e){var i,r,n,o,a,s,h=e.wrapper.children[0].rows;for(r=0;r<h.length;r++)for(n=0;n<h[parseInt(r.toString(),10)].cells.length;n++){if((a=Jr(h[parseInt(r.toString(),10)].cells[parseInt(n.toString(),10)]))&&a.children)for(o=a.children.length-1;o>=0;o--)a.children[parseInt(o.toString(),10)].children&&(s=t.nameTable[a.children[parseInt(o.toString(),10)].id])&&(s.isLane?$r(t,s):(t.removeDependentConnector(s),t.diagramActions|=yt.PreventHistory,s.constraints&ht.Delete?t.remove(s):ln(t,s,{},!1),t.diagramActions&=~yt.PreventHistory));a&&(i=t.nameTable[a.id])&&$r(t,i)}}(this,t),!(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.PreventHistory||!(t instanceof Yh||t instanceof Co))){var o={type:"CollectionChanged",changeType:"Remove",undoObject:N(t),redoObject:N(t),category:"Internal"};this.diagramActions&yt.Clear||t.children&&!t.isLane&&!t.isPhase&&t.children.length>0&&this.undoRedoModule&&"None"===this.layout.type&&(this.historyManager.startGroupAction(),n=!0),(t instanceof Yh||t instanceof Co)&&this.deleteDependentConnector&&this.removeDependentConnector(t),t.isLane||t.isPhase||t.isHeader&&"Container"===this.nameTable[t.parentId].shape.type||this.diagramActions&yt.Clear||this.isStackChild(t)||this.addHistoryEntry(o)}"TextAnnotation"===t.shape.shape&&this.removeDependentConnector(t),!t.children||t.isLane||t.isPhase||this.diagramActions&yt.UndoRedo&&(0,e.isBlazor)()||this.deleteGroup(t),t.parentId&&(this.deleteChild(t,void 0,!0),this.nameTable[t.parentId]&&"UmlClassifier"===this.nameTable[t.parentId].shape.type&&(this.updateDiagramObject(this.nameTable[t.parentId]),this.updateConnectorEdges(this.nameTable[t.parentId])));var a=void 0;this.diagramActions=this.diagramActions|yt.PublicMethod;var s=this.nameTable[t.id];if(s instanceof Yh){if("Bpmn"===s.shape.type&&this.bpmnModule&&this.bpmnModule.removeBpmnProcesses(s,this),(s.parentId&&this.nameTable[s.parentId]&&"Container"===this.nameTable[s.parentId].shape.type||"Container"===s.shape.type)&&function(t,e){var i=e.nameTable[t.parentId];if("Container"===t.shape.type){if(t.shape.children&&t.shape.children.length>0)for(var r=(n=t.shape.children).length-1;r>=0;r--)e.remove(e.nameTable[n[parseInt(r.toString(),10)]]);t.shape.hasHeader&&e.remove(e.nameTable[t.id+t.shape.header.id])}if(i){e.removeDependentConnector(t);var n=i.shape.children;if(sh(i.wrapper,t.id,e,!0),n){var o=n.indexOf(t.id);n.splice(o,1)}}}(s,this),s.isLane||s.isPhase||"SwimLane"===s.shape.type){(h=s.isLane||s.isPhase?this.nameTable[s.parentId]:this.nameTable[s.id]).wrapper.children[0];s.isLane?tn(this,s,h):s.isPhase&&nn(this,s,h)}-1!==(a=this.nodes.indexOf(s))&&(this.crudDeleteNodes.push(this.nameTable[s.id]),this.nodes.splice(a,1),this.updateNodeEdges(s))}else-1!==(a=this.connectors.indexOf(s))&&(this.crudDeleteNodes.push(this.nameTable[s.id]),this.connectors.splice(a,1)),this.updateEdges(s),this.spliceConnectorEdges(t,!0),this.spliceConnectorEdges(t,!1);if(this.isServerUpdate||this.blazorActions&$.GroupClipboardInProcess||this.commandHandler.getBlazorOldValues(),n&&this.historyManager.endGroupAction(),Dn(this,s)&&this.unSelect(s),!s.isPhase){if(this.removeObjectsFromLayer(t),this.currentDrawingObject&&(this.currentDrawingObject.wrapper=void 0),delete this.nameTable[t.id],r.length>0&&r[0].id===s.id&&s.parentId){var h,d=this.nameTable[s.parentId];if(d&&d.isLane&&"SwimLane"===this.nameTable[d.parentId].shape.type)Kr(this,h=this.nameTable[d.parentId],d,s)}this.removeElements(s),this.updateBridging(),"SVG"!==this.mode&&this.refreshDiagramLayer(),this.diagramActions&yt.Clear||(this.removeFromAQuad(s),i={element:t,cause:this.diagramActions,diagramAction:this.itemType,state:"Changed",type:"Removal",cancel:!1},"helper"!==t.id&&this.triggerEvent(xt.collectionChange,i),this.resetTool())}}this.selectedItems.annotation&&this.clearSelection()}else if(r.length>0){this.undoRedoModule&&(this.historyManager.startGroupAction(),this.blazorActions|=$.GroupingInProgress,n=!0);for(var l=0;l<r.length;l++){var c=r[parseInt(l.toString(),10)],p=this.nameTable[c.parentId];if(this.nameTable[r[parseInt(l.toString(),10)].id])if(p&&p.shape instanceof Uh&&!c.isPhase){if(c.isLane){var g=p.shape.header.id?p.shape.header.height:0;(this.selectedItems.wrapper.bounds.x<=p.wrapper.bounds.x&&this.selectedItems.wrapper.bounds.width>=p.wrapper.bounds.width&&"Horizontal"===p.shape.orientation||this.selectedItems.wrapper.bounds.y<=p.wrapper.bounds.y+g&&this.selectedItems.wrapper.bounds.height>=p.wrapper.bounds.height-g&&"Vertical"===p.shape.orientation)&&(Xi(p)||p.shape.lanes.length>1)&&this.remove(r[parseInt(l.toString(),10)])}}else this.remove(r[parseInt(l.toString(),10)])}n&&(this.blazorActions&=~$.GroupingInProgress,this.isServerUpdate=!0,this.commandHandler.getBlazorOldValues(),this.UpdateBlazorDiagramModelCollection(void 0,void 0,void 0,!0),this.historyManager.endGroupAction(),this.isServerUpdate=!1),this.clearSelection()}if(!(t&&(Xi(t)||this.diagramActions&yt.Clear)||this.diagramActions&yt.UndoRedo||this.diagramActions&yt.PreventHistory||!(t instanceof Yh||t instanceof Co))){o={type:"ConnectionChanged",undoObject:N(t),redoObject:N(t),category:"Internal"};t.isLane||t.isPhase||t.isHeader&&this.nameTable[t.parentId]&&"Container"===this.nameTable[t.parentId].shape.type||this.diagramActions&yt.Clear||this.isStackChild(t)||this.addHistoryEntry(o)}if(this.tooltipObject.close(),t&&"helper"!==t.id&&this.lineRoutingModule&&this.constraints&ct.LineRouting&&t instanceof Yh&&"ComplexHierarchicalTree"!==this.layout.type){var u=R(t.wrapper);u.Inflate(40);var f=this.spatialSearch.findObjects(u);this.avoidLineOverlappingModule&&this.avoidLineOverlappingModule.removeConnectors(f),this.lineRoutingModule.renderVirtualRegion(this,!0);for(var m=0,y=f;m<y.length;m++){var v=y[m];v instanceof Co&&"Orthogonal"===v.type&&this.lineRoutingModule.refreshConnectorSegments(this,v,!0)}}},r.prototype.isStackChild=function(t){var e,i=this.nameTable[t.parentId];if(t&&t.parentId&&i.container&&"Stack"===i.container.type&&"UmlClassifier"!==this.nameTable[t.parentId].shape.type){e=!0;var r={type:"StackChildPositionChanged",redoObject:{sourceIndex:void 0,source:t,target:void 0,targetIndex:void 0},undoObject:{sourceIndex:i.wrapper.children.indexOf(t.wrapper),source:t,target:void 0,targetIndex:void 0},category:"Internal"};this.diagramActions&yt.UndoRedo||this.addHistoryEntry(r)}return e},r.prototype.deleteChild=function(t,e,r){var n;if(e=e?this.nameTable[e.id]:this.nameTable[t.parentId],n="string"==typeof t?t:t.id,e&&e.children){for(var o=0;o<e.children.length;o++)if(e.children[parseInt(o.toString(),10)]===n){e.children.splice(o,1);for(var a=0;a<e.wrapper.children.length;a++)e.wrapper.children[parseInt(a.toString(),10)].id===n&&e.wrapper.children.splice(a,1);if(!r){var s=this.getObject(e.parentId);if(s&&s.shape instanceof Uh)for(var h=0;h<s.shape.lanes.length;h++){var d=t.parentId.split(s.id);if(s.shape.lanes[parseInt(h.toString(),10)].id===d[1].slice(0,-1))for(var l=0;l<s.shape.lanes[parseInt(h.toString(),10)].children.length;l++)if(t.id===s.shape.lanes[parseInt(h.toString(),10)].children[parseInt(l.toString(),10)].id){s.shape.lanes[parseInt(h.toString(),10)].children.splice(l,1);break}}}}e.wrapper.measure(new i),e.wrapper.arrange(e.wrapper.desiredSize)}},r.prototype.addChild=function(t,e,r){var n,o=this.nameTable[t.id];if(o.children||(o.children=[]),o.children&&("string"==typeof e?this.nameTable[""+e]&&(n=e):(n=e.id=e.id||E(),this.add(e)),n&&(!e.umlIndex||-1===e.umlIndex))){var a=this.nameTable[""+n];if(a.parentId=o.id,o.container&&"Stack"===o.container.type&&this.updateStackProperty(o,a),r)o.children.splice(r,0,n),o.wrapper.children.splice(r,0,a.wrapper);else{o.children.push(n),o.wrapper.children.push(a.wrapper);var s=this.getObject(t.parentId),h=!1;if(s&&s.shape instanceof Uh)for(var d=0;d<s.shape.lanes.length;d++){var l=an(o,this);if(s.shape.lanes[parseInt(d.toString(),10)].id===l.id){for(var c=0;c<s.shape.lanes[parseInt(d.toString(),10)].children.length;c++)if(s.shape.lanes[parseInt(d.toString(),10)].children[parseInt(c.toString(),10)].id===a.id){h=!0;break}h||s.shape.lanes[parseInt(d.toString(),10)].children.push(a);break}}}o.wrapper.measure(new i),o.wrapper.arrange(o.wrapper.desiredSize),o.isLane||(this.nameTable[t.id].width=o.wrapper.actualSize.width,this.nameTable[t.id].height=o.wrapper.actualSize.height,this.nameTable[t.id].offsetX=o.wrapper.offsetX,this.nameTable[t.id].offsetY=o.wrapper.offsetY),void 0!==o.container&&(a.offsetX=a.wrapper.offsetX,a.offsetY=a.wrapper.offsetY),(!o.parentId||this.nameTable[o.parentId]&&"SwimLane"!==this.nameTable[o.parentId].shape.type)&&this.updateDiagramObject(o)}return n},r.prototype.removeChild=function(t,e){var r,n=this.nameTable[t.id];if(n.children||(n.children=[]),n.children&&("string"==typeof e?this.nameTable[""+e]&&(r=e):r=e.id=e.id||E(),r&&(!e.umlIndex||-1===e.umlIndex))){var o=this.nameTable[""+r];o.parentId="",n.container&&"Stack"===n.container.type&&this.updateStackProperty(n,o);for(var a=0;a<n.children.length;a++)if(n.children[parseInt(a.toString(),10)]===r){n.children.splice(a,1);for(var s=0;s<n.wrapper.children.length;s++)n.wrapper.children[parseInt(s.toString(),10)]===o.wrapper&&n.wrapper.children.splice(s,1)}n.wrapper.measure(new i),n.wrapper.arrange(n.wrapper.desiredSize),n.isLane||(this.nameTable[t.id].width=n.wrapper.actualSize.width,this.nameTable[t.id].height=n.wrapper.actualSize.height,this.nameTable[t.id].offsetX=n.wrapper.offsetX,this.nameTable[t.id].offsetY=n.wrapper.offsetY),(!n.parentId||this.nameTable[n.parentId]&&"SwimLane"!==this.nameTable[n.parentId].shape.type)&&this.updateDiagramObject(n)}return r},r.prototype.clear=function(){this.clearObjects(),this.clearLayers()},r.prototype.clearLayers=function(){for(var t=this.layers.length-1;t>=0;t--)this.removeLayer(this.layers[parseInt(t.toString(),10)].id);this.commandHandler.addLayer({id:"default_layer",visible:!0,lock:!1,objects:[],zIndex:0,objectZIndex:-1,zIndexTable:{}},null,!0),this.setActiveLayer(this.layers[this.layers.length-1].id)},r.prototype.clearObjects=function(t){var e=[];e=t||(e=e.concat(this.nodes)).concat(this.connectors),this.diagramActions=this.diagramActions|yt.Clear;for(var i=0,r=e;i<r.length;i++){var n=r[i];this.nameTable[n.id]&&this.remove(n)}this.diagramActions=this.diagramActions&~yt.Clear,this.spatialSearch=new yl(this.nameTable),this.initHistory()},r.prototype.startEditCommad=function(){var t,e=this.selectedItems.nodes[0]?this.selectedItems.nodes[0]:void 0;if(e&&e instanceof Yh)if(e.isLane&&e.parentId)for(var i=this.nameTable[e.parentId],r=i.shape.lanes,n=e.id.slice(i.id.length),o=n.substring(0,n.length-1),a=0;a<r.length;a++)e.isLane&&o===r[parseInt(a.toString(),10)].id&&(t=this.nameTable[r[parseInt(a.toString(),10)].header.id]);else if("SwimLane"===e.shape.type&&e.shape.header&&e.shape.hasHeader){var s=e.wrapper.children[0].rows[0].cells[0].children[0].id;t=this.nameTable[""+s]}this.startTextEdit(t)},r.prototype.startTextEdit=function(t,r){if(!or(this)&&!nr(this)||rr(this)){this.textEditing=!0;var n=this.scroller.transform,o=lr(this)?n.scale:1,a=void 0,s=void 0,h=void 0,d=void 0,l=void 0;if(t||(t=this.selectedItems.nodes[0]?this.selectedItems.nodes[0]:this.selectedItems.connectors[0]),t){!t.shape||"UmlClassifier"!==t.shape.type||t instanceof Co||(t=this.nameTable[t.children[0]]);var c=!1;if(l)c=!0;else{if("Text"!==t.shape.type&&0===t.annotations.length&&(t.constraints&ht.ReadOnly||(this.activeLabel.isGroup=!0,this.startGroupAction(),this.addLabels(t,[{id:E(),content:""}]))),!r&&("Text"!==t.shape.type&&t.annotations.length>0||"Text"===t.shape.type))if("Text"===t.shape.type)r=t.wrapper.children[0].id.split("_")[1];else for(var p=t.annotations.length-1;p>=0;p--)t.annotations[parseInt(p.toString(),10)].visibility&&(r=t.annotations[parseInt(p.toString(),10)].id);r&&(l=this.getWrapper(t.wrapper,r))}if(t&&l&&!(l instanceof Bi)&&(!function(t,e){var i;return i=e instanceof Co?at.ReadOnly:ht.ReadOnly,"Text"===e.shape.type?e.constraints&ht.ReadOnly:e.constraints&i?t.constraints&st.InheritReadOnly?1:0:t.constraints&st.ReadOnly?1:0}(l,t)||c)){var g=l.style,u=void 0;u=90>(u=l.bounds.width<t.wrapper.bounds.width?l.bounds.width:t.wrapper.bounds.width)?90:u;var f=document.getElementById(this.element.id+"_editTextBoxDiv"),m=document.getElementById(this.element.id+"_editBox");if(a=m?m.value:l.content,this.activeLabel.text=a,f||m||(f=ud("div",{}),m=ud("textarea",{}),this.diagramCanvas.appendChild(f),f.appendChild(m),m.appendChild(document.createTextNode(a))),(s=$h(l.style,a,void 0,void 0,u)).isEmpty()&&(s="Text"!==t.shape.type?new i(is(t,l.id.split(t.id+"_")[1]).width||50,l.style.fontSize):new i(t.width>50?50:t.width,l.style.fontSize)),t.parentId&&"UmlClassifier"===this.nameTable[t.parentId].shape.type?(s.width=t.wrapper.bounds.width-20,h=(t.wrapper.bounds.center.x+n.tx)*n.scale-s.width/2*o-2.5,d=(t.wrapper.bounds.center.y+n.ty)*n.scale-s.height/2*o-3,l.style.textAlign="Left"):(s.width=Math.max(s.width,50),h=(l.bounds.center.x+n.tx)*n.scale-s.width/2*o-2.5,d=(l.bounds.center.y+n.ty)*n.scale-s.height/2*o-3),l.flippedPoint&&Ws(l)){var y=l.flippedPoint.x-l.corners.topLeft.x,v=l.flippedPoint.y-l.corners.topLeft.y;h+=y,d+=v,l.flipTransformOffset={x:y,y:v}}Id(f,{id:this.element.id+"_editTextBoxDiv",style:"position: absolute;left:"+h+"px;top:"+d+"px;width:"+(s.width+1)*o+"px;height:"+s.height*o+"px; containerName:"+t.id+";"}),Id(m,{"aria-label":a,id:this.element.id+"_editBox",style:"width:"+(s.width+1)*o+"px;height:"+s.height*o+"px;resize: none;outline: none;overflow: hidden;;font-family:"+g.fontFamily+";font-size:"+g.fontSize*o+"px;text-align:"+l.style.textAlign.toLocaleLowerCase()+";",class:"e-diagram-text-edit"}),m.style.fontWeight=g.bold?"bold":"",m.style.fontStyle=g.italic?"italic":"",m.style.lineHeight=(1.2*g.fontSize+"px;").toString(),m.style.textDecoration=g.textDecoration?g.textDecoration:"",this.activeLabel.parentId=t.id,this.activeLabel.id=r,l.visible=!1,this.updateDiagramObject(t),this.diagramActions=this.diagramActions|yt.TextEdit,this.isTriggerEvent||(e.EventHandler.add(m,"input",this.eventHandler.inputChange,this.eventHandler),e.EventHandler.add(m,"focusout",this.focusOutEdit,this),m.select())}}}},r.prototype.updateConnectorfixedUserHandles=function(t){if(t.fixedUserHandles.length)for(var e=void 0,r=0,n=t.fixedUserHandles;r<n.length;r++){var o=n[r];e=this.getWrapper(t.wrapper,o.id),t.updateAnnotation(o,t.intermediatePoints,t.wrapper.bounds,e)}t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize)},r.prototype.updateNodeExpand=function(t,e){for(var i=0;i<t.outEdges.length;i++){var r=this.nameTable[t.outEdges[parseInt(i.toString(),10)]],n=this.nameTable[r.targetID];r.visible=e,n&&(e||(this.updateElementVisibility(r.wrapper,r,!1),n.isExpanded=e),this.updateNodeExpand(n,n.isExpanded),n.visible=e,e||this.updateElementVisibility(n.wrapper,n,!1))}},r.prototype.updateConnectorAnnotation=function(t){if(t.annotations.length)for(var e=void 0,r=0,n=t.annotations;r<n.length;r++){var o=n[r];e=this.getWrapper(t.wrapper,o.id),t.updateAnnotation(o,t.intermediatePoints,t.wrapper.bounds,e,this.diagramActions&yt.Interactions)}t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize)},r.prototype.removeChildrenFromLayout=function(t){for(var e,i=[],r=0;r<t.length;r++)(e=t[parseInt(r.toString(),10)]).parentId||e.processId||i.push(e);return i},r.prototype.doLayout=function(){var t,e=!1,r="ComplexHierarchicalTree"===this.layout.type||"HierarchicalTree"===this.layout.type,n=this.isProtectedOnChange;this.protectPropertyChange(!0);var o=this.removeChildrenFromLayout(this.nodes),a=this.layout.enableRouting&&"ComplexHierarchicalTree"===this.layout.type,s={x:this.scroller.viewPortWidth,y:this.scroller.viewPortHeight},h=!1;if("None"!==this.layout.type){if(this.organizationalChartModule||this.mindMapChartModule||this.radialTreeModule||this.symmetricalLayoutModule||this.complexHierarchicalTreeModule||this.flowchartLayoutModule){var d={state:"Started",type:this.layout.type};this.triggerEvent(xt.layoutUpdated,d)}if(this.organizationalChartModule)t=this.organizationalChartModule.updateLayout(o,this.nameTable,this.layout,s,this.dataSourceSettings.id,this.diagramActions),e=!0,this.canDistribute(a,r)&&this.lineDistributionModule.initLineDistribution(this.layout,this),this.layoutAnimateModule&&t.rootNode&&!this.diagramActions?this.updateNodeExpand(t.rootNode,t.rootNode.isExpanded):this.layoutAnimateModule||!t.rootNode||t.rootNode.isExpanded||this.canExpand||this.updateNodeExpand(t.rootNode,t.rootNode.isExpanded);else if(this.mindMapChartModule)o&&o.length>0&&this.mindMapChartModule.updateLayout(o,this.nameTable,this.layout,s,this.dataSourceSettings.id,this.dataSourceSettings.root),e=!0;else if(this.radialTreeModule)this.radialTreeModule.updateLayout(o,this.nameTable,this.layout,s),e=!0;else if(this.symmetricalLayoutModule)this.symmetricalLayoutModule.maxIteration=this.layout.maxIteration,this.symmetricalLayoutModule.springLength=this.layout.springLength,this.symmetricalLayoutModule.springFactor=this.layout.springFactor,this.symmetricalLayoutModule.updateLayout(o,this.connectors,this.symmetricalLayoutModule,this.nameTable,this.layout,s),e=!0;else if(this.complexHierarchicalTreeModule){if(this.canDistribute(a,r)){this.lineDistributionModule.diagram=this;this.connectors.forEach(function(t){t.obstaclePointCollection=[]})}var l=this.complexHierarchicalTreeModule.getLayoutNodesCollection(this.nodes);l.length>0&&this.complexHierarchicalTreeModule.doLayout(l,this.nameTable,this.layout,s,this),e=!0,this.canDistribute(a,r)&&this.lineDistributionModule.initLineDistribution(this.layout,this)}else if(this.flowchartLayoutModule)this.flowchartLayoutModule.updateLayout(this.nodes,this),e=!0;else{var c="OrganizationalChart"===this.layout.type?"HierarchicalTree":this.layout.type;console.warn("[WARNING] :: Module "+c+" is not available in Diagram component! You either misspelled the module name or forgot to load it.")}if(e){this.preventDiagramUpdate=!0;for(var p={},g=0,u=o;g<u.length;g++){var f=u[g];if(this.preventNodesUpdate||this.diagramActions&&this.diagramActions&yt.PreventIconsUpdate||(this.updateIcon(f),this.updateDefaultLayoutIcons(f)),this.preventNodesUpdate=!0,this.nodePropertyChange(f,{},{offsetX:f.offsetX,offsetY:f.offsetY},!0),this.preventNodesUpdate=!1,f.wrapper.measure(new i(f.wrapper.width,f.wrapper.height)),f.wrapper.arrange(f.wrapper.desiredSize),this.updateDiagramObject(f,!0),f.inEdges.length>0)for(var m=0;m<f.inEdges.length;m++){p[(x=this.nameTable[f.inEdges[parseInt(m.toString(),10)]]).id]=x}if(f.outEdges.length>0)for(var y=0;y<f.outEdges.length;y++){var v=this.nameTable[f.outEdges[parseInt(y.toString(),10)]];p[v.id]=v}}for(var b=0,S=Object.keys(p);b<S.length;b++){var w=S[b];"SamePoint"!==this.layout.connectionPointOrigin&&this.lineDistributionModule&&a&&this.lineDistributionModule.resetConnectorSegments(this.nameTable[""+w]);var x=p[""+w],I=this.getPoints(x);"SamePoint"!==this.layout.connectionPointOrigin&&this.lineDistributionModule&&a&&this.lineDistributionModule.resetRoutingSegments(x,this,I),Qa(x,I),"Bpmn"===x.shape.type&&"Default"===x.shape.sequence&&"Sequence"===x.shape.flow&&this.commandHandler.updatePathElementOffset(x),x.wrapper.measure(new i(void 0,void 0)),x.wrapper.arrange(x.wrapper.desiredSize),this.updateConnectorAnnotation(x),this.updateConnectorfixedUserHandles(x),this.updateQuad(x),this.updateDiagramObject(x,!0)}(a||"DifferentPoint"===this.layout.connectionPointOrigin&&this.lineDistributionModule&&r)&&(this.layout.enableRouting&&(this.refreshRoutingConnectors(),h=!0),"SamePoint"!==this.layout.connectionPointOrigin&&this.lineDistributionModule&&this.lineDistributionModule.distributeLines(this.layout,this)),this.refreshFlowChartConnectors(),this.preventDiagramUpdate=!1,this.updatePage(),this.diagramActions&yt.Render&&"Canvas"!==this.mode||(this.refreshDiagramLayer(),this.isRefreshed=!0)}n||this.protectPropertyChange(n)}if(e&&this.updateDiagramElementQuad(),this.diagramActions&yt.Render&&this.layout.enableRouting&&!h&&this.refreshRoutingConnectors(),e){d={state:"Completed",type:this.layout.type};this.triggerEvent(xt.layoutUpdated,d)}return!(this.blazorActions&$.expandNode)||t},r.prototype.refreshRoutingConnectors=function(){var t=this.isProtectedOnChange;if(this.isProtectedOnChange=!0,this.routingConnectors)for(var e=0;e<this.routingConnectors.length;e++){var i=this.routingConnectors[parseInt(e.toString(),10)],r=this.nameTable[i.sourceID],n=this.nameTable[i.targetID],o=new Pl;r.visible&&n.visible&&(o.renderVirtualRegion(this,!0),o.refreshConnectorSegments(this,i,!0,!0),this.routingConnectors.splice(e,1),e--)}this.isProtectedOnChange=t},r.prototype.refreshFlowChartConnectors=function(){if(this.flowchartLayoutModule){this.flowchartLayoutModule.reRouteFlowChartConnectors(this.layout.flowChartData,this);for(var t=0;t<this.connectors.length;t++){var e=this.connectors[parseInt(t.toString(),10)];Qa(e,this.getPoints(e)),e.wrapper.measure(new i(void 0,void 0)),e.wrapper.arrange(e.wrapper.desiredSize),this.updateConnectorAnnotation(e),this.updateConnectorfixedUserHandles(e),this.updateQuad(e),this.updateDiagramObject(e,!0)}}},r.prototype.canDistribute=function(t,e){var i="SamePoint"!==this.layout.connectionPointOrigin&&t||"DifferentPoint"===this.layout.connectionPointOrigin&&e||"Linear"===this.layout.arrangement&&"SamePoint"!==this.layout.connectionPointOrigin;return!(!this.lineDistributionModule||!i)||(i&&console.warn('[WARNING] :: Module "LineDistribution" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),!1)},r.prototype.saveDiagram=function(){for(var t,e,i=[],r=0;r<this.nodes.length;r++)if("SwimLane"===(t=this.nodes[parseInt(r.toString(),10)]).shape.type){e=t.wrapper.children[0].childTable;for(var n=0,o=Object.keys(e);n<o.length;n++){i=Da(e[""+o[n]],i)}for(var a=0;a<i.length;a++)this.nameTable[i[parseInt(a.toString(),10)]]&&(this.swimlaneChildTable[i[parseInt(a.toString(),10)]]=this.nameTable[i[parseInt(a.toString(),10)]].zIndex);this.swimlaneZIndexTable[t.id]=t.zIndex}return Ea(this)},r.prototype.loadDiagram=function(t,e){if(e&&this.ej1SerializationModule){var i=JSON.parse(t);t=this.ej1SerializationModule.getSerializedData(i)}else e&&console.warn('[WARNING] :: Module "Ej1Serialization" is not available in Diagram component! You either misspelled the module name or forgot to load it.');return Ba(t,this)},r.prototype.saveDiagramAsMermaid=function(){return this.layout&&"Flowchart"===this.layout.type?this.saveFlowDiagramInMermaidFormat():this.layout&&"MindMap"===this.layout.type?this.saveMindmapDiagramInMermaidFormat():this.saveSequenceDiagramAsMermaid()},r.prototype.saveMindmapDiagramInMermaidFormat=function(){var t="",e=[];if(this.layout&&"MindMap"===this.layout.type&&(e.push("mindmap"),this.nodes.length>0)){var i=this.nodes.filter(function(t){return 0===t.inEdges.length})[0],r=this.convertMindmapToMermaid(i,0);e.push(r);var n=i.outEdges;this.updateTextDataSource(e,n,1),t=(e=e.filter(function(t){return""!==t.trim()})).join("\n")}return t},r.prototype.updateTextDataSource=function(t,e,i){for(var r=0;r<e.length;){var n=this.getObject(e[parseInt(r.toString(),10)]),o=this.getObject(n.targetID),a=this.convertMindmapToMermaid(o,i);t.push(a);var s=o.outEdges;s.length>0&&this.updateTextDataSource(t,s,i+1),r++}},r.prototype.convertMindmapToMermaid=function(t,e){var i=t.id,r=" ".repeat(2*(e+1)),n=t.annotations.length>0?t.annotations[0].content.replace(/\n/g," "):"",o=r+n,a=r+i;if(t.shape&&"Basic"===t.shape.type){var s=t.shape;"Rectangle"===s.shape?o=a+"["+n+"]":"Ellipse"===s.shape?o=a+"(("+n+"))":"Hexagon"===s.shape&&(o=a+"{{"+n+"}}")}else if(t.shape&&"Flow"===t.shape.type){"Terminator"===t.shape.shape&&(o=a+"("+n+")")}else if(t.shape&&"Path"===t.shape.type){var h=t.shape;h.data===this.bangShape?o=a+"))"+n+"((":h.data===this.cloudShape&&(o=a+")"+n+"(")}return o},r.prototype.saveFlowDiagramInMermaidFormat=function(){var t=this,e=[],i="graph TD\n",r={nodes:this.nodes,edges:this.connectors},n=r.nodes.reduce(function(t,e){return t[e.id]=e.annotations.length?e.annotations[0].content:"",t},{});return r.edges.forEach(function(r){var o=r.sourceID,a=r.targetID,s=(n[""+o],n[""+a],t.nameTable[""+o]),h=t.nameTable[""+a],d=t.getNodeShape(s),l=t.getNodeShape(h),c=r.annotations[0]&&""!==r.annotations[0].content?"|"+r.annotations[0].content+"|":"";-1===e.indexOf(o)?e.push(o):d="",-1===e.indexOf(a)?e.push(a):l="";var p=t.arrowType(r);i+=" "+o+d+" "+p+c+" "+a+l+"\n"}),r.nodes.forEach(function(t){var e=t.id,r=t.style.fill,n=t.style.strokeColor,o=t.style.strokeWidth+"px";i+=" style "+e+" fill:"+r+",stroke:"+n+",stroke-width:"+o+";\n"}),i},r.prototype.arrowType=function(t){var e=t.targetDecorator.shape,i=t.style.strokeDashArray,r=t.style.strokeWidth;return t.style.opacity<1?"~~~":""!==i?"-.->":"Arrow"===e?r>1?"==>":"--\x3e":"None"===e?"---":"--\x3e"},r.prototype.getNodeShape=function(t){var e=t.annotations.length>0?t.annotations[0].content:"",i=t.shape.shape;if(!i){var r=t.shape.data;return"M 0 0 A 1 1 0 0 0 7 0 A 1 1 0 0 0 0 0 M -1 0 A 1 1 0 0 0 8 0 A 1 1 0 0 0 -1 0"===r?"((("+e+")))":"M 0 0 L 1 -1 L 5 -1 L 6 0 L 0 0"===r?"[/"+e+"\\]":"M 0 1 L 0 6 C 2 7 4 7 6 6 L 6 1 C 5 0 1 0 0 1 C 1 2 5 2 6 1"===r?"[("+e+")]":"M 0 0 L 12 0 L 14 2 L 2 2 L 0 0"===r?"[\\"+e+"\\]":"M 0 0 L 5 0 L 4 1 L 1 1 L 0 0"===r?"[\\"+e+"/]":"M 0 0 L 2 -2 L 11 -2 L 13 0 L 11 2 L 2 2 L 0 0"===r?"{{"+e+"}}":">"+e+"]"}switch(i){case"Terminator":return"(["+e+"])";case"Process":default:return"["+e+"]";case"Decision":return"{"+e+"}";case"Parallelogram":return"[/"+e+"/]";case"Ellipse":return"(("+e+"))";case"PreDefinedProcess":return"[["+e+"]]"}},r.prototype.loadDiagramFromMermaid=function(t){this.layout&&"Flowchart"===this.layout.type&&this.flowchartLayoutModule?this.convertMermaidToFlowChart(t):this.layout&&"MindMap"===this.layout.type&&this.mindMapChartModule?this.convertMermaidToMindmap(t):this.isSequenceDiagram(t)?this.loadSequenceDiagramFromMermaid(t):console.warn('[WARNING] :: Module "FlowchartLayout" or "MindMap" is not available in Diagram component! You either misspelled the module name or forgot to load it.')},r.prototype.countLeadingSpaces=function(t){for(var e=0,i=t.length;e<i&&" "===t.charAt(e);)e++;return e},r.prototype.convertMermaidToMindmap=function(t){if(t&&this.layout&&"MindMap"===this.layout.type&&this.mindMapChartModule){var e=t.split(/\r?\n/).filter(function(t){return t.trim().length>0});this.clear(),this.mermaidNodeBaseCollection=[];var i=[],r={text:"",children:[],currentLevel:0,branch:"Left"},n=[],o=!1,a=!1,s=!1;if(e.length>0){for(var h=function(t){var h=e[parseInt(t.toString(),10)],l=0,c="",p=d.countLeadingSpaces(h),g=h.includes('"`');if(a=h.includes('`"'),s=(o=!!g||o)||s?s:0===p&&t>0,o&&a&&!g)return r.text+="\n"+h,o=!1,"continue";if(!g&&o)return r.text+="\n"+h,"continue";if(o=!a&&o,h.length>0&&(/\s/.test(h[0])&&t>0||0===p)){if(-1!==n.findIndex(function(t){return t.space===p.toString()}))for(var u=n.length-1;u>=0;u--){var f=n[parseInt(u.toString(),10)];if((m=parseFloat(f.space))>p)n.splice(u,1);else{if(m<p){n.push({space:p.toString(),level:f.level+1}),l=f.level+1;break}if(m===p){l=f.level;break}}}else if(0===n.length)n.push({space:p.toString(),level:1}),l=1;else{for(u=n.length-1;u>=0;u--){var m,y=n[parseInt(u.toString(),10)];if(!((m=parseFloat(y.space))>p)){var v=n[n.length-1];n.push({space:p.toString(),level:v.level+1});break}n.splice(u,1)}l=n[n.length-1].level}c=h.trim().replace(/^[+-]/,"")}var b={text:c,branch:void 0,children:[],currentLevel:0===t?0:l-1};if(i.length>0){for(;i.length>=l&&0!==i.length;)i.pop();i.length>0&&i[i.length-1].children.push(b)}else 0;i.push(b),r=b},d=this,l=0;l<e.length;l++)h(l);var c=i[0];if("mindmap"===c.text||s){if(s){var p=this.getNodeDetails(c),g={id:p.nodeId,shape:p.nodeShapeData,annotations:[{content:p.annotationContent}]};this.mermaidNodeBaseCollection.push(g),this.createDataSource(c.children,c,g.id)}else{var u=c.children[0],f=this.getNodeDetails(u),m={id:f.nodeId,shape:f.nodeShapeData,annotations:[{content:f.annotationContent}]};this.mermaidNodeBaseCollection.push(m),this.createDataSource(u.children,u,m.id)}this.addElements(this.mermaidNodeBaseCollection),this.doLayout()}}}},r.prototype.saveSequenceDiagramAsMermaid=function(){var t=this.model;return t.isLoadedFromMermaid?t.mermaidData:t.generateMermaidFromModel()},r.prototype.isSequenceDiagram=function(t){var e=t.split(/\r?\n/).filter(function(t){return t.trim().length>0});return e.length>0&&"sequenceDiagram"===e[0].trim()},r.prototype.loadSequenceDiagramFromMermaid=function(t){this.model={},this.model.parse(t,this),this.initLayerObjects();var e=this.isProtectedOnChange;this.protectPropertyChange(!0),this.model.loadDiagramFromMermaid(t,this),this.refreshDiagramLayer(),e||this.protectPropertyChange(e),this.fitToPage({mode:"Page",region:"Content",margin:{left:10,top:10,right:10,bottom:10},canZoomIn:!0,canZoomOut:!0})},r.prototype.createDataSource=function(t,e,i){for(var r=0;r<t.length;){var n=t[parseInt(r.toString(),10)],o=this.getNodeDetails(n),a={id:o.nodeId,shape:o.nodeShapeData,annotations:[{content:o.annotationContent}]},s={sourceID:i,targetID:a.id};this.mermaidNodeBaseCollection.push(a),this.mermaidNodeBaseCollection.push(s),this.createDataSource(n.children,n,a.id),r++}},r.prototype.getNodeDetails=function(t){var e=t.text.match(/^(.*?)\s*([\\[\\(\\{][\s\S]*?[\]\\)\\}]|[)\\(][\s\S]*|[)\\{][\s\S]*|[)\\(][^{}()\\[\]]*$)/),i=E(),r=t.text,n={type:"Basic",shape:"Rectangle"};if(e){i=e[1]?e[1]:i;var o=e[2].trim().replace(/["`]/g,""),a=o.charAt(0);"["===a?r=o.slice(1,-1):"("===a?(r=o.startsWith("((")?o.slice(2,-1):o.slice(1,-1),n=o.startsWith("((")?{type:"Basic",shape:"Ellipse"}:{type:"Flow",shape:"Terminator"}):")"===a?(r=o.startsWith("))")?o.slice(2,-2):o.slice(1,-1),n=o.startsWith("))")?{type:"Path",data:this.bangShape}:{type:"Path",data:this.cloudShape}):"{"===a&&(r=o.slice(2,-1),n={type:"Basic",shape:"Hexagon"})}return{nodeId:i,annotationContent:r,nodeShapeData:n}},r.prototype.convertMermaidToFlowChart=function(t){var e=[];this.clear();for(var i=(t=t.replace(/;(?!\s*[\n\r])/g,";\n")).trim().split("\n"),r=function(t){var r=i[parseInt(t.toString(),10)];(r=r.trim()).endsWith(";")&&!r.startsWith("style")&&(r=r.slice(0,-1).trim());if(""!==r&&!["%","subgraph","graph","flowchart","end","End"].some(function(t){return r.startsWith(t)}))if(r.startsWith("style"))n.parseStyle(r,e);else{var o=n.getLineSplitting(r),a=[o[0],o[1]],s=n.getNodeData(a,e,o[2]);if(s&&s.length>0){var h=s[s.length-1];h.arrowType=o[2],""!==o[3]&&(h.label&&h.label.some(function(t){return t.trim().length>0})?h.label.push(o[3]):(h.label=[],h.label[h.parentId.length-1]=o[3])),s.filter(function(t){return t.parentId&&0===t.parentId.length}).forEach(function(t){t.parentId=null}),e=e.concat(s)}}},n=this,o=1;o<i.length;o++)r(o);this.createFlowChart(e),this.doLayout(),this.clearHistory()},r.prototype.createFlowChart=function(t){for(var e=[],i=0;i<t.length;i++){var r={id:(o=t[parseInt(i.toString(),10)]).id,shape:o.shape,annotations:[{content:o.name}],style:{fill:o.color,strokeColor:o.stroke,strokeWidth:o.strokeWidth}};e.push(r)}for(var n=0;n<t.length;n++){var o,a=Ns(o=t[parseInt(n.toString(),10)]);if(o.parentId&&o.parentId.length>1)for(var s=0;s<o.parentId.length;s++){var h={id:E(),sourceID:o.parentId[parseInt(s.toString(),10)],targetID:o.id,annotations:[{content:o.label?o.label[parseInt(s.toString(),10)]:""}],style:{strokeWidth:a.strokeWidth?a.strokeWidth:1,strokeDashArray:a.strokeDashArray?a.strokeDashArray:"",opacity:void 0!==a.opacity?a.opacity:1},targetDecorator:{shape:a.targetDecorator}};e.push(h)}else if(o.parentId&&1===o.parentId.length){h={id:E(),sourceID:o.parentId[0],targetID:o.id,annotations:[{content:o.label?o.label[0]:""}],style:{strokeWidth:a.strokeWidth?a.strokeWidth:1,strokeDashArray:a.strokeDashArray?a.strokeDashArray:"",opacity:void 0!==a.opacity?a.opacity:1},targetDecorator:{shape:a.targetDecorator}};e.push(h)}}this.addElements(e)},r.prototype.getLineSplitting=function(t){var e,i,r,n="",o=t.match(/^(.*?)\s*(-->|---|--\s*.*?\s*-->|~~~|==>|===|==\s*.*?\s*==>|\s*-\.\s*->|\s*-\.\s*-|\s*-\.\s*.*?\s*\.\s*->|\s*-\..*?\.\s*->)(.*)$/);if(o){e=o[1].trim();var a=o[2].trim();i=o[3].trim();var s=a.match(/(-\.|\\-\\-|==|--|~~)(.*?)(\1>|\.->|==>|\\->|~~>)/),h=void 0,d="";if(s)h={text:s[2].trim()||null,arrowType:s[1]+s[3]};else h={text:null,arrowType:a};n=null!==h.text?h.text:"",r=(d=h.arrowType).includes("--\x3e")?"single-line-arrow":d.includes("---")?"single-line":d.includes("==>")?"double-line-arrow":d.includes("==")?"double-line":d.includes("~~~")?"wiggly-arrow":d.includes("-.->")||d.includes(".->")?"dotted-arrow":d.includes("-.-")||d.includes(".-")?"dotted":"single-line-arrow"}else e=t.trim(),i=null;return[e,i,r,n]},r.prototype.parseStyle=function(t,e){if(t.startsWith("style")){var i=t.match(/^style\s+(\w+)\s+fill:([^,]+),stroke:([^,]+),stroke-width:(\d+)px;/);if(i){var r={id:i[1],fill:i[2],stroke:i[3],strokeWidth:parseInt(i[4],10)},n=e.filter(function(t){return t.id===r.id});n[0].color=r.fill,n[0].stroke=r.stroke,n[0].strokeWidth=r.strokeWidth}}},r.prototype.getNodeData=function(t,e,i){for(var r=[],n=null,o=null,a=0,s="",h=function(i){var h=t[parseInt(i.toString(),10)];if(h){var l=d.splitNested(h);if(l&&l[0].includes("|")){var c=l[0].match(/\|([^|]*)\|/);c&&(s=c[1]);var p=l[0].split("|");p.length>=3&&(l[0]=p[2].trim())}var g=l[0].trim().replace(/;$/,"");0===i?n=g:o=g;var u=e.find(function(t){return t.id===g});if(u)a++;else{var f=l.length>1?l[1]:l[0],m=d.getShape(f),y=f.replace(/[\\[\]\\(\\)\\{\\}\\{\\}\\/>]/g,""),v={id:g,name:y,shape:m,color:"white",parentId:[]};r.push(v)}}},d=this,l=0;l<t.length;l++)h(l);if(r.length){var c=r[r.length-1];if(c.id!==n)c.parentId.push(n),c.label?c.label.push(s):c.label=[s];else{var p=e.find(function(t){return t.id===o});p&&(p.parentId?p.parentId.push(n):p.parentId=[n],p.label?p.label.push(s):p.label=[s])}}else if(2===a){var g;(g=e.filter(function(t){return t.id===o})[0]).parentId=g.parentId||[],g.parentId.push(n),g.label=g.label||[],g.label[g.parentId.length-1]=s}i&&((g=e.filter(function(t){return t.id===o})[0])&&(g.arrowType=i));return r},r.prototype.splitNested=function(t){for(var e=[],i="",r=0,n="",o=0,a=t;o<a.length;o++){var s=a[o];"["===s||"{"===s||"("===s||">"===s?0===r?(i.trim().length>0&&e.push(i.trim()),i=s,n=s,r++):(i+=s,r++):"]"===s||"}"===s||")"===s?1===r&&s===n?(i+=s,e.push(i.trim()),i="",r--):r>1?(i+=s,r--):i+=s:i+=s}return i.trim().length>0&&e.push(i.trim()),e},r.prototype.getShape=function(t){var e={};return t.startsWith("(((")?e={type:"Path",data:"M 0 0 A 1 1 0 0 0 7 0 A 1 1 0 0 0 0 0 M -1 0 A 1 1 0 0 0 8 0 A 1 1 0 0 0 -1 0"}:t.startsWith("((")?e={shape:"Ellipse",type:"Basic"}:t.startsWith("([")?e={type:"Flow",shape:"Terminator"}:t.startsWith("(")?e={type:"Flow",shape:"Process"}:t.startsWith("[[")?e={type:"Flow",shape:"PreDefinedProcess"}:t.startsWith("[/")?e=t.endsWith("/]")?{type:"Basic",shape:"Parallelogram"}:{type:"Path",data:"M 0 0 L 1 -1 L 5 -1 L 6 0 L 0 0"}:t.startsWith("[(")?e={type:"Path",data:"M 0 1 L 0 6 C 2 7 4 7 6 6 L 6 1 C 5 0 1 0 0 1 C 1 2 5 2 6 1"}:t.startsWith("[\\")?e=t.endsWith("\\]")?{type:"Path",data:"M 0 0 L 12 0 L 14 2 L 2 2 L 0 0"}:{type:"Path",data:"M 0 0 L 5 0 L 4 1 L 1 1 L 0 0"}:t.startsWith("[")?e={type:"Basic",shape:"Rectangle"}:t.startsWith("{{")?e={type:"Path",data:"M 0 0 L 2 -2 L 11 -2 L 13 0 L 11 2 L 2 2 L 0 0"}:t.startsWith("{")?e={type:"Flow",shape:"Decision"}:t.startsWith(">")&&(e={type:"Path",data:"M 0 0 L 8 0 L 8 2 L 0 2 L 2 1 L 0 0"}),e},r.prototype.getDiagramContent=function(t){return this.printandExportModule?this.printandExportModule.getDiagramContent(t):(console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),"")},r.prototype.exportImage=function(t,e){this.printandExportModule?this.printandExportModule.exportImages(t,e):console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.')},r.prototype.printImage=function(t,e){this.printandExportModule?(e.printOptions=!0,this.printandExportModule.exportImages(t,e)):console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.')},r.prototype.setStackLimit=function(t){this.undoRedoModule&&t&&(this.historyManager.stackLimit=t,this.undoRedoModule.applyLimit(this.historyManager.currentEntry,t,this,!0))},r.prototype.clearHistory=function(){this.undoRedoModule&&this.undoRedoModule.clearHistory(this)},r.prototype.getDiagramBounds=function(){if(this.printandExportModule){var t=this.printandExportModule.getDiagramBounds("",{});return t.width=t.width>this.scrollSettings.viewPortWidth?t.width+(t.x>0?t.x:0):this.scrollSettings.viewPortWidth,t.height=t.height>this.scrollSettings.viewPortHeight?t.height+(t.y>0?t.y:0):this.scrollSettings.viewPortHeight,t.x=t.x>0?0:t.x,t.y=t.y>0?0:t.y,t}return console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),new w},r.prototype.exportDiagram=function(t){return this.printandExportModule?this.printandExportModule.exportDiagram(t):(console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),"")},r.prototype.print=function(t){this.printandExportModule?this.printandExportModule.print(t):console.warn('[WARNING] :: Module "PrintAndExport" is not available in Diagram component! You either misspelled the module name or forgot to load it.')},r.prototype.addPorts=function(t,e){this.protectPropertyChange(!0);var r;t=this.nameTable[t.id]||t,e.length>1&&this.startGroupAction();for(var n=function(i){if(t.ports.some(function(t){return t.id===e[parseInt(i.toString(),10)].id}))return"continue";if(t instanceof Yh?(r=new ye(t,"ports",e[parseInt(i.toString(),10)],!0),t.ports.push(r)):t instanceof Co&&(r=new ve(t,"ports",e[parseInt(i.toString(),10)],!0),t.ports.push(r)),t.children)for(var n=t.wrapper,a=0;a<n.children.length;a++){var s=n.children[parseInt(a.toString(),10)];if(s.id.match(n.id)){t.initPort(o.getDescription,s,r);break}}else{var h=t.wrapper;if(t instanceof Yh)h.children.push(t.initPortWrapper(t.ports[t.ports.length-1]));else if(t instanceof Co){var d="Bezier"===t.type?t.intermediatePoints:t.getConnectorPoints(t.type);d=t.clipDecorators(t,d);var l=w.toBounds(d);h.children.push(t.initPort(t.ports[t.ports.length-1],d,l,void 0))}}if(!(o.diagramActions&yt.UndoRedo||o.diagramActions&yt.Group)){var c={type:"PortCollectionChanged",changeType:"Insert",undoObject:N(r),redoObject:N(t),category:"Internal"};o.addHistoryEntry(c)}},o=this,a=0;a<e.length;a++)n(a);e.length>1&&this.endGroupAction(),t.wrapper.measure(new i(t.width,t.height)),t.wrapper.arrange(t.wrapper.desiredSize),this.updateDiagramObject(t),this.protectPropertyChange(!1)},r.prototype.addConstraints=function(t,e){return t|e},r.prototype.removeConstraints=function(t,e){return t&~e},r.prototype.addNodeLabels=function(t,e){this.addLabels(t,e)},r.prototype.addConnectorLabels=function(t,e){this.addLabels(t,e)},r.prototype.addLabels=function(t,e){this.protectPropertyChange(!0);var r,n=(t=this.nameTable[t.id]||t).wrapper;e.length>1&&this.startGroupAction();for(var o=0;o<e.length;o++){if(t instanceof Yh)if(r=new Ie(t,"annotations",e[parseInt(o.toString(),10)],!0),t.annotations.push(r),t.children)for(var a=t,s=0;s<a.wrapper.children.length;s++){if(a.wrapper.children[parseInt(s.toString(),10)].id===a.id+"group_container")a.wrapper.children[parseInt(s.toString(),10)].children.push(t.initAnnotationWrapper(t.annotations[t.annotations.length-1],this.element.id))}else n.children.push(t.initAnnotationWrapper(t.annotations[t.annotations.length-1],this.element.id));else if(t instanceof Co){r=new Pe(t,"annotations",e[parseInt(o.toString(),10)],!0),t.annotations.push(r);var h=n.children[0],d=new w(h.offsetX-h.width/2,h.offsetY-h.height/2,h.width,h.height);n.children.push(t.getAnnotationElement(t.annotations[t.annotations.length-1],t.intermediatePoints,d,this.getDescription,this.element.id))}if(!(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.Group)){var l={type:"LabelCollectionChanged",changeType:"Insert",undoObject:N(r),redoObject:N(t),category:"Internal"};this.addHistoryEntry(l)}}e.length>1&&this.endGroupAction(),t.wrapper.measure(new i(n.width,n.height)),t.wrapper.arrange(n.desiredSize),this.updateDiagramObject(t),this.protectPropertyChange(!1),this.refreshCanvasLayers()},r.prototype.addChildToUmlNode=function(t,e,i){var r,n,o,a,s="NoWrap";"Class"===t.shape.classifier||"Interface"===t.shape.classifier?"Method"===i?(n=new Bh(t,"",e),"Class"===t.shape.classifier?(t.shape.classShape.methods.push(n),r=t.shape.classShape):"Interface"===t.shape.classifier&&(t.shape.interfaceShape.methods.push(n),r=t.shape.interfaceShape),function(t,e,i,r){if(i.methods&&i.methods.length){var n=i.methods,o="",a="",s=void 0,h=1,d=void 0,l=0,c=0,p=t.shape,g="Class"===p.classifier,u=(p.classifier,g?p.classShape:p.interfaceShape);1===n.length?u.attributes.length>0?(l=u.attributes.filter(function(t){return t.isSeparator}).length,d=(h=2+u.attributes.length+l)+1,qs(t,e,h)):d=h+1:(l=u.attributes.filter(function(t){return t.isSeparator}).length,c=u.methods.filter(function(t){return t.isSeparator}).length,d=(h=2+u.attributes.length+l+u.methods.length+c)+1);for(var f=0;f<n.length;f++){var m=n[n.length-1];if(s=m.scope&&"Public"===m.scope?" +":m.scope&&"Private"===m.scope?"-":m.scope&&"Protected"===m.scope?"#":"~",m.parameters)for(var y=0;y<m.parameters.length;y++)m.parameters[parseInt(y.toString(),10)].type?o+=m.parameters[parseInt(y.toString(),10)].name+":"+m.parameters[parseInt(y.toString(),10)].type:o+=m.parameters[parseInt(y.toString(),10)].name,y!==m.parameters.length-1&&(o+=",");if(""!==m.name&&s&&(a+=s+" "+m.name+"("+o+") : "+m.type),f!==n.length){var v=Qs(t,m),b=new Yh(e,"nodes",{id:E()+"_umlMethods",verticalAlignment:"Stretch",horizontalAlignment:"Stretch",annotations:[{id:"name",content:a,offset:{x:0,y:.5},style:{bold:!0,fontSize:v.fontSize,color:v.color,fill:v.fill,textWrapping:r,italic:v.italic,fontFamily:v.fontFamily,whiteSpace:v.whiteSpace,textAlign:v.textAlign,textDecoration:v.textDecoration,textOverflow:v.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor},minHeight:25,constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize)},!0);b.parentId=t.id,b.umlIndex=d,e.add(b),a=""}break}}}(t,this,r,s)):"Attribute"===i&&(o=new kh(t,"",e),"Class"===t.shape.classifier?(t.shape.classShape.attributes.push(o),r=t.shape.classShape):"Interface"===t.shape.classifier&&(t.shape.interfaceShape.attributes.push(o),r=t.shape.interfaceShape),function(t,e,i,r){if(i.attributes&&i.attributes.length){var n=i.attributes,o="",a=void 0;1===n.length&&qs(t,e,n.length);for(var s=0,h=0;h<n.length-1;h++)!0===n[parseInt(h.toString(),10)].isSeparator&&s++;var d=n.length+s+1;for(h=0;h<n.length;h++){var l=n[n.length-1];if(a=l.scope&&"Public"===l.scope?" +":l.scope&&"Private"===l.scope?"-":l.scope&&"Protected"===l.scope?"#":"~",""!==l.name&&a&&(o+=a+" "+l.name+" : "+l.type),h!==n.length){var c=Qs(t,l),p=new Yh(e,"nodes",{id:E()+"_umlProperty",style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor},annotations:[{id:"name",content:o,offset:{x:0,y:.5},style:{bold:!0,fontSize:c.fontSize,color:c.color,fill:c.fill,textWrapping:r,italic:c.italic,fontFamily:c.fontFamily,whiteSpace:c.whiteSpace,textAlign:c.textAlign,textDecoration:c.textDecoration,textOverflow:c.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],verticalAlignment:"Stretch",horizontalAlignment:"Stretch",constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),minHeight:25},!0);p.parentId=t.id,p.umlIndex=d,e.add(p),o=""}break}}}(t,this,r,s)):"Enumeration"===t.shape.classifier&&"Member"===i&&(a=new jh(t,"",e),t.shape.enumerationShape.members.push(a),function(t,e,i,r){if("Enumeration"===t.shape.classifier){var n=i.members,o="";1===n.length&&qs(t,e,n.length);for(var a=0,s=0;s<n.length-1;s++)!0===n[parseInt(s.toString(),10)].isSeparator&&a++;var h=n.length+a+1;for(s=0;s<n.length;s++){var d=n[n.length-1];if(""!==d.name&&(o+=d.name),s!==n.length){var l=Qs(t,d),c=new Yh(e,"nodes",{id:E()+"_umlMember",annotations:[{id:"name",content:o,offset:{x:0,y:.5},style:{bold:!0,fontSize:l.fontSize,color:l.color,fill:l.fill,textWrapping:r,italic:l.italic,fontFamily:l.fontFamily,whiteSpace:l.whiteSpace,textAlign:l.textAlign,textDecoration:l.textDecoration,textOverflow:l.textOverflow},margin:{left:14,right:5},horizontalAlignment:"Left"}],verticalAlignment:"Stretch",horizontalAlignment:"Stretch",style:{fill:t.style.fill,strokeColor:"black"===t.style.strokeColor?"#ffffff00":t.style.strokeColor,textWrapping:r},constraints:(ht.Default|ht.HideThumbs)&~(ht.Rotate|ht.Drag|ht.Resize),minHeight:25},!0);c.parentId=t.id,c.umlIndex=h,e.add(c),o=""}break}}}(t,this,r=t.shape.enumerationShape,s)),this.clearSelection(),this.updateSelector()},r.prototype.addLanes=function(t,e,i){t=this.nameTable[t.id]||t;for(var r=0;r<e.length;r++)Xr(this,t,e[parseInt(r.toString(),10)],i),void 0!==i&&(i+=1);this.updateDiagramElementQuad()},r.prototype.addPhases=function(t,e){t=this.nameTable[t.id]||t;for(var i=0;i<e.length;i++)this.protectPropertyChange(!0),Ur(this,t,e[parseInt(i.toString(),10)]),this.protectPropertyChange(!1);this.updateDiagramElementQuad()},r.prototype.removeLane=function(t,e){if(e){var i=this.nameTable[e.header.id];this.diagramActions=this.diagramActions|yt.PublicMethod,tn(this,i,t,void 0),this.updateDiagramElementQuad()}},r.prototype.removePhase=function(t,e){var i=e.header.id;nn(this,this.nameTable[""+i],t),this.updateDiagramElementQuad()},r.prototype.editSegment=function(t){if("Straight"===t.connector.type){for(var e=t.connector,i=t&&t.SegmentEditing?t.SegmentEditing:"Toggle",r=t.point,n=void 0,o=void 0,a=0;a<e.segments.length;a++){if(Tn(r,e.segments[parseInt(a.toString(),10)].point,e.hitPadding)){n=!0;break}}(n&&"Remove"===i||!n&&"Add"===i)&&(o=!0),"Straight"!==e.type||!o&&"Toggle"!==i||this.connectorEditingToolModule.addOrRemoveSegment(e,r,this.commandHandler)}},r.prototype.removelabelExtension=function(t,e,i,r){for(var n=0;n<r.children.length;n++){var o=r.children[parseInt(n.toString(),10)];if((o instanceof Zt||o instanceof Bi)&&o.id.match("_"+e[parseInt(i.toString(),10)].id+"$")){for(var a=0;a<t.annotations.length;a++)if(o.id.match("_"+t.annotations[parseInt(a.toString(),10)].id+"$")){if(!(this.diagramActions&yt.UndoRedo)){var s={type:"LabelCollectionChanged",changeType:"Remove",undoObject:N(t.annotations[parseInt(a.toString(),10)]),redoObject:N(t),category:"Internal"};this.addHistoryEntry(s)}t.annotations.splice(a,1)}if(r.children.splice(n,1),"SVG"===this.mode){var h=id(o.id,this.element.id);if(h){var d=id(o.id,this.element.id);d.parentNode.removeChild(d)}id(o.id+"_text",this.element.id)&&(h=id(o.id+"_text",this.element.id)).parentNode.removeChild(h);var l=id(o.id+"_html_element",this.element.id);l&&l.parentNode.removeChild(l)}else this.refreshCanvasLayers()}}},r.prototype.removeLabels=function(t,e){t=this.nameTable[t.id]||t,e.length>1&&this.startGroupAction();for(var i=e.length-1;i>=0;i--)if(t.children&&t.children.length>0){var r=t.wrapper.children.filter(function(e){return e.id===t.id+"group_container"});r&&r.length>0&&this.removelabelExtension(t,e,i,r[0])}else this.removelabelExtension(t,e,i,t.wrapper);e.length>1&&this.endGroupAction(),this.refreshCanvasLayers()},r.prototype.removePortsExtenion=function(t,e,i,r){for(var n=0;n<r.children.length;n++){var o=r.children[parseInt(n.toString(),10)];if(o instanceof Qt&&o.id.match("_"+e[parseInt(i.toString(),10)].id+"$")){for(var a=0;a<t.ports.length;a++)if(o.id.match("_"+t.ports[parseInt(a.toString(),10)].id+"$")){if(!(this.diagramActions&yt.UndoRedo)){var s={type:"PortCollectionChanged",changeType:"Remove",undoObject:N(t.ports[parseInt(a.toString(),10)]),redoObject:N(t),category:"Internal"};this.addHistoryEntry(s)}t.ports.splice(a,1)}if(r.children.splice(n,1),"SVG"===this.mode){var h=id(o.id,this.element.id);h&&h.parentNode.removeChild(h)}else this.refreshCanvasLayers()}}},r.prototype.removePorts=function(t,e){t=this.nameTable[t.id]||t;var i=e.length;i>1&&this.startGroupAction();for(var r=e.length-1;r>=0;r--)if(t.children&&t.children.length>0)for(var n=0;n<t.wrapper.children.length;n++){t.wrapper.children[parseInt(n.toString(),10)].id.match(t.wrapper.id)&&this.removePortsExtenion(t,e,r,t.wrapper.children[parseInt(n.toString(),10)])}else this.removePortsExtenion(t,e,r,t.wrapper);i>1&&this.endGroupAction()},r.prototype.getSizeValue=function(t,e){var i;if(i=t.toString().indexOf("px")>0?t.toString():t.toString().indexOf("%")>0?void 0!==e?"100%":t.toString():t.toString()+"px",e){Eo(this);i="calc("+i+" - "+e+"px)"}return i},r.prototype.renderRulers=function(){var t,e,i;this.rulerSettings.showRulers?(e=Eo(t=this),i=ud("div",{id:t.element.id+"_overlapRuler",style:"height:"+e.height+"px;width:"+e.width+"px;position:absolute;left:0;top:0",class:"e-ruler-overlap"}),t.element.insertBefore(i,t.element.firstChild),Do(this,!0),Do(this,!1)):Lo(this)},r.prototype.intOffPageBackground=function(){var t=new i;t=Eo(this);var e=document.getElementById(this.element.id+"content");this.width||(this.width="100%"),this.height||(this.height="100%");var r=this.getSizeValue(this.width,t.width),n=this.getSizeValue(this.height,t.height),o=this.rulerSettings.showRulers?"width:"+r+"; height:"+n+";top:"+t.height+"px;left:"+t.width+"px;overflow: scroll;position:absolute;overflow:auto;":"width:"+r+"; height:"+n+";position:absolute; left:0px; top:0px;overflow: auto;",a={id:this.element.id+"content",tabindex:"0",style:o};e?(this.diagramCanvas=e,xd(this.diagramCanvas,o)):(this.diagramCanvas=ud("div",a),this.element.appendChild(this.diagramCanvas)),this.diagramCanvas.style.background=this.backgroundColor},r.prototype.initDiagram=function(){this.intOffPageBackground(),Id(this.element,{style:"width:"+this.getSizeValue(this.width)+"; height:"+this.getSizeValue(this.height)+";position:relative;overflow:hidden;"})},r.prototype.renderHiddenUserHandleTemplateLayer=function(t){var e=ud("div",{class:this.element.id+"_hiddenUserHandleTemplate",style:"width:"+t.width+"px; height:"+t.height+"px;visibility:hidden ; overflow: hidden;"});this.element.appendChild(e)},r.prototype.renderBackgroundLayer=function(t,e){var i=this.createSvg(this.element.id+"_backgroundLayer_svg",t.width,t.height);xd(i,e);var r=fd("g",{id:this.element.id+"_backgroundImageLayer",class:"e-background-image-layer"});i.appendChild(r);var n=fd("g",{id:this.element.id+"_backgroundLayer",class:"e-background-layer"});i.appendChild(n),this.diagramCanvas.appendChild(i)},r.prototype.renderGridLayer=function(t,e){var i=this.createSvg(this.element.id+"_gridline_svg",t.width,t.height);i.setAttribute("class","e-grid-layer");var r=fd("g",{id:this.element.id+"_gridline"}),n=fd("rect",{id:this.element.id+"_grid_rect",x:"0",y:"0",width:"100%",height:"100%"});Ls()?""!==new URL(window.location.href).search?n.setAttribute("fill","url(#"+this.element.id+"_pattern)"):n.setAttribute("fill","url("+location.protocol+"//"+location.host+location.pathname+"#"+this.element.id+"_pattern)"):n.setAttribute("fill","url(#"+this.element.id+"_pattern)");r.appendChild(n),i.appendChild(r),this.diagramCanvas.appendChild(i),wd(i,{style:e})},r.prototype.renderDiagramLayer=function(t,e){var i={id:this.element.id+"_diagramLayer_div",style:"width:"+t.width+"px; height:"+t.height+"px;"+e};if(this.diagramLayerDiv=ud("div",i),"SVG"===this.mode){var r=this.createSvg(this.element.id+"_diagramLayer_svg",t.width,t.height);r.style["pointer-events"]="none",r.setAttribute("class","e-diagram-layer");var n=fd("g",{id:this.element.id+"_diagramLayer"}),o=fd("g",{});this.diagramLayer=n,r.style["pointer-events"]="all",o.appendChild(n),r.appendChild(o),this.diagramLayerDiv.appendChild(r)}else this.diagramLayer=Md.createCanvas(this.element.id+"_diagram",t.width,t.height),xd(this.diagramLayer,"position:absolute;left:0px;top:0px;"),this.diagramLayerDiv.appendChild(this.diagramLayer);this.diagramCanvas.appendChild(this.diagramLayerDiv)},r.prototype.initLayers=function(){var t="position:absolute;top:0px;left:0px;overflow:hidden;pointer-events:none;",e=document.getElementById(this.element.id),i=e.getBoundingClientRect();this.setScaleFromElement(i,e),this.modifyBounds(i);var r=function(){var t=ud("div",{style:"visibility:hidden; width: 100px"});document.body.appendChild(t);var e=t.getBoundingClientRect().width;t.style.overflow="scroll";var i=ud("div",{style:"width:100%"});t.appendChild(i);var r=i.getBoundingClientRect().width;return t.parentNode.removeChild(t),e-r}();this.scroller.scrollerWidth=r,this.scroller.setViewPortSize(i.width,i.height),this.renderRulers();var n="measureElement";window[""+n]&&(window[""+n]=null,document.getElementById("measureElement").remove());Pd(),this.renderBackgroundLayer(i,t),this.renderGridLayer(i,t),this.renderDiagramLayer(i,t),this.renderHTMLLayer(i,t),this.renderPortsExpandLayer(i,t),this.renderNativeLayer(i,t),this.renderAdornerLayer(i,t),this.renderHiddenUserHandleTemplateLayer(i)},r.prototype.setScaleFromElement=function(t,e){var i=t.width/e.clientWidth;this.scaleValue=i},r.prototype.modifyBounds=function(t){var e=this.scaleValue;t.x=t.x/e,t.y=t.y/e,t.width=t.width/e,t.height=t.height/e},r.prototype.modifyClientOffset=function(t,e){var i=this.scaleValue;return e?t*i:t/i},r.prototype.renderAdornerLayer=function(t,e){var i=ud("div",{id:this.element.id+"_diagramAdornerLayer",style:"width:"+t.width+"px;height:"+t.height+"px;"+e}),r=ud("div",{id:this.element.id+"_diagramUserHandleLayer",style:"width:"+t.width+"px;height:"+t.height+"px;"+e});r.setAttribute("class","e-userHandle-layer"),i.appendChild(r);var n=this.createSvg(this.element.id+"_diagramAdorner_svg",t.width,t.height);n.setAttribute("class","e-adorner-layer"),n.style["pointer-events"]="none",this.adornerLayer=fd("g",{id:this.element.id+"_diagramAdorner"}),this.adornerLayer.style[" pointer-events"]="all",n.appendChild(this.adornerLayer),i.appendChild(n),this.diagramCanvas.appendChild(i);var o=fd("g",{id:this.element.id+"_SelectorElement"});this.adornerLayer.appendChild(o),wd(n,{style:"pointer-events:none;"})},r.prototype.renderPortsExpandLayer=function(t,e){var i=this.createSvg(this.element.id+"_diagramPorts_svg",t.width,t.height);i.setAttribute("class","e-ports-expand-layer");var r=fd("g",{id:this.element.id+"_diagramPorts",class:"e-ports-layer",style:"pointer-events: all;"});i.appendChild(r);var n=fd("g",{id:this.element.id+"_diagramExpander",class:"e-expand-layer",style:"pointer-events: all;"});i.appendChild(n),this.diagramCanvas.appendChild(i),wd(i,{style:e})},r.prototype.renderHTMLLayer=function(t,e){this.htmlLayer=ud("div",{id:this.element.id+"_htmlLayer",style:"width:"+t.width+"px; height:"+t.height+"px;position:absolute;top:0px;left:0px;overflow:hidden;pointer-events:none;",class:"e-html-layer"});var i=ud("div",{id:this.element.id+"_htmlLayer_div",style:"position:absolute;top:0px;left:0px;pointer-events:all;"});this.htmlLayer.appendChild(i),this.diagramCanvas.appendChild(this.htmlLayer)},r.prototype.renderNativeLayer=function(t,e){var i=this.createSvg(this.element.id+"_nativeLayer_svg",t.width,t.height),r=fd("g",{id:this.element.id+"_nativeLayer",style:"pointer-events:all;"});i.appendChild(r),this.diagramLayerDiv.appendChild(i),wd(i,{class:"e-native-layer",style:e})},r.prototype.createSvg=function(t,e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","svg");return wd(r,{id:t,width:e,height:i}),r},r.prototype.updateBazorShape=function(){for(var t=0;t<this.nodes.length;t++){var e=this.nodes[parseInt(t.toString(),10)];switch(e.shape.type){case"Bpmn":e.shape.bpmnShape=e.shape.shape;break;case"UmlActivity":e.shape.umlActivityShape=e.shape.shape;break;case"Flow":e.shape.flowShape=e.shape.shape;break;case"Basic":e.shape.basicShape=e.shape.shape;break;case"Text":e.shape.textContent=e.shape.content}}},r.prototype.initObjects=function(t){this.updateBazorShape(),this.isLoading||this.initData(),this.initLayerObjects(),this.updateBridging(t)},r.prototype.initLayerObjects=function(){for(var t=this.layers.length>1,e=[],r={},n={},o={},a=[],s=0,h=this.nodes;s<h.length;s++){(S=h[s]).id=S.id||E(),this.addToLayer(S,t),r[S.id]=S}for(var d=0,l=this.connectors;d<l.length;d++){(S=l[d]).id=S.id||E(),this.addToLayer(S,t),r[S.id]=S}this.tempTable=r;for(var c=0,p=this.layers;c<p.length;c++){for(var g=0,u=(O=p[c]).objects;g<u.length;g++){if(r[""+(S=u[g])])if(r[""+S]instanceof Co)if((L=r[""+S]).sourceID&&L.targetID){var f=r[L.sourceID],m=r[L.targetID],y=!0;this.isLoading&&(f&&f.children&&f.children.length>0||m&&m.children&&m.children.length>0)&&(y=!1),f&&f.wrapper&&m&&m.wrapper&&y?this.initConnectors(r[""+S],O):e.push(r[""+S])}else{f=r[L.sourceID],m=r[L.targetID];f&&f.children&&f.children.length>0||m&&m.children&&m.children.length>0?e.push(r[""+S]):this.initConnectors(r[""+S],O)}else r[""+S].children?a.push(S):r[""+S].shape instanceof Lh&&r[""+S].shape.activity.subProcess.processes&&r[""+S].shape.activity.subProcess.processes.length>0?n[r[""+S].id]=S:r[""+S].shape instanceof Gh&&r[""+S].shape.children&&r[""+S].shape.children.length>0?o[r[""+S].id]=S:this.initNodes(r[""+S],O)}if(this.pathDataStorage&&this.pathDataStorage.clear(),this.bpmnModule)for(var v=0,b=this.bpmnModule.bpmnTextAnnotationConnector;v<b.length;v++){var S=b[v];this.initConnectors(S,void 0,!0)}}for(var w=0,x=Object.keys(n);w<x.length;w++){S=x[w];this.initObject(r[""+S]),this.bpmnModule.updateDocks(r[""+S],this)}var I=[];Object.keys(o).length>0&&(I=this.sortContainersTopologically(o,r));for(var P=0,C=I;P<C.length;P++){S=C[P];this.initObject(r[""+S]),ah(r[""+S],this)}for(var T=0,A=this.alignGroup(a,r);T<A.length;T++){S=A[T];var O=this.commandHandler.getObjectLayer(S);this.initNodes(r[""+S],O)}for(var D=0,M=e;D<M.length;D++){var L=M[D];O=this.commandHandler.getObjectLayer(L.id);this.initConnectors(L,O)}for(var z=0,k=this.connectorOrRotatedGroups;z<k.length;z++){if((S=k[z]).children&&S.flip!==tt.None&&!this.refreshing){this.groupBounds=S.wrapper.bounds,ws(S.wrapper,S.wrapper.offsetX,S.wrapper.offsetY,this,S.wrapper.flip,void 0,void 0);for(var B=0,R=S.children;B<R.length;B++){var N=R[B],j=this.nameTable[""+N];j instanceof Co&&j.sourceID&&j.targetID&&this.updateConnectorProperties(j)}S.wrapper.measure(new i(S.wrapper.actualSize.width,S.wrapper.actualSize.height)),S.wrapper.arrange(S.wrapper.desiredSize)}}},r.prototype.hasNestingContainer=function(t,e){for(var i=!1,r=0,n=Object.keys(t);r<n.length;r++){var o=e[""+n[r]];if(o&&o.shape instanceof Gh&&Array.isArray(o.shape.children))for(var a=0,s=o.shape.children;a<s.length;a++){if(t[""+s[a]]){i=!0;break}}if(i)break}return i},r.prototype.sortContainersTopologically=function(t,e){if(!this.hasNestingContainer(t,e))return Object.keys(t);for(var i={},r={},n=[],o=0,a=Object.keys(t);o<a.length;o++){i[""+(m=a[o])]=[],r[""+m]=0}for(var s=0,h=Object.keys(t);s<h.length;s++){var d=h[s],l=e[""+d];if(l&&l.shape instanceof Gh&&Array.isArray(l.shape.children)&&l.shape.children.length>0)for(var c=0,p=l.shape.children;c<p.length;c++){t[""+(S=p[c])]&&(i[""+d].push(S),r[""+S]=(r[""+S]||0)+1)}}for(var g=[],u=0,f=Object.keys(r);u<f.length;u++){var m;0===r[""+(m=f[u])]&&g.push(m)}for(;g.length>0;){var y=g.shift();n.push(y);for(var v=0,b=i[""+y];v<b.length;v++){var S;r[""+(S=b[v])]--,0===r[""+S]&&g.push(S)}}return n.reverse()},r.prototype.alignGroup=function(t,e){var i,r,n,o,a=[],s=[];for(n=0;n<t.length;n++){var h=void 0;if((r=e[""+(i=t[parseInt(n.toString(),10)])])&&r.children.length)for(o=0;o<r.children.length;o++)h=r.children[parseInt(o.toString(),10)],t.indexOf(h)>-1&&-1===a.indexOf(h)&&-1===s.indexOf(h)&&a.splice(0,0,h);-1===a.indexOf(i)&&s.push(i)}return a=a.concat(s)},r.prototype.addToLayer=function(t,e){var i;if(e&&(i=this.commandHandler.getObjectLayer(t.id)),e&&i||this.activeLayerObjectsSet.has(t.id)||(this.activeLayer.objects.push(t.id),this.activeLayerObjectsSet.add(t.id)),(t instanceof Yh||t instanceof Co)&&("SwimLane"!==t.shape.type||t.children&&t.children.length>0)){if(t.parentId){var r=this.swimlaneZIndexTable[t.parentId],n=this.swimlaneChildTable[t.id];(r&&-1!==r||n&&-1!==n)&&(t.zIndex=this.swimlaneChildTable[t.id])}t instanceof Co&&t.sourceID&&t.targetID?this.activeLayerObjectsSet.has(t.sourceID)&&this.activeLayerObjectsSet.has(t.targetID)&&this.setZIndex(i||this.activeLayer,t):this.setZIndex(i||this.activeLayer,t)}},r.prototype.updateLayer=function(t){for(var e=0,i=Object.keys(t.layers);e<i.length;e++){for(var r=i[e],n=0,o=this.layers[""+r].objects;n<o.length;n++){var a=o[n],s=this.nameTable[""+a];void 0!==t.layers[""+r].visible?this.updateElementVisibility(s.wrapper,s,t.layers[""+r].visible):!0===t.layers[""+r].lock&&this.unSelect(s)}void 0!==t.layers[""+r].lock&&(this.layers[""+r].lock=t.layers[""+r].lock)}"SVG"!==this.mode&&this.refreshDiagramLayer()},r.prototype.updateScrollSettings=function(t,e){var i=-this.scroller.horizontalOffset+t.scrollSettings.horizontalOffset||0,r=-this.scroller.verticalOffset+t.scrollSettings.verticalOffset||0;this.scrollSettings.horizontalOffset=-this.scroller.horizontalOffset||0,this.scrollSettings.verticalOffset=-this.scroller.verticalOffset||0;var n,o="Start";this.realActions&bt.PanInProgress&&(o="Progress"),"Start"===o?(n={VerticalOffset:void 0!==e.scrollSettings.verticalOffset?e.scrollSettings.verticalOffset:this.scrollSettings.verticalOffset,HorizontalOffset:void 0!==e.scrollSettings.horizontalOffset?e.scrollSettings.horizontalOffset:this.scrollSettings.horizontalOffset,ViewportHeight:void 0!==e.scrollSettings.viewPortHeight?e.scrollSettings.viewPortHeight:this.scrollSettings.viewPortHeight,ViewportWidth:void 0!==e.scrollSettings.viewPortWidth?e.scrollSettings.viewPortWidth:this.scrollSettings.viewPortWidth,CurrentZoom:void 0!==e.scrollSettings.currentZoom?e.scrollSettings.currentZoom:this.scroller.currentZoom},this.initialScrollValues=n):"Progress"===o&&(n={VerticalOffset:this.currentScrollValues.VerticalOffset,HorizontalOffset:this.currentScrollValues.HorizontalOffset,ViewportHeight:this.currentScrollValues.ViewportHeight,ViewportWidth:this.currentScrollValues.ViewportWidth,CurrentZoom:this.currentScrollValues.CurrentZoom}),0===i&&0===r||(this.pan(i,r),this.scrollSettings.horizontalOffset=-this.scroller.horizontalOffset||0,this.scrollSettings.verticalOffset=-this.scroller.verticalOffset||0);var a={VerticalOffset:this.scrollSettings.verticalOffset,HorizontalOffset:this.scrollSettings.horizontalOffset,ViewportHeight:this.scrollSettings.viewPortHeight,ViewportWidth:this.scrollSettings.viewPortWidth,CurrentZoom:this.scroller.currentZoom};this.currentScrollValues=a;var s={oldValue:n,newValue:a,source:this,panState:o};this.triggerEvent(xt.scrollChange,s),this.commandHandler.updatePanState(!0),"Canvas"===this.mode&&this.constraints&ct.Virtualization&&this.refreshDiagramLayer()},r.prototype.updateFromModel=function(){if(this.model.participants.length>0){this.model.updateUmlSequenceDiagram(this),this.initLayerObjects();var t=this.isProtectedOnChange;this.protectPropertyChange(!0),this.model.render(),this.refreshDiagramLayer(),this.diagramActions&yt.Render&&"Canvas"!==this.mode||(this.isRefreshed=!0),t||this.protectPropertyChange(t),this.fitToPage({mode:"Page",region:"Content",margin:{left:10,top:10,right:10,bottom:10},canZoomIn:!0,canZoomOut:!0})}},r.prototype.initData=function(){var t=this.dataSourceSettings.dataManager||this.dataSourceSettings.dataSource;if(!this.dataBindingModule||this.realActions&bt.PreventDataInit)t&&!this.dataBindingModule&&console.warn('[WARNING] :: Module "DataBinding" is not available in Diagram component! You either misspelled the module name or forgot to load it.');else if(t&&this.dataSourceSettings.connectionDataSource.dataManager){var e=this.dataSourceSettings.dataManager||this.dataSourceSettings.dataSource;this.nodes=this.generateData(e,!0),this.connectors=this.generateData(this.dataSourceSettings.connectionDataSource.dataManager,!1)}else t&&t.dataSource&&(t.dataSource.url||"BlazorAdaptor"===t.adaptorName&&!t.dataSource.url)?this.dataBindingModule.initSource(this.dataSourceSettings,this):this.dataBindingModule.initData(this.dataSourceSettings,this)},r.prototype.generateData=function(t,e){var i,r=[];for(i=0;i<t.length;i++){var n=t[parseInt(i.toString(),10)],o=e?this.makeData(n,!0):this.makeData(n,!1);o&&o.id&&!Jo(r,o.id)&&r.push(o)}return r},r.prototype.makeData=function(t,e){var i,r=e?this.dataSourceSettings:this.dataSourceSettings.connectionDataSource,n={};if(n.id=t[r.id]?t[r.id]:E(),r.sourceID&&(n.sourceID=t[r.sourceID]),r.targetID&&(n.targetID=t[r.targetID]),t[r.sourcePointX]&&t[r.sourcePointY]&&(n.sourcePoint={x:Number(t[r.sourcePointX]),y:Number(t[r.sourcePointY])}),t[r.targetPointX]&&t[r.targetPointY]&&(n.targetPoint={x:Number(t[r.targetPointX]),y:Number(t[r.targetPointY])}),r.crudAction.customFields&&r.crudAction.customFields.length>0)for(i=0;i<r.crudAction.customFields.length;i++)n[r.crudAction.customFields[parseInt(i.toString(),10)]]=t[r.crudAction.customFields[parseInt(i.toString(),10)]];return n},r.prototype.initNodes=function(t,e){this.preventDiagramUpdate=!0,this.initObject(t,e),this.preventDiagramUpdate=!1},r.prototype.initConnectors=function(t,e,i){this.preventDiagramUpdate=!0,this.initObject(t,e,i),this.updateEdges(t),this.preventDiagramUpdate=!1},r.prototype.setZIndex=function(t,e){var i=t;if(e.zIndex===Number.MIN_VALUE){for(;i.zIndexTable[i.objectZIndex+1];)t.objectZIndex++;this.setIndex(t,e)}else{var r=null!==e.zIndex?e.zIndex:i.objectZIndex+1;if(i.zIndexTable[parseInt(r.toString(),10)])for(var n=Object.keys(i.zIndexTable).length,o=0;o<n;o++){if(o===r){for(var a=n;a>r;a--)i.zIndexTable[parseInt(a.toString(),10)]=i.zIndexTable[a-1],this.nameTable[i.zIndexTable[parseInt(a.toString(),10)]]&&(this.nameTable[i.zIndexTable[parseInt(a.toString(),10)]].zIndex=a);i.zIndexTable[parseInt(o.toString(),10)]=e.id}0}}},r.prototype.setIndex=function(t,e){var i=this,r=function(e){(e.zIndex=++t.objectZIndex,"Bpmn"===e.shape.type&&e.shape.activity&&e.shape.activity.subProcess&&e.shape.activity.subProcess.processes&&e.shape.activity.subProcess.processes.length)&&e.shape.activity.subProcess.processes.forEach(function(e){var r=i.nameTable[""+e];r&&(r.zIndex=++t.objectZIndex)})},n=function(e){var n=i.nodes.find(function(t){return t.id===e}),o=i.connectors.find(function(t){return t.id===e});n?n.children&&n.children.length>0||n.shape.activity&&n.shape.activity.subProcess&&n.shape.activity.subProcess.processes&&n.shape.activity.subProcess.processes.length>0?i.setIndex(t,n):r(n):o&&r(o)};if(-1!==t.objects.indexOf(e.id))if(e instanceof Yh){if(r(e),"SwimLane"!==e.shape.type&&e.children&&e.children.length>0)for(var o=0;o<e.children.length;o++)n(e.children[parseInt(o.toString(),10)]);else if(e.shape.activity&&e.shape.activity.subProcess&&e.shape.activity.subProcess.processes&&e.shape.activity.subProcess.processes.length>0)for(var a=0;a<e.shape.activity.subProcess.processes.length;a++)n(e.shape.activity.subProcess.processes[parseInt(a.toString(),10)])}else r(e)},r.prototype.initializeDiagramLayers=function(){for(var t=0;t<this.layers.length;t++)if(-1!==this.layers[parseInt(t.toString(),10)].zIndex){var e=this.layers[parseInt(t.toString(),10)];this.layers[parseInt(t.toString(),10)]=this.layers[this.layers[parseInt(t.toString(),10)].zIndex],this.layers[e.zIndex]=e}for(var i=0,r=this.layers;i<r.length;i++){var n=r[i];n.zIndex=-1!==n.zIndex?n.zIndex:this.layers.indexOf(n),this.layerZIndexTable[n.zIndex]=n.id}for(t=0;t<this.layers.length;t++)for(var o=t+1;o<this.layers.length;o++)if(this.layers[parseInt(t.toString(),10)].zIndex>this.layers[parseInt(o.toString(),10)].zIndex){e=this.layers[parseInt(t.toString(),10)];this.layers[parseInt(t.toString(),10)]=this.layers[parseInt(o.toString(),10)],this.layers[parseInt(o.toString(),10)]=e}if(this.layers.length>0&&"default_layer"!==(this.activeLayer?this.activeLayer.id:void 0)){var a=this.layers.flatMap(function(t){return t.objects}),s=[].concat(this.nodes,this.connectors).filter(function(t){return!a.includes(t.id)});if(s.length>0){var h=s.map(function(t){return t.id}),d={id:"default_layer",visible:!0,lock:!1,objects:[],zIndex:0,objectZIndex:-1,zIndexTable:{}};this.commandHandler.addLayer(d,null,!0);var l=this.layers.findIndex(function(t){return"default_layer"===t.id});if(-1!==l){var c=this.layers.splice(l,1)[0];this.layers.unshift(c),c.objects=h}}}if(0===this.layers.length){d={id:"default_layer",visible:!0,lock:!1,objects:[],zIndex:0,objectZIndex:-1,zIndexTable:{}};this.commandHandler.addLayer(d,null,!0)}this.setActiveLayer(this.layers[this.layers.length-1].id)},r.prototype.resetTool=function(){this.eventHandler.resetTool()},r.prototype.initObjectExtend=function(t,e,i){if(i){var r=this.commandHandler.checkBoundaryConstraints(void 0,void 0,t.wrapper.bounds,!0);if("SwimLane"===t.shape.type)for(var n=0,o=Object.keys(e.zIndexTable);n<o.length;n++)e.zIndexTable[o[parseInt(n.toString(),10)]]&&e.zIndexTable[o[parseInt(n.toString(),10)]]===t.id&&delete e.zIndexTable[o[parseInt(n.toString(),10)]];if(e.zIndexTable[t.zIndex]=t.id,!r){var a=t instanceof Yh?this.nodes:this.connectors;for(n=0;n<=a.length;n++)a[parseInt(n.toString(),10)]&&t.id===a[parseInt(n.toString(),10)].id&&a.splice(n,1);delete e.zIndexTable[t.zIndex]}}},r.prototype.initObject=function(t,e,r,n){if(void 0===r&&(r=!0),void 0!==t){if(r&&(e||(this.addToLayer(t,!1),e=this.activeLayer),(t instanceof Yh||t instanceof Co)&&("SwimLane"!==t.shape.type||t.children&&t.children.length>0)&&this.setZIndex(e,t)),t instanceof Yh){if(r){if("helper"!==t.id&&!(this.diagramActions&yt.UndoRedo))if(a=J(this.getNodeDefaults)){if((s=a(t,this))&&s.ports)for(var o=0;o<s.ports.length;o++)s.ports[parseInt(o.toString(),10)].inEdges=[],s.ports[parseInt(o.toString(),10)].outEdges=[];s&&s!==t&&W(s,t)}this.initNode(t,this.element.id)}}else if(t instanceof Co){var a,s;if(a=J(this.getConnectorDefaults))(s=a(t,this))&&s!==t&&W(s,t),t.segments.length&&t.type!==t.segments[0].type&&(t.segments=[]);var h=this.nameTable[t.sourceID],d=this.nameTable[t.targetID],l=this.getConnectedPort(h,t,!0),c=this.getConnectedPort(d,t),p=this.findInOutConnectPorts(h,!1),g=this.findInOutConnectPorts(d,!0);if((void 0!==h&&Ji(h)||""!==t.sourcePortID&&$i(p))&&(t.sourceWrapper=this.getEndNodeWrapper(h,t,!0),t.sourcePortID&&l&&l.constraints&&!(l.constraints&It.None)&&l.constraints&It.OutConnect&&(t.sourcePortWrapper=this.getWrapper(h.wrapper,t.sourcePortID))),(void 0!==d&&Qi(d)||""!==t.targetPortID&&Ki(g))&&(t.targetWrapper=this.getEndNodeWrapper(d,t,!1),t.targetPortID&&c&&c.constraints&&!(c.constraints&It.None)&&c.constraints&It.InConnect&&(t.targetPortWrapper=this.getWrapper(d.wrapper,t.targetPortID))),!r){var u=t.getConnectorPoints(t.type);Qa(t,u)}r&&t.init(this);for(var f=0;f<t.wrapper.children.length;f++)this.pathTable[t.wrapper.children[parseInt(f.toString(),10)].data]&&(t.wrapper.children[parseInt(f.toString(),10)].absoluteBounds=this.pathTable[t.wrapper.children[parseInt(f.toString(),10)].data].absoluteBounds);t.wrapper.measure(new i(void 0,void 0)),t.wrapper.arrange(t.wrapper.desiredSize),t instanceof Co&&"Bezier"===t.type&&(this.updateConnectorAnnotation(t),this.updateConnectorfixedUserHandles(t));for(var m=0;m<t.wrapper.children.length;m++)this.pathTable[t.wrapper.children[parseInt(m.toString(),10)].data]={},this.pathTable[t.wrapper.children[parseInt(m.toString(),10)].data].absoluteBounds=t.wrapper.children[parseInt(m.toString(),10)].absoluteBounds}if(t instanceof Yh&&t.children&&t.container)for(o=0;o<t.children.length;o++)this.nameTable[t.children[parseInt(o.toString(),10)]].offsetX=this.nameTable[t.children[parseInt(o.toString(),10)]].wrapper.offsetX,this.nameTable[t.children[parseInt(o.toString(),10)]].offsetY=this.nameTable[t.children[parseInt(o.toString(),10)]].wrapper.offsetY;if(t instanceof Yh&&t.shape&&"Activity"===t.shape.shape&&"SubProcess"===t.shape.activity.activity&&t.shape.activity.subProcess.processes){var y=t.shape.activity.subProcess.processes;for(o=0;o<y.length;o++)this.nameTable[y[parseInt(o.toString(),10)]]&&(this.nameTable[y[parseInt(o.toString(),10)]].offsetX=this.nameTable[y[parseInt(o.toString(),10)]].wrapper.offsetX,this.nameTable[y[parseInt(o.toString(),10)]].offsetY=this.nameTable[y[parseInt(o.toString(),10)]].wrapper.offsetY,this.updateQuad(this.nameTable[y[parseInt(o.toString(),10)]]))}if(this.initObjectExtend(t,e,r),this.nameTable[t.id]=t,!this.refreshing&&t.shape.annotations&&t.shape.annotations.length>0)for(o=0;o<t.shape.annotations.length&&t.shape.annotations[parseInt(o.toString(),10)].text;o++)this.getBPMNTextAnnotation(t,this,t.shape.annotations[parseInt(o.toString(),10)],!1);if(t instanceof Yh&&t.children){this.preventNodesUpdate=!0,this.preventConnectorsUpdate=!0,n||t.container||this.updateGroupOffset(t,!0),this.groupTable[t.id]=t.children;for(o=0;o<t.children.length;o++){var v=this.nameTable[t.children[parseInt(o.toString(),10)]];v&&(v.parentId=t.id)}this.isLoading||!t.rotateAngle||t.container||this.isUndo||this.commandHandler.rotateObjects(t,[t],t.rotateAngle,{x:t.offsetX,y:t.offsetY},!1),this.preventNodesUpdate=!1,this.preventConnectorsUpdate=!1}void 0===this.enterObject&&this.updateQuad(t)}!1===t.visible&&this.updateElementVisibility(t.wrapper,t,!1)},r.prototype.getConnectedPort=function(t,e,i){if(t&&t.ports)for(var r=0,n=t.ports;r<n.length;r++){var o=n[r];if(o.id===e.sourcePortID&&i)return o;if(o.id===e.targetPortID&&!i)return o}return null},r.prototype.scaleObject=function(t,e,i){var r=i?t.wrapper.actualSize.width:t.wrapper.actualSize.height,n=i?1+(e-r)/r:1,o=i?1:1+(e-r)/r;this.realActions|=bt.PreventDrag,this.scale(t,n,o,{x:.5,y:.5}),this.realActions&=~bt.PreventDrag},r.prototype.updateDefaultLayoutIcons=function(t){"OrganizationalChart"!==this.layout.type&&"HierarchicalTree"!==this.layout.type&&"ComplexHierarchicalTree"!==this.layout.type||(this.updateDefaultLayoutIcon(t,t.expandIcon),this.updateDefaultLayoutIcon(t,t.collapseIcon))},r.prototype.updateDefaultLayoutIcon=function(t,e){if("None"!==e.shape&&"Auto"===e.horizontalAlignment&&"Auto"===e.verticalAlignment&&.5===e.offset.x&&1===e.offset.y){var r=this.getWrapper(t.wrapper,"icon_content"),n=void 0,o=void 0;"TopToBottom"===this.layout.orientation||"BottomToTop"===this.layout.orientation?(n=.5,o="TopToBottom"===this.layout.orientation?1:0):"RightToLeft"!==this.layout.orientation&&"LeftToRight"!==this.layout.orientation||(n="LeftToRight"===this.layout.orientation?1:0,o=.5),r.setOffsetWithRespectToBounds(n,o,"Fraction"),r.horizontalAlignment="Center",r.verticalAlignment="Center",t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize)}},r.prototype.updateGroupOffset=function(t,e){if(t.children&&t.children.length>0&&!t.container||t.processId||t.parentId&&this.nameTable[t.parentId]&&"Container"===this.nameTable[t.parentId].shape.type){var r=this.nameTable[t.id];if(!(this.realActions&bt.PreventScale||this.realActions&bt.PreventDrag)){if(!r.offsetX||!(this.realActions&bt.EnableGroupAction)&&(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.ToolAction||this.diagramActions&yt.PublicMethod||t.processId))r.offsetX=t.wrapper.offsetX;else{this.realActions|=bt.PreventScale;var n=r.offsetX-t.wrapper.offsetX;r.offsetX=t.wrapper.offsetX;var o=r.offsetY-t.wrapper.offsetY;r.offsetY=t.wrapper.offsetY,n+o!==0&&this.drag(r,n,o),this.realActions&=~bt.PreventScale}if(!r.offsetY||!(this.realActions&bt.EnableGroupAction)&&(this.diagramActions&yt.UndoRedo||this.diagramActions&yt.ToolAction||this.diagramActions&yt.PublicMethod||t.processId))r.offsetY=t.wrapper.offsetY;else{this.realActions|=bt.PreventScale;o=r.offsetY-t.wrapper.offsetY;r.offsetY=t.wrapper.offsetY,this.drag(r,0,o),this.realActions&=~bt.PreventScale}this.diagramActions&&(r.width=t.wrapper.actualSize.width,r.height=t.wrapper.actualSize.height)}}t&&t.annotations&&t.annotations.length>0&&(t.wrapper.children.forEach(function(t){t instanceof te&&t.children.forEach(function(t){t&&t instanceof Zt&&t.refreshTextElement()})}),t.wrapper.measure(new i(t.width,t.height),t.id,this.onLoadImageSize.bind(this)),t.wrapper.arrange(t.wrapper.desiredSize)),e&&t.children&&t.children.length>0&&(void 0!==this.nameTable[t.id].width?this.scaleObject(t,this.nameTable[t.id].width,!0):this.nameTable[t.id].width=t.wrapper.actualSize.width,void 0!==this.nameTable[t.id].height?this.scaleObject(t,this.nameTable[t.id].height,!1):this.nameTable[t.id].height=t.wrapper.actualSize.height)},r.prototype.initNode=function(t,r,n){var o,a,s=this,h=t.initContainer(),d=new te;if(this.diagramSettings.inversedAlignment||(h.inversedAlignment=!1),h.children||(h.children=[]),t.children){if(h.measureChildren=!1,d.id=t.id+"group_container",t.shape&&"SwimLane"===t.shape.type?d.style.fill=t.style.fill:d.style.fill="none",d.style.strokeColor="none",d.horizontalAlignment="Stretch",d.verticalAlignment="Stretch",d.pivot=t.pivot,h.style=t.style,t.shape&&"Basic"===t.shape.type&&(h.cornerRadius=t.shape.cornerRadius),h.padding.left=t.padding.left,h.padding.right=t.padding.right,h.padding.top=t.padding.top,h.padding.bottom=t.padding.bottom,d.children=[],d.preventContainer=!0,t.container&&(d.relativeMode="Object"),t.container&&"Grid"===t.container.type)for(var l=0;l<t.children.length;l++){var c=new te,p=this.nameTable[t.children[l]];c.children=[],c.children.push(p.wrapper),p&&h.addObject(p.wrapper,p.rowIndex,p.columnIndex,p.rowSpan,p.columnSpan)}else for(l=0;l<t.children.length;l++)if(this.nameTable[t.children[l]]){p=this.nameTable[t.children[l]];this.updateStackProperty(t,p,l),h.children.push(p.wrapper),h.elementActions=h.elementActions|dt.ElementIsGroup,p.wrapper.flip=p.wrapper.flip^=t.wrapper.flip}((0,e.isNullOrUndefined)(t.container)||t.container&&"Grid"!==t.container.type)&&h.children.push(d)}else{var g=J(this.setNodeTemplate);g&&"helper"!==t.id&&(o=g(t,this)),o||(o=t.init(this)),h.children.push(o)}a=J(this.getDescription),(t.children?h:o).description=a||(t.annotations.length?t.annotations[0].content:t.id);var u=t.children?d:h;t.initAnnotations(this.getDescription,u,this.element.id,!!ir(this),this.annotationTemplate),t.initPorts(this.getDescription,u),t.initIcons(this.getDescription,this.layout,u,r);for(l=0;t.fixedUserHandles,l<t.fixedUserHandles.length;l++){var f=t.initFixedUserHandles(t.fixedUserHandles[l],this.fixedUserHandleTemplate,this.element.id);u.children.push(f)}if("SwimLane"===t.shape.type&&t.wrapper&&t.wrapper.children.length>0&&t.wrapper.children[0]instanceof yr?(this.setZIndex(this.activeLayer,t),Mr(t),Er(this,t),this.updateLaneAfterAddChild(t),t.shape.lanes.forEach(function(t){t.children&&t.children.length>0&&t.children.forEach(function(t){s.updateQuad(t)})}),this.updateDiagramElementQuad()):(h.measure(new i(t.width,t.height),t.id,this.onLoadImageSize.bind(this)),h instanceof yr?h.arrange(h.desiredSize,!0):h.arrange(h.desiredSize)),"Container"===t.shape.type&&this.updateDiagramElementQuad(),t.wrapper.flip!==tt.None&&this.isNotContainerOrSubProcess(t))if(t.children&&t.children.length>0){var m=!1;for(l=0;l<t.children.length;l++){var y=this.nameTable[t.children[l]];(y instanceof Co||0!==t.rotateAngle)&&(m=!0,-1==this.connectorOrRotatedGroups.indexOf(t)&&this.connectorOrRotatedGroups.push(t)),y&&(this.refreshing||this.commandHandler.cloningInProgress||this.diagramActions&yt.UndoRedo||(y.flip^=t.flip,y.flipMode=t.flipMode),"None"!==y.flipMode&&"Label"!==y.flipMode&&"LabelText"!==y.flipMode&&"LabelAndLabelText"!==y.flipMode?this.updatePorts(y,y.flip):this.updatePorts(y,tt.None),this.applyWrapperFlip(y),y.wrapper.measure(new i(y.wrapper.bounds.width,y.wrapper.bounds.height),y.id,this.onLoadImageSize.bind(this)),y.wrapper.arrange(y.wrapper.desiredSize))}var v=t.wrapper.children[t.wrapper.children.length-1];v.flip=t.wrapper.flip,v.flipMode=t.wrapper.flipMode;for(var b=0;b<v.children.length;b++){var S=v.children[b];S instanceof Zt&&"Port"!==t.flipMode&&"None"!==t.flipMode&&(S.flip=t.wrapper.flip,S.flipMode=t.wrapper.flipMode)}m||this.refreshing||this.commandHandler.cloningInProgress||this.diagramActions&yt.UndoRedo||ws(t.wrapper,t.wrapper.offsetX,t.wrapper.offsetY,this,t.wrapper.flip,void 0,void 0,!0)}else this.applyWrapperFlip(t);if("Bpmn"===t.shape.type&&"TextAnnotation"===t.shape.shape){var w=!1;for(l=0;l<this.connectors.length;l++)if(this.connectors[parseInt(l.toString(),10)].id===t.id+"_connector"){this.connectors[parseInt(l.toString(),10)].isBpmnAnnotationConnector=!0,w=!0;break}w||this.addBpmnAnnotationConnector(t,h)}t instanceof Yh&&t.container&&(t.width<h.outerBounds.width||t.height<h.outerBounds.height)&&h.bounds.x<=h.outerBounds.x&&h.bounds.y<=h.outerBounds.y&&(t.width=h.width=h.outerBounds.width,t.height=h.height=h.outerBounds.height,h.measure(new i(t.width,t.height)),h.arrange(h.desiredSize)),t.container&&"Grid"===t.container.type&&t.children&&t.children.length>0&&this.updateChildPosition(t)},r.prototype.isNotContainerOrSubProcess=function(t){return"Container"!==t.shape.type&&!("Bpmn"===t.shape.type&&"Activity"===t.shape.shape&&"SubProcess"===t.shape.activity.activity&&!1===t.shape.activity.subProcess.collapsed)},r.prototype.isNotSwimlaneObject=function(t){return"SwimLane"!==t.shape.type&&!t.isLane&&!t.isPhase&&!t.isHeader},r.prototype.updateLaneAfterAddChild=function(t){for(var e=0;e<this.nodes.length;e++){var i=this.nodes[parseInt(e.toString(),10)];i.parentId!==t.id||t.shape.hasHeader||(i.width=i.wrapper.width,i.height=i.wrapper.height)}},r.prototype.applyWrapperFlip=function(t){if(t instanceof Yh){t.wrapper.flip=t.flip,t.wrapper.flipMode=t.flipMode,t.wrapper.children[0].flip=t.flip,t.wrapper.children[0].flipMode=t.flipMode;for(var e=0;e<t.wrapper.children.length;e++){var i=t.wrapper.children[e];i instanceof te?this.applyWrapperCanvasFlip(i,t):(i.flip=t.flip,i.flipMode=t.flipMode)}}},r.prototype.applyWrapperCanvasFlip=function(t,e){for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)];r instanceof te?this.applyWrapperCanvasFlip(r,e):"None"!==e.flipMode&&(r.flip=e.flip,r.flipMode=e.flipMode)}},r.prototype.addBpmnAnnotationConnector=function(t,e){if(t.parentObj instanceof r||t.parentObj instanceof Xh){var i=t.shape,n=i.textAnnotation.textAnnotationDirection,o=""!==i.textAnnotation.textAnnotationTarget&&this.nameTable[i.textAnnotation.textAnnotationTarget],a=o?this.nameTable[i.textAnnotation.textAnnotationTarget]:null,s=null!=a?a.wrapper:null,h=t.ports[0],d={x:0,y:0};switch(n){case"Left":h.offset={x:0,y:.5},d.x=e.bounds.left-40,d.y=e.bounds.bottom+30;break;case"Right":h.offset={x:1,y:.5},d.x=e.bounds.right+40,d.y=e.bounds.bottom+30;break;case"Top":h.offset={x:.5,y:0},d.x=e.bounds.right+30,d.y=e.bounds.top-40;break;case"Bottom":h.offset={x:.5,y:1},d.x=e.bounds.right+30,d.y=e.bounds.bottom+40;break;default:h.offset={x:0,y:.5},d.x=e.bounds.left-40,d.y=e.bounds.bottom+30,o&&null!=e&&null!=s&&(e.bounds.left>s.bounds.right?h.offset={x:0,y:.5}:e.bounds.right<s.bounds.left?h.offset={x:1,y:.5}:e.bounds.bottom>s.bounds.top?h.offset={x:.5,y:0}:e.bounds.top<s.bounds.bottom&&(h.offset={x:.5,y:1}))}var l=new Co(this,"connectors",{id:t.id+"_connector",targetID:t.id,targetPortID:h.id,type:"Straight",shape:{type:"Bpmn",flow:"Association"},constraints:at.Default&~(at.DragTargetEnd|at.Delete),isBpmnAnnotationConnector:!0},!0);o?l.sourceID=i.textAnnotation.textAnnotationTarget:l.sourcePoint=d;var c=this.isProtectedOnChange;this.isProtectedOnChange=!0,t.constraints|=ht.InConnect,this.connectors.push(l),this.bpmnModule.bpmnTextAnnotationConnector||(this.bpmnModule.bpmnTextAnnotationConnector=[]),this.bpmnModule.bpmnTextAnnotationConnector.push(l);var p=0!==(t.constraints&ht.Shadow),g=0!==(t.constraints&ht.AllowMovingOutsideLane);t.constraints=ht.Default&~(ht.OutConnect|ht.InConnect),p&&(t.constraints|=ht.Shadow),g&&(t.constraints|=ht.AllowMovingOutsideLane),this.isProtectedOnChange=c}},r.prototype.getBPMNTextAnnotation=function(t,e,i,r){var n,a={id:i.id||E(),height:i.height||100,width:i.width||100,annotations:[{id:(i.id?i.id:E())+i.text,content:i.text}],offsetX:t.offsetX+i.length*Math.cos(i.angle*(Math.PI/180)),offsetY:t.offsetY+i.length*Math.sin(i.angle*(Math.PI/180)),shape:{type:"Bpmn",shape:"TextAnnotation",textAnnotation:{textAnnotationDirection:"Auto",textAnnotationTarget:t.id}},constraints:ht.Default&~(ht.OutConnect|ht.InConnect)},s=t.wrapper.bounds,h={x:a.offsetX,y:a.offsetY},d=Pi(h,s,s);switch(d){case"Right":n={x1:s.right,y1:s.top,x2:s.right,y2:s.bottom};break;case"Left":n={x1:s.left,y1:s.top,x2:s.left,y2:s.bottom};break;case"Bottom":n={x1:s.right,y1:s.bottom,x2:s.left,y2:s.bottom};break;case"Top":n={x1:s.right,y1:s.top,x2:s.left,y2:s.top}}var l=s.center,c=ci(n,[l,o.transform(h,i.angle,Math.max(s.width,s.height))],0,l);if(void 0!==i.length&&void 0!==i.angle&&c&&(c=o.transform(c,i.angle,i.length),a.offsetX=c.x,a.offsetY=c.y),"Right"===d?a.offsetX+=a.width/2:"Left"===d?a.offsetX-=a.width/2:"Bottom"===d?a.offsetY+=a.height/2:a.offsetY-=a.height/2,r)this.add(a);else{var p=new Yh(this,"nodes",a,!0);e.initObject(p,void 0,void 0,!0),e.nodes.push(p)}},r.prototype.updateDiagramElementQuad=function(){for(var t=0;t<this.nodes.length;t++)this.nodes[parseInt(t.toString(),10)].wrapper&&this.nodes[parseInt(t.toString(),10)].wrapper instanceof Ut&&this.updateQuad(this.nodes[parseInt(t.toString(),10)])},r.prototype.onLoadImageSize=function(t,e){var i=this.getObject(t),r=document.getElementById(t+"sf-imageNode");r&&r.parentNode.removeChild(r),this.nodePropertyChange(i,{},{width:e.width,height:e.height});var n={element:N(i),size:e};this.triggerEvent(xt.onImageLoad,n)},r.prototype.updateChildPosition=function(t){for(var e=0;e<t.children.length;e++){var i=this.getObject(t.children[parseInt(e.toString(),10)]);i.offsetX=i.wrapper.offsetX,i.offsetY=i.wrapper.offsetY,i.children&&i.children.length>0&&this.updateChildPosition(i)}},r.prototype.canExecute=function(){return!0},r.prototype.updateStackProperty=function(t,e,i){t.container&&"Stack"===t.container.type&&(e.width||(e.wrapper.horizontalAlignment="Stretch",e.horizontalAlignment="Stretch"),e.height||(e.verticalAlignment="Stretch",e.wrapper.verticalAlignment="Stretch"),i&&"UmlClassifier"===t.shape.type&&(e.umlIndex=i))},r.prototype.initViews=function(){this.isLoading||(this.views.push(this.element.id),this.views[this.element.id]=this)},r.prototype.initCommands=function(){var t=this.commandManager.commands,e={copy:{execute:this.copyCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.C,keyModifiers:ft.Control}},paste:{execute:this.pasteCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.V,keyModifiers:ft.Control}},cut:{execute:this.cutCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.X,keyModifiers:ft.Control}},delete:{execute:this.removeCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.Delete}},selectAll:{execute:this.selectAll.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.A,keyModifiers:ft.Control}},undo:{execute:this.undo.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.Z,keyModifiers:ft.Control}},redo:{execute:this.redo.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.Y,keyModifiers:ft.Control}},nudgeUp:{execute:this.nudgeCommand.bind(this,"Up"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Up},parameter:"up"},nudgeRight:{execute:this.nudgeCommand.bind(this,"Right"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Right},parameter:"right"},nudgeDown:{execute:this.nudgeCommand.bind(this,"Down"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Down},parameter:"down"},nudgeLeft:{execute:this.nudgeCommand.bind(this,"Left"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Left},parameter:"left"},startEdit:{execute:this.startEditCommad.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.F2}},endEdit:{execute:this.endEditCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.Escape}},focusToNextItem:{execute:this.navigateItems.bind(this,!0),canExecute:this.canExecute.bind(this),gesture:{key:mt.Tab}},focusToPreviousItem:{execute:this.navigateItems.bind(this,!1),canExecute:this.canExecute.bind(this),gesture:{key:mt.Tab,keyModifiers:ft.Shift}},selectFocusedItem:{execute:this.startEditCommad.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.Enter}},bold:{execute:this.fontStyleCommand.bind(this,"bold"),canExecute:this.canExecute.bind(this),gesture:{key:mt.B,keyModifiers:ft.Control}},italic:{execute:this.fontStyleCommand.bind(this,"italic"),canExecute:this.canExecute.bind(this),gesture:{key:mt.I,keyModifiers:ft.Control}},underline:{execute:this.fontStyleCommand.bind(this,"underline"),canExecute:this.canExecute.bind(this),gesture:{key:mt.U,keyModifiers:ft.Control}},duplicate:{execute:this.duplicateCommand.bind(this),canExecute:this.canExecute.bind(this),gesture:{key:mt.D,keyModifiers:ft.Control}},group:{execute:this.groupCommand.bind(this,"group"),canExecute:this.canExecute.bind(this),gesture:{key:mt.G,keyModifiers:ft.Control}},ungroup:{execute:this.groupCommand.bind(this,"ungroup"),canExecute:this.canExecute.bind(this),gesture:{key:mt.U,keyModifiers:ft.Control|ft.Shift}},rotateClockwise:{execute:this.rotateCommand.bind(this,"clockwise"),canExecute:this.canExecute.bind(this),gesture:{key:mt.R,keyModifiers:ft.Control}},rotateAntiClockwise:{execute:this.rotateCommand.bind(this,"antiClockwise"),canExecute:this.canExecute.bind(this),gesture:{key:mt.L,keyModifiers:ft.Control}},flipHorizontal:{execute:this.flipCommand.bind(this,"horizontal"),canExecute:this.canExecute.bind(this),gesture:{key:mt.H,keyModifiers:ft.Control}},flipVertical:{execute:this.flipCommand.bind(this,"vertical"),canExecute:this.canExecute.bind(this),gesture:{key:mt.J,keyModifiers:ft.Control}},pointerTool:{execute:this.toolCommand.bind(this,"pointer"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number1,keyModifiers:ft.Control}},textTool:{execute:this.toolCommand.bind(this,"text"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number2,keyModifiers:ft.Control}},connectTool:{execute:this.toolCommand.bind(this,"connect"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number3,keyModifiers:ft.Control}},freeForm:{execute:this.toolCommand.bind(this,"freeForm"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number5,keyModifiers:ft.Control}},lineTool:{execute:this.toolCommand.bind(this,"line"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number6,keyModifiers:ft.Control}},rectangleTool:{execute:this.toolCommand.bind(this,"rectangle"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number8,keyModifiers:ft.Control}},ellipseTool:{execute:this.toolCommand.bind(this,"ellipse"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Number9,keyModifiers:ft.Control}},zoomIn:{execute:this.zoomCommand.bind(this,"zoomIn"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Plus,keyModifiers:ft.Control}},zoomOut:{execute:this.zoomCommand.bind(this,"zoomOut"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Minus,keyModifiers:ft.Control}},shiftUp:{execute:this.shiftCommand.bind(this,"Up"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Up,keyModifiers:ft.Shift}},shiftDown:{execute:this.shiftCommand.bind(this,"Down"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Down,keyModifiers:ft.Shift}},shiftLeft:{execute:this.shiftCommand.bind(this,"Left"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Left,keyModifiers:ft.Shift}},shiftRight:{execute:this.shiftCommand.bind(this,"Right"),canExecute:this.canExecute.bind(this),gesture:{key:mt.Right,keyModifiers:ft.Shift}},alignTextCenter:{execute:this.alignCommand.bind(this,"center"),canExecute:this.canExecute.bind(this),gesture:{key:mt.C,keyModifiers:ft.Control|ft.Shift}},alignTextLeft:{execute:this.alignCommand.bind(this,"right"),canExecute:this.canExecute.bind(this),gesture:{key:mt.L,keyModifiers:ft.Control|ft.Shift}},alignTextRight:{execute:this.alignCommand.bind(this,"left"),canExecute:this.canExecute.bind(this),gesture:{key:mt.R,keyModifiers:ft.Control|ft.Shift}},alignTextTop:{execute:this.alignCommand.bind(this,"top"),canExecute:this.canExecute.bind(this),gesture:{key:mt.E,keyModifiers:ft.Control|ft.Shift}},alignTextCenterVertical:{execute:this.alignCommand.bind(this,"centerVertical"),canExecute:this.canExecute.bind(this),gesture:{key:mt.M,keyModifiers:ft.Control|ft.Shift}},alignTextBottom:{execute:this.alignCommand.bind(this,"bottom"),canExecute:this.canExecute.bind(this),gesture:{key:mt.V,keyModifiers:ft.Control|ft.Shift}},alignJustify:{execute:this.alignCommand.bind(this,"justify"),canExecute:this.canExecute.bind(this),gesture:{key:mt.J,keyModifiers:ft.Control|ft.Shift}},sendToBack:{execute:this.orderCommand.bind(this,"sendToBack"),canExecute:this.canExecute.bind(this),gesture:{key:mt.B,keyModifiers:ft.Control|ft.Shift}},bringToFront:{execute:this.orderCommand.bind(this,"bringToFront"),canExecute:this.canExecute.bind(this),gesture:{key:mt.F,keyModifiers:ft.Control|ft.Shift}},sendBackward:{execute:this.orderCommand.bind(this,"sendBackward"),canExecute:this.canExecute.bind(this),gesture:{key:mt.BracketLeft,keyModifiers:ft.Control}},bringForward:{execute:this.orderCommand.bind(this,"bringForward"),canExecute:this.canExecute.bind(this),gesture:{key:mt.BracketRight,keyModifiers:ft.Control}}};this.initCommandManager(t,e)},r.prototype.overrideCommands=function(t,e){for(var i,r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];if(i=e[""+o],t.gesture.key===i.gesture.key&&t.gesture.keyModifiers===i.gesture.keyModifiers){delete e[""+o];break}}},r.prototype.initCommandManager=function(t,e){var i=0;if(t)for(i=0;i<t.length;i++)e[t[parseInt(i.toString(),10)].name]&&t[parseInt(i.toString(),10)]?(t[parseInt(i.toString(),10)].canExecute&&(e[t[parseInt(i.toString(),10)].name].canExecute=t[parseInt(i.toString(),10)].canExecute),t[parseInt(i.toString(),10)].execute&&(e[t[parseInt(i.toString(),10)].name].execute=t[parseInt(i.toString(),10)].execute),(t[parseInt(i.toString(),10)].gesture.key||t[parseInt(i.toString(),10)].gesture.keyModifiers)&&(e[t[parseInt(i.toString(),10)].name].gesture=t[parseInt(i.toString(),10)].gesture),""!==t[parseInt(i.toString(),10)].parameter&&(e[t[parseInt(i.toString(),10)].name].parameter=t[parseInt(i.toString(),10)].parameter)):(this.overrideCommands(t[parseInt(i.toString(),10)],e),e[t[parseInt(i.toString(),10)].name]={execute:t[parseInt(i.toString(),10)].execute,canExecute:t[parseInt(i.toString(),10)].canExecute,gesture:t[parseInt(i.toString(),10)].gesture,parameter:t[parseInt(i.toString(),10)].parameter});this.commands=e},r.prototype.updateNodeEdges=function(t){for(var e=0,i=t.inEdges;e<i.length;e++){var r=i[e];this.nameTable[""+r]&&(this.nameTable[""+r].targetID="")}for(var n=0,o=t.outEdges;n<o.length;n++){r=o[n];this.nameTable[""+r]&&(this.nameTable[""+r].sourceID="")}t.inEdges=[],t.outEdges=[]},r.prototype.updateIconVisibility=function(t,e){for(var i=t.id+"_icon",r=0,n=t.wrapper.children;r<n.length;r++){var o=n[r];o.id&&o.id.startsWith(i)&&(o.visible=e,this.updateDiagramContainerVisibility(o,e))}},r.prototype.updateEdges=function(t){if(void 0!==t.sourceID&&""!==t.sourceID){var e=this.nameTable[t.sourceID];e&&e.outEdges&&0===e.outEdges.length&&(e.outEdges=[]),e&&e.outEdges&&-1===e.outEdges.indexOf(t.id)&&e.outEdges.push(t.id),this.updatePortEdges(e,t,!1)}if(void 0!==t.targetID&&""!==t.targetID){var i=this.nameTable[t.targetID];if(i&&i.inEdges&&0===i.inEdges.length&&(i.inEdges=[]),i&&i.inEdges&&-1===i.inEdges.indexOf(t.id)&&i.inEdges.push(t.id),this.updatePortEdges(i,t,!0),i&&i.visible&&i.outEdges){var r=0!==i.outEdges.length;this.updateIconVisibility(i,r)}}},r.prototype.updatePortEdges=function(t,e,i){if(t)for(var r=0;r<t.ports.length;r++){var n=t.ports[parseInt(r.toString(),10)],o=i?e.targetPortID:e.sourcePortID;if(n.id===o){var a=i?n.inEdges:n.outEdges;-1===a.indexOf(e.id)&&a.push(e.id)}}},r.prototype.refreshDiagram=function(){this.initLayerObjects(),this.doLayout(),this.updateBridging(),this.scroller.setSize(),this.addBlazorDiagramObjects(),this.updateFitToPage()},r.prototype.updateCanupdateStyle=function(t,e){for(var i=0;i<t.length;i++)t[parseInt(i.toString(),10)].children&&this.updateCanupdateStyle(t[parseInt(i.toString(),10)].children,e),t[parseInt(i.toString(),10)].canApplyStyle=e},r.prototype.getZindexPosition=function(t,e){var i,r,n=[],o=void 0;if(n=(n=n.concat(this.nodes)).concat(this.connectors),r=t.children?this.commandHandler.findMaxZIndex(t):t.zIndex,t.zIndex!==Number.MIN_VALUE)for(var a=0;a<n.length;a++)if(n[parseInt(a.toString(),10)].zIndex>r){"HTML"!==t.shape.type&&"Native"!==t.shape.type||(i="HTML"===t.shape.type?"html":"native"),o=rd(e,n[parseInt(a.toString(),10)].id,i);break}return o},r.prototype.updateDiagramObject=function(t,e,i){for(var r,n="domTable",o=0,a=this.views;o<a.length;o++){var s=a[o];if(r=this.views[""+s],this.diagramActions&&"SVG"===r.mode){var h=void 0;if(this.layers.length>1&&(h=this.commandHandler.getObjectLayer(t.id)),void 0===h||h&&h.visible||i){var d=gd(this.element.id);window[""+n][r.element.id+"_diagramLayer"]||(window[""+n][r.element.id+"_diagramLayer"]=document.getElementById(r.element.id+"_diagramLayer"));var l=window[""+n][r.element.id+"_diagramLayer"];this.diagramActions&yt.Interactions&&this.updateCanupdateStyle(t.wrapper.children,!0);var c=this.getMidPoint(t);this.diagramRenderer.updateNode(t.wrapper,l,d,void 0,e?void 0:this.getZindexPosition(t,r.element.id),c,this.portCenterPoint),this.updateCanupdateStyle(t.wrapper.children,!0)}}}},r.prototype.applyMarginBezier=function(t,e){e.cx=e.cx+t.margin.left,e.cx=e.cx-t.margin.right,e.cy=e.cy+t.margin.top,e.cy=e.cy-t.margin.bottom},r.prototype.getMidPoint=function(t){var e;if(t instanceof Co&&"Bezier"===t.type){e=[];for(var i=this.getBezierPoints(t),r=o.getLengthFromListOfPoints(i),n=0;n<t.annotations.length;n++)for(var a=t.annotations[parseInt(n.toString(),10)].offset*r,s=this.commandHandler.getPointAtLength(a,i,0),h={cx:s.x,cy:s.y},d=0;d<t.wrapper.children.length;d++)t.wrapper&&t.wrapper.children[parseInt(d.toString(),10)]instanceof Zt&&t.wrapper.children[parseInt(d.toString(),10)].id===t.id+"_"+t.annotations[parseInt(n.toString(),10)].id&&(this.applyMarginBezier(t.wrapper.children[parseInt(d.toString(),10)],h),e[t.id+"_"+t.annotations[parseInt(n.toString(),10)].id]=this.applyAlignment(t.wrapper.children[parseInt(d.toString(),10)],h,t.annotations[parseInt(n.toString(),10)].displacement));for(n=0;n<t.ports.length;n++){var l=t.ports[parseInt(n.toString(),10)].offset*r,c=this.commandHandler.getPointAtLength(l,i,0),p={cx:c.x,cy:c.y};for(d=0;d<t.wrapper.children.length;d++)t.wrapper&&t.wrapper.children[parseInt(d.toString(),10)]instanceof Qt&&t.wrapper.children[parseInt(d.toString(),10)].isPathPort&&t.wrapper.children[parseInt(d.toString(),10)].id===t.id+"_"+t.ports[parseInt(n.toString(),10)].id&&(this.applyMarginBezier(t.wrapper.children[parseInt(d.toString(),10)],p),this.portCenterPoint[t.id+"_"+t.ports[parseInt(n.toString(),10)].id]=this.applyAlignment(t.wrapper.children[parseInt(d.toString(),10)],p,t.ports[parseInt(n.toString(),10)].displacement))}}return e},r.prototype.applyAlignment=function(t,e,i){switch(t.horizontalAlignment){case"Auto":case"Left":e.cx=t.inversedAlignment?e.cx:e.cx-t.desiredSize.width,e.cx+=i.x;break;case"Stretch":case"Center":e.cx-=t.desiredSize.width*t.pivot.x;break;case"Right":e.cx=t.inversedAlignment?e.cx-t.desiredSize.width:e.cx,e.cx-=i.x}switch(t.verticalAlignment){case"Auto":case"Top":e.cy=t.inversedAlignment?e.cy:e.cy-t.desiredSize.height,e.cy+=i.y;break;case"Stretch":case"Center":e.cy-=t.desiredSize.height*t.pivot.y;break;case"Bottom":e.cy=t.inversedAlignment?e.cy-t.desiredSize.height:e.cy,e.cy-=i.y}return e},r.prototype.getBezierPoints=function(t){var e,i=[],r={x:t.sourcePoint.x,y:t.sourcePoint.y};for(i.push(r),e=0;e<t.segments.length;e++){var n=t.segments[parseInt(e.toString(),10)].getPoints(t.segments[parseInt(e.toString(),10)],r);i.push.apply(i,n),r=i[i.length-1]}return i},r.prototype.updateGridContainer=function(t){for(var e,i=gd(this.element.id),r=0,n=this.views;r<n.length;r++){var o=n[r];if("SVG"===(e=this.views[""+o]).mode&&this.diagramActions){var a=document.getElementById(e.element.id+"_diagramLayer");this.diagramRenderer.updateNode(t,a,i,void 0)}else this.refreshCanvasDiagramLayer(e)}},r.prototype.getObjectsOfLayer=function(t){for(var e=[],i=0,r=t;i<r.length;i++){var n=r[i];this.nameTable[""+n]&&e.push(this.nameTable[""+n])}return e},r.prototype.refreshDiagramLayer=function(){for(var t,e=0,i=this.views;e<i.length;e++){var r=i[e];switch((t=this.views[""+r]).mode){case"SVG":this.refreshSvgDiagramLayer(t);break;case"Canvas":this.refreshCanvasLayers(t)}}},r.prototype.refreshCanvasLayers=function(t){if(t)this.refreshCanvasDiagramLayer(t);else for(var e=0,i=this.views;e<i.length;e++){var r=i[e],n=this.views[""+r];this.refreshCanvasDiagramLayer(n)}},r.prototype.renderBasicElement=function(t){for(var e=gd(t.element.id),r=0;r<this.basicElements.length;r++){var n=this.basicElements[parseInt(r.toString(),10)];n instanceof Ut&&(n.prevRotateAngle=0),n.measure(new i(n.width,n.height)),n.arrange(n.desiredSize),t.diagramRenderer.renderElement(n,t.diagramLayer,e)}},r.prototype.refreshElements=function(t){var e=!1;if(!this.isDestroyed){if(this.clearCanvas(t),t instanceof r)t.diagramLayer.getContext("2d").setTransform(t.scroller.currentZoom,0,0,t.scroller.currentZoom,0,0),t.diagramLayer.getContext("2d").scale(1.5,1.5);else e=!0,(a=document.getElementById(t.element.id+"_nativeLayer")).children.length>0&&t.updateView(t);var n=gd(t.element.id);this.renderDiagramElements(t.diagramLayer,t.diagramRenderer,n,void 0,void 0,e);for(var o=0;o<this.basicElements.length;o++){var a;(a=this.basicElements[parseInt(o.toString(),10)]).measure(new i(a.width,a.height)),a.arrange(a.desiredSize),t.diagramRenderer.renderElement(a,t.diagramLayer,n)}t instanceof r&&(t.diagramLayer.style.transform="scale("+2/3+")",t.diagramLayer.style.transformOrigin="0 0"),this.renderTimer=null}},r.prototype.refreshCanvasDiagramLayer=function(t){var e=this;"SVG"===t.mode||this.isDestroyed||(this.basicElements.length>0&&this.renderBasicElement(t),this.preventOverviewRefresh||(!this.diagramActions||0===(this.diagramActions&yt.Render)||yt.ToolAction&this.diagramActions||ir(this)||1!==this.scroller.currentZoom?this.refreshElements(t):this.renderTimer||(this.renderTimer=setTimeout(function(){e.refreshElements(t)},40))))},r.prototype.updatePortVisibility=function(t,e,i){var r,n=!this.drawingObject||!this.drawingObject.shape;if((t instanceof Yh||t instanceof Co)&&n&&Yi(t)){for(var o=t.ports,a=!1,s=0;s<o.length;s++)r=this.getWrapper(t.wrapper,o[parseInt(s.toString(),10)].id),(e&et.Hover||e&et.Connect)&&es(o[parseInt(s.toString(),10)],e)&&(r.visible=!i,a=!0);a&&this.updateDiagramObject(t),"Canvas"===this.mode&&this.refreshCanvasLayers()}},r.prototype.refreshSvgDiagramLayer=function(t){var e,r=document.getElementById(t.element.id+"_diagramLayer"),n=gd(t.element.id);if(ir(this))this.scroller.virtualizeElements();else{for(var o=0;o<this.basicElements.length;o++)(e=this.basicElements[parseInt(o.toString(),10)]).measure(new i(e.width,e.height)),e.arrange(e.desiredSize,!(this.diagramActions&yt.Render)),this.diagramRenderer.renderElement(e,r,n);this.renderDiagramElements(r,this.diagramRenderer,n)}},r.prototype.removeVirtualObjects=function(t){if(this.deleteVirtualObject){this.preventOverviewRefresh=!0;for(var e=0;e<this.scroller.removeCollection.length;e++){var i=this.nameTable[this.scroller.removeCollection[parseInt(e.toString(),10)]];void 0!==i&&this.removeElements(i)}this.deleteVirtualObject=!1,this.preventOverviewRefresh=!1}clearInterval(t)},r.prototype.updateTextElementValue=function(t){for(var e=0;e<t.wrapper.children.length;e++){var r=t.wrapper.children[parseInt(e.toString(),10)];if(r instanceof Zt){r.canMeasure=!0;var n=this.scroller.viewPortHeight,o=this.scroller.viewPortWidth,a=!1;t.offsetX<o&&t.offsetY<n&&(a=!0),a&&ir(this)&&void 0===r.actualSize.height&&void 0===r.actualSize.width&&(t.wrapper.measure(new i(t.width,t.height),t.id,this.onLoadImageSize.bind(this)),t.wrapper.arrange(t.wrapper.desiredSize)),r.measure(new i(t.width,t.height)),r.arrange(r.desiredSize)}}},r.prototype.updateVirtualObjects=function(t,e,i){var r=document.getElementById(this.element.id+"_diagramLayer"),n=gd(this.element.id);if("SVG"===this.mode){for(var o=0;o<t.length;o++){var a=this.scroller.removeCollection.indexOf(t[parseInt(o.toString(),10)]);a>=0&&this.scroller.removeCollection.splice(a,1);var s=this.nameTable[t[parseInt(o.toString(),10)]];this.updateTextElementValue(s),this.diagramRenderer.renderElement(s.wrapper,r,n,void 0,void 0,void 0,void 0,s.zIndex)}for(var h=0;h<i.length;h++)this.scroller.removeCollection.push(i[parseInt(h.toString(),10)]);1!==this.scroller.currentZoom&&this.eventHandler.updateVirtualization()}else this.diagramActions&&this.refreshDiagramLayer()},r.prototype.renderDiagramElements=function(t,e,r,n,o,a,s){void 0===n&&(n=!0);var h=this.scroller.getPageBounds();h.x*=this.scroller.currentZoom,h.y*=this.scroller.currentZoom,h.width*=this.scroller.currentZoom,h.height*=this.scroller.currentZoom;for(var d,l=-this.scroller.horizontalOffset-h.x,c=-this.scroller.verticalOffset-h.y,p=0,g=Object.keys(this.layerZIndexTable);p<g.length;p++){var u=g[p],f=this.commandHandler.getLayer(this.layerZIndexTable[""+u]),m=void 0,y=void 0;"Canvas"===this.mode&&ir(this)&&!this.diagramActions&&this.scroller.virtualizeElements();var v="Canvas"===this.mode&&ir(this)&&this.scroller.oldCollectionObjects.length>0?this.scroller.oldCollectionObjects:void 0,b=Object.keys(v||f.zIndexTable);b.sort(function(t,e){return parseInt(""+t,10)-parseInt(""+e,10)});for(var S=0,w=b;S<w.length;S++){var x=w[S],I=v?this.nameTable[v[""+x]]:this.nameTable[f.zIndexTable[""+x]];if(I&&!I.parentId&&f.visible&&(!I.processId||this.refreshing)){var P=void 0;if(P=this.scroller.currentZoom<1&&"SVG"===this.mode?{tx:-h.x/this.scroller.currentZoom,ty:-h.y/this.scroller.currentZoom,scale:this.scroller.transform.scale}:{tx:this.scroller.transform.tx,ty:this.scroller.transform.ty,scale:this.scroller.transform.scale},(a||s)&&(P={tx:-h.x/this.scroller.currentZoom,ty:-h.y/this.scroller.currentZoom,scale:this.scroller.transform.scale}),ir(this)){if(this.scroller.currentZoom<1){if(h.x<0||this.scroller.horizontalOffset<0){var C=this.scroller.verticalOffset<0?this.scroller.verticalOffset:0;m=(l>0?l:0)+"px",y=(this.realActions&bt.vScrollbarMoved?0:-C)+"px"}else m="0px",y="0px";this.realActions&bt.hScrollbarMoved&&(this.realActions=this.realActions&~bt.hScrollbarMoved),this.realActions&bt.vScrollbarMoved&&(this.realActions=this.realActions&~bt.vScrollbarMoved)}else m=(h.x<0?l:-this.scroller.horizontalOffset)+"px",y=(h.y<0?c:-this.scroller.verticalOffset)+"px";this.diagramLayer.style.left=m,this.diagramLayer.style.top=y,P.tx=-h.x/P.scale,P.ty=-h.y/P.scale}var T=!0;if(o&&(T=!1),this.updateTextElementValue(I),this.refreshing&&I.shape.activity&&I.shape.activity.subProcess&&I.shape.activity.subProcess.processes){for(var A=0;A<I.shape.activity.subProcess.processes.length;A++){var O=I.shape.activity.subProcess.processes[parseInt(A.toString(),10)];I.wrapper.children.push(this.nameTable[""+O].wrapper)}I.wrapper.measure(new i(I.wrapper.bounds.width,I.wrapper.bounds.height)),I.wrapper.arrange(I.wrapper.desiredSize)}I instanceof Co&&"Bezier"===I.type?(d=this.getMidPoint(I),"Canvas"===this.mode&&n&&(d.cx+=P.tx,d.cy+=P.ty)):d=null,e.renderElement(I.wrapper,t,r,!e.isSvgMode&&n?P:void 0,void 0,void 0,T&&(!this.diagramActions||s),void 0,void 0,d,this.portCenterPoint)}}}},r.prototype.updateBridging=function(t){if(this.bridgingModule)for(var e=0;e<this.connectors.length;e++){var r=this.connectors[parseInt(e.toString(),10)];this.bridgingModule.updateBridging(r,this);var n=this.connectors[parseInt(e.toString(),10)].wrapper;if(n&&n.children&&n.children.length>0){var o=n.children[0],a=o.data;(r.isBezierEditing&&this.selectedItems.connectors[0].id===r.id||"Bezier"!==r.type)&&(this.updateQuad(r),r.getSegmentElement(r,o,"ComplexHierarchicalTree"===this.layout.type||"HierarchicalTree"===this.layout.type?this.layout.orientation:void 0,void 0,!1)),o.data!==a&&(n.measure(new i),n.arrange(n.desiredSize),"SVG"!==this.mode||t||this.updateDiagramObject(r))}}else this.constraints&ct.Bridging&&console.warn('[WARNING] :: Module "ConnectorBridging" is not available in Diagram component! You either misspelled the module name or forgot to load it.')},r.prototype.setCursor=function(t){this.diagramRenderer.setCursor(this.diagramCanvas,t)},r.prototype.clearCanvas=function(t){var e=t.contentWidth||t.diagramLayer.width/this.scroller.currentZoom,i=t.contentHeight||t.diagramLayer.height/this.scroller.currentZoom;"SVG"!==t.mode&&Md.getContext(t.diagramLayer).clearRect(0,0,e,i)},r.prototype.updateScrollOffset=function(){this.scroller.setScrollOffset(this.diagramCanvas.scrollLeft,this.diagramCanvas.scrollTop),Mo(this),ir(this)&&this.scroller.virtualizeElements()},r.prototype.setOffset=function(t,e){var i=this.element.id+"content",r=window.domTable;if(!r[""+i]){var n=document.getElementById(i);n&&(r[""+i]=n)}var o=r[""+i];o&&(o.scrollLeft!==t&&(o.scrollLeft=t),o.scrollTop!==e&&(o.scrollTop=e))},r.prototype.setSize=function(t,e){if(this.diagramLayer&&!this.preventDiagramUpdate){var i=Eo(this);t-=i.width,e-=i.height;var r=this.spatialSearch.getPageBounds();r.x*=this.scroller.currentZoom,r.y*=this.scroller.currentZoom,r.width*=this.scroller.currentZoom,r.height*=this.scroller.currentZoom;var n="SVG"===this.mode?1:1.5,o="SVG"===this.mode?ed(this.element.id):this.diagramLayer,a="Canvas"===this.mode&&this.constraints&ct.Virtualization?this.scroller.viewPortWidth:t,s="Canvas"===this.mode&&this.constraints&ct.Virtualization?this.scroller.viewPortHeight:e;o.setAttribute("width",(n*a).toString()),o.setAttribute("height",(n*s).toString());var h=document.getElementById(this.element.id+"_diagramUserHandleLayer");h&&(h.style.width=t+"px",h.style.height=e+"px");var d={width:t.toString(),height:e.toString()};this.diagramLayerDiv.style.width=t+"px",this.diagramLayerDiv.style.height=e+"px",wd(hd(this.element.id),d),wd(id(this.element.id).getElementsByClassName("e-ports-expand-layer")[0],d);var l=nd(this.element.id);wd(l,d),l.parentNode.style.width=t+"px",l.parentNode.style.height=e+"px";var c=dd(this.element.id);wd(c,d),this.diagramRenderer.updateGrid(this.snapSettings,c,this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler),wd(ld(this.element.id),d),this.htmlLayer.style.width=t+"px",this.htmlLayer.style.height=e+"px","SVG"===this.mode||ir(this)||this.refreshDiagramLayer(),"SVG"===this.mode&&ir(this)&&this.scroller.virtualizeElements()}},r.prototype.transformLayers=function(){var t=this.spatialSearch.getPageBounds();t.x*=this.scroller.currentZoom,t.y*=this.scroller.currentZoom,t.width*=this.scroller.currentZoom,t.height*=this.scroller.currentZoom,this.diagramRenderer.updateGrid(this.snapSettings,dd(this.element.id),this.scroller.transform,this.rulerSettings,this.hRuler,this.vRuler),this.diagramRenderer.transformLayers(this.scroller.transform,"SVG"===this.mode),this.diagramActions&yt.DragUsingMouse||this.updateSelector(),this.renderPageBreaks(t)},r.prototype.removePageBreaks=function(){if(this.diagramLayer){var t=cd(this.element.id);if(t&&t.childNodes)for(var e=t.childNodes.length,i=0;i<e;i++)t.removeChild(t.childNodes[0])}},r.prototype.renderPageBreaks=function(t){this.removePageBreaks();var e=cd(this.element.id);if(e){var i=0;t=this.scroller.getPageBounds(!0);var r=(this.scroller.transform.tx+t.x)*this.scroller.currentZoom,n=(this.scroller.transform.ty+t.y)*this.scroller.currentZoom,o=t.height*this.scroller.currentZoom,a=t.width*this.scroller.currentZoom;Go.renderSvgBackGroundImage(this.pageSettings.background,this.element,r,n,a,o);var s={id:e.id+"rect",x:r,y:n,height:o,width:a,angle:0,stroke:"",strokeWidth:1,fill:this.pageSettings.background.color,opacity:1,pivotX:0,pivotY:0,visible:!0,dashArray:"0"};if(this.diagramRenderer.drawRect(e,s),this.pageSettings.showPageBreaks){var h=this.scroller.getPageBreak(t);for(i=0;i<h.length;i++)this.diagramRenderer.drawLine(e,{class:"e-diagram-page-break",fill:"none",stroke:"#aaaaaa",strokeWidth:1,dashArray:"10 10",opacity:2,x:0,y:0,width:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,startPoint:{x:(h[parseInt(i.toString(),10)].x1+this.scroller.transform.tx)*this.scroller.currentZoom,y:(h[parseInt(i.toString(),10)].y1+this.scroller.transform.ty)*this.scroller.currentZoom},endPoint:{x:(h[parseInt(i.toString(),10)].x2+this.scroller.transform.tx)*this.scroller.currentZoom,y:(h[parseInt(i.toString(),10)].y2+this.scroller.transform.ty)*this.scroller.currentZoom},id:h[parseInt(i.toString(),10)].y1===h[parseInt(i.toString(),10)].y2?"HorizontalLines":"VerticalLines"})}}},r.prototype.validatePageSize=function(){var t=0;"Portrait"===this.pageSettings.orientation?this.pageSettings.width>this.pageSettings.height&&(t=this.pageSettings.height,this.pageSettings.height=this.pageSettings.width,this.pageSettings.width=t):this.pageSettings.height>this.pageSettings.width&&(t=this.pageSettings.width,this.pageSettings.width=this.pageSettings.height,this.pageSettings.height=t)},r.prototype.setOverview=function(t,e){if(t)t&&(this.views.push(t.id),this.views[t.id]=t,this.overviewObject={id:t.id,view:t},t.renderDocument(t),t.diagramRenderer.setLayers(),t.initializeOverviewLayers(),t.updateView(t),this.renderNodes(t));else{for(var i=0;i<this.views.length;i++)this.views[parseInt(i.toString(),10)]===e&&(t=this.views[""+e]);this.views[""+e]=void 0;var r=this.views.indexOf(e);r>=0&&this.views.splice(r,1)}},r.prototype.renderNodes=function(t){if(t){var e=new Go(t.id,new Uo,!1),i=document.getElementById(t.element.id+"_diagramLayer"),r=gd(t.element.id);this.renderDiagramElements(i,t.diagramRenderer||e,r,void 0,void 0,void 0,!0)}},r.prototype.updateThumbConstraints=function(t,e,i){for(var r=t.length,n=0;n<r;n++){var o=t[parseInt(n.toString(),10)],a=!1,s=e.thumbsConstraints,h=!1;if(this.nameTable[o.parentId])h=this.nameTable[o.parentId].isLane;o instanceof Yh?(a="Bpmn"===o.shape.type&&"Activity"===o.shape.shape&&!1===o.shape.activity.subProcess.collapsed||"SwimLane"===o.shape.type||h,Zi(o)&&s<.Rotate&&!a||(s&=~lt.Rotate),tr(o,"SouthEast")&&s<.ResizeSouthEast||(s&=~lt.ResizeSouthEast),tr(o,"NorthWest")&&s<.ResizeNorthWest||(s&=~lt.ResizeNorthWest),tr(o,"East")&&s<.ResizeEast||(s&=~lt.ResizeEast),tr(o,"West")&&s<.ResizeWest||(s&=~lt.ResizeWest),tr(o,"North")&&s<.ResizeNorth||(s&=~lt.ResizeNorth),tr(o,"South")&&s<.ResizeSouth||(s&=~lt.ResizeSouth),tr(o,"NorthEast")&&s<.ResizeNorthEast||(s&=~lt.ResizeNorthEast),tr(o,"SouthWest")&&s<.ResizeSouthWest||(s&=~lt.ResizeSouthWest)):o instanceof Co?(i||(s|=lt.Default),Vi(o)?s|=lt.ConnectorSource:s&=~lt.ConnectorSource,Ui(o)?s|=lt.ConnectorTarget:s&=~lt.ConnectorTarget):(i||(s|=lt.Default),tr(o)||(s&=~(lt.ResizeSouthEast|lt.ResizeSouthWest|lt.ResizeSouth|lt.ResizeEast|lt.ResizeWest|lt.ResizeNorth|lt.ResizeNorthEast|lt.ResizeNorthWest)),Zi(o)||(s&=~lt.Rotate)),e.thumbsConstraints=s}},r.prototype.renderSelector=function(t,e,r){var n=this.isProtectedOnChange,o=new i,a=this.selectedItems,s=(a.constraints,this.diagramRenderer.rendererActions);document.getElementsByClassName("blazor-inner-template");if(this.diagramRenderer.rendererActions=this.currentSymbol?this.addConstraints(s,vt.DrawSelectorBorder):this.removeConstraints(s,vt.DrawSelectorBorder),this.clearSelectorLayer(),this.commandHandler.hasSelection()){if(1===a.nodes.length&&0===a.connectors.length&&(a.rotateAngle=a.nodes[0].rotateAngle,a.pivot=a.nodes[0].pivot),a.wrapper.measure(o),a.wrapper.arrange(a.wrapper.desiredSize),a.width=a.wrapper.actualSize.width,a.height=a.wrapper.actualSize.height,a.offsetX=a.wrapper.offsetX,a.offsetY=a.wrapper.offsetY,0!==a.rotateAngle){for(var h=0,d=a.nodes;h<d.length;h++){var l=d[h];l.offsetX=l.wrapper.offsetX,l.offsetY=l.wrapper.offsetY}for(var c=0,p=a.connectors;c<p.length;c++)p[c]}this.spatialSearch.getPageBounds();var g=od(this.element.id),u=sd(this.element.id);if(a.thumbsConstraints=lt.Default,a.annotation?this.updateThumbConstraints([a.annotation],a):(this.updateThumbConstraints(a.nodes,a),this.updateThumbConstraints(a.connectors,a,!0)),a.annotation)this.renderSelectorForAnnotation(a,g);else if(a.nodes.length+a.connectors.length===1||this.nameTable.helper){if(a.nodes[0]instanceof Yh){var f=a.nodes[0];un(this,f)&&(e||"UmlClassifier"===f.shape.type||f.parentId&&this.nameTable[f.parentId]&&"UmlClassifier"===this.nameTable[f.parentId].shape.type||(a.thumbsConstraints&=~lt.Rotate));var m=!!e||!!(f.constraints&ht.HideThumbs),y=!!("SwimLane"===f.shape.type||f.isLane||f.isPhase||e);this.diagramRenderer.renderResizeHandle(e?r:a.wrapper.children[0],g,a.thumbsConstraints,this.scroller.currentZoom,a.constraints,this.scroller.transform,void 0,Yi(f),m,y,a.handleSize)}else if(a.connectors[0]instanceof Co&&ur(this.diagramRenderer.rendererActions)){var v=a.connectors[0];this.diagramRenderer.renderEndPointHandle(v,g,a.thumbsConstraints,a.constraints,this.scroller.transform,void 0!==v.sourceWrapper,void 0!==v.targetWrapper,!(!this.connectorEditingToolModule||!Gi(v)),!!this.connectorEditingToolModule,a.handleSize)}}else this.diagramRenderer.renderResizeHandle(a.wrapper,g,a.thumbsConstraints,this.scroller.currentZoom,a.constraints,this.scroller.transform,void 0,Yi(a),null,null,a.handleSize);a.annotation||this.currentSymbol||this.diagramRenderer.renderUserHandler(a,g,this.scroller.transform,u,this.eventHandler.currentAction,this.eventHandler.inAction)}this.selectedItems.selectedObjects.length>1&&this.updateSelectionRectangle(),this.isProtectedOnChange=n},r.prototype.updateSelectionRectangle=function(){for(var t=od(this.element.id),e=!1,i=0;i<this.selectedItems.selectedObjects.length;i++)e=0===i,vs(this.selectedItems.selectedObjects[parseInt(i.toString(),10)])===Co?this.diagramRenderer.renderSelectionLine(this.selectedItems.selectedObjects[parseInt(i.toString(),10)].wrapper.children[0],t,this.scroller.transform,e):this.diagramRenderer.renderSelectionRectangle(this.selectedItems.selectedObjects[parseInt(i.toString(),10)].wrapper,t,this.scroller.transform,e)},r.prototype.updateSelector=function(){var t=this.allowServerDataBinding;this.enableServerDataBinding(!1);var e=new i,r=this.selectedItems,n=r.constraints;document.getElementsByClassName("blazor-inner-template");if(this.diagramActions&yt.ToolAction||1!==this.selectedItems.nodes.length||(this.selectedItems.rotateAngle=this.selectedItems.nodes[0].rotateAngle,this.selectedItems.wrapper.rotateAngle=this.selectedItems.nodes[0].rotateAngle),void 0!==this.selectedItems&&(this.clearSelectorLayer(),null!==r.wrapper&&r.wrapper.children&&r.wrapper.children.length)){var o=!0,a=!0;if(r.wrapper.rotateAngle=r.rotateAngle,Rs(this,r)){var s=this.eventHandler.action,h=s.includes("Rotate"),d=s.includes("None")||s.includes("Select")||s.includes("Drag");(h||d)&&(a=!1),d||(o=!1)}if(o&&(r.wrapper.measure(e),r.wrapper.arrange(r.wrapper.desiredSize)),0!==r.rotateAngle||r.rotateAngle!==r.wrapper.prevRotateAngle)for(var l=0,c=r.nodes;l<c.length;l++){var p=c[l];p.offsetX=p.wrapper.offsetX,p.offsetY=p.wrapper.offsetY}r.width=r.wrapper.actualSize.width,r.height=r.wrapper.actualSize.height,r.offsetX=r.wrapper.offsetX,r.offsetY=r.wrapper.offsetY;var g=od(this.element.id),u=sd(this.element.id),f=this.eventHandler.canHideResizers();if(r.thumbsConstraints=lt.Default,r.annotation?this.updateThumbConstraints([r.annotation],r):(this.updateThumbConstraints(r.nodes,r),this.updateThumbConstraints(r.connectors,r,!0)),this.selectedItems.constraints&rt.UserHandle&&!r.annotation&&!this.currentSymbol&&this.diagramRenderer.renderUserHandler(r,g,this.scroller.transform,u,this.eventHandler.currentAction,this.eventHandler.inAction),r.annotation)this.renderSelectorForAnnotation(r,g);else if(r.nodes.length+r.connectors.length===1){if(r.connectors[0]instanceof Co&&ur(this.diagramRenderer.rendererActions)){var m=r.connectors[0];this.diagramRenderer.renderEndPointHandle(m,g,r.thumbsConstraints,n,this.scroller.transform,void 0!==m.sourceWrapper,void 0!==m.targetWrapper,!(!this.connectorEditingToolModule||!Gi(m)),!!this.connectorEditingToolModule,r.handleSize)}else if(r.nodes[0]instanceof Yh){var y=r.nodes[0];un(this,r.nodes[0])&&("UmlClassifier"===y.shape.type||y.parentId&&this.nameTable[y.parentId]&&"UmlClassifier"===this.nameTable[y.parentId].shape.type||(r.thumbsConstraints&=~lt.Rotate));var v=!("SwimLane"!==y.shape.type&&!y.isLane&&!y.isPhase);this.diagramRenderer.renderResizeHandle(r.wrapper.children[0],g,r.thumbsConstraints,this.scroller.currentZoom,r.constraints,this.scroller.transform,f,Yi(r.nodes[0]),!!(r.nodes[0].constraints&ht.HideThumbs),v,r.handleSize)}}else this.diagramActions&yt.Interactions&&(this.diagramRenderer.rendererActions=this.diagramRenderer.rendererActions|vt.PreventRenderSelector),Rs(this,r)&&a||this.diagramRenderer.renderResizeHandle(r.wrapper,g,r.thumbsConstraints,this.scroller.currentZoom,r.constraints,this.scroller.transform,f,Yi(r),null,null,r.handleSize),this.diagramRenderer.rendererActions=this.diagramRenderer.rendererActions&~vt.PreventRenderSelector}this.selectedItems.selectedObjects.length>1&&this.updateSelectionRectangle(),this.enableServerDataBinding(t)},r.prototype.renderSelectorForAnnotation=function(t,e){this.diagramRenderer.renderResizeHandle(t.wrapper.children[0],e,t.thumbsConstraints,this.scroller.currentZoom,t.constraints,this.scroller.transform,void 0,Yi(t.annotation),void 0,void 0,t.handleSize)},r.prototype.drawSelectionRectangle=function(t,e,i,r){this.clearSelectorLayer(),this.diagramRenderer.drawSelectionRectangle(t,e,i,r,this.adornerLayer,this.scroller.transform)},r.prototype.renderHighlighter=function(t){var e=nd(this.element.id);this.diagramRenderer.renderHighlighter(t,e,this.scroller.transform)},r.prototype.clearHighlighter=function(){var t=nd(this.element.id),e=t.getElementById(t.id+"_highlighter");e&&e.parentNode.removeChild(e)},r.prototype.getNodesConnectors=function(t){for(var e=0;e<this.nodes.length;e++){var i=this.nodes[parseInt(e.toString(),10)];t.push(i)}for(e=0;e<this.connectors.length;e++){var r=this.connectors[parseInt(e.toString(),10)];t.push(r)}return t},r.prototype.clearSelectorLayer=function(){var t,i=nd(this.element.id);document.getElementsByClassName("blazor-inner-template");if(this.currentSymbol){var r=i.getElementById("borderRect_symbol");r&&r.parentNode.removeChild(r)}else{var n=i.getElementById(this.adornerLayer.id+"_selected_region");n&&n.parentNode.removeChild(n),this.clearHighlighter();var o=od(this.element.id).childNodes,a=void 0,s=this.eventHandler.touchArgs?this.eventHandler.touchArgs.target.id:void 0;s&&s.includes("bezierLine")&&(s=void 0);for(var h=o.length;h>0;h--)this.eventHandler&&this.eventHandler.touchArgs&&"touchmove"===this.eventHandler.touchArgs.type?(this.diagramRenderer.touchMove=!0,s&&s===o[h-1].id||(a=o[h-1]).parentNode.removeChild(a)):(a=o[h-1]).parentNode.removeChild(a);if(!(0,e.isBlazor)()){var d=sd(this.element.id).childNodes;for(t=d.length;t>0;t--)d[t-1].parentNode.removeChild(d[t-1])}}},r.prototype.getWrapper=function(t,e){var i;e=t.id+"_"+e;for(var r=t instanceof te?t:this.getPortContainer(this.nameTable[t.id]),n=0;n<r.children.length;n++)e===r.children[parseInt(n.toString(),10)].id&&(i=r.children[parseInt(n.toString(),10)]);return i},r.prototype.getEndNodeWrapper=function(t,i,r){if("Bpmn"===t.shape.type&&t.wrapper.children[0]instanceof te){if(!(0,e.isBlazor)()&&"Activity"===t.shape.shape){if(r&&"Transaction"===t.shape.activity.subProcess.type&&i.sourcePortID){var n=i.sourcePortID,o=t.wrapper.children[0].children[0].children[2];if(o.children)for(var a=0,s=o.children;a<s.length;a++){var h=s[a];if(h.visible&&h.id===t.id+"_"+n)return h.children[0]}}return t.wrapper.children[0].children[0].children[0]}return"Group"===t.shape.shape?t.wrapper.children[0]:t.wrapper.children[0].children[0]}var d=t.wrapper.children[0];return!d||this.containsMargin(d)||t.children&&0!==t.children.length?t.wrapper:d},r.prototype.containsMargin=function(t){return t.margin&&(0!==t.margin.left||0!==t.margin.top||0!==t.margin.right||0!==t.margin.bottom)},r.prototype.focusOutEdit=function(){this.endEdit(),"Canvas"===this.mode&&1!==this.scroller.currentZoom&&this.refreshDiagramLayer()},r.prototype.endEditCommand=function(){this.endEdit(),this.textEditing=!1,"Canvas"===this.mode&&1!==this.scroller.currentZoom&&this.refreshDiagramLayer()},r.prototype.fontStyleCommand=function(t){for(var e=0;e<this.selectedItems.nodes.length;e++){var i=this.selectedItems.nodes[parseInt(e.toString(),10)];if("SwimLane"===i.shape.type&&i.shape.hasHeader&&this.applyStyleText(t,i.shape.header.annotation),i.isLane){var r=this.getObject(i.shape.header[0].id);this.applyStyle(t,r.annotations)}if("Text"===i.shape.type){var n=i;this.applyStyleText(t,n)}if(i.annotations.length>0){var o=i.annotations;this.applyStyle(t,o)}}for(e=0;e<this.selectedItems.connectors.length;e++)if(this.selectedItems.connectors[parseInt(e.toString(),10)].annotations.length>0){o=this.selectedItems.connectors[parseInt(e.toString(),10)].annotations;this.applyStyle(t,o)}},r.prototype.applyStyle=function(t,e){for(var i=0;i<e.length;i++)switch(t){case"bold":e[parseInt(i.toString(),10)].style.bold=!e[parseInt(i.toString(),10)].style.bold;break;case"italic":e[parseInt(i.toString(),10)].style.italic=!e[parseInt(i.toString(),10)].style.italic;break;case"underline":"None"===e[parseInt(i.toString(),10)].style.textDecoration?e[parseInt(i.toString(),10)].style.textDecoration="Underline":"Underline"===e[parseInt(i.toString(),10)].style.textDecoration&&(e[parseInt(i.toString(),10)].style.textDecoration="None")}this.dataBind()},r.prototype.applyStyleText=function(t,e){switch(t){case"bold":e.style.bold=!e.style.bold;break;case"italic":e.style.italic=!e.style.italic;break;case"underline":"None"===e.style.textDecoration?e.style.textDecoration="Underline":"Underline"===e.style.textDecoration&&(e.style.textDecoration="None")}this.dataBind()},r.prototype.duplicateCommand=function(){var t=[];t=t.concat(this.selectedItems.nodes,this.selectedItems.connectors),this.copy(),this.paste()},r.prototype.groupCommand=function(t){switch(t){case"group":this.group();break;case"ungroup":this.unGroup()}},r.prototype.rotateCommand=function(t){var e=this.selectedItems;switch(t){case"clockwise":this.rotate(e,90);break;case"antiClockwise":this.rotate(e,-90)}},r.prototype.flipCommand=function(t){var e=[];e=e.concat(this.selectedItems.nodes,this.selectedItems.connectors);for(var i=0;i<e.length;i++)switch(t){case"horizontal":e[parseInt(i.toString(),10)].flip=tt.Horizontal;break;case"vertical":e[parseInt(i.toString(),10)].flip=tt.Vertical}this.dataBind()},r.prototype.toolCommand=function(t){switch(t){case"pointer":this.tool=pt.Default,this.dataBind();break;case"text":this.drawingObject={shape:{type:"Text"}},this.tool=pt.DrawOnce,this.dataBind();break;case"connect":this.drawingObject={id:"connector1",type:"Straight"},this.tool=pt.DrawOnce,this.dataBind();break;case"freeForm":this.drawingObject={id:"connector1",type:"Freehand"},this.tool=pt.DrawOnce,this.dataBind();break;case"line":this.drawingObject={id:"connector1",type:"Polyline"},this.tool=pt.DrawOnce,this.dataBind();break;case"rectangle":var e={shape:{type:"Basic",shape:"Rectangle"}};this.drawingObject=e,this.tool=pt.DrawOnce,this.dataBind();break;case"ellipse":var i={shape:{type:"Basic",shape:"Ellipse"}};this.drawingObject=i,this.tool=pt.DrawOnce,this.dataBind()}},r.prototype.zoomCommand=function(t){switch(t){case"zoomIn":this.zoomTo({type:"ZoomIn",zoomFactor:.2});break;case"zoomOut":this.zoomTo({type:"ZoomOut",zoomFactor:.2})}},r.prototype.shiftCommand=function(t){if(this.eventHandler.keyArgs&&void 0!==this.eventHandler.keyArgs.keyModifiers&&4!==this.eventHandler.keyArgs.keyModifiers)return null;if(this.selectedItems instanceof qh&&this.selectedItems.wrapper&&this.constraints&ct.RestrictNegativeAxisDragDrop){var e=this.selectedItems.wrapper.bounds;if(e){if("Left"===t&&e.x-5<0)return;if("Top"===t&&e.y-5<0)return}}var i=0,r=0;"Left"===t||"Right"===t?i="Left"===t?-5:5:r="Up"===t?-5:5;var n=this.selectedItems,o=this.selectedItems.wrapper.children[0];o instanceof Zt?this.commandHandler.labelDrag(n.nodes[0],o,i,r):this.drag(n,i,r);for(var a=0;a<this.selectedItems.connectors.length;a++){var s=this.selectedItems;"Up"===t?this.drag(s,0,-5):"Down"===t?this.drag(s,0,5):"Left"===t?this.drag(s,-5,0):"Right"===t&&this.drag(s,5,0)}},r.prototype.alignCommand=function(t){if(this.selectedItems.nodes.length>0)for(var e=0;e<this.selectedItems.nodes.length;e++)this.updateNodesAndConnectorAnnotation(this.selectedItems.nodes[parseInt(e.toString(),10)],t)},r.prototype.updateNodesAndConnectorAnnotation=function(t,e){for(var i,r=0;r<t.annotations.length;r++){switch(i=t.annotations[parseInt(r.toString(),10)],e){case"left":i.horizontalAlignment="Left";break;case"center":i.horizontalAlignment="Center";break;case"right":i.horizontalAlignment="Right";break;case"justify":i.style.textAlign="Justify";break;case"top":i.verticalAlignment="Top";break;case"centerVertical":i.verticalAlignment="Center";break;case"bottom":i.verticalAlignment="Bottom"}this.dataBind()}},r.prototype.orderCommand=function(t){switch(t){case"sendToBack":this.sendToBack();break;case"bringToFront":this.bringToFront();break;case"sendBackward":this.sendBackward();break;case"bringForward":this.moveForward()}},r.prototype.navigateItems=function(t){var e=0,i=this.activeLayer.objectZIndex,r=[],n=[];r=r.concat(this.selectedItems.nodes,this.selectedItems.connectors),n=n.concat(this.nodes,this.connectors),(e=r.length>0?r[0].zIndex+(t?1:-1):t?0:i)<0?e=i:e>i&&(e=0);var o=!1;do{for(var a=0;a<n.length;a++){var s=n[parseInt(a.toString(),10)];if(e===s.zIndex){this.clearSelection(),this.select([s]),o=!0;break}}o||(t?e++:e--)}while(!o&&n.length>0)},r.prototype.endEdit=function(){return oc(this,void 0,void 0,function(){var t,i,r,n,o,a,s,h,d,l,c,p,g,u,f,m,y,v,b,S,w,x;return ac(this,function(I){if(this.diagramActions&yt.TextEdit&&(t=void 0,i=void 0,r={},this.enableServerDataBinding(!1),n=document.getElementById(this.element.id+"_editBox"),!(0,e.isBlazor)())){if(o=n.value,e.EventHandler.remove(n,"input",this.eventHandler.inputChange),e.EventHandler.remove(n,"focusout",this.focusOutEdit),a=document.getElementById(this.element.id+"_editTextBoxDiv"),s=void 0,s=this.nameTable[this.activeLabel.parentId],h=is(s,this.activeLabel.id),d={oldValue:this.activeLabel.text,newValue:o,cancel:!1,element:s,annotation:h},a.parentNode.removeChild(a),l=void 0,!h||h instanceof vh?t={shape:{content:s.shape.content}}:(g=os(s,h.id,!0),r[""+g]={content:h.content},t={annotations:r}),c=!1,"Draw"===this.eventHandler.currentAction&&(c=this.eventHandler.isAddTextNode(s,!0)),c||a.textContent===o&&o===this.activeLabel.text||this.triggerEvent(xt.textEdit,d),l||(l=this.getWrapper(s.wrapper,this.activeLabel.id)),p=!1,h&&h.content!==o&&!d.cancel&&(p=!0,this.activeLabel.isGroup||this.startGroupAction(),s.parentId&&"UmlClassifier"===this.nameTable[s.parentId].shape.type&&-1===o.indexOf("+")&&-1===o.indexOf("-")&&-1===o.indexOf("#")&&-1===o.indexOf("~")&&-1===s.id.indexOf("_umlClass_header")&&(o=" + "+o),(s.isLane||s.isPhase)&&this.protectPropertyChange(!0),h instanceof vh?i={shape:{content:o}}:(g=os(s,h.id,!0),(u={})[""+g]={content:o},i={annotations:u}),(f=this.getIndex(s,s.id))&&((m={})[""+f]=t,(y={})[""+f]=i,vs(s)===Yh?this.onPropertyChanged({nodes:y},{nodes:m}):this.onPropertyChanged({connectors:y},{connectors:m})),this.protectPropertyChange(!0),h.content=o,this.protectPropertyChange(!1),this.updateSelector(),(s.isLane||s.isPhase)&&this.protectPropertyChange(!1)),c&&(this.removeObjectsFromLayer(s),this.removeFromAQuad(s),delete this.nameTable[this.activeLabel.parentId],""!==o&&(this.clearSelection(),v=N(s),s=this.add(v),this.updateDiagramObject(s),this.commandHandler.oldSelectedObjects=Is(this),this.commandHandler.select(this.nameTable[s.id]))),this.selectedItems.nodes.length){if(b=this.nameTable[this.activeLabel.parentId],(S=this.nameTable[b.parentId])&&"SwimLane"===S.shape.type||"SwimLane"===b.shape.type)if("SwimLane"===b.shape.type&&(S=this.nameTable[this.activeLabel.parentId],b=s),b.isLane||b.isPhase)for(w=b.isLane?S.shape.lanes:S.shape.phases,x=0;x<w.length;x++)w[parseInt(x.toString(),10)].id===(b.LaneHeaderParent||b.PhaseHeaderParent)&&(w[parseInt(x.toString(),10)].header.annotation.content=b.annotations[0].content);else b.isHeader&&S.shape.hasHeader&&(S.shape.header.annotation.content=b.annotations[0].content);this.dataBind()}l.visible=!0,this.updateDiagramObject(s),this.diagramActions=this.diagramActions&~yt.TextEdit,(this.activeLabel.isGroup||p)&&this.endGroupAction(),this.activeLabel={id:"",parentId:"",isGroup:!1,text:void 0},this.commandHandler.getBlazorOldValues(),this.enableServerDataBinding(!0)}return[2]})})},r.prototype.getIndex=function(t,e){for(var i=vs(t)===Yh?this.nodes:this.connectors,r=0;r<i.length;r++)if(i[parseInt(r.toString(),10)].id.toString()===e.toString())return r.toString();return null},r.prototype.canLogChange=function(){return!(!(this.diagramActions&yt.Render)||this.diagramActions&yt.ToolAction||this.diagramActions&yt.UndoRedo||this.diagramActions&yt.PublicMethod)},r.prototype.modelChanged=function(t,e){return!!(t.connectors||e.connectors||t.nodes||e.connectors||t.pageSettings||e.pageSettings||t.bridgeDirection||e.bridgeDirection)},r.prototype.resetDiagramActions=function(t){var e=!!t;this.diagramActions&yt.UndoRedo&&(!e||t===yt.UndoRedo)&&(this.diagramActions=this.diagramActions&~yt.UndoRedo),this.diagramActions&yt.PublicMethod&&(!e||t===yt.PublicMethod)&&(this.diagramActions=this.diagramActions&~yt.PublicMethod)},r.prototype.removeNode=function(t,e){this.removeObjectsFromLayer(t),this.removeFromAQuad(this.nameTable[t.id]);var i=document.getElementById(t.id+"_groupElement");if(delete this.nameTable[t.id],t.children&&delete this.groupTable[t.id],this.nodes.splice(this.nodes.indexOf(t),1),i&&i.children&&i.children.length>0)for(var r=void 0,n=i.children.length-1;n>=0;n--){var o=i.children[parseInt(n.toString(),10)];e.length>0&&-1!==e.indexOf(o.id.split("_groupElement")[0])&&(r?i.parentNode.insertBefore(o,r):i.parentNode.insertBefore(o,i),r=o)}i&&i.parentNode.removeChild(i)},r.prototype.deleteGroup=function(t){var e=[];t.children&&(e=this.commandHandler.getChildren(t,[])),this.UpdateBlazorDiagramModelCollection(t);for(var i=0,r=e;i<r.length;i++){var n=r[i];n&&this.nameTable[n.id]&&this.remove(n)}},r.prototype.updateObject=function(t,e,i){if(!(this.diagramActions&yt.ToolAction)){var r=t.wrapper.children[0].bounds;if(!this.commandHandler.checkBoundaryConstraints(void 0,void 0,r,!0))if(t instanceof Yh){for(var n=e,o=0,a=Object.keys(i);o<a.length;o++){switch(d=a[o]){case"width":t.width=n.width;break;case"height":t.height=n.height;break;case"offsetX":t.offsetX=n.offsetX;break;case"offsetY":t.offsetY=n.offsetY;break;case"rotateAngle":t.rotateAngle=n.rotateAngle}}this.nodePropertyChange(t,i,e)}else{for(var s=0,h=Object.keys(i);s<h.length;s++){var d=h[s],l=e,c=t.sourcePoint,p=t.targetPoint;switch(d){case"sourcePoint":c.x=l.sourcePoint.x||c.x,c.y=l.sourcePoint.y||c.y;break;case"targetPoint":p.x=l.targetPoint.x||p.x,p.y=l.targetPoint.y||p.y}}this.connectorPropertyChange(t,i,e)}}},r.prototype.nodePropertyChangeExtend=function(t,e,i,r){return void 0!==i.style&&"Bpmn"!==t.shape.type&&(Ha(i.style,t.wrapper.children[0]),r=!0),void 0!==i.shadow&&(this.updateShadow(t.shadow,i.shadow),r=!0),void 0!==i.constraints&&(e.constraints&ht.Select&&!(i.constraints&ht.Select)&&Dn(this,t)?this.clearSelection():(this.updateThumbConstraints(this.selectedItems.nodes,this.selectedItems),this.updateSelector(),r=!0)),this.updateTextAnnotationInSwimlane(t,i),this.swimLaneNodePropertyChange(t,e,i,r),r},r.prototype.updateTextAnnotationInSwimlane=function(t,e){if(t.hasTextAnnotation&&this.isPositionUndo)for(var r=0;r<t.outEdges.length;r++){var n=this.nameTable[t.outEdges[parseInt(r.toString(),10)]];if(n.isBpmnAnnotationConnector){var o=this.nameTable[n.targetID];if(this.isProtectedOnChange=!0,t.laneMargin&&o){var a=t.margin.left-t.laneMargin.left,s=t.margin.top-t.laneMargin.top;o.margin.left+=a,o.margin.top+=s,o.offsetX+=a,o.offsetY+=s,o.wrapper.offsetX+=a,o.wrapper.offsetY+=s,o.wrapper.measure(new i(o.wrapper.width,o.wrapper.height)),o.wrapper.arrange(o.wrapper.desiredSize),this.updateDiagramObject(o)}this.isProtectedOnChange=!1}}},r.prototype.swimLaneNodePropertyChange=function(t,e,i,r){if(("SwimLane"===t.shape.type||"Container"===t.shape.type)&&!this.currentSymbol){if(e.shape){var n,o=i.shape,a=t.shape,s="Horizontal"===a.orientation,h=a.padding,d=e.shape,l=t.wrapper.children[0],c=void 0,p=void 0,g=void 0;if(d.lanes||d.phases){if(d.lanes)for(var u=0,f=Object.keys(o.lanes);u<f.length;u++){var m=f[u],y=Number(m),v=d.lanes[parseInt(y.toString(),10)],b=void 0,S=o.lanes[parseInt(y.toString(),10)];if(S&&S.header&&(g=a.lanes[parseInt(y.toString(),10)].header.id,c=v.header,(p=S.header).annotation&&p.annotation.content&&(this.nameTable[""+g].annotations[0].content=p.annotation.content),p.annotation&&p.annotation.style&&(this.nameTable[""+g].annotations[0].style=p.annotation.style),p.annotation&&p.annotation.offset&&(this.nameTable[""+g].annotations[0].offset=p.annotation.offset),this.nodePropertyChange(this.nameTable[""+g],c,p)),v.children){for(var w=0,x=Object.keys(v.children);w<x.length;w++){var I=x[w];g=a.lanes[parseInt(y.toString(),10)].children[Number(I)].id;var P=this.nameTable[""+g];c=v.children[Number(I)],p=S.children[Number(I)],this.nodePropertyChange(P,c,p);var C=this.nameTable[P.parentId];this.diagramActions&yt.UndoRedo||(this.startGroupAction(),wn(C,t,P,this))}this.updateSelector()}v.width&&!s&&(b=a.phases&&a.phaseSize?y+1:y,l.updateColumnWidth(b,S.width,!0,h),this.updateDiagramElementQuad()),v.height&&s&&(b=a.header&&a.hasHeader?y+1:y,b+=a.phases&&a.phaseSize?1:0,l.updateRowHeight(b,S.height,!0,h),this.updateDiagramElementQuad())}if(o.phases)for(var T=0,A=Object.keys(o.phases);T<A.length;T++){var O=A[T],D=(y=Number(O),o.phases[parseInt(y.toString(),10)]),M=void 0,L=a.header&&a.hasHeader?1:0;if(D&&D.header&&(g=a.phases[parseInt(y.toString(),10)].header.id,c=d.phases[parseInt(y.toString(),10)].header,(p=D.header).annotation&&p.annotation.content&&(this.nameTable[""+g].annotations[0].content=p.annotation.content),p.annotation&&p.annotation.style&&(this.nameTable[""+g].annotations[0].style=p.annotation.style),p.annotation&&p.annotation.offset&&(this.nameTable[""+g].annotations[0].offset=p.annotation.offset),this.nodePropertyChange(this.nameTable[""+g],c,p)),D.offset){if(0===y)M=D.offset;else{var z=a.phases[y-1];(M=D.offset-z.offset)<=0&&(M=D.offset)}s?(l.updateColumnWidth(y,M,!0,h),Yr(t,this,l.rows[parseInt(L.toString(),10)].cells[parseInt(y.toString(),10)],y)):l.updateRowHeight(L+y,M,!0,h)}}}if(void 0!==o.phaseSize&&a.phases.length)if(0===o.phaseSize||0===d.phaseSize)if(d.phaseSize)s?(l.removeRow(a.header&&a.hasHeader?1:0),t.height=t.wrapper.height=l.height):(a.header&&a.hasHeader&&(l.rows[0].cells[1].children=l.rows[0].cells[0].children,l.rows[0].cells[1].columnSpan=l.rows[0].cells[0].columnSpan-1,l.rows[0].cells[0].children=[]),l.removeColumn(0));else{if(s){var k=new vr;k.height=o.phaseSize,l.addRow(a.header&&a.hasHeader?1:0,k,!0),t.height=t.wrapper.height+=o.phaseSize}else{var B=new br;B.width=o.phaseSize,l.addColumn(0,B,!0),a.header&&a.hasHeader&&(l.rows[0].cells[0].children=l.rows[0].cells[1].children,l.rows[0].cells[1].children=[],l.rows[0].cells[1].columnSpan=1,l.rows[0].cells[1].minWidth=void 0,l.rows[0].cells[0].columnSpan=a.lanes.length+1)}for(var R=0;R<a.phases.length;R++)""===a.phases[parseInt(R.toString(),10)].id&&(a.phases[parseInt(R.toString(),10)].id=E()),Cr(l,this,t,a.header&&a.hasHeader?1:0,s,R)}else s?l.updateRowHeight(a.header&&a.hasHeader?1:0,o.phaseSize,!1):l.updateColumnWidth(0,o.phaseSize,!1);if(a.header&&a.hasHeader&&d.header)"SwimLane"===t.shape.type?n=l.rows[0].cells[0].children[0].id:"Container"===t.shape.type&&(n=l.children[1].id),p=o.header,c=d.header,p.annotation&&p.annotation.offset&&(this.nameTable[""+n].annotations[0].offset=p.annotation.offset),this.nodePropertyChange(this.nameTable[""+n],c,p);t.height=l.height,t.width=l.width,"SwimLane"===t.shape.type&&(t.wrapper.height=l.height,t.wrapper.width=l.width)}else if(e.constraints){var N=e.constraints&ht.Select,j=i.constraints&ht.Select;if(N!==j){o=t.shape;var H=this.nameTable[t.id+o.header.id];H.constraints=j?H.constraints|ht.Select:H.constraints&~ht.Select;var W=void 0;if(o.phaseSize>0)for(var _=0;_<o.phases.length;_++)(W=this.nameTable[t.id+o.phases[parseInt(_.toString(),10)].id+"_header"]).constraints=j?W.constraints|ht.Select:W.constraints&~ht.Select;var Y=void 0,F=void 0,X=o.phases.length||1;for(_=0;_<o.lanes.length;_++)for(var V=0;V<X;V++)(Y=this.nameTable[t.id+o.lanes[parseInt(_.toString(),10)].id+V]).constraints=j?Y.constraints|ht.Select:Y.constraints&~ht.Select,0===V&&((F=this.nameTable[t.id+o.lanes[parseInt(_.toString(),10)].id+"_"+V+"_header"]).constraints=j?F.constraints|ht.Select:F.constraints&~ht.Select)}}r=!0}return r},r.prototype.insertValue=function(t,e){if(!(this.blazorActions&$.GroupClipboardInProcess)){for(var i=void 0,r=e?this.oldNodeObjects:this.oldConnectorObjects,n=0;n<r.length;n++)r[parseInt(n.toString(),10)].id===t.id&&(i=!0);i||(e?this.oldNodeObjects.push(t):this.oldConnectorObjects.push(t))}},r.prototype.nodePropertyChange=function(t,r,n,o,a,s){var h=this;if(this.canEnableBlazorObject&&"helper"!==t.id){var d=N(t);this.insertValue(d,!0)}var l,c=t.wrapper.outerBounds,p=t.wrapper.bounds,g=!1,u=0,f=0,m=0,y=0,v=!1,b=!1,S=!1;if(void 0!==n.width&&(t.children?t.container?t.wrapper.width=n.width:this.scaleObject(t,n.width,!0):(t.wrapper.children[0].width=n.width,l=!0,g=!0,"SwimLane"===t.shape.type&&(t.wrapper.width=n.width)),v=!0),void 0!==n.height){if(t.children)t.container?t.wrapper.height=n.height:this.scaleObject(t,n.height,!1);else if(t.wrapper.children[0].height=n.height,l=!0,g=!0,"SwimLane"===t.shape.type&&(t.wrapper.height=n.height,"SwimLane"===t.shape.type&&this.isUndo)){var w=t.shape;if(w.header&&w.hasHeader){var x=t.wrapper.children[0],I=w.padding,P=r.height-n.height,C=x.rowDefinitions(),T=C.length-1,A=C[parseInt(T.toString(),10)].height-P;x.updateRowHeight(T,A,!0,I,!0)}}v=!0}if(l=this.nodePropertyChangeExtend(t,r,n,l),void 0!==n.constraints&&qi(r)!==qi(n)&&(t.wrapper.children[0].shadow=qi(t)?t.shadow:null),void 0!==n.offsetX){if(u=r.offsetX,f=n.offsetX,t.wrapper.flip!==tt.None)if(t.offsetX!==t.wrapper.offsetX&&void 0!==r.offsetX){var O=n.offsetX-r.offsetX;t.wrapper.offsetX=t.wrapper.offsetX+O,this.updateFlipOffset(t.wrapper,O,0,t.wrapper.flip)}else t.wrapper.offsetX=n.offsetX;else t.wrapper.offsetX=n.offsetX;l=!0,g=!0,b=!0}if(void 0!==n.offsetY){if(m=r.offsetY,y=n.offsetY,t.wrapper.flip!==tt.None)if(t.offsetY!==t.wrapper.offsetY&&void 0!==r.offsetY){var D=n.offsetY-r.offsetY;t.wrapper.offsetY=t.wrapper.offsetY+D,this.updateFlipOffset(t.wrapper,0,D,t.wrapper.flip)}else t.wrapper.offsetY=n.offsetY;else t.wrapper.offsetY=n.offsetY;l=!0,g=!0,b=!0}if(void 0!==n.padding&&(t.wrapper.padding.left=void 0!==n.padding.left?n.padding.left:t.wrapper.padding.left,t.wrapper.padding.right=void 0!==n.padding.right?n.padding.right:t.wrapper.padding.right,t.wrapper.padding.top=void 0!==n.padding.top?n.padding.top:t.wrapper.padding.top,t.wrapper.padding.bottom=void 0!==n.padding.bottom?n.padding.bottom:t.wrapper.padding.bottom,l=!0),void 0!==n.pivot&&(t.wrapper.pivot=n.pivot,l=!0),void 0!==n.minWidth&&(t.wrapper.minWidth=t.wrapper.children[0].minWidth=n.minWidth,l=!0,g=!0,v=!0),void 0!==n.minHeight&&(t.wrapper.minHeight=t.wrapper.children[0].minHeight=n.minHeight,l=!0,g=!0,v=!0),void 0!==n.maxWidth&&(t.wrapper.maxWidth=n.maxWidth,l=!0,g=!0,v=!0),void 0!==n.maxHeight&&(t.wrapper.maxHeight=n.maxHeight,l=!0,g=!0,v=!0),this.isNotContainerOrSubProcess(t)&&this.isNotSwimlaneObject(t)){if(void 0!==n.flip){var M=(n.flip&tt.Horizontal^t.wrapper.flip&tt.Horizontal)===tt.Horizontal,L=(n.flip&tt.Vertical^t.wrapper.flip&tt.Vertical)===tt.Vertical;if(M&&(t.wrapper.flip^=tt.Horizontal),L&&(t.wrapper.flip^=tt.Vertical),l=!0,g=!0,t.children){var E=t.children.filter(function(t){return h.nameTable[""+t]&&h.nameTable[""+t]instanceof Co});E&&E.length>0?this.groupBounds=t.wrapper.bounds:this.groupBounds=null}else this.groupBounds=null;ws(t.wrapper,t.offsetX,t.offsetY,this,void 0,M,L),M!==L&&xs(t,this),this.updateWrapperChildFlip(t)}if(void 0!==n.flipMode){var z;z=t.wrapper.flipMode=n.flipMode,l=!0,g=!0,this.updateWrapperChildFlip(t,z)}}if(void 0!==n.rotateAngle&&t.constraints&ht.Rotate&&(t.children&&a&&this.commandHandler.rotateObjects(t,[t],t.rotateAngle-t.wrapper.rotateAngle,{x:t.offsetX,y:t.offsetY},!1),t.wrapper.rotateAngle=n.rotateAngle,l=!0,g=!0,S=!0,t.processId||t.parentId&&"Container"===this.nameTable[t.parentId].shape.type)){var k=N(t),B=void 0;B=t.processId?this.nameTable[t.processId]:this.nameTable[t.parentId],k.margin.top=t.offsetY-t.actualSize.height/2-(B.offsetY-B.actualSize.height/2),k.margin.left=t.offsetX-t.actualSize.width/2-(B.offsetX-B.actualSize.width/2),k.margin.left===t.margin.left&&k.margin.top===t.margin.top||this.updateMargin(t,k)}if(void 0!==n.backgroundColor&&(t.wrapper.style.fill=n.backgroundColor),void 0!==n.visible&&this.updateElementVisibility(t.wrapper,t,t.visible),void 0!==n.shape&&"Bpmn"!==t.shape.type&&(l=!0,Fa(n,t,r,this),g=!0),n.margin&&(l=!0,this.updateMargin(t,n),t.parentId&&"Container"===this.nameTable[t.parentId].shape.type&&function(t,e){for(var i=e.nameTable[t.parentId].wrapper.children[0].children,r=0;r<i.length;r++)if(i[parseInt(r.toString(),10)].id===t.wrapper.id&&(i[parseInt(r.toString(),10)].offsetX===t.wrapper.offsetX||i[parseInt(r.toString(),10)].offsetY===t.wrapper.offsetY)){i[parseInt(r.toString(),10)]=t.wrapper;break}}(t,this),g=!0,b=!0),(void 0!==n.shape&&void 0===n.shape.type||void 0!==n.width||void 0!==n.maxWidth||void 0!==n.minWidth||void 0!==n.maxHeight||void 0!==n.minHeight||void 0!==n.height||void 0!==n.style)&&"Bpmn"===t.shape.type&&this.bpmnModule&&(l=!0,g=!0,this.bpmnModule.updateBPMN(n,r,t,this)),void 0===n.width&&void 0===n.height||"Container"!==t.shape.type||(l=!0,function(t,e,r,n,o){if(n.children[0].width=t.width,n.children[0].height=t.height,r.shape.header&&r.shape.hasHeader){var a=o.nameTable[r.id+r.shape.header.id];a.wrapper.children[0].width=t.width,a.wrapper.measure(new i(a.wrapper.bounds.width,a.wrapper.bounds.height)),a.wrapper.arrange(a.wrapper.desiredSize)}}(n,0,t,t.wrapper.children[0],this)),void 0!==n.style&&"Container"===t.shape.type&&(l=!0,Ha(n.style,t.wrapper.children[0].children[0])),"UmlActivity"!==t.shape.type||(0,e.isBlazor)()||"FinalNode"!==t.shape.shape||(l=!0,g=!0,this.updateUMLActivity(n,r,t,this)),(t.shape&&"UmlClassifier"===t.shape.type||t.parentId&&this.nameTable[t.parentId]&&"UmlClassifier"===this.nameTable[t.parentId].shape.type)&&(l=!0,g=!0),void 0!==n.ports)for(var R=0,j=Object.keys(n.ports);R<j.length;R++){var H=j[R],W=Number(H);l=!0;var _=n.ports[""+H],Y=t.ports[parseInt(W.toString(),10)];this.updatePort(_,Y,t.wrapper),t.flip!==tt.None&&("Port"!==t.flipMode&&"PortAndLabel"!==t.flipMode&&"PortAndLabelText"!==t.flipMode&&"All"!==t.flipMode||this.updatePorts(t,t.flip)),g=!0}if(void 0!==n.annotation||void 0!==n.annotations||void 0!==n.width)for(var F=0,X=Object.keys(n.annotations||t.annotations);F<X.length;F++){H=X[F],W=Number(H);l=!0;_=void 0;_=n.annotation?n.annotation:n.annotations?n.annotations[""+H]:t.annotations;var V=t.annotations[parseInt(W.toString(),10)];if(V){var U=!!t.width;this.updateAnnotation(_,V,t.wrapper,t,U);var G=this.nameTable[t.parentId];if(G&&"SwimLane"===G.shape.type){if(t.isLane||t.isPhase){for(var Z=t.isLane?G.shape.lanes:G.shape.phases,q=0;q<Z.length;q++)if(Z[parseInt(q.toString(),10)].id===(t.LaneHeaderParent||t.PhaseHeaderParent)){Z[parseInt(q.toString(),10)].header.annotation.content=t.annotations[0].content,Z[parseInt(q.toString(),10)].header.annotation.style=t.annotations[0].style,Z[parseInt(q.toString(),10)].header.annotation.offset.x=t.annotations[0].offset.x,Z[parseInt(q.toString(),10)].header.annotation.offset.y=t.annotations[0].offset.y,Z[parseInt(q.toString(),10)].header.annotation.width=t.annotations[0].width,Z[parseInt(q.toString(),10)].header.annotation.height=t.annotations[0].height;break}}else t.isHeader&&(G.shape.header.annotation.offset.x=t.annotations[0].offset.x,G.shape.header.annotation.offset.y=t.annotations[0].offset.y,G.shape.header.annotation.rotateAngle=t.annotations[0].rotateAngle,G.shape.header.annotation.width=t.annotations[0].width,G.shape.header.annotation.height=t.annotations[0].height)}else if(G&&"Container"===G.shape.type&&t.isHeader){var Q=G.shape.header;Q.annotation.content=t.annotations[0].content,Q.annotation.offset=t.annotations[0].offset,Q.annotation.width=t.annotations[0].width,Q.annotation.height=t.annotations[0].height,Q.annotation.rotateAngle=t.annotations[0].rotateAngle}}}if(void 0===n.expandIcon&&void 0===n.collapseIcon&&void 0===n.isExpanded||(this.updateIcon(t),this.updateDefaultLayoutIcons(t),void 0!==n.isExpanded&&(this.canExpand=!0,this.diagramActions|=yt.PreventIconsUpdate,this.commandHandler.expandNode(t,this),this.diagramActions=this.diagramActions&~yt.PreventIconsUpdate),l=!0,this.canExpand=!1),void 0!==n.fixedUserHandles){W=void 0,_=void 0;for(var K=void 0,J=0,$=Object.keys(n.fixedUserHandles);J<$.length;J++){H=$[J];W=Number(H),l=!0,n.fixedUserHandles[parseInt(W.toString(),10)]&&(_=n.fixedUserHandles[parseInt(W.toString(),10)]),(K=t.fixedUserHandles[parseInt(W.toString(),10)])&&this.updateNodefixedUserHandle(_,K,t.wrapper,t)}}if(void 0!==n.tooltip&&this.updateTooltip(t,n),l){if(void 0!==this.bpmnModule&&(b&&!v&&!this.sizeUndo||v&&"Bpmn"===t.shape.type&&"TextAnnotation"!==t.shape.shape)&&!S&&this.updateBpmnAnnotationPosition(u,m,f,y,t,t.wrapper,t.shape,"TextAnnotation"===t.shape.shape,r,v,this.sizeUndo),this.checkSelectedItem(t)&&t.wrapper.children[0]instanceof Zt&&t.wrapper.children[0].refreshTextElement(),t.wrapper.measure(new i(t.wrapper.bounds.width,t.wrapper.bounds.height),t.id,this.onLoadImageSize.bind(this)),t.wrapper.arrange(t.wrapper.desiredSize),this.updateObject(t,r,n),!("SwimLane"!==t.shape.type||this.currentSymbol||this.diagramActions&yt.ToolAction)){Fr(this,t);x=t.wrapper.children[0];var et=t.shape,it=x.columnDefinitions().length;if("Horizontal"===et.orientation){W=et.header&&et.hasHeader?1:0;Yr(t,this,x.rows[parseInt(W.toString(),10)].cells[it-1],it-1)}t.wrapper.measure(new i(t.wrapper.bounds.width,t.wrapper.bounds.height)),t.wrapper.arrange(t.wrapper.desiredSize)}if(this.diagramActions&yt.ToolAction&&!(this.diagramActions&yt.UndoRedo)||this.checkSelectedItem(t)&&this.updateSelector(),!1===c.equals(c,t.wrapper.outerBounds)&&(this.updateQuad(t),t.parentId&&this.nameTable[t.parentId])){var rt=this.nameTable[t.parentId];this.updateQuad(rt)}if(o?t&&t.visible&&t.outEdges&&this.updateIconVisibility(t,0!==t.outEdges.length):this.commandHandler.connectorSegmentChange(t,p,void 0!==n.rotateAngle),void 0!==this.bpmnModule&&this.bpmnModule.updateDocks(t,this),t.shape instanceof Gh&&ah(t,this),(n.annotations||t.isHeader)&&(t.processId||t.parentId&&"Container"===this.nameTable[t.parentId].shape.type)||void 0!==n.flip||this.updateGroupOffset(t),t.parentId&&this.nameTable[t.parentId]){var nt=this.nameTable[t.parentId];nt.wrapper.measure(new i(nt.wrapper.width,t.wrapper.height)),nt.wrapper.arrange(nt.wrapper.desiredSize),nt.offsetX=nt.wrapper.offsetX,nt.offsetY=nt.wrapper.offsetY}if(!1===p.equals(p,t.wrapper.bounds)&&("Drag"!==this.eventHandler.currentAction&&this.updateGroupSize(t),t.children&&this.updateGroupOffset(t)),"SwimLane"===t.shape.type&&!this.currentSymbol&&this.diagramActions&yt.Render)Rr(Dr(this,t.wrapper.children[0]),this);if(!this.preventNodesUpdate){if((!ir(this)||ir(this)&&this.scroller.oldCollectionObjects.indexOf(t.id)>-1)&&(this.diagramActions&yt.PreventZIndexOnDragging?this.updateDiagramObject(t,!0):this.updateDiagramObject(t),t.parentId)){var ot=this.nameTable[t.parentId];"BPMN"===ot.shape.type||this.diagramActions&yt.isGroupDragging||(this.diagramActions&yt.PreventZIndexOnDragging?this.updateDiagramObject(ot,!0):ot.isLane||this.updateDiagramObject(ot))}if(!o&&g&&(this.lineRoutingModule&&this.diagramActions&&this.constraints&ct.LineRouting&&"helper"!==t.id?this.diagramActions&yt.ToolAction||this.lineRoutingModule.renderVirtualRegion(this,!0):this.diagramActions&&this.constraints&ct.LineRouting&&"helper"!==t.id&&console.warn('[WARNING] :: Module "LineRouting" is not available in Diagram component! You either misspelled the module name or forgot to load it.'),this.updateConnectorEdges(t),"helper"!==t.id&&!(this.diagramActions&yt.ToolAction)))for(var at=this.spatialSearch.findObjects(t.wrapper.outerBounds),st=0;st<at.length;st++){var dt=at[parseInt(st.toString(),10)];dt instanceof Co&&this.connectorPropertyChange(at[parseInt(st.toString(),10)],{},{sourceID:dt.sourceID,targetID:dt.targetID,sourcePortID:dt.sourcePortID,targetPortID:dt.targetPortID,sourcePoint:dt.sourcePoint,targetPoint:dt.targetPoint})}}"New"!==t.status&&this.diagramActions&&(t.status="Update")}if(!s){var lt={element:t,cause:this.diagramActions,diagramAction:this.getDiagramAction(this.diagramActions),oldValue:r,newValue:n};this.triggerEvent(xt.propertyChange,lt)}},r.prototype.hasSelectedConnector=function(t){var e=(this.selectedItems.connectors||[]).map(function(t){return t.id});return!!(t.outEdges||[]).concat(t.inEdges||[]).some(function(t){return-1!==e.indexOf(t)})},r.prototype.updateWrapperChildFlip=function(t,e){if(t&&t.children&&t.children.length>0)for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)],n=this.nameTable[""+r],o="";e?(o=e,n.wrapper.flipMode=o,n.flipMode=o):o=n.flipMode,"None"===o||"Label"===o||"LabelText"===o||"LabelAndLabelText"===o?this.updatePorts(n,tt.None):this.updatePorts(n,n.wrapper.flip),this.updateWrapperFlip(n.wrapper,n)}var a;"None"===(e=t.flipMode)||"Label"===e||"LabelText"===e||"LabelAndLabelText"===e?this.updatePorts(t,tt.None):this.updatePorts(t,t.wrapper.flip),(a=t.children?t.wrapper.children[t.wrapper.children.length-1]:t.wrapper).flip=t.wrapper.flip,a.flipMode=t.flipMode,this.updateWrapperFlip(a,t)},r.prototype.updateWrapperFlip=function(t,e){for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)];r instanceof Zt?"None"!==e.flipMode&&"Port"!==e.flipMode?(r.flip=e.wrapper.flip,r.flipMode=e.flipMode):r.flip=tt.None:r instanceof te&&this.applyWrapperCanvasFlip(r,e)}},r.prototype.getResizeHandle=function(t,e,i,r,n,o,a,s){var h=n-t,d=o-e,l=a-i,c=s-r;return 0===c&&(h>0&&l>0||h<0&&l<0)?"ResizeEast":0===c&&(h>0&&l<0||h<0&&l>0)?"ResizeWest":0===l&&(d>0&&c<0||d<0&&c>0)?"ResizeNorth":0===l&&(d>0&&c>0||d<0&&c<0)?"ResizeSouth":(h>0&&l>0||h<0&&l<0)&&(d>0&&c>0||d<0&&c<0)?"ResizeSouthEast":(h>0&&l<0||h<0&&l>0)&&(d>0&&c>0||d<0&&c<0)?"ResizeSouthWest":(h>0&&l>0||h<0&&l<0)&&(d>0&&c<0||d<0&&c>0)?"ResizeNorthEast":(h>0&&l<0||h<0&&l>0)&&(d>0&&c<0||d<0&&c>0)?"ResizeNorthWest":null},r.prototype.getTextAnnotationOffset=function(t,e,i,r,n){var o=t.width-i.width,a=t.height-i.height,s=this.getTextAnnotationQuadrant(t,e),h=this.getResizeHandle(i.offsetX,i.offsetY,i.width,i.height,t.offsetX,t.offsetY,t.width,t.height),d=0,l=0;return function(t){return"ResizeEast"===h||"ResizeNorthEast"===h||"ResizeSouthEast"===h?t.includes("East"):("ResizeWest"===h||"ResizeNorthWest"===h||"ResizeSouthWest"===h)&&t.includes("West")}(s)&&(d=h.includes("West")?-o:o),function(t){return"ResizeSouth"===h||"ResizeSouthWest"===h||"ResizeSouthEast"===h?t.includes("South"):("ResizeNorth"===h||"ResizeNorthWest"===h||"ResizeNorthEast"===h)&&t.includes("North")}(s)&&(l=h.includes("North")?-a:a),{x:r+d,y:n+l}},r.prototype.getTextAnnotationQuadrant=function(t,e){var i=t.wrapper.bounds.left,r=t.wrapper.bounds.right,n=t.wrapper.bounds.top,o=t.wrapper.bounds.bottom,a=e.wrapper.bounds.center.x,s=e.wrapper.bounds.center.y;if(a>=i&&a<=r){if(s<n)return"North";if(s>o)return"South"}if(s>=n&&s<=o){if(a<i)return"West";if(a>r)return"East"}return a<i&&s<n?"NorthWest":a>r&&s<n?"NorthEast":a<i&&s>o?"SouthWest":a>r&&s>o?"SouthEast":""},r.prototype.updateBpmnAnnotationPosition=function(t,e,i,r,n,o,a,s,h,d,l){var c,p,g=i>t?Math.abs(i-t):Math.abs(t-i),u=r>e?Math.abs(r-e):Math.abs(e-r);(0===g&&0===u||Number.isNaN(g)&&Number.isNaN(u))&&n.laneMargin&&(c=n.margin.left-n.laneMargin.left,p=n.margin.top-n.laneMargin.top);var f=n.width,m=n.height,y=new w(0,0,0,0);if(0!==f&&0!==m&&(y=new w((0!==i?i:n.offsetX)-f/2,(0!==r?r:n.offsetY)-m/2,f,m)),s){var v=a,b=""!==v.textAnnotation.textAnnotationTarget&&this.nameTable[v.textAnnotation.textAnnotationTarget],S=this.selectedItems.nodes?this.selectedItems.nodes[0]:void 0,x=S&&S.shape&&"TextAnnotation"===S.shape.shape;if(b)if(""===n.parentId||x){if("Auto"===v.textAnnotation.textAnnotationDirection&&o.children[0]instanceof te&&o.children[0].children[0]instanceof Qt){var I=o.children[0],P=document.getElementById(I.id+"_groupElement"),C=document.getElementById(I.children[0].id+"_groupElement");P.removeChild(C),I.children.splice(0,1),this.isProtectedOnChange=!0,this.bpmnModule.setAnnotationPath(y,I,n,v,v.textAnnotation.textAnnotationDirection,this),this.isProtectedOnChange=!1}}else this.isPositionUndo=!0,this.updateTextAnnotationInSwimlane(n,n),this.isPositionUndo=!1;else if(n.inEdges.length>0){var T=n.inEdges[0];(M=this.nameTable[""+T])&&M.isBpmnAnnotationConnector&&(M.sourcePoint={x:i>t?M.sourcePoint.x+g:M.sourcePoint.x-g,y:r>e?M.sourcePoint.y+u:M.sourcePoint.y-u})}var A={ports:[{offset:n.ports[0].offset}]};this.nodePropertyChange(n,{},A)}else for(var O=0,D=n.outEdges;O<D.length;O++){var M,L=D[O];if((M=this.nameTable[""+L])&&M.isBpmnAnnotationConnector){var E=this.nameTable[M.targetID],z=E.shape.textAnnotation.textAnnotationTarget,k=this.nameTable[""+z];if(d&&!l){var B=this.getTextAnnotationOffset(n,E,h,t,e);i=B.x,r=B.y,g=i>t?Math.abs(i-t):Math.abs(t-i),u=r>e?Math.abs(r-e):Math.abs(e-r)}if("TextAnnotation"===E.shape.shape&&!Dn(this,E)&&Dn(this,k)){var R=void 0;A=void 0;if(n.isResized){R={margin:{left:E.margin.left,top:E.margin.top}};var N=n.resizeDif[E.id];N&&(E.margin.left+=N.x,E.margin.top+=N.y,A={margin:{left:E.margin.left,top:E.margin.top}})}else void 0!==c&&void 0!==p?E.parentId?(R={margin:{left:E.margin.left,top:E.margin.top}},E.margin.left+=c,E.margin.top+=p,A={margin:{left:E.margin.left,top:E.margin.top}}):(R={offsetX:E.offsetX,offsetY:E.offsetY},E.offsetX+=c,E.offsetY+=p,A={offsetX:E.offsetX,offsetY:E.offsetY}):(R={offsetX:E.offsetX,offsetY:E.offsetY},E.offsetX=i>t?E.offsetX+g:E.offsetX-g,E.offsetY=r>e?E.offsetY+u:E.offsetY-u,A={offsetX:E.offsetX,offsetY:E.offsetY});this.nodePropertyChange(E,R,A)}}}},r.prototype.updatePorts=function(t,e){if(t&&t.ports.length>0)for(var r=0,n=Object.keys(t.ports);r<n.length;r++){var o=n[r],a=Number(o),s=t.ports[parseInt(a.toString(),10)],h=this.getWrapper(t.wrapper,s.id);(h=Ss(h,e,s)).relativeMode="Point",void 0===t.wrapper.measureChildren&&(t.wrapper.measureChildren=!1),h.measure(new i(h.width,h.height)),h.arrange(h.desiredSize)}},r.prototype.updateFlipOffset=function(t,e,i,r){if(t.hasChildren())for(var n=0,o=t.children;n<o.length;n++){var a=o[n];r!==tt.Horizontal&&r!==tt.Both||(a.flipOffset.x=a.flipOffset.x+e),r!==tt.Vertical&&r!==tt.Both||(a.flipOffset.y=a.flipOffset.y+i),(a instanceof te||a instanceof Ut)&&this.updateFlipOffset(a,e,i,r)}},r.prototype.updateUMLActivity=function(t,e,i,r){if(void 0!==t.width||void 0!==t.height){var n=i.wrapper.children[0].children[0];n.width=t.width,n.height=t.height;var o=i.wrapper.children[0].children[1];o.width=t.width/1.5,o.height=t.height/1.5}},r.prototype.updateConnectorProperties=function(t){if(this.preventConnectorsUpdate){-1===this.selectionConnectorsList.indexOf(t)&&t&&this.selectionConnectorsList.push(t)}else{var e={sourcePoint:t.sourcePoint,targetPoint:t.targetPoint,sourceID:t.sourceID,targetID:t.targetID,sourcePortID:t.sourcePortID,targetPortID:t.targetPortID};this.connectorPropertyChange(t,{},e,void 0,!0)}},r.prototype.updateConnectorEdges=function(t){var e=(this.selectedItems.connectors||[]).map(function(t){return t.id});if(t.inEdges.length>0)for(var i=0;i<t.inEdges.length;i++){var r=t.inEdges[parseInt(i.toString(),10)];"Drag"===this.eventHandler.currentAction&&-1!==e.indexOf(r)||this.updateConnectorProperties(this.nameTable[""+r])}if(t.outEdges.length>0)for(var n=0;n<t.outEdges.length;n++){var o=t.outEdges[parseInt(n.toString(),10)];"Drag"===this.eventHandler.currentAction&&-1!==e.indexOf(o)||this.updateConnectorProperties(this.nameTable[""+o])}t instanceof Co||!t.parentId||!this.nameTable[t.parentId]||this.updateConnectorEdges(this.nameTable[t.parentId])},r.prototype.connectorProprtyChangeExtend=function(t,e,i,r){return void 0!==i.type&&i.type!==e.type&&t.segments.length>0&&void 0===i.segments&&(t.segments=[]),void 0!==i.shape&&void 0!==t.shape&&t.shape&&"Bpmn"===t.shape.type&&this.bpmnModule&&this.bpmnModule.updateBPMNConnector(t,e,i,this),void 0!==t.constraints?(this.updateThumbConstraints(this.selectedItems.connectors,this.selectedItems,!0),!0):r},r.prototype.connectorPropertyChange=function(t,e,r,n,o){if(this.canEnableBlazorObject){var a=N(t);this.insertValue(a,!1)}var s;if(t&&void 0!==t.wrapper){s=t.wrapper.bounds;var h,d,l,c,p=!1,g=[];if(p=this.connectorProprtyChangeExtend(t,e,r,p),void 0!==r.visible&&this.updateElementVisibility(t.wrapper,t,t.visible),void 0!==r.sourcePoint||void 0!==r.targetPoint||void 0!==r.sourceID||void 0!==r.targetID||void 0!==r.targetPadding||void 0!==r.sourcePortID||void 0!==r.targetPortID||void 0!==r.sourcePadding||void 0!==r.type||void 0!==r.segments||void 0!==r.flip){if(void 0!==r.sourceID&&r.sourceID!==e.sourceID||r.sourcePortID){var u=this.nameTable[t.sourceID];if(d=this.findInOutConnectPorts(u,!1),(!u||Ji(u)||""!==t.sourcePortID&&$i(d))&&(t.sourceWrapper=u?this.getEndNodeWrapper(u,t,!0):void 0,t.sourcePortID&&void 0===r.sourcePortID&&(t.sourcePortWrapper=u?this.getWrapper(u.wrapper,t.sourcePortID):void 0),this.removePortEdges(this.nameTable[e.sourceID]||u,e.sourcePortID||t.sourcePortID,t.id,!1)),void 0!==r.sourceID&&void 0!==e.sourceID&&""!==e.sourceID){var f=this.nameTable[e.sourceID];void 0!==f&&f.outEdges&&-1!==f.outEdges.indexOf(t.id)&&qa(f.outEdges,t.id)}this.updateEdges(t)}if(void 0!==r.targetID&&r.targetID!==e.targetID){var m=this.nameTable[r.targetID];if(h=this.findInOutConnectPorts(m,!0),(!m||Qi(m)||""!==t.targetPortID&&Ki(h))&&(t.targetWrapper=m?this.getEndNodeWrapper(m,t,!1):void 0,t.targetPortID&&void 0===r.targetPortID&&(t.targetPortWrapper=m?this.getWrapper(m.wrapper,t.targetPortID):void 0),this.removePortEdges(this.nameTable[e.targetID]||m,e.targetPortID||t.targetPortID,t.id,!0)),void 0!==e&&void 0!==e.targetID&&""!==e.targetID){var y=this.nameTable[e.targetID];void 0!==y&&y.inEdges&&-1!==y.inEdges.indexOf(t.id)&&qa(y.inEdges,t.id)}this.updateEdges(t)}if(void 0!==r.sourcePortID&&r.sourcePortID!==e.sourcePortID)t.sourceID&&this.nameTable[t.sourceID]&&(l=this.nameTable[t.sourceID].wrapper),!(u=this.nameTable[t.sourceID])||Ji(u)||""!==t.sourcePortID&&$i(d)?t.sourcePortWrapper=l?this.getWrapper(l,r.sourcePortID):void 0:""!==t.sourcePortID||Ji(u)||(t.sourcePortWrapper=void 0);if(void 0!==r.targetPortID&&r.targetPortID!==e.targetPortID){m=this.nameTable[t.targetID];t.targetID&&this.nameTable[t.targetID]&&(c=this.nameTable[t.targetID].wrapper),!m||Qi(m)||""!==t.targetPortID&&Ki(h)?t.targetPortWrapper=c?this.getWrapper(c,r.targetPortID):void 0:""!==t.targetPortID||Qi(m)||(t.targetPortWrapper=void 0)}if(void 0!==r.flip){t.flip=r.flip;var v=(t.flip&tt.Horizontal^t.wrapper.flip&tt.Horizontal)===tt.Horizontal,b=(t.flip&tt.Vertical^t.wrapper.flip&tt.Vertical)===tt.Vertical;v&&(t.wrapper.flip^=tt.Horizontal),b&&(t.wrapper.flip^=tt.Vertical),bs(t,v,b,this)}"Orthogonal"===t.type&&this.lineRoutingModule&&this.diagramActions&&this.constraints&ct.LineRouting&&!(this.diagramActions&yt.ToolAction)&&"ComplexHierarchicalTree"!==this.layout.type&&(this.lineRoutingModule.renderVirtualRegion(this,!0),t.sourceID!==t.targetID&&t.segments.length>1&&this.lineRoutingModule.refreshConnectorSegments(this,t,!1)),g=this.getPoints(t)}void 0!==r.style&&Ha(r.style,t.wrapper.children[0]),(g.length>0||void 0!==r.sourceDecorator||void 0!==r.targetDecorator&&Es(Object.keys(r.targetDecorator))||void 0!==r.cornerRadius)&&(Qa(t,g.length>0?g:t.intermediatePoints,this.diagramActions),void 0!==r.type&&(p=!0),g.length>0&&(t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize),this.updateConnectorAnnotation(t),this.updateConnectorPort(t),this.updateConnectorfixedUserHandles(t),this.updateObject(t,e,r))),(r.sourcePoint||r.targetPoint||r.segments)&&this.diagramActions===yt.Render&&(p=!0),"Bpmn"===t.shape.type&&"Default"===t.shape.sequence&&"Sequence"===t.shape.flow&&this.commandHandler.updatePathElementOffset(t),n||this.updateBridging(),this.updateAnnotations(r,t),this.updateConnectorPorts(r,t),this.updatefixedUserHandle(r,t),t.wrapper.measure(new i(t.wrapper.width,t.wrapper.height)),t.wrapper.arrange(t.wrapper.desiredSize),!1!==s.equals(s,t.wrapper.bounds)||this.connectorFlipInProgress||(this.updateQuad(t),"Drag"!==this.eventHandler.currentAction&&this.updateGroupSize(t)),!0!==p||!this.checkSelectedItem(t)||this.diagramActions&yt.ToolAction&&!(this.diagramActions&yt.UndoRedo)||this.updateSelector(),this.preventConnectorsUpdate||(!ir(this)||ir(this)&&this.scroller.oldCollectionObjects.indexOf(t.id)>-1)&&(this.diagramActions&yt.PreventZIndexOnDragging?this.updateDiagramObject(t,!0):this.updateDiagramObject(t)),this.updateConnectorEdges(t),this.diagramActions&&"New"!==t.status&&(t.status="Update"),this.triggerPropertyChange(o,t,e,r)}},r.prototype.removePortEdges=function(t,e,i,r){if(t)for(var n=0;n<t.ports.length;n++){var o=t.ports[parseInt(n.toString(),10)];if(o.id===e)qa(r?o.inEdges:o.outEdges,i)}},r.prototype.updateConnectorPorts=function(t,e){if(void 0!==t.ports)for(var i=0,r=Object.keys(t.ports);i<r.length;i++){var n=r[i],o=Number(n),a=t.ports[""+n],s=e.ports[parseInt(o.toString(),10)];this.updatePort(a,s,e.wrapper,e)}},r.prototype.triggerPropertyChange=function(t,e,i,r){if(!t){var n={element:e,cause:this.diagramActions,diagramAction:this.getDiagramAction(this.diagramActions),oldValue:i,newValue:r};this.triggerEvent(xt.propertyChange,n)}},r.prototype.findInOutConnectPorts=function(t,e){var i={};return t&&(i=ns(t,e)),i},r.prototype.getPoints=function(t,e){var i=!(!this.lineDistributionModule||"DifferentPoint"!==this.layout.connectionPointOrigin);return t.getConnectorPoints(t.type,e,"ComplexHierarchicalTree"===this.layout.type||"HierarchicalTree"===this.layout.type?this.layout.orientation:void 0,i)},r.prototype.updateNodeProperty=function(t,e,i){if(void 0===e)this.updateElementVisibility(t,this.nameTable[t.id],e);else{t.style.opacity=i;for(var r=0;r<t.children.length;r++)t.children[parseInt(r.toString(),10)]instanceof Ut&&this.updateNodeProperty(t.children[parseInt(r.toString(),10)],void 0,i),t.children[parseInt(r.toString(),10)].style.opacity=i}},r.prototype.checkSelectedItem=function(t){var e=this.selectedItems,i=!1,r=[];return(r=r.concat(e.nodes,e.connectors)).length>0&&t.id===r[r.length-1].id&&(i=!0),i},r.prototype.updateDiagramContainerVisibility=function(t,e){if(t instanceof Ut)for(var i=0;i<t.children.length;i++)this.updateDiagramContainerVisibility(t.children[parseInt(i.toString(),10)],e);t.visible=e},r.prototype.updateElementVisibility=function(t,e,i){if(void 0!==i){if(t.visible=i,e instanceof Yh){if(e.children)for(var r=0,n=e.children;r<n.length;r++){var o=n[r];this.updateElementVisibility(this.nameTable[""+o].wrapper,this.nameTable[""+o],i)}else t.children[0].visible=i,this.updateDiagramContainerVisibility(t.children[0],i),"Bpmn"===e.shape.type&&this.bpmnModule&&this.bpmnModule.updateElementVisibility(e,i,this);if("Bpmn"===e.shape.type&&"TextAnnotation"===e.shape.shape&&this.diagramActions){var a=this.nameTable[e.inEdges[0]],s=a.visible;a.visible=i,this.connectorPropertyChange(a,{visible:s},{visible:i})}if(e.ports)for(var h=0,d=e.ports;h<d.length;h++){var l=d[h];if(l.visibility&et.Visible)(y=this.getWrapper(t,l.id)).visible=i}if(e.annotations)for(var c=0,p=e.annotations;c<p.length;c++){var g=p[c];(y=this.getWrapper(t,g.id)).visible=i?"Visible"===y.annotationVisibility:i}}else if("Bpmn"===e.shape.type)for(var u=0;u<4;u++)t.children[parseInt(u.toString(),10)].visible=i;else for(u=0;u<3;u++)t.children[parseInt(u.toString(),10)].visible=i;if(e.annotations)for(var f=0,m=e.annotations;f<m.length;f++){g=m[f];(y=this.getWrapper(t,g.id)).visible=i?"Visible"===y.annotationVisibility:i}if(e.expandIcon||e.collapseIcon){var y;if(y=this.getWrapper(t,"icon_content")){for(u=0;u<y.children.length;u++)y.children[parseInt(u.toString(),10)].visible=i;y.visible=i}e&&e.visible&&e.outEdges&&this.updateIconVisibility(e,0!==e.outEdges.length)}!1===i&&this.unSelect(this.nameTable[t.id]),(e instanceof Yh&&!this.preventNodesUpdate||e instanceof Co&&!this.preventConnectorsUpdate)&&this.diagramActions&&this.updateDiagramObject(this.nameTable[t.id],void 0,!0)}},r.prototype.updateAnnotations=function(t,e){if(void 0!==t.annotations)for(var i=0,r=Object.keys(t.annotations);i<r.length;i++){var n=r[i],o=Number(n),a=t.annotations[""+n],s=e.annotations[parseInt(o.toString(),10)];this.updateAnnotation(a,s,e.wrapper,e)}},r.prototype.updatefixedUserHandle=function(t,e){if(void 0!==t.fixedUserHandles)for(var i=void 0,r=void 0,n=void 0,o=0,a=Object.keys(t.fixedUserHandles);o<a.length;o++){var s=a[o];i=Number(s),r=t.fixedUserHandles[""+s],n=e.fixedUserHandles[parseInt(i.toString(),10)],this.updateConnectorfixedUserHandle(r,n,e.wrapper,e)}},r.prototype.updateConnectorfixedUserHandle=function(t,e,r,n,o){var a=!1,s=this.getWrapper(r,e.id);void 0!==s&&(void 0!==t.width&&(s.width=t.width,a=!0),void 0!==t.height&&(s.height=t.height,a=!0),e instanceof Wi&&void 0!==t.offset&&n.updateAnnotation(e,n.intermediatePoints,n.wrapper.bounds,s),e instanceof Wi&&t.displacement&&(void 0===t.displacement.x&&void 0===t.displacement.y||(a=!0)),void 0!==t.fill&&(s.style.fill=t.fill),void 0!==t.handleStrokeColor&&(s.style.strokeColor=t.handleStrokeColor),void 0!==t.handleStrokeWidth&&(s.style.strokeWidth=t.handleStrokeWidth),void 0!==t.visibility&&(s.visible=t.visibility),void 0!==t.cornerRadius&&(s.cornerRadius=t.cornerRadius),this.updatefixedUserHandleContent(t,a,s,n,e,r),!0===a&&(s.measure(new i(s.width,s.height)),s.arrange(s.desiredSize)))},r.prototype.updateAnnotation=function(t,e,r,n,o){var a=!1,s=this.getWrapper(r,e.id);if(void 0!==s){if(void 0!==t.width&&void 0!==t.height&&(s.width=t.width,s.height=t.height,a=!0),void 0!==t.rotateAngle&&(s.rotateAngle=t.rotateAngle),!o||s instanceof Bi||s.refreshTextElement(),e instanceof Pe&&void 0!==t.segmentAngle&&(s.rotateAngle=e.rotateAngle),void 0!==t.rotationReference&&(s.rotationReference=t.rotationReference),e instanceof Ie&&void 0!==t.offset){var h=t.offset;a=!0;var d=void 0!==h.x?h.x:e.offset.x,l=void 0!==h.y?h.y:e.offset.y;s.setOffsetWithRespectToBounds(d,l,"Fraction"),s.relativeMode="Point"}else e instanceof Pe&&(void 0!==t.offset||void 0!==t.segmentAngle||void 0!==t.alignment)&&n.updateAnnotation(e,n.intermediatePoints,n.wrapper.bounds,s);if(e instanceof Pe&&t.displacement&&(void 0===t.displacement.x&&void 0===t.displacement.y||(a=!0,n.updateAnnotation(e,n.intermediatePoints,n.wrapper.bounds,s))),void 0!==t.margin&&(a=!0,void 0!==t.margin.bottom&&(s.margin.bottom=t.margin.bottom),void 0!==t.margin.top&&(s.margin.top=t.margin.top),void 0!==t.margin.left&&(s.margin.left=t.margin.left),void 0!==t.margin.right&&(s.margin.right=t.margin.right)),(a||o)&&(s.width=e.width||n.width,e.template&&(s.width=s.width||s.actualSize.width,s.height=e.height||n.height||s.actualSize.height)),void 0!==t.horizontalAlignment&&(s.horizontalAlignment=t.horizontalAlignment,a=!0),void 0!==t.verticalAlignment&&(s.verticalAlignment=t.verticalAlignment,a=!0),void 0!==t.visibility){s.visible=!(!r.visible||!t.visibility),s.annotationVisibility=s.visible?"Visible":"Collapsed";var c=this.selectedItems;!s.visible&&c.annotation&&this.clearSelection()}if(void 0!==t.constraints){s.constraints&st.Select&&!(t.constraints&st.Select)&&Dn(this,n,!1,s),s.constraints=t.constraints}void 0!==t.style&&Ha(t.style,s),void 0!==t.hyperlink&&_a(t.hyperlink,s,e),this.updateAnnotationContent(t,a,s,n,e,r),!0===a&&(s.measure(new i(s.width,s.height)),s.arrange(s.desiredSize)),s instanceof Bi||s.refreshTextElement()}},r.prototype.updatefixedUserHandleContent=function(t,e,i,r,n,o){void 0!==t&&this.updateConnectorfixedUserHandleWrapper(i,r,n,o)},r.prototype.updateConnectorfixedUserHandleWrapper=function(t,e,i,r){for(var n=0,o=this.views;n<o.length;n++){var a=o[n];bd(t.id+"_groupElement",a),bd(t.id+"_html_element",a)}if(e instanceof Co){var s=e.wrapper.children[0],h=new w(s.offsetX-s.width/2,s.offsetY-s.height/2,s.width,s.height);t=e.getFixedUserHandle(e.fixedUserHandles[e.fixedUserHandles.length-1],e.intermediatePoints,h,void 0,void 0)}for(var d=0;d<r.children.length;d++)t.id===r.children[parseInt(d.toString(),10)].id&&r.children.splice(d,1,t)},r.prototype.updateAnnotationContent=function(t,i,r,n,o,a){void 0!==t.content&&(r&&("UmlActivity"!==n.shape.type||(0,e.isBlazor)()||"StructuredNode"!==n.shape.shape?r.content=t.content:r.content="<<"+t.content+">>"),r instanceof Bi&&this.updateAnnotationWrapper(r,n,o,a)),void 0!==t.template&&(r.content=t.template,this.updateAnnotationWrapper(r,n,o,a))},r.prototype.updateAnnotationWrapper=function(t,e,i,r){for(var n=0,o=this.views;n<o.length;n++){var a=o[n];bd(t.id+"_groupElement",a),bd(t.id+"_html_element",a)}if(e instanceof Yh)t=e.initAnnotationWrapper(i,this.element.id);else if(e instanceof Co){var s=e.wrapper.children[0],h=new w(s.offsetX-s.width/2,s.offsetY-s.height/2,s.width,s.height);t=e.getAnnotationElement(e.annotations[e.annotations.length-1],e.intermediatePoints,h,this.getDescription,this.element.id)}for(var d=0;d<r.children.length;d++)t.id===r.children[parseInt(d.toString(),10)].id&&r.children.splice(d,1,t)},r.prototype.updateNodefixedUserHandle=function(t,e,r,n){var o=!1,a=this.getWrapper(r,e.id);if(void 0!==a){if(void 0!==t.width&&(a.actualSize.width=t.width,o=!0),void 0!==t.height&&(a.height=t.height,o=!0),e instanceof Hi&&void 0!==t.offset){var s=t.offset;o=!0;var h=void 0!==s.x?s.x:e.offset.x,d=void 0!==s.y?s.y:e.offset.y;a.setOffsetWithRespectToBounds(h,d,"Fraction"),a.relativeMode="Point"}void 0!==t.margin&&(o=!0,void 0!==t.margin.bottom&&(a.margin.bottom=t.margin.bottom),void 0!==t.margin.top&&(a.margin.top=t.margin.top),void 0!==t.margin.left&&(a.margin.left=t.margin.left),void 0!==t.margin.right&&(a.margin.right=t.margin.right)),void 0!==t.visibility&&(a.visible=t.visibility),void 0!==t.fill&&(a.style.fill=t.fill),void 0!==t.handleStrokeColor&&(a.style.strokeColor=t.handleStrokeColor),void 0!==t.handleStrokeWidth&&(a.style.strokeWidth=t.handleStrokeWidth),void 0!==t.cornerRadius&&(a.cornerRadius=t.cornerRadius),this.updatefixedUserHandleWrapper(a,n,e,r),!0===o&&(a.measure(new i(a.width,a.height)),a.arrange(a.desiredSize))}},r.prototype.updatefixedUserHandleWrapper=function(t,e,i,r){for(var n=0,o=this.views;n<o.length;n++){var a=o[n];bd(t.id+"_groupElement",a),bd(t.id+"_html_element",a)}e instanceof Yh&&(t=e.initFixedUserHandles(i,void 0,void 0));for(var s=0;s<r.children.length;s++)t.id===r.children[parseInt(s.toString(),10)].id&&r.children.splice(s,1,t)},r.prototype.updatePort=function(t,e,r,n){var o=!1,a=this.getWrapper(r,e.id);if(void 0!==a){if(void 0!==t.offset)if(o=!0,n)void 0!==t.offset&&n.updateAnnotation(e,n.intermediatePoints,n.wrapper.bounds,a);else{var s=void 0!==t.offset.x?t.offset.x:e.offset.x,h=void 0!==t.offset.y?t.offset.y:e.offset.y;a.setOffsetWithRespectToBounds(s,h,"Fraction"),a.relativeMode="Point"}if(void 0!==t.width&&(o=!0,a.width=t.width),void 0!==t.height&&(o=!0,a.height=t.height),void 0!==t.connectionDirection&&(a.connectionDirection=t.connectionDirection),void 0!==t.visibility&&(a.visible=!(!r.visible||!es(e,et.Visible))),void 0!==t.margin&&(o=!0,void 0!==t.margin.bottom&&(a.margin.bottom=t.margin.bottom),void 0!==t.margin.top&&(a.margin.top=t.margin.top),void 0!==t.margin.right&&(a.margin.right=t.margin.right),void 0!==t.margin.left&&(a.margin.left=t.margin.left)),void 0!==t.horizontalAlignment&&(o=!0,a.horizontalAlignment=t.horizontalAlignment),void 0!==t.verticalAlignment&&(o=!0,a.verticalAlignment=t.verticalAlignment),void 0!==t.style&&(void 0!==t.style.fill&&(a.style.fill=t.style.fill),void 0!==t.style.opacity&&(a.style.opacity=t.style.opacity),void 0!==t.style.strokeColor&&(a.style.strokeColor=t.style.strokeColor),void 0!==t.style.strokeWidth&&(a.style.strokeWidth=t.style.strokeWidth),void 0!==t.style.strokeDashArray&&(a.style.strokeDashArray=t.style.strokeDashArray)),void 0!==t.shape&&a){var d=Ce(t.shape);a.data=d,a.canMeasurePath=!0}void 0!==t.pathData&&(a.data=String(t.pathData),o=!0),!0===o&&(a.measure(new i(a.width,a.height)),a.arrange(a.desiredSize))}},r.prototype.updateIcon=function(t){var e=this.getWrapper(t.wrapper,"icon_content"),i=this.diagramActions&yt.Render?this.element.id:void 0;if(e){if("SVG"===this.mode){var r=id(t.wrapper.id+"_icon_content",i);if(r){var n=id(r.id+"_rect",i),o=id(r.id+"_shape",i),a=id(o.id+"_native_element",i);a&&a.parentNode.removeChild(a),o.parentNode.removeChild(o),n.parentNode.removeChild(n),r.parentNode.removeChild(r)}}var s=t.wrapper.children.indexOf(e);t.wrapper.children.splice(s,1)}var h=this.getPortContainer(t);t.initIcons(this.getDescription,this.layout,h,this.element.id)},r.prototype.getPortContainer=function(t){if(t.children)for(var e=0;e<t.wrapper.children.length;e++)if(t.wrapper.children[parseInt(e.toString(),10)].id===t.id+"group_container")return t.wrapper.children[parseInt(e.toString(),10)];return t.wrapper},r.prototype.updateTooltip=function(t,e){void 0!==e.tooltip.content&&(t.tooltip.content=e.tooltip.content),void 0!==e.tooltip.position&&(t.tooltip.position=e.tooltip.position),void 0!==e.tooltip.height&&(t.tooltip.height=e.tooltip.height),void 0!==e.tooltip.width&&(t.tooltip.width=e.tooltip.width),void 0!==e.tooltip.showTipPointer&&(t.tooltip.showTipPointer=e.tooltip.showTipPointer),void 0!==e.tooltip.relativeMode&&(t.tooltip.relativeMode=e.tooltip.relativeMode)},r.prototype.updateQuad=function(t){this.spatialSearch.updateQuad(t.wrapper)&&!this.preventDiagramUpdate&&this.updatePage()},r.prototype.removeFromAQuad=function(t){if(t.children)for(var e=void 0,i=t.children,r=0;r<i.length;r++)(e=this.nameTable[i[parseInt(r.toString(),10)]])&&this.removeFromAQuad(e);this.spatialSearch.removeFromAQuad(t.wrapper);var n="SwimLane"===t.shape.type;this.spatialSearch.updateBounds(t.wrapper,n)&&!this.preventDiagramUpdate&&this.updatePage()},r.prototype.updateGroupSize=function(t){var e;t.parentId&&(e=this.nameTable[t.parentId])&&(e.parentId?this.updateGroupSize(e):(e.wrapper.measure(new i),e.wrapper.arrange(e.wrapper.desiredSize),this.updateGroupOffset(e),this.updateDiagramObject(e)))},r.prototype.updatePage=function(){if(this.diagramActions&yt.Render&&!(this.diagramActions&yt.DragUsingMouse)){this.scroller.updateScrollOffsets(),this.scroller.setSize();for(var t=0,e=this.views;t<e.length;t++){var i=e[t],n=this.views[""+i];n instanceof r||n.updateView(n)}}this.diagramActions&yt.DragUsingMouse&&(this.renderPageBreaks(),this.pageSettings.width&&this.pageSettings.height&&!this.pageSettings.multiplePage||(this.scroller.updateScrollOffsets(),this.scroller.setSize()))},r.prototype.protectPropertyChange=function(t){this.isProtectedOnChange=t},r.prototype.getProtectPropertyChangeValue=function(){return this.isProtectedOnChange},r.prototype.enableServerDataBinding=function(t){},r.prototype.updateShadow=function(t,e){void 0!==e.angle&&(t.angle=e.angle),void 0!==e.color&&(t.color=e.color),void 0!==e.distance&&(t.distance=e.distance),void 0!==e.opacity&&(t.opacity=e.opacity)},r.prototype.updateMargin=function(t,e){void 0!==e.margin.top&&(t.margin.top=e.margin.top),void 0!==e.margin.bottom&&(t.margin.bottom=e.margin.bottom),void 0!==e.margin.left&&(t.margin.left=e.margin.left),void 0!==e.margin.right&&(t.margin.right=e.margin.right)},r.prototype.removePreviewChildren=function(t){if(t.children&&t.children.length&&t.shape&&"SwimLane"===t.shape.type){for(var e=0;e<t.children.length;e++){var i=t.children[parseInt(e.toString(),10)],r=this.nodes.indexOf(this.nameTable[""+i]);r>=0&&this.nodes.splice(r,1),delete this.nameTable[""+i]}(o=this.nodes.indexOf(this.nameTable[this.currentSymbol.id]))>=0&&this.nodes.splice(o,1)}else if("Container"===t.shape.type){if(t.shape.hasHeader){var n=this.nodes.indexOf(this.nameTable[t.id+t.shape.header.id]);n>=0&&this.nodes.splice(n,1)}var o;(o=this.nodes.indexOf(this.nameTable[this.currentSymbol.id]))>=0&&this.nodes.splice(o,1)}},r.prototype.selectDragedNode=function(t,e,i){this.currentSymbol=t,"SVG"!==this.mode&&this.refreshDiagramLayer(),this.commandHandler.oldSelectedObjects=Is(this),this.commandHandler.select(t),this.eventHandler.mouseDown(e.event),this.eventHandler.mouseMove(e.event,e),this.preventDiagramUpdate=!1,this.updatePage(),i.style.opacity="0"},r.prototype.initDroppables=function(){var t,i,r=this,n={},o={},a="selectedSymbols";this.droppable=new e.Droppable(this.element);var s=5;this.droppable.over=function(e){if(r.rulerSettings.showRulers){var h=document.getElementById(r.element.id+"_vRuler"),d=parseFloat(h.style.width);s=d+1}if(0!==r.previousSelectedObjects.length||r.currentSymbol||(r.previousSelectedObjects=r.commandHandler.getSelectedObject()),r.commandHandler.PreventConnectorSplit=!0,r.currentSymbol)e.event.touches&&e.event.touches.length&&r.eventHandler.mouseMove(e.event,e.event.touches);else{var l=null;if(!e.dragData&&"drag"===e.name){var c=document.getElementsByClassName("e-dragclone")[0];c&&(l=c)}if(e.dragData||l){var p=void 0,g=void 0;document.getElementById(r.element.id+"content").focus();var u=r.eventHandler.getMousePosition(e.event),f=void 0,m=l||e.dragData.helper,y=m.getAttribute("paletteId"),v=void 0,b=void 0,S=void 0,x=void 0;if(!y&&e.dragData){var I={source:null,element:p,cancel:!1,diagram:r,dragData:e.dragData.draggedElement.ej2_instances[0].dragData,dragItem:p};r.triggerEvent(xt.dragEnter,I);var P=void 0,C=void 0;if(I.dragItem){if(I.dragItem.sourcePoint&&I.dragItem.targetPoint?C=new Co(r,"connectors",I.dragItem,!0):P=new Yh(r,"nodes",I.dragItem,!0),p=P||C,r.initObject(p,void 0,void 0,!0),r.enterObject=p,r.enterTable=o,p instanceof Yh)P.offsetX=u.x+5+P.width*P.pivot.x,P.offsetY=u.y+P.height*P.pivot.y;else if(p instanceof Co){var T=w.toBounds([p.sourcePoint,p.targetPoint]),A=u.x-T.left,O=u.y-T.top;p.sourcePoint.x+=A,p.sourcePoint.y+=O,p.targetPoint.x+=A,p.targetPoint.y+=O}r.preventDiagramUpdate=!0,r.currentSymbol=p,"SVG"!==r.mode&&r.refreshDiagramLayer(),r.selectDragedNode(p,e,m),delete r.enterObject,delete r.enterTable,r.droppable[""+a]=m,r.allowServerDataBinding=!0}}if(y){var D=document.getElementById(y).ej2_instances[0];r.droppable.sourceElement=D;if(D){var M=D[""+a],L=M.wrapper.children[0].children[0];if("Native"!==M.shape.type&&"HTML"!==M.shape.type||M.shape.content&&"function"==typeof M.shape.content&&(M.shape.content=L.template.innerHTML),r.allowServerDataBinding=!1,f=N(D[""+a]),n=D.childTable,x=zs(D,f,L),D[""+a]instanceof Yh){"TextAnnotation"===M.shape.shape?(f.offsetX=u.x+11+x.width*f.pivot.x,f.offsetY=u.y+11+x.height*f.pivot.y):(f.offsetX=u.x+5+x.width*f.pivot.x,f.offsetY=u.y+x.height*f.pivot.y),"Bpmn"===(P=new Yh(r,"nodes",f,!0)).shape.type&&P.shape.activity.subProcess.processes&&P.shape.activity.subProcess.processes.length&&(P.shape.activity.subProcess.processes=[]),v=P.dragSize,b=P.previewSize,S=D.symbolDragSize;var z=D.symbolPreview;if(P.width=v.width||S.width||b.width||z.width||P.width,P.height=v.height||S.height||b.height||z.height||P.height,"SwimLane"===P.shape.type){var k;if(r.diagramActions|=yt.PreventHistory,P.shape.isLane)P.children=[],t={id:"header"+E()},"Horizontal"===P.shape.orientation?(t.width=P.shape.lanes[0].header.width,t.height=P.shape.lanes[0].height):(t.width=P.shape.lanes[0].width,t.height=P.shape.lanes[0].header.height),t.style=P.shape.lanes[0].header.style,t.offsetX=u.x+s+t.width/2,t.offsetY=u.y+t.height/2,r.diagramActions|=yt.PreventCollectionChangeOnDragOver,t=r.add(t),i={id:"body"+E()},"Horizontal"===P.shape.orientation?(i.width=P.shape.lanes[0].width-t.width,i.height=P.shape.lanes[0].height,i.offsetX=u.x+s+(P.shape.lanes[0].header.width+i.width/2),i.offsetY=u.y+i.height/2):(i.width=P.shape.lanes[0].width,i.height=P.shape.lanes[0].height-t.height,i.offsetX=u.x+s+i.width/2,i.offsetY=u.y+(P.shape.lanes[0].header.height+i.height/2)),i.style=P.shape.lanes[0].style,i=r.add(i),(k={id:"group"+E(),children:[t.id,i.id]}).shape=P.shape,k.width=P.shape.lanes[0].width,k.height=P.shape.lanes[0].height,k.previewSize=P.previewSize,k.dragSize=P.dragSize,k.addInfo=P.addInfo,P=r.add(k),r.diagramActions&=~yt.PreventCollectionChangeOnDragOver;r.diagramActions&=~yt.PreventHistory}if("Container"===P.shape.type)r.diagramActions|=yt.PreventHistory,r.diagramActions|=yt.PreventCollectionChangeOnDragOver,P.shape.hasHeader&&((t={id:"header"+E()}).width=P.width,t.height=P.shape.header.height,t.style=P.shape.header.style),(k={id:"group"+E()}).shape=P.shape,k.shape.header=t,k.width=P.width,k.height=P.height,k.previewSize=P.previewSize,k.dragSize=P.dragSize,k.addInfo=P.addInfo,k.offsetX=P.offsetX,k.offsetY=P.offsetY,k.ports=P.ports,k.style=P.style,P=r.add(k),r.diagramActions&=~yt.PreventCollectionChangeOnDragOver,r.diagramActions&=~yt.PreventHistory;if(P.shape.isPhase&&((g="Horizontal"===P.shape.orientation)?(P.offsetX=u.x+s+(P.width||L.actualSize.width)/2,P.offsetY=u.y,P.shape.data="M20,"+P.height/2+" L"+(P.width-20)+","+P.height/2+"z",P.height=1):(P.offsetX=u.x+5,P.offsetY=u.y+(P.height||L.actualSize.height)/2,P.shape.data="M"+P.width/2+",20 L"+P.width/2+","+(P.height-20)+"z",P.width=1)),"UmlClassifier"===P.shape.type&&(P.children=P.width=P.height=void 0,f.children=void 0,"Class"===P.shape.classifier&&P.shape.classShape.methods.length<=0&&P.shape.classShape.attributes.length<=0&&(P.shape.classShape.attributes=[{name:"Name",type:"Type",style:{}}]),"Enumeration"===P.shape.classifier&&P.shape.enumerationShape.members.length<=0&&(P.shape.enumerationShape.members=[{name:"Name"}]),"Interface"===P.shape.classifier&&P.shape.interfaceShape.methods.length<=0&&P.shape.interfaceShape.attributes.length<=0&&(P.shape.interfaceShape.attributes=[{name:"Name",type:"Type",style:{}}])),p=P,f.children){var B=f;o=r.getChildren(B,{},n),ds(B,-B.offsetX,-B.offsetY,o,!0,r)}}else if(D[""+a]instanceof Co){p=new Co(r,"connectors",f,!0);var R=w.toBounds([p.sourcePoint,p.targetPoint]),j=u.x-R.left,H=u.y-R.top;p.sourcePoint.x+=j,p.sourcePoint.y+=H,p.targetPoint.x+=j,p.targetPoint.y+=H}p.shape.isLane||"Container"===p.shape.type||(p.id+=E());I={source:D,element:p,cancel:!1,diagram:r,dragData:null,dragItem:p};if(r.enterObject=p,r.enterTable=o,r.triggerEvent(xt.dragEnter,I),p instanceof Yh&&"SwimLane"===p.shape.type&&p.shape.isLane){var W=I.element,_=W.shape.lanes[0];g="Horizontal"===W.shape.orientation;var Y=r.nameTable[p.children[0]],F=r.nameTable[p.children[1]];v=p.dragSize,b=p.previewSize,S=D.symbolDragSize,_.width=v.width||S.width||b.width||_.width,_.height=v.height||S.height||b.height||_.height,g?(t.width=_.header.width,t.height=_.height,i.width=_.width-t.width,i.height=_.height,i.offsetX=u.x+s+(_.header.width+F.width/2),i.offsetY=u.y+F.height/2):(t.width=_.width,t.height=_.header.height,i.width=_.width,i.height=_.height-t.height,i.offsetX=u.x+s+F.width/2,i.offsetY=u.y+(_.header.height+F.height/2)),t.offsetX=u.x+s+Y.width/2,t.offsetY=u.y+Y.height/2,p.width=_.width,p.height=_.height}p instanceof Yh&&p.shape.isPhase&&(g?p.height=1:p.width=1);var X=!1;if(r.element.ej2_instances[0].constraints&ct.RestrictNegativeAxisDragDrop){if(p instanceof Yh){var V=p.offsetX-p.width*p.pivot.x,U=p.offsetY-p.height*p.pivot.y;X=V<0||U<0}else if(p instanceof Co){V=Math.min(p.sourcePoint.x,p.targetPoint.x),U=Math.min(p.sourcePoint.y,p.targetPoint.y);X=V<0||U<0}X&&r.element.ej2_instances[0].setCursor("not-allowed")}if(!r.activeLayer.lock&&!I.cancel&&!X){if(r.preventDiagramUpdate=!0,p.children&&r.findChild(p,o),r.preventDiagramUpdate=!0,p.zIndex!==Number.MIN_VALUE&&(p.zIndex=Number.MIN_VALUE),"Container"!==p.shape.type&&r.initObject(p,void 0,void 0,!0),r.bpmnModule)for(var G=0;G<r.bpmnModule.bpmnTextAnnotationConnector.length;G++)null===r.bpmnModule.bpmnTextAnnotationConnector[parseInt(G.toString(),10)].wrapper&&r.initConnectors(r.bpmnModule.bpmnTextAnnotationConnector[parseInt(G.toString(),10)],void 0,!0);r.selectDragedNode(p,e,m)}delete r.enterObject,delete r.enterTable}r.droppable[""+a]=m,r.allowServerDataBinding=!0}}}},this.droppable.drop=function(t){return oc(r,void 0,void 0,function(){var i,r,n,o,a,s,h,d,l,c,p,g,u;return ac(this,function(f){if(this.allowServerDataBinding=!1,i="sourceElement",this.currentSymbol?(n=!1,a=this.currentSymbol instanceof Co,t.event.touches&&this.eventHandler.mouseUp(t.event),d={source:this.droppable[""+i],element:this.currentSymbol,target:this.eventHandler.hoverNode||this.findObjectsUnderMouse(this.eventHandler.getMousePosition(t.event))[0]||this,cancel:!1,position:{x:this.currentSymbol.wrapper.offsetX,y:this.currentSymbol.wrapper.offsetY}},this.commandHandler.PreventConnectorSplit=!1,this.triggerEvent(xt.drop,d),c="id",(l=N(this.currentSymbol)).hasTarget=this.currentSymbol.hasTarget,this.removeFromAQuad(this.currentSymbol),this.removeObjectsFromLayer(this.nameTable[this.currentSymbol.id]),this.removeElements(this.currentSymbol),(this.currentSymbol.shape.isLane||this.currentSymbol.shape.isPhase||"UmlClassifier"===this.currentSymbol.shape.type||"Container"===this.currentSymbol.shape.type)&&this.removeChildInNodes(this.currentSymbol),d.cancel&&Oa(this.currentSymbol,this),this.currentSymbol.shape.isPhase&&(n=!0,o=this.currentSymbol.shape.orientation,l.shape.phases=this.currentSymbol.shape.phases),this.removePreviewChildren(this.currentSymbol),delete this.nameTable[this.currentSymbol.id],this.currentSymbol=null,this.protectPropertyChange(!0),this.itemType="SymbolPalette",d.cancel?this.clearSelectorLayer():(this.startGroupAction(),l&&(l.shape.isLane||n)&&(n&&(l.shape.isPhase=n,l.shape.orientation=o),this.eventHandler.addSwimLaneObject(l)),l&&"UmlClassifier"===l.shape.type&&!l.shape.relationship&&(l.children=void 0,this.clearSelectorLayer(),this.add(l)),"Bpmn"===l.shape.type&&l.shape.annotation&&l.hasTarget&&(s=l.shape.annotation.nodeId,l.shape.annotation.id=l.id,this.addTextAnnotation(l.shape.annotation,this.nameTable[""+s]),l.nodeId=""),l.shape.isLane||n||void 0===l.type&&"UmlClassifier"===l.shape.type||(l.children&&this.addChildNodes(l),d.target&&d.target instanceof Yh&&!a&&un(this,d.target)&&er(d.target)&&!this.commandHandler.isTargetSubProcess(d.target)?vn(this,d.target,l):("Bezier"===l.type&&l.segments.length>0&&(l.segments=[]),r=this.add(l,!0)),(l||r)&&(rr(this)||nr(this))&&this.select([this.nameTable[l[""+c]]],!1,this.previousSelectedObjects),this.lineRoutingModule&&this.constraints&ct.LineRouting&&this.commandHandler.updateSelectedNodeProperties(this.selectedItems),d.target&&d.target instanceof Co&&!0===this.enableConnectorSplit&&this.nameTable[l[""+c]]instanceof Yh&&(this.commandHandler.connectorSplit(this.nameTable[l[""+c]],d.target),this.commandHandler.PreventConnectorSplit=!1))),this.protectPropertyChange(!1),h=this.nameTable[l[""+c]],l.hasTarget&&(l.nodeId=l.hasTarget,this.remove(l)),this.bpmnModule&&h instanceof Yh&&l.processId&&(h.processId=l.processId,this.bpmnModule.dropBPMNchild(this.nameTable[h.processId],h,this)),h instanceof Yh&&l.parentId&&this.nameTable[l.parentId]&&"Container"===this.nameTable[l.parentId].shape.type&&(h.parentId=l.parentId,rh(this.nameTable[h.parentId],h,this)),d.cancel||this.endGroupAction(),"SVG"!==this.mode&&this.refreshDiagramLayer(),delete this.droppable[""+i]):(d={source:t.droppedElement,element:void 0,target:this.eventHandler.hoverNode||this.eventHandler.lastObjectUnderMouse||this,cancel:!1,position:void 0},this.triggerEvent(xt.drop,d),l=void 0,c="id"),p="selectedSymbols",this.droppable[""+p]&&this.droppable[""+p].parentNode)(0,e.remove)(this.droppable[""+p]);else for(g=document.getElementsByClassName("e-dragclone"),u=0;u<g.length;u++)g[parseInt(u.toString(),10)].remove();return this.allowServerDataBinding=!0,this.previousSelectedObjects=[],[2]})})},this.droppable.out=function(t){if("touchmove"===t.evt.type&&r.eventHandler.mouseLeave(t.evt),r.currentSymbol&&!r.eventHandler.focus){if(r.unSelect(r.currentSymbol),r.removeFromAQuad(r.currentSymbol),"SVG"!==r.mode&&"Native"===r.currentSymbol.shape.type&&r.removeElements(r.currentSymbol),r.removeObjectsFromLayer(r.nameTable[r.currentSymbol.id]),r.currentSymbol.shape&&"TextAnnotation"===r.currentSymbol.shape.shape){var e=r.nameTable[r.currentSymbol.inEdges[0]];r.removeObjectsFromLayer(r.nameTable[e.id]),r.removeFromAQuad(e),r.removePreviewChildren(e),delete r.nameTable[e.id];var i=r.connectors.indexOf(e);r.connectors.splice(i,1),r.removeElements(e)}r.removePreviewChildren(r.currentSymbol),delete r.nameTable[r.currentSymbol.id];var n={element:r.currentSymbol,diagram:r};if(r.triggerEvent(xt.dragLeave,n),"SVG"!==r.mode)r.refreshDiagramLayer();else{if(r.removeElements(r.currentSymbol),"SwimLane"!==r.currentSymbol.shape.type&&r.currentSymbol.children&&r.currentSymbol.children.length>0)for(var o=0;o<r.currentSymbol.children.length;o++){var a=r.nameTable[r.currentSymbol.children[parseInt(o.toString(),10)]];r.removeElements(a),delete r.nameTable[r.currentSymbol.children[parseInt(o.toString(),10)]]}if("Container"===r.currentSymbol.shape.type&&r.currentSymbol.shape.hasHeader){a=r.nameTable[r.currentSymbol.id+r.currentSymbol.shape.header.id];r.removeFromAQuad(a),delete r.nameTable[a.id],r.removeElements(a)}}r.currentSymbol=null;r.droppable.selectedSymbols.style.opacity="1";delete r.droppable.sourceElement,r.diagramRenderer.rendererActions=r.removeConstraints(r.diagramRenderer.rendererActions,vt.DrawSelectorBorder),r.previousSelectedObject&&r.select(r.previousSelectedObject,r.previousSelectedObject.length>1),r.previousSelectedObject=null}}},r.prototype.getDropEventArgs=function(t){if(this.eventHandler.lastObjectUnderMouse||this.eventHandler.hoverNode){var e=this.eventHandler.lastObjectUnderMouse||this.eventHandler.hoverNode;t.target=vs(e)===Co?{connector:e}:{node:e}}else t.target.diagramId=this.element.id},r.prototype.removeChildInNodes=function(t){if(t&&"Container"!==t.shape.type){if(t.children)for(var e=0;e<t.children.length;e++)this.removeChildInNodes(this.nameTable[t.children[parseInt(e.toString(),10)]]);-1!==(i=this.nodes.indexOf(t))&&this.nodes.splice(i,1)}else if(t&&"Container"===t.shape.type){var i;t.shape.hasHeader&&this.removeChildInNodes(this.nameTable[t.id+t.shape.header.id]),-1!==(i=this.nodes.indexOf(t))&&this.nodes.splice(i,1)}},r.prototype.getBlazorDragEventArgs=function(t){return t={source:t.source,element:vs(t.element)===Co?{connector:t.element}:{node:t.element},cancel:t.cancel,diagramId:this.element.id}},r.prototype.findChild=function(t,e){for(var i,r,n=0;n<t.children.length;n++)(i=e[t.children[parseInt(n.toString(),10)]])&&(i.children&&this.findChild(i,e),i.id=i.id+E(),e[i.id]=i,t.children[parseInt(n.toString(),10)]=i.id,r=new Yh(this,"nodes",i,!0),this.initObject(r,void 0,void 0,!0))},r.prototype.getChildren=function(t,e,i){for(var r,n=0;n<t.children.length;n++)(r=i[t.children[parseInt(n.toString(),10)]])&&(r.children&&(e=this.getChildren(r,e,i)),e[r.id]=N(r));return e},r.prototype.addChildNodes=function(t){for(var e,i=0;i<t.children.length;i++)(e=this.nameTable[t.children[parseInt(i.toString(),10)]])&&(e.children&&this.addChildNodes(e),this.add(e,!0))},r.prototype.moveNode=function(t){for(var e,i=this.commandHandler.getObjectLayer(t.id),r=i.zIndex,n=i.objects.length,o=0;o<this.layers.length;o++)r===this.layers[parseInt(o.toString(),10)].zIndex&&(e=this.layers[o+1]);if(n>1){var a=2;if(t.children&&t.children.length>0)for(;t.children.indexOf(i.objects[n-a])>-1;)a++;if(n-a>-1){var s=this.nameTable[i.objects[n-a]];if(t.zIndex>s.zIndex){var h=s.parentId!==t.parentId&&s.parentId?this.getRootParentId(s):s.id;this.commandHandler.moveSvgNode(t.id,h),this.commandHandler.moveSvgNode(h,t.id)}}else this.moveNodeWithTargetLayer(t,i,e)}else this.moveNodeWithTargetLayer(t,i,e)},r.prototype.moveNodeWithTargetLayer=function(t,e,i){if(i){var r=this.commandHandler.getLayer(this.layerZIndexTable[i.zIndex]).objects[0];r?(this.commandHandler.moveSvgNode(t.id,r),this.commandHandler.updateNativeNodeIndex(t.id,r)):this.moveObjectsUp(t,e)}else this.moveObjectsUp(t,e)},r.prototype.getRootParentId=function(t){for(var e=t;e&&e.parentId;){var i=e.parentId,r=this.nameTable[""+i];if(!r)break;e=r}return e.id},r.prototype.moveObjectsUp=function(t,e){for(var i,r=this.layers.length-1;r>=0;r--)if(i=this.layers[parseInt(r.toString(),10)],e.id!==i.id){var n=this.commandHandler.getLayer(this.layerZIndexTable[i.zIndex]).objects[i.objects.length-1];if(n){this.commandHandler.moveSvgNode(t.id,n),this.commandHandler.moveSvgNode(n,t.id);break}}},r.prototype.insertData=function(t){return this.crudOperation(t,"create",this.getNewUpdateNodes("New"))},r.prototype.updateData=function(t){return this.crudOperation(t,"update",this.getNewUpdateNodes("Update"))},r.prototype.removeData=function(t){return this.crudOperation(t,"destroy",this.getDeletedNodes())},r.prototype.distributePorts=function(t){for(var e=this,i=[],r=function(r){var o=n.nameTable[t[parseInt(r.toString(),10)]];if(!(o&&o.ports&&o.width&&o.height))return"continue";for(var a=function(t){var e=o.ports[parseInt(t.toString(),10)],i=0;if(e.inEdges&&e.inEdges.length&&(i+=e.inEdges.length),e.outEdges&&e.outEdges.length&&(i+=e.outEdges.length),i>1)return"continue";var r=e.offset.x*o.width,a=e.offset.y*o.height,s=r,h=o.width-r,d=a,l=o.height-a,c=[{edge:"Left",value:s},{edge:"Right",value:h},{edge:"Top",value:d},{edge:"Bottom",value:l}],p=Math.min(s,h,d,l),g=c.filter(function(t){return t.value===p}),u=g[0].edge;if(g.length>1){var f=null;if(e.outEdges&&e.outEdges.length>0?f=n.nameTable[e.outEdges[0]]:e.inEdges&&e.inEdges.length>0&&(f=n.nameTable[e.inEdges[0]]),f){var m=f.targetPoint;if(m){var y=o.offsetX-o.width*o.pivot.x,v=o.offsetY-o.height*o.pivot.y,b={x:y+e.offset.x*o.width,y:v+e.offset.y*o.height},S=m.x-b.x,w=m.y-b.y;Math.abs(S)>Math.abs(w)?S<0&&g.some(function(t){return"Left"===t.edge})?u="Left":S>0&&g.some(function(t){return"Right"===t.edge})&&(u="Right"):w<0&&g.some(function(t){return"Top"===t.edge})?u="Top":w>0&&g.some(function(t){return"Bottom"===t.edge})&&(u="Bottom")}}}switch(u){case"Left":e.offset.x=0;break;case"Right":e.offset.x=1;break;case"Top":e.offset.y=0;break;case"Bottom":e.offset.y=1}},s=0;s<o.ports.length;s++)a(s);for(var h={Left:[],Right:[],Top:[],Bottom:[]},d=0;d<o.ports.length;d++){var l=o.ports[parseInt(d.toString(),10)];0===l.offset.x?h.Left.push(l):1===l.offset.x?h.Right.push(l):0===l.offset.y?h.Top.push(l):1===l.offset.y&&h.Bottom.push(l)}["Left","Right","Top","Bottom"].forEach(function(t){var r=h[""+t];if(0!==r.length){r.sort(e.callSort(o,t,e,i)),-1===i.indexOf(o.id)&&i.push(o.id);for(var n=r.length,a=0;a<n;a++){var s=r[parseInt(a.toString(),10)],d=0;if(s.inEdges&&s.inEdges.length&&(d+=s.inEdges.length),s.outEdges&&s.outEdges.length&&(d+=s.outEdges.length),!(d>1)){var l=(a+1)/(n+1);"Left"===t||"Right"===t?s.offset.y=l:s.offset.x=l}}}})},n=this,o=0;o<t.length;o++)r(o)},r.prototype.getProjectedOffset=function(t,e,i){var r=e.offsetX-e.width*e.pivot.x,n=e.offsetY-e.height*e.pivot.y;return{x:r+t.offset.x*e.width,y:n+t.offset.y*e.height}},r.prototype.callSort=function(t,e,i,r){return function(n,o){var a,s,h,d,l,c,p,g,u=n.outEdges&&n.outEdges.length||n.inEdges&&n.inEdges.length,f=o.outEdges&&o.outEdges.length||o.inEdges&&o.inEdges.length,m=u?i.getConnectorTargetOffset(n,t,e,i):i.getProjectedOffset(n,t,e),y=f?i.getConnectorTargetOffset(o,t,e,i):i.getProjectedOffset(o,t,e),v=n.outEdges&&n.outEdges.length?i.nameTable[n.outEdges[0]]:n.inEdges&&n.inEdges.length?i.nameTable[n.inEdges[0]]:null,b=o.outEdges&&o.outEdges.length?i.nameTable[o.outEdges[0]]:o.inEdges&&o.inEdges.length?i.nameTable[o.inEdges[0]]:null,S=!1;if(v&&(a=i.nameTable[v.sourceID],h=i.getConnectedPort(a,v,!0),l=i.nameTable[v.targetID],p=i.getConnectedPort(l,v),v.targetID===t.id&&(S=!0),l&&-1!==r.indexOf(l.id)&&(v=null)),b&&(s=i.nameTable[b.sourceID],d=i.getConnectedPort(s,b,!0),c=i.nameTable[b.targetID],g=i.getConnectedPort(c,b),b.targetID===t.id&&(S=!0),c&&-1!==r.indexOf(c.id)&&(b=null)),v&&b){var w=void 0,x=void 0;return(p&&0===p.offset.x||!p&&h&&0===h.offset.x)&&(w="Left"),(p&&1===p.offset.x||!p&&h&&1===h.offset.x)&&(w="Right"),(p&&0===p.offset.y||!p&&h&&0===h.offset.y)&&(w="Top"),(p&&1===p.offset.y||!p&&h&&1===h.offset.y)&&(w="Bottom"),(g&&0===g.offset.x||!g&&d&&0===d.offset.x)&&(x="Left"),(g&&1===g.offset.x||!g&&d&&1===d.offset.x)&&(x="Right"),(g&&0===g.offset.y||!g&&d&&0===d.offset.y)&&(x="Top"),(g&&1===g.offset.y||!g&&d&&1===d.offset.y)&&(x="Bottom"),"Top"===e||"Bottom"===e?b.targetID!==t.id&&("Top"===e&&"Bottom"===w||"Top"===e&&"Right"===w||"Bottom"===e&&"Top"===w||"Bottom"===e&&"Left"===w)?m.x-y.x===0?y.y-m.y:m.x-y.x:"Top"===e&&"Top"===w||"Top"===e&&"Left"===w||"Bottom"===e&&"Bottom"===w||"Bottom"===e&&"Right"===w?l&&c&&l.id===c.id&&!S&&("Bottom"===e&&"Right"===w&&"Right"===x||"Bottom"===e&&"Bottom"===w&&"Bottom"===x||"Top"===e&&"Top"===w&&"Top"===x||"Top"===e&&"Left"===w&&"Left"===x)?m.x-y.x===0?m.y-y.y:y.x-m.x:m.x-y.x===0?y.y-m.y:m.x-y.x:m.x-y.x===0?m.y-y.y:y.x-m.x:"Left"===e&&"Right"===w||"Left"===e&&"Bottom"===w||"Right"===e&&"Left"===w||"Right"===e&&"Top"===w?m.y-y.y===0?y.x-m.x:m.y-y.y:"Left"===e&&"Left"===w||"Left"===e&&"Top"===w||"Right"===e&&"Right"===w||"Right"===e&&"Bottom"===w?l&&c&&l.id===c.id&&!S&&("Right"===e&&"Bottom"===w&&"Bottom"===x||"Right"===e&&"Right"===w&&"Right"===x||"Left"===e&&"Left"===w&&"Left"===x||"Left"===e&&"Top"===w&&"Top"===x)?m.y-y.y===0?m.x-y.x:y.y-m.y:m.y-y.y===0?y.x-m.x:m.y-y.y:m.y-y.y===0?m.x-y.x:y.y-m.y}return 0}},r.prototype.getConnectorTargetOffset=function(t,e,i,r){var n=null;return t.outEdges&&t.outEdges.length>0?n=r.nameTable[t.outEdges[0]]:t.inEdges&&t.inEdges.length>0&&(n=r.nameTable[t.inEdges[0]]),n?n.targetPoint:this.getProjectedOffset(t,e,i)},r.prototype.crudOperation=function(t,e,i){if(t){var r=this.parameterMap(t,!(t instanceof Co));if(r){var n=t instanceof Co?this.dataSourceSettings.connectionDataSource.crudAction[""+e]:this.dataSourceSettings.crudAction[""+e];this.raiseAjaxPost(JSON.stringify(r),n)}return r}var o=i;return this.processCrudCollection(o,this.dataSourceSettings.crudAction[""+e],this.dataSourceSettings.connectionDataSource.crudAction[""+e]),o},r.prototype.processCrudCollection=function(t,e,i){if(t.nodes){var r=[],n=void 0;for(n=0;n<t.nodes.length;n++)r.push(this.parameterMap(t.nodes[parseInt(n.toString(),10)],!0));r&&r.length>0&&this.raiseAjaxPost(JSON.stringify(r),e)}if(t.connectors){r=[],n=void 0;for(n=0;n<t.connectors.length;n++)r.push(this.parameterMap(t.connectors[parseInt(n.toString(),10)],!1));r&&r.length>0&&this.raiseAjaxPost(JSON.stringify(r),i)}},r.prototype.parameterMap=function(t,e){var i,r={},n=e?this.dataSourceSettings:this.dataSourceSettings.connectionDataSource;if(n.id&&(r[n.id]=t.id),n.sourcePointX&&n.sourcePointY&&(r[n.sourcePointX]=t.sourcePoint.x,r[n.sourcePointY]=t.sourcePoint.y),n.targetPointX&&n.targetPointY&&(r[n.targetPointX]=t.targetPoint.x,r[n.targetPointY]=t.targetPoint.y),n.sourceID&&(r[n.sourceID]=t.sourceID),n.targetID&&(r[n.targetID]=t.targetID),n.crudAction&&n.crudAction.customFields&&n.crudAction.customFields.length>0)for(i=0;i<n.crudAction.customFields.length;i++)r[n.crudAction.customFields[parseInt(i.toString(),10)]]=t[n.crudAction.customFields[parseInt(i.toString(),10)]];return r},r.prototype.getNewUpdateNodes=function(t){var e=[],i=[];for(var r in this.nameTable){var n=this.nameTable[""+r];n.status===t&&(n&&n instanceof Co?(n.status="None",i.push(n)):(n.status="None",e.push(n)))}return{nodes:e,connectors:i}},r.prototype.getDeletedNodes=function(){var t,e=[],i=[];for(t=0;t<this.crudDeleteNodes.length;t++){var r=this.crudDeleteNodes[parseInt(t.toString(),10)];r&&r.segments?i.push(r):r&&e.push(r)}return this.crudDeleteNodes=[],{nodes:e,connectors:i}},r.prototype.raiseAjaxPost=function(t,i){var r=new e.Fetch(i,"POST","application/json"),n=JSON.stringify(JSON.parse(t));r.send(n).then(),r.onSuccess=function(t){}},r.prototype.getHiddenItems=function(t){if(this.contextMenuModule){this.contextMenuModule.hiddenItems=[];for(var e=0,i=t.items;e<i.length;e++){var r=i[e];if(this.contextMenuModule.ensureItems(r,t.event),r.items&&r.items.length)for(var n=0,o=r.items;n<o.length;n++){var a=o[n];this.contextMenuModule.ensureItems(a,t.event)}}return this.contextMenuModule.hiddenItems}return[]},nc([(0,e.Property)("100%")],r.prototype,"width",void 0),nc([(0,e.Property)(!1)],r.prototype,"enableConnectorSplit",void 0),nc([(0,e.Property)("SVG")],r.prototype,"mode",void 0),nc([(0,e.Property)("100%")],r.prototype,"height",void 0),nc([(0,e.Property)("Circle")],r.prototype,"segmentThumbShape",void 0),nc([(0,e.Property)(10)],r.prototype,"segmentThumbSize",void 0),nc([(0,e.Complex)({},Vo)],r.prototype,"contextMenuSettings",void 0),nc([(0,e.Property)(ct.Default)],r.prototype,"constraints",void 0),nc([(0,e.Property)(pt.Default)],r.prototype,"tool",void 0),nc([(0,e.Property)("Top")],r.prototype,"bridgeDirection",void 0),nc([(0,e.Property)("transparent")],r.prototype,"backgroundColor",void 0),nc([(0,e.Complex)({},_d)],r.prototype,"snapSettings",void 0),nc([(0,e.Complex)({},Vd)],r.prototype,"rulerSettings",void 0),nc([(0,e.Complex)({},Bd)],r.prototype,"pageSettings",void 0),nc([(0,e.Complex)({},Sl)],r.prototype,"serializationSettings",void 0),nc([(0,e.Collection)([],Yh)],r.prototype,"nodes",void 0),nc([(0,e.Property)()],r.prototype,"drawingObject",void 0),nc([(0,e.Collection)([],Co)],r.prototype,"connectors",void 0),nc([(0,e.Property)([])],r.prototype,"basicElements",void 0),nc([(0,e.Complex)({},he)],r.prototype,"tooltip",void 0),nc([(0,e.Complex)({},$d)],r.prototype,"dataSourceSettings",void 0),nc([(0,e.Property)()],r.prototype,"addInfo",void 0),nc([(0,e.Property)()],r.prototype,"historyManager",void 0),nc([(0,e.Property)()],r.prototype,"nodeTemplate",void 0),nc([(0,e.Property)()],r.prototype,"annotationTemplate",void 0),nc([(0,e.Property)()],r.prototype,"userHandleTemplate",void 0),nc([(0,e.Property)()],r.prototype,"fixedUserHandleTemplate",void 0),nc([(0,e.Property)()],r.prototype,"getNodeDefaults",void 0),nc([(0,e.Property)()],r.prototype,"nodeDefaults",void 0),nc([(0,e.Property)()],r.prototype,"getConnectorDefaults",void 0),nc([(0,e.Property)()],r.prototype,"connectorDefaults",void 0),nc([(0,e.Property)()],r.prototype,"setNodeTemplate",void 0),nc([(0,e.Property)()],r.prototype,"getDescription",void 0),nc([(0,e.Property)()],r.prototype,"getCustomProperty",void 0),nc([(0,e.Property)()],r.prototype,"getCustomTool",void 0),nc([(0,e.Property)()],r.prototype,"getCustomCursor",void 0),nc([(0,e.Collection)([],Il)],r.prototype,"customCursor",void 0),nc([(0,e.Property)()],r.prototype,"updateSelection",void 0),nc([(0,e.Complex)({},Al)],r.prototype,"diagramSettings",void 0),nc([(0,e.Complex)({},qh)],r.prototype,"selectedItems",void 0),nc([(0,e.Complex)({},Rd)],r.prototype,"scrollSettings",void 0),nc([(0,e.Complex)({},rl)],r.prototype,"layout",void 0),nc([(0,e.Complex)(void 0,Bl)],r.prototype,"model",void 0),nc([(0,e.Complex)({},Xo)],r.prototype,"commandManager",void 0),nc([(0,e.Event)()],r.prototype,"dataLoaded",void 0),nc([(0,e.Event)()],r.prototype,"dragEnter",void 0),nc([(0,e.Event)()],r.prototype,"dragLeave",void 0),nc([(0,e.Event)()],r.prototype,"dragOver",void 0),nc([(0,e.Event)()],r.prototype,"click",void 0),nc([(0,e.Event)()],r.prototype,"historyChange",void 0),nc([(0,e.Event)()],r.prototype,"historyStateChange",void 0),nc([(0,e.Event)()],r.prototype,"doubleClick",void 0),nc([(0,e.Event)()],r.prototype,"textEdit",void 0),nc([(0,e.Event)()],r.prototype,"scrollChange",void 0),nc([(0,e.Event)()],r.prototype,"mouseWheel",void 0),nc([(0,e.Event)()],r.prototype,"selectionChange",void 0),nc([(0,e.Event)()],r.prototype,"sizeChange",void 0),nc([(0,e.Event)()],r.prototype,"connectionChange",void 0),nc([(0,e.Event)()],r.prototype,"sourcePointChange",void 0),nc([(0,e.Event)()],r.prototype,"targetPointChange",void 0),nc([(0,e.Event)()],r.prototype,"propertyChange",void 0),nc([(0,e.Event)()],r.prototype,"positionChange",void 0),nc([(0,e.Event)()],r.prototype,"keyUp",void 0),nc([(0,e.Event)()],r.prototype,"keyDown",void 0),nc([(0,e.Event)()],r.prototype,"animationComplete",void 0),nc([(0,e.Event)()],r.prototype,"rotateChange",void 0),nc([(0,e.Event)()],r.prototype,"collectionChange",void 0),nc([(0,e.Event)()],r.prototype,"fixedUserHandleClick",void 0),nc([(0,e.Event)()],r.prototype,"onUserHandleMouseDown",void 0),nc([(0,e.Event)()],r.prototype,"onUserHandleMouseUp",void 0),nc([(0,e.Event)()],r.prototype,"onUserHandleMouseEnter",void 0),nc([(0,e.Event)()],r.prototype,"onUserHandleMouseLeave",void 0),nc([(0,e.Event)()],r.prototype,"onFixedUserHandleMouseDown",void 0),nc([(0,e.Event)()],r.prototype,"onFixedUserHandleMouseUp",void 0),nc([(0,e.Event)()],r.prototype,"onFixedUserHandleMouseEnter",void 0),nc([(0,e.Event)()],r.prototype,"onFixedUserHandleMouseLeave",void 0),nc([(0,e.Event)()],r.prototype,"segmentCollectionChange",void 0),nc([(0,e.Event)()],r.prototype,"onImageLoad",void 0),nc([(0,e.Event)()],r.prototype,"expandStateChange",void 0),nc([(0,e.Event)()],r.prototype,"load",void 0),nc([(0,e.Event)()],r.prototype,"created",void 0),nc([(0,e.Event)()],r.prototype,"mouseEnter",void 0),nc([(0,e.Event)()],r.prototype,"mouseLeave",void 0),nc([(0,e.Event)()],r.prototype,"mouseOver",void 0),nc([(0,e.Event)()],r.prototype,"elementDraw",void 0),nc([(0,e.Event)()],r.prototype,"contextMenuOpen",void 0),nc([(0,e.Event)()],r.prototype,"contextMenuBeforeItemRender",void 0),nc([(0,e.Event)()],r.prototype,"contextMenuClick",void 0),nc([(0,e.Event)()],r.prototype,"commandExecute",void 0),nc([(0,e.Collection)([],ll)],r.prototype,"layers",void 0),nc([(0,e.Event)()],r.prototype,"drop",void 0),nc([(0,e.Event)()],r.prototype,"segmentChange",void 0),nc([(0,e.Event)()],r.prototype,"loaded",void 0),nc([(0,e.Event)()],r.prototype,"layoutUpdated",void 0),r}(e.Component),hc=function(){function t(t){var e=this;this.printWindow=void 0,this.closePrintWindow=function(){e.printWindow&&!e.printWindow.closed&&e.printWindow.close()},this.diagram=t}return t.prototype.exportDiagram=function(t){var i,r,n,o="data",a=[],s=t.margin||{},h=t&&t.region?t.region:"Content",d=t&&t.mode?t.mode:"Download",l=this.getDiagramBounds(h,t);t.bounds&&(r=!0,l.x=t.bounds.x?t.bounds.x:l.x,l.y=t.bounds.y?t.bounds.y:l.y,l.width=t.bounds.width||l.width,l.height=t.bounds.height||l.height),s={top:void 0!==s.top?s.top:25,bottom:void 0!==s.bottom?s.bottom:25,right:void 0!==s.right?s.right:25,left:void 0!==s.left?s.left:25};this.diagram.nodes;"PageSettings"!==h&&(l.x-=s.left,l.y-=s.top,l.width+=s.left+s.right,l.height+=s.top+s.bottom);var c=t.fileName||"diagram";if("SVG"!==t.format){if(null!==(o=this.setCanvas(t,l,s,d,r,h,c)))return o}else{i=t.format,t.bounds=l,t.margin=s;var p=n=this.diagramAsSvg(t,s);if("Data"===d)return n;var g=(new XMLSerializer).serializeToString(p);a.push(g)}if("Download"===d&&null!==o)for(var u=0;u<a.length;u++){var f=new Blob([a[parseInt(u.toString(),10)]],{type:"application/octet-stream"});if("msie"===e.Browser.info.name)window.navigator.msSaveOrOpenBlob(f,c+"."+i);else{var m=ud("a",{download:c+"."+i}),y=URL.createObjectURL(f);m.href=y;var v=document.createEvent("MouseEvents");v.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),m.dispatchEvent(v)}}return null},t.prototype.setCanvas=function(t,e,i,r,n,o,a){var s;t.bounds=e,t.region=o;this.setScaleValueforCanvas(t,e);var h,d=this.diagramAsCanvas({bounds:e,margin:i,region:o,scaleX:t.scaleX,scaleY:t.scaleY,scaleOffsetX:t.scaleOffsetX,scaleOffsetY:t.scaleOffsetY},n);return h=s="JPG"===t.format?d.toDataURL("image/jpeg"):"BMP"===t.format?d.toDataURL("image/bmp"):d.toDataURL(),"Data"===r?s:(this.canvasMultiplePage(t,d,i,h,a),null)},t.prototype.canvasMultiplePage=function(t,e,i,r,n){var o=this,a=[],s=r.substring(r.indexOf(":")+1,r.indexOf(";")),h=s.substring(s.indexOf("/")+1),d=(h="jpeg"===h?void 0:h.toUpperCase())||"JPG";if(t.multiplePage&&"Content"!==t.region){if(t.pageHeight=t.pageHeight?t.pageHeight:this.diagram.pageSettings.height,t.pageWidth=t.pageWidth?t.pageWidth:this.diagram.pageSettings.width,t.pageHeight=t.pageHeight?t.pageHeight:e.width,t.pageWidth=t.pageWidth?t.pageWidth:e.height,i=t.margin||{},t.pageOrientation&&("Landscape"===t.pageOrientation&&t.pageHeight>t.pageWidth||"Portrait"===t.pageOrientation&&t.pageWidth>t.pageHeight)){var l=t.pageWidth;t.pageWidth=t.pageHeight,t.pageHeight=l}t.margin={top:isNaN(i.top)?0:i.top,bottom:isNaN(i.bottom)?0:i.bottom,left:isNaN(i.left)?0:i.left,right:isNaN(i.right)?0:i.right};var c=ud("img",{id:this.diagram.element.id+"_printImage",src:r});c.onload=function(){a=o.getMultipleImage(c,t,!0),o.exportImage(a,n,d,r)}}else a=[r],this.exportImage(a,n,d,r)},t.prototype.exportImage=function(t,i,r,n){for(var o=[],a=t instanceof HTMLElement?0:t.length,s=0;s<a;s++){for(var h=t[parseInt(s.toString(),10)].replace(/^data:[a-z]*;,/,"").split(","),d=atob(h[1]),l=new ArrayBuffer(d.length),c=new Uint8Array(l),p=0;p<d.length;p++)c[parseInt(p.toString(),10)]=d.charCodeAt(p);o.push(l)}for(var g=function(t){var n=new Blob([o[parseInt(t.toString(),10)]],{type:"application/octet-stream"});if("msie"===e.Browser.info.name)window.navigator.msSaveOrOpenBlob(n,i+"."+r);else{var a=ud("a",{download:i+"."+r}),s=URL.createObjectURL(n);a.href=s;var h=document.createEvent("MouseEvents");h.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),setTimeout(function(){a.dispatchEvent(h)},5*(t+1))}},u=0;u<o.length;u++)g(u)},t.prototype.getObjectsBound=function(t){for(var e,i=0,r=this.diagram.nodes;i<r.length;i++){var n=r[i];n.visible&&(("SVG"===t.format||n instanceof ne||n instanceof Bi)&&("SVG"!==t.format||n instanceof Bi)||(e=e?e.uniteRect(n.wrapper.outerBounds):n.wrapper.outerBounds))}for(var o=0,a=this.diagram.connectors;o<a.length;o++){var s=a[o];s.visible&&(e=e?e.uniteRect(s.wrapper.outerBounds):s.wrapper.outerBounds)}return e||new w(0,0,0,0)},t.prototype.getDiagramBounds=function(t,e){var i=this.getObjectsBound(e),r=i.left,n=i.top,o=i.right-i.left,a=i.bottom-i.top;if("Content"!==t&&(this.diagram.pageSettings&&this.diagram.pageSettings.multiplePage?(r=i.left,n=i.top,this.diagram.pageSettings.width&&(r=Math.floor(r/this.diagram.pageSettings.width)*this.diagram.pageSettings.width,o=Math.ceil(i.right/this.diagram.pageSettings.width)*this.diagram.pageSettings.width-r),this.diagram.pageSettings.height&&(n=Math.floor(n/this.diagram.pageSettings.height)*this.diagram.pageSettings.height,a=Math.ceil(i.bottom/this.diagram.pageSettings.height)*this.diagram.pageSettings.height-n),0===i.width&&null!==this.diagram.pageSettings.width&&(o=this.diagram.pageSettings.width),0===i.height&&null!==this.diagram.pageSettings.height&&(a=this.diagram.pageSettings.height)):(this.diagram.pageSettings.width&&(r=0,o=this.diagram.pageSettings.width),this.diagram.pageSettings.height&&(n=0,a=this.diagram.pageSettings.height))),this.diagram.scrollSettings.padding){var s=this.diagram.scrollSettings.padding;r-=s.left,n-=s.top,o+=s.left+s.right,a+=s.top+s.bottom}var h=new w;return h.x=r,h.y=n,h.width=o,h.height=a,h},t.prototype.setScaleValueforCanvas=function(t,e){var i="scaleX",r="scaleY",n="scaleOffsetX",o="scaleOffsetY";t[""+i]=1,t[""+r]=1,t[""+n]=0,t[""+o]=0;var a=t&&"Content"===t.region;if(!a){t.pageHeight=t.pageHeight||this.diagram.pageSettings.height,t.pageWidth=t.pageWidth||this.diagram.pageSettings.width;var s=t.pageOrientation||this.diagram.pageSettings.orientation;if(s||(s="Portrait"),"Portrait"===s){if(t.pageWidth>t.pageHeight){var h=t.pageHeight;t.pageHeight=t.pageWidth,t.pageWidth=h}}else if(t.pageHeight>t.pageWidth){h=t.pageWidth;t.pageWidth=t.pageHeight,t.pageHeight=h}t.pageWidth&&t.pageHeight&&!t.multiplePage&&(t.stretch="Meet")}var d=a?e.height:t.pageHeight||e.height,l=a?e.width:t.pageWidth||e.width;"Stretch"!==t.stretch&&"Meet"!==t.stretch&&"Slice"!==t.stretch||(t[""+i]=l/e.width,t[""+r]=d/e.height,"Meet"===t.stretch?(t[""+i]=t[""+r]=Math.min(t[""+i],t[""+r]),t[""+o]=(t.pageHeight-e.height*t[""+i])/2,t[""+n]=(t.pageWidth-e.width*t[""+i])/2):"Slice"===t.stretch&&(t[""+i]=t[""+r]=Math.max(t[""+i],t[""+r])),e.width=l,e.height=d),e.x*=t[""+i],e.y*=t[""+r]},t.prototype.diagramAsSvg=function(t,e){var i=this.diagram.createSvg(this.diagram.element.id+"_diagram_svg",t.bounds.width,t.bounds.height);document.body.appendChild(i);var r=fd("g",{id:this.diagram.element.id+"_pageBackground"}),n=t&&t.region?t.region:"Content",o=this.getDiagramBounds(n,t),a=o.x,s=o.y,h=o.width,d=o.height;i.appendChild(r);var l={x:String(a),y:String(s),width:String(h),height:String(d)};wd(r,l),this.setTransform(r,t.bounds,e);var c=document.getElementById(this.diagram.element.id+"gradient_pattern");c&&i.appendChild(c.cloneNode(!0)),l={x:String(a),y:String(s),width:String(h+e.left+e.right),height:String(d+e.top+e.bottom)};var p=document.getElementById(this.diagram.element.id+"_backgroundImageLayer").cloneNode(!0);wd(p,l),i.appendChild(p),this.setTransform(p,o,e);var g=document.getElementById(this.diagram.element.id+"_backgroundLayerrect").cloneNode(!0);if(wd(g,l),i.appendChild(g),this.setTransform(g,o,e),"SVG"===this.diagram.mode){var u=void 0,f=void 0,m=ed(this.diagram.element.id);for(i.appendChild(m.getElementById(this.diagram.diagramLayer.id).cloneNode(!0)),f=0;f<i.childNodes.length;f++)(u=i.childNodes[parseInt(f.toString(),10)]).id===this.diagram.element.id+"_diagramLayer"&&this.setTransform(u,o,e)}else{r=fd("g",{id:this.diagram.element.id+"_diagramLayer"}),i.appendChild(r),this.setTransform(r,t.bounds,e);var y=new Go("",null,!0),v=gd(this.diagram.element.id);this.diagram.renderDiagramElements(i,y,v,!1)}return document.body.removeChild(i),i},t.prototype.setTransform=function(t,e,i){t.setAttribute("transform","translate("+(-e.x+i.left)+", "+(-e.y+i.top)+")")},t.prototype.diagramAsCanvas=function(t,e){var i="scaleX",r="scaleY",n="scaleOffsetX",o="scaleOffsetY",a=t.bounds,s=t.margin,h=t.region,d=this.getDiagramBounds(h,t),l=this.diagram.pageSettings.background.color,c=Md.createCanvas(this.diagram.element.id+"_diagram",t.bounds.width,t.bounds.height),p=c.getContext("2d");p.translate(-a.x,-a.y),p.save(),p.fillStyle="transparent"===this.diagram.pageSettings.background.color?"white":this.diagram.pageSettings.background.color,a="Content"===h?d:a,p.fillRect(a.x,a.y,a.width,a.height);var g=this.diagram.pageSettings.background;if(g&&g.source){d=this.getDiagramBounds(h,t);var u=new Image;u.src=g.source;var f=d.width/u.width,m=d.height/u.height,y=d.x,v=d.y,b=d.width,S=d.height,w=this.isImageExportable(g);if("None"!==g.scale&&"None"!==g.align){var x="Meet"===g.scale?Math.min(f,m):Math.max(f,m);b=x*u.width,S=x*u.height,g.align.indexOf("xmid")>-1?y+=(d.width-b)/2:g.align.indexOf("xmax")>-1&&(y=y+d.width-b),g.align.indexOf("ymid")>-1?v+=(d.height-S)/2:g.align.indexOf("ymax")>-1&&(v=v+d.height-S),"none"!==this.diagram.pageSettings.background.color&&"transparent"!==this.diagram.pageSettings.background.color||(p.fillStyle="white",p.fillRect(d.x*t[""+i],d.y*t[""+r],d.width*t[""+i],d.height*t[""+r])),w&&p.drawImage(u,y,v,x*u.width,x*u.height)}else w&&p.drawImage(u,y,v,d.width,d.height)}else p.fillStyle="transparent"===l?"white":l,p.fillRect(d.x*t[""+i]-s.left,d.y*t[""+r]-s.top,d.width*t[""+i]+s.left+s.right,t[""+r]*d.height+s.top+s.bottom);var I=this.diagram.pageSettings.background.color,P=this.diagram.pageSettings.width;P&&(p.strokeStyle="none"===I?"transparent":I,p.lineWidth=P,p.strokeRect(d.x*t[""+i],d.y*t[""+r],d.width*t[""+i],d.height*t[""+r])),p.restore();var C=gd(this.diagram.element.id),T=new Go("",null,!1);return this.updateObjectValue(t[""+i],t[""+n],t[""+o],!0),this.diagram.renderDiagramElements(c,T,C,!1,!0),this.updateObjectValue(t[""+i],t[""+n],t[""+o],!1),c},t.prototype.updateWrapper=function(t,e,i,r,n){if(t&&t.length>0)for(var o=0;o<t.length;o++)t[parseInt(o.toString(),10)].children&&this.updateWrapper(t[parseInt(o.toString(),10)].children,e,i,r,n),t[parseInt(o.toString(),10)].exportScaleValue.x=e,t[parseInt(o.toString(),10)].exportScaleValue.y=e,t[parseInt(o.toString(),10)].exportScaleOffset.x=i,t[parseInt(o.toString(),10)].exportScaleOffset.y=r,t[parseInt(o.toString(),10)].isExport=n},t.prototype.scaleGradientValue=function(t,e,i){if(t.style.gradient.stops.length>0){var r=t.style.gradient;t.style.gradient instanceof zt?(r.x1=i?r.x1*e:r.x1/e,r.y1=i?r.y1*e:r.y1/e,r.x2=i?r.x2*e:r.x2/e,r.y2=i?r.y2*e:r.y2/e):(r.fx=i?r.fx*e:r.fx/e,r.fy=i?r.fy*e:r.fy/e,r.cx=i?r.cx*e:r.cx/e,r.cy=i?r.cy*e:r.cy/e,r.r=i?r.r*e:r.r/e)}},t.prototype.updateObjectValue=function(t,e,i,r){for(var n,o=0;o<this.diagram.nodes.length;o++)n=this.diagram.nodes[parseInt(o.toString(),10)].wrapper,this.scaleGradientValue(this.diagram.nodes[parseInt(o.toString(),10)],t,r),this.updateWrapper(n.children,t,e,i,r),n.exportScaleValue.x=t,n.exportScaleValue.y=t,n.exportScaleOffset.x=e,n.exportScaleOffset.y=i,n.isExport=r;for(var a=0;a<this.diagram.connectors.length;a++){n=this.diagram.connectors[parseInt(a.toString(),10)].wrapper;for(var s=0;s<n.children.length;s++)n.children[parseInt(s.toString(),10)].isExport=r,r&&(n.children[parseInt(s.toString(),10)].exportScaleValue.x=t,n.children[parseInt(s.toString(),10)].exportScaleValue.y=t,n.children[parseInt(s.toString(),10)].exportScaleOffset.x=e,n.children[parseInt(s.toString(),10)].exportScaleOffset.y=i)}},t.prototype.isImageExportable=function(t){var e,i=!0;if(t.source)try{var r=(e=Md.createCanvas(this.diagram.element.id+"temp_canvas",100,100)).getContext("2d");r.save();var n=new Image;n.src=t.source,r.drawImage(n,0,0,100,100),r.restore(),e.toDataURL()}catch(t){i=!1}return i},t.prototype.getPrintCanvasStyle=function(t,e){var r=0,n=0,o=new i;if(r=t.width,n=t.height,(e.pageHeight||e.pageWidth)&&(n=e.pageHeight?e.pageHeight:n,r=e.pageWidth?e.pageWidth:r),e.pageOrientation&&("Landscape"===e.pageOrientation&&n>r||"Portrait"===e.pageOrientation&&r>n)){var a=r;r=n,n=a}return o.height=n,o.width=r,o},t.prototype.getMultipleImage=function(t,e,i){var r=[],n=ud("div",{}),o=this.getPrintCanvasStyle(t,e),a=e.margin,s=a.left,h=a.top,d=a.right,l=a.bottom,c=0,p=o.width+c,g=o.height+0,u=0,f=0;if(e&&e.multiplePage){n.style.height="auto",n.style.width="auto";var m=t.height,y=t.width,v=0,b=0,S=void 0,w=0,x=0,I=void 0,P=void 0;do{do{w=o.width,x=o.height,u+o.width>=y&&(w=y-u),f+o.height>=m&&(x=m-f),(I=(P=Md.createCanvas(this.diagram.element.id+"_multiplePrint",o.width,o.height)).getContext("2d")).drawImage(t,c+u+s,0+f+h,w-d-s,x-l-h,0+s,0+h,w-d-s,x-l-h),u+o.width>=y&&(u-=u-y),S=P.toDataURL(),I.restore(),u+=p,i?r.push(S):this.printImage(n,S,v+""+b,p+"px;",g+"px;"),v++}while(u<y);b++,v=c=u=0,f+o.height>=m&&(f-=f-m),f+=g}while(f<m)}else{var C=this.getPrintCanvasStyle(t,e),T=C.width,A=C.height;(I=(P=Md.createCanvas(this.diagram.element.id+"_diagram",T,A)).getContext("2d")).drawImage(t,0+s,0+h,t.width-(d+s),t.height-(h+l),0+s,0+h,T-(d+s),A-(h+l));S=P.toDataURL();I.restore(),i?r.push(S):this.printImage(n,S,0)}return i?r:n},t.prototype.printImage=function(t,e,i,r,n){var o={class:"e-diagram-print-page",style:"width:"+r+"height:"+n},a=ud("img",o),s=ud("div",o);Id(a,o={id:this.diagram.element.id+"_multiplePrint_img"+i,style:"float:left",src:e}),s.appendChild(a),t.appendChild(s)},t.prototype.print=function(t){t.mode="Data";var e=this.exportDiagram(t);this.printImages(e,t)},t.prototype.printImages=function(t,e){var i=this,r={id:this.diagram.element.id+"_printImage",src:t};e.margin={top:0,bottom:0,right:0,left:0};var n=ud("img",r);n.onload=function(){var t=i.getMultipleImage(n,e),r=window.open("");i.printWindow=r,null!=r&&t instanceof HTMLElement&&(r.document.write("<html><head><style> body{margin:0px;} @media print { .e-diagram-print-page{page-break-after: left; }.e-diagram-print-page:last-child {page-break-after: avoid;}}</style><title></title></head>"),window.addEventListener("beforeunload",i.closePrintWindow),r.addEventListener("load",function(){setTimeout(function(){r.window.print(),r.close()},3e3)}),r.document.write("<center>"+t.innerHTML+"</center>"),r.document.close())}},t.prototype.getContent=function(t){var e=this.diagram.snapSettings.constraints;this.diagram.snapSettings.constraints=this.diagram.snapSettings.constraints&~it.ShowLines,this.diagram.dataBind(),this.diagram.clearSelection(),t=t||document.styleSheets;for(var i="",r=0;r<t.length;r++)(t[parseInt(r.toString(),10)].href||"string"==typeof t[parseInt(r.toString(),10)])&&(i+="<link href='"+(t[parseInt(r.toString(),10)].href||t[parseInt(r.toString(),10)])+"' rel='stylesheet' />");var n=document.getElementById(this.diagram.element.id+"content").innerHTML;return n=(n=i+"<body style=\"margin: 0px; padding: 0px\"><div style='margin-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;'>"+n+"</div></body>").replace(/ transform: t/g," -webkit-transform: t"),this.diagram.snapSettings.constraints=e,this.diagram.dataBind(),n},t.prototype.getDiagramContent=function(t){if(1===this.diagram.scroller.currentZoom){var e=this.getContent(t);return Ls()?e.replace("url("+location.protocol+"//"+location.host+location.pathname+"#diagram_pattern ","url(#diagram_pattern)"):e}var i=document.getElementById(this.diagram.element.id+"content"),r=i.scrollLeft,n=i.scrollTop,o=this.diagram.scrollSettings.currentZoom,a=this.diagram.scroller.horizontalOffset,s=this.diagram.scroller.verticalOffset,h=Number(String(this.diagram.width).split("%")[0])?i.clientWidth:Number(String(this.diagram.width).split("px")[0]),d=Number(String(this.diagram.height).split("%")[0])?i.clientHeight:Number(String(this.diagram.height).split("px")[0]),l=this.getDiagramBounds("",{});this.diagram.scroller.zoom(1/o);var c,p;c=l.x,p=l.y,this.diagram.scroller.transform={tx:-c,ty:-p,scale:this.diagram.scroller.currentZoom},this.diagram.scroller.horizontalOffset=-c,this.diagram.scroller.verticalOffset=-p,this.diagram.scroller.setSize(),this.diagram.setSize(l.width,l.height);e=this.getContent(t);return this.diagram.setSize(h,d),this.diagram.scroller.zoom(o/this.diagram.scrollSettings.currentZoom),this.diagram.dataBind(),r||n?this.diagram.setOffset(r,n):(this.diagram.scroller.transform={tx:a/this.diagram.scroller.currentZoom,ty:s/this.diagram.scroller.currentZoom,scale:this.diagram.scroller.currentZoom},this.diagram.scroller.horizontalOffset=a,this.diagram.scroller.verticalOffset=s),this.diagram.renderSelector(!1),Ls()?e.replace("url("+location.protocol+"//"+location.host+location.pathname+"#diagram_pattern ","url(#diagram_pattern)"):e},t.prototype.exportImages=function(t,e){var i=this,r=e&&e.region?e.region:"Content",n=e.margin||{};n={top:isNaN(n.top)?0:n.top,bottom:isNaN(n.bottom)?0:n.bottom,left:isNaN(n.left)?0:n.left,right:isNaN(n.right)?0:n.right};var o=this.getDiagramBounds(r,{});e.bounds&&(o.x=isNaN(e.bounds.x)?o.x:e.bounds.x,o.y=isNaN(e.bounds.y)?o.y:e.bounds.y,o.width=e.bounds.width||o.width,o.height=e.bounds.height||o.height);var a=document.createElement("img");Id(a,{src:t});var s=this;a.onload=function(){var r=Md.createCanvas(s.diagram.element.id+"innerImage",o.width+(n.left+n.right),o.height+(n.top+n.bottom)),h=r.getContext("2d");if(h.fillStyle=s.diagram.pageSettings.background.color,h.fillRect(0,0,o.width+(n.left+n.right),o.height+(n.top+n.bottom)),h.drawImage(a,0,0,o.width,o.height,n.left,n.top,o.width,o.height),t=t&&"JPG"===e.format?r.toDataURL("image/jpeg"):r.toDataURL(),e.printOptions)s.printImages(t,e);else{h.restore();var d=e.fileName||"diagram";i.canvasMultiplePage(e,r,n,t,d)}},"SVG"===e.format&&this.exportDiagram(e)},t.prototype.destroy=function(){window.removeEventListener("beforeunload",this.closePrintWindow),this.printWindow=void 0},t.prototype.getModuleName=function(){return"PrintandExport"},t}(),dc=a(74),lc=function(){function t(){this.dataTable={}}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"DataBinding"},t.prototype.initData=function(t,i){var r,n=t.dataManager||t.dataSource||{};(r=n.data||n.json||(n.dataSource?n.dataSource.json:void 0))&&0===r.length&&n.dataSource.data&&(r=n.dataSource.data),r&&r.length&&(this.applyDataSource(t,r,i),i.trigger("dataLoaded",{diagram:(0,e.isBlazor)()?null:i}))},t.prototype.initSource=function(t,i){var r,n=this,o=t,a=t;if(o.dataManager instanceof dc.DataManager||o.dataSource instanceof dc.DataManager){var s=(a.dataManager||a.dataSource).defaultQuery||new dc.Query;(t.dataManager||t.dataSource).executeQuery(s).then(function(o){r=o.result,i.isDestroyed||(i.protectPropertyChange(!0),n.applyDataSource(t,r,i),i.refreshDiagram(),i.protectPropertyChange(!1),i.trigger("dataLoaded",{diagram:(0,e.isBlazor)()?null:i}))})}},t.prototype.applyDataSource=function(t,e,i){var r,n,o;this.dataTable={};var a,s,h=[],d=[];if(void 0!==e){for(var l=0;l<e.length;l++)void 0===(r=e[parseInt(l.toString(),10)])[t.parentId]||null===r[t.parentId]||"object"!=typeof r[t.parentId]||0===r[t.parentId].length?isNaN(r[t.parentId])&&void 0!==r[t.parentId]?void 0!==h[r[t.parentId]?r[t.parentId].toLowerCase():r[t.parentId]]?h[r[t.parentId].toLowerCase()].items.push(r):h[r[t.parentId]?r[t.parentId].toLowerCase():r[t.parentId]]={items:[r]}:void 0!==h[r[t.parentId]]?h[r[t.parentId]].items.push(r):h[r[t.parentId]]={items:[r]}:h=this.updateMultipleRootNodes(r,h,t,e),t.root&&isNaN(t.root)&&r[t.id]&&isNaN(r[t.id])?t.root.toLowerCase()===r[t.id].toLowerCase()&&(n={items:[r]}):t.root===r[t.id]&&(n={items:[r]});if(n)d.push(n);else for(var c=0,p=Object.keys(h);c<p.length;c++){var g=p[c];g&&"undefined"!==g&&"''"!==g&&"null"!==g||d.push(h[""+g])}for(var u=0;u<d.length;u++)for(var f=0;f<d[parseInt(u.toString(),10)].items.length;f++)a=d[parseInt(u.toString(),10)].items[parseInt(f.toString(),10)],o=this.applyNodeTemplate(t,a,i),i.nodes.push(o),isNaN(a[t.id])&&void 0!==a[t.id]?this.dataTable[a[t.id].toLowerCase()]=o:this.dataTable[a[t.id]]=o,void 0!==(s=isNaN(o.data[t.id])&&void 0!==o.data[t.id]?h[o.data[t.id].toLowerCase()]:h[o.data[t.id]])&&this.renderChildNodes(t,s,o.id,h,i)}this.dataTable=null},t.prototype.updateMultipleRootNodes=function(t,e,i,r){for(var n,o=t[i.parentId],a=0;a<o.length;a++)o[parseInt(a.toString(),10)]?e[""+(n=isNaN(o[parseInt(a.toString(),10)])?o[parseInt(a.toString(),10)].toLowerCase():o[parseInt(a.toString(),10)])]?e[""+n].items.push(t):e[""+n]={items:[t]}:e[""+(n=o[parseInt(a.toString(),10)])]?e[""+n].items.push(t):e[""+n]={items:[t]};return e},t.prototype.applyNodeTemplate=function(t,e,i){var r={id:E()+e[t.id],data:e};if("Flowchart"===i.layout.type){var n=this.getFlowChartNodeShape(e),o={fill:e.color?e.color:"white",strokeColor:e.stroke?e.stroke:"black",strokeWidth:e.strokeWidth?e.strokeWidth:1};r.shape=n,r.style=o,r.annotations=[{content:e.name?e.name:""}]}var a=J(t.doBinding);a&&a(r,e,i);var s=new Yh(i,"nodes",r,!0);if(da(s,r,i.nodeDefaults),t.dataMapSettings)for(var h=void 0,d=[],l=[],c=0;c<t.dataMapSettings.length;c++){if(-1!==t.dataMapSettings[parseInt(c.toString(),10)].property.indexOf(".")){l=this.splitString(t.dataMapSettings[parseInt(c.toString(),10)].property);for(var p=0;p<l.length;p++)-1!==l[parseInt(p.toString(),10)].indexOf("[")&&(h=l[parseInt(p.toString(),10)].indexOf("["),d=l[parseInt(p.toString(),10)].split("["));if(h)if(l[2])s[d[0]][l[0].charAt(h+1)][l[1]][l[2]]=e[t.dataMapSettings[parseInt(c.toString(),10)].field];else{var g=e[t.dataMapSettings[parseInt(c.toString(),10)].field];s[d[0]][l[0].charAt(h+1)][l[1]]=g}else l[2]?s[l[0]][l[1]][l[2]]=e[t.dataMapSettings[parseInt(c.toString(),10)].field]:s[l[0]][l[1]]=e[t.dataMapSettings[parseInt(c.toString(),10)].field]}else{var u=t.dataMapSettings[parseInt(c.toString(),10)].property;s[""+(u=u.charAt(0).toLowerCase()+u.slice(1))]=e[t.dataMapSettings[parseInt(c.toString(),10)].field]}h=0,d=[],l=[]}return this.collectionContains(s,i,t.id,t.parentId)?e[t.id]&&isNaN(e[t.id])?this.dataTable[e[t.id].toLowerCase()]:this.dataTable[e[t.id]]:s},t.prototype.getFlowChartNodeShape=function(t){if(""!==t.shape)switch(t.shape){case"Rectangle":return{type:"Basic",shape:"Rectangle"};case"Decision":return{type:"Flow",shape:"Decision"};case"Hexagon":return{type:"Path",data:"M 0 0 L 2 -2 L 11 -2 L 13 0 L 11 2 L 2 2 L 0 0"};case"Ellipse":return{type:"Basic",shape:"Ellipse"};case"Terminator":return{type:"Flow",shape:"Terminator"};case"PredefinedProcess":return{type:"Flow",shape:"PreDefinedProcess"};case"Parallelogram":return{type:"Basic",shape:"Parallelogram"};case"ParallelogramAlt":return{type:"Path",data:"M 0 0 L 12 0 L 14 2 L 2 2 L 0 0"};case"Trapezoid":return{type:"Path",data:"M 0 0 L 1 -1 L 5 -1 L 6 0 L 0 0"};case"TrapezoidAlt":return{type:"Path",data:"M 0 0 L 5 0 L 4 1 L 1 1 L 0 0"};case"DataSource":return{type:"Path",data:"M 0 1 L 0 6 C 2 7 4 7 6 6 L 6 1 C 5 0 1 0 0 1 C 1 2 5 2 6 1"};case"Asymmetric":return{type:"Path",data:"M 0 0 L 8 0 L 8 2 L 0 2 L 2 1 L 0 0"};case"DoubleCircle":return{type:"Path",data:"M 0 0 A 1 1 0 0 0 7 0 A 1 1 0 0 0 0 0 M -1 0 A 1 1 0 0 0 8 0 A 1 1 0 0 0 -1 0"};case"Document":return{type:"Flow",shape:"Document"};case"PaperTap":return{type:"Flow",shape:"PaperTap"};case"DirectData":return{type:"Flow",shape:"DirectData"};case"SequentialData":return{type:"Flow",shape:"SequentialData"};case"Sort":return{type:"Flow",shape:"Sort"};case"MultiDocument":return{type:"Flow",shape:"MultiDocument"};case"Collate":return{type:"Flow",shape:"Collate"};case"SummingJunction":return{type:"Flow",shape:"SummingJunction"};case"Or":return{type:"Flow",shape:"Or"};case"InternalStorage":return{type:"Flow",shape:"InternalStorage"};case"Extract":return{type:"Flow",shape:"Extract"};case"ManualOperation":return{type:"Flow",shape:"ManualOperation"};case"Merge":return{type:"Flow",shape:"Merge"};case"OffPageReference":return{type:"Flow",shape:"OffPageReference"};case"SequentialAccessStorage":return{type:"Flow",shape:"SequentialAccessStorage"};case"Data":return{type:"Flow",shape:"Data"};case"Card":return{type:"Flow",shape:"Card"};case"Delay":return{type:"Flow",shape:"Delay"};case"Preparation":return{type:"Flow",shape:"Preparation"};case"Display":return{type:"Flow",shape:"Display"};case"ManualInput":return{type:"Flow",shape:"ManualInput"};case"LoopLimit":return{type:"Flow",shape:"LoopLimit"};case"StoredData":return{type:"Flow",shape:"StoredData"};case"Annotation":return{type:"Flow",shape:"Annotation"};case"Annotation2":return{type:"Flow",shape:"Annotation2"};default:return{type:"Flow",shape:"Process"}}return{type:"Flow",shape:"Process"}},t.prototype.splitString=function(t){var e=[];e=t.split(".");for(var i=0;i<e.length;i++)e[parseInt(i.toString(),10)]=e[parseInt(i.toString(),10)].charAt(0).toLowerCase()+e[parseInt(i.toString(),10)].slice(1);return e},t.prototype.renderChildNodes=function(t,e,i,r,n,o){var a,s,h;o||(o=new Set(n.connectors.filter(function(t){return t.sourceID&&t.targetID}).map(function(t){return t.sourceID+"->"+t.targetID})));for(var d=0;d<e.items.length;d++)if((a=e.items[parseInt(d.toString(),10)])[t.id]){h=this.applyNodeTemplate(t,a,n);var l=!1;if(this.collectionContains(h,n,t.id,t.parentId)?l=!0:(a[t.id]&&isNaN(a[t.id])?this.dataTable[a[t.id].toLowerCase()]=h:this.dataTable[a[t.id]]=h,n.nodes.push(h)),!this.containsConnector(n,i,h.id,o)){var c=this.applyConnectorTemplate(i,h.id,n);n.connectors.push(c),o.add(c.sourceID+"->"+c.targetID)}l||void 0!==(s=h.data[t.id]&&isNaN(h.data[t.id])?r[h.data[t.id].toLowerCase()]:r[h.data[t.id]])&&this.renderChildNodes(t,s,h.id,r,n,o)}},t.prototype.containsConnector=function(t,e,i,r){return e&&i&&r.has(e+"->"+i)},t.prototype.collectionContains=function(t,e,i,r){var n;return void 0!==(n=isNaN(t.data[""+i])&&t.data[""+i]?this.dataTable[t.data[""+i].toLowerCase()]:this.dataTable[t.data[""+i]])&&n.data[""+i]===t.data[""+i]&&n.data[""+r]===t.data[""+r]},t.prototype.applyConnectorTemplate=function(t,e,i){var r,n={id:E(),sourceID:t,targetID:e};if("Flowchart"===i.layout.type){var o=i.nodes.find(function(t){return t.id===e});if("string"==typeof o.data.label)n.annotations=[{content:o.data.label}];else if(Array.isArray(o.data.label)){var a=i.connectors.filter(function(t){return t.targetID===e}),s=0;a.length>0&&(s=a.length),n.annotations=[{content:o.data.label[parseInt(s.toString(),10)]}]}r=this.getConnectorArrowType(o.data)}var h=new Co(i,"connectors",n,!0);return r&&(h.style.strokeWidth=r.strokeWidth,h.targetDecorator.shape=r.targetDecorator),da(h,n,i.connectorDefaults),h},t.prototype.getConnectorArrowType=function(t){if(""===t.arrowType)return{targetDecorator:"Arrow",strokeWidth:1};switch(t.arrowType){case"None":return{targetDecorator:"None",strokeWidth:1};case"Arrow":default:return{targetDecorator:"Arrow",strokeWidth:1};case"Diamond":return{targetDecorator:"Diamond",strokeWidth:1};case"Circle":return{targetDecorator:"Circle",strokeWidth:1};case"OpenArrow":return{targetDecorator:"OpenArrow",strokeWidth:1};case"Square":return{targetDecorator:"Square",strokeWidth:1};case"Fletch":return{targetDecorator:"Fletch",strokeWidth:1};case"OpenFetch":return{targetDecorator:"OpenFetch",strokeWidth:1};case"IndentedArrow":return{targetDecorator:"IndentedArrow",strokeWidth:1};case"OutdentedArrow":return{targetDecorator:"OutdentedArrow",strokeWidth:1};case"DoubleArrow":return{targetDecorator:"DoubleArrow",strokeWidth:1}}},t}(),cc=a(215),pc=function(t,e,i,r){return new(i||(i=Promise))(function(n,o){function a(t){try{h(r.next(t))}catch(t){o(t)}}function s(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,s)}h((r=r.apply(t,e||[])).next())})},gc=function(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},uc={content:".e-diagramcontent",copy:"e-copy",paste:"e-paste",undo:"e-undo",redo:"e-redo",cut:"e-cut",selectAll:"e-selectall",grouping:"e-grouping",group:"e-group",unGroup:"e-ungroup",bringToFront:"e-bringfront",sendToBack:"e-sendback",moveForward:"e-bringforward",sendBackward:"e-sendbackward",order:"e-order"},fc=function(){function t(t,e){this.defaultItems={},this.disableItems=[],this.hiddenItems=[],this.localeText=this.setLocaleKey(),this.parent=t,this.serviceLocator=e,this.addEventListener()}return t.prototype.addEventListener=function(){this.parent.isDestroyed||this.parent.on("initial-load",this.render,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("initial-load",this.render)},t.prototype.render=function(){this.l10n=this.serviceLocator.getService("localization"),this.element=ud("ul",{id:this.parent.element.id+"_contextMenu"}),this.parent.element.appendChild(this.element);var t="#"+this.parent.element.id;this.contextMenu=new cc.ContextMenu({items:this.getMenuItems(),enableRtl:this.parent.enableRtl,enablePersistence:this.parent.enablePersistence,locale:this.parent.locale,target:t,select:this.contextMenuItemClick.bind(this),beforeOpen:this.contextMenuBeforeOpen.bind(this),onOpen:this.contextMenuOpen.bind(this),beforeItemRender:this.BeforeItemRender.bind(this),onClose:this.contextMenuOnClose.bind(this),cssClass:"e-diagram-menu",animationSettings:{effect:"None"}}),this.contextMenu.appendTo(this.element)},t.prototype.getMenuItems=function(){var t=[],e=[],i=[];if(!this.parent.contextMenuSettings.showCustomMenuOnly){for(var r=0,n=this.getDefaultItems();r<n.length;r++){var o=n[r];-1!==o.toLocaleLowerCase().indexOf("group")?"grouping"!==o.toLocaleLowerCase()&&i.push(this.buildDefaultItems(o)):-1!==o.toLocaleLowerCase().indexOf("order")?"order"!==o.toLocaleLowerCase()&&e.push(this.buildDefaultItems(o)):t.push(this.buildDefaultItems(o))}var a=this.buildDefaultItems("grouping");a.items=i,t.push(a);var s=this.buildDefaultItems("order");s.items=e,t.push(s)}if(this.parent.contextMenuSettings.items)for(var h=0,d=this.parent.contextMenuSettings.items;h<d.length;h++){var l=d[h];t.push(l)}return t},t.prototype.contextMenuOpen=function(){this.isOpen=!0},t.prototype.BeforeItemRender=function(t){this.parent.trigger(Ft,t)},t.prototype.contextMenuItemClick=function(t){document.getElementById(this.parent.element.id+"content").focus(),this.parent.trigger(_t,t);var e=this.getKeyFromId(t.item.id);if(!t.cancel)switch(e){case"cut":this.parent.cut();break;case"copy":this.parent.copy();break;case"undo":this.parent.undo();break;case"redo":this.parent.redo();break;case"paste":this.parent.paste();break;case"selectAll":this.parent.selectAll();break;case"group":this.parent.group();break;case"unGroup":this.parent.unGroup();break;case"bringToFrontOrder":this.parent.bringToFront();break;case"moveForwardOrder":this.parent.moveForward();break;case"sendToBackOrder":this.parent.sendToBack();break;case"sendBackwardOrder":this.parent.sendBackward()}},t.prototype.contextMenuOnClose=function(t){t.items.length>0&&t.items[0].parentObj instanceof cc.ContextMenu&&this.updateItemStatus()},t.prototype.getLocaleText=function(t){return this.l10n.getConstant(this.localeText[""+t])},t.prototype.updateItemStatus=function(){this.contextMenu.showItems(this.hiddenItems,!0),this.contextMenu.enableItems(this.disableItems,!1,!0),this.hiddenItems=[],this.disableItems=[],this.isOpen=!1},t.prototype.ensureItems=function(t,e){var i=this.getKeyFromId(t.id);this.defaultItems[""+i];-1!==this.getDefaultItems().indexOf(i)&&t.target&&(e||this.parent.checkMenu)&&!this.ensureTarget(t)&&this.hiddenItems.push(t.id)},t.prototype.refreshItems=function(){this.updateItems(),this.contextMenu.refresh()},t.prototype.updateItems=function(){for(var t=!0,e=0;e<this.parent.contextMenuSettings.items.length;e++){for(var i=this.parent.contextMenuSettings.items[parseInt(e.toString(),10)],r=0;r<this.contextMenu.items.length;r++)this.contextMenu.items[parseInt(r.toString(),10)].text===this.parent.contextMenuSettings.items[parseInt(e.toString(),10)].text&&(t=!1);t&&this.contextMenu.insertAfter([i],this.contextMenu.items[this.contextMenu.items.length-1].text)}},t.prototype.contextMenuBeforeOpen=function(t){return pc(this,void 0,void 0,function(){var e,i,r,n,o,a,s,h,d,l;return gc(this,function(c){for(this.parent.checkMenu||-1===window.navigator.userAgent.indexOf("Linux")&&-1===window.navigator.userAgent.indexOf("X11")||(this.parent.checkMenu=t.cancel=!0),this.parent.checkMenu&&(this.hiddenItems=[]),(e=t).hiddenItems=[],i=0,r=t.items;i<r.length;i++)if(l=r[i],this.ensureItems(l,t.event),l.items.length)for(n=0,o=l.items;n<o.length;n++)a=o[n],this.ensureItems(a,t.event);for(this.eventArgs=t.event,this.parent.trigger(Yt,e),s=!0,this.hiddenItems=this.hiddenItems.concat(e.hiddenItems),this.contextMenu.enableItems(this.disableItems,!1,!0),h=this,d=0;d<t.items.length;d++)l=t.items[parseInt(d.toString(),10)],h.hiddenItems.indexOf(l.id)>-1&&h.contextMenu.hideItems([l.id],!0);for(d=0;d<h.contextMenu.items.length;d++)l=h.contextMenu.items[parseInt(d.toString(),10)],-1===h.hiddenItems.indexOf(l.id)&&(s=!1,h.contextMenu.showItems([l.id],!0));return s&&(e.cancel=s,this.hiddenItems=[]),this.parent.selectedItems.nodes.length&&this.parent.selectedItems.nodes[0].isPhase&&!this.parent.contextMenuSettings.showCustomMenuOnly&&(t.cancel=!0),[2]})})},t.prototype.ensureTarget=function(t){var e=this.parent.selectedItems.nodes.length+this.parent.selectedItems.connectors.length,i=!1;switch(this.getKeyFromId(t.id)){case"undo":i=!(!this.parent.historyManager||!this.parent.historyManager.canUndo);break;case"redo":i=!(!this.parent.historyManager||!this.parent.historyManager.canRedo);break;case"paste":i=!!this.parent.commandHandler.clipboardData.clipObject;break;case"selectAll":i=!!(this.parent.nodes.length+this.parent.connectors.length);break;case"grouping":i=!!(e>1||this.parent.selectedItems.nodes[0]&&this.parent.selectedItems.nodes[0].children&&this.parent.selectedItems.nodes[0].children.length>1);break;case"group":i=e>1;break;case"unGroup":i=!!(1===this.parent.selectedItems.nodes.length&&0===this.parent.selectedItems.connectors.length&&this.parent.selectedItems.nodes[0]&&this.parent.selectedItems.nodes[0].children&&this.parent.selectedItems.nodes[0].children.length>1);break;case"cut":case"copy":case"order":case"bringToFrontOrder":case"moveForwardOrder":case"sendToBackOrder":case"sendBackwardOrder":i=!!e}return i},t.prototype.destroy=function(){this.contextMenu.destroy(),(0,e.remove)(this.element),this.removeEventListener()},t.prototype.getModuleName=function(){return"contextMenu"},t.prototype.generateID=function(t){return this.parent.element.id+"_contextMenu_"+t},t.prototype.getKeyFromId=function(t){return t.replace(this.parent.element.id+"_contextMenu_","")},t.prototype.buildDefaultItems=function(t){var e;switch(t){case"copy":e={target:uc.content,iconCss:uc.copy};break;case"cut":e={target:uc.content,iconCss:uc.cut};break;case"paste":e={target:uc.content,iconCss:uc.paste};break;case"undo":e={target:uc.content,iconCss:uc.undo};break;case"redo":e={target:uc.content,iconCss:uc.redo};break;case"grouping":case"selectAll":e={target:uc.content};break;case"group":e={target:uc.content,iconCss:uc.group};break;case"unGroup":e={target:uc.content,iconCss:uc.unGroup};break;case"order":e={target:uc.content,iconCss:uc.order};break;case"bringToFrontOrder":e={target:uc.content,iconCss:uc.bringToFront};break;case"moveForwardOrder":e={target:uc.content,iconCss:uc.moveForward};break;case"sendToBackOrder":e={target:uc.content,iconCss:uc.sendToBack};break;case"sendBackwardOrder":e={target:uc.content,iconCss:uc.sendBackward}}return this.defaultItems[""+t]={text:this.getLocaleText(t),id:this.generateID(t),target:e.target,iconCss:e.iconCss?"e-icons "+e.iconCss:""},this.defaultItems[""+t]},t.prototype.getDefaultItems=function(){return["copy","cut","paste","undo","redo","selectAll","grouping","group","unGroup","order","bringToFrontOrder","moveForwardOrder","sendToBackOrder","sendBackwardOrder"]},t.prototype.setLocaleKey=function(){return{copy:"Copy",cut:"Cut",paste:"Paste",undo:"Undo",redo:"Redo",selectAll:"SelectAll",grouping:"Grouping",group:"Group",unGroup:"UnGroup",order:"Order",bringToFrontOrder:"BringToFront",moveForwardOrder:"MoveForward",sendToBackOrder:"SendToBack",sendBackwardOrder:"SendBackward"}},t}(),mc=function(){function t(){this.bpmnTextAnnotationConnector=[]}return t.prototype.getSize=function(t,e){var r=new i(t.width,t.height);return e instanceof Qt||(r.width=r.width||50,r.height=r.height||50),e.actualSize.width&&e.actualSize.height?e.actualSize:(e.measure(new i),r.width=r.width||e.desiredSize.width,r.height=r.height||e.desiredSize.height,void 0!==t.maxWidth&&(r.width=Math.min(r.width,t.maxWidth)),void 0!==t.maxHeight&&(r.height=Math.min(r.height,t.maxHeight)),void 0!==t.minWidth&&(r.width=Math.max(r.width,t.minWidth)),void 0!==t.minHeight&&(r.height=Math.max(r.height,t.minHeight)),r)},t.prototype.initBPMNContent=function(t,e,i){var r=e.shape,n=e.shape.shape;return"Event"===n&&(t=this.getBPMNEventShape(e,r.event)),"Gateway"===n&&(t=this.getBPMNGatewayShape(e)),"DataObject"===n&&(t=this.getBPMNDataObjectShape(e)),"Message"!==n&&"DataSource"!==n||(t=this.getBPMNShapes(e)),"Group"===n&&((t=this.getBPMNGroup(e,i)).style.strokeDashArray=""!==e.style.strokeDashArray?e.style.strokeDashArray:"2 2 6 2",t.cornerRadius=10),"Activity"===n&&(t=this.getBPMNActivityShape(e)),"TextAnnotation"===n&&(t=e.parentObj instanceof sc||e.parentObj instanceof Xh?this.getBpmnTextAnnotationShape(e,e.shape,i):this.getBpmnTextAnnotationSymbol(e,e.shape,i)),t},t.prototype.getBpmnTextAnnotationShape=function(t,e,i){var r=new te;r.measureChildren=!1,r.offsetX=t.offsetX,r.offsetY=t.offsetY,r.float=!0,r.id=t.id+"_textannotation",r.style.strokeColor="transparent",r.style.fill="transparent",r.relativeMode="Object",r.rotateAngle=0;var n=t.width,o=t.height,a=new w(0,0,0,0);0!==n&&0!==o&&(a=new w(t.offsetX-n/2,t.offsetY-o/2,n,o));var s=i.isProtectedOnChange;return i.isProtectedOnChange=!1,this.setAnnotationPath(a,r,t,e,e.textAnnotation.textAnnotationDirection,i),i.isProtectedOnChange=s,r},t.prototype.getBpmnTextAnnotationSymbol=function(t,e,i){var r="M33.33,15 L0,43 M39.33,0 L33.33,0 L33.33,30 L39.33,30 M60,0";"Top"===e.textAnnotation.textAnnotationDirection?r="M15,33.33 L43,0 M0,39.33 L0,33.33 L30,33.33 L30,39.33 M0,60":"Right"===e.textAnnotation.textAnnotationDirection?r="M6,15 L39.33,43 M0,0 L6,0 L6,30 L0,30 M-20,0":"Bottom"===e.textAnnotation.textAnnotationDirection&&(r="M15,6 L43,39.33 M0,0 L0,6 L30,6 L30,0 M0,-20");var n=new Qt;return n.data=r,n.style.fill="white"===t.style.fill?"transparent":t.style.fill,n.style.strokeDashArray=t.style.strokeDashArray?t.style.strokeDashArray:"",n.style.strokeWidth=t.style.strokeWidth,n.style.strokeColor="transparent"===t.style.strokeColor?"black":t.style.strokeColor,n.style.opacity=t.style.opacity,n},t.prototype.getBPMNShapes=function(t){var e=new Qt;this.setStyle(e,t),0!==(t.constraints&ht.Shadow)&&t.visible&&(e.shadow=t.shadow);var i=yc(t.shape.shape);return e.data=i,e.id=t.id+"_"+t.shape.shape,void 0!==t.width&&void 0!==t.height&&(e.width=t.width,e.height=t.height),e},t.prototype.getBPMNGroup=function(t,e){var i=new te;this.setStyle(i,t),i.id=t.id+"_group",i.children||(i.children=[]);var r=t.shape.group;if(t.shape.group)for(var n=0;n<r.children.length;n++){var o=e.nameTable[r.children[parseInt(n.toString(),10)]];i.children.push(o.wrapper)}return i.width=t.width,i.height=t.height,i},t.prototype.getBPMNGatewayShape=function(t){var e=new te,i=new Qt;i.id=t.id+"_0_gateway",i.offsetX=t.offsetX,i.offsetY=t.offsetY,i.data="M 40 20 L 20 40 L 0 20 L 20 0 L 40 20 Z",this.setStyle(i,t);var r=new Qt;r.id=t.id+"_1_gatewayType",r.style.opacity=t.style.opacity,r.style.strokeColor=t.style.strokeColor,r.horizontalAlignment="Center",r.verticalAlignment="Center",r.relativeMode="Object";var n=t.shape.gateway,o=bc(n.type);"EventBased"===n.type||"ExclusiveEventBased"===n.type||"ParallelEventBased"===n.type?r.style.fill="white":r.style.fill="black",r.data=o,e.style.fill="transparent",e.style.strokeColor="transparent",e.style.strokeWidth=0,e.children=[i,r];var a=this.getSize(t,i);return this.setSizeForBPMNGateway(t.shape.gateway,e,a.width,a.height),e},t.prototype.getBPMNDataObjectShape=function(t){var e=new te,i=t.shape.dataObject,r=new Qt;r.id=t.id+"_0_dataobj",r.data="M29.904,5 L7.853,5 L7.853,45 L42.147,45 L42.147,17.242,L29.932,5,L29.932,17.242,L42.147,17.242";var n=this.getSize(t,r);r.width=n.width,r.height=n.height,this.setStyle(r,t);var o=new Qt;o.id=t.id+"_1_type",o.width=25,o.height=20,o.margin.left=5,o.margin.top=5,o.data="M 3 9.4 l 6 0 v 2.4 l 3.6 -4 L 9 4 v 2.5 H 3 V 9.4 Z",o.style.opacity=t.style.opacity;var a=new Qt;switch(a.id=t.id+"_2_collection",a.width=7.5,a.height=15,a.style.fill="black",a.visible=!0,a.horizontalAlignment="Center",a.verticalAlignment="Bottom",a.relativeMode="Object",a.style.opacity=t.style.opacity,a.data="M 0 0 L 0.1 0 L 0.1 2 L 0 2 Z M 0.4 0 L 0.6 0 L 0.6 2 L0.4 2 Z M 0.9 0 L 1 0 L 1 2 L 0.9 2 Z",i.type){case"None":o.visible=!1;break;case"Input":o.style.fill="white";break;case"Output":o.style.fill="black"}return!1===i.collection&&(a.visible=!1),e.style.fill="transparent",e.style.strokeColor="transparent",e.style.strokeWidth=0,e.children=[r,o,a],e},t.prototype.getBPMNTaskShape=function(t){var e=t.shape.activity.task,i=new te,r=new Xt;r.cornerRadius=10;var n=this.getSize(t,r);r.id=t.id+"_0_task",r.width=n.width,r.height=n.height,this.setStyle(r,t),void 0!==e.call&&!0===e.call&&(r.style.strokeWidth=4),i.width=n.width,i.height=n.height;var o,a=this.getTaskChildCount(t),s=12*a,h=n.width/2-s;o=1===a?h+8:h+8*(a-1);var d=new Qt;"Receive"===e.type||"Send"===e.type?(d.width=18,d.height=16):"Manual"===e.type?(d.width=16,d.height=11):(d.width=20,d.height=20),d.id=t.id+"_1_tasktType",d.margin.left=5,d.margin.top=5,e.type=e.type||"None";var l=Sc(e.type);if(d.data=l,d.style.fill="transparent",d.style.opacity=t.style.opacity,"Send"===e.type&&(d.style.fill="black"),i.style.fill="transparent",i.style.strokeColor="transparent",i.style.strokeWidth=0,i.children=[r,d],"Service"===e.type){var c=new Qt;c.id=t.id+"_1_taskTypeService",c.data=l,c.margin.left=d.margin.left+9,c.margin.top=d.margin.top+9,c.style.fill="white",c.style.opacity=t.style.opacity,i.children.push(c)}var p=e.loop,g=new Qt,u=wc(p);g.data=u,g.style.fill="black",g.visible="None"!==p,1===a&&(o=h+9),g.margin.left=o-3,!0===g.visible&&(o+=20),g.width=12,g.height=12,g.margin.bottom=5,g.id=t.id+"_2_loop",g.horizontalAlignment="Left",g.verticalAlignment="Bottom",g.setOffsetWithRespectToBounds(0,1,"Fraction"),g.relativeMode="Point",g.style.fill="transparent",d.style.opacity=t.style.opacity,i.children.push(g);var f=new Qt;return f=this.getBPMNCompensationShape(t,f),!0===e.compensation?f.visible=!0:f.visible=!1,1===a&&(o=h+9),f.margin.left=o-3,o+=18,i.children.push(f),i},t.prototype.getBPMNEventShape=function(t,i,r,n){var o,a,s,h,d=new te;d.flip=t.flip||tt.None,n=n||t.id;var l="M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001",c=t.shape.event;if((0,e.isBlazor)()||"Event"!==t.shape.shape||(o=c.event,a=c.trigger),s=i.width,h=i.height,r)s=s||20,h=h||20;else if(void 0===i.width||void 0===i.height){var p=new Qt;p.data=l;var g=this.getSize(t,p);s=g.width,h=g.height}var u=t.shape.activity;if(!(0,e.isBlazor)()&&"Activity"===t.shape.shape){u.subProcess;o=i.event,a=i.trigger}var f=new Qt;f.data=l,f.id=n+"_0_event",f.width=s,f.height=h,f.horizontalAlignment="Center",f.verticalAlignment="Center",f.relativeMode="Object",this.setStyle(f,t);var m=new Qt;m.data=l,m.id=n+"_1_event",m.style.gradient=t.style.gradient,m.horizontalAlignment="Center",m.verticalAlignment="Center",m.relativeMode="Object",m.style.strokeColor=t.style.strokeColor,m.style.opacity=t.style.opacity;var y=new Qt,v=vc(a);switch(y.data=v,y.id=n+"_2_trigger",y.horizontalAlignment="Center",y.verticalAlignment="Center",y.relativeMode="Object",y.style.strokeColor=t.style.strokeColor,y.style.opacity=t.style.opacity,o){case"Start":m.visible=!1;break;case"NonInterruptingStart":f.style.strokeDashArray="2 3",m.visible=!1;break;case"Intermediate":f.style.fill=t.style.fill,f.style.gradient=null;break;case"NonInterruptingIntermediate":f.style.fill=t.style.fill,f.style.gradient=null,f.style.strokeDashArray="2 3",m.style.strokeDashArray="2 3";break;case"ThrowingIntermediate":case"End":f.style.fill="End"!==o||"white"!==t.style.fill?t.style.fill:"black",f.style.gradient=null,y.style.fill="black",y.style.strokeColor="white"}return d.style.fill="transparent",d.style.strokeColor="transparent",d.style.strokeWidth=0,d.children=[f,m,y],this.setSizeForBPMNEvents(c,d,s,h),d},t.prototype.setEventVisibility=function(t,e){var i=t.shape.event.event,r=e[0],n=e[1];e[2];switch(i){case"Start":n.visible=!1;break;case"NonInterruptingStart":r.style.strokeDashArray="2 3",n.visible=!1}},t.prototype.setSubProcessVisibility=function(t){var e=t.shape.activity.subProcess,i=e.events.length,r="Transaction"===t.shape.activity.subProcess.type?2:0,n=t.wrapper.children[0].children[0];if(!1===e.adhoc&&(n.children[3+r+i].visible=!1),!1===e.compensation&&(n.children[4+r+i].visible=!1),i>0)for(var o=0;o<i;o++)this.setEventVisibility(t,n.children[2+o].children)},t.prototype.getBPMNSubProcessShape=function(t){var e,i,r,n=new te,o=new Qt,a=(new te,new Qt),s=t.shape.activity,h=s.subProcess,d=this.getSubprocessChildCount(t),l=new Xt;l.id=t.id+"_0_Subprocess",l.style.fill="transparent",l.cornerRadius=10;var c=this.getSize(t,l);l.width=c.width,l.height=c.height,n.children=[l],"Transaction"===s.subProcess.type&&this.getBPMNSubProcessTransaction(t,t.shape,n);var p=12,g=d*p,u=c.width/2;r=1===d?u-6:u-g/2-4*(d-1)/2,this.setStyle(l,t),0!==(t.constraints&ht.Shadow)&&t.visible&&(n.shadow=t.shadow);var f=new Qt;if(f.id=t.id+"_0_collapsed",f.width=12,f.height=12,f.style.fill="black",f.style.strokeColor=t.style.strokeColor,f.margin.bottom=5,f.style.opacity=t.style.opacity,f.horizontalAlignment="Left",f.verticalAlignment="Bottom",f.setOffsetWithRespectToBounds(0,1,"Fraction"),f.relativeMode="Point",f.data=yc("collapsedShape"),f.margin.left=r,!0!==h.collapsed||h.processes?f.visible=!1:f.visible=!0,!0===f.visible&&(r+=16),n.children.push(f),"Event"===h.type){l.style.strokeWidth=1,l.style.strokeDashArray="2 2",e=h.events;for(var m=0;m<e.length;m++)i=e[parseInt(m.toString(),10)],this.getBPMNSubEvent(i,t,n)}1===d&&(r=u-6),(a=this.getBPMNSubProcessLoopShape(t)).margin.left=r,!0===a.visible&&(r+=16),a.style.opacity=t.style.opacity,n.children.push(a),l.id=t.id+"_boundary","Default"===h.boundary&&(l.style.strokeWidth=t.style.strokeWidth?t.style.strokeWidth:1,l.style.strokeDashArray="1 0"),"Call"===h.boundary&&(l.style.strokeWidth=4,l.style.strokeDashArray="1 0"),"Event"===h.boundary&&(l.style.strokeWidth=t.style.strokeWidth?t.style.strokeWidth:1,l.style.strokeDashArray="2 2"),1===d&&(r=u-6),(o=this.getBPMNAdhocShape(t,o,h)).margin.left=r,!0===o.visible&&(r+=16),o.style.opacity=t.style.opacity,n.children.push(o);var y=new Qt;return!0===h.compensation?y.visible=!0:y.visible=!1,1===d&&(r=u-6),(y=this.getBPMNCompensationShape(t,y)).margin.left=r,!0===y.visible&&(r+=16),y.style.opacity=t.style.opacity,n.children.push(y),n.style.strokeColor="transparent",n.style.strokeWidth=0,n.style.fill="transparent",n},t.prototype.getBPMNSubEvent=function(t,e,i,r){i.children=i.children||[];var n=this.getBPMNEventShape(e,t,!0,r);this.getBPMNSubprocessEvent(e,n,t),n.id=r||e.id+"_subprocessEvents",n.width=t.width||20,n.height=t.height||20,n.setOffsetWithRespectToBounds(t.offset.x,t.offset.y,"Fraction"),n.relativeMode="Point",n.margin=t.margin,n.horizontalAlignment=t.horizontalAlignment,n.verticalAlignment=t.verticalAlignment,n.style.fill="transparent",n.style.strokeColor="transparent",n.style.strokeWidth=0,i.children.push(n)},t.prototype.getBPMNSubProcessTransaction=function(t,e,i){var r=i.children[0].width,n=i.children[0].height,o=new Xt;o.margin={left:3,right:0,top:3,bottom:0},o.id=t.id+"_0_Subprocess_innnerRect",o.cornerRadius=10,o.width=r-6,o.style.fill="transparent",o.height=n-6,i.children.push(o);var a=new te;a.id=t.id+"_transaction_events",a.flip=t.flip||tt.None,a.style.gradient=t.style.gradient;var s=e.activity.subProcess.transaction;this.getBPMNSubEvent(s.success,t,a,t.id+"_success"),this.getBPMNSubEvent(s.cancel,t,a,t.id+"_cancel"),this.getBPMNSubEvent(s.failure,t,a,t.id+"_failure"),this.updateDiagramContainerVisibility(a.children[0],s.success.visible),this.updateDiagramContainerVisibility(a.children[1],s.cancel.visible),this.updateDiagramContainerVisibility(a.children[2],s.failure.visible),a.float=!0,a.width=r,a.height=n,a.style.fill=a.style.strokeColor="transparent",i.children.push(a)},t.prototype.getBPMNSubProcessLoopShape=function(t){var e,i,r=t.shape.activity,n=new Qt;return i=wc(e=r.subProcess.loop),n.visible="None"!==e,n.id=t.id+"_loop",n.data=i,n.style.fill="black",n.width=12,n.height=12,n.horizontalAlignment="Left",n.verticalAlignment="Bottom",n.setOffsetWithRespectToBounds(0,1,"Fraction"),n.relativeMode="Point",n.margin.bottom=5,n.style.fill="transparent",n.style.strokeColor=t.style.strokeColor,n},t.prototype.drag=function(t,e,r,n){var o=n.nameTable[t.processId],a=t.margin.left,s=t.margin.top,h={top:t.margin.top+r>=0?t.margin.top+r:t.margin.top,left:t.margin.left+e>=0?t.margin.left+e:t.margin.left};if(h.top===t.margin.top&&h.left===t.margin.left||n.nodePropertyChange(t,{},{margin:h}),!("Drag"===n.eventHandler.currentAction||n.eventHandler.isNudgeKey||t.hasTextAnnotation||s===t.margin.top&&a===t.margin.left)){var d={offsetX:t.offsetX+e>=0?t.offsetX+e:t.offsetX,offsetY:t.offsetY+r>=0?t.offsetY+r:t.offsetY};n.nodePropertyChange(t,{},{offsetX:d.offsetX,offsetY:d.offsetY})}var l=this.getChildrenBound(o,t.id,n);this.updateSubProcessess(l,t,n);var c=t.margin.left-a,p=t.margin.top-s;if(0!==t.outEdges.length)for(var g=0;g<t.outEdges.length;g++){var u=n.nameTable[t.outEdges[parseInt(g.toString(),10)]];if(u&&"Bpmn"===u.shape.type&&u.isBpmnAnnotationConnector){var f=n.nameTable[u.targetID],m={offsetX:f.offsetX,offsetY:f.offsetY};f.offsetX+=c,f.offsetY+=p;var y={offsetX:f.offsetX,offsetY:f.offsetY};n.nodePropertyChange(f,m,y)}}o.wrapper.measure(new i(void 0,void 0)),o.wrapper.arrange(o.wrapper.desiredSize),n.refreshCanvasLayers(),n.updateSelector(),n.updateDiagramObject(o),n.updateConnectorEdges(t),this.updateDocks(t,n)},t.prototype.dropBPMNchild=function(t,r,n){if(r&&"Bpmn"===r.shape.type&&"Bpmn"===t.shape.type&&!(0,e.isBlazor)()){var o=n.nameTable[t.id].shape.activity.subProcess;if(n.currentSymbol&&"Bpmn"===t.shape.type&&!o.collapsed)return void(r.processId=t.id);if(o.processes=o.processes||[],o.processes&&-1===o.processes.indexOf(r.id)&&!o.collapsed){o.processes.push(r.id),o.processes.length>1&&this.sortProcessOrder(o.processes,n);var a=N(r),s=n.nameTable[r.id].wrapper,h=n.nameTable[t.id].wrapper;s.margin.top=s.offsetY-s.actualSize.height/2-(t.offsetY-t.actualSize.height/2),s.margin.left=s.offsetX-s.actualSize.width/2-(t.offsetX-t.actualSize.width/2),s.margin.top=s.margin.top<0?0:s.margin.top,s.margin.left=s.margin.left<0?0:s.margin.left,n.nameTable[r.id].processId=t.id,h.children.push(n.nameTable[r.id].wrapper);var d=this.getChildrenBound(t,r.id,n);this.updateSubProcessess(d,r,n),h.measure(new i(void 0,void 0)),h.arrange(h.desiredSize),n.refreshCanvasLayers(),n.updateSelector();var l={type:"PositionChanged",undoObject:{nodes:[a]},redoObject:{nodes:[N(r)]},category:"Internal"};if(n.addHistoryEntry(l),"SVG"===n.mode)r.zIndex<t.zIndex&&(n.updateProcesses(r),this.updateSubprocessNodeIndex(r,n,t)),id(t.id+"_groupElement").appendChild(id(r.id+"_groupElement"));this.updateDocks(r,n)}}},t.prototype.sortProcessOrder=function(t,e){t.sort(function(t,i){return e.nameTable[""+t].zIndex-e.nameTable[""+i].zIndex})},t.prototype.updateIndex=function(t,e){var i=e,r=t.getIndex(i,i.id);t.nodes.splice(Number(r),1),i.zIndex=++t.activeLayer.objectZIndex,t.nodes.push(i)},t.prototype.updateSubprocessNodeIndex=function(t,e,i){if(t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length>0)for(var r=0;r<t.shape.activity.subProcess.processes.length;r++){this.updateIndex(e,t);var n=t.shape.activity.subProcess.processes[parseInt(r.toString(),10)];if(e.nameTable[""+n].shape.activity.subProcess.processes.length>0)this.updateSubprocessNodeIndex(e.nameTable[""+n],e,i);else{var o=e.nameTable[t.shape.activity.subProcess.processes[parseInt(r.toString(),10)]];this.updateIndex(e,o)}}else this.updateIndex(e,t)},t.prototype.updateDocks=function(t,e){if("Bpmn"===t.shape.type&&t.shape.activity.subProcess.processes&&!t.shape.activity.subProcess.collapsed)for(var r=0,n=t.shape.activity.subProcess.processes;r<n.length;r++){var o=n[r],a=e.nameTable[""+o];a&&(e.updateConnectorEdges(a),a.wrapper.measure(new i(a.wrapper.width,a.wrapper.height)),a.wrapper.arrange(a.wrapper.desiredSize),a.shape.activity.subProcess.processes&&a.shape.activity.subProcess.processes.length&&this.updateDocks(a,e))}},t.prototype.removeBpmnProcesses=function(t,e){var i=e.nameTable[t.processId];if("Bpmn"===t.shape.type&&t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length>0)for(var r=(n=t.shape.activity.subProcess.processes).length-1;r>=0;r--)e.remove(e.nameTable[n[parseInt(r.toString(),10)]]);if(i){e.removeDependentConnector(t);var n=i.shape.activity.subProcess.processes;this.removeChildFromBPMN(i.wrapper,t.id,e,!0);var o=n.indexOf(t.id);n.splice(o,1)}},t.prototype.removeChildFromBPMN=function(t,e,i,r){for(var n=0,o=t.children;n<o.length;n++){var a=o[n];a.id===e?(t.children.splice(t.children.indexOf(a),1),r||this.removeGElement(a.id,i)):a.children&&this.removeChildFromBPMN(a,e,i,r)}},t.prototype.removeGElement=function(t,e){var i=document.getElementById(t+"_groupElement"),r=document.getElementById(e.element.id+"_diagramLayer");i.parentElement.removeChild(i),r.appendChild(i);var n=e.nameTable[""+t],o=e.nameTable[""+n.processId],a=n.zIndex+1,s=this.getNode(a,e);if(s.length>0){var h=document.getElementById(s[0].id+"_groupElement"),d=Array.from(r.children).findIndex(function(t){return t===h}),l=-1!==d?d:1;n.zIndex<o.zIndex&&r.children[parseInt(l.toString(),10)].insertAdjacentElement("beforebegin",i)}},t.prototype.getNode=function(t,e){var i=e.nodes.filter(function(e){return e.zIndex===t});return 0===i.length&&t>0?this.getNode(t-1,e):i},t.prototype.removeProcess=function(t,e){var i=e.nameTable[""+t];if(i){var r=e.nameTable[i.processId],n=N(i);if(r&&"Bpmn"===r.shape.type){var o=r.shape.activity.subProcess.processes;this.removeChildFromBPMN(r.wrapper,t,e,!0);var a=o.indexOf(t);if(o.splice(a,1),i.processId="",!(e.diagramActions&yt.UndoRedo)){var s={type:"PositionChanged",undoObject:{nodes:[n]},redoObject:{nodes:[N(i)]},category:"Internal"};e.addHistoryEntry(s)}e.refreshDiagramLayer(),e.updateSelector()}}},t.prototype.addProcess=function(t,e,r){t.id=t.id||E();var n=t.id,o=r.nameTable[""+n],a=N(o);o||r.add(t),t.processId=e;var s=r.nameTable[""+e],h=s.shape.activity.subProcess,d=r.diagramActions&yt.UndoRedo;if(d||r.protectPropertyChange(!0),h.processes||(h.processes=[]),d||r.protectPropertyChange(!1),o&&s&&"Bpmn"===s.shape.type&&"Bpmn"===o.shape.type){if(o.processId=e,!d){r.protectPropertyChange(!0),o.zIndex<s.zIndex&&this.updateIndex(r,o);var l=s.offsetX-s.width*s.pivot.x+(o.margin.left+o.width*o.pivot.x),c=s.offsetY-s.height*s.pivot.y+(o.margin.top+o.height*o.pivot.y);o.offsetX===l&&o.offsetY===c||(o.offsetX=l,o.offsetY=c),r.protectPropertyChange(!1)}var p=s.shape.activity.subProcess.processes;if(p.indexOf(n)<0&&p.push(n),s.wrapper.children.push(o.wrapper),s.wrapper.measure(new i),s.wrapper.arrange(s.wrapper.desiredSize),r.bpmnModule.updateDocks(s,r),r.refreshDiagramLayer(),r.updateSelector(),!(r.diagramActions&yt.UndoRedo)){var g={type:"PositionChanged",undoObject:{nodes:[a]},redoObject:{nodes:[N(o)]},category:"Internal"};r.addHistoryEntry(g)}if("SVG"===r.mode&&o.shape&&o.shape.activity&&!o.shape.activity.subProcess.processes)id(e+"_groupElement").appendChild(id(t.id+"_groupElement"))}},t.prototype.getChildrenBound=function(t,e,i){var r,n=t.shape.activity.subProcess.processes;if(n&&n.length)for(var o=0,a=n;o<a.length;o++){var s=a[o];e!==s&&(r=r?i.nameTable[""+s].wrapper.bounds.uniteRect(r):i.nameTable[""+s].wrapper.bounds)}return r||i.nameTable[""+e].wrapper.bounds},t.prototype.updateSubProcessess=function(t,e,i){var r,n,o,a,s=i.nameTable[e.processId],h={x:.5,y:.5},d=e.width||e.minWidth,l=e.height||e.minHeight;s.wrapper.bounds.left+e.margin.left+d>s.wrapper.bounds.right&&(o=!0),s.wrapper.bounds.top+e.margin.top+l>s.wrapper.bounds.bottom&&(a=!0),o&&(h.x=0),a&&(h.y=0);var c=s.wrapper.actualSize;o&&(r=(e.wrapper.margin.left+e.wrapper.bounds.width)/c.width),a&&(n=(e.wrapper.margin.top+e.wrapper.bounds.height)/c.height),(r>0||n>0)&&s.constraints&ht.Resize&&i.commandHandler.scale(i.nameTable[e.processId],r||1,n||1,h)},t.prototype.getBPMNCompensationShape=function(t,e){return e.id=t.id+"_0_compensation",e.width=12,e.height=12,e.margin.bottom=5,e.style.fill="transparent",e.style.strokeColor=t.style.strokeColor,e.horizontalAlignment="Left",e.verticalAlignment="Bottom",e.relativeMode="Object",e.data="M 22.462 18.754 l -6.79 3.92 l 6.79 3.92 V 22.89 l 6.415 3.705 v -7.841 l -6.415 3.705 V 18.754 Z M 28.331 19.701 v 5.947 l -5.149 -2.973 L 28.331 19.701 Z M 21.916 25.647 l -5.15 -2.973 l 5.15 -2.973 V 25.647 Z M 22.275 12.674 c -5.513 0 -9.999 4.486 -9.999 9.999 c 0 5.514 4.486 10.001 9.999 10.001 c 5.514 0 9.999 -4.486 9.999 -10.001 C 32.274 17.16 27.789 12.674 22.275 12.674 Z M 22.275 32.127 c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 c 5.212 0 9.453 4.241 9.453 9.453 C 31.728 27.887 27.487 32.127 22.275 32.127 Z",e},t.prototype.getBPMNActivityShape=function(t){var e,i=new te,r=t.shape.activity,n=r.activity,o=r.subProcess;r.activity;return"Task"===n&&(e=this.getBPMNTaskShape(t)),"SubProcess"===n&&o&&(e=this.getBPMNSubProcessShape(t)),e.id=n+t.id,i.children=[e],i.style.fill="transparent",i.style.strokeColor="transparent",i.style.strokeWidth=0,i},t.prototype.getBPMNSubprocessEvent=function(t,e,i){var r,n;if(0!==i.annotations.length)for(var o=0;o<i.annotations.length;o++){var a=i.annotations[parseInt(o.toString(),10)];(r=t.initAnnotationWrapper(a)).width=i.width,r.height=i.height,e.children.push(r)}if(0!==i.ports.length)for(o=0;o<i.ports.length;o++){var s=i.ports[parseInt(o.toString(),10)];n=t.initPortWrapper(s),e.children.push(n)}},t.prototype.getBPMNAdhocShape=function(t,e,i){return e.id=t.id+"_0_adhoc",e.width=12,e.height=8,e.style.fill="black",e.style.strokeColor=t.style.strokeColor,e.margin.bottom=5,e.horizontalAlignment="Left",e.verticalAlignment="Bottom",e.relativeMode="Object",e.data="M 49.832 76.811 v -2.906 c 0 0 0.466 -1.469 1.931 -1.5 c 1.465 -0.031 2.331 1.219 2.897 1.688 s 1.06 0.75 1.526 0.75 c 0.466 0 1.548 -0.521 1.682 -1.208 s 0.083 3.083 0.083 3.083 s -0.76 0.969 -1.859 0.969 c -1.066 0 -1.865 -0.625 -2.464 -1.438 s -1.359 -0.998 -2.064 -0.906 C 50.598 75.467 49.832 76.811 49.832 76.811 Z",i&&!0===i.adhoc?e.visible=!0:e.visible=!1,e},t.prototype.setAnnotationPath=function(t,e,i,r,n,o){var a=new Qt;a.id=e.id+"_path",a.width=i.width,a.height=i.height,a.style.fill="white"===i.style.fill?"transparent":i.style.fill,a.style.strokeDashArray=i.style.strokeDashArray?i.style.strokeDashArray:"",a.style.gradient=i.style.gradient?i.style.gradient:null,a.style.strokeWidth=i.style.strokeWidth,a.style.strokeColor="transparent"===i.style.strokeColor?"black":i.style.strokeColor,a.style.opacity=i.style.opacity,a.relativeMode="Object",a.horizontalAlignment="Stretch",a.verticalAlignment="Stretch";var s=i.ports.length>0?i.ports[0]:new ye(i,"ports","",!0);switch(o.protectPropertyChange(!0),i.ports=[s],o.protectPropertyChange(!1),n){case"Left":a.data="M10,20 L0,20 L0,0 L10,0",a.width=10,a.horizontalAlignment="Left",s.offset={x:0,y:.5};break;case"Right":a.data="M0,0 L10,0 L10,20 L0,20",a.width=10,a.horizontalAlignment="Right",s.offset={x:1,y:.5};break;case"Top":a.data="M20,10 L20,0 L0,0 L0,10",a.height=10,a.verticalAlignment="Top",s.offset={x:.5,y:0};break;case"Bottom":a.data="M0,0 L0,10 L20,10 L20,0",a.height=10,a.verticalAlignment="Bottom",s.offset={x:.5,y:1};break;default:if(""!==r.textAnnotation.textAnnotationTarget){if(o.nameTable[r.textAnnotation.textAnnotationTarget]){var h=o.nameTable[r.textAnnotation.textAnnotationTarget];if(h.hasTextAnnotation=!0,null!==h.wrapper){var d=h.width,l=h.height,c=new w(0,0,0,0);0!==d&&0!==l&&(c=new w(h.offsetX-d/2,h.offsetY-l/2,d,l)),this.setAnnotationPosition(c,i,t,a)}}}else""===r.textAnnotation.textAnnotationTarget&&(a.data="M10,20 L0,20 L0,0 L10,0",a.width=10,a.horizontalAlignment="Left",s.offset={x:0,y:.5})}e.children=[],e.children.push(a)},t.prototype.setAnnotationPosition=function(t,e,i,r){var n=e.ports[0],o={x:i.x,y:i.y},a=this.getAnnotationPathAngle(o,t);90===a?(r.data="M20,10 L20,0 L0,0 L0,10",r.height=10,r.verticalAlignment="Top",n.offset={x:.5,y:0}):180===a?(r.data="M0,0 L10,0 L10,20 L0,20",r.width=10,r.horizontalAlignment="Right",n.offset={x:1,y:.5}):0===a?(r.data="M10,20 L0,20 L0,0 L10,0",r.width=10,r.horizontalAlignment="Left",n.offset={x:0,y:.5}):(r.data="M0,0 L0,10 L20,10 L20,0",r.height=10,r.verticalAlignment="Bottom",n.offset={x:.5,y:1})},t.prototype.getSubprocessChildCount=function(t){var e=0,i=t.shape.activity.subProcess,r=i.loop;return void 0!==r&&"None"!==r&&e++,void 0!==i.compensation&&!0===i.compensation&&e++,void 0!==i.collapsed&&!0===i.collapsed&&e++,void 0!==i.adhoc&&!0===i.adhoc&&e++,e},t.prototype.getTaskChildCount=function(t){var e=0,i=t.shape.activity.task;return void 0!==i.compensation&&!0===i.compensation&&e++,void 0!==i.loop&&"None"!==i.loop&&e++,e},t.prototype.setStyle=function(t,e){t.style.fill=e.style.fill,t.style.strokeColor=e.style.strokeColor,t.style.strokeWidth=e.style.strokeWidth,t.style.strokeDashArray=e.style.strokeDashArray,t.style.opacity=e.style.opacity,t.style.gradient=e.style.gradient,0!==(e.constraints&ht.Shadow)&&e.visible&&(t.shadow=e.shadow)},t.prototype.updateBPMN=function(t,i,r,n){var o=t.shape||{},a=r.wrapper.children[0],s=r.shape.shape||r.shape.bpmnShape;if(o.textAnnotation&&"TextAnnotation"===s){if(void 0!==o.textAnnotation.textAnnotationDirection){this.setAnnotationPath(r.wrapper.bounds,r.wrapper.children[0],r,r.shape,r.shape.textAnnotation.textAnnotationDirection,n),r.wrapper.children[0].children[0].id=r.id+"_textannotation_path";var h={ports:{0:{offset:r.ports[0].offset}}};n.nodePropertyChange(r,{},h)}if(void 0!==o.textAnnotation.textAnnotationTarget){var d=n.nameTable[o.textAnnotation.textAnnotationTarget];if(d&&"Bpmn"===d.shape.type)(l=n.nameTable[r.inEdges[0]])&&(l.sourceID=d.id,n.connectorPropertyChange(l,{},{sourceID:d.id}));else if(""===o.textAnnotation.textAnnotationTarget){var l;if(l=n.nameTable[r.inEdges[0]]){var c=n.nameTable[i.shape.textAnnotation.textAnnotationTarget],p=c.outEdges.indexOf(l.id);c.outEdges.splice(p,1),l.sourceID="",n.connectorPropertyChange(l,{},{sourceID:""})}}}}var g=void 0!==t.width||void 0!==t.height||void 0!==t.maxWidth||void 0!==t.minWidth||void 0!==t.maxHeight||void 0!==t.minHeight;if("Gateway"===o.shape&&o.gateway)this.removeBPMNElementFromDOM(r,n),r.wrapper.children[0]=this.getBPMNGatewayShape(r);else if("DataObject"===o.shape&&o.dataObject)this.removeBPMNElementFromDOM(r,n),r.wrapper.children[0]=this.getBPMNDataObjectShape(r);else if("Activity"===o.shape&&o.activity)this.removeBPMNElementFromDOM(r,n),r.wrapper.children[0]=this.getBPMNActivityShape(r);else if("Event"!==r.shape.bpmnShape&&"Event"!==r.shape.shape&&"Event"!==o.shape||!o.event)"Message"===o.shape||"DataSource"===o.shape?(this.removeBPMNElementFromDOM(r,n),r.wrapper.children[0]=this.getBPMNShapes(r)):void 0!==o.gateway||"Gateway"===s&&g?this.updateBPMNGateway(r,t):void 0!==o.dataObject||"DataObject"===s&&g?this.updateBPMNDataObject(r,t,i):void 0!==o.activity||"Activity"===s&&g?this.updateBPMNActivity(r,t,i,n):(void 0!==o.event||"Event"===s&&g)&&this.updateBPMNEvent(r,t,i);else{this.removeBPMNElementFromDOM(r,n);var u=o.event;r.wrapper.children[0]=this.getBPMNEventShape(r,u)}if(r.wrapper.children[0].id=r.wrapper.children[0].id||a.id,t.style){var f=a;if(a instanceof Ut&&((0,e.isBlazor)()||"Activity"!==r.shape.shape?f=(0,e.isBlazor)()||"Group"!==r.shape.shape?a.children[0]:a:(f=a.children[0].children[0],"Call"===r.shape.activity.subProcess.boundary&&t.style.strokeWidth&&(t.style.strokeWidth=4))),Ha(t.style,f),a&&void 0!==a.children&&a.children.length>0&&!(0,e.isBlazor)()&&"Activity"===r.shape.shape&&"SubProcess"===r.shape.activity.activity&&"Transaction"===r.shape.activity.subProcess.type){for(var m=a.children[0].children[2],y=0;y<m.children.length;y++){var v=m.children[parseInt(y.toString(),10)].children[0];Ha(t.style,v)}if(t.style.strokeColor)for(y=0;y<m.children.length;y++){v=m.children[parseInt(y.toString(),10)];this.updateBPMNStyle(v,t.style.strokeColor)}}if(t.style&&t.style.strokeColor&&a&&void 0!==a.children&&a.children.length>0)if((0,e.isBlazor)()||"Activity"!==r.shape.shape||"SubProcess"!==r.shape.activity.activity||"Transaction"===r.shape.activity.subProcess.type)if((0,e.isBlazor)()||"Activity"!==r.shape.shape||"SubProcess"!==r.shape.activity.activity||"Transaction"!==r.shape.activity.subProcess.type)(!(0,e.isBlazor)()&&"Gateway"===r.shape.shape||!(0,e.isBlazor)()&&"Event"===r.shape.shape)&&this.updateBPMNStyle(a,t.style.strokeColor);else{m=a.children[0].children[2];this.updateBPMNStyle(m,t.style.strokeColor);for(y=3;y<=6;y++){var b=a.children[0].children[parseInt(y.toString(),10)];Ha({strokeColor:t.style.strokeColor},b)}}else{v=a.children[0];this.updateBPMNStyle(v,t.style.strokeColor)}t.style&&void 0!==t.style.opacity&&this.updateBpmnChildOpacity(r.wrapper,t.style.opacity)}},t.prototype.updateBpmnChildOpacity=function(t,e){if(t.children&&t.children.length>0)for(var i=0;i<t.children.length;i++){var r=t.children[parseInt(i.toString(),10)];r.children&&this.updateBpmnChildOpacity(r,e),r instanceof Zt||(r.style.opacity=e)}},t.prototype.removeBPMNElementFromDOM=function(t,e){for(var i=0,r=e.views;i<r.length;i++){var n=r[i];bd(t.id+"_groupElement",n)}},t.prototype.updateBPMNStyle=function(t,e){for(var i=0;i<t.children.length;i++){Ha({strokeColor:e},t.children[parseInt(i.toString(),10)])}},t.prototype.updateBPMNGateway=function(t,e){var i=t.shape,r=t.wrapper.children[0];if(i){Ha(t.style,r.children[0]);var n=bc(i.gateway.type),o=this.updateGatewaySubType(r,t,n),a=i.gateway.type;o.style.fill="None"===a||"EventBased"===a||"ExclusiveEventBased"===a||"ParallelEventBased"===a?"white":"black",bd(r.children[1].id),r.children.splice(1,1),r.children.push(o)}if(void 0!==e.width||void 0!==e.height||void 0!==e.maxWidth||void 0!==e.minWidth||void 0!==e.maxHeight||void 0!==e.minHeight){var s=e.width||t.width,h=e.height||t.height;if(e.maxWidth||e.minWidth||e.maxHeight||e.minHeight){var d=new Qt,l=this.getSize(t,d);s=l.width,h=l.height}this.setSizeForBPMNGateway(t.shape.gateway,r,s,h)}},t.prototype.updateGatewaySubType=function(t,e,i){var r=new Qt;return r.id=e.id+"_1_gatewayType",r.width=t.children[1].width,r.height=t.children[1].height,r.margin.left=t.children[1].margin.left,r.margin.top=t.children[1].margin.top,r.data=i,r.offsetX=t.children[1].offsetX,r.offsetY=t.children[1].offsetY,r.style=t.children[1].style,r.horizontalAlignment=t.children[1].horizontalAlignment,r.verticalAlignment=t.children[1].verticalAlignment,r.relativeMode=t.children[1].relativeMode,r.transform=t.children[1].transform,r},t.prototype.updateBPMNDataObject=function(t,e,i){var r=e.shape,n=t.wrapper.children[0];if(r){var o=n.children[1],a=n.children[2];if(void 0!==e.style&&(Ha(e.style,n.children[0]),o.style.opacity=t.style.opacity,a.style.opacity=t.style.opacity),r.dataObject){switch(r.dataObject.type){case"None":o.visible=!1;break;case"Input":o.style.fill="white";break;case"Output":o.style.fill="black"}"None"===i.shape.dataObject.type&&(o.visible=!0),void 0!==e.shape.dataObject.collection&&(a.visible=r.dataObject.collection)}}if(void 0!==e.width||void 0!==e.height||void 0!==e.maxWidth||void 0!==e.minWidth||void 0!==e.maxHeight||void 0!==e.minHeight){var s=e.width||t.width,h=e.height||t.height;if(e.maxWidth||e.minWidth||e.maxHeight||e.minHeight){var d=new Qt,l=this.getSize(t,d);s=l.width,h=l.height}this.setSizeForBPMNDataObjects(t.shape.dataObject,n,s,h)}},t.prototype.getEvent=function(t,e,i,r,n,o){switch(i){case"Start":n.visible=!1,r.style.strokeDashArray="",o.style.fill="white",o.style.strokeColor="black",r.style.fill="white";break;case"NonInterruptingStart":r.style.strokeDashArray="2 3",o.style.fill="white",r.style.fill="white",o.style.strokeColor="black",n.visible=!1;break;case"Intermediate":r.style.strokeDashArray="",r.style.fill="white",n.style.strokeDashArray="",r.style.gradient=null,o.style.fill="white",o.style.strokeColor="black",this.updateEventVisibility(e,n);break;case"NonInterruptingIntermediate":r.style.fill="white",r.style.gradient=null,o.style.fill="white",o.style.strokeColor="black",r.style.strokeDashArray="2 3",n.style.strokeDashArray="2 3",this.updateEventVisibility(e,n);break;case"ThrowingIntermediate":case"End":r.style.fill="End"!==i?"white":"black",r.style.strokeDashArray="",n.style.strokeDashArray="",r.style.gradient=null,o.style.fill="black",this.updateEventVisibility(e,n)}},t.prototype.updateEventVisibility=function(t,e){if(t.shape.activity&&t.shape.activity.subProcess&&t.shape.activity.subProcess.events&&void 0!==t.shape.activity.subProcess.events[0]&&void 0!==t.shape.activity.subProcess.events[0].event)"NonInterruptingStart"!==t.shape.activity.subProcess.events[0].event&&"Start"!==t.shape.activity.subProcess.events[0].event||(e.visible=!0);else if(t.shape.activity&&t.shape.activity.subProcess&&t.shape.activity.subProcess.transaction){var i=t.shape.activity.subProcess.transaction,r=["success","failure","cancel"].some(function(t){var e,r=i[""+t];return!!r&&("Start"===(e=r.event)||"NonInterruptingStart"===e)});e.visible=r||e.visible}else void 0!==t.shape.event&&("NonInterruptingStart"!==t.shape.event.event&&"Start"!==t.shape.event.event||(e.visible=!0))},t.prototype.updateBPMNEvent=function(t,e,i){e.shape;var r=t.wrapper.children[0];if(void 0!==e.width||void 0!==e.height||void 0!==e.maxWidth||void 0!==e.minWidth||void 0!==e.maxHeight||void 0!==e.minHeight){var n=e.width||t.width,o=e.height||t.height;if(e.maxWidth||e.minWidth||e.maxHeight||e.minHeight){var a=new Qt,s=this.getSize(t,a);n=s.width,o=s.height}this.setSizeForBPMNEvents(t.shape.event,r,n,o)}},t.prototype.updateBPMNActivity=function(t,e,i,r){var n=e.shape,o=t.wrapper.children[0];if(o&&o.children&&o.children.length>0&&o.children[0]){var a=this.getSize(t,o.children[0].children[0]);if(n){var s=i.shape.activity.activity,h=t.shape.activity.activity;if("SubProcess"!==s&&"Task"!==s||"SubProcess"!==h&&"Task"!==h){if("Task"===h&&void 0!==n.activity.task){this.updateBPMNActivityTask(t,e);var d=this.getTaskChildCount(t),l=void 0,c=12*d,p=a.width/2-c;l=1===d?p+8:p+8*(d-1),void 0!==n.activity.task.loop&&this.updateBPMNActivityTaskLoop(t,e,l,d,p,2)}"SubProcess"===h&&void 0!==n.activity.subProcess&&this.updateBPMNActivitySubProcess(t,e,i,r)}else r.removeElements(t),t.wrapper.children[0]=this.getBPMNActivityShape(t);this.setSizeForBPMNActivity(t.shape.activity,o,e.width||a.width,e.height||a.height,t)}if(void 0!==e.width||void 0!==e.height||void 0!==e.maxWidth||void 0!==e.minWidth||void 0!==e.maxHeight||void 0!==e.minHeight){var g=e.width||t.width,u=e.height||t.height;if(e.maxWidth||e.minWidth||e.maxHeight||e.minHeight){var f=new Xt,m=this.getSize(t,f);g=m.width,u=m.height}this.setSizeForBPMNActivity(t.shape.activity,o,g,u,t)}}},t.prototype.updateBPMNActivityTask=function(t,e){for(var i=e.shape,r=t.wrapper.children[0].children[0],n=i.activity.task,o=0;o<r.children.length;o++){if(r.children[parseInt(o.toString(),10)].id===t.id+"_2_loop")(h=document.getElementById(t.id+"_2_loop")).parentNode.removeChild(h)}if(void 0!==n.type){n.type=n.type||"None";var a=Sc(n.type),s=tt.None;r.children[1].data=a;for(o=0;o<r.children.length;o++){var h;if(r.children[parseInt(o.toString(),10)].id===t.id+"_1_tasktType")s=r.children[parseInt(o.toString(),10)].flip,r.children.splice(o,1),(h=document.getElementById(t.id+"_1_tasktType")).parentNode.removeChild(h);if(r.children[parseInt(o.toString(),10)].id===t.id+"_1_taskTypeService")s=r.children[parseInt(o.toString(),10)].flip,r.children.splice(o,1),(h=document.getElementById(t.id+"_1_taskTypeService")).parentNode.removeChild(h)}var d=new Qt;if(d.id=t.id+"_1_tasktType",d.flip=s||0,d.margin.left=5,d.margin.top=5,d.data=a,d.style.fill="transparent",d.style.opacity=t.style.opacity,"Receive"===n.type||"Send"===n.type)d.width=18,d.height=16,"Send"===n.type&&(d.style.fill="black"),r.children.splice(1,0,d);else if("Manual"===n.type)d.width=16,d.height=11,r.children.splice(1,0,d);else if("Service"!==n.type)d.width=20,d.height=20,r.children.splice(1,0,d);else{d.width=20,d.height=20,r.children.splice(1,0,d);var l=new Qt;l.id=t.id+"_1_taskTypeService",l.data=a,l.margin.left=r.children[1].margin.left+9,l.margin.top=r.children[1].margin.top+9,l.style.fill="white",l.style.opacity=t.style.opacity,r.children.splice(2,0,l)}}if(void 0!==i.activity.task.call&&(!1!==i.activity.task.call?r.children[0].style.strokeWidth=4:r.children[0].style.strokeWidth=1),void 0!==i.activity.task.compensation)if(!0===i.activity.task.compensation){var c="Service"===t.shape.activity.task.type;r.children[c?4:3].visible=!0}else r.children[3].visible=!1},t.prototype.updateBPMNActivityTaskLoop=function(t,e,i,r,n,o){var a,s,h=e.shape,d=t.wrapper.children[0].children[0],l=h.activity,c=t.shape.activity.task.type,p=0;if(void 0!==l.subProcess){var g=l.subProcess;p="Transaction"===l.subProcess.type?2:l.subProcess.events.length>0?1:0,s=wc(a=g.loop),d.children[2+p].data=s,d.children[2+p].visible="None"!==a}else void 0!==l.task&&void 0!==l.task.loop&&"Service"!==c?(s=wc(l.task.loop),d.children[2].data=s,d.children[2].visible="None"!==l.task.loop):void 0!==l.task&&void 0!==l.task.loop&&"Service"===c&&(s=wc(l.task.loop),d.children[3].data=s,d.children[3].visible="None"!==l.task.loop);this.updateChildMargin(d,r,n,i,o+p)},t.prototype.updateChildMargin=function(t,e,i,r,n){if(1===e)for(var o=n;o<t.children.length;o++)2!==o&&!0===t.children[parseInt(o.toString(),10)].visible&&(t.children[parseInt(o.toString(),10)].margin.left=r,r=i+8);else{r=i+8*(e-1);for(o=n;o<t.children.length;o++)2!==o&&!0===t.children[parseInt(o.toString(),10)].visible&&(t.children[parseInt(o.toString(),10)].margin.left=r,r+=20)}},t.prototype.updateBPMNActivitySubProcess=function(t,e,i,r){var n,o=e.shape,a=t.wrapper.children[0],s=this.getSize(t,a.children[0].children[0]),h=o.activity.subProcess,d=this.getSubprocessChildCount(t),l=12*d,c=s.width/2-l;n=1===d?c+8:c+8*(d-1),Ha(t.style,a.children[0].children[0]),void 0!==h.events&&this.updateBPMNSubProcessEvent(t,e,i,r),void 0!==h.adhoc&&this.updateBPMNSubProcessAdhoc(t,i,h,n,d,c),void 0!==h.boundary&&this.updateBPMNSubProcessBoundary(t,h),void 0!==h.collapsed&&this.updateBPMNSubProcessCollapsed(t,i,h,n,d,c,r),void 0!==h.compensation&&this.updateBPMNSubProcessCompensation(t,i,h,n,d,c),void 0!==h.loop&&this.updateBPMNSubProcessLoop(t,i,h,n,d,c),void 0!==h.transaction&&this.updateBPMNSubProcessTransaction(t,e,i,r)},t.prototype.updateBPMNSubProcessEvent=function(t,e,i,r){for(var n=e.shape,o=t.wrapper.children[0],a=o.children[0],s=(o.children[0].children.length,n.activity.subProcess),h=0,d=Object.keys(s.events);h<d.length;h++){var l=d[h],c=Number(l),p=a.children[c+2],g=t.shape.activity.subProcess.events[parseInt(c.toString(),10)];this.updateBPMNSubEvent(t,s.events[parseInt(c.toString(),10)],g,p,e,i,r)}},t.prototype.updateBPMNSubEvent=function(t,e,i,r,n,o,a){var s=t.wrapper.children[0],h=n.shape;if(void 0!==r.children){var d=r.children[0],l=r.children[1],c=r.children[2],p=void 0,g=void 0;if(n.style&&(void 0===n.style.strokeColor&&void 0===n.style.opacity||(s.children[0].children[1].style.strokeColor=n.style.strokeColor,s.children[0].children[1].style.opacity=n.style.opacity)),void 0!==h.activity.subProcess&&(p=e.event,g=e.trigger),void 0!==p&&this.getEvent(n,o,p,d,l,c),void 0!==g&&(n.style&&Ha(n.style,s.children[0]),this.removeBPMNElementFromDOM(t,a),t.wrapper.children[0]=this.getBPMNActivityShape(t)),void 0===e.height&&void 0===e.width||this.getEventSize(e,r),void 0!==e.id&&(r.id=e.id),void 0!==e.margin&&(r.margin=e.margin),void 0!==e.horizontalAlignment&&(r.horizontalAlignment=e.horizontalAlignment),void 0!==e.verticalAlignment&&(r.verticalAlignment=e.verticalAlignment),void 0!==e.offset&&(r.setOffsetWithRespectToBounds(i.offset.x,i.offset.y,"Fraction"),r.relativeMode="Point"),void 0!==e.annotations){var u=void 0,f=s.children[0].children[2];r.children[3]&&r.children.length>3&&(u=r.children[3],a.updateAnnotation(e.annotations[0],u,f))}if(void 0!==e.ports){var m=void 0,y=s.children[0].children[2];r.children[4]&&r.children.length>4&&(m=r.children[4],a.updatePort(e.ports[0],m,y))}void 0!==e.visible&&"Event"!==t.shape.activity.subProcess.type&&this.updateDiagramContainerVisibility(r,e.visible)}},t.prototype.updateBPMNSubProcessTransaction=function(t,e,i,r){var n,o=e.shape.activity.subProcess.transaction,a=t.wrapper.children[0].children[0].children[2];void 0!==o.success&&(n=t.shape.activity.subProcess.transaction.success,this.updateBPMNSubEvent(t,o.success,n,a.children[0],e,i,r)),void 0!==o.cancel&&(n=t.shape.activity.subProcess.transaction.cancel,this.updateBPMNSubEvent(t,o.cancel,n,a.children[1],e,i,r)),void 0!==o.failure&&(n=t.shape.activity.subProcess.transaction.failure,this.updateBPMNSubEvent(t,o.failure,n,a.children[2],e,i,r));for(var s=0,h=t.outEdges;s<h.length;s++){var d=h[s],l=r.nameTable[""+d];switch(l.sourcePortID){case"success":o.success&&void 0!==o.success.visible&&r.connectorPropertyChange(l,{},{sourcePortID:"success"});break;case"cancel":o.cancel&&void 0!==o.cancel.visible&&r.connectorPropertyChange(l,{},{sourcePortID:"cancel"});break;case"failure":o.failure&&void 0!==o.failure.visible&&r.connectorPropertyChange(l,{},{sourcePortID:"failure"})}}},t.prototype.getEventSize=function(t,e){void 0!==t.height&&(e.height=t.height,e.children[0].height=t.height,e.children[1].height=.85*t.height,e.children[2].height=.54*t.height),void 0!==t.width&&(e.width=t.width,e.children[0].width=t.width,e.children[1].width=.85*t.width,e.children[2].width=.54*t.width)},t.prototype.updateBPMNSubProcessAdhoc=function(t,e,i,r,n,o){t.shape;var a,s=t.wrapper.children[0].children[0];a="Transaction"===t.shape.activity.subProcess.type?2:t.shape.activity.subProcess.events.length>0?1:0,!1===i.adhoc?s.children[3+a].visible=!1:s.children[3+a].visible=!0,this.updateChildMargin(s,n,o,r,3+a)},t.prototype.updateBPMNSubProcessBoundary=function(t,e){t.shape;var i=t.wrapper.children[0].children[0].children[0];"Default"===e.boundary&&(i.style.strokeWidth=1,i.style.strokeDashArray="1 0"),"Call"===e.boundary&&(i.style.strokeWidth=4,i.style.strokeDashArray="1 0"),"Event"===e.boundary&&(i.style.strokeWidth=1,i.style.strokeDashArray="2 2")},t.prototype.updateElementVisibility=function(t,i,r){if(t.shape.activity.subProcess.processes&&t.shape.activity.subProcess.processes.length>0)for(var n=t.shape.activity.subProcess.processes,o=n.length-1;o>=0;o--){var a=r.nameTable[n[parseInt(o.toString(),10)]];a.visible=i,r.updateElementVisibility(a.wrapper,a,i),i&&((0,e.isBlazor)()||"Event"!==a.shape.shape||this.setEventVisibility(a,a.wrapper.children[0].children),"SubProcess"===a.shape.activity.activity&&this.setSubProcessVisibility(a));for(var s=a.inEdges.concat(a.outEdges),h=s.length-1;h>=0;h--){var d=r.nameTable[s[parseInt(h.toString(),10)]];d.visible=i,r.updateElementVisibility(d.wrapper,d,i)}}if(i&&((0,e.isBlazor)()||"Event"!==t.shape.shape||this.setEventVisibility(t,t.wrapper.children[0].children),"SubProcess"===t.shape.activity.activity&&this.setSubProcessVisibility(t),"Task"!==t.shape.activity.activity||(0,e.isBlazor)()||"Activity"!==t.shape.shape||"None"!==t.shape.activity.subProcess.loop||(t.wrapper.children[0].children[0].children[3].visible=!1),"DataObject"===t.shape.shape))if(!1===t.shape.dataObject.collection&&"None"===t.shape.dataObject.type)for(h=t.wrapper.children[0].children.length-1;h>0;h--)t.wrapper.children[0].children[parseInt(h.toString(),10)].visible=!1;else!0===t.shape.dataObject.collection&&"None"===t.shape.dataObject.type?t.wrapper.children[0].children[1].visible=!1:!1!==t.shape.dataObject.collection||"Input"!==t.shape.dataObject.type&&"Output"!==t.shape.dataObject.type||(t.wrapper.children[0].children[2].visible=!1)},t.prototype.updateBPMNSubProcessCollapsed=function(t,e,i,r,n,o,a){var s,h=t.shape.activity.subProcess.events.length,d=t.wrapper.children[0].children[0];s="Transaction"===t.shape.activity.subProcess.type?3:t.shape.activity.subProcess.events.length>0?0:1,!1===i.collapsed?(this.updateElementVisibility(t,!0,a),d.children[s+h].visible=!1):(this.updateElementVisibility(t,!1,a),d.children[s+h].visible=!0),this.updateChildMargin(d,n,o,r,3+h)},t.prototype.updateBPMNSubProcessCompensation=function(t,e,i,r,n,o){var a,s=t.wrapper.children[0].children[0];a="Transaction"===t.shape.activity.subProcess.type?2:t.shape.activity.subProcess.events.length>0?1:0,!1===i.compensation?s.children[4+a].visible=!1:s.children[4+a].visible=!0,this.updateChildMargin(s,n,o,r,4+a)},t.prototype.updateBPMNSubProcessLoop=function(t,e,i,r,n,o){this.updateBPMNActivityTaskLoop(t,t,r,n,o,1)},t.prototype.updateBPMNConnector=function(t,e,i,r){var n=i.shape,o=t.shape.flow;return"Sequence"!==n.flow&&!n.sequence||"Sequence"!==o||(t=this.getSequence(t,e,i,r)),"Association"!==n.flow&&!n.association||"Association"!==o||(t=this.getAssociation(t,e,i,r)),"Message"!==n.flow&&!n.message||"Message"!==o||(t=this.getMessage(t,e,i,r)),t},t.prototype.getSequence=function(t,e,i,r){if("Normal"!==i.shape.sequence&&"Normal"!==t.shape.sequence||(t.targetDecorator.shape="Arrow",t.sourceDecorator.shape="None",t.style.strokeDashArray="None",t.targetDecorator.style.fill="black",t.targetDecorator.width=10,t.targetDecorator.height=10,r.connectorPropertyChange(t,e,{targetDecorator:{shape:"Arrow",style:{fill:"black"},height:10,width:10},sourceDecorator:{shape:"None"},style:{strokeDashArray:"None"}}),t.wrapper.children[3].visible=!1),"Default"===i.shape.sequence||"Default"===t.shape.sequence){t.targetDecorator.shape="Arrow",t.sourceDecorator.shape="None",t.style.strokeDashArray="None",t.targetDecorator.style.fill="black",t.targetDecorator.width=10,t.targetDecorator.height=10,r.connectorPropertyChange(t,e,{style:{strokeDashArray:"None"},targetDecorator:{shape:"Arrow",style:{fill:"black"},height:10,width:10},sourceDecorator:{shape:"None"}});var n=new Qt,o=(new Qt,void 0);n=t.getSegmentElement(t,n);for(var a=t.intermediatePoints,s=0;s<a.length-1;s++)length+=t.distance(a[parseInt(s.toString(),10)],a[s+1]),o=t.findPath(a[parseInt(s.toString(),10)],a[s+1]);var h=new Qt;h.data=o[0],h.id=t.id+"_"+i.shape.sequence||t.shape.sequence,h.offsetX=o[1].x,h.offsetY=o[1].y,h.rotateAngle=45,h.transform=gt.Self,this.removeDomElement(t,r,h)}return"Conditional"!==i.shape.sequence&&"Conditional"!==t.shape.sequence||(t.sourceDecorator.shape="Diamond",t.sourceDecorator.width=20,t.sourceDecorator.height=10,t.sourceDecorator.style.fill="white",t.targetDecorator.style.fill="black",t.style.strokeDashArray="None",t.targetDecorator.shape="Arrow",r.connectorPropertyChange(t,e,{style:{strokeDashArray:"None"},targetDecorator:{shape:"Arrow",style:{fill:"black"},height:10,width:10},sourceDecorator:{shape:"Diamond",width:20,height:10,style:{fill:"white"}}}),t.wrapper.children[3].visible=!1),t},t.prototype.getAssociation=function(t,e,i,r){return"Default"!==i.shape.association&&"Default"!==t.shape.association||(t.sourceDecorator.shape="None",t.targetDecorator.shape="None",t.style.strokeDashArray="2 2",r.connectorPropertyChange(t,e,{style:{strokeDashArray:"2 2"},targetDecorator:{shape:"None"},sourceDecorator:{shape:"None"}}),t.wrapper.children[3].visible=!1),"Directional"!==i.shape.association&&"Directional"!==t.shape.association||(t.sourceDecorator.shape="None",t.style.strokeDashArray="2 2",t.targetDecorator.shape="OpenArrow",t.targetDecorator.width=10,t.targetDecorator.height=10,r.connectorPropertyChange(t,e,{style:{strokeDashArray:"2 2"},targetDecorator:{shape:"OpenArrow",width:10,height:10},sourceDecorator:{shape:"None"}}),t.wrapper.children[3].visible=!1),"BiDirectional"!==i.shape.association&&"BiDirectional"!==t.shape.association||(t.sourceDecorator.shape="OpenArrow",t.targetDecorator.shape="OpenArrow",t.sourceDecorator.width=10,t.sourceDecorator.height=10,t.sourceDecorator.style.fill="black",r.connectorPropertyChange(t,e,{style:{strokeDashArray:"2 2"},targetDecorator:{shape:"OpenArrow",width:10,height:10},sourceDecorator:{shape:"OpenArrow",width:10,height:10,style:{fill:"black"}}}),t.wrapper.children[3].visible=!1),t},t.prototype.getMessage=function(t,e,i,r){var n,a;t.sourceDecorator.shape="Circle",t.sourceDecorator.width=10,t.targetDecorator.shape="Arrow",t.sourceDecorator.height=10,t.sourceDecorator.style.fill="White",t.targetDecorator.style.fill="White",r.connectorPropertyChange(t,e,{sourceDecorator:{shape:"Circle",style:{fill:"White"},width:10,height:10},targetDecorator:{shape:"Arrow",style:{fill:"white"}}});for(var s=t.intermediatePoints,h=0,d=0;d<s.length-1;d++){var l=.5*(h+=t.distance(s[d],s[d+1]));h>=l&&(n=ai(s[parseInt(d.toString(),10)],s[d+1]),a=o.transform(s[parseInt(d.toString(),10)],n,l))}var c=new Qt;return t.wrapper.children[0].style.strokeDashArray=" 4 4",t.style.strokeDashArray="4 4",c.id=t.id+"_"+i.shape.message||t.shape.message,c.width=25,c.height=15,c.data="M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0",c.horizontalAlignment="Center",c.verticalAlignment="Center",c.transform=gt.Self,c.style.fill="NonInitiatingMessage"===i.shape.message?"lightgrey":"white",c.offsetX=a.x,c.offsetY=a.y,"Default"!==i.shape.message&&void 0!==i.shape.message||"Default"!==t.shape.message?c.style.fill="NonInitiatingMessage"===(i.shape.message||t.shape.message)?"lightgrey":"white":c.visible=!1,this.removeDomElement(t,r,c),t},t.prototype.removeDomElement=function(t,e,i){for(var r=0,n=e.views;r<n.length;r++){var o=n[r];bd(t.id+"_groupElement",o),bd(t.id+"_content_groupElement",o),bd(t.id+"_html_element",o)}t.wrapper.children.splice(3,1),t.wrapper.children.splice(3,0,i)},t.prototype.setSizeForBPMNEvents=function(t,e,i,r){e.children[0].width=i,e.children[0].height=r;var n=e.children[1];n.width=.85*i,n.height=.85*r;var o=e.children[2];"Message"===t.trigger?(o.width=.54*i,o.height=.4*r):(o.width=.5*i,o.height=.5*r)},t.prototype.updateAnnotationDrag=function(t,e,i,r){return!!t.processId&&(this.drag(t,i,r,e),!0)},t.prototype.getAnnotationPathAngle=function(t,e){var i=0;switch(Pi(t,e,e)){case"Right":i=0;break;case"Left":i=180;break;case"Bottom":i=90;break;case"Top":i=270}return i},t.prototype.setSizeForBPMNGateway=function(t,e,i,r){e.children[0].width=i,e.children[0].height=r,e.children[1].width=.45*i,e.children[1].height=.45*r},t.prototype.setSizeForBPMNDataObjects=function(t,e,i,r){e.children[0].width=i,e.children[0].height=r},t.prototype.setSizeForBPMNActivity=function(t,e,i,r,n){e.children[0].width=i,e.children[0].height=r,e.children[0].children[0].width=i,e.children[0].children[0].height=r,"Transaction"===t.subProcess.type&&(e.children[0].children[1].width=Math.max(i-6,1),e.children[0].children[1].height=Math.max(r-6,1),e.children[0].children[2].width=i,e.children[0].children[2].height=r);var o,a,s=new Xt,h=this.getSize(n,s),d=12*(a="Task"===t.activity?this.getTaskChildCount(n):this.getSubprocessChildCount(n)),l=(i||h.width)/2;o=1===a?l-6:l-d/2-4*(a-1)/2;for(var c=0;c<e.children[0].children.length;c++)e.children[0].children[parseInt(c.toString(),10)].visible&&(e.children[0].children[parseInt(c.toString(),10)].id.indexOf("_loop")>-1||e.children[0].children[parseInt(c.toString(),10)].id.indexOf("_0_compensation")>-1||e.children[0].children[parseInt(c.toString(),10)].id.indexOf("_0_adhoc")>-1||e.children[0].children[parseInt(c.toString(),10)].id.indexOf("_0_collapsed")>-1)&&(e.children[0].children[parseInt(c.toString(),10)].margin.left=o,o+=e.children[0].children[parseInt(c.toString(),10)].actualSize.width+4)},t.prototype.updateDiagramContainerVisibility=function(t,e){if(t instanceof Ut)for(var i=0;i<t.children.length;i++)this.updateDiagramContainerVisibility(t.children[parseInt(i.toString(),10)],e);t.visible&&t.visible!==e&&(t.visible=e)},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"Bpmn"},t}();function yc(t){return xc[t.toString()]}function vc(t){return Ic[t.toString()]}function bc(t){return Pc[t.toString()]}function Sc(t){return Cc[t.toString()]}function wc(t){return Tc[t.toString()]}var xc={Event:"M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Message:"M0,0L19.8,12.8L40,0L0,0L0,25.5L40,25.5L40,0z",DataSource:"M 0 10.6 c 0 5.9 16.8 10.6 37.5 10.6 S 75 16.4 75 10.6 v 0 v 68.9 v -0.1 C 75 85.3 58.2 90 37.5 90 S 0 85.3 0 79.4 l 0 0.1 V 56 V 40.6 L 0 10.6 C 0 4.7 16.8 0 37.5 0 S 75 4.7 75 10.6 S 58.2 21.2 37.5 21.2S 0 16.5 0 10.6 l 0 6.7 v -0.2 c 0 5.9 16.8 10.6 37.5 10.6 S 75 22.9 75 17.1 v 6.8 v -0.1 c 0 5.9 -16.8 10.6 -37.5 10.6 S 0 29.6 0 23.8",SubProcess:"M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z",collapsedShape:"M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z"},Ic={Message:"M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0",Timer:"M40,20c0,8.654-5.496,16.024-13.189,18.81C24.685,39.58,22.392,40,20,40C8.954,40,0,31.046,0,20S8.954,0,20,0S40,8.954,40,20z M20,0 L20,2.583 L20,5.283 M10.027,2.681L11.659,5.507 L12.669,7.257 M2.731,9.989 L6.014,11.885 L7.307,12.631 M0.067,19.967 L2.667,19.967 L5.35,19.967M2.748,29.939 L5.731,28.217 L7.323,27.298 M10.056,37.236 L11.292,35.095 L12.698,32.66 M20.033,39.9 L20.033,36.417 L20.033,34.617M30.006,37.219 L28.893,35.292 L27.364,32.643 M37.302,29.911 L34.608,28.355 L32.727,27.269M39.967,19.933 L37.417,19.933 L34.683,19.933 M37.286,9.961 L34.583,11.521 L32.71,12.602 M29.977,2.664 L28.653,4.957 L27.336,7.24 M22.104,8.5 L19.688,20 L24.75,20 L31.604,20 L24.75,20 L19.688,20z",Error:"M 23.77 18.527 l -7.107 27.396 l 8.507 -17.247 L 36.94 40.073 l 6.394 -25.997 l -8.497 15.754 L 23.77 18.527 Z",Escalation:"M 30.001 8.098 L 11.842 43.543 l 18.159 -18.882 l 18.162 18.882 L 30.001 8.098 Z ",Cancel:"M 3.5 16 L 0 12.6 L 4.6 8 L 0 3.5 L 3.4 0 L 8 4.6 l 4.5 -4.5 L 16 3.5 L 11.5 8 l 4.5 4.5 l -3.4 3.5 L 8 11.4 L 3.5 16 Z",Compensation:"M 25.7086 0 L 0 25 L 25.7086 50 V 26.3752 L 50 50 V 0 L 25.7086 23.6248 V 0 Z ",Conditional:"M 0 0 H 16 V 16 H 0 z M 1.14 3.2 H 14.85 M 1.14 6.4 H 14.85 M 1.14 9.6 H 14.85 M 1.14 12.8 H 14.85",Link:"M 32.014 19.258 v 5.992 H 9.373 v 9.504 h 22.641 v 5.988 L 50.622 30 L 32.014 19.258 Z",Signal:"M 50 50 H 0 L 25.0025 0 L 50 50 Z",Terminate:"M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50",Multiple:"M 17.784 48.889 H 42.21 l 7.548 -23.23 L 29.997 11.303 L 10.236 25.658 L 17.784 48.889 Z",Parallel:"M 27.276 49.986 h 5.58 v -17.15 h 17.146 V 27.17 h -17.15 l 0.004 -17.15 h -5.58 l -0.004 17.15 H 9.994 v 5.666 h 17.278 L 27.276 49.986 Z"},Pc={None:"",Exclusive:"M 11.196 29.009 l 6.36 -9.712 l -5.764 -8.899 h 4.393 l 3.732 5.979 l 3.656 -5.979 h 4.354 l -5.789 9.039l 6.36 9.572 h -4.532 l -4.126 -6.437 l -4.139 6.437 H 11.196 Z",Inclusive:"M 20.323 31.333 c -6.625 0 -12.015 -5.39 -12.015 -12.015 s 5.39 -12.015 12.015 -12.015 s 12.016 5.39 12.016 12.015 S 26.948 31.333 20.323 31.333 Z M 20.323 9.303 c -5.522 0 -10.015 4.493 -10.015 10.015 s 4.492 10.015 10.015 10.015 s 10.016 -4.493 10.016 -10.015 S 25.846 9.303 20.323 9.303 Z",Parallel:"M 18.394 29.542 v -8.833 H 9.626 v -3.691 h 8.768 V 8.251 h 3.734 v 8.767 h 8.768 v 3.691 h -8.768 v 8.833 H 18.394 Z",Complex:"M29.198,19.063L23.089,19.063L27.794,14.358L26.38,12.944L21.223,18.101L21.223,10.443L19.223,10.443L19.223,17.976L14.022,12.776L12.608,14.19L17.48,19.063L10.365,19.063L10.365,21.063L18.261,21.063L12.392,26.932L13.806,28.346L19.223,22.929L19.223,30.225L21.223,30.225L21.223,22.805L25.925,27.507L27.339,26.093L22.309,21.063L29.198,21.063z",EventBased:"M 20.322 29.874 c -5.444 0 -9.873 -4.43 -9.873 -9.874 s 4.429 -9.874 9.873 -9.874 s 9.874 4.429 9.874 9.874 S 25.767 29.874 20.322 29.874 Z M 20.322 32.891 c -7.107 0 -12.89 -5.783 -12.89 -12.891 c 0 -7.107 5.782 -12.89 12.89 -12.89 c 7.108 0 12.891 5.783 12.891 12.89 C 33.213 27.108 27.431 32.891 20.322 32.891 Z M 24.191 25.386 h -7.984 l -2.469 -7.595 l 6.461 -4.693 l 6.461 4.693 L 24.191 25.386 Z",ExclusiveEventBased:"M 30 15 C 30 23.28 23.28 30 15 30 S 0 23.28 0 15 S 6.72 0 15 0 S 30 6.72 30 15 z M 15 5 L 5 12.5 L 8 22.5 H 22 L 25 12.5 z",ParallelEventBased:"M 35 17.5 C 35 27.16 27.16 35 17.5 35 S 0 27.16 0 17.5 S 7.84 0 17.5 0 S 35 7.84 35 17.5 z M 14.58 5.83 V 14.58 H 5.83 V 20.42 H 14.58 V 29.17 H 20.42 V 20.42 H 29.17 V 14.58 H 20.42 V 5.83 z"},Cc={None:"",Service:"M 32.699 20.187 v -4.005 h -3.32 c -0.125 -0.43 -0.292 -0.83 -0.488 -1.21 l 2.373 -2.375 l -2.833 -2.83 l -2.333 2.333 c -0.44 -0.253 -0.9 -0.448 -1.387 -0.595 v -3.32 h -4.003 v 3.32 c -0.46 0.137 -0.890.322 -1.3 0.537 l -2.285 -2.275 l -2.833 2.83 l 2.285 2.278 c -0.235 0.42 -0.41 0.847 -0.547 1.307 h -3.33 v 4.005 h 3.33 c 0.148 0.488 0.343 0.955 0.588 1.395 l -2.325 2.325 l 2.822 2.832 l 2.373 -2.382 c 0.392 0.205 0.792 0.37 1.212 0.497 v 3.33 h 4.003 v -3.33 c 0.46 -0.138 0.89 -0.323 1.3 -0.547 l 2.43 2.432 l 2.822 -2.832 l -2.42 -2.422 c 0.222 -0.41 0.4 -0.85 0.535-1.297 H 32.699 Z M 22.699 21.987 c -2.1 0 -3.803 -1.703 -3.803 -3.803 c 0 -2.1 1.703 -3.803 3.803 -3.803 c 2.1 0 3.803 1.703 3.803 3.803 C 26.502 20.285 24.8 21.987 22.699 21.987 Z",Receive:"M 12.217 12.134 v 13.334 h 20 V 12.134 H 12.217 Z M 30.44 13.007 l -8.223 5.35 l -8.223 -5.35 H 30.44 Z M 13.09 24.594 V 13.459 l 9.127 5.94 l 9.127 -5.94 v 11.135 H 13.09 Z",Send:"M0,1.2260086 L8.0000002,8.3380068 16,1.2260086 16,12.000007 0,12.000007 z M1.6300015,0 L14.371001,0 8.0000055,5.662 z",InstantiatingReceive:"M 16.306 17.39 v 8.79 h 13.198 v -8.79 H 16.306 Z M 28.375 17.946 l -5.47 3.558 l -5.47 -3.558 H 28.375 Z M 28.948 25.625 H 16.861 v -7.389 l 6.043 3.931 l 6.043 -3.931 V 25.625 Z M 22.905 11.785c -5.514 0 -9.999 4.486 -9.999 10 c 0 5.514 4.485 10 9.999 10 s 9.999 -4.486 9.999 -10 C 32.904 16.272 28.419 11.785 22.905 11.785 Z M 22.905 31.239 c -5.212 0 -9.453 -4.241 -9.453 -9.454c 0 -5.212 4.241 -9.453 9.453 -9.453 s 9.452 4.241 9.452 9.453 C 32.357 26.998 28.117 31.239 22.905 31.239 Z",Manual:"M9.21 612 L5.82 612 L1.07 612 a1.07317 1 -180 0 1 -1.07317 -1 L0 604.75 A3.42007 1.59344 -180 0 0 1.61 604 L2.6 604 L5.99 604 a0.721171 0.672 0 0 1 0.721171 0.672 a0.721171 0.672 0 0 1 -0.721171 0.672 L2.6 605.34 a0.48818 0.183302 -90 0 0 0.0837073 0.342385 L5.63 605.69 a0.721171 0.672 0 0 1 0.184585 -0.0223847 L10.28 605.66 a0.721171 0.672 0 0 1 0.721171 0.672 a0.721171 0.672 0 0 1 -0.721171 0.672 L5.82 607.01 a0.721171 0.672 0 0 1 -0.184585 -0.0223847 L5.63 607.35 a0.721171 0.672 0 0 1 0.184585 -0.0223847 L10.01 607.33 a0.721171 0.672 0 0 1 0.721171 0.672 a0.721171 0.672 0 0 1 -0.721171 0.672 L5.82 608.67 a0.721171 0.672 0 0 1 -0.184585 -0.0223847 L5.63 609.01 a0.721171 0.672 0 0 1 0.184585 -0.0223847 L9.47 608.99 a0.721171 0.672 0 0 1 0.721171 0.672 a0.721171 0.672 0 0 1 -0.721171 0.672 L5.82 610.34 a0.721171 0.672 0 0 1 -0.184585 -0.0223847 L5.63 610.68 a0.721171 0.672 0 0 1 0.184585 -0.0223847 L9.21 610.66 a0.721171 0.672 0 0 1 0.721171 0.672 a0.721171 0.672 0 0 1 -0.721171 0.672",BusinessRule:"M 32.844 13.245 h -0.089 v 0 H 13.764 v -0.015 h -1.009 v 16.989 h 0.095 v 0.011 h 19.716 v -0.011 h 0.278 V 13.245 Z M 31.844 14.229 v 4.185 h -18.08 v -4.185 H 31.844 Z M 18.168 25.306 v 3.938 h -4.404 v -3.938 H 18.168 Z M 13.764 24.322 v -4.923 h 4.404 v 4.923 H 13.764 Z M 19.177 25.306 h 12.667 v 3.938 H 19.177 V 25.306 Z M 19.177 24.322v -4.923 h 12.667 v 4.923 H 19.177 Z",User:"M8.6751149,13.75 L10.79009,18.703003 11.664047,18.696991 13.792084,13.75 13.824066,13.75 C18.177001,13.75 21.709022,17.259003 21.748998,21.60199 21.748998,21.649994 21.743993,21.700012 21.735021,21.747009 21.137981,24.774994 18.775997,27.144989 15.74904,27.75 L6.7491024,27.75 C3.7231224,27.144989 1.3601628,24.774994 0.76312089,21.747009 0.75414884,21.700012 0.74914402,21.649994 0.75012076,21.60199 0.78912175,17.259003 4.3221171,13.75 8.6751149,13.75 z M11.249014,0.75 C14.287014,0.75 16.749015,3.2119999 16.749015,6.25 16.749015,9.2880001 14.287014,11.75 11.249014,11.75 8.211015,11.75 5.7490147,9.2880001 5.7490147,6.25 5.7490147,3.2119999 8.211015,0.75 11.249014,0.75 z",Script:"M22.3,80.4 A82.9529,77.0159,-180,0,0,10.3,46.7 A69.8467,64.8477,0,0,1,0,19.7 A27.6207,25.6439,0,0,1,12.1,0 L84.7,0 A37.4124,34.7347,-180,0,0,77.7,19.6 A82.8871,76.9547,-180,0,0,89.7,53.3 A69.8146,64.81790000000001,0,0,1,100,80.3 A27.603399999999997,25.6278,0,0,1,87.9,100 L15.3,100 A37.4265,34.7479,-180,0,0,22.3,80.4 M12.5,28.6 L67.3,28.6 M18.3,42.9 L72.1,42.9 M80.8,57.1 L26,57.1 M85.6,71.4 L32.6,71.4"},Tc={None:"",Standard:"M 52.002 73.379 c -2.494 -2.536 -6.55 -2.534 -9.043 0 c -1.208 1.228 -1.874 2.861 -1.874 4.598 c 0 1.225 0.337 2.395 0.957 3.411 l -1.167 1.186 l 2.071 0.458 l 2.071 0.458 l -0.45 -2.106 l -0.45 -2.106 l -1.292 1.314c -1.119 -2.065 -0.842 -4.709 0.877 -6.458 c 2.084 -2.119 5.475 -2.117 7.557 0 c 2.083 2.119 2.083 5.565 0 7.685c -0.976 0.992 -2.272 1.557 -3.65 1.59 l 0.025 1.068 c 1.65 -0.041 3.2 -0.716 4.368 -1.903 c 1.208 -1.228 1.874 -2.861 1.874 -4.597 C 53.875 76.24 53.209 74.607 52.002 73.379 Z",ParallelMultiInstance:"M 51.5,69.5 L52.5,69.5 L52.5,84.5 L51.5 84.5 Z M 46.5,69.5 L47.5,69.5 L47.5,84.5 L46.5 84.5 Z M 41.5,69.5 L42.5,69.5 L42.5,84.5 L41.5 84.5 Z ",SequenceMultiInstance:"M 40.375,71.5 L 55.375,71.5 L 55.375,72.5 L 40.375,72.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,81.5 L 55.375,81.5L 55.375,82.5 L 40.375,82.5 Z"},Ac=function(){function t(){}return t.prototype.updateBridging=function(t,e){var i,r=[];if(t.bridges=[],function(t,e){return t.constraints&at.Bridging?t.constraints&at.Bridging:t.constraints&at.InheritBridging?e.constraints&ct.Bridging:0}(t,e)){var n=this.getPoints(t);i=w.toBounds(n);for(var o=t.bridgeSpace,a=e.bridgeDirection||"Top",s=-1,h=e.connectors,d=0;d<h.length;d++){var l=h[parseInt(d.toString(),10)];if(t&&l&&t.id!==l.id&&l.visible){var c=this.getPoints(l),p=w.toBounds(c);if(this.intersectsRect(i,p)){var g=this.intersect(n,c,!1,a,!0);if(g.length>0)for(var u=0;u<g.length;u++){var f=0,m=0,y=0,v=0,b=this.getLengthAtFractionPoint(t,g[parseInt(u.toString(),10)]);if(-1!==b.pointIndex){m=b.lengthFractionIndex,f=b.fullLength,y=b.segmentIndex,v=b.pointIndex;var S=this.getPointAtLength(m-o/2,n),x=this.getPointAtLength(m+o/2,n);this.isEmptyPoint(x)&&(x=S);var I=void 0,P=t.sourcePoint;I="Straight"===t.type?t.targetPoint:t.intermediatePoints[parseInt(v.toString(),10)];var C=this.angleCalculation(P,I);if(r.length){var T,A=t.sourcePoint,O=Math.abs(this.lengthCalculation(A,x)),D=-1;s=-1;for(var M=0;M<r[parseInt(y.toString(),10)].bridges.length;M++){s++;var L=r[parseInt(y.toString(),10)].bridges[parseInt(M.toString(),10)];if(O<Math.abs(this.lengthCalculation(A,L.endPoint))){D=s;break}}if(D>=0)(T=this.createSegment(S,x,C,a,v,t,e)).target=l.id,r[parseInt(y.toString(),10)].bridges.splice(D,0,T),r[parseInt(y.toString(),10)].bridges.join(),r[parseInt(y.toString(),10)].bridgeStartPoint.splice(D,0,S),r[parseInt(y.toString(),10)].bridgeStartPoint.join(),r[parseInt(y.toString(),10)].segmentIndex=y;else(T=this.createSegment(S,x,C,a,v,t,e)).target=l.id,r[parseInt(y.toString(),10)].bridges.push(T),r[parseInt(y.toString(),10)].bridgeStartPoint.push(S),r[parseInt(y.toString(),10)].segmentIndex=y}else if(!isNaN(S.x)&&!isNaN(S.y)&&!this.isEmptyPoint(x)){var E=this.createSegment(S,x,C,a,v,t,e),z={bridges:[],bridgeStartPoint:[],segmentIndex:y};E.target=l.id;var k=[];k.push(S),[].push(x),r[parseInt(y.toString(),10)]=z,r[parseInt(y.toString(),10)].bridges.push(E),r[parseInt(y.toString(),10)].bridgeStartPoint=k,r[parseInt(y.toString(),10)].segmentIndex=y}}}}}}0!==r.length&&this.firstBridge(r,t,o)}},t.prototype.firstBridge=function(t,e,i){for(var r=0;r<t.length;r++){for(var n=t[parseInt(r.toString(),10)],a=1;a<n.bridges.length;a++)if(o.findLength(n.bridges[parseInt(a.toString(),10)].endPoint,n.bridges[a-1].endPoint)<i){n.bridges[a-1].endPoint=n.bridges[parseInt(a.toString(),10)].endPoint;var s=n.bridges[a-1],h=this.createBridgeSegment(s.startPoint,s.endPoint,s.angle,i,s.sweep);n.bridges[a-1].path=h,n.bridges.splice(a,1),n.bridgeStartPoint.splice(a,1),a--}e.sourcePoint;for(var d=0;d<n.bridges.length;d++){(s=n.bridges[parseInt(d.toString(),10)]).endPoint,e.bridges.push(s)}}},t.prototype.createSegment=function(t,e,i,r,n,o,a){var s={angle:0,endPoint:{x:0,y:0},target:"",path:"",segmentPointIndex:-1,startPoint:{x:0,y:0},sweep:1,rendered:!1},h=this.sweepDirection(i,r,o,a),d=this.createBridgeSegment(t,e,i,o.bridgeSpace,h);return s.path=d,s.startPoint=t,s.endPoint=e,s.angle=i,s.segmentPointIndex=n,s.sweep=h,s},t.prototype.createBridgeSegment=function(t,e,i,r,n){return"A "+r/2+" "+r/2+" "+i+" , 1 "+n+" "+e.x+","+e.y},t.prototype.sweepDirection=function(t,e,i,r){var n,o=Math.abs(t);switch(e){case"Top":case"Bottom":n=1,o>=0&&o<=90&&(n=0);break;case"Left":case"Right":n=1,t<0&&t>=-180&&(n=0)}return"Right"!==e&&"Bottom"!==e||(n=0===n?1:0),n},t.prototype.getPointAtLength=function(t,e){for(var i,r=0,n={x:0,y:0},a=0;a<e.length;a++){var s=e[parseInt(a.toString(),10)];if(i){var h=this.lengthCalculation(i,s);if(r+h>t){var d=t-r,l=o.findAngle(i,s),c=d*Math.cos(l*Math.PI/180),p=d*Math.sin(l*Math.PI/180);n={x:i.x+c,y:i.y+p};break}r+=h,i=s}else i=s}return n},t.prototype.getPoints=function(t){var e=[];if(t.intermediatePoints&&("Straight"===t.type||"Orthogonal"===t.type))for(var i=0;i<t.intermediatePoints.length;i++)e.push(t.intermediatePoints[parseInt(i.toString(),10)]);return e},t.prototype.intersectsRect=function(t,e){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height},t.prototype.intersect=function(t,e,i,r,n){i&&e.length>=2&&(e.splice(0,1),e.splice(0,1));for(var o=[],a=0;a<t.length-1;a++){var s=this.inter1(t[parseInt(a.toString(),10)],t[a+1],e,n,r);if(s.length>0)for(var h=0;h<s.length;h++)o.push(s[parseInt(h.toString(),10)]);i&&e.length>=1&&e.splice(0,1)}return o},t.prototype.inter1=function(t,e,i,r,n){for(var o=[],a=0;a<i.length-1;a++){var s=ga(t,e,i[parseInt(a.toString(),10)],i[a+1]);if(!this.isEmptyPoint(s)){var h=this.angleCalculation(t,e),d=this.angleCalculation(i[parseInt(a.toString(),10)],i[a+1]);switch(h=this.checkForHorizontalLine(h),d=this.checkForHorizontalLine(d),n){case"Left":case"Right":h>d&&o.push(s);break;case"Top":case"Bottom":h<d&&o.push(s)}h===d&&r&&o.push(s)}}return o},t.prototype.checkForHorizontalLine=function(t){var e=Math.abs(t);return e>90?180-e:e},t.prototype.isEmptyPoint=function(t){return 0===t.x&&0===t.y},t.prototype.getLengthAtFractionPoint=function(t,e){for(var i=100,r=-1,n=0,a=-1,s=0,h=0,d=t.sourcePoint,l=d,c=[],p=0;p<t.intermediatePoints.length;p++){var g=t.intermediatePoints[parseInt(p.toString(),10)];c.push(g)}for(var u=0;u<c.length;u++){var f=c[parseInt(u.toString(),10)],m=this.getSlope(f,d,e,t);m<i&&(i=m,h=n+this.lengthCalculation(e,l),a=s,r=u),n+=o.findLength(f,d),d=f,l=f}return s++,{lengthFractionIndex:h,fullLength:n,segmentIndex:a,pointIndex:r}},t.prototype.getSlope=function(t,e,i,r){var n=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y),a=(i.y-t.y)/(e.y-t.y),s=(i.x-t.x)/(e.x-t.x);if(!isFinite(a)||!isFinite(s)||isNaN(a)||isNaN(s)){if(t.x===e.x){if(t.y===e.y)return 1e4;if(t.y>i.y&&i.y>e.y||t.y<i.y&&i.y<e.y)return Math.abs(t.x-i.x)}else if(t.y===e.y&&(t.x>i.x&&i.x>e.x||t.x<i.x&&i.x<e.x))return Math.abs(t.y-i.y)}else if((t.x>=i.x&&i.x>=e.x||t.x<=i.x&&i.x<=e.x||n<3)&&(t.y>=i.y&&i.y>=e.y||t.y<=i.y&&i.y<=e.y||o<3))return Math.abs(a-s);return 1e4},t.prototype.angleCalculation=function(t,e){var i=t.x-e.x,r=t.y-e.y;return Math.atan2(r,i)*(180/Math.PI)},t.prototype.lengthCalculation=function(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"Bridging"},t}(),Oc=function(){function t(t){this.line=[],this.diagram=t}return t.prototype.canSnap=function(){return 0!==(this.diagram.snapSettings.constraints&(it.SnapToObject|it.SnapToLines))},t.prototype.getWrapperObject=function(t,e){if(t.nodes&&t.nodes.length>0&&(this.diagram.snapSettings.constraints&it.SnapToLines||this.diagram.snapSettings.constraints&it.SnapToObject))for(var i=0;i<t.nodes.length;i++)return("SwimLane"===t.nodes[parseInt(i.toString(),10)].shape.type||t.nodes[parseInt(i.toString(),10)].isLane||""!==t.nodes[parseInt(i.toString(),10)].parentId&&e[t.nodes[parseInt(i.toString(),10)].parentId]&&e[t.nodes[parseInt(i.toString(),10)].parentId].isLane)&&e.helper?e.helper.wrapper:t.wrapper;return t.wrapper},t.prototype.setSnapLineColor=function(){return this.diagram.snapSettings.snapLineColor},t.prototype.snapPoint=function(t,e,i,r,n,o,a){var s=this.diagram.snapSettings,h=this.diagram.scroller.currentZoom,d={x:0,y:0},l=R(this.getWrapperObject(e,t.nameTable)),c={snapped:!1,offset:0},p={snapped:!1,offset:0};if(this.diagram.snapSettings.constraints&it.SnapToObject){var g=document.createElementNS("http://www.w3.org/2000/svg","g");g.setAttribute("id","_SnappingLines"),g.setAttribute("shapeRendering","crispEdges"),this.getAdornerLayerSvg().appendChild(g),this.snapObject(t,e,g,c,p,n,o===a)}var u=l.x+n.x,f=l.y+n.y,m=l.x+l.width+n.x,y=l.y+l.height+n.y,v=s.verticalGridlines.scaledIntervals,b=this.round(m,v,h),S=this.round(u,v,h);v=s.horizontalGridlines.scaledIntervals;var w=this.round(f,v,h),x=this.round(y,v,h),I=l.x+l.width,P=l.y+l.height;return c.snapped?this.diagram.snapSettings.constraints&it.SnapToObject?d.x=c.offset:d.x=a.x-o.x:this.diagram.snapSettings.constraints&it.SnapToVerticalLines?Math.abs(n.x)>=1&&(i?Math.abs(b-I)>Math.abs(S-l.x)?d.x+=S-l.x:d.x+=b-I:Math.abs(b-I)<Math.abs(S-l.x)?d.x+=b-I:d.x+=S-l.x):d.x=a.x-o.x,p.snapped?d.y=p.offset:this.diagram.snapSettings.constraints&it.SnapToHorizontalLines?Math.abs(n.y)>=1&&(r?Math.abs(x-P)>Math.abs(w-l.y)?d.y+=w-l.y:d.y+=x-P:Math.abs(x-P)<Math.abs(w-l.y)?d.y+=x-P:d.y+=w-l.y):d.y=a.y-o.y,d},t.prototype.round=function(t,e,i){1===i&&(i=Math.pow(2,Math.floor(Math.log(i)/Math.log(2))));var r=0,n=0;for(n=0;n<e.length;n++)r+=e[parseInt(n.toString(),10)];var o=t%(r/=i),a=Math.floor(Math.abs(t)/r)*r;if(a!==t)if(t>=0)for(n=0;n<e.length;n++){if(o<=e[parseInt(n.toString(),10)]/i)return a+(o<e[parseInt(n.toString(),10)]/(2*i)?0:e[parseInt(n.toString(),10)]/i);a+=e[parseInt(n.toString(),10)]/i,o-=e[parseInt(n.toString(),10)]/i}else for(a*=-1,n=e.length-1;n>=0;n--){if(Math.abs(o)<=e[parseInt(n.toString(),10)]/i)return a-(Math.abs(o)<e[parseInt(n.toString(),10)]/(2*i)?0:e[parseInt(n.toString(),10)]/i);a-=e[parseInt(n.toString(),10)]/i,o+=e[parseInt(n.toString(),10)]/i}return t},t.prototype.snapObject=function(t,e,i,r,n,o,a){var s,h,d,l=null,c=this.diagram.scroller,p=this.diagram.snapSettings,g=[],u=[],f=[],m=[],y=R(this.getWrapperObject(e,t.nameTable)),v=t.scroller.currentZoom,b=-c.horizontalOffset,S=-c.verticalOffset,x=p.snapObjectDistance/v,I=new w(0,0,c.viewPortWidth,c.viewPortHeight),P=new w(b/v,y.y-x-5,I.width/v,y.height+2*x+10),C=new w(y.x-x-5,S/v,y.width+2*x+10,I.height/v);I=new w(b/v,S/v,I.width/v,I.height/v);var T,A,O,D=this.findNodes(t.spatialSearch,e,C,I),M=t.nameTable;for(T=0;T<D.length;T++)A=D[parseInt(T.toString(),10)],this.canBeTarget(t,A)&&(this.diagram.nameTable[A.id]instanceof Co||!this.canConsider(M,e,A)||((O=A.bounds).height+O.y<o.y+y.y?f.push({obj:A,distance:Math.abs(y.y+o.y-O.y-O.height)}):O.y>y.y+o.y+y.height&&m.push({obj:A,distance:Math.abs(y.y+o.y+y.height-O.y)}),(null==l||l>Math.abs(O.y-y.y-o.y))&&(Math.abs(O.x+O.width/2-(y.x+y.width/2+o.x))<=x?(h=this.createSnapObject(O,y,"centerX"),l=Math.abs(O.y-y.y)):Math.abs(O.x+O.width-(y.x+y.width+o.x))<=x?(h=this.createSnapObject(O,y,"right"),l=Math.abs(O.y-y.y)):Math.abs(O.x-(y.x+o.x))<=x?(h=this.createSnapObject(O,y,"left"),l=Math.abs(O.y-y.y)):Math.abs(O.x-(y.x+y.width+o.x))<=x?(h=this.createSnapObject(O,y,"rightLeft"),l=Math.abs(O.y-y.y)):Math.abs(O.x+O.width-(y.x+o.x))<=x&&(h=this.createSnapObject(O,y,"leftRight"),l=Math.abs(O.y-y.y)))));D=this.findNodes(t.spatialSearch,e,P,I);for(var L=0;L<D.length;L++)A=D[parseInt(L.toString(),10)],this.canBeTarget(t,A)&&(this.diagram.nameTable[A.id]instanceof Co||!this.canConsider(M,e,A)||((O=A.bounds).x+O.width<y.x+o.x&&(g[g.length]={obj:A,distance:Math.abs(y.x+o.x-O.x-O.width)}),O.x>y.x+o.x+y.width&&(u[u.length]={obj:A,distance:Math.abs(y.x+o.x+y.width-O.x)}),(null==s||s>Math.abs(O.x-y.x-o.x))&&(Math.abs(O.y+O.height/2-(y.y+y.height/2+o.y))<=x?(d=this.createSnapObject(O,y,"centerY"),s=Math.abs(O.x-y.x)):Math.abs(O.y-y.y-o.y)<=x?(d=this.createSnapObject(O,y,"top"),s=Math.abs(O.x-y.x)):Math.abs(O.y+O.height-(y.y+y.height+o.y))<=x?(d=this.createSnapObject(O,y,"bottom"),s=Math.abs(O.x-y.x)):Math.abs(O.y+O.height-y.y-o.y)<=x?(d=this.createSnapObject(O,y,"topBottom"),s=Math.abs(O.x-y.x)):Math.abs(O.y-(y.y+y.height+o.y))<=x&&(d=this.createSnapObject(O,y,"bottomTop"),s=Math.abs(O.x-y.x)))));this.createGuidelines(t,h,d,i,r,n,a),r.snapped||this.createHSpacingLines(t,i,e,g,u,r,n,a,o,x),n.snapped||this.createVSpacingLines(t,i,e,f,m,r,n,a,o,x)},t.prototype.snapConnectorEnd=function(t){var e=this.diagram.snapSettings,i=this.diagram.scroller.currentZoom;return e.constraints&it.SnapToLines&&(t.x=this.round(t.x,e.verticalGridlines.scaledIntervals,i),t.y=this.round(t.y,e.horizontalGridlines.scaledIntervals,i)),t},t.prototype.canBeTarget=function(t,e){return e=this.diagram.nameTable[e.id],!Dn(this.diagram,e,!1)},t.prototype.snapSize=function(t,e,i,r,n,o,a,s){var h,d,l,c,p=this.diagram.snapSettings,g=this.diagram.scroller,u=R(a.wrapper),f=t.nameTable,m=[],y=[],v=t.scroller.currentZoom,b=-g.horizontalOffset,S=-g.verticalOffset,x=p.snapObjectDistance/v,I=new w(0,0,g.viewPortWidth,g.viewPortHeight),P=new w(b/v,(u.y-5)/v,I.width/v,(u.height+10)/v),C=new w((u.x-5)/v,S/v,(u.width+10)/v,I.height/v);I=new w(b/v,S/v,I.width/v,I.height/v);var T,A,O,D=[],M=this.findNodes(t.spatialSearch,a,C,I,D);for(T=0;T<M.length;T++)A=M[parseInt(T.toString(),10)],!this.canConsider(f,a,A)||this.diagram.nameTable[A.id]instanceof Co||(O=A.bounds,(null==h||h>Math.abs(O.y-u.y))&&(e.left?Math.abs(u.x+n-O.x)<=x?(l=this.createSnapObject(O,u,"left"),h=Math.abs(O.y-u.y)):Math.abs(u.x+n-O.x-O.width)<=x&&(l=this.createSnapObject(O,u,"leftRight"),h=Math.abs(O.y-u.y)):e.right&&(Math.abs(u.x+n+u.width-O.x-O.width)<=x?(l=this.createSnapObject(O,u,"right"),h=Math.abs(O.y-u.y)):Math.abs(u.x+n+u.width-O.x)<=x&&(l=this.createSnapObject(O,u,"rightLeft"),h=Math.abs(O.y-u.y)))));M=this.findNodes(t.spatialSearch,a,P,I);for(var L=0;L<M.length;L++){var E=M[parseInt(L.toString(),10)];if(this.canConsider(f,a,E)&&!(this.diagram.nameTable[E.id]instanceof Co)){var z=E.bounds;(null==d||d>Math.abs(z.x-u.x))&&(i.top?Math.abs(u.y+o-z.y)<=x?(c=this.createSnapObject(z,u,"top"),d=Math.abs(z.x-u.x)):Math.abs(u.y+o-z.y-z.height)<=x&&(c=this.createSnapObject(z,u,"topBottom"),d=Math.abs(z.x-u.x)):i.bottom&&(Math.abs(u.y+u.height+o-z.y-z.height)<=x?(c=this.createSnapObject(z,u,"bottom"),d=Math.abs(z.x-u.x)):Math.abs(u.y+u.height+o-z.y)<=x&&(c=this.createSnapObject(z,u,"bottomTop"),d=Math.abs(z.x-u.x))))}}for(T=0;T<D.length;T++)if(A=D[parseInt(T.toString(),10)],this.canConsider(f,a,A)){var k=A.bounds,B=e.left?-n:n,N=Math.abs(u.width+B-k.width),j=void 0;N<=x&&(j=e.left?-k.width+u.width:k.width-u.width,m[m.length]={source:A,difference:N,offset:j}),B=i.top?-o:o;var H=Math.abs(u.height+B-k.height);H<=x&&(j=i.top?-k.height+u.height:k.height-u.height,y[y.length]={source:A,difference:H,offset:j})}if(!t.getTool)this.createGuidelines(t,l,c,r,e,i,s);!e.snapped&&m.length>0&&(e.left||e.right)&&this.addSameWidthLines(t,r,m,e,s,a),!i.snapped&&y.length>0&&(i.top||i.bottom)&&this.addSameHeightLines(t,r,y,i,s,a)},t.prototype.snapTop=function(t,e,i,r,n,o,a,s){var h,d=n;e.top=!0,t.left=t.right=!1;var l=this.diagram.scroller.currentZoom;if(this.diagram.snapSettings.constraints&it.SnapToObject&&!o.rotateAngle&&(h=s.y-s.height*o.pivot.y+n-(o.offsetY-o.height*o.pivot.y),this.snapSize(this.diagram,t,e,i,r,h,this.diagram.selectedItems,a)),e.snapped)d=n-h+e.offset;else if(this.diagram.snapSettings.constraints&it.SnapToHorizontalLines){var c=s.y-s.height*o.pivot.y,p=c+n;d=this.round(p,this.diagram.snapSettings.horizontalGridlines.scaledIntervals,l)-c}return d},t.prototype.snapRight=function(t,e,i,r,n,o,a,s){var h,d=r;t.right=!0,e.top=e.bottom=!1;var l=this.diagram.scroller.currentZoom;if(this.diagram.snapSettings.constraints&it.SnapToObject&&!o.rotateAngle&&(h=s.x+s.width*(1-o.pivot.x)+r-(o.offsetX+o.width*(1-o.pivot.x)),this.snapSize(this.diagram,t,e,i,h,n,this.diagram.selectedItems,a)),t.snapped)d=r-h+t.offset;else if(this.diagram.snapSettings.constraints&it.SnapToVerticalLines){var c=s.x+s.width*(1-o.pivot.x),p=c+r;d=this.round(p,this.diagram.snapSettings.verticalGridlines.scaledIntervals,l)-c}return d},t.prototype.snapLeft=function(t,e,i,r,n,o,a,s){var h=r,d=0;t.left=!0,e.top=e.bottom=!1;var l=this.diagram.scroller.currentZoom;if(this.diagram.snapSettings.constraints&it.SnapToObject&&!o.rotateAngle&&(d=s.x-s.width*o.pivot.x+r-(o.offsetX-o.width*o.pivot.x),this.snapSize(this.diagram,t,e,i,d,n,this.diagram.selectedItems,a)),t.snapped)h=r-d+t.offset;else if(this.diagram.snapSettings.constraints&it.SnapToVerticalLines){var c=s.x-s.width*o.pivot.x,p=c+r;h=this.round(p,this.diagram.snapSettings.horizontalGridlines.scaledIntervals,l)-c}return h},t.prototype.snapBottom=function(t,e,i,r,n,o,a,s){var h=n;e.bottom=!0,t.left=t.right=!1;var d=this.diagram.scroller.currentZoom,l=0;this.diagram.snapSettings.constraints&it.SnapToObject&&!o.rotateAngle&&(l=s.y+s.height*(1-o.pivot.y)+n-(o.offsetY+o.height*(1-o.pivot.y)),this.snapSize(this.diagram,t,e,i,r,l,this.diagram.selectedItems,a));R(o instanceof Zt||o instanceof Bi?o:o.wrapper);if(e.snapped)h=n-l+e.offset;else if(this.diagram.snapSettings.constraints&it.SnapToHorizontalLines){var c=s.y+s.height*(1-o.pivot.y),p=c+n;h=this.round(p,this.diagram.snapSettings.horizontalGridlines.scaledIntervals,d)-c}return h},t.prototype.createGuidelines=function(t,e,i,r,n,o,a){return e&&(n.offset=e.offsetX,n.snapped=!0,a||(e.type,this.renderAlignmentLines(e.start,e.end,r,t.scroller.transform))),i&&(o.offset=i.offsetY,o.snapped=!0,a||(i.type,this.renderAlignmentLines(i.start,i.end,r,t.scroller.transform))),r},t.prototype.renderAlignmentLines=function(t,e,i,r){t={x:(t.x+r.tx)*r.scale,y:(t.y+r.ty)*r.scale},e={x:(e.x+r.tx)*r.scale,y:(e.y+r.ty)*r.scale};var n={stroke:this.setSnapLineColor(),strokeWidth:1,startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},fill:this.setSnapLineColor(),dashArray:"",width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,opacity:1,id:E()},o=0;for(this.line.push(n),o=0;o<this.line.length;o++)this.diagram.diagramRenderer.drawLine(i,this.line.pop())},t.prototype.createHSpacingLines=function(t,e,i,r,n,o,a,s,h,d){var l=0;this.sortByDistance(r,"distance",!0),this.sortByDistance(n,"distance",!0);var c,p,g,u,f,m=[];if(c=t.selectedObject.helperObject?R(t.selectedObject.helperObject.wrapper):R(i.wrapper),r.length>0&&(m[m.length]=r[0],l=(p=r[0].obj.bounds).y,r.length>1?(u=r[1].obj.bounds,f=p.x-u.x-u.width,Math.abs(f-r[0].distance)<=d?l=this.findEquallySpacedNodesAtLeft(r,f,l,m):f=r[0].distance):f=r[0].distance),this.sortByDistance(m,"distance"),m[m.length]={obj:i,distance:0},l=c.y<l||!l?c.y:l,n.length>0){var y=void 0;if(l=(g=n[0].obj.bounds).y<l?g.y:l,n.length>1&&(y=(u=n[1].obj.bounds).x-g.x-g.width),r.length>0)if(Math.abs(n[0].distance-r[0].distance)<=d){var v=Math.abs(n[0].distance-r[0].distance)/2;n[0].distance<r[0].distance?f-=v:f+=v,m[m.length]=n[0]}else 1===r.length&&(p=void 0,m.splice(0,1),m[m.length]=n[0],f=y);else f=y,m[m.length]=n[0];n.length>1&&g.x+g.width<u.x&&(l=this.findEquallySpacedNodesAtRight(n,y,l,m,d))}if(m.length>2){this.addHSpacingLines(t,e,m,s,l);var b=0;s&&(b=h.x),p?o.offset=f-Math.abs(c.x+b-p.x-p.width)+b:g&&(o.offset=Math.abs(c.x+c.width+b-g.x)-f+b),o.snapped=!0}},t.prototype.createVSpacingLines=function(t,e,i,r,n,o,a,s,h,d){var l=0;this.sortByDistance(r,"distance",!0),this.sortByDistance(n,"distance",!0);var c,p,g,u,f,m=[],y=R(this.getWrapperObject(i,t.nameTable));if(r.length>0&&(m[m.length]=r[0],l=(c=r[0].obj.bounds).x+c.width,r.length>1?(g=r[1].obj.bounds,u=c.y-g.y-g.height,Math.abs(u-r[0].distance)<=d?l=this.findEquallySpacedNodesAtTop(r,u,l,m):u=r[0].distance):u=r[0].distance),this.sortByDistance(m,"distance"),m[m.length]={obj:i,distance:0},l=y.x+y.width>l||!l?y.x+y.width:l,n.length>0){if(l=(p=n[0].obj.bounds).x+p.width>l?p.x+p.width:l,n.length>1&&(f=(g=n[1].obj.bounds).y-p.y-p.height),r.length>0)if(Math.abs(n[0].distance-r[0].distance)<=d){var v=Math.abs(n[0].distance-r[0].distance)/2;n[0].distance<r[0].distance?u-=v:u+=v,m[m.length]=n[0]}else 1===r.length&&(c=void 0,m.splice(0,1),m[m.length]=n[0],u=f);else u=f,m[m.length]=n[0];n.length>1&&g.y>p.y+p.height&&(l=this.findEquallySpacedNodesAtBottom(n,f,l,m,d))}if(m.length>2){this.addVSpacingLines(t,e,m,s,l);var b=0;s&&(b=h.y),c?a.offset=u-Math.abs(y.y+b-c.y-c.height)+b:p&&(a.offset=Math.abs(y.y+y.height+b-p.y)-u+b),a.snapped=!0}},t.prototype.addHSpacingLines=function(t,e,i,r,n){var o,a,s;if(!r)for(o=0;o<i.length-1;o++){var h=i[parseInt(o.toString(),10)].obj instanceof qh?R(i[parseInt(o.toString(),10)].obj.wrapper):i[parseInt(o.toString(),10)].obj.bounds,d=i[o+1].obj instanceof qh?R(i[o+1].obj.wrapper):i[o+1].obj.bounds;a={x:h.x+h.width,y:n-15},s={x:d.x,y:n-15},this.renderSpacingLines(a,s,e,this.getAdornerLayerSvg(),t.scroller.transform)}},t.prototype.addVSpacingLines=function(t,e,i,r,n){var o,a;if(!r)for(var s=0;s<i.length-1;s++){var h=i[parseInt(s.toString(),10)].obj instanceof qh?R(i[parseInt(s.toString(),10)].obj.wrapper):i[parseInt(s.toString(),10)].obj.bounds,d=i[s+1].obj instanceof qh?R(i[s+1].obj.wrapper):i[s+1].obj.bounds;o={x:n+15,y:h.y+h.height},a={x:n+15,y:d.y},this.renderSpacingLines(o,a,e,this.getAdornerLayerSvg(),t.scroller.transform)}},t.prototype.addSameWidthLines=function(t,e,i,r,n,o){this.sortByDistance(i,"offset");var a,s,h,d=R(o.wrapper),l=i[0],c=l.source.bounds,p=[];for(p.push(i[0]),h=1;h<i.length;h++)i[parseInt(h.toString(),10)].source.bounds.width===c.width&&p.push(i[parseInt(h.toString(),10)]);if(!n)for(a={x:d.x+l.offset,y:d.y-15},s={x:d.x+d.width+l.offset,y:d.y-15},this.renderSpacingLines(a,s,e,this.getAdornerLayerSvg(),t.scroller.transform),h=0;h<p.length;h++)a={x:(d=p[parseInt(h.toString(),10)].source.bounds).x,y:d.y-15},s={x:d.x+d.width,y:d.y-15},this.renderSpacingLines(a,s,e,this.getAdornerLayerSvg(),t.scroller.transform);r.offset=l.offset,r.snapped=!0},t.prototype.addSameHeightLines=function(t,e,i,r,n,o){this.sortByDistance(i,"offset");var a,s,h,d=R(o.wrapper),l=i[0],c=l.source.bounds,p=[];for(p.push(i[0]),h=0;h<i.length;h++)i[parseInt(h.toString(),10)].source.bounds.height===c.height&&p.push(i[parseInt(h.toString(),10)]);if(!n)for(a={x:d.x+d.width+15,y:d.y+l.offset},s={x:d.x+d.width+15,y:d.y+l.offset+d.height},this.renderSpacingLines(a,s,e,this.getAdornerLayerSvg(),t.scroller.transform),h=0;h<p.length;h++)a={x:(d=p[parseInt(h.toString(),10)].source.bounds).x+d.width+15,y:d.y},s={x:d.x+d.width+15,y:d.y+d.height},this.renderSpacingLines(a,s,e,this.getAdornerLayerSvg(),t.scroller.transform);r.offset=l.offset,r.snapped=!0},t.prototype.renderSpacingLines=function(t,e,i,r,n){var o,a,s=new Qt,h={};t={x:(t.x+n.tx)*n.scale,y:(t.y+n.ty)*n.scale},e={x:(e.x+n.tx)*n.scale,y:(e.y+n.ty)*n.scale},t.x===e.x?(o="M"+(t.x-5)+" "+(t.y+5)+"L"+t.x+" "+t.y+"L"+(t.x+5)+" "+(t.y+5)+"zM"+(e.x-5)+" "+(e.y-5)+" L"+e.x+" "+e.y+" L"+(e.x+5)+" "+(e.y-5)+"z",a={startPoint:{x:t.x-8,y:t.y-1},endPoint:{x:t.x+8,y:t.y-1},stroke:this.setSnapLineColor(),strokeWidth:1,fill:this.setSnapLineColor(),dashArray:"",width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,opacity:1,id:E()},s.data=o,h.data=s.data,h.angle=0,h.pivotX=0,h.pivotY=0,h.x=0,h.y=0,h.height=0,h.width=1,h.id=E(),this.diagram.diagramRenderer.drawPath(i,h),this.line.push(a),this.diagram.diagramRenderer.drawLine(i,this.line.pop()),a={startPoint:{x:e.x-8,y:e.y+1},endPoint:{x:e.x+8,y:e.y+1},stroke:this.setSnapLineColor(),strokeWidth:1,fill:this.setSnapLineColor(),dashArray:"",width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,opacity:1,id:this.getAdornerLayerSvg().id+"spacing"},this.line.push(a),this.diagram.diagramRenderer.drawLine(i,this.line.pop())):(o="M"+(t.x+5)+" "+(t.y+5)+" L"+t.x+" "+t.y+" L"+(t.x+5)+" "+(t.y-5)+"zM"+(e.x-5)+" "+(e.y-5)+" L"+e.x+" "+e.y+" L"+(e.x-5)+" "+(e.y+5)+"z",s.data=o,h.data=o,h.angle=0,h.pivotX=0,h.pivotY=0,h.x=0,h.y=0,h.height=0,h.width=1,h.id=E(),this.diagram.diagramRenderer.drawPath(i,h),a={visible:!0,opacity:1,id:E(),startPoint:{x:t.x-1,y:t.y-8},endPoint:{x:t.x-1,y:t.y+8},stroke:this.setSnapLineColor(),strokeWidth:1,fill:this.setSnapLineColor(),dashArray:"0",width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0},this.line.push(a),this.diagram.diagramRenderer.drawLine(i,this.line.pop()),a={width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,opacity:1,id:E(),startPoint:{x:e.x+1,y:e.y-8},endPoint:{x:e.x+1,y:e.y+8},stroke:this.setSnapLineColor(),strokeWidth:1,fill:this.setSnapLineColor(),dashArray:"0"},this.line.push(a),this.diagram.diagramRenderer.drawLine(i,this.line.pop())),a={startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},stroke:this.setSnapLineColor(),strokeWidth:1,fill:this.setSnapLineColor(),dashArray:"0",width:1,x:0,y:0,height:0,angle:0,pivotX:0,pivotY:0,visible:!0,opacity:1,id:E()},this.line.push(a),this.diagram.diagramRenderer.drawLine(i,this.line.pop())},t.prototype.createSnapObject=function(t,e,i){var r;switch(i){case"left":r={start:{x:t.x,y:Math.min(t.y,e.y)},end:{x:t.x,y:Math.max(t.y+t.height,e.y+e.height)},offsetX:t.x-e.x,offsetY:0,type:"sideAlign"};break;case"right":r={type:"sideAlign",start:{x:t.x+t.width,y:Math.min(t.y,e.y)},offsetX:t.x+t.width-e.x-e.width,offsetY:0,end:{x:t.x+t.width,y:Math.max(t.y+t.height,e.y+e.height)}};break;case"top":r={offsetY:t.y-e.y,offsetX:0,type:"sideAlign",start:{x:Math.min(t.x,e.x),y:t.y},end:{x:Math.max(t.x+t.width,e.x+e.width),y:t.y}};break;case"bottom":r={type:"sideAlign",offsetY:t.y+t.height-e.y-e.height,offsetX:0,end:{x:Math.max(t.x+t.width,e.x+e.width),y:t.y+t.height},start:{x:Math.min(t.x,e.x),y:t.y+t.height}};break;case"topBottom":r={start:{x:Math.min(t.x,e.x),y:t.y+t.height},end:{x:Math.max(t.x+t.width,e.x+e.width),y:t.y+t.height},offsetY:t.y+t.height-e.y,offsetX:0,type:"sideAlign"};break;case"bottomTop":r={start:{x:Math.min(t.x,e.x),y:t.y},end:{x:Math.max(t.x+t.width,e.x+e.width),y:t.y},offsetY:t.y-e.y-e.height,offsetX:0,type:"sideAlign"};break;case"leftRight":r={start:{x:t.x+t.width,y:Math.min(t.y,e.y)},end:{x:t.x+t.width,y:Math.max(t.y+t.height,e.y+e.height)},offsetX:t.x+t.width-e.x,offsetY:0,type:"sideAlign"};break;case"rightLeft":r={start:{x:t.x,y:Math.min(t.y,e.y)},end:{x:t.x,y:Math.max(t.y+t.height,e.y+e.height)},offsetX:t.x-e.x-e.width,offsetY:0,type:"sideAlign"};break;case"centerX":r={start:{x:t.x+t.width/2,y:Math.min(t.y,e.y)},end:{x:t.x+t.width/2,y:Math.max(t.y+t.height,e.y+e.height)},offsetX:t.x+t.width/2-(e.x+e.width/2),offsetY:0,type:"centerAlign"};break;case"centerY":r={start:{x:Math.min(t.x,e.x),y:t.y+t.height/2},end:{x:Math.max(t.x+t.width,e.x+e.width),y:t.y+t.height/2},offsetY:t.y+t.height/2-(e.y+e.height/2),offsetX:0,type:"centerAlign"}}return r},t.prototype.snapAngle=function(t,e){var i=this.diagram.snapSettings.snapAngle,r=e%(i||0);return r>=i/2?e+i-r:e-r},t.prototype.canConsider=function(t,e,i){return!this.diagram.selectedItems.nodes.length||this.diagram.selectedItems.nodes[0].id!==i.id},t.prototype.findNodes=function(t,e,i,r,n){for(var o,a,s=[],h=t.findQuads(n?r:i),d=0;d<h.length;d++){var l=h[parseInt(d.toString(),10)];if(l.objects.length>0)for(var c=0;c<l.objects.length;c++)o=l.objects[parseInt(c.toString(),10)],this.diagram.nameTable[o.id]instanceof Co||!o.visible||"SwimLane"===this.diagram.nameTable[o.id].shape.type||this.diagram.nameTable[o.id].isLane||this.diagram.nameTable[o.id].isPhase||this.diagram.nameTable[o.id].isHeader||"helper"===o.id||(a=R(o),-1===s.indexOf(o)&&this.intersectsRect(i,a)&&s.push(o),n&&n.indexOf(o)&&this.intersectsRect(r,a)&&n.push(o))}return s},t.prototype.intersectsRect=function(t,e){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height},t.prototype.getAdornerLayerSvg=function(){return this.diagram.diagramRenderer.adornerSvgLayer},t.prototype.removeGuidelines=function(t){var e=this.getAdornerLayerSvg().getElementById("_SnappingLines"),i=this.getAdornerLayerSvg().getElementById("pivotLine");e&&e.parentNode.removeChild(e),i&&i.parentNode.removeChild(i)},t.prototype.sortByDistance=function(t,e,i){var r,n,o;if(i)for(r=0;r<t.length;r++)for(n=r+1;n<t.length;n++)t[parseInt(r.toString(),10)][""+e]>t[parseInt(n.toString(),10)][""+e]&&(o=t[parseInt(r.toString(),10)],t[parseInt(r.toString(),10)]=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=o);else for(r=0;r<t.length;r++)for(n=r+1;n<t.length;n++)t[parseInt(r.toString(),10)][""+e]<t[parseInt(n.toString(),10)][""+e]&&(o=t[parseInt(r.toString(),10)],t[parseInt(r.toString(),10)]=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=o)},t.prototype.findEquallySpacedNodesAtLeft=function(t,e,i,r){var n,o,a,s;for(s=1;s<t.length&&(n=t[s-1].obj.bounds,o=t[parseInt(s.toString(),10)].obj.bounds,a=n.x-o.x-o.width,Math.abs(a-e)<=1);s++)r[r.length]=t[parseInt(s.toString(),10)],o.y<i&&(i=o.y);return i},t.prototype.findEquallySpacedNodesAtRight=function(t,e,i,r,n){var o,a,s,h,d=t[0].distance;if(Math.abs(e-d)<=n)for(var l=0;l<t.length-1&&(o=t[parseInt(l.toString(),10)].obj,a=t[l+1].obj.bounds,s=o.bounds,h=a.x-s.x-s.width,Math.abs(h-e)<=1);l++)r[r.length]=t[l+1],s.y<i&&(i=s.y);return i},t.prototype.findEquallySpacedNodesAtTop=function(t,e,i,r){for(var n,o,a,s=1;s<t.length&&(n=t[s-1].obj.bounds,o=t[parseInt(s.toString(),10)].obj.bounds,a=n.y-o.y-o.height,Math.abs(a-e)<=1);s++)r[r.length]=t[parseInt(s.toString(),10)],o.x+o.width>i&&(i=o.x+o.width);return i},t.prototype.findEquallySpacedNodesAtBottom=function(t,e,i,r,n){var o,a,s,h,d=t[0].distance;if(Math.abs(e-d)<=n)for(var l=0;l<t.length-1&&(o=t[parseInt(l.toString(),10)].obj,a=t[l+1].obj.bounds,s=o.bounds,h=a.y-s.y-s.height,Math.abs(h-e)<=1);l++)r[r.length]=t[l+1],s.x+s.width>i&&(i=s.x+s.width);return i},t.prototype.getLayer=function(){var t;return this.diagram.snapSettings.constraints&it.SnapToObject&&((t=document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute("id","_SnappingLines"),t.setAttribute("shapeRendering","crispEdges"),this.getAdornerLayerSvg().appendChild(t)),t},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"Snapping"},t}(),Dc=function(){function t(){this.groupUndo=!1,this.childTable=[],this.historyCount=0,this.hasGroup=!1,this.groupCount=0,this.undoOffsets=[],this.checkRedo=!1}return t.prototype.initHistory=function(t){t.historyManager={canRedo:!1,canUndo:!1,currentEntry:null,push:t.addHistoryEntry.bind(t),undo:Function,redo:Function,startGroupAction:t.startGroupAction.bind(t),endGroupAction:t.endGroupAction.bind(t),canLog:null,undoStack:[],redoStack:[],stackLimit:t.historyManager?t.historyManager.stackLimit:void 0}},t.prototype.addHistoryEntry=function(t,e){if("EndGroup"===t.type&&"StartGroup"===e.historyManager.currentEntry.type)return e.historyManager.currentEntry.previous&&(e.historyManager.currentEntry.previous.next=void 0),e.historyManager.currentEntry=e.historyManager.currentEntry.previous,e.historyManager.currentEntry||(e.historyManager.canUndo=!1),!1;var i=null;if(e.historyManager.canLog&&!0===e.historyManager.canLog(t).cancel)return!1;if(e.historyManager&&e.historyManager.canUndo&&e.historyManager.currentEntry&&((i=e.historyManager.currentEntry).next?i.previous&&(i.next.previous=null,i.next=t,t.previous=i):(i.next=t,t.previous=i)),e.historyManager.currentEntry=t,e.historyManager.stackLimit){if("StartGroup"===t.type||"EndGroup"===t.type){var r="EndGroup"===t.type;this.setEntryLimit(r)}this.hasGroup||0!==this.groupCount||(this.historyCount<e.historyManager.stackLimit?this.historyCount++:this.applyLimit(e.historyManager.currentEntry,e.historyManager.stackLimit,e))}return this.getHistoryList(e),e.historyManager.canUndo=!0,e.historyManager.canRedo=!1,!0},t.prototype.applyLimit=function(t,e,i,r){if(t&&t.previous){if("StartGroup"===t.type||"EndGroup"===t.type){var n="StartGroup"===t.type;this.setEntryLimit(n)}this.hasGroup||0!==this.groupCount||e--,0===e?(r&&this.limitHistoryStack(t.previous,i),i.historyManager.stackLimit<this.historyCount&&(this.historyCount=i.historyManager.stackLimit),delete t.previous):t.previous&&this.applyLimit(t.previous,e,i,r)}this.groupCount=0},t.prototype.clearHistory=function(t){var e=t.historyManager;e.currentEntry=void 0,e.canUndo=!1,e.canRedo=!1,this.historyCount=0,this.groupCount=0,t.historyManager.undoStack=[],t.historyManager.redoStack=[]},t.prototype.setEntryLimit=function(t){t?this.groupCount--:this.groupCount++,this.hasGroup=t?!t:t},t.prototype.limitHistoryStack=function(t,e){"StartGroup"!==t.type&&"EndGroup"!==t.type&&(this.removeFromStack(e.historyManager.undoStack,t),this.removeFromStack(e.historyManager.redoStack,t)),t.previous&&this.limitHistoryStack(t.previous,e)},t.prototype.removeFromStack=function(t,e){if(t.length)for(var i=0;i<=t.length;i++)if(t[parseInt(i.toString(),10)].undoObject===e.undoObject&&t[parseInt(i.toString(),10)].redoObject===e.redoObject){t.splice(i,1);break}},t.prototype.undo=function(t){t.checkUndoRedo=!0;var i=this.getUndoEntry(t),r=0;if(i)if("Internal"===i.category)"EndGroup"===i.type?(r++,this.groupUndo=!0):this.undoEntry(i,t),this.groupUndo&&(this.undoGroupAction(i,t,r),this.groupUndo=!1);else{(0,e.isBlazor)()||t.historyManager.undo(i);var n={entryType:"undo",oldValue:i.undoObject,newValue:i.redoObject};t.triggerEvent(xt.historyStateChange,n)}t.checkUndoRedo=!1},t.prototype.getHistoryList=function(t){var e,i,r=[],n=[],o=t.historyManager.currentEntry;for(o=t.historyManager.currentEntry,t.historyManager.canUndo||0===t.historyManager.undoStack.length?this.getHistroyObject(r,o):this.getHistroyObject(n,o);o&&o.previous;)e=o.previous,this.getHistroyObject(r,e),o=o.previous;for(o=t.historyManager.currentEntry;o&&o.next;)i=o.next,this.getHistroyObject(n,i),o=o.next;t.historyManager.undoStack=r,t.historyManager.redoStack=n},t.prototype.getHistroyObject=function(t,e){e&&"StartGroup"!==e.type&&"EndGroup"!==e.type&&t.push({redoObject:e.redoObject?e.redoObject:null,undoObject:e.undoObject?e.undoObject:null,type:e.type?e.type:null,category:e.category?e.category:null})},t.prototype.undoGroupAction=function(t,e,i){for(;0!==i;)this.undoEntry(t,e),"StartGroup"===(t=this.getUndoEntry(e)).type?i--:"EndGroup"===t.type&&i++;i=0},t.prototype.undoEntry=function(t,e){var r,n;if("PropertyChanged"!==t.type&&"CollectionChanged"!==t.type&&"LabelCollectionChanged"!==t.type&&(n=r=t.undoObject?t.undoObject:t.previous.undoObject),"StartGroup"!==t.type&&"EndGroup"!==t.type&&e.historyManager.undoStack.length>0){var o=e.historyManager.undoStack.splice(0,1);e.historyManager.redoStack.splice(0,0,o[0]),n=t.undoObject}switch(e.protectPropertyChange(!0),e.diagramActions|=yt.UndoRedo,t.type){case"PositionChanged":case"Align":case"Distribute":this.recordPositionChanged(r,e);break;case"SizeChanged":case"Sizing":this.recordSizeChanged(r,e,t);break;case"RotationChanged":this.recordRotationChanged(r,e,t,"undo");break;case"ConnectionChanged":this.recordConnectionChanged(r,e);break;case"PropertyChanged":this.recordPropertyChanged(t,e,!1);break;case"CollectionChanged":if(t&&t.next&&"AddChildToGroupNode"===t.next.type&&"Insert"===t.next.changeType){var a=e.getObject(t.next.undoObject.id);e.insertValue(N(a),!0)}if(t.isUndo=!0,this.recordCollectionChanged(t,e),t.isUndo=!1,t&&t.next&&"AddChildToGroupNode"===t.next.type&&"Insert"===t.next.changeType)(a=e.getObject(t.next.undoObject.id)).wrapper.measure(new i),a.wrapper.arrange(a.wrapper.desiredSize),e.updateDiagramObject(a);break;case"LabelCollectionChanged":t.isUndo=!0,this.recordLabelCollectionChanged(t,e),t.isUndo=!1;break;case"PortCollectionChanged":t.isUndo=!0,this.recordPortCollectionChanged(t,e),t.isUndo=!1;break;case"Group":this.unGroup(t,e);break;case"UnGroup":e.itemType="Undo",this.group(t,e);break;case"SegmentChanged":this.recordSegmentChanged(r,e);break;case"PortPositionChanged":this.recordPortChanged(t,e,!1);break;case"AnnotationPropertyChanged":this.recordAnnotationChanged(t,e,!1);break;case"ChildCollectionChanged":this.recordChildCollectionChanged(t,e,!1);break;case"StackChildPositionChanged":this.recordStackPositionChanged(t,e,!1);break;case"RowHeightChanged":this.recordGridSizeChanged(t,e,!1,!0);break;case"ColumnWidthChanged":this.recordGridSizeChanged(t,e,!1,!1);break;case"LanePositionChanged":this.recordLanePositionChanged(t,e,!1);break;case"LaneCollectionChanged":case"PhaseCollectionChanged":t.isUndo=!0,this.recordLaneOrPhaseCollectionChanged(t,e,!1),t.isUndo=!1;break;case"SendToBack":case"SendForward":case"SendBackward":case"BringToFront":this.recordOrderCommandChanged(t,e,!1);break;case"AddChildToGroupNode":this.recordAddChildToGroupNode(t,e,!1);break;case"RemoveChildFromGroupNode":this.recordRemoveChildFromGroupNode(t,e,!1);break;case"ExternalEntry":e.historyManager.undo(t)}if(e.diagramActions&=~yt.UndoRedo,e.protectPropertyChange(!1),e.historyChangeTrigger(t,"Undo"),n){var s=this.checkNodeObject(n,e);if(s){var h=J(e.updateSelection);h&&h(s,e)}}},t.prototype.checkNodeObject=function(t,e){var i;if(t.id)i=e.nameTable[t.id];else if(t.nodes&&t.nodes.length>0||t.connectors&&t.connectors.length>0)for(var r=0,n=t.nodes.length>0?t.nodes:t.connectors;r<n.length;r++)i=n[r],i=e.nameTable[i.id];else{var o=t.nodes?t.nodes:t.connectors;if(o)for(var a=0,s=Object.keys(o);a<s.length;a++){var h=s[a],d=Number(h);i=t.nodes?e.nodes[parseInt(d.toString(),10)]:e.connectors[parseInt(d.toString(),10)]}}return i},t.prototype.group=function(t,e){e.add(t.undoObject)},t.prototype.unGroup=function(t,e){t.redoObject=N(t.undoObject);var i=t.undoObject;e.commandHandler.unGroup(i)},t.prototype.ignoreProperty=function(t){return"zIndex"===t||"wrapper"===t||"parentObj"===t||"controlParent"===t},t.prototype.getProperty=function(t,e){for(var i=0,r=Object.keys(e);i<r.length;i++){var n=r[i];t&&(this.ignoreProperty(n)||(e[""+n]instanceof Object?this.getProperty(t[""+n],e[""+n]):t[""+n]=e[""+n]))}},t.prototype.recordLaneOrPhaseCollectionChanged=function(t,e,i){var r,n=t.redoObject,o=t.undoObject;if(t.isUndo?(e.itemType="Undo",r="Insert"===t.changeType?"Remove":"Insert"):(e.itemType="Redo",r=t.changeType),"Remove"===r)e.remove(n);else if(n.isPhase){var a=e.nameTable[n.parentId];e.addPhases(a,[o])}else{var s=Wr(a=e.nameTable[n.parentId],n);e.addLanes(a,[o],s)}e.clearSelection()},t.prototype.recordAnnotationChanged=function(t,e,i){var r=i?t.redoObject:t.undoObject;if(e.canEnableBlazorObject){var n=N(e.nameTable[r.id]);e.insertValue(n,n instanceof Yh)}var o=is(r,t.objectId),a=e.commandHandler.getAnnotationChanges(e.nameTable[r.id],o),s=e.nameTable[r.id],h=is(s,t.objectId);h.offset=o.offset,h.margin=o.margin,h.width=o.width,h.height=o.height,h.rotateAngle=o.rotateAngle,h.margin=o.margin,s instanceof Yh?e.nodePropertyChange(s,{},a):e.connectorPropertyChange(s,{},a)},t.prototype.recordChildCollectionChanged=function(t,e,i){var r=i?t.redoObject:t.undoObject,n=e.nameTable[r.parentId],o=e.nameTable[r.id];n?vn(e,n,o,!i,"AddNodeToLane"===t.historyAction,i):(o.parentId&&(n=e.nameTable[o.parentId])&&(this.removeChildFromLane(e,n,o),n.children.splice(n.children.indexOf(o.id),1),n.wrapper.children.splice(n.wrapper.children.indexOf(o.wrapper),1)),r.parentId&&""!==r.parentId&&((n=e.nameTable[r.parentId]).children.push(r.id),n.wrapper.children.push(o.wrapper)),o.parentId=r.parentId,e.removeElements(o),e.updateDiagramObject(o))},t.prototype.removeChildFromLane=function(t,e,i){var r=t.nameTable[e.parentId];if(r&&r.shape&&r.shape.lanes.length>0){var n="Horizontal"===r.shape.orientation,o=0;r.shape.phases.length>0&&r.shape.phaseSize>0||(o=1);var a=n?r.shape.hasHeader?e.rowIndex-(2-o):e.rowIndex-(1-o):e.columnIndex-(1-o),s=r.shape.lanes[parseInt(a.toString(),10)];if(s&&s.children&&s.children.length>0)for(var h=s.children.length-1;h>=0;h--)s.children[parseInt(h.toString(),10)].id===i.id&&s.children.splice(h,1)}},t.prototype.recordStackPositionChanged=function(t,e,r){var n=r?t.redoObject:t.undoObject;if(n.source){var o=e.nameTable[n.source.parentId];o&&(n.target?(o.wrapper.children.splice(n.targetIndex,1),o.wrapper.children.splice(n.sourceIndex,0,n.source.wrapper)):void 0!==n.sourceIndex?(e.nameTable[n.source.id]||e.add(n.source),o.wrapper.children.splice(n.sourceIndex,0,e.nameTable[n.source.id].wrapper),e.nameTable[n.source.id].parentId=o.id):(o.wrapper.children.splice(o.wrapper.children.indexOf(e.nameTable[n.source.id].wrapper),1),e.nameTable[n.source.id].parentId=""),r&&"UmlClassifier"===o.shape.type&&e.remove(n.source),o.wrapper.measure(new i),o.wrapper.arrange(o.wrapper.desiredSize),e.updateDiagramObject(o),e.updateSelector())}},t.prototype.recordGridSizeChanged=function(t,e,i,r){var n=i?t.redoObject:t.undoObject,o=i?t.undoObject:t.redoObject;if(n.parentId){var a=e.nameTable[n.parentId],s=e.nameTable[n.id],h=a.wrapper.bounds.x,d=a.wrapper.bounds.y;if("SwimLane"===a.shape.type){var l=a.wrapper.children[0],c=a.shape.padding,p=!1;e.diagramActions&yt.UndoRedo&&(p=!0);var g=0,u=0;n.wrapper&&n.wrapper.actualSize&&o.wrapper&&o.wrapper.actualSize&&(g=n.wrapper.actualSize.width-o.wrapper.actualSize.width,u=n.wrapper.actualSize.height-o.wrapper.actualSize.height),Hr(e,o,a,n,g,u),r?(l.updateRowHeight(n.rowIndex,n.wrapper.actualSize.height,!0,c,p),a.height=a.wrapper.height=l.height):(l.updateColumnWidth(n.columnIndex,n.wrapper.actualSize.width,!0,c,p),a.width=a.wrapper.width=l.width,n.isPhase&&(s.maxWidth=s.wrapper.maxWidth=n.wrapper.actualSize.width)),Mr(a);var f=h-a.wrapper.bounds.x,m=d-a.wrapper.bounds.y;e.drag(a,f,m),e.clearSelection(),e.updateDiagramObject(a)}}},t.prototype.recordLanePositionChanged=function(t,e,i){var r=i?t.redoObject:t.undoObject;if(r.source){var n=e.nameTable[r.source.parentId];n&&"SwimLane"===n.shape.type&&(Nr(e,r.target,r.source),e.clearSelection())}},t.prototype.recordPortChanged=function(t,e,i){var r=i?t.redoObject.nodes[0]:t.undoObject.nodes[0];if(e.canEnableBlazorObject){var n=N(e.nameTable[r.id]);e.insertValue(n,!0)}var o=rs(r,t.objectId),a=e.commandHandler.getPortChanges(e.nameTable[r.id],o),s=e.nameTable[r.id];rs(s,t.objectId).offset=o.offset,e.nodePropertyChange(s,{},a),s.parentId&&e.updateConnectorEdges(e.nameTable[s.parentId])},t.prototype.recordPropertyChanged=function(t,e,i){var r=t.redoObject,n=t.undoObject;this.getProperty(e,i?r:n),i?e.onPropertyChanged(r,n):e.onPropertyChanged(n,r),e.diagramActions=e.diagramActions|yt.UndoRedo},t.prototype.recordOrderCommandChanged=function(t,e,i){var r=t.redoObject,n=t.undoObject;e.commandHandler.orderCommands(i,i?r:n,t.type),e.diagramActions=e.diagramActions|yt.UndoRedo},t.prototype.recordAddChildToGroupNode=function(t,e,i){var r=e.nameTable[t.undoObject.id],n=e.nameTable[t.objectId];i&&"Insert"===t.changeType?e.addChildToGroup(r,n.id):e.removeChildFromGroup(r,n.id)},t.prototype.recordRemoveChildFromGroupNode=function(t,e,i){var r=e.nameTable[t.undoObject.id],n=e.nameTable[t.objectId];i&&"Remove"===t.changeType?e.removeChildFromGroup(r,n.id):e.addChildToGroup(r,n.id)},t.prototype.recordSegmentChanged=function(t,e){var i,r=0;if(t.connectors&&t.connectors.length>0)for(r=0;r<t.connectors.length;r++)i=t.connectors[parseInt(r.toString(),10)],this.segmentChanged(i,e)},t.prototype.segmentChanged=function(t,e){var i=e.nameTable[t.id];i&&(i.segments=t.segments,e.commandHandler.updateEndPoint(i))},t.prototype.recordPositionChanged=function(t,e){var i,r,n=0;if(t.nodes&&t.nodes.length>0){for(n=0;n<t.nodes.length;n++)e.bpmnModule&&(e.isPositionUndo=!0),i=t.nodes[parseInt(n.toString(),10)],this.positionChanged(i,e);e.isPositionUndo=!1}if(t.connectors&&t.connectors.length>0)for(n=0;n<t.connectors.length;n++)r=t.connectors[parseInt(n.toString(),10)],this.segmentChanged(r,e),this.connectionChanged(r,e)},t.prototype.positionChanged=function(t,e){var i=e.nameTable[t.id];if(t.processId&&!i.processId&&e.addProcess(t,t.processId),!t.processId&&i.processId&&e.removeProcess(t.id),t.parentId&&"Container"===e.nameTable[t.parentId].shape.type&&!i.parentId&&hh(t,t.parentId,e),!t.parentId&&i.parentId&&"Container"===e.nameTable[i.parentId].shape.type&&dh(i,e),i.processId||i.parentId&&e.nameTable[i.parentId]&&"Container"===e.nameTable[i.parentId].shape.type){var r=t.margin.left-i.margin.left,n=t.margin.top-i.margin.top;e.drag(i,r,n)}else{if(i.parentId){var o=e.nameTable[i.parentId];o.isLane&&(t.wrapper.offsetX=t.width/2+(o.wrapper.bounds.x+t.margin.left),t.wrapper.offsetY=t.height/2+(o.wrapper.bounds.y+t.margin.top))}r=t.wrapper.offsetX-i.offsetX,n=t.wrapper.offsetY-i.offsetY;e.drag(i,r,n)}e.bpmnModule&&e.bpmnModule.updateDocks(i,e)},t.prototype.recordSizeChanged=function(t,e,i){var r,n,o=0;if(t&&t.nodes&&t.nodes.length>0)for(o=0;o<t.nodes.length;o++)if((n=t.nodes[parseInt(o.toString(),10)]).children&&!n.container)for(var a=e.commandHandler.getAllDescendants(n,[]),s=0;s<a.length;s++){var h=i.childTable[a[parseInt(s.toString(),10)].id];vs(h)===Yh?(this.sizeChanged(h,e,i),this.positionChanged(h,e)):this.connectionChanged(h,e,i)}else e.bpmnModule&&(e.sizeUndo=!0),this.sizeChanged(n,e),this.positionChanged(n,e),e.bpmnModule&&(e.sizeUndo=!1);if(t&&t.connectors&&t.connectors.length>0){var d=t.connectors;for(o=0;o<d.length;o++)r=d[parseInt(o.toString(),10)],this.segmentChanged(r,e),this.connectionChanged(r,e)}e.updateSelector()},t.prototype.sizeChanged=function(t,e,i){var r=e.nameTable[t.id],n=t.wrapper.actualSize.width/r.wrapper.actualSize.width,o=t.wrapper.actualSize.height/r.wrapper.actualSize.height;i&&i.childTable&&(i.childTable[t.id]=N(r)),e.scale(r,n,o,{x:t.wrapper.offsetX/r.wrapper.offsetX,y:t.wrapper.offsetY/r.wrapper.offsetY})},t.prototype.recordRotationChanged=function(t,e,i,r){var n,o,a=0,s=e.selectedItems;if(s.rotateAngle=t.rotateAngle,s&&s.wrapper&&(s.wrapper.rotateAngle=t.rotateAngle),e.fromUndo=!0,t&&t.nodes&&t.nodes.length>0)for(a=0;a<t.nodes.length;a++){var h=!1;if((n=t.nodes[parseInt(a.toString(),10)]).children&&n.children.length>0){for(var d=0;d<n.children.length;d++){var l=e.nameTable[n.children[parseInt(d.toString(),10)]];if(vs(l)!==Yh&&(""===l.sourceID||""===l.targetID)){h=!0;break}}if(h&&Object.keys(i.childTable).length>0){for(var c=e.commandHandler.getAllDescendants(n,[]),p=0;p<c.length;p++){var g=i.childTable[c[parseInt(p.toString(),10)].id];if(vs(g)===Yh){var u={id:"",rotateAngle:0,wrapper:{offsetX:0,offsetY:0}};if("redo"===r?(u.id=g.id,u.rotateAngle=n.rotateAngle):u=g,this.rotationChanged(u,e),"undo"===r){var f=e.nameTable[u.id];this.undoOffsets.push({id:f.id,offsetX:f.offsetX,offsetY:f.offsetY})}else{for(var m=-1,y=this.undoOffsets.length-1;y>=0;y--)if(this.undoOffsets[parseInt(y.toString(),10)].id===u.id){u.wrapper=this.undoOffsets[parseInt(y.toString(),10)],m=y;break}-1!==m&&this.undoOffsets.splice(m,1)}this.positionChanged(u,e)}else this.connectionChanged(g,e,i)}e.nameTable[n.id].rotateAngle=t.rotateAngle,e.updateSelector(),this.rotationChanged(n,e)}else this.rotationChanged(n,e),this.positionChanged(n,e)}else this.rotationChanged(n,e),this.positionChanged(n,e)}if(e.fromUndo=!1,t&&t.connectors&&t.connectors.length>0)for(a=0;a<t.connectors.length;a++)o=t.connectors[parseInt(a.toString(),10)],this.segmentChanged(o,e),this.connectionChanged(o,e)},t.prototype.rotationChanged=function(t,e){var i=e.nameTable[t.id];e.rotate(i,t.rotateAngle-i.rotateAngle)},t.prototype.recordConnectionChanged=function(t,e){var i;(i=t&&t.connectors?t.connectors[0]:t).sourceID&&e.nameTable[i.sourceID]&&e.insertValue(e.nameTable[i.sourceID],!0),i.targetID&&e.nameTable[i.targetID]&&e.insertValue(e.nameTable[i.targetID],!0),(i instanceof Co||"None"===i.shape.type||"Bpmn"===i.shape.type)&&this.connectionChanged(i,e)},t.prototype.connectionChanged=function(t,e,i){var r=e.nameTable[t.id];if(r){var n;if(t.sourcePortID!==r.sourcePortID&&(e.removePortEdges(e.nameTable[r.sourceID],r.sourcePortID,r.id,!1),r.sourcePortID=t.sourcePortID,r.segments=t.segments,e.connectorPropertyChange(r,{},{sourcePortID:t.sourcePortID})),t.targetPortID!==r.targetPortID&&(e.removePortEdges(e.nameTable[r.targetID],r.targetPortID,r.id,!0),r.targetPortID=t.targetPortID,r.segments=t.segments,e.connectorPropertyChange(r,{},{targetPortID:t.targetPortID})),t.sourceID!==r.sourceID){if(""===t.sourceID||null===t.sourceID?qa((n=e.nameTable[r.sourceID]).outEdges,t.id):((n=e.nameTable[t.sourceID]).outEdges.push(t.id),e.updatePortEdges(n,t,!1)),r.sourceID=t.sourceID,r.isBpmnAnnotationConnector)e.nameTable[r.targetID].shape.textAnnotation.textAnnotationTarget=r.sourceID;r.segments=t.segments,e.connectorPropertyChange(r,{},{sourceID:t.sourceID})}t.targetID!==r.targetID&&(""===t.targetID||null===t.targetID?qa((n=e.nameTable[r.targetID]).inEdges,t.id):((n=e.nameTable[t.targetID]).inEdges.push(t.id),e.updatePortEdges(n,t,!0)),r.targetID=t.targetID,r.segments=t.segments,e.connectorPropertyChange(r,{},{targetID:t.targetID})),i&&i.childTable&&(i.childTable[t.id]=N(r));var o=t.sourcePoint.x-r.sourcePoint.x,a=t.sourcePoint.y-r.sourcePoint.y;0===o&&0===a||(r.segments=t.segments,e.dragSourceEnd(r,o,a));var s=t.targetPoint.x-r.targetPoint.x,h=t.targetPoint.y-r.targetPoint.y;0===s&&0===h||(r.segments=t.segments,e.dragTargetEnd(r,s,h)),e.updateSelector(),"SVG"!==e.mode&&e.refreshDiagramLayer()}},t.prototype.recordCollectionChanged=function(t,e){var i=t.undoObject;if(t&&t.changeType){var r=void 0;if(t.isUndo?(e.itemType="Undo",r="Insert"===t.changeType?"Remove":"Insert"):(e.itemType="Redo",r=t.changeType),"Remove"===r)if(i.nodeId)e.remove(e.nameTable[i.nodeId+"_textannotation_"+i.id]);else{if(e.remove(i),i.parentId)(n=e.nameTable[i.parentId])&&this.removeChildFromLane(e,n,i);e.clearSelectorLayer()}else{var n;if(e.clearSelectorLayer(),i.parentId&&e.nameTable[i.parentId]&&"Container"!==e.nameTable[i.parentId].shape.type)(n=e.nameTable[i.parentId])?e.addChild(n,i):e.add(i);else i.nodeId?e.addTextAnnotation(i,e.nameTable[i.nodeId]):e.nameTable[i.id]||(i&&i.shape&&"SwimLane"===i.shape.type&&t.isUndo&&qr(i,void 0,void 0,void 0,void 0,!0),this.updateConnectorZindex(i,e),e.add(i));i.processId&&e.nameTable[i.processId]&&e.addProcess(i,i.processId),i.parentId&&e.nameTable[i.parentId]&&"Container"===e.nameTable[i.parentId].shape.type&&hh(i,i.parentId,e)}"SVG"!==e.mode&&e.refreshDiagramLayer(),e.itemType="PublicMethod"}},t.prototype.updateConnectorZindex=function(t,e){if(t.sourceID||t.targetID){var i=e.nameTable[t.sourceID],r=e.nameTable[t.targetID];if(i&&i.parentId){var n=e.nameTable[i.parentId];if(n&&n.isLane)(o=e.nameTable[n.parentId])&&o.zIndex>t.zIndex&&yn(t,o,e)}else if(r&&r.parentId){var o,a=e.nameTable[r.parentId];if(a&&a.isLane)(o=e.nameTable[a.parentId])&&o.zIndex>t.zIndex&&yn(t,o,e)}}},t.prototype.recordLabelCollectionChanged=function(t,e){var i=t.undoObject,r=t.redoObject,n=e.nameTable[r.id];if(t&&t.changeType){"Remove"===(t.isUndo?"Insert"===t.changeType?"Remove":"Insert":t.changeType)?(e.removeLabels(n,[i]),e.clearSelectorLayer()):(e.clearSelectorLayer(),e.addLabels(n,[i])),"SVG"!==e.mode&&e.refreshDiagramLayer()}},t.prototype.recordPortCollectionChanged=function(t,e){var i=t.undoObject,r=t.redoObject,n=e.nameTable[r.id];if(t&&t.changeType){"Remove"===(t.isUndo?"Insert"===t.changeType?"Remove":"Insert":t.changeType)?(e.removePorts(n,[i]),e.clearSelectorLayer()):(e.clearSelectorLayer(),e.addPorts(n,[i])),"SVG"!==e.mode&&e.refreshDiagramLayer()}},t.prototype.redo=function(t){t.checkUndoRedo=!0,this.checkRedo=!0;var i=this.getRedoEntry(t),r=0;if(i)if("Internal"===i.category)"StartGroup"===i.type?(r++,this.groupUndo=!0):this.redoEntry(i,t),this.groupUndo&&(this.redoGroupAction(i,t,r),this.groupUndo=!1);else{(0,e.isBlazor)()||t.historyManager.redo(i);var n={entryType:"redo",oldValue:i.redoObject,newValue:i.undoObject};t.triggerEvent(xt.historyStateChange,n)}this.checkRedo=!1,t.checkUndoRedo=!1},t.prototype.redoGroupAction=function(t,e,i){for(;0!==i;)this.redoEntry(t,e),"EndGroup"===(t=this.getRedoEntry(e)).type?i--:"StartGroup"===t.type&&i++;i=0},t.prototype.redoEntry=function(t,e){var i,r;if("PropertyChanged"!==t.type&&"CollectionChanged"!==t.type&&(i=t.redoObject,r=t.redoObject),e.diagramActions|=yt.UndoRedo,"StartGroup"!==t.type&&"EndGroup"!==t.type&&e.historyManager.redoStack.length>0){var n=e.historyManager.redoStack.splice(0,1);e.historyManager.undoStack.splice(0,0,n[0]),r=t.redoObject}switch(e.protectPropertyChange(!0),t.type){case"PositionChanged":case"Align":case"Distribute":this.recordPositionChanged(i,e);break;case"SizeChanged":case"Sizing":this.recordSizeChanged(i,e,t);break;case"RotationChanged":this.recordRotationChanged(i,e,t,"redo");break;case"ConnectionChanged":this.recordConnectionChanged(i,e);break;case"PropertyChanged":this.recordPropertyChanged(t,e,!0);break;case"CollectionChanged":this.recordCollectionChanged(t,e);break;case"LabelCollectionChanged":this.recordLabelCollectionChanged(t,e);break;case"PortCollectionChanged":this.recordPortCollectionChanged(t,e);break;case"Group":e.itemType="Redo",this.group(t,e);break;case"UnGroup":this.unGroup(t,e);break;case"SegmentChanged":this.recordSegmentChanged(i,e);break;case"PortPositionChanged":this.recordPortChanged(t,e,!0);break;case"AnnotationPropertyChanged":this.recordAnnotationChanged(t,e,!0);break;case"ChildCollectionChanged":this.recordChildCollectionChanged(t,e,!0);break;case"StackChildPositionChanged":this.recordStackPositionChanged(t,e,!0);break;case"RowHeightChanged":this.recordGridSizeChanged(t,e,!0,!0);break;case"ColumnWidthChanged":this.recordGridSizeChanged(t,e,!0,!1);break;case"LanePositionChanged":this.recordLanePositionChanged(t,e,!0);break;case"LaneCollectionChanged":case"PhaseCollectionChanged":this.recordLaneOrPhaseCollectionChanged(t,e,!0);break;case"SendToBack":case"SendForward":case"SendBackward":case"BringToFront":this.recordOrderCommandChanged(t,e,!0);break;case"AddChildToGroupNode":this.recordAddChildToGroupNode(t,e,!0);break;case"RemoveChildFromGroupNode":this.recordRemoveChildFromGroupNode(t,e,!0);break;case"ExternalEntry":e.historyManager.redo(t)}if(e.protectPropertyChange(!1),e.diagramActions&=~yt.UndoRedo,e.historyChangeTrigger(t,"Redo"),r){var o=this.checkNodeObject(r,e);if(o){var a=J(e.updateSelection);a&&a(o,e)}}},t.prototype.getUndoEntry=function(t){var e,i=null,r=t.historyManager;return r.canUndo&&(i=r.currentEntry,(e=r.currentEntry.previous)?(r.currentEntry=e,r.canRedo||(r.canRedo=!0)):(r.canRedo=!0,r.canUndo=!1)),i},t.prototype.getRedoEntry=function(t){var e,i=null,r=t.historyManager;return r.canRedo&&((e=r.currentEntry.previous||r.canUndo?r.currentEntry.next:r.currentEntry)&&(r.currentEntry=e,r.canUndo||(r.canUndo=!0),e.next||(r.canRedo=!1,r.canUndo=!0)),i=r.currentEntry),i},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"UndoRedo"},t}(),Mc=function(){function t(){this.protectChange=!1,this.setIntervalObject=[]}return t.prototype.expand=function(t,e,i,r){var n=this,o=0;if(r.realActions=r.realActions|bt.AnimationClick,this.setIntervalObject[parseInt((0).toString(),10)]=setInterval(function(){return o++,n.layoutAnimation(e,n.setIntervalObject,6===o,r,i)},20),i.isExpanded){var a=.2;r.protectPropertyChange(!1);var s={};if(t){this.updateOpacity(i,a,r);s[parseInt((0).toString(),10)]=setInterval(function(){r.allowServerDataBinding=!1,a<=1?n.updateOpacity(i,a,r):clearInterval(s[0]),a+=.2,r.allowServerDataBinding=!0},20)}}},t.prototype.stopCurrentAnimation=function(t,e,i){clearInterval(this.setIntervalObject[0]),this.setIntervalObject=[];for(var r=0;r<t.objects.length;r++){var n=e.nameTable[t.objects[parseInt(r.toString(),10)].id];n.offsetX+=t.objects[parseInt(r.toString(),10)].differenceX-t.objects[parseInt(r.toString(),10)].differenceX/5,n.offsetY+=t.objects[parseInt(r.toString(),10)].differenceY-t.objects[parseInt(r.toString(),10)].differenceY/5}e.realActions=e.realActions&bt.AnimationClick,e.refreshCanvasLayers(),e.protectPropertyChange(!0),e.triggerEvent(xt.animationComplete,void 0),e.layout.fixedNode="",e.protectPropertyChange(this.protectChange);var o={element:N(i),state:!!i.isExpanded};e.triggerEvent(xt.expandStateChange,o),e.lineRoutingModule&&e.constraints&ct.LineRouting&&e.resetSegments()},t.prototype.layoutAnimation=function(t,e,i,r,n){if(!i)for(var o=0;o<t.objects.length;o++){var a=r.nameTable[t.objects[parseInt(o.toString(),10)].id];a.offsetX+=t.objects[parseInt(o.toString(),10)].differenceX/5,a.offsetY+=t.objects[parseInt(o.toString(),10)].differenceY/5}if(i){clearInterval(e[0]),this.setIntervalObject=[],r.realActions=r.realActions&~bt.AnimationClick,r.refreshCanvasLayers(),r.protectPropertyChange(!0),r.triggerEvent(xt.animationComplete,void 0),r.organizationalChartModule.isAnimation=!1,r.layout.fixedNode="",r.protectPropertyChange(this.protectChange);var s={element:N(n),state:!!n.isExpanded};r.triggerEvent(xt.expandStateChange,s),r.lineRoutingModule&&r.constraints&ct.LineRouting&&r.resetSegments()}},t.prototype.updateOpacity=function(t,e,i){for(var r=0;r<t.outEdges.length;r++){var n=i.nameTable[t.outEdges[parseInt(r.toString(),10)]],o=i.nameTable[n.targetID];n.style.opacity=e;for(var a=0;a<n.wrapper.children.length;a++)n.wrapper.children[parseInt(a.toString(),10)].style.opacity=e,o.style.opacity=e,o.wrapper instanceof Ut&&i.updateNodeProperty(o.wrapper,void 0,e);this.updateOpacity(o,e,i)}},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"LayoutAnimate"},t}(),Lc=function(){function t(t,e,i){this.startPoint=t,this.endPoint=e,this.previous=i,i&&(i.next=this);var r=t.x===e.x;this.coordinate=r?t.x:t.y,this.sortedStart=r?Math.min(t.y,e.y):Math.min(t.x,e.x),this.sortedEnd=r?Math.max(t.y,e.y):Math.max(t.x,e.x),this.direction=r?t.y<e.y?"Bottom":"Top":t.x<e.x?"Right":"Left",this.startEvent=new Ec(this,!0),this.endEvent=new Ec(this,!1)}return t.prototype.updateCoordinate=function(t){this.coordinate+=t;var e="Left"===this.direction||"Right"===this.direction,i=e?{x:this.startPoint.x,y:this.coordinate}:{x:this.coordinate,y:this.startPoint.y},r=e?{x:this.endPoint.x,y:this.coordinate}:{x:this.coordinate,y:this.endPoint.y};this.startPoint=i,this.previous&&this.previous.adjustEnd(i),this.endPoint=r,this.next&&this.next.adjustStart(r)},t.prototype.adjustStart=function(t){this.startPoint=t,this.updateSortedValues()},t.prototype.adjustEnd=function(t){this.endPoint=t,this.updateSortedValues()},t.prototype.updateSortedValues=function(){var t="Top"===this.direction||"Bottom"===this.direction;this.sortedStart=t?Math.min(this.startPoint.y,this.endPoint.y):Math.min(this.startPoint.x,this.endPoint.x),this.sortedEnd=t?Math.max(this.startPoint.y,this.endPoint.y):Math.max(this.startPoint.x,this.endPoint.x),this.startEvent.refresh(),this.endEvent.refresh()},t}(),Ec=function(){function t(t,e){this.segment=t,this.isStart=e,this.value=e?t.sortedStart:t.sortedEnd}return t.prototype.refresh=function(){this.value=this.isStart?this.segment.sortedStart:this.segment.sortedEnd},t.prototype.compareTo=function(t){return this.value!==t.value?this.value<t.value?-1:1:this.isStart?-1:t.isStart?1:0},t}(),zc=function(){function t(){this.horizontalBranches=new Map,this.verticalBranches=new Map}return t.prototype.addSegment=function(t){var e=this.getBranches(t.direction);this.addSegmentToBranch(e,t)},t.prototype.addSegmentToBranch=function(t,e){t.has(e.coordinate)||t.set(e.coordinate,new Set);var i=t.get(e.coordinate);i&&(i.add(e.startEvent),i.add(e.endEvent))},t.prototype.removeSegment=function(t){var e=this.getBranches(t.direction);this.removeSegmentFromBranch(e,t)},t.prototype.removeSegmentFromBranch=function(t,e){var i=t.get(e.coordinate);i&&(i.delete(e.startEvent),i.delete(e.endEvent),0===i.size&&t.delete(e.coordinate))},t.prototype.findOverlappingSegments=function(t){var e=this.getBranches(t.direction);return this.findOverlappingSegmentsInBranch(e,t)},t.prototype.findOverlappingSegmentsInBranch=function(t,e){var i=[],r=new Set,n=t.get(e.coordinate);if(n){var o=[];n.forEach(function(t){return o.push(t)});for(var a=0;a<o.length;a++){var s=o[parseInt(a.toString(),10)];if(s.segment.sortedStart<e.sortedStart&&s.segment.sortedEnd>e.sortedEnd||!(s.value<e.sortedStart||s.value>e.sortedEnd))if(s.segment!==e&&!r.has(s.segment))r.add(s.segment),Math.max(e.sortedStart,s.segment.sortedStart)<Math.min(e.sortedEnd,s.segment.sortedEnd)&&i.push(s.segment)}}return i},t.prototype.getBranches=function(t){return"Left"===t||"Right"===t?this.horizontalBranches:this.verticalBranches},t}(),kc=function(){function t(t){this.requireReroute=!1,this.reRoutedCount=0,this.considerNonWalkable=[],this.diagram=t,this.segmentTree=new zc,this.segmentMappings=new Map,this.connectorMappings=new Map,this.modifiedConnector=new Set,this.modifiedSegments=new Map,this.currentSegments=new Map}return t.prototype.getModifiedConnector=function(){return this.modifiedConnector},t.prototype.getModifiedConnectorSegments=function(t){var e=this.segmentMappings.get(t);return this.convertSegmentsToOrthogonal(e)},t.prototype.refreshModifiedConnectors=function(t){var e=this;this.modifiedConnector.forEach(function(i){var r=e.getModifiedConnectorSegments(i);r.length&&(i.segments=r,t.connectorPropertyChange(i,{},{type:"Orthogonal",segments:r}))}),this.modifiedConnector.clear()},t.prototype.removeConnectors=function(t){for(var e=0;e<t.length;e++){var i=t[parseInt(e.toString(),10)],r=void 0;"string"==typeof i?r=this.diagram.nameTable[i]:i instanceof Co&&(r=i),r&&"Orthogonal"===r.type&&this.removeConnector(r)}},t.prototype.removeConnector=function(t){var e=this,i=this.segmentMappings.get(t);i&&i.forEach(function(t){e.segmentTree.removeSegment(t),e.connectorMappings.delete(t)}),this.segmentMappings.delete(t)},t.prototype.addConnector=function(t,e,i){var r=this;if(void 0===e&&(e=[]),void 0===i&&(i=[]),!this.diagram.lineDistributionModule){0===e.length&&(e=t.intermediatePoints),this.removeConnector(t);var n=this.createLineSegments(e);if(this.mapSegmentsToConnector(t,n),e.length>3)this.adjustConnector(t);else{for(var o=new Set,a=0,s=n;a<s.length;a++)for(var h=s[a],d=0,l=this.segmentTree.findOverlappingSegments(h);d<l.length;d++){var c=l[d],p=this.connectorMappings.get(c);o.add(p)}o.forEach(function(t){return r.adjustConnector(t)})}}},t.prototype.createLineSegments=function(t){for(var e=[],i=0;i<t.length-1;i++){var r=new Lc(t[parseInt(i.toString(),10)],t[parseInt((i+1).toString(),10)],0===i?null:e[parseInt((i-1).toString(),10)]);e.push(r)}return e},t.prototype.mapSegmentsToConnector=function(t,e){var i=this;this.segmentMappings.set(t,e),e.forEach(function(e){i.segmentTree.addSegment(e),i.connectorMappings.has(e)||i.connectorMappings.set(e,t)})},t.prototype.convertSegmentsToOrthogonal=function(t){var e=[];return t&&t.forEach(function(t){var i={type:"Orthogonal",direction:t.direction,length:Math.abs(t.sortedEnd-t.sortedStart)};e.push(i)}),e},t.prototype.adjustConnector=function(e){var i=this;this.requireReroute=!1;var r=this.segmentMappings.get(e);if(r.length>2){var n=r[0],o=this.diagram.nameTable[e.sourceID];if(o&&o.outEdges.length>0){for(var a=void 0,s=0;s<o.outEdges.length;s++){var h=this.diagram.nameTable[o.outEdges[parseInt(s.toString(),10)]];if(h!==e){var d=this.segmentMappings.get(h);if(d&&d.length>2){var l=d[0];l.direction===n.direction&&l.next.direction===n.next.direction&&(a?Math.abs(n.coordinate-l.coordinate)<Math.abs(n.coordinate-a.coordinate)&&(a=l):a=l)}}}if(a){var c=a.next.coordinate-n.next.coordinate;if(c){var p=n.next.next,g=n.direction!==p.direction;if(n.direction===p.direction){var u=this.calculateMaximumSegmentShift(n,p,p.direction);g=Math.abs(c)<=u}g&&(this.modifiedSegments.clear(),this.segmentTree.removeSegment(n.next),n.next.updateCoordinate(c),this.segmentTree.addSegment(n.next),this.modifiedSegments.set(n.next,n.next.coordinate),this.modifiedConnector.add(e))}}}}for(var f=void 0,m=0;m<r.length-1;m++){var y=r[parseInt(m.toString(),10)];if(y.previous&&y.next){var v=this.segmentTree.findOverlappingSegments(y);if(v.length>0&&!this.resolveOverlappingSegments(y,v)&&this.requireReroute){f=y;break}}}if(f&&this.diagram.lineRoutingModule&&this.reRoutedCount<=t.maxReRouteLimit){for(;this.considerNonWalkable.length>0;){this.considerNonWalkable.pop().walkable=!0}this.diagram.lineRoutingModule.getGridsIntersect(f.startPoint,f.endPoint).forEach(function(t){t.walkable=!1,i.considerNonWalkable.push(t)}),this.reRoutedCount++,this.diagram.lineRoutingModule.refreshConnectorSegments(this.diagram,e,!1)}for(this.reRoutedCount=0;this.considerNonWalkable.length>0;){this.considerNonWalkable.pop().walkable=!0}},t.prototype.resolveOverlappingSegments=function(t,e){this.modifiedSegments.clear(),this.currentSegments.clear(),this.rootShiftingSegment=t;var i=this.shouldAdjustSelfFirst(t,e),r=e[0],n=i?this.calculateShiftDirection(t,e):this.calculateShiftDirection(r,this.segmentTree.findOverlappingSegments(r)),o=!1;if(i){var a=1===e.length?r:void 0;(o=this.attemptAdjustment(t,n,a))||(n=Ti(n),o=this.attemptAdjustment(t,n,a,!0))}else(o=this.attemptAdjustment(r,n,t))||(n=Ti(n),o=this.attemptAdjustment(r,n,t,!0));return this.updateSegmentTreeWithModifiedSegments(),this.rootShiftingSegment=void 0,o},t.prototype.shouldAdjustSelfFirst=function(t,e){var i=e.length>1;if(1===e.length){var r=e[0];if(r.previous&&r.next){var n=Math.max(t.sortedStart,r.sortedStart),o=Math.min(t.sortedEnd,r.sortedEnd);(o-n)/(t.sortedEnd-t.sortedStart)>=(o-n)/(r.sortedEnd-r.sortedStart)&&(i=!0)}else i=!0}return i},t.prototype.attemptAdjustment=function(t,e,i,r){void 0===r&&(r=!1);var n=this.adjustSegment(t,e,r);return this.updateModifiedSegments(n),n||i&&i.previous&&i.next&&(e=Ti(e),n=this.adjustSegment(i,e,r),this.updateModifiedSegments(n)),n},t.prototype.updateModifiedSegments=function(t){var e=this;t&&this.modifiedSegments.clear(),this.currentSegments.forEach(function(i,r){t&&e.modifiedSegments.set(r,r.coordinate),e.segmentTree.removeSegment(r),r.updateCoordinate(i-r.coordinate),e.segmentTree.addSegment(r)}),this.currentSegments.clear()},t.prototype.updateSegmentTreeWithModifiedSegments=function(){var t=this;this.modifiedSegments.size>0&&this.modifiedSegments.forEach(function(e,i){t.segmentTree.removeSegment(i),i.updateCoordinate(e-i.coordinate),t.segmentTree.addSegment(i);var r=t.connectorMappings.get(i);t.modifiedConnector.has(r)||t.modifiedConnector.add(r)})},t.prototype.resolveOverlappingAtGivenDirection=function(t,e,i,r,n){if(n){for(var o=!1,a=0,s=e;a<s.length;a++){if((l=s[a]).previous&&l.next&&!(o=this.adjustSegment(l,i,r,n)))return!1}return o}var h=t;if(1===e.length){var d=this.shouldAdjustSelfFirst(t,e),l=e[0],c=d?this.calculateShiftDirection(t,e):this.calculateShiftDirection(l,this.segmentTree.findOverlappingSegments(l));r&&(c=Ti(c)),(h=d?c===i?t:l:c===i?l:t)!==l||l.previous&&l.next||(h=t)}return this.adjustSegment(h,i,r)},t.prototype.calculateShiftDirection=function(t,e){var i=e[0],r=t,n=r.previous,o=r.next,a="Left"===r.direction||"Right"===r.direction?r.startPoint.x:r.startPoint.y,s="Left"===r.direction||"Right"===r.direction?r.endPoint.x:r.endPoint.y,h=r.direction;if(n.direction===o.direction){var d=i.previous,l=i.next,c=i.sortedStart<=a&&a<=i.sortedEnd,p=i.sortedStart<=s&&s<=i.sortedEnd;if(c&&p){var g="Left"===i.direction||"Right"===i.direction?i.startPoint.x:i.startPoint.y,u="Left"===i.direction||"Right"===i.direction?i.endPoint.x:i.endPoint.y;if(r.direction!==i.direction){var f=g;g=u,u=f}Math.abs(a-g)>=Math.abs(s-u)||o.next&&r.direction===o.next.direction&&0!==this.segmentTree.findOverlappingSegments(o).length?p=!1:c=!1}h=c?r.direction===i.direction&&l?Ti(l.direction):r.direction!==i.direction&&d?Ti(d.direction):Ti(n.direction):p?r.direction===i.direction&&d?d.direction:r.direction!==i.direction&&l?Ti(l.direction):Ti(n.direction):o.direction}else if(i.previous&&i.next&&i.previous.direction!==i.next.direction){var m=Math.max(r.sortedStart,i.sortedStart),y=Math.min(r.sortedEnd,i.sortedEnd);h=(y-m)/(r.sortedEnd-r.sortedStart)>=(y-m)/(i.sortedEnd-i.sortedStart)?o.direction:n.direction}else h=o.direction;return h},t.prototype.adjustSegment=function(e,i,r,n){void 0===n&&(n=!1);var o=e.coordinate,a=e.previous,s=e.next,h=this.calculateMaximumSegmentShift(a,s,i),d=("Right"===i||"Bottom"===i?1:-1)*t.ConnectorSpacing;if(Math.abs(d)<=h){if(this.segmentTree.removeSegment(e),e.updateCoordinate(d),this.segmentTree.addSegment(e),this.currentSegments.has(e)||this.currentSegments.set(e,o),this.diagram.lineRoutingModule){var l=e.startPoint,c=e.endPoint;if(!this.diagram.lineRoutingModule.isPathWalkable(l,c,this.diagram)){if(!n&&e===this.rootShiftingSegment){this.segmentTree.removeSegment(e),e.updateCoordinate(-1*d),this.segmentTree.addSegment(e);var p=this.segmentTree.findOverlappingSegments(e);if(0!==p.length){var g=Ti(i);return this.resolveOverlappingAtGivenDirection(e,p,g,r,!0)}}return this.requireReroute=!0,!1}}if(0!==(u=this.segmentTree.findOverlappingSegments(e)).length)return!(0!==this.modifiedSegments.size&&this.modifiedSegments.size>this.currentSegments.size+1)&&this.resolveOverlappingAtGivenDirection(e,u,i,r,n)}else if(!n&&e===this.rootShiftingSegment){var u;if(0!==(u=this.segmentTree.findOverlappingSegments(e)).length){g=Ti(i);return this.resolveOverlappingAtGivenDirection(e,u,g,r,!0)}}return e.coordinate!==o},t.prototype.calculateMaximumSegmentShift=function(t,e,i){var r=Math.abs(t.sortedEnd-t.sortedStart),n=Math.abs(e.sortedEnd-e.sortedStart),o=this.connectorMappings.get(t);if(o){if(!t.previous){var a=7;"None"!==o.sourceDecorator.shape&&(a=Math.max(o.sourceDecorator.width,o.sourceDecorator.height)),r-=a+5}if(!e.next){var s=7;"None"!==o.targetDecorator.shape&&(s=Math.max(o.targetDecorator.width,o.targetDecorator.height)),n-=s+5}}return t.direction===e.direction?i===e.direction?n:r:i===e.direction?Math.min(r,n):Number.MAX_VALUE},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"AvoidLineOverlapping"},t.ConnectorSpacing=5,t.maxReRouteLimit=5,t}(),Bc=function(){function t(){}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"LineDistribution"},t.prototype.initLineDistribution=function(t,e){var i="Bottom";if("DifferentPoint"===e.layout.connectionPointOrigin||e.layout.enableRouting){var r="Top";"BottomToTop"===t.orientation?(i="Top",r="Bottom"):"RightToLeft"===t.orientation?(i="Left",r="Right"):"LeftToRight"===t.orientation&&(i="Right",r="Left");var n=e.nodes;if(n.length>0)for(var o=0;o<n.length;o++){var a=e.nameTable[n[parseInt(o.toString(),10)].id];this.addDynamicPortandDistrrbuteLine(t,a,i,r,e)}}},t.prototype.ObstacleSegment=function(t){return t.direction=Os(t.startpt,t.endpt),t.distance=o.findLength(t.startpt,t.endpt),t.orientation="Left"===t.direction||"Right"===t.direction?"horizontal":"vertical",t.id=t.id,"horizontal"===t.orientation?(t.coord=t.startpt.y,"Left"===t.direction?(t.start=t.endpt.x,t.end=t.startpt.x):(t.start=t.startpt.x,t.end=t.endpt.x)):(t.coord=t.startpt.x,"Top"===t.direction?(t.start=t.endpt.y,t.end=t.startpt.y):(t.start=t.startpt.y,t.end=t.endpt.y)),t},t.prototype.distributeLines=function(t,e){for(var i="LeftToRight"===t.orientation||"RightToLeft"===t.orientation,r=i?t.horizontalSpacing:t.verticalSpacing,n="obstaclePointCollection",a=r-8-10,s=[],h=[],d=e.connectors,l=0;l<d.length;l++){for(var c=d[parseInt(l.toString(),10)],p=[],g=0;g<c.segments.length;g++)for(var u=c.segments[parseInt(g.toString(),10)],f=0;f<u.points.length;f++){var m=u.points[parseInt(f.toString(),10)];0!==p.length&&o.equals(m,p[p.length-1])||p.push(m)}for(var y=[],v=1;v<p.length;v++){var b=this.ObstacleSegment({startpt:p[v-1],endpt:p[parseInt(v.toString(),10)],id:c.id});y.push(b)}var S={wrapper:c,segments:y},w=[];if(i)for(g=0;g<S.segments.length;g++){"vertical"===(b=S.segments[parseInt(g.toString(),10)]).orientation&&b.distance>1&&w.push(b)}else for(var g=0;g<S.segments.length;g++){"horizontal"===(b=S.segments[parseInt(g.toString(),10)]).orientation&&b.distance>1&&w.push(b)}for(v=0;v<w.length;v++){var x=w[parseInt(v.toString(),10)];this.containsValue(s,x.coord)||s.push({key:x.coord,value:[]});var I=void 0;for(f=0;f<s.length;f++){g=s[parseInt(f.toString(),10)].key;if(Number(g)===x.coord){I=f;break}}s[parseInt(I.toString(),10)].value.push(x)}h.push(S)}if(s.length>0)for(var P=s.map(function(t){return t.key}).sort(function(t,e){return t-e}),C=(l=0,function(){var t=P[parseInt(l.toString(),10)],e=P[l+1];if(Math.abs(e-t)<.5*r){var i=s.findIndex(function(e){return e.key===t}),n=s.findIndex(function(t){return t.key===e});if(-1===i||-1===n)return l++,"continue";var o=s[parseInt(i.toString(),10)],a=s[parseInt(n.toString(),10)],h=(t+e)/2,d=o.value.concat(a.value),c=Math.max(i,n),p=Math.min(i,n);s.splice(c,1),s.splice(p,1),s.push({key:h,value:d}),P=s.map(function(t){return t.key}).sort(function(t,e){return t-e})}else l++});l<P.length-1;)C();this.sortConnectors(s,e);for(var T=[],A=0;A<s.length;A++){var O=s[parseInt(A.toString(),10)],D=O.value;D.sort(function(t,e){return t.start-e.start});var M=void 0;M=[];I=0;var L=Number.MIN_VALUE;M.push([]);for(var E=0;E<D.length;E++){x=D[parseInt(E.toString(),10)];!(M[parseInt(I.toString(),10)].length>0)||L>=x.start?(M[parseInt(I.toString(),10)].push(x),L=Math.max(L,M[parseInt(I.toString(),10)][M[parseInt(I.toString(),10)].length-1].end)):(I++,M.push([]),M[parseInt(I.toString(),10)].push(x),L=M[parseInt(I.toString(),10)][M[parseInt(I.toString(),10)].length-1].end)}for(E=0;E<M.length;E++){var z=M[parseInt(E.toString(),10)],k=[];for(v=0;v<z.length;v++){(j=z[parseInt(v.toString(),10)]).start&&k.push(j)}var B=i?"Bottom":"Right",R=[];for(v=0;v<k.length;v++){(j=k[parseInt(v.toString(),10)]).direction===B&&R.push(j)}var N=[];for(v=0;v<k.length;v++){var j;(j=k[parseInt(v.toString(),10)]).direction!==B&&N.push(j)}var H=[];if(R.length>0){var W=R[0].start;for(v=0;v<N.length;)N[parseInt(v.toString(),10)].end>W?(H.push(N[parseInt(v.toString(),10)]),N.splice(v,1)):v++}var _=[];_=this.updateSegmentRow(H,_);var Y=[];Y=[],Y=this.updateSegmentRow(N,Y),R.reverse(),Y=this.updateSegmentRow(R,Y),_[_.length-1].length>0||_.splice(_.length-1,1),Y[Y.length-1].length>0||Y.splice(Y.length-1,1);var F=[];if(H.length>0&&(k[k.length-1].direction===H[H.length-1].direction||k[0].direction===H[0].direction)){F=Y;for(var X=0;X<_.length;X++){var V=_[parseInt(X.toString(),10)];F[F.length]=V}}else{F=_;for(X=0;X<Y.length;X++){V=Y[parseInt(X.toString(),10)];F[F.length]=V}}if(F.length>1){var U=1;"BottomToTop"!==t.orientation&&"RightToLeft"!==t.orientation||(U=-1);var G=O.key-U*a/2,Z=a/F.length;for(l=0;l<F.length;l++){var q=G+l*Z*U;for(X=0;X<F[parseInt(l.toString(),10)].length;X++){(x=F[parseInt(l.toString(),10)][parseInt(X.toString(),10)]).coord=q,this.containsValue(T,x.coord)||T.push({key:x.coord,value:[]});var Q=void 0;for(f=0;f<T.length;f++){if(T[parseInt(f.toString(),10)].key===x.coord){Q=f;break}}T[parseInt(Q.toString(),10)].value.push(x)}}}}}for(A=0;A<h.length;A++){for(S=h[parseInt(A.toString(),10)],p=[],l=0;l<S.segments.length;l++)0===l?p.push(this.getObstacleStartPoint(S.segments[parseInt(l.toString(),10)])):i?"vertical"===S.segments[parseInt(l.toString(),10)].orientation&&(p[p.length-1]=this.getObstacleStartPoint(S.segments[parseInt(l.toString(),10)])):i||"horizontal"===S.segments[parseInt(l.toString(),10)].orientation&&(p[p.length-1]=this.getObstacleStartPoint(S.segments[parseInt(l.toString(),10)])),p.push(this.getObstacleEndPoint(S.segments[parseInt(l.toString(),10)]));S.wrapper[""+n]=[];for(v=0;v<p.length;v++){var K=p[parseInt(v.toString(),10)];(0===v||v>0&&!o.equals(K,p[v-1]))&&S.wrapper[""+n].push(this.getPointvalue(K.x,K.y))}"Orthogonal"===S.wrapper.type&&this.resetConnectorPoints(S.wrapper,e)}},t.prototype.sortConnectors=function(t,e){for(var i=0;i<t.length;i++)for(var r=0;r<t[parseInt(i.toString(),10)].value.length;r++)t[parseInt(i.toString(),10)].value.length>1&&("LeftToRight"===e.layout.orientation||"RightToLeft"===e.layout.orientation?t[parseInt(i.toString(),10)].value.sort(function(t,i){var r=e.nameTable[""+t.id],n=e.nameTable[""+i.id];return r.targetPoint.y-n.targetPoint.y}):"TopToBottom"!==e.layout.orientation&&"BottomToTop"!==e.layout.orientation||t[parseInt(i.toString(),10)].value.sort(function(t,i){var r=e.nameTable[""+t.id],n=e.nameTable[""+i.id];return r.targetPoint.x-n.targetPoint.x}))},t.prototype.resetConnectorPoints=function(t,e){var i="obstaclePointCollection";if(t.segments[0].points&&t.segments[0].points.length>0&&t[""+i]){var r=t;r.sourcePoint=t[""+i][0],r.targetPoint=t[""+i][t[""+i].length-1];var n=void 0;n=[];for(var o=0;o<t[""+i].length-1;o++){var a=t[""+i][parseInt(o.toString(),10)],s=t[""+i][o+1],h=Ds(a,s),d=Os(a,s);o===t[""+i].length-2&&("RightToLeft"===e.layout.orientation&&"Left"===d||"LeftToRight"===e.layout.orientation&&"Right"===d||"TopToBottom"===e.layout.orientation&&"Bottom"===d||"BottomToTop"===e.layout.orientation&&"Top"===d)&&(h/=2);var l=new uo(t,"segments",{type:"Orthogonal"},!0);l.length=h,l.direction=d,n.push(l)}r.segments=n,r.type="Orthogonal",e.connectorPropertyChange(r,{},{type:"Orthogonal",segments:r.segments})}},t.prototype.getObstacleEndPoint=function(t){return"horizontal"===t.orientation?"Left"===t.direction?this.getPointvalue(t.start,t.coord):this.getPointvalue(t.end,t.coord):"Top"===t.direction?this.getPointvalue(t.coord,t.start):this.getPointvalue(t.coord,t.end)},t.prototype.getObstacleStartPoint=function(t){return"horizontal"===t.orientation?"Left"===t.direction?this.getPointvalue(t.end,t.coord):this.getPointvalue(t.start,t.coord):"Top"===t.direction?this.getPointvalue(t.coord,t.end):this.getPointvalue(t.coord,t.start)},t.prototype.updateSegmentRow=function(t,e){var i=0;e.length>0||(e[0]=[]);for(var r=0;r<t.length;r++)for(var n=t[parseInt(r.toString(),10)];i<e.length;){if(i===e.length-1&&(e[i+1]=[]),!(e[parseInt(i.toString(),10)].length>0)||e[parseInt(i.toString(),10)][e[parseInt(i.toString(),10)].length-1].end<n.start){e[parseInt(i.toString(),10)].push(n);break}i++}return e},t.prototype.portOffsetCalculation=function(t,e,i,r){"Top"===i&&(t.offset={x:(r+1)*(1/(e+1)),y:0}),"Bottom"===i&&(t.offset={x:(r+1)*(1/(e+1)),y:1}),"Left"===i&&(t.offset={x:0,y:(r+1)*(1/(e+1))}),"Right"===i&&(t.offset={x:1,y:(r+1)*(1/(e+1))})},t.prototype.addDynamicPortandDistrrbuteLine=function(t,e,i,r,n){if(e.ports&&e.ports.length>0){var o=e.ports;n.removePorts(e,o)}e.ports;var a=e.outEdges,s=e.inEdges;this.initPort(a,n,e,i,!1),this.initPort(s,n,e,r,!0)},t.prototype.initPort=function(t,e,r,n,o){var a=t;t.length>1&&o&&(t=this.sortObjects(a,o,e));for(var s=0;s<=t.length-1;s++){var h=e.nameTable[t[parseInt(s.toString(),10)]];h.obstaclePointCollection=[];var d=rs(r,o?h.targetPortID:h.sourcePortID),l=n;void 0===d&&((d=new ye(r,"ports","",!0)).id=E()+"_LineDistribution",o?h.targetPortID=d.id:h.sourcePortID=d.id),this.portOffsetCalculation(d,t.length,l,s),r.ports.push(d);var c=r.initPortWrapper(r.ports[r.ports.length-1]);r.wrapper.children.push(c),r.wrapper.measure(new i(r.width,r.height),r.id),r.wrapper.arrange(r.wrapper.desiredSize),e.connectorPropertyChange(h,o?{targetPortID:""}:{sourcePortID:""},o?{targetPortID:d.id}:{sourcePortID:d.id})}},t.prototype.sortObjects=function(t,e,i){for(var r,n=0;n<t.length;n++)for(var o=n+1;o<t.length;o++){var a=i.nameTable[t[parseInt(n.toString(),10)]],s=i.nameTable[t[parseInt(o.toString(),10)]];if(e){var h=i.nameTable[a.sourceID],d=i.nameTable[s.sourceID];"LeftToRight"===i.layout.orientation||"RightToLeft"===i.layout.orientation?h.offsetY>d.offsetY&&(r=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=t[parseInt(o.toString(),10)],t[parseInt(o.toString(),10)]=r):h.offsetX>d.offsetX&&(r=t[parseInt(n.toString(),10)],t[parseInt(n.toString(),10)]=t[parseInt(o.toString(),10)],t[parseInt(o.toString(),10)]=r)}}return t},t.prototype.resetConnectorSegments=function(t){for(var e=t.segments,i=e.length;i>0;i--)e.splice(i-1,1)},t.prototype.resetRoutingSegments=function(t,e,i){if(t.levelSkip){for(var r=void 0,n=void 0,o=e.layout.ranks.reverse(),a=0;a<o.length;a++)for(var s=0;s<o[parseInt(a.toString(),10)].length;s++)t.sourceID===o[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id&&(r=a),t.targetID===o[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id&&(n=a);var h=[];if(r<n)for(a=0;a<o.length;a++)a>=r&&a<=n&&h.push(o[parseInt(a.toString(),10)]);else for(a=0;a<o.length;a++)a<=r&&a>=n&&h.push(o[parseInt(a.toString(),10)]);var d=[];for(a=0;a<h.length;a++)for(s=0;s<h[parseInt(a.toString(),10)].length;s++)if(void 0===h[parseInt(a.toString(),10)][parseInt(s.toString(),10)].edges){var l=e.nameTable[h[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id];d.push(l)}e.routingConnectors||(e.routingConnectors=[]);var c=this.getConnectorBounds(t);t:for(var p=0;p<d.length;p++){var g=d[parseInt(p.toString(),10)].wrapper.bounds;if(c.intersects(g))for(a=0;a<t.segments.length;a++){var u=t.segments[parseInt(a.toString(),10)].points;for(s=0;s<u.length;s++){var f=u[parseInt(s.toString(),10)],m=u[s+1];if(m){var y=this.pointsAlongLine(f,m);if(this.pointInsideBounds(y,g)){e.routingConnectors.push(t);break t}}}}}}},t.prototype.getConnectorBounds=function(t){for(var e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0;o<t.segments.length;o++)for(var a=t.segments[o].points,s=0;s<a.length;s++){var h=a[s];e=Math.min(e,h.x),i=Math.min(i,h.y),r=Math.max(r,h.x),n=Math.max(n,h.y)}return new w(e,i,r-e,n-i)},t.prototype.pointsAlongLine=function(t,e){for(var i=e.x-t.x,r=e.y-t.y,n=Math.sqrt(i*i+r*r),o=i/n,a=r/n,s=[],h=0;h<=n;h+=2)s.push({x:t.x+o*h,y:t.y+a*h});return s},t.prototype.pointInsideBounds=function(t,e){for(var i=0,r=t;i<r.length;i++){var n=r[i];if(e.right>n.x&&e.left<n.x&&e.top<n.y&&e.bottom>n.y)return!0}return!1},t.prototype.getPointvalue=function(t,e){return{x:Number(t)||0,y:Number(e)||0}},t.prototype.containsValue=function(t,e){for(var i=0;i<t.length;i++){if(t[parseInt(i.toString(),10)]===e)return!0;if(t[parseInt(i.toString(),10)]&&t[parseInt(i.toString(),10)].key===e)return!0}return!1},t}(),Rc=function(){function t(){this.isAnimation=!1}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"OrganizationalChart"},t.prototype.updateLayout=function(t,e,i,r,n,o){var a={type:i.type,connectionPointOrigin:i.connectionPointOrigin,nameTable:e,anchorX:0,anchorY:0,firstLevelNodes:[],centerNode:null,levels:[],maxLevel:0,graphNodes:{},orientation:i.orientation,horizontalSpacing:i.horizontalSpacing,verticalSpacing:i.verticalSpacing,verticalAlignment:i.verticalAlignment,horizontalAlignment:i.horizontalAlignment,fixedNode:i.fixedNode,getLayoutInfo:J(i.getLayoutInfo),layoutInfo:i.layoutInfo,margin:i.margin,bounds:i.bounds,objects:[],root:i.root};return this.doLayout(a,t,r,n,o),a},t.prototype.updateLayoutBounds=function(t,e,i,r){var n=i[parseInt(r.toString(),10)],o=i[parseInt(r.toString(),10)-1],a=t.horizontalSpacing-(n.x-o.right),s=function(e){if(t.nameTable[""+e]){var i=t.graphNodes[""+e];if(i.x+=a,void 0!==i.mid&&(i.mid+=a),i.firstChild&&void 0!==i.firstChild.x&&(i.firstChild.x+=a),i.tree.children&&i.tree.children.length>0)for(var r=0;r<i.tree.children.length;r++)s(i.tree.children[parseInt(r.toString(),10)]);if(i.tree.assistants&&i.tree.assistants.length>0)for(var n=0;n<i.tree.assistants.length;n++)s(i.tree.assistants[parseInt(n.toString(),10)])}};s(e.id),n.x+=a,n.right+=a},t.prototype.doLayout=function(t,e,i,r,n){var o,a,s=[];for(t.nameTable[t.root]&&t.firstLevelNodes.push(t.nameTable[t.root]),a=0;a<e.length;a++)if(!((o=e[parseInt(a.toString(),10)]).excludeFromLayout||((t.graphNodes[o.id]=this.setUpLayoutInfo(t,o)).tree.hasSubTree=!1,t.nameTable[t.root]||o.inEdges&&o.inEdges.length))){o.parentId||o.processId||s.push(o),o.data&&String(o.data[""+r])===t.root&&t.firstLevelNodes.push(o)}for(0===t.firstLevelNodes.length&&(t.firstLevelNodes=s),a=0;a<t.firstLevelNodes.length;a++)o=t.firstLevelNodes[parseInt(a.toString(),10)],this.updateEdges(t,o,1,n,e);var h=[];if(t.firstLevelNodes.length>0){t.rootNode=t.firstLevelNodes[0];var d=0,l=0,c=void 0,p=void 0,g=void 0,u=void 0,f=void 0;for(a=0;a<t.firstLevelNodes.length;a++){f=this.updateTree(t,d,l,t.firstLevelNodes[parseInt(a.toString(),10)],0,t.firstLevelNodes[a-1]),h.push(f),t.firstLevelNodes.length>1&&a>0&&a<t.firstLevelNodes.length&&this.updateLayoutBounds(t,t.firstLevelNodes[parseInt(a.toString(),10)],h,a);var m=t.graphNodes[t.firstLevelNodes[parseInt(a.toString(),10)].id];f.y=Math.min(f.y,m.y),f.x=Math.min(f.x,m.x),-1!==t.orientation.indexOf("Left")?l=f.right+t.horizontalSpacing:d=f.right+t.horizontalSpacing,0===a?(c=f.x,u=f.y,g=f.right,p=f.bottom):(c=Math.min(c,f.x),u=Math.min(u,f.y),g=Math.max(g,f.right),p=Math.max(p,f.bottom)),t.levels=[],t.maxLevel=void 0}for(this.updateAnchor(t,{x:c,y:u,right:g,bottom:p},i),a=0;a<t.firstLevelNodes.length;a++)this.updateNodes(t,t.firstLevelNodes[parseInt(a.toString(),10)],0);for(a=0;a<t.firstLevelNodes.length;a++)this.updateConnectors(t,t.firstLevelNodes[parseInt(a.toString(),10)],1)}},t.prototype.getBounds=function(t){var e=t.offsetX-t.actualSize.width*t.pivot.x,i=t.offsetY-t.actualSize.height*t.pivot.y;return new w(e,i,t.actualSize.width,t.actualSize.height)},t.prototype.updateTree=function(t,e,i,r,n,o,a){var s,h,d={},l=this.getDimensions(t,r,e,i,n);d=t.graphNodes[r.id],t.maxLevel=Math.max(t.maxLevel,n),s=n;var c=this.hasChild(t,r);if(c||d.tree.assistants.length){var p=void 0,g=void 0,u=void 0,f=void 0,m=void 0,y=void 0;y=l.y+l.height+t.verticalSpacing,d.tree.assistants.length&&(s=(h=this.setDepthSpaceForAssitants(t,r,y,l.height,n,t.verticalSpacing)).level,y=h.bottom),d.tree.assistants.length||"Horizontal"===d.tree.orientation||(y=l.y+l.height+t.verticalSpacing/2),d.tree.children.length&&(p="Horizontal"!==d.tree.orientation||"Balanced"===d.tree.type&&1!==d.tree.children.length?"Balanced"===d.tree.type?this.updateHorizontalTreeWithMultipleRows(t,r,o,l.x,y,s):this.updateVerticalTree(t,r,l.x,y,s,a):this.updateHorizontalTree(t,r,o,l.x,y,s)),d.y&&d.y>l.y||(d.y=l.y),void 0!==d.mid&&(e=d.mid),d.tree.assistants.length&&(m=void 0!==e?e:l.x,f=this.setBreadthSpaceForAssistants(t,r,l,m,y,n),c||(e=((g=p=f).x+g.right)/2-l.width/2,p=g),u=f?f.canMoveBy:void 0),d.x=e,d.translate||(d.treeWidth=p.right-p.x);var v={layout:t,shape:r,shapeBounds:{x:e,y:l.y,right:e+l.width,bottom:l.y+l.height},treeBounds:p,dim:l,level:n};return this.translateSubTree(v,u,void 0!==o,a),d.firstChild&&"string"!=typeof d.firstChild&&(d.firstChild.x+=d.subTreeTranslation),r.treeBounds=p,p}return r.treeBounds=this.updateLeafNode(t,r,o,l,n,a),r.treeBounds},t.prototype.updateLeafNode=function(t,e,i,r,n,o){var a=t.graphNodes[e.id];a.x=r.x,a.y&&a.y>r.y||(a.y=r.y,a.maxLevel=Math.max(n,a.maxLevel||0));var s={x:r.x,y:r.y,right:r.x+r.width,bottom:r.y+r.height};a.maxLevel=Math.max(a.maxLevel||0,n);var h={layout:t,shape:e,shapeBounds:s,treeBounds:s,dim:r,level:n};return this.translateSubTree(h,void 0,void 0!==i,o),{x:a.x,y:a.y,right:a.x+r.width,bottom:a.y+r.height}},t.prototype.setUpLayoutInfo=function(t,e){var i={subTreeTranslation:0};return"OrganizationalChart"===t.type?i.tree={orientation:"Vertical",type:"Alternate",offset:20,enableRouting:!0}:i.tree={orientation:"Horizontal",type:"Center",enableRouting:!0},i.tree.children=[],i.tree.assistants=[],i.tree.level=0,i.translate=!0,i},t.prototype.translateSubTree=function(t,e,i,r){var n=t.layout,o=t.shape,a=t.shapeBounds,s=t.treeBounds,h=t.level,d=t.dim,l=n.graphNodes[o.id],c=n.nameTable[l.firstChild?l.firstChild.child:l.tree.children[0]],p=c?n.graphNodes[c.id]:null,g=this.hasChild(n,o),u=this.findIntersectingLevels(n,a,h,l.actualLevel),f=this.findIntersectingLevels(n,s,h,l.actualLevel),m=[];u.length&&l.translate?(l.intersect=u,this.spaceLeftFromPrevSubTree(n,o,a),l.canMoveBy=l.diff,void 0!==e&&(l.canMoveBy=Math.min(e,l.canMoveBy)),c&&void 0!==p.canMoveBy&&(p.canMoveBy>=l.canMoveBy&&(l.translated=!0),l.canMoveBy=Math.min(l.canMoveBy,p.canMoveBy)),i?(l.x-=l.canMoveBy,l.subTreeTranslation-=l.canMoveBy,g&&(this.shiftSubordinates(n,f,l.canMoveBy),s.x=Math.min(s.x,l.x),s.right=Math.max(s.right,l.x+d.width),s.bottom=Math.max(s.bottom,l.y+d.height),s.x-=l.canMoveBy,s.right-=l.canMoveBy),c&&p.canMoveBy>l.canMoveBy?l.canMoveBy=p.canMoveBy-l.canMoveBy:c&&void 0!==l.canMoveBy&&(l.canMoveBy=0)):void 0!==l.canMoveBy&&g&&(s.x=Math.min(s.x,l.x),s.right=Math.max(s.right,l.x+d.width))):(g&&(s.x=Math.min(s.x,a.x),s.right=Math.max(s.right,a.x+d.width),s.bottom=Math.max(s.bottom,l.y+d.height)),l.translate||(l.canMoveBy=0,l.subTreeTranslation=0)),r||(a={x:l.x,y:d.y,right:l.x+d.width,bottom:d.y+d.height},m.push({rBounds:a}),this.updateRearBounds(n,o,m,h))},t.prototype.updateRearBounds=function(t,e,i,r,n){var o,a,s,h,d=!0,l={};e&&(n=(l=t.graphNodes[e.id]).intersect,d=!l.tree.children.length&&!l.tree.assistants.length);var c=i[0].rBounds,p=i[i.length-1].rBounds;if(n&&n.length){for(h=(o=t.levels[n[0]].rBounds).bottom,o.y<c.y&&(o.bottom=c.y,i.splice(0,0,{rBounds:o})),h>p.bottom?i.push({rBounds:{x:o.x,right:o.right,y:c.bottom,bottom:h}}):(o=t.levels[n[n.length-1]].rBounds,d&&o.bottom>p.bottom&&(o.y=p.bottom,i.push({rBounds:o}))),a=n[0],s=i.length-1;s>=0;s--)t.levels.splice(a,0,i[parseInt(s.toString(),10)]);a+=i.length,t.levels.splice(a,n.length)}else for(a=this.findLevel(t,i[i.length-1].rBounds,r),s=i.length-1;s>=0;s--)t.levels.splice(a,0,i[parseInt(s.toString(),10)])},t.prototype.shiftSubordinates=function(t,e,i){var r;if(0!==i)for(r=0;r<e.length;r++)t.levels[e[parseInt(r.toString(),10)]].rBounds&&(t.levels[e[parseInt(r.toString(),10)]].rBounds.x-=i,t.levels[e[parseInt(r.toString(),10)]].rBounds.right-=i)},t.prototype.setDepthSpaceForAssitants=function(t,e,i,r,n,o){var a,s,h,d,l=t.graphNodes[e.id],c={};for(d=i,s=0;s<l.tree.assistants.length;s++)(c=t.graphNodes[l.tree.assistants[parseInt(s.toString(),10)]])&&(c.tree.children=c.tree.assistants=[],c.y=i,a=(h=t.nameTable[l.tree.assistants[parseInt(s.toString(),10)]]).actualSize.height,-1!==t.orientation.indexOf("Left")&&(a=h.actualSize.width),d=i+a+o/2,t.maxLevel=n+1,s%2==1&&s!==l.tree.assistants.length-1&&(i=d,n++));return{level:t.maxLevel,bottom:i+a+o}},t.prototype.setBreadthSpaceForAssistants=function(t,e,i,r,n,o){var a,s,h,d,l,c,p,g={},u=t.graphNodes[e.id],f=o,m={x:0,y:0,right:0,bottom:0};for(d=0;d<u.tree.assistants.length;d++)(g=t.graphNodes[u.tree.assistants[parseInt(d.toString(),10)]])&&(a=(h=t.nameTable[u.tree.assistants[parseInt(d.toString(),10)]]).actualSize.width,-1!==t.orientation.indexOf("Left")&&(a=h.actualSize.height),l=d%2==0?r+i.width/2-20-a:r+i.width/2+20,s=this.updateTree(t,l,g.y,t.nameTable[u.tree.assistants[parseInt(d.toString(),10)]],f+1),this.hasChild(t,e)||(0===d?m=s:this.uniteRects(m,s)),d%2==0&&g.prevBounds&&(c=void 0===c?g.canMoveBy:Math.min(c,g.canMoveBy)),d%2!=1&&d!==u.tree.assistants.length-1||(p=this.findIntersectingLevels(t,s,f+1),this.updateRearBounds(t,null,[{rBounds:s}],f+1,p),f++));return m&&(m.canMoveBy=c),m},t.prototype.getDimensions=function(t,e,i,r,n){var o,a;if(o=e.actualSize.width,a=e.actualSize.height,t.orientation=t.orientation||"TopToBottom",-1!==t.orientation.indexOf("Left")){if(!n){var s=i;i=r,r=s}a=e.actualSize.width,o=e.actualSize.height}return{x:i,y:r,width:o,height:a}},t.prototype.hasChild=function(t,e){var i=t.graphNodes[e.id];return i?i.tree.children&&i.tree.children.length:0},t.prototype.updateHorizontalTree=function(t,e,i,r,n,o){var a=this.getDimensions(t,e,r,n,o),s={},h=(s=t.graphNodes[e.id]).tree.type,d=o,l=0;l=r;var c,p,g,u,f,m,y,v,b,S,w,x,I,P,C,T=n;t.levels.slice(0,t.levels.length);if(this.hasChild(t,e)){var A=-1!==t.orientation.indexOf("Left");for(I=0;I<s.tree.children.length;I++){c=(g=t.nameTable[s.tree.children[parseInt(I.toString(),10)]]).actualSize.width,p=g.actualSize.height,f=A?p:c,m=A?c:p;t.levels[d+1]&&t.levels[d+1].rBounds;if(u=this.updateTree(t,l,T,g,d+1,t.nameTable[s.tree.children[I-1]]),P=t.graphNodes[g.id],s.maxLevel=Math.max(s.maxLevel||0,P.maxLevel||0),v={x:P.x,y:P.y,right:P.x+f,bottom:P.y+m},0===I&&(y={x:Math.min(P.x,u.x),y:Math.min(P.y,u.y),right:u.right,bottom:u.bottom},C=P),x?(x.x=v.x,x.y=v.y,v.right>x.right&&(x.right=v.right),x.bottom=v.bottom):x=v,0===I&&(s.firstChild={x:P.x,canMoveBy:P.canMoveBy,child:g.id}),this.hasChild(t,g))if(!s.firstChild||s.firstChild.x>=P.firstChild.x){P.firstChild&&s.firstChild.canMoveBy<P.canMoveBy&&(w=s.firstChild.canMoveBy,P.canMoveBy=w,t.graphNodes[s.firstChild.child].canMoveBy=w,s.firstChild.canMoveBy=w);var O=void 0!==w?w:P.canMoveBy;s.firstChild={x:P.firstChild.x,canMoveBy:O,child:g.id}}else P.firstChild&&P.translated&&s.firstChild.canMoveBy>P.canMoveBy&&(s.firstChild.canMoveBy=t.graphNodes[s.firstChild.child].canMoveBy=P.canMoveBy);b=b?Math.max(P.maxLevel,b):P.maxLevel,this.uniteRects(y,u),l=0!==I&&!this.hasChild(t,g)&&P.subTreeTranslation<0?u.right-P.subTreeTranslation+t.horizontalSpacing:u.right+t.horizontalSpacing}isNaN(S)||(C.canMoveBy=S),s.mid=(C.x+x.right)/2-a.width/2,"Left"===h?s.mid=v.right-a.width:"Right"===h&&(s.mid=r)}return y},t.prototype.updateHorizontalTreeWithMultipleRows=function(t,e,i,r,n,o){var a,s,h,d,l,c,p,g,u,f,m,y=this.getDimensions(t,e,r,n,o),v=t.graphNodes[e.id],b=(v.tree.type,o),S=r,w=n,x=(t.levels.slice(0,t.levels.length),0);if(this.hasChild(t,e)){var I=-1!==t.orientation.indexOf("Left"),P=void 0,C=this.splitChildrenInRows(t,e),T=5===v.tree.children.length&&3===C[0].length,A=[],O=[];T?O=C:this.splitRows(C,A,O);var D={leftTree:A,rows:C,rightTree:O,dimensions:y},M=this.updateLeftTree(t,D,e,r,w,b);l=D.bounds;var L=void 0,E=(M||0)+(void 0!==M?t.horizontalSpacing/2:0);void 0!==M&&(v.mid=E-y.width/2,L=M+t.horizontalSpacing),w=n;var z=void 0;for(z=[],u=0;u<O.length;u++)for(S=C[u].length%2==1&&u===O.length-1||T?r:L||r,0!==u&&(w=z[u-1].bottom+t.verticalSpacing),g=0;g<O[u].length;g++)c=(a=t.nameTable[O[u][g]]).actualSize.width,p=a.actualSize.height,d=I?p:c,(s=t.graphNodes[a.id]).actualLevel=b+1+u,0===g&&A[u]&&A[u].length&&(s.translate=!1),T&&1===u&&(0===g&&f+d+t.horizontalSpacing<=m&&(P=!0,S=f-d/2),P&&1===g&&(S=m-d/2)),h=this.updateTree(t,S,w,a,b+1,t.nameTable[O[u][g-1]]),T&&g<=2&&0===u&&1===g&&(f=h.x-t.horizontalSpacing/2,m=h.x+d+t.horizontalSpacing/2),0===g?z[u]={x:h.x,y:h.y,right:h.right,bottom:h.bottom}:this.uniteRects(z[u],h),l||(l={x:z[u].x,y:z[u].y,right:z[u].right,bottom:z[u].bottom}),this.uniteRects(l,z[u]),S=h.right+t.horizontalSpacing,(!v.firstChild||(u===O.length-1&&C[u].length%2==1||T)&&0===g&&void 0!==s.canMoveBy&&x>s.canMoveBy)&&(x=Math.min(x,s.canMoveBy||0),v.firstChild={x:s.x,child:a.id,canMoveBy:s.canMoveBy}),D.leftCenter=f,D.rightCenter=m,D.align=P,D.level=b,D.rightBounds=z,this.alignRowsToCenter(t,u,e,D,L)}return l},t.prototype.updateLeftTree=function(t,e,i,r,n,o){for(var a,s,h,d,l,c=e.leftTree,p=t.graphNodes[i.id],g=[],u=-1!==t.orientation.indexOf("Left"),f=0;f<c.length&&c[parseInt(f.toString(),10)].length;f++){a=r,g[f-1]&&(n=g[f-1].bottom+t.verticalSpacing);for(var m=0;m<c[parseInt(f.toString(),10)].length;m++){var y=t.nameTable[c[parseInt(f.toString(),10)][parseInt(m.toString(),10)]],v=(u?y.actualSize.height:y.actualSize.width,u?y.actualSize.width:y.actualSize.height,t.graphNodes[y.id]);v.actualLevel=o+1+f,d=this.updateTree(t,a,n,y,o+1,t.nameTable[c[parseInt(f.toString(),10)][m-1]]),0===m?g[parseInt(f.toString(),10)]={x:d.x,y:d.y,right:d.right,bottom:d.bottom}:this.uniteRects(g[parseInt(f.toString(),10)],d),0===f&&0===m?(s=v.canMoveBy,p.firstChild={x:v.x,child:y.id,canMoveBy:v.canMoveBy}):0===m&&void 0!==v.canMoveBy&&s>v.canMoveBy&&(s=Math.min(s,v.canMoveBy||0),p.firstChild={x:v.x,child:y.id,canMoveBy:v.canMoveBy}),a=d.right+t.horizontalSpacing}h=0===f?g[parseInt(f.toString(),10)].right:Math.max(h,g[parseInt(f.toString(),10)].right)}for(f=0;f<c.length&&c[parseInt(f.toString(),10)].length;f++){if(h!==g[parseInt(f.toString(),10)].right){var b=h-g[parseInt(f.toString(),10)].right;for(m=0;m<c[parseInt(f.toString(),10)].length;m++){t.nameTable[c[parseInt(f.toString(),10)][parseInt(m.toString(),10)]];t.graphNodes[c[parseInt(f.toString(),10)][parseInt(m.toString(),10)]].x+=b}}0===f?l={x:g[0].x,y:g[0].y,right:g[0].right,bottom:g[0].bottom}:this.uniteRects(l,g[parseInt(f.toString(),10)])}return e.bounds=l,h},t.prototype.alignRowsToCenter=function(t,e,i,r,n){var o,a,s,h=t.graphNodes[i.id],d=r.rows,l=r.rightTree,c=r.leftCenter,p=r.rightCenter,g=r.align,u=r.rightBounds,f=r.dimensions,m=r.level,y=5===h.tree.children.length&&3===d[0].length;if(y&&1===e&&(o=u[0].right-u[0].x>=u[1].right-u[1].x?0:1),e===d.length-1&&(d[parseInt(e.toString(),10)].length%2==1||y&&1===e)){a=l[parseInt(e.toString(),10)][Math.floor(l[parseInt(e.toString(),10)].length/2)];var v=t.nameTable[""+a],b=t.graphNodes[""+a].x,S=t.graphNodes[""+a].y,w=this.getDimensions(t,v,b,S,m+1);s=void 0,!g&&y?(1===o&&(e=0),s=(u[parseInt(o.toString(),10)].x+u[parseInt(o.toString(),10)].right)/2-(u[parseInt(e.toString(),10)].x+u[parseInt(e.toString(),10)].right)/2,0===e&&(h.mid+=s)):y||void 0===n||(s=n-t.horizontalSpacing/2-(b+w.width/2)),void 0!==s&&this.updateRearBoundsOfTree(t,l[parseInt(e.toString(),10)],s,f),y&&(h.mid=(p+c)/2+(0===e?s:0)-f.width/2),void 0===h.mid&&t.graphNodes[""+a]&&(h.mid=b),g=!1,e++}},t.prototype.updateRearBoundsOfTree=function(t,e,i,r){for(var n=0;n<e.length;n++){var o=t.graphNodes[e[parseInt(n.toString(),10)]];if(o.x+=i,o.canMoveBy+=i,n===e.length-1){var a={x:o.x,y:o.y,right:o.x+r.width,bottom:o.y+r.height},s=this.findIntersectingLevels(t,a,o.actualLevel);this.updateRearBounds(t,null,[{rBounds:a}],o.actualLevel,s)}}},t.prototype.splitRows=function(t,e,i){for(var r=0;r<t.length;r++){e[parseInt(r.toString(),10)]=[],i[parseInt(r.toString(),10)]=[];var n=void 0;if(n=t[parseInt(r.toString(),10)].length,t[parseInt(r.toString(),10)].length%2!=1){n=Math.ceil(t[parseInt(r.toString(),10)].length/2);for(var o=0;o<n;o++)e[parseInt(r.toString(),10)].push(t[parseInt(r.toString(),10)][parseInt(o.toString(),10)])}for(var a=e[parseInt(r.toString(),10)].length;a<t[parseInt(r.toString(),10)].length;a++)i[parseInt(r.toString(),10)].push(t[parseInt(r.toString(),10)][parseInt(a.toString(),10)])}},t.prototype.updateVerticalTree=function(t,e,i,r,n,o){var a,s,h,d,l,c,p,g,u,f,m,y,v,b,S=t.graphNodes[e.id],w=t.nameTable[S.tree.children[0]],x=-1!==t.orientation.indexOf("Left"),I="Left"===S.tree.type?-1:0,P=i,C=r,T=n,A=[],O=[];for(m=0;m<S.tree.children.length;m++){if("Alternate"===S.tree.type&&(v=m%2==0&&S.tree.children.length>2?"Left":"Right",I=m%2==0&&S.tree.children.length>2?-1:0),P=i+this.findOffset(t,e,S,v),a=t.nameTable[S.tree.children[parseInt(m.toString(),10)]],d=x?a.actualSize.height:a.actualSize.width,l=x?a.actualSize.width:a.actualSize.height,h=this.updateTree(t,P+I*d,C,a,n+1,void 0,!0),g={x:(s=t.graphNodes[a.id]).x,y:s.y,right:s.x+d,bottom:s.y+l},0===m?(this.uniteRects(h,g),p=h):this.uniteRects(p,h),!s.prevBounds||"Alternate"===S.tree.type&&m%2==1&&S.tree.children.length>2||(b=void 0!==b?Math.min(s.canMoveBy,b):s.canMoveBy),S.maxLevel=Math.max(S.maxLevel||0,s.maxLevel||0),"Alternate"===S.tree.type&&S.tree.children.length>2&&m%2==0?(0!==m&&(C=c.bottom+t.verticalSpacing/2),O.push({rBounds:g}),s.levelBounds&&(O=O.concat(s.levelBounds))):(C="Alternate"===S.tree.type&&S.tree.children.length>2?Math.max(h.bottom,c.bottom)+t.verticalSpacing/2:h.bottom+t.verticalSpacing/2,n=S.maxLevel,A.push({rBounds:g}),f?this.uniteRects(f,g):f={x:s.x,y:s.y,right:s.x+d,bottom:s.y+l},s.levelBounds&&(A=A.concat(s.levelBounds))),0===m&&(S.firstChild={x:s.x,canMoveBy:s.canMoveBy,child:a.id}),this.hasChild(t,a))if(!S.firstChild||S.firstChild.x>=s.firstChild.x){if(s.firstChild&&S.firstChild.canMoveBy<s.canMoveBy){var D=S.firstChild.canMoveBy;s.canMoveBy=D,t.graphNodes[S.firstChild.child].canMoveBy=D,S.firstChild.canMoveBy=D}S.firstChild={x:s.firstChild.x,canMoveBy:void 0!==b?b:s.canMoveBy,child:a.id}}else s.firstChild&&s.translated&&S.firstChild.canMoveBy>s.canMoveBy&&(S.firstChild.canMoveBy=t.graphNodes[S.firstChild.child].canMoveBy=s.canMoveBy);c=g}return o?S.levelBounds=A:("Alternate"===S.tree.type&&S.tree.children.length>2&&(u={x:O[0].rBounds.x,y:O[0].rBounds.y,right:O[O.length-1].rBounds.right,bottom:O[O.length-1].rBounds.bottom},y=this.findIntersectingLevels(t,u,T+1),this.updateRearBounds(t,null,O,T+1,y)),y=this.findIntersectingLevels(t,f||p,T+1),this.updateRearBounds(t,null,f?A:[{rBounds:p}],T+1,y)),isNaN(b)||(t.graphNodes[w.id].canMoveBy=b),S.childBounds=p,S.mid=i,p},t.prototype.splitChildrenInRows=function(t,e){var i,r=t.graphNodes[e.id];i=4;var n,o=[];n=r.tree.children.length;var a=this.extend(r.tree.children);if(r.tree.rows){r.tree.children.length;var s=r.tree.rows;i=s%2==0?s:s-1}else 3===r.tree.children.length||4===r.tree.children.length?i=2:5===r.tree.children.length&&(i=3);for(;n>0;)o[o.length]=a.splice(0,i),(n-=i)<i&&(n%2==0?i=n:1!==n&&(i=n-1),n<i&&(i=n));return o},t.prototype.extend=function(t){var e,i=[];for(e=0;e<t.length;e++)i[parseInt(e.toString(),10)]=t[parseInt(e.toString(),10)];return i},t.prototype.findOffset=function(t,e,i,r){var n=0,o=-1!==t.orientation.indexOf("Left")?e.actualSize.height:e.actualSize.width,a=r||i.tree.type;switch(n=i.tree.offset||20,"Alternate"===i.tree.type&&n>=t.horizontalSpacing&&(n=t.horizontalSpacing/2),a){case"Left":n=o/2-n;break;case"Right":n+=o/2}return n},t.prototype.uniteRects=function(t,e){t.x=Math.min(t.x,e.x),t.right=Math.max(t.right,e.right),t.bottom=Math.max(t.bottom,e.bottom)},t.prototype.spaceLeftFromPrevSubTree=function(t,e,i){for(var r,n,o=t.graphNodes[e.id],a=t.horizontalSpacing,s=0;s<o.intersect.length;s++)n=t.levels[o.intersect[parseInt(s.toString(),10)]].rBounds,r=i.x-(n.right+a),(void 0===o.diff||r<o.diff)&&(o.diff=r,o.prevBounds=t.levels[o.intersect[parseInt(s.toString(),10)]].rBounds)},t.prototype.findIntersectingLevels=function(t,e,i,r){var n={x:e.x,y:e.y,right:e.right,bottom:e.bottom};n.y-=t.verticalSpacing/2,n.bottom+=t.verticalSpacing/2;var o,a,s=[];a=void 0!==r?r:i,o=t.levels[parseInt(a.toString(),10)]?t.levels[parseInt(a.toString(),10)].rBounds:null;do{if(o&&(n.y<o.y&&n.bottom>o.y||n.y<o.bottom&&o.bottom<n.bottom||n.y>=o.y&&n.bottom<=o.bottom||n.y<o.y&&n.bottom>o.bottom)){s.splice(0,0,a)}else if(o&&o.bottom<n.y)break;a--,o=t.levels[parseInt(a.toString(),10)]?t.levels[parseInt(a.toString(),10)].rBounds:null}while(a>=0);a=(void 0!==r?r:i)+1,o=t.levels[parseInt(a.toString(),10)]?t.levels[parseInt(a.toString(),10)].rBounds:null;do{if(o&&(n.y<o.y&&n.bottom>o.y||n.y<o.bottom&&o.bottom<n.bottom||n.y>=o.y&&n.bottom<=o.bottom||n.y<o.y&&n.bottom>o.bottom))s.push(a);else if(o&&o.y>n.bottom)break;a++,o=t.levels[parseInt(a.toString(),10)]?t.levels[parseInt(a.toString(),10)].rBounds:null}while(a<=t.levels.length);return s},t.prototype.findLevel=function(t,e,i){var r,n,o=e;for(r=0,n=t.levels[parseInt(r.toString(),10)]?t.levels[parseInt(r.toString(),10)].rBounds:null;r<t.levels.length;){if(n&&o.bottom<n.y)return r;r++,n=t.levels[parseInt(r.toString(),10)]?t.levels[parseInt(r.toString(),10)].rBounds:null}return r},t.prototype.getParentNode=function(t,e){return t.nameTable[t.nameTable[e.inEdges[0]].sourceID]},t.prototype.updateEdges=function(t,e,i,r,n){var o,a=t.graphNodes[e.id];if(e.outEdges&&e.outEdges.length&&(e.isExpanded||r===yt.Render))for(o=0;o<e.outEdges.length;o++){var s=t.nameTable[t.nameTable[e.outEdges[parseInt(o.toString(),10)]].targetID];s&&!s.excludeFromLayout&&(-1===a.tree.children.indexOf(s.id)&&a.tree.children.push(s.id),s.outEdges&&s.outEdges.length&&s.isExpanded&&(a.tree.hasSubTree=!0),this.updateEdges(t,s,i+1,r,n))}a.tree.level=i,a.tree.hasSubTree&&(a.tree.orientation="Horizontal",a.tree.type="Center"),(t.getLayoutInfo||t.layoutInfo)&&"OrganizationalChart"===t.type&&(t.getLayoutInfo?t.getLayoutInfo(e,a.tree):la(a.tree,t.layoutInfo,n,e),"Balanced"===a.tree.type&&a.tree.hasSubTree&&(a.tree.type="Center",a.tree.orientation="Horizontal")),t.level&&"Alternate"!==a.tree.type&&i>=t.level&&(a.tree.hasSubTree=!1)},t.prototype.updateAnchor=function(t,e,i){var r,n,o=0,a=0,s=0,h=0,d=new w(0,0,i.x,i.y),l=t.bounds?t.bounds:d,c=t.orientation;if(t.fixedNode){o=(n=t.nameTable[t.fixedNode]).actualSize.width,a=n.actualSize.height,t.anchorX=n.offsetX,t.anchorY=n.offsetY;var p=n.pivot;for(t.anchorX+="RightToLeft"===t.orientation?o*p.x:-o*p.x,t.anchorY+="BottomToTop"===t.orientation?a*p.y:-a*p.y,r=n,s=0;r.inEdges.length;)r=this.getParentNode(t,r),s+=t.graphNodes[r.id].subTreeTranslation||0;-1!==t.orientation.indexOf("Left")?(h=t.graphNodes[n.id].y,"LeftToRight"===c?t.anchorX-=h:t.anchorX+=h,t.anchorY-=t.graphNodes[n.id].x+s):(h=t.graphNodes[n.id].y,t.anchorX-=t.graphNodes[n.id].x+s,"TopToBottom"===c?t.anchorY-=h:t.anchorY+=h)}else if("TopToBottom"===c||"BottomToTop"===c){switch(t.horizontalAlignment){case"Left":t.anchorX=l.x-e.x+t.margin.left;break;case"Right":t.anchorX=l.x+l.width-t.margin.right-e.right;break;case"Auto":case"Center":t.anchorX=l.x+l.width/2-(e.x+e.right)/2}switch(t.verticalAlignment){case"Auto":case"Top":var g;g=l.y+t.margin.top,t.anchorY="TopToBottom"===c?g:e.bottom+g;break;case"Bottom":var u;u=l.y+l.height-t.margin.bottom,t.anchorY="TopToBottom"===c?u-e.bottom:u;break;case"Center":var f=void 0;f=l.y+l.height/2,t.anchorY="TopToBottom"===t.orientation?f-(e.y+e.bottom)/2:f+(e.y+e.bottom)/2}}else{switch(t.horizontalAlignment){case"Auto":case"Left":var m;m=l.x+t.margin.left,t.anchorX="LeftToRight"===c?m:e.bottom+m;break;case"Right":var y;y=l.x+l.width-t.margin.right,t.anchorX="LeftToRight"===c?y-e.bottom:y;break;case"Center":f=void 0;f=l.width/2+l.x,t.anchorX="LeftToRight"===t.orientation?f-(e.y+e.bottom)/2:f+(e.y+e.bottom)/2}switch(t.verticalAlignment){case"Top":t.anchorY=l.y+t.margin.top-e.x;break;case"Auto":case"Center":t.anchorY=l.y+l.height/2-(e.right+e.x)/2;break;case"Bottom":t.anchorY=l.y+l.height-t.margin.bottom-e.right}}},t.prototype.updateConnectors=function(t,e,i){var r,n,o,a=t.graphNodes[e.id];if(e.outEdges.length)for(r=0;r<e.outEdges.length;r++)if((o=t.nameTable[e.outEdges[parseInt(r.toString(),10)]]).points=[],n=t.nameTable[o.targetID],o.visible){if(o.visited=!0,t.getConnectorSegments)t.getConnectorSegments(o);else a&&-1!==a.tree.children.indexOf(o.targetID)&&(o.segments=[],"Bezier"===o.type&&"SamePoint"===t.connectionPointOrigin&&o.segments.push(new go(o,"segments",{type:"Bezier"},!0)),"OrganizationalChart"===t.type&&"Orthogonal"===o.type&&this.updateSegments(t,o,e,n,r));n&&(n.isExpanded||this.hasChild(t,n))&&this.updateConnectors(t,n,i+1)}if(a&&a.tree.assistants.length)for(r=0;r<a.tree.assistants.length;r++)n=t.nameTable[a.tree.assistants[parseInt(r.toString(),10)]],o=t.nameTable[n.inEdges[0]],this.get3Points(t,e,n,o),(n.isExpanded||this.hasChild(t,n))&&this.updateConnectors(t,n,i+1)},t.prototype.updateSegments=function(t,e,i,r,n){var o=t.graphNodes[i.id];o.tree.assistants.length?this.updateSegmentsForHorizontalOrientation(t,i,r,e):"Horizontal"===o.tree.orientation&&"Balanced"===o.tree.type?this.updateSegmentsForBalancedTree(t,e,i,r,n):"Horizontal"===o.tree.orientation?this.updateSegmentsForHorizontalOrientation(t,i,r,e):o.tree.offset<5?this.get5Points(t,i,r,e):this.get3Points(t,i,r,e)},t.prototype.updateSegmentsForBalancedTree=function(t,e,i,r,n){var o,a=t.graphNodes[i.id];if(5===a.tree.children.length&&n>2){o=a.tree.children[1],isNaN(t.graphNodes[""+o].treeWidth)&&(t.graphNodes[""+o].treeWidth=t.nameTable[""+o].actualSize.width);var s=3!==n?1:-1;if(-1!==t.orientation.indexOf("Left"))t.nameTable[""+o].offsetY-t.graphNodes[""+o].treeWidth/2-t.verticalSpacing*s/2;else t.nameTable[""+o].offsetX,t.graphNodes[""+o].treeWidth,t.horizontalSpacing;this.getSegmentsForMultipleRows(t,i,r,e)}else a.tree.children.length>5?n<4||n<a.tree.rows?this.getSegmentsForMultipleRows(t,i,r,e):this.updateSegmentsForHorizontalOrientation(t,i,r,e):4===a.tree.children.length?n<2||n<a.tree.rows?this.getSegmentsForMultipleRows(t,i,r,e):this.updateSegmentsForHorizontalOrientation(t,i,r,e):this.getSegmentsForMultipleRows(t,i,r,e)},t.prototype.get3Points=function(t,e,i,r){var n=[],o=this.getBounds(e),a=this.getBounds(i);if(-1!==t.orientation.indexOf("Top")){var s=0===t.orientation.indexOf("Top")?o.bottomCenter:o.topCenter,h=e.offsetX>i.offsetX?a.middleRight:a.middleLeft;n.push(s,{x:o.bottomCenter.x,y:h.y},h)}else{s=0===t.orientation.indexOf("Left")?o.middleRight:o.middleLeft,h=e.offsetY>i.offsetY?a.bottomCenter:a.topCenter;n.push(s,{x:a.bottomCenter.x,y:o.middleRight.y},h)}this.getSegmentsFromPoints(n,r)},t.prototype.get5Points=function(t,e,i,r){var n,o,a,s,h=[],d=this.getBounds(e),l=this.getBounds(i);-1!==t.orientation.indexOf("Top")?(n=e.offsetY<i.offsetY?d.bottomCenter:d.topCenter,s=t.verticalSpacing/4*(e.offsetY<i.offsetY?1:-1),a=t.horizontalSpacing/2*(e.offsetX>i.offsetX?1:-1),o=e.offsetX>i.offsetX?l.middleRight:l.middleLeft,h.push(n,{x:n.x,y:n.y+s},{x:o.x+a,y:n.y+s},{x:o.x+a,y:o.y},o)):(n=e.offsetX>i.offsetX?d.middleLeft:d.middleRight,o=e.offsetY>i.offsetY?l.bottomCenter:l.topCenter,a=t.horizontalSpacing/4*(e.offsetX<i.offsetX?1:-1),s=t.verticalSpacing/2*(e.offsetY>i.offsetY?1:-1),h.push(n,{x:n.x+a,y:n.y},{x:n.x+a,y:n.y+s},{x:o.x,y:n.y+s},o)),this.getSegmentsFromPoints(h,r)},t.prototype.getSegmentsFromPoints=function(t,e){for(var i,r=[],n=0;n<t.length-2;n++)(i=new uo(e,"segments",{type:"Orthogonal"},!0)).direction=o.direction(t[parseInt(n.toString(),10)],t[n+1]),i.length=o.distancePoints(t[parseInt(n.toString(),10)],t[n+1]),r.push(i);e.segments=r},t.prototype.getSegmentsForMultipleRows=function(t,e,i,r){var n,a,s=[],h=this.getBounds(i),d=this.getBounds(e);switch(t.orientation){case"TopToBottom":n={x:d.bottomCenter.x,y:d.bottomCenter.y+t.verticalSpacing/4},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(d.bottomCenter,n),a.length=o.distancePoints(d.bottomCenter,n),s.push(a);break;case"BottomToTop":n={x:d.bottomCenter.x,y:d.topCenter.y-t.verticalSpacing/4},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(d.topCenter,n),a.length=o.distancePoints(d.topCenter,n),s.push(a);break;case"LeftToRight":if(n={x:d.middleRight.x+t.verticalSpacing/4,y:d.middleRight.y},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(d.middleRight,n),a.length=o.distancePoints(d.middleRight,n),s.push(a),h.center.y!==d.center.y){var l={x:d.middleRight.x+t.verticalSpacing/4,y:h.middleLeft.y};(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(n,l),a.length=o.distancePoints(n,l),s.push(a)}break;case"RightToLeft":if(n={x:d.middleLeft.x-t.verticalSpacing/4,y:d.middleRight.y},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(d.middleLeft,n),a.length=o.distancePoints(d.middleLeft,n),s.push(a),h.center.y!==d.center.y){var c={x:d.middleLeft.x-t.verticalSpacing/4,y:h.middleLeft.y};(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(c,c),a.length=o.distancePoints(c,c),s.push(a)}}r.segments=s},t.prototype.updateSegmentsForHorizontalOrientation=function(t,e,i,r){var n,a,s=[],h=this.getBounds(e),d=this.getBounds(i);switch(t.orientation){case"TopToBottom":n={x:h.bottomCenter.x,y:d.topCenter.y-t.verticalSpacing/2},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(h.bottomCenter,n),a.length=o.distancePoints(h.bottomCenter,n),s.push(a);break;case"BottomToTop":n={x:h.topCenter.x,y:d.bottomCenter.y+t.verticalSpacing/2},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(h.topCenter,n),a.length=o.distancePoints(h.topCenter,n),s.push(a);break;case"LeftToRight":if(n={x:d.middleLeft.x-t.verticalSpacing/2,y:h.middleRight.y},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(h.middleRight,n),a.length=o.distancePoints(h.middleRight,n),s.push(a),d.center.y!==h.center.y){var l={x:d.middleLeft.x-t.verticalSpacing/2,y:d.middleLeft.y};(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(n,l),a.length=o.distancePoints(n,l),s.push(a)}break;case"RightToLeft":if(n={x:d.middleRight.x+t.verticalSpacing/2,y:h.middleRight.y},(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(h.middleLeft,n),a.length=o.distancePoints(h.middleLeft,n),s.push(a),d.center.y!==h.center.y){var c={x:d.middleRight.x+t.verticalSpacing/2,y:d.middleLeft.y};(a=new uo(r,"segments",{type:"Orthogonal"},!0)).direction=o.direction(n,c),a.length=o.distancePoints(n,c),s.push(a)}}return r.segments=s,[]},t.prototype.updateNodes=function(t,e,i,r,n,o){var a,s,h,d,l,c;if(e&&!e.excludeFromLayout){h=e.actualSize.width,d=e.actualSize.height,l=t.anchorX,c=t.anchorY,"LeftToRight"===t.orientation?(l+=t.graphNodes[e.id].y+h/2,c+=t.graphNodes[e.id].x+i+d/2):"RightToLeft"===t.orientation?(l-=t.graphNodes[e.id].y+h/2,c+=t.graphNodes[e.id].x+i+d/2):"TopToBottom"===t.orientation?(l+=t.graphNodes[e.id].x+i+h/2,c+=t.graphNodes[e.id].y+d/2):(l+=t.graphNodes[e.id].x+i+h/2,c-=t.graphNodes[e.id].y+d/2),t.graphNodes&&(l+=n=n||0,c+=o=o||0,this.isAnimation||(e.offsetX=l,e.offsetY=c));var p={id:e.id,differenceX:l-e.offsetX,differenceY:c-e.offsetY};t.objects.push(p);var g=[];if(this.hasChild(t,e))for(a=0;a<t.graphNodes[e.id].tree.children.length;a++)s=t.nameTable[t.graphNodes[e.id].tree.children[parseInt(a.toString(),10)]],this.updateNodes(t,s,i+(t.graphNodes[e.id].subTreeTranslation||0),r,n,o),g.push(s);if(t.graphNodes[e.id].tree.assistants.length)for(a=0;a<t.graphNodes[e.id].tree.assistants.length;a++)s=t.nameTable[t.graphNodes[e.id].tree.assistants[parseInt(a.toString(),10)]],this.updateNodes(t,s,i+(t.graphNodes[e.id].subTreeTranslation||0),null,n,o)}},t}(),Nc=function(){function t(){this.isAnimation=!1}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"MindMapChart"},t.prototype.updateLayout=function(t,e,i,r,n,o){var a=this.checkRoot(t,i,n,o,e);if(a)i.fixedNode=a;else for(var s=0,h=t;s<h.length;s++){if(!((m=h[s]).excludeFromLayout||m.inEdges&&m.inEdges.length)){i.fixedNode=m.id;break}}var d=e[i.fixedNode],l=this.findFirstLevelNodes(d,i,e),c=[],p=[],g=J(i.getBranch);g=g||J(this.getBranch);for(var u=0,f=l;u<f.length;u++){var m,y=g(m=f[u],l);"Left"===(y=m&&m.branch?m.branch:y)?c.push(m):p.push(m)}var v=new w(0,0,r.x,r.y);e[i.fixedNode].offsetX=v.x+v.width/2,e[i.fixedNode].offsetY=v.y+v.height/2,c.length&&this.updateMindMapBranch(t,p,e,i,r,n,"Left"),p.length&&this.updateMindMapBranch(t,c,e,i,r,n,"Right")},t.prototype.checkRoot=function(t,e,i,r,n){for(var o=0,a=t;o<a.length;o++){var s=a[o];if(!s.excludeFromLayout){if(s.data&&(s.data[""+i].toString()===r||s.data[""+i].toString()===e.root))return s.id;if(!s.data&&s.id===e.root)return s.id}}return""},t.prototype.updateMindMapBranch=function(t,e,i,r,n,o,a){var s={type:"HierarchicalTree",horizontalSpacing:r.verticalSpacing,verticalSpacing:r.horizontalSpacing,verticalAlignment:r.verticalAlignment,horizontalAlignment:r.horizontalAlignment,fixedNode:r.fixedNode,getLayoutInfo:J(r.getLayoutInfo),layoutInfo:r.layoutInfo,margin:r.margin,orientation:r.orientation,root:r.fixedNode};"Vertical"===s.orientation?s.orientation="Left"===a?"TopToBottom":"BottomToTop":s.orientation="Left"===a?"LeftToRight":"RightToLeft",this.excludeFromLayout(e,i,!0),(new Rc).updateLayout(t,i,s,n,o),this.excludeFromLayout(e,i,!1)},t.prototype.getBranch=function(t,e){return e.indexOf(t)%2==0?"Left":"Right"},t.prototype.excludeFromLayout=function(t,e,i){for(var r=0,n=t;r<n.length;r++){e[n[r].id].excludeFromLayout=i}},t.prototype.findFirstLevelNodes=function(t,e,i){var r=[];if(t&&t.outEdges.length)for(var n=0,o=t.outEdges;n<o.length;n++){var a=o[n];r.push(i[i[""+a].targetID])}return r},t}(),jc=function(){function t(){}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"RadialTree"},t.prototype.updateLayout=function(t,e,i,r){var n={type:i.type,nameTable:e,anchorX:0,anchorY:0,firstLevelNodes:[],centerNode:null,levels:[],maxLevel:0,graphNodes:{},layoutNodes:[],orientation:i.orientation,horizontalSpacing:i.horizontalSpacing,verticalSpacing:i.verticalSpacing,verticalAlignment:i.verticalAlignment,horizontalAlignment:i.horizontalAlignment,fixedNode:i.fixedNode,margin:i.margin,bounds:i.bounds,objects:[],root:i.root};this.doLayout(n,t,e,r)},t.prototype.doLayout=function(t,e,i,r){for(var n,o=0;o<e.length;o++)(n=e[parseInt(o.toString(),10)]).excludeFromLayout||(t.graphNodes[n.id]=this.setUpLayoutInfo(t,n),n.inEdges&&n.inEdges.length||t.firstLevelNodes.push(n));t.root&&i[t.root]?t.centerNode=i[t.root]:t.firstLevelNodes.length&&(t.centerNode=t.firstLevelNodes[0],t.root=t.centerNode.id),t.centerNode&&(this.updateEdges(t,t.centerNode,0,i),this.depthFirstAllignment(t,t.centerNode,0,0),this.populateLevels(t),this.transformToCircleLayout(t),this.updateAnchor(t,r),this.updateNodes(t,t.centerNode,i))},t.prototype.updateEdges=function(t,e,i,r){var n=t.graphNodes[e.id];t.layoutNodes.push(n),n.level=i,n.visited=!0,t.maxLevel=Math.max(t.maxLevel,i);for(var o=0;o<e.outEdges.length;o++){var a=r[r[e.outEdges[parseInt(o.toString(),10)]].targetID];a.excludeFromLayout||a.visited||(n.children.push(a),this.updateEdges(t,a,i+1,r))}},t.prototype.depthFirstAllignment=function(t,e,i,r){var n,o=t.graphNodes[e.id];if(o.children.length){r+=300;for(var a=0;a<o.children.length;a++)i=(n=this.depthFirstAllignment(t,o.children[parseInt(a.toString(),10)],i,r)).x,r=n.y;o.children=o.children.sort(function(e,i){return t.graphNodes[e.id].x-t.graphNodes[i.id].x});var s=t.graphNodes[o.children[0].id].min,h=t.graphNodes[o.children[o.children.length-1].id].max;if(o.x=s+(h-s)/2,i=h+t.horizontalSpacing,o.segmentOffset=h+t.horizontalSpacing,o.x-=o.width/2,o.y-=o.height/2,o.min=s,o.max=h,o.x<s&&o.visited){o.x=s,i=o.x+o.width/2-(h-s)/2,o.visited=!1;for(a=0;a<o.children.length;a++)n=this.depthFirstAllignment(t,o.children[parseInt(a.toString(),10)],i,r);o.visited=!0,i=o.x+o.width+t.horizontalSpacing}i=i<(h=t.graphNodes[o.children[o.children.length-1].id].segmentOffset)?h:i,r-=300,o.y=r}else o.x=i,o.y=r,o.min=i,o.max=i+o.width,i+=o.width+t.horizontalSpacing;return{x:i,y:r}},t.prototype.populateLevels=function(t){var e=[],i=Math.min.apply(Math,t.layoutNodes.map(function(t){return t.x})),r=Math.max.apply(Math,t.layoutNodes.map(function(e){return e.x+e.width+t.horizontalSpacing}))-i;t.levels=[];for(var n=function(n){var o={};e=(e=t.layoutNodes.filter(function(t){return t.level===n?t:null})).sort(function(t,e){return t.x-e.x}),o.min=e[0].x,o.max=e[e.length-1].x+e[e.length-1].width+t.horizontalSpacing,o.actualCircumference=0,o.height=0;for(var a=0;a<e.length;a++)e[parseInt(a.toString(),10)].height>o.height&&(o.height=e[parseInt(a.toString(),10)].height),o.actualCircumference+=Math.max(e[parseInt(a.toString(),10)].width,e[parseInt(a.toString(),10)].height),a!==e.length-1&&(o.actualCircumference+=t.horizontalSpacing);o.circumference=o.max-o.min,o.actualCircumference<o.circumference&&(o.circumference=(o.circumference+o.actualCircumference)/2),o.radius=o.circumference/(2*Math.PI)+o.height,o.nodes=[],n>1&&t.levels[n-1].radius+t.levels[n-1].height>=o.radius&&(o.radius=t.levels[n-1].radius+t.levels[n-1].height);for(var s=0;s<e.length;s++)e[parseInt(s.toString(),10)].ratio=Math.abs(e[parseInt(s.toString(),10)].x+e[parseInt(s.toString(),10)].width/2-i)/r,o.nodes.push(e[parseInt(s.toString(),10)]);t.levels.push(o)},o=0;o<=t.maxLevel;o++)n(o)},t.prototype.transformToCircleLayout=function(t){var e=t.graphNodes[t.centerNode.id];e.x=0,e.y=0;for(var i=1;i<t.levels.length;i++)for(var r=0;r<t.levels[parseInt(i.toString(),10)].nodes.length;r++){var n=t.levels[parseInt(i.toString(),10)].nodes[parseInt(r.toString(),10)];n.x=Math.cos(360*n.ratio*Math.PI/180)*(t.levels[parseInt(i.toString(),10)].radius+t.verticalSpacing*i),n.y=Math.sin(360*n.ratio*Math.PI/180)*(t.levels[parseInt(i.toString(),10)].radius+t.verticalSpacing*i),t.anchorX=Math.min(t.anchorX,n.x),t.anchorY=Math.min(t.anchorY,n.y)}},t.prototype.updateAnchor=function(t,e){t.anchorX=t.centerNode.offsetX||e.x/2,t.anchorY=t.centerNode.offsetY||e.y/2},t.prototype.updateNodes=function(t,e,i){var r=t.graphNodes[e.id],n=r.x+t.anchorX,o=r.y+t.anchorY;e.offsetX=n,e.offsetY=o;for(var a=0;a<r.children.length;a++){var s=r.children[parseInt(a.toString(),10)];this.updateNodes(t,i[s.id],i)}},t.prototype.setUpLayoutInfo=function(t,e){var i={};return i.name=e.id,i.x=0,i.y=0,i.min=0,i.max=0,i.width=e.actualSize.width,i.height=e.actualSize.height,i.children=[],i.level=0,i.ratio=0,i.visited=!1,i},t}(),Hc=function(){function t(t){this.velocityX=0,this.velocityY=0,this.nodes=[],this.graphNode=t;var e=Yc(this.graphNode);this.location=e.center,this.nodes=[],t.treeInfo.parents||(t.treeInfo.parents=[]),t.treeInfo.children||(t.treeInfo.children=[]),this.nodes=t.treeInfo.parents.concat(t.treeInfo.children)}return t.prototype.applyChanges=function(){this.graphNode.treeInfo.center=this.location},t}(),Wc=function(){function t(){this.cdCOEF=.442,this.cfMAXVELOCITY=50,this.cnMAXITERACTION=1e3,this.cnSPRINGLENGTH=100,this.mszMaxForceVelocity={width:this.cfMAXVELOCITY,height:this.cfMAXVELOCITY},this.springLength=0,this.springFactor=this.cdCOEF,this.maxIteration=this.cnMAXITERACTION,this.springLength=this.cnSPRINGLENGTH}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"SymmetricalLayout"},t.prototype.doGraphLayout=function(t){var e=this.selectedNode;e.treeInfo.Bounds=t.getModelBounds(t.nodes);var i=e.treeInfo.GraphNodes,r=this.convertGraphNodes(i),n=r.length;n=Math.min(this.maxIteration,n*n*n),this.preLayoutNodes(r,e.treeInfo.Bounds);for(var o=0,a=n;o<a;o++)this.makeSymmetricLayout(r),this.appendForces(r);this.resetGraphPosition(r,e)},t.prototype.preLayoutNodes=function(t,e){for(var i=Math.max(e.width,e.height),r=i/2,n=i/2,o=2*Math.PI/t.length,a=o,s=0;s<t.length;s++){var h=t[parseInt(s.toString(),10)];this.getForceNode(h).location={x:r+i*Number(Math.cos(a).toFixed(2)),y:n+i*Number(Math.sin(a).toFixed(2))},a-=o}},t.prototype.doLayout=function(t){this.selectedNode=t.selectedNode,this.doGraphLayout(t)},t.prototype.makeSymmetricLayout=function(t){for(var e,i,r=0;r<t.length;r++){for(var n=t[parseInt(r.toString(),10)],o=(e=this.getForceNode(n)).nodes,a=0;a<o.length;a++){var s=o[parseInt(a.toString(),10)];this.calcNodesForce(e,this.getForceNode(s))}for(var h=0,d=o.length;h<d&&!(d<2);h++){var l=this.getForceNode(o[parseInt(h.toString(),10)]),c=h+1>=d?this.getForceNode(o[0]):this.getForceNode(o[h+1]),p=360/o.length/2*Math.PI/180,g=2*this.springLength*Math.sin(p);this.calcRelatesForce(l,c,g)}for(var u=0;u<t.length;u++){Fc((s=t[parseInt(u.toString(),10)]).id,o)||s.id===n.id||(i=this.getForceNode(s),this.updateNeigbour(e,i))}}},t.prototype.appendForces=function(t){for(var e=null,i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)],n=(e=this.getForceNode(r)).location;n.x+=Math.min(e.velocityX,this.mszMaxForceVelocity.width),n.y+=Math.min(e.velocityY,this.mszMaxForceVelocity.height),e.velocityX=0,e.velocityY=0,e.location=n}},t.prototype.resetGraphPosition=function(t,e){for(var i,r={width:Number.MAX_VALUE,height:Number.MAX_VALUE},n=null,o=0;o<t.length;o++){i=t[parseInt(o.toString(),10)];var a={x:(n=this.getForceNode(i)).location.x-i.actualSize.width/2,y:n.location.y-i.actualSize.height/2};r.width=Math.min(r.width,a.x),r.height=Math.min(r.height,a.y)}for(o=0;o<t.length;o++){i=t[parseInt(o.toString(),10)],(a=(n=this.getForceNode(i)).location).x-=r.width-(e.treeInfo.location?e.treeInfo.location.x:0),a.y-=r.height-(e.treeInfo.location?e.treeInfo.location.y:0),n.location=a,n.applyChanges()}},t.prototype.convertGraphNodes=function(t){for(var e=[],i=0,r=Object.keys(t);i<r.length;i++){var n=t[""+r[i]],o=new Hc(n);n.treeInfo.tag=o,e.push(n)}return e},t.prototype.getForceNode=function(t){return t.treeInfo.tag},t.prototype.updateNeigbour=function(t,e){if(null!=e&&null!=t){var i=this.pointDistance(t.location,e.location),r=this.lineAngle(t.location,e.location),n=.9*this.springLength;i<n&&this.calcForce(i,n,r,e)}},t.prototype.lineAngle=function(t,e){var i=0,r=e.x-t.x,n=e.y-t.y;return 0===r?i=n<=0?3*Math.PI/2:Math.PI/2:0===n?i=r<0?Math.PI:0:(i=Math.atan(n/r),r<0&&n>0||r<0&&n<0?i=Math.PI+i:r>0&&n<0&&(i=2*Math.PI+i)),i},t.prototype.pointDistance=function(t,e){var i=e.x-t.x,r=e.y-t.y,n=i*i+r*r;return Math.sqrt(n)},t.prototype.calcRelatesForce=function(t,e,i){var r=this.pointDistance(t.location,e.location),n=this.lineAngle(t.location,e.location);r<i&&this.calcForce(r,i,n,e)},t.prototype.updateLayout=function(t,e,i,r,n,o){(new _c).updateLayout(t,e,i,r,n,o)},t.prototype.calcNodesForce=function(t,e){var i=this.pointDistance(t.location,e.location),r=this.lineAngle(t.location,e.location);(i>this.springLength||i<this.springLength)&&this.calcForce(i,this.springLength,r,e)},t.prototype.calcForce=function(t,e,i,r){var n=r.nodes.length,o=(t-e)*(this.springFactor/(n*n)*Math.sqrt(n)),a=Math.cos(i)*o,s=Math.sin(i)*o;r.velocityX-=a,r.velocityY-=s},t}(),_c=function(){function t(){this.visitedStack=[],this.cycleEdgesCollection=[],this.graphObjects=[],this.passedNodes=[]}return t.prototype.updateLayout=function(t,e,i,r,n,o){this.nameTable=r,this.nodes=t,this.connectors=e;var a=t;a.length>0&&(this.mhelperSelectedNode=N(a[0]));for(var s=0,h=t;s<h.length;s++){var d=f=h[s];d.treeInfo={},d.treeInfo.graphType="Node",this.graphObjects.push(d)}for(var l=0,c=e;l<c.length;l++){var p=c[l];p.treeInfo={},p.treeInfo.graphType="Connector",this.graphObjects.push(p)}this.updateLayout1(this.graphObjects,i);for(var g=this.getModelBounds(a),u=0;u<a.length;u++){var f=a[parseInt(u.toString(),10)],m=(o.x-g.width)/2,y=n.margin,v=f.treeInfo.tag.location.x-(f.offsetX-f.actualSize.width/2)-g.x+m+y.left,b=f.treeInfo.tag.location.y-(f.offsetY-f.actualSize.height/2)-g.y+y.top;f.offsetX+=v,f.offsetY+=b,delete f.treeInfo}return!0},t.prototype.getModelBounds=function(t){t=t.slice();for(var e,i=null,r=null,n=0;n<t.length;n++){var o=Yc(e=t[parseInt(n.toString(),10)]);i=new w(e.treeInfo.tag?e.treeInfo.tag.location.x:o.x,e.treeInfo.tag?e.treeInfo.tag.location.y:o.y,e.actualSize.width,e.actualSize.height),r=r?r.uniteRect(i):i}return r},t.prototype.updateLayout1=function(t,e){this.detectCyclesInGraph(t);var i=t.length;if(i>0){for(var r=[],n=[],o=[],a=0;a<t.length;a++){var s=t[parseInt(a.toString(),10)];void 0===s.treeInfo.isCycleEdge&&(s.treeInfo.isCycleEdge=!1),"Connector"!==s.treeInfo.graphType||s.treeInfo.isCycleEdge?"Connector"===s.treeInfo.graphType?r.push(s):o.push(s):n.push(s)}for(n=n.concat(o),n=r.concat(n);i>this.dictionaryLength(this.passedNodes);)this.getNodesToPosition(n),null!=this.selectedNode&&(e.doLayout(this),this.selectedNode=null,this.visitedStack=[]);this.passedNodes=null,this.selectedNode=null}return!1},t.prototype.getNodesToPosition=function(t){for(var e=0;e<t.length;e++){var i=t[parseInt(e.toString(),10)];this.selectNodes(i);break}},t.prototype.selectNodes=function(t){var e=t;"Connector"===t.treeInfo.graphType?this.exploreGraphEdge(t):null!=e&&this.addNode(t,"passed")&&(this.addNode(t,"selected"),this.isConnectedToAnotherNode(e)&&(this.selectedNode={treeInfo:{}},this.selectedNode.treeInfo.LeftMargin=10,this.selectedNode.treeInfo.TopMargin=10,this.selectConnectedNodes(e)))},t.prototype.selectConnectedNodes=function(t){var e=this.selectedNode;e.treeInfo.GraphNodes||(e.treeInfo.GraphNodes={});var i=t;this.addNode(i,"passed");var r=i.id;if(this.dictionaryContains(e.treeInfo.GraphNodes,i)){var n=e.treeInfo.GraphNodes[""+r];n.treeInfo.Added&&(n.treeInfo.Added=!1,this.getConnectedRelatives(n),this.exploreRelatives(t))}else{var o=this.addGraphNode(i);this.getConnectedRelatives(o),this.exploreRelatives(t)}},t.prototype.exploreRelatives=function(t){this.exploreRelatives1(t,"Parents"),this.exploreRelatives1(t,"Children")},t.prototype.exploreRelatives1=function(t,e){var i=[];i="Parents"===e?t.inEdges:t.outEdges;for(var r=0;r<i.length;r++){var n=this.nameTable[i[parseInt(r.toString(),10)]];if(this.addNode(n,"passed")){var o=this.nameTable[n.sourceID],a=this.nameTable[n.targetID];"Parents"===e&&null!=o&&Fc(o.id,this.nodes)?this.selectConnectedNodes(this.nameTable[n.sourceID]):"Children"===e&&null!=a&&Fc(a.id,this.nodes)&&this.selectConnectedNodes(this.nameTable[n.targetID])}}},t.prototype.getConnectedRelatives=function(t){this.getConnectedParents(t),this.getConnectedChildren(t)},t.prototype.dictionaryContains=function(t,e){for(var i=Object.keys(t),r=0;r<i.length;r++)if(i[parseInt(r.toString(),10)]===e.id)return!0;return!1},t.prototype.dictionaryLength=function(t){return Object.keys(t).length},t.prototype.getConnectedChildren=function(t){for(var e=this.selectedNode,i=t,r=0;r<i.outEdges.length;r++){var n=this.nameTable[i.outEdges[parseInt(r.toString(),10)]];if(!n.treeInfo.isCycleEdge){var o=this.nameTable[n.targetID];if(Fc(o.id,this.nodes)&&null!=o&&o.visible){var a=void 0;this.dictionaryContains(e.treeInfo.GraphNodes,o)?a=e.treeInfo.GraphNodes[o.id]:(a=this.addGraphNode(o)).treeInfo.Added=!0,t.treeInfo.children||(t.treeInfo.children=[]),a.treeInfo.parents||(a.treeInfo.parents=[]),this.setNode(a.treeInfo.parents,t),this.findNode(t.treeInfo.children,a.id)<0&&t.treeInfo.children.push(a)}}}},t.prototype.getConnectedParents=function(t){for(var e=this.selectedNode,i=t,r=0;r<i.inEdges.length;r++){var n=this.nameTable[i.inEdges[parseInt(r.toString(),10)]];if(!n.treeInfo.isCycleEdge){var o=this.nameTable[n.sourceID];if(Fc(o.id,this.nodes)&&null!=o&&o.visible){var a=void 0;this.dictionaryContains(e.treeInfo.GraphNodes,o)?a=e.treeInfo.GraphNodes[o.id]:(a=this.addGraphNode(o)).treeInfo.Added=!0,t.treeInfo.parents||(t.treeInfo.parents=[]),a.treeInfo.children||(a.treeInfo.children=[]),this.setNode(a.treeInfo.children,t),this.findNode(t.treeInfo.parents,a.id)<0&&t.treeInfo.parents.push(a)}}}},t.prototype.setNode=function(t,e){var i=this.findNode(t,e.id);i>=0&&i<t.length?t[parseInt(i.toString(),10)]=e:t.push(e)},t.prototype.findNode=function(t,e){var i=-1;if(null!=t&&""!==e)for(var r=0,n=t.length;r<n;r++){var o=t[parseInt(r.toString(),10)];if(null!=o&&o.id===e){i=r;break}}return i},t.prototype.addGraphNode=function(t){var e=t;this.selectedNode.treeInfo.GraphNodes[e.id]=e;var i=this.mhelperSelectedNode;return null!=i&&t.id===i.id&&(this.mhelperSelectedNode=e),e},t.prototype.isConnectedToAnotherNode=function(t){var e=!1;return t.inEdges.concat(t.outEdges).length>0&&(null!=t.inEdges&&t.inEdges.length>0&&(e=this.searchEdgeCollection(t.inEdges,"FromNode")),!e&&null!=t.outEdges&&t.outEdges.length>0&&(e=this.searchEdgeCollection(t.outEdges,"ToNode"))),e},t.prototype.searchEdgeCollection=function(t,e){for(var i=!1,r=0;r<t.length-1;r++){var n=this.nameTable[t[parseInt(r.toString(),10)]];if(this.addNode(n,"passed")&&(!n.treeInfo.isCycleEdge&&("FromNode"===e&&null!=this.nameTable[n.sourceID]||"ToNode"===e&&null!=this.nameTable[n.targetID]))){i=!0;break}}return i},t.prototype.exploreGraphEdge=function(t){var e=t;if(null!=e&&!e.treeInfo.isCycleEdge&&this.addNode(t,"passed")){this.addNode(t,"selected");var i=this.nameTable[e.sourceID];this.nameTable[e.targetID];null!=i&&this.selectNodes(i)}},t.prototype.addNode=function(t,e){var i=t;return"passed"!==e&&i.visible||this.dictionaryContains(this.passedNodes,i)||(this.passedNodes[i.id]=i),!!i.visible},t.prototype.detectCyclesInGraph=function(t){for(var e=[],i=[],r=0;r<t.length;r++)"Connector"!==t[parseInt(r.toString(),10)].treeInfo.graphType&&e.push(t[parseInt(r.toString(),10)]);if(e.length>0)for(i.push(e[0]),this.visitedStack.push(e[0]);i.length>0;){var n=i[i.length-1],o=this.getUnVisitedChildNodes(n);if(o.length>0){var a=o[0],s=o[o.length-1];Fc(a.id,this.visitedStack)?(s.treeInfo.isCycleEdge=!0,this.cycleEdgesCollection.push(s)):(i.push(a),this.visitedStack.splice(0,0,a))}else i.pop()}},t.prototype.getUnVisitedChildNodes=function(t){var e=[];if(t.outEdges.length>0){for(var i=0;i<t.outEdges.length;i++){var r=this.nameTable[t.outEdges[parseInt(i.toString(),10)]];if(!Fc(r.id,this.visitedStack)){var n=this.nameTable[r.targetID];return null!=n&&e.push(n),e.push(r),this.visitedStack.splice(0,0,r),e}}return e}return e},t}();function Yc(t){var e=t.offsetX-t.actualSize.width*t.pivot.x,i=t.offsetY-t.actualSize.height*t.pivot.y;return new w(e,i,t.actualSize.width,t.actualSize.height)}function Fc(t,e){for(var i=0;i<e.length;i++)if(e[parseInt(i.toString(),10)].id===t)return!0;return!1}var Xc=function(){function t(){}return t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"ComplexHierarchicalTree"},t.prototype.doLayout=function(t,e,i,r,n){(new Vc).doLayout(t,e,i,r,n)},t.prototype.getLayoutNodesCollection=function(t){for(var e,i=[],r=0;r<t.length;r++)(e=t[parseInt(r.toString(),10)]).excludeFromLayout||!(e.inEdges.length+e.outEdges.length>0||0===e.offsetX&&0===e.offsetY)||e.parentId||e.processId||i.push(e);return i},t}(),Vc=function(){function t(){this.nameTable={},this.vertexTable={},this.verticesMap=new Map,this.crossReduction=new Gc,this.previousEdgeOffset=6,this.previousEdgeDistance=5,this.jettyPositions={},this.rankBottomY=null,this.limitX=null,this.rankTopY=null,this.parallelEdgeSpacing=10,this.minEdgeJetty=12}return t.prototype.createVertex=function(t,e,i,r,n,o){return{value:e,geometry:{x:i,y:r,width:n,height:o},name:e,vertex:!0,inEdges:t.inEdges.slice(),outEdges:t.outEdges.slice(),maxRowWidth:void 0,maxRowHeight:void 0}},t.prototype.getEdges=function(t){var e=[],i=this.nameTable[t.name];if(t&&!i.excludeFromLayout){for(var r=0;t.inEdges.length>0&&r<t.inEdges.length;r++){var n=this.nameTable[t.inEdges[parseInt(r.toString(),10)]];this.nameTable[n.sourceID].excludeFromLayout||e.push(n)}for(r=0;t.outEdges.length>0&&r<t.outEdges.length;r++){n=this.nameTable[t.outEdges[parseInt(r.toString(),10)]];this.nameTable[n.targetID].excludeFromLayout||e.push(n)}}return e},t.prototype.findRoots=function(t,e){for(var i=[],r=null,n=-1e5,o=0,a=Object.keys(t);o<a.length;o++){for(var s=t[""+a[o]],h=this.getEdges(s),d=0,l=0,c=0;c<h.length;c++){this.getVisibleTerminal(h[parseInt(c.toString(),10)],!0).name===s.name?d++:l++}0===l&&(e||d>0)&&i.push(s);var p=d-l;p>n&&(n=p,r=s)}return 0===i.length&&null!=r&&i.push(r),i},t.prototype.getVisibleTerminal=function(t,e){var i=this.nameTable[t.targetID];return e&&(i=this.nameTable[t.sourceID]),this.verticesMap.get(i.id)||null},t.prototype.traverse=function(t,e,i,r,n,o){if(null!=t){var a=t.name;if(null==o||null!=o[""+a]){null==r[""+a]&&(r[""+a]=t),null!=o&&delete o[""+a];for(var s=this.getEdges(t),h=[],d=0;d<s.length;d++)h[parseInt(d.toString(),10)]=this.getVisibleTerminal(s[parseInt(d.toString(),10)],!0)===t;for(d=0;d<s.length;d++)if(!e||h[parseInt(d.toString(),10)]){for(var l=this.getVisibleTerminal(s[parseInt(d.toString(),10)],!h[parseInt(d.toString(),10)]),c=1,p=0;p<s.length;p++)if(p!==d){var g=h[parseInt(p.toString(),10)];this.getVisibleTerminal(s[parseInt(p.toString(),10)],!g)===l&&(g?c++:c--)}c>=0&&(r=this.traverse(l,e,s[parseInt(d.toString(),10)],r,n,o))}}else if(null==r[""+a])for(d=0;d<n.length;d++){var u=n[parseInt(d.toString(),10)];if(null!=u[""+a]){for(var f=0,m=Object.keys(u);f<m.length;f++){var y=m[f];r[""+y]=u[""+y]}return n.splice(d,1),r}}}return r},t.prototype.getModelBounds=function(t){t=t.slice();for(var e=null,i=null,r=0;r<t.length;r++)if(e=t[parseInt(r.toString(),10)].geometry,i){var n=Math.max(i.x+i.width,e.x+e.width),o=Math.max(i.y+i.height,e.y+e.height);i.x=Math.min(i.x,e.x),i.y=Math.min(i.y,e.y),i.width=n-i.x,i.height=o-i.y}else i={x:e.x,y:e.y,width:e.width,height:e.height};return i},t.prototype.doLayout=function(t,e,i,r,n){this.nameTable=e;var o,a=i.enableRouting,s={horizontalSpacing:i.horizontalSpacing,verticalSpacing:i.verticalSpacing,orientation:i.orientation,marginX:i.margin.left,marginY:i.margin.top,enableLayoutRouting:a},h=new Zc;h.edgeMapper=[],h.diagram=n;var d=[];this.vertices=[];for(var l={},c=0;c<t.length;c++){var p=this.nameTable[t[parseInt(c.toString(),10)].id];if(!p.excludeFromLayout){var g=this.createVertex(t[parseInt(c.toString(),10)],t[parseInt(c.toString(),10)].id,0,0,t[parseInt(c.toString(),10)].actualSize.width,t[parseInt(c.toString(),10)].actualSize.height);if(this.vertices.push(g),this.verticesMap.set(g.name,g),this.vertexTable[p.id]=g,(t[parseInt(c.toString(),10)].inEdges.length>0||t[parseInt(c.toString(),10)].outEdges.length>0)&&d.push(t[parseInt(c.toString(),10)]),l[g.name]=g,h)for(var u=t[parseInt(c.toString(),10)].outEdges.slice(),f=0;f<u.length;f++){var m=e[u[parseInt(f.toString(),10)]];h.setEdgeMapper({key:m,value:[]})}}}var y=[],v="Linear"===i.arrangement||a;v=v||h&&"DifferentPoint"===i.connectionPointOrigin;var b=this.findRoots(l,v);for(c=0;c<b.length;c++){var S={};y.push(S),this.traverse(b[parseInt(c.toString(),10)],!0,null,S,y,l)}var w,x={marginX:0,marginY:0},I=[],P=!1;for(c=0;c<y.length;c++){S=y[parseInt(c.toString(),10)];for(var C=0,T=Object.keys(S);C<T.length;C++){var A=T[C];I.push(S[""+A])}("Linear"===i.arrangement&&c===y.length-1||a)&&(P=!0),o=new Uc(this,I,b,s),this.cycleStage(o),this.layeringStage(o);for(var O=o.ranks,D=O.length-1;D>=0;D--){for(var M=0,L=0,E=0,z=O[parseInt(D.toString(),10)];E<z.length;E++){var k=z[E];if("internalVertex"===this.getType(k.type)){var B=k.cell.geometry;M=Math.max(M,B.width),L=Math.max(L,B.height)}}for(var R=0,N=O[parseInt(D.toString(),10)];R<N.length;R++){k=N[R];if("internalVertex"===this.getType(k.type))(q=k.cell).maxRowWidth=M,q.maxRowHeight=L}}h&&"DifferentPoint"===i.connectionPointOrigin||P?(w={model:o,matrix:[],rowOffset:[],roots:[]},h.arrangeElements(w,i),i.ranks=w.model.ranks):"Nonlinear"===i.arrangement&&(this.crossingStage(o),x=this.placementStage(o,x.marginX,x.marginY),I=[])}var j=this.getModelBounds(this.vertices);this.updateMargin(i,s,j,r);for(c=0;c<this.vertices.length;c++){if($=this.vertices[parseInt(c.toString(),10)]){var H=this.nameTable[$.name];H.offsetX=0,H.offsetY=0;var W=$.geometry.x-(H.offsetX-H.actualSize.width/2)+s.marginX,_=$.geometry.y-(H.offsetY-H.actualSize.height/2)+s.marginY,Y=(D=W,_);"BottomToTop"===s.orientation?(a&&($.geometry.y=j.height-_-H.actualSize.height/2),Y=j.height-_):"RightToLeft"===s.orientation&&(D=j.width-W),H.offsetX+=D-H.offsetX,H.offsetY+=Y-H.offsetY,"Stretch"===i.horizontalAlignment&&"Stretch"===i.verticalAlignment||h.nodePropertyChange(H)}}if(!P)for(c=0;c<this.vertices.length;c++)this.isNodeOverLap(this.nameTable[this.vertices[parseInt(c.toString(),10)].name],i);if(h.updateLayout(r,j,i,s,d,e,this.vertexTable),a){for(var F={},X=void 0,V=0;V<w.matrix.length;V++){X=w.matrix[parseInt(V.toString(),10)].value;for(var U=0;U<X.length;U++)for(var G=X[parseInt(U.toString(),10)],Z=0;Z<G.cells.length;Z++){var q=G.cells[parseInt(Z.toString(),10)];if("internalVertex"===this.getType(q.type)){var Q=q;F[Q.id]=Q}}}this.updateRankValuess(o);c=0;for(var K=Object.keys(F);c<K.length;c++){A=K[parseInt(c.toString(),10)];this.setVertexLocationValue(F[""+A],i.orientation,j)}this.localEdgeProcessing(o,F),this.assignRankOffset(o),this.updateEdgeSetXYValue(o);var J=this.getValues(o.edgeMapper);for(c=0;c<J.length;c++){if(J[parseInt(c.toString(),10)].x.length>0)for(f=0;f<J[parseInt(c.toString(),10)].x.length;f++)"RightToLeft"!==i.orientation&&"LeftToRight"!==i.orientation?J[parseInt(c.toString(),10)].x[parseInt(f.toString(),10)]=J[parseInt(c.toString(),10)].x[parseInt(f.toString(),10)]+s.marginX:(i.orientation,J[parseInt(c.toString(),10)].x[parseInt(f.toString(),10)]=J[parseInt(c.toString(),10)].x[parseInt(f.toString(),10)]+i.verticalSpacing/2);this.setEdgePosition(J[parseInt(c.toString(),10)],o,s)}for(V=0;V<this.vertices.length;V++){var $;($=this.vertices[parseInt(V.toString(),10)]).outEdges.length>1&&this.updateMultiOutEdgesPoints($)}}},t.prototype.setEdgeXY=function(t,e,i,r){if(t&&e.source.id){for(var n=void 0,o=void 0,a=0;a<t.length;a++)for(var s=0;s<t[parseInt(a.toString(),10)].length;s++)t[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id!==e.target.id&&t[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id!==e.source.id||(t[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id===e.target.id&&void 0===n&&(n=a),t[parseInt(a.toString(),10)][parseInt(s.toString(),10)].id===e.source.id&&void 0===o&&(o=a));for(var h=void 0,d=n;d<=o;d++)void 0===h&&(h=this[d+"_RankOffset"]),void 0!==h&&h<this[d+"_RankOffset"]&&(h=this[d+"_RankOffset"]);void 0===this.edges&&(this.edges={}),this.edges[e.ids[0]]={x:e.x,y:0};var l=this.resetOffsetXValue(h,i/10);e.x[r-e.minRank-1]=l;for(s=0;s<e.edges.length;s++)e.edges[parseInt(s.toString(),10)].levelSkip=!0}},t.prototype.resetOffsetXValue=function(t,e){for(var i=0,r=Object.keys(this.edges);i<r.length;i++)for(var n=r[parseInt(i.toString(),10)],o=this.edges[""+n].x,a=0;a<o.length;a++){var s=void 0;if(this.edges[""+n].x[parseInt(a.toString(),10)]===t)return s=t+e,s=this.resetOffsetXValue(s,e)}return t},t.prototype.setEdgePosition=function(t,e,i){var r=0;if(101207!==t.temp[0]){void 0===t.maxRank&&(t.maxRank=-1),void 0===t.minRank&&(t.minRank=-1);var n=t.maxRank,o=t.minRank;n===o&&(n=t.source.maxRank,o=t.target.minRank);var a=0,s=this.jettyPositions[t.ids[0]];void 0===t.isReversed?t.isReversed=!1:t.isReversed=!0;var h=t.isReversed?t.target.cell:t.source.cell,d=!1;"TopToBottom"===e.layout.orientation||"LeftToRight"===e.layout.orientation?("TopToBottom"===e.layout.orientation&&(d=!1),"LeftToRight"===e.layout.orientation&&(d=(t.isReversed,!1))):t.isReversed||(d=!0);for(var l=0;l<t.edges.length;l++){var c=t.edges[parseInt(l.toString(),10)],p=this.getVisibleTerminal(c,!0),g=[],u=t.isReversed;if(p!==h&&(u=!u),null!=s){var f=u?2:0,m=u?d?this.rankBottomY[parseInt(o.toString(),10)]:this.rankTopY[parseInt(o.toString(),10)]:d?this.rankTopY[parseInt(n.toString(),10)]:this.rankBottomY[parseInt(n.toString(),10)],y=s[4*a+1+f];u!==d&&(y=-y),"TopToBottom"!==i.orientation&&"BottomToTop"!==i.orientation||(m+=y);var v=s[4*a+f];"TopToBottom"===i.orientation||"BottomToTop"===i.orientation?g.push(this.getPointvalue(v,m+i.marginY)):"LeftToRight"===i.orientation?g.push(this.getPointvalue(m+y,v+i.marginY)):g.push(this.getPointvalue(m,v+i.marginY))}var b=t.x.length-1,S=-1,w=-1,x=t.maxRank-1;u&&(b=0,S=t.x.length,w=1,x=t.minRank+1);for(var I=b;t.maxRank!==t.minRank&&I!==S;I+=w){var P=t.x[parseInt(I.toString(),10)]+r,C=(this.rankTopY[parseInt(x.toString(),10)]+this.rankBottomY[x+1])/2,T=(this.rankTopY[x-1]+this.rankBottomY[parseInt(x.toString(),10)])/2;if(u){var A=C;C=T,T=A}"TopToBottom"===i.orientation||"BottomToTop"===i.orientation?(g.push(this.getPointvalue(P,C+i.marginY)),g.push(this.getPointvalue(P,T+i.marginY))):(g.push(this.getPointvalue(C,P+i.marginY)),g.push(this.getPointvalue(T,P+i.marginY))),this.limitX=Math.max(this.limitX,P),x+=w}if(null!=s){f=u?2:0;var O=u?d?this.rankTopY[parseInt(n.toString(),10)]:this.rankBottomY[parseInt(n.toString(),10)]:d?this.rankBottomY[parseInt(o.toString(),10)]:this.rankTopY[parseInt(o.toString(),10)];y=s[4*a+3-f];u!==d&&(y=-y);m=O-y,v=s[4*a+2-f];"TopToBottom"===i.orientation||"BottomToTop"===i.orientation?g.push(this.getPointvalue(v,m+i.marginY)):g.push(this.getPointvalue(m,v+i.marginY))}this.setEdgePoints(c,g,e),r=0===r?this.parallelEdgeSpacing:r>0?-r:-r+this.parallelEdgeSpacing,a++}t.temp[0]=101207}},t.prototype.getPointvalue=function(t,e){return{x:Number(t)||0,y:Number(e)||0}},t.prototype.updateEdgeSetXYValue=function(t){if(t.layout.enableLayoutRouting){var e=!1;"LeftToRight"!==t.layout.orientation&&"RightToLeft"!==t.layout.orientation||(e=!0);for(var i=0;i<t.ranks.length;i++)for(var r=t.ranks[parseInt(i.toString(),10)],n=0;n<r.length;n++){var o=r[parseInt(n.toString(),10)];if(o.edges&&o.edges.length>0){var a=t.layout.horizontalSpacing>0?t.layout.horizontalSpacing/2:15,s=!0;o.minRank!==i-1&&o.maxRank!==i-1&&(s=!1),s&&this.setXY(o,i,void 0,!!e,t.ranks,a)}}}},t.prototype.getPreviousLayerConnectedCells=function(t,e){if(null==e.previousLayerConnectedCells){e.previousLayerConnectedCells=[],e.previousLayerConnectedCells[0]=[];for(var i=0;i<e.connectsAsSource.length;i++){var r=e.connectsAsSource[parseInt(i.toString(),10)];-1===r.minRank||r.minRank===t-1?e.previousLayerConnectedCells[0].push(r.target):e.previousLayerConnectedCells[0].push(r)}}return e.previousLayerConnectedCells[0]},t.prototype.compare=function(t,e){if(null!=t&&null!=e){if(e.weightedValue>t.weightedValue)return-1;if(e.weightedValue<t.weightedValue)return 1}return 0},t.prototype.localEdgeProcessing=function(t,e){for(var i=0;i<t.ranks.length;i++)for(var r=t.ranks[parseInt(i.toString(),10)],n=0;n<r.length;n++){var o=r[parseInt(n.toString(),10)];if(this.crossReduction.isVertex(o))for(var a=this.getPreviousLayerConnectedCells(i,o),s=i-1,h=0;h<2;h++){if(s>-1&&s<t.ranks.length&&null!=a&&a.length>0){for(var d=[],l=0;l<a.length;l++){var c=this.weightedCellSorter(a[parseInt(l.toString(),10)],this.getX(s,a[parseInt(l.toString(),10)]));d.push(c)}d.sort(this.compare),o.width=e[o.id].cell.geometry.width,o.height=e[o.id].cell.geometry.height;var p=void 0;"TopToBottom"===t.layout.orientation||"BottomToTop"===t.layout.orientation?(o.x[0]=e[o.id].cell.geometry.x+e[o.id].cell.geometry.width/2,p=o.x[0]-o.width/2+e[o.id].cell.geometry.height/2):(o.x[0]=e[o.id].cell.geometry.y,p=o.x[0]);var g=p+o.width,u=0,f=[];for(l=0;l<d.length;l++){var m=d[parseInt(l.toString(),10)].cell,y=void 0;if(this.crossReduction.isVertex(m)){y=0===h?o.connectsAsSource:o.connectsAsTarget;for(var v=0;v<y.length;v++)y[parseInt(v.toString(),10)].source!==m&&y[parseInt(v.toString(),10)].target!==m||(u+=y[parseInt(v.toString(),10)].edges.length,f.push(y[parseInt(v.toString(),10)]))}else u+=m.edges.length,f.push(m)}var b=(u+1)*this.previousEdgeDistance;o.width>b+2*this.previousEdgeDistance&&(p+=this.previousEdgeDistance,g-=this.previousEdgeDistance);var S=(g-p)/u,w=p+S/2,x=this.minEdgeJetty-this.previousEdgeOffset,I=0;for(l=0;l<f.length;l++){var P=f[parseInt(l.toString(),10)].edges.length;void 0===this.jettyPositions&&(this.jettyPositions={});var C=this.jettyPositions[f[parseInt(l.toString(),10)].ids[0]];null==C&&(C=[],this.jettyPositions[f[parseInt(l.toString(),10)].ids[0]]=C),l<u/2?x+=this.previousEdgeOffset:l>u/2&&(x-=this.previousEdgeOffset);for(var T=0;T<P;T++)C[4*T+2*h]=w,w+=S,C[4*T+2*h+1]=x;I=Math.max(I,x)}}a=this.getNextLayerConnectedCells(i,o),s=i+1}}},t.prototype.updateMultiOutEdgesPoints=function(t){for(var e=0;e<t.outEdges.length/2;e++){var i=this.nameTable[t.outEdges[parseInt(e.toString(),10)]],r=this.nameTable[t.outEdges[t.outEdges.length-(e+1)]],n="geometry";i.sourceID!==r.targetID&&i.targetID!==r.sourceID&&(r[""+n].points[0].y=i[""+n].points[0].y)}},t.prototype.getNextLayerConnectedCells=function(t,e){if(null==e.nextLayerConnectedCells){e.nextLayerConnectedCells=[],e.nextLayerConnectedCells[0]=[];for(var i=0;i<e.connectsAsTarget.length;i++){var r=e.connectsAsTarget[parseInt(i.toString(),10)];-1===r.maxRank||r.maxRank===t+1?e.nextLayerConnectedCells[0].push(r.source):e.nextLayerConnectedCells[0].push(r)}}return e.nextLayerConnectedCells[0]},t.prototype.getX=function(t,e){return this.crossReduction.isVertex(e)?e.x[0]:this.crossReduction.isVertex(e)?0:e.x[t-e.minRank-1]||e.temp[t-e.minRank-1]},t.prototype.getGeometry=function(t){return t.geometry},t.prototype.setEdgePoints=function(t,e,i){if(null!=t){var r=this.getGeometry(t);if(null!=e)for(var n=0;n<e.length;n++)e[n].x=e[n].x,e[n].y=e[n].y;r.points=e,t.geometry=r}},t.prototype.assignRankOffset=function(t){if(t)for(var e=0;e<t.ranks.length;e++)this.rankCoordinatesAssigment(e,t)},t.prototype.rankCoordinatesAssigment=function(t,e){for(var i,r=e.ranks[parseInt(t.toString(),10)],n=e.layout.horizontalSpacing,o=0;o<r.length;o++)void 0===this[t+"_RankOffset"]&&(this[t+"_RankOffset"]=0),i=r[parseInt(o.toString(),10)].x[0],this[t+"_RankOffset"]<i&&(this[t+"_RankOffset"]=i+r[parseInt(o.toString(),10)].width/2+n)},t.prototype.getType=function(t){return"internalVertex"===t?"internalVertex":"internalEdge"},t.prototype.updateRankValuess=function(t){this.rankTopY=[],this.rankBottomY=[];for(var e=0;e<t.ranks.length;e++)this.rankTopY[parseInt(e.toString(),10)]=Number.MAX_VALUE,this.rankBottomY[parseInt(e.toString(),10)]=-Number.MAX_VALUE},t.prototype.setVertexLocationValue=function(t,e,i){var r,n=t.cell.geometry;"TopToBottom"===e||"BottomToTop"===e?(n.x,r=n.y):(n.y,r=n.x),"RightToLeft"===e?(n.y,r=i.width-n.x-n.height,this.rankBottomY[t.minRank]=Math.max(this.rankBottomY[t.minRank],r),this.rankTopY[t.minRank]=Math.min(this.rankTopY[t.minRank],r+n.height)):(this.rankTopY[t.minRank]=Math.min(this.rankTopY[t.minRank],r),this.rankBottomY[t.minRank]=Math.max(this.rankBottomY[t.minRank],r+n.height))},t.prototype.calculateRectValue=function(t){var e={x:0,y:0,right:0,bottom:0,height:0,width:0};return e.x=t.offsetX-t.actualSize.width/2,e.right=t.offsetX+t.actualSize.width/2,e.y=t.offsetY-t.actualSize.height/2,e.bottom=t.offsetY+t.actualSize.height/2,e},t.prototype.isNodeOverLap=function(t,e){for(var i={x:0,y:0,right:0,bottom:0,height:0,width:0},r=0;r<this.vertices.length;r++){var n={x:0,y:0,width:0,height:0},o=this.nameTable[this.vertices[parseInt(r.toString(),10)].value];t.id!==o.id&&0!==o.offsetX&&0!==o.offsetY&&(i=this.calculateRectValue(t),n=this.calculateRectValue(o),this.isIntersect(n,i,e)&&("TopToBottom"===e.orientation||"BottomToTop"===e.orientation?t.offsetX+=e.horizontalSpacing:t.offsetY+=e.verticalSpacing,this.isNodeOverLap(t,e)))}},t.prototype.isIntersect=function(t,e,i){return!(Math.floor(t.right+i.horizontalSpacing)<=Math.floor(e.x)||Math.floor(t.x-i.horizontalSpacing)>=Math.floor(e.right)||Math.floor(t.y-i.verticalSpacing)>=Math.floor(e.bottom)||Math.floor(t.bottom+i.verticalSpacing)<=Math.floor(e.y))},t.prototype.updateMargin=function(t,e,i,r){var n={x:0,y:0,width:r.x,height:r.y},o=i.x,a=i.y,s=i.x+i.width,h=i.y+i.height,d=t.bounds?t.bounds:n;if("TopToBottom"===e.orientation||"BottomToTop"===e.orientation){switch(t.horizontalAlignment){case"Auto":case"Left":e.marginX=d.x-o+t.margin.left;break;case"Right":e.marginX=d.x+d.width-t.margin.right-s;break;case"Center":e.marginX=d.x+d.width/2-(o+s)/2}switch(t.verticalAlignment){case"Top":var l=d.y+t.margin.top;e.marginY="TopToBottom"===e.orientation?l:-l;break;case"Bottom":var c=d.y+d.height-t.margin.bottom;e.marginY="TopToBottom"===e.orientation?c-h:-(c-h);break;case"Auto":case"Center":var p=d.y+d.height/2;e.marginY="TopToBottom"===e.orientation?p-(a+h)/2:(a+h)/2-p}}else{switch(t.horizontalAlignment){case"Auto":case"Left":var g=d.x+t.margin.left;e.marginX="LeftToRight"===e.orientation?g:-g;break;case"Right":var u;u=d.x+d.width-t.margin.right,e.marginX="LeftToRight"===e.orientation?u-s:s-u;break;case"Center":p=void 0;p=d.width/2+d.x,e.marginX="LeftToRight"===e.orientation?p-(a+h)/2:(o+s)/2-p}switch(t.verticalAlignment){case"Top":e.marginY=d.y+t.margin.top-a;break;case"Auto":case"Center":e.marginY=d.y+d.height/2-(a+h)/2;break;case"Bottom":e.marginY=d.y+d.height-t.margin.bottom-h}}},t.prototype.placementStage=function(t,e,i){var r=this.coordinateAssignment(e,i,parent,t);return r.model=t,r.widestRankValue=null,this.placementStageExecute(r),{marginX:r.marginX+t.layout.horizontalSpacing,marginY:r.marginY+t.layout.verticalSpacing}},t.prototype.coordinateAssignment=function(t,e,i,r){var n={};return"TopToBottom"===r.layout.orientation||"BottomToTop"===r.layout.orientation?(n.horizontalSpacing=r.layout.horizontalSpacing,n.verticalSpacing=r.layout.verticalSpacing):(n.horizontalSpacing=r.layout.verticalSpacing,n.verticalSpacing=r.layout.horizontalSpacing),n.orientation="north",n.marginX=n.marginX=t,n.marginY=n.marginY=e,n},t.prototype.calculateWidestRank=function(t,e,i){var r=!1;"LeftToRight"!==t.model.layout.orientation&&"RightToLeft"!==t.model.layout.orientation||(r=!0);var n=-t.verticalSpacing,o=0;t.rankSizes=[],t.rankOffset=[];for(var a=i.maxRank;a>=0;a--){for(var s=0,h=i.ranks[parseInt(a.toString(),10)],d=r?t.marginY:t.marginX,l=0;l<h.length;l++){var c=h[parseInt(l.toString(),10)];if(this.crossReduction.isVertex(c)){var p=c;if(p.cell&&(p.cell.inEdges||p.cell.outEdges)){var g=this.nameTable[p.cell.name];p.width=g.actualSize.width,p.height=g.actualSize.height,s=Math.max(s,r?p.width:p.height)}}else if(c){var u=c,f=1;null!=u.edges&&(f=u.edges.length),c.width=10*(f-1)}r&&(c.height||(c.height=0)),d+=(r?c.height:c.width)/2,this.setXY(c,a,d,!!r),this.setTempVariable(c,a,d),(d+=(r?c.height:c.width)/2+t.horizontalSpacing)>t.widestRankValue&&(t.widestRankValue=d,t.widestRank=a),t.rankSizes[parseInt(a.toString(),10)]=d}t.rankOffset[parseInt(a.toString(),10)]=n;var m=s/2+o/2+t.verticalSpacing;o=s,"north"===t.orientation||"west"===t.orientation?n+=m:n-=m;for(l=0;l<h.length;l++){var y=h[parseInt(l.toString(),10)];this.setXY(y,a,n,!r)}}},t.prototype.setTempVariable=function(t,e,i){this.crossReduction.isVertex(t)?t.temp[0]=i:t.temp[e-t.minRank-1]=i},t.prototype.setXY=function(t,e,i,r,n,o){t&&t.cell?t.cell.inEdges.length>0||t.cell.outEdges.length>0?r?t.y[0]=i:t.x[0]=i:r?t.y[e-t.minRank-1]=i:t.x[e-t.minRank-1]=i:this.setEdgeXY(n,t,o,e)},t.prototype.rankCoordinates=function(t,e,i,r){var n=!1;"LeftToRight"!==t.model.layout.orientation&&"RightToLeft"!==t.model.layout.orientation||(n=!0);for(var o=r.ranks[parseInt(e.toString(),10)],a=0,s=(n?t.marginY:t.marginX)+(t.widestRankValue-t.rankSizes[parseInt(e.toString(),10)])/2,h=0;h<o.length;h++){var d=o[parseInt(h.toString(),10)];if(this.crossReduction.isVertex(d)){var l=this.nameTable[d.cell.name];d.width=l.actualSize.width,d.height=l.actualSize.height,a=Math.max(a,d.height)}else{var c=d,p=1;null!=c.edges&&(p=c.edges.length),n?d.height=10*(p-1):d.width=10*(p-1)}var g=(n?d.height:d.width)/2;s+=g,this.setXY(d,e,s,!!n),this.setTempVariable(d,e,s),s+=g+t.horizontalSpacing}},t.prototype.initialCoords=function(t,e,i){this.calculateWidestRank(t,e,i);for(var r=t.widestRank;r>=0;r--)r<i.maxRank&&this.rankCoordinates(t,r,e,i);for(r=t.widestRank+1;r<=i.maxRank;r++)r>0&&this.rankCoordinates(t,r,e,i)},t.prototype.isAncestor=function(t,e){if(null!=e&&null!=t.hashCode&&null!=e.hashCode&&t.hashCode.length<e.hashCode.length){if(t.hashCode===e.hashCode)return!0;if(null==t.hashCode||null==t.hashCode)return!1;for(var i=0;i<t.hashCode.length;i++)if(t.hashCode[parseInt(i.toString(),10)]!==e.hashCode[parseInt(i.toString(),10)])return!1;return!0}return!1},t.prototype.weightedCellSorter=function(t,e){var i={};return i.cell=t||null,i.weightedValue=e||0,i.visited=!1,i.rankIndex=null,i},t.prototype.minNode=function(t,e){for(var i=[],r={map:{}},n=[],o=0;o<=e.maxRank;o++){n[parseInt(o.toString(),10)]=e.ranks[parseInt(o.toString(),10)];for(var a=0;a<n[parseInt(o.toString(),10)].length;a++){var s=n[parseInt(o.toString(),10)][parseInt(a.toString(),10)],h=this.weightedCellSorter(s,o);h.rankIndex=a,h.visited=!0,i.push(h),e.setDictionaryForSorter(r,s,h,!0)}}for(var d=10*i.length,l=0;i.length>0&&l<=d;){var c=i.shift(),p=c.cell,g=c.weightedValue,u=c.rankIndex,f=this.crossReduction.getConnectedCellsOnLayer(p,g),m=this.crossReduction.getConnectedCellsOnLayer(p,g,!0),y=f?f.length:0,v=m?m.length:0,b=this.medianXValue(t,f,g+1),S=this.medianXValue(t,m,g-1),w=y+v,x=this.crossReduction.getTempVariable(p,g),I=x;w>0&&(I=(b*y+S*v)/w),1===y&&1===v?I=S*v/v:1===y&&(I=b*y/y);var P=!1,C=void 0;if(I<x-1)if(0===u)C=I,P=!0;else{var T=n[parseInt(g.toString(),10)][u-1],A=this.crossReduction.getTempVariable(T,g);(A=A+T.width/2+t.intraCellSpacing+p.width/2)<I?(C=I,P=!0):A<this.crossReduction.getTempVariable(p,g)-1&&(C=A,P=!0)}else if(I>x+1){if(u===n[parseInt(g.toString(),10)].length-1)C=I,P=!0;else{var O=n[parseInt(g.toString(),10)][u+1],D=this.crossReduction.getTempVariable(O,g);(D=D-O.width/2-t.intraCellSpacing-p.width/2)>I?(C=I,P=!0):D>this.crossReduction.getTempVariable(p,g)+1&&(C=D,P=!0)}}P&&(this.setTempVariable(p,g,C),this.updateNodeList(i,r,f,e),this.updateNodeList(i,r,m,e)),this.crossReduction.isVertex(c.cell)&&(c.visited=!1),l++}},t.prototype.updateNodeList=function(t,e,i,r){for(var n=0;n<i.length;n++){var o=i[parseInt(n.toString(),10)],a=r.getDictionaryForSorter(e,o);null!=a&&!1===a.visited&&(a.visited=!0,t.push(a))}},t.prototype.medianXValue=function(t,e,i){if(!e||0===e.length)return 0;for(var r=[],n=0;n<e.length;n++)r[parseInt(n.toString(),10)]=this.crossReduction.getTempVariable(e[parseInt(n.toString(),10)],i);if(r.sort(function(t,e){return t-e}),e.length%2==1)return r[Math.floor(e.length/2)];var o=e.length/2;return(r[o-1]+r[parseInt(o.toString(),10)])/2},t.prototype.placementStageExecute=function(t){var e=!1;"LeftToRight"!==t.model.layout.orientation&&"RightToLeft"!==t.model.layout.orientation||(e=!0),t.jettyPositions={};var i=t.model;e?t.currentYDelta=0:t.currentXDelta=0,this.initialCoords(t,{model:i},i),this.minNode(t,i);var r=1e8;t.maxIterations||(t.maxIterations=8);for(var n=0;n<t.maxIterations;n++){if((e?t.currentYDelta:t.currentXDelta)<r){for(var o=0;o<i.ranks.length;o++)for(var a=i.ranks[parseInt(o.toString(),10)],s=0;s<a.length;s++){var h=a[parseInt(s.toString(),10)];this.setXY(h,o,this.crossReduction.getTempVariable(h,o),!!e)}r=e?t.currentYDelta:t.currentXDelta}e?t.currentYDelta=0:t.currentXDelta=0}this.setCellLocations(t,i)},t.prototype.setCellLocations=function(t,e){for(var i=this.getValues(e.vertexMapper),r=0;r<i.length;r++)this.setVertexLocation(t,i[parseInt(r.toString(),10)])},t.prototype.garphModelsetVertexLocation=function(t,e,i,r){var n=e.geometry,o=null;return null!=n&&(o={x:i,y:r,width:n.width,height:n.height},n.x===i&&n.y===r||(e.geometry=o)),o},t.prototype.setVertexLocation=function(t,e){var i=!1;"LeftToRight"!==t.model.layout.orientation&&"RightToLeft"!==t.model.layout.orientation||(i=!0);var r=e.cell,n=e.x[0]-e.width/2,o=e.y[0]-e.height/2;this.garphModelsetVertexLocation(t,r,n,o),i?(t.marginY||(t.marginY=0),t.marginY=Math.max(t.marginY,o+e.height)):(t.marginX||(t.marginX=0),t.marginX=Math.max(t.marginX,n+e.width))},t.prototype.getValues=function(t){var e=[];if(t.map)for(var i=0,r=Object.keys(t.map);i<r.length;i++){var n=r[i];e.push(t.map[""+n])}return e},t.prototype.crossingStage=function(t){this.crossReduction.execute(t)},t.prototype.layeringStage=function(t){this.initialRank(t),this.fixRanks(t)},t.prototype.initialRank=function(t){for(var e=t.startNodes,i=t.getDictionaryValues(t.vertexMapper),r=e.slice();e.length>0;){for(var n=(c=e[0]).connectsAsTarget,o=c.connectsAsSource,a=!0,s=1e8,h=0;h<n.length;h++){if(5270620!==(u=n[parseInt(h.toString(),10)]).temp[0]){a=!1;break}var d=u.source;s=Math.min(s,d.temp[0]-1)}if(a){if(c.temp[0]=s,t.maxRank||(t.maxRank=1e8),t.maxRank=Math.min(t.maxRank,s),null!=o)for(h=0;h<o.length;h++){(u=o[parseInt(h.toString(),10)]).temp[0]=5270620,-1===(d=u.target).temp[0]&&(e.push(d),d.temp[0]=-2)}e.shift()}else{var l=e.shift();if(e.push(c),l===c&&1===e.length)break}}for(h=0;h<i.length;h++)i[parseInt(h.toString(),10)].temp[0]-=t.maxRank;for(h=0;h<r.length;h++)for(var c,p=0,g=(n=(c=r[parseInt(h.toString(),10)]).connectsAsSource,0);g<n.length;g++){var u;d=(u=n[parseInt(g.toString(),10)]).target;c.temp[0]=Math.max(p,d.temp[0]+1),p=c.temp[0]}t.maxRank=1e8-t.maxRank},t.prototype.fixRanks=function(t){t.fixRanks()},t.prototype.cycleStage=function(t){var e={};t.startNodes=[];for(var i=t.getDictionaryValues(t.vertexMapper),r=[],n=0;n<i.length;n++)i[parseInt(n.toString(),10)].temp[0]=-1,r[i[parseInt(n.toString(),10)].id]=i[parseInt(n.toString(),10)];var o=null;if(null!=t.roots){var a=t.roots;o=[];for(n=0;n<a.length;n++)o[parseInt(n.toString(),10)]=t.getDictionary(t.vertexMapper,a[parseInt(n.toString(),10)]),null!=o[parseInt(n.toString(),10)]&&t.startNodes.push(o[parseInt(n.toString(),10)])}t.visit("removeParentConnection",o,!0,null,{seenNodes:e,unseenNodes:r});var s=t.clone(e,null,!0);t.visit("removeNodeConnection",r,!0,s,{seenNodes:e,unseenNodes:r})},t.prototype.remove=function(t,e){var i=e.indexOf(t);return-1!==i&&e.splice(i,1),t},t.prototype.invert=function(t,e){var i=t.source;t.source=t.target,t.target=i,t.isReversed=!t.isReversed},t.prototype.getEdgesBetween=function(t,e,i){for(var r=this.getEdges(t),n=[],o=0;o<r.length;o++){var a=this.getVisibleTerminal(r[parseInt(o.toString(),10)],!0),s=this.getVisibleTerminal(r[parseInt(o.toString(),10)],!1);(a===t&&s===e||!i&&a===e&&s===t)&&n.push(r[parseInt(o.toString(),10)])}return n},t}(),Uc=function(){function t(t,e,i,r){this.multiObjectIdentityCounter=0,this.dfsCount=0,this.hierarchicalUtil=new Vc,this.roots=i,this.vertexMapper={map:{}};var n=[];this.layout=r,this.maxRank=1e8,this.edgeMapper={map:{}},this.hierarchicalLayout=t,this.createInternalCells(t,e,n,r);for(var o=0;o<e.length;o++){for(var a=n[parseInt(o.toString(),10)].connectsAsSource,s=0;s<a.length;s++){var h=a[parseInt(s.toString(),10)],d=h.edges;if(null!=d&&d.length>0){var l=d[0],c=t.getVisibleTerminal(l,!1),p=this.getDictionary(this.vertexMapper,c);n[parseInt(o.toString(),10)]===p&&(c=t.getVisibleTerminal(l,!0),p=this.getDictionary(this.vertexMapper,c)),null!=p&&n[parseInt(o.toString(),10)]!==p&&(h.target=p,0===p.connectsAsTarget.length&&(p.connectsAsTarget=[]),p.connectsAsTarget.indexOf(h)<0&&p.connectsAsTarget.push(h))}}n[parseInt(o.toString(),10)].temp[0]=1}}return t.prototype.resetEdge=function(t){var e={x:0,y:0,width:0,height:0,relative:!0};return t.geometry=e,t},t.prototype.createInternalCells=function(t,e,i,r){for(var n=0;n<e.length;n++){i[parseInt(n.toString(),10)]={x:[],y:[],temp:[],cell:e[parseInt(n.toString(),10)],id:e[parseInt(n.toString(),10)].name,connectsAsTarget:[],connectsAsSource:[],type:"internalVertex"},this.setDictionary(this.vertexMapper,e[parseInt(n.toString(),10)],i[parseInt(n.toString(),10)]);var o=t.getEdges(e[parseInt(n.toString(),10)]);i[parseInt(n.toString(),10)].connectsAsSource=[];for(var a=0;a<o.length;a++){var s=t.getVisibleTerminal(o[parseInt(a.toString(),10)],!1);if(s!==e[parseInt(n.toString(),10)]){var h=t.getEdgesBetween(e[parseInt(n.toString(),10)],s,!1),d=t.getEdgesBetween(e[parseInt(n.toString(),10)],s,!0);if(null!=h&&h.length>0&&2*d.length>=h.length){var l={x:[],y:[],temp:[],edges:h,ids:[]};if(r.enableLayoutRouting)for(var c=0;c<h.length;c++){var p=h[parseInt(c.toString(),10)];this.setDictionary(this.edgeMapper,void 0,l,p.id),this.resetEdge(p)}l.source=i[parseInt(n.toString(),10)];for(var g=0;g<h.length;g++)l.ids.push(h[parseInt(g.toString(),10)].id);l.source=i[parseInt(n.toString(),10)],i[parseInt(n.toString(),10)].connectsAsSource||(i[parseInt(n.toString(),10)].connectsAsSource=[]),i[parseInt(n.toString(),10)].connectsAsSource.indexOf(l)<0&&i[parseInt(n.toString(),10)].connectsAsSource.push(l)}}}i[parseInt(n.toString(),10)].temp[0]=0}},t.prototype.fixRanks=function(){var t=[];this.ranks=[];for(var e=0;e<this.maxRank+1;e++)t[parseInt(e.toString(),10)]=[],this.ranks[parseInt(e.toString(),10)]=t[parseInt(e.toString(),10)];var i=null;if(null!=this.roots){var r=this.roots;i=[];for(e=0;e<r.length;e++){var n=r[parseInt(e.toString(),10)],o=this.getDictionary(this.vertexMapper,n);i[parseInt(e.toString(),10)]=o}}this.visit("updateMinMaxRank",i,!1,null,{seenNodes:null,unseenNodes:null,rankList:t})},t.prototype.updateMinMaxRank=function(t,e,i){var r=i.parent,n=i.root,o=i.edge,a=i.rankList;if((n.maxRank||0===n.maxRank||(n.maxRank=-1),n.minRank||0===n.minRank||(n.minRank=-1),0===e&&n.maxRank<0&&n.minRank<0&&(a[n.temp[0]].push(n),n.maxRank=n.temp[0],n.minRank=n.temp[0],n.temp[0]=a[n.maxRank].length-1),null!=r&&null!=o)&&r.maxRank-n.maxRank>1){o.maxRank=r.maxRank,o.minRank=n.maxRank,o.temp=[],o.x=[],o.y=[];for(var s=o.minRank+1;s<o.maxRank;s++)a[parseInt(s.toString(),10)].push(o),this.hierarchicalUtil.setTempVariable(o,s,a[parseInt(s.toString(),10)].length-1)}},t.prototype.setDictionary=function(t,e,i,r){if(r){o=t.map[""+r];return t.map[""+r]=i,o}var n=e.name,o=t.map[""+n];return t.map[""+n]=i,o},t.prototype.setDictionaryForSorter=function(t,e,i,r){var n=e.id,o=t.map[""+n];return t.map[""+n]=i,o},t.prototype.getDictionary=function(t,e){this.multiObjectIdentityCounter||0===this.multiObjectIdentityCounter||(this.multiObjectIdentityCounter=0);var i=e.name;return i?t.map[""+i]:e.layoutObjectId?t.map[e.layoutObjectId]:(e.layoutObjectId="graphHierarchyNode#"+this.multiObjectIdentityCounter++,e.layoutObjectId)},t.prototype.getDictionaryForSorter=function(t,e){this.multiObjectIdentityCounter||0===this.multiObjectIdentityCounter||(this.multiObjectIdentityCounter=0);var i=e.id;return i?t.map[""+i]:e.layoutObjectId?t.map[e.layoutObjectId]:(e.layoutObjectId="graphHierarchyNode#"+this.multiObjectIdentityCounter++,e.layoutObjectId)},t.prototype.getDictionaryValues=function(t){for(var e=[],i=0,r=Object.keys(t.map);i<r.length;i++){var n=r[i];e.push(t.map[""+n])}return e},t.prototype.visit=function(t,e,i,r,n){if(null!=e){for(var o=0;o<e.length;o++){var a=e[parseInt(o.toString(),10)];null!=a&&(null==r&&(r=new Object),n.parent=null,n.root=a,n.edge=null,i?(a.hashCode=[],a.hashCode[0]=this.dfsCount,a.hashCode[1]=o,this.extendedDfs(t,r,o,0,n)):this.depthFirstSearch(t,r,0,n))}this.dfsCount++}},t.prototype.depthFirstSearch=function(t,e,i,r){var n=r.root;if(null!=n){var o=n.id;if(null==e[""+o]){e[""+o]=n,this.updateConnectionRank(t,i,0,r);for(var a=n.connectsAsSource.slice(),s=0;s<a.length;s++){var h=a[parseInt(s.toString(),10)],d=h.target;r.parent=n,r.root=d,r.edge=h,this.depthFirstSearch(t,e,i+1,r)}}else this.updateConnectionRank(t,i,1,r)}},t.prototype.updateConnectionRank=function(t,e,i,r){var n=r.parent,o=r.root,a=r.edge;if("removeParentConnection"===t||"removeNodeConnection"===t){var s="removeNodeConnection"===t;this.removeConnectionEdge(n,o,a,e,r,s)}"updateMinMaxRank"===t&&this.updateMinMaxRank(e,i,r)},t.prototype.removeConnectionEdge=function(t,e,i,r,n,o){var a=n.seenNodes,s=n.unseenNodes;this.hierarchicalUtil.isAncestor(e,t)&&(this.hierarchicalUtil.invert(i,0),this.hierarchicalUtil.remove(i,t.connectsAsSource),o?(e.connectsAsSource.push(i),t.connectsAsTarget.push(i),this.hierarchicalUtil.remove(i,e.connectsAsTarget)):(t.connectsAsTarget.push(i),this.hierarchicalUtil.remove(i,e.connectsAsTarget),e.connectsAsSource.push(i))),a[e.id]=e,delete s[e.id]},t.prototype.extendedDfs=function(t,e,i,r,n){var o=n.parent,a=n.root;n.edge;if(null!=a){if(null!=o&&(null==a.hashCode||a.hashCode[0]!==o.hashCode[0])){var s=o.hashCode.length+1;a.hashCode=o.hashCode.slice(),a.hashCode[s-1]=i}var h=a.id;if(null==e[""+h]){e[""+h]=a,this.updateConnectionRank(t,r,0,n);for(var d=a.connectsAsSource.slice(),l=0;l<d.length;l++){var c=d[parseInt(l.toString(),10)],p=c.target;n.parent=a,n.root=p,n.edge=c,this.extendedDfs(t,e,l,r+1,n)}}else this.updateConnectionRank(t,r,1,n)}},t.prototype.clone=function(t,e,i){if(null!=t&&"function"==typeof t.constructor){for(var r=t.constructor(),n=0,o=Object.keys(t);n<o.length;n++){var a=o[n];"layoutObjectId"!==a&&(null==e||e.indexOf(a)<0)&&i&&(r[""+a]=t[""+a])}return r}return null},t}(),Gc=function(){function t(){}return t.prototype.calculateCrossings=function(t){for(var e=t.ranks.length,i=0,r=1;r<e;r++)i+=this.calculateRankCrossing(r,t);return i},t.prototype.getTempVariable=function(t,e){return t?this.isVertex(t)?t.temp[0]:t.temp[e-t.minRank-1]:0},t.prototype.calculateRankCrossing=function(t,e){for(var i=0,r=e.ranks[parseInt(t.toString(),10)],n=e.ranks[t-1],o=[],a=0;a<r.length;a++){for(var s=r[parseInt(a.toString(),10)],h=this.getTempVariable(s,t),d=this.getConnectedCellsOnLayer(s,t,!0),l=[],c=0;c<d.length;c++){var p=d[parseInt(c.toString(),10)],g=this.getTempVariable(p,t-1);l.push(g)}l.sort(function(t,e){return t-e}),o[parseInt(h.toString(),10)]=l}var u=[];for(a=0;a<o.length;a++)u=u.concat(o[parseInt(a.toString(),10)]);for(var f=1;f<n.length;)f<<=1;var m=2*f-1;f-=1;var y=[];for(a=0;a<m;++a)y[parseInt(a.toString(),10)]=0;for(a=0;a<u.length;a++){var v=u[parseInt(a.toString(),10)]+f;for(++y[parseInt(v.toString(),10)];v>0;)v%2&&(i+=y[v+1]),v=v-1>>1,++y[parseInt(v.toString(),10)]}return i},t.prototype.execute=function(t){this.nestedBestRanks=[];for(var e=0;e<t.ranks.length;e++)this.nestedBestRanks[parseInt(e.toString(),10)]=t.ranks[parseInt(e.toString(),10)].slice();var i=0,r=this.calculateCrossings(t);for(e=0;e<24&&i<2;e++){this.weightedMedian(e,t);var n=this.calculateCrossings(t);if(n<r){r=n,i=0;for(var o=0;o<this.nestedBestRanks.length;o++)for(var a=t.ranks[parseInt(o.toString(),10)],s=0;s<a.length;s++){var h=a[parseInt(s.toString(),10)],d=this.nestedBestRanks[parseInt(o.toString(),10)][h.temp[0]],l=!0;h.edges&&d&&!d.edges&&(l=!1),d&&l&&(this.nestedBestRanks[parseInt(o.toString(),10)][h.temp[0]]=h)}}else{i++;for(o=0;o<this.nestedBestRanks.length;o++)for(a=t.ranks[parseInt(o.toString(),10)],s=0;s<a.length;s++){h=a[parseInt(s.toString(),10)];this.setTempVariable(h,o,s)}}if(0===r)break}var c=[],p=[];for(e=0;e<t.maxRank+1;e++)p[parseInt(e.toString(),10)]=[],c[parseInt(e.toString(),10)]=p[parseInt(e.toString(),10)];for(e=0;e<this.nestedBestRanks.length;e++)for(o=0;o<this.nestedBestRanks[parseInt(e.toString(),10)].length;o++)p[parseInt(e.toString(),10)].push(this.nestedBestRanks[parseInt(e.toString(),10)][parseInt(o.toString(),10)]);t.ranks=c},t.prototype.isVertex=function(t){return!!(t&&t.cell&&(t.cell.inEdges&&t.cell.inEdges.length||t.cell.outEdges&&t.cell.outEdges.length))},t.prototype.weightedMedian=function(t,e){var i=t%2==0;if(i)for(var r=e.maxRank-1;r>=0;r--)this.medianRank(r,i);else for(r=1;r<e.maxRank;r++)this.medianRank(r,i)},t.prototype.getConnectedCellsOnLayer=function(t,e,i){void 0===i&&(i=!1);var r="nextLayerConnectedCells",n="connectsAsTarget";if(i&&(r="previousLayerConnectedCells",n="connectsAsSource"),t){if(this.isVertex(t)){if(null==t[""+r]){t[""+r]=[],t[""+r][0]=[];for(var o=0;o<t[""+n].length;o++){var a=t[""+n][parseInt(o.toString(),10)];void 0===a.maxRank&&(a.maxRank=-1),-1===a.maxRank||(i?a.minRank===e-1:a.maxRank===e+1)?t[""+r][0].push(i?a.target:a.source):t[""+r][0].push(a)}}return t[""+r][0]}if(null==t[""+r]){t[""+r]=[];for(o=0;o<t.temp.length;o++)t[""+r][parseInt(o.toString(),10)]=[],o===(i?0:t.temp.length-1)?t[""+r][parseInt(o.toString(),10)].push(i?t.target:t.source):t[""+r][parseInt(o.toString(),10)].push(t)}return t[""+r][e-t.minRank-1]}return null},t.prototype.medianValue=function(t,e){for(var i=[],r=0,n=0;n<t.length;n++){var o=t[parseInt(n.toString(),10)];i[r++]=this.getTempVariable(o,e)}if(i.sort(function(t,e){return t-e}),r%2==1)return i[Math.floor(r/2)];if(2===r)return(i[0]+i[1])/2;var a=r/2,s=i[a-1]-i[0],h=i[r-1]-i[parseInt(a.toString(),10)];return(i[a-1]*h+i[parseInt(a.toString(),10)]*s)/(s+h)},t.prototype.setTempVariable=function(t,e,i){t&&(t.temp[0]=i)},t.prototype.medianRank=function(t,e){for(var i=this.nestedBestRanks[parseInt(t.toString(),10)].length,r=[],n=[],o=0;o<i;o++){var a=this.nestedBestRanks[parseInt(t.toString(),10)][parseInt(o.toString(),10)],s={medianValue:0};s.cell=a;var h=void 0,d=void 0;d=e?t+1:t-1,null!=(h=e?this.getConnectedCellsOnLayer(a,t):this.getConnectedCellsOnLayer(a,t,!0))&&0!==h.length?(s.medianValue=this.medianValue(h,d),r.push(s)):n[this.getTempVariable(a,t)]=!0}r.sort(this.compare);for(o=0;o<i;o++)if(null==n[parseInt(o.toString(),10)]&&r.length>0){a=r.shift().cell;this.setTempVariable(a,t,o)}},t.prototype.compare=function(t,e){if(null!=t&&null!=e){if(e.medianValue>t.medianValue)return-1;if(e.medianValue<t.medianValue)return 1}return 0},t}(),Zc=function(){function t(){this.edgeMapper=[]}return t.prototype.arrangeElements=function(t,e){var i=t.model.layout,r="LeftToRight"===e.orientation||"RightToLeft"===e.orientation?i.verticalSpacing:i.horizontalSpacing;this.groupLayoutCells(t),this.createMatrixCells(t);for(var n=0;n<t.matrix.length;n++)for(var o=t.matrix[parseInt(n.toString(),10)].key,a=t.matrix[parseInt(o.toString(),10)].value,s=1;s<a.length;s++){var h=a[parseInt(s.toString(),10)],d=a[s-1];h.offset+=d.offset+d.size/2+r+h.size/2}t.roots.sort(function(e,i){return e.cells[0]&&i.cells[0]?t.model.roots.indexOf(e.cells[0].cell)-t.model.roots.indexOf(i.cells[0].cell):0});for(n=0;n<t.roots.length;n++){var l=t.roots[parseInt(n.toString(),10)];this.arrangeMatrix(l,null,t)}for(var c=0;c<t.matrix.length;c++){var p=t.matrix[parseInt(c.toString(),10)].value;for(s=0;s<p.length;s++){for(var g=(h=p[parseInt(s.toString(),10)]).visitedParents.slice(),u=0;u<h.visitedParents.length;u++){var f=h.visitedParents[parseInt(u.toString(),10)];f&&this.containsValue(f.ignoredChildren,h)&&g.splice(g.indexOf(f),1)}if(g.length>1){var m=g[0],y=g[g.length-1],v=this.findParentVertexCellGroup(m),b=this.findParentVertexCellGroup(y);m!==v&&v.offset<m.offset&&(m=v),y!==b&&b.offset>y.offset&&(y=v);var S=(y.offset+.5*y.size+m.offset-.5*m.size)/2,w=h.initialOffset,x=h.offset;x!==w&&(this.seenCells=[],S>=w&&S<=x?this.translateMatrixCells(S-h.offset,h):S<w&&this.translateMatrixCells(w-h.offset,h),this.seenCells=[])}}}this.setXYforMatrixCell(t)},t.prototype.groupLayoutCells=function(t){for(var e=t.model.ranks,i=e.length-1;i>=0;i--){for(var r=[],n=0;n<e[parseInt(i.toString(),10)].length;n++){var o=e[parseInt(i.toString(),10)][parseInt(n.toString(),10)];"internalVertex"===this.getType(o.type)&&r.push(e[parseInt(i.toString(),10)][parseInt(n.toString(),10)])}for(var a=[],s=0;s<e[parseInt(i.toString(),10)].length;s++){o=e[parseInt(i.toString(),10)][parseInt(s.toString(),10)];"internalEdge"===this.getType(o.type)&&a.push(o)}for(;r.length>1;){for(var h=r[0],d=this.selectIds(h.connectsAsTarget,!0),l=this.selectIds(h.connectsAsSource,!1);r.length>1;){var c=r[1],p=this.selectIds(c.connectsAsTarget,!0),g=this.selectIds(c.connectsAsSource,!1),u=this.compareLists(d,p),f=this.compareLists(l,g),m=this.checkparentsLevel(d,p,t);if(!(u&&f&&m))break;this.updateMutualSharing(r[0],c.id),this.updateMutualSharing(r[1],h.id),r.splice(1,1)}r.splice(0,1)}for(;a.length>1;){var y=a[0],v=y.source,b=y.target;if(null!=v.identicalSibiling){for(var S=[],w=0;w<a.length;w++){var x=a[parseInt(w.toString(),10)];x.target===b&&S.push(x)}for(w=0;w<S.length;w++){var I=S[parseInt(w.toString(),10)];this.containsValue(v.identicalSibiling,I.source.id)&&(I.source.identicalSibiling=null)}y.source.identicalSibiling=null}a.splice(0,1)}}},t.prototype.createMatrixCells=function(t){for(var e=t.model.layout,i="LeftToRight"===e.orientation||"RightToLeft"===e.orientation,r=i?e.verticalSpacing:e.horizontalSpacing,n=i?e.horizontalSpacing:e.verticalSpacing,o=t.model.ranks,a=[],s=-n,h=o.length-1;h>=0;h--){var d=0,l=o.length-1-h,c=o[parseInt(h.toString(),10)].slice(),p=[];t.matrix.push({key:l,value:p});var g=[];for(a.push({index:l,value:g});c.length>0;){var u=c[0],f={level:l,parents:[],children:[],visitedParents:[],visitedChildren:[],ignoredChildren:[],cells:[],size:0,offset:0,initialOffset:0};p.push(f);var m=this.getType(u.type);if("internalVertex"===m){if(f.cells.push(u),null!=u.identicalSibiling)for(var y=0;y<c.length;y++){var v=c[parseInt(y.toString(),10)];if("internalVertex"===this.getType(v.type)&&this.containsValue(u.identicalSibiling,v.id)&&(f.cells.push(v),f.cells.length>u.identicalSibiling.length))break}for(y=0;y<f.cells.length;y++){v=f.cells[parseInt(y.toString(),10)];if("internalVertex"===this.getType(v.type)){var b=v.cell.geometry;if(f.size+=i?b.height:b.width,d=Math.max(d,i?b.width:b.height),g.push({key:v.id,value:f}),v.connectsAsTarget.length>0)for(var S=0;S<v.connectsAsTarget.length;S++){var w=v.connectsAsTarget[parseInt(S.toString(),10)],x=null;if(this.containsValue(a[l-1].value,w.ids)?x=w.ids:this.containsValue(a[l-1].value,w.source.id)&&(x=w.source.id),null!=x){for(var I=a[l-1].value,P=void 0,C=0;C<I.length;C++)if(I[parseInt(C.toString(),10)].key===x){P=I[parseInt(C.toString(),10)].value;break}this.containsValue(f.parents,P)||f.parents.push(P),this.containsValue(P.children,f)||P.children.push(f)}}var T=f.cells[parseInt(y.toString(),10)];-1!==c.indexOf(T)&&c.splice(c.indexOf(T),1)}}f.size+=(f.cells.length-1)*r}else if("internalEdge"===m){f.cells.push(u);for(y=0;y<f.cells.length;y++){var A=f.cells[parseInt(y.toString(),10)];if("internalEdge"===this.getType(A.type)&&null!=A.edges){var O=-5;for(S=0;S<A.edges.length;S++)O+=6;f.size+=O}g.push({key:A.ids,value:f});x=null;if(this.containsValue(a[l-1].value,A.ids)?x=A.ids:this.containsValue(a[l-1].value,A.source.id)&&(x=A.source.id),null!=x){var D=a[l-1].value;for(P=void 0,C=0;C<D.length;C++)if(D[parseInt(C.toString(),10)].key===x){P=D[parseInt(C.toString(),10)].value;break}this.containsValue(f.parents,P)||f.parents.push(P),this.containsValue(P.children,f)||P.children.push(f)}T=f.cells[parseInt(y.toString(),10)];-1!==c.indexOf(T)&&c.splice(c.indexOf(T),1)}f.size+=(f.cells.length-1)*r}if(f.cells.length){var M=f.cells.filter(function(t){return"internalVertex"===t.type});if(M.length>0)for(var L=function(e){var i=e.cell;if(t.model.roots.some(function(t){return t===i}))return t.roots.push(f),"break"},E=0,z=M;E<z.length;E++){if("break"===L(z[E]))break}}}t.rowOffset.push(s+d/2+n),s+=d+n}},t.prototype.arrangeMatrix=function(t,e,i){var r=i.model.layout,n="LeftToRight"===r.orientation||"RightToLeft"===r.orientation?r.verticalSpacing:r.horizontalSpacing,o=i.matrix,a=o[t.level].value,s=a.indexOf(t);if(t.visitedParents.length>0&&(1===t.visitedParents.length&&(t.initialOffset=t.offset),!this.containsValue(t.visitedParents,e))){var h=t.visitedParents[t.visitedParents.length-1],d=o[h.level].value,l=d.indexOf(h),c=d.indexOf(e),p=s+1<a.length?a[s+1]:void 0;if(-1!==h.ignoredChildren.indexOf(t)||c-l!==1||p&&p.visitedParents.length>0)return t.visitedParents.push(e),void e.ignoredChildren.push(t)}if(t.children.length>0){for(var g=0;g<t.children.length;g++){var u=t.children[parseInt(g.toString(),10)];this.containsValue(t.visitedChildren,u)||(this.arrangeMatrix(u,t,i),t.visitedChildren.push(u))}if(t.visitedChildren.length>0){var f=t.visitedChildren.slice();for(g=0;g<t.ignoredChildren.length;g++){var m=t.ignoredChildren[parseInt(g.toString(),10)];this.containsValue(f,m)&&f.splice(f.indexOf(m),1)}if(f.length>0){var y=f[0],v=f[f.length-1],b=(y.offset-y.size/2+(v.offset+v.size/2))/2;b<t.offset?this.shiftMatrixCells(t.offset-b,y,!0,t,i):b>t.offset&&this.shiftMatrixCells(b-t.offset,t,!1,null,i)}}}else{var S=t.offset;if(s>0){var w=a[s-1];S=w.offset+w.size/2+n+t.size/2}this.shiftMatrixCells(S-t.offset,t,!1,null,i)}this.containsValue(t.visitedParents,e)||t.visitedParents.push(e)},t.prototype.findParentVertexCellGroup=function(t){return t.cells[0]?t:t.parents.length>0?this.findParentVertexCellGroup(t.parents[0]):t},t.prototype.translateMatrixCells=function(t,e){if(0!==t){if(-1!==this.seenCells.indexOf(e))return;if(this.seenCells.push(e),e.offset+=t,e.visitedChildren.length>0)for(var i=0;i<e.visitedChildren.length;i++){var r=e.visitedChildren[parseInt(i.toString(),10)];-1===e.ignoredChildren.indexOf(r)&&this.translateMatrixCells(t,r)}}},t.prototype.setXYforMatrixCell=function(t){for(var e=t.model.layout,i="LeftToRight"===e.orientation||"RightToLeft"===e.orientation,r=i?e.verticalSpacing:e.horizontalSpacing,n=0;n<t.matrix.length;n++)for(var o=t.matrix[parseInt(n.toString(),10)].value,a=0;a<o.length;a++)for(var s=o[parseInt(a.toString(),10)],h=s.offset-s.size/2,d=0;d<s.cells.length;d++){var l=s.cells[parseInt(d.toString(),10)],c=this.getType(l.type);if("internalVertex"===c){var p=l,g=p.cell.geometry.width,u=p.cell.geometry.height;p.cell.geometry=i?new w(t.rowOffset[s.level]-g/2,h,g,u):new w(h,t.rowOffset[s.level]-u/2,g,u),h+=(i?u:g)+r}else if("internalEdge"===c){var f=l,m=s.visitedParents[0];if(m)for(var y=0;y<m.visitedChildren.length;y++){for(var v=m.visitedChildren[parseInt(y.toString(),10)],b=[],S=0;S<v.cells.length;S++){var x=v.cells[parseInt(S.toString(),10)];"internalVertex"===this.getType(x.type)&&b.push(x)}if(b.length>0){0;break}}for(S=0;S<f.edges.length;S++){var I=f.edges[parseInt(S.toString(),10)],P=this.getPointvalue(h+.5,t.rowOffset[s.level]);if(i&&(P=this.getPointvalue(t.rowOffset[s.level],h+.5)),this.containsValue(this.getEdgeMapper(),I)){var C=void 0;for(y=0;y<this.getEdgeMapper().length;y++)if(this.getEdgeMapper()[parseInt(y.toString(),10)].key===I){C=y;break}this.getEdgeMapper()[parseInt(C.toString(),10)].value.push(P)}h+=6}h+=r}}},t.prototype.getType=function(t){return"internalVertex"===t?"internalVertex":"internalEdge"},t.prototype.selectIds=function(t,e){for(var i=[],r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)];e?i.push(n.source.id):i.push(n.target.id)}return i},t.prototype.checkparentsLevel=function(t,e,i){if(1===t.length||1===e.length)return!0;for(var r=function(e){var r=i.model.ranks[parseInt(e.toString(),10)];if(r.length<t.length)return"continue";var n=0;return t.forEach(function(t){r.some(function(e){return e.id===t})&&n++}),n===t.length?{value:!0}:n>0&&n!==t.length?{value:!1}:void 0},n=0;n<i.model.ranks.length;n++){var o=r(n);if("object"==typeof o)return o.value}return!1},t.prototype.compareLists=function(t,e){var i=t.slice(),r=e.slice();if(i.length===r.length){if(0===i.length)return!0;for(var n=!0,o=0;o<r.length;o++){var a=r[parseInt(o.toString(),10)];if(-1===i.indexOf(a)){n=!1;break}}return n}return!1},t.prototype.updateMutualSharing=function(t,e){null!=t.identicalSibiling||(t.identicalSibiling=[]),t.identicalSibiling.push(e)},t.prototype.containsValue=function(t,e){for(var i=0;i<t.length;i++)if(t[parseInt(i.toString(),10)].key===e||t[parseInt(i.toString(),10)]===e)return!0;return!1},t.prototype.shiftMatrixCells=function(t,e,i,r,n){if(0!==t){for(var o=n.matrix[e.level].value,a=o.indexOf(e),s=a;s<o.length;s++)o[parseInt(s.toString(),10)].offset+=t;if(i)if(e.visitedChildren.length>0){var h=void 0;for(s=0;s<e.visitedChildren.length;s++){var d=e.visitedChildren[parseInt(s.toString(),10)];if(-1===e.ignoredChildren.indexOf(d)){h=d;break}}h&&this.shiftMatrixCells(t,h,!0,e,n)}else{s=1;for(var l=null;a+s<o.length;){var c=o[a+s];if(c.visitedChildren.length>0&&c.visitedChildren.length>c.ignoredChildren.length){l=c;break}s++}if(null!=l){h=void 0;for(var p=0;p<l.visitedChildren.length;p++){d=l.visitedChildren[parseInt(p.toString(),10)];if(-1===l.ignoredChildren.indexOf(d)){h=d;break}}h&&this.shiftMatrixCells(t,h,!0,l,n)}}}},t.prototype.getPointvalue=function(t,e){return{x:Number(t)||0,y:Number(e)||0}},t.prototype.getEdgeMapper=function(){return this.edgeMapper},t.prototype.setEdgeMapper=function(t){this.edgeMapper.push(t)},t.prototype.findLevelDifference=function(t){var e=0,i=0,r=0;if(this.diagram.layout.ranks){for(var n=this.diagram.layout.ranks,o=0;o<n.length;o++)for(var a=0;a<n[parseInt(o.toString(),10)].length;a++)t.sourceID===n[parseInt(o.toString(),10)][parseInt(a.toString(),10)].id&&(e=o),t.targetID===n[parseInt(o.toString(),10)][parseInt(a.toString(),10)].id&&(i=o);r=e-i}return r<0?-r:r},t.prototype.updateLayout=function(t,e,i,r,n,o,a){var s=(t.x-e.width)/2-e.x,h=(t.y-e.height)/2-e.y;s=Math.round(s),h=Math.round(h);for(var d=[],l=new w(e.x+s,e.y+h,e.width,e.height),c=(i.margin,"RightToLeft"===r.orientation||"LeftToRight"===r.orientation),p=c?r.horizontalSpacing:r.verticalSpacing,g=0;g<n.length;g++){var u=n[parseInt(g.toString(),10)];if(null!=u.outEdges&&u.outEdges.length>0)for(var f=u.outEdges.length,m=0;m<f;m++){(N=o[u.outEdges[parseInt(m.toString(),10)]]).pointCollection=[];var y=p/2,v=null,b=!1;if(this.findLevelDifference(N)>1&&(b=!0),f>1||b){for(var S=-1,x=this.getEdgeMapper(),I=0;I<x.length;I++)if(x[parseInt(I.toString(),10)].key===N){S=I;break}if(-1!==S&&x[parseInt(S.toString(),10)].value.length>0&&"Orthogonal"===N.type){var P=x[parseInt(S.toString(),10)].value[0],C=P.x+r.marginX,T=P.y+r.marginY,A=C,O=T;"BottomToTop"===r.orientation?O=e.height-T:"RightToLeft"===r.orientation&&(A=e.width-C),v=this.getPointvalue(A,O),N.segments=[],this.diagram.connectorPropertyChange(N,{},{type:"Orthogonal",segments:N.segments})}}for(var D=[],M=0;M<N.segments.length;M++){var L=N.segments[parseInt(M.toString(),10)].points;for(var E in L)D.push(L[parseInt(E.toString(),10)])}var z=!1;if(4===D.length&&(f>1&&!v||!v))if((c?D[3].x-D[0].x:D[3].y-D[0].y)>p){var k=a[N.sourceID],B=c?k.maxRowWidth-k.geometry.width:k.maxRowHeight-k.geometry.height;B>0&&(y+=B/2,z=!0)}if(f>1||z||b){if(D=this.updateConnectorPoints(D,y,v,l,r.orientation),null!=v&&"DifferentPoint"!==this.diagram.layout.connectionPointOrigin||z)for(var R=0;R<D.length;R++){L=D[parseInt(R.toString(),10)];N.pointCollection.push(this.getPointvalue(L.x,L.y))}this.resetConnectorPoints(N)}d.push(N)}if(null!=u.inEdges&&u.inEdges.length>1)for(f=u.inEdges.length,x=this.getEdgeMapper(),m=0;m<f;m++){var N=o[u.inEdges[parseInt(m.toString(),10)]];if(this.containsValue(d,N)||(N.pointCollection=[]),f>1){for(y=p/2,v=null,S=-1,I=0;I<x.length;I++)if(x[parseInt(I.toString(),10)].key===N){S=I;break}if(-1!==S&&x[parseInt(S.toString(),10)].value.length>0&&!this.containsValue(d,N)&&"Orthogonal"===N.type){var j=x[parseInt(S.toString(),10)].value[0],H=j.x+r.marginX,W=j.y+r.marginY;A=H,O=W;"BottomToTop"===r.orientation?O=e.height-W:"RightToLeft"===r.orientation&&(A=e.width-H),v=this.getPointvalue(A,O),N.segments=[],this.diagram.connectorPropertyChange(N,{},{type:"Orthogonal",segments:N.segments})}for(D=[],R=0;R<N.segments.length;R++){L=N.segments[parseInt(R.toString(),10)].points;for(var E in L)D.push(L[parseInt(E.toString(),10)])}if(D.reverse(),(D=this.updateConnectorPoints(D,y,v,l,i.orientation)).reverse(),N.pointCollection=[],null!=v&&"DifferentPoint"!==this.diagram.layout.connectionPointOrigin)for(R=0;R<D.length;R++){L=D[parseInt(R.toString(),10)];N.pointCollection.push(this.getPointvalue(L.x,L.y))}this.resetConnectorPoints(N)}}}},t.prototype.inflate=function(t,e,i){return t.x-=e,t.y-=i,t.width+=2*e,t.height+=2*i,t},t.prototype.updateConnectorPoints=function(t,e,i,r,n){var a="LeftToRight"===n||"RightToLeft"===n,s=t,h=s[0],d=s[s.length-1];if(null!=i){var l=o.transform(h,o.findAngle(h,s[1]),e),c=o.transform(d,o.findAngle(d,s[s.length-2]),e),p=this.getPointvalue(i.x,l.y),g=this.getPointvalue(i.x,c.y);return a&&(p.x=l.x,p.y=i.y,g.x=c.x,g.y=i.y),0===Math.abs(o.findLength(g,c))?[h,l,p,d]:[h,l,p,g,c,d]}if(4===s.length){l=o.transform(h,o.findAngle(h,s[1]),e),p=this.getPointvalue(s[2].x,l.y);return a&&(p.x=l.x,p.y=s[2].y),[h,l,p,d]}return s},t.prototype.resetConnectorPoints=function(t){if(t.pointCollection&&t.pointCollection.length>0){(h=t).sourcePoint=t.pointCollection[0],h.targetPoint=t.pointCollection[t.pointCollection.length-1];for(var e=[],i=0;i<t.pointCollection.length-1;i++){var r=t.pointCollection[parseInt(i.toString(),10)],n=t.pointCollection[i+1],o=Ds(r,n),a=Os(r,n);i===t.pointCollection.length-2&&("RightToLeft"===this.diagram.layout.orientation&&"Left"===a||"LeftToRight"===this.diagram.layout.orientation&&"Right"===a||"TopToBottom"===this.diagram.layout.orientation&&"Bottom"===a||"BottomToTop"===this.diagram.layout.orientation&&"Top"===a)&&(o/=2),(d=new uo(t,"segments",{type:"Orthogonal"},!0)).length=o,d.direction=a,e.push(d)}h.segments=e,h.type="Orthogonal",this.diagram.connectorPropertyChange(h,{},{type:"Orthogonal",segments:h.segments})}else if("DifferentPoint"===this.diagram.layout.connectionPointOrigin){var s="obstaclePointCollection";if(t.segments[0].points&&t.segments[0].points.length>0&&t[""+s]){var h;(h=t).sourcePoint=t[""+s][0],h.targetPoint=t[""+s][t[""+s].length-1];for(e=[],i=0;i<t[""+s].length-1;i++){r=t[""+s][parseInt(i.toString(),10)],n=t[""+s][i+1];var d,l=Ds(r,n);a=Os(r,n);i===t[""+s].length-2&&("RightToLeft"===this.diagram.layout.orientation&&"Left"===a||"LeftToRight"===this.diagram.layout.orientation&&"Right"===a||"TopToBottom"===this.diagram.layout.orientation&&"Bottom"===a||"BottomToTop"===this.diagram.layout.orientation&&"Top"===a)&&(l/=2),(d=new uo(t,"segments",{type:"Orthogonal"},!0)).length=l,d.direction=a,e.push(d)}h.segments=e,h.type="Orthogonal",this.diagram.connectorPropertyChange(h,{},{type:"Orthogonal",segments:h.segments})}}},t.prototype.nodePropertyChange=function(t){this.diagram.nodePropertyChange(t,{},{offsetX:t.offsetX,offsetY:t.offsetY})},t}(),qc=function(){function t(t,e,i){var r=this;this.dfsCount=0,this.maxRank=1e8,this.layout=t,this.vertexMapper=new Map,this.ranks=new Map;var n=[];this.createInternalCells(i,n),n.forEach(function(t){t.internalOutEdges.forEach(function(e){var i=e.edges;if(i&&i.length>0){var n=i[0],o=r.layout.getVisibleTerminal(n,!1),a=r.vertexMapper.get(o.id);t===a&&(o=r.layout.getVisibleTerminal(n,!0),a=r.vertexMapper.get(o.id)),a&&t!==a&&(e.target=a,-1===t.internalInEdges.indexOf(e)&&a.internalInEdges.push(e))}})}),this.rootNode=this.vertexMapper.get(e.id)}return t.prototype.createInternalCells=function(t,e){for(var i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)],n={tempRank:-1,cell:r,hashCode:[],maxRank:null,minRank:null,id:r.id,internalOutEdges:[],internalInEdges:[],identicalSibling:[]};e.push(n),this.vertexMapper.set(r.id,n);for(var o=this.layout.getEdges(r),a=0;a<o.length;){var s=o[parseInt(a.toString(),10)],h=this.layout.getVisibleTerminal(s,!1);if(h!==r){var d=this.layout.getEdgesBetween(r,h,!0);if(d.length>0){for(var l={connectorIds:[],edges:d,ids:[],isReversed:!1,source:null,target:null,tempRank:0,maxRank:null,minRank:null},c=0;c<d.length;c++){var p=d[parseInt(c.toString(),10)];l.ids.push(p.id),-1!==o.indexOf(p)&&(o.indexOf(p)<a&&a--,o.splice(o.indexOf(p),1))}l.source=n,-1===n.internalOutEdges.indexOf(l)&&n.internalOutEdges.push(l)}}else a++}}},t.prototype.layeringStage=function(){this.recycleConnectors(),this.initialRank(),this.fixRanks()},t.prototype.recycleConnectors=function(){var t=[this.rootNode];this.visit(t,!0)},t.prototype.initialRank=function(){for(var t=[this.rootNode],e=Array.from(this.vertexMapper.values());t.length>0;){for(var i=t[0],r=i.internalOutEdges,n=i.internalInEdges,o=!0,a=1e8,s=0;s<n.length;s++){if(5270620!==(u=n[parseInt(s.toString(),10)]).tempRank){o=!1;break}a=(f=u.source).tempRank?Math.min(a,f.tempRank-1):a}if(o){if(i.tempRank=a,this.maxRank=Math.min(this.maxRank,a),r.length){if(i.cell.isDecisionNode){var h=r.find(function(t){return t.target.cell.isYesChild}),d=r.find(function(t){return t.target.cell.isDecisionNode});-1===r.indexOf(d)&&0!==r.indexOf(h)&&r.reverse(),("RightInFlow"===this.layout.yesBranchDirection||"SameAsFlow"===this.layout.yesBranchDirection&&"LeftInFlow"===this.layout.noBranchDirection)&&r.reverse()}for(s=0;s<r.length;s++){(u=r[parseInt(s.toString(),10)]).tempRank=5270620,-1===(f=u.target).tempRank&&(f.tempRank=-2,t.push(f))}}t.shift()}else{var l=t.shift();if(t.push(i),l===i&&1===t.length)break}}for(s=0;s<e.length;s++)e[parseInt(s.toString(),10)].tempRank-=this.maxRank;for(var c=0,p=this.rootNode.internalOutEdges,g=0;g<p.length;g++){var u,f=(u=p[parseInt(g.toString(),10)]).target;this.rootNode.tempRank=void 0!==f.tempRank&&null!==f.tempRank?Math.max(c,f.tempRank+1):c,c=this.rootNode.tempRank}this.maxRank=1e8-this.maxRank},t.prototype.fixRanks=function(){var t=new Map;this.ranks=new Map;for(var e=0;e<=this.maxRank;e++)t.set(e,[]),this.ranks.set(e,t.get(e));var i=[this.rootNode];this.visit(i,!1,t)},t.prototype.visit=function(t,e,i){if(void 0===i&&(i=null),t){for(var r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)];if(n){var o=new Map;e?(n.hashCode=[this.dfsCount,r],this.extendedDfs(null,n,null,o,r)):this.depthFirstSearch(null,n,null,o,i)}}this.dfsCount++}},t.prototype.extendedDfs=function(t,e,i,r,n){var o=this;t&&(e.hashCode&&e.hashCode[0]===t.hashCode[0]||(e.hashCode=t.hashCode.concat([n])));var a=e.id;r.has(a)?this.removeConnectionEdge(t,e,i):(r.set(a,e),this.removeConnectionEdge(t,e,i),e.internalOutEdges.slice().forEach(function(t,i){var n=t.target;o.extendedDfs(e,n,t,r,i)}))},t.prototype.removeConnectionEdge=function(t,e,i){t&&this.isAncestor(e,t)&&(this.invert(i),this.remove(i,t.internalOutEdges),t.internalInEdges.push(i),this.remove(i,e.internalInEdges),e.internalOutEdges.push(i))},t.prototype.invert=function(t){var e=t.source;t.source=t.target,t.target=e,t.isReversed=!t.isReversed},t.prototype.remove=function(t,e){var i=e.indexOf(t);e.splice(i,1)},t.prototype.isAncestor=function(t,e){if(null!==e&&null!==t.hashCode&&null!==e.hashCode&&t.hashCode.length<e.hashCode.length){if(t.hashCode===e.hashCode)return!0;for(var i=0;i<t.hashCode.length;i++)if(t.hashCode[parseInt(i.toString(),10)]!==e.hashCode[parseInt(i.toString(),10)])return!1;return!0}return!1},t.prototype.depthFirstSearch=function(t,e,i,r,n){var o=this,a=e.id;r.has(a)?this.updateMinMaxRank(t,e,i,1,n):(r.set(a,e),this.updateMinMaxRank(t,e,i,0,n),e.internalOutEdges.slice().forEach(function(t){var i=t.target;o.depthFirstSearch(e,i,t,r,n)}))},t.prototype.updateMinMaxRank=function(t,e,i,r,n){var o=Array.from(n.values());if(null==e.maxRank&&0!==e.maxRank&&(e.maxRank=-1),null==e.minRank&&0!==e.minRank&&(e.minRank=-1),0===r&&e.maxRank<0&&e.minRank<0&&e.tempRank>=0){var a=e.tempRank;o[parseInt(a.toString(),10)].push(e),e.maxRank=a,e.minRank=a,e.tempRank=o[e.maxRank].length-1}if(null!==t&&null!==i)if(t.maxRank-e.maxRank>1){i.maxRank=t.maxRank,i.minRank=e.maxRank;for(var s=i.minRank+1;s<i.maxRank;s++)o[parseInt(s.toString(),10)].push(i)}else if(i.isReversed){i.maxRank=t.maxRank,i.minRank=e.maxRank;for(s=i.minRank;s<=i.maxRank;s++)o[parseInt(s.toString(),10)].push(i)}},t}(),Qc=function(){function t(t){this.flowchartModel=t,this.matrix=[],this.rowOffset=[],this.rowMaxDimension=[],this.siblingModel=null}return t.prototype.arrangeElements=function(){if(null!==this.flowchartModel){var t=this.flowchartModel.layout,e="LeftToRight"===t.orientation?t.verticalSpacing:t.horizontalSpacing;this.groupLayoutCells(),this.createMatrixCells();for(var i=0,r=this.matrix;i<r.length;i++)for(var n=r[i],o=1;o<n.length;o++){var a=n[parseInt(o.toString(),10)],s=n[o-1];a.offset+=s.offset+s.size/2+e+a.size/2}for(var h=0,d=this.matrix[0];h<d.length;h++){var l=d[h];this.arrangeMatrix(l,null)}for(var c=0,p=this.matrix;c<p.length;c++){var g=p[c];for(o=0;o<g.length;o++){if((a=g[parseInt(o.toString(),10)]).visitedParents.length>1){var u=a.visitedParents[0],f=a.visitedParents[a.visitedParents.length-1],m=this.findParentVertexCellGroup(u),y=this.findParentVertexCellGroup(f);u!==m&&m.offset<u.offset&&(u=m),f!==y&&y.offset>f.offset&&(f=m);var v=(u.offset+f.offset)/2,b=a.cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t});if("SameAsFlow"===this.flowchartModel.layout.yesBranchDirection){var S=a.visitedParents.slice();if(b&&b.cell.isYesChild)for(var w=0,x=S;w<x.length;w++){if(!(M=(D=x[w]).cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t}))){v=D.offset;break}}else{"LeftInFlow"===this.flowchartModel.layout.noBranchDirection&&S.reverse();for(var I=0,P=S;I<P.length;I++){if(M=(D=P[I]).cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})){if(M.cell.isYesChild){v=D.offset;break}}else if(L=this.findParentVertexCellGroup(D))if((E=L.cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t}))&&E.cell.isYesChild){v=D.offset;break}}}}else if("SameAsFlow"===this.flowchartModel.layout.noBranchDirection){S=a.visitedParents.slice();if(b&&b.cell.isNoChild)for(var C=0,T=S;C<T.length;C++){if(!(M=(D=T[C]).cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t}))){v=D.offset;break}}else{"LeftInFlow"===this.flowchartModel.layout.yesBranchDirection&&S.reverse();for(var A=0,O=S;A<O.length;A++){var D,M,L,E;if(M=(D=O[A]).cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})){if(M.cell.isNoChild){v=D.offset;break}}else if(L=this.findParentVertexCellGroup(D))if((E=L.cells.find(function(t){return"internalInEdges"in t&&"internalOutEdges"in t}))&&E.cell.isNoChild){v=D.offset;break}}}}var z=a.initialOffset,k=a.offset;k!==z&&(v>=z&&v<=k?this.translateMatrixCells(v-a.offset,a):v<z&&this.translateMatrixCells(z-a.offset,a))}}}this.setXYForMatrixCell()}},t.prototype.arrangeMatrix=function(t,e){var i=this.flowchartModel.layout,r="LeftToRight"===i.orientation?i.verticalSpacing:i.horizontalSpacing,n=this.matrix[t.level],o=n.indexOf(t);if(t.visitedParents.length&&(1===t.visitedParents.length&&(t.initialOffset=t.offset),o+1<n.length&&n[o+1].visitedParents.length&&-1===t.visitedParents.indexOf(e)))return void(t.level!==e.level&&(t.visitedParents.push(e),e.ignoredChildren.push(t)));if(t.children.length){for(var a=0,s=t.children;a<s.length;a++){var h=s[a];t.visitedChildren.indexOf(h)&&(this.arrangeMatrix(h,t),t.level!==h.level?t.visitedChildren.push(h):t.loopChildren.push(h))}if(t.visitedChildren.length){for(var d=t.visitedChildren.slice(),l=function(t){d=d.filter(function(e){return e!==t})},c=0,p=t.ignoredChildren;c<p.length;c++){l(p[c])}if(d.length){var g=d[0],u=d[d.length-1],f=(g.offset+u.offset)/2;if(t.cells.length){var m=t.cells.filter(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})[0],y=g.cells.filter(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})[0],v=u.cells.filter(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})[0];m&&m.cell.isDecisionNode&&("SameAsFlow"===this.flowchartModel.layout.yesBranchDirection?y?f=y.cell.isYesChild?g.offset:u.offset:v&&(f=v.cell.isYesChild?u.offset:g.offset):"SameAsFlow"===this.flowchartModel.layout.noBranchDirection&&(y?f=y.cell.isNoChild?g.offset:u.offset:v&&(f=v.cell.isNoChild?u.offset:g.offset)))}f<t.offset?this.shiftMatrixCells(t.offset-f,g,!0,t):f>t.offset&&this.shiftMatrixCells(f-t.offset,t)}}}else{var b=t.offset;if(o>0){var S=n[o-1];b=S.offset+S.size/2+r+t.size/2}this.shiftMatrixCells(b-t.offset,t)}-1===t.visitedParents.indexOf(e)&&null!==e&&t.level!==e.level&&t.visitedParents.push(e)},t.prototype.shiftMatrixCells=function(t,e,i,r){if(void 0===i&&(i=!1),void 0===r&&(r=null),0!==t){for(var n=this.matrix[e.level],o=n.indexOf(e),a=o;a<n.length;a++)n[parseInt(a.toString(),10)].offset+=t;if(i)if(e.visitedChildren.length)this.shiftMatrixCells(t,e.visitedChildren[0],!0,e);else{a=1;for(var s=null;o+a<n.length;){var h=n[o+a];if(null!==r&&-1!==h.visitedParents.indexOf(r)){if(!h.visitedChildren.length){a++;continue}s=h}break}null!==s&&this.shiftMatrixCells(t,s.visitedChildren[0],!0,s)}}},t.prototype.findParentVertexCellGroup=function(t){return"internalInEdges"in t.cells[0]&&"internalOutEdges"in t.cells[0]?t:t.parents.length?this.findParentVertexCellGroup(t.parents[0]):t},t.prototype.translateMatrixCells=function(t,e){if(0!==t&&(e.offset+=t,e.visitedChildren.length)){for(var i=0,r=e.visitedChildren;i<r.length;i++){var n=r[i];this.translateMatrixCells(t,n)}for(var o=0,a=e.loopChildren;o<a.length;o++){var s=a[o];this.translateMatrixCells(t,s)}}},t.prototype.getObjectValues=function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(t[""+i]);return e},t.prototype.setXYForMatrixCell=function(){var t=this.flowchartModel.layout,e="LeftToRight"===t.orientation,i=e?t.verticalSpacing:t.horizontalSpacing,r=0;if(this.siblingModel){var n=this.getObjectValues(this.rowMaxDimension),o=Math.max.apply(Math,n);r=this.siblingModel.getSiblingDimension(o)}for(var a=0,s=this.getObjectValues(this.matrix);a<s.length;a++)for(var h=0,d=s[a];h<d.length;h++){var l=d[h],c=l.offset-l.size/2;0!==r&&(c+=r+i);for(var p=0,g=l.cells;p<g.length;p++){var u=g[p];if("internalInEdges"in u&&"internalOutEdges"in u){var f=u,m=f.cell.geometry.width,y=f.cell.geometry.height;f.cell.geometry=e?new w(this.rowOffset[l.level]-m/2,c,m,y):new w(c,this.rowOffset[l.level]-y/2,m,y),c+=(e?y:m)+i}else if("edges"in u){var v=u,b=v.isReversed;if(!b){var S=l.visitedParents[0];if(S)for(var x=0,I=S.visitedChildren;x<I.length;x++){if(I[x].cells.some(function(t){return"internalInEdges"in t&&"internalOutEdges"in t})){b=!0;break}}}for(var P=0,C=v.edges;P<C.length;P++){var T=C[P];if(b){var A={x:c+.5,y:this.rowOffset[l.level]};e&&(A={x:this.rowOffset[l.level],y:c+.5}),this.flowchartModel.layout.edgesMapper.has(T)&&(this.flowchartModel.layout.edgesMapper.get(T).push(A),this.flowchartModel.layout.loopedgesMapper.set(T,v.isReversed))}c+=6}c+=i}}}},t.prototype.getSiblingDimension=function(t){var e=this.flowchartModel.layout,i="LeftToRight"===e.orientation,r=i?e.horizontalSpacing:e.verticalSpacing,n=0;for(var o in this.rowMaxDimension)if(Object.prototype.hasOwnProperty.call(this.rowMaxDimension,o)){if(!(this.rowMaxDimension[""+o]<t))break;n=parseInt(o,10)}this.rowMaxDimension[parseInt(n.toString(),10)]+r<=t&&this.rowMaxDimension[n+1]&&n++;var a=[];for(var o in this.matrix)Object.prototype.hasOwnProperty.call(this.matrix,o)&&parseInt(o,10)<=n&&(a[""+o]=this.matrix[""+o]);var s=0;for(var o in a)if(Object.prototype.hasOwnProperty.call(a,o)){var h=a[""+o];if(h.length){var d=h[0].cells[0],l=0;if(d&&"cell"in d){var c=d.cell.geometry;l=i?c.y:c.x}else if(d&&"edges"in d){var p=d.edges[d.edges.length-1];(f=this.flowchartModel.layout.edgesMapper.get(p)).length&&(l=i?f[0].y:f[0].x)}var g=0,u=h[h.length-1].cells[h[h.length-1].cells.length-1];if(u&&"cell"in u){c=u.cell.geometry;g=i?c.y+c.height:c.x+c.width}else if(u&&"edges"in u){var f;p=u.edges[u.edges.length-1];(f=this.flowchartModel.layout.edgesMapper.get(p)).length&&(g=i?f[0].y:f[0].x)}s=Math.max(s,g-l)}}return s},t.prototype.createMatrixCells=function(){for(var t=this.flowchartModel.layout,e="LeftToRight"===t.orientation,i=e?t.verticalSpacing:t.horizontalSpacing,r=e?t.horizontalSpacing:t.verticalSpacing,n=this.flowchartModel.ranks,o=Array.from(n.values()),a={},s=-r,h=o.length-1;h>=0;h--){var d=0,l=o.length-1-h,c=o[parseInt(h.toString(),10)].slice(),p=[];this.matrix[parseInt(l.toString(),10)]=p;var g={};for(a[parseInt(l.toString(),10)]=g;c.length>0;){var u=c[0],f={parents:[],children:[],visitedParents:[],visitedChildren:[],ignoredChildren:[],loopChildren:[],cells:[],level:l,initialOffset:0,size:0,offset:0};if(p.push(f),"internalInEdges"in u&&"internalOutEdges"in u){if(f.cells.push(u),u.identicalSibling)for(var m=0;m<c.length;m++){if("internalInEdges"in(v=c[parseInt(m.toString(),10)])&&"internalOutEdges"in v&&-1!==u.identicalSibling.indexOf(v.id)&&(f.cells.push(v),f.cells.length>u.identicalSibling.length))break}var y=f.cells;for(m=0;m<y.length;m++){var v;if("internalInEdges"in(v=y[parseInt(m.toString(),10)])&&"internalOutEdges"in v){var b=v.cell.geometry;if(f.size+=e?b.height:b.width,d=Math.max(d,e?b.width:b.height),g[v.id]=f,v.internalInEdges.length)for(var S=v.internalInEdges,w=0;w<S.length;w++){var x=S[parseInt(w.toString(),10)];if(!x.isReversed){var I=null;if(a[l-1]&&Object.prototype.hasOwnProperty.call(a[l-1],x.ids)?I=x.ids:a[l-1]&&Object.prototype.hasOwnProperty.call(a[l-1],x.source.id)&&(I=x.source.id),null!==I){var P=a[l-1][""+I];-1===f.parents.indexOf(P)&&f.parents.push(P),-1===P.children.indexOf(f)&&(P.children.length&&P.children[0].level===P.level?P.children.unshift(f):P.children.push(f))}}}c.splice(c.indexOf(v),1)}}f.size+=(f.cells.length-1)*i}else if("edges"in u){f.cells.push(u);for(y=f.cells,m=0;m<y.length;m++){var C=y[parseInt(m.toString(),10)];if("edges"in C&&C.edges){for(var T=-5,A=0;A<C.edges.length;A++){C.edges[parseInt(A.toString(),10)];T+=6}f.size+=T}I=null;if(C.isReversed?a[parseInt(l.toString(),10)][C.ids]?I=C.ids:a[parseInt(l.toString(),10)][C.source.id]&&(I=C.source.id):a[l-1][C.ids]?I=C.ids:a[l-1][C.source.id]&&(I=C.source.id),null!==I){P=a[C.isReversed?l:l-1][""+I];-1===f.parents.indexOf(P)&&f.parents.push(P),-1===P.children.indexOf(f)&&P.children.push(f)}g[C.ids]=f,c.splice(c.indexOf(C),1)}f.size+=(f.cells.length-1)*i}}this.rowOffset[parseInt(l.toString(),10)]=s+d/2+r,this.rowMaxDimension[parseInt(l.toString(),10)]=this.rowOffset[parseInt(l.toString(),10)]+d/2,s+=d+r}},t.prototype.groupLayoutCells=function(){var t=this.flowchartModel.ranks,e=Array.from(t.values());e.reverse();for(var i=e.length-1;i>=0;i--){for(var r=e[parseInt(i.toString(),10)].filter(function(t){return"internalInEdges"in t&&"internalOutEdges"in t}),n=e[parseInt(i.toString(),10)].filter(function(t){return"edges"in t&&"edges"in t});r.length>1;){var o=r[0];if(o.cell.isYesChild||o.cell.isNoChild)r.shift();else{for(var a=o.internalInEdges.map(function(t){return t.source.id}),s=o.internalOutEdges.map(function(t){return t.target.id});r.length>1;){var h=r[1],d=h.internalInEdges.map(function(t){return t.source.id}),l=h.internalOutEdges.map(function(t){return t.target.id}),c=this.compareLists(a,d),p=this.compareLists(s,l);if(!c||!p)break;this.updateMutualSharing(r[0],h.id),this.updateMutualSharing(r[1],o.id),r.splice(1,1)}r.shift()}}for(var g=function(){var t=n[0],e=t.source,i=t.target;if(e.identicalSibling){for(var r=0,o=n.filter(function(t){return t.target===i});r<o.length;r++){var a=o[r];-1!==e.identicalSibling.indexOf(a.source.id)&&(a.source.identicalSibling=null)}t.source.identicalSibling=null}n.shift()};n.length>1;)g()}},t.prototype.updateMutualSharing=function(t,e){t.identicalSibling?t.identicalSibling.push(e):t.identicalSibling=[e]},t.prototype.compareLists=function(t,e){var i=t.slice(),r=e.slice();if(i.length===r.length){if(0===i.length)return!0;for(var n=0,o=r;n<o.length;n++){var a=o[n];if(-1===i.indexOf(a))return!1}return!0}return!1},t}(),Kc=function(){function t(){this.rootNodes=[],this.vertexMapper=new Map,this.edgesMapper=new Map,this.loopedgesMapper=new Map,this.anchorX=0,this.anchorY=0,this.verticalSpacing=50,this.horizontalSpacing=50,this.horizontalAlignment="Center",this.verticalAlignment="Top",this.margin={top:50,right:50,bottom:50,left:50},this.orientation="TopToBottom",this.yesBranchDirection="SameAsFlow",this.noBranchDirection="RightInFlow",this.yesBranchValues=["Yes","True"],this.noBranchValues=["No","False"],this.diagram=new sc}return t.prototype.updateLayout=function(t,e){this.diagram=e,this.yesBranchDirection=this.diagram.layout.flowchartLayoutSettings.yesBranchDirection,this.noBranchDirection=this.diagram.layout.flowchartLayoutSettings.noBranchDirection,this.yesBranchValues=this.diagram.layout.flowchartLayoutSettings.yesBranchValues||["Yes","True"],this.noBranchValues=this.diagram.layout.flowchartLayoutSettings.noBranchValues||["No","False"],this.orientation="TopToBottom"===this.diagram.layout.orientation||"BottomToTop"===this.diagram.layout.orientation?"TopToBottom":"LeftToRight",this.horizontalAlignment=this.diagram.layout.horizontalAlignment,this.verticalAlignment=this.diagram.layout.verticalAlignment,this.verticalSpacing=this.diagram.layout.verticalSpacing,this.horizontalSpacing=this.diagram.layout.horizontalSpacing,this.margin=this.diagram.layout.margin;var i=[],r=[];this.rootNodes=[],this.vertexMapper.clear(),this.edgesMapper.clear(),this.loopedgesMapper.clear();for(var n=0,o=this.diagram.connectors;n<o.length;n++){var a=o[n];a.segments&&a.segments.length>0&&(a.segments=a.segments.filter(function(t){return!t.isOrthoInternalSegment}))}for(var s=0,h=t;s<h.length;s++){var d=h[s];if(!d.excludeFromLayout){var l=this.createVertex(d);this.vertexMapper.set(l.id,l),r.push(l),l.inEdges&&0!==l.inEdges.length||(i.push(l),this.rootNodes.push(d))}}for(var c=null,p=0,g=i;p<g.length;p++){var u=g[p],f=[];this.getTreeVertices(u,f,r);var m=new qc(this,u,f);m.layeringStage();var y=new Qc(m);y.siblingModel=c,y.arrangeElements(),c=y}var v=Array.from(this.vertexMapper.values()),b=this.getModelBounds(v);this.updateAnchor(b);for(var S="LeftToRight"===this.orientation?this.horizontalSpacing:this.verticalSpacing,x=[],I=0,P=v;I<P.length;I++){if(l=P[I]){var C=l.item;C&&(C.offsetX=l.geometry.x+l.geometry.width/2+this.anchorX,C.offsetY=l.geometry.y+l.geometry.height/2+this.anchorY,(l.inEdges&&l.inEdges.length>0||l.outEdges&&l.outEdges.length>0)&&x.push(C)),e.dataBind()}}var T=new w(b.x+this.anchorX,b.y+this.anchorY,b.width,b.height);this.nodeWithMultiEdges=x,this.inverseSpacing=S,this.transModelBounds=T,this.diagram.layout.flowChartData=this},t.prototype.reRouteFlowChartConnectors=function(t,e){this.diagram=e;var i=t.nodeWithMultiEdges,r=t.inverseSpacing;this.orientation=t.orientation;var n="TopToBottom"===this.orientation,o=t.transModelBounds;this.vertexMapper=t.vertexMapper,this.loopedgesMapper=t.loopedgesMapper,this.edgesMapper=t.edgesMapper,this.anchorX=t.anchorX,this.anchorY=t.anchorY;for(var a=[],s=0,h=i;s<h.length;s++){var d=h[s];if(d.outEdges&&d.outEdges.length>0)for(var l=0,c=d.outEdges;l<c.length;l++){var p=c[l],g=this.diagram.nameTable[""+p];if(this.loopedgesMapper.has(g)&&this.loopedgesMapper.get(g))-1===a.indexOf(g)&&(this.updateLoopConnector(g),a.push(g));else{var u=[];if(d.outEdges.length>1){var f=r/2,m=null;if(this.edgesMapper.has(g))(P=this.edgesMapper.get(g)[0])&&(m={x:P.x+this.anchorX,y:P.y+this.anchorY});g.segments=[],g.intermediatePoints=[];var y=[g.sourcePoint,g.targetPoint];if(n){u=this.updateVerticalConnectorSegments(g,y);var v=this.diagram.nameTable[g.sourceID];y=!this.vertexMapper.get(v.id).isDecisionNode&&u.length<=2?this.updateConnectorPoints(u,f,m,o):u}else y=u=this.updateHorizontalSegments(g,y);y.length>2&&this.updatePoints(y,g),a.push(g)}else if(4===g.intermediatePoints.length){var b=g.intermediatePoints[0],S=g.intermediatePoints[3],w=[b,n?{x:b.x,y:S.y-20}:{x:S.x-20,y:b.y},S];this.updatePoints(w,g),a.push(g)}}}if(d.inEdges&&d.inEdges.length>1)for(var x=0,I=d.inEdges;x<I.length;x++){p=I[x],g=this.diagram.nameTable[""+p];if(-1===a.indexOf(g))if(g.segments[0].points=[],this.loopedgesMapper.has(g)&&this.loopedgesMapper.get(g))this.updateLoopConnector(g),a.push(g);else if(d.inEdges.length>1){var P;f=r/2,m=null;if(this.edgesMapper.has(g)&&-1===a.indexOf(g))(P=this.edgesMapper.get(g)[0])&&(m={x:P.x+this.anchorX,y:P.y+this.anchorY});g.segments=[];y=[g.targetPoint,g.sourcePoint],u=[];u=n?this.updateVerticalConnectorSegments(g,y):this.updateHorizontalSegments(g,y),(y=this.updateConnectorPoints(u,f,m,o)).reverse(),y.length>2&&this.updatePoints(y,g)}}}},t.prototype.updateAnchor=function(t){var e=this.diagram.scrollSettings.viewPortWidth,i=this.diagram.scrollSettings.viewPortHeight;if("TopToBottom"===this.orientation?(this.anchorX=e/2-t.width/2-t.x,this.anchorY=this.margin.top):(this.anchorX=this.margin.left,this.anchorY=i/2-t.height/2-t.y),1===this.rootNodes.length){var r=this.rootNodes[0],n=this.vertexMapper.get(r.id).geometry,o=n.x+n.width/2,a=n.y+n.height/2,s=o-(t.x+t.width/2),h=a-(t.y+t.height/2);"TopToBottom"===this.orientation?this.anchorX-=s:this.anchorY-=h}},t.prototype.updateConnectorPoints=function(t,e,i,r){var n,o,a,s,h="LeftToRight"===this.orientation,d=t.slice();function l(t,e){return Math.atan2(e.y-t.y,e.x-t.x)*(180/Math.PI)}function c(t,e,i){var r=i*(Math.PI/180);return{x:t.x+e*Math.cos(r),y:t.y+e*Math.sin(r)}}if(d.length>2){var p=c(d[0],e,l(d[0],d[1])),g=c(p,(n=p,o=d[1],a=o.x-n.x,s=o.y-n.y,Math.sqrt(a*a+s*s)),l(p,d[2]));if(d.splice(1,0,g),d.splice(1,0,p),d.splice(3,2),null!=i){var u=d.length,f=c(d[u-1],e,l(d[u-1],d[u-2]));for(d.splice(u-1,0,f);2<d.length-2;)d.splice(2,1);var m=i;if(this.inflate(r,r.width,r.height),h){var y=[{x:r.left,y:m.y},{x:r.right,y:m.y}],v=[{x:d[1].x,y:r.top},{x:d[1].x,y:r.bottom}],b=[{x:f.x,y:r.top},{x:f.x,y:r.bottom}],S=[],w=[];S=this.diagram.commandHandler.intersect(y,v,!1),(w=this.diagram.commandHandler.intersect(y,b,!1)).length&&d.splice(2,0,w[0]),S.length&&d.splice(2,0,S[0])}else{y=[{x:m.x,y:r.top},{x:m.x,y:r.bottom}],v=[{x:r.left,y:d[1].y},{x:r.right,y:d[1].y}],b=[{x:r.left,y:f.y},{x:r.right,y:f.y}],S=[],w=[];S=this.diagram.commandHandler.intersect(y,v,!1),(w=this.diagram.commandHandler.intersect(y,b,!1)).length&&d.splice(2,0,w[0]),S.length&&d.splice(2,0,S[0])}}}else if(2===d.length&&null!=i){var x=d[0],I=d[1],P=l(d[0],d[1]),C=(f=c(x,e,P),c(I,e,(P+180)%360));if(d.splice(1,0,C),h){var T={x:f.x,y:i.y},A={x:C.x,y:i.y};d.splice(1,0,A),d.splice(1,0,T)}else{T={x:i.x,y:f.y},A={x:i.x,y:C.y};d.splice(1,0,A),d.splice(1,0,T)}d.splice(1,0,f)}return d},t.prototype.inflate=function(t,e,i){t.x-=e,t.y-=i,t.width+=2*e,t.height+=2*i},t.isBranchConnector=function(t,e){if(t.annotations.length>0&&t.annotations[0].content){var i=t.annotations[0].content;return e.some(function(t){return 0===i.localeCompare(t,void 0,{sensitivity:"accent"})})}return!1},t.prototype.isYesBranchConnector=function(e){return t.isBranchConnector(e,this.yesBranchValues)},t.prototype.isNoBranchConnector=function(e){return t.isBranchConnector(e,this.noBranchValues)},t.prototype.updateHorizontalSegments=function(t,e){var i=[],r=this.diagram.nameTable[t.sourceID],n=this.diagram.nameTable[t.targetID],o=this.vertexMapper.get(r.id).isDecisionNode,a=this.horizontalSpacing/2,s=this.verticalSpacing/2;if(o){var h=this.isYesBranchConnector(t),d=this.isNoBranchConnector(t);if(n.wrapper.bounds.containsPoint({x:n.offsetX,y:r.offsetY})||r.offsetY!==n.offsetY&&(h&&"SameAsFlow"===this.yesBranchDirection||d&&"SameAsFlow"===this.noBranchDirection&&"SameAsFlow"!==this.yesBranchDirection)){if(h&&"LeftInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("SameAsFlow"===this.noBranchDirection||"LeftInFlow"===this.noBranchDirection)||"RightInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection))){l=r.offsetX,c=r.wrapper.bounds.top,p=n.wrapper.bounds.left,g=n.wrapper.bounds.center.y;i.push({x:l,y:c}),i.push({x:l,y:c-s}),i.push({x:p-a,y:c-s}),i.push({x:p-a,y:g}),i.push({x:p,y:g})}else if(r.offsetY!==n.offsetY&&(h&&"SameAsFlow"===this.yesBranchDirection||d&&"SameAsFlow"===this.noBranchDirection&&"SameAsFlow"!==this.yesBranchDirection)){l=r.wrapper.bounds.right,c=r.offsetY,p=n.wrapper.bounds.left,g=n.wrapper.bounds.center.y;i.push({x:l,y:c}),i.push({x:p-a,y:c}),i.push({x:p-a,y:g}),i.push({x:p,y:g})}}else if(r.wrapper.bounds.bottom<n.wrapper.bounds.center.y){var l=r.wrapper.bounds.bottom,c=r.offsetX,p=n.wrapper.bounds.left,g=n.offsetY;i.push({x:c,y:l}),i.push({x:c,y:g}),i.push({x:p,y:g})}else if(r.wrapper.bounds.top>n.wrapper.bounds.center.y){var l=r.wrapper.bounds.top,c=r.offsetX,p=n.wrapper.bounds.left,g=n.offsetY;i.push({x:c,y:l}),i.push({x:c,y:g}),i.push({x:p,y:g})}else if(h&&"RightInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("RightInFlow"===this.noBranchDirection||"SameAsFlow"===this.noBranchDirection)||"LeftInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection))){var l=r.offsetX,c=r.wrapper.bounds.bottom,p=n.wrapper.bounds.left,g=n.wrapper.bounds.center.y;i.push({x:l,y:c}),i.push({x:l,y:c+s}),i.push({x:p-a,y:c+s}),i.push({x:p-a,y:g}),i.push({x:p,y:g})}}else i=e;return i},t.prototype.updateVerticalConnectorSegments=function(t,e){var i=[],r=this.diagram.nameTable[t.sourceID],n=this.diagram.nameTable[t.targetID],o=this.vertexMapper.get(r.id).isDecisionNode,a=this.horizontalSpacing/2,s=this.verticalSpacing/2;if(o){var h=this.isYesBranchConnector(t),d=this.isNoBranchConnector(t);if(r.wrapper.bounds.right<n.wrapper.bounds.center.x&&(h&&"RightInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("RightInFlow"===this.noBranchDirection||"SameAsFlow"===this.noBranchDirection)||"LeftInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection)))){var l=r.wrapper.bounds.right,c=r.offsetY,p=n.wrapper.bounds.top,g=n.offsetY;if(i.push({x:l,y:c}),0===(y=(y=this.diagram.nodes.filter(function(t){return t.wrapper.bounds.containsPoint({x:n.offsetX,y:r.offsetY})})).sort(function(t,e){return e.wrapper.bounds.left-t.wrapper.bounds.left})).length)i.push({x:n.offsetX,y:c});else{var u=y[0].wrapper.bounds;i.push({x:u.left-a,y:y[0].offsetY}),i.push({x:u.left-a,y:u.bottom+s})}i.push({x:p,y:g})}else if(r.wrapper.bounds.left>n.wrapper.bounds.center.x&&(h&&"LeftInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("SameAsFlow"===this.noBranchDirection||"LeftInFlow"===this.noBranchDirection)||"RightInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection)))){l=r.wrapper.bounds.left,c=r.offsetY,p=n.wrapper.bounds.top,g=n.offsetY;i.push({x:l,y:c});var f=w.toBounds([i[0],{x:n.offsetX,y:c}]);if(0===(y=(y=this.diagram.nodes.filter(function(t){return t.wrapper.bounds.intersects(f)&&t.id!==r.id&&t.id!==n.id})).sort(function(t,e){return e.wrapper.bounds.right-t.wrapper.bounds.right})).length)i.push({x:n.offsetX,y:c});else{u=y[0].wrapper.bounds;i.push({x:u.right+a,y:y[0].offsetY}),i.push({x:u.right+a,y:u.bottom+s})}i.push({x:p,y:g})}else if(h&&"RightInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("RightInFlow"===this.noBranchDirection||"SameAsFlow"===this.noBranchDirection)||"LeftInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection))){l=r.wrapper.bounds.right,c=r.offsetY,p=n.wrapper.bounds.topCenter.x,g=n.wrapper.bounds.topCenter.y;i.push({x:l,y:c}),i.push({x:l+a,y:c}),i.push({x:l+a,y:g-s}),i.push({x:p,y:g-s}),i.push({x:p,y:g});var m=w.toBounds([i[1],i[2]]);if((y=(y=this.diagram.nodes.filter(function(t){return t.wrapper.bounds.intersects(m)})).sort(function(t,e){return e.wrapper.bounds.right-t.wrapper.bounds.right})).length>0&&y[0].wrapper.bounds.intersects(m)){u=y[0].wrapper.bounds;i[1].x=u.right+a,i[2].x=u.right+a}}else if(h&&"LeftInFlow"===this.yesBranchDirection||d&&("SameAsFlow"===this.yesBranchDirection&&("SameAsFlow"===this.noBranchDirection||"LeftInFlow"===this.noBranchDirection)||"RightInFlow"===this.yesBranchDirection&&("LeftInFlow"===this.noBranchDirection||"RightInFlow"===this.noBranchDirection))){l=r.wrapper.bounds.left,c=r.offsetY,p=n.wrapper.bounds.topCenter.x,g=n.wrapper.bounds.topCenter.y;i.push({x:l,y:c}),i.push({x:l-a,y:c}),i.push({x:l-a,y:g-s}),i.push({x:p,y:g-s}),i.push({x:p,y:g});var y,v=w.toBounds([i[1],i[2]]);if((y=(y=this.diagram.nodes.filter(function(t){return t.wrapper.bounds.intersects(v)})).sort(function(t,e){return e.wrapper.bounds.left-t.wrapper.bounds.left})).length>0&&y[0].wrapper.bounds.intersects(v)){u=y[0].wrapper.bounds;i[1].x=u.left-a,i[2].x=u.left-a}}else if(r.offsetX!==n.offsetX&&(h&&"SameAsFlow"===this.yesBranchDirection||d&&"SameAsFlow"===this.noBranchDirection&&"SameAsFlow"!==this.yesBranchDirection)){l=r.offsetX,c=r.wrapper.bounds.bottom,p=n.wrapper.bounds.topCenter.x,g=n.wrapper.bounds.topCenter.y;i.push({x:l,y:c}),i.push({x:l,y:g-s}),i.push({x:p,y:g-s}),i.push({x:p,y:g})}else i=e}else i=e;return i},t.prototype.getModelBounds=function(t){var e=new w(0,0,0,0);return(t=Array.from(t)).forEach(function(t){var i=t.geometry;e.uniteRect(i)}),e},t.prototype.createVertex=function(t){var e=this,i=isNaN(t.width)?t.wrapper.bounds.width:t.width,r=isNaN(t.height)?t.wrapper.bounds.height:t.height,n=new w(0,0,i,r),o=[],a=[],s={isYesBranch:!1,isNoBranch:!1};if(null!=t.inEdges)for(var h=0,d=t.inEdges;h<d.length;h++){var l=d[h];(g=this.diagram.nameTable[""+l])&&o.push(g)}if(null!=t.outEdges)for(var c=0,p=t.outEdges;c<p.length;c++){var g;l=p[c];(g=this.diagram.nameTable[""+l])&&a.push(g)}var u=s.isYesBranch,f=s.isNoBranch;return null!=o&&o.forEach(function(t){s=e.checkForYesOrNoBranch(t,u,f)}),null!=a&&a.forEach(function(t){e.edgesMapper.set(t,[]),e.loopedgesMapper.set(t,!1)}),{id:t.id,geometry:n,inEdges:o,layoutObjectId:{},outEdges:a,item:t,isDecisionNode:!1,isYesChild:s.isYesBranch,isNoChild:s.isNoBranch}},t.prototype.updatePoints=function(t,e){for(var i=[],r=[],n=0;n<t.length;n++)if(t[n+2]){i.push(t[parseInt(n.toString(),10)]),i.push(t[n+1]);var o={type:"Orthogonal",points:i,length:i[0].x===i[1].x?Math.abs(i[0].y-i[1].y):Math.abs(i[0].x-i[1].x),direction:i[0].x===i[1].x?i[0].y>i[1].y?"Top":"Bottom":i[0].x>i[1].x?"Left":"Right",isOrthoInternalSegment:!0};i=[],r.push(o)}e.segments=r},t.prototype.contains=function(t,e){return t.x>=e.left&&t.x<=e.right&&t.y>=e.top&&t.y<=e.bottom},t.prototype.updateLoopConnector=function(t){var e=[];if(this.edgesMapper.has(t)){var i=this.edgesMapper.get(t);if(i)for(var r=0,n=i;r<n.length;r++){var o=n[r],a=o.x+this.anchorX,s=o.y+this.anchorY;e.push({x:a,y:s})}}e.reverse();var h=[],d=(e[0],e[e.length-1],this.diagram.nameTable[t.sourceID]),l=this.diagram.nameTable[t.targetID],c=d.wrapper.bounds,p=l.wrapper.bounds,g=d,u=l,f=this.vertexMapper.get(t.sourceID).isDecisionNode,m=this.isYesBranchConnector(t),y=this.isNoBranchConnector(t),v=m&&"LeftInFlow"===this.yesBranchDirection,b=y&&("RightInFlow"===this.yesBranchDirection&&("RightInFlow"===this.noBranchDirection||"SameAsFlow"===this.noBranchDirection)||"LeftInFlow"===this.noBranchDirection&&("RightInFlow"===this.yesBranchDirection||"SameAsFlow"===this.yesBranchDirection)),S=this.horizontalSpacing/2,x=this.verticalSpacing/2,I=(new w).uniteRect(g.wrapper.bounds).uniteRect(u.wrapper.bounds),P=this.diagram.nodes.filter(function(t){return t.id!==u.id&&t.id!==g.id&&t.wrapper.bounds.intersects(I)});if("TopToBottom"===this.orientation){var C=Array.from(this.vertexMapper.values()).filter(function(t){return t.item.wrapper.bounds.containsPoint({x:t.item.wrapper.bounds.x,y:g.offsetY})&&g.id!==t.item.id}),T=Array.from(this.vertexMapper.values()).filter(function(t){return t.item.wrapper.bounds.containsPoint({x:t.item.wrapper.bounds.x,y:u.offsetY})&&u.id!==t.item.id}),A=Math.max.apply(Math,e.map(function(t){return t.x})),O=!1;if(f?(v||b)&&(O=!0):O=C.length>0&&C[0].item.wrapper.bounds.x>c.x,0===T.length||!O&&T.length>0&&T.filter(function(t){return t.item.wrapper.bounds.right<p.left}).length>0){var D=!O&&A>c.right?c.right:c.left,M=D+(O?-S:S),L=!O&&A>p.right?p.right:p.left;h.push({x:D,y:g.offsetY}),h.push({x:M,y:g.offsetY}),h.push({x:M,y:u.offsetY}),h.push({x:L,y:u.offsetY})}else{var E=T[0].item.wrapper.bounds.bottom+x,z=O?c.left:c.right,k=z+(O?-S:S),B=!O&&A>p.right?p.right+S:p.left-S,R=!O&&A>p.right?p.right:p.left;h.push({x:z,y:g.offsetY}),h.push({x:k,y:g.offsetY}),h.push({x:k,y:E}),h.push({x:B,y:E}),h.push({x:B,y:u.offsetY}),h.push({x:R,y:u.offsetY})}if(P.length>0){var N=O?Math.min.apply(Math,P.map(function(t){return t.wrapper.bounds.left})):Math.max.apply(Math,P.map(function(t){return t.wrapper.bounds.right}));if(O&&N<h[1].x||!O&&N>h[1].x){var j=N+(O?-S:S);h[1].x=j,h[2].x=j}}}else{C=Array.from(this.vertexMapper.values()).filter(function(t){return t.item.wrapper.bounds.containsPoint({y:t.item.wrapper.bounds.y,x:g.offsetX})&&g.id!==t.item.id}),T=Array.from(this.vertexMapper.values()).filter(function(t){return t.item.wrapper.bounds.containsPoint({y:t.item.wrapper.bounds.y,x:u.offsetX})&&u.id!==t.item.id}),A=Math.max.apply(Math,e.map(function(t){return t.y}));var H=!1;if(f?(v||b)&&(H=!0):H=C.length>0&&C[0].item.wrapper.bounds.y>c.y,0===T.length||!H&&T.length>0&&T.some(function(t){return t.item.wrapper.bounds.bottom<p.top})){h.push({x:g.offsetX,y:!H&&A>c.bottom?c.bottom:c.top});var W=h[0].y+(H?-x:x);h.push({x:g.offsetX,y:W}),h.push({x:u.offsetX,y:W}),h.push({x:u.offsetX,y:!H&&A>p.bottom?p.bottom:p.top})}else{var _=T[0].item.wrapper.bounds.right+S;W=!H&&A>p.bottom?p.bottom+x:p.top-x;h.push({x:g.offsetX,y:H?c.top:c.bottom}),h.push({x:g.offsetX,y:h[0].y+(H?-x:x)}),h.push({x:_,y:h[1].y}),h.push({x:_,y:W}),h.push({x:u.offsetX,y:W}),h.push({x:u.offsetX,y:!H&&A>p.bottom?p.bottom:p.top})}if(P.length>0){N=H?Math.min.apply(Math,P.map(function(t){return t.wrapper.bounds.top})):Math.max.apply(Math,P.map(function(t){return t.wrapper.bounds.bottom}));if(H&&h[1].y>N||!H&&h[1].y<N){var Y=H?-x:x;h[1].y=N+Y,h[2].y=N+Y}}}this.updatePoints(h,t)},t.prototype.checkForYesOrNoBranch=function(t,e,i){var r=this;return t.annotations&&t.annotations.length&&t.annotations.forEach(function(t){if("string"==typeof t.content){var n=t.content.toString();r.yesBranchValues.forEach(function(t){0!==n.localeCompare(t,void 0,{sensitivity:"accent"})||(e=!0)}),r.noBranchValues.forEach(function(t){0!==n.localeCompare(t,void 0,{sensitivity:"accent"})||(i=!0)})}}),{isYesBranch:e,isNoBranch:i}},t.prototype.getTreeVertices=function(t,e,i){var r=this;if(null!=t&&-1===e.indexOf(t)){e.push(t),i=i.filter(function(e){return e!==t});var n=t.item.outEdges;if(2===n.length){var o=this.diagram.nameTable[this.diagram.nameTable[n[0]].targetID],a=this.diagram.nameTable[this.diagram.nameTable[n[1]].targetID],s=this.vertexMapper.get(o.id),h=this.vertexMapper.get(a.id);if(s&&h){var d=s.isYesChild||h.isYesChild,l=s.isNoChild||h.isNoChild;d&&!l?(s.isYesChild?h.isNoChild=!0:s.isNoChild=!0,l=!0):!d&&l&&(s.isNoChild?h.isYesChild=!0:s.isYesChild=!0,d=!0),t.isDecisionNode=d}}t.outEdges.forEach(function(n){var o=r.diagram.nameTable[n.targetID],a=r.vertexMapper.get(o.id);null!=a&&(t.isDecisionNode||(a.isYesChild=!1,a.isNoChild=!1),r.getTreeVertices(a,e,i))})}},t.prototype.getEdges=function(t){var e=[];if(null!=t){for(var i=0,r=t.inEdges;i<r.length;i++){var n=r[i];e.push(n)}for(var o=0,a=t.outEdges;o<a.length;o++){var s=a[o];e.push(s)}}return e},t.prototype.getVisibleTerminal=function(t,e){var i=e?t.sourceID:t.targetID;return this.vertexMapper.get(i)},t.prototype.getEdgesBetween=function(t,e,i){for(var r=this.getEdges(t),n=[],o=0;o<r.length;o++){var a=this.getVisibleTerminal(r[parseInt(o.toString(),10)],!0),s=this.getVisibleTerminal(r[parseInt(o.toString(),10)],!1);a.id===t.id&&s.id===e.id&&n.push(r[parseInt(o.toString(),10)])}return n},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"FlowchartLayout"},t}(),Jc=function(){function t(t){this.labelProperties=t}return t.prototype.renderConnectorsCollection=function(t,e){t.connectors=[];for(var i=[],r=0;r<e.connectors.length;r++){var n=e.connectors[parseInt(r.toString(),10)],o=this.convertToConnector(n);i.push(o)}t.connectors=i},t.prototype.convertToConnector=function(t){var e={style:{}};return t.name&&(e.id=t.name),t.addInfo&&(e.addInfo=t.addInfo),t.bridgeSpace&&(e.bridgeSpace=t.bridgeSpace),t.constraints&&(e.constraints=this.setConnectorConstraints(t.constraints)),t.cornerRadius&&(e.cornerRadius=t.cornerRadius),t.labels&&(e.annotations=this.labelProperties.setLabelProperties(t.labels,t)),t.lineColor&&(e.style.fill=t.lineColor),t.lineWidth&&(e.style.strokeWidth=t.lineWidth),t.lineDashArray&&(e.style.strokeDashArray=t.lineDashArray),t.opacity&&(e.style.opacity=t.opacity),t.lineHitPadding&&(e.hitPadding=t.lineHitPadding),t.margin&&(e.margin={left:t.margin.left,right:t.margin.right,top:t.margin.top,bottom:t.margin.bottom}),t.segments&&(e.type=t.segments[0].type.charAt(0).toUpperCase()+t.segments[0].type.slice(1),e.segments=this.setConnectorSegments(t.segments)),t.shape&&(e.shape=this.getConnectorShape(t.shape)),t.sourceDecorator&&(e.sourceDecorator={height:t.sourceDecorator.height,width:t.sourceDecorator.width,shape:this.getDecoratorShape(t.sourceDecorator.shape),pathData:t.sourceDecorator.pathData,style:{fill:t.sourceDecorator.fillColor,strokeColor:t.sourceDecorator.lineColor,strokeWidth:t.sourceDecorator.lineWidth}}),t.targetDecorator&&(e.targetDecorator={height:t.targetDecorator.height,width:t.targetDecorator.width,shape:this.getDecoratorShape(t.targetDecorator.shape),pathData:t.targetDecorator.pathData,style:{fill:t.targetDecorator.fillColor,strokeColor:t.targetDecorator.lineColor,strokeWidth:t.targetDecorator.lineWidth}}),t.sourceNode&&(e.sourceID=t.sourceNode),t.targetNode&&(e.targetID=t.targetNode),t.sourcePoint&&(e.sourcePoint={x:t.sourcePoint.x,y:t.sourcePoint.y}),t.targetPoint&&(e.targetPoint={x:t.targetPoint.x,y:t.targetPoint.y}),t.sourcePort&&(e.sourcePortID=t.sourcePort),t.targetPort&&(e.targetPortID=t.targetPort),t.tooltip&&(e.tooltip={content:t.tooltip.content,relativeMode:t.tooltip.relativeMode}),t.visible&&(e.visible=t.visible),t.zOrder&&(e.zIndex=t.zOrder),e},t.prototype.getConnectorShape=function(t){var e=null;return t&&("bpmn"===t.type&&(e={type:"Bpmn",flow:t.flow.charAt(0).toUpperCase()+t.flow.slice(1)},"sequence"===t.flow?e.sequence=t.sequence.charAt(0).toUpperCase()+t.sequence.slice(1):"association"===t.flow?e.association=t.association.charAt(0).toUpperCase()+t.association.slice(1):e.message=t.message.charAt(0).toUpperCase()+t.message.slice(1)),"umlclassifier"===t.type&&(e={type:"UmlClassifier",relationship:t.relationship.charAt(0).toUpperCase()+t.relationship.slice(1),multiplicity:{type:t.multiplicity.type.charAt(0).toUpperCase()+t.multiplicity.type.slice(1),source:{upperBounds:t.multiplicity.source.upperBounds,optional:t.multiplicity.source.optional,lowerBounds:t.multiplicity.source.lowerBounds},target:{upperBounds:t.multiplicity.target.upperBounds,optional:t.multiplicity.target.optional,lowerBounds:t.multiplicity.target.lowerBounds}}}),"umlactivity"===t.type&&(e={type:"UmlActivity",flow:t.flow.charAt(0).toUpperCase()+t.flow.slice(1)})),e},t.prototype.getDecoratorShape=function(t){return"path"===t?"Custom":t.charAt(0).toUpperCase()+t.slice(1)},t.prototype.setConnectorSegments=function(t){var e=[];if(t.length>0)for(var i=0;i<t.length;i++){var r={},n=t[parseInt(i.toString(),10)];r.direction=n.direction?n.direction.charAt(0).toUpperCase()+n.direction.slice(1):n._direction?n._direction.charAt(0).toUpperCase()+n._direction.slice(1):null,r.length=n.length?n.length:n._length?n._length:null,r.point=n.point?{x:n.point.x,y:n.point.y}:null,r.point1=n.point1?{x:n.point1.x,y:n.point1.y}:null,r.point2=n.point2?{x:n.point2.x,y:n.point2.y}:null,r.vector1=n.vector1?{angle:n.vector1.angle,distance:n.vector1.distance}:null,r.vector2=n.vector2?{angle:n.vector2.angle,distance:n.vector2.distance}:null,n.points&&(r.points=this.getSegmentPoints(n.points)),n.type&&(r.type=n.type.charAt(0).toUpperCase()+n.type.slice(1)),e.push(r)}return e},t.prototype.getSegmentPoints=function(t){var e=[];if(t.length>0)for(var i=0;i<t.length;i++){var r={},n=t[parseInt(i.toString(),10)];r.x=n.x,r.y=n.y,e.push(r)}return e},t.prototype.setConnectorConstraints=function(t){var e=at.None;return t&at.Select&&(e|=at.Select),t&at.Delete&&(e|=at.Delete),t&at.Drag&&(e|=at.Drag),t&at.DragSourceEnd&&(e|=at.DragSourceEnd),t&at.DragTargetEnd&&(e|=at.DragTargetEnd),t&at.DragSegmentThumb&&(e|=at.DragSegmentThumb),t&at.Bridging&&(e|=at.Bridging),t&at.InheritBridging&&(e|=at.InheritBridging),t&at.AllowDrop&&(e|=at.AllowDrop),t&at.InheritTooltip&&(e|=at.InheritTooltip),t&at.PointerEvents&&(e|=at.PointerEvents),t&at.BridgeObstacle&&(e|=at.BridgeObstacle),t&at.Interaction&&(e|=at.Interaction),t&at.Default&&(e|=at.Default),e},t.prototype.getModuleName=function(){return"ConnectorProperties"},t}(),$c=function(){function t(t){this.modelProperties=t}return t.prototype.setLabelProperties=function(t,e){var i=[];if(t.length>0)for(var r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],o={style:{}};if(n.name){var a=n.name.split("_"),s=a[a.length-1];o.id=s}if(n.addInfo&&(o.addInfo=n.addInfo),n.text&&(o.content=n.text),n.constraints&&(o.constraints=this.setLabelConstraints(n.constraints)),n.readOnly&&(o.constraints=o.constraints|st.ReadOnly),n.dragLimit&&(o.dragLimit={left:n.dragLimit.left,right:n.dragLimit.right,top:n.dragLimit.top,bottom:n.dragLimit.bottom}),n.height&&(o.height=n.height),n.horizontalAlignment&&(o.horizontalAlignment=n.horizontalAlignment.charAt(0).toUpperCase()+n.horizontalAlignment.slice(1).toLowerCase()),n.verticalAlignment&&(o.verticalAlignment=n.verticalAlignment.charAt(0).toUpperCase()+n.verticalAlignment.slice(1).toLowerCase()),n.hyperlink&&(o.hyperlink={link:n.hyperlink,color:"blue"}),n.margin&&(o.margin={left:n.margin.left,right:n.margin.right,top:n.margin.top,bottom:n.margin.bottom}),o.rotateAngle=n.rotateAngle,n.offset&&(o.offset=e?n.offset.x:{x:n.offset.x,y:n.offset.y}),o.style.color=n.fontColor,o.style.fontFamily=n.fontFamily,o.style.fontSize=n.fontSize,o.style.italic=n.italic,o.style.bold=n.bold,n.borderColor&&(o.style.strokeColor=n.borderColor),n.borderWidth&&(o.style.strokeWidth=n.borderWidth),n.wrapping)switch(n.wrapping){case"wrap":o.style.textWrapping="Wrap";break;case"nowrap":o.style.textWrapping="NoWrap";break;case"wrapwithoverflow":o.style.textWrapping="WrapWithOverflow"}n.textOverflow&&n.overflowType&&(o.style.textOverflow=n.overflowType.charAt(0).toUpperCase()+n.overflowType.slice(1)),n.textAlign&&(o.style.textAlign=n.textAlign.charAt(0).toUpperCase()+n.textAlign.slice(1).toLowerCase()),n.textDecoration&&(o.style.textDecoration=n.textDecoration.charAt(0).toUpperCase()+n.textDecoration.slice(1).toLowerCase(),"Linethrough"===o.style.textDecoration&&(o.style.textDecoration="LineThrough"));var h=this.setLabelAppearance(o,n);o.style.fill=h.fill,o.style.opacity=h.opacity,o.visibility=h.visibility,n.width&&(o.width=n.width),i.push(o)}return i},t.prototype.setLabelAppearance=function(t,e){var i={};return e.fillColor&&(i.fill="white"===e.fillColor?"transparent":e.fillColor),e.opacity&&(i.opacity=e.opacity),e.visible&&(i.visibility=e.visible),i},t.prototype.setLabelConstraints=function(t){var e=st.None;return t&st.Select&&(e|=st.Select),t&st.Drag&&(e|=st.Drag),t&st.Resize&&(e|=st.Resize),t&st.Rotate&&(e|=st.Rotate),e},t.prototype.getModuleName=function(){return"LabelProperties"},t}(),tp=function(){function t(t,e){this.labelProperties=t,this.portProperties=e}return t.prototype.renderNodesCollection=function(t,e){t.nodes=[];for(var i=[],r=0;r<e.nodes.length;r++){var n=e.nodes[parseInt(r.toString(),10)],o=[],a=this.convertToNode(n);if(a.shape&&a.shape.activity&&a.shape.activity.subProcess&&a.shape.activity.subProcess.processes&&a.shape.activity.subProcess.processes.length>0){for(var s=[],h=0;h<a.shape.activity.subProcess.processes.length;h++){var d=a.shape.activity.subProcess.processes[parseInt(h.toString(),10)];d.margin.right=0,d.margin.bottom=0,d.processId=a.id,s.push(d.id),o.push(d)}a.shape.activity.subProcess.processes=s}if("group"===n.type&&!n.isSwimlane){var l=[];if(a.children&&a.children.length>0){for(var c=0;c<a.children.length;c++){var p=a.children[parseInt(c.toString(),10)];i.push(p),l.push(p.id)}a.children=l}}i.push(a),o&&o.length>0&&(i=i.concat(o))}return t.nodes=i,t.nodes},t.prototype.convertToNode=function(t){var e={style:{},margin:{}};return t.name&&(e.id=t.name),t.fillColor&&(e.style.fill=t.fillColor),t.borderColor&&(e.style.strokeColor=t.borderColor),t.borderWidth&&(e.style.strokeWidth=t.borderWidth),t.borderDashArray&&(e.style.strokeDashArray=t.borderDashArray),t.opacity&&(e.style.opacity=t.opacity),t.gradient&&(e.style.gradient=this.setGradient(t.gradient)),t.isExpanded&&(e.isExpanded=t.isExpanded),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.offsetX&&(e.offsetX=t.offsetX),t.offsetY&&(e.offsetY=t.offsetY),t.visible&&(e.visible=t.visible),e.zIndex=-1===t.zOrder?-1:t.zOrder,t.excludeFromLayout&&(e.excludeFromLayout=t.excludeFromLayout),t.rotateAngle&&(e.rotateAngle=t.rotateAngle),t.pivot&&(e.pivot=t.pivot),t.addInfo&&(e.addInfo=t.addInfo),t.marginLeft&&(e.margin.left=t.marginLeft),t.marginRight&&(e.margin.right=t.marginRight),t.marginTop&&(e.margin.top=t.marginTop),t.marginBottom&&(e.margin.bottom=t.marginBottom),t.horizontalAlign&&(e.horizontalAlignment=t.horizontalAlign),t.verticalAlign&&(e.verticalAlignment=t.verticalAlign),t.constraints&&(e.constraints=this.setNodeConstraints(t.constraints)),t.labels&&(e.annotations=this.labelProperties.setLabelProperties(t.labels,void 0)),t.shadow&&(e.shadow={angle:t.shadow.angle,opacity:t.shadow.opacity,distance:t.shadow.distance}),t.tooltip&&(e.tooltip={relativeMode:t.tooltip.relativeMode}),t.expandIcon&&(e.expandIcon={shape:t.expandIcon.shape.charAt(0).toUpperCase()+t.expandIcon.shape.slice(1),width:t.expandIcon.width,height:t.expandIcon.height,margin:{left:t.expandIcon.margin.left,right:t.expandIcon.margin.right,top:t.expandIcon.margin.top,bottom:t.expandIcon.margin.bottom},offset:{x:t.expandIcon.offset.x,y:t.expandIcon.offset.y},borderColor:t.expandIcon.borderColor,borderWidth:t.expandIcon.borderWidth,cornerRadius:t.expandIcon.cornerRadius,pathData:t.expandIcon.pathData},"Arrowup"===e.expandIcon.shape?e.expandIcon.shape="ArrowUp":"Arrowdown"===e.expandIcon.shape&&(e.expandIcon.shape="ArrowDown")),t.collapseIcon&&(e.collapseIcon={shape:t.collapseIcon.shape.charAt(0).toUpperCase()+t.collapseIcon.shape.slice(1),width:t.collapseIcon.width,height:t.collapseIcon.height,margin:{left:t.collapseIcon.margin.left,right:t.collapseIcon.margin.right,top:t.collapseIcon.margin.top,bottom:t.collapseIcon.margin.bottom},offset:{x:t.collapseIcon.offset.x,y:t.collapseIcon.offset.y},borderColor:t.collapseIcon.borderColor,borderWidth:t.collapseIcon.borderWidth,cornerRadius:t.collapseIcon.cornerRadius,pathData:t.collapseIcon.pathData},"Arrowup"===e.collapseIcon.shape?e.collapseIcon.shape="ArrowUp":"Arrowdown"===e.collapseIcon.shape&&(e.collapseIcon.shape="ArrowDown")),t.ports&&(e.ports=this.portProperties.setPortProperties(t.ports)),t.children&&("bpmn"===t.type||t.isSwimlane||(e.children=this.getChildren(e,t))),t.children&&t.children.length>0||(e.maxWidth=t.maxWidth,e.maxHeight=t.maxHeight,e.minWidth=t.minWidth,e.minHeight=t.minHeight),(t.shape||t.type)&&(e=this.setShape(e,t)),e},t.prototype.getChildren=function(t,e){if(e.children&&e.children.length>0){for(var i=[],r=0;r<e.children.length;r++){var n=this.convertToNode(e.children[parseInt(r.toString(),10)]);n.children&&this.getChildren(t,n),i.push(n)}t.children=i}return t.children},t.prototype.setShape=function(t,e){switch(e.type){case"basic":var i=e.shape.charAt(0).toUpperCase()+e.shape.slice(1);"path"===e.shape?t.shape={type:"Path",data:e.pathData}:t.shape={type:"Basic",shape:i,cornerRadius:e.cornerRadius,points:e.points};break;case"flow":var r=e.shape.charAt(0).toUpperCase()+e.shape.slice(1);t.shape={type:"Flow",shape:r};break;case"umlactivity":t.shape={type:"UmlActivity",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1)};break;case"image":t.shape={type:"Image",source:e.source,align:this.getImageContentAlignment(e.contentAlignment),scale:e.scale.charAt(0).toUpperCase()+e.scale.slice(1)};break;case"html":t.shape={type:"HTML"};break;case"native":t.shape={type:"Native"};break;case"text":t.shape={type:"Text",content:e.textBlock.text};break;case"bpmn":t.shape=this.renderBpmnShape(t,e);break;case"group":e.isSwimlane&&(t.shape=this.renderSwimlaneShape(t,e))}return t},t.prototype.getImageContentAlignment=function(t){if(t)switch(t){case"xminymin":return"XMinYMin";case"xminymid":return"XMinYMid";case"xminymax":return"XMinYMax";case"xmidymin":return"XMidYMin";case"xmidymid":return"XMidYMid";case"xmidymax":return"XMidYMax";case"xmaxymin":return"XMaxYMin";case"xmaxymid":return"XMaxYMid";case"xmaxymax":return"XMaxYMax";case"none":return"None"}return"None"},t.prototype.setNodeConstraints=function(t){var e=ht.None;return t&ht.Select&&(e|=ht.Select),t&ht.Delete&&(e|=ht.Delete),t&ht.Drag&&(e|=ht.Drag),t&ht.Rotate&&(e|=ht.Rotate),t&ht.ResizeNorthEast&&(e|=ht.ResizeNorthEast),t&ht.ResizeEast&&(e|=ht.ResizeEast),t&ht.OutConnect&&(e|=ht.ResizeSouthEast),t&ht.Expandable&&(e|=ht.ResizeSouth),t&ht.AllowDrop&&(e|=ht.ResizeSouthWest),t&ht.ResizeNorthEast&&(e|=ht.ResizeWest),t&ht.ResizeEast&&(e|=ht.ResizeNorthWest),t&ht.ResizeNorth&&(e|=ht.ResizeNorth),t&ht.Resize&&(e|=ht.Resize),t&ht.Shadow&&(e|=ht.Shadow),t&ht.AspectRatio&&(e|=ht.AspectRatio),t&ht.AllowDrop&&(e|=ht.AllowDrop),t&ht.InheritTooltip&&(e|=ht.InheritTooltip),t&ht.PointerEvents&&(e|=ht.PointerEvents),t&ht.Inherit&&(e|=ht.Inherit),t&ht.Default&&(e|=ht.Default),e},t.prototype.setGradient=function(t){var e={};return t&&("linear"===t.type?e={type:"Linear",x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,stops:this.getGradientStops(t.stops)}:"radial"===t.type&&(e={type:"Radial",cx:t.cx,cy:t.cy,fx:t.fx,fy:t.fy,stops:this.getGradientStops(t.stops)})),e},t.prototype.getGradientStops=function(t){for(var e=[],i=0;i<t.length;i++){var r={},n=t[parseInt(i.toString(),10)];r.color=n.color,r.offset=n.offset,e.push(r)}return e},t.prototype.renderBpmnShape=function(t,e){return"event"===e.shape?t.shape={type:"Bpmn",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1),event:{event:e.event.charAt(0).toUpperCase()+e.event.slice(1),trigger:e.trigger.charAt(0).toUpperCase()+e.trigger.slice(1)}}:"gateway"===e.shape?t.shape={type:"Bpmn",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1),gateway:{type:e.gateway.charAt(0).toUpperCase()+e.gateway.slice(1)}}:"activity"===e.shape?(t.shape={type:"Bpmn",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1),activity:{activity:e.activity.charAt(0).toUpperCase()+e.activity.slice(1)}},t.shape.activity.activity="Subprocess"===t.shape.activity.activity?"SubProcess":t.shape.activity.activity,"task"===e.activity&&(t.shape.activity.task={type:e.task.type.charAt(0).toUpperCase()+e.task.type.slice(1),loop:e.task.loop.charAt(0).toUpperCase()+e.task.loop.slice(1),compensation:e.task.compensation,call:e.task.call}),"subprocess"===e.activity&&("event"===e.subProcess.type?t.shape.activity.subProcess={collapsed:e.subProcess.collapsed,compensation:e.subProcess.compensation,adhoc:e.subProcess.adhoc,loop:e.subProcess.loop.charAt(0).toUpperCase()+e.subProcess.loop.slice(1),boundary:e.subProcess.boundary.charAt(0).toUpperCase()+e.subProcess.boundary.slice(1),type:e.subProcess.type.charAt(0).toUpperCase()+e.subProcess.type.slice(1),event:{event:e.subProcess.event.charAt(0).toUpperCase()+e.subProcess.event.slice(1),trigger:e.subProcess.trigger.charAt(0).toUpperCase()+e.subProcess.trigger.slice(1)}}:"transaction"===e.subProcess.type&&(t.shape.activity.subProcess={collapsed:e.subProcess.collapsed,compensation:e.subProcess.compensation,adhoc:e.subProcess.adhoc,loop:e.subProcess.loop.charAt(0).toUpperCase()+e.subProcess.loop.slice(1),boundary:e.subProcess.boundary.charAt(0).toUpperCase()+e.subProcess.boundary.slice(1),type:e.subProcess.type.charAt(0).toUpperCase()+e.subProcess.type.slice(1),events:this.renderEventsCollection(e.subProcess.events),processes:this.renderProcessesCollection(e)}))):"dataobject"===e.shape?(t.shape={type:"Bpmn",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1)},e.annotation&&(t.shape.annotation={text:e.annotation.text,angle:e.annotation.angle,width:e.annotation.width,height:e.annotation.height,length:e.annotation.length})):t.shape={type:"Bpmn",shape:e.shape.charAt(0).toUpperCase()+e.shape.slice(1)},t.shape},t.prototype.renderSwimlaneShape=function(t,e){t.shape={type:"SwimLane",orientation:e.orientation.charAt(0).toUpperCase()+e.orientation.slice(1),header:{annotation:{content:e.header.text},height:50,style:{fontSize:e.header.fontSize,color:e.header.fontColor,fill:e.header.fillColor}}};for(var i=[],r=[],n=0;n<e.lanes.length;n++){i[parseInt(n.toString(),10)]={header:{annotation:{content:e.lanes[parseInt(n.toString(),10)].header.text,width:e.lanes[parseInt(n.toString(),10)].header.width,style:{fontSize:e.lanes[parseInt(n.toString(),10)].header.fontSize,color:e.lanes[parseInt(n.toString(),10)].header.fontColor}}},style:{fill:e.lanes[parseInt(n.toString(),10)].fillColor},children:[]};for(var o=0;o<e.lanes[parseInt(n.toString(),10)].children.length;o++){var a=this.convertToNode(e.lanes[parseInt(n.toString(),10)].children[parseInt(o.toString(),10)]);null==a.wrapper&&(a.wrapper={actualSize:{width:a.width,height:a.height},offsetX:a.offsetX,offsetY:a.offsetY}),i[parseInt(n.toString(),10)].children.push(a)}}for(n=0;n<e.phases.length;n++)r[parseInt(n.toString(),10)]={header:{annotation:{content:e.phases[parseInt(n.toString(),10)].label.text,style:{fill:e.phases[parseInt(n.toString(),10)].label.fillColor,fontSize:e.phases[parseInt(n.toString(),10)].label.fontSize,color:e.phases[parseInt(n.toString(),10)].label.fontColor}}},offset:e.phases[parseInt(n.toString(),10)].offset,style:{fill:e.phases[parseInt(n.toString(),10)].fillColor,strokeColor:e.phases[parseInt(n.toString(),10)].lineColor,strokeDashArray:e.phases[parseInt(n.toString(),10)].lineDashArray}};return t.shape.lanes=i,t.shape.phases=r,t.shape},t.prototype.renderEventsCollection=function(t){var e=[];if(t.length>0)for(var i=0;i<t.length;i++){var r={},n=t[parseInt(i.toString(),10)];r.event=n.event.charAt(0).toUpperCase()+n.event.slice(1),r.trigger=n.trigger.charAt(0).toUpperCase()+n.trigger.slice(1),r.offset={x:n.offset.x,y:n.offset.y},e.push(r)}return e},t.prototype.renderProcessesCollection=function(t){var e=[];if(t.subProcess&&t.subProcess.processes.length>0)for(var i=0;i<t.subProcess.processes.length;i++){var r=t.subProcess.processes[parseInt(i.toString(),10)],n=this.convertToNode(r);e.push(n)}return e},t.prototype.getModuleName=function(){return"NodeProperties"},t}(),ep=function(){function t(t){this.modelProperties=t}return t.prototype.setPortProperties=function(t){var e=[];if(t.length>0)for(var i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)],n={style:{}};n.id=r.name,r.addInfo&&(n.addInfo=r.addInfo),n.height=r.size,n.width=r.size,r.horizontalAlignment&&(n.horizontalAlignment=r.horizontalAlignment.charAt(0).toUpperCase()+r.horizontalAlignment.slice(1)),r.verticalAlignment&&(n.verticalAlignment=r.verticalAlignment.charAt(0).toUpperCase()+r.verticalAlignment.slice(1)),r.margin&&(n.margin={left:r.margin.left,right:r.margin.right,top:r.margin.top,bottom:r.margin.bottom}),n.offset={x:r.offset.x,y:r.offset.y},n.style.strokeColor=r.borderColor,n.style.strokeWidth=r.borderWidth,n.style.fill=r.fillColor,n.constraints=this.setPortConstraints(r.constraints),r.pathData&&(n.pathData=r.pathData),"path"===r.shape?n.shape="Custom":r.shape?n.shape=r.shape.charAt(0).toUpperCase()+r.shape.slice(1):n.shape="Square",n.visibility=this.setPortVisibility(r.visibility),e.push(n)}return e},t.prototype.setPortConstraints=function(t){var e=It.Default;return t&It.Draw&&(e|=It.Draw),t&It.None&&(e=It.None),e},t.prototype.setPortVisibility=function(t){var e;return t&et.Visible&&(e|=et.Visible),t&et.Hidden&&(e|=et.Hidden),t&et.Hover&&(e|=et.Hover),t&et.Connect&&(e|=et.Connect),e},t.prototype.getModuleName=function(){return"PortProperties"},t}(),ip=function(){function t(t){this.labelProperties=new $c(this),this.connectorProperties=new Jc(this.labelProperties),this.portProperties=new ep(this),this.nodeProperties=new tp(this.labelProperties,this.portProperties),this.convertedData={},this.items=[],this.diagram=t}return t.prototype.getSerializedData=function(t){return this.convertedData.mode="SVG",this.convertedData.basicElements=[],this.convertedData.width=t.width,this.convertedData.height=t.height,t.nodes&&t.nodes.length>0?this.nodeProperties.renderNodesCollection(this.convertedData,t):this.convertedData.nodes=t.nodes,t.connectors&&t.connectors.length>0?this.connectorProperties.renderConnectorsCollection(this.convertedData,t):this.convertedData.connectors=t.connectors,void 0!==t.defaultSettings&&(this.convertedData.getNodeDefaults=this.getNodeDefaults(t.defaultSettings.node),this.convertedData.getConnectorDefaults=this.getConnectorDefaults(t.defaultSettings.connector)),t.layers=t.layers||[],t.dataSourceSettings=t.dataSourceSettings||{},t.dataSourceSettings.crudAction=t.dataSourceSettings.crudAction||{},t.rulerSettings=t.rulerSettings||{},t.rulerSettings.horizontalRuler=t.rulerSettings.horizontalRuler||{},t.rulerSettings.verticalRuler=t.rulerSettings.verticalRuler||{},t.snapSettings=t.snapSettings||{},t.snapSettings.horizontalGridLines=t.snapSettings.horizontalGridLines||{},t.snapSettings.verticalGridLines=t.snapSettings.verticalGridLines||{},t.snapSettings.snapConstraints=it.All,t.pageSettings=t.pageSettings||{},t.pageSettings.scrollLimit=t.pageSettings.scrollLimit||"Diagram",t.pageSettings.pageOrientation=t.pageSettings.pageOrientation||"Landscape",t.pageSettings.boundaryConstraints=t.pageSettings.boundaryConstraints||"Diagram",t.pageSettings.pageBackgroundColor=t.pageSettings.pageBackgroundColor||"transparent",t.backgroundImage=t.backgroundImage||{},t.tooltip=t.tooltip||{},t.scrollSettings=t.scrollSettings||{},t.layout=t.layout||{},t.layout.margin=t.layout.margin||{left:0,right:0,top:0,bottom:0},t.layout.horizontalAlignment=t.layout.horizontalAlignment||"Auto",t.layout.verticalAlignment=t.layout.verticalAlignment||"Auto",t.layout.type=t.layout.type||"None",t.selectedItems=t.selectedItems||{},t.selectedItems.constraints=t.selectedItems.constraints||rt.All,t.constraints=t.constraints||ct.Default,t.tool=t.tool||pt.None,t.scrollSettings.horizontalOffset=-t.scrollSettings.horizontalOffset||0,t.scrollSettings.verticalOffset=-t.scrollSettings.verticalOffset||0,t.pageSettings.pageWidth||(t.pageSettings.pageWidth=t.scrollSettings.viewPortWidth),t.pageSettings.pageHeight||(t.pageSettings.pageHeight=t.scrollSettings.viewPortHeight),this.setLayers(this.convertedData,t),this.setDataSourceSettings(this.convertedData,t),this.setRulerSettings(this.convertedData,t),this.setSnapSettings(this.convertedData,t),t.snapSettings.enableSnapToObject?this.convertedData.snapSettings.constraints=this.convertedData.snapSettings.constraints|it.SnapToObject:this.convertedData.snapSettings.constraints=this.convertedData.snapSettings.constraints&~it.SnapToObject,void 0===t.pageSettings.backgroundImage&&(t.pageSettings.backgroundImage={source:"",scale:"meet",alignment:"xmidymid"},t.pageSettings.showPageBreak=!1),this.setScrollSettings(this.convertedData,t),this.setPageSettings(this.convertedData,t),this.setContextMenu(this.convertedData,t),this.setTooltip(this.convertedData,t),this.setModelLayout(this.convertedData,t),this.setSelectedItems(this.convertedData,t),this.convertedData.constraints=this.setDiagramConstraints(t.constraints),this.convertedData.tool=this.setDiagramTool(t.tool),this.convertedData.drawType=t.drawType,this.convertedData.commandManager=t.commandManager,this.convertedData},t.prototype.getNodeDefaults=function(t){return t?this.nodeProperties.convertToNode(t):null},t.prototype.getConnectorDefaults=function(t){return t?this.connectorProperties.convertToConnector(t):null},t.prototype.setLayers=function(t,e){if(t.layers=[],e.layers.length>0)for(var i=0;i<e.layers.length;i++){var r={},n=e.layers[parseInt(i.toString(),10)];r.id=n.name,r.visible=n.visible,r.lock=n.lock,r.objects=n.objects,t.layers.push(r)}},t.prototype.setDataSourceSettings=function(t,e){t.dataSourceSettings={},t.dataSourceSettings.id=e.dataSourceSettings.id,t.dataSourceSettings.dataManager=e.dataSourceSettings.dataSource,t.dataSourceSettings.root=e.dataSourceSettings.root,t.dataSourceSettings.parentId=e.dataSourceSettings.parent,t.dataSourceSettings.crudAction={read:e.dataSourceSettings.crudAction.read,create:e.dataSourceSettings.crudAction.create,update:e.dataSourceSettings.crudAction.update,destroy:e.dataSourceSettings.crudAction.destroy,customFields:e.dataSourceSettings.customFields},e.dataSourceSettings.connectionDataSource&&(t.dataSourceSettings.connectionDataSource={},t.dataSourceSettings.connectionDataSource.id=e.dataSourceSettings.connectionDataSource.id,t.dataSourceSettings.connectionDataSource.dataManager=e.dataSourceSettings.connectionDataSource.dataSource,t.dataSourceSettings.connectionDataSource.sourceID=e.dataSourceSettings.connectionDataSource.sourceNode,t.dataSourceSettings.connectionDataSource.targetID=e.dataSourceSettings.connectionDataSource.targetNode,t.dataSourceSettings.connectionDataSource.sourcePointX=e.dataSourceSettings.connectionDataSource.sourcePointX,t.dataSourceSettings.connectionDataSource.sourcePointY=e.dataSourceSettings.connectionDataSource.sourcePointY,t.dataSourceSettings.connectionDataSource.targetPointX=e.dataSourceSettings.connectionDataSource.targetPointX,t.dataSourceSettings.connectionDataSource.targetPointY=e.dataSourceSettings.connectionDataSource.targetPointY,t.dataSourceSettings.connectionDataSource.crudAction={read:e.dataSourceSettings.connectionDataSource.crudAction.read,create:e.dataSourceSettings.connectionDataSource.crudAction.create,update:e.dataSourceSettings.connectionDataSource.crudAction.update,destroy:e.dataSourceSettings.connectionDataSource.crudAction.destroy,customFields:e.dataSourceSettings.connectionDataSource.customFields})},t.prototype.setRulerSettings=function(t,e){t.rulerSettings={},t.rulerSettings.showRulers=e.rulerSettings.showRulers,t.rulerSettings.horizontalRuler=this.setRulerProperties(e.rulerSettings.horizontalRuler),t.rulerSettings.verticalRuler=this.setRulerProperties(e.rulerSettings.verticalRuler)},t.prototype.setRulerProperties=function(t){var e={};return e.interval=t.interval,e.segmentWidth=t.segmentWidth,e.markerColor=t.markerColor,e.thickness=t.thickness,e.arrangeTick=t.arrangeTick,e},t.prototype.setSnapSettings=function(t,e){t.snapSettings={},e.snapSettings&&(t.snapSettings.horizontalGridLines=this.setGridLines(e.snapSettings.horizontalGridLines),t.snapSettings.verticalGridLines=this.setGridLines(e.snapSettings.verticalGridLines),t.snapSettings.snapAngle=e.snapSettings.snapAngle,t.snapSettings.snapObjectDistance=e.snapSettings.snapObjectDistance,t.snapSettings.constraints=this.setSnapConstraints(e.snapSettings.snapConstraints))},t.prototype.setSnapConstraints=function(t){var e=it.None;return t&it.ShowHorizontalLines&&(e|=it.ShowHorizontalLines),t&it.ShowVerticalLines&&(e|=it.ShowVerticalLines),t&it.ShowLines&&(e|=it.ShowLines),t&it.SnapToHorizontalLines&&(e|=it.SnapToHorizontalLines),t&it.SnapToVerticalLines&&(e|=it.SnapToVerticalLines),t&it.SnapToLines&&(e|=it.SnapToLines),e},t.prototype.setGridLines=function(t){var e={};return e.lineColor=t.lineColor,e.lineDashArray=t.lineDashArray,e.lineIntervals=t.lineInterval,e.snapIntervals=t.snapInterval,e},t.prototype.setScrollSettings=function(t,e){t.scrollSettings={horizontalOffset:e.scrollSettings.horizontalOffset,verticalOffset:e.scrollSettings.verticalOffset,currentZoom:e.scrollSettings.currentZoom,viewPortWidth:e.scrollSettings.viewPortWidth,viewPortHeight:e.scrollSettings.viewPortHeight,minZoom:e.scrollSettings.minZoom,maxZoom:e.scrollSettings.maxZoom,scrollLimit:e.pageSettings.scrollLimit.charAt(0).toUpperCase()+e.pageSettings.scrollLimit.slice(1),scrollableArea:e.pageSettings.scrollableArea,canAutoScroll:e.enableAutoScroll,autoScrollBorder:e.pageSettings.autoScrollBorder}},t.prototype.setPageSettings=function(t,e){t.pageSettings={width:e.pageSettings.pageWidth,height:e.pageSettings.pageHeight,margin:{left:e.pageSettings.pageMargin,right:e.pageSettings.pageMargin,top:e.pageSettings.pageMargin,bottom:e.pageSettings.pageMargin},orientation:e.pageSettings.pageOrientation.charAt(0).toUpperCase()+e.pageSettings.pageOrientation.slice(1),boundaryConstraints:e.pageSettings.boundaryConstraints.charAt(0).toUpperCase()+e.pageSettings.boundaryConstraints.slice(1),background:{color:e.pageSettings.pageBackgroundColor,source:e.backgroundImage.source,scale:e.backgroundImage.scale,align:e.backgroundImage.align},multiplePage:e.pageSettings.multiplePage,showPageBreaks:e.pageSettings.showPageBreak}},t.prototype.setContextMenu=function(t,e){t.contextMenuSettings={},t.contextMenuSettings.show=e.enableContextMenu,void 0!==e.contextMenu&&(t.contextMenuSettings.showCustomMenuOnly=e.contextMenu.showCustomMenuItemsOnly,t.contextMenuSettings.items=this.getContextMenuItems(e.contextMenu.items))},t.prototype.getContextMenuItems=function(t){for(var e={},i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)];e.id=r.name,e.text=r.text,this.items.push(e),t.subItems&&t.subItems.length>0&&this.getContextMenuItems(t.subItems)}return this.items},t.prototype.setTooltip=function(t,e){t.tooltip={content:e.tooltip.templateId,relativeMode:e.tooltip.relativeMode}},t.prototype.setModelLayout=function(t,e){t.layout={fixedNode:e.layout.fixedNode,horizontalSpacing:e.layout.horizontalSpacing,verticalSpacing:e.layout.verticalSpacing,maxIteration:e.layout.maxIteration,springFactor:e.layout.springFactor,springLength:e.layout.springLength,margin:{left:e.layout.margin.left,right:e.layout.margin.right,top:e.layout.margin.top,bottom:e.layout.margin.bottom},horizontalAlignment:e.layout.horizontalAlignment.charAt(0).toUpperCase()+e.layout.horizontalAlignment.slice(1),verticalAlignment:e.layout.verticalAlignment.charAt(0).toUpperCase()+e.layout.verticalAlignment.slice(1),orientation:"toptobottom"===e.layout.orientation?"TopToBottom":"bottomtotop"===e.layout.orientation?"BottomToTop":"righttoleft"===e.layout.orientation?"RightToLeft":"LeftToRight",connectorSegments:e.layout.getConnectorSegments,type:e.layout.type.charAt(0).toUpperCase()+e.layout.type.slice(1),getLayoutInfo:e.layout.getLayoutInfo,bounds:e.layout.bounds,root:e.layout.root},t.layout&&"Hierarchicaltree"===t.layout.type?t.layout.type="HierarchicalTree":t.layout&&"Organizationalchart"===t.layout.type?t.layout.type="OrganizationalChart":t.layout&&"Radialtree"===t.layout.type&&(t.layout.type="RadialTree")},t.prototype.setSelectedItems=function(t,e){t.selectedItems={};t.selectedItems.nodes=[],t.selectedItems.connectors=[],t.selectedItems.offsetX=e.selectedItems.offsetX,t.selectedItems.offsetY=e.selectedItems.offsetY,t.selectedItems.width=e.selectedItems.width,t.selectedItems.height=e.selectedItems.height,t.selectedItems.rotateAngle=e.selectedItems.rotateAngle,t.selectedItems.constraints=this.setSelectorConstraints(e.selectedItems.constraints),t.selectedItems.userHandles=e.selectedItems.userHandles},t.prototype.setSelectorConstraints=function(t){var e=rt.None;return t&rt.ConnectorSourceThumb&&(e|=rt.Rotate),t&rt.ResizeAll&&(e|=rt.ResizeAll),t&rt.ResizeSouthEast&&(e|=rt.UserHandle),t&rt.ToolTip&&(e|=rt.ToolTip),t&rt.All&&(e|=rt.All),e},t.prototype.setDiagramConstraints=function(t){var e=ct.None;return t&ct.UserInteraction&&(e|=ct.UserInteraction),t&ct.ApiUpdate&&(e|=ct.ApiUpdate),t&ct.PageEditable&&(e|=ct.PageEditable),t&ct.LineRouting&&(e|=ct.Bridging),t&ct.Zoom&&(e|=ct.Zoom),t&ct.PanX&&(e|=ct.PanX),t&ct.PanY&&(e|=ct.PanY),t&ct.Pan&&(e|=ct.Pan),t&ct.UndoRedo&&(e|=ct.UndoRedo),t&ct.ZoomTextEdit&&(e|=ct.ZoomTextEdit),e},t.prototype.setDiagramTool=function(t){var e=pt.None;return t&pt.MultipleSelect&&(e|=pt.SingleSelect),t&pt.ZoomPan&&(e|=pt.MultipleSelect),t&pt.DrawOnce&&(e|=pt.ZoomPan),t&pt.ContinuousDraw&&(e|=pt.DrawOnce),t&pt.ContinuousDraw&&(e|=pt.ContinuousDraw),e},t.prototype.destroy=function(){},t.prototype.getModuleName=function(){return"Ej1Serialization"},t}(),rp=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),np=function(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},op=function(t){var e=t;return e.sourcePoint||e.targetPoint||e.sourceID||e.targetID||e.sourcePortID||e.targetPortID||e.sourceDecorator||e.targetDecorator?Co:(t.shape&&(t.shape instanceof gh||t.shape.type),Yh)},ap=function(t){function i(e,i,r,n){return t.call(this,e,i,r,n)||this}return rp(i,t),np([(0,e.Property)("")],i.prototype,"id",void 0),np([(0,e.Property)()],i.prototype,"height",void 0),np([(0,e.Property)(!0)],i.prototype,"expanded",void 0),np([(0,e.Property)("")],i.prototype,"iconCss",void 0),np([(0,e.Property)("")],i.prototype,"title",void 0),np([(0,e.CollectionFactory)(op)],i.prototype,"symbols",void 0),i}(e.ChildProperty),sp=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return rp(i,t),np([(0,e.Property)()],i.prototype,"width",void 0),np([(0,e.Property)()],i.prototype,"height",void 0),i}(e.ChildProperty),hp=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return rp(i,t),np([(0,e.Property)()],i.prototype,"width",void 0),np([(0,e.Property)()],i.prototype,"height",void 0),np([(0,e.Complex)({},o)],i.prototype,"offset",void 0),i}(e.ChildProperty),dp=function(t){function r(e,i){var r,n,o=t.call(this,e,i)||this;o.symbolTable={},o.childTable={},o.info="info",o.oldObject=null,o.laneTable={},o.isExpand=!1,o.isExpandMode=!1,o.isMethod=!1,o.paletteid=88123,o.checkOnRender=!1,o.symbolTooltipObject=null,o.helper=function(t){var e,i=o.selectedSymbol&&o.selectedSymbol.id||t.sender.target.id.split("_container")[0],r=o.symbolTable[""+i];return r&&o.selectedSymbol&&(o.selectedSymbols=o.selectedSymbol.id===r.id?r:o.selectedSymbol,(e=o.getSymbolPreview(o.selectedSymbols,t.sender,o.element)).setAttribute("paletteId",o.element.id)),e};for(var a=0;o&&o.palettes&&a<o.palettes.length;a++)for(var s=0;s<o.palettes[parseInt(a.toString(),10)].symbols.length;s++)r=o.palettes[parseInt(a.toString(),10)].symbols[parseInt(s.toString(),10)],n=e.palettes[parseInt(a.toString(),10)].symbols[parseInt(s.toString(),10)],r&&"UmlActivity"===r.shape.type&&na(n,r),(o.nodeDefaults||o.connectorDefaults)&&da(r,n,r instanceof Yh?o.nodeDefaults:o.connectorDefaults);return o}return rp(r,t),r.prototype.onPropertyChanged=function(t,i){for(var r=!1,n=0,o=Object.keys(t);n<o.length;n++){switch(o[n]){case"width":this.element.style.width=this.width.toString();break;case"height":this.element.style.height=this.height.toString();break;case"symbolPreview":break;case"symbolWidth":case"symbolHeight":case"getSymbolInfo":r=!this.isReact;break;case"enableSearch":if(t.enableSearch&&!(0,e.isBlazor)())this.createTextbox();else{var a=document.getElementById(this.element.id+"_search");a&&a.parentNode.removeChild(a)}break;case"palettes":for(var s=0,h=Object.keys(t.palettes);s<h.length;s++){var d=h[s],l=Number(d);if((0,e.isBlazor)()||this.accordionElement.items[parseInt(l.toString(),10)]||(this.accordionElement.items[parseInt(l.toString(),10)]={header:t.palettes[parseInt(l.toString(),10)].title||"",expanded:t.palettes[parseInt(l.toString(),10)].expanded,iconCss:t.palettes[parseInt(l.toString(),10)].iconCss||""}),t.palettes[parseInt(l.toString(),10)].height)document.getElementById(this.palettes[parseInt(l.toString(),10)].id+"_content").style.height=t.palettes[parseInt(l.toString(),10)].height+"px";void 0!==t.palettes[parseInt(l.toString(),10)].iconCss&&((0,e.isBlazor)()||(this.accordionElement.items[parseInt(l.toString(),10)].iconCss=t.palettes[parseInt(l.toString(),10)].iconCss||"",r=!0)),void 0===t.palettes[parseInt(l.toString(),10)].expanded||(0,e.isBlazor)()||(this.palettes[parseInt(l.toString(),10)].isInteraction?this.palettes[parseInt(l.toString(),10)].isInteraction=!1:(this.accordionElement.items[parseInt(l.toString(),10)].expanded=t.palettes[parseInt(l.toString(),10)].expanded,this.isExpand=!0),this.isExpandMode||this.isMethod||this.isExpand||(this.isExpand=!0))}break;case"enableAnimation":(0,e.isBlazor)()||(this.enableAnimation?this.accordionElement.animation={expand:{duration:400},collapse:{duration:400}}:this.accordionElement.animation={expand:{duration:0},collapse:{duration:0}});break;case"expandMode":(0,e.isBlazor)()||(this.accordionElement.expandMode=this.expandMode,r=!0,this.isExpandMode=!0);break;case"allowDrag":this.allowDrag=t.allowDrag,this.draggable&&(this.draggable.destroy(),this.draggable=null),this.allowDrag&&this.initDraggable()}}if(r&&this.refreshPalettes(),this.isExpand&&!r){this.isExpand=!1;for(var c=0;c<this.palettes.length;c++){var p=this.palettes[parseInt(c.toString(),10)].id;window[""+p]&&window[""+p].length>1&&(window[""+p][1].parentNode.removeChild(window[""+p][1]),window[""+p][1]=null)}}this.isMethod=!1},r.prototype.getPersistData=function(){return this.addOnPersist(["loaded"])},r.prototype.preRender=function(){var t=this;if(this.l10n=new e.L10n(this.getModuleName(),this.defaultLocale(),this.locale),""===this.element.id){var i=document.getElementsByClassName("e-symbolpalette").length;this.element.id="symbolpalette_"+this.paletteid+"_"+i}if(this.element.style.overflow="auto",this.element.style.height=this.height.toString(),this.element.style.width=this.width.toString(),this.enableSearch&&!(0,e.isBlazor)()&&this.createTextbox(),!(0,e.isBlazor)()){var r=ud("div",{id:this.element.id+"_container"});this.accordionElement=new cc.Accordion({expandMode:this.expandMode}),this.enableAnimation||(this.accordionElement.animation={expand:{duration:0},collapse:{duration:0}}),this.accordionElement.created=function(){t.checkOnRender=!0},this.accordionElement.expanded=function(e){var i=t.accordionElement.items.indexOf(e.item),r=t.allowServerDataBinding;t.allowServerDataBinding=!1,t.palettes[parseInt(i.toString(),10)].expanded=e.isExpanded,t.palettes[parseInt(i.toString(),10)].isInteraction=!0,t.allowServerDataBinding=r},this.accordionElement.expanding=function(e){if(t.checkOnRender){var i={element:e.element,content:e.content,index:e.index,cancel:!1,isExpanded:e.isExpanded,palette:t.palettes[e.index]};t.trigger("paletteExpanding",i),e.cancel=i.cancel}},this.element.appendChild(r)}var n="measureElement";window[""+n]&&(window[""+n]=null),Pd(),this.unWireEvents(),this.wireEvents()},r.prototype.defaultLocale=function(){return{SearchShapes:"Search Shapes",SearchResults:"Search Results",NoItemsToDisplay:"No Items To Display"}},r.prototype.render=function(){this.diagramRenderer=new Go(this.element.id,new Uo,!1),this.svgRenderer=new Go(this.element.id,new Uo,!0),this.updatePalettes(),(0,e.isBlazor)()||this.accordionElement.appendTo("#"+this.element.id+"_container"),this.renderComplete()},r.prototype.getModuleName=function(){return"SymbolPalette"},r.prototype.requiredModules=function(){var t=[];return t.push({member:"Bpmn",args:[]}),t},r.prototype.destroy=function(){if(this.allowDrag){this.draggable.destroy(),this.unWireEvents(),this.notify("destroy",{}),t.prototype.destroy.call(this);var e=document.getElementById(this.element.id+"_container");if(e){this.element.removeChild(e);var i="measureElement";if(window[""+i]){window[""+i].usageCount-=1;var r="measureElementCount";window[""+r]--,0===window[""+r]&&(window[""+i].parentNode.removeChild(window[""+i]),window[""+i]=null)}}(e=document.getElementById(this.element.id+"_search"))&&e.parentNode.removeChild(e)}},r.prototype.addPalettes=function(t){for(var i,r=0;r<t.length;r++){var n=this.allowServerDataBinding;this.isProtectedOnChange=!0,this.allowServerDataBinding=!1,i=new ap(this,"palettes",t[parseInt(r.toString(),10)],!0),this.palettes.push(i),this.initSymbols(i),this.allowServerDataBinding=n,this.isProtectedOnChange=!1,this.renderPalette(i)}this.bulkChanges={},(0,e.isBlazor)()||this.accordionElement.refresh()},r.prototype.removePalette=function(t){for(var i=0;i<this.palettes.length;i++)if(this.palettes[parseInt(i.toString(),10)].id===t){this.palettes.splice(i,1),(0,e.isBlazor)()||this.accordionElement.items.splice(i,1);break}},r.prototype.removePalettes=function(t){var i=this.allowServerDataBinding;this.allowServerDataBinding=!1;for(var r=0;r<t.length;r++)this.removePalette(t[parseInt(r.toString(),10)]);(0,e.isBlazor)()?this.updatePalettes():this.accordionElement.refresh(),this.allowServerDataBinding=i},r.prototype.initSymbols=function(t){for(var e=[],i=0,r=0,n=0,o=t.symbols;n<o.length;n++){if("SwimLane"===(L=o[n]).shape.type){var a=L,s=L.shape,h="Horizontal"===s.orientation;if(s.isLane){i=h?this.symbolHeight-this.symbolHeight/2:this.symbolHeight-this.symbolHeight/4,r=h?this.symbolWidth-this.symbolWidth/4:this.symbolWidth-this.symbolWidth/2,this.laneTable[L.id]={height:i,width:r};var d=s.lanes[0].header,l=s.lanes[0].style,c=d.style;(f={id:"header"+E(),shape:{type:"Basic",shape:"Rectangle"},width:h?d.width:a.width,height:h?a.height:d.height,style:c,annotations:[{content:d.annotation.content}]}).offsetX=f.width/2,f.offsetY=f.height/2,this.addPaletteItem(t.id,f);var p={id:"lane"+E(),shape:{type:"Basic",shape:"Rectangle"},width:h?a.width-d.width:a.width,height:h?a.height:a.height-d.height,style:l};p.offsetX=h?f.width+p.width/2:p.width/2,p.offsetY=h?p.height/2:f.height+p.height/2,this.addPaletteItem(t.id,p),a.children=[f.id,p.id]}else s.isPhase&&(i=a.height?a.height:this.symbolHeight,r=a.width?a.width:this.symbolWidth,L.shape.type="Path",L.shape.data=h?"M0,0 L"+r+",0":"M0,0 L0,"+r)}if("Container"===L.shape.type){var g=L,u=L.shape;if(u.hasHeader){d=u.header;var f,m=g.style;c=d.style;(f={id:"header"+E(),shape:{type:"Basic",shape:"Rectangle"},width:g.width,height:g.height/2,style:c,annotations:[{content:d.annotation.content}]}).offsetX=f.width/2,f.offsetY=f.height/2,this.addPaletteItem(t.id,f);var y={id:"container"+E(),shape:{type:"Basic",shape:"Rectangle"},width:g.width,height:g.height,style:m};y.offsetX=g.width/2,y.offsetY=g.height/2,this.addPaletteItem(t.id,y),g.children=[y.id,f.id]}}if("UmlClassifier"===L.shape.type&&!L.shape.relationship){var v=L,b=void 0,S=void 0;S="white"===L.style.fill?{fill:"#26A0DA"}:{fill:L.style.fill},"Class"===L.shape.classifier?(b={id:"node"+E(),shape:{type:"HTML",content:'<div id="parentDiv" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv" style="font-size:0.7vw;">class</div></div>'},width:v.width?v.width:100,height:v.height?v.height:100,style:S,offsetX:v.width?v.width/2:50,offsetY:v.height?v.height/2:50},this.addPaletteItem(t.id,b)):"Enumeration"===L.shape.classifier?(b={id:"node"+E(),shape:{type:"HTML",content:'<div id="parentDiv2" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv2" style="font-size:0.5vw;">Enumeration</div></div>'},width:v.width?v.width:100,height:v.height?v.height:100,style:S,offsetX:v.width?v.width/2:50,offsetY:v.height?v.height/2:50},this.addPaletteItem(t.id,b)):"Interface"===L.shape.classifier&&(b={id:"node"+E(),shape:{type:"HTML",content:'<div id="parentDiv3" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv3" style="font-size:0.7vw;">Interface</div></div>'},width:v.width?v.width:100,height:v.height?v.height:100,style:S,offsetX:v.width?v.width/2:50,offsetY:v.height?v.height/2:50},this.addPaletteItem(t.id,b));var w={id:"member"+E(),shape:{type:"HTML",content:'<div style="width:100%;height:100%;border:1px solid #000;background:white"></div>'},width:v.width?v.width:100,height:v.height?v.height:100,offsetX:v.width?v.width/2:50,offsetY:v.height?v.height/2+b.height/2:50+b.height/2};this.addPaletteItem(t.id,w),v.children=[b.id,w.id]}if("UmlClassifier"===L.shape.type&&L.shape.relationship&&("Inheritance"===L.shape.relationship&&(L.targetDecorator.style.fill="black"===L.targetDecorator.style.fill?"white":L.targetDecorator.style.fill),"Realization"===L.shape.relationship&&(L.style.strokeDashArray=L.style.strokeDashArray?L.style.strokeDashArray:"4 4",L.targetDecorator.style.fill="black"===L.targetDecorator.style.fill?"white":L.targetDecorator.style.fill),"Dependency"===L.shape.relationship&&(L.style.strokeDashArray=L.style.strokeDashArray?L.style.strokeDashArray:"4 4"),"Aggregation"===L.shape.relationship&&(L.sourceDecorator.style.fill="black"===L.sourceDecorator.style.fill?"white":L.sourceDecorator.style.fill)),L instanceof Yh){var x=J(this.getNodeDefaults);x&&x(L,this)}else if(L instanceof Co){var I=J(this.getConnectorDefaults);I&&I(L,this)}this.symbolTable[L.id]=L,L instanceof Yh&&L.children&&e.push(L)}for(var P=0;P<e.length;P++)for(var C=void 0,T=0;T<e[parseInt(P.toString(),10)].children.length;T++)(C=this.symbolTable[e[parseInt(P.toString(),10)].children[parseInt(T.toString(),10)]])&&(this.childTable[C.id]=C,C.parentId=e[parseInt(P.toString(),10)].id);for(var A=0,O=t.symbols;A<O.length;A++){(L=O[A])instanceof Yh&&L.children||this.prepareSymbol(L)}for(var D=0,M=e;D<M.length;D++){var L=M[D];this.prepareSymbol(L)}},r.prototype.renderPalette=function(t){var i="display:none;overflow:auto;";t.height&&(i+="height:"+t.height+"px");document.getElementById(t.id);var r=ud("div",{id:t.id,style:i,class:"e-remove-palette"});if(this.element.appendChild(r),!(0,e.isBlazor)()){var n={header:t.title,expanded:t.expanded,content:"#"+t.id,iconCss:t.iconCss};this.accordionElement.items.push(n)}this.renderSymbols(t,r)},r.prototype.addPaletteItem=function(t,e,i){e=N(e);for(var r=0;r<this.palettes.length;r++){var n=this.palettes[parseInt(r.toString(),10)];if(-1!==n.id.indexOf(t)){for(var o=[void 0,n,"symbols",{},!0],a=new(Function.prototype.bind.apply(op(e),o)),s=0;s<Object.keys(e).length;s++){var h=this.allowServerDataBinding;this.allowServerDataBinding=!1,a[Object.keys(e)[parseInt(s.toString(),10)]]=e[Object.keys(e)[parseInt(s.toString(),10)]],this.allowServerDataBinding=h}da(a,e,a instanceof Yh?this.nodeDefaults:this.connectorDefaults),n.symbols.push(a);var d=this.allowServerDataBinding;if(this.allowServerDataBinding=!1,this.prepareSymbol(a),this.allowServerDataBinding=d,this.symbolTable[a.id]=a,i)this.childTable[a.id]=a;else{var l=document.getElementById(n.id);l&&l.appendChild(this.getSymbolContainer(a,l))}break}}},r.prototype.removePaletteItem=function(t,e){for(var i,r=0;r<this.palettes.length;r++){var n=this.palettes[parseInt(r.toString(),10)];if(-1!==n.id.indexOf(t))for(var o=0,a=n.symbols;o<a.length;o++){var s=a[o];if(-1!==s.id.indexOf(e)){var h=n.symbols.indexOf(s);if(n.symbols.splice(h,1),s.children)for(var d=s.children,l=0;l<d.length;l++)delete this.symbolTable[d[parseInt(l.toString(),10)]];delete this.symbolTable[s.id];var c=document.getElementById(s.id+"_container");c.parentNode.removeChild(c),i=!0;break}}if(i)break}},r.prototype.prepareSymbol=function(t){var e,r,n,o,a,s=new Us,h=t,d=new te,l=t instanceof Yh?t.initContainer():null;l&&!l.children&&(l.children=[]);var c=J(this.getSymbolTemplate);if(c&&(a=c(t)),!a)if(h.children)a=this.getContainer(h,l);else{if(t instanceof Co&&"UmlClassifier"===t.shape.type&&t.shape.relationship)for(var p=(a=t.init(this)).children.length-1;p>=0;p--)a.children[parseInt(p.toString(),10)]instanceof Zt&&a.children.splice(p,1);else a=t.init(this);t instanceof Yh&&t.parentId&&(a.measure(new i),a.arrange(a.desiredSize),a.width=a.width||a.actualSize.width||this.symbolWidth||a.style.strokeWidth,a.height=a.height||a.actualSize.height||this.symbolHeight||a.style.strokeWidth,t.width=t.width||a.actualSize.width||this.symbolWidth||a.style.strokeWidth,t.height=t.height||a.actualSize.height||this.symbolHeight||a.style.strokeWidth,l.children.push(a))}if(!t.parentId){var g={width:this.symbolWidth,height:this.symbolHeight},u=J(this.getSymbolInfo);if(u&&(g=u(t)),h.showDefaultTooltipForPalette=g&&!1!==g.showTooltip,g=g||this.symbolInfo||{},t.shape&&t.shape.isPhase&&(g.width=g.width||this.symbolWidth,g.height=g.height||this.symbolHeight),a.relativeMode="Object",a.horizontalAlignment=a.verticalAlignment="Center",d.style.strokeColor=d.style.fill="none",d.children=[a],a.measure(new i),a.arrange(a.desiredSize),e=g.width=g.width||(void 0!==h.width?a.actualSize.width:void 0)||this.symbolWidth,n=g.height=g.height||(void 0!==h.height?a.actualSize.height:void 0)||this.symbolHeight,void 0!==e&&void 0!==n){var f=e,m=n,y=!!t.shape.isPhase;void 0!==this.symbolWidth?f=this.symbolWidth-this.symbolMargin.left-this.symbolMargin.right:e+=h.style.strokeWidth,void 0!==this.symbolHeight?m=this.symbolHeight-this.symbolMargin.top-this.symbolMargin.bottom:n+=h.style.strokeWidth,t.shape&&"Bpmn"!==t.shape.type&&g.description&&""!==g.description.text&&(m-=20),r=f/(!y&&a.width||e),o=m/(!y&&a.height||n),g.fit&&(r=f/g.width,o=m/g.height),e=f,n=m,r=o=Math.min(r,o),d.width=e,d.height=n,a.width=g.width,a.height=g.height,this.scaleSymbol(t,d,r,o,e,n)}else{var v=void 0;t instanceof Co&&(v=Ci(t)),a.width=t.width||v?v.width:a.actualSize.width,a.height=t.height||v?v.height:a.actualSize.height}t.wrapper=s,s.children=[d],a.pivot=s.pivot={x:0,y:0},s.id=a.id+"_symbol",s.style.fill=s.style.strokeColor="transparent",t instanceof Yh?(s.offsetX=t.style.strokeWidth/2,s.offsetY=t.style.strokeWidth/2):(s.offsetX=.5,s.offsetY=.5),this.getSymbolDescription(g,e,s,t),s.padding={left:1,right:1,bottom:1,top:1},s.measure(new i),s.arrange(s.desiredSize),g.width=g.width||a.actualSize.width,g.height=g.height||a.actualSize.height,t[this.info]=g}t.parentId&&(l.measure(new i(h.width,h.height)),l.arrange(l.desiredSize))},r.prototype.getContainer=function(t,e){var r;e.measureChildren=!1;var n=t.children;e.children=[];for(var o=0;o<n.length;o++)this.symbolTable[n[parseInt(o.toString(),10)]]&&e.children.push(this.symbolTable[n[parseInt(o.toString(),10)]].wrapper);return e.measure(new i(t.width,t.height)),e.arrange(e.desiredSize),0===e.bounds.x&&0===e.bounds.y||(ds(t,(r=e.bounds).x,r.y,this.symbolTable,!1,this),e=this.getContainer(t,e)),e},r.prototype.getSymbolDescription=function(t,e,i,r){if(t&&t.description&&t.description.text){var n=new Zt;t.description.overflow=t.description.overflow||"Ellipsis",t.description.wrap=t.description.wrap||"WrapWithOverflow",n.id=i.id+"_text",n.content=t.description.text,n.width=e,n.height=20,n.style.strokeColor="transparent",n.style.color=t.description.color||"black",n.style.fill=t.description.fill||"transparent",n.style.fontFamily=t.description.fontFamily||"Arial",n.style.fontSize=t.description.fontSize||12,n.style.bold=t.description.bold||!1,n.style.italic=t.description.italic||!1,n.style.textDecoration=t.description.textDecoration||"None",n.style.strokeWidth=0,n.style.textWrapping=t.description.wrap,n.style.textOverflow=t.description.overflow,r.shape&&"Bpmn"===r.shape.type?n.margin={left:0,right:0,top:t.description.margin?t.description.margin.top:0,bottom:t.description.margin?t.description.margin.bottom:this.symbolMargin.bottom}:n.margin={left:0,right:0,top:t.description.margin?t.description.margin.top:0,bottom:t.description.margin?t.description.margin.bottom:5},i.children.push(n)}},r.prototype.renderSymbols=function(t,e){for(var i=0,r=t.symbols;i<r.length;i++){var n=r[i];n.parentId||this.getSymbolContainer(n,e)}},r.prototype.getSymbolPreview=function(t,e,i){var r,n,o;this.allowServerDataBinding=!1;var a=t.wrapper.children[0].desiredSize.width+t.style.strokeWidth,s=t.wrapper.children[0].desiredSize.height+t.style.strokeWidth,h=t.wrapper.children[0].children[0],d=t.previewSize;if(t&&(d.width||d.height)||void 0!==this.symbolPreview.width||void 0!==this.symbolPreview.height){a=(d.width||this.symbolPreview.width||a)-t.style.strokeWidth,s=(d.height||this.symbolPreview.height||s)-t.style.strokeWidth,t instanceof Co&&(h.actualSize.width<=t.style.strokeWidth&&(h.actualSize.width=this.symbolWidth),h.actualSize.height<=t.style.strokeWidth&&(h.actualSize.height=this.symbolHeight)),n=a/h.actualSize.width,o=s/h.actualSize.height,n=o=Math.min(n,o);var l=h.actualSize.width*n,c=h.actualSize.height*o;t.wrapper.children[0].width=a,t.wrapper.children[0].height=s,this.measureAndArrangeSymbol(h,t instanceof Yh),this.scaleSymbol(t,t.wrapper.children[0],n,o,l,c,!0),a=l,s=c}var p={x:h.offsetX,y:h.offsetY};h.offsetX=h.offsetY=t.style.strokeWidth/2,h.pivot={x:0,y:0},this.measureAndArrangeSymbol(h,t instanceof Yh);var g,u=ud("div",{draggable:"true",class:"e-dragclone",style:"pointer-events:none"});document.body.appendChild(u);var f="margin:5px;";if("Native"===t.shape.type){r=fd("svg",{id:t.id+"_preview",width:Math.ceil(a)+1,height:Math.ceil(s)+1});var m=fd("g",{id:t.id+"_g"});r.appendChild(m),u.appendChild(r),this.svgRenderer.renderElement(h,m,void 0,void 0,r),this.prepareSymbol(t)}else if("HTML"===t.shape.type)g=this.getHtmlSymbol(t,r,u,s,a,!0),this.prepareSymbol(t);else if("UmlClassifier"!==t.shape.type||t.shape.relationship)if(t.children&&t.children.length>0&&ha(t,"HTML",this.childTable))g=this.getGroupParent(t,r,u,t.wrapper.actualSize.height,t.wrapper.actualSize.width,!0),this.prepareSymbol(t);else{r=Md.createCanvas(t.id+"_preview",2*(Math.ceil(a)+t.style.strokeWidth+1),2*(Math.ceil(s)+t.style.strokeWidth+1)),u.appendChild(r),"Basic"===t.shape.type||"Flow"===t.shape.type?f+="transform: scale(0.5) translate(-"+r.width/2+"px, -"+r.height/2+"px);":f+="transform:scale(0.5);",r.setAttribute("transform-origin","0 0");var y=2;t instanceof Co&&(y=1.9),r.getContext("2d").setTransform(y,0,0,y,0,0),this.diagramRenderer.renderElement(h,r,void 0),this.prepareSymbol(t)}else t.children&&t.children.length>0&&ha(t,"HTML",this.childTable)&&(g=this.getHtmlSymbol(t,r,u,t.wrapper.actualSize.height,t.wrapper.actualSize.width,!0),this.prepareSymbol(t));return xd(g&&("HTML"===t.shape.type||t.children&&t.children.length>0)?g:r,f),h.offsetX=p.x,h.offsetY=p.y,this.allowServerDataBinding=!0,u},r.prototype.measureAndArrangeSymbol=function(t,e){t.children&&!e&&(t.children[0].transform=gt.Self),t.measure(new i),t.arrange(t.desiredSize),t.children&&t.children.length>0&&(t.children[0].transform=gt.Parent)},r.prototype.updateSymbolSize=function(t,e,r){var n=t.wrapper.children[0].children[0],o=t.style.strokeWidth;n.width=(e||n.width)-(o+1),n.height=(r||n.height)-(o+1),t.wrapper.measure(new i),t.wrapper.arrange(t.wrapper.desiredSize)},r.prototype.getSymbolContainer=function(t,e,i){var r,n,o,a=this.symbolTable[t.id][this.info],s=this.getSymbolSize(t,a),h=s.width+1,d=s.height+1,l="SearchPalette"===e.id?t.id+"SearchSymbol":t.id,c=ud("div",{id:l+"_container",style:"width:"+h+"px;height:"+d+"px;float:left;overflow:hidden"});if(e.appendChild(c),"Native"===t.shape.type)r=fd("svg",{id:l,width:Math.ceil(t.wrapper.actualSize.width)+1,height:Math.ceil(t.wrapper.actualSize.height)+1}),n=fd("g",{id:l+"_g"}),r.appendChild(n),c.appendChild(r),this.updateSymbolSize(t),this.svgRenderer.renderElement(t.wrapper,n,void 0,void 0,r);else if("HTML"===t.shape.type)o=this.getHtmlSymbol(t,r,c,t.wrapper.actualSize.height,t.wrapper.actualSize.width,!1,"SearchPalette"===e.id);else if("UmlClassifier"!==t.shape.type||t.shape.relationship)if(t.children&&t.children.length>0&&ha(t,"HTML",this.childTable))o=this.getGroupParent(t,r,c,t.wrapper.actualSize.height,t.wrapper.actualSize.width,!1);else{r=Md.createCanvas(l,Math.ceil(2*(t.wrapper.actualSize.width+t.style.strokeWidth))+1,Math.ceil(2*(t.wrapper.actualSize.height+t.style.strokeWidth))+1),c.appendChild(r);var p=2;t instanceof Co&&(p=1.9),r.getContext("2d").setTransform(p,0,0,p,0,0),this.diagramRenderer.renderElement(t.wrapper,n||r,void 0,void 0,void 0,void 0,!0,void 0,!0)}else t.children&&t.children.length>0&&ha(t,"HTML",this.childTable)&&(o=this.getHtmlSymbol(t,r,c,t.wrapper.actualSize.height,t.wrapper.actualSize.width,!1));if(!i){var g=t.wrapper.actualSize.width+t.style.strokeWidth,u=t.wrapper.actualSize.height+t.style.strokeWidth,f="pointer-events:none;transform-origin:0 0;overflow:hidden;";return t.shape.isPhase?"Horizontal"===t.shape.orientation?f+="margin-left:"+Math.max(this.symbolMargin.left,(h-g)/2)+"px;margin-top:"+s.height/2+"px;":f+="margin-left:"+s.width/2+"px;margin-top:"+Math.max(this.symbolMargin.top,(d-u)/2)+"px;":f+="margin-left:"+Math.max(this.symbolMargin.left,(h-g)/2)+"px;margin-top:"+Math.max(this.symbolMargin.top,(d-u)/2)+"px;",r instanceof HTMLCanvasElement&&(f+="transform:scale(.5,.5);"),xd(o&&("HTML"===t.shape.type||t.children&&t.children.length>0)?o:r,f),c.classList.add("e-symbol-draggable"),c}return r},r.prototype.getGroupParent=function(t,e,i,r,n,o){var a=ud("div",{id:t.id+(o?"_html_div_preview":"_html_div")}),s=ud("div",{id:t.id+(o?"_htmlLayer_preview":"_htmlLayer"),style:"width:"+Math.ceil(n+1)+"px;height:"+Math.ceil(r+1)+"px;position:absolute",class:"e-html-layer"}),h=ud("div",{id:t.id+(o?"_htmlLayer_div_preview":"_htmlLayer_div"),style:"width:"+Math.ceil(n+1)+"px;height:"+Math.ceil(r+1)+"px;position:absolute"});return s.appendChild(h),a.appendChild(s),e=Md.createCanvas(o?t.id+"_preview":t.id,Math.ceil(n)+1,Math.ceil(r)+1),a.appendChild(e),i.appendChild(a),this.diagramRenderer.renderElement(t.wrapper.children[0].children[0],e,s),a},r.prototype.getHtmlSymbol=function(t,e,i,r,n,o,a){var s=a?t.id+"SearchSymbol":t.id,h=ud("div",{id:s+(o?"_html_div_preview":"_html_div")}),d=ud("div",{id:s+(o?"_htmlLayer_preview":"_htmlLayer"),style:"width:"+Math.ceil(n+1)+"px;height:"+Math.ceil(r+1)+"px;position:absolute",class:"e-html-layer"}),l=ud("div",{id:s+(o?"_htmlLayer_div_preview":"_htmlLayer_div"),style:"width:"+Math.ceil(n+1)+"px;height:"+Math.ceil(r+1)+"px;position:absolute"});d.appendChild(l),h.appendChild(d);var c=t.wrapper.actualSize.width+t.style.strokeWidth,p=t.wrapper.actualSize.height+t.style.strokeWidth,g="pointer-events:none;transform-origin:0 0;overflow:hidden;";return g+="margin-left:"+Math.max(this.symbolMargin.left,(n-c)/2)+"px;margin-top:"+Math.max(this.symbolMargin.top,(r-p)/2)+"px;",g+="transform:scale(.5,.5);position:absolute",e=Md.createCanvas(s,Math.ceil(2*(t.wrapper.actualSize.width+t.style.strokeWidth))+1,Math.ceil(2*(t.wrapper.actualSize.height+t.style.strokeWidth))+1),i.appendChild(e),e.getContext("2d").setTransform(2,0,0,2,0,0),xd(e,g),i.appendChild(h),o?("UmlClassifier"===t.shape.type&&("Class"===t.shape.classifier?t.wrapper.children[0].children[0].children[0].content='<div id="parentDiv" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv" style="font-size:1vw;">class</div></div>':"Enumeration"===t.shape.classifier?t.wrapper.children[0].children[0].children[0].content='<div id="parentDiv2" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv2" style="font-size:0.8vw;">Enumeration</div></div>':"Interface"===t.shape.classifier&&(t.wrapper.children[0].children[0].children[0].content='<div id="parentDiv3" style="width:100%; height:50%; border:1px solid #000; background:#6BA5D7; display: flex; align-items: center; justify-content: center;"><div id="textDiv3" style="font-size:0.9vw;">Interface</div></div>')),this.diagramRenderer.renderElement(t.wrapper.children[0].children[0],e,d)):this.diagramRenderer.renderElement(t.wrapper,e,d),h},r.prototype.getSymbolSize=function(t,e){var r=t.wrapper.actualSize.width,n=t.wrapper.actualSize.height;return this.symbolWidth||this.symbolHeight?(r=this.symbolWidth,n=Math.max(this.symbolHeight,n)):(r+=this.symbolMargin.left+this.symbolMargin.right+t.style.strokeWidth,n+=this.symbolMargin.top+this.symbolMargin.bottom+t.style.strokeWidth),new i(r,n)},r.prototype.getMousePosition=function(t){var e,i,r;if(-1!==t.type.indexOf("touch")){var n=(r=t).changedTouches[0].clientY,o=r.changedTouches[0].clientX;e=n-this.element.offsetTop,i=o-this.element.offsetLeft}else e=t.clientY-this.element.offsetTop,i=t.clientX-this.element.offsetLeft;return{x:i,y:e}},r.prototype.getContent=function(t){return this.hoverElement instanceof Yh&&this.hoverElement.constraints&ht.Tooltip||this.hoverElement instanceof Co&&this.hoverElement.constraints&at.Tooltip?this.hoverElement.tooltip.content:t.id},r.prototype.initTooltip=function(t){var i;if(!(0,e.isBlazor)()){var r=new oe.Tooltip;r=this.updateTooltipContent(this.hoverElement.tooltip,r),(i=new oe.Tooltip(r)).cssClass="e-symbolPalette-tooltip",i.opensOn="custom",i.appendTo("#"+t.id),i.close()}return i},r.prototype.updateTooltipContent=function(t,e){return e.content=t.content,e.position="BottomRight",e.showTipPointer=t.showTipPointer,e.width=t.width,e.height=t.height,t.animation?e.animation=t.animation:e.animation={close:{effect:"None"}},e},r.prototype.elementEnter=function(t,i,r){if(!i){this.symbolTooltipObject.windowCollision=!0;var n=this.hoverElement.showDefaultTooltipForPalette;this.hoverElement.tooltip.isSticky&&(this.symbolTooltipObject.isSticky=!0),this.hoverElement instanceof Yh?!n||this.hoverElement.constraints&(ht.Default&&ht.Tooltip)||(this.symbolTooltipObject.content=(0,e.initializeCSPTemplate)(function(){return this.hoverElement.id},this)):this.hoverElement instanceof Co&&(!n||this.hoverElement.constraints&(at.Default&&at.Tooltip)||(this.symbolTooltipObject.content=(0,e.initializeCSPTemplate)(function(){return this.hoverElement.id},this))),this.symbolTooltipObject.content&&("Mouse"===this.hoverElement.tooltip.relativeMode?(this.hoverElement.tooltip.relativeMode="Object",this.symbolTooltipObject.offsetX=0,this.symbolTooltipObject.offsetY=0):(this.symbolTooltipObject.offsetX=0,this.symbolTooltipObject.offsetY=0));var o=r?this.hoverElement.id+"SearchSymbol":this.hoverElement.id,a=document.getElementById(o);"Auto"===this.hoverElement.tooltip.openOn&&""!==this.symbolTooltipObject.content&&(this.symbolTooltipObject.close(),this.symbolTooltipObject.opensOn=this.hoverElement.tooltip.openOn,this.symbolTooltipObject.dataBind()),"Auto"===this.hoverElement.tooltip.openOn&&""!==this.symbolTooltipObject.content&&(this.symbolTooltipObject.target=this.hoverElement.id,this.symbolTooltipObject.open(a))}},r.prototype.mouseMove=function(t,e){!this.highlightedSymbol||this.selectedSymbol&&this.selectedSymbol.id+"_container"===this.highlightedSymbol.id||(this.highlightedSymbol.classList.remove("e-symbol-hover"),this.highlightedSymbol.style.backgroundColor="",this.highlightedSymbol=null);var i=t.target.id.split("_container")[0];if(this.symbolTable[""+i]||"SearchPalette"!==i&&t.target&&t.target.id.includes("SearchSymbol")){var r=document.getElementById(i+"_container");r.classList.add("e-symbol-hover"),this.highlightedSymbol=r}t.preventDefault();var n=!1;t.target&&t.target.id.includes("SearchSymbol")&&(n=!0,i=i.split("SearchSymbol")[0]);var o=this.symbolTable[""+i];if(this.symbolTable[""+i]&&o!==this.hoverElement){this.currentPosition=this.getMousePosition(t);var a=this.getContent(o);this.hoverElement&&"Auto"===this.hoverElement.tooltip.openOn&&""!==a&&this.elementLeave(),this.hoverElement=o,this.symbolTooltipObject=this.initTooltip(this.hoverElement),""===a&&(a=this.hoverElement.id),this.hoverElement.tooltip&&""!==a&&this.elementEnter(this.currentPosition,!1,n)}void 0===o&&this.hoverElement&&!this.hoverElement.tooltip.isSticky&&"Auto"===this.hoverElement.tooltip.openOn&&(this.hoverElement=null,this.elementLeave())},r.prototype.elementLeave=function(){this.symbolTooltipObject&&"Custom"!==this.symbolTooltipObject.opensOn&&this.symbolTooltipObject.close()},r.prototype.mouseLeave=function(t){this.elementLeave(),t.preventDefault()},r.prototype.mouseUp=function(t){if(this.isMethod=!0,t&&t.target)if("iconSearch"===t.srcElement.id){var e=document.getElementById("iconSearch");e.classList.contains("e-clear-searchtext")&&(e.className="e-input-group-icon e-search e-icons",document.getElementById("textEnter").value="",this.searchPalette(""))}else{var i=t.target.id.split("_container")[0];if(i&&this.selectedSymbol){var r={oldValue:this.oldObject,newValue:i};this.trigger("paletteSelectionChange",r),this.oldObject=i,t.preventDefault()}else""!==this.oldObject&&(this.oldObject="")}},r.prototype.keyUp=function(t){var e=this;if(this.enableSearch){var i=this;document.getElementById("iconSearch").className="e-input-group-icon e-clear-searchtext e-icons",!t||"Enter"!==t.key&&13!==t.keyCode?(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){t.target instanceof HTMLInputElement&&(i.searchPalette(t.target.value),e.timer=null)},500)):t.target instanceof HTMLInputElement&&this.searchPalette(t.target.value)}},r.prototype.mouseDown=function(t){var e=t.target.id.split("_container")[0],i=!1;if(e.includes("SearchSymbol")&&(e=e.split("SearchSymbol")[0],i=!0),this.selectedSymbol){var r=document.getElementById(this.selectedSymbol.id+"_container"),n=document.getElementById(this.selectedSymbol.id+"SearchSymbol_container");(r||n)&&(r.classList.remove("e-symbol-selected"),n&&n.classList.remove("e-symbol-selected")),(o=document.getElementById(this.selectedSymbol.id+"_container"))&&(o.style.backgroundColor=""),this.selectedSymbol=null}if(this.symbolTable[""+e]){var o,a=e;i&&(a=e+"SearchSymbol"),(o=document.getElementById(a+"_container")).classList.add("e-symbol-selected"),this.selectedSymbol=this.symbolTable[""+e],t.preventDefault()}},r.prototype.keyDown=function(t){if(t&&"Escape"===t.key){var e=this.draggable.helperElement;e&&e.parentNode&&(e.parentNode.removeChild(e),this.draggable.intDestroy())}},r.prototype.initDraggable=function(){this.allowDrag&&(this.draggable=new e.Draggable(this.element,{dragTarget:".e-symbol-draggable",helper:this.helper,dragStart:this.dragStart,preventDefault:!1,dragStop:this.dragStop,drag:function(t){var e=md(t.target,"e-droppable");if(e&&e.classList.contains("e-diagram")){e.ej2_instances[0].droppable.over(t)}},cursorAt:{left:this.symbolPreview.offset.x,top:this.symbolPreview.offset.y}}))},r.prototype.dragStart=function(t){var e=this.helper[0];e&&e.setAttribute("paletteId",this.element.id)},r.prototype.dragStop=function(t){md(t.target,"e-diagram")||(0,e.remove)(t.helper)},r.prototype.scaleSymbol=function(t,e,r,n,o,a,s){if(t instanceof Co){var h=t.wrapper;t.wrapper=e.children[0];for(var d=t.scale(r,n,o,a,e.children[0]),l=o/2-e.children[0].children[0].offsetX+d.x/2,c=a/2-e.children[0].children[0].offsetY+d.y/2,p=0,g=e.children[0].children;p<g.length;p++){var u=g[p];u.offsetX+=l,u.offsetY+=c,u.staticSize=!1}t.wrapper=h}else if("Bpmn"===t.shape.type&&this.bpmnModule){h=t.wrapper;t.wrapper=e,e.children[0].width=o,e.children[0].height=a,this.bpmnModule.updateBPMN({width:o,height:a},t,t,null),t.wrapper=h}else if(t.children){var f,m,y=t.children;if(!s)for(var v=void 0,b=void 0,S=0;S<y.length;S++)(b=e.children[0].children[parseInt(S.toString(),10)])&&(b.children[0].children&&this.measureChild(b),v=this.symbolTable[b.id],b.width=v.width,b.height=v.height,b.measure(new i),b.arrange(b.children[0].desiredSize));if(f=o/e.children[0].desiredSize.width,m=a/e.children[0].desiredSize.height,e.children[0].measure(new i),e.children[0].arrange(e.children[0].desiredSize),!s){var w=void 0;for(S=0;S<y.length;S++)(w=e.children[0].children[parseInt(S.toString(),10)])&&(w.children[0].children&&this.scaleChildren(w,f,m,t),this.scaleGroup(w,f,m,t))}if(s){var x=void 0,I=void 0;for(w=void 0,S=0;S<y.length;S++)x=o/t.wrapper.children[0].desiredSize.width,I=a/t.wrapper.children[0].desiredSize.height,(w=e.children[0].children[parseInt(S.toString(),10)])&&(w.children[0].children&&this.scaleChildren(w,x,I,t,!0),this.scaleGroup(w,x,I,t,!0));t.wrapper.children[0].measure(new i),t.wrapper.children[0].arrange(t.wrapper.children[0].desiredSize)}}else hs(e.children[0],r,n,e)},r.prototype.scaleChildren=function(t,e,i,r,n){for(var o,a=0;a<t.children.length;a++)(o=t.children[parseInt(a.toString(),10)]).children[0].children?this.scaleChildren(o,e,i,r,n):this.scaleGroup(o,e,i,r,n)},r.prototype.measureChild=function(t){for(var e,r,n=0;n<t.children.length;n++)(e=t.children[parseInt(n.toString(),10)]).children[0].children?this.measureChild(e):(r=this.symbolTable[e.id],e.width=r.width,e.height=r.height,e.measure(new i),e.arrange(e.children[0].desiredSize))},r.prototype.scaleGroup=function(t,e,r,n,o){t.width=(t.width||t.children[0].width)*e,t.height=(t.height||t.children[0].height)*r,t.offsetX=o?t.offsetX*e-n.style.strokeWidth:t.offsetX*e+n.style.strokeWidth/2,t.offsetY=o?t.offsetY*r-n.style.strokeWidth:t.offsetY*r+n.style.strokeWidth/2,t.measure(new i),t.arrange(t.children[0].desiredSize)},r.prototype.refreshPalettes=function(){(0,e.isBlazor)()||(this.accordionElement.items=[]),function(t,e){var i;for(i=e&&document.getElementById(e).classList.contains(t)?document.getElementById(e).getElementsByClassName(t):document.getElementsByClassName(t);i.length>0;)i[0].parentNode.removeChild(i[0])}("e-remove-palette",this.element.id),this.updatePalettes(),(0,e.isBlazor)()||this.accordionElement.dataBind()},r.prototype.updatePalettes=function(){for(var t=0;t<this.palettes.length;t++){var e=this.palettes[parseInt(t.toString(),10)];"search_palette"===e.id?(this.palettes.splice(t,1),t--):(this.initSymbols(e),this.renderPalette(e))}},r.prototype.createTextbox=function(){var t=ud("div",{id:this.element.id+"_search"});xd(t,"height:30px"),t.className="e-input-group",this.element.insertBefore(t,this.element.firstChild);var e=ud("input",{});e.placeholder=this.l10n.getConstant("SearchShapes"),e.id="textEnter",xd(e,"width:100%;height:auto"),e.className="e-input",t.appendChild(e);var i=ud("span",{id:"iconSearch",className:"e-input-group-icon e-search e-icons"});t.appendChild(i)},r.prototype.getFilterSymbol=function(t){var e=this;return t.filter(function(t){return!e.ignoreSymbolsOnSearch.includes(t.id)})},r.prototype.searchPalette=function(t){var i,r=[],n=document.getElementById("SearchPalette");if(n){for(var o=n.children.length-1;o>=0;o--)n.removeChild(n.children[parseInt(o.toString(),10)]);this.palettes.splice(0,1)}for(o=0;o<this.palettes.length;o++)for(var a=this.palettes[parseInt(o.toString(),10)],s=0;s<a.symbols.length;s++){var h=a.symbols[parseInt(s.toString(),10)];""!==t&&(-1!==h.id.toLowerCase().indexOf(t.toLowerCase())||h.info&&h.info.description&&h.info.description.text&&h.info.description.text.toLowerCase().startsWith(t.toLowerCase()))&&r.push(h)}var d=J(this.filterSymbols);if(d&&(r=d(r)||[]),this.ignoreSymbolsOnSearch&&this.ignoreSymbolsOnSearch.length>0&&(r=this.getFilterSymbol(r)),""!==t){var l=new ap(this,"palettes",f={id:"search_palette",expanded:!0,symbols:r,title:"Search Shapes"},!0);this.palettes.splice(0,0,l)}if(n||(0,e.isBlazor)()||(n=i=this.createSearchPalette(i)),r.length>0)for(var c=0,p=r;c<p.length;c++){var g=p[c];""===g.parentId&&this.getSymbolContainer(g,n)}else if(""!==t){var u=ud("div",{id:"EmptyDiv",style:"text-align:center;font-style:italic"});u.innerHTML=this.l10n.getConstant("NoItemsToDisplay"),n.appendChild(u)}else{var f;if(document.getElementById("iconSearch").className="e-input-group-icon e-search e-icons",!(0,e.isBlazor)())this.accordionElement.removeItem(0),(f=document.getElementById("SearchPalette"))&&f.remove()}},r.prototype.createSearchPalette=function(t){t=ud("div",{id:"SearchPalette",style:"display:none;overflow:auto;"}),this.element.appendChild(t);var e={header:this.l10n.getConstant("SearchResults"),expanded:!0,content:"#SearchPalette"};return this.accordionElement.addItem(e,0),t},r.prototype.wireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchEndEvent,r=e.Browser.touchMoveEvent;e.EventHandler.add(this.element,t,this.mouseDown,this),e.EventHandler.add(this.element,r,this.mouseMove,this),e.EventHandler.add(this.element,i,this.mouseUp,this),e.EventHandler.add(this.element,"mouseleave",this.mouseLeave,this),e.EventHandler.add(this.element,"keyup",this.keyUp,this),e.EventHandler.add(document,"keydown",this.keyDown,this),this.initDraggable()},r.prototype.unWireEvents=function(){var t=e.Browser.touchStartEvent,i=e.Browser.touchEndEvent,r=e.Browser.touchMoveEvent,n=e.Browser.isPointer?"pointerleave":"mouseleave";e.EventHandler.remove(this.element,t,this.mouseDown),e.EventHandler.remove(this.element,r,this.mouseMove),e.EventHandler.remove(this.element,i,this.mouseUp),e.EventHandler.remove(this.element,n,this.mouseLeave),e.EventHandler.remove(this.element,"keyup",this.keyUp),e.EventHandler.remove(document,"keydown",this.keyDown)},np([(0,e.Property)("S")],r.prototype,"accessKey",void 0),np([(0,e.Property)("100%")],r.prototype,"width",void 0),np([(0,e.Property)("100%")],r.prototype,"height",void 0),np([(0,e.Collection)([],ap)],r.prototype,"palettes",void 0),np([(0,e.Property)()],r.prototype,"getSymbolInfo",void 0),np([(0,e.Property)({fit:!0})],r.prototype,"symbolInfo",void 0),np([(0,e.Property)()],r.prototype,"filterSymbols",void 0),np([(0,e.Property)()],r.prototype,"ignoreSymbolsOnSearch",void 0),np([(0,e.Property)()],r.prototype,"getSymbolTemplate",void 0),np([(0,e.Property)()],r.prototype,"symbolWidth",void 0),np([(0,e.Property)()],r.prototype,"symbolHeight",void 0),np([(0,e.Complex)({left:10,right:10,top:10,bottom:10},Ot)],r.prototype,"symbolMargin",void 0),np([(0,e.Property)(!0)],r.prototype,"allowDrag",void 0),np([(0,e.Complex)({},hp)],r.prototype,"symbolPreview",void 0),np([(0,e.Complex)({},sp)],r.prototype,"symbolDragSize",void 0),np([(0,e.Property)(!1)],r.prototype,"enableSearch",void 0),np([(0,e.Property)(!0)],r.prototype,"enableAnimation",void 0),np([(0,e.Property)("Multiple")],r.prototype,"expandMode",void 0),np([(0,e.Event)()],r.prototype,"paletteSelectionChange",void 0),np([(0,e.Event)()],r.prototype,"paletteExpanding",void 0),np([(0,e.Property)()],r.prototype,"getNodeDefaults",void 0),np([(0,e.Property)()],r.prototype,"nodeDefaults",void 0),np([(0,e.Property)()],r.prototype,"getConnectorDefaults",void 0),np([(0,e.Property)()],r.prototype,"connectorDefaults",void 0),np([(0,e.Property)()],r.prototype,"nodeTemplate",void 0),r}(e.Component)})(),s})());