{"version":3,"sources":["kendo.dataviz.diagram.js"],"names":["f","define","defined","value","UNDEFINED","round","precision","power","pow","math","p","limitValue","min","max","rad","degrees","DEG_TO_RAD","deg","radians","isNumber","val","isNaN","valueOrDefault","defaultValue","sqr","objectKey","object","key","parts","push","sort","join","hashKey","str","i","hash","length","charCodeAt","hashObject","arrayLimits","arr","MAX_NUM","MIN_NUM","arrayMin","arrayMax","sparseArrayMin","sparseArrayLimits","sparseArrayMax","n","isFinite","undefined","last","array","append","first","second","apply","renderTemplate","text","kendo","template","useWithBlock","paramName","renderAttr","name","renderAllAttr","attrs","output","renderStyle","renderSize","size","renderPos","pos","result","toHyphens","split","isTransparent","color","arabicToRoman","literals","1","10","100","2","20","200","3","30","300","4","40","400","5","50","500","6","60","600","7","70","700","8","80","800","9","90","900","1000","values","roman","shift","romanToArabic","r","digits","prev","v","toLowerCase","x","l","c","d","m","charAt","memoize","cache","Object","create","id","arguments","this","ucs2decode","string","extra","counter","ucs2encode","map","String","fromCharCode","mergeSort","a","cmp","merge","b","ai","bi","slice","left","right","Math","floor","window","deepExtend","PI","Number","MAX_VALUE","now","Date","getTime","util","drawing","dataviz","amd","a1","a2","a3","$","zeroSize","width","height","baseline","measureText","style","measureBox","TextMetrics","current","measure","loadFonts","fonts","callback","promises","document","font","load","e","logToConsole","Promise","all","then","doc","Class","LRUCache","extend","init","_size","_length","_map","put","lru","entry","_head","_tail","newer","older","get","defaultMeasureBox","options","_cache","_initOptions","baselineMarkerSize","box","styleKey","cacheKey","cachedResult","baselineMarker","_baselineMarker","cloneNode","appendChild","body","offsetWidth","offsetHeight","offsetTop","parentNode","removeChild","jQuery","encodeBase64","input","chr1","chr2","chr3","enc1","enc2","enc3","enc4","encodeUTF8","KEY_STR","inArray","ObserversMixin","observers","_observers","addObserver","element","removeObserver","index","splice","trigger","methodName","event","observer","idx","_suspended","optionsChange","geometryChange","suspend","resume","_observerField","field","mixins","Range","start","stop","step","rangeIntegerScale","k","range","j","Utils","sign","Infinity","abs","findRadian","end","sngXComp","sngYComp","y","atan","Easing","Ticker","diagram","isArray","EPSILON","isNearZero","num","isDefined","obj","isUndefined","isObject","has","hasOwnProperty","call","isString","prototype","toString","isBoolean","isType","type","parseFloat","isEmpty","simpleExtend","destination","source","initArray","serializePoints","points","res","deserializePoints","s","Point","parseInt","randomInteger","lower","upper","random","DFT","el","func","item","childNodes","getMatrixAngle","atan2","getMatrixScaling","sX","sqrt","sY","number","findAngle","center","forEach","iterator","thisRef","any","predicate","remove","what","ax","indexOf","contains","fold","list","acc","context","initial","find","constraint","insert","position","clear","bisort","sortfunc","addRange","easeInOut","cos","adapters","target","tick","interval","duration","lastTime","handlers","_this","transition","timerDelegate","onTimerEvent","addAdapter","onComplete","handler","removeHandler","grep","h","caller","onStep","seekTo","to","seekFromTo","from","intervalId","setInterval","clearInterval","play","origin","initState","reverse","propagate","update","movement","timePassed","ui","intersectLine","start1","end1","start2","end2","isSegment","num1","num2","tangensdiff","normalVariable","mean","deviation","log","randomId","chars","PathDefiner","Rect","Size","Intersect","RectAlign","Polar","Matrix","MatrixVector","Geometry","HashTable","Dictionary","Queue","Set","Node","Link","Graph","Point2D","isFunction","HITTESTAREA","fn","plus","minus","offset","times","normalize","lengthSquared","middleOf","q","toPolar","useDegrees","halfpi","len","factor","isOnLine","temp","r1","r2","o1","u1","inflate","union","parse","tempStr","xy","point","dx","dy","x1","y1","x2","y2","top","bottom","topLeft","topRight","bottomLeft","bottomRight","clone","equals","rect","rotatedBounds","angle","rotatedPoints","tl","tr","br","bl","rotate","delimiter","scale","scaleX","scaleY","staicPoint","adornerCenter","delta","scaled","thisCenter","zoom","overlaps","rectBottomRight","Empty","toRect","empty","fromPoints","lines","segments","rectWithLine","rects","rect1","rect2","intersect","reverseAngle","container","align","content","alignment","alignValues","_singleAlign","_align","_left","_center","_right","stretch","_stretch","_top","middle","_middle","_bottom","alignCalc","applyRect","fromSVGMatrix","vm","fromMatrixVector","fromList","translation","unit","rotation","sin","scaling","nums","trim","substr","fromMatrix","_distanceToLineSquared","d2","pt1","pt2","vx","vy","dot","distanceToLine","distanceToPolyline","p1","p2","minimum","_buckets","add","_createGetBucket","_bucketExists","set","containsKey","hashId","_hash","bucket","hashes","_hashes","ht","_hashString","_objectHashId","ch","_hashId","Observable","dictionary","that","_hashTable","Error","forEachValue","forEachKey","keys","enqueue","next","dequeue","resource","kv","toArray","shape","links","outgoing","incoming","weight","associatedShape","bounds","data","shortForm","isVirtual","isIsolated","isLinkedTo","node","link","getComplement","getChildren","children","getParents","parents","copy","balance","owner","adjacentTo","removeLink","hasLinkTo","degree","incidentWith","getLinksWith","getNeighbors","neighbors","connection","sourceFound","targetFound","associatedConnection","getCommonNode","isBridging","v1","v2","getNodes","changeSource","changeTarget","changesNodes","w","oldSource","oldTarget","directTo","createReverseEdge","reversed","idOrDiagram","nodes","_nodeMap","_root","_hasCachedRelationships","cacheRelationships","forceRebuild","assignLevels","startNode","visited","child","level","root","found","getConnectedComponents","componentId","components","graph","componentIndex","setItemIndices","_collectConnectedNodes","addNodeAndOutgoings","setIds","nodeIndex","nextId","calcBounds","getSpanningTree","remaining","levelCount","ni","cn","newLink","treeLevels","tree","_addNode","pop","addLink","takeRandomNode","excludedNodes","incidenceLessThan","pool","isHealthy","hasNode","sourceOrLink","foundSource","foundTarget","addExistingLink","getNode","addNode","removeAllLinks","t","hasLink","linkOrId","nodeOrId","_removeNode","removeNode","areConnected","n1","n2","layoutRect","newNode","newLinks","saveMapping","save","nodeMap","linkMap","nOriginal","nCopy","linkOriginal","linkCopy","linearize","addIds","depthFirstTraversal","action","foundNode","_dftIterator","breadthFirstTraversal","queue","_stronglyConnectedComponents","excludeSingleItems","indices","lowLinks","connected","stack","component","findCycles","isAcyclic","isSubGraph","other","otherArray","thisArray","makeAcyclic","oneLink","oneNode","rev","N","intensityCatalog","flowIntensity","catalogEqualIntensity","sourceStack","targetStack","intensity","targets","li","targetLink","sources","si","sourceLink","maxdiff","ri","ril","u","vertexOrder","kk","reversedEdges","unshift","concat","Predefined","EightGraph","Mindmap","ThreeGraph","BinaryTree","levels","createBalancedTree","Linear","Tree","siblingsCount","Forest","trees","createBalancedForest","Workflow","Grid","previous","g","graphString","previousLink","part","lin","_addShape","kendoDiagram","shapeDefaults","radius","fill","undoable","addShape","_addConnection","connect","createDiagramFromGraph","doLayout","randomSize","opt","gli","sourceShape","targetShape","shi","clientWidth","clientHeight","SpringLayout","layoutGraph","limitToView","lastAdded","news","parent","treeCount","createRandomConnectedGraph","nodeCount","maxIncidence","isTree","poolNode","randomAdditions","randomDiagram","shapeCount","diffNumericOptions","fields","elementOptions","hasChanges","sizeOptionsOrDefault","normalizeDrawingOptions","drawingOptions","getColor","TRANSPARENT","Color","toHex","lineAngle","xDiff","yDiff","createSegment","Segment","toDrawingRect","Scale","Translation","Rotation","CompositeTransform","AutoSizeableMixin","Element","VisualBase","TextBlock","Rectangle","MarkerBase","CircleMarker","ArrowMarker","MarkerPathMixin","Path","Line","Polyline","Image","Group","Layout","Circle","Canvas","geometry","Markers","none","arrowStart","filledCircle","arrowEnd","FULL_CIRCLE_ANGLE","START","END","WIDTH","HEIGHT","X","Y","toMatrix","format","invert","toMatrixVector","Length","ZERO","translate","transform","render","visual","_transform","_renderTransform","rotateMatrix","scaleMatrix","translatePoint","_setScale","originWidth","_originWidth","originHeight","_originHeight","_setTranslate","_initSize","autoSize","_measure","_updateSize","_diffNumericOptions","_originSize","visible","drawingContainer","redraw","drawingElement","matrix","_hover","force","startPoint","_measured","_boundingBox","rawBBox","stroke","opacity","_fill","_stroke","show","hover","strokeOptions","dashType","fillOptions","gradient","GradientClass","RadialGradient","LinearGradient","_textColor","_font","_initText","fontSize","fontFamily","Text","fontOptions","fontStyle","fontWeight","sizeChanged","textOptions","_initPath","_setPosition","_drawPath","closed","sizeOptions","elements","anchor","createElement","_transformToPath","path","transformCopy","positionMarker","targetSegment","_linePoints","endPoint","nextSegment","prevSegment","controlOut","controlIn","_getPath","MultiPath","paths","_normalizeMarkerOptions","startCap","endCap","_removeMarker","marker","_markers","_createMarkers","_createMarker","markerType","_positionMarker","_capMap","_redrawMarker","pathChange","pathOptions","cap","pathCapType","optionsCap","created","_redrawMarkers","_createElements","_setData","multipath","_updatePath","_pointsDiffer","currentPoints","differ","_initImage","src","_rect","_childrenChange","_remove","removeAt","toFront","visuals","toBack","_reorderChildren","toIndex","group","drawingChildren","fixedPosition","boundingBox","childBoundingBox","_includeInBBox","clippedBBox","drawingRect","reflow","_initCircle","circleOptions","move","_circle","setRadius","surface","Surface","_translate","_viewBox","viewBox","setSize","draw","insertBefore","destroy","clearHtml","testKey","toUpperCase","hitToOppositeSide","hit","canDrag","editable","drag","hitTestShapeConnectors","connector","connectors","HIT_TEST_DISTANCE","noMeta","meta","ctrlKey","altKey","shiftKey","PositionAdapter","LayoutUndoUnit","CompositeUnit","ConnectionEditUnit","ConnectionEditUndoUnit","DeleteConnectionUnit","DeleteShapeUnit","TransformUnit","AddConnectionUnit","AddShapeUnit","PanUndoUnit","RotateUnit","ToFrontUnit","ToBackUnit","UndoRedoService","EmptyTool","ScrollerTool","PointerTool","SelectionTool","ConnectionTool","ConnectionEditTool","ToolService","ConnectionRouterBase","LinearConnectionRouter","PolylineRouter","CascadingRouter","AdornerBase","ConnectionEditAdorner","ConnectorsAdorner","ResizingAdorner","Selector","ConnectorVisual","Movable","browser","support","proxy","Cursors","arrow","grip","cross","select","south","east","west","north","rowresize","colresize","AUTO","TOP","RIGHT","LEFT","BOTTOM","DEFAULT_SNAP_SIZE","DEFAULT_SNAP_ANGLE","DRAG_START","DRAG","DRAG_END","ITEMROTATE","ITEMBOUNDSCHANGE","MIN_SNAP_SIZE","MIN_SNAP_ANGLE","MOUSE_ENTER","MOUSE_LEAVE","ZOOM_START","ZOOM_END","SCROLL_MIN","SCROLL_MAX","FRICTION","FRICTION_MOBILE","VELOCITY_MULTIPLIER","PAN","ROTATED","SOURCE","TARGET","HANDLE_NAMES","-1","layoutState","pusher","getShapeById","subjects","froms","tos","initialState","finalState","animate","_initialState","_finalState","title","undo","setState","redo","state","ticker","conn","units","undoUnit","redoSource","redoTarget","_redoSource","_redoTarget","_undoSource","_undoTarget","_updateConnector","updateModel","undoSource","undoTarget","targetConnector","shapes","undoStates","adorner","redoStates","layout","refreshBounds","refresh","deselect","initialPosition","finalPosition","finalPos","pan","undoRotates","redoRotates","redoAngle","_angle","_innerBounds","_initialize","items","initialIndices","_toIndex","bind","events","capacity","begin","composite","cancel","commit","execute","_restart","addCompositeItem","count","toolService","tryActivate","getCursor","canvas","scroller","virtualScroll","tool","friction","mobileOS","scrollable","kendoMobileScroller","velocityMultiplier","mousewheelScrolling","scroll","_move","movableCanvas","dimension","makeVirtual","virtualSize","dimensions","disable","pannable","enabled","hoveredItem","hoveredAdorner","_hoveredConnector","enable","args","scrollPos","scrollLeft","scrollTop","_storePan","moveTo","_pan","selectSingle","handle","_hitTest","_resizingAdorner","isDragHandle","connections","undoRedoService","_getCursor","selectable","multiple","selector","isSelected","selectArea","_createConnection","_c","connectionHandle","_connectionManipulation","_removeHover","activeConnection","_cachedTouchTarget","cachedTouchTarget","sourceConnector","Shape","getConnector","_syncConnectionChanges","_connectorsAdorner","isActive","handleName","tools","activeTool","_updateHoveredItem","_activateTool","_updateCursor","focus","suspendTracking","updateHovered","resumeTracking","keyDown","toRemove","metaKey","_triggerRemove","_syncChanges","_destroyToolBar","_discardNewConnection","selectAll","cut","paste","wheel","z","zoomRate","zoomOptions","zoomMin","zoomMax","setTool","addToSelection","newConnection","cursor","css","msie","version","cssText","disabledShape","isNew","selectedConnections","_visible","_selectedItems","Connection","_hitTestItems","_hitTestElements","mainLayer","shapeIdx","connectionIdx","shapeHit","connectionHit","hitTest","rec","getBounds","allPoints","route","SAME_SIDE_DISTANCE_RATIO","routePoints","_connectorPoints","_floatingPoints","_resolvedSourceConnector","_resolvedTargetConnector","sourcePoint","targetPoint","_connectorSides","axis","boundsPoint","secondarySign","_connectorSide","sideDistance","minSide","side","shapeBounds","sides","_sameSideDistance","pointX","pointY","sourceConnectorSide","targetConnectorSide","deltaX","deltaY","sameSideDistance","shiftX","shiftY","cascadeStartHorizontal","_startHorizontal","sourceSide","horizontal","_adorners","sp","tp","_ts","spVisual","handles","epVisual","_initialSource","_initialTarget","ts","radiusX","radiusY","sourcePointDistance","distanceTo","targetPointDistance","sourceHandle","targetHandle","modelToLayer","_refreshHandler","ctr","_clearVisual","_keepCachedTouchTarget","visualChildren","childrenCount","unbind","each","_manipulating","_initSelection","_createHandles","selected","_internalChange","_rotatedHandler","_resizable","resize","_handleOptions","_bounds","handleBounds","handlesCount","_getHandleBounds","_rotationOffset","_startAngle","_rotates","_positions","initialRotates","initialStates","handleOptions","_sp","_cp","_lp","shapeStates","visibleHandles","currentAngle","dragging","newBounds","staticPoint","thr","newCenter","oldBounds","dtl","dbr","changed","_truncateAngle","_rotating","shouldSnap","_truncateDistance","_displaceBounds","minWidth","minHeight","states","_truncatePositionToGuides","ruler","truncatePositionToGuides","_truncateSizeToGuides","truncateSizeToGuides","snap","snapOptions","snapAngle","snapSize","_diffStates","_syncShapeChanges","thumb","rotationThumb","_rotationThumbBounds","_ep","_adorn","visualBounds","modelToView","relative","_visualBounds","HyperTree","LayoutBase","defaultOptions","subtype","roots","nodeDistance","iterations","horizontalSeparation","verticalSeparation","underneathVerticalTopOffset","underneathHorizontalOffset","underneathVerticalSeparation","grid","offsetX","offsetY","componentSpacingX","componentSpacingY","layerSeparation","layeredIterations","startRadialAngle","endRadialAngle","radialSeparation","radialFirstLevelSeparation","keepComponentsInOneRadialLayout","ignoreContainers","layoutContainerChildren","ignoreInvisible","animateTransitions","gridLayoutComponents","maxWidth","startX","startY","resultLinkSet","resultNodeSet","boundingRect","currentHeight","currentWidth","moveToOffset","nodeBounds","newpoints","pt","deltax","deltay","currentHorizontalOffset","transferOptions","DiagramToHyperTreeAdapter","shapeMap","edges","edgeMap","finalNodes","finalLinks","ignoredConnections","ignoredShapes","hyperMap","hyperTree","finalGraph","convert","_renormalizeShapes","_renormalizeConnections","mapConnection","mapShape","getEdge","listToRoot","containerGraph","parentContainer","firstNonIgnorableContainer","isContainer","_isIgnorableItem","isContainerConnection","isDescendantOf","scope","containers","isIgnorableItem","isCollapsed","_isVisible","_isTop","isShapeMapped","leastCommonAncestor","al","xa","xb","_isCollapsed","sink","sourceNode","sinkNode","newEdge","areConnectedAlready","adapter","finalNodeSet","LayoutState","initialTemperature","guessBounds","temperature","_expectedBounds","refineStage","_repulsion","_attraction","_shake","rho","alpha","_InverseSquareForce","wn","hn","wm","hm","_SquareForce","distance","av","squareSize","ratio","multiplier","area","ceil","TreeLayoutProcessor","treeGraph","layoutSwitch","layoutLeft","setChildrenDirection","setChildrenLayout","TreeDirection","Width","arrange","layoutRight","layoutUp","up","layoutDown","down","treeDirection","layoutRadialTree","startAngle","endAngle","previousRoot","maxDepth","calculateAngularWidth","radialLayout","Angle","tipOverTree","startFromLevel","aw","diameter","sectorAngle","sortChildren","pl","nl","col","basevalue","normalizeAngle","childNode","cp","childAngleFraction","deltaTheta","deltaThetaHalf","parentSector","fraction","sorted","setPolarLocation","BoundingRectangle","direction","includeStart","rootDirection","rootLayout","childrenLayout","givenSize","shapeWidth","shapeHeight","AngleToParent","SectorAngle","pp","childrenwidth","selfLocation","single","male","female","leftcount","tipOverTreeStartLevel","TreeLayout","layoutComponents","getTree","givenRootShape","getTreeForRoot","LayeredLayout","_initRuntimeProperties","layer","downstreamLinkCount","upstreamLinkCount","uBaryCenter","dBaryCenter","upstreamPriority","downstreamPriority","gridPosition","_prepare","targetLayer","sortedNodes","minLayer","layerMap","layerCount","o2","o1layer","o2layer","layers","linksTo","_dummify","_optimizeCrossings","_swapPairs","arrangeNodes","_moveThingsAround","_dedummify","setMinDist","minDist","layerIndex","minDistances","getMinDist","dist","i1","i2","placeLeftToRight","leftClasses","classNodes","rightSibling","D","neighbor","leftPos","placeLeft","POSITIVE_INFINITY","nodeLeftClass","upNodes","downNodes","intDiv","placeRightToLeft","rightClasses","leftSibling","rightPos","placeRight","NEGATIVE_INFINITY","nodeRightClass","_getLeftWing","leftWing","computeClasses","_getRightWing","rightWing","wingPair","ndsinl","vnode","wings","currentWing","wing","_nodesInLink","classIndex","_isVerticalLayout","_isHorizontalLayout","_isIncreasingLayout","maximumHeight","ctx","MIN_VALUE","currentNode","currDown","downNode","order","placed","sequenceStart","sequenceEnd","directions","fromLayerIndex","reachedFinalLayerIndex","layerIncrement","_gridPositionComparer","dest","virtualStartIndex","virtualStart","sequence","virtualEnd","virtualEndIndex","_firstVirtualNode","_sequencer","nextVirtualNode","adjustDirections","prevBridge","prevBridgeTarget","nextBridge","nextBridgeTarget","clayer","j1","j2","getNeighborOnLayer","dir","_sequenceSingle","combineSequences","pair","rightHeap","leftRes","rightRes","leftHeap","_positionDescendingComparer","_positionAscendingComparer","leftClass","_getComposite","rightClass","maxLayoutIterations","it","gridPos","layoutLayer","iconsidered","considered","n1Priority","n2Priority","nodeGridPos","nodeBaryCenter","calcBaryCenter","nodePriority","moveRight","moveLeft","calcDownData","calcUpData","priority","rightNode","rightNodePriority","leftNode","leftNodePriority","mapVirtualNode","nodeToLinkMap","linkToNodeMap","addLinkBetweenLayers","o","oLayer","dLayer","oPos","dPos","upLayer","downLayer","depthOfDumminess","prevLink","dedum","moves","maxIterations","iter","optimizeLayerCrossings","sum","total","presorted","inode","compareValue","n1BaryCenter","n2BaryCenter","compareByIndex","downwards","secondPass","hasSwapped","calcCrossings","memCrossings","crossBefore","node1","node2","node1GridPos","node2GridPos","crossAfter","revert","countLinksCrossingBetweenTwoLayers","ulayer","dlayer","link1","link2","n11","n12","n21","n22","l1","l2","n11gp","n12gp","n21gp","n22gp","crossings","numerator","denominator","graphOrNodes","capture","diagramOrGraphOrNodes","Array","GraphAdapter","mwDelta","origEvent","originalEvent","wheelDelta","detail","isAutoConnector","closestConnector","resCtr","minimumDistance","MAXINT","indicesOfItems","filterShapeDataItem","dataItem","filterConnectionDataItem","fromConnector","fromX","fromY","toConnector","toX","toY","connectionSelector","textField","model","dataSource","reader","idField","appendTo","kendoDropDownList","dataValueField","dataTextField","toJSON","optionLabel","valuePrimitive","InactiveItem","callbacks","InactiveItemsCollection","cloneDataItem","Model","_defaultId","splitDiagramElements","createModel","ObservableObject","clearField","copyDefaultOptions","mainOptions","translateToOrigin","bbox","preventDefault","defaultButtons","DiagramElement","Connector","Diagram","DiagramToolBar","Editor","PopupEditor","QuadRoot","QuadNode","ShapesQuadTree","geom","Widget","outerWidth","_outerWidth","outerHeight","_outerHeight","HierarchicalDataSource","isPlainObject","NS","CASCADING","CHANGE","CLICK","ERROR","SELECT","NONE","DEFAULT_CANVAS_WIDTH","DEFAULT_CANVAS_HEIGHT","DEFAULT_SHAPE_TYPE","DEFAULT_SHAPE_WIDTH","DEFAULT_SHAPE_HEIGHT","DEFAULT_SHAPE_MINWIDTH","DEFAULT_SHAPE_MINHEIGHT","DEFAULT_SHAPE_POSITION","DEFAULT_CONNECTION_BACKGROUND","ABSOLUTE","TRANSFORMED","MOUSEWHEEL_NS","MOBILE_ZOOM_RATE","MOBILE_PAN_DISTANCE","BUTTON_TEMPLATE","CONNECTION_CONTENT_OFFSET","DefaultConnectors","getPosition","imageClass","className","iconClass","defaults","_template","serializable","serialize","json","_content","contentOptions","contentVisual","_contentVisual","_updateContentVisual","_createContentVisual","elementTemplate","_canSelect","shapeId","updateOptionsFromModel","createShapeVisual","updateBounds","_createConnectors","_setOptionsFromModel","modelOptions","redrawVisual","_isEditable","_redrawVisual","syncChanges","_suspendModelRefresh","_resumeModelRefresh","_rotate","_alignContent","containerRect","aligner","contentBounds","contentRect","alignedBounds","connectorDefaults","_transformedBounds","_rotatedBounds","_setBounds","_triggerBoundsChange","_layouting","refreshConnections","deselected","_internalSelection","_selectionChanged","sc","deltaAngle","newPosition","con","cons","nameOrPoint","toLocaleLowerCase","fnName","_transformPoint","shapeOptions","boundsChange","shapeVisual","_visualOptions","_updateConnectors","_showConnectors","rotatedPoint","visualOptions","visualTemplate","_initRouter","_sourcePoint","_targetPoint","_setSource","_setTarget","definers","toConenctor","dataMap","_dataMap","connectionsDataSource","getByUid","uid","shapeSource","defaultConnector","_removeFromSourceConnector","_clearSourceConnector","_setFromOptions","fromPoint","sourceDefiner","_sourceDefiner","shapeTarget","_removeFromTargetConnector","_clearTargetConnector","_setToOptions","toPoint","targetDefiner","_targetDefiner","instance","connectorName","setNewTarget","inactiveItem","_inactiveShapeItems","_deferredConnectionUpdates","onActivate","endIdx","startIdx","alignToPath","midIdx","selection","_router","definition","pts","_resolveConnectors","_refreshPath","sourceConnectors","targetConnectors","_resolveAutoConnectors","minNonConflictSource","minNonConflictTarget","minSource","minTarget","sourceIdx","targetIdx","minNonConflict","_testRoutePoints","router","passRoute","_shapesQuadTree","hitTestRect","userOptions","_initTheme","_initElements","_extendLayoutOptions","_initDefaults","_interactionDefaults","_initCanvas","adornerLayer","_createHandlers","_clipboard","pauseMouseHandlers","_fetchFreshData","_createGlobalToolBar","_createOptionElements","theme","draggable","autoBind","tooltip","connectionDefaults","toolBar","click","_toolBarClick","modal","textAlign","prepend","_resize","createShape","view","editor","_createShape","edit","createConnection","_connectionsDataMap","addConnection","editModel","editorType","editors","connectionSelectorHandler","cancelEdit","shapeEditors","shapeTemplate","connectionEditors","connectionTemplate","_update","_cancel","_editArgs","_getEditDataSource","cancelChanges","_destroyEditor","saveEdit","sync","wrapper","close","attr","addClass","userShapeDefaults","mobile","canvasContainer","viewPort","viewport","on","_wheel","_keydown","_userEvents","UserEvents","multiTouch","fastTap","tap","_tap","_dragStart","_drag","_dragEnd","gesturestart","_gestureStart","gesturechange","_gestureChange","gestureend","_gestureEnd","_mouseover","_mouseout","_mouseMove","_mouseDown","_mouseUp","_syncHandler","_resizeHandler","onResize","_pauseMouseHandlers","_eventPositions","_meta","_createToolBar","ctrlPressed","focused","keyCode","touch","pageX","pageY","documentToModel","initialCenter","eventArgs","_gesture","_initialCenter","zoomedPoint","previousGesture","documentToView","scaleDelta","_zoom","updateZoom","_getValidZoom","_panTransform","_updateAdorners","_kendoNode","srcElement","themes","themeName","themeOptions","shapesLength","_createShapes","_createConnections","_findConnectionTarget","unbindResize","off","destroyScroller","_destroyGlobalToolBar","is","_activeElement","scrollContainer","offsets","documentElement","scrollHeight","setOptions","added","removed","_removeItem","_removeShapeDataItem","_removeConnectionDataItem","_getDiagramItems","_fixOrdering","bringIntoView","original","newPan","_zoomMainLayer","alignShapes","viewportVector","raw","hideTooltip","_getPan","animatedScrollTo","scrollTo","_copyOffset","copied","mapping","_updateCopiedConnection","sourceConnection","di","_containerOffset","containerOffset","viewToDocument","viewToModel","_transformWithMatrix","_matrixInvert","_matrix","_layerMatrix","layerToModel","_layerMatrixInvert","viewPoint","modelToDocument","setDataSource","_dataSource","fetch","setConnectionsDataSource","_connectionDataSource","_redrawConnections","getShapeByModelId","getShapeByModelUid","getConnectionByModelId","getConnectionByModelUid","_transformMainLayer","_finishPan","NaN","_storeViewMatrix","_storeLayerMatrix","canvasTransform","shapePos","conPos","removedConnections","_removeShape","_removeConnection","_removeDataItems","recursive","_removeShapeConnections","hasChildren","loaded","_addDataItem","_addDataItemByUid","_addDataItems","parentShape","_refreshSource","dataBound","_bindingRoots","_addItem","preventClosing","padding","popupWidth","popupHeight","connectionBounds","singleToolBar","_popup","showAt","one","_normalizePointZoom","undone","redone","_loadingShapes","_loadingConnections","dsOptions","ds","_shapesRefreshHandler","_shapesRequestStartHandler","_shapesErrorHandler","_refreshShapes","_shapesRequestStart","_error","DataSource","_treeDataSource","_connectionsRefreshHandler","_connectionsRequestStartHandler","_connectionsErrorHandler","_refreshConnections","_connectionsRequestStart","_connectionsError","_shouldRefresh","_removeShapes","_updateShapes","_syncShapes","_rebindShapesAndConnections","_addShapes","_addConnections","inactiveItems","activate","dataItems","_removeConnections","_updateConnections","_addConnectionDataItem","_validateConnector","_unbindDataSource","_errorHandler","adorners","_refresh","hide","exportDOMVisual","scrollOffset","viewRect","clipPath","fromRect","wrap","clipWrap","clip","exportVisual","when","deferredConnectionUpdates","ExportMixin","PDFMixin","_tools","createToolBar","createTools","appendTools","createPopup","kendoPopup","getKendoPopup","buttons","_toolBar","kendoToolBar","resizable","getKendoToolBar","createTool","toolName","attributes","_setAttributes","open","newGroup","editTool","spriteCssClass","showText","deleteTool","rotateAnticlockwiseTool","_appendGroup","_rotateGroup","rotateClockwiseTool","createShapeTool","_createGroup","createConnectionTool","undoTool","_historyGroup","redoTool","prop","_getAttributes","eventData","selectedElements","delete","selectedElemens","rotateClockwise","rotateAnticlockwise","_getFields","_initContainer","createEditable","Editable","clearContainer","modelFields","columns","formContent","_renderTemplate","_renderFields","_renderButtons","Window","userTriggered","sender","_cancelClick","_attachButtonEvents","unescape","form","_createButton","_cancelClickHandler","_updateClickHandler","_updateClick","_editUpdateClickHandler","deffered","Deferred","deferred","resolve","_add","_quadNode","_testRect","inBounds","nodeRect","nodeBottomRight","overlapsBounds","inserted","_initChildren","childIdx","halfWidth","halfHeight","ROOT_SIZE","boundsChangeHandler","_boundsChange","initRoots","rootMap","rootSize","sectors","getSectors","inRoot","bottomX","bottomY","xIdx","yIdx","plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,aAAc,cAAeD,IACtC,WA6WE,MA5WC,YAGG,QAASE,GAAQC,GACb,aAAcA,KAAUC,EAE5B,QAASC,GAAMF,EAAOG,GAClB,GAAIC,GAAQC,EAAIF,EAChB,OAAOG,GAAKJ,MAAMF,EAAQI,GAASA,EAEvC,QAASC,GAAIE,GACT,MAAIA,GACOD,EAAKD,IAAI,GAAIE,GAEb,EAGf,QAASC,GAAWR,EAAOS,EAAKC,GAC5B,MAAOJ,GAAKI,IAAIJ,EAAKG,IAAIT,EAAOU,GAAMD,GAE1C,QAASE,GAAIC,GACT,MAAOA,GAAUC,EAErB,QAASC,GAAIC,GACT,MAAOA,GAAUF,EAErB,QAASG,GAASC,GACd,MAAsB,gBAARA,KAAqBC,MAAMD,GAE7C,QAASE,GAAenB,EAAOoB,GAC3B,MAAO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AAGM,GACf3pD,GAAQjf,KAAKooE,QAAQhpE,QAAU4J,GAC3BiW,GAAQA,EAAKyzC,YAAY/9C,GACzB,OAAO,CAInB,QAAO,KAyDf5S,EAAQiO,GAAG64D,OAAOrgB,GAClBlnD,EAAW8H,GACPo5B,MAAOA,EACP4C,WAAYA,EACZmjB,UAAWA,EACXE,eAAgBA,EAChBI,SAAUA,EACVD,SAAUA,EACVE,eAAgBA,EAChBH,YAAaA,KAEnBtnD,OAAO3F,MAAMoK,SACC,kBAAV9N,SAAwBA,OAAOgK,IAAMhK,OAAS,SAAUiK,EAAIC,EAAIC,IACrEA,GAAMD,OAEV,SAAUnK,EAAGC,QACVA,OAAO,yBACH,aACA,oBACA,mBACA,wBACA,gBACA,wBACA,uBACA,sBACA,2BACA,yBACA,uBACDD,IACL,WAmCE,MAAOsJ,QAAO3F,OACE,kBAAV1D,SAAwBA,OAAOgK,IAAMhK,OAAS,SAAUiK,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.dataviz.diagram.min.js","sourcesContent":["/*!\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('util/main', ['kendo.core'], f);\n}(function () {\n (function () {\n var math = Math, kendo = window.kendo, deepExtend = kendo.deepExtend;\n var DEG_TO_RAD = math.PI / 180, MAX_NUM = Number.MAX_VALUE, MIN_NUM = -Number.MAX_VALUE, UNDEFINED = 'undefined';\n function defined(value) {\n return typeof value !== UNDEFINED;\n }\n function round(value, precision) {\n var power = pow(precision);\n return math.round(value * power) / power;\n }\n function pow(p) {\n if (p) {\n return math.pow(10, p);\n } else {\n return 1;\n }\n }\n function limitValue(value, min, max) {\n return math.max(math.min(value, max), min);\n }\n function rad(degrees) {\n return degrees * DEG_TO_RAD;\n }\n function deg(radians) {\n return radians / DEG_TO_RAD;\n }\n function isNumber(val) {\n return typeof val === 'number' && !isNaN(val);\n }\n function valueOrDefault(value, defaultValue) {\n return defined(value) ? value : defaultValue;\n }\n function sqr(value) {\n return value * value;\n }\n function objectKey(object) {\n var parts = [];\n for (var key in object) {\n parts.push(key + object[key]);\n }\n return parts.sort().join('');\n }\n function hashKey(str) {\n var hash = 2166136261;\n for (var i = 0; i < str.length; ++i) {\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n hash ^= str.charCodeAt(i);\n }\n return hash >>> 0;\n }\n function hashObject(object) {\n return hashKey(objectKey(object));\n }\n var now = Date.now;\n if (!now) {\n now = function () {\n return new Date().getTime();\n };\n }\n function arrayLimits(arr) {\n var length = arr.length, i, min = MAX_NUM, max = MIN_NUM;\n for (i = 0; i < length; i++) {\n max = math.max(max, arr[i]);\n min = math.min(min, arr[i]);\n }\n return {\n min: min,\n max: max\n };\n }\n function arrayMin(arr) {\n return arrayLimits(arr).min;\n }\n function arrayMax(arr) {\n return arrayLimits(arr).max;\n }\n function sparseArrayMin(arr) {\n return sparseArrayLimits(arr).min;\n }\n function sparseArrayMax(arr) {\n return sparseArrayLimits(arr).max;\n }\n function sparseArrayLimits(arr) {\n var min = MAX_NUM, max = MIN_NUM;\n for (var i = 0, length = arr.length; i < length; i++) {\n var n = arr[i];\n if (n !== null && isFinite(n)) {\n min = math.min(min, n);\n max = math.max(max, n);\n }\n }\n return {\n min: min === MAX_NUM ? undefined : min,\n max: max === MIN_NUM ? undefined : max\n };\n }\n function last(array) {\n if (array) {\n return array[array.length - 1];\n }\n }\n function append(first, second) {\n first.push.apply(first, second);\n return first;\n }\n function renderTemplate(text) {\n return kendo.template(text, {\n useWithBlock: false,\n paramName: 'd'\n });\n }\n function renderAttr(name, value) {\n return defined(value) && value !== null ? ' ' + name + '=\\'' + value + '\\' ' : '';\n }\n function renderAllAttr(attrs) {\n var output = '';\n for (var i = 0; i < attrs.length; i++) {\n output += renderAttr(attrs[i][0], attrs[i][1]);\n }\n return output;\n }\n function renderStyle(attrs) {\n var output = '';\n for (var i = 0; i < attrs.length; i++) {\n var value = attrs[i][1];\n if (defined(value)) {\n output += attrs[i][0] + ':' + value + ';';\n }\n }\n if (output !== '') {\n return output;\n }\n }\n function renderSize(size) {\n if (typeof size !== 'string') {\n size += 'px';\n }\n return size;\n }\n function renderPos(pos) {\n var result = [];\n if (pos) {\n var parts = kendo.toHyphens(pos).split('-');\n for (var i = 0; i < parts.length; i++) {\n result.push('k-pos-' + parts[i]);\n }\n }\n return result.join(' ');\n }\n function isTransparent(color) {\n return color === '' || color === null || color === 'none' || color === 'transparent' || !defined(color);\n }\n function arabicToRoman(n) {\n var literals = {\n 1: 'i',\n 10: 'x',\n 100: 'c',\n 2: 'ii',\n 20: 'xx',\n 200: 'cc',\n 3: 'iii',\n 30: 'xxx',\n 300: 'ccc',\n 4: 'iv',\n 40: 'xl',\n 400: 'cd',\n 5: 'v',\n 50: 'l',\n 500: 'd',\n 6: 'vi',\n 60: 'lx',\n 600: 'dc',\n 7: 'vii',\n 70: 'lxx',\n 700: 'dcc',\n 8: 'viii',\n 80: 'lxxx',\n 800: 'dccc',\n 9: 'ix',\n 90: 'xc',\n 900: 'cm',\n 1000: 'm'\n };\n var values = [\n 1000,\n 900,\n 800,\n 700,\n 600,\n 500,\n 400,\n 300,\n 200,\n 100,\n 90,\n 80,\n 70,\n 60,\n 50,\n 40,\n 30,\n 20,\n 10,\n 9,\n 8,\n 7,\n 6,\n 5,\n 4,\n 3,\n 2,\n 1\n ];\n var roman = '';\n while (n > 0) {\n if (n < values[0]) {\n values.shift();\n } else {\n roman += literals[values[0]];\n n -= values[0];\n }\n }\n return roman;\n }\n function romanToArabic(r) {\n r = r.toLowerCase();\n var digits = {\n i: 1,\n v: 5,\n x: 10,\n l: 50,\n c: 100,\n d: 500,\n m: 1000\n };\n var value = 0, prev = 0;\n for (var i = 0; i < r.length; ++i) {\n var v = digits[r.charAt(i)];\n if (!v) {\n return null;\n }\n value += v;\n if (v > prev) {\n value -= 2 * prev;\n }\n prev = v;\n }\n return value;\n }\n function memoize(f) {\n var cache = Object.create(null);\n return function () {\n var id = '';\n for (var i = arguments.length; --i >= 0;) {\n id += ':' + arguments[i];\n }\n return id in cache ? cache[id] : cache[id] = f.apply(this, arguments);\n };\n }\n function ucs2decode(string) {\n var output = [], counter = 0, length = string.length, value, extra;\n while (counter < length) {\n value = string.charCodeAt(counter++);\n if (value >= 55296 && value <= 56319 && counter < length) {\n extra = string.charCodeAt(counter++);\n if ((extra & 64512) == 56320) {\n output.push(((value & 1023) << 10) + (extra & 1023) + 65536);\n } else {\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n }\n function ucs2encode(array) {\n return array.map(function (value) {\n var output = '';\n if (value > 65535) {\n value -= 65536;\n output += String.fromCharCode(value >>> 10 & 1023 | 55296);\n value = 56320 | value & 1023;\n }\n output += String.fromCharCode(value);\n return output;\n }).join('');\n }\n function mergeSort(a, cmp) {\n if (a.length < 2) {\n return a.slice();\n }\n function merge(a, b) {\n var r = [], ai = 0, bi = 0, i = 0;\n while (ai < a.length && bi < b.length) {\n if (cmp(a[ai], b[bi]) <= 0) {\n r[i++] = a[ai++];\n } else {\n r[i++] = b[bi++];\n }\n }\n if (ai < a.length) {\n r.push.apply(r, a.slice(ai));\n }\n if (bi < b.length) {\n r.push.apply(r, b.slice(bi));\n }\n return r;\n }\n return function sort(a) {\n if (a.length <= 1) {\n return a;\n }\n var m = Math.floor(a.length / 2);\n var left = a.slice(0, m);\n var right = a.slice(m);\n left = sort(left);\n right = sort(right);\n return merge(left, right);\n }(a);\n }\n deepExtend(kendo, {\n util: {\n MAX_NUM: MAX_NUM,\n MIN_NUM: MIN_NUM,\n append: append,\n arrayLimits: arrayLimits,\n arrayMin: arrayMin,\n arrayMax: arrayMax,\n defined: defined,\n deg: deg,\n hashKey: hashKey,\n hashObject: hashObject,\n isNumber: isNumber,\n isTransparent: isTransparent,\n last: last,\n limitValue: limitValue,\n now: now,\n objectKey: objectKey,\n round: round,\n rad: rad,\n renderAttr: renderAttr,\n renderAllAttr: renderAllAttr,\n renderPos: renderPos,\n renderSize: renderSize,\n renderStyle: renderStyle,\n renderTemplate: renderTemplate,\n sparseArrayLimits: sparseArrayLimits,\n sparseArrayMin: sparseArrayMin,\n sparseArrayMax: sparseArrayMax,\n sqr: sqr,\n valueOrDefault: valueOrDefault,\n romanToArabic: romanToArabic,\n arabicToRoman: arabicToRoman,\n memoize: memoize,\n ucs2encode: ucs2encode,\n ucs2decode: ucs2decode,\n mergeSort: mergeSort\n }\n });\n kendo.drawing.util = kendo.util;\n kendo.dataviz.util = kendo.util;\n }());\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('util/text-metrics', [\n 'kendo.core',\n 'util/main'\n ], f);\n}(function () {\n (function ($) {\n var doc = document, kendo = window.kendo, Class = kendo.Class, util = kendo.util, defined = util.defined;\n var LRUCache = Class.extend({\n init: function (size) {\n this._size = size;\n this._length = 0;\n this._map = {};\n },\n put: function (key, value) {\n var lru = this, map = lru._map, entry = {\n key: key,\n value: value\n };\n map[key] = entry;\n if (!lru._head) {\n lru._head = lru._tail = entry;\n } else {\n lru._tail.newer = entry;\n entry.older = lru._tail;\n lru._tail = entry;\n }\n if (lru._length >= lru._size) {\n map[lru._head.key] = null;\n lru._head = lru._head.newer;\n lru._head.older = null;\n } else {\n lru._length++;\n }\n },\n get: function (key) {\n var lru = this, entry = lru._map[key];\n if (entry) {\n if (entry === lru._head && entry !== lru._tail) {\n lru._head = entry.newer;\n lru._head.older = null;\n }\n if (entry !== lru._tail) {\n if (entry.older) {\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n }\n entry.older = lru._tail;\n entry.newer = null;\n lru._tail.newer = entry;\n lru._tail = entry;\n }\n return entry.value;\n }\n }\n });\n var defaultMeasureBox = $('
')[0];\n function zeroSize() {\n return {\n width: 0,\n height: 0,\n baseline: 0\n };\n }\n var TextMetrics = Class.extend({\n init: function (options) {\n this._cache = new LRUCache(1000);\n this._initOptions(options);\n },\n options: { baselineMarkerSize: 1 },\n measure: function (text, style, box) {\n if (!text) {\n return zeroSize();\n }\n var styleKey = util.objectKey(style), cacheKey = util.hashKey(text + styleKey), cachedResult = this._cache.get(cacheKey);\n if (cachedResult) {\n return cachedResult;\n }\n var size = zeroSize();\n var measureBox = box ? box : defaultMeasureBox;\n var baselineMarker = this._baselineMarker().cloneNode(false);\n for (var key in style) {\n var value = style[key];\n if (defined(value)) {\n measureBox.style[key] = value;\n }\n }\n $(measureBox).text(text);\n measureBox.appendChild(baselineMarker);\n doc.body.appendChild(measureBox);\n if ((text + '').length) {\n size.width = measureBox.offsetWidth - this.options.baselineMarkerSize;\n size.height = measureBox.offsetHeight;\n size.baseline = baselineMarker.offsetTop + this.options.baselineMarkerSize;\n }\n if (size.width > 0 && size.height > 0) {\n this._cache.put(cacheKey, size);\n }\n measureBox.parentNode.removeChild(measureBox);\n return size;\n },\n _baselineMarker: function () {\n return $('')[0];\n }\n });\n TextMetrics.current = new TextMetrics();\n function measureText(text, style, measureBox) {\n return TextMetrics.current.measure(text, style, measureBox);\n }\n function loadFonts(fonts, callback) {\n var promises = [];\n if (fonts.length > 0 && document.fonts) {\n try {\n promises = fonts.map(function (font) {\n return document.fonts.load(font);\n });\n } catch (e) {\n kendo.logToConsole(e);\n }\n Promise.all(promises).then(callback, callback);\n } else {\n callback();\n }\n }\n kendo.util.TextMetrics = TextMetrics;\n kendo.util.LRUCache = LRUCache;\n kendo.util.loadFonts = loadFonts;\n kendo.util.measureText = measureText;\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('util/base64', ['util/main'], f);\n}(function () {\n (function () {\n var kendo = window.kendo, deepExtend = kendo.deepExtend, fromCharCode = String.fromCharCode;\n var KEY_STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n function encodeBase64(input) {\n var output = '';\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n input = encodeUTF8(input);\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output + KEY_STR.charAt(enc1) + KEY_STR.charAt(enc2) + KEY_STR.charAt(enc3) + KEY_STR.charAt(enc4);\n }\n return output;\n }\n function encodeUTF8(input) {\n var output = '';\n for (var i = 0; i < input.length; i++) {\n var c = input.charCodeAt(i);\n if (c < 128) {\n output += fromCharCode(c);\n } else if (c < 2048) {\n output += fromCharCode(192 | c >>> 6);\n output += fromCharCode(128 | c & 63);\n } else if (c < 65536) {\n output += fromCharCode(224 | c >>> 12);\n output += fromCharCode(128 | c >>> 6 & 63);\n output += fromCharCode(128 | c & 63);\n }\n }\n return output;\n }\n deepExtend(kendo.util, {\n encodeBase64: encodeBase64,\n encodeUTF8: encodeUTF8\n });\n }());\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('mixins/observers', ['kendo.core'], f);\n}(function () {\n (function ($) {\n var math = Math, kendo = window.kendo, deepExtend = kendo.deepExtend, inArray = $.inArray;\n var ObserversMixin = {\n observers: function () {\n this._observers = this._observers || [];\n return this._observers;\n },\n addObserver: function (element) {\n if (!this._observers) {\n this._observers = [element];\n } else {\n this._observers.push(element);\n }\n return this;\n },\n removeObserver: function (element) {\n var observers = this.observers();\n var index = inArray(element, observers);\n if (index != -1) {\n observers.splice(index, 1);\n }\n return this;\n },\n trigger: function (methodName, event) {\n var observers = this._observers;\n var observer;\n var idx;\n if (observers && !this._suspended) {\n for (idx = 0; idx < observers.length; idx++) {\n observer = observers[idx];\n if (observer[methodName]) {\n observer[methodName](event);\n }\n }\n }\n return this;\n },\n optionsChange: function (e) {\n e = e || {};\n e.element = this;\n this.trigger('optionsChange', e);\n },\n geometryChange: function () {\n this.trigger('geometryChange', { element: this });\n },\n suspend: function () {\n this._suspended = (this._suspended || 0) + 1;\n return this;\n },\n resume: function () {\n this._suspended = math.max((this._suspended || 0) - 1, 0);\n return this;\n },\n _observerField: function (field, value) {\n if (this[field]) {\n this[field].removeObserver(this);\n }\n this[field] = value;\n value.addObserver(this);\n }\n };\n deepExtend(kendo, { mixins: { ObserversMixin: ObserversMixin } });\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/utils', ['kendo.core'], f);\n}(function () {\n (function ($, undefined) {\n var kendo = window.kendo, diagram = kendo.dataviz.diagram = {}, deepExtend = kendo.deepExtend, isArray = $.isArray, EPSILON = 0.000001;\n var Utils = {};\n deepExtend(Utils, {\n isNearZero: function (num) {\n return Math.abs(num) < EPSILON;\n },\n isDefined: function (obj) {\n return typeof obj !== 'undefined';\n },\n isUndefined: function (obj) {\n return typeof obj === 'undefined' || obj === null;\n },\n isObject: function (obj) {\n return obj === Object(obj);\n },\n has: function (obj, key) {\n return Object.hasOwnProperty.call(obj, key);\n },\n isString: function (obj) {\n return Object.prototype.toString.call(obj) == '[object String]';\n },\n isBoolean: function (obj) {\n return Object.prototype.toString.call(obj) == '[object Boolean]';\n },\n isType: function (obj, type) {\n return Object.prototype.toString.call(obj) == '[object ' + type + ']';\n },\n isNumber: function (obj) {\n return !isNaN(parseFloat(obj)) && isFinite(obj);\n },\n isEmpty: function (obj) {\n if (obj === null) {\n return true;\n }\n if (isArray(obj) || Utils.isString(obj)) {\n return obj.length === 0;\n }\n for (var key in obj) {\n if (Utils.has(obj, key)) {\n return false;\n }\n }\n return true;\n },\n simpleExtend: function (destination, source) {\n if (!Utils.isObject(source)) {\n return;\n }\n for (var name in source) {\n destination[name] = source[name];\n }\n },\n initArray: function createIdArray(size, value) {\n var array = [];\n for (var i = 0; i < size; ++i) {\n array[i] = value;\n }\n return array;\n },\n serializePoints: function (points) {\n var res = [];\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n res.push(p.x + ';' + p.y);\n }\n return res.join(';');\n },\n deserializePoints: function (s) {\n var v = s.split(';'), points = [];\n if (v.length % 2 !== 0) {\n throw 'Not an array of points.';\n }\n for (var i = 0; i < v.length; i += 2) {\n points.push(new diagram.Point(parseInt(v[i], 10), parseInt(v[i + 1], 10)));\n }\n return points;\n },\n randomInteger: function (lower, upper) {\n return parseInt(Math.floor(Math.random() * upper) + lower, 10);\n },\n DFT: function (el, func) {\n func(el);\n if (el.childNodes) {\n for (var i = 0; i < el.childNodes.length; i++) {\n var item = el.childNodes[i];\n this.DFT(item, func);\n }\n }\n },\n getMatrixAngle: function (m) {\n if (m === null || m.d === 0) {\n return 0;\n }\n return Math.atan2(m.b, m.d) * 180 / Math.PI;\n },\n getMatrixScaling: function (m) {\n var sX = Math.sqrt(m.a * m.a + m.c * m.c);\n var sY = Math.sqrt(m.b * m.b + m.d * m.d);\n return [\n sX,\n sY\n ];\n }\n });\n function Range(start, stop, step) {\n if (typeof start == 'undefined' || typeof stop == 'undefined') {\n return [];\n }\n if (step && Utils.sign(stop - start) != Utils.sign(step)) {\n throw 'The sign of the increment should allow to reach the stop-value.';\n }\n step = step || 1;\n start = start || 0;\n stop = stop || start;\n if ((stop - start) / step === Infinity) {\n throw 'Infinite range defined.';\n }\n var range = [], i = -1, j;\n function rangeIntegerScale(x) {\n var k = 1;\n while (x * k % 1) {\n k *= 10;\n }\n return k;\n }\n var k = rangeIntegerScale(Math.abs(step));\n start *= k;\n stop *= k;\n step *= k;\n if (start > stop && step > 0) {\n step = -step;\n }\n if (step < 0) {\n while ((j = start + step * ++i) >= stop) {\n range.push(j / k);\n }\n } else {\n while ((j = start + step * ++i) <= stop) {\n range.push(j / k);\n }\n }\n return range;\n }\n function findRadian(start, end) {\n if (start == end) {\n return 0;\n }\n var sngXComp = end.x - start.x, sngYComp = start.y - end.y, atan = Math.atan(sngXComp / sngYComp);\n if (sngYComp >= 0) {\n return sngXComp < 0 ? atan + 2 * Math.PI : atan;\n }\n return atan + Math.PI;\n }\n Utils.sign = function (number) {\n return number ? number < 0 ? -1 : 1 : 0;\n };\n Utils.findAngle = function (center, end) {\n return findRadian(center, end) * 180 / Math.PI;\n };\n Utils.forEach = function (arr, iterator, thisRef) {\n for (var i = 0; i < arr.length; i++) {\n iterator.call(thisRef, arr[i], i, arr);\n }\n };\n Utils.any = function (arr, predicate) {\n for (var i = 0; i < arr.length; ++i) {\n if (predicate(arr[i])) {\n return arr[i];\n }\n }\n return null;\n };\n Utils.remove = function (arr, what) {\n var ax;\n while ((ax = Utils.indexOf(arr, what)) !== -1) {\n arr.splice(ax, 1);\n }\n return arr;\n };\n Utils.contains = function (arr, obj) {\n return Utils.indexOf(arr, obj) !== -1;\n };\n Utils.indexOf = function (arr, what) {\n return $.inArray(what, arr);\n };\n Utils.fold = function (list, iterator, acc, context) {\n var initial = arguments.length > 2;\n for (var i = 0; i < list.length; i++) {\n var value = list[i];\n if (!initial) {\n acc = value;\n initial = true;\n } else {\n acc = iterator.call(context, acc, value, i, list);\n }\n }\n if (!initial) {\n throw 'Reduce of empty array with no initial value';\n }\n return acc;\n };\n Utils.find = function (arr, iterator, context) {\n var result;\n Utils.any(arr, function (value, index, list) {\n if (iterator.call(context, value, index, list)) {\n result = value;\n return true;\n }\n return false;\n });\n return result;\n };\n Utils.first = function (arr, constraint, context) {\n if (arr.length === 0) {\n return null;\n }\n if (Utils.isUndefined(constraint)) {\n return arr[0];\n }\n return Utils.find(arr, constraint, context);\n };\n Utils.insert = function (arr, element, position) {\n arr.splice(position, 0, element);\n return arr;\n };\n Utils.all = function (arr, iterator, context) {\n var result = true;\n var value;\n for (var i = 0; i < arr.length; i++) {\n value = arr[i];\n result = result && iterator.call(context, value, i, arr);\n if (!result) {\n break;\n }\n }\n return result;\n };\n Utils.clear = function (arr) {\n arr.splice(0, arr.length);\n };\n Utils.bisort = function (a, b, sortfunc) {\n if (Utils.isUndefined(a)) {\n throw 'First array is not specified.';\n }\n if (Utils.isUndefined(b)) {\n throw 'Second array is not specified.';\n }\n if (a.length != b.length) {\n throw 'The two arrays should have equal length';\n }\n var all = [], i;\n for (i = 0; i < a.length; i++) {\n all.push({\n 'x': a[i],\n 'y': b[i]\n });\n }\n if (Utils.isUndefined(sortfunc)) {\n all.sort(function (m, n) {\n return m.x - n.x;\n });\n } else {\n all.sort(function (m, n) {\n return sortfunc(m.x, n.x);\n });\n }\n Utils.clear(a);\n Utils.clear(b);\n for (i = 0; i < all.length; i++) {\n a.push(all[i].x);\n b.push(all[i].y);\n }\n };\n Utils.addRange = function (arr, range) {\n arr.push.apply(arr, range);\n };\n var Easing = {\n easeInOut: function (pos) {\n return -Math.cos(pos * Math.PI) / 2 + 0.5;\n }\n };\n var Ticker = kendo.Class.extend({\n init: function () {\n this.adapters = [];\n this.target = 0;\n this.tick = 0;\n this.interval = 20;\n this.duration = 800;\n this.lastTime = null;\n this.handlers = [];\n var _this = this;\n this.transition = Easing.easeInOut;\n this.timerDelegate = function () {\n _this.onTimerEvent();\n };\n },\n addAdapter: function (a) {\n this.adapters.push(a);\n },\n onComplete: function (handler) {\n this.handlers.push(handler);\n },\n removeHandler: function (handler) {\n this.handlers = $.grep(this.handlers, function (h) {\n return h !== handler;\n });\n },\n trigger: function () {\n var _this = this;\n if (this.handlers) {\n Utils.forEach(this.handlers, function (h) {\n return h.call(_this.caller !== null ? _this.caller : _this);\n });\n }\n },\n onStep: function () {\n },\n seekTo: function (to) {\n this.seekFromTo(this.tick, to);\n },\n seekFromTo: function (from, to) {\n this.target = Math.max(0, Math.min(1, to));\n this.tick = Math.max(0, Math.min(1, from));\n this.lastTime = new Date().getTime();\n if (!this.intervalId) {\n this.intervalId = window.setInterval(this.timerDelegate, this.interval);\n }\n },\n stop: function () {\n if (this.intervalId) {\n window.clearInterval(this.intervalId);\n this.intervalId = null;\n this.trigger();\n }\n },\n play: function (origin) {\n if (this.adapters.length === 0) {\n return;\n }\n if (origin !== null) {\n this.caller = origin;\n }\n this.initState();\n this.seekFromTo(0, 1);\n },\n reverse: function () {\n this.seekFromTo(1, 0);\n },\n initState: function () {\n if (this.adapters.length === 0) {\n return;\n }\n for (var i = 0; i < this.adapters.length; i++) {\n this.adapters[i].initState();\n }\n },\n propagate: function () {\n var value = this.transition(this.tick);\n for (var i = 0; i < this.adapters.length; i++) {\n this.adapters[i].update(value);\n }\n },\n onTimerEvent: function () {\n var now = new Date().getTime();\n var timePassed = now - this.lastTime;\n this.lastTime = now;\n var movement = timePassed / this.duration * (this.tick < this.target ? 1 : -1);\n if (Math.abs(movement) >= Math.abs(this.tick - this.target)) {\n this.tick = this.target;\n } else {\n this.tick += movement;\n }\n try {\n this.propagate();\n } finally {\n this.onStep.call(this);\n if (this.target == this.tick) {\n this.stop();\n }\n }\n }\n });\n kendo.deepExtend(diagram, {\n init: function (element) {\n kendo.init(element, diagram.ui);\n },\n Utils: Utils,\n Range: Range,\n Ticker: Ticker\n });\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/math', [\n 'dataviz/diagram/utils',\n 'kendo.dataviz.core'\n ], f);\n}(function () {\n (function ($, undefined) {\n var kendo = window.kendo, diagram = kendo.dataviz.diagram, Class = kendo.Class, deepExtend = kendo.deepExtend, dataviz = kendo.dataviz, Utils = diagram.Utils, Point = dataviz.Point2D, isFunction = kendo.isFunction, contains = Utils.contains, map = $.map;\n var HITTESTAREA = 3, EPSILON = 0.000001;\n deepExtend(Point.fn, {\n plus: function (p) {\n return new Point(this.x + p.x, this.y + p.y);\n },\n minus: function (p) {\n return new Point(this.x - p.x, this.y - p.y);\n },\n offset: function (value) {\n return new Point(this.x - value, this.y - value);\n },\n times: function (s) {\n return new Point(this.x * s, this.y * s);\n },\n normalize: function () {\n if (this.length() === 0) {\n return new Point();\n }\n return this.times(1 / this.length());\n },\n length: function () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n toString: function () {\n return '(' + this.x + ',' + this.y + ')';\n },\n lengthSquared: function () {\n return this.x * this.x + this.y * this.y;\n },\n middleOf: function MiddleOf(p, q) {\n return new Point(q.x - p.x, q.y - p.y).times(0.5).plus(p);\n },\n toPolar: function (useDegrees) {\n var factor = 1;\n if (useDegrees) {\n factor = 180 / Math.PI;\n }\n var a = Math.atan2(Math.abs(this.y), Math.abs(this.x));\n var halfpi = Math.PI / 2;\n var len = this.length();\n if (this.x === 0) {\n if (this.y === 0) {\n return new Polar(0, 0);\n }\n if (this.y > 0) {\n return new Polar(len, factor * halfpi);\n }\n if (this.y < 0) {\n return new Polar(len, factor * 3 * halfpi);\n }\n } else if (this.x > 0) {\n if (this.y === 0) {\n return new Polar(len, 0);\n }\n if (this.y > 0) {\n return new Polar(len, factor * a);\n }\n if (this.y < 0) {\n return new Polar(len, factor * (4 * halfpi - a));\n }\n } else {\n if (this.y === 0) {\n return new Polar(len, 2 * halfpi);\n }\n if (this.y > 0) {\n return new Polar(len, factor * (2 * halfpi - a));\n }\n if (this.y < 0) {\n return new Polar(len, factor * (2 * halfpi + a));\n }\n }\n },\n isOnLine: function (from, to) {\n if (from.x > to.x) {\n var temp = to;\n to = from;\n from = temp;\n }\n var r1 = new Rect(from.x, from.y).inflate(HITTESTAREA, HITTESTAREA), r2 = new Rect(to.x, to.y).inflate(HITTESTAREA, HITTESTAREA), o1, u1;\n if (r1.union(r2).contains(this)) {\n if (from.x === to.x || from.y === to.y) {\n return true;\n } else if (from.y < to.y) {\n o1 = r1.x + (r2.x - r1.x) * (this.y - (r1.y + r1.height)) / (r2.y + r2.height - (r1.y + r1.height));\n u1 = r1.x + r1.width + (r2.x + r2.width - (r1.x + r1.width)) * (this.y - r1.y) / (r2.y - r1.y);\n } else {\n o1 = r1.x + (r2.x - r1.x) * (this.y - r1.y) / (r2.y - r1.y);\n u1 = r1.x + r1.width + (r2.x + r2.width - (r1.x + r1.width)) * (this.y - (r1.y + r1.height)) / (r2.y + r2.height - (r1.y + r1.height));\n }\n return this.x > o1 && this.x < u1;\n }\n return false;\n }\n });\n deepExtend(Point, {\n parse: function (str) {\n var tempStr = str.slice(1, str.length - 1), xy = tempStr.split(','), x = parseInt(xy[0], 10), y = parseInt(xy[1], 10);\n if (!isNaN(x) && !isNaN(y)) {\n return new Point(x, y);\n }\n }\n });\n var PathDefiner = Class.extend({\n init: function (p, left, right) {\n this.point = p;\n this.left = left;\n this.right = right;\n }\n });\n var Rect = Class.extend({\n init: function (x, y, width, height) {\n this.x = x || 0;\n this.y = y || 0;\n this.width = width || 0;\n this.height = height || 0;\n },\n contains: function (point) {\n return point.x >= this.x && point.x <= this.x + this.width && point.y >= this.y && point.y <= this.y + this.height;\n },\n inflate: function (dx, dy) {\n if (dy === undefined) {\n dy = dx;\n }\n this.x -= dx;\n this.y -= dy;\n this.width += 2 * dx + 1;\n this.height += 2 * dy + 1;\n return this;\n },\n offset: function (dx, dy) {\n var x = dx, y = dy;\n if (dx instanceof Point) {\n x = dx.x;\n y = dx.y;\n }\n this.x += x;\n this.y += y;\n return this;\n },\n union: function (r) {\n var x1 = Math.min(this.x, r.x);\n var y1 = Math.min(this.y, r.y);\n var x2 = Math.max(this.x + this.width, r.x + r.width);\n var y2 = Math.max(this.y + this.height, r.y + r.height);\n return new Rect(x1, y1, x2 - x1, y2 - y1);\n },\n center: function () {\n return new Point(this.x + this.width / 2, this.y + this.height / 2);\n },\n top: function () {\n return new Point(this.x + this.width / 2, this.y);\n },\n right: function () {\n return new Point(this.x + this.width, this.y + this.height / 2);\n },\n bottom: function () {\n return new Point(this.x + this.width / 2, this.y + this.height);\n },\n left: function () {\n return new Point(this.x, this.y + this.height / 2);\n },\n topLeft: function () {\n return new Point(this.x, this.y);\n },\n topRight: function () {\n return new Point(this.x + this.width, this.y);\n },\n bottomLeft: function () {\n return new Point(this.x, this.y + this.height);\n },\n bottomRight: function () {\n return new Point(this.x + this.width, this.y + this.height);\n },\n clone: function () {\n return new Rect(this.x, this.y, this.width, this.height);\n },\n isEmpty: function () {\n return !this.width && !this.height;\n },\n equals: function (rect) {\n return this.x === rect.x && this.y === rect.y && this.width === rect.width && this.height === rect.height;\n },\n rotatedBounds: function (angle) {\n var rect = this.clone(), points = this.rotatedPoints(angle), tl = points[0], tr = points[1], br = points[2], bl = points[3];\n rect.x = Math.min(br.x, tl.x, tr.x, bl.x);\n rect.y = Math.min(br.y, tl.y, tr.y, bl.y);\n rect.width = Math.max(br.x, tl.x, tr.x, bl.x) - rect.x;\n rect.height = Math.max(br.y, tl.y, tr.y, bl.y) - rect.y;\n return rect;\n },\n rotatedPoints: function (angle) {\n var rect = this, c = rect.center(), br = rect.bottomRight().rotate(c, 360 - angle), tl = rect.topLeft().rotate(c, 360 - angle), tr = rect.topRight().rotate(c, 360 - angle), bl = rect.bottomLeft().rotate(c, 360 - angle);\n return [\n tl,\n tr,\n br,\n bl\n ];\n },\n toString: function (delimiter) {\n delimiter = delimiter || ' ';\n return this.x + delimiter + this.y + delimiter + this.width + delimiter + this.height;\n },\n scale: function (scaleX, scaleY, staicPoint, adornerCenter, angle) {\n var tl = this.topLeft();\n var thisCenter = this.center();\n tl.rotate(thisCenter, 360 - angle).rotate(adornerCenter, angle);\n var delta = staicPoint.minus(tl);\n var scaled = new Point(delta.x * scaleX, delta.y * scaleY);\n var position = delta.minus(scaled);\n tl = tl.plus(position);\n tl.rotate(adornerCenter, 360 - angle).rotate(thisCenter, angle);\n this.x = tl.x;\n this.y = tl.y;\n this.width *= scaleX;\n this.height *= scaleY;\n },\n zoom: function (zoom) {\n this.x *= zoom;\n this.y *= zoom;\n this.width *= zoom;\n this.height *= zoom;\n return this;\n },\n overlaps: function (rect) {\n var bottomRight = this.bottomRight();\n var rectBottomRight = rect.bottomRight();\n var overlaps = !(bottomRight.x < rect.x || bottomRight.y < rect.y || rectBottomRight.x < this.x || rectBottomRight.y < this.y);\n return overlaps;\n }\n });\n var Size = Class.extend({\n init: function (width, height) {\n this.width = width;\n this.height = height;\n }\n });\n Size.prototype.Empty = new Size(0, 0);\n Rect.toRect = function (rect) {\n if (!(rect instanceof Rect)) {\n rect = new Rect(rect.x, rect.y, rect.width, rect.height);\n }\n return rect;\n };\n Rect.empty = function () {\n return new Rect(0, 0, 0, 0);\n };\n Rect.fromPoints = function (p, q) {\n if (isNaN(p.x) || isNaN(p.y) || isNaN(q.x) || isNaN(q.y)) {\n throw 'Some values are NaN.';\n }\n return new Rect(Math.min(p.x, q.x), Math.min(p.y, q.y), Math.abs(p.x - q.x), Math.abs(p.y - q.y));\n };\n function isNearZero(num) {\n return Math.abs(num) < EPSILON;\n }\n function intersectLine(start1, end1, start2, end2, isSegment) {\n var tangensdiff = (end1.x - start1.x) * (end2.y - start2.y) - (end1.y - start1.y) * (end2.x - start2.x);\n if (isNearZero(tangensdiff)) {\n return;\n }\n var num1 = (start1.y - start2.y) * (end2.x - start2.x) - (start1.x - start2.x) * (end2.y - start2.y);\n var num2 = (start1.y - start2.y) * (end1.x - start1.x) - (start1.x - start2.x) * (end1.y - start1.y);\n var r = num1 / tangensdiff;\n var s = num2 / tangensdiff;\n if (isSegment && (r < 0 || r > 1 || s < 0 || s > 1)) {\n return;\n }\n return new Point(start1.x + r * (end1.x - start1.x), start1.y + r * (end1.y - start1.y));\n }\n var Intersect = {\n lines: function (start1, end1, start2, end2) {\n return intersectLine(start1, end1, start2, end2);\n },\n segments: function (start1, end1, start2, end2) {\n return intersectLine(start1, end1, start2, end2, true);\n },\n rectWithLine: function (rect, start, end) {\n return Intersect.segments(start, end, rect.topLeft(), rect.topRight()) || Intersect.segments(start, end, rect.topRight(), rect.bottomRight()) || Intersect.segments(start, end, rect.bottomLeft(), rect.bottomRight()) || Intersect.segments(start, end, rect.topLeft(), rect.bottomLeft());\n },\n rects: function (rect1, rect2, angle) {\n var tl = rect2.topLeft(), tr = rect2.topRight(), bl = rect2.bottomLeft(), br = rect2.bottomRight();\n var center = rect2.center();\n if (angle) {\n tl = tl.rotate(center, angle);\n tr = tr.rotate(center, angle);\n bl = bl.rotate(center, angle);\n br = br.rotate(center, angle);\n }\n var intersect = rect1.contains(tl) || rect1.contains(tr) || rect1.contains(bl) || rect1.contains(br) || Intersect.rectWithLine(rect1, tl, tr) || Intersect.rectWithLine(rect1, tl, bl) || Intersect.rectWithLine(rect1, tr, br) || Intersect.rectWithLine(rect1, bl, br);\n if (!intersect) {\n tl = rect1.topLeft();\n tr = rect1.topRight();\n bl = rect1.bottomLeft();\n br = rect1.bottomRight();\n if (angle) {\n var reverseAngle = 360 - angle;\n tl = tl.rotate(center, reverseAngle);\n tr = tr.rotate(center, reverseAngle);\n bl = bl.rotate(center, reverseAngle);\n br = br.rotate(center, reverseAngle);\n }\n intersect = rect2.contains(tl) || rect2.contains(tr) || rect2.contains(bl) || rect2.contains(br);\n }\n return intersect;\n }\n };\n var RectAlign = Class.extend({\n init: function (container) {\n this.container = Rect.toRect(container);\n },\n align: function (content, alignment) {\n var alignValues = alignment.toLowerCase().split(' ');\n for (var i = 0; i < alignValues.length; i++) {\n content = this._singleAlign(content, alignValues[i]);\n }\n return content;\n },\n _singleAlign: function (content, alignment) {\n if (isFunction(this[alignment])) {\n return this[alignment](content);\n } else {\n return content;\n }\n },\n left: function (content) {\n return this._align(content, this._left);\n },\n center: function (content) {\n return this._align(content, this._center);\n },\n right: function (content) {\n return this._align(content, this._right);\n },\n stretch: function (content) {\n return this._align(content, this._stretch);\n },\n top: function (content) {\n return this._align(content, this._top);\n },\n middle: function (content) {\n return this._align(content, this._middle);\n },\n bottom: function (content) {\n return this._align(content, this._bottom);\n },\n _left: function (container, content) {\n content.x = container.x;\n },\n _center: function (container, content) {\n content.x = (container.width - content.width) / 2 || 0;\n },\n _right: function (container, content) {\n content.x = container.width - content.width;\n },\n _top: function (container, content) {\n content.y = container.y;\n },\n _middle: function (container, content) {\n content.y = (container.height - content.height) / 2 || 0;\n },\n _bottom: function (container, content) {\n content.y = container.height - content.height;\n },\n _stretch: function (container, content) {\n content.x = 0;\n content.y = 0;\n content.height = container.height;\n content.width = container.width;\n },\n _align: function (content, alignCalc) {\n content = Rect.toRect(content);\n alignCalc(this.container, content);\n return content;\n }\n });\n var Polar = Class.extend({\n init: function (r, a) {\n this.r = r;\n this.angle = a;\n }\n });\n var Matrix = Class.extend({\n init: function (a, b, c, d, e, f) {\n this.a = a || 0;\n this.b = b || 0;\n this.c = c || 0;\n this.d = d || 0;\n this.e = e || 0;\n this.f = f || 0;\n },\n plus: function (m) {\n this.a += m.a;\n this.b += m.b;\n this.c += m.c;\n this.d += m.d;\n this.e += m.e;\n this.f += m.f;\n },\n minus: function (m) {\n this.a -= m.a;\n this.b -= m.b;\n this.c -= m.c;\n this.d -= m.d;\n this.e -= m.e;\n this.f -= m.f;\n },\n times: function (m) {\n return new Matrix(this.a * m.a + this.c * m.b, this.b * m.a + this.d * m.b, this.a * m.c + this.c * m.d, this.b * m.c + this.d * m.d, this.a * m.e + this.c * m.f + this.e, this.b * m.e + this.d * m.f + this.f);\n },\n apply: function (p) {\n return new Point(this.a * p.x + this.c * p.y + this.e, this.b * p.x + this.d * p.y + this.f);\n },\n applyRect: function (r) {\n return Rect.fromPoints(this.apply(r.topLeft()), this.apply(r.bottomRight()));\n },\n toString: function () {\n return 'matrix(' + this.a + ' ' + this.b + ' ' + this.c + ' ' + this.d + ' ' + this.e + ' ' + this.f + ')';\n }\n });\n deepExtend(Matrix, {\n fromSVGMatrix: function (vm) {\n var m = new Matrix();\n m.a = vm.a;\n m.b = vm.b;\n m.c = vm.c;\n m.d = vm.d;\n m.e = vm.e;\n m.f = vm.f;\n return m;\n },\n fromMatrixVector: function (v) {\n var m = new Matrix();\n m.a = v.a;\n m.b = v.b;\n m.c = v.c;\n m.d = v.d;\n m.e = v.e;\n m.f = v.f;\n return m;\n },\n fromList: function (v) {\n if (v.length !== 6) {\n throw 'The given list should consist of six elements.';\n }\n var m = new Matrix();\n m.a = v[0];\n m.b = v[1];\n m.c = v[2];\n m.d = v[3];\n m.e = v[4];\n m.f = v[5];\n return m;\n },\n translation: function (x, y) {\n var m = new Matrix();\n m.a = 1;\n m.b = 0;\n m.c = 0;\n m.d = 1;\n m.e = x;\n m.f = y;\n return m;\n },\n unit: function () {\n return new Matrix(1, 0, 0, 1, 0, 0);\n },\n rotation: function (angle, x, y) {\n var m = new Matrix();\n m.a = Math.cos(angle * Math.PI / 180);\n m.b = Math.sin(angle * Math.PI / 180);\n m.c = -m.b;\n m.d = m.a;\n m.e = x - x * m.a + y * m.b || 0;\n m.f = y - y * m.a - x * m.b || 0;\n return m;\n },\n scaling: function (scaleX, scaleY) {\n var m = new Matrix();\n m.a = scaleX;\n m.b = 0;\n m.c = 0;\n m.d = scaleY;\n m.e = 0;\n m.f = 0;\n return m;\n },\n parse: function (v) {\n var parts, nums;\n if (v) {\n v = v.trim();\n if (v.slice(0, 6).toLowerCase() === 'matrix') {\n nums = v.slice(7, v.length - 1).trim();\n parts = nums.split(',');\n if (parts.length === 6) {\n return Matrix.fromList(map(parts, function (p) {\n return parseFloat(p);\n }));\n }\n parts = nums.split(' ');\n if (parts.length === 6) {\n return Matrix.fromList(map(parts, function (p) {\n return parseFloat(p);\n }));\n }\n }\n if (v.slice(0, 1) === '(' && v.slice(v.length - 1) === ')') {\n v = v.substr(1, v.length - 1);\n }\n if (v.indexOf(',') > 0) {\n parts = v.split(',');\n if (parts.length === 6) {\n return Matrix.fromList(map(parts, function (p) {\n return parseFloat(p);\n }));\n }\n }\n if (v.indexOf(' ') > 0) {\n parts = v.split(' ');\n if (parts.length === 6) {\n return Matrix.fromList(map(parts, function (p) {\n return parseFloat(p);\n }));\n }\n }\n }\n return parts;\n }\n });\n var MatrixVector = Class.extend({\n init: function (a, b, c, d, e, f) {\n this.a = a || 0;\n this.b = b || 0;\n this.c = c || 0;\n this.d = d || 0;\n this.e = e || 0;\n this.f = f || 0;\n },\n fromMatrix: function FromMatrix(m) {\n var v = new MatrixVector();\n v.a = m.a;\n v.b = m.b;\n v.c = m.c;\n v.d = m.d;\n v.e = m.e;\n v.f = m.f;\n return v;\n }\n });\n function normalVariable(mean, deviation) {\n var x, y, r;\n do {\n x = Math.random() * 2 - 1;\n y = Math.random() * 2 - 1;\n r = x * x + y * y;\n } while (!r || r > 1);\n return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);\n }\n function randomId(length) {\n if (Utils.isUndefined(length)) {\n length = 10;\n }\n var result = '';\n var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for (var i = length; i > 0; --i) {\n result += chars.charAt(Math.round(Math.random() * (chars.length - 1)));\n }\n return result;\n }\n var Geometry = {\n _distanceToLineSquared: function (p, a, b) {\n function d2(pt1, pt2) {\n return (pt1.x - pt2.x) * (pt1.x - pt2.x) + (pt1.y - pt2.y) * (pt1.y - pt2.y);\n }\n if (a === b) {\n return d2(p, a);\n }\n var vx = b.x - a.x, vy = b.y - a.y, dot = (p.x - a.x) * vx + (p.y - a.y) * vy;\n if (dot < 0) {\n return d2(a, p);\n }\n dot = (b.x - p.x) * vx + (b.y - p.y) * vy;\n if (dot < 0) {\n return d2(b, p);\n }\n dot = (b.x - p.x) * vy - (b.y - p.y) * vx;\n return dot * dot / (vx * vx + vy * vy);\n },\n distanceToLine: function (p, a, b) {\n return Math.sqrt(this._distanceToLineSquared(p, a, b));\n },\n distanceToPolyline: function (p, points) {\n var minimum = Number.MAX_VALUE;\n if (Utils.isUndefined(points) || points.length === 0) {\n return Number.MAX_VALUE;\n }\n for (var s = 0; s < points.length - 1; s++) {\n var p1 = points[s];\n var p2 = points[s + 1];\n var d = this._distanceToLineSquared(p, p1, p2);\n if (d < minimum) {\n minimum = d;\n }\n }\n return Math.sqrt(minimum);\n }\n };\n var HashTable = kendo.Class.extend({\n init: function () {\n this._buckets = [];\n this.length = 0;\n },\n add: function (key, value) {\n var obj = this._createGetBucket(key);\n if (Utils.isDefined(value)) {\n obj.value = value;\n }\n return obj;\n },\n get: function (key) {\n if (this._bucketExists(key)) {\n return this._createGetBucket(key);\n }\n return null;\n },\n set: function (key, value) {\n this.add(key, value);\n },\n containsKey: function (key) {\n return this._bucketExists(key);\n },\n remove: function (key) {\n if (this._bucketExists(key)) {\n var hashId = this._hash(key);\n delete this._buckets[hashId];\n this.length--;\n return key;\n }\n },\n forEach: function (func) {\n var hashes = this._hashes();\n for (var i = 0, len = hashes.length; i < len; i++) {\n var hash = hashes[i];\n var bucket = this._buckets[hash];\n if (Utils.isUndefined(bucket)) {\n continue;\n }\n func(bucket);\n }\n },\n clone: function () {\n var ht = new HashTable();\n var hashes = this._hashes();\n for (var i = 0, len = hashes.length; i < len; i++) {\n var hash = hashes[i];\n var bucket = this._buckets[hash];\n if (Utils.isUndefined(bucket)) {\n continue;\n }\n ht.add(bucket.key, bucket.value);\n }\n return ht;\n },\n _hashes: function () {\n var hashes = [];\n for (var hash in this._buckets) {\n if (this._buckets.hasOwnProperty(hash)) {\n hashes.push(hash);\n }\n }\n return hashes;\n },\n _bucketExists: function (key) {\n var hashId = this._hash(key);\n return Utils.isDefined(this._buckets[hashId]);\n },\n _createGetBucket: function (key) {\n var hashId = this._hash(key);\n var bucket = this._buckets[hashId];\n if (Utils.isUndefined(bucket)) {\n bucket = { key: key };\n this._buckets[hashId] = bucket;\n this.length++;\n }\n return bucket;\n },\n _hash: function (key) {\n if (Utils.isNumber(key)) {\n return key;\n }\n if (Utils.isString(key)) {\n return this._hashString(key);\n }\n if (Utils.isObject(key)) {\n return this._objectHashId(key);\n }\n throw 'Unsupported key type.';\n },\n _hashString: function (s) {\n var result = 0;\n if (s.length === 0) {\n return result;\n }\n for (var i = 0; i < s.length; i++) {\n var ch = s.charCodeAt(i);\n result = result * 32 - result + ch;\n }\n return result;\n },\n _objectHashId: function (key) {\n var id = key._hashId;\n if (Utils.isUndefined(id)) {\n id = randomId();\n key._hashId = id;\n }\n return id;\n }\n });\n var Dictionary = kendo.Observable.extend({\n init: function (dictionary) {\n var that = this;\n kendo.Observable.fn.init.call(that);\n this._hashTable = new HashTable();\n this.length = 0;\n if (Utils.isDefined(dictionary)) {\n if ($.isArray(dictionary)) {\n for (var i = 0; i < dictionary.length; i++) {\n this.add(dictionary[i]);\n }\n } else {\n dictionary.forEach(function (k, v) {\n this.add(k, v);\n }, this);\n }\n }\n },\n add: function (key, value) {\n var entry = this._hashTable.get(key);\n if (!entry) {\n entry = this._hashTable.add(key);\n this.length++;\n this.trigger('changed');\n }\n entry.value = value;\n },\n set: function (key, value) {\n this.add(key, value);\n },\n get: function (key) {\n var entry = this._hashTable.get(key);\n if (entry) {\n return entry.value;\n }\n throw new Error('Cannot find key ' + key);\n },\n containsKey: function (key) {\n return this._hashTable.containsKey(key);\n },\n remove: function (key) {\n if (this.containsKey(key)) {\n this.trigger('changed');\n this.length--;\n return this._hashTable.remove(key);\n }\n },\n forEach: function (func, thisRef) {\n this._hashTable.forEach(function (entry) {\n func.call(thisRef, entry.key, entry.value);\n });\n },\n forEachValue: function (func, thisRef) {\n this._hashTable.forEach(function (entry) {\n func.call(thisRef, entry.value);\n });\n },\n forEachKey: function (func, thisRef) {\n this._hashTable.forEach(function (entry) {\n func.call(thisRef, entry.key);\n });\n },\n keys: function () {\n var keys = [];\n this.forEachKey(function (key) {\n keys.push(key);\n });\n return keys;\n }\n });\n var Queue = kendo.Class.extend({\n init: function () {\n this._tail = null;\n this._head = null;\n this.length = 0;\n },\n enqueue: function (value) {\n var entry = {\n value: value,\n next: null\n };\n if (!this._head) {\n this._head = entry;\n this._tail = this._head;\n } else {\n this._tail.next = entry;\n this._tail = this._tail.next;\n }\n this.length++;\n },\n dequeue: function () {\n if (this.length < 1) {\n throw new Error('The queue is empty.');\n }\n var value = this._head.value;\n this._head = this._head.next;\n this.length--;\n return value;\n },\n contains: function (item) {\n var current = this._head;\n while (current) {\n if (current.value === item) {\n return true;\n }\n current = current.next;\n }\n return false;\n }\n });\n var Set = kendo.Observable.extend({\n init: function (resource) {\n var that = this;\n kendo.Observable.fn.init.call(that);\n this._hashTable = new HashTable();\n this.length = 0;\n if (Utils.isDefined(resource)) {\n if (resource instanceof HashTable) {\n resource.forEach(function (d) {\n this.add(d);\n });\n } else if (resource instanceof Dictionary) {\n resource.forEach(function (k, v) {\n this.add({\n key: k,\n value: v\n });\n }, this);\n }\n }\n },\n contains: function (item) {\n return this._hashTable.containsKey(item);\n },\n add: function (item) {\n var entry = this._hashTable.get(item);\n if (!entry) {\n this._hashTable.add(item, item);\n this.length++;\n this.trigger('changed');\n }\n },\n get: function (item) {\n if (this.contains(item)) {\n return this._hashTable.get(item).value;\n } else {\n return null;\n }\n },\n hash: function (item) {\n return this._hashTable._hash(item);\n },\n remove: function (item) {\n if (this.contains(item)) {\n this._hashTable.remove(item);\n this.length--;\n this.trigger('changed');\n }\n },\n forEach: function (func, context) {\n this._hashTable.forEach(function (kv) {\n func(kv.value);\n }, context);\n },\n toArray: function () {\n var r = [];\n this.forEach(function (d) {\n r.push(d);\n });\n return r;\n }\n });\n var Node = kendo.Class.extend({\n init: function (id, shape) {\n this.links = [];\n this.outgoing = [];\n this.incoming = [];\n this.weight = 1;\n if (Utils.isDefined(id)) {\n this.id = id;\n } else {\n this.id = randomId();\n }\n if (Utils.isDefined(shape)) {\n this.associatedShape = shape;\n var b = shape.bounds();\n this.width = b.width;\n this.height = b.height;\n this.x = b.x;\n this.y = b.y;\n } else {\n this.associatedShape = null;\n }\n this.data = null;\n this.type = 'Node';\n this.shortForm = 'Node \\'' + this.id + '\\'';\n this.isVirtual = false;\n },\n isIsolated: function () {\n return Utils.isEmpty(this.links);\n },\n bounds: function (r) {\n if (!Utils.isDefined(r)) {\n return new diagram.Rect(this.x, this.y, this.width, this.height);\n }\n this.x = r.x;\n this.y = r.y;\n this.width = r.width;\n this.height = r.height;\n },\n isLinkedTo: function (node) {\n var that = this;\n return Utils.any(that.links, function (link) {\n return link.getComplement(that) === node;\n });\n },\n getChildren: function () {\n if (this.outgoing.length === 0) {\n return [];\n }\n var children = [];\n for (var i = 0, len = this.outgoing.length; i < len; i++) {\n var link = this.outgoing[i];\n children.push(link.getComplement(this));\n }\n return children;\n },\n getParents: function () {\n if (this.incoming.length === 0) {\n return [];\n }\n var parents = [];\n for (var i = 0, len = this.incoming.length; i < len; i++) {\n var link = this.incoming[i];\n parents.push(link.getComplement(this));\n }\n return parents;\n },\n clone: function () {\n var copy = new Node();\n if (Utils.isDefined(this.weight)) {\n copy.weight = this.weight;\n }\n if (Utils.isDefined(this.balance)) {\n copy.balance = this.balance;\n }\n if (Utils.isDefined(this.owner)) {\n copy.owner = this.owner;\n }\n copy.associatedShape = this.associatedShape;\n copy.x = this.x;\n copy.y = this.y;\n copy.width = this.width;\n copy.height = this.height;\n return copy;\n },\n adjacentTo: function (node) {\n return this.isLinkedTo(node) !== null;\n },\n removeLink: function (link) {\n if (link.source === this) {\n Utils.remove(this.links, link);\n Utils.remove(this.outgoing, link);\n link.source = null;\n }\n if (link.target === this) {\n Utils.remove(this.links, link);\n Utils.remove(this.incoming, link);\n link.target = null;\n }\n },\n hasLinkTo: function (node) {\n return Utils.any(this.outgoing, function (link) {\n return link.target === node;\n });\n },\n degree: function () {\n return this.links.length;\n },\n incidentWith: function (link) {\n return contains(this.links, link);\n },\n getLinksWith: function (node) {\n return Utils.all(this.links, function (link) {\n return link.getComplement(this) === node;\n }, this);\n },\n getNeighbors: function () {\n var neighbors = [];\n Utils.forEach(this.incoming, function (e) {\n neighbors.push(e.getComplement(this));\n }, this);\n Utils.forEach(this.outgoing, function (e) {\n neighbors.push(e.getComplement(this));\n }, this);\n return neighbors;\n }\n });\n var Link = kendo.Class.extend({\n init: function (source, target, id, connection) {\n if (Utils.isUndefined(source)) {\n throw 'The source of the new link is not set.';\n }\n if (Utils.isUndefined(target)) {\n throw 'The target of the new link is not set.';\n }\n var sourceFound, targetFound;\n if (Utils.isString(source)) {\n sourceFound = new Node(source);\n } else {\n sourceFound = source;\n }\n if (Utils.isString(target)) {\n targetFound = new Node(target);\n } else {\n targetFound = target;\n }\n this.source = sourceFound;\n this.target = targetFound;\n this.source.links.push(this);\n this.target.links.push(this);\n this.source.outgoing.push(this);\n this.target.incoming.push(this);\n if (Utils.isDefined(id)) {\n this.id = id;\n } else {\n this.id = randomId();\n }\n if (Utils.isDefined(connection)) {\n this.associatedConnection = connection;\n } else {\n this.associatedConnection = null;\n }\n this.type = 'Link';\n this.shortForm = 'Link \\'' + this.source.id + '->' + this.target.id + '\\'';\n },\n getComplement: function (node) {\n if (this.source !== node && this.target !== node) {\n throw 'The given node is not incident with this link.';\n }\n return this.source === node ? this.target : this.source;\n },\n getCommonNode: function (link) {\n if (this.source === link.source || this.source === link.target) {\n return this.source;\n }\n if (this.target === link.source || this.target === link.target) {\n return this.target;\n }\n return null;\n },\n isBridging: function (v1, v2) {\n return this.source === v1 && this.target === v2 || this.source === v2 && this.target === v1;\n },\n getNodes: function () {\n return [\n this.source,\n this.target\n ];\n },\n incidentWith: function (node) {\n return this.source === node || this.target === node;\n },\n adjacentTo: function (link) {\n return contains(this.source.links, link) || contains(this.target.links, link);\n },\n changeSource: function (node) {\n Utils.remove(this.source.links, this);\n Utils.remove(this.source.outgoing, this);\n node.links.push(this);\n node.outgoing.push(this);\n this.source = node;\n },\n changeTarget: function (node) {\n Utils.remove(this.target.links, this);\n Utils.remove(this.target.incoming, this);\n node.links.push(this);\n node.incoming.push(this);\n this.target = node;\n },\n changesNodes: function (v, w) {\n if (this.source === v) {\n this.changeSource(w);\n } else if (this.target === v) {\n this.changeTarget(w);\n }\n },\n reverse: function () {\n var oldSource = this.source;\n var oldTarget = this.target;\n this.source = oldTarget;\n Utils.remove(oldSource.outgoing, this);\n this.source.outgoing.push(this);\n this.target = oldSource;\n Utils.remove(oldTarget.incoming, this);\n this.target.incoming.push(this);\n return this;\n },\n directTo: function (target) {\n if (this.source !== target && this.target !== target) {\n throw 'The given node is not incident with this link.';\n }\n if (this.target !== target) {\n this.reverse();\n }\n },\n createReverseEdge: function () {\n var r = this.clone();\n r.reverse();\n r.reversed = true;\n return r;\n },\n clone: function () {\n var clone = new Link(this.source, this.target);\n return clone;\n }\n });\n var Graph = kendo.Class.extend({\n init: function (idOrDiagram) {\n this.links = [];\n this.nodes = [];\n this._nodeMap = new Dictionary();\n this.diagram = null;\n this._root = null;\n if (Utils.isDefined(idOrDiagram)) {\n if (Utils.isString(idOrDiagram)) {\n this.id = idOrDiagram;\n } else {\n this.diagram = idOrDiagram;\n this.id = idOrDiagram.id;\n }\n } else {\n this.id = randomId();\n }\n this.bounds = new Rect();\n this._hasCachedRelationships = false;\n this.type = 'Graph';\n },\n cacheRelationships: function (forceRebuild) {\n if (Utils.isUndefined(forceRebuild)) {\n forceRebuild = false;\n }\n if (this._hasCachedRelationships && !forceRebuild) {\n return;\n }\n for (var i = 0, len = this.nodes.length; i < len; i++) {\n var node = this.nodes[i];\n node.children = this.getChildren(node);\n node.parents = this.getParents(node);\n }\n this._hasCachedRelationships = true;\n },\n assignLevels: function (startNode, offset, visited) {\n if (!startNode) {\n throw 'Start node not specified.';\n }\n if (Utils.isUndefined(offset)) {\n offset = 0;\n }\n this.cacheRelationships();\n if (Utils.isUndefined(visited)) {\n visited = new Dictionary();\n Utils.forEach(this.nodes, function (n) {\n visited.add(n, false);\n });\n }\n visited.set(startNode, true);\n startNode.level = offset;\n var children = startNode.children;\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n if (!child || visited.get(child)) {\n continue;\n }\n this.assignLevels(child, offset + 1, visited);\n }\n },\n root: function (value) {\n if (Utils.isUndefined(value)) {\n if (!this._root) {\n var found = Utils.first(this.nodes, function (n) {\n return n.incoming.length === 0;\n });\n if (found) {\n return found;\n }\n return Utils.first(this.nodes);\n } else {\n return this._root;\n }\n } else {\n this._root = value;\n }\n },\n getConnectedComponents: function () {\n this.componentIndex = 0;\n this.setItemIndices();\n var componentId = Utils.initArray(this.nodes.length, -1);\n for (var v = 0; v < this.nodes.length; v++) {\n if (componentId[v] === -1) {\n this._collectConnectedNodes(componentId, v);\n this.componentIndex++;\n }\n }\n var components = [], i;\n for (i = 0; i < this.componentIndex; ++i) {\n components[i] = new Graph();\n }\n for (i = 0; i < componentId.length; ++i) {\n var graph = components[componentId[i]];\n graph.addNodeAndOutgoings(this.nodes[i]);\n }\n components.sort(function (a, b) {\n return b.nodes.length - a.nodes.length;\n });\n return components;\n },\n _collectConnectedNodes: function (setIds, nodeIndex) {\n setIds[nodeIndex] = this.componentIndex;\n var node = this.nodes[nodeIndex];\n Utils.forEach(node.links, function (link) {\n var next = link.getComplement(node);\n var nextId = next.index;\n if (setIds[nextId] === -1) {\n this._collectConnectedNodes(setIds, nextId);\n }\n }, this);\n },\n calcBounds: function () {\n if (this.isEmpty()) {\n this.bounds = new Rect();\n return this.bounds;\n }\n var b = null;\n for (var i = 0, len = this.nodes.length; i < len; i++) {\n var node = this.nodes[i];\n if (!b) {\n b = node.bounds();\n } else {\n b = b.union(node.bounds());\n }\n }\n this.bounds = b;\n return this.bounds;\n },\n getSpanningTree: function (root) {\n var tree = new Graph();\n var map = new Dictionary(), source, target;\n tree.root = root.clone();\n tree.root.level = 0;\n tree.root.id = root.id;\n map.add(root, tree.root);\n root.level = 0;\n var visited = [];\n var remaining = [];\n tree._addNode(tree.root);\n visited.push(root);\n remaining.push(root);\n var levelCount = 1;\n while (remaining.length > 0) {\n var next = remaining.pop();\n for (var ni = 0; ni < next.links.length; ni++) {\n var link = next.links[ni];\n var cn = link.getComplement(next);\n if (contains(visited, cn)) {\n continue;\n }\n cn.level = next.level + 1;\n if (levelCount < cn.level + 1) {\n levelCount = cn.level + 1;\n }\n if (!contains(remaining, cn)) {\n remaining.push(cn);\n }\n if (!contains(visited, cn)) {\n visited.push(cn);\n }\n if (map.containsKey(next)) {\n source = map.get(next);\n } else {\n source = next.clone();\n source.level = next.level;\n source.id = next.id;\n map.add(next, source);\n }\n if (map.containsKey(cn)) {\n target = map.get(cn);\n } else {\n target = cn.clone();\n target.level = cn.level;\n target.id = cn.id;\n map.add(cn, target);\n }\n var newLink = new Link(source, target);\n tree.addLink(newLink);\n }\n }\n var treeLevels = [];\n for (var i = 0; i < levelCount; i++) {\n treeLevels.push([]);\n }\n Utils.forEach(tree.nodes, function (node) {\n treeLevels[node.level].push(node);\n });\n tree.treeLevels = treeLevels;\n tree.cacheRelationships();\n return tree;\n },\n takeRandomNode: function (excludedNodes, incidenceLessThan) {\n if (Utils.isUndefined(excludedNodes)) {\n excludedNodes = [];\n }\n if (Utils.isUndefined(incidenceLessThan)) {\n incidenceLessThan = 4;\n }\n if (this.nodes.length === 0) {\n return null;\n }\n if (this.nodes.length === 1) {\n return contains(excludedNodes, this.nodes[0]) ? null : this.nodes[0];\n }\n var pool = $.grep(this.nodes, function (node) {\n return !contains(excludedNodes, node) && node.degree() <= incidenceLessThan;\n });\n if (Utils.isEmpty(pool)) {\n return null;\n }\n return pool[Utils.randomInteger(0, pool.length)];\n },\n isEmpty: function () {\n return Utils.isEmpty(this.nodes);\n },\n isHealthy: function () {\n return Utils.all(this.links, function (link) {\n return contains(this.nodes, link.source) && contains(this.nodes, link.target);\n }, this);\n },\n getParents: function (n) {\n if (!this.hasNode(n)) {\n throw 'The given node is not part of this graph.';\n }\n return n.getParents();\n },\n getChildren: function (n) {\n if (!this.hasNode(n)) {\n throw 'The given node is not part of this graph.';\n }\n return n.getChildren();\n },\n addLink: function (sourceOrLink, target, owner) {\n if (Utils.isUndefined(sourceOrLink)) {\n throw 'The source of the link is not defined.';\n }\n if (Utils.isUndefined(target)) {\n if (Utils.isDefined(sourceOrLink.type) && sourceOrLink.type === 'Link') {\n this.addExistingLink(sourceOrLink);\n return;\n } else {\n throw 'The target of the link is not defined.';\n }\n }\n var foundSource = this.getNode(sourceOrLink);\n if (Utils.isUndefined(foundSource)) {\n foundSource = this.addNode(sourceOrLink);\n }\n var foundTarget = this.getNode(target);\n if (Utils.isUndefined(foundTarget)) {\n foundTarget = this.addNode(target);\n }\n var newLink = new Link(foundSource, foundTarget);\n if (Utils.isDefined(owner)) {\n newLink.owner = owner;\n }\n this.links.push(newLink);\n return newLink;\n },\n removeAllLinks: function () {\n while (this.links.length > 0) {\n var link = this.links[0];\n this.removeLink(link);\n }\n },\n addExistingLink: function (link) {\n if (this.hasLink(link)) {\n return;\n }\n this.links.push(link);\n if (this.hasNode(link.source.id)) {\n var s = this.getNode(link.source.id);\n link.changeSource(s);\n } else {\n this.addNode(link.source);\n }\n if (this.hasNode(link.target.id)) {\n var t = this.getNode(link.target.id);\n link.changeTarget(t);\n } else {\n this.addNode(link.target);\n }\n },\n hasLink: function (linkOrId) {\n if (Utils.isString(linkOrId)) {\n return Utils.any(this.links, function (link) {\n return link.id === linkOrId;\n });\n }\n if (linkOrId.type === 'Link') {\n return contains(this.links, linkOrId);\n }\n throw 'The given object is neither an identifier nor a Link.';\n },\n getNode: function (nodeOrId) {\n var id = nodeOrId.id || nodeOrId;\n if (this._nodeMap.containsKey(id)) {\n return this._nodeMap.get(id);\n }\n },\n hasNode: function (nodeOrId) {\n var id = nodeOrId.id || nodeOrId;\n return this._nodeMap.containsKey(id);\n },\n _addNode: function (node) {\n this.nodes.push(node);\n this._nodeMap.add(node.id, node);\n },\n _removeNode: function (node) {\n Utils.remove(this.nodes, node);\n this._nodeMap.remove(node.id);\n },\n removeNode: function (nodeOrId) {\n var n = nodeOrId;\n if (Utils.isString(nodeOrId)) {\n n = this.getNode(nodeOrId);\n }\n if (Utils.isDefined(n)) {\n var links = n.links;\n n.links = [];\n for (var i = 0, len = links.length; i < len; i++) {\n var link = links[i];\n this.removeLink(link);\n }\n this._removeNode(n);\n } else {\n throw 'The identifier should be a Node or the Id (string) of a node.';\n }\n },\n areConnected: function (n1, n2) {\n return Utils.any(this.links, function (link) {\n return link.source == n1 && link.target == n2 || link.source == n2 && link.target == n1;\n });\n },\n removeLink: function (link) {\n Utils.remove(this.links, link);\n Utils.remove(link.source.outgoing, link);\n Utils.remove(link.source.links, link);\n Utils.remove(link.target.incoming, link);\n Utils.remove(link.target.links, link);\n },\n addNode: function (nodeOrId, layoutRect, owner) {\n var newNode = null;\n if (!Utils.isDefined(nodeOrId)) {\n throw 'No Node or identifier for a new Node is given.';\n }\n if (Utils.isString(nodeOrId)) {\n if (this.hasNode(nodeOrId)) {\n return this.getNode(nodeOrId);\n }\n newNode = new Node(nodeOrId);\n } else {\n if (this.hasNode(nodeOrId)) {\n return this.getNode(nodeOrId);\n }\n newNode = nodeOrId;\n }\n if (Utils.isDefined(layoutRect)) {\n newNode.bounds(layoutRect);\n }\n if (Utils.isDefined(owner)) {\n newNode.owner = owner;\n }\n this._addNode(newNode);\n return newNode;\n },\n addNodeAndOutgoings: function (node) {\n if (!this.hasNode(node)) {\n this._addNode(node);\n }\n var newLinks = node.outgoing;\n node.outgoing = [];\n Utils.forEach(newLinks, function (link) {\n this.addExistingLink(link);\n }, this);\n },\n setItemIndices: function () {\n var i;\n for (i = 0; i < this.nodes.length; ++i) {\n this.nodes[i].index = i;\n }\n for (i = 0; i < this.links.length; ++i) {\n this.links[i].index = i;\n }\n },\n clone: function (saveMapping) {\n var copy = new Graph();\n var save = Utils.isDefined(saveMapping) && saveMapping === true;\n if (save) {\n copy.nodeMap = new Dictionary();\n copy.linkMap = new Dictionary();\n }\n var map = new Dictionary();\n Utils.forEach(this.nodes, function (nOriginal) {\n var nCopy = nOriginal.clone();\n map.set(nOriginal, nCopy);\n copy._addNode(nCopy);\n if (save) {\n copy.nodeMap.set(nCopy, nOriginal);\n }\n });\n Utils.forEach(this.links, function (linkOriginal) {\n if (map.containsKey(linkOriginal.source) && map.containsKey(linkOriginal.target)) {\n var linkCopy = copy.addLink(map.get(linkOriginal.source), map.get(linkOriginal.target));\n if (save) {\n copy.linkMap.set(linkCopy, linkOriginal);\n }\n }\n });\n return copy;\n },\n linearize: function (addIds) {\n return Graph.Utils.linearize(this, addIds);\n },\n depthFirstTraversal: function (startNode, action) {\n if (Utils.isUndefined(startNode)) {\n throw 'You need to supply a starting node.';\n }\n if (Utils.isUndefined(action)) {\n throw 'You need to supply an action.';\n }\n if (!this.hasNode(startNode)) {\n throw 'The given start-node is not part of this graph';\n }\n var foundNode = this.getNode(startNode);\n var visited = [];\n this._dftIterator(foundNode, action, visited);\n },\n _dftIterator: function (node, action, visited) {\n action(node);\n visited.push(node);\n var children = node.getChildren();\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n if (contains(visited, child)) {\n continue;\n }\n this._dftIterator(child, action, visited);\n }\n },\n breadthFirstTraversal: function (startNode, action) {\n if (Utils.isUndefined(startNode)) {\n throw 'You need to supply a starting node.';\n }\n if (Utils.isUndefined(action)) {\n throw 'You need to supply an action.';\n }\n if (!this.hasNode(startNode)) {\n throw 'The given start-node is not part of this graph';\n }\n var foundNode = this.getNode(startNode);\n var queue = new Queue();\n var visited = [];\n queue.enqueue(foundNode);\n while (queue.length > 0) {\n var node = queue.dequeue();\n action(node);\n visited.push(node);\n var children = node.getChildren();\n for (var i = 0, len = children.length; i < len; i++) {\n var child = children[i];\n if (contains(visited, child) || contains(queue, child)) {\n continue;\n }\n queue.enqueue(child);\n }\n }\n },\n _stronglyConnectedComponents: function (excludeSingleItems, node, indices, lowLinks, connected, stack, index) {\n indices.add(node, index);\n lowLinks.add(node, index);\n index++;\n stack.push(node);\n var children = node.getChildren(), next;\n for (var i = 0, len = children.length; i < len; i++) {\n next = children[i];\n if (!indices.containsKey(next)) {\n this._stronglyConnectedComponents(excludeSingleItems, next, indices, lowLinks, connected, stack, index);\n lowLinks.add(node, Math.min(lowLinks.get(node), lowLinks.get(next)));\n } else if (contains(stack, next)) {\n lowLinks.add(node, Math.min(lowLinks.get(node), indices.get(next)));\n }\n }\n if (lowLinks.get(node) === indices.get(node)) {\n var component = [];\n do {\n next = stack.pop();\n component.push(next);\n } while (next !== node);\n if (!excludeSingleItems || component.length > 1) {\n connected.push(component);\n }\n }\n },\n findCycles: function (excludeSingleItems) {\n if (Utils.isUndefined(excludeSingleItems)) {\n excludeSingleItems = true;\n }\n var indices = new Dictionary();\n var lowLinks = new Dictionary();\n var connected = [];\n var stack = [];\n for (var i = 0, len = this.nodes.length; i < len; i++) {\n var node = this.nodes[i];\n if (indices.containsKey(node)) {\n continue;\n }\n this._stronglyConnectedComponents(excludeSingleItems, node, indices, lowLinks, connected, stack, 0);\n }\n return connected;\n },\n isAcyclic: function () {\n return Utils.isEmpty(this.findCycles());\n },\n isSubGraph: function (other) {\n var otherArray = other.linearize();\n var thisArray = this.linearize();\n return Utils.all(otherArray, function (s) {\n return contains(thisArray, s);\n });\n },\n makeAcyclic: function () {\n if (this.isEmpty() || this.nodes.length <= 1 || this.links.length <= 1) {\n return [];\n }\n if (this.nodes.length == 2) {\n var result = [];\n if (this.links.length > 1) {\n var oneLink = this.links[0];\n var oneNode = oneLink.source;\n for (var i = 0, len = this.links.length; i < len; i++) {\n var link = this.links[i];\n if (link.source == oneNode) {\n continue;\n }\n var rev = link.reverse();\n result.push(rev);\n }\n }\n return result;\n }\n var copy = this.clone(true);\n var N = this.nodes.length;\n var intensityCatalog = new Dictionary();\n var flowIntensity = function (node) {\n if (node.outgoing.length === 0) {\n return 2 - N;\n } else if (node.incoming.length === 0) {\n return N - 2;\n } else {\n return node.outgoing.length - node.incoming.length;\n }\n };\n var catalogEqualIntensity = function (node, intensityCatalog) {\n var intensity = flowIntensity(node, N);\n if (!intensityCatalog.containsKey(intensity)) {\n intensityCatalog.set(intensity, []);\n }\n intensityCatalog.get(intensity).push(node);\n };\n Utils.forEach(copy.nodes, function (v) {\n catalogEqualIntensity(v, intensityCatalog);\n });\n var sourceStack = [];\n var targetStack = [];\n while (copy.nodes.length > 0) {\n var source, target, intensity;\n if (intensityCatalog.containsKey(2 - N)) {\n var targets = intensityCatalog.get(2 - N);\n while (targets.length > 0) {\n target = targets.pop();\n for (var li = 0; li < target.links.length; li++) {\n var targetLink = target.links[li];\n source = targetLink.getComplement(target);\n intensity = flowIntensity(source, N);\n Utils.remove(intensityCatalog.get(intensity), source);\n source.removeLink(targetLink);\n catalogEqualIntensity(source, intensityCatalog);\n }\n copy._removeNode(target);\n targetStack.unshift(target);\n }\n }\n if (intensityCatalog.containsKey(N - 2)) {\n var sources = intensityCatalog.get(N - 2);\n while (sources.length > 0) {\n source = sources.pop();\n for (var si = 0; si < source.links.length; si++) {\n var sourceLink = source.links[si];\n target = sourceLink.getComplement(source);\n intensity = flowIntensity(target, N);\n Utils.remove(intensityCatalog.get(intensity), target);\n target.removeLink(sourceLink);\n catalogEqualIntensity(target, intensityCatalog);\n }\n sourceStack.push(source);\n copy._removeNode(source);\n }\n }\n if (copy.nodes.length > 0) {\n for (var k = N - 3; k > 2 - N; k--) {\n if (intensityCatalog.containsKey(k) && intensityCatalog.get(k).length > 0) {\n var maxdiff = intensityCatalog.get(k);\n var v = maxdiff.pop();\n for (var ri = 0; ri < v.links.length; ri++) {\n var ril = v.links[ri];\n var u = ril.getComplement(v);\n intensity = flowIntensity(u, N);\n Utils.remove(intensityCatalog.get(intensity), u);\n u.removeLink(ril);\n catalogEqualIntensity(u, intensityCatalog);\n }\n sourceStack.push(v);\n copy._removeNode(v);\n break;\n }\n }\n }\n }\n sourceStack = sourceStack.concat(targetStack);\n var vertexOrder = new Dictionary();\n for (var kk = 0; kk < this.nodes.length; kk++) {\n vertexOrder.set(copy.nodeMap.get(sourceStack[kk]), kk);\n }\n var reversedEdges = [];\n Utils.forEach(this.links, function (link) {\n if (vertexOrder.get(link.source) > vertexOrder.get(link.target)) {\n link.reverse();\n reversedEdges.push(link);\n }\n });\n return reversedEdges;\n }\n });\n Graph.Predefined = {\n EightGraph: function () {\n return Graph.Utils.parse([\n '1->2',\n '2->3',\n '3->4',\n '4->1',\n '3->5',\n '5->6',\n '6->7',\n '7->3'\n ]);\n },\n Mindmap: function () {\n return Graph.Utils.parse([\n '0->1',\n '0->2',\n '0->3',\n '0->4',\n '0->5',\n '1->6',\n '1->7',\n '7->8',\n '2->9',\n '9->10',\n '9->11',\n '3->12',\n '12->13',\n '13->14',\n '4->15',\n '4->16',\n '15->17',\n '15->18',\n '18->19',\n '18->20',\n '14->21',\n '14->22',\n '5->23',\n '23->24',\n '23->25',\n '6->26'\n ]);\n },\n ThreeGraph: function () {\n return Graph.Utils.parse([\n '1->2',\n '2->3',\n '3->1'\n ]);\n },\n BinaryTree: function (levels) {\n if (Utils.isUndefined(levels)) {\n levels = 5;\n }\n return Graph.Utils.createBalancedTree(levels, 2);\n },\n Linear: function (length) {\n if (Utils.isUndefined(length)) {\n length = 10;\n }\n return Graph.Utils.createBalancedTree(length, 1);\n },\n Tree: function (levels, siblingsCount) {\n return Graph.Utils.createBalancedTree(levels, siblingsCount);\n },\n Forest: function (levels, siblingsCount, trees) {\n return Graph.Utils.createBalancedForest(levels, siblingsCount, trees);\n },\n Workflow: function () {\n return Graph.Utils.parse([\n '0->1',\n '1->2',\n '2->3',\n '1->4',\n '4->3',\n '3->5',\n '5->6',\n '6->3',\n '6->7',\n '5->4'\n ]);\n },\n Grid: function (n, m) {\n var g = new diagram.Graph();\n if (n <= 0 && m <= 0) {\n return g;\n }\n for (var i = 0; i < n + 1; i++) {\n var previous = null;\n for (var j = 0; j < m + 1; j++) {\n var node = new Node(i.toString() + '.' + j.toString());\n g.addNode(node);\n if (previous) {\n g.addLink(previous, node);\n }\n if (i > 0) {\n var left = g.getNode((i - 1).toString() + '.' + j.toString());\n g.addLink(left, node);\n }\n previous = node;\n }\n }\n return g;\n }\n };\n Graph.Utils = {\n parse: function (graphString) {\n var previousLink, graph = new diagram.Graph(), parts = graphString.slice();\n for (var i = 0, len = parts.length; i < len; i++) {\n var part = parts[i];\n if (Utils.isString(part)) {\n if (part.indexOf('->') < 0) {\n throw 'The link should be specified as \\'a->b\\'.';\n }\n var p = part.split('->');\n if (p.length != 2) {\n throw 'The link should be specified as \\'a->b\\'.';\n }\n previousLink = new Link(p[0], p[1]);\n graph.addLink(previousLink);\n }\n if (Utils.isObject(part)) {\n if (!previousLink) {\n throw 'Specification found before Link definition.';\n }\n kendo.deepExtend(previousLink, part);\n }\n }\n return graph;\n },\n linearize: function (graph, addIds) {\n if (Utils.isUndefined(graph)) {\n throw 'Expected an instance of a Graph object in slot one.';\n }\n if (Utils.isUndefined(addIds)) {\n addIds = false;\n }\n var lin = [];\n for (var i = 0, len = graph.links.length; i < len; i++) {\n var link = graph.links[i];\n lin.push(link.source.id + '->' + link.target.id);\n if (addIds) {\n lin.push({ id: link.id });\n }\n }\n return lin;\n },\n _addShape: function (kendoDiagram, p, id, shapeDefaults) {\n if (Utils.isUndefined(p)) {\n p = new diagram.Point(0, 0);\n }\n if (Utils.isUndefined(id)) {\n id = randomId();\n }\n shapeDefaults = kendo.deepExtend({\n width: 20,\n height: 20,\n id: id,\n radius: 10,\n fill: '#778899',\n data: 'circle',\n undoable: false,\n x: p.x,\n y: p.y\n }, shapeDefaults);\n return kendoDiagram.addShape(shapeDefaults);\n },\n _addConnection: function (diagram, from, to, options) {\n return diagram.connect(from, to, options);\n },\n createDiagramFromGraph: function (diagram, graph, doLayout, randomSize) {\n if (Utils.isUndefined(diagram)) {\n throw 'The diagram surface is undefined.';\n }\n if (Utils.isUndefined(graph)) {\n throw 'No graph specification defined.';\n }\n if (Utils.isUndefined(doLayout)) {\n doLayout = true;\n }\n if (Utils.isUndefined(randomSize)) {\n randomSize = false;\n }\n var width = diagram.element.clientWidth || 200;\n var height = diagram.element.clientHeight || 200;\n var map = [], node, shape;\n for (var i = 0, len = graph.nodes.length; i < len; i++) {\n node = graph.nodes[i];\n var p = node.position;\n if (Utils.isUndefined(p)) {\n if (Utils.isDefined(node.x) && Utils.isDefined(node.y)) {\n p = new Point(node.x, node.y);\n } else {\n p = new Point(Utils.randomInteger(10, width - 20), Utils.randomInteger(10, height - 20));\n }\n }\n var opt = {};\n if (node.id === '0') {\n } else if (randomSize) {\n kendo.deepExtend(opt, {\n width: Math.random() * 150 + 20,\n height: Math.random() * 80 + 50,\n data: 'rectangle',\n fill: { color: '#778899' }\n });\n }\n shape = this._addShape(diagram, p, node.id, opt);\n var bounds = shape.bounds();\n if (Utils.isDefined(bounds)) {\n node.x = bounds.x;\n node.y = bounds.y;\n node.width = bounds.width;\n node.height = bounds.height;\n }\n map[node.id] = shape;\n }\n for (var gli = 0; gli < graph.links.length; gli++) {\n var link = graph.links[gli];\n var sourceShape = map[link.source.id];\n if (Utils.isUndefined(sourceShape)) {\n continue;\n }\n var targetShape = map[link.target.id];\n if (Utils.isUndefined(targetShape)) {\n continue;\n }\n this._addConnection(diagram, sourceShape, targetShape, { id: link.id });\n }\n if (doLayout) {\n var l = new diagram.SpringLayout(diagram);\n l.layoutGraph(graph, { limitToView: false });\n for (var shi = 0; shi < graph.nodes.length; shi++) {\n node = graph.nodes[shi];\n shape = map[node.id];\n shape.bounds(new Rect(node.x, node.y, node.width, node.height));\n }\n }\n },\n createBalancedTree: function (levels, siblingsCount) {\n if (Utils.isUndefined(levels)) {\n levels = 3;\n }\n if (Utils.isUndefined(siblingsCount)) {\n siblingsCount = 3;\n }\n var g = new diagram.Graph(), counter = -1, lastAdded = [], news;\n if (levels <= 0 || siblingsCount <= 0) {\n return g;\n }\n var root = new Node((++counter).toString());\n g.addNode(root);\n g.root = root;\n lastAdded.push(root);\n for (var i = 0; i < levels; i++) {\n news = [];\n for (var j = 0; j < lastAdded.length; j++) {\n var parent = lastAdded[j];\n for (var k = 0; k < siblingsCount; k++) {\n var item = new Node((++counter).toString());\n g.addLink(parent, item);\n news.push(item);\n }\n }\n lastAdded = news;\n }\n return g;\n },\n createBalancedForest: function (levels, siblingsCount, treeCount) {\n if (Utils.isUndefined(levels)) {\n levels = 3;\n }\n if (Utils.isUndefined(siblingsCount)) {\n siblingsCount = 3;\n }\n if (Utils.isUndefined(treeCount)) {\n treeCount = 5;\n }\n var g = new diagram.Graph(), counter = -1, lastAdded = [], news;\n if (levels <= 0 || siblingsCount <= 0 || treeCount <= 0) {\n return g;\n }\n for (var t = 0; t < treeCount; t++) {\n var root = new Node((++counter).toString());\n g.addNode(root);\n lastAdded = [root];\n for (var i = 0; i < levels; i++) {\n news = [];\n for (var j = 0; j < lastAdded.length; j++) {\n var parent = lastAdded[j];\n for (var k = 0; k < siblingsCount; k++) {\n var item = new Node((++counter).toString());\n g.addLink(parent, item);\n news.push(item);\n }\n }\n lastAdded = news;\n }\n }\n return g;\n },\n createRandomConnectedGraph: function (nodeCount, maxIncidence, isTree) {\n if (Utils.isUndefined(nodeCount)) {\n nodeCount = 40;\n }\n if (Utils.isUndefined(maxIncidence)) {\n maxIncidence = 4;\n }\n if (Utils.isUndefined(isTree)) {\n isTree = false;\n }\n var g = new diagram.Graph(), counter = -1;\n if (nodeCount <= 0) {\n return g;\n }\n var root = new Node((++counter).toString());\n g.addNode(root);\n if (nodeCount === 1) {\n return g;\n }\n if (nodeCount > 1) {\n for (var i = 1; i < nodeCount; i++) {\n var poolNode = g.takeRandomNode([], maxIncidence);\n if (!poolNode) {\n break;\n }\n var newNode = g.addNode(i.toString());\n g.addLink(poolNode, newNode);\n }\n if (!isTree && nodeCount > 1) {\n var randomAdditions = Utils.randomInteger(1, nodeCount);\n for (var ri = 0; ri < randomAdditions; ri++) {\n var n1 = g.takeRandomNode([], maxIncidence);\n var n2 = g.takeRandomNode([], maxIncidence);\n if (n1 && n2 && !g.areConnected(n1, n2)) {\n g.addLink(n1, n2);\n }\n }\n }\n return g;\n }\n },\n randomDiagram: function (diagram, shapeCount, maxIncidence, isTree, randomSize) {\n var g = kendo.dataviz.diagram.Graph.Utils.createRandomConnectedGraph(shapeCount, maxIncidence, isTree);\n Graph.Utils.createDiagramFromGraph(diagram, g, false, randomSize);\n }\n };\n kendo.deepExtend(diagram, {\n init: function (element) {\n kendo.init(element, diagram.ui);\n },\n Point: Point,\n Intersect: Intersect,\n Geometry: Geometry,\n Rect: Rect,\n Size: Size,\n RectAlign: RectAlign,\n Matrix: Matrix,\n MatrixVector: MatrixVector,\n normalVariable: normalVariable,\n randomId: randomId,\n Dictionary: Dictionary,\n HashTable: HashTable,\n Queue: Queue,\n Set: Set,\n Node: Node,\n Link: Link,\n Graph: Graph,\n PathDefiner: PathDefiner\n });\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/svg', [\n 'kendo.drawing',\n 'dataviz/diagram/math'\n ], f);\n}(function () {\n (function ($, undefined) {\n var kendo = window.kendo, diagram = kendo.dataviz.diagram, Class = kendo.Class, deepExtend = kendo.deepExtend, Point = diagram.Point, Rect = diagram.Rect, Matrix = diagram.Matrix, Utils = diagram.Utils, isNumber = Utils.isNumber, isString = Utils.isString, MatrixVector = diagram.MatrixVector, g = kendo.geometry, d = kendo.drawing, defined = kendo.util.defined, inArray = $.inArray;\n var TRANSPARENT = 'transparent', Markers = {\n none: 'none',\n arrowStart: 'ArrowStart',\n filledCircle: 'FilledCircle',\n arrowEnd: 'ArrowEnd'\n }, FULL_CIRCLE_ANGLE = 360, START = 'start', END = 'end', WIDTH = 'width', HEIGHT = 'height', X = 'x', Y = 'y';\n diagram.Markers = Markers;\n function diffNumericOptions(options, fields) {\n var elementOptions = this.options;\n var hasChanges = false;\n var value, field;\n for (var i = 0; i < fields.length; i++) {\n field = fields[i];\n value = options[field];\n if (isNumber(value) && elementOptions[field] !== value) {\n elementOptions[field] = value;\n hasChanges = true;\n }\n }\n return hasChanges;\n }\n var Scale = Class.extend({\n init: function (x, y) {\n this.x = x;\n this.y = y;\n },\n toMatrix: function () {\n return Matrix.scaling(this.x, this.y);\n },\n toString: function () {\n return kendo.format('scale({0},{1})', this.x, this.y);\n },\n invert: function () {\n return new Scale(1 / this.x, 1 / this.y);\n }\n });\n var Translation = Class.extend({\n init: function (x, y) {\n this.x = x;\n this.y = y;\n },\n toMatrixVector: function () {\n return new MatrixVector(0, 0, 0, 0, this.x, this.y);\n },\n toMatrix: function () {\n return Matrix.translation(this.x, this.y);\n },\n toString: function () {\n return kendo.format('translate({0},{1})', this.x, this.y);\n },\n plus: function (delta) {\n this.x += delta.x;\n this.y += delta.y;\n },\n times: function (factor) {\n this.x *= factor;\n this.y *= factor;\n },\n length: function () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n normalize: function () {\n if (this.Length === 0) {\n return;\n }\n this.times(1 / this.length());\n },\n invert: function () {\n return new Translation(-this.x, -this.y);\n }\n });\n var Rotation = Class.extend({\n init: function (angle, x, y) {\n this.x = x || 0;\n this.y = y || 0;\n this.angle = angle;\n },\n toString: function () {\n if (this.x && this.y) {\n return kendo.format('rotate({0},{1},{2})', this.angle, this.x, this.y);\n } else {\n return kendo.format('rotate({0})', this.angle);\n }\n },\n toMatrix: function () {\n return Matrix.rotation(this.angle, this.x, this.y);\n },\n center: function () {\n return new Point(this.x, this.y);\n },\n invert: function () {\n return new Rotation(FULL_CIRCLE_ANGLE - this.angle, this.x, this.y);\n }\n });\n Rotation.ZERO = new Rotation(0);\n Rotation.create = function (rotation) {\n return new Rotation(rotation.angle, rotation.x, rotation.y);\n };\n Rotation.parse = function (str) {\n var values = str.slice(1, str.length - 1).split(','), angle = values[0], x = values[1], y = values[2];\n var rotation = new Rotation(angle, x, y);\n return rotation;\n };\n var CompositeTransform = Class.extend({\n init: function (x, y, scaleX, scaleY, angle, center) {\n this.translate = new Translation(x, y);\n if (scaleX !== undefined && scaleY !== undefined) {\n this.scale = new Scale(scaleX, scaleY);\n }\n if (angle !== undefined) {\n this.rotate = center ? new Rotation(angle, center.x, center.y) : new Rotation(angle);\n }\n },\n toString: function () {\n var toString = function (transform) {\n return transform ? transform.toString() : '';\n };\n return toString(this.translate) + toString(this.rotate) + toString(this.scale);\n },\n render: function (visual) {\n visual._transform = this;\n visual._renderTransform();\n },\n toMatrix: function () {\n var m = Matrix.unit();\n if (this.translate) {\n m = m.times(this.translate.toMatrix());\n }\n if (this.rotate) {\n m = m.times(this.rotate.toMatrix());\n }\n if (this.scale) {\n m = m.times(this.scale.toMatrix());\n }\n return m;\n },\n invert: function () {\n var rotate = this.rotate ? this.rotate.invert() : undefined, rotateMatrix = rotate ? rotate.toMatrix() : Matrix.unit(), scale = this.scale ? this.scale.invert() : undefined, scaleMatrix = scale ? scale.toMatrix() : Matrix.unit();\n var translatePoint = new Point(-this.translate.x, -this.translate.y);\n translatePoint = rotateMatrix.times(scaleMatrix).apply(translatePoint);\n var translate = new Translation(translatePoint.x, translatePoint.y);\n var transform = new CompositeTransform();\n transform.translate = translate;\n transform.rotate = rotate;\n transform.scale = scale;\n return transform;\n }\n });\n var AutoSizeableMixin = {\n _setScale: function () {\n var options = this.options;\n var originWidth = this._originWidth;\n var originHeight = this._originHeight;\n var scaleX = options.width / originWidth;\n var scaleY = options.height / originHeight;\n if (!isNumber(scaleX)) {\n scaleX = 1;\n }\n if (!isNumber(scaleY)) {\n scaleY = 1;\n }\n this._transform.scale = new Scale(scaleX, scaleY);\n },\n _setTranslate: function () {\n var options = this.options;\n var x = options.x || 0;\n var y = options.y || 0;\n this._transform.translate = new Translation(x, y);\n },\n _initSize: function () {\n var options = this.options;\n var transform = false;\n if (options.autoSize !== false && (defined(options.width) || defined(options.height))) {\n this._measure(true);\n this._setScale();\n transform = true;\n }\n if (defined(options.x) || defined(options.y)) {\n this._setTranslate();\n transform = true;\n }\n if (transform) {\n this._renderTransform();\n }\n },\n _updateSize: function (options) {\n var update = false;\n if (this.options.autoSize !== false && this._diffNumericOptions(options, [\n WIDTH,\n HEIGHT\n ])) {\n update = true;\n this._measure(true);\n this._setScale();\n }\n if (this._diffNumericOptions(options, [\n X,\n Y\n ])) {\n update = true;\n this._setTranslate();\n }\n if (update) {\n this._renderTransform();\n }\n return update;\n }\n };\n var Element = Class.extend({\n init: function (options) {\n var element = this;\n element.options = deepExtend({}, element.options, options);\n element.id = element.options.id;\n element._originSize = Rect.empty();\n element._transform = new CompositeTransform();\n },\n visible: function (value) {\n return this.drawingContainer().visible(value);\n },\n redraw: function (options) {\n if (options && options.id) {\n this.id = options.id;\n }\n },\n position: function (x, y) {\n var options = this.options;\n if (!defined(x)) {\n return new Point(options.x, options.y);\n }\n if (defined(y)) {\n options.x = x;\n options.y = y;\n } else if (x instanceof Point) {\n options.x = x.x;\n options.y = x.y;\n }\n this._transform.translate = new Translation(options.x, options.y);\n this._renderTransform();\n },\n rotate: function (angle, center) {\n if (defined(angle)) {\n this._transform.rotate = new Rotation(angle, center.x, center.y);\n this._renderTransform();\n }\n return this._transform.rotate || Rotation.ZERO;\n },\n drawingContainer: function () {\n return this.drawingElement;\n },\n _renderTransform: function () {\n var matrix = this._transform.toMatrix();\n this.drawingContainer().transform(new g.Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f));\n },\n _hover: function () {\n },\n _diffNumericOptions: diffNumericOptions,\n _measure: function (force) {\n var rect;\n if (!this._measured || force) {\n var box = this._boundingBox() || new g.Rect();\n var startPoint = box.topLeft();\n rect = new Rect(startPoint.x, startPoint.y, box.width(), box.height());\n this._originSize = rect;\n this._originWidth = rect.width;\n this._originHeight = rect.height;\n this._measured = true;\n } else {\n rect = this._originSize;\n }\n return rect;\n },\n _boundingBox: function () {\n return this.drawingElement.rawBBox();\n }\n });\n var VisualBase = Element.extend({\n init: function (options) {\n Element.fn.init.call(this, options);\n options = this.options;\n options.fill = normalizeDrawingOptions(options.fill);\n options.stroke = normalizeDrawingOptions(options.stroke);\n },\n options: {\n stroke: {\n color: 'gray',\n width: 1\n },\n fill: { color: TRANSPARENT }\n },\n fill: function (color, opacity) {\n this._fill({\n color: getColor(color),\n opacity: opacity\n });\n },\n stroke: function (color, width, opacity) {\n this._stroke({\n color: getColor(color),\n width: width,\n opacity: opacity\n });\n },\n redraw: function (options) {\n if (options) {\n var stroke = options.stroke;\n var fill = options.fill;\n if (stroke) {\n this._stroke(normalizeDrawingOptions(stroke));\n }\n if (fill) {\n this._fill(normalizeDrawingOptions(fill));\n }\n Element.fn.redraw.call(this, options);\n }\n },\n _hover: function (show) {\n var drawingElement = this.drawingElement;\n var options = this.options;\n var hover = options.hover;\n if (hover && hover.fill) {\n var fill = show ? normalizeDrawingOptions(hover.fill) : options.fill;\n drawingElement.fill(fill.color, fill.opacity);\n }\n },\n _stroke: function (strokeOptions) {\n var options = this.options;\n deepExtend(options, { stroke: strokeOptions });\n strokeOptions = options.stroke;\n var stroke = null;\n if (strokeOptions.width > 0) {\n stroke = {\n color: strokeOptions.color,\n width: strokeOptions.width,\n opacity: strokeOptions.opacity,\n dashType: strokeOptions.dashType\n };\n }\n this.drawingElement.options.set('stroke', stroke);\n },\n _fill: function (fillOptions) {\n var options = this.options;\n deepExtend(options, { fill: fillOptions || {} });\n var fill = options.fill;\n if (fill.gradient) {\n var gradient = fill.gradient;\n var GradientClass = gradient.type === 'radial' ? d.RadialGradient : d.LinearGradient;\n this.drawingElement.fill(new GradientClass(gradient));\n } else {\n this.drawingElement.fill(fill.color, fill.opacity);\n }\n }\n });\n var TextBlock = VisualBase.extend({\n init: function (options) {\n options = this._textColor(options);\n VisualBase.fn.init.call(this, options);\n this._font();\n this._initText();\n this._initSize();\n },\n options: {\n fontSize: 15,\n fontFamily: 'sans-serif',\n stroke: { width: 0 },\n fill: { color: 'black' },\n autoSize: true\n },\n _initText: function () {\n var options = this.options;\n this.drawingElement = new d.Text(defined(options.text) ? options.text : '', new g.Point(), { font: options.font });\n this._fill();\n this._stroke();\n },\n _textColor: function (options) {\n if (options && options.color) {\n options = deepExtend({}, options, { fill: { color: options.color } });\n }\n return options;\n },\n _font: function () {\n var options = this.options;\n if (options.fontFamily && defined(options.fontSize)) {\n var fontOptions = [];\n if (options.fontStyle) {\n fontOptions.push(options.fontStyle);\n }\n if (options.fontWeight) {\n fontOptions.push(options.fontWeight);\n }\n fontOptions.push(options.fontSize + (isNumber(options.fontSize) ? 'px' : ''));\n fontOptions.push(options.fontFamily);\n options.font = fontOptions.join(' ');\n } else {\n delete options.font;\n }\n },\n content: function (text) {\n return this.drawingElement.content(text);\n },\n redraw: function (options) {\n if (options) {\n var sizeChanged = false;\n var textOptions = this.options;\n options = this._textColor(options);\n VisualBase.fn.redraw.call(this, options);\n if (options.fontFamily || defined(options.fontSize) || options.fontStyle || options.fontWeight) {\n deepExtend(textOptions, {\n fontFamily: options.fontFamily,\n fontSize: options.fontSize,\n fontStyle: options.fontStyle,\n fontWeight: options.fontWeight\n });\n this._font();\n this.drawingElement.options.set('font', textOptions.font);\n sizeChanged = true;\n }\n if (options.text) {\n this.content(options.text);\n sizeChanged = true;\n }\n if (!this._updateSize(options) && sizeChanged) {\n this._initSize();\n }\n }\n }\n });\n deepExtend(TextBlock.fn, AutoSizeableMixin);\n var Rectangle = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n this._initPath();\n this._setPosition();\n },\n _setPosition: function () {\n var options = this.options;\n var x = options.x;\n var y = options.y;\n if (defined(x) || defined(y)) {\n this.position(x || 0, y || 0);\n }\n },\n redraw: function (options) {\n if (options) {\n VisualBase.fn.redraw.call(this, options);\n if (this._diffNumericOptions(options, [\n WIDTH,\n HEIGHT\n ])) {\n this._drawPath();\n }\n if (this._diffNumericOptions(options, [\n X,\n Y\n ])) {\n this._setPosition();\n }\n }\n },\n _initPath: function () {\n var options = this.options;\n this.drawingElement = new d.Path({\n stroke: options.stroke,\n closed: true\n });\n this._fill();\n this._drawPath();\n },\n _drawPath: function () {\n var drawingElement = this.drawingElement;\n var sizeOptions = sizeOptionsOrDefault(this.options);\n var width = sizeOptions.width;\n var height = sizeOptions.height;\n drawingElement.segments.elements([\n createSegment(0, 0),\n createSegment(width, 0),\n createSegment(width, height),\n createSegment(0, height)\n ]);\n }\n });\n var MarkerBase = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n var anchor = this.options.anchor;\n this.anchor = new g.Point(anchor.x, anchor.y);\n this.createElement();\n },\n options: {\n stroke: {\n color: TRANSPARENT,\n width: 0\n },\n fill: { color: 'black' }\n },\n _transformToPath: function (point, path) {\n var transform = path.transform();\n if (point && transform) {\n point = point.transformCopy(transform);\n }\n return point;\n },\n redraw: function (options) {\n if (options) {\n if (options.position) {\n this.options.position = options.position;\n }\n VisualBase.fn.redraw.call(this, options);\n }\n }\n });\n var CircleMarker = MarkerBase.extend({\n options: {\n radius: 4,\n anchor: {\n x: 0,\n y: 0\n }\n },\n createElement: function () {\n var options = this.options;\n this.drawingElement = new d.Circle(new g.Circle(this.anchor, options.radius), {\n fill: options.fill,\n stroke: options.stroke\n });\n },\n positionMarker: function (path) {\n var options = this.options;\n var position = options.position;\n var segments = path.segments;\n var targetSegment;\n var point;\n if (position == START) {\n targetSegment = segments[0];\n } else {\n targetSegment = segments[segments.length - 1];\n }\n if (targetSegment) {\n point = this._transformToPath(targetSegment.anchor(), path);\n this.drawingElement.transform(g.transform().translate(point.x, point.y));\n }\n }\n });\n var ArrowMarker = MarkerBase.extend({\n options: {\n path: 'M 0 0 L 10 5 L 0 10 L 3 5 z',\n anchor: {\n x: 10,\n y: 5\n }\n },\n createElement: function () {\n var options = this.options;\n this.drawingElement = d.Path.parse(options.path, {\n fill: options.fill,\n stroke: options.stroke\n });\n },\n positionMarker: function (path) {\n var points = this._linePoints(path);\n var start = points.start;\n var end = points.end;\n var transform = g.transform();\n if (start) {\n transform.rotate(lineAngle(start, end), end);\n }\n if (end) {\n var anchor = this.anchor;\n var translate = end.clone().translate(-anchor.x, -anchor.y);\n transform.translate(translate.x, translate.y);\n }\n this.drawingElement.transform(transform);\n },\n _linePoints: function (path) {\n var options = this.options;\n var segments = path.segments;\n var startPoint, endPoint, targetSegment;\n if (options.position == START) {\n targetSegment = segments[0];\n if (targetSegment) {\n endPoint = targetSegment.anchor();\n startPoint = targetSegment.controlOut();\n var nextSegment = segments[1];\n if (!startPoint && nextSegment) {\n startPoint = nextSegment.anchor();\n }\n }\n } else {\n targetSegment = segments[segments.length - 1];\n if (targetSegment) {\n endPoint = targetSegment.anchor();\n startPoint = targetSegment.controlIn();\n var prevSegment = segments[segments.length - 2];\n if (!startPoint && prevSegment) {\n startPoint = prevSegment.anchor();\n }\n }\n }\n if (endPoint) {\n return {\n start: this._transformToPath(startPoint, path),\n end: this._transformToPath(endPoint, path)\n };\n }\n }\n });\n var MarkerPathMixin = {\n _getPath: function (position) {\n var path = this.drawingElement;\n if (path instanceof d.MultiPath) {\n if (position == START) {\n path = path.paths[0];\n } else {\n path = path.paths[path.paths.length - 1];\n }\n }\n if (path && path.segments.length) {\n return path;\n }\n },\n _normalizeMarkerOptions: function (options) {\n var startCap = options.startCap;\n var endCap = options.endCap;\n if (isString(startCap)) {\n options.startCap = { type: startCap };\n }\n if (isString(endCap)) {\n options.endCap = { type: endCap };\n }\n },\n _removeMarker: function (position) {\n var marker = this._markers[position];\n if (marker) {\n this.drawingContainer().remove(marker.drawingElement);\n delete this._markers[position];\n }\n },\n _createMarkers: function () {\n var options = this.options;\n this._normalizeMarkerOptions(options);\n this._markers = {};\n this._markers[START] = this._createMarker(options.startCap, START);\n this._markers[END] = this._createMarker(options.endCap, END);\n },\n _createMarker: function (options, position) {\n var type = (options || {}).type;\n var path = this._getPath(position);\n var markerType, marker;\n if (!path) {\n this._removeMarker(position);\n return;\n }\n if (type == Markers.filledCircle) {\n markerType = CircleMarker;\n } else if (type == Markers.arrowStart || type == Markers.arrowEnd) {\n markerType = ArrowMarker;\n } else {\n this._removeMarker(position);\n }\n if (markerType) {\n marker = new markerType(deepExtend({}, options, { position: position }));\n marker.positionMarker(path);\n this.drawingContainer().append(marker.drawingElement);\n return marker;\n }\n },\n _positionMarker: function (position) {\n var marker = this._markers[position];\n if (marker) {\n var path = this._getPath(position);\n if (path) {\n marker.positionMarker(path);\n } else {\n this._removeMarker(position);\n }\n }\n },\n _capMap: {\n start: 'startCap',\n end: 'endCap'\n },\n _redrawMarker: function (pathChange, position, options) {\n this._normalizeMarkerOptions(options);\n var pathOptions = this.options;\n var cap = this._capMap[position];\n var pathCapType = (pathOptions[cap] || {}).type;\n var optionsCap = options[cap];\n var created = false;\n if (optionsCap) {\n pathOptions[cap] = deepExtend({}, pathOptions[cap], optionsCap);\n if (optionsCap.type && pathCapType != optionsCap.type) {\n this._removeMarker(position);\n this._markers[position] = this._createMarker(pathOptions[cap], position);\n created = true;\n } else if (this._markers[position]) {\n this._markers[position].redraw(optionsCap);\n }\n } else if (pathChange && !this._markers[position] && pathOptions[cap]) {\n this._markers[position] = this._createMarker(pathOptions[cap], position);\n created = true;\n }\n return created;\n },\n _redrawMarkers: function (pathChange, options) {\n if (!this._redrawMarker(pathChange, START, options) && pathChange) {\n this._positionMarker(START);\n }\n if (!this._redrawMarker(pathChange, END, options) && pathChange) {\n this._positionMarker(END);\n }\n }\n };\n var Path = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n this.container = new d.Group();\n this._createElements();\n this._initSize();\n },\n options: { autoSize: true },\n drawingContainer: function () {\n return this.container;\n },\n data: function (value) {\n var options = this.options;\n if (value) {\n if (options.data != value) {\n options.data = value;\n this._setData(value);\n this._initSize();\n this._redrawMarkers(true, {});\n }\n } else {\n return options.data;\n }\n },\n redraw: function (options) {\n if (options) {\n VisualBase.fn.redraw.call(this, options);\n var pathOptions = this.options;\n var data = options.data;\n if (defined(data) && pathOptions.data != data) {\n pathOptions.data = data;\n this._setData(data);\n if (!this._updateSize(options)) {\n this._initSize();\n }\n this._redrawMarkers(true, options);\n } else {\n this._updateSize(options);\n this._redrawMarkers(false, options);\n }\n }\n },\n _createElements: function () {\n var options = this.options;\n this.drawingElement = d.Path.parse(options.data || '', { stroke: options.stroke });\n this._fill();\n this.container.append(this.drawingElement);\n this._createMarkers();\n },\n _setData: function (data) {\n var drawingElement = this.drawingElement;\n var multipath = d.Path.parse(data || '');\n var paths = multipath.paths.slice(0);\n multipath.paths.elements([]);\n drawingElement.paths.elements(paths);\n }\n });\n deepExtend(Path.fn, AutoSizeableMixin);\n deepExtend(Path.fn, MarkerPathMixin);\n var Line = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n this.container = new d.Group();\n this._initPath();\n this._createMarkers();\n },\n drawingContainer: function () {\n return this.container;\n },\n redraw: function (options) {\n if (options) {\n options = options || {};\n var from = options.from;\n var to = options.to;\n if (from) {\n this.options.from = from;\n }\n if (to) {\n this.options.to = to;\n }\n if (from || to) {\n this._drawPath();\n this._redrawMarkers(true, options);\n } else {\n this._redrawMarkers(false, options);\n }\n VisualBase.fn.redraw.call(this, options);\n }\n },\n _initPath: function () {\n var options = this.options;\n var drawingElement = this.drawingElement = new d.Path({ stroke: options.stroke });\n this._fill();\n this._drawPath();\n this.container.append(drawingElement);\n },\n _drawPath: function () {\n var options = this.options;\n var drawingElement = this.drawingElement;\n var from = options.from || new Point();\n var to = options.to || new Point();\n drawingElement.segments.elements([\n createSegment(from.x, from.y),\n createSegment(to.x, to.y)\n ]);\n }\n });\n deepExtend(Line.fn, MarkerPathMixin);\n var Polyline = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n this.container = new d.Group();\n this._initPath();\n this._createMarkers();\n },\n drawingContainer: function () {\n return this.container;\n },\n points: function (points) {\n var options = this.options;\n if (points) {\n options.points = points;\n this._updatePath();\n } else {\n return options.points;\n }\n },\n redraw: function (options) {\n if (options) {\n var points = options.points;\n VisualBase.fn.redraw.call(this, options);\n if (points && this._pointsDiffer(points)) {\n this.points(points);\n this._redrawMarkers(true, options);\n } else {\n this._redrawMarkers(false, options);\n }\n }\n },\n _initPath: function () {\n var options = this.options;\n this.drawingElement = new d.Path({ stroke: options.stroke });\n this._fill();\n this.container.append(this.drawingElement);\n if (options.points) {\n this._updatePath();\n }\n },\n _pointsDiffer: function (points) {\n var currentPoints = this.options.points;\n var differ = currentPoints.length !== points.length;\n if (!differ) {\n for (var i = 0; i < points.length; i++) {\n if (currentPoints[i].x !== points[i].x || currentPoints[i].y !== points[i].y) {\n differ = true;\n break;\n }\n }\n }\n return differ;\n },\n _updatePath: function () {\n var drawingElement = this.drawingElement;\n var options = this.options;\n var points = options.points;\n var segments = [];\n var point;\n for (var i = 0; i < points.length; i++) {\n point = points[i];\n segments.push(createSegment(point.x, point.y));\n }\n drawingElement.segments.elements(segments);\n },\n options: { points: [] }\n });\n deepExtend(Polyline.fn, MarkerPathMixin);\n var Image = Element.extend({\n init: function (options) {\n Element.fn.init.call(this, options);\n this._initImage();\n },\n redraw: function (options) {\n if (options) {\n if (options.source) {\n this.drawingElement.src(options.source);\n }\n if (this._diffNumericOptions(options, [\n WIDTH,\n HEIGHT,\n X,\n Y\n ])) {\n this.drawingElement.rect(this._rect());\n }\n Element.fn.redraw.call(this, options);\n }\n },\n _initImage: function () {\n var options = this.options;\n var rect = this._rect();\n this.drawingElement = new d.Image(options.source, rect, {});\n },\n _rect: function () {\n var sizeOptions = sizeOptionsOrDefault(this.options);\n var origin = new g.Point(sizeOptions.x, sizeOptions.y);\n var size = new g.Size(sizeOptions.width, sizeOptions.height);\n return new g.Rect(origin, size);\n }\n });\n var Group = Element.extend({\n init: function (options) {\n this.children = [];\n Element.fn.init.call(this, options);\n this.drawingElement = new d.Group();\n this._initSize();\n },\n options: { autoSize: false },\n append: function (visual) {\n this.drawingElement.append(visual.drawingContainer());\n this.children.push(visual);\n this._childrenChange = true;\n },\n remove: function (visual) {\n if (this._remove(visual)) {\n this._childrenChange = true;\n }\n },\n _remove: function (visual) {\n var index = inArray(visual, this.children);\n if (index >= 0) {\n this.drawingElement.removeAt(index);\n this.children.splice(index, 1);\n return true;\n }\n },\n clear: function () {\n this.drawingElement.clear();\n this.children = [];\n this._childrenChange = true;\n },\n toFront: function (visuals) {\n var visual;\n for (var i = 0; i < visuals.length; i++) {\n visual = visuals[i];\n if (this._remove(visual)) {\n this.append(visual);\n }\n }\n },\n toBack: function (visuals) {\n this._reorderChildren(visuals, 0);\n },\n toIndex: function (visuals, indices) {\n this._reorderChildren(visuals, indices);\n },\n _reorderChildren: function (visuals, indices) {\n var group = this.drawingElement;\n var drawingChildren = group.children.slice(0);\n var children = this.children;\n var fixedPosition = isNumber(indices);\n var i, index, toIndex, drawingElement, visual;\n for (i = 0; i < visuals.length; i++) {\n visual = visuals[i];\n drawingElement = visual.drawingContainer();\n index = inArray(visual, children);\n if (index >= 0) {\n drawingChildren.splice(index, 1);\n children.splice(index, 1);\n toIndex = fixedPosition ? indices : indices[i];\n drawingChildren.splice(toIndex, 0, drawingElement);\n children.splice(toIndex, 0, visual);\n }\n }\n group.clear();\n group.append.apply(group, drawingChildren);\n },\n redraw: function (options) {\n if (options) {\n if (this._childrenChange) {\n this._childrenChange = false;\n if (!this._updateSize(options)) {\n this._initSize();\n }\n } else {\n this._updateSize(options);\n }\n Element.fn.redraw.call(this, options);\n }\n },\n _boundingBox: function () {\n var children = this.children;\n var boundingBox;\n var visual, childBoundingBox;\n for (var i = 0; i < children.length; i++) {\n visual = children[i];\n if (visual.visible() && visual._includeInBBox !== false) {\n childBoundingBox = visual.drawingContainer().clippedBBox(null);\n if (childBoundingBox) {\n if (boundingBox) {\n boundingBox = g.Rect.union(boundingBox, childBoundingBox);\n } else {\n boundingBox = childBoundingBox;\n }\n }\n }\n }\n return boundingBox;\n }\n });\n deepExtend(Group.fn, AutoSizeableMixin);\n var Layout = Group.extend({\n init: function (rect, options) {\n this.children = [];\n Element.fn.init.call(this, options);\n this.drawingElement = new d.Layout(toDrawingRect(rect), options);\n this._initSize();\n },\n rect: function (rect) {\n if (rect) {\n this.drawingElement.rect(toDrawingRect(rect));\n } else {\n var drawingRect = this.drawingElement.rect();\n if (drawingRect) {\n return new Rect(drawingRect.origin.x, drawingRect.origin.y, drawingRect.size.width, drawingRect.size.height);\n }\n }\n },\n reflow: function () {\n this.drawingElement.reflow();\n },\n redraw: function (options) {\n kendo.deepExtend(this.drawingElement.options, options);\n Group.fn.redraw.call(this, options);\n }\n });\n var Circle = VisualBase.extend({\n init: function (options) {\n VisualBase.fn.init.call(this, options);\n this._initCircle();\n this._initSize();\n },\n redraw: function (options) {\n if (options) {\n var circleOptions = this.options;\n if (options.center) {\n deepExtend(circleOptions, { center: options.center });\n this._center.move(circleOptions.center.x, circleOptions.center.y);\n }\n if (this._diffNumericOptions(options, ['radius'])) {\n this._circle.setRadius(circleOptions.radius);\n }\n this._updateSize(options);\n VisualBase.fn.redraw.call(this, options);\n }\n },\n _initCircle: function () {\n var options = this.options;\n var width = options.width;\n var height = options.height;\n var radius = options.radius;\n if (!defined(radius)) {\n if (!defined(width)) {\n width = height;\n }\n if (!defined(height)) {\n height = width;\n }\n options.radius = radius = Math.min(width, height) / 2;\n }\n var center = options.center || {\n x: radius,\n y: radius\n };\n this._center = new g.Point(center.x, center.y);\n this._circle = new g.Circle(this._center, radius);\n this.drawingElement = new d.Circle(this._circle, { stroke: options.stroke });\n this._fill();\n }\n });\n deepExtend(Circle.fn, AutoSizeableMixin);\n var Canvas = Class.extend({\n init: function (element, options) {\n options = options || {};\n this.element = element;\n this.surface = d.Surface.create(element, options);\n if (kendo.isFunction(this.surface.translate)) {\n this.translate = this._translate;\n }\n this.drawingElement = new d.Group();\n this._viewBox = new Rect(0, 0, options.width, options.height);\n this.size(this._viewBox);\n },\n bounds: function () {\n var box = this.drawingElement.clippedBBox();\n return new Rect(0, 0, box.width(), box.height());\n },\n size: function (size) {\n var viewBox = this._viewBox;\n if (defined(size)) {\n viewBox.width = size.width;\n viewBox.height = size.height;\n this.surface.setSize(size);\n }\n return {\n width: viewBox.width,\n height: viewBox.height\n };\n },\n _translate: function (x, y) {\n var viewBox = this._viewBox;\n if (defined(x) && defined(y)) {\n viewBox.x = x;\n viewBox.y = y;\n this.surface.translate({\n x: x,\n y: y\n });\n }\n return {\n x: viewBox.x,\n y: viewBox.y\n };\n },\n draw: function () {\n this.surface.draw(this.drawingElement);\n },\n append: function (visual) {\n this.drawingElement.append(visual.drawingContainer());\n return this;\n },\n remove: function (visual) {\n this.drawingElement.remove(visual.drawingContainer());\n },\n insertBefore: function () {\n },\n clear: function () {\n this.drawingElement.clear();\n },\n destroy: function (clearHtml) {\n this.surface.destroy();\n if (clearHtml) {\n $(this.element).remove();\n }\n }\n });\n function sizeOptionsOrDefault(options) {\n return {\n x: options.x || 0,\n y: options.y || 0,\n width: options.width || 0,\n height: options.height || 0\n };\n }\n function normalizeDrawingOptions(options) {\n if (options) {\n var drawingOptions = options;\n if (isString(drawingOptions)) {\n drawingOptions = { color: drawingOptions };\n }\n if (drawingOptions.color) {\n drawingOptions.color = getColor(drawingOptions.color);\n }\n return drawingOptions;\n }\n }\n function getColor(value) {\n var color;\n if (value != TRANSPARENT) {\n color = new d.Color(value).toHex();\n } else {\n color = value;\n }\n return color;\n }\n function lineAngle(p1, p2) {\n var xDiff = p2.x - p1.x;\n var yDiff = p2.y - p1.y;\n var angle = kendo.util.deg(Math.atan2(yDiff, xDiff));\n return angle;\n }\n function createSegment(x, y) {\n return new d.Segment(new g.Point(x, y));\n }\n function toDrawingRect(rect) {\n if (rect) {\n return new g.Rect([\n rect.x,\n rect.y\n ], [\n rect.width,\n rect.height\n ]);\n }\n }\n kendo.deepExtend(diagram, {\n init: function (element) {\n kendo.init(element, diagram.ui);\n },\n diffNumericOptions: diffNumericOptions,\n Element: Element,\n Scale: Scale,\n Translation: Translation,\n Rotation: Rotation,\n Circle: Circle,\n Group: Group,\n Rectangle: Rectangle,\n Canvas: Canvas,\n Path: Path,\n Layout: Layout,\n Line: Line,\n MarkerBase: MarkerBase,\n ArrowMarker: ArrowMarker,\n CircleMarker: CircleMarker,\n Polyline: Polyline,\n CompositeTransform: CompositeTransform,\n TextBlock: TextBlock,\n Image: Image,\n VisualBase: VisualBase\n });\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/services', [\n 'kendo.drawing',\n 'dataviz/diagram/svg'\n ], f);\n}(function () {\n (function ($, undefined) {\n var kendo = window.kendo, dataviz = kendo.dataviz, diagram = dataviz.diagram, Class = kendo.Class, Group = diagram.Group, Rect = diagram.Rect, Rectangle = diagram.Rectangle, Utils = diagram.Utils, isUndefined = Utils.isUndefined, Point = diagram.Point, Circle = diagram.Circle, Ticker = diagram.Ticker, deepExtend = kendo.deepExtend, Movable = kendo.ui.Movable, browser = kendo.support.browser, defined = kendo.util.defined, inArray = $.inArray, proxy = $.proxy;\n var Cursors = {\n arrow: 'default',\n grip: 'pointer',\n cross: 'pointer',\n add: 'pointer',\n move: 'move',\n select: 'pointer',\n south: 's-resize',\n east: 'e-resize',\n west: 'w-resize',\n north: 'n-resize',\n rowresize: 'row-resize',\n colresize: 'col-resize'\n }, HIT_TEST_DISTANCE = 10, AUTO = 'Auto', TOP = 'Top', RIGHT = 'Right', LEFT = 'Left', BOTTOM = 'Bottom', DEFAULT_SNAP_SIZE = 10, DEFAULT_SNAP_ANGLE = 10, DRAG_START = 'dragStart', DRAG = 'drag', DRAG_END = 'dragEnd', ITEMROTATE = 'itemRotate', ITEMBOUNDSCHANGE = 'itemBoundsChange', MIN_SNAP_SIZE = 5, MIN_SNAP_ANGLE = 5, MOUSE_ENTER = 'mouseEnter', MOUSE_LEAVE = 'mouseLeave', ZOOM_START = 'zoomStart', ZOOM_END = 'zoomEnd', SCROLL_MIN = -20000, SCROLL_MAX = 20000, FRICTION = 0.9, FRICTION_MOBILE = 0.93, VELOCITY_MULTIPLIER = 5, TRANSPARENT = 'transparent', PAN = 'pan', ROTATED = 'rotated', SOURCE = 'source', TARGET = 'target', HANDLE_NAMES = {\n '-1': SOURCE,\n '1': TARGET\n };\n diagram.Cursors = Cursors;\n var PositionAdapter = kendo.Class.extend({\n init: function (layoutState) {\n this.layoutState = layoutState;\n this.diagram = layoutState.diagram;\n },\n initState: function () {\n this.froms = [];\n this.tos = [];\n this.subjects = [];\n function pusher(id, bounds) {\n var shape = this.diagram.getShapeById(id);\n if (shape) {\n this.subjects.push(shape);\n this.froms.push(shape.bounds().topLeft());\n this.tos.push(bounds.topLeft());\n }\n }\n this.layoutState.nodeMap.forEach(pusher, this);\n },\n update: function (tick) {\n if (this.subjects.length <= 0) {\n return;\n }\n for (var i = 0; i < this.subjects.length; i++) {\n this.subjects[i].position(new Point(this.froms[i].x + (this.tos[i].x - this.froms[i].x) * tick, this.froms[i].y + (this.tos[i].y - this.froms[i].y) * tick));\n }\n }\n });\n var LayoutUndoUnit = Class.extend({\n init: function (initialState, finalState, animate) {\n if (isUndefined(animate)) {\n this.animate = false;\n } else {\n this.animate = animate;\n }\n this._initialState = initialState;\n this._finalState = finalState;\n this.title = 'Diagram layout';\n },\n undo: function () {\n this.setState(this._initialState);\n },\n redo: function () {\n this.setState(this._finalState);\n },\n setState: function (state) {\n var diagram = state.diagram;\n if (this.animate) {\n state.linkMap.forEach(function (id, points) {\n var conn = diagram.getShapeById(id);\n conn.visible(false);\n if (conn) {\n conn.points(points);\n }\n });\n var ticker = new Ticker();\n ticker.addAdapter(new PositionAdapter(state));\n ticker.onComplete(function () {\n state.linkMap.forEach(function (id) {\n var conn = diagram.getShapeById(id);\n conn.visible(true);\n });\n });\n ticker.play();\n } else {\n state.nodeMap.forEach(function (id, bounds) {\n var shape = diagram.getShapeById(id);\n if (shape) {\n shape.position(bounds.topLeft());\n }\n });\n state.linkMap.forEach(function (id, points) {\n var conn = diagram.getShapeById(id);\n if (conn) {\n conn.points(points);\n }\n });\n }\n }\n });\n var CompositeUnit = Class.extend({\n init: function (unit) {\n this.units = [];\n this.title = 'Composite unit';\n if (unit !== undefined) {\n this.units.push(unit);\n }\n },\n add: function (undoUnit) {\n this.units.push(undoUnit);\n },\n undo: function () {\n for (var i = 0; i < this.units.length; i++) {\n this.units[i].undo();\n }\n },\n redo: function () {\n for (var i = 0; i < this.units.length; i++) {\n this.units[i].redo();\n }\n }\n });\n var ConnectionEditUnit = Class.extend({\n init: function (item, redoSource, redoTarget) {\n this.item = item;\n this._redoSource = redoSource;\n this._redoTarget = redoTarget;\n if (defined(redoSource)) {\n this._undoSource = item.source();\n }\n if (defined(redoTarget)) {\n this._undoTarget = item.target();\n }\n this.title = 'Connection Editing';\n },\n undo: function () {\n if (this._undoSource !== undefined) {\n this.item._updateConnector(this._undoSource, 'source');\n }\n if (this._undoTarget !== undefined) {\n this.item._updateConnector(this._undoTarget, 'target');\n }\n this.item.updateModel();\n },\n redo: function () {\n if (this._redoSource !== undefined) {\n this.item._updateConnector(this._redoSource, 'source');\n }\n if (this._redoTarget !== undefined) {\n this.item._updateConnector(this._redoTarget, 'target');\n }\n this.item.updateModel();\n }\n });\n var ConnectionEditUndoUnit = Class.extend({\n init: function (item, undoSource, undoTarget) {\n this.item = item;\n this._undoSource = undoSource;\n this._undoTarget = undoTarget;\n this._redoSource = item.source();\n this._redoTarget = item.target();\n this.title = 'Connection Editing';\n },\n undo: function () {\n this.item._updateConnector(this._undoSource, 'source');\n this.item._updateConnector(this._undoTarget, 'target');\n this.item.updateModel();\n },\n redo: function () {\n this.item._updateConnector(this._redoSource, 'source');\n this.item._updateConnector(this._redoTarget, 'target');\n this.item.updateModel();\n }\n });\n var DeleteConnectionUnit = Class.extend({\n init: function (connection) {\n this.connection = connection;\n this.diagram = connection.diagram;\n this.targetConnector = connection.targetConnector;\n this.title = 'Delete connection';\n },\n undo: function () {\n this.diagram._addConnection(this.connection, false);\n },\n redo: function () {\n this.diagram.remove(this.connection, false);\n }\n });\n var DeleteShapeUnit = Class.extend({\n init: function (shape) {\n this.shape = shape;\n this.diagram = shape.diagram;\n this.title = 'Deletion';\n },\n undo: function () {\n this.diagram._addShape(this.shape, false);\n this.shape.select(false);\n },\n redo: function () {\n this.shape.select(false);\n this.diagram.remove(this.shape, false);\n }\n });\n var TransformUnit = Class.extend({\n init: function (shapes, undoStates, adorner) {\n this.shapes = shapes;\n this.undoStates = undoStates;\n this.title = 'Transformation';\n this.redoStates = [];\n this.adorner = adorner;\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n this.redoStates.push(shape.bounds());\n }\n },\n undo: function () {\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n shape.bounds(this.undoStates[i]);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape, this.redoStates[i], this.undoStates[i]);\n }\n shape.updateModel();\n }\n if (this.adorner) {\n this.adorner.refreshBounds();\n this.adorner.refresh();\n }\n },\n redo: function () {\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n shape.bounds(this.redoStates[i]);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape, this.undoStates[i], this.redoStates[i]);\n }\n shape.updateModel();\n }\n if (this.adorner) {\n this.adorner.refreshBounds();\n this.adorner.refresh();\n }\n }\n });\n var AddConnectionUnit = Class.extend({\n init: function (connection, diagram) {\n this.connection = connection;\n this.diagram = diagram;\n this.title = 'New connection';\n },\n undo: function () {\n this.diagram.remove(this.connection, false);\n },\n redo: function () {\n this.diagram._addConnection(this.connection, false);\n }\n });\n var AddShapeUnit = Class.extend({\n init: function (shape, diagram) {\n this.shape = shape;\n this.diagram = diagram;\n this.title = 'New shape';\n },\n undo: function () {\n this.diagram.deselect();\n this.diagram.remove(this.shape, false);\n },\n redo: function () {\n this.diagram._addShape(this.shape, false);\n }\n });\n var PanUndoUnit = Class.extend({\n init: function (initialPosition, finalPosition, diagram) {\n this.initial = initialPosition;\n this.finalPos = finalPosition;\n this.diagram = diagram;\n this.title = 'Pan Unit';\n },\n undo: function () {\n this.diagram.pan(this.initial);\n },\n redo: function () {\n this.diagram.pan(this.finalPos);\n }\n });\n var RotateUnit = Class.extend({\n init: function (adorner, shapes, undoRotates) {\n this.shapes = shapes;\n this.undoRotates = undoRotates;\n this.title = 'Rotation';\n this.redoRotates = [];\n this.redoAngle = adorner._angle;\n this.adorner = adorner;\n this.center = adorner._innerBounds.center();\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n this.redoRotates.push(shape.rotate().angle);\n }\n },\n undo: function () {\n var i, shape;\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n shape.rotate(this.undoRotates[i], this.center, false);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape);\n }\n shape.updateModel();\n }\n if (this.adorner) {\n this.adorner._initialize();\n this.adorner.refresh();\n }\n },\n redo: function () {\n var i, shape;\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n shape.rotate(this.redoRotates[i], this.center, false);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape);\n }\n shape.updateModel();\n }\n if (this.adorner) {\n this.adorner._initialize();\n this.adorner.refresh();\n }\n }\n });\n var ToFrontUnit = Class.extend({\n init: function (diagram, items, initialIndices) {\n this.diagram = diagram;\n this.indices = initialIndices;\n this.items = items;\n this.title = 'Rotate Unit';\n },\n undo: function () {\n this.diagram._toIndex(this.items, this.indices);\n },\n redo: function () {\n this.diagram.toFront(this.items, false);\n }\n });\n var ToBackUnit = Class.extend({\n init: function (diagram, items, initialIndices) {\n this.diagram = diagram;\n this.indices = initialIndices;\n this.items = items;\n this.title = 'Rotate Unit';\n },\n undo: function () {\n this.diagram._toIndex(this.items, this.indices);\n },\n redo: function () {\n this.diagram.toBack(this.items, false);\n }\n });\n var UndoRedoService = kendo.Observable.extend({\n init: function (options) {\n kendo.Observable.fn.init.call(this, options);\n this.bind(this.events, options);\n this.stack = [];\n this.index = 0;\n this.capacity = 100;\n },\n events: [\n 'undone',\n 'redone'\n ],\n begin: function () {\n this.composite = new CompositeUnit();\n },\n cancel: function () {\n this.composite = undefined;\n },\n commit: function (execute) {\n if (this.composite.units.length > 0) {\n this._restart(this.composite, execute);\n }\n this.composite = undefined;\n },\n addCompositeItem: function (undoUnit) {\n if (this.composite) {\n this.composite.add(undoUnit);\n } else {\n this.add(undoUnit);\n }\n },\n add: function (undoUnit, execute) {\n this._restart(undoUnit, execute);\n },\n pop: function () {\n if (this.index > 0) {\n this.stack.pop();\n this.index--;\n }\n },\n count: function () {\n return this.stack.length;\n },\n undo: function () {\n if (this.index > 0) {\n this.index--;\n this.stack[this.index].undo();\n this.trigger('undone');\n }\n },\n redo: function () {\n if (this.stack.length > 0 && this.index < this.stack.length) {\n this.stack[this.index].redo();\n this.index++;\n this.trigger('redone');\n }\n },\n _restart: function (composite, execute) {\n this.stack.splice(this.index, this.stack.length - this.index);\n this.stack.push(composite);\n if (execute !== false) {\n this.redo();\n } else {\n this.index++;\n }\n if (this.stack.length > this.capacity) {\n this.stack.splice(0, this.stack.length - this.capacity);\n this.index = this.capacity;\n }\n },\n clear: function () {\n this.stack = [];\n this.index = 0;\n }\n });\n var EmptyTool = Class.extend({\n init: function (toolService) {\n this.toolService = toolService;\n },\n start: function () {\n },\n move: function () {\n },\n end: function () {\n },\n tryActivate: function () {\n return false;\n },\n getCursor: function () {\n return Cursors.arrow;\n }\n });\n var ScrollerTool = EmptyTool.extend({\n init: function (toolService) {\n var tool = this;\n var friction = kendo.support.mobileOS ? FRICTION_MOBILE : FRICTION;\n EmptyTool.fn.init.call(tool, toolService);\n var diagram = tool.toolService.diagram, canvas = diagram.canvas;\n var scroller = diagram.scroller = tool.scroller = $(diagram.scrollable).kendoMobileScroller({\n friction: friction,\n velocityMultiplier: VELOCITY_MULTIPLIER,\n mousewheelScrolling: false,\n zoom: false,\n scroll: proxy(tool._move, tool)\n }).data('kendoMobileScroller');\n if (canvas.translate) {\n tool.movableCanvas = new Movable(canvas.element);\n }\n var virtualScroll = function (dimension, min, max) {\n dimension.makeVirtual();\n dimension.virtualSize(min || SCROLL_MIN, max || SCROLL_MAX);\n };\n virtualScroll(scroller.dimensions.x);\n virtualScroll(scroller.dimensions.y);\n scroller.disable();\n },\n tryActivate: function (p, meta) {\n var toolService = this.toolService;\n var options = toolService.diagram.options.pannable;\n var enabled = meta.ctrlKey;\n if (defined(options.key)) {\n if (!options.key || options.key == 'none') {\n enabled = noMeta(meta) && !defined(toolService.hoveredItem);\n } else {\n enabled = meta[options.key + 'Key'];\n }\n }\n return options !== false && enabled && !defined(toolService.hoveredAdorner) && !defined(toolService._hoveredConnector);\n },\n start: function () {\n this.scroller.enable();\n },\n move: function () {\n },\n _move: function (args) {\n var tool = this, diagram = tool.toolService.diagram, canvas = diagram.canvas, scrollPos = new Point(args.scrollLeft, args.scrollTop);\n if (canvas.translate) {\n diagram._storePan(scrollPos.times(-1));\n tool.movableCanvas.moveTo(scrollPos);\n canvas.translate(scrollPos.x, scrollPos.y);\n } else {\n scrollPos = scrollPos.plus(diagram._pan.times(-1));\n }\n diagram.trigger(PAN, { pan: scrollPos });\n },\n end: function () {\n this.scroller.disable();\n },\n getCursor: function () {\n return Cursors.move;\n }\n });\n var PointerTool = Class.extend({\n init: function (toolService) {\n this.toolService = toolService;\n },\n tryActivate: function () {\n return true;\n },\n start: function (p, meta) {\n var toolService = this.toolService, diagram = toolService.diagram, hoveredItem = toolService.hoveredItem;\n if (hoveredItem) {\n toolService.selectSingle(hoveredItem, meta);\n if (hoveredItem.adorner) {\n this.adorner = hoveredItem.adorner;\n this.handle = this.adorner._hitTest(p);\n }\n }\n if (!this.handle) {\n this.handle = diagram._resizingAdorner._hitTest(p);\n if (this.handle) {\n this.adorner = diagram._resizingAdorner;\n }\n }\n if (this.adorner) {\n if (!this.adorner.isDragHandle(this.handle) || !diagram.trigger(DRAG_START, {\n shapes: this.adorner.shapes,\n connections: []\n })) {\n this.adorner.start(p);\n } else {\n toolService.startPoint = p;\n toolService.end(p);\n }\n }\n },\n move: function (p) {\n if (this.adorner) {\n this.adorner.move(this.handle, p);\n if (this.adorner.isDragHandle(this.handle)) {\n this.toolService.diagram.trigger(DRAG, {\n shapes: this.adorner.shapes,\n connections: []\n });\n }\n }\n },\n end: function () {\n var diagram = this.toolService.diagram, adorner = this.adorner, unit;\n if (adorner) {\n if (!adorner.isDragHandle(this.handle) || !diagram.trigger(DRAG_END, {\n shapes: adorner.shapes,\n connections: []\n })) {\n unit = adorner.stop();\n if (unit) {\n diagram.undoRedoService.add(unit, false);\n }\n } else {\n adorner.cancel();\n }\n }\n this.adorner = undefined;\n this.handle = undefined;\n },\n getCursor: function (p) {\n return this.toolService.hoveredItem ? this.toolService.hoveredItem._getCursor(p) : Cursors.arrow;\n }\n });\n var SelectionTool = Class.extend({\n init: function (toolService) {\n this.toolService = toolService;\n },\n tryActivate: function (p, meta) {\n var toolService = this.toolService;\n var selectable = toolService.diagram.options.selectable;\n var enabled = selectable && selectable.multiple !== false;\n if (enabled) {\n if (selectable.key && selectable.key != 'none') {\n enabled = meta[selectable.key + 'Key'];\n } else {\n enabled = noMeta(meta);\n }\n }\n return enabled && !defined(toolService.hoveredItem) && !defined(toolService.hoveredAdorner);\n },\n start: function (p) {\n var diagram = this.toolService.diagram;\n diagram.deselect();\n diagram.selector.start(p);\n },\n move: function (p) {\n var diagram = this.toolService.diagram;\n diagram.selector.move(p);\n },\n end: function (p, meta) {\n var diagram = this.toolService.diagram, hoveredItem = this.toolService.hoveredItem;\n var rect = diagram.selector.bounds();\n if ((!hoveredItem || !hoveredItem.isSelected) && !meta.ctrlKey) {\n diagram.deselect();\n }\n if (!rect.isEmpty()) {\n diagram.selectArea(rect);\n }\n diagram.selector.end();\n },\n getCursor: function () {\n return Cursors.arrow;\n }\n });\n var ConnectionTool = Class.extend({\n init: function (toolService) {\n this.toolService = toolService;\n this.type = 'ConnectionTool';\n },\n tryActivate: function () {\n return this.toolService._hoveredConnector;\n },\n start: function (p, meta) {\n var toolService = this.toolService, diagram = toolService.diagram, connector = toolService._hoveredConnector, connection = diagram._createConnection({}, connector._c, p);\n if (canDrag(connection) && !diagram.trigger(DRAG_START, {\n shapes: [],\n connections: [connection],\n connectionHandle: TARGET\n }) && diagram._addConnection(connection)) {\n toolService._connectionManipulation(connection, connector._c.shape, true);\n toolService._removeHover();\n toolService.selectSingle(toolService.activeConnection, meta);\n if (meta.type == 'touchmove') {\n diagram._cachedTouchTarget = connector.visual;\n }\n } else {\n connection.source(null);\n toolService.end(p);\n }\n },\n move: function (p) {\n var toolService = this.toolService;\n var connection = toolService.activeConnection;\n connection.target(p);\n toolService.diagram.trigger(DRAG, {\n shapes: [],\n connections: [connection],\n connectionHandle: TARGET\n });\n return true;\n },\n end: function (p) {\n var toolService = this.toolService, d = toolService.diagram, connection = toolService.activeConnection, hoveredItem = toolService.hoveredItem, connector = toolService._hoveredConnector, target, cachedTouchTarget = d._cachedTouchTarget;\n if (!connection) {\n return;\n }\n if (connector && connector._c != connection.sourceConnector) {\n target = connector._c;\n } else if (hoveredItem && hoveredItem instanceof diagram.Shape) {\n target = hoveredItem.getConnector(AUTO) || hoveredItem.getConnector(p);\n } else {\n target = p;\n }\n connection.target(target);\n if (!d.trigger(DRAG_END, {\n shapes: [],\n connections: [connection],\n connectionHandle: TARGET\n })) {\n connection.updateModel();\n d._syncConnectionChanges();\n } else {\n d.remove(connection, false);\n d.undoRedoService.pop();\n }\n toolService._connectionManipulation();\n if (cachedTouchTarget) {\n d._connectorsAdorner.visual.remove(cachedTouchTarget);\n d._cachedTouchTarget = null;\n }\n },\n getCursor: function () {\n return Cursors.arrow;\n }\n });\n var ConnectionEditTool = Class.extend({\n init: function (toolService) {\n this.toolService = toolService;\n this.type = 'ConnectionTool';\n },\n tryActivate: function (p, meta) {\n var toolService = this.toolService, diagram = toolService.diagram, selectable = diagram.options.selectable, item = toolService.hoveredItem, isActive = selectable !== false && item && item.path && !(item.isSelected && meta.ctrlKey);\n if (isActive) {\n this._c = item;\n }\n return isActive;\n },\n start: function (p, meta) {\n var toolService = this.toolService;\n var connection = this._c;\n toolService.selectSingle(connection, meta);\n var adorner = connection.adorner;\n var handle, name;\n if (adorner) {\n handle = adorner._hitTest(p);\n name = HANDLE_NAMES[handle];\n }\n if (canDrag(connection) && adorner && !toolService.diagram.trigger(DRAG_START, {\n shapes: [],\n connections: [connection],\n connectionHandle: name\n })) {\n this.handle = handle;\n this.handleName = name;\n adorner.start(p);\n } else {\n toolService.startPoint = p;\n toolService.end(p);\n }\n },\n move: function (p) {\n var adorner = this._c.adorner;\n if (canDrag(this._c) && adorner) {\n adorner.move(this.handle, p);\n this.toolService.diagram.trigger(DRAG, {\n shapes: [],\n connections: [this._c],\n connectionHandle: this.handleName\n });\n return true;\n }\n },\n end: function (p) {\n var connection = this._c;\n var adorner = connection.adorner;\n var toolService = this.toolService;\n var diagram = toolService.diagram;\n if (adorner) {\n if (canDrag(connection)) {\n var unit = adorner.stop(p);\n if (!diagram.trigger(DRAG_END, {\n shapes: [],\n connections: [connection],\n connectionHandle: this.handleName\n })) {\n diagram.undoRedoService.add(unit, false);\n connection.updateModel();\n diagram._syncConnectionChanges();\n } else {\n unit.undo();\n }\n }\n }\n },\n getCursor: function () {\n return Cursors.move;\n }\n });\n function testKey(key, str) {\n return str.charCodeAt(0) == key || str.toUpperCase().charCodeAt(0) == key;\n }\n var ToolService = Class.extend({\n init: function (diagram) {\n this.diagram = diagram;\n this.tools = [\n new ScrollerTool(this),\n new ConnectionEditTool(this),\n new ConnectionTool(this),\n new SelectionTool(this),\n new PointerTool(this)\n ];\n this.activeTool = undefined;\n },\n start: function (p, meta) {\n meta = deepExtend({}, meta);\n if (this.activeTool) {\n this.activeTool.end(p, meta);\n }\n this._updateHoveredItem(p);\n this._activateTool(p, meta);\n this.activeTool.start(p, meta);\n this._updateCursor(p);\n this.diagram.focus();\n this.diagram.canvas.surface.suspendTracking();\n this.startPoint = p;\n return true;\n },\n move: function (p, meta) {\n meta = deepExtend({}, meta);\n var updateHovered = true;\n if (this.activeTool) {\n updateHovered = this.activeTool.move(p, meta);\n }\n if (updateHovered) {\n this._updateHoveredItem(p);\n }\n this._updateCursor(p);\n return true;\n },\n end: function (p, meta) {\n meta = deepExtend({}, meta);\n if (this.activeTool) {\n this.activeTool.end(p, meta);\n }\n this.diagram.canvas.surface.resumeTracking();\n this.activeTool = undefined;\n this._updateCursor(p);\n return true;\n },\n keyDown: function (key, meta) {\n var diagram = this.diagram;\n meta = deepExtend({\n ctrlKey: false,\n metaKey: false,\n altKey: false\n }, meta);\n if ((meta.ctrlKey || meta.metaKey) && !meta.altKey) {\n if (testKey(key, 'a')) {\n diagram.selectAll();\n diagram._destroyToolBar();\n return true;\n } else if (testKey(key, 'z')) {\n diagram.undo();\n diagram._destroyToolBar();\n return true;\n } else if (testKey(key, 'y')) {\n diagram.redo();\n diagram._destroyToolBar();\n return true;\n } else if (testKey(key, 'c')) {\n diagram.copy();\n diagram._destroyToolBar();\n } else if (testKey(key, 'x')) {\n diagram.cut();\n diagram._destroyToolBar();\n } else if (testKey(key, 'v')) {\n diagram.paste();\n diagram._destroyToolBar();\n } else if (testKey(key, 'l')) {\n diagram.layout();\n diagram._destroyToolBar();\n } else if (testKey(key, 'd')) {\n diagram._destroyToolBar();\n diagram.copy();\n diagram.paste();\n }\n } else if (key === 46 || key === 8) {\n var toRemove = this.diagram._triggerRemove(diagram.select());\n if (toRemove.length) {\n this.diagram.remove(toRemove, true);\n this.diagram._syncChanges();\n this.diagram._destroyToolBar();\n }\n return true;\n } else if (key === 27) {\n this._discardNewConnection();\n diagram.deselect();\n diagram._destroyToolBar();\n return true;\n }\n },\n wheel: function (p, meta) {\n var diagram = this.diagram, delta = meta.delta, z = diagram.zoom(), options = diagram.options, zoomRate = options.zoomRate, zoomOptions = {\n point: p,\n meta: meta,\n zoom: z\n };\n if (diagram.trigger(ZOOM_START, zoomOptions)) {\n return;\n }\n if (delta < 0) {\n z += zoomRate;\n } else {\n z -= zoomRate;\n }\n z = kendo.dataviz.round(Math.max(options.zoomMin, Math.min(options.zoomMax, z)), 2);\n zoomOptions.zoom = z;\n diagram.zoom(z, zoomOptions);\n diagram.trigger(ZOOM_END, zoomOptions);\n return true;\n },\n setTool: function (tool, index) {\n tool.toolService = this;\n this.tools[index] = tool;\n },\n selectSingle: function (item, meta) {\n var diagram = this.diagram;\n var selectable = diagram.options.selectable;\n if (selectable && !item.isSelected && item.options.selectable !== false) {\n var addToSelection = meta.ctrlKey && selectable.multiple !== false;\n diagram.select(item, { addToSelection: addToSelection });\n }\n },\n _discardNewConnection: function () {\n if (this.newConnection) {\n this.diagram.remove(this.newConnection);\n this.newConnection = undefined;\n }\n },\n _activateTool: function (p, meta) {\n for (var i = 0; i < this.tools.length; i++) {\n var tool = this.tools[i];\n if (tool.tryActivate(p, meta)) {\n this.activeTool = tool;\n break;\n }\n }\n },\n _updateCursor: function (p) {\n var element = this.diagram.element;\n var cursor = this.activeTool ? this.activeTool.getCursor(p) : this.hoveredAdorner ? this.hoveredAdorner._getCursor(p) : this.hoveredItem ? this.hoveredItem._getCursor(p) : Cursors.arrow;\n element.css({ cursor: cursor });\n if (browser.msie && browser.version == 7) {\n element[0].style.cssText = element[0].style.cssText;\n }\n },\n _connectionManipulation: function (connection, disabledShape, isNew) {\n this.activeConnection = connection;\n this.disabledShape = disabledShape;\n if (isNew) {\n this.newConnection = this.activeConnection;\n } else {\n this.newConnection = undefined;\n }\n },\n _updateHoveredItem: function (p) {\n var hit = this._hitTest(p);\n var diagram = this.diagram;\n if (hit != this.hoveredItem && (!this.disabledShape || hit != this.disabledShape)) {\n if (this.hoveredItem) {\n diagram.trigger(MOUSE_LEAVE, { item: this.hoveredItem });\n this.hoveredItem._hover(false);\n }\n if (hit && hit.options.enable) {\n diagram.trigger(MOUSE_ENTER, { item: hit });\n this.hoveredItem = hit;\n this.hoveredItem._hover(true);\n } else {\n this.hoveredItem = undefined;\n }\n }\n },\n _removeHover: function () {\n if (this.hoveredItem) {\n this.hoveredItem._hover(false);\n this.hoveredItem = undefined;\n }\n },\n _hitTest: function (point) {\n var hit, d = this.diagram, item, i;\n if (this._hoveredConnector) {\n this._hoveredConnector._hover(false);\n this._hoveredConnector = undefined;\n }\n if (d._connectorsAdorner._visible) {\n hit = d._connectorsAdorner._hitTest(point);\n if (hit) {\n return hit;\n }\n }\n hit = this.diagram._resizingAdorner._hitTest(point);\n if (hit) {\n this.hoveredAdorner = d._resizingAdorner;\n if (hit.x !== 0 || hit.y !== 0) {\n return;\n }\n hit = undefined;\n } else {\n this.hoveredAdorner = undefined;\n }\n if (!this.activeTool || this.activeTool.type !== 'ConnectionTool') {\n var selectedConnections = [];\n for (i = 0; i < d._selectedItems.length; i++) {\n item = d._selectedItems[i];\n if (item instanceof diagram.Connection) {\n selectedConnections.push(item);\n }\n }\n hit = this._hitTestItems(selectedConnections, point);\n }\n return hit || this._hitTestElements(point);\n },\n _hitTestElements: function (point) {\n var diagram = this.diagram;\n var shapeHit = this._hitTestItems(diagram.shapes, point);\n var connectionHit = this._hitTestItems(diagram.connections, point);\n var hit;\n if ((!this.activeTool || this.activeTool.type != 'ConnectionTool') && shapeHit && connectionHit && !hitTestShapeConnectors(shapeHit, point)) {\n var mainLayer = diagram.mainLayer;\n var shapeIdx = inArray(shapeHit.visual, mainLayer.children);\n var connectionIdx = inArray(connectionHit.visual, mainLayer.children);\n hit = shapeIdx > connectionIdx ? shapeHit : connectionHit;\n }\n return hit || shapeHit || connectionHit;\n },\n _hitTestItems: function (array, point) {\n var i, item, hit;\n for (i = array.length - 1; i >= 0; i--) {\n item = array[i];\n hit = item._hitTest(point);\n if (hit) {\n return hit;\n }\n }\n }\n });\n var ConnectionRouterBase = kendo.Class.extend({\n init: function () {\n }\n });\n var LinearConnectionRouter = ConnectionRouterBase.extend({\n init: function (connection) {\n var that = this;\n ConnectionRouterBase.fn.init.call(that);\n this.connection = connection;\n },\n hitTest: function (p) {\n var rec = this.getBounds().inflate(HIT_TEST_DISTANCE);\n if (!rec.contains(p)) {\n return false;\n }\n return diagram.Geometry.distanceToPolyline(p, this.connection.allPoints()) < HIT_TEST_DISTANCE;\n },\n getBounds: function () {\n var points = this.connection.allPoints(), s = points[0], e = points[points.length - 1], right = Math.max(s.x, e.x), left = Math.min(s.x, e.x), top = Math.min(s.y, e.y), bottom = Math.max(s.y, e.y);\n for (var i = 1; i < points.length - 1; ++i) {\n right = Math.max(right, points[i].x);\n left = Math.min(left, points[i].x);\n top = Math.min(top, points[i].y);\n bottom = Math.max(bottom, points[i].y);\n }\n return new Rect(left, top, right - left, bottom - top);\n }\n });\n var PolylineRouter = LinearConnectionRouter.extend({\n init: function (connection) {\n var that = this;\n LinearConnectionRouter.fn.init.call(that);\n this.connection = connection;\n },\n route: function () {\n }\n });\n var CascadingRouter = LinearConnectionRouter.extend({\n SAME_SIDE_DISTANCE_RATIO: 5,\n init: function (connection) {\n var that = this;\n LinearConnectionRouter.fn.init.call(that);\n this.connection = connection;\n },\n routePoints: function (start, end, sourceConnector, targetConnector) {\n var result;\n if (sourceConnector && targetConnector) {\n result = this._connectorPoints(start, end, sourceConnector, targetConnector);\n } else {\n result = this._floatingPoints(start, end, sourceConnector);\n }\n return result;\n },\n route: function () {\n var sourceConnector = this.connection._resolvedSourceConnector;\n var targetConnector = this.connection._resolvedTargetConnector;\n var start = this.connection.sourcePoint();\n var end = this.connection.targetPoint();\n var points = this.routePoints(start, end, sourceConnector, targetConnector);\n this.connection.points(points);\n },\n _connectorSides: [\n {\n name: 'Top',\n axis: 'y',\n boundsPoint: 'topLeft',\n secondarySign: 1\n },\n {\n name: 'Left',\n axis: 'x',\n boundsPoint: 'topLeft',\n secondarySign: 1\n },\n {\n name: 'Bottom',\n axis: 'y',\n boundsPoint: 'bottomRight',\n secondarySign: -1\n },\n {\n name: 'Right',\n axis: 'x',\n boundsPoint: 'bottomRight',\n secondarySign: -1\n }\n ],\n _connectorSide: function (connector, targetPoint) {\n var position = connector.position();\n var shapeBounds = connector.shape.bounds(ROTATED);\n var bounds = {\n topLeft: shapeBounds.topLeft(),\n bottomRight: shapeBounds.bottomRight()\n };\n var sides = this._connectorSides;\n var min = kendo.util.MAX_NUM;\n var sideDistance;\n var minSide;\n var axis;\n var side;\n for (var idx = 0; idx < sides.length; idx++) {\n side = sides[idx];\n axis = side.axis;\n sideDistance = Math.round(Math.abs(position[axis] - bounds[side.boundsPoint][axis]));\n if (sideDistance < min) {\n min = sideDistance;\n minSide = side;\n } else if (sideDistance === min && (position[axis] - targetPoint[axis]) * side.secondarySign > (position[minSide.axis] - targetPoint[minSide.axis]) * minSide.secondarySign) {\n minSide = side;\n }\n }\n return minSide.name;\n },\n _sameSideDistance: function (connector) {\n var bounds = connector.shape.bounds(ROTATED);\n return Math.min(bounds.width, bounds.height) / this.SAME_SIDE_DISTANCE_RATIO;\n },\n _connectorPoints: function (start, end, sourceConnector, targetConnector) {\n var sourceConnectorSide = this._connectorSide(sourceConnector, end);\n var targetConnectorSide = this._connectorSide(targetConnector, start);\n var deltaX = end.x - start.x;\n var deltaY = end.y - start.y;\n var sameSideDistance = this._sameSideDistance(sourceConnector);\n var result = [];\n var pointX, pointY;\n if (sourceConnectorSide === TOP || sourceConnectorSide == BOTTOM) {\n if (targetConnectorSide == TOP || targetConnectorSide == BOTTOM) {\n if (sourceConnectorSide == targetConnectorSide) {\n if (sourceConnectorSide == TOP) {\n pointY = Math.min(start.y, end.y) - sameSideDistance;\n } else {\n pointY = Math.max(start.y, end.y) + sameSideDistance;\n }\n result = [\n new Point(start.x, pointY),\n new Point(end.x, pointY)\n ];\n } else {\n result = [\n new Point(start.x, start.y + deltaY / 2),\n new Point(end.x, start.y + deltaY / 2)\n ];\n }\n } else {\n result = [new Point(start.x, end.y)];\n }\n } else {\n if (targetConnectorSide == LEFT || targetConnectorSide == RIGHT) {\n if (sourceConnectorSide == targetConnectorSide) {\n if (sourceConnectorSide == LEFT) {\n pointX = Math.min(start.x, end.x) - sameSideDistance;\n } else {\n pointX = Math.max(start.x, end.x) + sameSideDistance;\n }\n result = [\n new Point(pointX, start.y),\n new Point(pointX, end.y)\n ];\n } else {\n result = [\n new Point(start.x + deltaX / 2, start.y),\n new Point(start.x + deltaX / 2, start.y + deltaY)\n ];\n }\n } else {\n result = [new Point(end.x, start.y)];\n }\n }\n return result;\n },\n _floatingPoints: function (start, end, sourceConnector) {\n var sourceConnectorSide = sourceConnector ? this._connectorSide(sourceConnector, end) : null;\n var cascadeStartHorizontal = this._startHorizontal(start, end, sourceConnectorSide);\n var points = [\n start,\n start,\n end,\n end\n ];\n var deltaX = end.x - start.x;\n var deltaY = end.y - start.y;\n var length = points.length;\n var shiftX;\n var shiftY;\n for (var idx = 1; idx < length - 1; ++idx) {\n if (cascadeStartHorizontal) {\n if (idx % 2 !== 0) {\n shiftX = deltaX / (length / 2);\n shiftY = 0;\n } else {\n shiftX = 0;\n shiftY = deltaY / ((length - 1) / 2);\n }\n } else {\n if (idx % 2 !== 0) {\n shiftX = 0;\n shiftY = deltaY / (length / 2);\n } else {\n shiftX = deltaX / ((length - 1) / 2);\n shiftY = 0;\n }\n }\n points[idx] = new Point(points[idx - 1].x + shiftX, points[idx - 1].y + shiftY);\n }\n idx--;\n if (cascadeStartHorizontal && idx % 2 !== 0 || !cascadeStartHorizontal && idx % 2 === 0) {\n points[length - 2] = new Point(points[length - 1].x, points[length - 2].y);\n } else {\n points[length - 2] = new Point(points[length - 2].x, points[length - 1].y);\n }\n return [\n points[1],\n points[2]\n ];\n },\n _startHorizontal: function (start, end, sourceSide) {\n var horizontal;\n if (sourceSide !== null && (sourceSide === RIGHT || sourceSide === LEFT)) {\n horizontal = true;\n } else {\n horizontal = Math.abs(start.x - end.x) > Math.abs(start.y - end.y);\n }\n return horizontal;\n }\n });\n var AdornerBase = Class.extend({\n init: function (diagram, options) {\n var that = this;\n that.diagram = diagram;\n that.options = deepExtend({}, that.options, options);\n that.visual = new Group();\n that.diagram._adorners.push(that);\n },\n refresh: function () {\n }\n });\n var ConnectionEditAdorner = AdornerBase.extend({\n init: function (connection, options) {\n var that = this, diagram;\n that.connection = connection;\n diagram = that.connection.diagram;\n that._ts = diagram.toolService;\n AdornerBase.fn.init.call(that, diagram, options);\n var sp = that.connection.sourcePoint();\n var tp = that.connection.targetPoint();\n that.spVisual = new Circle(deepExtend(that.options.handles, { center: sp }));\n that.epVisual = new Circle(deepExtend(that.options.handles, { center: tp }));\n that.visual.append(that.spVisual);\n that.visual.append(that.epVisual);\n },\n options: { handles: {} },\n _getCursor: function () {\n return Cursors.move;\n },\n start: function (p) {\n this.handle = this._hitTest(p);\n this.startPoint = p;\n this._initialSource = this.connection.source();\n this._initialTarget = this.connection.target();\n switch (this.handle) {\n case -1:\n if (this.connection.targetConnector) {\n this._ts._connectionManipulation(this.connection, this.connection.targetConnector.shape);\n }\n break;\n case 1:\n if (this.connection.sourceConnector) {\n this._ts._connectionManipulation(this.connection, this.connection.sourceConnector.shape);\n }\n break;\n }\n },\n move: function (handle, p) {\n switch (handle) {\n case -1:\n this.connection.source(p);\n break;\n case 1:\n this.connection.target(p);\n break;\n default:\n var delta = p.minus(this.startPoint);\n this.startPoint = p;\n if (!this.connection.sourceConnector) {\n this.connection.source(this.connection.sourcePoint().plus(delta));\n }\n if (!this.connection.targetConnector) {\n this.connection.target(this.connection.targetPoint().plus(delta));\n }\n break;\n }\n this.refresh();\n return true;\n },\n stop: function (p) {\n var ts = this.diagram.toolService, item = ts.hoveredItem, target;\n if (ts._hoveredConnector) {\n target = ts._hoveredConnector._c;\n } else if (item && item instanceof diagram.Shape) {\n target = item.getConnector(AUTO) || item.getConnector(p);\n } else {\n target = p;\n }\n if (this.handle === -1) {\n this.connection.source(target);\n } else if (this.handle === 1) {\n this.connection.target(target);\n }\n this.handle = undefined;\n this._ts._connectionManipulation();\n return new ConnectionEditUndoUnit(this.connection, this._initialSource, this._initialTarget);\n },\n _hitTest: function (point) {\n var sourcePoint = this.connection.sourcePoint();\n var targetPoint = this.connection.targetPoint();\n var radiusX = this.options.handles.width / 2 + HIT_TEST_DISTANCE;\n var radiusY = this.options.handles.height / 2 + HIT_TEST_DISTANCE;\n var sourcePointDistance = sourcePoint.distanceTo(point);\n var targetPointDistance = targetPoint.distanceTo(point);\n var sourceHandle = new Rect(sourcePoint.x, sourcePoint.y).inflate(radiusX, radiusY).contains(point);\n var targetHandle = new Rect(targetPoint.x, targetPoint.y).inflate(radiusX, radiusY).contains(point);\n var handle = 0;\n if (sourceHandle && (!targetHandle || sourcePointDistance < targetPointDistance)) {\n handle = -1;\n } else if (targetHandle && (!sourceHandle || targetPointDistance < sourcePointDistance)) {\n handle = 1;\n }\n return handle;\n },\n refresh: function () {\n this.spVisual.redraw({ center: this.diagram.modelToLayer(this.connection.sourcePoint()) });\n this.epVisual.redraw({ center: this.diagram.modelToLayer(this.connection.targetPoint()) });\n }\n });\n var ConnectorsAdorner = AdornerBase.extend({\n init: function (diagram, options) {\n var that = this;\n AdornerBase.fn.init.call(that, diagram, options);\n that._refreshHandler = function (e) {\n if (e.item == that.shape) {\n that.refresh();\n }\n };\n },\n show: function (shape) {\n var that = this, len, i, ctr;\n that._visible = true;\n that.shape = shape;\n that.diagram.bind(ITEMBOUNDSCHANGE, that._refreshHandler);\n len = shape.connectors.length;\n that.connectors = [];\n that._clearVisual();\n for (i = 0; i < len; i++) {\n ctr = new ConnectorVisual(shape.connectors[i]);\n that.connectors.push(ctr);\n that.visual.append(ctr.visual);\n }\n that.visual.visible(true);\n that.refresh();\n },\n _clearVisual: function () {\n var that = this;\n if (that.diagram._cachedTouchTarget) {\n that._keepCachedTouchTarget();\n } else {\n that.visual.clear();\n }\n },\n _keepCachedTouchTarget: function () {\n var that = this, visualChildren = that.visual.children;\n var childrenCount = visualChildren.length;\n var index = inArray(that.diagram._cachedTouchTarget, visualChildren);\n for (var i = childrenCount - 1; i >= 0; i--) {\n if (i == index) {\n continue;\n }\n that.visual.remove(visualChildren[i]);\n }\n },\n destroy: function () {\n var that = this;\n that.diagram.unbind(ITEMBOUNDSCHANGE, that._refreshHandler);\n that.shape = undefined;\n that._visible = undefined;\n that.visual.visible(false);\n },\n _hitTest: function (p) {\n var ctr, i;\n for (i = 0; i < this.connectors.length; i++) {\n ctr = this.connectors[i];\n if (ctr._hitTest(p)) {\n ctr._hover(true);\n this.diagram.toolService._hoveredConnector = ctr;\n break;\n }\n }\n },\n refresh: function () {\n if (this.shape) {\n var bounds = this.shape.bounds();\n bounds = this.diagram.modelToLayer(bounds);\n this.visual.position(bounds.topLeft());\n $.each(this.connectors, function () {\n this.refresh();\n });\n }\n }\n });\n function hitToOppositeSide(hit, bounds) {\n var result;\n if (hit.x == -1 && hit.y == -1) {\n result = bounds.bottomRight();\n } else if (hit.x == 1 && hit.y == 1) {\n result = bounds.topLeft();\n } else if (hit.x == -1 && hit.y == 1) {\n result = bounds.topRight();\n } else if (hit.x == 1 && hit.y == -1) {\n result = bounds.bottomLeft();\n } else if (hit.x === 0 && hit.y == -1) {\n result = bounds.bottom();\n } else if (hit.x === 0 && hit.y == 1) {\n result = bounds.top();\n } else if (hit.x == 1 && hit.y === 0) {\n result = bounds.left();\n } else if (hit.x == -1 && hit.y === 0) {\n result = bounds.right();\n }\n return result;\n }\n var ResizingAdorner = AdornerBase.extend({\n init: function (diagram, options) {\n var that = this;\n AdornerBase.fn.init.call(that, diagram, options);\n that._manipulating = false;\n that.map = [];\n that.shapes = [];\n that._initSelection();\n that._createHandles();\n that.redraw();\n that.diagram.bind('select', function (e) {\n that._initialize(e.selected);\n });\n that._refreshHandler = function () {\n if (!that._internalChange) {\n that.refreshBounds();\n that.refresh();\n }\n };\n that._rotatedHandler = function () {\n if (that.shapes.length == 1) {\n that._angle = that.shapes[0].rotate().angle;\n }\n that._refreshHandler();\n };\n that.diagram.bind(ITEMBOUNDSCHANGE, that._refreshHandler).bind(ITEMROTATE, that._rotatedHandler);\n that.refreshBounds();\n that.refresh();\n },\n options: {\n handles: {\n fill: { color: '#fff' },\n stroke: { color: '#282828' },\n height: 7,\n width: 7,\n hover: {\n fill: { color: '#282828' },\n stroke: { color: '#282828' }\n }\n },\n selectable: {\n stroke: {\n color: '#778899',\n width: 1,\n dashType: 'dash'\n },\n fill: { color: TRANSPARENT }\n },\n offset: 10\n },\n _initSelection: function () {\n var that = this;\n var diagram = that.diagram;\n var selectable = diagram.options.selectable;\n var options = deepExtend({}, that.options.selectable, selectable);\n that.rect = new Rectangle(options);\n that.visual.append(that.rect);\n },\n _resizable: function () {\n return this.options.editable && this.options.editable.resize !== false;\n },\n _handleOptions: function () {\n return (this.options.editable.resize || {}).handles || this.options.handles;\n },\n _createHandles: function () {\n var handles, item, y, x;\n if (this._resizable()) {\n handles = this._handleOptions();\n for (x = -1; x <= 1; x++) {\n for (y = -1; y <= 1; y++) {\n if (x !== 0 || y !== 0) {\n item = new Rectangle(handles);\n item.drawingElement._hover = proxy(this._hover, this);\n this.map.push({\n x: x,\n y: y,\n visual: item\n });\n this.visual.append(item);\n }\n }\n }\n }\n },\n bounds: function (value) {\n if (value) {\n this._innerBounds = value.clone();\n this._bounds = this.diagram.modelToLayer(value).inflate(this.options.offset, this.options.offset);\n } else {\n return this._bounds;\n }\n },\n _hitTest: function (p) {\n var tp = this.diagram.modelToLayer(p), i, hit, handleBounds, handlesCount = this.map.length, handle;\n if (this._angle) {\n tp = tp.clone().rotate(this._bounds.center(), this._angle);\n }\n if (this._resizable()) {\n for (i = 0; i < handlesCount; i++) {\n handle = this.map[i];\n hit = new Point(handle.x, handle.y);\n handleBounds = this._getHandleBounds(hit);\n handleBounds.offset(this._bounds.x, this._bounds.y);\n if (handleBounds.contains(tp)) {\n return hit;\n }\n }\n }\n if (this._bounds.contains(tp)) {\n return new Point(0, 0);\n }\n },\n _getHandleBounds: function (p) {\n if (this._resizable()) {\n var handles = this._handleOptions(), w = handles.width, h = handles.height, r = new Rect(0, 0, w, h);\n if (p.x < 0) {\n r.x = -w / 2;\n } else if (p.x === 0) {\n r.x = Math.floor(this._bounds.width / 2) - w / 2;\n } else if (p.x > 0) {\n r.x = this._bounds.width + 1 - w / 2;\n }\n if (p.y < 0) {\n r.y = -h / 2;\n } else if (p.y === 0) {\n r.y = Math.floor(this._bounds.height / 2) - h / 2;\n } else if (p.y > 0) {\n r.y = this._bounds.height + 1 - h / 2;\n }\n return r;\n }\n },\n _getCursor: function (point) {\n var hit = this._hitTest(point);\n if (hit && hit.x >= -1 && hit.x <= 1 && hit.y >= -1 && hit.y <= 1 && this._resizable()) {\n var angle = this._angle;\n if (angle) {\n angle = 360 - angle;\n hit.rotate(new Point(0, 0), angle);\n hit = new Point(Math.round(hit.x), Math.round(hit.y));\n }\n if (hit.x == -1 && hit.y == -1) {\n return 'nw-resize';\n }\n if (hit.x == 1 && hit.y == 1) {\n return 'se-resize';\n }\n if (hit.x == -1 && hit.y == 1) {\n return 'sw-resize';\n }\n if (hit.x == 1 && hit.y == -1) {\n return 'ne-resize';\n }\n if (hit.x === 0 && hit.y == -1) {\n return 'n-resize';\n }\n if (hit.x === 0 && hit.y == 1) {\n return 's-resize';\n }\n if (hit.x == 1 && hit.y === 0) {\n return 'e-resize';\n }\n if (hit.x == -1 && hit.y === 0) {\n return 'w-resize';\n }\n }\n return this._manipulating ? Cursors.move : Cursors.select;\n },\n _initialize: function () {\n var that = this, i, item, items = that.diagram.select();\n that.shapes = [];\n for (i = 0; i < items.length; i++) {\n item = items[i];\n if (item instanceof diagram.Shape) {\n that.shapes.push(item);\n item._rotationOffset = new Point();\n }\n }\n that._angle = that.shapes.length == 1 ? that.shapes[0].rotate().angle : 0;\n that._startAngle = that._angle;\n that._rotates();\n that._positions();\n that.refreshBounds();\n that.refresh();\n that.redraw();\n },\n _rotates: function () {\n var that = this, i, shape;\n that.initialRotates = [];\n for (i = 0; i < that.shapes.length; i++) {\n shape = that.shapes[i];\n that.initialRotates.push(shape.rotate().angle);\n }\n },\n _positions: function () {\n var that = this, i, shape;\n that.initialStates = [];\n for (i = 0; i < that.shapes.length; i++) {\n shape = that.shapes[i];\n that.initialStates.push(shape.bounds());\n }\n },\n _hover: function (value, element) {\n if (this._resizable()) {\n var handleOptions = this._handleOptions(), hover = handleOptions.hover, stroke = handleOptions.stroke, fill = handleOptions.fill;\n if (value && Utils.isDefined(hover.stroke)) {\n stroke = deepExtend({}, stroke, hover.stroke);\n }\n if (value && Utils.isDefined(hover.fill)) {\n fill = hover.fill;\n }\n element.stroke(stroke.color, stroke.width, stroke.opacity);\n element.fill(fill.color, fill.opacity);\n }\n },\n start: function (p) {\n this._sp = p;\n this._cp = p;\n this._lp = p;\n this._manipulating = true;\n this._internalChange = true;\n this.shapeStates = [];\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n this.shapeStates.push(shape.bounds());\n }\n },\n redraw: function () {\n var i, handle, visibleHandles = this._resizable();\n for (i = 0; i < this.map.length; i++) {\n handle = this.map[i];\n handle.visual.visible(visibleHandles);\n }\n },\n angle: function (value) {\n if (defined(value)) {\n this._angle = value;\n }\n return this._angle;\n },\n rotate: function () {\n var center = this._innerBounds.center();\n var currentAngle = this.angle();\n this._internalChange = true;\n for (var i = 0; i < this.shapes.length; i++) {\n var shape = this.shapes[i];\n currentAngle = (currentAngle + this.initialRotates[i] - this._startAngle) % 360;\n shape.rotate(currentAngle, center);\n }\n this.refresh();\n },\n move: function (handle, p) {\n var delta, dragging, dtl = new Point(), dbr = new Point(), bounds, center, shape, i, angle, newBounds, changed = 0, staticPoint, scaleX, scaleY;\n if (handle.y === -2 && handle.x === -1) {\n center = this._innerBounds.center();\n this._angle = this._truncateAngle(Utils.findAngle(center, p));\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n angle = (this._angle + this.initialRotates[i] - this._startAngle) % 360;\n shape.rotate(angle, center);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape);\n }\n this._rotating = true;\n }\n this.refresh();\n } else {\n if (this.shouldSnap()) {\n var thr = this._truncateDistance(p.minus(this._lp));\n if (thr.x === 0 && thr.y === 0) {\n this._cp = p;\n return;\n }\n delta = thr;\n this._lp = new Point(this._lp.x + thr.x, this._lp.y + thr.y);\n } else {\n delta = p.minus(this._cp);\n }\n if (this.isDragHandle(handle)) {\n dbr = dtl = delta;\n dragging = true;\n } else {\n if (this._angle) {\n delta.rotate(new Point(0, 0), this._angle);\n }\n if (handle.x == -1) {\n dtl.x = delta.x;\n } else if (handle.x == 1) {\n dbr.x = delta.x;\n }\n if (handle.y == -1) {\n dtl.y = delta.y;\n } else if (handle.y == 1) {\n dbr.y = delta.y;\n }\n }\n if (!dragging) {\n staticPoint = hitToOppositeSide(handle, this._innerBounds);\n scaleX = (this._innerBounds.width + delta.x * handle.x) / this._innerBounds.width;\n scaleY = (this._innerBounds.height + delta.y * handle.y) / this._innerBounds.height;\n }\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n bounds = shape.bounds();\n if (dragging) {\n if (!canDrag(shape)) {\n continue;\n }\n newBounds = this._displaceBounds(bounds, dtl, dbr, dragging);\n } else {\n newBounds = bounds.clone();\n newBounds.scale(scaleX, scaleY, staticPoint, this._innerBounds.center(), shape.rotate().angle);\n var newCenter = newBounds.center();\n newCenter.rotate(bounds.center(), -this._angle);\n newBounds = new Rect(newCenter.x - newBounds.width / 2, newCenter.y - newBounds.height / 2, newBounds.width, newBounds.height);\n }\n if (newBounds.width >= shape.options.minWidth && newBounds.height >= shape.options.minHeight) {\n var oldBounds = bounds;\n shape.bounds(newBounds);\n if (shape.hasOwnProperty('layout')) {\n shape.layout(shape, oldBounds, newBounds);\n }\n if (oldBounds.width !== newBounds.width || oldBounds.height !== newBounds.height) {\n shape.rotate(shape.rotate().angle);\n }\n changed += 1;\n }\n }\n if (changed) {\n if (changed == i) {\n newBounds = this._displaceBounds(this._innerBounds, dtl, dbr, dragging);\n this.bounds(newBounds);\n } else {\n this.refreshBounds();\n }\n this.refresh();\n }\n this._positions();\n }\n this._cp = p;\n },\n isDragHandle: function (handle) {\n return handle.x === 0 && handle.y === 0;\n },\n cancel: function () {\n var shapes = this.shapes;\n var states = this.shapeStates;\n for (var idx = 0; idx < shapes.length; idx++) {\n shapes[idx].bounds(states[idx]);\n }\n this.refreshBounds();\n this.refresh();\n this._manipulating = undefined;\n this._internalChange = undefined;\n this._rotating = undefined;\n },\n _truncatePositionToGuides: function (bounds) {\n if (this.diagram.ruler) {\n return this.diagram.ruler.truncatePositionToGuides(bounds);\n }\n return bounds;\n },\n _truncateSizeToGuides: function (bounds) {\n if (this.diagram.ruler) {\n return this.diagram.ruler.truncateSizeToGuides(bounds);\n }\n return bounds;\n },\n _truncateAngle: function (a) {\n var snap = this.snapOptions();\n var snapAngle = Math.max(snap.angle || DEFAULT_SNAP_ANGLE, MIN_SNAP_ANGLE);\n return snap ? Math.floor(a % 360 / snapAngle) * snapAngle : a % 360;\n },\n _truncateDistance: function (d) {\n if (d instanceof diagram.Point) {\n return new diagram.Point(this._truncateDistance(d.x), this._truncateDistance(d.y));\n } else {\n var snap = this.snapOptions() || {};\n var snapSize = Math.max(snap.size || DEFAULT_SNAP_SIZE, MIN_SNAP_SIZE);\n return snap ? Math.floor(d / snapSize) * snapSize : d;\n }\n },\n snapOptions: function () {\n var editable = this.diagram.options.editable;\n var snap = ((editable || {}).drag || {}).snap || {};\n return snap;\n },\n shouldSnap: function () {\n var editable = this.diagram.options.editable;\n var drag = (editable || {}).drag;\n var snap = (drag || {}).snap;\n return editable !== false && drag !== false && snap !== false;\n },\n _displaceBounds: function (bounds, dtl, dbr, dragging) {\n var tl = bounds.topLeft().plus(dtl), br = bounds.bottomRight().plus(dbr), newBounds = Rect.fromPoints(tl, br), newCenter;\n if (!dragging) {\n newCenter = newBounds.center();\n newCenter.rotate(bounds.center(), -this._angle);\n newBounds = new Rect(newCenter.x - newBounds.width / 2, newCenter.y - newBounds.height / 2, newBounds.width, newBounds.height);\n }\n return newBounds;\n },\n stop: function () {\n var unit, i, shape;\n if (this._cp != this._sp) {\n if (this._rotating) {\n unit = new RotateUnit(this, this.shapes, this.initialRotates);\n this._rotating = false;\n } else if (this._diffStates()) {\n if (this.diagram.ruler) {\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n var bounds = shape.bounds();\n bounds = this._truncateSizeToGuides(this._truncatePositionToGuides(bounds));\n shape.bounds(bounds);\n this.refreshBounds();\n this.refresh();\n }\n }\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n shape.updateModel();\n }\n unit = new TransformUnit(this.shapes, this.shapeStates, this);\n this.diagram._syncShapeChanges();\n }\n }\n this._manipulating = undefined;\n this._internalChange = undefined;\n this._rotating = undefined;\n return unit;\n },\n _diffStates: function () {\n var shapes = this.shapes;\n var states = this.shapeStates;\n for (var idx = 0; idx < shapes.length; idx++) {\n if (!shapes[idx].bounds().equals(states[idx])) {\n return true;\n }\n }\n return false;\n },\n refreshBounds: function () {\n var bounds = this.shapes.length == 1 ? this.shapes[0].bounds().clone() : this.diagram.boundingBox(this.shapes, true);\n this.bounds(bounds);\n },\n refresh: function () {\n var that = this, b, bounds;\n if (this.shapes.length > 0) {\n bounds = this.bounds();\n this.visual.visible(true);\n this.visual.position(bounds.topLeft());\n $.each(this.map, function () {\n b = that._getHandleBounds(new Point(this.x, this.y));\n this.visual.position(b.topLeft());\n });\n this.visual.position(bounds.topLeft());\n var center = new Point(bounds.width / 2, bounds.height / 2);\n this.visual.rotate(this._angle, center);\n this.rect.redraw({\n width: bounds.width,\n height: bounds.height\n });\n if (this.rotationThumb) {\n var thumb = this.options.editable.rotate.thumb;\n this._rotationThumbBounds = new Rect(bounds.center().x, bounds.y + thumb.y, 0, 0).inflate(thumb.width);\n this.rotationThumb.redraw({ x: bounds.width / 2 - thumb.width / 2 });\n }\n } else {\n this.visual.visible(false);\n }\n }\n });\n var Selector = Class.extend({\n init: function (diagram) {\n var selectable = diagram.options.selectable;\n this.options = deepExtend({}, this.options, selectable);\n this.visual = new Rectangle(this.options);\n this.diagram = diagram;\n },\n options: {\n stroke: {\n color: '#778899',\n width: 1,\n dashType: 'dash'\n },\n fill: { color: TRANSPARENT }\n },\n start: function (p) {\n this._sp = this._ep = p;\n this.refresh();\n this.diagram._adorn(this, true);\n },\n end: function () {\n this._sp = this._ep = undefined;\n this.diagram._adorn(this, false);\n },\n bounds: function (value) {\n if (value) {\n this._bounds = value;\n }\n return this._bounds;\n },\n move: function (p) {\n this._ep = p;\n this.refresh();\n },\n refresh: function () {\n if (this._sp) {\n var visualBounds = Rect.fromPoints(this.diagram.modelToLayer(this._sp), this.diagram.modelToLayer(this._ep));\n this.bounds(Rect.fromPoints(this._sp, this._ep));\n this.visual.position(visualBounds.topLeft());\n this.visual.redraw({\n height: visualBounds.height + 1,\n width: visualBounds.width + 1\n });\n }\n }\n });\n var ConnectorVisual = Class.extend({\n init: function (connector) {\n this.options = deepExtend({}, connector.options);\n this._c = connector;\n this.visual = new Circle(this.options);\n this.refresh();\n },\n _hover: function (value) {\n var options = this.options, hover = options.hover, stroke = options.stroke, fill = options.fill;\n if (value && Utils.isDefined(hover.stroke)) {\n stroke = deepExtend({}, stroke, hover.stroke);\n }\n if (value && Utils.isDefined(hover.fill)) {\n fill = hover.fill;\n }\n this.visual.redraw({\n stroke: stroke,\n fill: fill\n });\n },\n refresh: function () {\n var p = this._c.shape.diagram.modelToView(this._c.position()), relative = p.minus(this._c.shape.bounds('transformed').topLeft()), value = new Rect(p.x, p.y, 0, 0);\n value.inflate(this.options.width / 2, this.options.height / 2);\n this._visualBounds = value;\n this.visual.redraw({ center: new Point(relative.x, relative.y) });\n },\n _hitTest: function (p) {\n var tp = this._c.shape.diagram.modelToView(p);\n return this._visualBounds.contains(tp);\n }\n });\n function canDrag(element) {\n var editable = element.options.editable;\n return editable && editable.drag !== false;\n }\n function hitTestShapeConnectors(shape, point) {\n var connector, position, rect;\n for (var idx = 0; idx < shape.connectors.length; idx++) {\n connector = shape.connectors[idx];\n position = connector.position();\n rect = new Rect(position.x, position.y);\n rect.inflate(HIT_TEST_DISTANCE, HIT_TEST_DISTANCE);\n if (rect.contains(point)) {\n return connector;\n }\n }\n }\n function noMeta(meta) {\n return meta.ctrlKey === false && meta.altKey === false && meta.shiftKey === false;\n }\n deepExtend(diagram, {\n CompositeUnit: CompositeUnit,\n TransformUnit: TransformUnit,\n PanUndoUnit: PanUndoUnit,\n AddShapeUnit: AddShapeUnit,\n AddConnectionUnit: AddConnectionUnit,\n DeleteShapeUnit: DeleteShapeUnit,\n DeleteConnectionUnit: DeleteConnectionUnit,\n ConnectionEditAdorner: ConnectionEditAdorner,\n ConnectionTool: ConnectionTool,\n ConnectorVisual: ConnectorVisual,\n UndoRedoService: UndoRedoService,\n ResizingAdorner: ResizingAdorner,\n Selector: Selector,\n ToolService: ToolService,\n ConnectorsAdorner: ConnectorsAdorner,\n LayoutUndoUnit: LayoutUndoUnit,\n ConnectionEditUnit: ConnectionEditUnit,\n ToFrontUnit: ToFrontUnit,\n ToBackUnit: ToBackUnit,\n ConnectionRouterBase: ConnectionRouterBase,\n PolylineRouter: PolylineRouter,\n CascadingRouter: CascadingRouter,\n SelectionTool: SelectionTool,\n ScrollerTool: ScrollerTool,\n PointerTool: PointerTool,\n ConnectionEditTool: ConnectionEditTool,\n RotateUnit: RotateUnit\n });\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/layout', ['dataviz/diagram/math'], f);\n}(function () {\n (function ($, undefined) {\n var kendo = window.kendo, diagram = kendo.dataviz.diagram, Graph = diagram.Graph, Node = diagram.Node, Link = diagram.Link, deepExtend = kendo.deepExtend, Size = diagram.Size, Rect = diagram.Rect, Dictionary = diagram.Dictionary, Set = diagram.Set, HyperTree = diagram.Graph, Utils = diagram.Utils, Point = diagram.Point, EPSILON = 0.000001, DEG_TO_RAD = Math.PI / 180, contains = Utils.contains, grep = $.grep;\n var LayoutBase = kendo.Class.extend({\n defaultOptions: {\n type: 'Tree',\n subtype: 'Down',\n roots: null,\n animate: false,\n limitToView: false,\n friction: 0.9,\n nodeDistance: 50,\n iterations: 300,\n horizontalSeparation: 90,\n verticalSeparation: 50,\n underneathVerticalTopOffset: 15,\n underneathHorizontalOffset: 15,\n underneathVerticalSeparation: 15,\n grid: {\n width: 1500,\n offsetX: 50,\n offsetY: 50,\n componentSpacingX: 20,\n componentSpacingY: 20\n },\n layerSeparation: 50,\n layeredIterations: 2,\n startRadialAngle: 0,\n endRadialAngle: 360,\n radialSeparation: 150,\n radialFirstLevelSeparation: 200,\n keepComponentsInOneRadialLayout: false,\n ignoreContainers: true,\n layoutContainerChildren: false,\n ignoreInvisible: true,\n animateTransitions: false\n },\n init: function () {\n },\n gridLayoutComponents: function (components) {\n if (!components) {\n throw 'No components supplied.';\n }\n Utils.forEach(components, function (c) {\n c.calcBounds();\n });\n components.sort(function (a, b) {\n return b.bounds.width - a.bounds.width;\n });\n var maxWidth = this.options.grid.width, offsetX = this.options.grid.componentSpacingX, offsetY = this.options.grid.componentSpacingY, height = 0, startX = this.options.grid.offsetX, startY = this.options.grid.offsetY, x = startX, y = startY, i, resultLinkSet = [], resultNodeSet = [];\n while (components.length > 0) {\n if (x >= maxWidth) {\n x = startX;\n y += height + offsetY;\n height = 0;\n }\n var component = components.pop();\n this.moveToOffset(component, new Point(x, y));\n for (i = 0; i < component.nodes.length; i++) {\n resultNodeSet.push(component.nodes[i]);\n }\n for (i = 0; i < component.links.length; i++) {\n resultLinkSet.push(component.links[i]);\n }\n var boundingRect = component.bounds;\n var currentHeight = boundingRect.height;\n if (currentHeight <= 0 || isNaN(currentHeight)) {\n currentHeight = 0;\n }\n var currentWidth = boundingRect.width;\n if (currentWidth <= 0 || isNaN(currentWidth)) {\n currentWidth = 0;\n }\n if (currentHeight >= height) {\n height = currentHeight;\n }\n x += currentWidth + offsetX;\n }\n return {\n nodes: resultNodeSet,\n links: resultLinkSet\n };\n },\n moveToOffset: function (component, p) {\n var i, j, bounds = component.bounds, deltax = p.x - bounds.x, deltay = p.y - bounds.y;\n for (i = 0; i < component.nodes.length; i++) {\n var node = component.nodes[i];\n var nodeBounds = node.bounds();\n if (nodeBounds.width === 0 && nodeBounds.height === 0 && nodeBounds.x === 0 && nodeBounds.y === 0) {\n nodeBounds = new Rect(0, 0, 0, 0);\n }\n nodeBounds.x += deltax;\n nodeBounds.y += deltay;\n node.bounds(nodeBounds);\n }\n for (i = 0; i < component.links.length; i++) {\n var link = component.links[i];\n if (link.points) {\n var newpoints = [];\n var points = link.points;\n for (j = 0; j < points.length; j++) {\n var pt = points[j];\n pt.x += deltax;\n pt.y += deltay;\n newpoints.push(pt);\n }\n link.points = newpoints;\n }\n }\n this.currentHorizontalOffset += bounds.width + this.options.grid.offsetX;\n return new Point(deltax, deltay);\n },\n transferOptions: function (options) {\n this.options = kendo.deepExtend({}, this.defaultOptions);\n if (Utils.isUndefined(options)) {\n return;\n }\n this.options = kendo.deepExtend(this.options, options || {});\n }\n });\n var DiagramToHyperTreeAdapter = kendo.Class.extend({\n init: function (diagram) {\n this.nodeMap = new Dictionary();\n this.shapeMap = new Dictionary();\n this.nodes = [];\n this.edges = [];\n this.edgeMap = new Dictionary();\n this.finalNodes = [];\n this.finalLinks = [];\n this.ignoredConnections = [];\n this.ignoredShapes = [];\n this.hyperMap = new Dictionary();\n this.hyperTree = new Graph();\n this.finalGraph = null;\n this.diagram = diagram;\n },\n convert: function (options) {\n if (Utils.isUndefined(this.diagram)) {\n throw 'No diagram to convert.';\n }\n this.options = kendo.deepExtend({\n ignoreInvisible: true,\n ignoreContainers: true,\n layoutContainerChildren: false\n }, options || {});\n this.clear();\n this._renormalizeShapes();\n this._renormalizeConnections();\n this.finalNodes = new Dictionary(this.nodes);\n this.finalLinks = new Dictionary(this.edges);\n this.finalGraph = new Graph();\n this.finalNodes.forEach(function (n) {\n this.finalGraph.addNode(n);\n }, this);\n this.finalLinks.forEach(function (l) {\n this.finalGraph.addExistingLink(l);\n }, this);\n return this.finalGraph;\n },\n mapConnection: function (connection) {\n return this.edgeMap.get(connection.id);\n },\n mapShape: function (shape) {\n return this.nodeMap.get(shape.id);\n },\n getEdge: function (a, b) {\n return Utils.first(a.links, function (link) {\n return link.getComplement(a) === b;\n });\n },\n clear: function () {\n this.finalGraph = null;\n this.hyperTree = !this.options.ignoreContainers && this.options.layoutContainerChildren ? new HyperTree() : null;\n this.hyperMap = !this.options.ignoreContainers && this.options.layoutContainerChildren ? new Dictionary() : null;\n this.nodeMap = new Dictionary();\n this.shapeMap = new Dictionary();\n this.nodes = [];\n this.edges = [];\n this.edgeMap = new Dictionary();\n this.ignoredConnections = [];\n this.ignoredShapes = [];\n this.finalNodes = [];\n this.finalLinks = [];\n },\n listToRoot: function (containerGraph) {\n var list = [];\n var s = containerGraph.container;\n if (!s) {\n return list;\n }\n list.push(s);\n while (s.parentContainer) {\n s = s.parentContainer;\n list.push(s);\n }\n list.reverse();\n return list;\n },\n firstNonIgnorableContainer: function (shape) {\n if (shape.isContainer && !this._isIgnorableItem(shape)) {\n return shape;\n }\n return !shape.parentContainer ? null : this.firstNonIgnorableContainer(shape.parentContainer);\n },\n isContainerConnection: function (a, b) {\n if (a.isContainer && this.isDescendantOf(a, b)) {\n return true;\n }\n return b.isContainer && this.isDescendantOf(b, a);\n },\n isDescendantOf: function (scope, a) {\n if (!scope.isContainer) {\n throw 'Expecting a container.';\n }\n if (scope === a) {\n return false;\n }\n if (contains(scope.children, a)) {\n return true;\n }\n var containers = [];\n for (var i = 0, len = scope.children.length; i < len; i++) {\n var c = scope.children[i];\n if (c.isContainer && this.isDescendantOf(c, a)) {\n containers.push(c);\n }\n }\n return containers.length > 0;\n },\n isIgnorableItem: function (shape) {\n if (this.options.ignoreInvisible) {\n if (shape.isCollapsed && this._isVisible(shape)) {\n return false;\n }\n if (!shape.isCollapsed && this._isVisible(shape)) {\n return false;\n }\n return true;\n } else {\n return shape.isCollapsed && !this._isTop(shape);\n }\n },\n isShapeMapped: function (shape) {\n return shape.isCollapsed && !this._isVisible(shape) && !this._isTop(shape);\n },\n leastCommonAncestor: function (a, b) {\n if (!a) {\n throw 'Parameter should not be null.';\n }\n if (!b) {\n throw 'Parameter should not be null.';\n }\n if (!this.hyperTree) {\n throw 'No hypertree available.';\n }\n var al = this.listToRoot(a);\n var bl = this.listToRoot(b);\n var found = null;\n if (Utils.isEmpty(al) || Utils.isEmpty(bl)) {\n return this.hyperTree.root.data;\n }\n var xa = al[0];\n var xb = bl[0];\n var i = 0;\n while (xa === xb) {\n found = al[i];\n i++;\n if (i >= al.length || i >= bl.length) {\n break;\n }\n xa = al[i];\n xb = bl[i];\n }\n if (!found) {\n return this.hyperTree.root.data;\n } else {\n return grep(this.hyperTree.nodes, function (n) {\n return n.data.container === found;\n });\n }\n },\n _isTop: function (item) {\n return !item.parentContainer;\n },\n _isVisible: function (shape) {\n if (!shape.visible()) {\n return false;\n }\n return !shape.parentContainer ? shape.visible() : this._isVisible(shape.parentContainer);\n },\n _isCollapsed: function (shape) {\n if (shape.isContainer && shape.isCollapsed) {\n return true;\n }\n return shape.parentContainer && this._isCollapsed(shape.parentContainer);\n },\n _renormalizeShapes: function () {\n if (this.options.ignoreContainers) {\n for (var i = 0, len = this.diagram.shapes.length; i < len; i++) {\n var shape = this.diagram.shapes[i];\n if (this.options.ignoreInvisible && !this._isVisible(shape) || shape.isContainer) {\n this.ignoredShapes.push(shape);\n continue;\n }\n var node = new Node(shape.id, shape);\n node.isVirtual = false;\n this.nodeMap.add(shape.id, node);\n this.nodes.push(node);\n }\n } else {\n throw 'Containers are not supported yet, but stay tuned.';\n }\n },\n _renormalizeConnections: function () {\n if (this.diagram.connections.length === 0) {\n return;\n }\n for (var i = 0, len = this.diagram.connections.length; i < len; i++) {\n var conn = this.diagram.connections[i];\n if (this.isIgnorableItem(conn)) {\n this.ignoredConnections.push(conn);\n continue;\n }\n var source = !conn.sourceConnector ? null : conn.sourceConnector.shape;\n var sink = !conn.targetConnector ? null : conn.targetConnector.shape;\n if (!source || !sink) {\n this.ignoredConnections.push(conn);\n continue;\n }\n if (contains(this.ignoredShapes, source) && !this.shapeMap.containsKey(source)) {\n this.ignoredConnections.push(conn);\n continue;\n }\n if (contains(this.ignoredShapes, sink) && !this.shapeMap.containsKey(sink)) {\n this.ignoredConnections.push(conn);\n continue;\n }\n if (this.shapeMap.containsKey(source)) {\n source = this.shapeMap[source];\n }\n if (this.shapeMap.containsKey(sink)) {\n sink = this.shapeMap[sink];\n }\n var sourceNode = this.mapShape(source);\n var sinkNode = this.mapShape(sink);\n if (sourceNode === sinkNode || this.areConnectedAlready(sourceNode, sinkNode)) {\n this.ignoredConnections.push(conn);\n continue;\n }\n if (sourceNode === null || sinkNode === null) {\n throw 'A shape was not mapped to a node.';\n }\n if (this.options.ignoreContainers) {\n if (sourceNode.isVirtual || sinkNode.isVirtual) {\n this.ignoredConnections.push(conn);\n continue;\n }\n var newEdge = new Link(sourceNode, sinkNode, conn.id, conn);\n this.edgeMap.add(conn.id, newEdge);\n this.edges.push(newEdge);\n } else {\n throw 'Containers are not supported yet, but stay tuned.';\n }\n }\n },\n areConnectedAlready: function (n, m) {\n return Utils.any(this.edges, function (l) {\n return l.source === n && l.target === m || l.source === m && l.target === n;\n });\n }\n });\n var SpringLayout = LayoutBase.extend({\n init: function (diagram) {\n var that = this;\n LayoutBase.fn.init.call(that);\n if (Utils.isUndefined(diagram)) {\n throw 'Diagram is not specified.';\n }\n this.diagram = diagram;\n },\n layout: function (options) {\n this.transferOptions(options);\n var adapter = new DiagramToHyperTreeAdapter(this.diagram);\n var graph = adapter.convert(options);\n if (graph.isEmpty()) {\n return;\n }\n var components = graph.getConnectedComponents();\n if (Utils.isEmpty(components)) {\n return;\n }\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n this.layoutGraph(component, options);\n }\n var finalNodeSet = this.gridLayoutComponents(components);\n return new diagram.LayoutState(this.diagram, finalNodeSet);\n },\n layoutGraph: function (graph, options) {\n if (Utils.isDefined(options)) {\n this.transferOptions(options);\n }\n this.graph = graph;\n var initialTemperature = this.options.nodeDistance * 9;\n this.temperature = initialTemperature;\n var guessBounds = this._expectedBounds();\n this.width = guessBounds.width;\n this.height = guessBounds.height;\n for (var step = 0; step < this.options.iterations; step++) {\n this.refineStage = step >= this.options.iterations * 5 / 6;\n this.tick();\n this.temperature = this.refineStage ? initialTemperature / 30 : initialTemperature * (1 - step / (2 * this.options.iterations));\n }\n },\n tick: function () {\n var i;\n for (i = 0; i < this.graph.nodes.length; i++) {\n this._repulsion(this.graph.nodes[i]);\n }\n for (i = 0; i < this.graph.links.length; i++) {\n this._attraction(this.graph.links[i]);\n }\n for (i = 0; i < this.graph.nodes.length; i++) {\n var node = this.graph.nodes[i];\n var offset = Math.sqrt(node.dx * node.dx + node.dy * node.dy);\n if (offset === 0) {\n return;\n }\n node.x += Math.min(offset, this.temperature) * node.dx / offset;\n node.y += Math.min(offset, this.temperature) * node.dy / offset;\n if (this.options.limitToView) {\n node.x = Math.min(this.width, Math.max(node.width / 2, node.x));\n node.y = Math.min(this.height, Math.max(node.height / 2, node.y));\n }\n }\n },\n _shake: function (node) {\n var rho = Math.random() * this.options.nodeDistance / 4;\n var alpha = Math.random() * 2 * Math.PI;\n node.x += rho * Math.cos(alpha);\n node.y -= rho * Math.sin(alpha);\n },\n _InverseSquareForce: function (d, n, m) {\n var force;\n if (!this.refineStage) {\n force = Math.pow(d, 2) / Math.pow(this.options.nodeDistance, 2);\n } else {\n var deltax = n.x - m.x;\n var deltay = n.y - m.y;\n var wn = n.width / 2;\n var hn = n.height / 2;\n var wm = m.width / 2;\n var hm = m.height / 2;\n force = Math.pow(deltax, 2) / Math.pow(wn + wm + this.options.nodeDistance, 2) + Math.pow(deltay, 2) / Math.pow(hn + hm + this.options.nodeDistance, 2);\n }\n return force * 4 / 3;\n },\n _SquareForce: function (d, n, m) {\n return 1 / this._InverseSquareForce(d, n, m);\n },\n _repulsion: function (n) {\n n.dx = 0;\n n.dy = 0;\n Utils.forEach(this.graph.nodes, function (m) {\n if (m === n) {\n return;\n }\n while (n.x === m.x && n.y === m.y) {\n this._shake(m);\n }\n var vx = n.x - m.x;\n var vy = n.y - m.y;\n var distance = Math.sqrt(vx * vx + vy * vy);\n var r = this._SquareForce(distance, n, m) * 2;\n n.dx += vx / distance * r;\n n.dy += vy / distance * r;\n }, this);\n },\n _attraction: function (link) {\n var t = link.target;\n var s = link.source;\n if (s === t) {\n return;\n }\n while (s.x === t.x && s.y === t.y) {\n this._shake(t);\n }\n var vx = s.x - t.x;\n var vy = s.y - t.y;\n var distance = Math.sqrt(vx * vx + vy * vy);\n var a = this._InverseSquareForce(distance, s, t) * 5;\n var dx = vx / distance * a;\n var dy = vy / distance * a;\n t.dx += dx;\n t.dy += dy;\n s.dx -= dx;\n s.dy -= dy;\n },\n _expectedBounds: function () {\n var size, N = this.graph.nodes.length, ratio = 1.5, multiplier = 4;\n if (N === 0) {\n return size;\n }\n size = Utils.fold(this.graph.nodes, function (s, node) {\n var area = node.width * node.height;\n if (area > 0) {\n s += Math.sqrt(area);\n return s;\n }\n return 0;\n }, 0, this);\n var av = size / N;\n var squareSize = av * Math.ceil(Math.sqrt(N));\n var width = squareSize * Math.sqrt(ratio);\n var height = squareSize / Math.sqrt(ratio);\n return {\n width: width * multiplier,\n height: height * multiplier\n };\n }\n });\n var TreeLayoutProcessor = kendo.Class.extend({\n init: function (options) {\n this.center = null;\n this.options = options;\n },\n layout: function (treeGraph, root) {\n this.graph = treeGraph;\n if (!this.graph.nodes || this.graph.nodes.length === 0) {\n return;\n }\n if (!contains(this.graph.nodes, root)) {\n throw 'The given root is not in the graph.';\n }\n this.center = root;\n this.graph.cacheRelationships();\n this.layoutSwitch();\n },\n layoutLeft: function (left) {\n this.setChildrenDirection(this.center, 'Left', false);\n this.setChildrenLayout(this.center, 'Default', false);\n var h = 0, w = 0, y, i, node;\n for (i = 0; i < left.length; i++) {\n node = left[i];\n node.TreeDirection = 'Left';\n var s = this.measure(node, Size.Empty);\n w = Math.max(w, s.Width);\n h += s.height + this.options.verticalSeparation;\n }\n h -= this.options.verticalSeparation;\n var x = this.center.x - this.options.horizontalSeparation;\n y = this.center.y + (this.center.height - h) / 2;\n for (i = 0; i < left.length; i++) {\n node = left[i];\n var p = new Point(x - node.Size.width, y);\n this.arrange(node, p);\n y += node.Size.height + this.options.verticalSeparation;\n }\n },\n layoutRight: function (right) {\n this.setChildrenDirection(this.center, 'Right', false);\n this.setChildrenLayout(this.center, 'Default', false);\n var h = 0, w = 0, y, i, node;\n for (i = 0; i < right.length; i++) {\n node = right[i];\n node.TreeDirection = 'Right';\n var s = this.measure(node, Size.Empty);\n w = Math.max(w, s.Width);\n h += s.height + this.options.verticalSeparation;\n }\n h -= this.options.verticalSeparation;\n var x = this.center.x + this.options.horizontalSeparation + this.center.width;\n y = this.center.y + (this.center.height - h) / 2;\n for (i = 0; i < right.length; i++) {\n node = right[i];\n var p = new Point(x, y);\n this.arrange(node, p);\n y += node.Size.height + this.options.verticalSeparation;\n }\n },\n layoutUp: function (up) {\n this.setChildrenDirection(this.center, 'Up', false);\n this.setChildrenLayout(this.center, 'Default', false);\n var w = 0, y, node, i;\n for (i = 0; i < up.length; i++) {\n node = up[i];\n node.TreeDirection = 'Up';\n var s = this.measure(node, Size.Empty);\n w += s.width + this.options.horizontalSeparation;\n }\n w -= this.options.horizontalSeparation;\n var x = this.center.x + this.center.width / 2 - w / 2;\n for (i = 0; i < up.length; i++) {\n node = up[i];\n y = this.center.y - this.options.verticalSeparation - node.Size.height;\n var p = new Point(x, y);\n this.arrange(node, p);\n x += node.Size.width + this.options.horizontalSeparation;\n }\n },\n layoutDown: function (down) {\n var node, i;\n this.setChildrenDirection(this.center, 'Down', false);\n this.setChildrenLayout(this.center, 'Default', false);\n var w = 0, y;\n for (i = 0; i < down.length; i++) {\n node = down[i];\n node.treeDirection = 'Down';\n var s = this.measure(node, Size.Empty);\n w += s.width + this.options.horizontalSeparation;\n }\n w -= this.options.horizontalSeparation;\n var x = this.center.x + this.center.width / 2 - w / 2;\n y = this.center.y + this.options.verticalSeparation + this.center.height;\n for (i = 0; i < down.length; i++) {\n node = down[i];\n var p = new Point(x, y);\n this.arrange(node, p);\n x += node.Size.width + this.options.horizontalSeparation;\n }\n },\n layoutRadialTree: function () {\n this.setChildrenDirection(this.center, 'Radial', false);\n this.setChildrenLayout(this.center, 'Default', false);\n this.previousRoot = null;\n var startAngle = this.options.startRadialAngle * DEG_TO_RAD;\n var endAngle = this.options.endRadialAngle * DEG_TO_RAD;\n if (endAngle <= startAngle) {\n throw 'Final angle should not be less than the start angle.';\n }\n this.maxDepth = 0;\n this.origin = new Point(this.center.x, this.center.y);\n this.calculateAngularWidth(this.center, 0);\n if (this.maxDepth > 0) {\n this.radialLayout(this.center, this.options.radialFirstLevelSeparation, startAngle, endAngle);\n }\n this.center.Angle = endAngle - startAngle;\n },\n tipOverTree: function (down, startFromLevel) {\n if (Utils.isUndefined(startFromLevel)) {\n startFromLevel = 0;\n }\n this.setChildrenDirection(this.center, 'Down', false);\n this.setChildrenLayout(this.center, 'Default', false);\n this.setChildrenLayout(this.center, 'Underneath', false, startFromLevel);\n var w = 0, y, node, i;\n for (i = 0; i < down.length; i++) {\n node = down[i];\n node.TreeDirection = 'Down';\n var s = this.measure(node, Size.Empty);\n w += s.width + this.options.horizontalSeparation;\n }\n w -= this.options.horizontalSeparation;\n w -= down[down.length - 1].width;\n w += down[down.length - 1].associatedShape.bounds().width;\n var x = this.center.x + this.center.width / 2 - w / 2;\n y = this.center.y + this.options.verticalSeparation + this.center.height;\n for (i = 0; i < down.length; i++) {\n node = down[i];\n var p = new Point(x, y);\n this.arrange(node, p);\n x += node.Size.width + this.options.horizontalSeparation;\n }\n },\n calculateAngularWidth: function (n, d) {\n if (d > this.maxDepth) {\n this.maxDepth = d;\n }\n var aw = 0, w = 1000, h = 1000, diameter = d === 0 ? 0 : Math.sqrt(w * w + h * h) / d;\n if (n.children.length > 0) {\n for (var i = 0, len = n.children.length; i < len; i++) {\n var child = n.children[i];\n aw += this.calculateAngularWidth(child, d + 1);\n }\n aw = Math.max(diameter, aw);\n } else {\n aw = diameter;\n }\n n.sectorAngle = aw;\n return aw;\n },\n sortChildren: function (n) {\n var basevalue = 0, i;\n if (n.parents.length > 1) {\n throw 'Node is not part of a tree.';\n }\n var p = n.parents[0];\n if (p) {\n var pl = new Point(p.x, p.y);\n var nl = new Point(n.x, n.y);\n basevalue = this.normalizeAngle(Math.atan2(pl.y - nl.y, pl.x - nl.x));\n }\n var count = n.children.length;\n if (count === 0) {\n return null;\n }\n var angle = [];\n var idx = [];\n for (i = 0; i < count; ++i) {\n var c = n.children[i];\n var l = new Point(c.x, c.y);\n idx[i] = i;\n angle[i] = this.normalizeAngle(-basevalue + Math.atan2(l.y - l.y, l.x - l.x));\n }\n Utils.bisort(angle, idx);\n var col = [];\n var children = n.children;\n for (i = 0; i < count; ++i) {\n col.push(children[idx[i]]);\n }\n return col;\n },\n normalizeAngle: function (angle) {\n while (angle > Math.PI * 2) {\n angle -= 2 * Math.PI;\n }\n while (angle < 0) {\n angle += Math.PI * 2;\n }\n return angle;\n },\n radialLayout: function (node, radius, startAngle, endAngle) {\n var deltaTheta = endAngle - startAngle;\n var deltaThetaHalf = deltaTheta / 2;\n var parentSector = node.sectorAngle;\n var fraction = 0;\n var sorted = this.sortChildren(node);\n for (var i = 0, len = sorted.length; i < len; i++) {\n var childNode = sorted[i];\n var cp = childNode;\n var childAngleFraction = cp.sectorAngle / parentSector;\n if (childNode.children.length > 0) {\n this.radialLayout(childNode, radius + this.options.radialSeparation, startAngle + fraction * deltaTheta, startAngle + (fraction + childAngleFraction) * deltaTheta);\n }\n this.setPolarLocation(childNode, radius, startAngle + fraction * deltaTheta + childAngleFraction * deltaThetaHalf);\n cp.angle = childAngleFraction * deltaTheta;\n fraction += childAngleFraction;\n }\n },\n setPolarLocation: function (node, radius, angle) {\n node.x = this.origin.x + radius * Math.cos(angle);\n node.y = this.origin.y + radius * Math.sin(angle);\n node.BoundingRectangle = new Rect(node.x, node.y, node.width, node.height);\n },\n setChildrenDirection: function (node, direction, includeStart) {\n var rootDirection = node.treeDirection;\n this.graph.depthFirstTraversal(node, function (n) {\n n.treeDirection = direction;\n });\n if (!includeStart) {\n node.treeDirection = rootDirection;\n }\n },\n setChildrenLayout: function (node, layout, includeStart, startFromLevel) {\n if (Utils.isUndefined(startFromLevel)) {\n startFromLevel = 0;\n }\n var rootLayout = node.childrenLayout;\n if (startFromLevel > 0) {\n this.graph.assignLevels(node);\n this.graph.depthFirstTraversal(node, function (s) {\n if (s.level >= startFromLevel + 1) {\n s.childrenLayout = layout;\n }\n });\n } else {\n this.graph.depthFirstTraversal(node, function (s) {\n s.childrenLayout = layout;\n });\n if (!includeStart) {\n node.childrenLayout = rootLayout;\n }\n }\n },\n measure: function (node, givenSize) {\n var w = 0, h = 0, s;\n var result = new Size(0, 0);\n if (!node) {\n throw '';\n }\n var b = node.associatedShape.bounds();\n var shapeWidth = b.width;\n var shapeHeight = b.height;\n if (node.parents.length !== 1) {\n throw 'Node not in a spanning tree.';\n }\n var parent = node.parents[0];\n if (node.treeDirection === 'Undefined') {\n node.treeDirection = parent.treeDirection;\n }\n if (Utils.isEmpty(node.children)) {\n result = new Size(Math.abs(shapeWidth) < EPSILON ? 50 : shapeWidth, Math.abs(shapeHeight) < EPSILON ? 25 : shapeHeight);\n } else if (node.children.length === 1) {\n switch (node.treeDirection) {\n case 'Radial':\n s = this.measure(node.children[0], givenSize);\n w = shapeWidth + this.options.radialSeparation * Math.cos(node.AngleToParent) + s.width;\n h = shapeHeight + Math.abs(this.options.radialSeparation * Math.sin(node.AngleToParent)) + s.height;\n break;\n case 'Left':\n case 'Right':\n switch (node.childrenLayout) {\n case 'TopAlignedWithParent':\n break;\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n s = this.measure(node.children[0], givenSize);\n w = shapeWidth + s.width + this.options.underneathHorizontalOffset;\n h = shapeHeight + this.options.underneathVerticalTopOffset + s.height;\n break;\n case 'Default':\n s = this.measure(node.children[0], givenSize);\n w = shapeWidth + this.options.horizontalSeparation + s.width;\n h = Math.max(shapeHeight, s.height);\n break;\n default:\n throw 'Unhandled TreeDirection in the Radial layout measuring.';\n }\n break;\n case 'Up':\n case 'Down':\n switch (node.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n s = this.measure(node.children[0], givenSize);\n w = Math.max(shapeWidth, s.width + this.options.underneathHorizontalOffset);\n h = shapeHeight + this.options.underneathVerticalTopOffset + s.height;\n break;\n case 'Default':\n s = this.measure(node.children[0], givenSize);\n h = shapeHeight + this.options.verticalSeparation + s.height;\n w = Math.max(shapeWidth, s.width);\n break;\n default:\n throw 'Unhandled TreeDirection in the Down layout measuring.';\n }\n break;\n default:\n throw 'Unhandled TreeDirection in the layout measuring.';\n }\n result = new Size(w, h);\n } else {\n var i, childNode;\n switch (node.treeDirection) {\n case 'Left':\n case 'Right':\n switch (node.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n w = shapeWidth;\n h = shapeHeight + this.options.underneathVerticalTopOffset;\n for (i = 0; i < node.children.length; i++) {\n childNode = node.children[i];\n s = this.measure(childNode, givenSize);\n w = Math.max(w, s.width + this.options.underneathHorizontalOffset);\n h += s.height + this.options.underneathVerticalSeparation;\n }\n h -= this.options.underneathVerticalSeparation;\n break;\n case 'Default':\n w = shapeWidth;\n h = 0;\n for (i = 0; i < node.children.length; i++) {\n childNode = node.children[i];\n s = this.measure(childNode, givenSize);\n w = Math.max(w, shapeWidth + this.options.horizontalSeparation + s.width);\n h += s.height + this.options.verticalSeparation;\n }\n h -= this.options.verticalSeparation;\n break;\n default:\n throw 'Unhandled TreeDirection in the Right layout measuring.';\n }\n break;\n case 'Up':\n case 'Down':\n switch (node.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n w = shapeWidth;\n h = shapeHeight + this.options.underneathVerticalTopOffset;\n for (i = 0; i < node.children.length; i++) {\n childNode = node.children[i];\n s = this.measure(childNode, givenSize);\n w = Math.max(w, s.width + this.options.underneathHorizontalOffset);\n h += s.height + this.options.underneathVerticalSeparation;\n }\n h -= this.options.underneathVerticalSeparation;\n break;\n case 'Default':\n w = 0;\n h = 0;\n for (i = 0; i < node.children.length; i++) {\n childNode = node.children[i];\n s = this.measure(childNode, givenSize);\n w += s.width + this.options.horizontalSeparation;\n h = Math.max(h, s.height + this.options.verticalSeparation + shapeHeight);\n }\n w -= this.options.horizontalSeparation;\n break;\n default:\n throw 'Unhandled TreeDirection in the Down layout measuring.';\n }\n break;\n default:\n throw 'Unhandled TreeDirection in the layout measuring.';\n }\n result = new Size(w, h);\n }\n node.SectorAngle = Math.sqrt(w * w / 4 + h * h / 4);\n node.Size = result;\n return result;\n },\n arrange: function (n, p) {\n var i, pp, child, node, childrenwidth, b = n.associatedShape.bounds();\n var shapeWidth = b.width;\n var shapeHeight = b.height;\n if (Utils.isEmpty(n.children)) {\n n.x = p.x;\n n.y = p.y;\n n.BoundingRectangle = new Rect(p.x, p.y, shapeWidth, shapeHeight);\n } else {\n var x, y;\n var selfLocation;\n switch (n.treeDirection) {\n case 'Left':\n switch (n.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n selfLocation = p;\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n y = p.y + shapeHeight + this.options.underneathVerticalTopOffset;\n for (i = 0; i < node.children.length; i++) {\n node = node.children[i];\n x = selfLocation.x - node.associatedShape.width - this.options.underneathHorizontalOffset;\n pp = new Point(x, y);\n this.arrange(node, pp);\n y += node.Size.height + this.options.underneathVerticalSeparation;\n }\n break;\n case 'Default':\n selfLocation = new Point(p.x + n.Size.width - shapeWidth, p.y + (n.Size.height - shapeHeight) / 2);\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n x = selfLocation.x - this.options.horizontalSeparation;\n y = p.y;\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n pp = new Point(x - node.Size.width, y);\n this.arrange(node, pp);\n y += node.Size.height + this.options.verticalSeparation;\n }\n break;\n default:\n throw 'Unsupported TreeDirection';\n }\n break;\n case 'Right':\n switch (n.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n selfLocation = p;\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n x = p.x + shapeWidth + this.options.underneathHorizontalOffset;\n y = p.y + shapeHeight + this.options.underneathVerticalTopOffset;\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n pp = new Point(x, y);\n this.arrange(node, pp);\n y += node.Size.height + this.options.underneathVerticalSeparation;\n }\n break;\n case 'Default':\n selfLocation = new Point(p.x, p.y + (n.Size.height - shapeHeight) / 2);\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n x = p.x + shapeWidth + this.options.horizontalSeparation;\n y = p.y;\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n pp = new Point(x, y);\n this.arrange(node, pp);\n y += node.Size.height + this.options.verticalSeparation;\n }\n break;\n default:\n throw 'Unsupported TreeDirection';\n }\n break;\n case 'Up':\n selfLocation = new Point(p.x + (n.Size.width - shapeWidth) / 2, p.y + n.Size.height - shapeHeight);\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n if (Math.abs(selfLocation.x - p.x) < EPSILON) {\n childrenwidth = 0;\n for (i = 0; i < n.children.length; i++) {\n child = n.children[i];\n childrenwidth += child.Size.width + this.options.horizontalSeparation;\n }\n childrenwidth -= this.options.horizontalSeparation;\n x = p.x + (shapeWidth - childrenwidth) / 2;\n } else {\n x = p.x;\n }\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n y = selfLocation.y - this.options.verticalSeparation - node.Size.height;\n pp = new Point(x, y);\n this.arrange(node, pp);\n x += node.Size.width + this.options.horizontalSeparation;\n }\n break;\n case 'Down':\n switch (n.childrenLayout) {\n case 'TopAlignedWithParent':\n case 'BottomAlignedWithParent':\n break;\n case 'Underneath':\n selfLocation = p;\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n x = p.x + this.options.underneathHorizontalOffset;\n y = p.y + shapeHeight + this.options.underneathVerticalTopOffset;\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n pp = new Point(x, y);\n this.arrange(node, pp);\n y += node.Size.height + this.options.underneathVerticalSeparation;\n }\n break;\n case 'Default':\n selfLocation = new Point(p.x + (n.Size.width - shapeWidth) / 2, p.y);\n n.x = selfLocation.x;\n n.y = selfLocation.y;\n n.BoundingRectangle = new Rect(n.x, n.y, n.width, n.height);\n if (Math.abs(selfLocation.x - p.x) < EPSILON) {\n childrenwidth = 0;\n for (i = 0; i < n.children.length; i++) {\n child = n.children[i];\n childrenwidth += child.Size.width + this.options.horizontalSeparation;\n }\n childrenwidth -= this.options.horizontalSeparation;\n x = p.x + (shapeWidth - childrenwidth) / 2;\n } else {\n x = p.x;\n }\n for (i = 0; i < n.children.length; i++) {\n node = n.children[i];\n y = selfLocation.y + this.options.verticalSeparation + shapeHeight;\n pp = new Point(x, y);\n this.arrange(node, pp);\n x += node.Size.width + this.options.horizontalSeparation;\n }\n break;\n default:\n throw 'Unsupported TreeDirection';\n }\n break;\n case 'None':\n break;\n default:\n throw 'Unsupported TreeDirection';\n }\n }\n },\n layoutSwitch: function () {\n if (!this.center) {\n return;\n }\n if (Utils.isEmpty(this.center.children)) {\n return;\n }\n var type = this.options.subtype;\n if (Utils.isUndefined(type)) {\n type = 'Down';\n }\n var single, male, female, leftcount;\n var children = this.center.children;\n switch (type.toLowerCase()) {\n case 'radial':\n case 'radialtree':\n this.layoutRadialTree();\n break;\n case 'mindmaphorizontal':\n case 'mindmap':\n single = this.center.children;\n if (this.center.children.length === 1) {\n this.layoutRight(single);\n } else {\n leftcount = children.length / 2;\n male = grep(this.center.children, function (n) {\n return Utils.indexOf(children, n) < leftcount;\n });\n female = grep(this.center.children, function (n) {\n return Utils.indexOf(children, n) >= leftcount;\n });\n this.layoutLeft(male);\n this.layoutRight(female);\n }\n break;\n case 'mindmapvertical':\n single = this.center.children;\n if (this.center.children.length === 1) {\n this.layoutDown(single);\n } else {\n leftcount = children.length / 2;\n male = grep(this.center.children, function (n) {\n return Utils.indexOf(children, n) < leftcount;\n });\n female = grep(this.center.children, function (n) {\n return Utils.indexOf(children, n) >= leftcount;\n });\n this.layoutUp(male);\n this.layoutDown(female);\n }\n break;\n case 'right':\n this.layoutRight(this.center.children);\n break;\n case 'left':\n this.layoutLeft(this.center.children);\n break;\n case 'up':\n case 'bottom':\n this.layoutUp(this.center.children);\n break;\n case 'down':\n case 'top':\n this.layoutDown(this.center.children);\n break;\n case 'tipover':\n case 'tipovertree':\n if (this.options.tipOverTreeStartLevel < 0) {\n throw 'The tip-over level should be a positive integer.';\n }\n this.tipOverTree(this.center.children, this.options.tipOverTreeStartLevel);\n break;\n case 'undefined':\n case 'none':\n break;\n }\n }\n });\n var TreeLayout = LayoutBase.extend({\n init: function (diagram) {\n var that = this;\n LayoutBase.fn.init.call(that);\n if (Utils.isUndefined(diagram)) {\n throw 'No diagram specified.';\n }\n this.diagram = diagram;\n },\n layout: function (options) {\n this.transferOptions(options);\n var adapter = new DiagramToHyperTreeAdapter(this.diagram);\n this.graph = adapter.convert();\n var finalNodeSet = this.layoutComponents();\n return new diagram.LayoutState(this.diagram, finalNodeSet);\n },\n layoutComponents: function () {\n if (this.graph.isEmpty()) {\n return;\n }\n var components = this.graph.getConnectedComponents();\n if (Utils.isEmpty(components)) {\n return;\n }\n var layout = new TreeLayoutProcessor(this.options);\n var trees = [];\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n var treeGraph = this.getTree(component);\n if (!treeGraph) {\n throw 'Failed to find a spanning tree for the component.';\n }\n var root = treeGraph.root;\n var tree = treeGraph.tree;\n layout.layout(tree, root);\n trees.push(tree);\n }\n return this.gridLayoutComponents(trees);\n },\n getTree: function (graph) {\n var root = null;\n if (this.options.roots && this.options.roots.length > 0) {\n for (var i = 0, len = graph.nodes.length; i < len; i++) {\n var node = graph.nodes[i];\n for (var j = 0; j < this.options.roots.length; j++) {\n var givenRootShape = this.options.roots[j];\n if (givenRootShape === node.associatedShape) {\n root = node;\n break;\n }\n }\n }\n }\n if (!root) {\n root = graph.root();\n if (!root) {\n throw 'Unable to find a root for the tree.';\n }\n }\n return this.getTreeForRoot(graph, root);\n },\n getTreeForRoot: function (graph, root) {\n var tree = graph.getSpanningTree(root);\n if (Utils.isUndefined(tree) || tree.isEmpty()) {\n return null;\n }\n return {\n tree: tree,\n root: tree.root\n };\n }\n });\n var LayeredLayout = LayoutBase.extend({\n init: function (diagram) {\n var that = this;\n LayoutBase.fn.init.call(that);\n if (Utils.isUndefined(diagram)) {\n throw 'Diagram is not specified.';\n }\n this.diagram = diagram;\n },\n layout: function (options) {\n this.transferOptions(options);\n var adapter = new DiagramToHyperTreeAdapter(this.diagram);\n var graph = adapter.convert(options);\n if (graph.isEmpty()) {\n return;\n }\n var components = graph.getConnectedComponents();\n if (Utils.isEmpty(components)) {\n return;\n }\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n this.layoutGraph(component, options);\n }\n var finalNodeSet = this.gridLayoutComponents(components);\n return new diagram.LayoutState(this.diagram, finalNodeSet);\n },\n _initRuntimeProperties: function () {\n for (var k = 0; k < this.graph.nodes.length; k++) {\n var node = this.graph.nodes[k];\n node.layer = -1;\n node.downstreamLinkCount = 0;\n node.upstreamLinkCount = 0;\n node.isVirtual = false;\n node.uBaryCenter = 0;\n node.dBaryCenter = 0;\n node.upstreamPriority = 0;\n node.downstreamPriority = 0;\n node.gridPosition = 0;\n }\n },\n _prepare: function (graph) {\n var current = [], i, l, link;\n var layerMap = new Dictionary();\n var layerCount = 0;\n var targetLayer, next, target;\n Utils.forEach(graph.nodes, function (node) {\n if (node.incoming.length === 0) {\n layerMap.set(node, 0);\n current.push(node);\n }\n });\n while (current.length > 0) {\n next = current.shift();\n for (i = 0; i < next.outgoing.length; i++) {\n link = next.outgoing[i];\n target = link.target;\n if (layerMap.containsKey(target)) {\n targetLayer = Math.max(layerMap.get(next) + 1, layerMap.get(target));\n } else {\n targetLayer = layerMap.get(next) + 1;\n }\n layerMap.set(target, targetLayer);\n if (targetLayer > layerCount) {\n layerCount = targetLayer;\n }\n if (!contains(current, target)) {\n current.push(target);\n }\n }\n }\n var sortedNodes = layerMap.keys();\n sortedNodes.sort(function (o1, o2) {\n var o1layer = layerMap.get(o1);\n var o2layer = layerMap.get(o2);\n return Utils.sign(o2layer - o1layer);\n });\n for (var n = 0; n < sortedNodes.length; ++n) {\n var node = sortedNodes[n];\n var minLayer = Number.MAX_VALUE;\n if (node.outgoing.length === 0) {\n continue;\n }\n for (l = 0; l < node.outgoing.length; ++l) {\n link = node.outgoing[l];\n minLayer = Math.min(minLayer, layerMap.get(link.target));\n }\n if (minLayer > 1) {\n layerMap.set(node, minLayer - 1);\n }\n }\n this.layers = [];\n var layer;\n for (i = 0; i < layerCount + 1; i++) {\n layer = [];\n layer.linksTo = {};\n this.layers.push(layer);\n }\n layerMap.forEach(function (node, layer) {\n node.layer = layer;\n this.layers[layer].push(node);\n }, this);\n for (l = 0; l < this.layers.length; l++) {\n layer = this.layers[l];\n for (i = 0; i < layer.length; i++) {\n layer[i].gridPosition = i;\n }\n }\n },\n layoutGraph: function (graph, options) {\n if (Utils.isUndefined(graph)) {\n throw 'No graph given or graph analysis of the diagram failed.';\n }\n if (Utils.isDefined(options)) {\n this.transferOptions(options);\n }\n this.graph = graph;\n graph.setItemIndices();\n var reversedEdges = graph.makeAcyclic();\n this._initRuntimeProperties();\n this._prepare(graph, options);\n this._dummify();\n this._optimizeCrossings();\n this._swapPairs();\n this.arrangeNodes();\n this._moveThingsAround();\n this._dedummify();\n Utils.forEach(reversedEdges, function (e) {\n if (e.points) {\n e.points.reverse();\n }\n });\n },\n setMinDist: function (m, n, minDist) {\n var l = m.layer;\n var i = m.layerIndex;\n this.minDistances[l][i] = minDist;\n },\n getMinDist: function (m, n) {\n var dist = 0, i1 = m.layerIndex, i2 = n.layerIndex, l = m.layer, min = Math.min(i1, i2), max = Math.max(i1, i2);\n for (var k = min; k < max; ++k) {\n dist += this.minDistances[l][k];\n }\n return dist;\n },\n placeLeftToRight: function (leftClasses) {\n var leftPos = new Dictionary(), n, node;\n for (var c = 0; c < this.layers.length; ++c) {\n var classNodes = leftClasses[c];\n if (!classNodes) {\n continue;\n }\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n if (!leftPos.containsKey(node)) {\n this.placeLeft(node, leftPos, c);\n }\n }\n var d = Number.POSITIVE_INFINITY;\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n var rightSibling = this.rightSibling(node);\n if (rightSibling && this.nodeLeftClass.get(rightSibling) !== c) {\n d = Math.min(d, leftPos.get(rightSibling) - leftPos.get(node) - this.getMinDist(node, rightSibling));\n }\n }\n if (d === Number.POSITIVE_INFINITY) {\n var D = [];\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n var neighbors = [];\n Utils.addRange(neighbors, this.upNodes.get(node));\n Utils.addRange(neighbors, this.downNodes.get(node));\n for (var e = 0; e < neighbors.length; e++) {\n var neighbor = neighbors[e];\n if (this.nodeLeftClass.get(neighbor) < c) {\n D.push(leftPos.get(neighbor) - leftPos.get(node));\n }\n }\n }\n D.sort();\n if (D.length === 0) {\n d = 0;\n } else if (D.length % 2 === 1) {\n d = D[this.intDiv(D.length, 2)];\n } else {\n d = (D[this.intDiv(D.length, 2) - 1] + D[this.intDiv(D.length, 2)]) / 2;\n }\n }\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n leftPos.set(node, leftPos.get(node) + d);\n }\n }\n return leftPos;\n },\n placeRightToLeft: function (rightClasses) {\n var rightPos = new Dictionary(), n, node;\n for (var c = 0; c < this.layers.length; ++c) {\n var classNodes = rightClasses[c];\n if (!classNodes) {\n continue;\n }\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n if (!rightPos.containsKey(node)) {\n this.placeRight(node, rightPos, c);\n }\n }\n var d = Number.NEGATIVE_INFINITY;\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n var leftSibling = this.leftSibling(node);\n if (leftSibling && this.nodeRightClass.get(leftSibling) !== c) {\n d = Math.max(d, rightPos.get(leftSibling) - rightPos.get(node) + this.getMinDist(leftSibling, node));\n }\n }\n if (d === Number.NEGATIVE_INFINITY) {\n var D = [];\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n var neighbors = [];\n Utils.addRange(neighbors, this.upNodes.get(node));\n Utils.addRange(neighbors, this.downNodes.get(node));\n for (var e = 0; e < neighbors.length; e++) {\n var neighbor = neighbors[e];\n if (this.nodeRightClass.get(neighbor) < c) {\n D.push(rightPos.get(node) - rightPos.get(neighbor));\n }\n }\n }\n D.sort();\n if (D.length === 0) {\n d = 0;\n } else if (D.length % 2 === 1) {\n d = D[this.intDiv(D.length, 2)];\n } else {\n d = (D[this.intDiv(D.length, 2) - 1] + D[this.intDiv(D.length, 2)]) / 2;\n }\n }\n for (n = 0; n < classNodes.length; n++) {\n node = classNodes[n];\n rightPos.set(node, rightPos.get(node) + d);\n }\n }\n return rightPos;\n },\n _getLeftWing: function () {\n var leftWing = { value: null };\n var result = this.computeClasses(leftWing, 1);\n this.nodeLeftClass = leftWing.value;\n return result;\n },\n _getRightWing: function () {\n var rightWing = { value: null };\n var result = this.computeClasses(rightWing, -1);\n this.nodeRightClass = rightWing.value;\n return result;\n },\n computeClasses: function (wingPair, d) {\n var currentWing = 0, wing = wingPair.value = new Dictionary();\n for (var l = 0; l < this.layers.length; ++l) {\n currentWing = l;\n var layer = this.layers[l];\n for (var n = d === 1 ? 0 : layer.length - 1; 0 <= n && n < layer.length; n += d) {\n var node = layer[n];\n if (!wing.containsKey(node)) {\n wing.set(node, currentWing);\n if (node.isVirtual) {\n var ndsinl = this._nodesInLink(node);\n for (var kk = 0; kk < ndsinl.length; kk++) {\n var vnode = ndsinl[kk];\n wing.set(vnode, currentWing);\n }\n }\n } else {\n currentWing = wing.get(node);\n }\n }\n }\n var wings = [];\n for (var i = 0; i < this.layers.length; i++) {\n wings.push(null);\n }\n wing.forEach(function (node, classIndex) {\n if (wings[classIndex] === null) {\n wings[classIndex] = [];\n }\n wings[classIndex].push(node);\n });\n return wings;\n },\n _isVerticalLayout: function () {\n return this.options.subtype.toLowerCase() === 'up' || this.options.subtype.toLowerCase() === 'down' || this.options.subtype.toLowerCase() === 'vertical';\n },\n _isHorizontalLayout: function () {\n return this.options.subtype.toLowerCase() === 'right' || this.options.subtype.toLowerCase() === 'left' || this.options.subtype.toLowerCase() === 'horizontal';\n },\n _isIncreasingLayout: function () {\n return this.options.subtype.toLowerCase() === 'right' || this.options.subtype.toLowerCase() === 'down';\n },\n _moveThingsAround: function () {\n var i, l, node, layer, n, w;\n for (l = 0; l < this.layers.length; ++l) {\n layer = this.layers[l];\n layer.sort(this._gridPositionComparer);\n }\n this.minDistances = [];\n for (l = 0; l < this.layers.length; ++l) {\n layer = this.layers[l];\n this.minDistances[l] = [];\n for (n = 0; n < layer.length; ++n) {\n node = layer[n];\n node.layerIndex = n;\n this.minDistances[l][n] = this.options.nodeDistance;\n if (n < layer.length - 1) {\n if (this._isVerticalLayout()) {\n this.minDistances[l][n] += (node.width + layer[n + 1].width) / 2;\n } else {\n this.minDistances[l][n] += (node.height + layer[n + 1].height) / 2;\n }\n }\n }\n }\n this.downNodes = new Dictionary();\n this.upNodes = new Dictionary();\n Utils.forEach(this.graph.nodes, function (node) {\n this.downNodes.set(node, []);\n this.upNodes.set(node, []);\n }, this);\n Utils.forEach(this.graph.links, function (link) {\n var origin = link.source;\n var dest = link.target;\n var down = null, up = null;\n if (origin.layer > dest.layer) {\n down = link.source;\n up = link.target;\n } else {\n up = link.source;\n down = link.target;\n }\n this.downNodes.get(up).push(down);\n this.upNodes.get(down).push(up);\n }, this);\n this.downNodes.forEachValue(function (list) {\n list.sort(this._gridPositionComparer);\n }, this);\n this.upNodes.forEachValue(function (list) {\n list.sort(this._gridPositionComparer);\n }, this);\n for (l = 0; l < this.layers.length - 1; ++l) {\n layer = this.layers[l];\n for (w = 0; w < layer.length - 1; w++) {\n var currentNode = layer[w];\n if (!currentNode.isVirtual) {\n continue;\n }\n var currDown = this.downNodes.get(currentNode)[0];\n if (!currDown.isVirtual) {\n continue;\n }\n for (n = w + 1; n < layer.length; ++n) {\n node = layer[n];\n if (!node.isVirtual) {\n continue;\n }\n var downNode = this.downNodes.get(node)[0];\n if (!downNode.isVirtual) {\n continue;\n }\n if (currDown.gridPosition > downNode.gridPosition) {\n var pos = currDown.gridPosition;\n currDown.gridPosition = downNode.gridPosition;\n downNode.gridPosition = pos;\n var i1 = currDown.layerIndex;\n var i2 = downNode.layerIndex;\n this.layers[l + 1][i1] = downNode;\n this.layers[l + 1][i2] = currDown;\n currDown.layerIndex = i2;\n downNode.layerIndex = i1;\n }\n }\n }\n }\n var leftClasses = this._getLeftWing();\n var rightClasses = this._getRightWing();\n var leftPos = this.placeLeftToRight(leftClasses);\n var rightPos = this.placeRightToLeft(rightClasses);\n var x = new Dictionary();\n Utils.forEach(this.graph.nodes, function (node) {\n x.set(node, (leftPos.get(node) + rightPos.get(node)) / 2);\n });\n var order = new Dictionary();\n var placed = new Dictionary();\n for (l = 0; l < this.layers.length; ++l) {\n layer = this.layers[l];\n var sequenceStart = -1, sequenceEnd = -1;\n for (n = 0; n < layer.length; ++n) {\n node = layer[n];\n order.set(node, 0);\n placed.set(node, false);\n if (node.isVirtual) {\n if (sequenceStart === -1) {\n sequenceStart = n;\n } else if (sequenceStart === n - 1) {\n sequenceStart = n;\n } else {\n sequenceEnd = n;\n order.set(layer[sequenceStart], 0);\n if (x.get(node) - x.get(layer[sequenceStart]) === this.getMinDist(layer[sequenceStart], node)) {\n placed.set(layer[sequenceStart], true);\n } else {\n placed.set(layer[sequenceStart], false);\n }\n sequenceStart = n;\n }\n }\n }\n }\n var directions = [\n 1,\n -1\n ];\n Utils.forEach(directions, function (d) {\n var start = d === 1 ? 0 : this.layers.length - 1;\n for (var l = start; 0 <= l && l < this.layers.length; l += d) {\n var layer = this.layers[l];\n var virtualStartIndex = this._firstVirtualNode(layer);\n var virtualStart = null;\n var sequence = null;\n if (virtualStartIndex !== -1) {\n virtualStart = layer[virtualStartIndex];\n sequence = [];\n for (i = 0; i < virtualStartIndex; i++) {\n sequence.push(layer[i]);\n }\n } else {\n virtualStart = null;\n sequence = layer;\n }\n if (sequence.length > 0) {\n this._sequencer(x, null, virtualStart, d, sequence);\n for (i = 0; i < sequence.length - 1; ++i) {\n this.setMinDist(sequence[i], sequence[i + 1], x.get(sequence[i + 1]) - x.get(sequence[i]));\n }\n if (virtualStart) {\n this.setMinDist(sequence[sequence.length - 1], virtualStart, x.get(virtualStart) - x.get(sequence[sequence.length - 1]));\n }\n }\n while (virtualStart) {\n var virtualEnd = this.nextVirtualNode(layer, virtualStart);\n if (!virtualEnd) {\n virtualStartIndex = virtualStart.layerIndex;\n sequence = [];\n for (i = virtualStartIndex + 1; i < layer.length; i++) {\n sequence.push(layer[i]);\n }\n if (sequence.length > 0) {\n this._sequencer(x, virtualStart, null, d, sequence);\n for (i = 0; i < sequence.length - 1; ++i) {\n this.setMinDist(sequence[i], sequence[i + 1], x.get(sequence[i + 1]) - x.get(sequence[i]));\n }\n this.setMinDist(virtualStart, sequence[0], x.get(sequence[0]) - x.get(virtualStart));\n }\n } else if (order.get(virtualStart) === d) {\n virtualStartIndex = virtualStart.layerIndex;\n var virtualEndIndex = virtualEnd.layerIndex;\n sequence = [];\n for (i = virtualStartIndex + 1; i < virtualEndIndex; i++) {\n sequence.push(layer[i]);\n }\n if (sequence.length > 0) {\n this._sequencer(x, virtualStart, virtualEnd, d, sequence);\n }\n placed.set(virtualStart, true);\n }\n virtualStart = virtualEnd;\n }\n this.adjustDirections(l, d, order, placed);\n }\n }, this);\n var fromLayerIndex = this._isIncreasingLayout() ? 0 : this.layers.length - 1;\n var reachedFinalLayerIndex = function (k, ctx) {\n if (ctx._isIncreasingLayout()) {\n return k < ctx.layers.length;\n } else {\n return k >= 0;\n }\n };\n var layerIncrement = this._isIncreasingLayout() ? +1 : -1, offset = 0;\n function maximumHeight(layer, ctx) {\n var height = Number.MIN_VALUE;\n for (var n = 0; n < layer.length; ++n) {\n var node = layer[n];\n if (ctx._isVerticalLayout()) {\n height = Math.max(height, node.height);\n } else {\n height = Math.max(height, node.width);\n }\n }\n return height;\n }\n for (i = fromLayerIndex; reachedFinalLayerIndex(i, this); i += layerIncrement) {\n layer = this.layers[i];\n var height = maximumHeight(layer, this);\n for (n = 0; n < layer.length; ++n) {\n node = layer[n];\n if (this._isVerticalLayout()) {\n node.x = x.get(node);\n node.y = offset + height / 2;\n } else {\n node.x = offset + height / 2;\n node.y = x.get(node);\n }\n }\n offset += this.options.layerSeparation + height;\n }\n },\n adjustDirections: function (l, d, order, placed) {\n if (l + d < 0 || l + d >= this.layers.length) {\n return;\n }\n var prevBridge = null, prevBridgeTarget = null;\n var layer = this.layers[l + d];\n for (var n = 0; n < layer.length; ++n) {\n var nextBridge = layer[n];\n if (nextBridge.isVirtual) {\n var nextBridgeTarget = this.getNeighborOnLayer(nextBridge, l);\n if (nextBridgeTarget.isVirtual) {\n if (prevBridge) {\n var p = placed.get(prevBridgeTarget);\n var clayer = this.layers[l];\n var i1 = prevBridgeTarget.layerIndex;\n var i2 = nextBridgeTarget.layerIndex;\n for (var i = i1 + 1; i < i2; ++i) {\n if (clayer[i].isVirtual) {\n p = p && placed.get(clayer[i]);\n }\n }\n if (p) {\n order.set(prevBridge, d);\n var j1 = prevBridge.layerIndex;\n var j2 = nextBridge.layerIndex;\n for (var j = j1 + 1; j < j2; ++j) {\n if (layer[j].isVirtual) {\n order.set(layer[j], d);\n }\n }\n }\n }\n prevBridge = nextBridge;\n prevBridgeTarget = nextBridgeTarget;\n }\n }\n }\n },\n getNeighborOnLayer: function (node, l) {\n var neighbor = this.upNodes.get(node)[0];\n if (neighbor.layer === l) {\n return neighbor;\n }\n neighbor = this.downNodes.get(node)[0];\n if (neighbor.layer === l) {\n return neighbor;\n }\n return null;\n },\n _sequencer: function (x, virtualStart, virtualEnd, dir, sequence) {\n if (sequence.length === 1) {\n this._sequenceSingle(x, virtualStart, virtualEnd, dir, sequence[0]);\n }\n if (sequence.length > 1) {\n var r = sequence.length, t = this.intDiv(r, 2);\n this._sequencer(x, virtualStart, virtualEnd, dir, sequence.slice(0, t));\n this._sequencer(x, virtualStart, virtualEnd, dir, sequence.slice(t));\n this.combineSequences(x, virtualStart, virtualEnd, dir, sequence);\n }\n },\n _sequenceSingle: function (x, virtualStart, virtualEnd, dir, node) {\n var neighbors = dir === -1 ? this.downNodes.get(node) : this.upNodes.get(node);\n var n = neighbors.length;\n if (n !== 0) {\n if (n % 2 === 1) {\n x.set(node, x.get(neighbors[this.intDiv(n, 2)]));\n } else {\n x.set(node, (x.get(neighbors[this.intDiv(n, 2) - 1]) + x.get(neighbors[this.intDiv(n, 2)])) / 2);\n }\n if (virtualStart) {\n x.set(node, Math.max(x.get(node), x.get(virtualStart) + this.getMinDist(virtualStart, node)));\n }\n if (virtualEnd) {\n x.set(node, Math.min(x.get(node), x.get(virtualEnd) - this.getMinDist(node, virtualEnd)));\n }\n }\n },\n combineSequences: function (x, virtualStart, virtualEnd, dir, sequence) {\n var r = sequence.length, t = this.intDiv(r, 2);\n var leftHeap = [], i, c, n, neighbors, neighbor, pair;\n for (i = 0; i < t; ++i) {\n c = 0;\n neighbors = dir === -1 ? this.downNodes.get(sequence[i]) : this.upNodes.get(sequence[i]);\n for (n = 0; n < neighbors.length; ++n) {\n neighbor = neighbors[n];\n if (x.get(neighbor) >= x.get(sequence[i])) {\n c++;\n } else {\n c--;\n leftHeap.push({\n k: x.get(neighbor) + this.getMinDist(sequence[i], sequence[t - 1]),\n v: 2\n });\n }\n }\n leftHeap.push({\n k: x.get(sequence[i]) + this.getMinDist(sequence[i], sequence[t - 1]),\n v: c\n });\n }\n if (virtualStart) {\n leftHeap.push({\n k: x.get(virtualStart) + this.getMinDist(virtualStart, sequence[t - 1]),\n v: Number.MAX_VALUE\n });\n }\n leftHeap.sort(this._positionDescendingComparer);\n var rightHeap = [];\n for (i = t; i < r; ++i) {\n c = 0;\n neighbors = dir === -1 ? this.downNodes.get(sequence[i]) : this.upNodes.get(sequence[i]);\n for (n = 0; n < neighbors.length; ++n) {\n neighbor = neighbors[n];\n if (x.get(neighbor) <= x.get(sequence[i])) {\n c++;\n } else {\n c--;\n rightHeap.push({\n k: x.get(neighbor) - this.getMinDist(sequence[i], sequence[t]),\n v: 2\n });\n }\n }\n rightHeap.push({\n k: x.get(sequence[i]) - this.getMinDist(sequence[i], sequence[t]),\n v: c\n });\n }\n if (virtualEnd) {\n rightHeap.push({\n k: x.get(virtualEnd) - this.getMinDist(virtualEnd, sequence[t]),\n v: Number.MAX_VALUE\n });\n }\n rightHeap.sort(this._positionAscendingComparer);\n var leftRes = 0, rightRes = 0;\n var m = this.getMinDist(sequence[t - 1], sequence[t]);\n while (x.get(sequence[t]) - x.get(sequence[t - 1]) < m) {\n if (leftRes < rightRes) {\n if (leftHeap.length === 0) {\n x.set(sequence[t - 1], x.get(sequence[t]) - m);\n break;\n } else {\n pair = leftHeap.shift();\n leftRes = leftRes + pair.v;\n x.set(sequence[t - 1], pair.k);\n x.set(sequence[t - 1], Math.max(x.get(sequence[t - 1]), x.get(sequence[t]) - m));\n }\n } else {\n if (rightHeap.length === 0) {\n x.set(sequence[t], x.get(sequence[t - 1]) + m);\n break;\n } else {\n pair = rightHeap.shift();\n rightRes = rightRes + pair.v;\n x.set(sequence[t], pair.k);\n x.set(sequence[t], Math.min(x.get(sequence[t]), x.get(sequence[t - 1]) + m));\n }\n }\n }\n for (i = t - 2; i >= 0; i--) {\n x.set(sequence[i], Math.min(x.get(sequence[i]), x.get(sequence[t - 1]) - this.getMinDist(sequence[i], sequence[t - 1])));\n }\n for (i = t + 1; i < r; i++) {\n x.set(sequence[i], Math.max(x.get(sequence[i]), x.get(sequence[t]) + this.getMinDist(sequence[i], sequence[t])));\n }\n },\n placeLeft: function (node, leftPos, leftClass) {\n var pos = Number.NEGATIVE_INFINITY;\n Utils.forEach(this._getComposite(node), function (v) {\n var leftSibling = this.leftSibling(v);\n if (leftSibling && this.nodeLeftClass.get(leftSibling) === this.nodeLeftClass.get(v)) {\n if (!leftPos.containsKey(leftSibling)) {\n this.placeLeft(leftSibling, leftPos, leftClass);\n }\n pos = Math.max(pos, leftPos.get(leftSibling) + this.getMinDist(leftSibling, v));\n }\n }, this);\n if (pos === Number.NEGATIVE_INFINITY) {\n pos = 0;\n }\n Utils.forEach(this._getComposite(node), function (v) {\n leftPos.set(v, pos);\n });\n },\n placeRight: function (node, rightPos, rightClass) {\n var pos = Number.POSITIVE_INFINITY;\n Utils.forEach(this._getComposite(node), function (v) {\n var rightSibling = this.rightSibling(v);\n if (rightSibling && this.nodeRightClass.get(rightSibling) === this.nodeRightClass.get(v)) {\n if (!rightPos.containsKey(rightSibling)) {\n this.placeRight(rightSibling, rightPos, rightClass);\n }\n pos = Math.min(pos, rightPos.get(rightSibling) - this.getMinDist(v, rightSibling));\n }\n }, this);\n if (pos === Number.POSITIVE_INFINITY) {\n pos = 0;\n }\n Utils.forEach(this._getComposite(node), function (v) {\n rightPos.set(v, pos);\n });\n },\n leftSibling: function (node) {\n var layer = this.layers[node.layer], layerIndex = node.layerIndex;\n return layerIndex === 0 ? null : layer[layerIndex - 1];\n },\n rightSibling: function (node) {\n var layer = this.layers[node.layer];\n var layerIndex = node.layerIndex;\n return layerIndex === layer.length - 1 ? null : layer[layerIndex + 1];\n },\n _getComposite: function (node) {\n return node.isVirtual ? this._nodesInLink(node) : [node];\n },\n arrangeNodes: function () {\n var i, l, ni, layer, node;\n for (l = 0; l < this.layers.length; l++) {\n layer = this.layers[l];\n for (ni = 0; ni < layer.length; ni++) {\n node = layer[ni];\n node.upstreamPriority = node.upstreamLinkCount;\n node.downstreamPriority = node.downstreamLinkCount;\n }\n }\n var maxLayoutIterations = 2;\n for (var it = 0; it < maxLayoutIterations; it++) {\n for (i = this.layers.length - 1; i >= 1; i--) {\n this.layoutLayer(false, i);\n }\n for (i = 0; i < this.layers.length - 1; i++) {\n this.layoutLayer(true, i);\n }\n }\n var gridPos = Number.MAX_VALUE;\n for (l = 0; l < this.layers.length; l++) {\n layer = this.layers[l];\n for (ni = 0; ni < layer.length; ni++) {\n node = layer[ni];\n gridPos = Math.min(gridPos, node.gridPosition);\n }\n }\n if (gridPos < 0) {\n for (l = 0; l < this.layers.length; l++) {\n layer = this.layers[l];\n for (ni = 0; ni < layer.length; ni++) {\n node = layer[ni];\n node.gridPosition = node.gridPosition - gridPos;\n }\n }\n }\n },\n layoutLayer: function (down, layer) {\n var iconsidered;\n var considered;\n if (down) {\n considered = this.layers[iconsidered = layer + 1];\n } else {\n considered = this.layers[iconsidered = layer - 1];\n }\n var sorted = [];\n for (var n = 0; n < considered.length; n++) {\n sorted.push(considered[n]);\n }\n sorted.sort(function (n1, n2) {\n var n1Priority = (n1.upstreamPriority + n1.downstreamPriority) / 2;\n var n2Priority = (n2.upstreamPriority + n2.downstreamPriority) / 2;\n if (Math.abs(n1Priority - n2Priority) < 0.0001) {\n return 0;\n }\n if (n1Priority < n2Priority) {\n return 1;\n }\n return -1;\n });\n Utils.forEach(sorted, function (node) {\n var nodeGridPos = node.gridPosition;\n var nodeBaryCenter = this.calcBaryCenter(node);\n var nodePriority = (node.upstreamPriority + node.downstreamPriority) / 2;\n if (Math.abs(nodeGridPos - nodeBaryCenter) < 0.0001) {\n return;\n }\n if (Math.abs(nodeGridPos - nodeBaryCenter) < 0.25 + 0.0001) {\n return;\n }\n if (nodeGridPos < nodeBaryCenter) {\n while (nodeGridPos < nodeBaryCenter) {\n if (!this.moveRight(node, considered, nodePriority)) {\n break;\n }\n nodeGridPos = node.gridPosition;\n }\n } else {\n while (nodeGridPos > nodeBaryCenter) {\n if (!this.moveLeft(node, considered, nodePriority)) {\n break;\n }\n nodeGridPos = node.gridPosition;\n }\n }\n }, this);\n if (iconsidered > 0) {\n this.calcDownData(iconsidered - 1);\n }\n if (iconsidered < this.layers.length - 1) {\n this.calcUpData(iconsidered + 1);\n }\n },\n moveRight: function (node, layer, priority) {\n var index = Utils.indexOf(layer, node);\n if (index === layer.length - 1) {\n node.gridPosition = node.gridPosition + 0.5;\n return true;\n }\n var rightNode = layer[index + 1];\n var rightNodePriority = (rightNode.upstreamPriority + rightNode.downstreamPriority) / 2;\n if (rightNode.gridPosition > node.gridPosition + 1) {\n node.gridPosition = node.gridPosition + 0.5;\n return true;\n }\n if (rightNodePriority > priority || Math.abs(rightNodePriority - priority) < 0.0001) {\n return false;\n }\n if (this.moveRight(rightNode, layer, priority)) {\n node.gridPosition = node.gridPosition + 0.5;\n return true;\n }\n return false;\n },\n moveLeft: function (node, layer, priority) {\n var index = Utils.indexOf(layer, node);\n if (index === 0) {\n node.gridPosition = node.gridPosition - 0.5;\n return true;\n }\n var leftNode = layer[index - 1];\n var leftNodePriority = (leftNode.upstreamPriority + leftNode.downstreamPriority) / 2;\n if (leftNode.gridPosition < node.gridPosition - 1) {\n node.gridPosition = node.gridPosition - 0.5;\n return true;\n }\n if (leftNodePriority > priority || Math.abs(leftNodePriority - priority) < 0.0001) {\n return false;\n }\n if (this.moveLeft(leftNode, layer, priority)) {\n node.gridPosition = node.gridPosition - 0.5;\n return true;\n }\n return false;\n },\n mapVirtualNode: function (node, link) {\n this.nodeToLinkMap.set(node, link);\n if (!this.linkToNodeMap.containsKey(link)) {\n this.linkToNodeMap.set(link, []);\n }\n this.linkToNodeMap.get(link).push(node);\n },\n _nodesInLink: function (node) {\n return this.linkToNodeMap.get(this.nodeToLinkMap.get(node));\n },\n _dummify: function () {\n this.linkToNodeMap = new Dictionary();\n this.nodeToLinkMap = new Dictionary();\n var layer, pos, newNode, node, r, newLink, i, l, links = this.graph.links.slice(0);\n var layers = this.layers;\n var addLinkBetweenLayers = function (upLayer, downLayer, link) {\n layers[upLayer].linksTo[downLayer] = layers[upLayer].linksTo[downLayer] || [];\n layers[upLayer].linksTo[downLayer].push(link);\n };\n for (l = 0; l < links.length; l++) {\n var link = links[l];\n var o = link.source;\n var d = link.target;\n var oLayer = o.layer;\n var dLayer = d.layer;\n var oPos = o.gridPosition;\n var dPos = d.gridPosition;\n var step = (dPos - oPos) / Math.abs(dLayer - oLayer);\n var p = o;\n if (oLayer - dLayer > 1) {\n for (i = oLayer - 1; i > dLayer; i--) {\n newNode = new Node();\n newNode.x = o.x;\n newNode.y = o.y;\n newNode.width = o.width / 100;\n newNode.height = o.height / 100;\n layer = layers[i];\n pos = (i - dLayer) * step + oPos;\n if (pos > layer.length) {\n pos = layer.length;\n }\n if (oPos >= layers[oLayer].length - 1 && dPos >= layers[dLayer].length - 1) {\n pos = layer.length;\n } else if (oPos === 0 && dPos === 0) {\n pos = 0;\n }\n newNode.layer = i;\n newNode.uBaryCenter = 0;\n newNode.dBaryCenter = 0;\n newNode.upstreamLinkCount = 0;\n newNode.downstreamLinkCount = 0;\n newNode.gridPosition = pos;\n newNode.isVirtual = true;\n Utils.insert(layer, newNode, pos);\n for (r = pos + 1; r < layer.length; r++) {\n node = layer[r];\n node.gridPosition = node.gridPosition + 1;\n }\n newLink = new Link(p, newNode);\n newLink.depthOfDumminess = 0;\n addLinkBetweenLayers(i - 1, i, newLink);\n p = newNode;\n this.graph._addNode(newNode);\n this.graph.addLink(newLink);\n newNode.index = this.graph.nodes.length - 1;\n this.mapVirtualNode(newNode, link);\n }\n addLinkBetweenLayers(dLayer - 1, dLayer, newLink);\n link.changeSource(p);\n link.depthOfDumminess = oLayer - dLayer - 1;\n } else if (oLayer - dLayer < -1) {\n for (i = oLayer + 1; i < dLayer; i++) {\n newNode = new Node();\n newNode.x = o.x;\n newNode.y = o.y;\n newNode.width = o.width / 100;\n newNode.height = o.height / 100;\n layer = layers[i];\n pos = (i - oLayer) * step + oPos;\n if (pos > layer.length) {\n pos = layer.length;\n }\n if (oPos >= layers[oLayer].length - 1 && dPos >= layers[dLayer].length - 1) {\n pos = layer.length;\n } else if (oPos === 0 && dPos === 0) {\n pos = 0;\n }\n newNode.layer = i;\n newNode.uBaryCenter = 0;\n newNode.dBaryCenter = 0;\n newNode.upstreamLinkCount = 0;\n newNode.downstreamLinkCount = 0;\n newNode.gridPosition = pos;\n newNode.isVirtual = true;\n pos &= pos;\n Utils.insert(layer, newNode, pos);\n for (r = pos + 1; r < layer.length; r++) {\n node = layer[r];\n node.gridPosition = node.gridPosition + 1;\n }\n newLink = new Link(p, newNode);\n newLink.depthOfDumminess = 0;\n addLinkBetweenLayers(i - 1, i, newLink);\n p = newNode;\n this.graph._addNode(newNode);\n this.graph.addLink(newLink);\n newNode.index = this.graph.nodes.length - 1;\n this.mapVirtualNode(newNode, link);\n }\n addLinkBetweenLayers(dLayer - 1, dLayer, link);\n link.changeSource(p);\n link.depthOfDumminess = dLayer - oLayer - 1;\n } else {\n addLinkBetweenLayers(oLayer, dLayer, link);\n }\n }\n },\n _dedummify: function () {\n var dedum = true;\n while (dedum) {\n dedum = false;\n for (var l = 0; l < this.graph.links.length; l++) {\n var link = this.graph.links[l];\n if (!link.depthOfDumminess) {\n continue;\n }\n var points = [];\n points.unshift({\n x: link.target.x,\n y: link.target.y\n });\n points.unshift({\n x: link.source.x,\n y: link.source.y\n });\n var temp = link;\n var depthOfDumminess = link.depthOfDumminess;\n for (var d = 0; d < depthOfDumminess; d++) {\n var node = temp.source;\n var prevLink = node.incoming[0];\n points.unshift({\n x: prevLink.source.x,\n y: prevLink.source.y\n });\n temp = prevLink;\n }\n link.changeSource(temp.source);\n link.depthOfDumminess = 0;\n if (points.length > 2) {\n points.splice(0, 1);\n points.splice(points.length - 1);\n link.points = points;\n } else {\n link.points = [];\n }\n dedum = true;\n break;\n }\n }\n },\n _optimizeCrossings: function () {\n var moves = -1, i;\n var maxIterations = 3;\n var iter = 0;\n while (moves !== 0) {\n if (iter++ > maxIterations) {\n break;\n }\n moves = 0;\n for (i = this.layers.length - 1; i >= 1; i--) {\n moves += this.optimizeLayerCrossings(false, i);\n }\n for (i = 0; i < this.layers.length - 1; i++) {\n moves += this.optimizeLayerCrossings(true, i);\n }\n }\n },\n calcUpData: function (layer) {\n if (layer === 0) {\n return;\n }\n var considered = this.layers[layer], i, l, link;\n var upLayer = new Set();\n var temp = this.layers[layer - 1];\n for (i = 0; i < temp.length; i++) {\n upLayer.add(temp[i]);\n }\n for (i = 0; i < considered.length; i++) {\n var node = considered[i];\n var sum = 0;\n var total = 0;\n for (l = 0; l < node.incoming.length; l++) {\n link = node.incoming[l];\n if (upLayer.contains(link.source)) {\n total++;\n sum += link.source.gridPosition;\n }\n }\n for (l = 0; l < node.outgoing.length; l++) {\n link = node.outgoing[l];\n if (upLayer.contains(link.target)) {\n total++;\n sum += link.target.gridPosition;\n }\n }\n if (total > 0) {\n node.uBaryCenter = sum / total;\n node.upstreamLinkCount = total;\n } else {\n node.uBaryCenter = i;\n node.upstreamLinkCount = 0;\n }\n }\n },\n calcDownData: function (layer) {\n if (layer === this.layers.length - 1) {\n return;\n }\n var considered = this.layers[layer], i, l, link;\n var downLayer = new Set();\n var temp = this.layers[layer + 1];\n for (i = 0; i < temp.length; i++) {\n downLayer.add(temp[i]);\n }\n for (i = 0; i < considered.length; i++) {\n var node = considered[i];\n var sum = 0;\n var total = 0;\n for (l = 0; l < node.incoming.length; l++) {\n link = node.incoming[l];\n if (downLayer.contains(link.source)) {\n total++;\n sum += link.source.gridPosition;\n }\n }\n for (l = 0; l < node.outgoing.length; l++) {\n link = node.outgoing[l];\n if (downLayer.contains(link.target)) {\n total++;\n sum += link.target.gridPosition;\n }\n }\n if (total > 0) {\n node.dBaryCenter = sum / total;\n node.downstreamLinkCount = total;\n } else {\n node.dBaryCenter = i;\n node.downstreamLinkCount = 0;\n }\n }\n },\n optimizeLayerCrossings: function (down, layer) {\n var iconsidered;\n var considered;\n if (down) {\n considered = this.layers[iconsidered = layer + 1];\n } else {\n considered = this.layers[iconsidered = layer - 1];\n }\n var presorted = considered.slice(0);\n if (down) {\n this.calcUpData(iconsidered);\n } else {\n this.calcDownData(iconsidered);\n }\n var that = this;\n considered.sort(function (n1, n2) {\n var n1BaryCenter = that.calcBaryCenter(n1), n2BaryCenter = that.calcBaryCenter(n2);\n if (Math.abs(n1BaryCenter - n2BaryCenter) < 0.0001) {\n if (n1.degree() === n2.degree()) {\n return that.compareByIndex(n1, n2);\n } else if (n1.degree() < n2.degree()) {\n return 1;\n }\n return -1;\n }\n var compareValue = (n2BaryCenter - n1BaryCenter) * 1000;\n if (compareValue > 0) {\n return -1;\n } else if (compareValue < 0) {\n return 1;\n }\n return that.compareByIndex(n1, n2);\n });\n var i, moves = 0;\n for (i = 0; i < considered.length; i++) {\n if (considered[i] !== presorted[i]) {\n moves++;\n }\n }\n if (moves > 0) {\n var inode = 0;\n for (i = 0; i < considered.length; i++) {\n var node = considered[i];\n node.gridPosition = inode++;\n }\n }\n return moves;\n },\n _swapPairs: function () {\n var maxIterations = this.options.layeredIterations;\n var iter = 0;\n while (true) {\n if (iter++ > maxIterations) {\n break;\n }\n var downwards = iter % 4 <= 1;\n var secondPass = iter % 4 === 1;\n for (var l = downwards ? 0 : this.layers.length - 1; downwards ? l <= this.layers.length - 1 : l >= 0; l += downwards ? 1 : -1) {\n var layer = this.layers[l];\n var hasSwapped = false;\n var calcCrossings = true;\n var memCrossings = 0;\n for (var n = 0; n < layer.length - 1; n++) {\n var up = 0;\n var down = 0;\n var crossBefore = 0;\n if (calcCrossings) {\n if (l !== 0) {\n up = this.countLinksCrossingBetweenTwoLayers(l - 1, l);\n }\n if (l !== this.layers.length - 1) {\n down = this.countLinksCrossingBetweenTwoLayers(l, l + 1);\n }\n if (downwards) {\n up *= 2;\n } else {\n down *= 2;\n }\n crossBefore = up + down;\n } else {\n crossBefore = memCrossings;\n }\n if (crossBefore === 0) {\n continue;\n }\n var node1 = layer[n];\n var node2 = layer[n + 1];\n var node1GridPos = node1.gridPosition;\n var node2GridPos = node2.gridPosition;\n layer[n] = node2;\n layer[n + 1] = node1;\n node1.gridPosition = node2GridPos;\n node2.gridPosition = node1GridPos;\n up = 0;\n if (l !== 0) {\n up = this.countLinksCrossingBetweenTwoLayers(l - 1, l);\n }\n down = 0;\n if (l !== this.layers.length - 1) {\n down = this.countLinksCrossingBetweenTwoLayers(l, l + 1);\n }\n if (downwards) {\n up *= 2;\n } else {\n down *= 2;\n }\n var crossAfter = up + down;\n var revert = false;\n if (secondPass) {\n revert = crossAfter >= crossBefore;\n } else {\n revert = crossAfter > crossBefore;\n }\n if (revert) {\n node1 = layer[n];\n node2 = layer[n + 1];\n node1GridPos = node1.gridPosition;\n node2GridPos = node2.gridPosition;\n layer[n] = node2;\n layer[n + 1] = node1;\n node1.gridPosition = node2GridPos;\n node2.gridPosition = node1GridPos;\n memCrossings = crossBefore;\n calcCrossings = false;\n } else {\n hasSwapped = true;\n calcCrossings = true;\n }\n }\n if (hasSwapped) {\n if (l !== this.layers.length - 1) {\n this.calcUpData(l + 1);\n }\n if (l !== 0) {\n this.calcDownData(l - 1);\n }\n }\n }\n }\n },\n countLinksCrossingBetweenTwoLayers: function (ulayer, dlayer) {\n var links = this.layers[ulayer].linksTo[dlayer];\n var link1, link2, n11, n12, n21, n22, l1, l2;\n var crossings = 0;\n var length = links.length;\n for (l1 = 0; l1 < length; l1++) {\n link1 = links[l1];\n for (l2 = l1 + 1; l2 < length; l2++) {\n link2 = links[l2];\n if (link1.target.layer === dlayer) {\n n11 = link1.source;\n n12 = link1.target;\n } else {\n n11 = link1.target;\n n12 = link1.source;\n }\n if (link2.target.layer === dlayer) {\n n21 = link2.source;\n n22 = link2.target;\n } else {\n n21 = link2.target;\n n22 = link2.source;\n }\n var n11gp = n11.gridPosition;\n var n12gp = n12.gridPosition;\n var n21gp = n21.gridPosition;\n var n22gp = n22.gridPosition;\n if ((n11gp - n21gp) * (n12gp - n22gp) < 0) {\n crossings++;\n }\n }\n }\n return crossings;\n },\n calcBaryCenter: function (node) {\n var upstreamLinkCount = node.upstreamLinkCount;\n var downstreamLinkCount = node.downstreamLinkCount;\n var uBaryCenter = node.uBaryCenter;\n var dBaryCenter = node.dBaryCenter;\n if (upstreamLinkCount > 0 && downstreamLinkCount > 0) {\n return (uBaryCenter + dBaryCenter) / 2;\n }\n if (upstreamLinkCount > 0) {\n return uBaryCenter;\n }\n if (downstreamLinkCount > 0) {\n return dBaryCenter;\n }\n return 0;\n },\n _gridPositionComparer: function (x, y) {\n if (x.gridPosition < y.gridPosition) {\n return -1;\n }\n if (x.gridPosition > y.gridPosition) {\n return 1;\n }\n return 0;\n },\n _positionAscendingComparer: function (x, y) {\n return x.k < y.k ? -1 : x.k > y.k ? 1 : 0;\n },\n _positionDescendingComparer: function (x, y) {\n return x.k < y.k ? 1 : x.k > y.k ? -1 : 0;\n },\n _firstVirtualNode: function (layer) {\n for (var c = 0; c < layer.length; c++) {\n if (layer[c].isVirtual) {\n return c;\n }\n }\n return -1;\n },\n compareByIndex: function (o1, o2) {\n var i1 = o1.index;\n var i2 = o2.index;\n if (i1 < i2) {\n return 1;\n }\n if (i1 > i2) {\n return -1;\n }\n return 0;\n },\n intDiv: function (numerator, denominator) {\n return (numerator - numerator % denominator) / denominator;\n },\n nextVirtualNode: function (layer, node) {\n var nodeIndex = node.layerIndex;\n for (var i = nodeIndex + 1; i < layer.length; ++i) {\n if (layer[i].isVirtual) {\n return layer[i];\n }\n }\n return null;\n }\n });\n var LayoutState = kendo.Class.extend({\n init: function (diagram, graphOrNodes) {\n if (Utils.isUndefined(diagram)) {\n throw 'No diagram given';\n }\n this.diagram = diagram;\n this.nodeMap = new Dictionary();\n this.linkMap = new Dictionary();\n this.capture(graphOrNodes ? graphOrNodes : diagram);\n },\n capture: function (diagramOrGraphOrNodes) {\n var node, nodes, shape, i, conn, link, links;\n if (diagramOrGraphOrNodes instanceof diagram.Graph) {\n for (i = 0; i < diagramOrGraphOrNodes.nodes.length; i++) {\n node = diagramOrGraphOrNodes.nodes[i];\n shape = node.associatedShape;\n this.nodeMap.set(shape.visual.id, new Rect(node.x, node.y, node.width, node.height));\n }\n for (i = 0; i < diagramOrGraphOrNodes.links.length; i++) {\n link = diagramOrGraphOrNodes.links[i];\n conn = link.associatedConnection;\n this.linkMap.set(conn.visual.id, link.points());\n }\n } else if (diagramOrGraphOrNodes instanceof Array) {\n nodes = diagramOrGraphOrNodes;\n for (i = 0; i < nodes.length; i++) {\n node = nodes[i];\n shape = node.associatedShape;\n if (shape) {\n this.nodeMap.set(shape.visual.id, new Rect(node.x, node.y, node.width, node.height));\n }\n }\n } else if (diagramOrGraphOrNodes.hasOwnProperty('links') && diagramOrGraphOrNodes.hasOwnProperty('nodes')) {\n nodes = diagramOrGraphOrNodes.nodes;\n links = diagramOrGraphOrNodes.links;\n for (i = 0; i < nodes.length; i++) {\n node = nodes[i];\n shape = node.associatedShape;\n if (shape) {\n this.nodeMap.set(shape.visual.id, new Rect(node.x, node.y, node.width, node.height));\n }\n }\n for (i = 0; i < links.length; i++) {\n link = links[i];\n conn = link.associatedConnection;\n if (conn) {\n this.linkMap.set(conn.visual.id, link.points);\n }\n }\n } else {\n var shapes = this.diagram.shapes;\n var connections = this.diagram.connections;\n for (i = 0; i < shapes.length; i++) {\n shape = shapes[i];\n this.nodeMap.set(shape.visual.id, shape.bounds());\n }\n for (i = 0; i < connections.length; i++) {\n conn = connections[i];\n this.linkMap.set(conn.visual.id, conn.points());\n }\n }\n }\n });\n deepExtend(diagram, {\n init: function (element) {\n kendo.init(element, diagram.ui);\n },\n SpringLayout: SpringLayout,\n TreeLayout: TreeLayout,\n GraphAdapter: DiagramToHyperTreeAdapter,\n LayeredLayout: LayeredLayout,\n LayoutBase: LayoutBase,\n LayoutState: LayoutState\n });\n }(window.kendo.jQuery));\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));\n(function (f, define) {\n define('dataviz/diagram/dom', [\n 'kendo.data',\n 'kendo.draganddrop',\n 'kendo.toolbar',\n 'kendo.editable',\n 'kendo.window',\n 'kendo.dropdownlist',\n 'kendo.dataviz.core',\n 'kendo.dataviz.themes',\n 'dataviz/diagram/svg',\n 'dataviz/diagram/services',\n 'dataviz/diagram/layout'\n ], f);\n}(function () {\n (function ($, undefined) {\n var dataviz = kendo.dataviz, draw = kendo.drawing, geom = kendo.geometry, diagram = dataviz.diagram, Widget = kendo.ui.Widget, Class = kendo.Class, proxy = $.proxy, deepExtend = kendo.deepExtend, outerWidth = kendo._outerWidth, outerHeight = kendo._outerHeight, extend = $.extend, HierarchicalDataSource = kendo.data.HierarchicalDataSource, Canvas = diagram.Canvas, Group = diagram.Group, Rectangle = diagram.Rectangle, Circle = diagram.Circle, CompositeTransform = diagram.CompositeTransform, Rect = diagram.Rect, Path = diagram.Path, DeleteShapeUnit = diagram.DeleteShapeUnit, DeleteConnectionUnit = diagram.DeleteConnectionUnit, TextBlock = diagram.TextBlock, Image = diagram.Image, Point = diagram.Point, Intersect = diagram.Intersect, ConnectionEditAdorner = diagram.ConnectionEditAdorner, UndoRedoService = diagram.UndoRedoService, ToolService = diagram.ToolService, Selector = diagram.Selector, ResizingAdorner = diagram.ResizingAdorner, ConnectorsAdorner = diagram.ConnectorsAdorner, Cursors = diagram.Cursors, Utils = diagram.Utils, Observable = kendo.Observable, ToBackUnit = diagram.ToBackUnit, ToFrontUnit = diagram.ToFrontUnit, PolylineRouter = diagram.PolylineRouter, CascadingRouter = diagram.CascadingRouter, isUndefined = Utils.isUndefined, isDefined = Utils.isDefined, defined = kendo.util.defined, isArray = $.isArray, isFunction = kendo.isFunction, isString = Utils.isString, isPlainObject = $.isPlainObject, math = Math;\n var NS = '.kendoDiagram', CASCADING = 'cascading', ITEMBOUNDSCHANGE = 'itemBoundsChange', CHANGE = 'change', CLICK = 'click', DRAG = 'drag', DRAG_END = 'dragEnd', DRAG_START = 'dragStart', MOUSE_ENTER = 'mouseEnter', MOUSE_LEAVE = 'mouseLeave', ERROR = 'error', AUTO = 'Auto', TOP = 'Top', RIGHT = 'Right', LEFT = 'Left', BOTTOM = 'Bottom', MAXINT = 9007199254740992, SELECT = 'select', ITEMROTATE = 'itemRotate', PAN = 'pan', ZOOM_START = 'zoomStart', ZOOM_END = 'zoomEnd', NONE = 'none', DEFAULT_CANVAS_WIDTH = 600, DEFAULT_CANVAS_HEIGHT = 600, DEFAULT_SHAPE_TYPE = 'rectangle', DEFAULT_SHAPE_WIDTH = 100, DEFAULT_SHAPE_HEIGHT = 100, DEFAULT_SHAPE_MINWIDTH = 20, DEFAULT_SHAPE_MINHEIGHT = 20, DEFAULT_SHAPE_POSITION = 0, DEFAULT_CONNECTION_BACKGROUND = 'Yellow', MAX_VALUE = Number.MAX_VALUE, MIN_VALUE = -Number.MAX_VALUE, ABSOLUTE = 'absolute', TRANSFORMED = 'transformed', ROTATED = 'rotated', TRANSPARENT = 'transparent', WIDTH = 'width', HEIGHT = 'height', X = 'x', Y = 'y', MOUSEWHEEL_NS = 'DOMMouseScroll' + NS + ' mousewheel' + NS, MOBILE_ZOOM_RATE = 0.05, MOBILE_PAN_DISTANCE = 5, BUTTON_TEMPLATE = '#=text#', CONNECTION_CONTENT_OFFSET = 5;\n diagram.DefaultConnectors = [\n { name: TOP },\n { name: BOTTOM },\n { name: LEFT },\n { name: RIGHT },\n {\n name: AUTO,\n position: function (shape) {\n return shape.getPosition('center');\n }\n }\n ];\n var defaultButtons = {\n cancel: {\n text: 'Cancel',\n imageClass: 'k-i-cancel',\n className: 'k-diagram-cancel',\n iconClass: 'k-icon'\n },\n update: {\n text: 'Update',\n imageClass: 'k-i-update',\n className: 'k-diagram-update',\n iconClass: 'k-icon'\n }\n };\n diagram.shapeDefaults = function (extra) {\n var defaults = {\n type: DEFAULT_SHAPE_TYPE,\n path: '',\n autoSize: true,\n visual: null,\n x: DEFAULT_SHAPE_POSITION,\n y: DEFAULT_SHAPE_POSITION,\n minWidth: DEFAULT_SHAPE_MINWIDTH,\n minHeight: DEFAULT_SHAPE_MINHEIGHT,\n width: DEFAULT_SHAPE_WIDTH,\n height: DEFAULT_SHAPE_HEIGHT,\n hover: {},\n editable: {\n connect: true,\n tools: []\n },\n connectors: diagram.DefaultConnectors,\n rotation: { angle: 0 }\n };\n Utils.simpleExtend(defaults, extra);\n return defaults;\n };\n function mwDelta(e) {\n var origEvent = e.originalEvent, delta = 0;\n if (origEvent.wheelDelta) {\n delta = -origEvent.wheelDelta / 40;\n delta = delta > 0 ? math.ceil(delta) : math.floor(delta);\n } else if (origEvent.detail) {\n delta = origEvent.detail;\n }\n return delta;\n }\n function isAutoConnector(connector) {\n return connector.options.name.toLowerCase() === AUTO.toLowerCase();\n }\n function closestConnector(point, connectors) {\n var minimumDistance = MAXINT, resCtr, connector;\n for (var i = 0; i < connectors.length; i++) {\n connector = connectors[i];\n if (!isAutoConnector(connector)) {\n var dist = point.distanceTo(connector.position());\n if (dist < minimumDistance) {\n minimumDistance = dist;\n resCtr = connector;\n }\n }\n }\n return resCtr;\n }\n function indicesOfItems(group, visuals) {\n var i, indices = [], visual;\n var children = group.drawingContainer().children;\n var length = children.length;\n for (i = 0; i < visuals.length; i++) {\n visual = visuals[i];\n for (var j = 0; j < length; j++) {\n if (children[j] == visual.drawingContainer()) {\n indices.push(j);\n break;\n }\n }\n }\n return indices;\n }\n var DiagramElement = Observable.extend({\n init: function (options) {\n var that = this;\n that.dataItem = (options || {}).dataItem;\n Observable.fn.init.call(that);\n that.options = deepExtend({ id: diagram.randomId() }, that.options, options);\n that.isSelected = false;\n that.visual = new Group({\n id: that.options.id,\n autoSize: that.options.autoSize\n });\n that.id = that.options.id;\n that._template();\n },\n options: {\n hover: {},\n cursor: Cursors.grip,\n content: { align: 'center middle' },\n selectable: true,\n serializable: true,\n enable: true\n },\n _getCursor: function (point) {\n if (this.adorner) {\n return this.adorner._getCursor(point);\n }\n return this.options.cursor;\n },\n visible: function (value) {\n if (isUndefined(value)) {\n return this.visual.visible();\n } else {\n this.visual.visible(value);\n }\n },\n bounds: function () {\n },\n refresh: function () {\n this.visual.redraw();\n },\n position: function (point) {\n this.options.x = point.x;\n this.options.y = point.y;\n this.visual.position(point);\n },\n toString: function () {\n return this.options.id;\n },\n serialize: function () {\n var json = deepExtend({}, { options: this.options });\n if (this.dataItem) {\n json.dataItem = this.dataItem.toString();\n }\n return json;\n },\n _content: function (content) {\n if (content !== undefined) {\n var options = this.options;\n if (diagram.Utils.isString(content)) {\n options.content.text = content;\n } else {\n deepExtend(options.content, content);\n }\n var contentOptions = options.content;\n var contentVisual = this._contentVisual;\n if (!contentVisual) {\n this._createContentVisual(contentOptions);\n } else {\n this._updateContentVisual(contentOptions);\n }\n }\n return this.options.content.text;\n },\n _createContentVisual: function (options) {\n if (options.text) {\n this._contentVisual = new TextBlock(options);\n this._contentVisual._includeInBBox = false;\n this.visual.append(this._contentVisual);\n }\n },\n _updateContentVisual: function (options) {\n this._contentVisual.redraw(options);\n },\n _hitTest: function (point) {\n var bounds = this.bounds();\n return this.visible() && bounds.contains(point) && this.options.enable;\n },\n _template: function () {\n var that = this;\n if (that.options.content.template) {\n var data = that.dataItem || {}, elementTemplate = kendo.template(that.options.content.template, { paramName: 'dataItem' });\n that.options.content.text = elementTemplate(data);\n }\n },\n _canSelect: function () {\n return this.options.selectable !== false;\n },\n toJSON: function () {\n return { id: this.options.id };\n }\n });\n var Connector = Class.extend({\n init: function (shape, options) {\n this.options = deepExtend({}, this.options, options);\n this.connections = [];\n this.shape = shape;\n },\n options: {\n width: 7,\n height: 7,\n fill: { color: DEFAULT_CONNECTION_BACKGROUND },\n hover: {}\n },\n position: function () {\n if (this.options.position) {\n return this.options.position(this.shape);\n } else {\n return this.shape.getPosition(this.options.name);\n }\n },\n toJSON: function () {\n return {\n shapeId: this.shape.toString(),\n connector: this.options.name\n };\n }\n });\n Connector.parse = function (diagram, str) {\n var tempStr = str.split(':'), id = tempStr[0], name = tempStr[1] || AUTO;\n for (var i = 0; i < diagram.shapes.length; i++) {\n var shape = diagram.shapes[i];\n if (shape.options.id == id) {\n return shape.getConnector(name.trim());\n }\n }\n };\n var Shape = DiagramElement.extend({\n init: function (options, diagram) {\n var that = this;\n DiagramElement.fn.init.call(that, options);\n this.diagram = diagram;\n this.updateOptionsFromModel();\n options = that.options;\n that.connectors = [];\n that.type = options.type;\n that.createShapeVisual();\n that.updateBounds();\n that.content(that.content());\n that._createConnectors();\n },\n options: diagram.shapeDefaults(),\n _setOptionsFromModel: function (model) {\n var modelOptions = filterShapeDataItem(model || this.dataItem);\n this.options = deepExtend({}, this.options, modelOptions);\n this.redrawVisual();\n },\n updateOptionsFromModel: function (model, field) {\n if (this.diagram && this.diagram._isEditable) {\n var modelOptions = filterShapeDataItem(model || this.dataItem);\n if (model && field) {\n if (!dataviz.inArray(field, [\n 'x',\n 'y',\n 'width',\n 'height'\n ])) {\n if (this.options.visual) {\n this._redrawVisual();\n } else if (modelOptions.type) {\n this.options = deepExtend({}, this.options, modelOptions);\n this._redrawVisual();\n }\n if (this.options.content) {\n this._template();\n this.content(this.options.content);\n }\n } else {\n var bounds = this.bounds();\n bounds[field] = model[field];\n this.bounds(bounds);\n }\n } else {\n this.options = deepExtend({}, this.options, modelOptions);\n }\n }\n },\n _redrawVisual: function () {\n this.visual.clear();\n this._contentVisual = null;\n this.options.dataItem = this.dataItem;\n this.createShapeVisual();\n this.updateBounds();\n },\n redrawVisual: function () {\n this._redrawVisual();\n if (this.options.content) {\n this._template();\n this.content(this.options.content);\n }\n },\n updateModel: function (syncChanges) {\n var diagram = this.diagram;\n if (diagram && diagram._isEditable) {\n var bounds = this._bounds;\n var model = this.dataItem;\n if (model) {\n diagram._suspendModelRefresh();\n if (defined(model.x) && bounds.x !== model.x) {\n model.set('x', bounds.x);\n }\n if (defined(model.y) && bounds.y !== model.y) {\n model.set('y', bounds.y);\n }\n if (defined(model.width) && bounds.width !== model.width) {\n model.set('width', bounds.width);\n }\n if (defined(model.height) && bounds.height !== model.height) {\n model.set('height', bounds.height);\n }\n this.dataItem = model;\n diagram._resumeModelRefresh();\n if (syncChanges) {\n diagram._syncShapeChanges();\n }\n }\n }\n },\n updateBounds: function () {\n var bounds = this.visual._measure(true);\n var options = this.options;\n this.bounds(new Rect(options.x, options.y, bounds.width, bounds.height));\n this._rotate();\n this._alignContent();\n },\n content: function (content) {\n var result = this._content(content);\n this._alignContent();\n return result;\n },\n _alignContent: function () {\n var contentOptions = this.options.content || {};\n var contentVisual = this._contentVisual;\n if (contentVisual && contentOptions.align) {\n var containerRect = this.visual._measure();\n var aligner = new diagram.RectAlign(containerRect);\n var contentBounds = contentVisual.drawingElement.bbox(null);\n var contentRect = new Rect(0, 0, contentBounds.width(), contentBounds.height());\n var alignedBounds = aligner.align(contentRect, contentOptions.align);\n contentVisual.position(alignedBounds.topLeft());\n }\n },\n _createConnectors: function () {\n var options = this.options, length = options.connectors.length, connectorDefaults = options.connectorDefaults, connector, i;\n for (i = 0; i < length; i++) {\n connector = new Connector(this, deepExtend({}, connectorDefaults, options.connectors[i]));\n this.connectors.push(connector);\n }\n },\n bounds: function (value) {\n var bounds;\n if (value) {\n if (isString(value)) {\n switch (value) {\n case TRANSFORMED:\n bounds = this._transformedBounds();\n break;\n case ABSOLUTE:\n bounds = this._transformedBounds();\n var pan = this.diagram._pan;\n bounds.x += pan.x;\n bounds.y += pan.y;\n break;\n case ROTATED:\n bounds = this._rotatedBounds();\n break;\n default:\n bounds = this._bounds;\n }\n } else {\n this._setBounds(value);\n this._triggerBoundsChange();\n if (!(this.diagram && this.diagram._layouting)) {\n this.refreshConnections();\n }\n }\n } else {\n bounds = this._bounds;\n }\n return bounds;\n },\n _setBounds: function (rect) {\n var options = this.options;\n var topLeft = rect.topLeft();\n var x = options.x = topLeft.x;\n var y = options.y = topLeft.y;\n var width = options.width = math.max(rect.width, options.minWidth);\n var height = options.height = math.max(rect.height, options.minHeight);\n this._bounds = new Rect(x, y, width, height);\n this.visual.redraw({\n x: x,\n y: y,\n width: width,\n height: height\n });\n },\n position: function (point) {\n if (point) {\n this.bounds(new Rect(point.x, point.y, this._bounds.width, this._bounds.height));\n } else {\n return this._bounds.topLeft();\n }\n },\n clone: function () {\n var json = this.serialize();\n json.options.id = diagram.randomId();\n if (this.diagram && this.diagram._isEditable && defined(this.dataItem)) {\n json.options.dataItem = cloneDataItem(this.dataItem);\n }\n return new Shape(json.options);\n },\n select: function (value) {\n var diagram = this.diagram, selected, deselected;\n if (isUndefined(value)) {\n value = true;\n }\n if (this._canSelect()) {\n if (this.isSelected != value) {\n selected = [];\n deselected = [];\n this.isSelected = value;\n if (this.isSelected) {\n diagram._selectedItems.push(this);\n selected.push(this);\n } else {\n Utils.remove(diagram._selectedItems, this);\n deselected.push(this);\n }\n if (!diagram._internalSelection) {\n diagram._selectionChanged(selected, deselected);\n }\n return true;\n }\n }\n },\n rotate: function (angle, center, undoable) {\n var rotate = this.visual.rotate();\n if (angle !== undefined) {\n if (undoable !== false && this.diagram && this.diagram.undoRedoService && angle !== rotate.angle) {\n this.diagram.undoRedoService.add(new diagram.RotateUnit(this.diagram._resizingAdorner, [this], [rotate.angle]), false);\n }\n var b = this.bounds(), sc = new Point(b.width / 2, b.height / 2), deltaAngle, newPosition;\n if (center) {\n deltaAngle = angle - rotate.angle;\n newPosition = b.center().rotate(center, 360 - deltaAngle).minus(sc);\n this._rotationOffset = this._rotationOffset.plus(newPosition.minus(b.topLeft()));\n this.position(newPosition);\n }\n this.visual.rotate(angle, sc);\n this.options.rotation.angle = angle;\n if (this.diagram && this.diagram._connectorsAdorner) {\n this.diagram._connectorsAdorner.refresh();\n }\n this.refreshConnections();\n if (this.diagram) {\n this.diagram.trigger(ITEMROTATE, { item: this });\n }\n }\n return rotate;\n },\n connections: function (type) {\n var result = [], i, j, con, cons, ctr;\n for (i = 0; i < this.connectors.length; i++) {\n ctr = this.connectors[i];\n cons = ctr.connections;\n for (j = 0, cons; j < cons.length; j++) {\n con = cons[j];\n if (type == 'out') {\n var source = con.source();\n if (source.shape && source.shape == this) {\n result.push(con);\n }\n } else if (type == 'in') {\n var target = con.target();\n if (target.shape && target.shape == this) {\n result.push(con);\n }\n } else {\n result.push(con);\n }\n }\n }\n return result;\n },\n refreshConnections: function () {\n $.each(this.connections(), function () {\n this.refresh();\n });\n },\n getConnector: function (nameOrPoint) {\n var i, ctr;\n if (isString(nameOrPoint)) {\n nameOrPoint = nameOrPoint.toLocaleLowerCase();\n for (i = 0; i < this.connectors.length; i++) {\n ctr = this.connectors[i];\n if (ctr.options.name.toLocaleLowerCase() == nameOrPoint) {\n return ctr;\n }\n }\n } else if (nameOrPoint instanceof Point) {\n return closestConnector(nameOrPoint, this.connectors);\n } else {\n return this.connectors.length ? this.connectors[0] : null;\n }\n },\n getPosition: function (side) {\n var b = this.bounds(), fnName = side.charAt(0).toLowerCase() + side.slice(1);\n if (isFunction(b[fnName])) {\n return this._transformPoint(b[fnName]());\n }\n return b.center();\n },\n redraw: function (options) {\n if (options) {\n var shapeOptions = this.options;\n var boundsChange;\n this.shapeVisual.redraw(this._visualOptions(options));\n if (this._diffNumericOptions(options, [\n WIDTH,\n HEIGHT,\n X,\n Y\n ])) {\n this.bounds(new Rect(shapeOptions.x, shapeOptions.y, shapeOptions.width, shapeOptions.height));\n boundsChange = true;\n }\n if (options.connectors) {\n shapeOptions.connectors = options.connectors;\n this._updateConnectors();\n }\n shapeOptions = deepExtend(shapeOptions, options);\n if (options.rotation || boundsChange) {\n this._rotate();\n }\n if (shapeOptions.content) {\n this.content(shapeOptions.content);\n }\n }\n },\n _updateConnectors: function () {\n var connections = this.connections();\n this.connectors = [];\n this._createConnectors();\n var connection;\n var source;\n var target;\n for (var idx = 0; idx < connections.length; idx++) {\n connection = connections[idx];\n source = connection.source();\n target = connection.target();\n if (source.shape && source.shape === this) {\n connection.source(this.getConnector(source.options.name) || null);\n } else if (target.shape && target.shape === this) {\n connection.target(this.getConnector(target.options.name) || null);\n }\n connection.updateModel();\n }\n },\n _diffNumericOptions: diagram.diffNumericOptions,\n _visualOptions: function (options) {\n return {\n data: options.path,\n source: options.source,\n hover: options.hover,\n fill: options.fill,\n stroke: options.stroke\n };\n },\n _triggerBoundsChange: function () {\n if (this.diagram) {\n this.diagram.trigger(ITEMBOUNDSCHANGE, {\n item: this,\n bounds: this._bounds.clone()\n });\n }\n },\n _transformPoint: function (point) {\n var rotate = this.rotate(), bounds = this.bounds(), tl = bounds.topLeft();\n if (rotate.angle) {\n point.rotate(rotate.center().plus(tl), 360 - rotate.angle);\n }\n return point;\n },\n _transformedBounds: function () {\n var bounds = this.bounds(), tl = bounds.topLeft(), br = bounds.bottomRight();\n return Rect.fromPoints(this.diagram.modelToView(tl), this.diagram.modelToView(br));\n },\n _rotatedBounds: function () {\n var bounds = this.bounds().rotatedBounds(this.rotate().angle), tl = bounds.topLeft(), br = bounds.bottomRight();\n return Rect.fromPoints(tl, br);\n },\n _rotate: function () {\n var rotation = this.options.rotation;\n if (rotation && rotation.angle) {\n this.rotate(rotation.angle);\n }\n this._rotationOffset = new Point();\n },\n _hover: function (value) {\n var options = this.options, hover = options.hover, stroke = options.stroke, fill = options.fill;\n if (value && isDefined(hover.stroke)) {\n stroke = deepExtend({}, stroke, hover.stroke);\n }\n if (value && isDefined(hover.fill)) {\n fill = hover.fill;\n }\n this.shapeVisual.redraw({\n stroke: stroke,\n fill: fill\n });\n if (options.editable && options.editable.connect) {\n this.diagram._showConnectors(this, value);\n }\n },\n _hitTest: function (value) {\n if (this.visible()) {\n var bounds = this.bounds(), rotatedPoint, angle = this.rotate().angle;\n if (value.isEmpty && !value.isEmpty()) {\n return Intersect.rects(value, bounds, angle ? angle : 0);\n } else {\n rotatedPoint = value.clone().rotate(bounds.center(), angle);\n if (bounds.contains(rotatedPoint)) {\n return this;\n }\n }\n }\n },\n toJSON: function () {\n return { shapeId: this.options.id };\n },\n createShapeVisual: function () {\n var options = this.options;\n var visualOptions = this._visualOptions(options);\n var visualTemplate = options.visual;\n var type = (options.type + '').toLocaleLowerCase();\n var shapeVisual;\n visualOptions.width = options.width;\n visualOptions.height = options.height;\n if (isFunction(visualTemplate)) {\n shapeVisual = visualTemplate.call(this, options);\n } else if (visualOptions.data) {\n shapeVisual = new Path(visualOptions);\n translateToOrigin(shapeVisual);\n } else if (type == 'rectangle') {\n shapeVisual = new Rectangle(visualOptions);\n } else if (type == 'circle') {\n shapeVisual = new Circle(visualOptions);\n } else if (type == 'text') {\n shapeVisual = new TextBlock(visualOptions);\n } else if (type == 'image') {\n shapeVisual = new Image(visualOptions);\n } else {\n shapeVisual = new Path(visualOptions);\n }\n this.shapeVisual = shapeVisual;\n this.visual.append(this.shapeVisual);\n }\n });\n var Connection = DiagramElement.extend({\n init: function (from, to, options) {\n var that = this;\n DiagramElement.fn.init.call(that, options);\n this.updateOptionsFromModel();\n this._initRouter();\n that.path = new diagram.Polyline(that.options);\n that.path.fill(TRANSPARENT);\n that.visual.append(that.path);\n that._sourcePoint = that._targetPoint = new Point();\n that._setSource(from);\n that._setTarget(to);\n that.content(that.options.content);\n that.definers = [];\n if (defined(options) && options.points) {\n that.points(options.points);\n }\n },\n options: {\n hover: { stroke: {} },\n startCap: NONE,\n endCap: NONE,\n points: [],\n selectable: true,\n fromConnector: AUTO,\n toConenctor: AUTO\n },\n _setOptionsFromModel: function (model) {\n this.updateOptionsFromModel(model || this.dataItem);\n },\n updateOptionsFromModel: function (model) {\n if (this.diagram && this.diagram._isEditable) {\n var dataMap = this.diagram._dataMap;\n var options = filterConnectionDataItem(model || this.dataItem);\n if (model) {\n if (defined(options.from)) {\n var from = dataMap[options.from];\n if (from && defined(options.fromConnector)) {\n from = from.getConnector(options.fromConnector);\n }\n this.source(from);\n } else if (defined(options.fromX) && defined(options.fromY)) {\n this.source(new Point(options.fromX, options.fromY));\n }\n if (defined(options.to)) {\n var to = dataMap[options.to];\n if (to && defined(options.toConnector)) {\n to = to.getConnector(options.toConnector);\n }\n this.target(to);\n } else if (defined(options.toX) && defined(options.toY)) {\n this.target(new Point(options.toX, options.toY));\n }\n if (defined(options.type) && this.type() !== options.type) {\n this.points([]);\n this.type(options.type);\n }\n this.dataItem = model;\n this._template();\n this.redraw(this.options);\n } else {\n this.options = deepExtend({}, options, this.options);\n }\n }\n },\n updateModel: function (syncChanges) {\n if (this.diagram && this.diagram._isEditable) {\n if (this.diagram.connectionsDataSource) {\n var model = this.diagram.connectionsDataSource.getByUid(this.dataItem.uid);\n if (model) {\n this.diagram._suspendModelRefresh();\n if (defined(this.options.fromX) && this.options.fromX !== null) {\n clearField('from', model);\n clearField('fromConnector', model);\n model.set('fromX', this.options.fromX);\n model.set('fromY', this.options.fromY);\n } else {\n model.set('from', this.options.from);\n if (defined(model.fromConnector)) {\n model.set('fromConnector', this.sourceConnector ? this.sourceConnector.options.name : null);\n }\n clearField('fromX', model);\n clearField('fromY', model);\n }\n if (defined(this.options.toX) && this.options.toX !== null) {\n clearField('to', model);\n clearField('toConnector', model);\n model.set('toX', this.options.toX);\n model.set('toY', this.options.toY);\n } else {\n model.set('to', this.options.to);\n if (defined(model.toConnector)) {\n model.set('toConnector', this.targetConnector ? this.targetConnector.options.name : null);\n }\n clearField('toX', model);\n clearField('toY', model);\n }\n if (defined(this.options.type) && defined(model.type)) {\n model.set('type', this.options.type);\n }\n this.dataItem = model;\n this.diagram._resumeModelRefresh();\n if (syncChanges) {\n this.diagram._syncConnectionChanges();\n }\n }\n }\n }\n },\n sourcePoint: function () {\n return this._resolvedSourceConnector ? this._resolvedSourceConnector.position() : this._sourcePoint;\n },\n _setSource: function (source) {\n var shapeSource = source instanceof Shape;\n var defaultConnector = this.options.fromConnector || AUTO;\n var dataItem;\n if (shapeSource && !source.getConnector(defaultConnector)) {\n return;\n }\n if (source !== undefined) {\n this.from = source;\n }\n this._removeFromSourceConnector();\n if (source === null) {\n if (this.sourceConnector) {\n this._sourcePoint = (this._resolvedSourceConnector || this.sourceConnector).position();\n this._clearSourceConnector();\n this._setFromOptions(null, this._sourcePoint);\n }\n } else if (source instanceof Connector) {\n dataItem = source.shape.dataItem;\n if (dataItem) {\n this._setFromOptions(dataItem.id);\n }\n this.sourceConnector = source;\n this.sourceConnector.connections.push(this);\n } else if (source instanceof Point) {\n this._setFromOptions(null, source);\n this._sourcePoint = source;\n if (this.sourceConnector) {\n this._clearSourceConnector();\n }\n } else if (shapeSource) {\n dataItem = source.dataItem;\n if (dataItem) {\n this._setFromOptions(dataItem.id);\n }\n this.sourceConnector = source.getConnector(defaultConnector);\n this.sourceConnector.connections.push(this);\n }\n },\n source: function (source, undoable) {\n if (isDefined(source)) {\n if (undoable && this.diagram) {\n this.diagram.undoRedoService.addCompositeItem(new diagram.ConnectionEditUnit(this, source));\n }\n this._setSource(source);\n this.refresh();\n }\n return this.sourceConnector ? this.sourceConnector : this._sourcePoint;\n },\n _setFromOptions: function (from, fromPoint) {\n this.options.from = from;\n if (fromPoint) {\n this.options.fromX = fromPoint.x;\n this.options.fromY = fromPoint.y;\n } else {\n this.options.fromX = null;\n this.options.fromY = null;\n }\n },\n sourceDefiner: function (value) {\n if (value) {\n if (value instanceof diagram.PathDefiner) {\n value.left = null;\n this._sourceDefiner = value;\n this.source(value.point);\n } else {\n throw 'The sourceDefiner needs to be a PathDefiner.';\n }\n } else {\n if (!this._sourceDefiner) {\n this._sourceDefiner = new diagram.PathDefiner(this.sourcePoint(), null, null);\n }\n return this._sourceDefiner;\n }\n },\n targetPoint: function () {\n return this._resolvedTargetConnector ? this._resolvedTargetConnector.position() : this._targetPoint;\n },\n _setTarget: function (target) {\n var shapeTarget = target instanceof Shape;\n var defaultConnector = this.options.toConnector || AUTO;\n var dataItem;\n if (shapeTarget && !target.getConnector(defaultConnector)) {\n return;\n }\n if (target !== undefined) {\n this.to = target;\n }\n this._removeFromTargetConnector();\n if (target === null) {\n if (this.targetConnector) {\n this._targetPoint = (this._resolvedTargetConnector || this.targetConnector).position();\n this._clearTargetConnector();\n this._setToOptions(null, this._targetPoint);\n }\n } else if (target instanceof Connector) {\n dataItem = target.shape.dataItem;\n if (dataItem) {\n this._setToOptions(dataItem.id);\n }\n this.targetConnector = target;\n this.targetConnector.connections.push(this);\n } else if (target instanceof Point) {\n this._setToOptions(null, target);\n this._targetPoint = target;\n if (this.targetConnector) {\n this._clearTargetConnector();\n }\n } else if (shapeTarget) {\n dataItem = target.dataItem;\n if (dataItem) {\n this._setToOptions(dataItem.id);\n }\n this.targetConnector = target.getConnector(defaultConnector);\n this.targetConnector.connections.push(this);\n }\n },\n target: function (target, undoable) {\n if (isDefined(target)) {\n if (undoable && this.diagram) {\n this.diagram.undoRedoService.addCompositeItem(new diagram.ConnectionEditUnit(this, undefined, target));\n }\n this._setTarget(target);\n this.refresh();\n }\n return this.targetConnector ? this.targetConnector : this._targetPoint;\n },\n _setToOptions: function (to, toPoint) {\n this.options.to = to;\n if (toPoint) {\n this.options.toX = toPoint.x;\n this.options.toY = toPoint.y;\n } else {\n this.options.toX = null;\n this.options.toY = null;\n }\n },\n targetDefiner: function (value) {\n if (value) {\n if (value instanceof diagram.PathDefiner) {\n value.right = null;\n this._targetDefiner = value;\n this.target(value.point);\n } else {\n throw 'The sourceDefiner needs to be a PathDefiner.';\n }\n } else {\n if (!this._targetDefiner) {\n this._targetDefiner = new diagram.PathDefiner(this.targetPoint(), null, null);\n }\n return this._targetDefiner;\n }\n },\n _updateConnectors: function () {\n this._updateConnector(this.source(), 'source');\n this._updateConnector(this.target(), 'target');\n },\n _updateConnector: function (instance, name) {\n var that = this;\n var diagram = that.diagram;\n if (instance instanceof Connector && !diagram.getShapeById(instance.shape.id)) {\n var dataItem = instance.shape.dataItem;\n var connectorName = instance.options.name;\n var setNewTarget = function () {\n var shape = diagram._dataMap[dataItem.id];\n instance = shape.getConnector(connectorName);\n that[name](instance, false);\n that.updateModel();\n };\n if (diagram._dataMap[dataItem.id]) {\n setNewTarget();\n } else {\n var inactiveItem = diagram._inactiveShapeItems.getByUid(dataItem.uid);\n if (inactiveItem) {\n diagram._deferredConnectionUpdates.push(inactiveItem.onActivate(setNewTarget));\n }\n }\n } else {\n that[name](instance, false);\n }\n },\n content: function (content) {\n var result = this._content(content);\n if (defined(content)) {\n this._alignContent();\n }\n return result;\n },\n _createContentVisual: function (options) {\n var visual;\n if (isFunction(options.visual)) {\n visual = options.visual.call(this, options);\n } else if (options.text) {\n visual = new TextBlock(options);\n }\n if (visual) {\n this._contentVisual = visual;\n visual._includeInBBox = false;\n this.visual.append(visual);\n }\n return visual;\n },\n _updateContentVisual: function (options) {\n if (isFunction(options.visual)) {\n this.visual.remove(this._contentVisual);\n this._createContentVisual(options);\n } else {\n this._contentVisual.redraw(options);\n }\n },\n _alignContent: function () {\n if (this._contentVisual) {\n var offset = CONNECTION_CONTENT_OFFSET;\n var points = this.allPoints();\n var endIdx = math.floor(points.length / 2);\n var startIdx = endIdx - 1;\n while (startIdx > 0 && points[startIdx].equals(points[endIdx])) {\n startIdx--;\n endIdx++;\n }\n var endPoint = points[endIdx];\n var startPoint = points[startIdx];\n var boundingBox = this._contentVisual._measure();\n var width = boundingBox.width;\n var height = boundingBox.height;\n var alignToPath = points.length % 2 === 0;\n var distance = startPoint.distanceTo(endPoint);\n if (alignToPath && points.length > 2 && distance > 0 && (startPoint.y === endPoint.y && distance < width || startPoint.x === endPoint.x && distance < height)) {\n alignToPath = false;\n offset = 0;\n }\n var point;\n if (alignToPath) {\n var angle = kendo.util.deg(math.atan2(endPoint.y - startPoint.y, endPoint.x - startPoint.x));\n point = new Point((endPoint.x - startPoint.x) / 2 + startPoint.x, (endPoint.y - startPoint.y) / 2 + startPoint.y);\n if (math.abs(angle) === 90) {\n point.x += offset;\n point.y -= height / 2;\n } else if (angle % 180 === 0) {\n point.x -= width / 2;\n point.y -= height + offset;\n } else if (angle < -90 || 0 < angle && angle < 90) {\n point.y -= height;\n } else if (angle < 0 || angle > 90) {\n point.x -= width;\n point.y -= height;\n }\n } else {\n var midIdx = math.floor(points.length / 2);\n point = points[midIdx].clone();\n startPoint = points[midIdx - 1];\n endPoint = points[midIdx + 1];\n var offsetX = startPoint.x <= point.x && endPoint.x <= point.x ? offset : -boundingBox.width - offset;\n var offsetY = startPoint.y <= point.y && endPoint.y <= point.y ? offset : -boundingBox.height - offset;\n point.x += offsetX;\n point.y += offsetY;\n }\n this._contentVisual.position(point);\n }\n },\n select: function (value) {\n var diagram = this.diagram, selected, deselected;\n if (this._canSelect()) {\n if (this.isSelected !== value) {\n this.isSelected = value;\n selected = [];\n deselected = [];\n if (this.isSelected) {\n this.adorner = new ConnectionEditAdorner(this, this.options.selection);\n diagram._adorn(this.adorner, true);\n diagram._selectedItems.push(this);\n selected.push(this);\n } else {\n if (this.adorner) {\n diagram._adorn(this.adorner, false);\n Utils.remove(diagram._selectedItems, this);\n this.adorner = undefined;\n deselected.push(this);\n }\n }\n if (this.adorner) {\n this.adorner.refresh();\n }\n if (!diagram._internalSelection) {\n diagram._selectionChanged(selected, deselected);\n }\n return true;\n }\n }\n },\n bounds: function (value) {\n if (value && !isString(value)) {\n this._bounds = value;\n } else {\n return this._bounds;\n }\n },\n type: function (value) {\n var options = this.options;\n if (value) {\n if (value !== options.type) {\n options.type = value;\n this._initRouter();\n this.refresh();\n }\n } else {\n return options.type;\n }\n },\n _initRouter: function () {\n var type = (this.options.type || '').toLowerCase();\n if (type == CASCADING) {\n this._router = new CascadingRouter(this);\n } else {\n this._router = new PolylineRouter(this);\n }\n },\n points: function (value) {\n if (value) {\n this.definers = [];\n for (var i = 0; i < value.length; i++) {\n var definition = value[i];\n if (definition instanceof diagram.Point) {\n this.definers.push(new diagram.PathDefiner(definition));\n } else if (definition.hasOwnProperty('x') && definition.hasOwnProperty('y')) {\n this.definers.push(new diagram.PathDefiner(new Point(definition.x, definition.y)));\n } else {\n throw 'A Connection point needs to be a Point or an object with x and y properties.';\n }\n }\n } else {\n var pts = [];\n if (isDefined(this.definers)) {\n for (var k = 0; k < this.definers.length; k++) {\n pts.push(this.definers[k].point);\n }\n }\n return pts;\n }\n },\n allPoints: function () {\n var pts = [this.sourcePoint()];\n if (this.definers) {\n for (var k = 0; k < this.definers.length; k++) {\n pts.push(this.definers[k].point);\n }\n }\n pts.push(this.targetPoint());\n return pts;\n },\n refresh: function () {\n this._resolveConnectors();\n this._refreshPath();\n this._alignContent();\n if (this.adorner) {\n this.adorner.refresh();\n }\n },\n _resolveConnectors: function () {\n var connection = this, sourcePoint, targetPoint, sourceConnectors, targetConnectors, source = connection.source(), target = connection.target();\n if (source instanceof Point) {\n sourcePoint = source;\n } else if (source instanceof Connector) {\n if (isAutoConnector(source)) {\n sourceConnectors = source.shape.connectors;\n } else {\n sourceConnectors = [source];\n }\n }\n if (target instanceof Point) {\n targetPoint = target;\n } else if (target instanceof Connector) {\n if (isAutoConnector(target)) {\n targetConnectors = target.shape.connectors;\n } else {\n targetConnectors = [target];\n }\n }\n if (sourcePoint) {\n if (targetConnectors) {\n connection._resolvedTargetConnector = closestConnector(sourcePoint, targetConnectors);\n }\n } else if (sourceConnectors) {\n if (targetPoint) {\n connection._resolvedSourceConnector = closestConnector(targetPoint, sourceConnectors);\n } else if (targetConnectors) {\n this._resolveAutoConnectors(sourceConnectors, targetConnectors);\n }\n }\n },\n _resolveAutoConnectors: function (sourceConnectors, targetConnectors) {\n var minNonConflict = MAXINT;\n var minDist = MAXINT;\n var minNonConflictSource, minNonConflictTarget;\n var sourcePoint, targetPoint;\n var minSource, minTarget;\n var sourceConnector, targetConnector;\n var sourceIdx, targetIdx;\n var dist;\n for (sourceIdx = 0; sourceIdx < sourceConnectors.length; sourceIdx++) {\n sourceConnector = sourceConnectors[sourceIdx];\n if (!isAutoConnector(sourceConnector)) {\n sourcePoint = sourceConnector.position();\n for (targetIdx = 0; targetIdx < targetConnectors.length; targetIdx++) {\n targetConnector = targetConnectors[targetIdx];\n if (!isAutoConnector(targetConnector)) {\n targetPoint = targetConnector.position();\n dist = math.round(sourcePoint.distanceTo(targetPoint));\n if (dist < minNonConflict && this.diagram && this._testRoutePoints(sourcePoint, targetPoint, sourceConnector, targetConnector)) {\n minNonConflict = dist;\n minNonConflictSource = sourceConnector;\n minNonConflictTarget = targetConnector;\n }\n if (dist < minDist) {\n minSource = sourceConnector;\n minTarget = targetConnector;\n minDist = dist;\n }\n }\n }\n }\n }\n if (minNonConflictSource) {\n minSource = minNonConflictSource;\n minTarget = minNonConflictTarget;\n }\n this._resolvedSourceConnector = minSource;\n this._resolvedTargetConnector = minTarget;\n },\n _testRoutePoints: function (sourcePoint, targetPoint, sourceConnector, targetConnector) {\n var router = this._router;\n var passRoute = true;\n if (router instanceof CascadingRouter) {\n var points = router.routePoints(sourcePoint, targetPoint, sourceConnector, targetConnector), start, end, rect;\n points.unshift(sourcePoint);\n points.push(targetPoint);\n for (var idx = 1; idx < points.length; idx++) {\n start = points[idx - 1];\n end = points[idx];\n rect = new Rect(math.min(start.x, end.x), math.min(start.y, end.y), math.abs(start.x - end.x), math.abs(start.y - end.y));\n if (rect.width > 0) {\n rect.x++;\n rect.width -= 2;\n }\n if (rect.height > 0) {\n rect.y++;\n rect.height -= 2;\n }\n if (!rect.isEmpty() && this.diagram._shapesQuadTree.hitTestRect(rect)) {\n passRoute = false;\n break;\n }\n }\n }\n return passRoute;\n },\n redraw: function (options) {\n if (options) {\n this.options = deepExtend({}, this.options, options);\n var points = this.options.points;\n if (defined(points) && points.length > 0) {\n this.points(points);\n this._refreshPath();\n }\n if (options && options.content || options.text) {\n this.content(options.content);\n }\n this.path.redraw({\n fill: options.fill,\n stroke: options.stroke,\n startCap: options.startCap,\n endCap: options.endCap\n });\n }\n },\n clone: function () {\n var json = this.serialize();\n if (this.diagram && this.diagram._isEditable && defined(this.dataItem)) {\n json.options.dataItem = cloneDataItem(this.dataItem);\n }\n return new Connection(this.from, this.to, json.options);\n },\n serialize: function () {\n var from = this.from.toJSON ? this.from.toJSON : this.from.toString(), to = this.to.toJSON ? this.to.toJSON : this.to.toString();\n var json = deepExtend({}, {\n options: this.options,\n from: from,\n to: to\n });\n if (defined(this.dataItem)) {\n json.dataItem = this.dataItem.toString();\n }\n json.options.points = this.points();\n return json;\n },\n _hitTest: function (value) {\n if (this.visible()) {\n var p = new Point(value.x, value.y), from = this.sourcePoint(), to = this.targetPoint();\n if (value.isEmpty && !value.isEmpty() && value.contains(from) && value.contains(to)) {\n return this;\n }\n if (this._router.hitTest(p)) {\n return this;\n }\n }\n },\n _hover: function (value) {\n var color = (this.options.stroke || {}).color;\n if (value && isDefined(this.options.hover.stroke.color)) {\n color = this.options.hover.stroke.color;\n }\n this.path.redraw({ stroke: { color: color } });\n },\n _refreshPath: function () {\n if (!defined(this.path)) {\n return;\n }\n this._drawPath();\n this.bounds(this._router.getBounds());\n },\n _drawPath: function () {\n if (this._router) {\n this._router.route();\n }\n var source = this.sourcePoint();\n var target = this.targetPoint();\n var points = this.points();\n this.path.redraw({ points: [source].concat(points, [target]) });\n },\n _clearSourceConnector: function () {\n this.sourceConnector = undefined;\n this._resolvedSourceConnector = undefined;\n },\n _clearTargetConnector: function () {\n this.targetConnector = undefined;\n this._resolvedTargetConnector = undefined;\n },\n _removeFromSourceConnector: function () {\n if (this.sourceConnector) {\n Utils.remove(this.sourceConnector.connections, this);\n }\n },\n _removeFromTargetConnector: function () {\n if (this.targetConnector) {\n Utils.remove(this.targetConnector.connections, this);\n }\n },\n toJSON: function () {\n var connection = this;\n var from, to, point;\n if (connection.from && connection.from.toJSON) {\n from = connection.from.toJSON();\n } else {\n point = connection._sourcePoint;\n from = {\n x: point.x,\n y: point.y\n };\n }\n if (connection.to && connection.to.toJSON) {\n to = connection.to.toJSON();\n } else {\n point = connection._targetPoint;\n to = {\n x: point.x,\n y: point.y\n };\n }\n return {\n from: from,\n to: to\n };\n }\n });\n var Diagram = Widget.extend({\n init: function (element, userOptions) {\n var that = this;\n kendo.destroy(element);\n Widget.fn.init.call(that, element, userOptions);\n that._initTheme();\n that._initElements();\n that._extendLayoutOptions(that.options);\n that._initDefaults(userOptions);\n that._interactionDefaults();\n that._initCanvas();\n that.mainLayer = new Group({ id: 'main-layer' });\n that.canvas.append(that.mainLayer);\n that._shapesQuadTree = new ShapesQuadTree(that);\n that._pan = new Point();\n that._adorners = [];\n that.adornerLayer = new Group({ id: 'adorner-layer' });\n that.canvas.append(that.adornerLayer);\n that._createHandlers();\n that._initialize();\n that._resizingAdorner = new ResizingAdorner(that, { editable: that.options.editable });\n that._connectorsAdorner = new ConnectorsAdorner(that);\n that._adorn(that._resizingAdorner, true);\n that._adorn(that._connectorsAdorner, true);\n that.selector = new Selector(that);\n that._clipboard = [];\n that.pauseMouseHandlers = false;\n that._fetchFreshData();\n that._createGlobalToolBar();\n that._createOptionElements();\n that.zoom(that.options.zoom);\n that.canvas.draw();\n },\n options: {\n name: 'Diagram',\n theme: 'default',\n layout: '',\n zoomRate: 0.1,\n zoom: 1,\n zoomMin: 0,\n zoomMax: 2,\n dataSource: {},\n draggable: true,\n template: '',\n autoBind: true,\n editable: {\n rotate: {},\n resize: {},\n text: true,\n tools: [],\n drag: {\n snap: {\n size: 10,\n angle: 10\n }\n },\n remove: true\n },\n pannable: {},\n selectable: { key: 'none' },\n tooltip: {\n enabled: true,\n format: '{0}'\n },\n copy: {\n enabled: true,\n offsetX: 20,\n offsetY: 20\n },\n shapeDefaults: diagram.shapeDefaults({ undoable: true }),\n connectionDefaults: {\n editable: { tools: [] },\n type: CASCADING\n },\n shapes: [],\n connections: []\n },\n events: [\n ZOOM_END,\n ZOOM_START,\n PAN,\n SELECT,\n ITEMROTATE,\n ITEMBOUNDSCHANGE,\n CHANGE,\n CLICK,\n MOUSE_ENTER,\n MOUSE_LEAVE,\n 'toolBarClick',\n 'save',\n 'cancel',\n 'edit',\n 'remove',\n 'add',\n 'dataBound',\n DRAG_START,\n DRAG,\n DRAG_END\n ],\n items: function () {\n return $();\n },\n _createGlobalToolBar: function () {\n var editable = this.options.editable;\n if (editable) {\n var tools = editable.tools;\n if (this._isEditable && tools !== false && (!tools || tools.length === 0)) {\n tools = [\n 'createShape',\n 'undo',\n 'redo',\n 'rotateClockwise',\n 'rotateAnticlockwise'\n ];\n }\n if (tools && tools.length) {\n this.toolBar = new DiagramToolBar(this, {\n tools: tools || {},\n click: proxy(this._toolBarClick, this),\n modal: false\n });\n this.toolBar.element.css({ textAlign: 'left' });\n this.element.prepend(this.toolBar.element);\n this._resize();\n }\n }\n },\n createShape: function () {\n if (this.editor && this.editor.end() || !this.editor) {\n var dataSource = this.dataSource;\n var view = dataSource.view() || [];\n var index = view.length;\n var model = createModel(dataSource, {});\n var shape = this._createShape(model, {});\n if (!this.trigger('add', { shape: shape })) {\n dataSource.insert(index, model);\n var inactiveItem = this._inactiveShapeItems.getByUid(model.uid);\n inactiveItem.element = shape;\n this.edit(shape);\n }\n }\n },\n _createShape: function (dataItem, options) {\n options = deepExtend({}, this.options.shapeDefaults, options);\n options.dataItem = dataItem;\n var shape = new Shape(options, this);\n return shape;\n },\n createConnection: function () {\n if (this.editor && this.editor.end() || !this.editor) {\n var connectionsDataSource = this.connectionsDataSource;\n var view = connectionsDataSource.view() || [];\n var index = view.length;\n var model = createModel(connectionsDataSource, {});\n var connection = this._createConnection(model);\n if (!this.trigger('add', { connection: connection })) {\n this._connectionsDataMap[model.uid] = connection;\n connectionsDataSource.insert(index, model);\n this.addConnection(connection, false);\n this.edit(connection);\n }\n }\n },\n _createConnection: function (dataItem, source, target) {\n var options = deepExtend({}, this.options.connectionDefaults);\n options.dataItem = dataItem;\n var connection = new Connection(source || new Point(), target || new Point(), options);\n return connection;\n },\n editModel: function (dataItem, editorType) {\n this.cancelEdit();\n var editors, template;\n var editable = this.options.editable;\n if (editorType == 'shape') {\n editors = editable.shapeEditors;\n template = editable.shapeTemplate;\n } else if (editorType == 'connection') {\n var connectionSelectorHandler = proxy(connectionSelector, this);\n editors = deepExtend({}, {\n from: connectionSelectorHandler,\n to: connectionSelectorHandler\n }, editable.connectionEditors);\n template = editable.connectionTemplate;\n } else {\n return;\n }\n this.editor = new PopupEditor(this.element, {\n update: proxy(this._update, this),\n cancel: proxy(this._cancel, this),\n model: dataItem,\n type: editorType,\n target: this,\n editors: editors,\n template: template\n });\n this.trigger('edit', this._editArgs());\n },\n edit: function (item) {\n if (item.dataItem) {\n var editorType = item instanceof Shape ? 'shape' : 'connection';\n this.editModel(item.dataItem, editorType);\n }\n },\n cancelEdit: function () {\n if (this.editor) {\n this._getEditDataSource().cancelChanges(this.editor.model);\n this._destroyEditor();\n }\n },\n saveEdit: function () {\n if (this.editor && this.editor.end() && !this.trigger('save', this._editArgs())) {\n this._getEditDataSource().sync();\n }\n },\n _update: function () {\n if (this.editor && this.editor.end() && !this.trigger('save', this._editArgs())) {\n this._getEditDataSource().sync();\n this._destroyEditor();\n }\n },\n _cancel: function () {\n if (this.editor && !this.trigger('cancel', this._editArgs())) {\n var model = this.editor.model;\n this._getEditDataSource().cancelChanges(model);\n var element = this._connectionsDataMap[model.uid] || this._dataMap[model.id];\n if (element) {\n element._setOptionsFromModel(model);\n }\n this._destroyEditor();\n }\n },\n _getEditDataSource: function () {\n return this.editor.options.type === 'shape' ? this.dataSource : this.connectionsDataSource;\n },\n _editArgs: function () {\n var result = { container: this.editor.wrapper };\n result[this.editor.options.type] = this.editor.model;\n return result;\n },\n _destroyEditor: function () {\n if (this.editor) {\n this.editor.close();\n this.editor = null;\n }\n },\n _initElements: function () {\n this.wrapper = this.element.empty().css('position', 'relative').attr('tabindex', 0).addClass('k-widget k-diagram');\n this.scrollable = $('').appendTo(this.element);\n },\n _initDefaults: function (userOptions) {\n var options = this.options;\n var editable = options.editable;\n var shapeDefaults = options.shapeDefaults;\n var connectionDefaults = options.connectionDefaults;\n var userShapeDefaults = (userOptions || {}).shapeDefaults;\n if (editable === false) {\n shapeDefaults.editable = false;\n connectionDefaults.editable = false;\n } else {\n copyDefaultOptions(editable, shapeDefaults.editable, [\n 'drag',\n 'remove',\n 'connect'\n ]);\n copyDefaultOptions(editable, connectionDefaults.editable, [\n 'drag',\n 'remove'\n ]);\n }\n if (userShapeDefaults && userShapeDefaults.connectors) {\n options.shapeDefaults.connectors = userShapeDefaults.connectors;\n }\n },\n _interactionDefaults: function () {\n var options = this.options;\n var selectable = options.selectable;\n var pannable = options.pannable;\n var mobile = kendo.support.mobileOS;\n if (selectable && !defined(selectable.multiple)) {\n options.selectable = deepExtend({ multiple: mobile ? false : true }, options.selectable);\n }\n if (pannable && !defined(pannable.key)) {\n options.pannable = deepExtend({ key: mobile ? 'none' : 'ctrl' }, options.pannable);\n }\n },\n _initCanvas: function () {\n var canvasContainer = $('').appendTo(this.scrollable)[0];\n var viewPort = this.viewport();\n this.canvas = new Canvas(canvasContainer, {\n width: viewPort.width || DEFAULT_CANVAS_WIDTH,\n height: viewPort.height || DEFAULT_CANVAS_HEIGHT\n });\n },\n _createHandlers: function () {\n var that = this;\n var element = that.element;\n element.on(MOUSEWHEEL_NS, proxy(that._wheel, that)).on('keydown' + NS, proxy(that._keydown, that));\n that._userEvents = new kendo.UserEvents(this.scrollable, {\n multiTouch: true,\n fastTap: true,\n tap: proxy(that._tap, that),\n start: proxy(that._dragStart, that),\n move: proxy(that._drag, that),\n end: proxy(that._dragEnd, that),\n gesturestart: proxy(that._gestureStart, that),\n gesturechange: proxy(that._gestureChange, that),\n gestureend: proxy(that._gestureEnd, that)\n });\n that.toolService = new ToolService(that);\n this.scrollable.on('mouseover' + NS, proxy(that._mouseover, that)).on('mouseout' + NS, proxy(that._mouseout, that)).on('mousemove' + NS, proxy(that._mouseMove, that)).on('mousedown' + NS, proxy(that._mouseDown, that)).on('mouseup' + NS, proxy(that._mouseUp, that));\n this._syncHandler = proxy(that._syncChanges, that);\n that._resizeHandler = proxy(that.resize, that, false);\n kendo.onResize(that._resizeHandler);\n this.bind(ZOOM_START, proxy(that._destroyToolBar, that));\n this.bind(PAN, proxy(that._destroyToolBar, that));\n },\n _dragStart: function (e) {\n this._pauseMouseHandlers = true;\n var point = this._eventPositions(e, true);\n var event = e.event;\n if (this.toolService.start(point, this._meta(event))) {\n this._destroyToolBar();\n event.preventDefault();\n }\n },\n _drag: function (e) {\n var p = this._eventPositions(e);\n var event = e.event;\n if (this.toolService.move(p, this._meta(event))) {\n event.preventDefault();\n }\n },\n _dragEnd: function (e) {\n this._pauseMouseHandlers = false;\n var p = this._eventPositions(e);\n var event = e.event;\n if (this.toolService.end(p, this._meta(event))) {\n this._createToolBar();\n event.preventDefault();\n }\n },\n _mouseMove: function (e) {\n if (!this._pauseMouseHandlers) {\n var p = this._eventPositions(e);\n this.toolService._updateHoveredItem(p);\n this.toolService._updateCursor(p);\n }\n },\n _mouseDown: function () {\n this._pauseMouseHandlers = true;\n },\n _mouseUp: function () {\n this._pauseMouseHandlers = false;\n },\n _tap: function (e) {\n var toolService = this.toolService;\n var selectable = this.options.selectable;\n var point = this._eventPositions(e);\n var focused = this.focus();\n toolService._updateHoveredItem(point);\n if (toolService.hoveredItem) {\n var item = toolService.hoveredItem;\n this.trigger('click', {\n item: item,\n point: point\n });\n if (selectable && item.options.selectable !== false) {\n var multiple = selectable.multiple !== false;\n var ctrlPressed = kendo.support.mobileOS || this._meta(e.event).ctrlKey;\n if (item.isSelected) {\n if (ctrlPressed) {\n this._destroyToolBar();\n item.select(false);\n } else {\n this._createToolBar(focused);\n }\n } else {\n this._destroyToolBar();\n this.select(item, { addToSelection: multiple && ctrlPressed });\n this._createToolBar(focused);\n }\n }\n } else if (selectable) {\n this._destroyToolBar();\n this.deselect();\n }\n },\n _keydown: function (e) {\n if (this.toolService.keyDown(e.keyCode, this._meta(e))) {\n e.preventDefault();\n }\n },\n _wheel: function (e) {\n var delta = mwDelta(e), p = this._eventPositions(e), meta = deepExtend(this._meta(e), { delta: delta });\n if (this.toolService.wheel(p, meta)) {\n e.preventDefault();\n }\n },\n _meta: function (e) {\n return {\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey,\n shiftKey: e.shiftKey,\n type: e.type\n };\n },\n _eventPositions: function (e, start) {\n var point;\n if (e.touch) {\n var field = start ? 'startLocation' : 'location';\n point = new Point(e.x[field], e.y[field]);\n } else {\n point = new Point(e.pageX, e.pageY);\n }\n return this.documentToModel(point);\n },\n _gestureStart: function (e) {\n this._destroyToolBar();\n this.scroller.disable();\n var initialCenter = this.documentToModel(new Point(e.center.x, e.center.y));\n var eventArgs = {\n point: initialCenter,\n zoom: this.zoom()\n };\n if (this.trigger(ZOOM_START, eventArgs)) {\n return;\n }\n this._gesture = e;\n this._initialCenter = initialCenter;\n },\n _gestureChange: function (e) {\n var previousGesture = this._gesture;\n var initialCenter = this._initialCenter;\n var center = this.documentToView(new Point(e.center.x, e.center.y));\n var scaleDelta = e.distance / previousGesture.distance;\n var zoom = this._zoom;\n var updateZoom = false;\n if (math.abs(scaleDelta - 1) >= MOBILE_ZOOM_RATE) {\n this._zoom = zoom = this._getValidZoom(zoom * scaleDelta);\n this.options.zoom = zoom;\n this._gesture = e;\n updateZoom = true;\n }\n var zoomedPoint = initialCenter.times(zoom);\n var pan = center.minus(zoomedPoint);\n if (updateZoom || this._pan.distanceTo(pan) >= MOBILE_PAN_DISTANCE) {\n this._panTransform(pan);\n this._updateAdorners();\n }\n e.preventDefault();\n },\n _gestureEnd: function () {\n if (this.options.pannable !== false) {\n this.scroller.enable();\n }\n this.trigger(ZOOM_END, {\n point: this._initialCenter,\n zoom: this.zoom()\n });\n },\n _resize: function () {\n var viewport = this.viewport();\n if (this.canvas) {\n this.canvas.size(viewport);\n }\n if (this.scrollable && this.toolBar) {\n this.scrollable.height(viewport.height);\n }\n },\n _mouseover: function (e) {\n var node = e.target._kendoNode;\n if (node && node.srcElement._hover) {\n node.srcElement._hover(true, node.srcElement);\n }\n },\n _mouseout: function (e) {\n var node = e.target._kendoNode;\n if (node && node.srcElement._hover) {\n node.srcElement._hover(false, node.srcElement);\n }\n },\n _initTheme: function () {\n var that = this, themes = dataviz.ui.themes || {}, themeName = ((that.options || {}).theme || '').toLowerCase(), themeOptions = (themes[themeName] || {}).diagram;\n that.options = deepExtend({}, themeOptions, that.options);\n if (that.options.editable === true) {\n deepExtend(that.options, { editable: (themeOptions || {}).editable });\n }\n },\n _createOptionElements: function () {\n var options = this.options;\n var shapesLength = options.shapes.length;\n if (shapesLength) {\n this._createShapes();\n }\n if (options.connections.length) {\n this._createConnections();\n }\n if (shapesLength && options.layout) {\n this.layout(options.layout);\n }\n },\n _createShapes: function () {\n var that = this, options = that.options, shapes = options.shapes, shape, i;\n for (i = 0; i < shapes.length; i++) {\n shape = shapes[i];\n that.addShape(shape);\n }\n },\n _createConnections: function () {\n var diagram = this, options = diagram.options, defaults = options.connectionDefaults, connections = options.connections, conn, source, target, i;\n for (i = 0; i < connections.length; i++) {\n conn = connections[i];\n source = diagram._findConnectionTarget(conn.from);\n target = diagram._findConnectionTarget(conn.to);\n diagram.connect(source, target, deepExtend({}, defaults, conn));\n }\n },\n _findConnectionTarget: function (options) {\n options = options || {};\n var diagram = this;\n var shapeId = isString(options) ? options : options.shapeId || options.id;\n var target;\n if (shapeId) {\n target = diagram.getShapeById(shapeId);\n if (options.connector) {\n target = target.getConnector(options.connector);\n }\n } else {\n target = new Point(options.x || 0, options.y || 0);\n }\n return target;\n },\n destroy: function () {\n var that = this;\n Widget.fn.destroy.call(that);\n if (this._userEvents) {\n this._userEvents.destroy();\n }\n kendo.unbindResize(that._resizeHandler);\n that.clear();\n that.element.off(NS);\n that.scroller.wrapper.off(NS);\n that.canvas.destroy(true);\n that.canvas = undefined;\n that._destroyEditor();\n that.destroyScroller();\n that._destroyGlobalToolBar();\n that._destroyToolBar();\n },\n destroyScroller: function () {\n var scroller = this.scroller;\n if (!scroller) {\n return;\n }\n scroller.destroy();\n scroller.element.remove();\n this.scroller = null;\n },\n save: function () {\n var json = {\n shapes: [],\n connections: []\n };\n var i, connection, shape;\n for (i = 0; i < this.shapes.length; i++) {\n shape = this.shapes[i];\n if (shape.options.serializable) {\n json.shapes.push(shape.options);\n }\n }\n for (i = 0; i < this.connections.length; i++) {\n connection = this.connections[i];\n json.connections.push(deepExtend({}, connection.options, connection.toJSON()));\n }\n return json;\n },\n focus: function () {\n if (!this.element.is(kendo._activeElement())) {\n var element = this.element, scrollContainer = element[0], containers = [], offsets = [], documentElement = document.documentElement, i;\n do {\n scrollContainer = scrollContainer.parentNode;\n if (scrollContainer.scrollHeight > scrollContainer.clientHeight) {\n containers.push(scrollContainer);\n offsets.push(scrollContainer.scrollTop);\n }\n } while (scrollContainer != documentElement);\n element.focus();\n for (i = 0; i < containers.length; i++) {\n containers[i].scrollTop = offsets[i];\n }\n return true;\n }\n },\n load: function (options) {\n this.clear();\n this.setOptions(options);\n this._createShapes();\n this._createConnections();\n },\n setOptions: function (options) {\n deepExtend(this.options, options);\n },\n clear: function () {\n var that = this;\n that.select(false);\n that.mainLayer.clear();\n that._shapesQuadTree.clear();\n that._initialize();\n },\n connect: function (source, target, options) {\n var connection;\n if (this.connectionsDataSource && this._isEditable) {\n var dataItem = this.connectionsDataSource.add({});\n connection = this._connectionsDataMap[dataItem.uid];\n connection.source(source);\n connection.target(target);\n connection.redraw(options);\n connection.updateModel();\n } else {\n connection = new Connection(source, target, deepExtend({}, this.options.connectionDefaults, options));\n this.addConnection(connection);\n }\n return connection;\n },\n connected: function (source, target) {\n for (var i = 0; i < this.connections.length; i++) {\n var c = this.connections[i];\n if (c.from == source && c.to == target) {\n return true;\n }\n }\n return false;\n },\n addConnection: function (connection, undoable) {\n if (undoable !== false) {\n this.undoRedoService.add(new diagram.AddConnectionUnit(connection, this), false);\n }\n connection.diagram = this;\n connection._setOptionsFromModel();\n connection.refresh();\n this.mainLayer.append(connection.visual);\n this.connections.push(connection);\n this.trigger(CHANGE, {\n added: [connection],\n removed: []\n });\n return connection;\n },\n _addConnection: function (connection, undoable) {\n var connectionsDataSource = this.connectionsDataSource;\n var dataItem;\n if (connectionsDataSource && this._isEditable) {\n dataItem = createModel(connectionsDataSource, cloneDataItem(connection.dataItem));\n connection.dataItem = dataItem;\n connection.updateModel();\n if (!this.trigger('add', { connection: connection })) {\n this._connectionsDataMap[dataItem.uid] = connection;\n connectionsDataSource.add(dataItem);\n this.addConnection(connection, undoable);\n connection._updateConnectors();\n return connection;\n }\n } else if (!this.trigger('add', { connection: connection })) {\n this.addConnection(connection, undoable);\n connection._updateConnectors();\n return connection;\n }\n },\n addShape: function (item, undoable) {\n var shape, shapeDefaults = this.options.shapeDefaults;\n if (item instanceof Shape) {\n shape = item;\n } else if (!(item instanceof kendo.Class)) {\n shapeDefaults = deepExtend({}, shapeDefaults, item || {});\n shape = new Shape(shapeDefaults, this);\n } else {\n return;\n }\n if (undoable !== false) {\n this.undoRedoService.add(new diagram.AddShapeUnit(shape, this), false);\n }\n this.shapes.push(shape);\n if (shape.diagram !== this) {\n this._shapesQuadTree.insert(shape);\n shape.diagram = this;\n }\n this.mainLayer.append(shape.visual);\n this.trigger(CHANGE, {\n added: [shape],\n removed: []\n });\n return shape;\n },\n _addShape: function (shape, undoable) {\n var that = this;\n var dataSource = that.dataSource;\n var dataItem;\n if (dataSource && this._isEditable) {\n dataItem = createModel(dataSource, cloneDataItem(shape.dataItem));\n shape.dataItem = dataItem;\n shape.updateModel();\n if (!this.trigger('add', { shape: shape })) {\n this.dataSource.add(dataItem);\n var inactiveItem = this._inactiveShapeItems.getByUid(dataItem.uid);\n inactiveItem.element = shape;\n inactiveItem.undoable = undoable;\n return shape;\n }\n } else if (!this.trigger('add', { shape: shape })) {\n return this.addShape(shape, undoable);\n }\n },\n remove: function (items, undoable) {\n items = isArray(items) ? items.slice(0) : [items];\n var elements = splitDiagramElements(items);\n var shapes = elements.shapes;\n var connections = elements.connections;\n var i;\n if (!defined(undoable)) {\n undoable = true;\n }\n if (undoable) {\n this.undoRedoService.begin();\n }\n this._suspendModelRefresh();\n for (i = shapes.length - 1; i >= 0; i--) {\n this._removeItem(shapes[i], undoable, connections);\n }\n for (i = connections.length - 1; i >= 0; i--) {\n this._removeItem(connections[i], undoable);\n }\n this._resumeModelRefresh();\n if (undoable) {\n this.undoRedoService.commit(false);\n }\n this.trigger(CHANGE, {\n added: [],\n removed: items\n });\n },\n _removeShapeDataItem: function (item) {\n if (this._isEditable) {\n this.dataSource.remove(item.dataItem);\n delete this._dataMap[item.dataItem.id];\n }\n },\n _removeConnectionDataItem: function (item) {\n if (this._isEditable) {\n this.connectionsDataSource.remove(item.dataItem);\n delete this._connectionsDataMap[item.dataItem.uid];\n }\n },\n _triggerRemove: function (items) {\n var toRemove = [];\n var item, args, editable;\n for (var idx = 0; idx < items.length; idx++) {\n item = items[idx];\n editable = item.options.editable;\n if (item instanceof Shape) {\n args = { shape: item };\n } else {\n args = { connection: item };\n }\n if (editable && editable.remove !== false && !this.trigger('remove', args)) {\n toRemove.push(item);\n }\n }\n return toRemove;\n },\n undo: function () {\n this.undoRedoService.undo();\n },\n redo: function () {\n this.undoRedoService.redo();\n },\n select: function (item, options) {\n if (isDefined(item)) {\n options = deepExtend({ addToSelection: false }, options);\n var addToSelection = options.addToSelection, items = [], selected = [], i, element;\n if (!addToSelection) {\n this.deselect();\n }\n this._internalSelection = true;\n if (item instanceof Array) {\n items = item;\n } else if (item instanceof DiagramElement) {\n items = [item];\n }\n for (i = 0; i < items.length; i++) {\n element = items[i];\n if (element.select(true)) {\n selected.push(element);\n }\n }\n this._selectionChanged(selected, []);\n this._internalSelection = false;\n } else {\n return this._selectedItems;\n }\n },\n selectAll: function () {\n this.select(this.shapes.concat(this.connections));\n },\n selectArea: function (rect) {\n var i, items, item;\n this._internalSelection = true;\n var selected = [];\n if (rect instanceof Rect) {\n items = this.shapes.concat(this.connections);\n for (i = 0; i < items.length; i++) {\n item = items[i];\n if ((!rect || item._hitTest(rect)) && item.options.enable) {\n if (item.select(true)) {\n selected.push(item);\n }\n }\n }\n }\n this._selectionChanged(selected, []);\n this._internalSelection = false;\n },\n deselect: function (item) {\n this._internalSelection = true;\n var deselected = [], items = [], element, i;\n if (item instanceof Array) {\n items = item;\n } else if (item instanceof DiagramElement) {\n items.push(item);\n } else if (!isDefined(item)) {\n items = this._selectedItems.slice(0);\n }\n for (i = 0; i < items.length; i++) {\n element = items[i];\n if (element.select(false)) {\n deselected.push(element);\n }\n }\n this._selectionChanged([], deselected);\n this._internalSelection = false;\n },\n toFront: function (items, undoable) {\n if (!items) {\n items = this._selectedItems.slice();\n }\n var result = this._getDiagramItems(items), indices;\n if (!defined(undoable) || undoable) {\n indices = indicesOfItems(this.mainLayer, result.visuals);\n var unit = new ToFrontUnit(this, items, indices);\n this.undoRedoService.add(unit);\n } else {\n this.mainLayer.toFront(result.visuals);\n this._fixOrdering(result, true);\n }\n },\n toBack: function (items, undoable) {\n if (!items) {\n items = this._selectedItems.slice();\n }\n var result = this._getDiagramItems(items), indices;\n if (!defined(undoable) || undoable) {\n indices = indicesOfItems(this.mainLayer, result.visuals);\n var unit = new ToBackUnit(this, items, indices);\n this.undoRedoService.add(unit);\n } else {\n this.mainLayer.toBack(result.visuals);\n this._fixOrdering(result, false);\n }\n },\n bringIntoView: function (item, options) {\n var viewport = this.viewport();\n var aligner = new diagram.RectAlign(viewport);\n var current, rect, original, newPan;\n if (viewport.width === 0 || viewport.height === 0) {\n return;\n }\n options = deepExtend({\n animate: false,\n align: 'center middle'\n }, options);\n if (options.align == 'none') {\n options.align = 'center middle';\n }\n if (item instanceof DiagramElement) {\n rect = item.bounds(TRANSFORMED);\n } else if (isArray(item)) {\n rect = this.boundingBox(item);\n } else if (item instanceof Rect) {\n rect = item.clone();\n }\n original = rect.clone();\n rect.zoom(this._zoom);\n if (rect.width > viewport.width || rect.height > viewport.height) {\n this._zoom = this._getValidZoom(math.min(viewport.width / original.width, viewport.height / original.height));\n rect = original.clone().zoom(this._zoom);\n }\n this._zoomMainLayer();\n current = rect.clone();\n aligner.align(rect, options.align);\n newPan = rect.topLeft().minus(current.topLeft());\n this.pan(newPan.times(-1), options.animate);\n },\n alignShapes: function (direction) {\n if (isUndefined(direction)) {\n direction = 'Left';\n }\n var items = this.select(), val, item, i;\n if (items.length === 0) {\n return;\n }\n switch (direction.toLowerCase()) {\n case 'left':\n case 'top':\n val = MAX_VALUE;\n break;\n case 'right':\n case 'bottom':\n val = MIN_VALUE;\n break;\n }\n for (i = 0; i < items.length; i++) {\n item = items[i];\n if (item instanceof Shape) {\n switch (direction.toLowerCase()) {\n case 'left':\n val = math.min(val, item.options.x);\n break;\n case 'top':\n val = math.min(val, item.options.y);\n break;\n case 'right':\n val = math.max(val, item.options.x);\n break;\n case 'bottom':\n val = math.max(val, item.options.y);\n break;\n }\n }\n }\n var undoStates = [];\n var shapes = [];\n for (i = 0; i < items.length; i++) {\n item = items[i];\n if (item instanceof Shape) {\n shapes.push(item);\n undoStates.push(item.bounds());\n switch (direction.toLowerCase()) {\n case 'left':\n case 'right':\n item.position(new Point(val, item.options.y));\n break;\n case 'top':\n case 'bottom':\n item.position(new Point(item.options.x, val));\n break;\n }\n }\n }\n var unit = new diagram.TransformUnit(shapes, undoStates);\n this.undoRedoService.add(unit, false);\n },\n zoom: function (zoom, options) {\n if (zoom) {\n var staticPoint = options ? options.point : new diagram.Point(0, 0);\n zoom = this._zoom = this._getValidZoom(zoom);\n if (!isUndefined(staticPoint)) {\n staticPoint = new diagram.Point(math.round(staticPoint.x), math.round(staticPoint.y));\n var zoomedPoint = staticPoint.times(zoom);\n var viewportVector = this.modelToView(staticPoint);\n var raw = viewportVector.minus(zoomedPoint);\n this._storePan(new diagram.Point(math.round(raw.x), math.round(raw.y)));\n }\n if (options) {\n options.zoom = zoom;\n }\n this._panTransform();\n this.canvas.surface.hideTooltip();\n this._updateAdorners();\n }\n return this._zoom;\n },\n _getPan: function (pan) {\n var canvas = this.canvas;\n if (!canvas.translate) {\n pan = pan.plus(this._pan);\n }\n return pan;\n },\n pan: function (pan, animate) {\n if (pan instanceof Point) {\n var that = this;\n var scroller = that.scroller;\n pan = that._getPan(pan);\n pan = pan.times(-1);\n if (animate) {\n scroller.animatedScrollTo(pan.x, pan.y, function () {\n that._updateAdorners();\n });\n } else {\n scroller.scrollTo(pan.x, pan.y);\n that._updateAdorners();\n }\n } else {\n return this._pan.times(-1);\n }\n },\n viewport: function () {\n var element = this.element;\n var width = element.width();\n var height = element.height();\n if (this.toolBar) {\n height -= outerHeight(this.toolBar.element);\n }\n return new Rect(0, 0, width, height);\n },\n copy: function () {\n if (this.options.copy.enabled) {\n this._clipboard = [];\n this._copyOffset = 1;\n for (var i = 0; i < this._selectedItems.length; i++) {\n var item = this._selectedItems[i];\n this._clipboard.push(item);\n }\n }\n },\n cut: function () {\n if (this.options.copy.enabled) {\n this._clipboard = [];\n this._copyOffset = 0;\n for (var i = 0; i < this._selectedItems.length; i++) {\n var item = this._selectedItems[i];\n this._clipboard.push(item);\n }\n this.remove(this._clipboard, true);\n }\n },\n paste: function () {\n if (this._clipboard.length > 0) {\n var item, copied, i;\n var mapping = {};\n var elements = splitDiagramElements(this._clipboard);\n var connections = elements.connections;\n var shapes = elements.shapes;\n var offset = {\n x: this._copyOffset * this.options.copy.offsetX,\n y: this._copyOffset * this.options.copy.offsetY\n };\n this.deselect();\n for (i = 0; i < shapes.length; i++) {\n item = shapes[i];\n copied = item.clone();\n mapping[item.id] = copied;\n copied.position(new Point(item.options.x + offset.x, item.options.y + offset.y));\n copied.diagram = this;\n copied = this._addShape(copied);\n if (copied) {\n copied.select();\n }\n }\n for (i = 0; i < connections.length; i++) {\n item = connections[i];\n copied = this._addConnection(item.clone());\n if (copied) {\n this._updateCopiedConnection(copied, item, 'source', mapping, offset);\n this._updateCopiedConnection(copied, item, 'target', mapping, offset);\n copied.select(true);\n copied.updateModel();\n }\n }\n this._syncChanges();\n this._copyOffset += 1;\n }\n },\n _updateCopiedConnection: function (connection, sourceConnection, connectorName, mapping, offset) {\n var onActivate, inactiveItem, targetShape;\n var target = sourceConnection[connectorName]();\n var diagram = this;\n if (target instanceof Connector && mapping[target.shape.id]) {\n targetShape = mapping[target.shape.id];\n if (diagram.getShapeById(targetShape.id)) {\n connection[connectorName](targetShape.getConnector(target.options.name));\n } else {\n inactiveItem = diagram._inactiveShapeItems.getByUid(targetShape.dataItem.uid);\n if (inactiveItem) {\n onActivate = function (item) {\n targetShape = diagram._dataMap[item.id];\n connection[connectorName](targetShape.getConnector(target.options.name));\n connection.updateModel();\n };\n diagram._deferredConnectionUpdates.push(inactiveItem.onActivate(onActivate));\n }\n }\n } else {\n connection[connectorName](new Point(sourceConnection[connectorName + 'Point']().x + offset.x, sourceConnection[connectorName + 'Point']().y + offset.y));\n }\n },\n boundingBox: function (items, origin) {\n var rect = Rect.empty(), temp, di = isDefined(items) ? this._getDiagramItems(items) : { shapes: this.shapes };\n if (di.shapes.length > 0) {\n var item = di.shapes[0];\n rect = item.bounds(ROTATED);\n for (var i = 1; i < di.shapes.length; i++) {\n item = di.shapes[i];\n temp = item.bounds(ROTATED);\n if (origin === true) {\n temp.x -= item._rotationOffset.x;\n temp.y -= item._rotationOffset.y;\n }\n rect = rect.union(temp);\n }\n }\n return rect;\n },\n _containerOffset: function () {\n var containerOffset = this.element.offset();\n if (this.toolBar) {\n containerOffset.top += outerHeight(this.toolBar.element);\n }\n return containerOffset;\n },\n documentToView: function (point) {\n var containerOffset = this._containerOffset();\n return new Point(point.x - containerOffset.left, point.y - containerOffset.top);\n },\n viewToDocument: function (point) {\n var containerOffset = this._containerOffset();\n return new Point(point.x + containerOffset.left, point.y + containerOffset.top);\n },\n viewToModel: function (point) {\n return this._transformWithMatrix(point, this._matrixInvert);\n },\n modelToView: function (point) {\n return this._transformWithMatrix(point, this._matrix);\n },\n modelToLayer: function (point) {\n return this._transformWithMatrix(point, this._layerMatrix);\n },\n layerToModel: function (point) {\n return this._transformWithMatrix(point, this._layerMatrixInvert);\n },\n documentToModel: function (point) {\n var viewPoint = this.documentToView(point);\n if (!this.canvas.translate) {\n viewPoint.x = viewPoint.x + this.scroller.scrollLeft;\n viewPoint.y = viewPoint.y + this.scroller.scrollTop;\n }\n return this.viewToModel(viewPoint);\n },\n modelToDocument: function (point) {\n return this.viewToDocument(this.modelToView(point));\n },\n _transformWithMatrix: function (point, matrix) {\n var result = point;\n if (point instanceof Point) {\n if (matrix) {\n result = matrix.apply(point);\n }\n } else {\n var tl = this._transformWithMatrix(point.topLeft(), matrix), br = this._transformWithMatrix(point.bottomRight(), matrix);\n result = Rect.fromPoints(tl, br);\n }\n return result;\n },\n setDataSource: function (dataSource) {\n this.options.dataSource = dataSource;\n this._dataSource();\n if (this.options.autoBind) {\n this.dataSource.fetch();\n }\n },\n setConnectionsDataSource: function (dataSource) {\n this.options.connectionsDataSource = dataSource;\n this._connectionDataSource();\n if (this.options.autoBind) {\n this.connectionsDataSource.fetch();\n }\n },\n layout: function (options) {\n this._layouting = true;\n var type;\n if (isUndefined(options)) {\n options = this.options.layout;\n }\n if (isUndefined(options) || isUndefined(options.type)) {\n type = 'Tree';\n } else {\n type = options.type;\n }\n var l;\n switch (type.toLowerCase()) {\n case 'tree':\n l = new diagram.TreeLayout(this);\n break;\n case 'layered':\n l = new diagram.LayeredLayout(this);\n break;\n case 'forcedirected':\n case 'force':\n case 'spring':\n case 'springembedder':\n l = new diagram.SpringLayout(this);\n break;\n default:\n throw 'Layout algorithm \\'' + type + '\\' is not supported.';\n }\n var initialState = new diagram.LayoutState(this);\n var finalState = l.layout(options);\n if (finalState) {\n var unit = new diagram.LayoutUndoUnit(initialState, finalState, options ? options.animate : null);\n this.undoRedoService.add(unit);\n }\n this._layouting = false;\n this._redrawConnections();\n },\n getShapeById: function (id) {\n var found;\n found = Utils.first(this.shapes, function (s) {\n return s.visual.id === id;\n });\n if (found) {\n return found;\n }\n found = Utils.first(this.connections, function (c) {\n return c.visual.id === id;\n });\n return found;\n },\n getShapeByModelId: function (id) {\n var shape;\n if (this._isEditable) {\n shape = this._dataMap[id];\n } else {\n shape = Utils.first(this.shapes, function (shape) {\n return (shape.dataItem || {}).id === id;\n });\n }\n return shape;\n },\n getShapeByModelUid: function (uid) {\n var shape;\n if (this._isEditable) {\n shape = Utils.first(this.shapes, function (shape) {\n return (shape.dataItem || {}).uid === uid;\n });\n } else {\n shape = this._dataMap[uid];\n }\n return shape;\n },\n getConnectionByModelId: function (id) {\n var connection;\n if (this.connectionsDataSource) {\n connection = Utils.first(this.connections, function (connection) {\n return (connection.dataItem || {}).id === id;\n });\n }\n return connection;\n },\n getConnectionByModelUid: function (uid) {\n var connection;\n if (this.connectionsDataSource) {\n connection = this._connectionsDataMap[uid];\n }\n return connection;\n },\n _extendLayoutOptions: function (options) {\n if (options.layout) {\n options.layout = deepExtend({}, diagram.LayoutBase.fn.defaultOptions || {}, options.layout);\n }\n },\n _selectionChanged: function (selected, deselected) {\n if (selected.length || deselected.length) {\n this.trigger(SELECT, {\n selected: selected,\n deselected: deselected\n });\n }\n },\n _getValidZoom: function (zoom) {\n return math.min(math.max(zoom, this.options.zoomMin), this.options.zoomMax);\n },\n _panTransform: function (pos) {\n var diagram = this, pan = pos || diagram._pan;\n if (diagram.canvas.translate) {\n diagram.scroller.scrollTo(pan.x, pan.y);\n diagram._zoomMainLayer();\n } else {\n diagram._storePan(pan);\n diagram._transformMainLayer();\n }\n },\n _finishPan: function () {\n this.trigger(PAN, {\n total: this._pan,\n delta: Number.NaN\n });\n },\n _storePan: function (pan) {\n this._pan = pan;\n this._storeViewMatrix();\n },\n _zoomMainLayer: function () {\n var zoom = this._zoom;\n var transform = new CompositeTransform(0, 0, zoom, zoom);\n transform.render(this.mainLayer);\n this._storeLayerMatrix(transform);\n this._storeViewMatrix();\n },\n _transformMainLayer: function () {\n var pan = this._pan, zoom = this._zoom;\n var transform = new CompositeTransform(pan.x, pan.y, zoom, zoom);\n transform.render(this.mainLayer);\n this._storeLayerMatrix(transform);\n this._storeViewMatrix();\n },\n _storeLayerMatrix: function (canvasTransform) {\n this._layerMatrix = canvasTransform.toMatrix();\n this._layerMatrixInvert = canvasTransform.invert().toMatrix();\n },\n _storeViewMatrix: function () {\n var pan = this._pan, zoom = this._zoom;\n var transform = new CompositeTransform(pan.x, pan.y, zoom, zoom);\n this._matrix = transform.toMatrix();\n this._matrixInvert = transform.invert().toMatrix();\n },\n _toIndex: function (items, indices) {\n var result = this._getDiagramItems(items);\n this.mainLayer.toIndex(result.visuals, indices);\n this._fixOrdering(result, false);\n },\n _fixOrdering: function (result, toFront) {\n var shapePos = toFront ? this.shapes.length - 1 : 0, conPos = toFront ? this.connections.length - 1 : 0, i, item;\n for (i = 0; i < result.shapes.length; i++) {\n item = result.shapes[i];\n Utils.remove(this.shapes, item);\n Utils.insert(this.shapes, item, shapePos);\n }\n for (i = 0; i < result.cons.length; i++) {\n item = result.cons[i];\n Utils.remove(this.connections, item);\n Utils.insert(this.connections, item, conPos);\n }\n },\n _getDiagramItems: function (items) {\n var i, result = {}, args = items;\n result.visuals = [];\n result.shapes = [];\n result.cons = [];\n if (!items) {\n args = this._selectedItems.slice();\n } else if (!isArray(items)) {\n args = [items];\n }\n for (i = 0; i < args.length; i++) {\n var item = args[i];\n if (item instanceof Shape) {\n result.shapes.push(item);\n result.visuals.push(item.visual);\n } else if (item instanceof Connection) {\n result.cons.push(item);\n result.visuals.push(item.visual);\n }\n }\n return result;\n },\n _removeItem: function (item, undoable, removedConnections) {\n item.select(false);\n if (item instanceof Shape) {\n this._removeShapeDataItem(item);\n this._removeShape(item, undoable, removedConnections);\n } else if (item instanceof Connection) {\n this._removeConnectionDataItem(item);\n this._removeConnection(item, undoable);\n }\n this.mainLayer.remove(item.visual);\n },\n _removeShape: function (shape, undoable, removedConnections) {\n var i, connection, connector, sources = [], targets = [];\n this.toolService._removeHover();\n if (undoable) {\n this.undoRedoService.addCompositeItem(new DeleteShapeUnit(shape));\n }\n Utils.remove(this.shapes, shape);\n this._shapesQuadTree.remove(shape);\n for (i = 0; i < shape.connectors.length; i++) {\n connector = shape.connectors[i];\n for (var j = 0; j < connector.connections.length; j++) {\n connection = connector.connections[j];\n if (!removedConnections || !dataviz.inArray(connection, removedConnections)) {\n if (connection.sourceConnector == connector) {\n sources.push(connection);\n } else if (connection.targetConnector == connector) {\n targets.push(connection);\n }\n }\n }\n }\n for (i = 0; i < sources.length; i++) {\n sources[i].source(null, undoable);\n sources[i].updateModel();\n }\n for (i = 0; i < targets.length; i++) {\n targets[i].target(null, undoable);\n targets[i].updateModel();\n }\n },\n _removeConnection: function (connection, undoable) {\n if (connection.sourceConnector) {\n Utils.remove(connection.sourceConnector.connections, connection);\n }\n if (connection.targetConnector) {\n Utils.remove(connection.targetConnector.connections, connection);\n }\n if (undoable) {\n this.undoRedoService.addCompositeItem(new DeleteConnectionUnit(connection));\n }\n Utils.remove(this.connections, connection);\n },\n _removeDataItems: function (items, recursive) {\n var item, children, shape, idx;\n items = isArray(items) ? items : [items];\n while (items.length) {\n item = items.shift();\n shape = this._dataMap[item.uid];\n if (shape) {\n this._removeShapeConnections(shape);\n this._removeItem(shape, false);\n delete this._dataMap[item.uid];\n if (recursive && item.hasChildren && item.loaded()) {\n children = item.children.data();\n for (idx = 0; idx < children.length; idx++) {\n items.push(children[idx]);\n }\n }\n }\n }\n },\n _removeShapeConnections: function (shape) {\n var connections = shape.connections();\n var idx;\n if (connections) {\n for (idx = 0; idx < connections.length; idx++) {\n this._removeItem(connections[idx], false);\n }\n }\n },\n _addDataItem: function (dataItem, undoable) {\n if (!defined(dataItem)) {\n return;\n }\n var shape = this._dataMap[dataItem.id];\n if (shape) {\n return shape;\n }\n var options = deepExtend({}, this.options.shapeDefaults);\n options.dataItem = dataItem;\n shape = new Shape(options, this);\n this.addShape(shape, undoable !== false);\n this._dataMap[dataItem.id] = shape;\n return shape;\n },\n _addDataItemByUid: function (dataItem) {\n if (!defined(dataItem)) {\n return;\n }\n var shape = this._dataMap[dataItem.uid];\n if (shape) {\n return shape;\n }\n var options = deepExtend({}, this.options.shapeDefaults);\n options.dataItem = dataItem;\n shape = new Shape(options, this);\n this.addShape(shape);\n this._dataMap[dataItem.uid] = shape;\n return shape;\n },\n _addDataItems: function (items, parent) {\n var item, idx, shape, parentShape, connection;\n for (idx = 0; idx < items.length; idx++) {\n item = items[idx];\n shape = this._addDataItemByUid(item);\n parentShape = this._addDataItemByUid(parent);\n if (parentShape && !this.connected(parentShape, shape)) {\n connection = this.connect(parentShape, shape);\n }\n }\n },\n _refreshSource: function (e) {\n var that = this, node = e.node, action = e.action, items = e.items, options = that.options, idx, dataBound;\n if (e.field) {\n for (idx = 0; idx < items.length; idx++) {\n if (this._dataMap[items[idx].uid]) {\n this._dataMap[items[idx].uid].redrawVisual();\n }\n }\n return;\n }\n if (action == 'remove') {\n this._removeDataItems(e.items, true);\n } else {\n if ((!action || action === 'itemloaded') && !this._bindingRoots) {\n this._bindingRoots = true;\n dataBound = true;\n }\n if (!action && !node) {\n that.clear();\n }\n this._addDataItems(items, node);\n for (idx = 0; idx < items.length; idx++) {\n items[idx].load();\n }\n }\n if (options.layout && (dataBound || action == 'remove' || action == 'add')) {\n that.layout(options.layout);\n }\n if (dataBound) {\n this.trigger('dataBound');\n this._bindingRoots = false;\n }\n },\n _addItem: function (item) {\n if (item instanceof Shape) {\n this.addShape(item);\n } else if (item instanceof Connection) {\n this.addConnection(item);\n }\n },\n _createToolBar: function (preventClosing) {\n var diagram = this.toolService.diagram;\n if (!this.singleToolBar && diagram.select().length === 1) {\n var element = diagram.select()[0];\n if (element && element.options.editable !== false) {\n var editable = element.options.editable;\n var tools = editable.tools;\n if (this._isEditable && tools.length === 0) {\n if (element instanceof Shape) {\n tools = [\n 'edit',\n 'rotateClockwise',\n 'rotateAnticlockwise'\n ];\n } else if (element instanceof Connection) {\n tools = ['edit'];\n }\n if (editable && editable.remove !== false) {\n tools.push('delete');\n }\n }\n if (tools && tools.length) {\n var padding = 20;\n var point;\n this.singleToolBar = new DiagramToolBar(diagram, {\n tools: tools,\n click: proxy(this._toolBarClick, this),\n modal: true\n });\n var popupWidth = outerWidth(this.singleToolBar._popup.element);\n var popupHeight = outerHeight(this.singleToolBar._popup.element);\n if (element instanceof Shape) {\n var shapeBounds = this.modelToView(element.bounds(ROTATED));\n point = Point(shapeBounds.x, shapeBounds.y).minus(Point((popupWidth - shapeBounds.width) / 2, popupHeight + padding));\n } else if (element instanceof Connection) {\n var connectionBounds = this.modelToView(element.bounds());\n point = Point(connectionBounds.x, connectionBounds.y).minus(Point((popupWidth - connectionBounds.width - 20) / 2, popupHeight + padding));\n }\n if (point) {\n if (!this.canvas.translate) {\n point = point.minus(Point(this.scroller.scrollLeft, this.scroller.scrollTop));\n }\n point = this.viewToDocument(point);\n point = Point(math.max(point.x, 0), math.max(point.y, 0));\n this.singleToolBar.showAt(point);\n if (preventClosing) {\n this.singleToolBar._popup.one('close', preventDefault);\n }\n } else {\n this._destroyToolBar();\n }\n }\n }\n }\n },\n _toolBarClick: function (e) {\n this.trigger('toolBarClick', e);\n this._destroyToolBar();\n },\n _normalizePointZoom: function (point) {\n return point.times(1 / this.zoom());\n },\n _initialize: function () {\n this.shapes = [];\n this._selectedItems = [];\n this.connections = [];\n this._dataMap = {};\n this._connectionsDataMap = {};\n this._inactiveShapeItems = new InactiveItemsCollection();\n this._deferredConnectionUpdates = [];\n this.undoRedoService = new UndoRedoService({\n undone: this._syncHandler,\n redone: this._syncHandler\n });\n this.id = diagram.randomId();\n },\n _fetchFreshData: function () {\n var that = this;\n that._dataSource();\n if (that._isEditable) {\n that._connectionDataSource();\n }\n if (that.options.autoBind) {\n if (that._isEditable) {\n this._loadingShapes = true;\n this._loadingConnections = true;\n that.dataSource.fetch();\n that.connectionsDataSource.fetch();\n } else {\n that.dataSource.fetch();\n }\n }\n },\n _dataSource: function () {\n if (defined(this.options.connectionsDataSource)) {\n this._isEditable = true;\n var dsOptions = this.options.dataSource || {};\n var ds = isArray(dsOptions) ? { data: dsOptions } : dsOptions;\n if (this.dataSource && this._shapesRefreshHandler) {\n this.dataSource.unbind('change', this._shapesRefreshHandler).unbind('requestStart', this._shapesRequestStartHandler).unbind('error', this._shapesErrorHandler);\n } else {\n this._shapesRefreshHandler = proxy(this._refreshShapes, this);\n this._shapesRequestStartHandler = proxy(this._shapesRequestStart, this);\n this._shapesErrorHandler = proxy(this._error, this);\n }\n this.dataSource = kendo.data.DataSource.create(ds).bind('change', this._shapesRefreshHandler).bind('requestStart', this._shapesRequestStartHandler).bind('error', this._shapesErrorHandler);\n } else {\n this._treeDataSource();\n this._isEditable = false;\n }\n },\n _connectionDataSource: function () {\n var dsOptions = this.options.connectionsDataSource;\n if (dsOptions) {\n var ds = isArray(dsOptions) ? { data: dsOptions } : dsOptions;\n if (this.connectionsDataSource && this._connectionsRefreshHandler) {\n this.connectionsDataSource.unbind('change', this._connectionsRefreshHandler).unbind('requestStart', this._connectionsRequestStartHandler).unbind('error', this._connectionsErrorHandler);\n } else {\n this._connectionsRefreshHandler = proxy(this._refreshConnections, this);\n this._connectionsRequestStartHandler = proxy(this._connectionsRequestStart, this);\n this._connectionsErrorHandler = proxy(this._connectionsError, this);\n }\n this.connectionsDataSource = kendo.data.DataSource.create(ds).bind('change', this._connectionsRefreshHandler).bind('requestStart', this._connectionsRequestStartHandler).bind('error', this._connectionsErrorHandler);\n }\n },\n _shapesRequestStart: function (e) {\n if (e.type == 'read') {\n this._loadingShapes = true;\n }\n },\n _connectionsRequestStart: function (e) {\n if (e.type == 'read') {\n this._loadingConnections = true;\n }\n },\n _error: function () {\n this._loadingShapes = false;\n },\n _connectionsError: function () {\n this._loadingConnections = false;\n },\n _refreshShapes: function (e) {\n if (e.action === 'remove') {\n if (this._shouldRefresh()) {\n this._removeShapes(e.items);\n }\n } else if (e.action === 'itemchange') {\n if (this._shouldRefresh()) {\n this._updateShapes(e.items, e.field);\n }\n } else if (e.action === 'add') {\n this._inactiveShapeItems.add(e.items);\n } else if (e.action === 'sync') {\n this._syncShapes(e.items);\n } else {\n this.refresh();\n }\n },\n _shouldRefresh: function () {\n return !this._suspended;\n },\n _suspendModelRefresh: function () {\n this._suspended = (this._suspended || 0) + 1;\n },\n _resumeModelRefresh: function () {\n this._suspended = math.max((this._suspended || 0) - 1, 0);\n },\n refresh: function () {\n this._loadingShapes = false;\n if (!this._loadingConnections) {\n this._rebindShapesAndConnections();\n }\n },\n _rebindShapesAndConnections: function () {\n this.clear();\n this._addShapes(this.dataSource.view());\n if (this.connectionsDataSource) {\n this._addConnections(this.connectionsDataSource.view(), false);\n }\n if (this.options.layout) {\n this.layout(this.options.layout);\n } else {\n this._redrawConnections();\n }\n this.trigger('dataBound');\n },\n refreshConnections: function () {\n this._loadingConnections = false;\n if (!this._loadingShapes) {\n this._rebindShapesAndConnections();\n }\n },\n _redrawConnections: function () {\n var connections = this.connections;\n for (var idx = 0; idx < connections.length; idx++) {\n connections[idx].refresh();\n }\n },\n _removeShapes: function (items) {\n var dataMap = this._dataMap;\n var item, i;\n for (i = 0; i < items.length; i++) {\n item = items[i];\n if (dataMap[item.id]) {\n this.remove(dataMap[item.id], false);\n dataMap[item.id] = null;\n }\n }\n },\n _syncShapes: function () {\n var diagram = this;\n var inactiveItems = diagram._inactiveShapeItems;\n inactiveItems.forEach(function (inactiveItem) {\n var dataItem = inactiveItem.dataItem;\n var shape = inactiveItem.element;\n if (!dataItem.isNew()) {\n if (shape) {\n shape._setOptionsFromModel();\n diagram.addShape(shape, inactiveItem.undoable);\n diagram._dataMap[dataItem.id] = shape;\n } else {\n diagram._addDataItem(dataItem);\n }\n inactiveItem.activate();\n inactiveItems.remove(dataItem);\n }\n });\n },\n _updateShapes: function (items, field) {\n for (var i = 0; i < items.length; i++) {\n var dataItem = items[i];\n var shape = this._dataMap[dataItem.id];\n if (shape) {\n shape.updateOptionsFromModel(dataItem, field);\n }\n }\n },\n _addShapes: function (dataItems) {\n for (var i = 0; i < dataItems.length; i++) {\n this._addDataItem(dataItems[i], false);\n }\n },\n _refreshConnections: function (e) {\n if (e.action === 'remove') {\n if (this._shouldRefresh()) {\n this._removeConnections(e.items);\n }\n } else if (e.action === 'add') {\n this._addConnections(e.items);\n } else if (e.action === 'sync') {\n } else if (e.action === 'itemchange') {\n if (this._shouldRefresh()) {\n this._updateConnections(e.items);\n }\n } else {\n this.refreshConnections();\n }\n },\n _removeConnections: function (items) {\n for (var i = 0; i < items.length; i++) {\n this.remove(this._connectionsDataMap[items[i].uid], false);\n this._connectionsDataMap[items[i].uid] = null;\n }\n },\n _updateConnections: function (items) {\n for (var i = 0; i < items.length; i++) {\n var dataItem = items[i];\n var connection = this._connectionsDataMap[dataItem.uid];\n connection.updateOptionsFromModel(dataItem);\n }\n },\n _addConnections: function (connections, undoable) {\n var length = connections.length;\n for (var i = 0; i < length; i++) {\n var dataItem = connections[i];\n this._addConnectionDataItem(dataItem, undoable);\n }\n },\n _addConnectionDataItem: function (dataItem, undoable) {\n if (!this._connectionsDataMap[dataItem.uid]) {\n var from = this._validateConnector(dataItem.from);\n if (!defined(from) || from === null) {\n from = new Point(dataItem.fromX, dataItem.fromY);\n }\n var to = this._validateConnector(dataItem.to);\n if (!defined(to) || to === null) {\n to = new Point(dataItem.toX, dataItem.toY);\n }\n if (defined(from) && defined(to)) {\n var options = deepExtend({}, this.options.connectionDefaults);\n options.dataItem = dataItem;\n var connection = new Connection(from, to, options);\n this._connectionsDataMap[dataItem.uid] = connection;\n this.addConnection(connection, undoable);\n }\n }\n },\n _validateConnector: function (value) {\n var connector;\n if (defined(value) && value !== null) {\n connector = this._dataMap[value];\n }\n return connector;\n },\n _treeDataSource: function () {\n var that = this, options = that.options, dataSource = options.dataSource;\n dataSource = isArray(dataSource) ? { data: dataSource } : dataSource;\n if (dataSource instanceof kendo.data.DataSource && !(dataSource instanceof kendo.data.HierarchicalDataSource)) {\n throw new Error('Incorrect DataSource type. If a single dataSource instance is set to the diagram then it should be a HierarchicalDataSource. You should set only the options instead of an instance or a HierarchicalDataSource instance or supply connectionsDataSource as well.');\n }\n if (!dataSource.fields) {\n dataSource.fields = [\n { field: 'text' },\n { field: 'url' },\n { field: 'spriteCssClass' },\n { field: 'imageUrl' }\n ];\n }\n if (that.dataSource && that._refreshHandler) {\n that._unbindDataSource();\n }\n that._refreshHandler = proxy(that._refreshSource, that);\n that._errorHandler = proxy(that._error, that);\n that.dataSource = HierarchicalDataSource.create(dataSource).bind(CHANGE, that._refreshHandler).bind(ERROR, that._errorHandler);\n },\n _unbindDataSource: function () {\n var that = this;\n that.dataSource.unbind(CHANGE, that._refreshHandler).unbind(ERROR, that._errorHandler);\n },\n _adorn: function (adorner, isActive) {\n if (isActive !== undefined && adorner) {\n if (isActive) {\n this._adorners.push(adorner);\n this.adornerLayer.append(adorner.visual);\n } else {\n Utils.remove(this._adorners, adorner);\n this.adornerLayer.remove(adorner.visual);\n }\n }\n },\n _showConnectors: function (shape, value) {\n if (value) {\n this._connectorsAdorner.show(shape);\n } else {\n this._connectorsAdorner.destroy();\n }\n },\n _updateAdorners: function () {\n var adorners = this._adorners;\n for (var i = 0; i < adorners.length; i++) {\n var adorner = adorners[i];\n if (adorner.refreshBounds) {\n adorner.refreshBounds();\n }\n adorner.refresh();\n }\n },\n _refresh: function () {\n for (var i = 0; i < this.connections.length; i++) {\n this.connections[i].refresh();\n }\n },\n _destroyToolBar: function () {\n if (this.singleToolBar) {\n this.singleToolBar.hide();\n this.singleToolBar.destroy();\n this.singleToolBar = null;\n }\n },\n _destroyGlobalToolBar: function () {\n if (this.toolBar) {\n this.toolBar.hide();\n this.toolBar.destroy();\n this.toolBar = null;\n }\n },\n exportDOMVisual: function () {\n var viewBox = this.canvas._viewBox;\n var scrollOffset = geom.transform().translate(-viewBox.x, -viewBox.y);\n var viewRect = new geom.Rect([\n 0,\n 0\n ], [\n viewBox.width,\n viewBox.height\n ]);\n var clipPath = draw.Path.fromRect(viewRect);\n var wrap = new draw.Group({ transform: scrollOffset });\n var clipWrap = new draw.Group({ clip: clipPath });\n var root = this.canvas.drawingElement.children[0];\n clipWrap.append(wrap);\n wrap.children.push(root);\n return clipWrap;\n },\n exportVisual: function () {\n var scale = geom.transform().scale(1 / this._zoom);\n var wrap = new draw.Group({ transform: scale });\n var root = this.mainLayer.drawingElement;\n wrap.children.push(root);\n return wrap;\n },\n _syncChanges: function () {\n this._syncShapeChanges();\n this._syncConnectionChanges();\n },\n _syncShapeChanges: function () {\n if (this.dataSource && this._isEditable) {\n this.dataSource.sync();\n }\n },\n _syncConnectionChanges: function () {\n var that = this;\n if (that.connectionsDataSource && that._isEditable) {\n $.when.apply($, that._deferredConnectionUpdates).then(function () {\n that.connectionsDataSource.sync();\n });\n that.deferredConnectionUpdates = [];\n }\n }\n });\n dataviz.ExportMixin.extend(Diagram.fn, true);\n if (kendo.PDFMixin) {\n kendo.PDFMixin.extend(Diagram.fn);\n }\n function filterShapeDataItem(dataItem) {\n var result = {};\n dataItem = dataItem || {};\n if (defined(dataItem.text) && dataItem.text !== null) {\n result.text = dataItem.text;\n }\n if (defined(dataItem.x) && dataItem.x !== null) {\n result.x = dataItem.x;\n }\n if (defined(dataItem.y) && dataItem.y !== null) {\n result.y = dataItem.y;\n }\n if (defined(dataItem.width) && dataItem.width !== null) {\n result.width = dataItem.width;\n }\n if (defined(dataItem.height) && dataItem.height !== null) {\n result.height = dataItem.height;\n }\n if (defined(dataItem.type) && dataItem.type !== null) {\n result.type = dataItem.type;\n }\n return result;\n }\n function filterConnectionDataItem(dataItem) {\n var result = {};\n dataItem = dataItem || {};\n if (defined(dataItem.text) && dataItem.text !== null) {\n result.content = dataItem.text;\n }\n if (defined(dataItem.type) && dataItem.type !== null) {\n result.type = dataItem.type;\n }\n if (defined(dataItem.from) && dataItem.from !== null) {\n result.from = dataItem.from;\n }\n if (defined(dataItem.fromConnector) && dataItem.fromConnector !== null) {\n result.fromConnector = dataItem.fromConnector;\n }\n if (defined(dataItem.fromX) && dataItem.fromX !== null) {\n result.fromX = dataItem.fromX;\n }\n if (defined(dataItem.fromY) && dataItem.fromY !== null) {\n result.fromY = dataItem.fromY;\n }\n if (defined(dataItem.to) && dataItem.to !== null) {\n result.to = dataItem.to;\n }\n if (defined(dataItem.toConnector) && dataItem.toConnector !== null) {\n result.toConnector = dataItem.toConnector;\n }\n if (defined(dataItem.toX) && dataItem.toX !== null) {\n result.toX = dataItem.toX;\n }\n if (defined(dataItem.toY) && dataItem.toY !== null) {\n result.toY = dataItem.toY;\n }\n return result;\n }\n var DiagramToolBar = kendo.Observable.extend({\n init: function (diagram, options) {\n kendo.Observable.fn.init.call(this);\n this.diagram = diagram;\n this.options = deepExtend({}, this.options, options);\n this._tools = [];\n this.createToolBar();\n this.createTools();\n this.appendTools();\n if (this.options.modal) {\n this.createPopup();\n }\n this.bind(this.events, options);\n },\n events: ['click'],\n createPopup: function () {\n this.container = $('').append(this.element);\n this._popup = this.container.kendoPopup({}).getKendoPopup();\n },\n appendTools: function () {\n for (var i = 0; i < this._tools.length; i++) {\n var tool = this._tools[i];\n if (tool.buttons && tool.buttons.length || !defined(tool.buttons)) {\n this._toolBar.add(tool);\n }\n }\n },\n createToolBar: function () {\n this.element = $('');\n this._toolBar = this.element.kendoToolBar({\n click: proxy(this.click, this),\n resizable: false\n }).getKendoToolBar();\n this.element.css('border', 'none');\n },\n createTools: function () {\n for (var i = 0; i < this.options.tools.length; i++) {\n this.createTool(this.options.tools[i]);\n }\n },\n createTool: function (tool) {\n if (!isPlainObject(tool)) {\n tool = { name: tool };\n }\n var toolName = tool.name + 'Tool';\n if (this[toolName]) {\n this[toolName](tool);\n } else {\n this._tools.push(deepExtend({}, tool, { attributes: this._setAttributes({ action: tool.name }) }));\n }\n },\n showAt: function (point) {\n if (this._popup) {\n this._popup.open(point.x, point.y);\n }\n },\n hide: function () {\n if (this._popup) {\n this._popup.close();\n }\n },\n newGroup: function () {\n return {\n type: 'buttonGroup',\n buttons: []\n };\n },\n editTool: function () {\n this._tools.push({\n spriteCssClass: 'k-icon k-i-pencil',\n showText: 'overflow',\n type: 'button',\n text: 'Edit',\n attributes: this._setAttributes({ action: 'edit' })\n });\n },\n deleteTool: function () {\n this._tools.push({\n spriteCssClass: 'k-icon k-i-close',\n showText: 'overflow',\n type: 'button',\n text: 'Delete',\n attributes: this._setAttributes({ action: 'delete' })\n });\n },\n rotateAnticlockwiseTool: function (options) {\n this._appendGroup('rotate');\n this._rotateGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-rotateccw',\n showText: 'overflow',\n text: 'RotateAnticlockwise',\n group: 'rotate',\n attributes: this._setAttributes({\n action: 'rotateAnticlockwise',\n step: options.step\n })\n });\n },\n rotateClockwiseTool: function (options) {\n this._appendGroup('rotate');\n this._rotateGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-rotatecw',\n attributes: this._setAttributes({\n action: 'rotateClockwise',\n step: options.step\n }),\n showText: 'overflow',\n text: 'RotateClockwise',\n group: 'rotate'\n });\n },\n createShapeTool: function () {\n this._appendGroup('create');\n this._createGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-shape',\n showText: 'overflow',\n text: 'CreateShape',\n group: 'create',\n attributes: this._setAttributes({ action: 'createShape' })\n });\n },\n createConnectionTool: function () {\n this._appendGroup('create');\n this._createGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-connector',\n showText: 'overflow',\n text: 'CreateConnection',\n group: 'create',\n attributes: this._setAttributes({ action: 'createConnection' })\n });\n },\n undoTool: function () {\n this._appendGroup('history');\n this._historyGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-undo',\n showText: 'overflow',\n text: 'Undo',\n group: 'history',\n attributes: this._setAttributes({ action: 'undo' })\n });\n },\n redoTool: function () {\n this._appendGroup('history');\n this._historyGroup.buttons.push({\n spriteCssClass: 'k-icon k-i-redo',\n showText: 'overflow',\n text: 'Redo',\n group: 'history',\n attributes: this._setAttributes({ action: 'redo' })\n });\n },\n _appendGroup: function (name) {\n var prop = '_' + name + 'Group';\n if (!this[prop]) {\n this[prop] = this.newGroup();\n this._tools.push(this[prop]);\n }\n },\n _setAttributes: function (attributes) {\n var attr = {};\n if (attributes.action) {\n attr[kendo.attr('action')] = attributes.action;\n }\n if (attributes.step) {\n attr[kendo.attr('step')] = attributes.step;\n }\n return attr;\n },\n _getAttributes: function (element) {\n var attr = {};\n var action = element.attr(kendo.attr('action'));\n if (action) {\n attr.action = action;\n }\n var step = element.attr(kendo.attr('step'));\n if (step) {\n attr.step = step;\n }\n return attr;\n },\n click: function (e) {\n var attributes = this._getAttributes($(e.target));\n var action = attributes.action;\n if (action && this[action]) {\n this[action](attributes);\n }\n this.trigger('click', this.eventData(action, e.target));\n },\n eventData: function (action, target) {\n var elements = this.selectedElements(), length = elements.length, shapes = [], connections = [], element;\n for (var idx = 0; idx < length; idx++) {\n element = elements[idx];\n if (element instanceof Shape) {\n shapes.push(element);\n } else {\n connections.push(element);\n }\n }\n return {\n shapes: shapes,\n connections: connections,\n action: action,\n target: target\n };\n },\n 'delete': function () {\n var diagram = this.diagram;\n var toRemove = diagram._triggerRemove(this.selectedElements());\n if (toRemove.length) {\n this.diagram.remove(toRemove, true);\n this.diagram._syncChanges();\n }\n },\n edit: function () {\n var selectedElemens = this.selectedElements();\n if (selectedElemens.length === 1) {\n this.diagram.edit(selectedElemens[0]);\n }\n },\n rotateClockwise: function (options) {\n var angle = parseFloat(options.step || 90);\n this._rotate(angle);\n },\n rotateAnticlockwise: function (options) {\n var angle = parseFloat(options.step || 90);\n this._rotate(-angle);\n },\n _rotate: function (angle) {\n var adorner = this.diagram._resizingAdorner;\n adorner.angle(adorner.angle() + angle);\n adorner.rotate();\n },\n selectedElements: function () {\n return this.diagram.select();\n },\n createShape: function () {\n this.diagram.createShape();\n },\n createConnection: function () {\n this.diagram.createConnection();\n },\n undo: function () {\n this.diagram.undo();\n },\n redo: function () {\n this.diagram.redo();\n },\n destroy: function () {\n this.diagram = null;\n this.element = null;\n this.options = null;\n if (this._toolBar) {\n this._toolBar.destroy();\n }\n if (this._popup) {\n this._popup.destroy();\n }\n }\n });\n var Editor = kendo.Observable.extend({\n init: function (element, options) {\n kendo.Observable.fn.init.call(this);\n this.options = extend(true, {}, this.options, options);\n this.element = element;\n this.model = this.options.model;\n this.fields = this._getFields();\n this._initContainer();\n this.createEditable();\n },\n options: { editors: {} },\n _initContainer: function () {\n this.wrapper = this.element;\n },\n createEditable: function () {\n var options = this.options;\n this.editable = new kendo.ui.Editable(this.wrapper, {\n fields: this.fields,\n target: options.target,\n clearContainer: false,\n model: this.model\n });\n },\n _isEditable: function (field) {\n return this.model.editable && this.model.editable(field);\n },\n _getFields: function () {\n var fields = [];\n var modelFields = this.model.fields;\n for (var field in modelFields) {\n var result = {};\n if (this._isEditable(field)) {\n var editor = this.options.editors[field];\n if (editor) {\n result.editor = editor;\n }\n result.field = field;\n fields.push(result);\n }\n }\n return fields;\n },\n end: function () {\n return this.editable.end();\n },\n destroy: function () {\n this.editable.destroy();\n this.editable.element.find('[' + kendo.attr('container-for') + ']').empty();\n this.model = this.wrapper = this.element = this.columns = this.editable = null;\n }\n });\n var PopupEditor = Editor.extend({\n init: function (element, options) {\n Editor.fn.init.call(this, element, options);\n this.bind(this.events, this.options);\n this.open();\n },\n events: [\n 'update',\n 'cancel'\n ],\n options: {\n window: {\n modal: true,\n resizable: false,\n draggable: true,\n title: 'Edit',\n visible: false\n }\n },\n _initContainer: function () {\n var that = this;\n this.wrapper = $('