e;++e)o=Math.max(o,t[e].x),r=Math.min(r,t[e].x),s=Math.min(s,t[e].y),a=Math.max(a,t[e].y);return new q(r,s,o-r,a-s)}}),R=I.extend({init:function(e){var t=this;I.fn.init.call(t),this.connection=e},route:function(){}}),B=I.extend({SAME_SIDE_DISTANCE_RATIO:5,init:function(e){var t=this;I.fn.init.call(t),this.connection=e},routePoints:function(e,t,n,i){var o;return o=n&&i?this._connectorPoints(e,t,n,i):this._floatingPoints(e,t,n)},route:function(){var e=this.connection._resolvedSourceConnector,t=this.connection._resolvedTargetConnector,n=this.connection.sourcePoint(),i=this.connection.targetPoint(),o=this.routePoints(n,i,e,t);this.connection.points(o)},_connectorSides:[{name:"Top",axis:"y",boundsPoint:"topLeft",secondarySign:1},{name:"Left",axis:"x",boundsPoint:"topLeft",secondarySign:1},{name:"Bottom",axis:"y",boundsPoint:"bottomRight",secondarySign:-1},{name:"Right",axis:"x",boundsPoint:"bottomRight",secondarySign:-1}],_connectorSide:function(e,t){var n,i,o,r,s,a=e.position(),l=e.shape.bounds(Ie),c={topLeft:l.topLeft(),bottomRight:l.bottomRight()},h=this._connectorSides,u=H.util.MAX_NUM;for(s=0;h.length>s;s++)r=h[s],o=r.axis,n=Math.round(Math.abs(a[o]-c[r.boundsPoint][o])),u>n?(u=n,i=r):n===u&&(a[o]-t[o])*r.secondarySign>(a[i.axis]-t[i.axis])*i.secondarySign&&(i=r);return i.name},_sameSideDistance:function(e){var t=e.shape.bounds(Ie);return Math.min(t.width,t.height)/this.SAME_SIDE_DISTANCE_RATIO},_connectorPoints:function(e,t,n,i){var o,r,s=this._connectorSide(n,t),a=this._connectorSide(i,e),l=t.x-e.x,c=t.y-e.y,h=this._sameSideDistance(n),u=[];return s===le||s==ue?a==le||a==ue?s==a?(r=s==le?Math.min(e.y,t.y)-h:Math.max(e.y,t.y)+h,u=[new Q(e.x,r),new Q(t.x,r)]):u=[new Q(e.x,e.y+c/2),new Q(t.x,e.y+c/2)]:u=[new Q(e.x,t.y)]:a==he||a==ce?s==a?(o=s==he?Math.min(e.x,t.x)-h:Math.max(e.x,t.x)+h,u=[new Q(o,e.y),new Q(o,t.y)]):u=[new Q(e.x+l/2,e.y),new Q(e.x+l/2,e.y+c)]:u=[new Q(t.x,e.y)],u},_floatingPoints:function(e,t,n){var i,o,r,s=n?this._connectorSide(n,t):null,a=this._startHorizontal(e,t,s),l=[e,e,t,t],c=t.x-e.x,h=t.y-e.y,u=l.length;for(r=1;u-1>r;++r)a?r%2!==0?(i=c/(u/2),o=0):(i=0,o=h/((u-1)/2)):r%2!==0?(i=0,o=h/(u/2)):(i=c/((u-1)/2),o=0),l[r]=new Q(l[r-1].x+i,l[r-1].y+o);return r--,l[u-2]=a&&r%2!==0||!a&&r%2===0?new Q(l[u-1].x,l[u-2].y):new Q(l[u-2].x,l[u-1].y),[l[1],l[2]]},_startHorizontal:function(e,t,n){var i;return i=null===n||n!==ce&&n!==he?Math.abs(e.x-t.x)>Math.abs(e.y-t.y):!0}}),z=W.extend({init:function(e,t){var n=this;n.diagram=e,n.options=J({},n.options,t),n.visual=new G,n.diagram._adorners.push(n)},refresh:function(){}}),L=z.extend({init:function(e,t){var n,i,o,r=this;r.connection=e,n=r.connection.diagram,r._ts=n.toolService,z.fn.init.call(r,n,t),i=r.connection.sourcePoint(),o=r.connection.targetPoint(),r.spVisual=new K(J(r.options.handles,{center:i})),r.epVisual=new K(J(r.options.handles,{center:o})),r.visual.append(r.spVisual),r.visual.append(r.epVisual)},options:{handles:{}},_getCursor:function(){return re.move},start:function(e){switch(this.handle=this._hitTest(e),this.startPoint=e,this._initialSource=this.connection.source(),this._initialTarget=this.connection.target(),this.handle){case-1:this.connection.targetConnector&&this._ts._connectionManipulation(this.connection,this.connection.targetConnector.shape);break;case 1:this.connection.sourceConnector&&this._ts._connectionManipulation(this.connection,this.connection.sourceConnector.shape)}},move:function(e,t){switch(e){case-1:this.connection.source(t);break;case 1:this.connection.target(t);break;default:var n=t.minus(this.startPoint);this.startPoint=t,this.connection.sourceConnector||this.connection.source(this.connection.sourcePoint().plus(n)),this.connection.targetConnector||this.connection.target(this.connection.targetPoint().plus(n))}return this.refresh(),!0},stop:function(e){var n,i=this.diagram.toolService,o=i.hoveredItem;return n=i._hoveredConnector?i._hoveredConnector._c:o&&o instanceof j.Shape?o.getConnector(ae)||o.getConnector(e):e,-1===this.handle?this.connection.source(n):1===this.handle&&this.connection.target(n),this.handle=t,this._ts._connectionManipulation(),new f(this.connection,this._initialSource,this._initialTarget)},_hitTest:function(e){var t=this.connection.sourcePoint(),n=this.connection.targetPoint(),i=this.options.handles.width/2,o=this.options.handles.height/2,r=new q(t.x,t.y).inflate(i,o),s=new q(n.x,n.y).inflate(i,o);
return r.contains(e)?-1:s.contains(e)?1:0},refresh:function(){this.spVisual.redraw({center:this.diagram.modelToLayer(this.connection.sourcePoint())}),this.epVisual.redraw({center:this.diagram.modelToLayer(this.connection.targetPoint())})}}),F=z.extend({init:function(e,t){var n=this;z.fn.init.call(n,e,t),n._refreshHandler=function(e){e.item==n.shape&&n.refresh()}},show:function(e){var t,n,i,o=this;for(o._visible=!0,o.shape=e,o.diagram.bind(_e,o._refreshHandler),t=e.connectors.length,o.connectors=[],o.visual.clear(),n=0;t>n;n++)i=new V(e.connectors[n]),o.connectors.push(i),o.visual.append(i.visual);o.visual.visible(!0),o.refresh()},destroy:function(){var e=this;e.diagram.unbind(_e,e._refreshHandler),e.shape=t,e._visible=t,e.visual.visible(!1)},_hitTest:function(e){var t,n;for(n=0;this.connectors.length>n;n++)if(t=this.connectors[n],t._hitTest(e)){t._hover(!0),this.diagram.toolService._hoveredConnector=t;break}},refresh:function(){if(this.shape){var t=this.shape.bounds();t=this.diagram.modelToLayer(t),this.visual.position(t.topLeft()),e.each(this.connectors,function(){this.refresh()})}}}),O=z.extend({init:function(e,t){var n=this;z.fn.init.call(n,e,t),n._manipulating=!1,n.map=[],n.shapes=[],n._initSelection(),n._createHandles(),n.redraw(),n.diagram.bind("select",function(e){n._initialize(e.selected)}),n._refreshHandler=function(){n._internalChange||(n.refreshBounds(),n.refresh())},n._rotatedHandler=function(){1==n.shapes.length&&(n._angle=n.shapes[0].rotate().angle),n._refreshHandler()},n.diagram.bind(_e,n._refreshHandler).bind(ve,n._rotatedHandler),n.refreshBounds(),n.refresh()},options:{handles:{fill:{color:"#fff"},stroke:{color:"#282828"},height:7,width:7,hover:{fill:{color:"#282828"},stroke:{color:"#282828"}}},selectable:{stroke:{color:"#778899",width:1,dashType:"dash"},fill:{color:Ee}},offset:10},_initSelection:function(){var e=this,t=e.diagram,n=t.options.selectable,i=J({},e.options.selectable,n);e.rect=new $(i),e.visual.append(e.rect)},_resizable:function(){return this.options.editable&&this.options.editable.resize!==!1},_handleOptions:function(){return(this.options.editable.resize||{}).handles||this.options.handles},_createHandles:function(){var e,t,n,i;if(this._resizable())for(e=this._handleOptions(),i=-1;1>=i;i++)for(n=-1;1>=n;n++)(0!==i||0!==n)&&(t=new $(e),t.drawingElement._hover=oe(this._hover,this),this.map.push({x:i,y:n,visual:t}),this.visual.append(t))},bounds:function(e){return e?(this._innerBounds=e.clone(),this._bounds=this.diagram.modelToLayer(e).inflate(this.options.offset,this.options.offset),t):this._bounds},_hitTest:function(e){var n,i,o,r,s=this.diagram.modelToLayer(e),a=this.map.length;if(this._angle&&(s=s.clone().rotate(this._bounds.center(),this._angle)),this._resizable())for(n=0;a>n;n++)if(r=this.map[n],i=new Q(r.x,r.y),o=this._getHandleBounds(i),o.offset(this._bounds.x,this._bounds.y),o.contains(s))return i;return this._bounds.contains(s)?new Q(0,0):t},_getHandleBounds:function(e){if(this._resizable()){var t=this._handleOptions(),n=t.width,i=t.height,o=new q(0,0,n,i);return 0>e.x?o.x=-n/2:0===e.x?o.x=Math.floor(this._bounds.width/2)-n/2:e.x>0&&(o.x=this._bounds.width+1-n/2),0>e.y?o.y=-i/2:0===e.y?o.y=Math.floor(this._bounds.height/2)-i/2:e.y>0&&(o.y=this._bounds.height+1-i/2),o}},_getCursor:function(e){var t,n=this._hitTest(e);if(n&&n.x>=-1&&1>=n.x&&n.y>=-1&&1>=n.y&&this._resizable()){if(t=this._angle,t&&(t=360-t,n.rotate(new Q(0,0),t),n=new Q(Math.round(n.x),Math.round(n.y))),-1==n.x&&-1==n.y)return"nw-resize";if(1==n.x&&1==n.y)return"se-resize";if(-1==n.x&&1==n.y)return"sw-resize";if(1==n.x&&-1==n.y)return"ne-resize";if(0===n.x&&-1==n.y)return"n-resize";if(0===n.x&&1==n.y)return"s-resize";if(1==n.x&&0===n.y)return"e-resize";if(-1==n.x&&0===n.y)return"w-resize"}return this._manipulating?re.move:re.select},_initialize:function(){var e,t,n=this,i=n.diagram.select();for(n.shapes=[],e=0;i.length>e;e++)t=i[e],t instanceof j.Shape&&(n.shapes.push(t),t._rotationOffset=new Q);n._angle=1==n.shapes.length?n.shapes[0].rotate().angle:0,n._startAngle=n._angle,n._rotates(),n._positions(),n.refreshBounds(),n.refresh(),n.redraw()},_rotates:function(){var e,t,n=this;for(n.initialRotates=[],e=0;n.shapes.length>e;e++)t=n.shapes[e],n.initialRotates.push(t.rotate().angle)},_positions:function(){var e,t,n=this;for(n.initialStates=[],e=0;n.shapes.length>e;e++)t=n.shapes[e],n.initialStates.push(t.bounds())},_hover:function(e,t){if(this._resizable()){var n=this._handleOptions(),i=n.hover,o=n.stroke,r=n.fill;e&&Y.isDefined(i.stroke)&&(o=J({},o,i.stroke)),e&&Y.isDefined(i.fill)&&(r=i.fill),t.stroke(o.color,o.width,o.opacity),t.fill(r.color,r.opacity)}},start:function(e){var t,n;for(this._sp=e,this._cp=e,this._lp=e,this._manipulating=!0,this._internalChange=!0,this.shapeStates=[],t=0;this.shapes.length>t;t++)n=this.shapes[t],this.shapeStates.push(n.bounds())},redraw:function(){var e,t,n=this._resizable();for(e=0;this.map.length>e;e++)t=this.map[e],t.visual.visible(n)},angle:function(e){return ne(e)&&(this._angle=e),this._angle},rotate:function(){var e,t,n=this._innerBounds.center(),i=this.angle();for(this._internalChange=!0,e=0;this.shapes.length>e;e++)t=this.shapes[e],i=(i+this.initialRotates[e]-this._startAngle)%360,t.rotate(i,n);this.refresh()},move:function(e,n){var i,o,r,l,c,h,u,d,f,p,g,m,v,_,y=new Q,w=new Q,b=0;if(-2===e.y&&-1===e.x){for(l=this._innerBounds.center(),this._angle=this._truncateAngle(Y.findAngle(l,n)),h=0;this.shapes.length>h;h++)c=this.shapes[h],u=(this._angle+this.initialRotates[h]-this._startAngle)%360,c.rotate(u,l),c.hasOwnProperty("layout")&&c.layout(c),this._rotating=!0;this.refresh()}else{if(this.shouldSnap()){if(m=this._truncateDistance(n.minus(this._lp)),0===m.x&&0===m.y)return this._cp=n,t;i=m,this._lp=new Q(this._lp.x+m.x,this._lp.y+m.y)}else i=n.minus(this._cp);for(this.isDragHandle(e)?(w=y=i,o=!0):(this._angle&&i.rotate(new Q(0,0),this._angle),-1==e.x?y.x=i.x:1==e.x&&(w.x=i.x),-1==e.y?y.y=i.y:1==e.y&&(w.y=i.y)),o||(f=s(e,this._innerBounds),p=(this._innerBounds.width+i.x*e.x)/this._innerBounds.width,g=(this._innerBounds.height+i.y*e.y)/this._innerBounds.height),h=0;this.shapes.length>h;h++){if(c=this.shapes[h],r=c.bounds(),o){if(!a(c))continue;d=this._displaceBounds(r,y,w,o)}else d=r.clone(),d.scale(p,g,f,this._innerBounds.center(),c.rotate().angle),v=d.center(),v.rotate(r.center(),-this._angle),d=new q(v.x-d.width/2,v.y-d.height/2,d.width,d.height);d.width>=c.options.minWidth&&d.height>=c.options.minHeight&&(_=r,c.bounds(d),c.hasOwnProperty("layout")&&c.layout(c,_,d),(_.width!==d.width||_.height!==d.height)&&c.rotate(c.rotate().angle),b+=1)}b&&(b==h?(d=this._displaceBounds(this._innerBounds,y,w,o),this.bounds(d)):this.refreshBounds(),this.refresh()),this._positions()}this._cp=n},isDragHandle:function(e){return 0===e.x&&0===e.y},cancel:function(){var e,n=this.shapes,i=this.shapeStates;for(e=0;n.length>e;e++)n[e].bounds(i[e]);this.refreshBounds(),this.refresh(),this._manipulating=t,this._internalChange=t,this._rotating=t},_truncatePositionToGuides:function(e){return this.diagram.ruler?this.diagram.ruler.truncatePositionToGuides(e):e},_truncateSizeToGuides:function(e){return this.diagram.ruler?this.diagram.ruler.truncateSizeToGuides(e):e},_truncateAngle:function(e){var t=this.snapOptions(),n=Math.max(t.angle||fe,we);return t?Math.floor(e%360/n)*n:e%360},_truncateDistance:function(e){var t,n;return e instanceof j.Point?new j.Point(this._truncateDistance(e.x),this._truncateDistance(e.y)):(t=this.snapOptions()||{},n=Math.max(t.size||de,ye),t?Math.floor(e/n)*n:e)},snapOptions:function(){var e=this.diagram.options.editable,t=((e||{}).drag||{}).snap||{};return t},shouldSnap:function(){var e=this.diagram.options.editable,t=(e||{}).drag,n=(t||{}).snap;return e!==!1&&t!==!1&&n!==!1},_displaceBounds:function(e,t,n,i){var o,r=e.topLeft().plus(t),s=e.bottomRight().plus(n),a=q.fromPoints(r,s);return i||(o=a.center(),o.rotate(e.center(),-this._angle),a=new q(o.x-a.width/2,o.y-a.height/2,a.width,a.height)),a},stop:function(){var e,n,i,o;if(this._cp!=this._sp)if(this._rotating)e=new w(this,this.shapes,this.initialRotates),this._rotating=!1;else if(this._diffStates()){if(this.diagram.ruler)for(n=0;this.shapes.length>n;n++)i=this.shapes[n],o=i.bounds(),o=this._truncateSizeToGuides(this._truncatePositionToGuides(o)),i.bounds(o),this.refreshBounds(),this.refresh();for(n=0;this.shapes.length>n;n++)i=this.shapes[n],i.updateModel();e=new m(this.shapes,this.shapeStates,this),this.diagram._syncShapeChanges()}return this._manipulating=t,this._internalChange=t,this._rotating=t,e},_diffStates:function(){var e,t=this.shapes,n=this.shapeStates;for(e=0;t.length>e;e++)if(!t[e].bounds().equals(n[e]))return!0;return!1},refreshBounds:function(){var e=1==this.shapes.length?this.shapes[0].bounds().clone():this.diagram.boundingBox(this.shapes,!0);this.bounds(e)},refresh:function(){var t,n,i,o,r=this;this.shapes.length>0?(n=this.bounds(),this.visual.visible(!0),this.visual.position(n.topLeft()),e.each(this.map,function(){t=r._getHandleBounds(new Q(this.x,this.y)),this.visual.position(t.topLeft())}),this.visual.position(n.topLeft()),i=new Q(n.width/2,n.height/2),this.visual.rotate(this._angle,i),this.rect.redraw({width:n.width,height:n.height}),this.rotationThumb&&(o=this.options.editable.rotate.thumb,this._rotationThumbBounds=new q(n.center().x,n.y+o.y,0,0).inflate(o.width),this.rotationThumb.redraw({x:n.width/2-o.width/2}))):this.visual.visible(!1)}}),N=W.extend({init:function(e){var t=e.options.selectable;this.options=J({},this.options,t),this.visual=new $(this.options),this.diagram=e},options:{stroke:{color:"#778899",width:1,dashType:"dash"},fill:{color:Ee}},start:function(e){this._sp=this._ep=e,this.refresh(),this.diagram._adorn(this,!0)},end:function(){this._sp=this._ep=t,this.diagram._adorn(this,!1)},bounds:function(e){return e&&(this._bounds=e),this._bounds},move:function(e){this._ep=e,this.refresh()},refresh:function(){if(this._sp){var e=q.fromPoints(this.diagram.modelToLayer(this._sp),this.diagram.modelToLayer(this._ep));this.bounds(q.fromPoints(this._sp,this._ep)),this.visual.position(e.topLeft()),this.visual.redraw({height:e.height+1,width:e.width+1})}}}),V=W.extend({init:function(e){this.options=J({},e.options),this._c=e,this.visual=new K(this.options),this.refresh()},_hover:function(e){var t=this.options,n=t.hover,i=t.stroke,o=t.fill;e&&Y.isDefined(n.stroke)&&(i=J({},i,n.stroke)),e&&Y.isDefined(n.fill)&&(o=n.fill),this.visual.redraw({stroke:i,fill:o})},refresh:function(){var e=this._c.shape.diagram.modelToView(this._c.position()),t=e.minus(this._c.shape.bounds("transformed").topLeft()),n=new q(e.x,e.y,0,0);n.inflate(this.options.width/2,this.options.height/2),this._visualBounds=n,this.visual.redraw({center:new Q(t.x,t.y)})},_hitTest:function(e){var t=this._c.shape.diagram.modelToView(e);return this._visualBounds.contains(t)}}),J(j,{CompositeUnit:u,TransformUnit:m,PanUndoUnit:y,AddShapeUnit:_,AddConnectionUnit:v,DeleteShapeUnit:g,DeleteConnectionUnit:p,ConnectionEditAdorner:L,ConnectionTool:D,ConnectorVisual:V,UndoRedoService:k,ResizingAdorner:O,Selector:N,ToolService:E,ConnectorsAdorner:F,LayoutUndoUnit:h,ConnectionEditUnit:d,ToFrontUnit:b,ToBackUnit:x,ConnectionRouterBase:P,PolylineRouter:R,CascadingRouter:B,SelectionTool:A,ScrollerTool:S,PointerTool:T,ConnectionEditTool:M,RotateUnit:w})}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.dataviz.diagram,i=n.Graph,o=n.Node,r=n.Link,s=t.deepExtend,a=n.Size,l=n.Rect,c=n.Dictionary,h=n.Set,u=n.Graph,d=n.Utils,f=n.Point,p=1e-6,g=Math.PI/180,m=d.contains,v=e.grep,_=t.Class.extend({defaultOptions:{type:"Tree",subtype:"Down",roots:null,animate:!1,limitToView:!1,friction:.9,nodeDistance:50,iterations:300,horizontalSeparation:90,verticalSeparation:50,underneathVerticalTopOffset:15,underneathHorizontalOffset:15,underneathVerticalSeparation:15,grid:{width:1500,offsetX:50,offsetY:50,componentSpacingX:20,componentSpacingY:20},layerSeparation:50,layeredIterations:2,startRadialAngle:0,endRadialAngle:360,radialSeparation:150,radialFirstLevelSeparation:200,keepComponentsInOneRadialLayout:!1,ignoreContainers:!0,layoutContainerChildren:!1,ignoreInvisible:!0,animateTransitions:!1},init:function(){},gridLayoutComponents:function(e){var t,n,i,o,r,s,a,l,c,h,u,p,g,m,v;if(!e)throw"No components supplied.";for(d.forEach(e,function(e){e.calcBounds()}),e.sort(function(e,t){return t.bounds.width-e.bounds.width}),t=this.options.grid.width,n=this.options.grid.componentSpacingX,i=this.options.grid.componentSpacingY,o=0,r=this.options.grid.offsetX,s=this.options.grid.offsetY,a=r,l=s,h=[],u=[];e.length>0;){for(a>=t&&(a=r,l+=o+i,o=0),p=e.pop(),this.moveToOffset(p,new f(a,l)),c=0;p.nodes.length>c;c++)u.push(p.nodes[c]);for(c=0;p.links.length>c;c++)h.push(p.links[c]);g=p.bounds,m=g.height,(0>=m||isNaN(m))&&(m=0),v=g.width,(0>=v||isNaN(v))&&(v=0),m>=o&&(o=m),a+=v+n}return{nodes:u,links:h}},moveToOffset:function(e,t){var n,i,o,r,s,a,c,h,u=e.bounds,d=t.x-u.x,p=t.y-u.y;for(n=0;e.nodes.length>n;n++)o=e.nodes[n],r=o.bounds(),0===r.width&&0===r.height&&0===r.x&&0===r.y&&(r=new l(0,0,0,0)),r.x+=d,r.y+=p,o.bounds(r);for(n=0;e.links.length>n;n++)if(s=e.links[n],s.points){for(a=[],c=s.points,i=0;c.length>i;i++)h=c[i],h.x+=d,h.y+=p,a.push(h);s.points=a}return this.currentHorizontalOffset+=u.width+this.options.grid.offsetX,new f(d,p)},transferOptions:function(e){this.options=t.deepExtend({},this.defaultOptions),d.isUndefined(e)||(this.options=t.deepExtend(this.options,e||{}))}}),y=t.Class.extend({init:function(e){this.nodeMap=new c,this.shapeMap=new c,this.nodes=[],this.edges=[],this.edgeMap=new c,this.finalNodes=[],this.finalLinks=[],this.ignoredConnections=[],this.ignoredShapes=[],this.hyperMap=new c,this.hyperTree=new i,this.finalGraph=null,this.diagram=e},convert:function(e){if(d.isUndefined(this.diagram))throw"No diagram to convert.";return this.options=t.deepExtend({ignoreInvisible:!0,ignoreContainers:!0,layoutContainerChildren:!1},e||{}),this.clear(),this._renormalizeShapes(),this._renormalizeConnections(),this.finalNodes=new c(this.nodes),this.finalLinks=new c(this.edges),this.finalGraph=new i,this.finalNodes.forEach(function(e){this.finalGraph.addNode(e)},this),this.finalLinks.forEach(function(e){this.finalGraph.addExistingLink(e)},this),this.finalGraph},mapConnection:function(e){return this.edgeMap.get(e.id)},mapShape:function(e){return this.nodeMap.get(e.id)},getEdge:function(e,t){return d.first(e.links,function(n){return n.getComplement(e)===t})},clear:function(){this.finalGraph=null,this.hyperTree=!this.options.ignoreContainers&&this.options.layoutContainerChildren?new u:null,this.hyperMap=!this.options.ignoreContainers&&this.options.layoutContainerChildren?new c:null,this.nodeMap=new c,this.shapeMap=new c,this.nodes=[],this.edges=[],this.edgeMap=new c,this.ignoredConnections=[],this.ignoredShapes=[],this.finalNodes=[],this.finalLinks=[]},listToRoot:function(e){var t=[],n=e.container;if(!n)return t;for(t.push(n);n.parentContainer;)n=n.parentContainer,t.push(n);return t.reverse(),t},firstNonIgnorableContainer:function(e){return e.isContainer&&!this._isIgnorableItem(e)?e:e.parentContainer?this.firstNonIgnorableContainer(e.parentContainer):null},isContainerConnection:function(e,t){return e.isContainer&&this.isDescendantOf(e,t)?!0:t.isContainer&&this.isDescendantOf(t,e)},isDescendantOf:function(e,t){var n,i,o,r;if(!e.isContainer)throw"Expecting a container.";if(e===t)return!1;if(m(e.children,t))return!0;for(n=[],i=0,o=e.children.length;o>i;i++)r=e.children[i],r.isContainer&&this.isDescendantOf(r,t)&&n.push(r);return n.length>0},isIgnorableItem:function(e){return this.options.ignoreInvisible?e.isCollapsed&&this._isVisible(e)?!1:!e.isCollapsed&&this._isVisible(e)?!1:!0:e.isCollapsed&&!this._isTop(e)},isShapeMapped:function(e){return e.isCollapsed&&!this._isVisible(e)&&!this._isTop(e)},leastCommonAncestor:function(e,t){var n,i,o,r,s,a;if(!e)throw"Parameter should not be null.";if(!t)throw"Parameter should not be null.";if(!this.hyperTree)throw"No hypertree available.";if(n=this.listToRoot(e),i=this.listToRoot(t),o=null,d.isEmpty(n)||d.isEmpty(i))return this.hyperTree.root.data;for(r=n[0],s=i[0],a=0;r===s&&(o=n[a],a++,!(a>=n.length||a>=i.length));)r=n[a],s=i[a];return o?v(this.hyperTree.nodes,function(e){return e.data.container===o}):this.hyperTree.root.data},_isTop:function(e){return!e.parentContainer},_isVisible:function(e){return e.visible()?e.parentContainer?this._isVisible(e.parentContainer):e.visible():!1},_isCollapsed:function(e){return e.isContainer&&e.isCollapsed?!0:e.parentContainer&&this._isCollapsed(e.parentContainer)},_renormalizeShapes:function(){var e,t,n,i;if(!this.options.ignoreContainers)throw"Containers are not supported yet, but stay tuned.";for(e=0,t=this.diagram.shapes.length;t>e;e++)n=this.diagram.shapes[e],this.options.ignoreInvisible&&!this._isVisible(n)||n.isContainer?this.ignoredShapes.push(n):(i=new o(n.id,n),i.isVirtual=!1,this.nodeMap.add(n.id,i),this.nodes.push(i))},_renormalizeConnections:function(){var e,t,n,i,o,s,a,l;if(0!==this.diagram.connections.length)for(e=0,t=this.diagram.connections.length;t>e;e++)if(n=this.diagram.connections[e],this.isIgnorableItem(n))this.ignoredConnections.push(n);else if(i=n.sourceConnector?n.sourceConnector.shape:null,o=n.targetConnector?n.targetConnector.shape:null,i&&o)if(!m(this.ignoredShapes,i)||this.shapeMap.containsKey(i))if(!m(this.ignoredShapes,o)||this.shapeMap.containsKey(o))if(this.shapeMap.containsKey(i)&&(i=this.shapeMap[i]),this.shapeMap.containsKey(o)&&(o=this.shapeMap[o]),s=this.mapShape(i),a=this.mapShape(o),s===a||this.areConnectedAlready(s,a))this.ignoredConnections.push(n);else{if(null===s||null===a)throw"A shape was not mapped to a node.";if(!this.options.ignoreContainers)throw"Containers are not supported yet, but stay tuned.";s.isVirtual||a.isVirtual?this.ignoredConnections.push(n):(l=new r(s,a,n.id,n),this.edgeMap.add(n.id,l),this.edges.push(l))}else this.ignoredConnections.push(n);else this.ignoredConnections.push(n);else this.ignoredConnections.push(n)},areConnectedAlready:function(e,t){return d.any(this.edges,function(n){return n.source===e&&n.target===t||n.source===t&&n.target===e})}}),w=_.extend({init:function(e){var t=this;if(_.fn.init.call(t),d.isUndefined(e))throw"Diagram is not specified.";this.diagram=e},layout:function(e){var t,i,o,r,s,a;if(this.transferOptions(e),t=new y(this.diagram),i=t.convert(e),!i.isEmpty()&&(o=i.getConnectedComponents(),!d.isEmpty(o))){for(r=0;o.length>r;r++)s=o[r],this.layoutGraph(s,e);return a=this.gridLayoutComponents(o),new n.LayoutState(this.diagram,a)}},layoutGraph:function(e,t){var n,i,o;for(d.isDefined(t)&&this.transferOptions(t),this.graph=e,n=9*this.options.nodeDistance,this.temperature=n,i=this._expectedBounds(),this.width=i.width,this.height=i.height,o=0;this.options.iterations>o;o++)this.refineStage=o>=5*this.options.iterations/6,this.tick(),this.temperature=this.refineStage?n/30:n*(1-o/(2*this.options.iterations))},tick:function(){var e,t,n;for(e=0;this.graph.nodes.length>e;e++)this._repulsion(this.graph.nodes[e]);for(e=0;this.graph.links.length>e;e++)this._attraction(this.graph.links[e]);for(e=0;this.graph.nodes.length>e;e++){if(t=this.graph.nodes[e],n=Math.sqrt(t.dx*t.dx+t.dy*t.dy),0===n)return;t.x+=Math.min(n,this.temperature)*t.dx/n,t.y+=Math.min(n,this.temperature)*t.dy/n,this.options.limitToView&&(t.x=Math.min(this.width,Math.max(t.width/2,t.x)),t.y=Math.min(this.height,Math.max(t.height/2,t.y)))}},_shake:function(e){var t=Math.random()*this.options.nodeDistance/4,n=2*Math.random()*Math.PI;e.x+=t*Math.cos(n),e.y-=t*Math.sin(n)},_InverseSquareForce:function(e,t,n){var i,o,r,s,a,l,c;return this.refineStage?(o=t.x-n.x,r=t.y-n.y,s=t.width/2,a=t.height/2,l=n.width/2,c=n.height/2,i=Math.pow(o,2)/Math.pow(s+l+this.options.nodeDistance,2)+Math.pow(r,2)/Math.pow(a+c+this.options.nodeDistance,2)):i=Math.pow(e,2)/Math.pow(this.options.nodeDistance,2),4*i/3},_SquareForce:function(e,t,n){return 1/this._InverseSquareForce(e,t,n)},_repulsion:function(e){e.dx=0,e.dy=0,d.forEach(this.graph.nodes,function(t){var n,i,o,r;if(t!==e){for(;e.x===t.x&&e.y===t.y;)this._shake(t);n=e.x-t.x,i=e.y-t.y,o=Math.sqrt(n*n+i*i),r=2*this._SquareForce(o,e,t),e.dx+=n/o*r,e.dy+=i/o*r}},this)},_attraction:function(e){var t,n,i,o,r,s,a=e.target,l=e.source;if(l!==a){for(;l.x===a.x&&l.y===a.y;)this._shake(a);t=l.x-a.x,n=l.y-a.y,i=Math.sqrt(t*t+n*n),o=5*this._InverseSquareForce(i,l,a),r=t/i*o,s=n/i*o,a.dx+=r,a.dy+=s,l.dx-=r,l.dy-=s}},_expectedBounds:function(){var e,t,n,i,o,r=this.graph.nodes.length,s=1.5,a=4;return 0===r?e:(e=d.fold(this.graph.nodes,function(e,t){var n=t.width*t.height;return n>0?e+=Math.sqrt(n):0},0,this),t=e/r,n=t*Math.ceil(Math.sqrt(r)),i=n*Math.sqrt(s),o=n/Math.sqrt(s),{width:i*a,height:o*a})}}),b=t.Class.extend({init:function(e){this.center=null,this.options=e},layout:function(e,t){if(this.graph=e,this.graph.nodes&&0!==this.graph.nodes.length){if(!m(this.graph.nodes,t))throw"The given root is not in the graph.";this.center=t,this.graph.cacheRelationships(),this.layoutSwitch()}},layoutLeft:function(e){var t,n,i,o,r,s,l,c;for(this.setChildrenDirection(this.center,"Left",!1),this.setChildrenLayout(this.center,"Default",!1),t=0,n=0,o=0;e.length>o;o++)r=e[o],r.TreeDirection="Left",s=this.measure(r,a.Empty),n=Math.max(n,s.Width),t+=s.height+this.options.verticalSeparation;for(t-=this.options.verticalSeparation,l=this.center.x-this.options.horizontalSeparation,i=this.center.y+(this.center.height-t)/2,o=0;e.length>o;o++)r=e[o],c=new f(l-r.Size.width,i),this.arrange(r,c),i+=r.Size.height+this.options.verticalSeparation},layoutRight:function(e){var t,n,i,o,r,s,l,c;for(this.setChildrenDirection(this.center,"Right",!1),this.setChildrenLayout(this.center,"Default",!1),t=0,n=0,o=0;e.length>o;o++)r=e[o],r.TreeDirection="Right",s=this.measure(r,a.Empty),n=Math.max(n,s.Width),t+=s.height+this.options.verticalSeparation;for(t-=this.options.verticalSeparation,l=this.center.x+this.options.horizontalSeparation+this.center.width,i=this.center.y+(this.center.height-t)/2,o=0;e.length>o;o++)r=e[o],c=new f(l,i),this.arrange(r,c),i+=r.Size.height+this.options.verticalSeparation},layoutUp:function(e){var t,n,i,o,r,s,l;for(this.setChildrenDirection(this.center,"Up",!1),this.setChildrenLayout(this.center,"Default",!1),t=0,o=0;e.length>o;o++)i=e[o],i.TreeDirection="Up",r=this.measure(i,a.Empty),t+=r.width+this.options.horizontalSeparation;for(t-=this.options.horizontalSeparation,s=this.center.x+this.center.width/2-t/2,o=0;e.length>o;o++)i=e[o],n=this.center.y-this.options.verticalSeparation-i.Size.height,l=new f(s,n),this.arrange(i,l),s+=i.Size.width+this.options.horizontalSeparation},layoutDown:function(e){var t,n,i,o,r,s,l;for(this.setChildrenDirection(this.center,"Down",!1),this.setChildrenLayout(this.center,"Default",!1),i=0,n=0;e.length>n;n++)t=e[n],t.treeDirection="Down",r=this.measure(t,a.Empty),i+=r.width+this.options.horizontalSeparation;for(i-=this.options.horizontalSeparation,s=this.center.x+this.center.width/2-i/2,o=this.center.y+this.options.verticalSeparation+this.center.height,n=0;e.length>n;n++)t=e[n],l=new f(s,o),this.arrange(t,l),s+=t.Size.width+this.options.horizontalSeparation},layoutRadialTree:function(){var e,t;if(this.setChildrenDirection(this.center,"Radial",!1),this.setChildrenLayout(this.center,"Default",!1),this.previousRoot=null,e=this.options.startRadialAngle*g,t=this.options.endRadialAngle*g,e>=t)throw"Final angle should not be less than the start angle.";this.maxDepth=0,this.origin=new f(this.center.x,this.center.y),this.calculateAngularWidth(this.center,0),this.maxDepth>0&&this.radialLayout(this.center,this.options.radialFirstLevelSeparation,e,t),this.center.Angle=t-e},tipOverTree:function(e,t){var n,i,o,r,s,l,c;for(d.isUndefined(t)&&(t=0),this.setChildrenDirection(this.center,"Down",!1),this.setChildrenLayout(this.center,"Default",!1),this.setChildrenLayout(this.center,"Underneath",!1,t),n=0,r=0;e.length>r;r++)o=e[r],o.TreeDirection="Down",s=this.measure(o,a.Empty),n+=s.width+this.options.horizontalSeparation;for(n-=this.options.horizontalSeparation,n-=e[e.length-1].width,n+=e[e.length-1].associatedShape.bounds().width,l=this.center.x+this.center.width/2-n/2,i=this.center.y+this.options.verticalSeparation+this.center.height,r=0;e.length>r;r++)o=e[r],c=new f(l,i),this.arrange(o,c),l+=o.Size.width+this.options.horizontalSeparation},calculateAngularWidth:function(e,t){var n,i,o,r,s,a,l;if(t>this.maxDepth&&(this.maxDepth=t),n=0,i=1e3,o=1e3,r=0===t?0:Math.sqrt(i*i+o*o)/t,e.children.length>0){for(s=0,a=e.children.length;a>s;s++)l=e.children[s],n+=this.calculateAngularWidth(l,t+1);n=Math.max(r,n)}else n=r;return e.sectorAngle=n,n},sortChildren:function(e){var t,n,i,o,r,s,a,l,c,h,u,p=0;if(e.parents.length>1)throw"Node is not part of a tree.";if(n=e.parents[0],n&&(i=new f(n.x,n.y),o=new f(e.x,e.y),p=this.normalizeAngle(Math.atan2(i.y-o.y,i.x-o.x))),r=e.children.length,0===r)return null;for(s=[],a=[],t=0;r>t;++t)l=e.children[t],c=new f(l.x,l.y),a[t]=t,s[t]=this.normalizeAngle(-p+Math.atan2(c.y-c.y,c.x-c.x));for(d.bisort(s,a),h=[],u=e.children,t=0;r>t;++t)h.push(u[a[t]]);return h},normalizeAngle:function(e){for(;e>2*Math.PI;)e-=2*Math.PI;for(;0>e;)e+=2*Math.PI;return e},radialLayout:function(e,t,n,i){var o,r,s,a,l,c=i-n,h=c/2,u=e.sectorAngle,d=0,f=this.sortChildren(e);for(o=0,r=f.length;r>o;o++)s=f[o],a=s,l=a.sectorAngle/u,s.children.length>0&&this.radialLayout(s,t+this.options.radialSeparation,n+d*c,n+(d+l)*c),this.setPolarLocation(s,t,n+d*c+l*h),a.angle=l*c,d+=l},setPolarLocation:function(e,t,n){e.x=this.origin.x+t*Math.cos(n),e.y=this.origin.y+t*Math.sin(n),e.BoundingRectangle=new l(e.x,e.y,e.width,e.height)},setChildrenDirection:function(e,t,n){var i=e.treeDirection;this.graph.depthFirstTraversal(e,function(e){e.treeDirection=t}),n||(e.treeDirection=i)},setChildrenLayout:function(e,t,n,i){d.isUndefined(i)&&(i=0);var o=e.childrenLayout;i>0?(this.graph.assignLevels(e),this.graph.depthFirstTraversal(e,function(e){e.level>=i+1&&(e.childrenLayout=t)})):(this.graph.depthFirstTraversal(e,function(e){e.childrenLayout=t}),n||(e.childrenLayout=o))},measure:function(e,t){var n,i,o,r,s,l,c,h=0,u=0,f=new a(0,0);if(!e)throw"";if(i=e.associatedShape.bounds(),o=i.width,r=i.height,1!==e.parents.length)throw"Node not in a spanning tree.";if(s=e.parents[0],"Undefined"===e.treeDirection&&(e.treeDirection=s.treeDirection),d.isEmpty(e.children))f=new a(Math.abs(o)l;l++)c=e.children[l],n=this.measure(c,t),h=Math.max(h,n.width+this.options.underneathHorizontalOffset),u+=n.height+this.options.underneathVerticalSeparation;u-=this.options.underneathVerticalSeparation;break;case"Default":for(h=o,u=0,l=0;e.children.length>l;l++)c=e.children[l],n=this.measure(c,t),h=Math.max(h,o+this.options.horizontalSeparation+n.width),u+=n.height+this.options.verticalSeparation;u-=this.options.verticalSeparation;break;default:throw"Unhandled TreeDirection in the Right layout measuring."}break;case"Up":case"Down":switch(e.childrenLayout){case"TopAlignedWithParent":case"BottomAlignedWithParent":break;case"Underneath":for(h=o,u=r+this.options.underneathVerticalTopOffset,l=0;e.children.length>l;l++)c=e.children[l],n=this.measure(c,t),h=Math.max(h,n.width+this.options.underneathHorizontalOffset),u+=n.height+this.options.underneathVerticalSeparation;u-=this.options.underneathVerticalSeparation;break;case"Default":for(h=0,u=0,l=0;e.children.length>l;l++)c=e.children[l],n=this.measure(c,t),h+=n.width+this.options.horizontalSeparation,u=Math.max(u,n.height+this.options.verticalSeparation+r);h-=this.options.horizontalSeparation;break;default:throw"Unhandled TreeDirection in the Down layout measuring."}break;default:throw"Unhandled TreeDirection in the layout measuring."}f=new a(h,u)}return e.SectorAngle=Math.sqrt(h*h/4+u*u/4),e.Size=f,f},arrange:function(e,t){var n,i,o,r,s,a,c,h,u=e.associatedShape.bounds(),g=u.width,m=u.height;if(d.isEmpty(e.children))e.x=t.x,e.y=t.y,e.BoundingRectangle=new l(t.x,t.y,g,m);else switch(e.treeDirection){case"Left":switch(e.childrenLayout){case"TopAlignedWithParent":case"BottomAlignedWithParent":break;case"Underneath":for(h=t,e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),c=t.y+m+this.options.underneathVerticalTopOffset,n=0;r.children.length>n;n++)r=r.children[n],a=h.x-r.associatedShape.width-this.options.underneathHorizontalOffset,i=new f(a,c),this.arrange(r,i),c+=r.Size.height+this.options.underneathVerticalSeparation;break;case"Default":for(h=new f(t.x+e.Size.width-g,t.y+(e.Size.height-m)/2),e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),a=h.x-this.options.horizontalSeparation,c=t.y,n=0;e.children.length>n;n++)r=e.children[n],i=new f(a-r.Size.width,c),this.arrange(r,i),c+=r.Size.height+this.options.verticalSeparation;break;default:throw"Unsupported TreeDirection"}break;case"Right":switch(e.childrenLayout){case"TopAlignedWithParent":case"BottomAlignedWithParent":break;case"Underneath":for(h=t,e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),a=t.x+g+this.options.underneathHorizontalOffset,c=t.y+m+this.options.underneathVerticalTopOffset,n=0;e.children.length>n;n++)r=e.children[n],i=new f(a,c),this.arrange(r,i),c+=r.Size.height+this.options.underneathVerticalSeparation;break;case"Default":for(h=new f(t.x,t.y+(e.Size.height-m)/2),e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),a=t.x+g+this.options.horizontalSeparation,c=t.y,n=0;e.children.length>n;n++)r=e.children[n],i=new f(a,c),this.arrange(r,i),c+=r.Size.height+this.options.verticalSeparation;break;default:throw"Unsupported TreeDirection"}break;case"Up":if(h=new f(t.x+(e.Size.width-g)/2,t.y+e.Size.height-m),e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),Math.abs(h.x-t.x)
n;n++)o=e.children[n],s+=o.Size.width+this.options.horizontalSeparation;s-=this.options.horizontalSeparation,a=t.x+(g-s)/2}else a=t.x;for(n=0;e.children.length>n;n++)r=e.children[n],c=h.y-this.options.verticalSeparation-r.Size.height,i=new f(a,c),this.arrange(r,i),a+=r.Size.width+this.options.horizontalSeparation;break;case"Down":switch(e.childrenLayout){case"TopAlignedWithParent":case"BottomAlignedWithParent":break;case"Underneath":for(h=t,e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),a=t.x+this.options.underneathHorizontalOffset,c=t.y+m+this.options.underneathVerticalTopOffset,n=0;e.children.length>n;n++)r=e.children[n],i=new f(a,c),this.arrange(r,i),c+=r.Size.height+this.options.underneathVerticalSeparation;
break;case"Default":if(h=new f(t.x+(e.Size.width-g)/2,t.y),e.x=h.x,e.y=h.y,e.BoundingRectangle=new l(e.x,e.y,e.width,e.height),Math.abs(h.x-t.x)
n;n++)o=e.children[n],s+=o.Size.width+this.options.horizontalSeparation;s-=this.options.horizontalSeparation,a=t.x+(g-s)/2}else a=t.x;for(n=0;e.children.length>n;n++)r=e.children[n],c=h.y+this.options.verticalSeparation+m,i=new f(a,c),this.arrange(r,i),a+=r.Size.width+this.options.horizontalSeparation;break;default:throw"Unsupported TreeDirection"}break;case"None":break;default:throw"Unsupported TreeDirection"}},layoutSwitch:function(){var e,t,n,i,o,r;if(this.center&&!d.isEmpty(this.center.children))switch(e=this.options.subtype,d.isUndefined(e)&&(e="Down"),r=this.center.children,e.toLowerCase()){case"radial":case"radialtree":this.layoutRadialTree();break;case"mindmaphorizontal":case"mindmap":t=this.center.children,1===this.center.children.length?this.layoutRight(t):(o=r.length/2,n=v(this.center.children,function(e){return d.indexOf(r,e)=o}),this.layoutLeft(n),this.layoutRight(i));break;case"mindmapvertical":t=this.center.children,1===this.center.children.length?this.layoutDown(t):(o=r.length/2,n=v(this.center.children,function(e){return d.indexOf(r,e)=o}),this.layoutUp(n),this.layoutDown(i));break;case"right":this.layoutRight(this.center.children);break;case"left":this.layoutLeft(this.center.children);break;case"up":case"bottom":this.layoutUp(this.center.children);break;case"down":case"top":this.layoutDown(this.center.children);break;case"tipover":case"tipovertree":if(0>this.options.tipOverTreeStartLevel)throw"The tip-over level should be a positive integer.";this.tipOverTree(this.center.children,this.options.tipOverTreeStartLevel);break;case"undefined":case"none":}}}),x=_.extend({init:function(e){var t=this;if(_.fn.init.call(t),d.isUndefined(e))throw"No diagram specified.";this.diagram=e},layout:function(e){var t,i;return this.transferOptions(e),t=new y(this.diagram),this.graph=t.convert(),i=this.layoutComponents(),new n.LayoutState(this.diagram,i)},layoutComponents:function(){var e,t,n,i,o,r,s,a;if(!this.graph.isEmpty()&&(e=this.graph.getConnectedComponents(),!d.isEmpty(e))){for(t=new b(this.options),n=[],i=0;e.length>i;i++){if(o=e[i],r=this.getTree(o),!r)throw"Failed to find a spanning tree for the component.";s=r.root,a=r.tree,t.layout(a,s),n.push(a)}return this.gridLayoutComponents(n)}},getTree:function(e){var t,n,i,o,r,s=null;if(this.options.roots&&this.options.roots.length>0)for(t=0,n=e.nodes.length;n>t;t++)for(i=e.nodes[t],o=0;this.options.roots.length>o;o++)if(r=this.options.roots[o],r===i.associatedShape){s=i;break}if(!s&&(s=e.root(),!s))throw"Unable to find a root for the tree.";return this.getTreeForRoot(e,s)},getTreeForRoot:function(e,t){var n=e.getSpanningTree(t);return d.isUndefined(n)||n.isEmpty()?null:{tree:n,root:n.root}}}),k=_.extend({init:function(e){var t=this;if(_.fn.init.call(t),d.isUndefined(e))throw"Diagram is not specified.";this.diagram=e},layout:function(e){var t,i,o,r,s,a;if(this.transferOptions(e),t=new y(this.diagram),i=t.convert(e),!i.isEmpty()&&(o=i.getConnectedComponents(),!d.isEmpty(o))){for(r=0;o.length>r;r++)s=o[r],this.layoutGraph(s,e);return a=this.gridLayoutComponents(o),new n.LayoutState(this.diagram,a)}},_initRuntimeProperties:function(){var e,t;for(e=0;this.graph.nodes.length>e;e++)t=this.graph.nodes[e],t.layer=-1,t.downstreamLinkCount=0,t.upstreamLinkCount=0,t.isVirtual=!1,t.uBaryCenter=0,t.dBaryCenter=0,t.upstreamPriority=0,t.downstreamPriority=0,t.gridPosition=0},_prepare:function(e){var t,n,i,o,r,s,a,l,h,u,f,p=[],g=new c,v=0;for(d.forEach(e.nodes,function(e){0===e.incoming.length&&(g.set(e,0),p.push(e))});p.length>0;)for(r=p.shift(),t=0;r.outgoing.length>t;t++)i=r.outgoing[t],s=i.target,o=g.containsKey(s)?Math.max(g.get(r)+1,g.get(s)):g.get(r)+1,g.set(s,o),o>v&&(v=o),m(p,s)||p.push(s);for(a=g.keys(),a.sort(function(e,t){var n=g.get(e),i=g.get(t);return d.sign(i-n)}),l=0;a.length>l;++l)if(h=a[l],u=Number.MAX_VALUE,0!==h.outgoing.length){for(n=0;h.outgoing.length>n;++n)i=h.outgoing[n],u=Math.min(u,g.get(i.target));u>1&&g.set(h,u-1)}for(this.layers=[],t=0;v+1>t;t++)f=[],f.linksTo={},this.layers.push(f);for(g.forEach(function(e,t){e.layer=t,this.layers[t].push(e)},this),n=0;this.layers.length>n;n++)for(f=this.layers[n],t=0;f.length>t;t++)f[t].gridPosition=t},layoutGraph:function(e,t){if(d.isUndefined(e))throw"No graph given or graph analysis of the diagram failed.";d.isDefined(t)&&this.transferOptions(t),this.graph=e,e.setItemIndices();var n=e.makeAcyclic();this._initRuntimeProperties(),this._prepare(e,t),this._dummify(),this._optimizeCrossings(),this._swapPairs(),this.arrangeNodes(),this._moveThingsAround(),this._dedummify(),d.forEach(n,function(e){e.points&&e.points.reverse()})},setMinDist:function(e,t,n){var i=e.layer,o=e.layerIndex;this.minDistances[i][o]=n},getMinDist:function(e,t){var n,i=0,o=e.layerIndex,r=t.layerIndex,s=e.layer,a=Math.min(o,r),l=Math.max(o,r);for(n=a;l>n;++n)i+=this.minDistances[s][n];return i},placeLeftToRight:function(e){var t,n,i,o,r,s,a,l,h,u,f=new c;for(i=0;this.layers.length>i;++i)if(o=e[i]){for(t=0;o.length>t;t++)n=o[t],f.containsKey(n)||this.placeLeft(n,f,i);for(r=Number.POSITIVE_INFINITY,t=0;o.length>t;t++)n=o[t],s=this.rightSibling(n),s&&this.nodeLeftClass.get(s)!==i&&(r=Math.min(r,f.get(s)-f.get(n)-this.getMinDist(n,s)));if(r===Number.POSITIVE_INFINITY){for(a=[],t=0;o.length>t;t++)for(n=o[t],l=[],d.addRange(l,this.upNodes.get(n)),d.addRange(l,this.downNodes.get(n)),h=0;l.length>h;h++)u=l[h],this.nodeLeftClass.get(u)t;t++)n=o[t],f.set(n,f.get(n)+r)}return f},placeRightToLeft:function(e){var t,n,i,o,r,s,a,l,h,u,f=new c;for(i=0;this.layers.length>i;++i)if(o=e[i]){for(t=0;o.length>t;t++)n=o[t],f.containsKey(n)||this.placeRight(n,f,i);for(r=Number.NEGATIVE_INFINITY,t=0;o.length>t;t++)n=o[t],s=this.leftSibling(n),s&&this.nodeRightClass.get(s)!==i&&(r=Math.max(r,f.get(s)-f.get(n)+this.getMinDist(s,n)));if(r===Number.NEGATIVE_INFINITY){for(a=[],t=0;o.length>t;t++)for(n=o[t],l=[],d.addRange(l,this.upNodes.get(n)),d.addRange(l,this.downNodes.get(n)),h=0;l.length>h;h++)u=l[h],this.nodeRightClass.get(u)t;t++)n=o[t],f.set(n,f.get(n)+r)}return f},_getLeftWing:function(){var e={value:null},t=this.computeClasses(e,1);return this.nodeLeftClass=e.value,t},_getRightWing:function(){var e={value:null},t=this.computeClasses(e,-1);return this.nodeRightClass=e.value,t},computeClasses:function(e,t){var n,i,o,r,s,a,l,h,u,d=0,f=e.value=new c;for(n=0;this.layers.length>n;++n)for(d=n,i=this.layers[n],o=1===t?0:i.length-1;o>=0&&i.length>o;o+=t)if(r=i[o],f.containsKey(r))d=f.get(r);else if(f.set(r,d),r.isVirtual)for(s=this._nodesInLink(r),a=0;s.length>a;a++)l=s[a],f.set(l,d);for(h=[],u=0;this.layers.length>u;u++)h.push(null);return f.forEach(function(e,t){null===h[t]&&(h[t]=[]),h[t].push(e)}),h},_isVerticalLayout:function(){return"up"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()||"vertical"===this.options.subtype.toLowerCase()},_isHorizontalLayout:function(){return"right"===this.options.subtype.toLowerCase()||"left"===this.options.subtype.toLowerCase()||"horizontal"===this.options.subtype.toLowerCase()},_isIncreasingLayout:function(){return"right"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()},_moveThingsAround:function(){function e(e,t){var n,i,o=Number.MIN_VALUE;for(n=0;e.length>n;++n)i=e[n],o=t._isVerticalLayout()?Math.max(o,i.height):Math.max(o,i.width);return o}var t,n,i,o,r,s,a,l,h,u,f,p,g,m,v,_,y,w,b,x,k,C,S,T,A,D,M;for(n=0;this.layers.length>n;++n)o=this.layers[n],o.sort(this._gridPositionComparer);for(this.minDistances=[],n=0;this.layers.length>n;++n)for(o=this.layers[n],this.minDistances[n]=[],r=0;o.length>r;++r)i=o[r],i.layerIndex=r,this.minDistances[n][r]=this.options.nodeDistance,o.length-1>r&&(this.minDistances[n][r]+=this._isVerticalLayout()?(i.width+o[r+1].width)/2:(i.height+o[r+1].height)/2);for(this.downNodes=new c,this.upNodes=new c,d.forEach(this.graph.nodes,function(e){this.downNodes.set(e,[]),this.upNodes.set(e,[])},this),d.forEach(this.graph.links,function(e){var t=e.source,n=e.target,i=null,o=null;t.layer>n.layer?(i=e.source,o=e.target):(o=e.source,i=e.target),this.downNodes.get(o).push(i),this.upNodes.get(i).push(o)},this),this.downNodes.forEachValue(function(e){e.sort(this._gridPositionComparer)},this),this.upNodes.forEachValue(function(e){e.sort(this._gridPositionComparer)},this),n=0;this.layers.length-1>n;++n)for(o=this.layers[n],s=0;o.length-1>s;s++)if(a=o[s],a.isVirtual&&(l=this.downNodes.get(a)[0],l.isVirtual))for(r=s+1;o.length>r;++r)i=o[r],i.isVirtual&&(h=this.downNodes.get(i)[0],h.isVirtual&&l.gridPosition>h.gridPosition&&(u=l.gridPosition,l.gridPosition=h.gridPosition,h.gridPosition=u,f=l.layerIndex,p=h.layerIndex,this.layers[n+1][f]=h,this.layers[n+1][p]=l,l.layerIndex=p,h.layerIndex=f));for(g=this._getLeftWing(),m=this._getRightWing(),v=this.placeLeftToRight(g),_=this.placeRightToLeft(m),y=new c,d.forEach(this.graph.nodes,function(e){y.set(e,(v.get(e)+_.get(e))/2)}),w=new c,b=new c,n=0;this.layers.length>n;++n)for(o=this.layers[n],x=-1,k=-1,r=0;o.length>r;++r)i=o[r],w.set(i,0),b.set(i,!1),i.isVirtual&&(-1===x?x=r:x===r-1?x=r:(k=r,w.set(o[x],0),y.get(i)-y.get(o[x])===this.getMinDist(o[x],i)?b.set(o[x],!0):b.set(o[x],!1),x=r));for(C=[1,-1],d.forEach(C,function(e){var n,i,o,r,s,a,l,c=1===e?0:this.layers.length-1;for(n=c;n>=0&&this.layers.length>n;n+=e){if(i=this.layers[n],o=this._firstVirtualNode(i),r=null,s=null,-1!==o)for(r=i[o],s=[],t=0;o>t;t++)s.push(i[t]);else r=null,s=i;if(s.length>0){for(this._sequencer(y,null,r,e,s),t=0;s.length-1>t;++t)this.setMinDist(s[t],s[t+1],y.get(s[t+1])-y.get(s[t]));r&&this.setMinDist(s[s.length-1],r,y.get(r)-y.get(s[s.length-1]))}for(;r;){if(a=this.nextVirtualNode(i,r)){if(w.get(r)===e){for(o=r.layerIndex,l=a.layerIndex,s=[],t=o+1;l>t;t++)s.push(i[t]);s.length>0&&this._sequencer(y,r,a,e,s),b.set(r,!0)}}else{for(o=r.layerIndex,s=[],t=o+1;i.length>t;t++)s.push(i[t]);if(s.length>0){for(this._sequencer(y,r,null,e,s),t=0;s.length-1>t;++t)this.setMinDist(s[t],s[t+1],y.get(s[t+1])-y.get(s[t]));this.setMinDist(r,s[0],y.get(s[0])-y.get(r))}}r=a}this.adjustDirections(n,e,w,b)}},this),S=this._isIncreasingLayout()?0:this.layers.length-1,T=function(e,t){return t._isIncreasingLayout()?t.layers.length>e:e>=0},A=this._isIncreasingLayout()?1:-1,D=0,t=S;T(t,this);t+=A){for(o=this.layers[t],M=e(o,this),r=0;o.length>r;++r)i=o[r],this._isVerticalLayout()?(i.x=y.get(i),i.y=D+M/2):(i.x=D+M/2,i.y=y.get(i));D+=this.options.layerSeparation+M}},adjustDirections:function(e,t,n,i){var o,r,s,a,l,c,h,u,d,f,p,g,m,v;if(!(0>e+t||e+t>=this.layers.length))for(o=null,r=null,s=this.layers[e+t],a=0;s.length>a;++a)if(l=s[a],l.isVirtual&&(c=this.getNeighborOnLayer(l,e),c.isVirtual)){if(o){for(h=i.get(r),u=this.layers[e],d=r.layerIndex,f=c.layerIndex,p=d+1;f>p;++p)u[p].isVirtual&&(h=h&&i.get(u[p]));if(h)for(n.set(o,t),g=o.layerIndex,m=l.layerIndex,v=g+1;m>v;++v)s[v].isVirtual&&n.set(s[v],t)}o=l,r=c}},getNeighborOnLayer:function(e,t){var n=this.upNodes.get(e)[0];return n.layer===t?n:(n=this.downNodes.get(e)[0],n.layer===t?n:null)},_sequencer:function(e,t,n,i,o){if(1===o.length&&this._sequenceSingle(e,t,n,i,o[0]),o.length>1){var r=o.length,s=this.intDiv(r,2);this._sequencer(e,t,n,i,o.slice(0,s)),this._sequencer(e,t,n,i,o.slice(s)),this.combineSequences(e,t,n,i,o)}},_sequenceSingle:function(e,t,n,i,o){var r=-1===i?this.downNodes.get(o):this.upNodes.get(o),s=r.length;0!==s&&(s%2===1?e.set(o,e.get(r[this.intDiv(s,2)])):e.set(o,(e.get(r[this.intDiv(s,2)-1])+e.get(r[this.intDiv(s,2)]))/2),t&&e.set(o,Math.max(e.get(o),e.get(t)+this.getMinDist(t,o))),n&&e.set(o,Math.min(e.get(o),e.get(n)-this.getMinDist(o,n))))},combineSequences:function(e,t,n,i,o){var r,s,a,l,c,h,u,d,f,p,g=o.length,m=this.intDiv(g,2),v=[];for(r=0;m>r;++r){for(s=0,l=-1===i?this.downNodes.get(o[r]):this.upNodes.get(o[r]),a=0;l.length>a;++a)c=l[a],e.get(c)>=e.get(o[r])?s++:(s--,v.push({k:e.get(c)+this.getMinDist(o[r],o[m-1]),v:2}));v.push({k:e.get(o[r])+this.getMinDist(o[r],o[m-1]),v:s})}for(t&&v.push({k:e.get(t)+this.getMinDist(t,o[m-1]),v:Number.MAX_VALUE}),v.sort(this._positionDescendingComparer),u=[],r=m;g>r;++r){for(s=0,l=-1===i?this.downNodes.get(o[r]):this.upNodes.get(o[r]),a=0;l.length>a;++a)c=l[a],e.get(c)<=e.get(o[r])?s++:(s--,u.push({k:e.get(c)-this.getMinDist(o[r],o[m]),v:2}));u.push({k:e.get(o[r])-this.getMinDist(o[r],o[m]),v:s})}for(n&&u.push({k:e.get(n)-this.getMinDist(n,o[m]),v:Number.MAX_VALUE}),u.sort(this._positionAscendingComparer),d=0,f=0,p=this.getMinDist(o[m-1],o[m]);e.get(o[m])-e.get(o[m-1]) d){if(0===v.length){e.set(o[m-1],e.get(o[m])-p);break}h=v.shift(),d+=h.v,e.set(o[m-1],h.k),e.set(o[m-1],Math.max(e.get(o[m-1]),e.get(o[m])-p))}else{if(0===u.length){e.set(o[m],e.get(o[m-1])+p);break}h=u.shift(),f+=h.v,e.set(o[m],h.k),e.set(o[m],Math.min(e.get(o[m]),e.get(o[m-1])+p))}for(r=m-2;r>=0;r--)e.set(o[r],Math.min(e.get(o[r]),e.get(o[m-1])-this.getMinDist(o[r],o[m-1])));for(r=m+1;g>r;r++)e.set(o[r],Math.max(e.get(o[r]),e.get(o[m])+this.getMinDist(o[r],o[m])))},placeLeft:function(e,t,n){var i=Number.NEGATIVE_INFINITY;d.forEach(this._getComposite(e),function(e){var o=this.leftSibling(e);o&&this.nodeLeftClass.get(o)===this.nodeLeftClass.get(e)&&(t.containsKey(o)||this.placeLeft(o,t,n),i=Math.max(i,t.get(o)+this.getMinDist(o,e)))},this),i===Number.NEGATIVE_INFINITY&&(i=0),d.forEach(this._getComposite(e),function(e){t.set(e,i)})},placeRight:function(e,t,n){var i=Number.POSITIVE_INFINITY;d.forEach(this._getComposite(e),function(e){var o=this.rightSibling(e);o&&this.nodeRightClass.get(o)===this.nodeRightClass.get(e)&&(t.containsKey(o)||this.placeRight(o,t,n),i=Math.min(i,t.get(o)-this.getMinDist(e,o)))},this),i===Number.POSITIVE_INFINITY&&(i=0),d.forEach(this._getComposite(e),function(e){t.set(e,i)})},leftSibling:function(e){var t=this.layers[e.layer],n=e.layerIndex;return 0===n?null:t[n-1]},rightSibling:function(e){var t=this.layers[e.layer],n=e.layerIndex;return n===t.length-1?null:t[n+1]},_getComposite:function(e){return e.isVirtual?this._nodesInLink(e):[e]},arrangeNodes:function(){var e,t,n,i,o,r,s,a;for(t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)o=i[n],o.upstreamPriority=o.upstreamLinkCount,o.downstreamPriority=o.downstreamLinkCount;for(r=2,s=0;r>s;s++){for(e=this.layers.length-1;e>=1;e--)this.layoutLayer(!1,e);for(e=0;this.layers.length-1>e;e++)this.layoutLayer(!0,e)}for(a=Number.MAX_VALUE,t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)o=i[n],a=Math.min(a,o.gridPosition);if(0>a)for(t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)o=i[n],o.gridPosition=o.gridPosition-a},layoutLayer:function(e,t){var n,i,o,r;for(i=e?this.layers[n=t+1]:this.layers[n=t-1],o=[],r=0;i.length>r;r++)o.push(i[r]);o.sort(function(e,t){var n=(e.upstreamPriority+e.downstreamPriority)/2,i=(t.upstreamPriority+t.downstreamPriority)/2;return Math.abs(n-i)<1e-4?0:i>n?1:-1}),d.forEach(o,function(e){var t=e.gridPosition,n=this.calcBaryCenter(e),o=(e.upstreamPriority+e.downstreamPriority)/2;if(!(Math.abs(t-n)<1e-4||Math.abs(t-n)<.2501))if(n>t)for(;n>t&&this.moveRight(e,i,o);)t=e.gridPosition;else for(;t>n&&this.moveLeft(e,i,o);)t=e.gridPosition},this),n>0&&this.calcDownData(n-1),this.layers.length-1>n&&this.calcUpData(n+1)},moveRight:function(e,t,n){var i,o,r=d.indexOf(t,e);return r===t.length-1?(e.gridPosition=e.gridPosition+.5,!0):(i=t[r+1],o=(i.upstreamPriority+i.downstreamPriority)/2,i.gridPosition>e.gridPosition+1?(e.gridPosition=e.gridPosition+.5,!0):o>n||Math.abs(o-n)<1e-4?!1:this.moveRight(i,t,n)?(e.gridPosition=e.gridPosition+.5,!0):!1)},moveLeft:function(e,t,n){var i,o,r=d.indexOf(t,e);return 0===r?(e.gridPosition=e.gridPosition-.5,!0):(i=t[r-1],o=(i.upstreamPriority+i.downstreamPriority)/2,e.gridPosition-1>i.gridPosition?(e.gridPosition=e.gridPosition-.5,!0):o>n||Math.abs(o-n)<1e-4?!1:this.moveLeft(i,t,n)?(e.gridPosition=e.gridPosition-.5,!0):!1)},mapVirtualNode:function(e,t){this.nodeToLinkMap.set(e,t),this.linkToNodeMap.containsKey(t)||this.linkToNodeMap.set(t,[]),this.linkToNodeMap.get(t).push(e)},_nodesInLink:function(e){return this.linkToNodeMap.get(this.nodeToLinkMap.get(e))},_dummify:function(){var e,t,n,i,s,a,l,h,u,f,p,g,m,v,_,y,w,b,x,k;for(this.linkToNodeMap=new c,this.nodeToLinkMap=new c,u=this.graph.links.slice(0),f=this.layers,p=function(e,t,n){f[e].linksTo[t]=f[e].linksTo[t]||[],f[e].linksTo[t].push(n)},h=0;u.length>h;h++)if(g=u[h],m=g.source,v=g.target,_=m.layer,y=v.layer,w=m.gridPosition,b=v.gridPosition,x=(b-w)/Math.abs(y-_),k=m,_-y>1){for(l=_-1;l>y;l--){for(n=new o,n.x=m.x,n.y=m.y,n.width=m.width/100,n.height=m.height/100,e=f[l],t=(l-y)*x+w,t>e.length&&(t=e.length),w>=f[_].length-1&&b>=f[y].length-1?t=e.length:0===w&&0===b&&(t=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=t,n.isVirtual=!0,d.insert(e,n,t),s=t+1;e.length>s;s++)i=e[s],i.gridPosition=i.gridPosition+1;a=new r(k,n),a.depthOfDumminess=0,p(l-1,l,a),k=n,this.graph._addNode(n),this.graph.addLink(a),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,g)}p(y-1,y,a),g.changeSource(k),g.depthOfDumminess=_-y-1}else if(-1>_-y){for(l=_+1;y>l;l++){for(n=new o,n.x=m.x,n.y=m.y,n.width=m.width/100,n.height=m.height/100,e=f[l],t=(l-_)*x+w,t>e.length&&(t=e.length),w>=f[_].length-1&&b>=f[y].length-1?t=e.length:0===w&&0===b&&(t=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=t,n.isVirtual=!0,t&=t,d.insert(e,n,t),s=t+1;e.length>s;s++)i=e[s],i.gridPosition=i.gridPosition+1;a=new r(k,n),a.depthOfDumminess=0,p(l-1,l,a),k=n,this.graph._addNode(n),this.graph.addLink(a),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,g)}p(y-1,y,g),g.changeSource(k),g.depthOfDumminess=y-_-1}else p(_,y,g)},_dedummify:function(){for(var e,t,n,i,o,r,s,a,l=!0;l;)for(l=!1,e=0;this.graph.links.length>e;e++)if(t=this.graph.links[e],t.depthOfDumminess){for(n=[],n.unshift({x:t.target.x,y:t.target.y}),n.unshift({x:t.source.x,y:t.source.y}),i=t,o=t.depthOfDumminess,r=0;o>r;r++)s=i.source,a=s.incoming[0],n.unshift({x:a.source.x,y:a.source.y}),i=a;t.changeSource(i.source),t.depthOfDumminess=0,n.length>2?(n.splice(0,1),n.splice(n.length-1),t.points=n):t.points=[],l=!0;break}},_optimizeCrossings:function(){for(var e,t=-1,n=3,i=0;0!==t&&!(i++>n);){for(t=0,e=this.layers.length-1;e>=1;e--)t+=this.optimizeLayerCrossings(!1,e);for(e=0;this.layers.length-1>e;e++)t+=this.optimizeLayerCrossings(!0,e)}},calcUpData:function(e){var t,n,i,o,r,s,a,l,c;if(0!==e){for(t=this.layers[e],r=new h,s=this.layers[e-1],n=0;s.length>n;n++)r.add(s[n]);for(n=0;t.length>n;n++){for(a=t[n],l=0,c=0,i=0;a.incoming.length>i;i++)o=a.incoming[i],r.contains(o.source)&&(c++,l+=o.source.gridPosition);for(i=0;a.outgoing.length>i;i++)o=a.outgoing[i],r.contains(o.target)&&(c++,l+=o.target.gridPosition);c>0?(a.uBaryCenter=l/c,a.upstreamLinkCount=c):(a.uBaryCenter=n,a.upstreamLinkCount=0)}}},calcDownData:function(e){var t,n,i,o,r,s,a,l,c;if(e!==this.layers.length-1){for(t=this.layers[e],r=new h,s=this.layers[e+1],n=0;s.length>n;n++)r.add(s[n]);for(n=0;t.length>n;n++){for(a=t[n],l=0,c=0,i=0;a.incoming.length>i;i++)o=a.incoming[i],r.contains(o.source)&&(c++,l+=o.source.gridPosition);for(i=0;a.outgoing.length>i;i++)o=a.outgoing[i],r.contains(o.target)&&(c++,l+=o.target.gridPosition);c>0?(a.dBaryCenter=l/c,a.downstreamLinkCount=c):(a.dBaryCenter=n,a.downstreamLinkCount=0)}}},optimizeLayerCrossings:function(e,t){var n,i,o,r,s,a,l,c;for(i=e?this.layers[n=t+1]:this.layers[n=t-1],o=i.slice(0),e?this.calcUpData(n):this.calcDownData(n),r=this,i.sort(function(e,t){var n,i=r.calcBaryCenter(e),o=r.calcBaryCenter(t);return Math.abs(i-o)<1e-4?e.degree()===t.degree()?r.compareByIndex(e,t):e.degree()0?-1:0>n?1:r.compareByIndex(e,t))}),a=0,s=0;i.length>s;s++)i[s]!==o[s]&&a++;if(a>0)for(l=0,s=0;i.length>s;s++)c=i[s],c.gridPosition=l++;return a},_swapPairs:function(){for(var e,t,n,i,o,r,s,a,l,c,h,u,d,f,p,g,m,v=this.options.layeredIterations,_=0;;){if(_++>v)break;for(e=1>=_%4,t=_%4===1,n=e?0:this.layers.length-1;e?this.layers.length-1>=n:n>=0;n+=e?1:-1){for(i=this.layers[n],o=!1,r=!0,s=0,a=0;i.length-1>a;a++)l=0,c=0,h=0,r?(0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),e?l*=2:c*=2,h=l+c):h=s,0!==h&&(u=i[a],d=i[a+1],f=u.gridPosition,p=d.gridPosition,i[a]=d,i[a+1]=u,u.gridPosition=p,d.gridPosition=f,l=0,0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),c=0,n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),e?l*=2:c*=2,g=l+c,m=!1,m=t?g>=h:g>h,m?(u=i[a],d=i[a+1],f=u.gridPosition,p=d.gridPosition,i[a]=d,i[a+1]=u,u.gridPosition=p,d.gridPosition=f,s=h,r=!1):(o=!0,r=!0));o&&(n!==this.layers.length-1&&this.calcUpData(n+1),0!==n&&this.calcDownData(n-1))}}},countLinksCrossingBetweenTwoLayers:function(e,t){var n,i,o,r,s,a,l,c,h,u,d,f,p=this.layers[e].linksTo[t],g=0,m=p.length;for(l=0;m>l;l++)for(n=p[l],c=l+1;m>c;c++)i=p[c],n.target.layer===t?(o=n.source,r=n.target):(o=n.target,r=n.source),i.target.layer===t?(s=i.source,a=i.target):(s=i.target,a=i.source),h=o.gridPosition,u=r.gridPosition,d=s.gridPosition,f=a.gridPosition,0>(h-d)*(u-f)&&g++;return g},calcBaryCenter:function(e){var t=e.upstreamLinkCount,n=e.downstreamLinkCount,i=e.uBaryCenter,o=e.dBaryCenter;return t>0&&n>0?(i+o)/2:t>0?i:n>0?o:0},_gridPositionComparer:function(e,t){return t.gridPosition>e.gridPosition?-1:e.gridPosition>t.gridPosition?1:0},_positionAscendingComparer:function(e,t){return t.k>e.k?-1:e.k>t.k?1:0},_positionDescendingComparer:function(e,t){return t.k>e.k?1:e.k>t.k?-1:0},_firstVirtualNode:function(e){for(var t=0;e.length>t;t++)if(e[t].isVirtual)return t;return-1},compareByIndex:function(e,t){var n=e.index,i=t.index;return i>n?1:n>i?-1:0},intDiv:function(e,t){return(e-e%t)/t},nextVirtualNode:function(e,t){var n,i=t.layerIndex;for(n=i+1;e.length>n;++n)if(e[n].isVirtual)return e[n];return null}}),C=t.Class.extend({init:function(e,t){if(d.isUndefined(e))throw"No diagram given";this.diagram=e,this.nodeMap=new c,this.linkMap=new c,this.capture(t?t:e)},capture:function(e){var t,i,o,r,s,a,c,h,u;if(e instanceof n.Graph){for(r=0;e.nodes.length>r;r++)t=e.nodes[r],o=t.associatedShape,this.nodeMap.set(o.visual.id,new l(t.x,t.y,t.width,t.height));for(r=0;e.links.length>r;r++)a=e.links[r],s=a.associatedConnection,this.linkMap.set(s.visual.id,a.points())}else if(e instanceof Array)for(i=e,r=0;i.length>r;r++)t=i[r],o=t.associatedShape,o&&this.nodeMap.set(o.visual.id,new l(t.x,t.y,t.width,t.height));else if(e.hasOwnProperty("links")&&e.hasOwnProperty("nodes")){for(i=e.nodes,c=e.links,r=0;i.length>r;r++)t=i[r],o=t.associatedShape,o&&this.nodeMap.set(o.visual.id,new l(t.x,t.y,t.width,t.height));for(r=0;c.length>r;r++)a=c[r],s=a.associatedConnection,s&&this.linkMap.set(s.visual.id,a.points)}else{for(h=this.diagram.shapes,u=this.diagram.connections,r=0;h.length>r;r++)o=h[r],this.nodeMap.set(o.visual.id,o.bounds());for(r=0;u.length>r;r++)s=u[r],this.linkMap.set(s.visual.id,s.points())}}});s(n,{init:function(e){t.init(e,n.ui)},SpringLayout:w,TreeLayout:x,GraphAdapter:y,LayeredLayout:k,LayoutBase:_,LayoutState:C})}(window.kendo.jQuery)}(),function(){!function(e,t){function n(){var e,t=this.options.anchor,n=t.outerWidth();k.wrap(this.element).addClass("k-split-wrapper"),e="border-box"!==this.element.css("box-sizing")?n-(this.element.outerWidth()-this.element.width()):n,this.element.css({fontFamily:t.css("font-family"),"min-width":e})}function i(e){e.target.is(".k-toggle-button")||e.target.toggleClass(O,"press"==e.type)}function o(t){return t=e(t),t.hasClass("km-actionsheet")?t.closest(".km-popup-wrapper"):t.addClass("km-widget km-actionsheet").wrap('').parent().wrap('').parent()}function r(e){e.preventDefault()}function s(t,n){var i="next"===n?e.fn.next:e.fn.prev,o="next"===n?e.fn.first:e.fn.last,r=i.call(t);return r.is(":kendoFocusable")||!r.length?r:r.find(":kendoFocusable").length?o.call(r.find(":kendoFocusable")):s(r,n)}var a,l,c,h,u,d,f,p,g,m,v,_,y,w,b,x,k=window.kendo,C=k.Class,S=k.ui.Widget,T=e.proxy,A=k.isFunction,D=k.keys,M="k-toolbar",E="k-button",P="k-overflow-button",I="k-toggle-button",R="k-button-group",B="k-split-button",z="k-separator",L="k-popup",F="k-toolbar-resizable",O="k-state-active",N="k-state-disabled",V="k-state-hidden",H="k-group-start",U="k-group-end",j="k-primary",W="k-icon",G="k-i-",q="k-button-icon",$="k-button-icontext",Y="k-list-container k-split-container",X="k-split-button-arrow",Q="k-overflow-anchor",K="k-overflow-container",Z="k-toolbar-first-visible",J="k-toolbar-last-visible",ee="click",te="toggle",ne="open",ie="close",oe="overflowOpen",re="overflowClose",se="never",ae="auto",le="always",ce="k-overflow-hidden",he=k.attr("uid");k.toolbar={},a={overflowAnchor:'
',overflowContainer:''},k.toolbar.registerComponent=function(e,t,n){a[e]={toolbar:t,overflow:n}},l=k.Class.extend({addOverflowAttr:function(){this.element.attr(k.attr("overflow"),this.options.overflow||ae)},addUidAttr:function(){this.element.attr(he,this.options.uid)},addIdAttr:function(){this.options.id&&this.element.attr("id",this.options.id)},addOverflowIdAttr:function(){this.options.id&&this.element.attr("id",this.options.id+"_overflow")},attributes:function(){this.options.attributes&&this.element.attr(this.options.attributes)},show:function(){this.element.removeClass(V).show(),this.options.hidden=!1},hide:function(){this.element.addClass(V).hide(),this.options.hidden=!0},remove:function(){this.element.remove()},enable:function(e){e===t&&(e=!0),this.element.toggleClass(N,!e),this.options.enable=e},twin:function(){var e=this.element.attr(he);return this.overflow?this.toolbar.element.find("["+he+"='"+e+"']").data(this.options.type):this.toolbar.options.resizable?this.toolbar.popup.element.find("["+he+"='"+e+"']").data(this.options.type):t}}),k.toolbar.Item=l,c=l.extend({init:function(n,i){var o=e(n.useButtonTag?' ':' ');this.element=o,this.options=n,this.toolbar=i,this.attributes(),n.primary&&o.addClass(j),n.togglable&&(o.addClass(I),this.toggle(n.selected)),n.url===t||n.useButtonTag||(o.attr("href",n.url),n.mobile&&o.attr(k.attr("role"),"button")),n.group&&(o.attr(k.attr("group"),n.group),(this.overflow&&this.options.overflow===le||!this.overflow)&&(this.group=this.toolbar.addToGroup(this,n.group))),!n.togglable&&n.click&&A(n.click)&&(this.clickHandler=n.click),n.togglable&&n.toggle&&A(n.toggle)&&(this.toggleHandler=n.toggle)},toggle:function(e,t){e=!!e,this.group&&e?this.group.select(this):this.group||this.select(e),t&&this.twin()&&this.twin().toggle(e)},getParentGroup:function(){return this.options.isChild?this.element.closest("."+R).data("buttonGroup"):t},_addGraphics:function(){var t,n,i,o=this.element,r=this.options.icon,s=this.options.spriteCssClass,a=this.options.imageUrl;(s||a||r)&&(t=!0,o.contents().not("span.k-sprite,span."+W+",img.k-image").each(function(n,i){(1==i.nodeType||3==i.nodeType&&e.trim(i.nodeValue).length>0)&&(t=!1)}),o.addClass(t?q:$)),r?(n=o.children("span."+W).first(),n[0]||(n=e(' ').prependTo(o)),n.addClass(G+r)):s?(n=o.children("span.k-sprite").first(),n[0]||(n=e(' ').prependTo(o)),n.addClass(s)):a&&(i=o.children("img.k-image").first(),i[0]||(i=e(' ').prependTo(o)),i.attr("src",a))}}),k.toolbar.Button=c,h=c.extend({init:function(e,t){c.fn.init.call(this,e,t);var n=this.element;n.addClass(E),this.addIdAttr(),e.align&&n.addClass("k-align-"+e.align),"overflow"!=e.showText&&e.text&&n.html(e.mobile?''+e.text+" ":e.text),e.hasIcon="overflow"!=e.showIcon&&(e.icon||e.spriteCssClass||e.imageUrl),e.hasIcon&&this._addGraphics(),this.addUidAttr(),this.addOverflowAttr(),this.enable(e.enable),e.hidden&&this.hide(),this.element.data({type:"button",button:this})},select:function(e){e===t&&(e=!1),this.element.toggleClass(O,e),this.options.selected=e}}),k.toolbar.ToolBarButton=h,u=c.extend({init:function(e,t){this.overflow=!0,c.fn.init.call(this,e,t);var n=this.element;"toolbar"!=e.showText&&e.text&&n.html(e.mobile?''+e.text+" ":''+e.text+" "),e.hasIcon="toolbar"!=e.showIcon&&(e.icon||e.spriteCssClass||e.imageUrl),e.hasIcon&&this._addGraphics(),e.isChild||this._wrap(),this.addOverflowIdAttr(),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.enable(e.enable),n.addClass(P+" "+E),e.hidden&&this.hide(),this.element.data({type:"button",button:this})},_wrap:function(){this.element=this.element.wrap(" ").parent()},overflowHidden:function(){this.element.addClass(ce)},select:function(e){e===t&&(e=!1),this.options.isChild?this.element.toggleClass(O,e):this.element.find(".k-button").toggleClass(O,e),this.options.selected=e}}),k.toolbar.OverflowButton=u,k.toolbar.registerComponent("button",h,u),d=l.extend({createButtons:function(t){var n,i,o=this.options,r=o.buttons||[];for(i=0;r.length>i;i++)r[i].uid||(r[i].uid=k.guid()),n=new t(e.extend({mobile:o.mobile,isChild:!0,type:"button"},r[i]),this.toolbar),n.element.appendTo(this.element)},refresh:function(){this.element.children().filter(":not('."+V+"'):first").addClass(H),this.element.children().filter(":not('."+V+"'):last").addClass(U)}}),k.toolbar.ButtonGroup=d,f=d.extend({init:function(t,n){var i=this.element=e("
");this.options=t,this.toolbar=n,this.addIdAttr(),t.align&&i.addClass("k-align-"+t.align),this.createButtons(h),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.refresh(),i.addClass(R),this.element.data({type:"buttonGroup",buttonGroup:this})}}),k.toolbar.ToolBarButtonGroup=f,p=d.extend({init:function(t,n){var i=this.element=e(" ");this.options=t,this.toolbar=n,this.overflow=!0,this.addOverflowIdAttr(),this.createButtons(u),this.attributes(),this.addUidAttr(),this.addOverflowAttr(),this.refresh(),i.addClass((t.mobile?"":R)+" k-overflow-group"),this.element.data({type:"buttonGroup",buttonGroup:this})},overflowHidden:function(){this.element.addClass(ce)}}),k.toolbar.OverflowButtonGroup=p,k.toolbar.registerComponent("buttonGroup",f,p),g=l.extend({init:function(t,n){var i=this.element=e('
');this.options=t,this.toolbar=n,this.mainButton=new h(t,n),this.arrowButton=e(' '),this.popupElement=e(''),this.mainButton.element.removeAttr("href tabindex").appendTo(i),this.arrowButton.appendTo(i),this.popupElement.appendTo(i),t.align&&i.addClass("k-align-"+t.align),t.id||(t.id=t.uid),i.attr("id",t.id+"_wrapper"),this.addOverflowAttr(),this.addUidAttr(),this.createMenuButtons(),this.createPopup(),this._navigatable(),this.mainButton.main=!0,i.data({type:"splitButton",splitButton:this,kendoPopup:this.popup})},_navigatable:function(){var t=this;t.popupElement.on("keydown","."+E,function(n){var i=e(n.target).parent();n.preventDefault(),n.keyCode===D.ESC||n.keyCode===D.TAB||n.altKey&&n.keyCode===D.UP?(t.toggle(),t.focus()):n.keyCode===D.DOWN?s(i,"next").focus():n.keyCode===D.UP?s(i,"prev").focus():(n.keyCode===D.SPACEBAR||n.keyCode===D.ENTER)&&t.toolbar.userEvents.trigger("tap",{
target:e(n.target)})})},createMenuButtons:function(){var t,n,i=this.options,o=i.menuButtons;for(n=0;o.length>n;n++)t=new h(e.extend({mobile:i.mobile,type:"button",click:i.click},o[n]),this.toolbar),t.element.wrap(" ").parent().appendTo(this.popupElement)},createPopup:function(){var t=this.options,i=this.element;this.popupElement.attr("id",t.id+"_optionlist").attr(he,t.rootUid),t.mobile&&(this.popupElement=o(this.popupElement)),this.popup=this.popupElement.kendoPopup({appendTo:t.mobile?e(t.mobile).children(".km-pane"):null,anchor:i,isRtl:this.toolbar._isRtl,copyAnchorStyles:!1,animation:t.animation,open:n,activate:function(){this.element.find(":kendoFocusable").first().focus()},close:function(){i.focus()}}).data("kendoPopup"),this.popup.element.on(ee,"a.k-button",r)},remove:function(){this.popup.element.off(ee,"a.k-button"),this.popup.destroy(),this.element.remove()},toggle:function(){this.popup.toggle()},enable:function(e){e===t&&(e=!0),this.mainButton.enable(e),this.options.enable=e},focus:function(){this.element.focus()}}),k.toolbar.ToolBarSplitButton=g,m=l.extend({init:function(t,n){var i,o,r=this.element=e(' '),s=t.menuButtons;for(this.options=t,this.toolbar=n,this.overflow=!0,this.mainButton=new u(e.extend({isChild:!0},t)),this.mainButton.element.appendTo(r),o=0;s.length>o;o++)i=new u(e.extend({mobile:t.mobile,isChild:!0},s[o]),this.toolbar),i.element.appendTo(r);this.addUidAttr(),this.addOverflowAttr(),this.mainButton.main=!0,r.data({type:"splitButton",splitButton:this})},overflowHidden:function(){this.element.addClass(ce)}}),k.toolbar.OverflowSplitButton=m,k.toolbar.registerComponent("splitButton",g,m),v=l.extend({init:function(t,n){var i=this.element=e("
");this.element=i,this.options=t,this.toolbar=n,this.attributes(),this.addIdAttr(),this.addUidAttr(),this.addOverflowAttr(),i.addClass(z),i.data({type:"separator",separator:this})}}),_=l.extend({init:function(t,n){var i=this.element=e(" ");this.element=i,this.options=t,this.toolbar=n,this.overflow=!0,this.attributes(),this.addUidAttr(),this.addOverflowIdAttr(),i.addClass(z),i.data({type:"separator",separator:this})},overflowHidden:function(){this.element.addClass(ce)}}),k.toolbar.registerComponent("separator",v,_),y=l.extend({init:function(t,n,i){var o=A(t)?t(n):t;o=o instanceof jQuery?o.wrap("
").parent():e("
").html(o),this.element=o,this.options=n,this.options.type="template",this.toolbar=i,this.attributes(),this.addUidAttr(),this.addIdAttr(),this.addOverflowAttr(),o.data({type:"template",template:this})}}),k.toolbar.TemplateItem=y,w=l.extend({init:function(t,n,i){var o=e(A(t)?t(n):t);o=o instanceof jQuery?o.wrap(" ").parent():e(" ").html(o),this.element=o,this.options=n,this.options.type="template",this.toolbar=i,this.overflow=!0,this.attributes(),this.addUidAttr(),this.addOverflowIdAttr(),this.addOverflowAttr(),o.data({type:"template",template:this})},overflowHidden:function(){this.element.addClass(ce)}}),k.toolbar.OverflowTemplateItem=w,b=C.extend({init:function(e){this.name=e,this.buttons=[]},add:function(e){this.buttons[this.buttons.length]=e},remove:function(t){var n=e.inArray(t,this.buttons);this.buttons.splice(n,1)},select:function(e){var t,n;for(n=0;this.buttons.length>n;n++)t=this.buttons[n],t.select(!1),t.twin()&&t.twin().select(!1);e.select(!0)}}),x=S.extend({init:function(t,n){var o,s=this;if(S.fn.init.call(s,t,n),n=s.options,t=s.wrapper=s.element,t.addClass(M+" k-widget"),this.uid=k.guid(),this._isRtl=k.support.isRtl(t),this._groups={},t.attr(he,this.uid),s.isMobile="boolean"==typeof n.mobile?n.mobile:s.element.closest(".km-root")[0],s.animation=s.isMobile?{open:{effects:"fade"}}:{},s.isMobile&&(t.addClass("km-widget"),W="km-icon",G="km-",E="km-button",R="km-buttongroup km-widget",O="km-state-active",N="km-state-disabled"),n.resizable?(s._renderOverflow(),t.addClass(F),s.overflowUserEvents=new k.UserEvents(s.element,{threshold:5,allowSelection:!0,filter:"."+Q,tap:T(s._toggleOverflow,s)}),s._resizeHandler=k.onResize(function(){s.resize()})):s.popup={element:e([])},n.items&&n.items.length)for(o=0;n.items.length>o;o++)s.add(n.items[o]);s.userEvents=new k.UserEvents(document,{threshold:5,allowSelection:!0,filter:"["+he+"="+this.uid+"] ."+E+", ["+he+"="+this.uid+"] ."+P,tap:T(s._buttonClick,s),press:i,release:i}),s.element.on(ee,"a.k-button",r),s._navigatable(),n.resizable&&s.popup.element.on(ee,NaN,r),n.resizable&&this._toggleOverflowAnchor(),k.notify(s)},events:[ee,te,ne,ie,oe,re],options:{name:"ToolBar",items:[],resizable:!0,mobile:null},addToGroup:function(e,t){var n;return n=this._groups[t]?this._groups[t]:this._groups[t]=new b,n.add(e),n},destroy:function(){var t=this;t.element.find("."+B).each(function(t,n){e(n).data("kendoPopup").destroy()}),t.element.off(ee,"a.k-button"),t.userEvents.destroy(),t.options.resizable&&(k.unbindResize(t._resizeHandler),t.overflowUserEvents.destroy(),t.popup.element.off(ee,"a.k-button"),t.popup.destroy()),S.fn.destroy.call(t)},add:function(t){var n,i,o=a[t.type],r=t.template,s=this,l=s.isMobile?"":"k-item k-state-default",c=t.overflowTemplate;e.extend(t,{uid:k.guid(),animation:s.animation,mobile:s.isMobile,rootUid:s.uid}),r&&!c?t.overflow=se:t.overflow||(t.overflow=ae),t.overflow!==se&&s.options.resizable&&(c?i=new w(c,t,s):o&&(i=new o.overflow(t,s),i.element.addClass(l)),i&&(t.overflow===ae&&i.overflowHidden(),i.element.appendTo(s.popup.container),s.angular("compile",function(){return{elements:i.element.get()}}))),t.overflow!==le&&(r?n=new y(r,t,s):o&&(n=new o.toolbar(t,s)),n&&(s.options.resizable?(n.element.appendTo(s.element).css("visibility","hidden"),s._shrink(s.element.innerWidth()),n.element.css("visibility","visible")):n.element.appendTo(s.element),s.angular("compile",function(){return{elements:n.element.get()}})))},_getItem:function(e){var t,n,i,o,r=this.options.resizable;return t=this.element.find(e),o=t.length?t.data("type"):"",n=t.data(o),n&&n.main&&(t=t.parent("."+B),o="splitButton",n=t.data(o)),!t.length&&r&&(t=this.popup.element.find(e),o=t.data("type"),i=t.data(o)),i&&i.main&&(t=t.parent("."+B),o="splitButton",i=t.data(o)),n&&r&&(i=n.twin()),{type:o,toolbar:n,overflow:i}},remove:function(e){var t=this._getItem(e);t.toolbar&&t.toolbar.remove(),t.overflow&&t.overflow.remove(),this.resize(!0)},hide:function(e){var t=this._getItem(e);t.toolbar&&(t.toolbar.hide(),"button"===t.toolbar.options.type&&t.toolbar.options.isChild&&t.toolbar.getParentGroup().refresh()),t.overflow&&(t.overflow.hide(),"button"===t.overflow.options.type&&t.overflow.options.isChild&&t.overflow.getParentGroup().refresh()),this.resize(!0)},show:function(e){var t=this._getItem(e);t.toolbar&&(t.toolbar.show(),"button"===t.toolbar.options.type&&t.toolbar.options.isChild&&t.toolbar.getParentGroup().refresh()),t.overflow&&(t.overflow.show(),"button"===t.overflow.options.type&&t.overflow.options.isChild&&t.overflow.getParentGroup().refresh()),this.resize(!0)},enable:function(e,n){var i=this._getItem(e);t===n&&(n=!0),i.toolbar&&i.toolbar.enable(n),i.overflow&&i.overflow.enable(n)},getSelectedFromGroup:function(e){return this.element.find("."+I+"[data-group='"+e+"']").filter("."+O)},toggle:function(n,i){var o=e(n),r=o.data("button");r.options.togglable&&(i===t&&(i=!0),r.toggle(i,!0))},_renderOverflow:function(){var t=this,n=a.overflowContainer,i=t._isRtl,r=i?"left":"right";t.overflowAnchor=e(a.overflowAnchor).addClass(E),t.element.append(t.overflowAnchor),t.isMobile?(t.overflowAnchor.append(' '),n=o(n)):t.overflowAnchor.append(' '),t.popup=new k.ui.Popup(n,{origin:"bottom "+r,position:"top "+r,anchor:t.overflowAnchor,isRtl:i,animation:t.animation,appendTo:t.isMobile?e(t.isMobile).children(".km-pane"):null,copyAnchorStyles:!1,open:function(n){var o=k.wrap(t.popup.element).addClass("k-overflow-wrapper");t.isMobile?t.popup.container.css("max-height",parseFloat(e(".km-content:visible").innerHeight())-15+"px"):o.css("margin-left",(i?-1:1)*((o.outerWidth()-o.width())/2+1)),t.trigger(oe)&&n.preventDefault()},activate:function(){this.element.find(":kendoFocusable").first().focus()},close:function(e){t.trigger(re)&&e.preventDefault(),this.element.focus()}}),t.popup.element.on("keydown","."+E,function(n){var i,o=e(n.target),r=o.parent(),a=r.is("."+R)||r.is("."+B);n.preventDefault(),n.keyCode===D.ESC||n.keyCode===D.TAB||n.altKey&&n.keyCode===D.UP?(t._toggleOverflow(),t.overflowAnchor.focus()):n.keyCode===D.DOWN?(i=!a||a&&o.is(":last-child")?r:o,s(i,"next").focus()):n.keyCode===D.UP?(i=!a||a&&o.is(":first-child")?r:o,s(i,"prev").focus()):(n.keyCode===D.SPACEBAR||n.keyCode===D.ENTER)&&t.userEvents.trigger("tap",{target:e(n.target)})}),t.popup.container=t.isMobile?t.popup.element.find("."+K):t.popup.element,t.popup.container.attr(he,this.uid)},_toggleOverflowAnchor:function(){this.overflowAnchor.css(this.popup.element.children(":not(."+ce+", ."+L+")").length>0?{visibility:"visible",width:""}:{visibility:"hidden",width:"1px"})},_buttonClick:function(n){var i,o,r,s,a,l,c=this,h=n.target.closest("."+X).length;return n.preventDefault(),h?(c._toggle(n),t):(o=e(n.target).closest("."+E,c.element),o.hasClass(Q)||(r=o.data("button"),!r&&c.popup&&(o=e(n.target).closest("."+P,c.popup.container),r=o.parent("li").data("button")),r&&r.options.enable&&(r.options.togglable?(a=A(r.toggleHandler)?r.toggleHandler:null,r.toggle(!r.options.selected,!0),l={target:o,group:r.options.group,checked:r.options.selected,id:r.options.id},a&&a.call(c,l),c.trigger(te,l)):(a=A(r.clickHandler)?r.clickHandler:null,l={sender:c,target:o,id:r.options.id},a&&a.call(c,l),c.trigger(ee,l)),r.options.url&&(window.location.href=r.options.url),o.hasClass(P)&&c.popup.close(),s=o.closest(".k-split-container"),s[0]&&(i=s.data("kendoPopup"),(i?i:s.parents(".km-popup-wrapper").data("kendoPopup")).close()))),t)},_navigatable:function(){var t=this;t.element.attr("tabindex",0).focus(function(){var t=e(this).find(":kendoFocusable:first");t.is("."+Q)&&(t=s(t,"next")),t[0].focus()}).on("keydown",T(t._keydown,t))},_keydown:function(n){var i,o,r,s,a=e(n.target),l=n.keyCode,c=this.element.children(":not(.k-separator):visible");return l===D.TAB&&(i=a.parentsUntil(this.element).last(),o=!1,i.length||(i=a),i.is("."+Q)&&(n.shiftKey&&n.preventDefault(),c.last().is(":kendoFocusable")?c.last().focus():c.last().find(":kendoFocusable").last().focus()),n.shiftKey||c.index(i)!==c.length-1||(o=i.is("."+R)?a.is(":last-child"):!0),o&&(n.preventDefault(),this.overflowAnchor.focus())),n.altKey&&l===D.DOWN?(r=e(document.activeElement).data("splitButton"),s=e(document.activeElement).is("."+Q),r?r.toggle():s&&this._toggleOverflow(),t):l===D.SPACEBAR||l===D.ENTER?(n.preventDefault(),a.is("."+B)&&(a=a.children().first()),this.userEvents.trigger("tap",{target:a}),t):t},_toggle:function(t){var n,i=e(t.target).closest("."+B).data("splitButton");t.preventDefault(),i.options.enable&&(n=i.popup.element.is(":visible")?this.trigger(ie,{target:i.element}):this.trigger(ne,{target:i.element}),n||i.toggle())},_toggleOverflow:function(){this.popup.toggle()},_resize:function(e){var t=e.width;this.options.resizable&&(this.popup.close(),this._shrink(t),this._stretch(t),this._markVisibles(),this._toggleOverflowAnchor())},_childrenWidth:function(){var t=0;return this.element.children(":visible:not('."+V+"')").each(function(){t+=e(this).outerWidth(!0)}),Math.ceil(t)},_shrink:function(e){var t,n,i;if(e=0&&(t=n.eq(i),!(e>this._childrenWidth()));i--)this._hideItem(t)},_stretch:function(e){var t,n,i;if(e>this._childrenWidth())for(n=this.element.children(":hidden:not('."+V+"')"),i=0;n.length>i&&(t=n.eq(i),!(eli[data-uid='"+e.data("uid")+"']").removeClass(ce)},_showItem:function(e,t){return e.length&&t>this._childrenWidth()+e.outerWidth(!0)?(e.show(),this.popup&&this.popup.container.find(">li[data-uid='"+e.data("uid")+"']").addClass(ce),!0):!1},_markVisibles:function(){var e=this.popup.container.children(),t=this.element.children(":not(.k-overflow-anchor)"),n=e.filter(":not(.k-overflow-hidden)"),i=t.filter(":visible");e.add(t).removeClass(Z+" "+J),n.first().add(i.first()).addClass(Z),n.last().add(i.last()).addClass(J)}}),k.ui.plugin(x)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t,n,i){var o,r=e.getFullYear(),s=t.getFullYear(),a=n.getFullYear();return r-=r%i,o=r+(i-1),s>r&&(r=s),o>a&&(o=a),r+"-"+o}function i(e){for(var t,n=0,i=e.min,o=e.max,r=e.start,s=e.setter,l=e.build,c=e.cells||12,h=e.perRow||4,u=e.content||P,d=e.empty||I,f=e.html||'';c>n;n++)n>0&&n%h===0&&(f+=' '),r=new pe(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),S(r,0),t=l(r,n),f+=a(r,i,o)?u(t):d(t),s(r,1);return f+"
"}function o(e,t,n){var i=e.getFullYear(),o=t.getFullYear(),r=o,s=0;return n&&(o-=o%n,r=o-o%n+n-1),i>r?s=1:o>i&&(s=-1),s}function r(){var e=new pe;return new pe(e.getFullYear(),e.getMonth(),e.getDate())}function s(e,t,n){var i=r();return e&&(i=new pe(+e)),t>i?i=new pe(+t):i>n&&(i=new pe(+n)),i}function a(e,t,n){return+e>=+t&&+n>=+e}function l(e,t){return e.slice(t).concat(e.slice(0,t))}function c(e,t,n){t=t instanceof pe?t.getFullYear():e.getFullYear()+n*t,e.setFullYear(t)}function h(t){e(this).toggleClass($,ie.indexOf(t.type)>-1||t.type==te)}function u(e){e.preventDefault()}function d(e){return D(e).calendars.standard}function f(e){var n=ge[e.start],i=ge[e.depth],o=D(e.culture);e.format=T(e.format||o.calendars.standard.patterns.d),isNaN(n)&&(n=0,e.start=U),(i===t||i>n)&&(e.depth=U),e.dates||(e.dates=[])}function p(e){B&&e.find("*").attr("unselectable","on")}function g(e,t){for(var n=0,i=t.length;i>n;n++)if(e===+t[n])return!0;return!1}function m(e,t){return e?e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate():!1}function v(e,t){return e?e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth():!1}var _,y=window.kendo,w=y.support,b=y.ui,x=b.Widget,k=y.keys,C=y.parseDate,S=y.date.adjustDST,T=y._extractFormat,A=y.template,D=y.getCulture,M=y.support.transitions,E=M?M.css+"transform-origin":"",P=A('#=data.value# ',{useWithBlock:!1}),I=A(' ',{useWithBlock:!1}),R=y.support.browser,B=R.msie&&9>R.version,z=".kendoCalendar",L="click"+z,F="keydown"+z,O="id",N="min",V="left",H="slideIn",U="month",j="century",W="change",G="navigate",q="value",$="k-state-hover",Y="k-state-disabled",X="k-state-focused",Q="k-other-month",K=' class="'+Q+'"',Z="k-nav-today",J="td:has(.k-link)",ee="blur"+z,te="focus",ne=te+z,ie=w.touch?"touchstart":"mouseenter",oe=w.touch?"touchstart"+z:"mouseenter"+z,re=w.touch?"touchend"+z+" touchmove"+z:"mouseleave"+z,se=6e4,ae=864e5,le="_prevArrow",ce="_nextArrow",he="aria-disabled",ue="aria-selected",de=e.proxy,fe=e.extend,pe=Date,ge={month:0,year:1,decade:2,century:3},me=x.extend({init:function(t,n){var i,o,r=this;x.fn.init.call(r,t,n),t=r.wrapper=r.element,n=r.options,n.url=window.unescape(n.url),r._templates(),r._header(),r._footer(r.footer),o=t.addClass("k-widget k-calendar").on(oe+" "+re,J,h).on(F,"table.k-content",de(r._move,r)).on(L,J,function(t){var n=t.currentTarget.firstChild;-1!=n.href.indexOf("#")&&t.preventDefault(),r._click(e(n))}).on("mouseup"+z,"table.k-content, .k-footer",function(){r._focusView(r.options.focusOnNav!==!1)}).attr(O),o&&(r._cellID=o+"_cell_selected"),f(n),i=C(n.value,n.format,n.culture),r._index=ge[n.start],r._current=new pe(+s(i,n.min,n.max)),r._addClassProxy=function(){r._active=!0,r._cell.addClass(X)},r._removeClassProxy=function(){r._active=!1,r._cell.removeClass(X)},r.value(i),y.notify(r)},options:{name:"Calendar",value:null,min:new pe(1900,0,1),max:new pe(2099,11,31),dates:[],url:"",culture:"",footer:"",format:"",month:{},start:U,depth:U,animation:{horizontal:{effects:H,reverse:!0,duration:500,divisor:2},vertical:{effects:"zoomIn",duration:400}}},events:[W,G],setOptions:function(e){var t=this;f(e),e.dates[0]||(e.dates=t.options.dates),x.fn.setOptions.call(t,e),t._templates(),t._footer(t.footer),t._index=ge[t.options.start],t.navigate()},destroy:function(){var e=this,t=e._today;e.element.off(z),e._title.off(z),e[le].off(z),e[ce].off(z),y.destroy(e._table),t&&y.destroy(t.off(z)),x.fn.destroy.call(e)},current:function(){return this._current},view:function(){return this._view},focus:function(e){e=e||this._table,this._bindTable(e),e.focus()},min:function(e){return this._option(N,e)},max:function(e){return this._option("max",e)},navigateToPast:function(){this._navigate(le,-1)},navigateToFuture:function(){this._navigate(ce,1)},navigateUp:function(){var e=this,t=e._index;e._title.hasClass(Y)||e.navigate(e._current,++t)},navigateDown:function(e){var n=this,i=n._index,o=n.options.depth;if(e)return i===ge[o]?(+n._value!=+e&&(n.value(e),n.trigger(W)),t):(n.navigate(e,--i),t)},navigate:function(n,i){i=isNaN(i)?ge[i]:i;var o,r,a,l,c=this,h=c.options,u=h.culture,d=h.min,f=h.max,g=c._title,m=c._table,v=c._oldTable,y=c._value,w=c._current,b=n&&+n>+w,x=i!==t&&i!==c._index;n||(n=w),c._current=n=new pe(+s(n,d,f)),i===t?i=c._index:c._index=i,c._view=r=_.views[i],a=r.compare,l=i===ge[j],g.toggleClass(Y,l).attr(he,l),l=a(n,d)<1,c[le].toggleClass(Y,l).attr(he,l),l=a(n,f)>-1,c[ce].toggleClass(Y,l).attr(he,l),m&&v&&v.data("animating")&&(v.kendoStop(!0,!0),m.kendoStop(!0,!0)),c._oldTable=m,(!m||c._changeView)&&(g.html(r.title(n,d,f,u)),c._table=o=e(r.content(fe({min:d,max:f,date:n,url:h.url,dates:h.dates,format:h.format,culture:u},c[r.name]))),p(o),c._animate({from:m,to:o,vertical:x,future:b}),c._focus(n),c.trigger(G)),i===ge[h.depth]&&y&&c._class("k-state-selected",r.toDateString(y)),c._class(X,r.toDateString(n)),!m&&c._cell&&c._cell.removeClass(X),c._changeView=!0},value:function(e){var n=this,i=n._view,o=n.options,r=n._view,s=o.min,l=o.max;return e===t?n._value:(e=C(e,o.format,o.culture),null!==e&&(e=new pe(+e),a(e,s,l)||(e=null)),n._value=e,r&&null===e&&n._cell?n._cell.removeClass("k-state-selected"):(n._changeView=!e||i&&0!==i.compare(e,n._current),n.navigate(e)),t)},_move:function(t){var n,i,o,r,a=this,l=a.options,c=t.keyCode,h=a._view,u=a._index,d=new pe(+a._current),f=y.support.isRtl(a.wrapper);return t.target===a._table[0]&&(a._active=!0),t.ctrlKey?c==k.RIGHT&&!f||c==k.LEFT&&f?(a.navigateToFuture(),i=!0):c==k.LEFT&&!f||c==k.RIGHT&&f?(a.navigateToPast(),i=!0):c==k.UP?(a.navigateUp(),i=!0):c==k.DOWN&&(a._click(e(a._cell[0].firstChild)),i=!0):(c==k.RIGHT&&!f||c==k.LEFT&&f?(n=1,i=!0):c==k.LEFT&&!f||c==k.RIGHT&&f?(n=-1,i=!0):c==k.UP?(n=0===u?-7:-4,i=!0):c==k.DOWN?(n=0===u?7:4,i=!0):c==k.ENTER?(a._click(e(a._cell[0].firstChild)),i=!0):c==k.HOME||c==k.END?(o=c==k.HOME?"first":"last",r=h[o](d),d=new pe(r.getFullYear(),r.getMonth(),r.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),d.getMilliseconds()),i=!0):c==k.PAGEUP?(i=!0,a.navigateToPast()):c==k.PAGEDOWN&&(i=!0,a.navigateToFuture()),(n||o)&&(o||h.setDate(d,n),a._focus(s(d,l.min,l.max)))),i&&t.preventDefault(),a._current},_animate:function(e){var t=this,n=e.from,i=e.to,o=t._active;n?n.parent().data("animating")?(n.off(z),n.parent().kendoStop(!0,!0).remove(),n.remove(),i.insertAfter(t.element[0].firstChild),t._focusView(o)):n.is(":visible")&&t.options.animation!==!1?t[e.vertical?"_vertical":"_horizontal"](n,i,e.future):(i.insertAfter(n),n.off(z).remove(),t._focusView(o)):(i.insertAfter(t.element[0].firstChild),t._bindTable(i))},_horizontal:function(e,t,n){var i=this,o=i._active,r=i.options.animation.horizontal,s=r.effects,a=e.outerWidth();s&&-1!=s.indexOf(H)&&(e.add(t).css({width:a}),e.wrap("
"),i._focusView(o,e),e.parent().css({position:"relative",width:2*a,"float":V,"margin-left":n?0:-a}),t[n?"insertAfter":"insertBefore"](e),fe(r,{effects:H+":"+(n?"right":V),complete:function(){e.off(z).remove(),i._oldTable=null,t.unwrap(),i._focusView(o)}}),e.parent().kendoStop(!0,!0).kendoAnimate(r))},_vertical:function(e,t){var n,i,o=this,r=o.options.animation.vertical,s=r.effects,a=o._active;s&&-1!=s.indexOf("zoom")&&(t.css({position:"absolute",top:e.prev().outerHeight(),left:0}).insertBefore(e),E&&(n=o._cellByDate(o._view.toDateString(o._current)),i=n.position(),i=i.left+parseInt(n.width()/2,10)+"px "+(i.top+parseInt(n.height()/2,10)+"px"),t.css(E,i)),e.kendoStop(!0,!0).kendoAnimate({effects:"fadeOut",duration:600,complete:function(){e.off(z).remove(),o._oldTable=null,t.css({position:"static",top:0,left:0}),o._focusView(a)}}),t.kendoStop(!0,!0).kendoAnimate(r))},_cellByDate:function(t){return this._table.find("td:not(."+Q+")").filter(function(){return e(this.firstChild).attr(y.attr(q))===t})},_class:function(t,n){var i=this,o=i._cellID,r=i._cell;r&&r.removeAttr(ue).removeAttr("aria-label").removeAttr(O),r=i._table.find("td:not(."+Q+")").removeClass(t).filter(function(){return e(this.firstChild).attr(y.attr(q))===n}).attr(ue,!0),t!==X||i._active||i.options.focusOnNav===!1||(t=""),r.addClass(t),r[0]&&(i._cell=r),o&&(r.attr(O,o),i._table.removeAttr("aria-activedescendant").attr("aria-activedescendant",o))},_bindTable:function(e){e.on(ne,this._addClassProxy).on(ee,this._removeClassProxy)},_click:function(e){var t=this,n=t.options,i=new Date(+t._current),o=e.attr(y.attr(q)).split("/");o=new pe(o[0],o[1],o[2]),S(o,0),t._view.setDate(i,o),t.navigateDown(s(i,n.min,n.max))},_focus:function(e){var t=this,n=t._view;0!==n.compare(e,t._current)?t.navigate(e):(t._current=e,t._class(X,n.toDateString(e)))},_focusView:function(e,t){e&&this.focus(t)},_footer:function(n){var i=this,o=r(),s=i.element,a=s.find(".k-footer");return n?(a[0]||(a=e('').appendTo(s)),i._today=a.show().find(".k-link").html(n(o)).attr("title",y.toString(o,"D",i.options.culture)),i._toggle(),t):(i._toggle(!1),a.hide(),t)},_header:function(){var e,t=this,n=t.element;n.find(".k-header")[0]||n.html(''),e=n.find(".k-link").on(oe+" "+re+" "+ne+" "+ee,h).click(!1),t._title=e.eq(1).on(L,function(){t._active=t.options.focusOnNav!==!1,t.navigateUp()}),t[le]=e.eq(0).on(L,function(){t._active=t.options.focusOnNav!==!1,t.navigateToPast()}),t[ce]=e.eq(2).on(L,function(){t._active=t.options.focusOnNav!==!1,t.navigateToFuture()})},_navigate:function(e,t){var n=this,i=n._index+1,o=new pe(+n._current);e=n[e],e.hasClass(Y)||(i>3?o.setFullYear(o.getFullYear()+100*t):_.views[i].setDate(o,t),n.navigate(o))},_option:function(e,n){var i,o=this,r=o.options,s=o._value||o._current;return n===t?r[e]:(n=C(n,r.format,r.culture),n&&(r[e]=new pe(+n),i=e===N?n>s:s>n,(i||v(s,n))&&(i&&(o._value=null),o._changeView=!0),o._changeView||(o._changeView=!(!r.month.content&&!r.month.empty)),o.navigate(o._value),o._toggle()),t)},_toggle:function(e){var n=this,i=n.options,o=n._today;e===t&&(e=a(r(),i.min,i.max)),o&&(o.off(L),e?o.addClass(Z).removeClass(Y).on(L,de(n._todayClick,n)):o.removeClass(Z).addClass(Y).on(L,u))},_todayClick:function(e){var t=this,n=ge[t.options.depth],i=r();e.preventDefault(),0===t._view.compare(t._current,i)&&t._index==n&&(t._changeView=!1),t._value=i,t.navigate(i,n),t.trigger(W)},_templates:function(){var e=this,t=e.options,n=t.footer,i=t.month,o=i.content,r=i.empty;e.month={content:A(''+(o||"#=data.value#")+" ",{useWithBlock:!!o}),empty:A(''+(r||" ")+" ",{useWithBlock:!!r})},e.footer=n!==!1?A(n||'#= kendo.toString(data,"D","'+t.culture+'") #',{useWithBlock:!1}):null}});b.plugin(me),_={firstDayOfMonth:function(e){return new pe(e.getFullYear(),e.getMonth(),1)},firstVisibleDay:function(e,t){t=t||y.culture().calendar;for(var n=t.firstDay,i=new pe(e.getFullYear(),e.getMonth(),0,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());i.getDay()!=n;)_.setTime(i,-1*ae);return i},setTime:function(e,t){var n=e.getTimezoneOffset(),i=new pe(e.getTime()+t),o=i.getTimezoneOffset()-n;e.setTime(i.getTime()+o*se)},views:[{name:U,title:function(e,t,n,i){return d(i).months.names[e.getMonth()]+" "+e.getFullYear()},content:function(e){for(var t=this,n=0,o=e.min,r=e.max,s=e.date,a=e.dates,c=e.format,h=e.culture,u=e.url,f=u&&a[0],p=d(h),m=p.firstDay,v=p.days,w=l(v.names,m),b=l(v.namesShort,m),x=_.firstVisibleDay(s,p),k=t.first(s),C=t.last(s),T=t.toDateString,A=new pe,D='';7>n;n++)D+=''+b[n]+" ";return A=new pe(A.getFullYear(),A.getMonth(),A.getDate()),S(A,0),A=+A,i({cells:42,perRow:7,html:D+=' ',start:x,min:new pe(o.getFullYear(),o.getMonth(),o.getDate()),max:new pe(r.getFullYear(),r.getMonth(),r.getDate()),content:e.content,empty:e.empty,setter:t.setDate,build:function(e){var t=[],n=e.getDay(),i="",o="#";return(k>e||e>C)&&t.push(Q),+e===A&&t.push("k-today"),(0===n||6===n)&&t.push("k-weekend"),f&&g(+e,a)&&(o=u.replace("{0}",y.toString(e,c,h)),i=" k-action-link"),{date:e,dates:a,ns:y.ns,title:y.toString(e,"D",h),value:e.getDate(),dateString:T(e),cssClass:t[0]?' class="'+t.join(" ")+'"':"",linkClass:i,url:o}}})},first:function(e){return _.firstDayOfMonth(e)},last:function(e){var t=new pe(e.getFullYear(),e.getMonth()+1,0),n=_.firstDayOfMonth(e),i=Math.abs(t.getTimezoneOffset()-n.getTimezoneOffset());return i&&t.setHours(n.getHours()+i/60),t},compare:function(e,t){var n,i=e.getMonth(),o=e.getFullYear(),r=t.getMonth(),s=t.getFullYear();return n=o>s?1:s>o?-1:i==r?0:i>r?1:-1},setDate:function(e,t){var n=e.getHours();t instanceof pe?e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()):_.setTime(e,t*ae),S(e,n)},toDateString:function(e){return e.getFullYear()+"/"+e.getMonth()+"/"+e.getDate()}},{name:"year",title:function(e){return e.getFullYear()},content:function(e){var t=d(e.culture).months.namesAbbr,n=this.toDateString,o=e.min,r=e.max;return i({min:new pe(o.getFullYear(),o.getMonth(),1),max:new pe(r.getFullYear(),r.getMonth(),1),start:new pe(e.date.getFullYear(),0,1),setter:this.setDate,build:function(e){return{value:t[e.getMonth()],ns:y.ns,dateString:n(e),cssClass:""}}})},first:function(e){return new pe(e.getFullYear(),0,e.getDate())},last:function(e){return new pe(e.getFullYear(),11,e.getDate())},compare:function(e,t){return o(e,t)},setDate:function(e,t){var n,i=e.getHours();t instanceof pe?(n=t.getMonth(),e.setFullYear(t.getFullYear(),n,e.getDate()),n!==e.getMonth()&&e.setDate(0)):(n=e.getMonth()+t,e.setMonth(n),n>11&&(n-=12),n>0&&e.getMonth()!=n&&e.setDate(0)),S(e,i)},toDateString:function(e){return e.getFullYear()+"/"+e.getMonth()+"/1"}},{name:"decade",title:function(e,t,i){return n(e,t,i,10)},content:function(e){var t=e.date.getFullYear(),n=this.toDateString;return i({start:new pe(t-t%10-1,0,1),min:new pe(e.min.getFullYear(),0,1),max:new pe(e.max.getFullYear(),0,1),setter:this.setDate,build:function(e,t){return{value:e.getFullYear(),ns:y.ns,dateString:n(e),cssClass:0===t||11==t?K:""}}})},first:function(e){var t=e.getFullYear();return new pe(t-t%10,e.getMonth(),e.getDate())},last:function(e){var t=e.getFullYear();return new pe(t-t%10+9,e.getMonth(),e.getDate())},compare:function(e,t){return o(e,t,10)},setDate:function(e,t){c(e,t,1)},toDateString:function(e){return e.getFullYear()+"/0/1"}},{name:j,title:function(e,t,i){return n(e,t,i,100)},content:function(e){var t=e.date.getFullYear(),n=e.min.getFullYear(),o=e.max.getFullYear(),r=this.toDateString,s=n,a=o;return s-=s%10,a-=a%10,10>a-s&&(a=s+9),i({start:new pe(t-t%100-10,0,1),min:new pe(s,0,1),max:new pe(a,0,1),setter:this.setDate,build:function(e,t){var i=e.getFullYear(),s=i+9;return n>i&&(i=n),s>o&&(s=o),{ns:y.ns,value:i+" - "+s,dateString:r(e),cssClass:0===t||11==t?K:""}}})},first:function(e){var t=e.getFullYear();return new pe(t-t%100,e.getMonth(),e.getDate())},last:function(e){var t=e.getFullYear();return new pe(t-t%100+99,e.getMonth(),e.getDate())},compare:function(e,t){return o(e,t,100)},setDate:function(e,t){c(e,t,10)},toDateString:function(e){var t=e.getFullYear();return t-t%10+"/0/1"}}]},_.isEqualDatePart=m,_.makeUnselectable=p,_.restrictValue=s,_.isInRange=a,_.normalize=f,_.viewsEnum=ge,y.calendar=_}(window.kendo.jQuery)}(),function(){!function(e,t){function n(t){var n=t.parseFormats,i=t.format;L.normalize(t),n=e.isArray(n)?n:[n],n.length||n.push("yyyy-MM-dd"),-1===e.inArray(i,n)&&n.splice(0,0,t.format),t.parseFormats=n}function i(e){e.preventDefault()}var o,r=window.kendo,s=r.ui,a=s.Widget,l=r.parseDate,c=r.keys,h=r.template,u=r._activeElement,d="
",f=" ",p=".kendoDatePicker",g="click"+p,m="open",v="close",_="change",y="disabled",w="readonly",b="k-state-default",x="k-state-focused",k="k-state-selected",C="k-state-disabled",S="k-state-hover",T="mouseenter"+p+" mouseleave"+p,A="mousedown"+p,D="id",M="min",E="max",P="month",I="aria-disabled",R="aria-expanded",B="aria-hidden",z="aria-readonly",L=r.calendar,F=L.isInRange,O=L.restrictValue,N=L.isEqualDatePart,V=e.extend,H=e.proxy,U=Date,j=function(t){var n,i=this,o=document.body,a=e(d).attr(B,"true").addClass("k-calendar-container").appendTo(o);i.options=t=t||{},n=t.id,n&&(n+="_dateview",a.attr(D,n),i._dateViewID=n),i.popup=new s.Popup(a,V(t.popup,t,{name:"Popup",isRtl:r.support.isRtl(t.anchor)})),i.div=a,i.value(t.value)};j.prototype={_calendar:function(){var t,n=this,o=n.calendar,a=n.options;o||(t=e(d).attr(D,r.guid()).appendTo(n.popup.element).on(A,i).on(g,"td:has(.k-link)",H(n._click,n)),n.calendar=o=new s.Calendar(t),n._setOptions(a),r.calendar.makeUnselectable(o.element),o.navigate(n._value||n._current,a.start),n.value(n._value))},_setOptions:function(e){this.calendar.setOptions({focusOnNav:!1,change:e.change,culture:e.culture,dates:e.dates,depth:e.depth,footer:e.footer,format:e.format,max:e.max,min:e.min,month:e.month,start:e.start})},setOptions:function(e){var t=this.options;this.options=V(t,e,{change:t.change,close:t.close,open:t.open}),this.calendar&&this._setOptions(this.options)},destroy:function(){this.popup.destroy()},open:function(){var e=this;e._calendar(),e.popup.open()},close:function(){this.popup.close()},min:function(e){this._option(M,e)},max:function(e){this._option(E,e)},toggle:function(){var e=this;e[e.popup.visible()?v:m]()},move:function(e){var t=this,n=e.keyCode,i=t.calendar,o=e.ctrlKey&&n==c.DOWN||n==c.ENTER,r=!1;if(e.altKey)n==c.DOWN?(t.open(),e.preventDefault(),r=!0):n==c.UP&&(t.close(),e.preventDefault(),r=!0);else if(t.popup.visible()){if(n==c.ESC||o&&i._cell.hasClass(k))return t.close(),e.preventDefault(),!0;t._current=i._move(e),r=!0}return r},current:function(e){this._current=e,this.calendar._focus(e)},value:function(e){var t=this,n=t.calendar,i=t.options;t._value=e,t._current=new U(+O(e,i.min,i.max)),n&&n.value(e)},_click:function(e){-1!==e.currentTarget.className.indexOf(k)&&this.close()},_option:function(e,t){var n=this,i=n.calendar;n.options[e]=t,i&&i[e](t)}},j.normalize=n,r.DateView=j,o=a.extend({init:function(t,i){var o,s,c=this;a.fn.init.call(c,t,i),t=c.element,i=c.options,i.min=l(t.attr("min"))||l(i.min),i.max=l(t.attr("max"))||l(i.max),n(i),c._initialOptions=V({},i),c._wrapper(),c.dateView=new j(V({},i,{id:t.attr(D),anchor:c.wrapper,change:function(){c._change(this.value()),c.close()},close:function(e){c.trigger(v)?e.preventDefault():(t.attr(R,!1),s.attr(B,!0))},open:function(e){var n,i=c.options;c.trigger(m)?e.preventDefault():(c.element.val()!==c._oldText&&(n=l(t.val(),i.parseFormats,i.culture),
c.dateView[n?"current":"value"](n)),t.attr(R,!0),s.attr(B,!1),c._updateARIA(n))}})),s=c.dateView.div,c._icon();try{t[0].setAttribute("type","text")}catch(h){t[0].type="text"}t.addClass("k-input").attr({role:"combobox","aria-expanded":!1,"aria-owns":c.dateView._dateViewID}),c._reset(),c._template(),o=t.is("[disabled]")||e(c.element).parents("fieldset").is(":disabled"),o?c.enable(!1):c.readonly(t.is("[readonly]")),c._old=c._update(i.value||c.element.val()),c._oldText=t.val(),r.notify(c)},events:[m,v,_],options:{name:"DatePicker",value:null,footer:"",format:"",culture:"",parseFormats:[],min:new Date(1900,0,1),max:new Date(2099,11,31),start:P,depth:P,animation:{},month:{},dates:[],ARIATemplate:'Current focused date is #=kendo.toString(data.current, "D")#'},setOptions:function(e){var t=this,i=t._value;a.fn.setOptions.call(t,e),e=t.options,e.min=l(e.min),e.max=l(e.max),n(e),t.dateView.setOptions(e),i&&(t.element.val(r.toString(i,e.format,e.culture)),t._updateARIA(i))},_editable:function(e){var t=this,n=t._dateIcon.off(p),o=t.element.off(p),r=t._inputWrapper.off(p),s=e.readonly,a=e.disable;s||a?(r.addClass(a?C:b).removeClass(a?b:C),o.attr(y,a).attr(w,s).attr(I,a).attr(z,s)):(r.addClass(b).removeClass(C).on(T,t._toggleHover),o.removeAttr(y).removeAttr(w).attr(I,!1).attr(z,!1).on("keydown"+p,H(t._keydown,t)).on("focusout"+p,H(t._blur,t)).on("focus"+p,function(){t._inputWrapper.addClass(x)}),n.on(g,H(t._click,t)).on(A,i))},readonly:function(e){this._editable({readonly:e===t?!0:e,disable:!1})},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t?!0:e)})},destroy:function(){var e=this;a.fn.destroy.call(e),e.dateView.destroy(),e.element.off(p),e._dateIcon.off(p),e._inputWrapper.off(p),e._form&&e._form.off("reset",e._resetHandler)},open:function(){this.dateView.open()},close:function(){this.dateView.close()},min:function(e){return this._option(M,e)},max:function(e){return this._option(E,e)},value:function(e){var n=this;return e===t?n._value:(n._old=n._update(e),null===n._old&&n.element.val(""),n._oldText=n.element.val(),t)},_toggleHover:function(t){e(t.currentTarget).toggleClass(S,"mouseenter"===t.type)},_blur:function(){var e=this,t=e.element.val();e.close(),t!==e._oldText&&e._change(t),e._inputWrapper.removeClass(x)},_click:function(){var e=this,t=e.element;e.dateView.toggle(),r.support.touch||t[0]===u()||t.focus()},_change:function(e){var t=this;e=t._update(e),+t._old!=+e&&(t._old=e,t._oldText=t.element.val(),t._typing||t.element.trigger(_),t.trigger(_)),t._typing=!1},_keydown:function(e){var t=this,n=t.dateView,i=t.element.val(),o=!1;n.popup.visible()||e.keyCode!=c.ENTER||i===t._oldText?(o=n.move(e),t._updateARIA(n._current),o||(t._typing=!0)):t._change(i)},_icon:function(){var t,n=this,i=n.element;t=i.next("span.k-select"),t[0]||(t=e('select ').insertAfter(i)),n._dateIcon=t.attr({role:"button","aria-controls":n.dateView._dateViewID})},_option:function(e,n){var i=this,o=i.options;return n===t?o[e]:(n=l(n,o.parseFormats,o.culture),n&&(o[e]=new U(+n),i.dateView[e](n)),t)},_update:function(e){var t,n=this,i=n.options,o=i.min,s=i.max,a=n._value,c=l(e,i.parseFormats,i.culture),h=null===c&&null===a||c instanceof Date&&a instanceof Date;return+c===+a&&h?(t=r.toString(c,i.format,i.culture),t!==e&&n.element.val(null===c?e:t),c):(null!==c&&N(c,o)?c=O(c,o,s):F(c,o,s)||(c=null),n._value=c,n.dateView.value(c),n.element.val(c?r.toString(c,i.format,i.culture):e),n._updateARIA(c),c)},_wrapper:function(){var t,n=this,i=n.element;t=i.parents(".k-datepicker"),t[0]||(t=i.wrap(f).parent().addClass("k-picker-wrap k-state-default"),t=t.wrap(f).parent()),t[0].style.cssText=i[0].style.cssText,i.css({width:"100%",height:i[0].style.height}),n.wrapper=t.addClass("k-widget k-datepicker k-header").addClass(i[0].className),n._inputWrapper=e(t[0].firstChild)},_reset:function(){var t=this,n=t.element,i=n.attr("form"),o=i?e("#"+i):n.closest("form");o[0]&&(t._resetHandler=function(){t.value(n[0].defaultValue),t.max(t._initialOptions.max),t.min(t._initialOptions.min)},t._form=o.on("reset",t._resetHandler))},_template:function(){this._ariaTemplate=h(this.options.ARIATemplate)},_updateARIA:function(e){var t,n=this,i=n.dateView.calendar;n.element.removeAttr("aria-activedescendant"),i&&(t=i._cell,t.attr("aria-label",n._ariaTemplate({current:e||i.current()})),n.element.attr("aria-activedescendant",t.attr("id")))}}),s.plugin(o)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t){return''+t+" "}var i=window.kendo,o=i.caret,r=i.keys,s=i.ui,a=s.Widget,l=i._activeElement,c=i._extractFormat,h=i.parseFloat,u=i.support.placeholder,d=i.getCulture,f=i._round,p="change",g="disabled",m="readonly",v="k-input",_="spin",y=".kendoNumericTextBox",w="touchend",b="mouseleave"+y,x="mouseenter"+y+" "+b,k="k-state-default",C="k-state-focused",S="k-state-hover",T="focus",A=".",D="k-state-selected",M="k-state-disabled",E="aria-disabled",P="aria-readonly",I=/^(-)?(\d*)$/,R=null,B=e.proxy,z=e.extend,L=a.extend({init:function(n,o){var r,s,l,h,u,d=this,f=o&&o.step!==t;a.fn.init.call(d,n,o),o=d.options,n=d.element.on("focusout"+y,B(d._focusout,d)).attr("role","spinbutton"),o.placeholder=o.placeholder||n.attr("placeholder"),d._initialOptions=z({},o),d._reset(),d._wrapper(),d._arrows(),d._input(),i.support.mobileOS?d._text.on(w+y+" "+T+y,function(){d._toggleText(!1),n.focus()}):d._text.on(T+y,B(d._click,d)),r=d.min(n.attr("min")),s=d.max(n.attr("max")),l=d._parse(n.attr("step")),o.min===R&&r!==R&&(o.min=r),o.max===R&&s!==R&&(o.max=s),f||l===R||(o.step=l),n.attr("aria-valuemin",o.min).attr("aria-valuemax",o.max),o.format=c(o.format),h=o.value,d.value(h!==R?h:n.val()),u=n.is("[disabled]")||e(d.element).parents("fieldset").is(":disabled"),u?d.enable(!1):d.readonly(n.is("[readonly]")),i.notify(d)},options:{name:"NumericTextBox",decimals:R,min:R,max:R,value:R,step:1,culture:"",format:"n",spinners:!0,placeholder:"",upArrowText:"Increase value",downArrowText:"Decrease value"},events:[p,_],_editable:function(e){var t=this,n=t.element,i=e.disable,o=e.readonly,r=t._text.add(n),s=t._inputWrapper.off(x);t._toggleText(!0),t._upArrowEventHandler.unbind("press"),t._downArrowEventHandler.unbind("press"),n.off("keydown"+y).off("keypress"+y).off("paste"+y),o||i?(s.addClass(i?M:k).removeClass(i?k:M),r.attr(g,i).attr(m,o).attr(E,i).attr(P,o)):(s.addClass(k).removeClass(M).on(x,t._toggleHover),r.removeAttr(g).removeAttr(m).attr(E,!1).attr(P,!1),t._upArrowEventHandler.bind("press",function(e){e.preventDefault(),t._spin(1),t._upArrow.addClass(D)}),t._downArrowEventHandler.bind("press",function(e){e.preventDefault(),t._spin(-1),t._downArrow.addClass(D)}),t.element.on("keydown"+y,B(t._keydown,t)).on("keypress"+y,B(t._keypress,t)).on("paste"+y,B(t._paste,t)))},readonly:function(e){this._editable({readonly:e===t?!0:e,disable:!1})},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t?!0:e)})},destroy:function(){var e=this;e.element.add(e._text).add(e._upArrow).add(e._downArrow).add(e._inputWrapper).off(y),e._upArrowEventHandler.destroy(),e._downArrowEventHandler.destroy(),e._form&&e._form.off("reset",e._resetHandler),a.fn.destroy.call(e)},min:function(e){return this._option("min",e)},max:function(e){return this._option("max",e)},step:function(e){return this._option("step",e)},value:function(e){var n,i=this;return e===t?i._value:(e=i._parse(e),n=i._adjust(e),e===n&&(i._update(e),i._old=i._value),t)},focus:function(){this._focusin()},_adjust:function(e){var t=this,n=t.options,i=n.min,o=n.max;return e===R?e:(i!==R&&i>e?e=i:o!==R&&e>o&&(e=o),e)},_arrows:function(){var t,o=this,r=function(){clearTimeout(o._spinning),t.removeClass(D)},s=o.options,a=s.spinners,l=o.element;t=l.siblings(".k-icon"),t[0]||(t=e(n("n",s.upArrowText)+n("s",s.downArrowText)).insertAfter(l),t.wrapAll(' ')),a||(t.parent().toggle(a),o._inputWrapper.addClass("k-expand-padding")),o._upArrow=t.eq(0),o._upArrowEventHandler=new i.UserEvents(o._upArrow,{release:r}),o._downArrow=t.eq(1),o._downArrowEventHandler=new i.UserEvents(o._downArrow,{release:r})},_blur:function(){var e=this;e._toggleText(!0),e._change(e.element.val())},_click:function(e){var t=this;clearTimeout(t._focusing),t._focusing=setTimeout(function(){var n,i,r,s=e.target,a=o(s)[0],l=s.value.substring(0,a),c=t._format(t.options.format),h=c[","],u=0;h&&(i=RegExp("\\"+h,"g"),r=RegExp("([\\d\\"+h+"]+)(\\"+c[A]+")?(\\d+)?")),r&&(n=r.exec(l)),n&&(u=n[0].replace(i,"").length,-1!=l.indexOf("(")&&0>t._value&&u++),t._focusin(),o(t.element[0],u)})},_change:function(e){var t=this;t._update(e),e=t._value,t._old!=e&&(t._old=e,t._typing||t.element.trigger(p),t.trigger(p)),t._typing=!1},_culture:function(e){return e||d(this.options.culture)},_focusin:function(){var e=this;e._inputWrapper.addClass(C),e._toggleText(!1),e.element[0].focus()},_focusout:function(){var e=this;clearTimeout(e._focusing),e._inputWrapper.removeClass(C).removeClass(S),e._blur()},_format:function(e,t){var n=this._culture(t).numberFormat;return e=e.toLowerCase(),e.indexOf("c")>-1?n=n.currency:e.indexOf("p")>-1&&(n=n.percent),n},_input:function(){var t,n=this,i="k-formatted-value",o=n.element.addClass(v).show()[0],r=o.accessKey,s=n.wrapper;t=s.find(A+i),t[0]||(t=e(' ').insertBefore(o).addClass(i));try{o.setAttribute("type","text")}catch(a){o.type="text"}t[0].tabIndex=o.tabIndex,t[0].style.cssText=o.style.cssText,t[0].title=o.title,t.prop("placeholder",n.options.placeholder),r&&(t.attr("accesskey",r),o.accessKey=""),n._text=t.addClass(o.className)},_keydown:function(e){var t=this,n=e.keyCode;t._key=n,n==r.DOWN?t._step(-1):n==r.UP?t._step(1):n==r.ENTER?t._change(t.element.val()):t._typing=!0},_keypress:function(e){var t,n,i,s,a,l,c,h,u,d,f;0===e.which||e.metaKey||e.ctrlKey||e.keyCode===r.BACKSPACE||e.keyCode===r.ENTER||(t=this,n=t.options.min,i=t.element,s=o(i),a=s[0],l=s[1],c=String.fromCharCode(e.which),h=t._format(t.options.format),u=t._key===r.NUMPAD_DOT,d=i.val(),u&&(c=h[A]),d=d.substring(0,a)+c+d.substring(l),f=t._numericRegex(h).test(d),f&&u?(i.val(d),o(i,a+c.length),e.preventDefault()):(null!==n&&n>=0&&"-"===d.charAt(0)||!f)&&e.preventDefault(),t._key=0)},_numericRegex:function(e){var t=this,n=e[A],i=t.options.decimals;return n===A&&(n="\\"+n),i===R&&(i=e.decimals),0===i?I:(t._separator!==n&&(t._separator=n,t._floatRegExp=RegExp("^(-)?(((\\d+("+n+"\\d*)?)|("+n+"\\d*)))?$")),t._floatRegExp)},_paste:function(e){var t=this,n=e.target,i=n.value;setTimeout(function(){t._parse(n.value)===R&&t._update(i)})},_option:function(e,n){var i=this,o=i.options;return n===t?o[e]:(n=i._parse(n),(n||"step"!==e)&&(o[e]=n,i.element.attr("aria-value"+e,n).attr(e,n)),t)},_spin:function(e,t){var n=this;t=t||500,clearTimeout(n._spinning),n._spinning=setTimeout(function(){n._spin(e,50)},t),n._step(e)},_step:function(e){var t=this,n=t.element,i=t._parse(n.val())||0;l()!=n[0]&&t._focusin(),i+=t.options.step*e,t._update(t._adjust(i)),t._typing=!1,t.trigger(_)},_toggleHover:function(t){e(t.currentTarget).toggleClass(S,"mouseenter"===t.type)},_toggleText:function(e){var t=this;t._text.toggle(e),t.element.toggle(!e)},_parse:function(e,t){return h(e,this._culture(t),this.options.format)},_update:function(e){var t,n=this,o=n.options,r=o.format,s=o.decimals,a=n._culture(),l=n._format(r,a);s===R&&(s=l.decimals),e=n._parse(e,a),t=e!==R,t&&(e=parseFloat(f(e,s))),n._value=e=n._adjust(e),n._placeholder(i.toString(e,r,a)),t?(e=""+e,-1!==e.indexOf("e")&&(e=f(+e,s)),e=e.replace(A,l[A])):e="",n.element.val(e).attr("aria-valuenow",e)},_placeholder:function(e){this._text.val(e),u||e||this._text.val(this.options.placeholder)},_wrapper:function(){var t,n=this,i=n.element,o=i[0];t=i.parents(".k-numerictextbox"),t.is("span.k-numerictextbox")||(t=i.hide().wrap(' ').parent(),t=t.wrap(" ").parent()),t[0].style.cssText=o.style.cssText,o.style.width="",n.wrapper=t.addClass("k-widget k-numerictextbox").addClass(o.className).css("display",""),n._inputWrapper=e(t[0].firstChild)},_reset:function(){var t=this,n=t.element,i=n.attr("form"),o=i?e("#"+i):n.closest("form");o[0]&&(t._resetHandler=function(){setTimeout(function(){t.value(n[0].value),t.max(t._initialOptions.max),t.min(t._initialOptions.min)})},t._form=o.on("reset",t._resetHandler))}});s.plugin(L)}(window.kendo.jQuery)}(),function(){!function(e){function t(t){var n,i=a.ui.validator.ruleResolvers||{},o={};for(n in i)e.extend(!0,o,i[n].resolve(t));return o}function n(e){return e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function i(e){return e=(e+"").split("."),e.length>1?e[1].length:0}function o(t){return e(e.parseHTML?e.parseHTML(t):t)}function r(t,n){var i,o,r,s,l=e();for(r=0,s=t.length;s>r;r++)i=t[r],u.test(i.className)&&(o=i.getAttribute(a.attr("for")),o===n&&(l=l.add(i)));return l}var s,a=window.kendo,l=a.ui.Widget,c=".kendoValidator",h="k-invalid-msg",u=RegExp(h,"i"),d="k-invalid",f="k-valid",p=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,g=/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,m=":input:not(:button,[type=submit],[type=reset],[disabled],[readonly])",v=":checkbox:not([disabled],[readonly])",_="[type=number],[type=range]",y="blur",w="name",b="form",x="novalidate",k=e.proxy,C=function(e,t){return"string"==typeof t&&(t=RegExp("^(?:"+t+")$")),t.test(e)},S=function(e,t,n){var i=e.val();return e.filter(t).length&&""!==i?C(i,n):!0},T=function(e,t){return e.length?null!=e[0].attributes[t]:!1};a.ui.validator||(a.ui.validator={rules:{},messages:{}}),s=l.extend({init:function(n,i){var o=this,r=t(n),s="["+a.attr("validate")+"!=false]";i=i||{},i.rules=e.extend({},a.ui.validator.rules,r.rules,i.rules),i.messages=e.extend({},a.ui.validator.messages,r.messages,i.messages),l.fn.init.call(o,n,i),o._errorTemplate=a.template(o.options.errorTemplate),o.element.is(b)&&o.element.attr(x,x),o._inputSelector=m+s,o._checkboxSelector=v+s,o._errors={},o._attachEvents(),o._isValidated=!1},events:["validate","change"],options:{name:"Validator",errorTemplate:' #=message# ',messages:{required:"{0} is required",pattern:"{0} is not valid",min:"{0} should be greater than or equal to {1}",max:"{0} should be smaller than or equal to {1}",step:"{0} is not valid",email:"{0} is not valid email",url:"{0} is not valid URL",date:"{0} is not valid date",dateCompare:"End date should be greater than or equal to the start date"},rules:{required:function(e){var t=e.filter("[type=checkbox]").length&&!e.is(":checked"),n=e.val();return!(T(e,"required")&&(""===n||!n||t))},pattern:function(e){return e.filter("[type=text],[type=email],[type=url],[type=tel],[type=search],[type=password]").filter("[pattern]").length&&""!==e.val()?C(e.val(),e.attr("pattern")):!0},min:function(e){if(e.filter(_+",["+a.attr("type")+"=number]").filter("[min]").length&&""!==e.val()){var t=parseFloat(e.attr("min"))||0,n=a.parseFloat(e.val());return n>=t}return!0},max:function(e){if(e.filter(_+",["+a.attr("type")+"=number]").filter("[max]").length&&""!==e.val()){var t=parseFloat(e.attr("max"))||0,n=a.parseFloat(e.val());return t>=n}return!0},step:function(e){if(e.filter(_+",["+a.attr("type")+"=number]").filter("[step]").length&&""!==e.val()){var t,n=parseFloat(e.attr("min"))||0,o=parseFloat(e.attr("step"))||1,r=parseFloat(e.val()),s=i(o);return s?(t=Math.pow(10,s),Math.floor((r-n)*t)%(o*t)/Math.pow(100,s)===0):(r-n)%o===0}return!0},email:function(e){return S(e,"[type=email],["+a.attr("type")+"=email]",p)},url:function(e){return S(e,"[type=url],["+a.attr("type")+"=url]",g)},date:function(e){return e.filter("[type^=date],["+a.attr("type")+"=date]").length&&""!==e.val()?null!==a.parseDate(e.val(),e.attr(a.attr("format"))):!0}},validateOnBlur:!0},destroy:function(){l.fn.destroy.call(this),this.element.off(c)},value:function(){return this._isValidated?0===this.errors().length:!1},_submit:function(e){return this.validate()?!0:(e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),!1)},_checkElement:function(e){var t=this.value();this.validateInput(e),this.value()!==t&&this.trigger("change")},_attachEvents:function(){var t=this;t.element.is(b)&&t.element.on("submit"+c,k(t._submit,t)),t.options.validateOnBlur&&(t.element.is(m)?(t.element.on(y+c,function(){t._checkElement(t.element)}),t.element.is(v)&&t.element.on("click"+c,function(){t._checkElement(t.element)})):(t.element.on(y+c,t._inputSelector,function(){t._checkElement(e(this))}),t.element.on("click"+c,t._checkboxSelector,function(){t._checkElement(e(this))})))},validate:function(){var e,t,n,i,o=!1,r=this.value();if(this._errors={},this.element.is(m))o=this.validateInput(this.element);else{for(i=!1,e=this.element.find(this._inputSelector),t=0,n=e.length;n>t;t++)this.validateInput(e.eq(t))||(i=!0);o=!i}return this.trigger("validate",{valid:o}),r!==o&&this.trigger("change"),o},validateInput:function(t){var i,r,s,l,c,u,p,g,m,v;return t=e(t),this._isValidated=!0,i=this,r=i._errorTemplate,s=i._checkValidity(t),l=s.valid,c="."+h,u=t.attr(w)||"",p=i._findMessageContainer(u).add(t.next(c).filter(function(){var t=e(this);return t.filter("["+a.attr("for")+"]").length?t.attr(a.attr("for"))===u:!0})).hide(),t.removeAttr("aria-invalid"),l?delete i._errors[u]:(g=i._extractMessage(t,s.key),i._errors[u]=g,m=o(r({message:n(g)})),v=p.attr("id"),i._decorateMessageContainer(m,u),v&&m.attr("id",v),p.replaceWith(m).length||m.insertAfter(t),m.show(),t.attr("aria-invalid",!0)),t.toggleClass(d,!l),t.toggleClass(f,l),l},hideMessages:function(){var e=this,t="."+h,n=e.element;n.is(m)?n.next(t).hide():n.find(t).hide()},_findMessageContainer:function(t){var n,i,o,s=a.ui.validator.messageLocators,l=e();for(i=0,o=this.element.length;o>i;i++)l=l.add(r(this.element[i].getElementsByTagName("*"),t));for(n in s)l=l.add(s[n].locate(this.element,t));return l},_decorateMessageContainer:function(e,t){var n,i=a.ui.validator.messageLocators;e.addClass(h).attr(a.attr("for"),t||"");for(n in i)i[n].decorate(e,t);e.attr("role","alert")},_extractMessage:function(e,t){var n=this,i=n.options.messages[t],o=e.attr(w);return i=a.isFunction(i)?i(e):i,a.format(e.attr(a.attr(t+"-msg"))||e.attr("validationMessage")||e.attr("title")||i||"",o,e.attr(t))},_checkValidity:function(e){var t,n=this.options.rules;for(t in n)if(!n[t].call(this,e))return{valid:!1,key:t};return{valid:!0}},errors:function(){var e,t=[],n=this._errors;for(e in n)t.push(n[e]);return t}}),a.ui.plugin(s)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(t){return t=null!=t?t:"",t.type||e.type(t)||"string"}function i(t){t.find(":input:not(:button, ["+a.attr("role")+"=upload], ["+a.attr("skip")+"], [type=file]), select").each(function(){var t=a.attr("bind"),n=this.getAttribute(t)||"",i="checkbox"===this.type||"radio"===this.type?"checked:":"value:",o=this.name;-1===n.indexOf(i)&&o&&(n+=(n.length?",":"")+i+o,e(this).attr(t,n))})}function o(e){var t,i,o=(e.model.fields||e.model)[e.field],r=n(o),s=o?o.validation:{},l=a.attr("type"),c=a.attr("bind"),h={name:e.field};for(t in s)i=s[t],p(t,_)>=0?h[l]=t:d(i)||(h[t]=f(i)?i.value||t:i),h[a.attr(t+"-msg")]=i.message;return p(r,_)>=0&&(h[l]=r),h[c]=("boolean"===r?"checked:":"value:")+e.field,h}function r(e){var t,n,i,o,r,s;if(e&&e.length)for(s=[],t=0,n=e.length;n>t;t++)i=e[t],r=i.text||i.value||i,o=null==i.value?i.text||i:i.value,s[t]={text:r,value:o};return s}function s(e,t){var n,i,o=e?e.validation||{}:{};for(n in o)i=o[n],f(i)&&i.value&&(i=i.value),d(i)&&(t[n]=i)}var a=window.kendo,l=a.ui,c=l.Widget,h=e.extend,u=a.support.browser.msie&&9>a.support.browser.version,d=a.isFunction,f=e.isPlainObject,p=e.inArray,g=/("|\%|'|\[|\]|\$|\.|\,|\:|\;|\+|\*|\&|\!|\#|\(|\)|<|>|\=|\?|\@|\^|\{|\}|\~|\/|\||`)/g,m='',v="change",_=["url","email","number","date","boolean"],y={number:function(t,n){var i=o(n);e(' ').attr(i).appendTo(t).kendoNumericTextBox({format:n.format}),e(" ').hide().appendTo(t)},date:function(t,n){var i=o(n),r=n.format;r&&(r=a._extractFormat(r)),i[a.attr("format")]=r,e(' ').attr(i).appendTo(t).kendoDatePicker({format:n.format}),e(" ').hide().appendTo(t)},string:function(t,n){var i=o(n);e(' ').attr(i).appendTo(t)},"boolean":function(t,n){var i=o(n);e(' ').attr(i).appendTo(t)},values:function(t,n){var i=o(n),s=a.stringify(r(n.values));e(" ').attr(i).appendTo(t),e(" ').hide().appendTo(t)}},w=c.extend({init:function(t,n){var i=this;n.target&&(n.$angular=n.target.options.$angular),c.fn.init.call(i,t,n),i._validateProxy=e.proxy(i._validate,i),i.refresh()},events:[v],options:{name:"Editable",editors:y,clearContainer:!0,errorTemplate:m},editor:function(e,t){var i=this,o=i.options.editors,r=f(e),s=r?e.field:e,l=i.options.model||{},c=r&&e.values,u=c?"values":n(t),d=r&&e.editor,p=d?e.editor:o[u],m=i.element.find("["+a.attr("container-for")+"="+s.replace(g,"\\$1")+"]");p=p?p:o.string,d&&"string"==typeof e.editor&&(p=function(t){t.append(e.editor)}),m=m.length?m:i.element,p(m,h(!0,{},r?e:{field:s},{model:l}))},_validate:function(t){var n,i=this,o=t.value,r=i._validationEventInProgress,s={},l=a.attr("bind"),c=t.field.replace(g,"\\$1"),h=RegExp("(value|checked)\\s*:\\s*"+c+"\\s*(,|$)");s[t.field]=t.value,n=e(":input["+l+'*="'+c+'"]',i.element).filter("["+a.attr("validate")+"!='false']").filter(function(){return h.test(e(this).attr(l))}),n.length>1&&(n=n.filter(function(){var t=e(this);return!t.is(":radio")||t.val()==o}));try{i._validationEventInProgress=!0,(!i.validatable.validateInput(n)||!r&&i.trigger(v,{values:s}))&&t.preventDefault()}finally{i._validationEventInProgress=!1}},end:function(){return this.validatable.validate()},destroy:function(){var e=this;e.angular("cleanup",function(){return{elements:e.element}}),c.fn.destroy.call(e),e.options.model.unbind("set",e._validateProxy),a.unbind(e.element),e.validatable&&e.validatable.destroy(),a.destroy(e.element),e.element.removeData("kendoValidator"),e.element.is("["+a.attr("role")+"=editable]")&&e.element.removeAttr(a.attr("role"))},refresh:function(){var n,o,r,l,c,h,d,p,g=this,m=g.options.fields||[],v=g.options.clearContainer?g.element.empty():g.element,_=g.options.model||{},y={};for(e.isArray(m)||(m=[m]),n=0,o=m.length;o>n;n++)r=m[n],l=f(r),c=l?r.field:r,h=(_.fields||_)[c],s(h,y),g.editor(r,h);if(g.options.target&&g.angular("compile",function(){return{elements:v,data:v.map(function(){return{dataItem:_}})}}),!o){d=_.fields||_;for(c in d)s(d[c],y)}i(v),g.validatable&&g.validatable.destroy(),a.bind(v,g.options.model),g.options.model.unbind("set",g._validateProxy),g.options.model.bind("set",g._validateProxy),g.validatable=new a.ui.Validator(v,{validateOnBlur:!1,errorTemplate:g.options.errorTemplate||t,rules:y}),p=v.find(":kendoFocusable").eq(0).focus(),u&&p.focus()}});l.plugin(w)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e){return t!==e}function i(e,t,n){return Math.max(Math.min(parseInt(e,10),n===1/0?n:parseInt(n,10)),parseInt(t,10))}function o(e,t){return function(){var n=this,i=n.wrapper,o=i[0].style,r=n.options;return r.isMaximized||r.isMinimized?n:(n.restoreOptions={width:o.width,height:o.height},i.children(k).hide().end().children(b).find(G).parent().hide().eq(0).before(J.action({name:"Restore"})),t.call(n),"maximize"==e?n.wrapper.children(b).find(Y).parent().hide():n.wrapper.children(b).find(Y).parent().show(),n)}}function r(){return!this.type||this.type.toLowerCase().indexOf("script")>=0}function s(e){var t=this;t.owner=e,t._draggable=new h(e.wrapper,{filter:">"+k,group:e.wrapper.id+"-resizing",dragstart:f(t.dragstart,t),drag:f(t.drag,t),dragend:f(t.dragend,t)}),t._draggable.userEvents.bind("press",f(t.addOverlay,t)),t._draggable.userEvents.bind("release",f(t.removeOverlay,t))}function a(e,t){var n=this;n.owner=e,n._draggable=new h(e.wrapper,{filter:t,group:e.wrapper.id+"-moving",dragstart:f(n.dragstart,n),drag:f(n.drag,n),dragend:f(n.dragend,n),dragcancel:f(n.dragcancel,n)}),n._draggable.userEvents.stopPropagation=!1}var l=window.kendo,c=l.ui.Widget,h=l.ui.Draggable,u=e.isPlainObject,d=l._activeElement,f=e.proxy,p=e.extend,g=e.each,m=l.template,v="body",_=".kendoWindow",y=".k-window",w=".k-window-title",b=w+"bar",x=".k-window-content",k=".k-resize-handle",C=".k-overlay",S="k-content-frame",T="k-loading",A="k-state-hover",D="k-state-focused",M="k-window-maximized",E=":visible",P="hidden",I="cursor",R="open",B="activate",z="deactivate",L="close",F="refresh",O="resize",N="resizeEnd",V="dragstart",H="dragend",U="error",j="overflow",W="zIndex",G=".k-window-actions .k-i-minimize,.k-window-actions .k-i-maximize",q=".k-i-pin",$=".k-i-unpin",Y=q+","+$,X=".k-window-titlebar .k-window-action",Q=".k-window-titlebar .k-i-refresh",K=l.isLocalUrl,Z=c.extend({init:function(i,o){var s,a,h,d,p,g,m,v=this,k={},C=!1,S=o&&o.actions&&!o.actions.length;c.fn.init.call(v,i,o),o=v.options,d=o.position,i=v.element,p=o.content,S&&(o.actions=[]),v.appendTo=e(o.appendTo),p&&!u(p)&&(p=o.content={url:p}),i.find("script").filter(r).remove(),i.parent().is(v.appendTo)||d.top!==t&&d.left!==t||(i.is(E)?(k=i.offset(),C=!0):(a=i.css("visibility"),h=i.css("display"),i.css({visibility:P,display:""}),k=i.offset(),i.css({visibility:a,display:h})),d.top===t&&(d.top=k.top),d.left===t&&(d.left=k.left)),n(o.visible)&&null!==o.visible||(o.visible=i.is(E)),s=v.wrapper=i.closest(y),i.is(".k-content")&&s[0]||(i.addClass("k-window-content k-content"),v._createWindow(i,o),s=v.wrapper=i.closest(y),v._dimensions()),v._position(),o.pinned&&v.pin(!0),p&&v.refresh(p),o.visible&&v.toFront(),g=s.children(x),v._tabindex(g),o.visible&&o.modal&&v._overlay(s.is(E)).css({opacity:.5}),s.on("mouseenter"+_,X,f(v._buttonEnter,v)).on("mouseleave"+_,X,f(v._buttonLeave,v)).on("click"+_,"> "+X,f(v._windowActionHandler,v)),g.on("keydown"+_,f(v._keydown,v)).on("focus"+_,f(v._focus,v)).on("blur"+_,f(v._blur,v)),this._resizable(),this._draggable(),m=i.attr("id"),m&&(m+="_wnd_title",s.children(b).children(w).attr("id",m),g.attr({role:"dialog","aria-labelledby":m})),s.add(s.children(".k-resize-handle,"+b)).on("mousedown"+_,f(v.toFront,v)),v.touchScroller=l.touchScroller(i),v._resizeHandler=f(v._onDocumentResize,v),v._marker=l.guid().substring(0,8),e(window).on("resize"+_+v._marker,v._resizeHandler),o.visible&&(v.trigger(R),v.trigger(B)),l.notify(v)},_buttonEnter:function(t){e(t.currentTarget).addClass(A)},_buttonLeave:function(t){e(t.currentTarget).removeClass(A)},_focus:function(){this.wrapper.addClass(D)},_blur:function(){this.wrapper.removeClass(D)},_dimensions:function(){var e,t,n=this.wrapper,o=this.options,r=o.width,s=o.height,a=o.maxHeight,l=["minWidth","minHeight","maxWidth","maxHeight"];for(this.title(o.title),e=0;l.length>e;e++)t=o[l[e]],t&&t!=1/0&&n.css(l[e],t);a&&a!=1/0&&this.element.css("maxHeight",a),r&&n.width((""+r).indexOf("%")>0?r:i(r,o.minWidth,o.maxWidth)),s&&n.height((""+s).indexOf("%")>0?s:i(s,o.minHeight,o.maxHeight)),o.visible||n.hide()},_position:function(){var e=this.wrapper,t=this.options.position;0===t.top&&(t.top=""+t.top),0===t.left&&(t.left=""+t.left),e.css({top:t.top||"",left:t.left||""})},_animationOptions:function(e){var t=this.options.animation,n={open:{effects:{}},close:{hide:!0,effects:{}}};return t&&t[e]||n[e]},_resize:function(){l.resize(this.element.children())},_resizable:function(){var t=this.options.resizable,n=this.wrapper;this.resizing&&(n.off("dblclick"+_).children(k).remove(),this.resizing.destroy(),this.resizing=null),t&&(n.on("dblclick"+_,b,f(function(t){e(t.target).closest(".k-window-action").length||this.toggleMaximization()},this)),g("n e s w se sw ne nw".split(" "),function(e,t){n.append(J.resizeHandle(t))}),this.resizing=new s(this)),n=null},_draggable:function(){var e=this.options.draggable;this.dragging&&(this.dragging.destroy(),this.dragging=null),e&&(this.dragging=new a(this,e.dragHandle||b))},_actions:function(){var t=this.options.actions,n=this.wrapper.children(b),i=n.find(".k-window-actions");t=e.map(t,function(e){return{name:e}}),i.html(l.render(J.action,t))},setOptions:function(e){var n,i;c.fn.setOptions.call(this,e),n=this.options.scrollable!==!1,this.restore(),this._dimensions(),this._position(),this._resizable(),this._draggable(),this._actions(),t!==e.modal&&(i=this.options.visible!==!1,this._overlay(e.modal&&i)),this.element.css(j,n?"":"hidden")},events:[R,B,z,L,F,O,N,V,H,U],options:{name:"Window",animation:{open:{effects:{zoom:{direction:"in"},fade:{direction:"in"}},duration:350},close:{effects:{zoom:{direction:"out",properties:{scale:.7}},fade:{direction:"out"}},duration:350,hide:!0}},title:"",actions:["Close"],autoFocus:!0,modal:!1,resizable:!0,draggable:!0,minWidth:90,minHeight:50,maxWidth:1/0,maxHeight:1/0,pinned:!1,scrollable:!0,position:{},content:null,visible:null,height:null,width:null,appendTo:"body"},_closable:function(){return e.inArray("close",e.map(this.options.actions,function(e){return e.toLowerCase()}))>-1},_keydown:function(e){var t,n,o,r,s,a,c=this,h=c.options,u=l.keys,d=e.keyCode,f=c.wrapper,p=10,g=c.options.isMaximized;e.target!=e.currentTarget||c._closing||(d==u.ESC&&c._closable()&&c._close(!1),!h.draggable||e.ctrlKey||g||(t=l.getOffset(f),d==u.UP?n=f.css("top",t.top-p):d==u.DOWN?n=f.css("top",t.top+p):d==u.LEFT?n=f.css("left",t.left-p):d==u.RIGHT&&(n=f.css("left",t.left+p))),h.resizable&&e.ctrlKey&&!g&&(d==u.UP?(n=!0,
r=f.height()-p):d==u.DOWN&&(n=!0,r=f.height()+p),d==u.LEFT?(n=!0,o=f.width()-p):d==u.RIGHT&&(n=!0,o=f.width()+p),n&&(s=i(o,h.minWidth,h.maxWidth),a=i(r,h.minHeight,h.maxHeight),isNaN(s)||(f.width(s),c.options.width=s+"px"),isNaN(a)||(f.height(a),c.options.height=a+"px"),c.resize())),n&&e.preventDefault())},_overlay:function(t){var n=this.appendTo.children(C),i=this.wrapper;return n.length||(n=e("
")),n.insertBefore(i[0]).toggle(t).css(W,parseInt(i.css(W),10)-1),n},_actionForIcon:function(e){var t=/\bk-i-\w+\b/.exec(e[0].className)[0];return{"k-i-close":"_close","k-i-maximize":"maximize","k-i-minimize":"minimize","k-i-restore":"restore","k-i-refresh":"refresh","k-i-pin":"pin","k-i-unpin":"unpin"}[t]},_windowActionHandler:function(n){var i,o;if(!this._closing)return i=e(n.target).closest(".k-window-action").find(".k-icon"),o=this._actionForIcon(i),o?(n.preventDefault(),this[o](),!1):t},_modals:function(){var t=this,n=e(y).filter(function(){var n=e(this),i=t._object(n),o=i&&i.options;return o&&o.modal&&o.visible&&o.appendTo===t.options.appendTo&&n.is(E)}).sort(function(t,n){return+e(t).css("zIndex")-+e(n).css("zIndex")});return t=null,n},_object:function(e){var n=e.children(x),i=l.widgetInstance(n);return i instanceof Z?i:t},center:function(){var t,n,i=this,o=i.options.position,r=i.wrapper,s=e(window),a=0,l=0;return i.options.isMaximized?i:(i.options.pinned||(a=s.scrollTop(),l=s.scrollLeft()),n=l+Math.max(0,(s.width()-r.width())/2),t=a+Math.max(0,(s.height()-r.height()-parseInt(r.css("paddingTop"),10))/2),r.css({left:n,top:t}),o.top=t,o.left=n,i)},title:function(e){var t,n=this,i=n.wrapper,o=n.options,r=i.children(b),s=r.children(w);return arguments.length?(e===!1?(i.addClass("k-window-titleless"),r.remove()):(r.length?s.html(e):(i.prepend(J.titlebar(o)),n._actions(),r=i.children(b)),t=r.outerHeight(),i.css("padding-top",t),r.css("margin-top",-t)),n.options.title=e,n):s.text()},content:function(e,t){var i=this.wrapper.children(x),o=i.children(".km-scroll-container");return i=o[0]?o:i,n(e)?(this.angular("cleanup",function(){return{elements:i.children()}}),l.destroy(this.element.children()),i.empty().html(e),this.angular("compile",function(){var e,n=[];for(e=i.length;--e>=0;)n.push({dataItem:t});return{elements:i.children(),data:n}}),this):i.html()},open:function(){var t,n,i=this,o=i.wrapper,r=i.options,s=this._animationOptions("open"),a=o.children(x),c=e(document);return i.trigger(R)||(i._closing&&o.kendoStop(!0,!0),i._closing=!1,i.toFront(),r.autoFocus&&i.element.focus(),r.visible=!0,r.modal&&(t=i._overlay(!1),t.kendoStop(!0,!0),s.duration&&l.effects.Fade?(n=l.fx(t).fadeIn(),n.duration(s.duration||0),n.endValue(.5),n.play()):t.css("opacity",.5),t.show()),o.is(E)||(a.css(j,P),o.show().kendoStop().kendoAnimate({effects:s.effects,duration:s.duration,complete:f(this._activate,this)}))),r.isMaximized&&(i._documentScrollTop=c.scrollTop(),i._documentScrollLeft=c.scrollLeft(),e("html, body").css(j,P)),i},_activate:function(){var e=this.options.scrollable!==!1;this.options.autoFocus&&this.element.focus(),this.element.css(j,e?"":"hidden"),this.trigger(B)},_removeOverlay:function(n){var i,o=this._modals(),r=this.options,s=r.modal&&!o.length,a=r.modal?this._overlay(!0):e(t),c=this._animationOptions("close");s?!n&&c.duration&&l.effects.Fade?(i=l.fx(a).fadeOut(),i.duration(c.duration||0),i.startValue(.5),i.play()):this._overlay(!1).remove():o.length&&this._object(o.last())._overlay(!0)},_close:function(t){var n=this,i=n.wrapper,o=n.options,r=this._animationOptions("open"),s=this._animationOptions("close"),a=e(document);if(i.is(E)&&!n.trigger(L,{userTriggered:!t})){if(n._closing)return;n._closing=!0,o.visible=!1,e(y).each(function(t,n){var o=e(n).children(x);n!=i&&o.find("> ."+S).length>0&&o.children(C).remove()}),this._removeOverlay(),i.kendoStop().kendoAnimate({effects:s.effects||r.effects,reverse:s.reverse===!0,duration:s.duration,complete:f(this._deactivate,this)})}n.options.isMaximized&&(e("html, body").css(j,""),n._documentScrollTop&&n._documentScrollTop>0&&a.scrollTop(n._documentScrollTop),n._documentScrollLeft&&n._documentScrollLeft>0&&a.scrollLeft(n._documentScrollLeft))},_deactivate:function(){var e,t=this;t.wrapper.hide().css("opacity",""),t.trigger(z),t.options.modal&&(e=t._object(t._modals().last()),e&&e.toFront())},close:function(){return this._close(!0),this},_actionable:function(t){return e(t).is(X+","+X+" .k-icon,:input,a")},_shouldFocus:function(t){var n=d(),i=this.element;return this.options.autoFocus&&!e(n).is(i)&&!this._actionable(t)&&(!i.find(n).length||!i.find(t).length)},toFront:function(t){var n,i,o=this,r=o.wrapper,s=r[0],a=+r.css(W),l=a,c=t&&t.target||null;return e(y).each(function(t,n){var i=e(n),o=i.css(W),r=i.children(x);isNaN(o)||(a=Math.max(+o,a)),n!=s&&r.find("> ."+S).length>0&&r.append(J.overlay)}),(!r[0].style.zIndex||a>l)&&r.css(W,a+2),o.element.find("> .k-overlay").remove(),o._shouldFocus(c)&&(o.element.focus(),n=e(window).scrollTop(),i=parseInt(r.position().top,10),i>0&&n>i&&(n>0?e(window).scrollTop(i):r.css("top",n))),r=null,o},toggleMaximization:function(){return this._closing?this:this[this.options.isMaximized?"restore":"maximize"]()},restore:function(){var t=this,n=t.options,i=n.minHeight,o=t.restoreOptions,r=e(document);return n.isMaximized||n.isMinimized?(i&&i!=1/0&&t.wrapper.css("min-height",i),t.wrapper.css({position:n.pinned?"fixed":"absolute",left:o.left,top:o.top,width:o.width,height:o.height}).removeClass(M).find(".k-window-content,.k-resize-handle").show().end().find(".k-window-titlebar .k-i-restore").parent().remove().end().end().find(G).parent().show().end().end().find(Y).parent().show(),t.options.width=o.width,t.options.height=o.height,e("html, body").css(j,""),this._documentScrollTop&&this._documentScrollTop>0&&r.scrollTop(this._documentScrollTop),this._documentScrollLeft&&this._documentScrollLeft>0&&r.scrollLeft(this._documentScrollLeft),n.isMaximized=n.isMinimized=!1,t.resize(),t):t},maximize:o("maximize",function(){var t=this,n=t.wrapper,i=n.position(),o=e(document);p(t.restoreOptions,{left:i.left,top:i.top}),n.css({left:0,top:0,position:"fixed"}).addClass(M),this._documentScrollTop=o.scrollTop(),this._documentScrollLeft=o.scrollLeft(),e("html, body").css(j,P),t.options.isMaximized=!0,t._onDocumentResize()}),minimize:o("minimize",function(){var e=this;e.wrapper.css({height:"",minHeight:""}),e.element.hide(),e.options.isMinimized=!0}),pin:function(t){var n=this,i=e(window),o=n.wrapper,r=parseInt(o.css("top"),10),s=parseInt(o.css("left"),10);(t||!n.options.pinned&&!n.options.isMaximized)&&(o.css({position:"fixed",top:r-i.scrollTop(),left:s-i.scrollLeft()}),o.children(b).find(q).addClass("k-i-unpin").removeClass("k-i-pin"),n.options.pinned=!0)},unpin:function(){var t=this,n=e(window),i=t.wrapper,o=parseInt(i.css("top"),10),r=parseInt(i.css("left"),10);t.options.pinned&&!t.options.isMaximized&&(i.css({position:"",top:o+n.scrollTop(),left:r+n.scrollLeft()}),i.children(b).find($).addClass("k-i-pin").removeClass("k-i-unpin"),t.options.pinned=!1)},_onDocumentResize:function(){var t,n,i=this,o=i.wrapper,r=e(window),s=l.support.zoomLevel();i.options.isMaximized&&(t=r.width()/s,n=r.height()/s-parseInt(o.css("padding-top"),10),o.css({width:t,height:n}),i.options.width=t,i.options.height=n,i.resize())},refresh:function(t){var i,o,r,s=this,a=s.options,l=e(s.element);return u(t)||(t={url:t}),t=p({},a.content,t),o=n(a.iframe)?a.iframe:t.iframe,r=t.url,r?(n(o)||(o=!K(r)),o?(i=l.find("."+S)[0],i?i.src=r||i.src:l.html(J.contentFrame(p({},a,{content:t}))),l.find("."+S).unbind("load"+_).on("load"+_,f(this._triggerRefresh,this))):s._ajaxRequest(t)):(t.template&&s.content(m(t.template)({})),s.trigger(F)),l.toggleClass("k-window-iframecontent",!!o),s},_triggerRefresh:function(){this.trigger(F)},_ajaxComplete:function(){clearTimeout(this._loadingIconTimeout),this.wrapper.find(Q).removeClass(T)},_ajaxError:function(e,t){this.trigger(U,{status:t,xhr:e})},_ajaxSuccess:function(e){return function(t){var n=t;e&&(n=m(e)(t||{})),this.content(n,t),this.element.prop("scrollTop",0),this.trigger(F)}},_showLoading:function(){this.wrapper.find(Q).addClass(T)},_ajaxRequest:function(t){this._loadingIconTimeout=setTimeout(f(this._showLoading,this),100),e.ajax(p({type:"GET",dataType:"html",cache:!1,error:f(this._ajaxError,this),complete:f(this._ajaxComplete,this),success:f(this._ajaxSuccess(t.template),this)},t))},_destroy:function(){this.resizing&&this.resizing.destroy(),this.dragging&&this.dragging.destroy(),this.wrapper.off(_).children(x).off(_).end().find(".k-resize-handle,.k-window-titlebar").off(_),e(window).off("resize"+_+this._marker),clearTimeout(this._loadingIconTimeout),c.fn.destroy.call(this),this.unbind(t),l.destroy(this.wrapper),this._removeOverlay(!0)},destroy:function(){this._destroy(),this.wrapper.empty().remove(),this.wrapper=this.appendTo=this.element=e()},_createWindow:function(){var t,n,i=this.element,o=this.options,r=l.support.isRtl(i);o.scrollable===!1&&i.attr("style","overflow:hidden;"),n=e(J.wrapper(o)),t=i.find("iframe:not(.k-content)").map(function(){var e=this.getAttribute("src");return this.src="",e}),n.toggleClass("k-rtl",r).appendTo(this.appendTo).append(i).find("iframe:not(.k-content)").each(function(e){this.src=t[e]}),n.find(".k-window-title").css(r?"left":"right",n.find(".k-window-actions").outerWidth()+10),i.css("visibility","").show(),i.find("[data-role=editor]").each(function(){var t=e(this).data("kendoEditor");t&&t.refresh()}),n=i=null}}),J={wrapper:m("
"),action:m("#= name # "),titlebar:m(""),overlay:"
",contentFrame:m(""),resizeHandle:m("
")};s.prototype={addOverlay:function(){this.owner.wrapper.append(J.overlay)},removeOverlay:function(){this.owner.wrapper.find(C).remove()},dragstart:function(t){var n=this,i=n.owner,o=i.wrapper;n.elementPadding=parseInt(o.css("padding-top"),10),n.initialPosition=l.getOffset(o,"position"),n.resizeDirection=t.currentTarget.prop("className").replace("k-resize-handle k-resize-",""),n.initialSize={width:o.width(),height:o.height()},n.containerOffset=l.getOffset(i.appendTo,"position"),o.children(k).not(t.currentTarget).hide(),e(v).css(I,t.currentTarget.css(I))},drag:function(e){var t,n,o,r,s=this,a=s.owner,l=a.wrapper,c=a.options,h=s.resizeDirection,u=s.containerOffset,d=s.initialPosition,f=s.initialSize,p=Math.max(e.x.location,u.left),g=Math.max(e.y.location,u.top);h.indexOf("e")>=0?(t=p-d.left,l.width(i(t,c.minWidth,c.maxWidth))):h.indexOf("w")>=0&&(r=d.left+f.width,t=i(r-p,c.minWidth,c.maxWidth),l.css({left:r-t-u.left,width:t})),h.indexOf("s")>=0?(n=g-d.top-s.elementPadding,l.height(i(n,c.minHeight,c.maxHeight))):h.indexOf("n")>=0&&(o=d.top+f.height,n=i(o-g,c.minHeight,c.maxHeight),l.css({top:o-n-u.top,height:n})),t&&(a.options.width=t+"px"),n&&(a.options.height=n+"px"),a.resize()},dragend:function(t){var n=this,i=n.owner,o=i.wrapper;return o.children(k).not(t.currentTarget).show(),e(v).css(I,""),i.touchScroller&&i.touchScroller.reset(),27==t.keyCode&&o.css(n.initialPosition).css(n.initialSize),i.trigger(N),!1},destroy:function(){this._draggable&&this._draggable.destroy(),this._draggable=this.owner=null}},a.prototype={dragstart:function(t){var n=this.owner,i=n.element,o=i.find(".k-window-actions"),r=l.getOffset(n.appendTo);n.trigger(V),n.initialWindowPosition=l.getOffset(n.wrapper,"position"),n.startPosition={left:t.x.client-n.initialWindowPosition.left,top:t.y.client-n.initialWindowPosition.top},n.minLeftPosition=o.length>0?o.outerWidth()+parseInt(o.css("right"),10)-i.outerWidth():20-i.outerWidth(),n.minLeftPosition-=r.left,n.minTopPosition=-r.top,n.wrapper.append(J.overlay).children(k).hide(),e(v).css(I,t.currentTarget.css(I))},drag:function(t){var n=this.owner,i=n.options.position,o=Math.max(t.y.client-n.startPosition.top,n.minTopPosition),r=Math.max(t.x.client-n.startPosition.left,n.minLeftPosition),s={left:r,top:o};e(n.wrapper).css(s),i.top=o,i.left=r},_finishDrag:function(){var t=this.owner;t.wrapper.children(k).toggle(!t.options.isMinimized).end().find(C).remove(),e(v).css(I,"")},dragcancel:function(e){this._finishDrag(),e.currentTarget.closest(y).css(this.owner.initialWindowPosition)},dragend:function(){return this._finishDrag(),this.owner.trigger(H),!1},destroy:function(){this._draggable&&this._draggable.destroy(),this._draggable=this.owner=null}},l.ui.plugin(Z)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t){var n,i,o,r=t.length,s=[];for(i=0;e.length>i;i++)for(n=e[i],o=0;r>o;o++)n===t[o]&&s.push({index:i,item:n});return s}function i(t,n){var o,r=!1;return t.filters&&(o=e.grep(t.filters,function(e){return r=i(e,n),e.filters?e.filters.length:e.field!=n}),r||t.filters.length===o.length||(r=!0),t.filters=o),r}var o,r,s=window.kendo,a=s.ui,l=a.Widget,c=s.keys,h=s.support,u=s.htmlEncode,d=s._activeElement,f=s.data.ObservableArray,p="id",g="change",m="k-state-focused",v="k-state-hover",_="k-loading",y="open",w="close",b="select",x="selected",k="requestStart",C="requestEnd",S="width",T=e.extend,A=e.proxy,D=e.isArray,M=h.browser,E=M.msie&&9>M.version,P=/"/g,I={ComboBox:"DropDownList",DropDownList:"ComboBox"},R=s.ui.DataBoundWidget.extend({init:function(t,n){var i,o=this,r=o.ns;l.fn.init.call(o,t,n),t=o.element,n=o.options,o._isSelect=t.is(b),o._isSelect&&o.element[0].length&&(n.dataSource||(n.dataTextField=n.dataTextField||"text",n.dataValueField=n.dataValueField||"value")),o.ul=e('').attr({tabIndex:-1,"aria-hidden":!0}),o.list=e("
").append(o.ul).on("mousedown"+r,A(o._listMousedown,o)),i=t.attr(p),i&&(o.list.attr(p,i+"-list"),o.ul.attr(p,i+"_listbox")),o._header(),o._accessors(),o._initValue()},options:{valuePrimitive:!1,headerTemplate:""},setOptions:function(e){l.fn.setOptions.call(this,e),e&&e.enable!==t&&(e.enabled=e.enable)},focus:function(){this._focused.focus()},readonly:function(e){this._editable({readonly:e===t?!0:e,disable:!1})},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t?!0:e)})},_listOptions:function(e){var t=this.options;return e=e||{},e={height:e.height||t.height,dataValueField:e.dataValueField||t.dataValueField,dataTextField:e.dataTextField||t.dataTextField,groupTemplate:e.groupTemplate||t.groupTemplate,fixedGroupTemplate:e.fixedGroupTemplate||t.fixedGroupTemplate,template:e.template||t.template},e.template||(e.template="#:"+s.expr(e.dataTextField,"data")+"#"),e},_initList:function(){var n=this,i=n.options,o=i.virtual,r=!!o,a=i.value,l=A(n._listBound,n),c={autoBind:!1,selectable:!0,dataSource:n.dataSource,click:A(n._click,n),change:A(n._listChange,n),activate:A(n._activateItem,n),deactivate:A(n._deactivateItem,n),dataBinding:function(){n.trigger("dataBinding"),n._angularItems("cleanup")},dataBound:l,listBound:l,selectedItemChange:A(n._listChange,n)};c=e.extend(n._listOptions(),c,"object"==typeof o?o:{}),n.listView=r?new s.ui.VirtualList(n.ul,c):new s.ui.StaticList(n.ul,c),a!==t&&n.listView.value(a).done(function(){var e=i.text;!n.listView.filter()&&n.input&&(-1===n.selectedIndex?((e===t||null===e)&&(e=a),n._accessor(a),n.input.val(e),n._placeholder()):-1===n._oldIndex&&(n._oldIndex=n.selectedIndex))})},_listMousedown:function(e){this.filterInput&&this.filterInput[0]===e.target||e.preventDefault()},_filterSource:function(e,t){var n=this,o=n.options,r=n.dataSource,s=T({},r.filter()||{}),a=i(s,o.dataTextField);(e||a)&&n.trigger("filtering",{filter:e})||(s={filters:s.filters||[],logic:"and"},e&&s.filters.push(e),t?r.read({filter:s}):r.filter(s))},_header:function(){var t,n=this,i=n.options.headerTemplate;e.isFunction(i)&&(i=i({})),i&&(n.list.prepend(i),t=n.ul.prev(),n.header=t[0]?t:null,n.header&&n.angular("compile",function(){return{elements:n.header}}))},_initValue:function(){var e=this,t=e.options.value;null!==t?e.element.val(t):(t=e._accessor(),e.options.value=t),e._old=t},_ignoreCase:function(){var e,t=this,n=t.dataSource.reader.model;n&&n.fields&&(e=n.fields[t.options.dataTextField],e&&e.type&&"string"!==e.type&&(t.options.ignoreCase=!1))},_focus:function(e){return this.listView.focus(e)},current:function(e){return this._focus(e)},items:function(){return this.ul[0].children},destroy:function(){var e=this,t=e.ns;l.fn.destroy.call(e),e._unbindDataSource(),e.listView.destroy(),e.list.off(t),e.popup.destroy(),e._form&&e._form.off("reset",e._resetHandler)},dataItem:function(n){var i=this;if(n===t)return i.listView.selectedDataItems()[0];if("number"!=typeof n){if(i.options.virtual)return i.dataSource.getByUid(e(n).data("uid"));n=e(i.items()).index(n)}return i.dataSource.flatView()[n]},_activateItem:function(){var e=this.listView.focus();e&&this._focused.add(this.filterInput).attr("aria-activedescendant",e.attr("id"))},_deactivateItem:function(){this._focused.add(this.filterInput).removeAttr("aria-activedescendant")},_accessors:function(){var e=this,t=e.element,n=e.options,i=s.getter,o=t.attr(s.attr("text-field")),r=t.attr(s.attr("value-field"));!n.dataTextField&&o&&(n.dataTextField=o),!n.dataValueField&&r&&(n.dataValueField=r),e._text=i(n.dataTextField),e._value=i(n.dataValueField)},_aria:function(e){var n=this,i=n.options,o=n._focused.add(n.filterInput);i.suggest!==t&&o.attr("aria-autocomplete",i.suggest?"both":"list"),e=e?e+" "+n.ul[0].id:n.ul[0].id,o.attr("aria-owns",e),n.ul.attr("aria-live",i.filter&&"none"!==i.filter?"polite":"off")},_blur:function(){var e=this;e._change(),e.close()},_change:function(){var e,n=this,i=n.selectedIndex,o=n.options.value,r=n.value();n._isSelect&&!n.listView.isBound()&&o&&(r=o),r!==n._old?e=!0:i!==t&&i!==n._oldIndex&&(e=!0),e&&(n._old=r,n._oldIndex=i,n._typing||n.element.trigger(g),n.trigger(g)),n.typing=!1},_data:function(){return this.dataSource.view()},_enable:function(){var e=this,n=e.options,i=e.element.is("[disabled]");n.enable!==t&&(n.enabled=n.enable),!n.enabled||i?e.enable(!1):e.readonly(e.element.is("[readonly]"))},_dataValue:function(e){var n=this._value(e);return n===t&&(n=this._text(e)),n},_offsetHeight:function(){var t=0,n=this.listView.content.prevAll(":visible");return n.each(function(){var n=e(this);t+=n.hasClass("k-list-filter")?n.children().outerHeight():n.outerHeight()}),t},_height:function(e){var t,n,i=this,o=i.list,r=i.options.height,s=i.popup.visible();return e&&(n=o.add(o.parent(".k-animation-container")).show(),r=i.listView.content[0].scrollHeight>r?r:"auto",n.height(r),"auto"!==r&&(t=i._offsetHeight(),t&&(r-=t)),i.listView.content.height(r),s||n.hide()),r},_adjustListWidth:function(){var e,t,n=this.list,i=n[0].style.width,o=this.wrapper;if(n.data(S)||!i)return e=window.getComputedStyle?window.getComputedStyle(o[0],null):0,t=e?parseFloat(e.width):o.outerWidth(),e&&M.msie&&(t+=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)),i="border-box"!==n.css("box-sizing")?t-(n.outerWidth()-n.width()):t,n.css({fontFamily:o.css("font-family"),width:i}).data(S,i),!0},_openHandler:function(e){this._adjustListWidth(),this.trigger(y)?e.preventDefault():(this._focused.attr("aria-expanded",!0),this.ul.attr("aria-hidden",!1))},_closeHandler:function(e){this.trigger(w)?e.preventDefault():(this._focused.attr("aria-expanded",!1),this.ul.attr("aria-hidden",!0))},_focusItem:function(){var e=this.listView,n=e.focus(),i=e.select();i=i[i.length-1],i===t&&this.options.highlightFirst&&!n&&(i=0),i!==t?e.focus(i):e.scrollToIndex(0)},_calculateGroupPadding:function(e){var t=this.ul.children(".k-first:first"),n=this.listView.content.prev(".k-group-header"),i=0;n[0]&&"none"!==n[0].style.display&&("auto"!==e&&(i=s.support.scrollbar()),i+=parseFloat(t.css("border-right-width"),10)+parseFloat(t.children(".k-group").css("padding-right"),10),n.css("padding-right",i))},_firstOpen:function(){var e=this._height(this.dataSource.flatView().length);this._calculateGroupPadding(e)},_popup:function(){var e=this;e.popup=new a.Popup(e.list,T({},e.options.popup,{anchor:e.wrapper,open:A(e._openHandler,e),close:A(e._closeHandler,e),animation:e.options.animation,isRtl:h.isRtl(e.wrapper)})),e.options.virtual||e.popup.one(y,A(e._firstOpen,e))},_makeUnselectable:function(){E&&this.list.find("*").not(".k-textbox").attr("unselectable","on")},_toggleHover:function(t){e(t.currentTarget).toggleClass(v,"mouseenter"===t.type)},_toggle:function(e,n){var i=this,o=h.mobileOS&&(h.touch||h.MSPointers||h.pointers);e=e!==t?e:!i.popup.visible(),n||o||i._focused[0]===d()||(i._prevent=!0,i._focused.focus(),i._prevent=!1),i[e?y:w]()},_triggerCascade:function(){var e=this;e._cascadeTriggered&&e._old===e.value()&&e._oldIndex===e.selectedIndex||(e._cascadeTriggered=!0,e.trigger("cascade",{userTriggered:e._userTriggered}))},_unbindDataSource:function(){var e=this;e.dataSource.unbind(k,e._requestStartHandler).unbind(C,e._requestEndHandler).unbind("error",e._errorHandler)}});T(R,{inArray:function(e,t){var n,i,o=t.children;if(!e||e.parentNode!==t)return-1;for(n=0,i=o.length;i>n;n++)if(e===o[n])return n;return-1}}),s.ui.List=R,a.Select=R.extend({init:function(e,t){R.fn.init.call(this,e,t),this._initial=this.element.val()},setDataSource:function(e){var t,n=this;n.options.dataSource=e,n._dataSource(),n.listView.setDataSource(n.dataSource),n.options.autoBind&&n.dataSource.fetch(),t=n._parentWidget(),t&&n._cascadeSelect(t)},close:function(){this.popup.close()},select:function(e){var n=this;return e===t?n.selectedIndex:(n._select(e),n._old=n._accessor(),n._oldIndex=n.selectedIndex,t)},search:function(e){var t,n,i,o,r,s;e="string"==typeof e?e:this.text(),t=this,n=e.length,i=t.options,o=i.ignoreCase,r=i.filter,s=i.dataTextField,clearTimeout(t._typingTimeout),(!n||n>=i.minLength)&&(t._state="filter",t.listView.filter(!0),"none"===r?t._filter(e):(t._open=!0,t._filterSource({value:o?e.toLowerCase():e,field:s,operator:r,ignoreCase:o})))},_accessor:function(e,t){return this[this._isSelect?"_accessorSelect":"_accessorInput"](e,t)},_accessorInput:function(e){var n=this.element[0];return e===t?n.value:(null===e&&(e=""),n.value=e,t)},_accessorSelect:function(e,n){var i,o=this.element[0],r=o.selectedIndex;return e===t?(r>-1&&(i=o.options[r]),i&&(e=i.value),e||""):(r>-1&&o.options[r].removeAttribute(x),n===t&&(n=-1),null!==e&&""!==e&&-1==n?this._custom(e):(e?o.value=e:o.selectedIndex=n,o.selectedIndex>-1&&(i=o.options[o.selectedIndex]),i&&i.setAttribute(x,x)),t)},_custom:function(t){var n=this,i=n.element,o=n._customOption;o||(o=e(" "),n._customOption=o,i.append(o)),o.text(t),o[0].setAttribute(x,x),o[0].selected=!0},_hideBusy:function(){var e=this;clearTimeout(e._busy),e._arrow.removeClass(_),e._focused.attr("aria-busy",!1),e._busy=null},_showBusy:function(){var e=this;e._request=!0,e._busy||(e._busy=setTimeout(function(){e._arrow&&(e._focused.attr("aria-busy",!0),e._arrow.addClass(_))},100))},_requestEnd:function(){this._request=!1,this._hideBusy()},_dataSource:function(){var t,n=this,i=n.element,o=n.options,r=o.dataSource||{};r=e.isArray(r)?{data:r}:r,n._isSelect&&(t=i[0].selectedIndex,t>-1&&(o.index=t),r.select=i,r.fields=[{field:o.dataTextField},{field:o.dataValueField}]),n.dataSource?n._unbindDataSource():(n._requestStartHandler=A(n._showBusy,n),n._requestEndHandler=A(n._requestEnd,n),n._errorHandler=A(n._hideBusy,n)),n.dataSource=s.data.DataSource.create(r).bind(k,n._requestStartHandler).bind(C,n._requestEndHandler).bind("error",n._errorHandler)},_firstItem:function(){this.listView.focusFirst()},_lastItem:function(){this.listView.focusLast()},_nextItem:function(){this.listView.focusNext()},_prevItem:function(){this.listView.focusPrev()},_move:function(e){var n,i,o,r,s=this,a=e.keyCode,l=a===c.DOWN;if(a===c.UP||l){if(e.altKey)s.toggle(l);else{if(!s.listView.isBound())return s._fetch||(s.dataSource.one(g,function(){s._fetch=!1,s._move(e)}),s._fetch=!0,s._filterSource()),e.preventDefault(),!0;if(o=s._focus(),s._fetch||o&&!o.hasClass("k-state-selected")||(l?(s._nextItem(),s._focus()||s._lastItem()):(s._prevItem(),s._focus()||s._firstItem())),s.trigger(b,{item:s.listView.focus()}))return s._focus(o),t;s._select(s._focus(),!0),s.popup.visible()||s._blur()}e.preventDefault(),i=!0}else if(a===c.ENTER||a===c.TAB){if(s.popup.visible()&&e.preventDefault(),o=s._focus(),n=s.dataItem(),s.popup.visible()||n&&s.text()===s._text(n)||(o=null),r=s.filterInput&&s.filterInput[0]===d(),o){if(s.trigger(b,{item:o}))return;s._select(o)}else s.input&&(s._accessor(s.input.val()),s.listView.value(s.input.val()));s._focusElement&&s._focusElement(s.wrapper),r&&a===c.TAB?s.wrapper.focusout():s._blur(),s.close(),i=!0}else a===c.ESC&&(s.popup.visible()&&e.preventDefault(),s.close(),i=!0);return i},_fetchData:function(){var e=this,t=!!e.dataSource.view().length;e._request||e.options.cascadeFrom||e.listView.isBound()||e._fetch||t||(e._fetch=!0,e.dataSource.fetch().done(function(){e._fetch=!1}))},_options:function(e,n,i){var o,r,s,a,l=this,c=l.element,h=e.length,d="",f=0;for(n&&(d=n);h>f;f++)o="",s!==t&&(o+=u(s)),o+=" ",d+=o;c.html(d),i!==t&&(c[0].value=i,c[0].value&&!i&&(c[0].selectedIndex=-1))},_reset:function(){var t=this,n=t.element,i=n.attr("form"),o=i?e("#"+i):n.closest("form");o[0]&&(t._resetHandler=function(){setTimeout(function(){t.value(t._initial)})},t._form=o.on("reset",t._resetHandler))},_parentWidget:function(){var t=this.options.name,n=e("#"+this.options.cascadeFrom),i=n.data("kendo"+t);return i||(i=n.data("kendo"+I[t])),i},_cascade:function(){var e,t=this,n=t.options,i=n.cascadeFrom;if(i){if(e=t._parentWidget(),!e)return;n.autoBind=!1,e.first("cascade",function(n){t._userTriggered=n.userTriggered,t.listView.isBound()&&t._clearSelection(e,!0),t._cascadeSelect(e)}),e.listView.isBound()?t._cascadeSelect(e):e.value()||t.enable(!1)}},_cascadeChange:function(e){var t=this,n=t._accessor();t._userTriggered?t._clearSelection(e,!0):n?(n!==t.listView.value()[0]&&t.value(n),t.dataSource.view()[0]&&-1!==t.selectedIndex||t._clearSelection(e,!0)):t.dataSource.flatView().length&&t.select(t.options.index),t.enable(),t._triggerCascade(),t._userTriggered=!1},_cascadeSelect:function(e){var t,n,o,r=this,s=e.dataItem(),a=s?e._value(s):null,l=r.options.cascadeFromField||e.options.dataValueField;a||0===a?(t=r.dataSource.filter()||{},i(t,l),n=t.filters||[],n.push({field:l,operator:"eq",value:a}),o=function(){r.unbind("dataBound",o),r._cascadeChange(e)},r.first("dataBound",o),r.dataSource.filter(n)):(r.enable(!1),r._clearSelection(e),r._triggerCascade(),r._userTriggered=!1)}}),o=".StaticList",r=s.ui.DataBoundWidget.extend({init:function(t,n){l.fn.init.call(this,t,n),this.element.attr("role","listbox").on("click"+o,"li",A(this._click,this)).on("mouseenter"+o,"li",function(){e(this).addClass(v)}).on("mouseleave"+o,"li",function(){e(this).removeClass(v)}),this.content=this.element.wrap("
").parent().css({overflow:"auto",position:"relative"}),this.header=this.content.before('').prev(),this._bound=!1,this._optionID=s.guid(),this._selectedIndices=[],this._view=[],this._dataItems=[],this._values=[];var i=this.options.value;i&&(this._values=e.isArray(i)?i.slice(0):[i]),this._getter(),this._templates(),this.setDataSource(this.options.dataSource),this._onScroll=A(function(){var e=this;clearTimeout(e._scrollId),e._scrollId=setTimeout(function(){e._renderHeader()},50)},this)},options:{name:"StaticList",dataValueField:null,valuePrimitive:!1,selectable:!0,template:null,groupTemplate:null,fixedGroupTemplate:null},events:["click","change","activate","deactivate","dataBinding","dataBound","selectedItemChange"],setDataSource:function(t){var n,i=this,o=t||{};o=e.isArray(o)?{data:o}:o,o=s.data.DataSource.create(o),i.dataSource?(i.dataSource.unbind(g,i._refreshHandler),n=i.value(),i.value([]),i._bound=!1,i.value(n)):i._refreshHandler=A(i.refresh,i),i.dataSource=o.bind(g,i._refreshHandler),i._fixedHeader()},setOptions:function(e){l.fn.setOptions.call(this,e),this._getter(),this._templates(),this._render()},destroy:function(){this.element.off(o),this._refreshHandler&&this.dataSource.unbind(g,this._refreshHandler),clearTimeout(this._scrollId),l.fn.destroy.call(this)},scrollToIndex:function(e){var t=this.element[0].children[e];t&&this.scroll(t)},scroll:function(e){if(e){e[0]&&(e=e[0]);var t=this.content[0],n=e.offsetTop,i=e.offsetHeight,o=t.scrollTop,r=t.clientHeight,s=n+i;o>n?o=n:s>o+r&&(o=s-r),t.scrollTop=o}},selectedDataItems:function(n){var i=this._valueGetter;return n===t?this._dataItems.slice():(this._dataItems=n,this._values=e.map(n,function(e){return i(e)}),t)},focusNext:function(){var e=this.focus();e=e?e.next():0,this.focus(e)},focusPrev:function(){var e=this.focus();e=e?e.prev():this.element[0].children.length-1,this.focus(e)},focusFirst:function(){this.focus(this.element[0].children[0])},focusLast:function(){this.focus(this.element[0].children[this.element[0].children.length-1])},focus:function(n){var i,o=this,r=o._optionID;return n===t?o._current:(n=o._get(n),n=n[n.length-1],n=e(this.element[0].children[n]),o._current&&(o._current.removeClass(m).removeAttr("aria-selected").removeAttr(p),o.trigger("deactivate")),i=!!n[0],i&&(n.addClass(m),o.scroll(n),n.attr("id",r)),o._current=i?n:null,o.trigger("activate"),t)},focusIndex:function(){return this.focus()?this.focus().index():t},filter:function(e){return e===t?this._filtered:(this._filtered=e,t)},skipUpdate:function(e){this._skipUpdate=e},select:function(n){var i,o=this,r=o.options.selectable,s="multiple"!==r&&r!==!1,a=o._selectedIndices,l=[],c=[];if(n===t)return a.slice();if(n=o._get(n),1===n.length&&-1===n[0]&&(n=[]),!o._filtered||s||!o._deselectFiltered(n)){if(s&&!o._filtered&&-1!==e.inArray(n[n.length-1],a))return o._dataItems.length&&o._view.length&&(o._dataItems=[o._view[a[0]].item]),t;i=o._deselect(n),c=i.removed,n=i.indices,n.length&&(s&&(n=[n[n.length-1]]),l=o._select(n)),(l.length||c.length)&&(o._valueComparer=null,o.trigger("change",{added:l,removed:c}))}},removeAt:function(e){return this._selectedIndices.splice(e,1),this._values.splice(e,1),this._valueComparer=null,{position:e,dataItem:this._dataItems.splice(e,1)[0]}},setValue:function(t){t=e.isArray(t)||t instanceof f?t.slice(0):[t],this._values=t,this._valueComparer=null},value:function(n){var i,o=this,r=o._valueDeferred;return n===t?o._values.slice():(o.setValue(n),r&&"resolved"!==r.state()||(o._valueDeferred=r=e.Deferred()),o.isBound()&&(i=o._valueIndices(o._values),"multiple"===o.options.selectable&&o.select(-1),o.select(i),r.resolve()),o._skipUpdate=!1,r)},items:function(){return this.element.children(".k-item")},_click:function(t){t.isDefaultPrevented()||this.trigger("click",{item:e(t.currentTarget)})||this.select(t.currentTarget)},_valueExpr:function(e,n){var i,o,r,s=this,a=0,l=[];if(!s._valueComparer||s._valueType!==e){for(s._valueType=e;n.length>a;a++)i=n[a],i!==t&&""!==i&&null!==i&&("boolean"===e?i=!!i:"number"===e?i=+i:"string"===e&&(i=""+i)),l.push(i);o="for (var idx = 0; idx < "+l.length+"; idx++) { if (current === values[idx]) { return idx; }} return -1;",r=Function(["current","values"],o),s._valueComparer=function(e){return r(e,l)}}return s._valueComparer},_dataItemPosition:function(e,t){var n=this._valueGetter(e),i=this._valueExpr(typeof n,t);return i(n)},_getter:function(){this._valueGetter=s.getter(this.options.dataValueField)},_deselect:function(t){var n,i,o,r=this,s=r.element[0].children,a=r.options.selectable,l=r._selectedIndices,c=r._dataItems,h=r._values,u=[],d=0,f=0;if(t=t.slice(),a!==!0&&t.length){if("multiple"===a)for(;t.length>d;d++)if(i=t[d],
e(s[i]).hasClass("k-state-selected"))for(n=0;l.length>n;n++)if(o=l[n],o===i){e(s[o]).removeClass("k-state-selected"),u.push({position:n+f,dataItem:c.splice(n,1)[0]}),l.splice(n,1),t.splice(d,1),h.splice(n,1),f+=1,d-=1,n-=1;break}}else{for(;l.length>d;d++)e(s[l[d]]).removeClass("k-state-selected"),u.push({position:d,dataItem:c[d]});r._values=[],r._dataItems=[],r._selectedIndices=[]}return{indices:t,removed:u}},_deselectFiltered:function(t){for(var n,i,o,r=this.element[0].children,s=[],a=0;t.length>a;a++)i=t[a],n=this._view[i].item,o=this._dataItemPosition(n,this._values),o>-1&&(s.push(this.removeAt(o)),e(r[i]).removeClass("k-state-selected"));return s.length?(this.trigger("change",{added:[],removed:s}),!0):!1},_select:function(t){var n,i,o=this,r=o.element[0].children,s=o._view,a=[],l=0;for(-1!==t[t.length-1]&&o.focus(t);t.length>l;l++)i=t[l],n=s[i],-1!==i&&n&&(n=n.item,o._selectedIndices.push(i),o._dataItems.push(n),o._values.push(o._valueGetter(n)),e(r[i]).addClass("k-state-selected").attr("aria-selected",!0),a.push({dataItem:n}));return a},_get:function(n){return"number"==typeof n?n=[n]:D(n)||(n=e(n).data("offset-index"),n===t&&(n=-1),n=[n]),n},_template:function(){var e=this,t=e.options,n=t.template;return n?(n=s.template(n),n=function(e){return''+n(e)+" "}):n=s.template('${'+s.expr(t.dataTextField,"data")+"} ",{useWithBlock:!1}),n},_templates:function(){var e,t,n={template:this.options.template,groupTemplate:this.options.groupTemplate,fixedGroupTemplate:this.options.fixedGroupTemplate};for(t in n)e=n[t],e&&"function"!=typeof e&&(n[t]=s.template(e));this.templates=n},_normalizeIndices:function(e){for(var n=[],i=0;e.length>i;i++)e[i]!==t&&n.push(e[i]);return n},_valueIndices:function(e,t){var n,i=this._view,o=0;if(t=t?t.slice():[],!e.length)return[];for(;i.length>o;o++)n=this._dataItemPosition(i[o].item,e),-1!==n&&(t[n]=o);return this._normalizeIndices(t)},_firstVisibleItem:function(){for(var t=this.element[0],n=this.content[0],i=n.scrollTop,o=e(t.children[0]).height(),r=Math.floor(i/o)||0,s=t.children[r]||t.lastChild,a=i>s.offsetTop;s;)if(a){if(s.offsetTop+o>i||!s.nextSibling)break;s=s.nextSibling}else{if(i>=s.offsetTop||!s.previousSibling)break;s=s.previousSibling}return this._view[e(s).data("offset-index")]},_fixedHeader:function(){this.isGrouped()&&this.templates.fixedGroupTemplate?(this.header.show(),this.content.scroll(this._onScroll)):(this.header.hide(),this.content.off("scroll",this._onScroll))},_renderHeader:function(){var e,t=this.templates.fixedGroupTemplate;t&&(e=this._firstVisibleItem(),e&&this.header.html(t(e.group)))},_renderItem:function(e){var t='',t+=this.templates.template(n),i&&e.newGroup&&(t+=''+this.templates.groupTemplate(e.group)+"
"),t+" "},_render:function(){var e,t,n,i,o="",r=0,s=0,a=[],l=this.dataSource.view(),c=this.value(),h=this.isGrouped();if(h)for(r=0;l.length>r;r++)for(t=l[r],n=!0,i=0;t.items.length>i;i++)e={selected:this._selected(t.items[i],c),item:t.items[i],group:t.value,newGroup:n,index:s},a[s]=e,s+=1,o+=this._renderItem(e),n=!1;else for(r=0;l.length>r;r++)e={selected:this._selected(l[r],c),item:l[r],index:r},a[r]=e,o+=this._renderItem(e);this._view=a,this.element[0].innerHTML=o,h&&a.length&&this._renderHeader()},_selected:function(e,t){var n=!this._filtered||"multiple"===this.options.selectable;return n&&-1!==this._dataItemPosition(e,t)},refresh:function(e){var t,i=this,o=e&&e.action;i.trigger("dataBinding"),i._fixedHeader(),i._render(),i._bound=!0,"itemchange"===o?(t=n(i._dataItems,e.items),t.length&&i.trigger("selectedItemChange",{items:t})):i._filtered||i._skipUpdate?(i.focus(0),i._skipUpdate&&(i._skipUpdate=!1,i._selectedIndices=i._valueIndices(i._values,i._selectedIndices))):i.options.skipUpdateOnBind||o&&"add"!==o||i.value(i._values),i._valueDeferred&&i._valueDeferred.resolve(),i.trigger("dataBound")},isBound:function(){return this._bound},isGrouped:function(){return(this.dataSource.group()||[]).length}}),a.plugin(r)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t,n){for(var i,o=0,r=t.length-1;r>o;++o)i=t[o],i in e||(e[i]={}),e=e[i];e[t[r]]=n}var i=window.kendo,o=i.ui,r=o.Select,s=i.support,a=i._activeElement,l=i.data.ObservableObject,c=i.keys,h=".kendoDropDownList",u="disabled",d="readonly",f="change",p="k-state-focused",g="k-state-default",m="k-state-disabled",v="aria-disabled",_="aria-readonly",y="mouseenter"+h+" mouseleave"+h,w="tabindex",b="filter",x="accept",k=e.proxy,C=r.extend({init:function(n,o){var s,a,l,c=this,u=o&&o.index;c.ns=h,o=e.isArray(o)?{dataSource:o}:o,r.fn.init.call(c,n,o),o=c.options,n=c.element.on("focus"+h,k(c._focusHandler,c)),c._focusInputHandler=e.proxy(c._focusInput,c),c._inputTemplate(),c._reset(),c._prev="",c._word="",c.optionLabel=e(),c._wrapper(),c._tabindex(),c.wrapper.data(w,c.wrapper.attr(w)),c._span(),c._popup(),c._mobile(),c._dataSource(),c._ignoreCase(),c._filterHeader(),c._aria(),c._enable(),c._oldIndex=c.selectedIndex=-1,u!==t&&(o.index=u),c._initialIndex=o.index,c._optionLabel(),c._initList(),c._cascade(),o.autoBind?c.dataSource.fetch():-1===c.selectedIndex&&(a=o.text||"",a||(s=o.optionLabel,s&&0===o.index?a=s:c._isSelect&&(a=n.children(":selected").text())),c._textAccessor(a)),l=e(c.element).parents("fieldset").is(":disabled"),l&&c.enable(!1),c.listView.bind("click",function(e){e.preventDefault()}),i.notify(c)},options:{name:"DropDownList",enabled:!0,autoBind:!0,index:0,text:null,value:null,delay:500,height:200,dataTextField:"",dataValueField:"",optionLabel:"",cascadeFrom:"",cascadeFromField:"",ignoreCase:!0,animation:{},filter:"none",minLength:1,virtual:!1,template:null,valueTemplate:null,optionLabelTemplate:null,groupTemplate:"#:data#",fixedGroupTemplate:"#:data#"},events:["open","close",f,"select","filtering","dataBinding","dataBound","cascade"],setOptions:function(e){r.fn.setOptions.call(this,e),this.listView.setOptions(this._listOptions(e)),this._optionLabel(),this._inputTemplate(),this._accessors(),this._filterHeader(),this._enable(),this._aria(),!this.value()&&this.optionLabel[0]&&this.select(0)},destroy:function(){var e=this;e.wrapper.off(h),e.element.off(h),e._inputWrapper.off(h),e._arrow.off(),e._arrow=null,e.optionLabel.off(),r.fn.destroy.call(e)},open:function(){var e=this;e.popup.visible()||(e.listView.isBound()&&e._state!==x?e._allowOpening()&&(e.popup.one("activate",e._focusInputHandler),e.popup.open(),e._focusItem()):(e._open=!0,e._state="rebind",e.filterInput&&(e.filterInput.val(""),e._prev=""),e._filterSource()))},_focusInput:function(){this._focusElement(this.filterInput)},_allowOpening:function(){return this.optionLabel[0]||this.filterInput||this.dataSource.view().length},toggle:function(e){this._toggle(e,!0)},current:function(e){var n;return e===t?(n=this.listView.focus(),!n&&0===this.selectedIndex&&this.optionLabel[0]?this.optionLabel:n):(this._focus(e),t)},dataItem:function(n){var i=this,o=null,r=!!i.optionLabel[0],s=i.options.optionLabel;if(n===t)o=i.listView.selectedDataItems()[0];else{if("number"!=typeof n){if(i.options.virtual)return i.dataSource.getByUid(e(n).data("uid"));n=n.hasClass("k-list-optionlabel")?-1:e(i.items()).index(n)}else r&&(n-=1);o=i.dataSource.flatView()[n]}return!o&&r&&(o=e.isPlainObject(s)?new l(s):i._assignInstance(i._optionLabelText(),"")),o},refresh:function(){this.listView.refresh()},text:function(e){var n,i,o=this,r=o.options.ignoreCase;return e=null===e?"":e,e===t?o._textAccessor():("string"==typeof e&&(i=r?e.toLowerCase():e,o._select(function(e){return e=o._text(e),r&&(e=(e+"").toLowerCase()),e===i}),n=o.dataItem(),n&&(e=n)),o._textAccessor(e),t)},value:function(e){var n=this,i=n.dataSource;return e===t?(e=n._accessor()||n.listView.value()[0],e===t||null===e?"":e):(e&&(n._initialIndex=null),n._request&&n.options.cascadeFrom&&n.listView.isBound()?(n._valueSetter&&i.unbind(f,n._valueSetter),n._valueSetter=k(function(){n.value(e)},n),i.one(f,n._valueSetter),t):(n.listView.value(e).done(function(){-1===n.selectedIndex&&n.text()&&(n.text(""),n._accessor("",-1)),n._old=n._accessor(),n._oldIndex=n.selectedIndex}),n._fetchData(),t))},_optionLabel:function(){var n=this,o=n.options,r=o.optionLabel,s=o.optionLabelTemplate;return r?(s||(s="#:",s+="string"==typeof r?"data":i.expr(o.dataTextField,"data"),s+="#"),"function"!=typeof s&&(s=i.template(s)),n.optionLabelTemplate=s,n.optionLabel[0]||(n.optionLabel=e('
').prependTo(n.list)),n.optionLabel.html(s(r)).off().click(k(n._click,n)).on(y,n._toggleHover),n.angular("compile",function(){return{elements:n.optionLabel}}),t):(n.optionLabel.off().remove(),n.optionLabel=e(),t)},_optionLabelText:function(){var e=this.options.optionLabel;return"string"==typeof e?e:this._text(e)},_listBound:function(){var e,t,n,i=this,o=i._initialIndex,r=i.options.optionLabel,s=i._state===b,a=i.dataSource.flatView(),l=a.length;i._angularItems("compile"),i._presetValue=!1,i.options.virtual||(t=i._height(s?l||1:l),i._calculateGroupPadding(t)),i.popup.position(),i._isSelect&&(n=i.value(),l?r&&(r=i._option("",i._optionLabelText())):n&&(r=i._option(n,i.text())),i._options(a,r,n)),i._makeUnselectable(),s||(i._open&&i.toggle(i._allowOpening()),i._open=!1,i._fetch||(l?(!i.listView.value().length&&o>-1&&null!==o&&i.select(o),i._initialIndex=null,e=i.listView.selectedDataItems()[0],e&&i.text()!==i._text(e)&&i._selectValue(e)):i._textAccessor()!==i._optionLabelText()&&(i.listView.value(""),i._selectValue(null),i._oldIndex=i.selectedIndex))),i._hideBusy(),i.trigger("dataBound")},_listChange:function(){this._selectValue(this.listView.selectedDataItems()[0]),(this._presetValue||this._old&&-1===this._oldIndex)&&(this._oldIndex=this.selectedIndex)},_focusHandler:function(){this.wrapper.focus()},_focusinHandler:function(){this._inputWrapper.addClass(p),this._prevent=!1},_focusoutHandler:function(){var e=this,t=e._state===b,n=window.self!==window.top,i=e._focus();e._prevent||(clearTimeout(e._typingTimeout),t&&i&&!e.trigger("select",{item:i})&&e._select(i,!e.dataSource.view().length),s.mobileOS.ios&&n?e._change():e._blur(),e._inputWrapper.removeClass(p),e._prevent=!0,e._open=!1,e.element.blur())},_wrapperMousedown:function(){this._prevent=!!this.filterInput},_wrapperClick:function(e){e.preventDefault(),this.popup.unbind("activate",this._focusInputHandler),this._focused=this.wrapper,this._toggle()},_editable:function(e){var t=this,n=t.element,i=e.disable,o=e.readonly,r=t.wrapper.add(t.filterInput).off(h),s=t._inputWrapper.off(y);o||i?i?(r.removeAttr(w),s.addClass(m).removeClass(g)):(s.addClass(g).removeClass(m),r.on("focusin"+h,k(t._focusinHandler,t)).on("focusout"+h,k(t._focusoutHandler,t))):(n.removeAttr(u).removeAttr(d),s.addClass(g).removeClass(m).on(y,t._toggleHover),r.attr(w,r.data(w)).attr(v,!1).attr(_,!1).on("keydown"+h,k(t._keydown,t)).on("focusin"+h,k(t._focusinHandler,t)).on("focusout"+h,k(t._focusoutHandler,t)).on("mousedown"+h,k(t._wrapperMousedown,t)),t.wrapper.on("click"+h,k(t._wrapperClick,t)),t.filterInput||r.on("keypress"+h,k(t._keypress,t))),n.attr(u,i).attr(d,o),r.attr(v,i).attr(_,o)},_option:function(e,t){return''+t+" "},_keydown:function(e){var n,i,o=this,r=e.keyCode,s=e.altKey,l=o.popup.visible();if(o.filterInput&&(n=o.filterInput[0]===a()),r===c.LEFT?(r=c.UP,i=!0):r===c.RIGHT&&(r=c.DOWN,i=!0),!i||!n){if(e.keyCode=r,s&&r===c.UP&&o._focusElement(o.wrapper),r===c.ENTER&&o._typingTimeout&&o.filterInput&&l)return e.preventDefault(),t;i=o._move(e),i||(l&&o.filterInput||(r===c.HOME?(i=!0,o._firstItem()):r===c.END&&(i=!0,o._lastItem()),i&&(o._select(o._focus()),e.preventDefault())),s||i||!o.filterInput||o._search())}},_matchText:function(e,t){var n=this,i=n.options.ignoreCase,o=!1;return e+="",i&&(e=e.toLowerCase()),0===e.indexOf(n._word)&&(n.optionLabel[0]&&(t+=1),n._select(t),n.popup.visible()||n._change(),o=!0),o},_selectNext:function(e){for(var t,n=this,i=e,o=n.dataSource.flatView(),r=o.length;r>e;e++)if(t=n._text(o[e]),t&&n._matchText(t,e)&&(1!==n._word.length||i!==n.selectedIndex))return!0;if(i>0&&r>i)for(e=0;i>=e;e++)if(t=n._text(o[e]),t&&n._matchText(t,e))return!0;return!1},_keypress:function(e){var t,n,o,r=this;0!==e.which&&e.keyCode!==i.keys.ENTER&&(t=String.fromCharCode(e.charCode||e.keyCode),n=r.selectedIndex,o=r._word.length,r.options.ignoreCase&&(t=t.toLowerCase())," "===t&&e.preventDefault(),o||(r._word=t),r._last===t&&1>=o&&n>-1&&r._selectNext(n)||(o&&(r._word+=t),r._last=t,r._search()))},_popupOpen:function(){var e=this.popup;e.wrapper=i.wrap(e.element),e.element.closest(".km-root")[0]&&(e.wrapper.addClass("km-popup km-widget"),this.wrapper.addClass("km-widget"))},_popup:function(){r.fn._popup.call(this),this.popup.one("open",k(this._popupOpen,this))},_click:function(n){var i=n.item||e(n.currentTarget);return this.trigger("select",{item:i})?(this.close(),t):(this._userTriggered=!0,this._select(i),this._focusElement(this.wrapper),this._blur(),t)},_focusElement:function(e){var t=a(),n=this.wrapper,i=this.filterInput,o=e===i?n:i,r=s.mobileOS&&(s.touch||s.MSPointers||s.pointers);i&&i[0]===e[0]&&r||i&&o[0]===t&&(this._prevent=!0,this._focused=e.focus())},_filter:function(e){var n,i;e&&(n=this,i=n.options.ignoreCase,i&&(e=e.toLowerCase()),n._select(function(o){var r=n._text(o);return r!==t?(r+="",i&&(r=r.toLowerCase()),0===r.indexOf(e)):t}))},_search:function(){var e=this,n=e.dataSource,i=e.selectedIndex;if(clearTimeout(e._typingTimeout),"none"!==e.options.filter)e._typingTimeout=setTimeout(function(){var t=e.filterInput.val();e._prev!==t&&(e._prev=t,e.search(t)),e._typingTimeout=null},e.options.delay);else{if(e._typingTimeout=setTimeout(function(){e._word=""},e.options.delay),-1===i&&(i=0),!e.ul[0].firstChild)return n.fetch().done(function(){n.data()[0]&&i>-1&&e._selectNext(i)}),t;e._selectNext(i)}},_get:function(t){var n,i,o,r="function"==typeof t,s=r?e():e(t);if(this.optionLabel[0]&&("number"==typeof t?t>-1&&(t-=1):s.hasClass("k-list-optionlabel")&&(t=-1)),r){for(n=this.dataSource.flatView(),o=0;n.length>o;o++)if(t(n[o])){t=o,i=!0;break}i||(t=-1)}return t},_firstItem:function(){this.optionLabel[0]?this._focus(this.optionLabel):this.listView.focusFirst()},_lastItem:function(){this.optionLabel.removeClass("k-state-focused"),this.listView.focusLast()},_nextItem:function(){this.optionLabel.hasClass("k-state-focused")?(this.optionLabel.removeClass("k-state-focused"),this.listView.focusFirst()):this.listView.focusNext()},_prevItem:function(){this.optionLabel.hasClass("k-state-focused")||(this.listView.focusPrev(),this.listView.focus()||this.optionLabel.addClass("k-state-focused"))},_focusItem:function(){var e=this.listView,n=e.focus(),i=e.select();i=i[i.length-1],i===t&&this.options.highlightFirst&&!n&&(i=0),i!==t?e.focus(i):this.options.optionLabel?(this._focus(this.optionLabel),this._select(this.optionLabel)):e.scrollToIndex(0)},_focus:function(e){var n=this.listView,i=this.optionLabel;return e===t?(e=n.focus(),!e&&i.hasClass("k-state-focused")&&(e=i),e):(i.removeClass("k-state-focused"),e=this._get(e),n.focus(e),-1===e&&i.addClass("k-state-focused"),t)},_select:function(e,t){var n=this;e=n._get(e),n.listView.select(e),t||n._state!==b||(n.listView.filter(!1),n._state=x),-1===e&&n._selectValue(null)},_selectValue:function(e){var n=this,i=n.options.optionLabel,o=n.optionLabel,r=n.listView.select(),s="",a="";r=r[r.length-1],r===t&&(r=-1),o.removeClass("k-state-focused k-state-selected"),e?(a=e,s=n._dataValue(e),i&&(r+=1)):i&&(n._focus(o.addClass("k-state-selected")),a=n._optionLabelText(),s="string"==typeof i?"":n._value(i),r=0),n.selectedIndex=r,null===s&&(s=""),n._textAccessor(a),n._accessor(s,r),n._triggerCascade()},_mobile:function(){var e=this,t=e.popup,n=s.mobileOS,i=t.element.parents(".km-root").eq(0);i.length&&n&&(t.options.animation.open.effects=n.android||n.meego?"fadeIn":n.ios||n.wp?"slideIn:up":t.options.animation.open.effects)},_filterHeader:function(){var t,n=this.options,i="none"!==n.filter;this.filterInput&&(this.filterInput.off(h).parent().remove(),this.filterInput=null),i&&(t='select ',this.filterInput=e(' ').attr({role:"listbox","aria-haspopup":!0,"aria-expanded":!1}),this.list.prepend(e(' ').append(this.filterInput.add(t))))},_span:function(){var t,n=this,i=n.wrapper,o="span.k-input";t=i.find(o),t[0]||(i.append(' select ').append(n.element),t=i.find(o)),n.span=t,n._inputWrapper=e(i[0].firstChild),n._arrow=i.find(".k-icon")},_wrapper:function(){var e,t=this,n=t.element,i=n[0];e=n.parent(),e.is("span.k-widget")||(e=n.wrap(" ").parent(),e[0].style.cssText=i.style.cssText,e[0].title=i.title),n.hide(),t._focused=t.wrapper=e.addClass("k-widget k-dropdown k-header").addClass(i.className).css("display","").attr({unselectable:"on",role:"listbox","aria-haspopup":!0,"aria-expanded":!1})},_clearSelection:function(e){this.select(e.value()?0:-1)},_inputTemplate:function(){var t=this,n=t.options.valueTemplate;n=n?i.template(n):e.proxy(i.template("#:this._text(data)#",{useWithBlock:!1}),t),t.valueTemplate=n},_textAccessor:function(n){var i,o=null,r=this.valueTemplate,s=this.options,a=s.optionLabel,c=this.span;return n===t?c.text():(e.isPlainObject(n)||n instanceof l?o=n:a&&this._optionLabelText()===n&&(o=a,r=this.optionLabelTemplate),o||(o=this._assignInstance(n,this._accessor())),i=function(){return{elements:c.get(),data:[{dataItem:o}]}},this.angular("cleanup",i),c.html(r(o)),this.angular("compile",i),t)},_preselect:function(e,t){e||t||(t=this._optionLabelText()),this._accessor(e),this._textAccessor(t),this._old=this._accessor(),this._oldIndex=this.selectedIndex,this.listView.setValue(e),this._initialIndex=null,this._presetValue=!0},_assignInstance:function(e,t){var i=this.options.dataTextField,o={};return i?(n(o,i.split("."),e),n(o,this.options.dataValueField.split("."),t),o=new l(o)):o=e,o}});o.plugin(C)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e){var t=e.originalEvent,n=0;return t.wheelDelta?(n=-t.wheelDelta/40,n=n>0?_e.ceil(n):_e.floor(n)):t.detail&&(n=t.detail),n}function i(e){return e.options.name.toLowerCase()===Ee.toLowerCase()}function o(e,t){var n,o,r,s,a=ze,l=t.connectors;for(o=0;l.length>o;o++)r=l[o],i(r)||(s=e.distanceTo(r.position()),a>s&&(a=s,n=r));return n}function r(e,t){var n,i,o,r=[],s=e.drawingContainer().children,a=s.length;for(n=0;t.length>n;n++)for(i=t[n],o=0;a>o;o++)if(s[o]==i.drawingContainer()){r.push(o);break}return r}function s(e){var t={};return e=e||{},fe(e.text)&&null!==e.text&&(t.text=e.text),fe(e.x)&&null!==e.x&&(t.x=e.x),fe(e.y)&&null!==e.y&&(t.y=e.y),fe(e.width)&&null!==e.width&&(t.width=e.width),fe(e.height)&&null!==e.height&&(t.height=e.height),fe(e.type)&&null!==e.type&&(t.type=e.type),t}function a(e){var t={};return e=e||{},fe(e.text)&&null!==e.text&&(t.content=e.text),fe(e.type)&&null!==e.type&&(t.type=e.type),fe(e.from)&&null!==e.from&&(t.from=e.from),fe(e.fromConnector)&&null!==e.fromConnector&&(t.fromConnector=e.fromConnector),fe(e.fromX)&&null!==e.fromX&&(t.fromX=e.fromX),fe(e.fromY)&&null!==e.fromY&&(t.fromY=e.fromY),fe(e.to)&&null!==e.to&&(t.to=e.to),fe(e.toConnector)&&null!==e.toConnector&&(t.toConnector=e.toConnector),fe(e.toX)&&null!==e.toX&&(t.toX=e.toX),fe(e.toY)&&null!==e.toY&&(t.toY=e.toY),t}function l(t,n){var i,o=this.dataSource.reader.model;o&&(i=o.fn.fields.text?"text":o.idField,e(" ").appendTo(t).kendoDropDownList({dataValueField:o.idField,dataTextField:i,dataSource:this.dataSource.data().toJSON(),optionLabel:" ",valuePrimitive:!0}))}function c(e){this.dataItem=e,this.callbacks=[]}function h(){this.items={}}function u(e){var t=e;return e instanceof kendo.data.Model&&(t=e.toJSON(),t[e.idField]=e._defaultId),t}function d(e){var t,n,i=[],o=[];for(n=0;e.length>n;n++)t=e[n],t instanceof w?o.push(t):i.push(t);return{shapes:o,connections:i}}function f(e,t){return e.reader.model?new e.reader.model(t):new kendo.data.ObservableObject(t)}function p(e,t){fe(t[e])&&t.set(e,null)}function g(e,t,n){var i,o;for(o=0;n.length>o;o++)i=n[o],t&&!fe(t[i])&&(t[i]=e[i])}function m(e){var t=e.drawingContainer().clippedBBox(null);(0!==t.origin.x||0!==t.origin.y)&&e.position(-t.origin.x,-t.origin.y)}var v,_,y,w,b,x,k,C,S,T,A,D,M=kendo.dataviz,E=kendo.drawing,P=kendo.geometry,I=M.diagram,R=kendo.ui.Widget,B=kendo.Class,z=e.proxy,L=kendo.deepExtend,F=e.extend,O=kendo.data.HierarchicalDataSource,N=I.Canvas,V=I.Group,H=I.Rectangle,U=I.Circle,j=I.CompositeTransform,W=I.Rect,G=I.Path,q=I.DeleteShapeUnit,$=I.DeleteConnectionUnit,Y=I.TextBlock,X=I.Image,Q=I.Point,K=I.Intersect,Z=I.ConnectionEditAdorner,J=I.UndoRedoService,ee=I.ToolService,te=I.Selector,ne=I.ResizingAdorner,ie=I.ConnectorsAdorner,oe=I.Cursors,re=I.Utils,se=kendo.Observable,ae=I.ToBackUnit,le=I.ToFrontUnit,ce=I.PolylineRouter,he=I.CascadingRouter,ue=re.isUndefined,de=re.isDefined,fe=kendo.util.defined,pe=e.isArray,ge=kendo.isFunction,me=re.isString,ve=e.isPlainObject,_e=Math,ye=".kendoDiagram",we="cascading",be="itemBoundsChange",xe="change",ke="click",Ce="drag",Se="dragEnd",Te="dragStart",Ae="mouseEnter",De="mouseLeave",Me="error",Ee="Auto",Pe="Top",Ie="Right",Re="Left",Be="Bottom",ze=9007199254740992,Le="select",Fe="itemRotate",Oe="pan",Ne="zoomStart",Ve="zoomEnd",He="none",Ue=600,je=600,We="rectangle",Ge=100,qe=100,$e=20,Ye=20,Xe=0,Qe="Yellow",Ke=Number.MAX_VALUE,Ze=-Number.MAX_VALUE,Je="absolute",et="transformed",tt="rotated",nt="transparent",it="width",ot="height",rt="x",st="y",at="DOMMouseScroll"+ye+" mousewheel"+ye,lt=.05,ct=5,ht=' #=text# ',ut=5;I.DefaultConnectors=[{name:Pe},{name:Be},{name:Re},{name:Ie},{name:Ee,position:function(e){return e.getPosition("center")}}],v={cancel:{text:"Cancel",imageClass:"k-cancel",className:"k-diagram-cancel",iconClass:"k-icon"},update:{text:"Update",imageClass:"k-update",className:"k-diagram-update",iconClass:"k-icon"}},I.shapeDefaults=function(e){var t={type:We,path:"",autoSize:!0,visual:null,x:Xe,y:Xe,minWidth:$e,minHeight:Ye,width:Ge,height:qe,hover:{},editable:{connect:!0,tools:[]},connectors:I.DefaultConnectors,rotation:{angle:0}};return re.simpleExtend(t,e),t},_=se.extend({init:function(e){var t=this;t.dataItem=(e||{}).dataItem,se.fn.init.call(t),t.options=L({id:I.randomId()},t.options,e),t.isSelected=!1,t.visual=new V({id:t.options.id,autoSize:t.options.autoSize}),t.id=t.options.id,t._template()},options:{hover:{},cursor:oe.grip,content:{align:"center middle"},selectable:!0,serializable:!0,enable:!0},_getCursor:function(e){return this.adorner?this.adorner._getCursor(e):this.options.cursor},visible:function(e){return ue(e)?this.visual.visible():(this.visual.visible(e),t)},bounds:function(){},refresh:function(){this.visual.redraw()},position:function(e){this.options.x=e.x,this.options.y=e.y,this.visual.position(e)},toString:function(){return this.options.id},serialize:function(){var e=L({},{options:this.options});return this.dataItem&&(e.dataItem=""+this.dataItem),e},_content:function(e){var n,i,o;return e!==t&&(n=this.options,I.Utils.isString(e)?n.content.text=e:L(n.content,e),i=n.content,o=this._contentVisual,o?this._updateContentVisual(i):this._createContentVisual(i)),this.options.content.text},_createContentVisual:function(e){e.text&&(this._contentVisual=new Y(e),this._contentVisual._includeInBBox=!1,this.visual.append(this._contentVisual))},_updateContentVisual:function(e){this._contentVisual.redraw(e)},_hitTest:function(e){var t=this.bounds();return this.visible()&&t.contains(e)&&this.options.enable},_template:function(){var e,t,n=this;n.options.content.template&&(e=n.dataItem||{},t=kendo.template(n.options.content.template,{paramName:"dataItem"}),n.options.content.text=t(e))},_canSelect:function(){return this.options.selectable!==!1},toJSON:function(){return{id:this.options.id}}}),y=B.extend({init:function(e,t){this.options=L({},this.options,t),this.connections=[],this.shape=e},options:{width:7,height:7,fill:{color:Qe},hover:{}},position:function(){return this.options.position?this.options.position(this.shape):this.shape.getPosition(this.options.name)},toJSON:function(){return{shapeId:""+this.shape,connector:this.options.name}}}),y.parse=function(e,t){var n,i,o=t.split(":"),r=o[0],s=o[1]||Ee;for(n=0;e.shapes.length>n;n++)if(i=e.shapes[n],i.options.id==r)return i.getConnector(s.trim())},w=_.extend({init:function(e,t){var n=this;_.fn.init.call(n,e),this.diagram=t,this.updateOptionsFromModel(),e=n.options,n.connectors=[],n.type=e.type,n.createShapeVisual(),n.updateBounds(),n.content(n.content()),n._createConnectors()},options:I.shapeDefaults(),_setOptionsFromModel:function(e){var t=s(e||this.dataItem);this.options=L({},this.options,t),this.redrawVisual(),this.options.content&&(this._template(),this.content(this.options.content))},updateOptionsFromModel:function(e,t){var n,i;this.diagram&&this.diagram._isEditable&&(n=s(e||this.dataItem),e&&t?M.inArray(t,["x","y","width","height"])?(i=this.bounds(),i[t]=e[t],this.bounds(i)):(this.options.visual?this.redrawVisual():n.type&&(this.options=L({},this.options,n),this.redrawVisual()),this.options.content&&(this._template(),this.content(this.options.content))):this.options=L({},this.options,n))},redrawVisual:function(){this.visual.clear(),this._contentVisual=null,this.options.dataItem=this.dataItem,this.createShapeVisual(),this.updateBounds()},updateModel:function(e){var t,n,i=this.diagram;i&&i._isEditable&&(t=this._bounds,n=this.dataItem,n&&(i._suspendModelRefresh(),fe(n.x)&&t.x!==n.x&&n.set("x",t.x),fe(n.y)&&t.y!==n.y&&n.set("y",t.y),fe(n.width)&&t.width!==n.width&&n.set("width",t.width),fe(n.height)&&t.height!==n.height&&n.set("height",t.height),this.dataItem=n,i._resumeModelRefresh(),e&&i._syncShapeChanges()))},updateBounds:function(){var e=this.visual._measure(!0),t=this.options;this.bounds(new W(t.x,t.y,e.width,e.height)),this._rotate(),this._alignContent()},content:function(e){var t=this._content(e);return this._alignContent(),t},_alignContent:function(){var e,t,n,i,o,r=this.options.content||{},s=this._contentVisual;s&&r.align&&(e=this.visual._measure(),t=new I.RectAlign(e),n=s.drawingElement.bbox(null),i=new W(0,0,n.width(),n.height()),o=t.align(i,r.align),s.position(o.topLeft()))},_createConnectors:function(){var e,t,n=this.options,i=n.connectors.length,o=n.connectorDefaults;for(t=0;i>t;t++)e=new y(this,L({},o,n.connectors[t])),this.connectors.push(e)},bounds:function(e){var t,n;if(e)if(me(e))switch(e){case et:t=this._transformedBounds();break;case Je:t=this._transformedBounds(),n=this.diagram._pan,t.x+=n.x,t.y+=n.y;break;case tt:t=this._rotatedBounds();break;default:t=this._bounds}else this._setBounds(e),this._triggerBoundsChange(),this.diagram&&this.diagram._layouting||this.refreshConnections();else t=this._bounds;return t},_setBounds:function(e){var t=this.options,n=e.topLeft(),i=t.x=n.x,o=t.y=n.y,r=t.width=_e.max(e.width,t.minWidth),s=t.height=_e.max(e.height,t.minHeight);this._bounds=new W(i,o,r,s),this.visual.redraw({x:i,y:o,width:r,height:s})},position:function(e){return e?(this.bounds(new W(e.x,e.y,this._bounds.width,this._bounds.height)),t):this._bounds.topLeft()},clone:function(){var e=this.serialize();return e.options.id=I.randomId(),this.diagram&&this.diagram._isEditable&&fe(this.dataItem)&&(e.options.dataItem=u(this.dataItem)),new w(e.options)},select:function(e){var n,i,o=this.diagram;return ue(e)&&(e=!0),this._canSelect()&&this.isSelected!=e?(n=[],i=[],this.isSelected=e,this.isSelected?(o._selectedItems.push(this),n.push(this)):(re.remove(o._selectedItems,this),i.push(this)),o._internalSelection||o._selectionChanged(n,i),!0):t},rotate:function(e,n,i){var o,r,s,a,l=this.visual.rotate();return e!==t&&(i!==!1&&this.diagram&&this.diagram.undoRedoService&&e!==l.angle&&this.diagram.undoRedoService.add(new I.RotateUnit(this.diagram._resizingAdorner,[this],[l.angle]),!1),o=this.bounds(),r=new Q(o.width/2,o.height/2),n&&(s=e-l.angle,a=o.center().rotate(n,360-s).minus(r),this._rotationOffset=this._rotationOffset.plus(a.minus(o.topLeft())),this.position(a)),this.visual.rotate(e,r),this.options.rotation.angle=e,this.diagram&&this.diagram._connectorsAdorner&&this.diagram._connectorsAdorner.refresh(),this.refreshConnections(),this.diagram&&this.diagram.trigger(Fe,{item:this})),l},connections:function(e){var t,n,i,o,r,s,a,l=[];for(t=0;this.connectors.length>t;t++)for(r=this.connectors[t],o=r.connections,n=0,o;o.length>n;n++)i=o[n],"out"==e?(s=i.source(),s.shape&&s.shape==this&&l.push(i)):"in"==e?(a=i.target(),a.shape&&a.shape==this&&l.push(i)):l.push(i);return l},refreshConnections:function(){e.each(this.connections(),function(){this.refresh()})},getConnector:function(e){var t,n;if(!me(e))return e instanceof Q?o(e,this):this.connectors.length?this.connectors[0]:null;for(e=e.toLocaleLowerCase(),t=0;this.connectors.length>t;t++)if(n=this.connectors[t],n.options.name.toLocaleLowerCase()==e)return n},getPosition:function(e){var t=this.bounds(),n=e.charAt(0).toLowerCase()+e.slice(1);return ge(t[n])?this._transformPoint(t[n]()):t.center()},redraw:function(e){var t,n;e&&(t=this.options,this.shapeVisual.redraw(this._visualOptions(e)),this._diffNumericOptions(e,[it,ot,rt,st])&&(this.bounds(new W(t.x,t.y,t.width,t.height)),n=!0),e.connectors&&(t.connectors=e.connectors,this._updateConnectors()),t=L(t,e),(e.rotation||n)&&this._rotate(),t.content&&this.content(t.content))},_updateConnectors:function(){var e,t,n,i,o=this.connections();for(this.connectors=[],this._createConnectors(),i=0;o.length>i;i++)e=o[i],t=e.source(),n=e.target(),t.shape&&t.shape===this?e.source(this.getConnector(t.options.name)||null):n.shape&&n.shape===this&&e.target(this.getConnector(n.options.name)||null),e.updateModel()},_diffNumericOptions:I.diffNumericOptions,_visualOptions:function(e){return{data:e.path,source:e.source,hover:e.hover,fill:e.fill,stroke:e.stroke}},_triggerBoundsChange:function(){this.diagram&&this.diagram.trigger(be,{item:this,bounds:this._bounds.clone()})},_transformPoint:function(e){var t=this.rotate(),n=this.bounds(),i=n.topLeft();return t.angle&&e.rotate(t.center().plus(i),360-t.angle),e},_transformedBounds:function(){var e=this.bounds(),t=e.topLeft(),n=e.bottomRight();return W.fromPoints(this.diagram.modelToView(t),this.diagram.modelToView(n))},_rotatedBounds:function(){var e=this.bounds().rotatedBounds(this.rotate().angle),t=e.topLeft(),n=e.bottomRight();return W.fromPoints(t,n)},_rotate:function(){var e=this.options.rotation;e&&e.angle&&this.rotate(e.angle),this._rotationOffset=new Q},_hover:function(e){var t=this.options,n=t.hover,i=t.stroke,o=t.fill;e&&de(n.stroke)&&(i=L({},i,n.stroke)),e&&de(n.fill)&&(o=n.fill),this.shapeVisual.redraw({stroke:i,fill:o}),t.editable&&t.editable.connect&&this.diagram._showConnectors(this,e)},_hitTest:function(e){if(this.visible()){var t,n=this.bounds(),i=this.rotate().angle;if(e.isEmpty&&!e.isEmpty())return K.rects(e,n,i?i:0);if(t=e.clone().rotate(n.center(),i),n.contains(t))return this}},toJSON:function(){return{shapeId:this.options.id}},createShapeVisual:function(){var e,t=this.options,n=this._visualOptions(t),i=t.visual,o=(t.type+"").toLocaleLowerCase();n.width=t.width,n.height=t.height,ge(i)?e=i.call(this,t):n.data?(e=new G(n),m(e)):e="rectangle"==o?new H(n):"circle"==o?new U(n):"text"==o?new Y(n):"image"==o?new X(n):new G(n),this.shapeVisual=e,this.visual.append(this.shapeVisual)}}),b=_.extend({init:function(e,t,n){var i=this;_.fn.init.call(i,n),
this.updateOptionsFromModel(),this._initRouter(),i.path=new I.Polyline(i.options),i.path.fill(nt),i.visual.append(i.path),i._sourcePoint=i._targetPoint=new Q,i._setSource(e),i._setTarget(t),i.content(i.options.content),i.definers=[],fe(n)&&n.points&&i.points(n.points)},options:{hover:{stroke:{}},startCap:He,endCap:He,points:[],selectable:!0,fromConnector:Ee,toConenctor:Ee},_setOptionsFromModel:function(e){this.updateOptionsFromModel(e||this.dataItem)},updateOptionsFromModel:function(e){var t,n,i,o;this.diagram&&this.diagram._isEditable&&(t=this.diagram._dataMap,n=a(e||this.dataItem),e?(fe(n.from)?(i=t[n.from],i&&fe(n.fromConnector)&&(i=i.getConnector(n.fromConnector)),this.source(i)):fe(n.fromX)&&fe(n.fromY)&&this.source(new Q(n.fromX,n.fromY)),fe(n.to)?(o=t[n.to],o&&fe(n.toConnector)&&(o=o.getConnector(n.toConnector)),this.target(o)):fe(n.toX)&&fe(n.toY)&&this.target(new Q(n.toX,n.toY)),fe(n.type)&&this.type()!==n.type&&(this.points([]),this.type(n.type)),this.dataItem=e,this._template(),this.redraw(this.options)):this.options=L({},n,this.options))},updateModel:function(e){if(this.diagram&&this.diagram._isEditable&&this.diagram.connectionsDataSource){var t=this.diagram.connectionsDataSource.getByUid(this.dataItem.uid);t&&(this.diagram._suspendModelRefresh(),fe(this.options.fromX)&&null!==this.options.fromX?(p("from",t),p("fromConnector",t),t.set("fromX",this.options.fromX),t.set("fromY",this.options.fromY)):(t.set("from",this.options.from),fe(t.fromConnector)&&t.set("fromConnector",this.sourceConnector?this.sourceConnector.options.name:null),p("fromX",t),p("fromY",t)),fe(this.options.toX)&&null!==this.options.toX?(p("to",t),p("toConnector",t),t.set("toX",this.options.toX),t.set("toY",this.options.toY)):(t.set("to",this.options.to),fe(t.toConnector)&&t.set("toConnector",this.targetConnector?this.targetConnector.options.name:null),p("toX",t),p("toY",t)),fe(this.options.type)&&fe(t.type)&&t.set("type",this.options.type),this.dataItem=t,this.diagram._resumeModelRefresh(),e&&this.diagram._syncConnectionChanges())}},sourcePoint:function(){return this._resolvedSourceConnector?this._resolvedSourceConnector.position():this._sourcePoint},_setSource:function(e){var n,i=e instanceof w,o=this.options.fromConnector||Ee;(!i||e.getConnector(o))&&(e!==t&&(this.from=e),this._removeFromSourceConnector(),null===e?this.sourceConnector&&(this._sourcePoint=(this._resolvedSourceConnector||this.sourceConnector).position(),this._clearSourceConnector(),this._setFromOptions(null,this._sourcePoint)):e instanceof y?(n=e.shape.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=e,this.sourceConnector.connections.push(this)):e instanceof Q?(this._setFromOptions(null,e),this._sourcePoint=e,this.sourceConnector&&this._clearSourceConnector()):i&&(n=e.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=e.getConnector(o),this.sourceConnector.connections.push(this)))},source:function(e,t){return de(e)&&(t&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new I.ConnectionEditUnit(this,e)),this._setSource(e),this.refresh()),this.sourceConnector?this.sourceConnector:this._sourcePoint},_setFromOptions:function(e,t){this.options.from=e,t?(this.options.fromX=t.x,this.options.fromY=t.y):(this.options.fromX=null,this.options.fromY=null)},sourceDefiner:function(e){if(!e)return this._sourceDefiner||(this._sourceDefiner=new I.PathDefiner(this.sourcePoint(),null,null)),this._sourceDefiner;if(!(e instanceof I.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";e.left=null,this._sourceDefiner=e,this.source(e.point)},targetPoint:function(){return this._resolvedTargetConnector?this._resolvedTargetConnector.position():this._targetPoint},_setTarget:function(e){var n,i=e instanceof w,o=this.options.toConnector||Ee;(!i||e.getConnector(o))&&(e!==t&&(this.to=e),this._removeFromTargetConnector(),null===e?this.targetConnector&&(this._targetPoint=(this._resolvedTargetConnector||this.targetConnector).position(),this._clearTargetConnector(),this._setToOptions(null,this._targetPoint)):e instanceof y?(n=e.shape.dataItem,n&&this._setToOptions(n.id),this.targetConnector=e,this.targetConnector.connections.push(this)):e instanceof Q?(this._setToOptions(null,e),this._targetPoint=e,this.targetConnector&&this._clearTargetConnector()):i&&(n=e.dataItem,n&&this._setToOptions(n.id),this.targetConnector=e.getConnector(o),this.targetConnector.connections.push(this)))},target:function(e,n){return de(e)&&(n&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new I.ConnectionEditUnit(this,t,e)),this._setTarget(e),this.refresh()),this.targetConnector?this.targetConnector:this._targetPoint},_setToOptions:function(e,t){this.options.to=e,t?(this.options.toX=t.x,this.options.toY=t.y):(this.options.toX=null,this.options.toY=null)},targetDefiner:function(e){if(!e)return this._targetDefiner||(this._targetDefiner=new I.PathDefiner(this.targetPoint(),null,null)),this._targetDefiner;if(!(e instanceof I.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";e.right=null,this._targetDefiner=e,this.target(e.point)},_updateConnectors:function(){this._updateConnector(this.source(),"source"),this._updateConnector(this.target(),"target")},_updateConnector:function(e,t){var n,i,o,r,s=this,a=s.diagram;e instanceof y&&!a.getShapeById(e.shape.id)?(n=e.shape.dataItem,i=e.options.name,o=function(){var o=a._dataMap[n.id];e=o.getConnector(i),s[t](e,!1),s.updateModel()},a._dataMap[n.id]?o():(r=a._inactiveShapeItems.getByUid(n.uid),r&&a._deferredConnectionUpdates.push(r.onActivate(o)))):s[t](e,!1)},content:function(e){var t=this._content(e);return fe(e)&&this._alignContent(),t},_createContentVisual:function(e){var t;return ge(e.visual)?t=e.visual.call(this,e):e.text&&(t=new Y(e)),t&&(this._contentVisual=t,t._includeInBBox=!1,this.visual.append(t)),t},_updateContentVisual:function(e){ge(e.visual)?(this.visual.remove(this._contentVisual),this._createContentVisual(e)):this._contentVisual.redraw(e)},_alignContent:function(){var e,t,n,i,o,r,s,a,l,c,h,u,d,f,p,g;if(this._contentVisual){for(e=ut,t=this.allPoints(),n=_e.floor(t.length/2),i=n-1;i>0&&t[i].equals(t[n]);)i--,n++;o=t[n],r=t[i],s=this._contentVisual._measure(),a=s.width,l=s.height,c=t.length%2===0,h=r.distanceTo(o),c&&t.length>2&&h>0&&(r.y===o.y&&a>h||r.x===o.x&&l>h)&&(c=!1,e=0),c?(d=kendo.util.deg(_e.atan2(o.y-r.y,o.x-r.x)),u=new Q((o.x-r.x)/2+r.x,(o.y-r.y)/2+r.y),90===_e.abs(d)?(u.x+=e,u.y-=l/2):d%180===0?(u.x-=a/2,u.y-=l+e):-90>d||d>0&&90>d?u.y-=l:(0>d||d>90)&&(u.x-=a,u.y-=l)):(f=_e.floor(t.length/2),u=t[f].clone(),r=t[f-1],o=t[f+1],p=u.x>=r.x&&u.x>=o.x?e:-s.width-e,g=u.y>=r.y&&u.y>=o.y?e:-s.height-e,u.x+=p,u.y+=g),this._contentVisual.position(u)}},select:function(e){var n,i,o=this.diagram;return this._canSelect()&&this.isSelected!==e?(this.isSelected=e,n=[],i=[],this.isSelected?(this.adorner=new Z(this,this.options.selection),o._adorn(this.adorner,!0),o._selectedItems.push(this),n.push(this)):this.adorner&&(o._adorn(this.adorner,!1),re.remove(o._selectedItems,this),this.adorner=t,i.push(this)),this.adorner&&this.adorner.refresh(),o._internalSelection||o._selectionChanged(n,i),!0):t},bounds:function(e){return!e||me(e)?this._bounds:(this._bounds=e,t)},type:function(e){var n=this.options;return e?(e!==n.type&&(n.type=e,this._initRouter(),this.refresh()),t):n.type},_initRouter:function(){var e=(this.options.type||"").toLowerCase();this._router=e==we?new he(this):new ce(this)},points:function(e){var t,n,i,o;if(!e){if(i=[],de(this.definers))for(o=0;this.definers.length>o;o++)i.push(this.definers[o].point);return i}for(this.definers=[],t=0;e.length>t;t++)if(n=e[t],n instanceof I.Point)this.definers.push(new I.PathDefiner(n));else{if(!n.hasOwnProperty("x")||!n.hasOwnProperty("y"))throw"A Connection point needs to be a Point or an object with x and y properties.";this.definers.push(new I.PathDefiner(new Q(n.x,n.y)))}},allPoints:function(){var e,t=[this.sourcePoint()];if(this.definers)for(e=0;this.definers.length>e;e++)t.push(this.definers[e].point);return t.push(this.targetPoint()),t},refresh:function(){this._resolveConnectors(),this._refreshPath(),this._alignContent(),this.adorner&&this.adorner.refresh()},_resolveConnectors:function(){var e,t,n,r,s=this,a=s.source(),l=s.target();a instanceof Q?e=a:a instanceof y&&(i(a)?n=a.shape:(s._resolvedSourceConnector=a,e=a.position())),l instanceof Q?t=l:l instanceof y&&(i(l)?r=l.shape:(s._resolvedTargetConnector=l,t=l.position())),e?r&&(s._resolvedTargetConnector=o(e,r)):n&&(t?s._resolvedSourceConnector=o(t,n):r&&this._resolveAutoConnectors(n,r))},_resolveAutoConnectors:function(e,t){var n,o,r,s,a,l,c,h,u,d,f,p,g=ze,m=ze,v=e.connectors;for(d=0;v.length>d;d++)if(h=v[d],!i(h))for(s=h.position(),n=t.connectors,f=0;n.length>f;f++)u=n[f],i(u)||(a=u.position(),p=_e.round(s.distanceTo(a)),g>p&&this.diagram&&this._testRoutePoints(s,a,h,u)&&(g=p,o=h,r=u),m>p&&(l=h,c=u,m=p));o&&(l=o,c=r),this._resolvedSourceConnector=l,this._resolvedTargetConnector=c},_testRoutePoints:function(e,t,n,i){var o,r,s,a,l,c=this._router,h=!0;if(c instanceof he)for(o=c.routePoints(e,t,n,i),o.unshift(e),o.push(t),l=1;o.length>l;l++)if(r=o[l-1],s=o[l],a=new W(_e.min(r.x,s.x),_e.min(r.y,s.y),_e.abs(r.x-s.x),_e.abs(r.y-s.y)),a.width>0&&(a.x++,a.width-=2),a.height>0&&(a.y++,a.height-=2),!a.isEmpty()&&this.diagram._shapesQuadTree.hitTestRect(a)){h=!1;break}return h},redraw:function(e){if(e){this.options=L({},this.options,e);var t=this.options.points;fe(t)&&t.length>0&&(this.points(t),this._refreshPath()),(e&&e.content||e.text)&&this.content(e.content),this.path.redraw({fill:e.fill,stroke:e.stroke,startCap:e.startCap,endCap:e.endCap})}},clone:function(){var e=this.serialize();return this.diagram&&this.diagram._isEditable&&fe(this.dataItem)&&(e.options.dataItem=u(this.dataItem)),new b(this.from,this.to,e.options)},serialize:function(){var e=this.from.toJSON?this.from.toJSON:""+this.from,t=this.to.toJSON?this.to.toJSON:""+this.to,n=L({},{options:this.options,from:e,to:t});return fe(this.dataItem)&&(n.dataItem=""+this.dataItem),n.options.points=this.points(),n},_hitTest:function(e){if(this.visible()){var t=new Q(e.x,e.y),n=this.sourcePoint(),i=this.targetPoint();if(e.isEmpty&&!e.isEmpty()&&e.contains(n)&&e.contains(i))return this;if(this._router.hitTest(t))return this}},_hover:function(e){var t=(this.options.stroke||{}).color;e&&de(this.options.hover.stroke.color)&&(t=this.options.hover.stroke.color),this.path.redraw({stroke:{color:t}})},_refreshPath:function(){fe(this.path)&&(this._drawPath(),this.bounds(this._router.getBounds()))},_drawPath:function(){var e,t,n;this._router&&this._router.route(),e=this.sourcePoint(),t=this.targetPoint(),n=this.points(),this.path.redraw({points:[e].concat(n,[t])})},_clearSourceConnector:function(){this.sourceConnector=t,this._resolvedSourceConnector=t},_clearTargetConnector:function(){this.targetConnector=t,this._resolvedTargetConnector=t},_removeFromSourceConnector:function(){this.sourceConnector&&re.remove(this.sourceConnector.connections,this)},_removeFromTargetConnector:function(){this.targetConnector&&re.remove(this.targetConnector.connections,this)},toJSON:function(){var e,t,n,i=this;return i.from&&i.from.toJSON?e=i.from.toJSON():(n=i._sourcePoint,e={x:n.x,y:n.y}),i.to&&i.to.toJSON?t=i.to.toJSON():(n=i._targetPoint,t={x:n.x,y:n.y}),{from:e,to:t}}}),x=R.extend({init:function(e,t){var n=this;kendo.destroy(e),R.fn.init.call(n,e,t),n._initTheme(),n._initElements(),n._extendLayoutOptions(n.options),n._initDefaults(t),n._initCanvas(),n.mainLayer=new V({id:"main-layer"}),n.canvas.append(n.mainLayer),n._shapesQuadTree=new D(n),n._pan=new Q,n._adorners=[],n.adornerLayer=new V({id:"adorner-layer"}),n.canvas.append(n.adornerLayer),n._createHandlers(),n._initialize(),n._fetchFreshData(),n._createGlobalToolBar(),n._resizingAdorner=new ne(n,{editable:n.options.editable}),n._connectorsAdorner=new ie(n),n._adorn(n._resizingAdorner,!0),n._adorn(n._connectorsAdorner,!0),n.selector=new te(n),n._clipboard=[],n.pauseMouseHandlers=!1,n._createOptionElements(),n.zoom(n.options.zoom),n.canvas.draw()},options:{name:"Diagram",theme:"default",layout:"",zoomRate:.1,zoom:1,zoomMin:0,zoomMax:2,dataSource:{},draggable:!0,template:"",autoBind:!0,editable:{rotate:{},resize:{},text:!0,tools:[],drag:{snap:{size:10,angle:10}},remove:!0},pannable:{key:"ctrl"},selectable:{key:"none"},tooltip:{enabled:!0,format:"{0}"},copy:{enabled:!0,offsetX:20,offsetY:20},shapeDefaults:I.shapeDefaults({undoable:!0}),connectionDefaults:{editable:{tools:[]},type:we},shapes:[],connections:[]},events:[Ve,Ne,Oe,Le,Fe,be,xe,ke,Ae,De,"toolBarClick","save","cancel","edit","remove","add","dataBound",Te,Ce,Se],items:function(){return e()},_createGlobalToolBar:function(){var e,t=this.options.editable;t&&(e=t.tools,!this._isEditable||e===!1||e&&0!==e.length||(e=["createShape","undo","redo","rotateClockwise","rotateAnticlockwise"]),e&&e.length&&(this.toolBar=new k(this,{tools:e||{},click:z(this._toolBarClick,this),modal:!1}),this.toolBar.element.css({textAlign:"left"}),this.element.prepend(this.toolBar.element),this._resize()))},createShape:function(){var e,t,n,i,o,r;(this.editor&&this.editor.end()||!this.editor)&&(e=this.dataSource,t=e.view()||[],n=t.length,i=f(e,{}),o=this._createShape(i,{}),this.trigger("add",{shape:o})||(e.insert(n,i),r=this._inactiveShapeItems.getByUid(i.uid),r.element=o,this.edit(o)))},_createShape:function(e,t){t=L({},this.options.shapeDefaults,t),t.dataItem=e;var n=new w(t,this);return n},createConnection:function(){var e,t,n,i,o;(this.editor&&this.editor.end()||!this.editor)&&(e=this.connectionsDataSource,t=e.view()||[],n=t.length,i=f(e,{}),o=this._createConnection(i),this.trigger("add",{connection:o})||(this._connectionsDataMap[i.uid]=o,e.insert(n,i),this.addConnection(o,!1),this.edit(o)))},_createConnection:function(e,t,n){var i,o=L({},this.options.connectionDefaults);return o.dataItem=e,i=new b(t||new Q,n||new Q,o)},editModel:function(e,t){var n,i,o,r;if(this.cancelEdit(),o=this.options.editable,"shape"==t)n=o.shapeEditors,i=o.shapeTemplate;else{if("connection"!=t)return;r=z(l,this),n=L({},{from:r,to:r},o.connectionEditors),i=o.connectionTemplate}this.editor=new S(this.element,{update:z(this._update,this),cancel:z(this._cancel,this),model:e,type:t,target:this,editors:n,template:i}),this.trigger("edit",this._editArgs())},edit:function(e){if(e.dataItem){var t=e instanceof w?"shape":"connection";this.editModel(e.dataItem,t)}},cancelEdit:function(){this.editor&&(this._getEditDataSource().cancelChanges(this.editor.model),this._destroyEditor())},saveEdit:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&this._getEditDataSource().sync()},_update:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&(this._getEditDataSource().sync(),this._destroyEditor())},_cancel:function(){var e,t;this.editor&&!this.trigger("cancel",this._editArgs())&&(e=this.editor.model,this._getEditDataSource().cancelChanges(e),t=this._connectionsDataMap[e.uid]||this._dataMap[e.id],t&&t._setOptionsFromModel(e),this._destroyEditor())},_getEditDataSource:function(){return"shape"===this.editor.options.type?this.dataSource:this.connectionsDataSource},_editArgs:function(){var e={container:this.editor.wrapper};return e[this.editor.options.type]=this.editor.model,e},_destroyEditor:function(){this.editor&&(this.editor.close(),this.editor=null)},_initElements:function(){this.wrapper=this.element.empty().css("position","relative").attr("tabindex",0).addClass("k-widget k-diagram"),this.scrollable=e("
").appendTo(this.element)},_initDefaults:function(e){var t=this.options,n=t.editable,i=t.shapeDefaults,o=t.connectionDefaults,r=(e||{}).shapeDefaults;n===!1?(i.editable=!1,o.editable=!1):(g(n,i.editable,["drag","remove","connect"]),g(n,o.editable,["drag","remove"])),r&&r.connectors&&(t.shapeDefaults.connectors=r.connectors)},_initCanvas:function(){var t=e("
").appendTo(this.scrollable)[0],n=this.viewport();this.canvas=new N(t,{width:n.width||Ue,height:n.height||je})},_createHandlers:function(){var e=this,t=e.element;t.on(at,z(e._wheel,e)),kendo.support.touch||kendo.support.mobileOS?(e._userEvents=new kendo.UserEvents(t,{multiTouch:!0,tap:z(e._tap,e)}),e._userEvents.bind(["gesturestart","gesturechange","gestureend"],{gesturestart:z(e._gestureStart,e),gesturechange:z(e._gestureChange,e),gestureend:z(e._gestureEnd,e)}),e.toolService=new ee(e),e.options.pannable!==!1&&e.scroller.enable()):(e.toolService=new ee(e),this.scroller.wrapper.on("mousemove"+ye,z(e._mouseMove,e)).on("mouseup"+ye,z(e._mouseUp,e)).on("mousedown"+ye,z(e._mouseDown,e)).on("mouseover"+ye,z(e._mouseover,e)).on("mouseout"+ye,z(e._mouseout,e)),t.on("keydown"+ye,z(e._keydown,e))),this._syncHandler=z(e._syncChanges,e),e._resizeHandler=z(e.resize,e,!1),kendo.onResize(e._resizeHandler),this.bind(Ne,z(e._destroyToolBar,e)),this.bind(Oe,z(e._destroyToolBar,e))},_tap:function(e){var t,n=this.toolService,i=this._caculateMobilePosition(e);n._updateHoveredItem(i),n.hoveredItem&&(t=n.hoveredItem,this.options.selectable!==!1&&(this._destroyToolBar(),t.isSelected?t.select(!1):this.select(t,{addToSelection:!0}),this._createToolBar()),this.trigger("click",{item:t,point:i}))},_caculateMobilePosition:function(e){return this.documentToModel(Q(e.x.location,e.y.location))},_gestureStart:function(e){var t,n;this._destroyToolBar(),this.scroller.disable(),t=this.documentToModel(new Q(e.center.x,e.center.y)),n={point:t,zoom:this.zoom()},this.trigger(Ne,n)||(this._gesture=e,this._initialCenter=t)},_gestureChange:function(e){var t,n,i=this._gesture,o=this._initialCenter,r=this.documentToView(new Q(e.center.x,e.center.y)),s=e.distance/i.distance,a=this._zoom,l=!1;_e.abs(s-1)>=lt&&(this._zoom=a=this._getValidZoom(a*s),this.options.zoom=a,this._gesture=e,l=!0),t=o.times(a),n=r.minus(t),(l||this._pan.distanceTo(n)>=ct)&&(this._panTransform(n),this._updateAdorners()),e.preventDefault()},_gestureEnd:function(){this.options.pannable!==!1&&this.scroller.enable(),this.trigger(Ve,{point:this._initialCenter,zoom:this.zoom()})},_resize:function(){var e=this.viewport();this.canvas&&this.canvas.size(e),this.scrollable&&this.toolBar&&this.scrollable.height(e.height)},_mouseover:function(e){var t=e.target._kendoNode;t&&t.srcElement._hover&&t.srcElement._hover(!0,t.srcElement)},_mouseout:function(e){var t=e.target._kendoNode;t&&t.srcElement._hover&&t.srcElement._hover(!1,t.srcElement)},_initTheme:function(){var e=this,t=M.ui.themes||{},n=((e.options||{}).theme||"").toLowerCase(),i=(t[n]||{}).diagram;e.options=L({},i,e.options),e.options.editable===!0&&L(e.options,{editable:(i||{}).editable})},_createOptionElements:function(){var e=this.options,t=e.shapes.length;t&&this._createShapes(),e.connections.length&&this._createConnections(),t&&e.layout&&this.layout(e.layout)},_createShapes:function(){var e,t,n=this,i=n.options,o=i.shapes;for(t=0;o.length>t;t++)e=o[t],n.addShape(e)},_createConnections:function(){var e,t,n,i,o=this,r=o.options,s=r.connectionDefaults,a=r.connections;for(i=0;a.length>i;i++)e=a[i],t=o._findConnectionTarget(e.from),n=o._findConnectionTarget(e.to),o.connect(t,n,L({},s,e))},_findConnectionTarget:function(e){var t,n=this,i=me(e)?e:e.shapeId||e.id;return i?(t=n.getShapeById(i),e.connector&&(t=t.getConnector(e.connector))):t=new Q(e.x||0,e.y||0),t},destroy:function(){var e=this;R.fn.destroy.call(e),this._userEvents&&this._userEvents.destroy(),kendo.unbindResize(e._resizeHandler),e.clear(),e.element.off(ye),e.scroller.wrapper.off(ye),e.canvas.destroy(!0),e.canvas=t,e._destroyEditor(),e.destroyScroller(),e._destroyGlobalToolBar(),e._destroyToolBar()},destroyScroller:function(){var e=this.scroller;e&&(e.destroy(),e.element.remove(),this.scroller=null)},save:function(){var e,t,n,i={shapes:[],connections:[]};for(e=0;this.shapes.length>e;e++)n=this.shapes[e],n.options.serializable&&i.shapes.push(n.options);for(e=0;this.connections.length>e;e++)t=this.connections[e],i.connections.push(L({},t.options,t.toJSON()));return i},focus:function(){if(!this.element.is(kendo._activeElement())){var e,t=this.element,n=t[0],i=[],o=[],r=document.documentElement;do n=n.parentNode,n.scrollHeight>n.clientHeight&&(i.push(n),o.push(n.scrollTop));while(n!=r);for(t.focus(),e=0;i.length>e;e++)i[e].scrollTop=o[e]}},load:function(e){this.clear(),this.setOptions(e),this._createShapes(),this._createConnections()},setOptions:function(e){L(this.options,e)},clear:function(){var e=this;e.select(!1),e.mainLayer.clear(),e._shapesQuadTree.clear(),e._initialize()},connect:function(e,t,n){var i,o;return this.connectionsDataSource&&this._isEditable?(o=this.connectionsDataSource.add({}),i=this._connectionsDataMap[o.uid],i.source(e),i.target(t),i.redraw(n),i.updateModel()):(i=new b(e,t,L({},this.options.connectionDefaults,n)),this.addConnection(i)),i},connected:function(e,t){var n,i;for(n=0;this.connections.length>n;n++)if(i=this.connections[n],i.from==e&&i.to==t)return!0;return!1},addConnection:function(e,t){return t!==!1&&this.undoRedoService.add(new I.AddConnectionUnit(e,this),!1),e.diagram=this,e._setOptionsFromModel(),e.refresh(),this.mainLayer.append(e.visual),this.connections.push(e),this.trigger(xe,{added:[e],removed:[]}),e},_addConnection:function(e,t){var n,i=this.connectionsDataSource;if(i&&this._isEditable){if(n=f(i,u(e.dataItem)),e.dataItem=n,e.updateModel(),!this.trigger("add",{connection:e}))return this._connectionsDataMap[n.uid]=e,i.add(n),this.addConnection(e,t),e._updateConnectors(),e}else if(!this.trigger("add",{connection:e}))return this.addConnection(e,t),e._updateConnectors(),e},addShape:function(e,t){var n,i=this.options.shapeDefaults;if(e instanceof w)n=e;else{if(e instanceof kendo.Class)return;i=L({},i,e||{}),n=new w(i,this)}return t!==!1&&this.undoRedoService.add(new I.AddShapeUnit(n,this),!1),this.shapes.push(n),n.diagram!==this&&(this._shapesQuadTree.insert(n),n.diagram=this),this.mainLayer.append(n.visual),this.trigger(xe,{added:[n],removed:[]}),n},_addShape:function(e,t){var n,i,o=this,r=o.dataSource;if(r&&this._isEditable){if(n=f(r,u(e.dataItem)),e.dataItem=n,e.updateModel(),!this.trigger("add",{shape:e}))return this.dataSource.add(n),i=this._inactiveShapeItems.getByUid(n.uid),i.element=e,i.undoable=t,e}else if(!this.trigger("add",{shape:e}))return this.addShape(e,t)},remove:function(e,t){var n,i,o,r;for(e=pe(e)?e.slice(0):[e],n=d(e),i=n.shapes,o=n.connections,fe(t)||(t=!0),t&&this.undoRedoService.begin(),this._suspendModelRefresh(),r=i.length-1;r>=0;r--)this._removeItem(i[r],t,o);for(r=o.length-1;r>=0;r--)this._removeItem(o[r],t);this._resumeModelRefresh(),t&&this.undoRedoService.commit(!1),this.trigger(xe,{added:[],removed:e})},_removeShapeDataItem:function(e){this._isEditable&&(this.dataSource.remove(e.dataItem),delete this._dataMap[e.dataItem.id])},_removeConnectionDataItem:function(e){this._isEditable&&(this.connectionsDataSource.remove(e.dataItem),delete this._connectionsDataMap[e.dataItem.uid])},_triggerRemove:function(e){var t,n,i,o,r=[];for(o=0;e.length>o;o++)t=e[o],i=t.options.editable,n=t instanceof w?{shape:t}:{connection:t},i&&i.remove!==!1&&!this.trigger("remove",n)&&r.push(t);return r},undo:function(){this.undoRedoService.undo()},redo:function(){this.undoRedoService.redo()},select:function(e,t){if(!de(e))return this._selectedItems;t=L({addToSelection:!1},t);var n,i,o=t.addToSelection,r=[],s=[];for(o||this.deselect(),this._internalSelection=!0,e instanceof Array?r=e:e instanceof _&&(r=[e]),n=0;r.length>n;n++)i=r[n],i.select(!0)&&s.push(i);this._selectionChanged(s,[]),this._internalSelection=!1},selectAll:function(){this.select(this.shapes.concat(this.connections))},selectArea:function(e){var t,n,i,o;if(this._internalSelection=!0,o=[],e instanceof W)for(n=this.shapes.concat(this.connections),t=0;n.length>t;t++)i=n[t],e&&!i._hitTest(e)||!i.options.enable||i.select(!0)&&o.push(i);this._selectionChanged(o,[]),this._internalSelection=!1},deselect:function(e){this._internalSelection=!0;var t,n,i=[],o=[];for(e instanceof Array?o=e:e instanceof _?o.push(e):de(e)||(o=this._selectedItems.slice(0)),n=0;o.length>n;n++)t=o[n],t.select(!1)&&i.push(t);this._selectionChanged([],i),this._internalSelection=!1},toFront:function(e,t){var n,i,o;e||(e=this._selectedItems.slice()),n=this._getDiagramItems(e),!fe(t)||t?(i=r(this.mainLayer,n.visuals),o=new le(this,e,i),this.undoRedoService.add(o)):(this.mainLayer.toFront(n.visuals),this._fixOrdering(n,!0))},toBack:function(e,t){var n,i,o;e||(e=this._selectedItems.slice()),n=this._getDiagramItems(e),!fe(t)||t?(i=r(this.mainLayer,n.visuals),o=new ae(this,e,i),this.undoRedoService.add(o)):(this.mainLayer.toBack(n.visuals),this._fixOrdering(n,!1))},bringIntoView:function(e,t){var n,i,o,r,s=this.viewport(),a=new I.RectAlign(s);0!==s.width&&0!==s.height&&(t=L({animate:!1,align:"center middle"},t),"none"==t.align&&(t.align="center middle"),e instanceof _?i=e.bounds(et):pe(e)?i=this.boundingBox(e):e instanceof W&&(i=e.clone()),o=i.clone(),i.zoom(this._zoom),(i.width>s.width||i.height>s.height)&&(this._zoom=this._getValidZoom(_e.min(s.width/o.width,s.height/o.height)),i=o.clone().zoom(this._zoom)),this._zoomMainLayer(),n=i.clone(),a.align(i,t.align),r=i.topLeft().minus(n.topLeft()),this.pan(r.times(-1),t.animate))},alignShapes:function(e){var t,n,i,o,r,s,a;if(ue(e)&&(e="Left"),t=this.select(),0!==t.length){switch(e.toLowerCase()){case"left":case"top":n=Ke;break;case"right":case"bottom":n=Ze}for(o=0;t.length>o;o++)if(i=t[o],i instanceof w)switch(e.toLowerCase()){case"left":n=_e.min(n,i.options.x);break;case"top":n=_e.min(n,i.options.y);break;case"right":n=_e.max(n,i.options.x);break;case"bottom":n=_e.max(n,i.options.y)}for(r=[],s=[],o=0;t.length>o;o++)if(i=t[o],i instanceof w)switch(s.push(i),r.push(i.bounds()),e.toLowerCase()){case"left":case"right":i.position(new Q(n,i.options.y));break;case"top":case"bottom":i.position(new Q(i.options.x,n))}a=new I.TransformUnit(s,r),this.undoRedoService.add(a,!1)}},zoom:function(e,t){var n,i,o,r;return e&&(n=t?t.point:new I.Point(0,0),e=this._zoom=this._getValidZoom(e),ue(n)||(n=new I.Point(_e.round(n.x),_e.round(n.y)),i=n.times(e),o=this.modelToView(n),r=o.minus(i),this._storePan(new I.Point(_e.round(r.x),_e.round(r.y)))),t&&(t.zoom=e),this._panTransform(),this._updateAdorners()),this._zoom},_getPan:function(e){var t=this.canvas;return t.translate||(e=e.plus(this._pan)),e},pan:function(e,t){var n,i;e instanceof Q&&(n=this,i=n.scroller,e=n._getPan(e),e=e.times(-1),t?i.animatedScrollTo(e.x,e.y,function(){n._updateAdorners()}):(i.scrollTo(e.x,e.y),n._updateAdorners()))},viewport:function(){var e=this.element,t=e.width(),n=e.height();return this.toolBar&&(n-=this.toolBar.element.outerHeight()),new W(0,0,t,n)},copy:function(){var e,t;if(this.options.copy.enabled)for(this._clipboard=[],this._copyOffset=1,e=0;this._selectedItems.length>e;e++)t=this._selectedItems[e],this._clipboard.push(t)},cut:function(){var e,t;if(this.options.copy.enabled){for(this._clipboard=[],this._copyOffset=0,e=0;this._selectedItems.length>e;e++)t=this._selectedItems[e],this._clipboard.push(t);this.remove(this._clipboard,!0)}},paste:function(){var e,t,n,i,o,r,s,a;if(this._clipboard.length>0){for(i={},o=d(this._clipboard),r=o.connections,s=o.shapes,a={x:this._copyOffset*this.options.copy.offsetX,y:this._copyOffset*this.options.copy.offsetY},this.deselect(),n=0;s.length>n;n++)e=s[n],t=e.clone(),i[e.id]=t,t.position(new Q(e.options.x+a.x,e.options.y+a.y)),t.diagram=this,t=this._addShape(t),t&&t.select();for(n=0;r.length>n;n++)e=r[n],t=this._addConnection(e.clone()),t&&(this._updateCopiedConnection(t,e,"source",i,a),this._updateCopiedConnection(t,e,"target",i,a),t.select(!0),t.updateModel());this._syncChanges(),this._copyOffset+=1}},_updateCopiedConnection:function(e,t,n,i,o){var r,s,a,l=t[n](),c=this;l instanceof y&&i[l.shape.id]?(a=i[l.shape.id],c.getShapeById(a.id)?e[n](a.getConnector(l.options.name)):(s=c._inactiveShapeItems.getByUid(a.dataItem.uid),s&&(r=function(t){a=c._dataMap[t.id],e[n](a.getConnector(l.options.name)),e.updateModel()},c._deferredConnectionUpdates.push(s.onActivate(r))))):e[n](new Q(t[n+"Point"]().x+o.x,t[n+"Point"]().y+o.y))},boundingBox:function(e,t){var n,i,o,r=W.empty(),s=de(e)?this._getDiagramItems(e):{shapes:this.shapes};if(s.shapes.length>0)for(i=s.shapes[0],r=i.bounds(tt),o=1;s.shapes.length>o;o++)i=s.shapes[o],n=i.bounds(tt),t===!0&&(n.x-=i._rotationOffset.x,n.y-=i._rotationOffset.y),r=r.union(n);return r},_containerOffset:function(){var e=this.element.offset();return this.toolBar&&(e.top+=this.toolBar.element.outerHeight()),e},documentToView:function(e){var t=this._containerOffset();return new Q(e.x-t.left,e.y-t.top)},viewToDocument:function(e){var t=this._containerOffset();return new Q(e.x+t.left,e.y+t.top)},viewToModel:function(e){return this._transformWithMatrix(e,this._matrixInvert)},modelToView:function(e){return this._transformWithMatrix(e,this._matrix)},modelToLayer:function(e){return this._transformWithMatrix(e,this._layerMatrix)},layerToModel:function(e){return this._transformWithMatrix(e,this._layerMatrixInvert)},documentToModel:function(e){var t=this.documentToView(e);return this.canvas.translate||(t.x=t.x+this.scroller.scrollLeft,t.y=t.y+this.scroller.scrollTop),this.viewToModel(t)},modelToDocument:function(e){return this.viewToDocument(this.modelToView(e))},_transformWithMatrix:function(e,t){var n,i,o=e;return e instanceof Q?t&&(o=t.apply(e)):(n=this._transformWithMatrix(e.topLeft(),t),i=this._transformWithMatrix(e.bottomRight(),t),o=W.fromPoints(n,i)),o},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.options.autoBind&&this.dataSource.fetch()},setConnectionsDataSource:function(e){this.options.connectionsDataSource=e,this._connectionDataSource(),this.options.autoBind&&this.connectionsDataSource.fetch()},layout:function(e){var t,n,i,o,r;switch(this._layouting=!0,ue(e)&&(e=this.options.layout),t=ue(e)||ue(e.type)?"Tree":e.type,t.toLowerCase()){case"tree":n=new I.TreeLayout(this);break;case"layered":n=new I.LayeredLayout(this);break;case"forcedirected":case"force":case"spring":case"springembedder":n=new I.SpringLayout(this);break;default:throw"Layout algorithm '"+t+"' is not supported."}i=new I.LayoutState(this),o=n.layout(e),o&&(r=new I.LayoutUndoUnit(i,o,e?e.animate:null),this.undoRedoService.add(r)),this._layouting=!1,this._redrawConnections()},getShapeById:function(e){var t;return(t=re.first(this.shapes,function(t){return t.visual.id===e}))?t:t=re.first(this.connections,function(t){return t.visual.id===e})},_extendLayoutOptions:function(e){e.layout&&(e.layout=L(I.LayoutBase.fn.defaultOptions||{},e.layout))},_selectionChanged:function(e,t){(e.length||t.length)&&this.trigger(Le,{selected:e,deselected:t})},_getValidZoom:function(e){return _e.min(_e.max(e,this.options.zoomMin),this.options.zoomMax)},_panTransform:function(e){var t=this,n=e||t._pan;t.canvas.translate?(t.scroller.scrollTo(n.x,n.y),t._zoomMainLayer()):(t._storePan(n),t._transformMainLayer())},_finishPan:function(){this.trigger(Oe,{total:this._pan,delta:Number.NaN})},_storePan:function(e){this._pan=e,this._storeViewMatrix()},_zoomMainLayer:function(){var e=this._zoom,t=new j(0,0,e,e);t.render(this.mainLayer),this._storeLayerMatrix(t),this._storeViewMatrix()},_transformMainLayer:function(){var e=this._pan,t=this._zoom,n=new j(e.x,e.y,t,t);n.render(this.mainLayer),this._storeLayerMatrix(n),this._storeViewMatrix()},_storeLayerMatrix:function(e){this._layerMatrix=e.toMatrix(),this._layerMatrixInvert=e.invert().toMatrix()},_storeViewMatrix:function(){var e=this._pan,t=this._zoom,n=new j(e.x,e.y,t,t);this._matrix=n.toMatrix(),this._matrixInvert=n.invert().toMatrix()},_toIndex:function(e,t){var n=this._getDiagramItems(e);this.mainLayer.toIndex(n.visuals,t),this._fixOrdering(n,!1)},_fixOrdering:function(e,t){var n,i,o=t?this.shapes.length-1:0,r=t?this.connections.length-1:0;for(n=0;e.shapes.length>n;n++)i=e.shapes[n],re.remove(this.shapes,i),re.insert(this.shapes,i,o);for(n=0;e.cons.length>n;n++)i=e.cons[n],re.remove(this.connections,i),re.insert(this.connections,i,r);
},_getDiagramItems:function(e){var t,n,i={},o=e;for(i.visuals=[],i.shapes=[],i.cons=[],e?pe(e)||(o=[e]):o=this._selectedItems.slice(),t=0;o.length>t;t++)n=o[t],n instanceof w?(i.shapes.push(n),i.visuals.push(n.visual)):n instanceof b&&(i.cons.push(n),i.visuals.push(n.visual));return i},_removeItem:function(e,t,n){e.select(!1),e instanceof w?(this._removeShapeDataItem(e),this._removeShape(e,t,n)):e instanceof b&&(this._removeConnectionDataItem(e),this._removeConnection(e,t)),this.mainLayer.remove(e.visual)},_removeShape:function(e,t,n){var i,o,r,s,a=[],l=[];for(this.toolService._removeHover(),t&&this.undoRedoService.addCompositeItem(new q(e)),re.remove(this.shapes,e),this._shapesQuadTree.remove(e),i=0;e.connectors.length>i;i++)for(r=e.connectors[i],s=0;r.connections.length>s;s++)o=r.connections[s],n&&M.inArray(o,n)||(o.sourceConnector==r?a.push(o):o.targetConnector==r&&l.push(o));for(i=0;a.length>i;i++)a[i].source(null,t),a[i].updateModel();for(i=0;l.length>i;i++)l[i].target(null,t),l[i].updateModel()},_removeConnection:function(e,t){e.sourceConnector&&re.remove(e.sourceConnector.connections,e),e.targetConnector&&re.remove(e.targetConnector.connections,e),t&&this.undoRedoService.addCompositeItem(new $(e)),re.remove(this.connections,e)},_removeDataItems:function(e,t){var n,i,o,r;for(e=pe(e)?e:[e];e.length;)if(n=e.shift(),o=this._dataMap[n.uid],o&&(this._removeShapeConnections(o),this._removeItem(o,!1),delete this._dataMap[n.uid],t&&n.hasChildren&&n.loaded()))for(i=n.children.data(),r=0;i.length>r;r++)e.push(i[r])},_removeShapeConnections:function(e){var t,n=e.connections();if(n)for(t=0;n.length>t;t++)this._removeItem(n[t],!1)},_addDataItem:function(e,t){var n,i;if(fe(e))return(n=this._dataMap[e.id])?n:(i=L({},this.options.shapeDefaults),i.dataItem=e,n=new w(i,this),this.addShape(n,t!==!1),this._dataMap[e.id]=n,n)},_addDataItemByUid:function(e){var t,n;if(fe(e))return(t=this._dataMap[e.uid])?t:(n=L({},this.options.shapeDefaults),n.dataItem=e,t=new w(n,this),this.addShape(t),this._dataMap[e.uid]=t,t)},_addDataItems:function(e,t){var n,i,o,r,s;for(i=0;e.length>i;i++)n=e[i],o=this._addDataItemByUid(n),r=this._addDataItemByUid(t),r&&!this.connected(r,o)&&(s=this.connect(r,o))},_refreshSource:function(e){var t,n,i=this,o=e.node,r=e.action,s=e.items,a=i.options;if(!e.field){if("remove"==r)this._removeDataItems(e.items,!0);else for(r&&"itemloaded"!==r||this._bindingRoots||(this._bindingRoots=!0,n=!0),r||o||i.clear(),this._addDataItems(s,o),t=0;s.length>t;t++)s[t].load();a.layout&&(n||"remove"==r||"add"==r)&&i.layout(a.layout),n&&(this.trigger("dataBound"),this._bindingRoots=!1)}},_mouseDown:function(e){var t=this._calculatePosition(e);1==e.which&&this.toolService.start(t,this._meta(e))&&(this._destroyToolBar(),e.preventDefault())},_addItem:function(e){e instanceof w?this.addShape(e):e instanceof b&&this.addConnection(e)},_mouseUp:function(e){var t=this._calculatePosition(e);1==e.which&&this.toolService.end(t,this._meta(e))&&(this._createToolBar(),e.preventDefault())},_createToolBar:function(){var e,t,n,i,o,r,s,a,l,c=this.toolService.diagram;this.singleToolBar||1!==c.select().length||(e=c.select()[0],e&&e.options.editable!==!1&&(t=e.options.editable,n=t.tools,this._isEditable&&0===n.length&&(e instanceof w?n=["edit","rotateClockwise","rotateAnticlockwise"]:e instanceof b&&(n=["edit"]),t&&t.remove!==!1&&n.push("delete")),n&&n.length&&(i=20,this.singleToolBar=new k(c,{tools:n,click:z(this._toolBarClick,this),modal:!0}),r=this.singleToolBar._popup.element.outerWidth(),s=this.singleToolBar._popup.element.outerHeight(),e instanceof w?(a=this.modelToView(e.bounds(tt)),o=Q(a.x,a.y).minus(Q((r-a.width)/2,s+i))):e instanceof b&&(l=this.modelToView(e.bounds()),o=Q(l.x,l.y).minus(Q((r-l.width-20)/2,s+i))),o?(this.canvas.translate||(o=o.minus(Q(this.scroller.scrollLeft,this.scroller.scrollTop))),o=this.viewToDocument(o),o=Q(_e.max(o.x,0),_e.max(o.y,0)),this.singleToolBar.showAt(o)):this._destroyToolBar())))},_toolBarClick:function(e){this.trigger("toolBarClick",e),this._destroyToolBar()},_mouseMove:function(e){if(!this.pauseMouseHandlers){var t=this._calculatePosition(e);0!==e.which&&1!=e.which||!this.toolService.move(t,this._meta(e))||e.preventDefault()}},_keydown:function(e){this.toolService.keyDown(e.keyCode,this._meta(e))&&e.preventDefault()},_wheel:function(e){var t=n(e),i=this._calculatePosition(e),o=L(this._meta(e),{delta:t});this.toolService.wheel(i,o)&&e.preventDefault()},_meta:function(e){return{ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}},_calculatePosition:function(e){var n=e.pageX===t?e.originalEvent:e,i=new Q(n.pageX,n.pageY),o=this.documentToModel(i);return o},_normalizePointZoom:function(e){return e.times(1/this.zoom())},_initialize:function(){this.shapes=[],this._selectedItems=[],this.connections=[],this._dataMap={},this._connectionsDataMap={},this._inactiveShapeItems=new h,this._deferredConnectionUpdates=[],this.undoRedoService=new J({undone:this._syncHandler,redone:this._syncHandler}),this.id=I.randomId()},_fetchFreshData:function(){var e=this;e._dataSource(),e._isEditable&&e._connectionDataSource(),e.options.autoBind&&(e._isEditable?(this._loadingShapes=!0,this._loadingConnections=!0,e.dataSource.fetch(),e.connectionsDataSource.fetch()):e.dataSource.fetch())},_dataSource:function(){var e,t;fe(this.options.connectionsDataSource)?(this._isEditable=!0,e=this.options.dataSource||{},t=pe(e)?{data:e}:e,this.dataSource&&this._shapesRefreshHandler?this.dataSource.unbind("change",this._shapesRefreshHandler).unbind("requestStart",this._shapesRequestStartHandler).unbind("error",this._shapesErrorHandler):(this._shapesRefreshHandler=z(this._refreshShapes,this),this._shapesRequestStartHandler=z(this._shapesRequestStart,this),this._shapesErrorHandler=z(this._error,this)),this.dataSource=kendo.data.DataSource.create(t).bind("change",this._shapesRefreshHandler).bind("requestStart",this._shapesRequestStartHandler).bind("error",this._shapesErrorHandler)):(this._treeDataSource(),this._isEditable=!1)},_connectionDataSource:function(){var e,t=this.options.connectionsDataSource;t&&(e=pe(t)?{data:t}:t,this.connectionsDataSource&&this._connectionsRefreshHandler?this.connectionsDataSource.unbind("change",this._connectionsRefreshHandler).unbind("requestStart",this._connectionsRequestStartHandler).unbind("error",this._connectionsErrorHandler):(this._connectionsRefreshHandler=z(this._refreshConnections,this),this._connectionsRequestStartHandler=z(this._connectionsRequestStart,this),this._connectionsErrorHandler=z(this._connectionsError,this)),this.connectionsDataSource=kendo.data.DataSource.create(e).bind("change",this._connectionsRefreshHandler).bind("requestStart",this._connectionsRequestStartHandler).bind("error",this._connectionsErrorHandler))},_shapesRequestStart:function(e){"read"==e.type&&(this._loadingShapes=!0)},_connectionsRequestStart:function(e){"read"==e.type&&(this._loadingConnections=!0)},_error:function(){this._loadingShapes=!1},_connectionsError:function(){this._loadingConnections=!1},_refreshShapes:function(e){"remove"===e.action?this._shouldRefresh()&&this._removeShapes(e.items):"itemchange"===e.action?this._shouldRefresh()&&this._updateShapes(e.items,e.field):"add"===e.action?this._inactiveShapeItems.add(e.items):"sync"===e.action?this._syncShapes(e.items):this.refresh()},_shouldRefresh:function(){return!this._suspended},_suspendModelRefresh:function(){this._suspended=(this._suspended||0)+1},_resumeModelRefresh:function(){this._suspended=_e.max((this._suspended||0)-1,0)},refresh:function(){this._loadingShapes=!1,this._loadingConnections||this._rebindShapesAndConnections()},_rebindShapesAndConnections:function(){this.clear(),this._addShapes(this.dataSource.view()),this.connectionsDataSource&&this._addConnections(this.connectionsDataSource.view(),!1),this.options.layout?this.layout(this.options.layout):this._redrawConnections(),this.trigger("dataBound")},refreshConnections:function(){this._loadingConnections=!1,this._loadingShapes||this._rebindShapesAndConnections()},_redrawConnections:function(){var e,t=this.connections;for(e=0;t.length>e;e++)t[e].refresh()},_removeShapes:function(e){var t,n,i=this._dataMap;for(n=0;e.length>n;n++)t=e[n],i[t.id]&&(this.remove(i[t.id],!1),i[t.id]=null)},_syncShapes:function(){var e=this,t=e._inactiveShapeItems;t.forEach(function(n){var i=n.dataItem,o=n.element;i.isNew()||(o?(o._setOptionsFromModel(),e.addShape(o,n.undoable),e._dataMap[i.id]=o):e._addDataItem(i),n.activate(),t.remove(i))})},_updateShapes:function(e,t){var n,i,o;for(n=0;e.length>n;n++)i=e[n],o=this._dataMap[i.id],o&&o.updateOptionsFromModel(i,t)},_addShapes:function(e){for(var t=0;e.length>t;t++)this._addDataItem(e[t],!1)},_refreshConnections:function(e){"remove"===e.action?this._shouldRefresh()&&this._removeConnections(e.items):"add"===e.action?this._addConnections(e.items):"sync"===e.action||("itemchange"===e.action?this._shouldRefresh()&&this._updateConnections(e.items):this.refreshConnections())},_removeConnections:function(e){for(var t=0;e.length>t;t++)this.remove(this._connectionsDataMap[e[t].uid],!1),this._connectionsDataMap[e[t].uid]=null},_updateConnections:function(e){var t,n,i;for(t=0;e.length>t;t++)n=e[t],i=this._connectionsDataMap[n.uid],i.updateOptionsFromModel(n)},_addConnections:function(e,t){var n,i,o=e.length;for(n=0;o>n;n++)i=e[n],this._addConnectionDataItem(i,t)},_addConnectionDataItem:function(e,t){var n,i,o,r;this._connectionsDataMap[e.uid]||(n=this._validateConnector(e.from),fe(n)&&null!==n||(n=new Q(e.fromX,e.fromY)),i=this._validateConnector(e.to),fe(i)&&null!==i||(i=new Q(e.toX,e.toY)),fe(n)&&fe(i)&&(o=L({},this.options.connectionDefaults),o.dataItem=e,r=new b(n,i,o),this._connectionsDataMap[e.uid]=r,this.addConnection(r,t)))},_validateConnector:function(e){var t;return fe(e)&&null!==e&&(t=this._dataMap[e]),t},_treeDataSource:function(){var e=this,t=e.options,n=t.dataSource;n=pe(n)?{data:n}:n,n.fields||(n.fields=[{field:"text"},{field:"url"},{field:"spriteCssClass"},{field:"imageUrl"}]),e.dataSource&&e._refreshHandler&&e._unbindDataSource(),e._refreshHandler=z(e._refreshSource,e),e._errorHandler=z(e._error,e),e.dataSource=O.create(n).bind(xe,e._refreshHandler).bind(Me,e._errorHandler)},_unbindDataSource:function(){var e=this;e.dataSource.unbind(xe,e._refreshHandler).unbind(Me,e._errorHandler)},_adorn:function(e,n){n!==t&&e&&(n?(this._adorners.push(e),this.adornerLayer.append(e.visual)):(re.remove(this._adorners,e),this.adornerLayer.remove(e.visual)))},_showConnectors:function(e,t){t?this._connectorsAdorner.show(e):this._connectorsAdorner.destroy()},_updateAdorners:function(){var e,t,n=this._adorners;for(e=0;n.length>e;e++)t=n[e],t.refreshBounds&&t.refreshBounds(),t.refresh()},_refresh:function(){for(var e=0;this.connections.length>e;e++)this.connections[e].refresh()},_destroyToolBar:function(){this.singleToolBar&&(this.singleToolBar.hide(),this.singleToolBar.destroy(),this.singleToolBar=null)},_destroyGlobalToolBar:function(){this.toolBar&&(this.toolBar.hide(),this.toolBar.destroy(),this.toolBar=null)},exportDOMVisual:function(){var e=this.canvas._viewBox,t=P.transform().translate(-e.x,-e.y),n=new P.Rect([0,0],[e.width,e.height]),i=E.Path.fromRect(n),o=new E.Group({transform:t}),r=new E.Group({clip:i}),s=this.canvas.drawingElement.children[0];return r.append(o),o.children.push(s),r},exportVisual:function(){var e=P.transform().scale(1/this._zoom),t=new E.Group({transform:e}),n=this.mainLayer.drawingElement;return t.children.push(n),t},_syncChanges:function(){this._syncShapeChanges(),this._syncConnectionChanges()},_syncShapeChanges:function(){this.dataSource&&this._isEditable&&this.dataSource.sync()},_syncConnectionChanges:function(){var t=this;t.connectionsDataSource&&t._isEditable&&(e.when.apply(e,t._deferredConnectionUpdates).then(function(){t.connectionsDataSource.sync()}),t.deferredConnectionUpdates=[])}}),M.ExportMixin.extend(x.fn,!0),kendo.PDFMixin&&kendo.PDFMixin.extend(x.fn),k=kendo.Observable.extend({init:function(e,t){kendo.Observable.fn.init.call(this),this.diagram=e,this.options=L({},this.options,t),this._tools=[],this.createToolBar(),this.createTools(),this.appendTools(),this.options.modal&&this.createPopup(),this.bind(this.events,t)},events:["click"],createPopup:function(){this.container=e("
").append(this.element),this._popup=this.container.kendoPopup({}).getKendoPopup()},appendTools:function(){var e,t;for(e=0;this._tools.length>e;e++)t=this._tools[e],(t.buttons&&t.buttons.length||!fe(t.buttons))&&this._toolBar.add(t)},createToolBar:function(){this.element=e("
"),this._toolBar=this.element.kendoToolBar({click:z(this.click,this),resizable:!1}).getKendoToolBar(),this.element.css("border","none")},createTools:function(){for(var e=0;this.options.tools.length>e;e++)this.createTool(this.options.tools[e])},createTool:function(e){var t=(ve(e)?e.name:e)+"Tool";this[t]?this[t](e):this._tools.push(e)},showAt:function(e){this._popup&&this._popup.open(e.x,e.y)},hide:function(){this._popup&&this._popup.close()},newGroup:function(){return{type:"buttonGroup",buttons:[]}},editTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-pencil",showText:"overflow",type:"button",text:"Edit",attributes:this._setAttributes({action:"edit"})})},deleteTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-close",showText:"overflow",type:"button",text:"Delete",attributes:this._setAttributes({action:"delete"})})},rotateAnticlockwiseTool:function(e){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotateccw",showText:"overflow",text:"RotateAnticlockwise",group:"rotate",attributes:this._setAttributes({action:"rotateAnticlockwise",step:e.step})})},rotateClockwiseTool:function(e){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotatecw",attributes:this._setAttributes({action:"rotateClockwise",step:e.step}),showText:"overflow",text:"RotateClockwise",group:"rotate"})},createShapeTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-shape",showText:"overflow",text:"CreateShape",group:"create",attributes:this._setAttributes({action:"createShape"})})},createConnectionTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-connector",showText:"overflow",text:"CreateConnection",group:"create",attributes:this._setAttributes({action:"createConnection"})})},undoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-undo",showText:"overflow",text:"Undo",group:"history",attributes:this._setAttributes({action:"undo"})})},redoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-redo",showText:"overflow",text:"Redo",group:"history",attributes:this._setAttributes({action:"redo"})})},_appendGroup:function(e){var t="_"+e+"Group";this[t]||(this[t]=this.newGroup(),this._tools.push(this[t]))},_setAttributes:function(e){var t={};return e.action&&(t[kendo.attr("action")]=e.action),e.step&&(t[kendo.attr("step")]=e.step),t},_getAttributes:function(e){var t,n={},i=e.attr(kendo.attr("action"));return i&&(n.action=i),t=e.attr(kendo.attr("step")),t&&(n.step=t),n},click:function(t){var n=this._getAttributes(e(t.target)),i=n.action;i&&this[i](n),this.trigger("click",this.eventData(i))},eventData:function(e){var t=this.selectedElements(),n=[],i=[];return t instanceof w?n.push(t):i.push(t),{shapes:n,connections:i,action:e}},"delete":function(){var e=this.diagram,t=e._triggerRemove(this.selectedElements());t.length&&(this.diagram.remove(t,!0),this.diagram._syncChanges())},edit:function(){this.diagram.edit(this.selectedElements()[0])},rotateClockwise:function(e){var t=parseFloat(e.step||90);this._rotate(t)},rotateAnticlockwise:function(e){var t=parseFloat(e.step||90);this._rotate(-t)},_rotate:function(e){var t=this.diagram._resizingAdorner;t.angle(t.angle()+e),t.rotate()},selectedElements:function(){return this.diagram.select()},createShape:function(){this.diagram.createShape()},createConnection:function(){this.diagram.createConnection()},undo:function(){this.diagram.undo()},redo:function(){this.diagram.redo()},destroy:function(){this.diagram=null,this.element=null,this.options=null,this._toolBar&&this._toolBar.destroy(),this._popup&&this._popup.destroy()}}),C=kendo.Observable.extend({init:function(e,t){kendo.Observable.fn.init.call(this),this.options=F(!0,{},this.options,t),this.element=e,this.model=this.options.model,this.fields=this._getFields(),this._initContainer(),this.createEditable()},options:{editors:{}},_initContainer:function(){this.wrapper=this.element},createEditable:function(){var e=this.options;this.editable=new kendo.ui.Editable(this.wrapper,{fields:this.fields,target:e.target,clearContainer:!1,model:this.model})},_isEditable:function(e){return this.model.editable&&this.model.editable(e)},_getFields:function(){var e,t,n,i=[],o=this.model.fields;for(e in o)t={},this._isEditable(e)&&(n=this.options.editors[e],n&&(t.editor=n),t.field=e,i.push(t));return i},end:function(){return this.editable.end()},destroy:function(){this.editable.destroy(),this.editable.element.find("["+kendo.attr("container-for")+"]").empty(),this.model=this.wrapper=this.element=this.columns=this.editable=null}}),S=C.extend({init:function(e,t){C.fn.init.call(this,e,t),this.bind(this.events,this.options),this.open()},events:["update","cancel"],options:{window:{modal:!0,resizable:!1,draggable:!0,title:"Edit",visible:!1}},_initContainer:function(){var t,n=this;this.wrapper=e('').attr(kendo.attr("uid"),this.model.uid),t="",this.options.template?(t+=this._renderTemplate(),this.fields=[]):t+=this._renderFields(),t+=this._renderButtons(),this.wrapper.append(e('
').append(t)),this.window=new kendo.ui.Window(this.wrapper.appendTo(this.element),this.options.window),this.window.bind("close",function(e){e.userTriggered&&(e.sender.element.focus(),n._cancelClick(e))}),this._attachButtonEvents()},_renderTemplate:function(){var e=this.options.template;return"string"==typeof e&&(e=window.unescape(e)),e=kendo.template(e)(this.model)},_renderFields:function(){var e,t,n="";for(e=0;this.fields.length>e;e++)t=this.fields[e],n+=''+(t.field||"")+"
",this._isEditable(t.field)&&(n+="
');return n},_renderButtons:function(){var e='';return e+=this._createButton("update"),e+=this._createButton("cancel"),e+="
"},_createButton:function(e){return kendo.template(ht)(v[e])},_attachButtonEvents:function(){this._cancelClickHandler=z(this._cancelClick,this),this.window.element.on(ke+ye,"a.k-diagram-cancel",this._cancelClickHandler),this._updateClickHandler=z(this._updateClick,this),this.window.element.on(ke+ye,"a.k-diagram-update",this._updateClickHandler)},_updateClick:function(e){e.preventDefault(),this.trigger("update")},_cancelClick:function(e){e.preventDefault(),this.trigger("cancel")},open:function(){this.window.center().open()},close:function(){this.window.bind("deactivate",z(this.destroy,this)).close()},destroy:function(){this.window.close().destroy(),this.window.element.off(ke+ye,"a.k-diagram-cancel",this._cancelClickHandler),this.window.element.off(ke+ye,"a.k-diagram-update",this._updateClickHandler),this._cancelClickHandler=null,this._editUpdateClickHandler=null,this.window=null,C.fn.destroy.call(this)}}),c.fn=c.prototype={onActivate:function(t){var n=e.Deferred();return this.callbacks.push({callback:t,deferred:n}),n},activate:function(){var e,t,n=this.callbacks;for(t=0;n.length>t;t++)e=this.callbacks[t],e.callback(this.dataItem),e.deferred.resolve();this.callbacks=[]}},h.fn=h.prototype={add:function(e){for(var t=0;e.length>t;t++)this.items[e[t].uid]=new c(e[t])},forEach:function(e){for(var t in this.items)e(this.items[t])},getByUid:function(e){return this.items[e]},remove:function(e){delete this.items[e.uid]}},T=B.extend({init:function(){this.shapes=[]},_add:function(e,t){this.shapes.push({bounds:t,shape:e}),e._quadNode=this},insert:function(e,t){this._add(e,t)},remove:function(e){var t,n=this.shapes,i=n.length;for(t=0;i>t;t++)if(n[t].shape===e){n.splice(t,1);break}},hitTestRect:function(e){var t,n=this.shapes,i=n.length;for(t=0;i>t;t++)if(this._testRect(n[t].shape,e))return!0},_testRect:function(e,t){var n,i=e.rotate().angle,o=e.bounds();return n=i?K.rects(t,o,-i):o.overlaps(t)}}),A=T.extend({init:function(e){T.fn.init.call(this),this.children=[],this.rect=e},inBounds:function(e){var t=this.rect,n=t.bottomRight(),i=e.bottomRight(),o=e.x>=t.x&&e.y>=t.y&&n.x>=i.x&&n.y>=i.y;return o},overlapsBounds:function(e){return this.rect.overlaps(e)},insert:function(e,t){var n,i=!1,o=this.children,r=o.length;if(this.inBounds(t)){if(!r&&4>this.shapes.length)this._add(e,t);else{for(r||this._initChildren(),n=0;o.length>n;n++)if(o[n].insert(e,t)){i=!0;break}i||this._add(e,t)}i=!0}return i},_initChildren:function(){var e,t,n=this.rect,i=this.children,o=this.shapes,r=n.center(),s=n.width/2,a=n.height/2;for(i.push(new A(new W(n.x,n.y,s,a)),new A(new W(r.x,n.y,s,a)),new A(new W(n.x,r.y,s,a)),new A(new W(r.x,r.y,s,a))),t=o.length-1;t>=0;t--)for(e=0;i.length>e;e++)if(i[e].insert(o[t].shape,o[t].bounds)){o.splice(t,1);break}},hitTestRect:function(e){var t,n=this.children,i=n.length,o=!1;if(this.overlapsBounds(e))if(T.fn.hitTestRect.call(this,e))o=!0;else for(t=0;i>t;t++)if(n[t].hitTestRect(e)){o=!0;break}return o}}),D=B.extend({ROOT_SIZE:1e3,init:function(e){var t=z(this._boundsChange,this);e.bind(be,t),e.bind(Fe,t),this.initRoots()},initRoots:function(){this.rootMap={},this.root=new T},clear:function(){this.initRoots()},_boundsChange:function(e){e.item._quadNode&&e.item._quadNode.remove(e.item),this.insert(e.item)},insert:function(e){var t=e.bounds(tt),n=this.ROOT_SIZE,i=this.getSectors(t),o=i[0][0],r=i[1][0];this.inRoot(i)?this.root.insert(e,t):(this.rootMap[o]||(this.rootMap[o]={}),this.rootMap[o][r]||(this.rootMap[o][r]=new A(new W(o*n,r*n,n,n))),this.rootMap[o][r].insert(e,t))},remove:function(e){e._quadNode&&e._quadNode.remove(e)},inRoot:function(e){return e[0].length>1||e[1].length>1},getSectors:function(e){var t,n,i=this.ROOT_SIZE,o=e.bottomRight(),r=_e.floor(o.x/i),s=_e.floor(o.y/i),a=[[],[]];for(t=_e.floor(e.x/i);r>=t;t++)a[0].push(t);for(n=_e.floor(e.y/i);s>=n;n++)a[1].push(n);return a},hitTestRect:function(e){var t,n,i,o,r,s=this.getSectors(e);if(this.root.hitTestRect(e))return!0;for(t=0;s[0].length>t;t++)for(i=s[0][t],n=0;s[1].length>n;n++)if(o=s[1][n],r=(this.rootMap[i]||{})[o],r&&r.hitTestRect(e))return!0;return!1}}),M.ui.plugin(x),L(I,{Shape:w,Connection:b,Connector:y,DiagramToolBar:k,QuadNode:A,QuadRoot:T,ShapesQuadTree:D,PopupEditor:S})}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t){if(null===t)return t;var n=x(e,!0);return n(t)}function i(e){return typeof e!==P}function o(e,t,n){var i,o,l=a(e),c=a(t),h=u(e)-u(t)<0,d=[];for(d.push(e),i=0;n>i;i++)o={r:r(l.r,c.r,i,n,h),g:r(l.g,c.g,i,n,h),b:r(l.b,c.b,i,n,h)},d.push(s(o));return d.push(t),d}function r(e,t,n,i,o){var r,s=f.min(f.abs(e),f.abs(t)),a=f.max(f.abs(e),f.abs(t)),l=(a-s)/(i+1),c=l*(n+1);return r=o?s+c:a-c}function s(e){return"#"+l(e.r)+l(e.g)+l(e.b)}function a(e){e=e.replace("#","");var t=c(e);return{r:h(t.r),g:h(t.g),b:h(t.b)}}function l(e){var t=f.round(e).toString(16).toUpperCase();return 1===t.length&&(t="0"+t),t}function c(e){var t=e.length,n={};return 3===t?(n.r=e[0],n.g=e[1],n.b=e[2]):(n.r=e.substring(0,2),n.g=e.substring(2,4),n.b=e.substring(4,6)),n}function h(e){return parseInt(e.toString(16),16)}function u(e){var t=0;return e&&(e=a(e),t=f.sqrt(.241*e.r*e.r+.691*e.g*e.g+.068*e.b*e.b)),t}function d(e){var t=f.pow(10,4);return f.round(e*t)/t}var f=Math,p=e.proxy,g=e.isArray,m=window.kendo,v=m.Class,_=m.ui.Widget,y=m.template,w=m.deepExtend,b=m.data.HierarchicalDataSource,x=m.getter,k=m.dataviz,C=".kendoTreeMap",S="change",T="dataBound",A="itemCreated",D=Number.MAX_VALUE,M="mouseover"+C,E="mouseleave"+C,P="undefined",I=_.extend({init:function(t,n){m.destroy(t),e(t).empty(),_.fn.init.call(this,t,n),this.wrapper=this.element,this._initTheme(this.options),this.element.addClass("k-widget k-treemap"),this._setLayout(),this._originalOptions=w({},this.options),this._initDataSource(),this._attachEvents(),m.notify(this,k.ui)},options:{name:"TreeMap",theme:"default",autoBind:!0,textField:"text",valueField:"value",colorField:"color"},events:[T,A],_initTheme:function(e){var t=this,n=k.ui.themes||{},i=((e||{}).theme||"").toLowerCase(),o=(n[i]||{}).treeMap;t.options=w({},o,e)},_attachEvents:function(){this.element.on(M,p(this._mouseover,this)).on(E,p(this._mouseleave,this))},_setLayout:function(){"horizontal"===this.options.type?(this._layout=new z(!1),this._view=new L(this,this.options)):"vertical"===this.options.type?(this._layout=new z(!0),this._view=new L(this,this.options)):(this._layout=new R,this._view=new B(this,this.options))},_initDataSource:function(){var e=this,t=e.options,n=t.dataSource;e._dataChangeHandler=p(e._onDataChange,e),e.dataSource=b.create(n).bind(S,e._dataChangeHandler),n&&e.options.autoBind&&e.dataSource.fetch()},setDataSource:function(e){var t=this;t.dataSource.unbind(S,t._dataChangeHandler),t.dataSource=e.bind(S,t._dataChangeHandler),e&&t.options.autoBind&&t.dataSource.fetch()},_onDataChange:function(e){var t,n,i,o,r=e.node,s=e.items,a=this.options;if(r){if(s.length){for(i=this._getByUid(r.uid),i.children=[],s=new m.data.Query(s)._sortForGrouping(a.valueField,"desc"),n=0;s.length>n;n++)t=s[n],i.children.push(this._wrapItem(t));o=this._view.htmlSize(i),this._layout.compute(i.children,i.coord,o),this._setColors(i.children),this._view.render(i)}}else this.element.empty(),t=this._wrapItem(s[0]),this._layout.createRoot(t,this.element.outerWidth(),this.element.outerHeight(),"vertical"===this.options.type),this._view.createRoot(t),this._root=t,this._colorIdx=0;for(n=0;s.length>n;n++)s[n].load();r&&this.trigger(T,{node:r})},_setColors:function(e){var t,n,r,s,a=this.options.colors,l=this._colorIdx,c=a[l%a.length];for(g(c)&&(t=o(c[0],c[1],e.length)),r=!1,s=0;e.length>s;s++)n=e[s],i(n.color)||(n.color=t?t[s]:c),n.dataItem.hasChildren||(r=!0);r&&this._colorIdx++},_contentSize:function(e){this.view.renderHeight(e)},_wrapItem:function(e){var t={};return i(this.options.valueField)&&(t.value=n(this.options.valueField,e)),i(this.options.colorField)&&(t.color=n(this.options.colorField,e)),i(this.options.textField)&&(t.text=n(this.options.textField,e)),t.level=e.level(),t.dataItem=e,t},_getByUid:function(e){for(var t,n=[this._root];n.length;){if(t=n.pop(),t.dataItem.uid===e)return t;t.children&&(n=n.concat(t.children))}},dataItem:function(t){var n=e(t).attr(m.attr("uid")),i=this.dataSource;return i&&i.getByUid(n)},findByUid:function(e){return this.element.find(".k-treemap-tile["+m.attr("uid")+"='"+e+"']")},_mouseover:function(t){var n=e(t.target);n.hasClass("k-leaf")&&(this._removeActiveState(),n.removeClass("k-state-hover").addClass("k-state-hover"))},_removeActiveState:function(){this.element.find(".k-state-hover").removeClass("k-state-hover")},_mouseleave:function(){this._removeActiveState()},destroy:function(){_.fn.destroy.call(this),this.element.off(C),this.dataSource&&this.dataSource.unbind(S,this._dataChangeHandler),this._root=null,m.destroy(this.element)},items:function(){return e()},getSize:function(){return m.dimensions(this.element)},_resize:function(){this.dataSource.fetch()},setOptions:function(e){var n=e.dataSource;e.dataSource=t,this._originalOptions=w(this._originalOptions,e),this.options=w({},this._originalOptions),this._setLayout(),this._initTheme(this.options),_.fn._setEvents.call(this,e),n&&this.setDataSource(b.create(n)),this.options.autoBind&&this.dataSource.fetch()}}),R=v.extend({createRoot:function(e,t,n){e.coord={width:t,height:n,top:0,left:0}},leaf:function(e){return!e.children},layoutChildren:function(e,t){var n,i,o,r,s=t.width*t.height,a=0,l=[];for(n=0;e.length>n;n++)l[n]=parseFloat(e[n].value),a+=l[n];for(n=0;l.length>n;n++)e[n].area=s*l[n]/a;i=this.layoutHorizontal()?t.height:t.width,o=[e[0]],r=e.slice(1),this.squarify(r,o,i,t)},squarify:function(e,t,n,i){this.computeDim(e,t,n,i)},computeDim:function(e,n,i,o){var r,s,a;return e.length+n.length==1?(r=1==e.length?e:n,this.layoutLast(r,i,o),t):(e.length>=2&&0===n.length&&(n=[e[0]],e=e.slice(1)),0===e.length?(n.length>0&&this.layoutRow(n,i,o),t):(s=e[0],this.worstAspectRatio(n,i)>=this.worstAspectRatio([s].concat(n),i)?this.computeDim(e.slice(1),n.concat([s]),i,o):(a=this.layoutRow(n,i,o),this.computeDim(e,[],a.dim,a)),t))},layoutLast:function(e,t,n){e[0].coord=n},layoutRow:function(e,t,n){return this.layoutHorizontal()?this.layoutV(e,t,n):this.layoutH(e,t,n)},orientation:"h",layoutVertical:function(){return"v"===this.orientation},layoutHorizontal:function(){return"h"===this.orientation},layoutChange:function(){this.orientation=this.layoutVertical()?"h":"v"},worstAspectRatio:function(e,t){var n,i,o,r,s;if(!e||0===e.length)return D;for(n=0,i=0,o=D,r=0;e.length>r;r++)s=e[r].area,n+=s,o=s>o?o:s,i=i>s?i:s;return f.max(t*t*i/(n*n),n*n/(t*t*o))},compute:function(e,t,n){if(t.width>=t.height&&this.layoutHorizontal()||this.layoutChange(),e&&e.length>0){var i={width:t.width,height:t.height-n.text,top:0,left:0};this.layoutChildren(e,i)}},layoutV:function(e,t,n){var i,o,r,s=this._totalArea(e),a=0;for(t=d(s/t),i=0;e.length>i;i++)o=d(e[i].area/t),e[i].coord={height:o,width:t,top:n.top+a,left:n.left},a+=o;return r={height:n.height,width:n.width-t,top:n.top,left:n.left+t},r.dim=f.min(r.width,r.height),r.dim!=r.height&&this.layoutChange(),r},layoutH:function(e,t,n){var i,o,r=this._totalArea(e),s=d(r/t),a=n.top,l=0;for(i=0;e.length>i;i++)e[i].coord={height:s,width:d(e[i].area/s),top:a,left:n.left+l},l+=e[i].coord.width;return o={height:n.height-s,width:n.width,top:n.top+s,left:n.left},o.dim=f.min(o.width,o.height),o.dim!=o.width&&this.layoutChange(),o},_totalArea:function(e){var t,n=0;for(t=0;e.length>t;t++)n+=e[t].area;return n}}),B=v.extend({init:function(t,n){this.options=w({},this.options,n),this.treeMap=t,this.element=e(t.element),this.offset=0},htmlSize:function(e){var t,n,i=this._getByUid(e.dataItem.uid),o={text:0};return e.children&&(this._clean(i),t=this._getText(e),t&&(n=this._createTitle(e),i.append(n),o.text=n.height()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),o},_getByUid:function(e){return this.element.find(".k-treemap-tile["+m.attr("uid")+"='"+e+"']")},render:function(e){var t,n,i,o,r=this._getByUid(e.dataItem.uid),s=e.children;if(s)for(t=r.find(".k-treemap-wrap"),n=0;s.length>n;n++)i=s[n],o=this._createLeaf(i),t.append(o),this.treeMap.trigger(A,{element:o})},createRoot:function(e){var t=this._createLeaf(e);this.element.append(t),this.treeMap.trigger(A,{element:t})},_clean:function(e){e.css("background-color",""),e.removeClass("k-leaf"),e.removeClass("k-inverse"),e.empty()},_createLeaf:function(t){return this._createTile(t).css("background-color",t.color).addClass("k-leaf").toggleClass("k-inverse",this._tileColorBrightness(t)>180).append(e("
").html(this._getText(t)))},_createTile:function(t){var n,o={width:t.coord.width,height:t.coord.height,left:t.coord.left,top:t.coord.top};return o.width+=o.left&&this.offset?2*this.offset:this.offset,o.height+=o.top?2*this.offset:this.offset,n=e("
").css({width:o.width,height:o.height,left:o.left,top:o.top}),i(t.dataItem)&&i(t.dataItem.uid)&&n.attr(m.attr("uid"),t.dataItem.uid),n},_getText:function(e){var t=e.text;return this.options.template&&(t=this._renderTemplate(e)),t},_renderTemplate:function(e){var t=y(this.options.template);return t({dataItem:e.dataItem,text:e.text})},_createTitle:function(t){return e("
").append(e("
").html(this._getText(t)))},_createWrap:function(){return e("
");
},_tileColorBrightness:function(e){return u(e.color)}}),z=v.extend({createRoot:function(e,t,n,i){e.coord={width:t,height:n,top:0,left:0},e.vertical=i},init:function(e){this.vertical=e,this.quotient=e?1:0},compute:function(e,t,n){var i,o,r;e.length>0&&(i=t.width,o=t.height,this.vertical?o-=n.text:i-=n.text,r={width:i,height:o,top:0,left:0},this.layoutChildren(e,r))},layoutChildren:function(e,t){var n,i,o=t.width*t.height,r=0,s=[];for(n=0;e.length>n;n++)i=e[n],s[n]=parseFloat(e[n].value),r+=s[n],i.vertical=this.vertical;for(n=0;s.length>n;n++)e[n].area=o*s[n]/r;this.sliceAndDice(e,t)},sliceAndDice:function(e,t){var n=this._totalArea(e);e[0].level%2===this.quotient?this.layoutHorizontal(e,t,n):this.layoutVertical(e,t,n)},layoutHorizontal:function(e,t,n){var i,o,r,s=0;for(i=0;e.length>i;i++)o=e[i],r=o.area/(n/t.width),o.coord={height:t.height,width:r,top:t.top,left:t.left+s},s+=r},layoutVertical:function(e,t,n){var i,o,r,s=0;for(i=0;e.length>i;i++)o=e[i],r=o.area/(n/t.height),o.coord={height:r,width:t.width,top:t.top+s,left:t.left},s+=r},_totalArea:function(e){var t,n=0;for(t=0;e.length>t;t++)n+=e[t].area;return n}}),L=B.extend({htmlSize:function(e){var t,n,i=this._getByUid(e.dataItem.uid),o={text:0,offset:0};return e.children&&(this._clean(i),t=this._getText(e),t&&(n=this._createTitle(e),i.append(n),o.text=e.vertical?n.height():n.width()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),o},_createTitle:function(t){var n;return n=e(t.vertical?"
":"
"),n.append(e("
").html(this._getText(t)))}});k.ui.plugin(I)}(window.kendo.jQuery)}(),function(){!function(e,t,n){"use strict";function i(e){var t=C;try{return C=function(e){return e()},e()}finally{C=t}}function o(t,i,o,c,h,m){function v(){var n,m,v,_,y,k,C;return o.kRebind&&(n=e(e(i)[0].cloneNode(!0))),S=r(t,i,o,c,x).options,i.is("select")&&!function(t){if(t.length>0){var n=e(t[0]);!/\S/.test(n.text())&&/^\?/.test(n.val())&&n.remove()}}(i[0].options),m=x.call(i,A=S).data(c),l(m,t,o,c,h),t.$emit("kendoWidgetCreated",m),v=f(t,m),o.kRebind&&g(m,t,i,n,o.kRebind,v,o),o.kNgDisabled&&(_=o.kNgDisabled,y=t.$eval(_),y&&m.enable(!y),s(m,t,i,_)),o.kNgReadonly&&(k=o.kNgReadonly,C=t.$eval(k),C&&m.readonly(C),a(m,t,i,k)),o.kNgModel&&d(m,t,o.kNgModel),w&&u(m,t,i,w,b),m&&p(m,i),m}var _,y,w,b,x,k,S,T,D,M,E,P,I,R;if(!(i instanceof jQuery))throw Error("The Kendo UI directives require jQuery to be available before AngularJS. Please include jquery before angular in the document.");if(_=o.kNgDelay,y=t.$eval(_),m=m||[],w=m[0],b=m[1],x=e(i)[c],!x)return window.console.error("Could not find: "+c),null;if(k=r(t,i,o,c,x),S=k.options,k.unresolved.length){for(T=[],D=0,M=k.unresolved.length;M>D;D++)E=k.unresolved[D],P=e.Deferred(function(e){var i=t.$watch(E.path,function(t){t!==n&&(i(),e.resolve())})}).promise(),T.push(P);return e.when.apply(null,T).then(v),n}return _&&!y?(I=t.$root||t,R=function(){var e=t.$watch(_,function(t){t!==n&&(e(),i.removeAttr(o.$attr.kNgDelay),_=null,C(v))})},/^\$(digest|apply)$/.test(I.$$phase)?R():t.$apply(R),n):v()}function r(i,o,r,s,a){function l(e,o){var r=t.copy(i.$eval(o));r===n?p.push({option:e,path:o}):c[e]=r}var c,h,u,d,f=s.replace(/^kendo/,""),p=[],g=r.kOptions||r.options,m=i.$eval(g);return g&&m===n&&p.push({option:"options",path:g}),c=t.extend({},r.defaultOptions,m),h=a.widget.prototype.options,u=a.widget.prototype.events,e.each(r,function(e,t){var n,i,o,r;"source"!==e&&"kDataSource"!==e&&"kScopeField"!==e&&"scopeField"!==e&&(n="data"+e.charAt(0).toUpperCase()+e.slice(1),0===e.indexOf("on")&&(i=e.replace(/^on./,function(e){return e.charAt(2).toLowerCase()}),u.indexOf(i)>-1&&(c[i]=t)),h.hasOwnProperty(n)?l(n,t):h.hasOwnProperty(e)&&!E[e]?l(e,t):M[e]||(o=e.match(/^k(On)?([A-Z].*)/),o&&(r=o[2].charAt(0).toLowerCase()+o[2].slice(1),o[1]&&"kOnLabel"!=e?c[r]=t:("kOnLabel"==e&&(r="onLabel"),l(r,t)))))}),d=r.kDataSource||r.source,d&&(c.dataSource=D(i,o,f,d)),c.$angular=[i],{options:c,unresolved:p}}function s(e,t,i,o){return kendo.ui.PanelBar&&e instanceof kendo.ui.PanelBar||kendo.ui.Menu&&e instanceof kendo.ui.Menu?(T.warn("k-ng-disabled specified on a widget that does not have the enable() method: "+e.options.name),n):(t.$watch(o,function(t,n){t!=n&&e.enable(!t)}),n)}function a(e,t,i,o){return"function"!=typeof e.readonly?(T.warn("k-ng-readonly specified on a widget that does not have the readonly() method: "+e.options.name),n):(t.$watch(o,function(t,n){t!=n&&e.readonly(t)}),n)}function l(e,t,n,i,o){if(n[o]){var r=k(n[o]).assign;if(!r)throw Error(o+" attribute used but expression in it is not assignable: "+n[i]);r(t,e)}}function c(e){return/checkbox|radio/i.test(e.attr("type"))?e.prop("checked"):e.val()}function h(e){return P.test(e[0].tagName)}function u(e,t,i,o,r){var s,a,l,u;e.value&&(s=h(i)?function(){return c(i)}:function(){return e.value()},o.$render=function(){var i=o.$viewValue;i===n&&(i=o.$modelValue),i===n&&(i=null),setTimeout(function(){if(e){var n=t[e.element.attr("k-ng-model")];n&&(i=n),e.value(i)}},0)},a=!1,h(i)&&i.on("change",function(){a=!0}),l=function(e){return function(){var n;a||(e&&r&&(n=r.$pristine),o.$setViewValue(s()),e&&(o.$setPristine(),n&&r.$setPristine()),_(t))}},e.first("change",l(!1)),kendo.ui.AutoComplete&&e instanceof kendo.ui.AutoComplete||e.first("dataBound",l(!0)),u=s(),isNaN(o.$viewValue)||u==o.$viewValue||(o.$isEmpty(o.$viewValue)?null!=u&&""!==u&&u!=o.$viewValue&&o.$setViewValue(u):e.value(o.$viewValue)),o.$setPristine())}function d(t,i,o){var r,s,a,l,c,h,u,d,f;return"function"!=typeof t.value?(T.warn("k-ng-model specified on a widget that does not have the value() method: "+t.options.name),n):(r=e(t.element).parents("form"),s=i[r.attr("name")],a=k(o),l=a.assign,c=!1,h=a(i),t.$angular_setLogicValue(h),u=kendo.ui.MultiSelect&&t instanceof kendo.ui.MultiSelect,u&&(d=h.length),f=function(e){if(e===n&&(e=null),u){if(e==h&&e.length==d)return}else if(e==h)return;c||(h=e,u&&(d=h.length),t.$angular_setLogicValue(e))},u?i.$watchCollection(o,f):i.$watch(o,f),t.first("change",function(){c=!0,s&&s.$pristine&&s.$setDirty(),_(i,function(){l(i,t.$angular_getLogicValue())}),c=!1}),n)}function f(e,t){var n=e.$on("$destroy",function(){n(),t&&(t.element&&(t=v(t.element),t&&t.destroy()),t=null)});return n}function p(t,n){function i(){s.disconnect()}function o(){s.observe(e(n)[0],{attributes:!0})}var r,s;window.MutationObserver&&t.wrapper&&(r=[].slice.call(e(n)[0].classList),s=new MutationObserver(function(n){i(),t&&(n.forEach(function(n){var i,o=e(t.wrapper)[0];switch(n.attributeName){case"class":i=[].slice.call(n.target.classList),i.forEach(function(e){r.indexOf(e)<0&&(o.classList.add(e),kendo.ui.ComboBox&&t instanceof kendo.ui.ComboBox&&t.input[0].classList.add(e))}),r.forEach(function(e){i.indexOf(e)<0&&(o.classList.remove(e),kendo.ui.ComboBox&&t instanceof kendo.ui.ComboBox&&t.input[0].classList.remove(e))}),r=i;break;case"disabled":"function"!=typeof t.enable||t.element.attr("readonly")||t.enable(!e(n.target).attr("disabled"));break;case"readonly":"function"!=typeof t.readonly||t.element.attr("disabled")||t.readonly(!!e(n.target).attr("readonly"))}}),o())}),o(),t.first("destroy",i))}function g(t,n,i,o,r,s,a){var l=n.$watch(r,function(r,c){var h,u,d,f;t._muteRebind||r===c||(l(),h=L[t.options.name],h&&h.forEach(function(t){var i=n.$eval(a["k"+t]);i&&o.append(e(i).attr(kendo.toHyphens("k"+t),""))}),u=e(t.wrapper)[0],d=e(t.element)[0],f=i.injector().get("$compile"),t._destroy(),s&&s(),t=null,d&&(u&&u.parentNode.replaceChild(d,u),e(i).replaceWith(o)),f(o)(n))},!0);_(n)}function m(e,n){function i(e,t){b.directive(e,["directiveFactory",function(n){return n.create(t,e)}])}var o,r,s,a,l=n?"Mobile":"";l+=e.fn.options.name,o=l,r="kendo"+l.charAt(0)+l.substr(1).toLowerCase(),l="kendo"+l,s=l.replace(/([A-Z])/g,"-$1"),-1==R.indexOf(l.replace("kendo",""))&&(a=l===r?[l]:[l,r],t.forEach(a,function(e){b.directive(e,function(){return{restrict:"E",replace:!0,template:function(e,t){var n=I[o]||"div",i=t.kScopeField||t.scopeField;return"<"+n+" "+s+(i?'="'+i+'"':"")+">"+e.html()+""+n+">"}}})})),B.indexOf(l.replace("kendo",""))>-1||(i(l,l),r!=l&&i(r,l))}function v(t){return t=e(t),kendo.widgetInstance(t,kendo.ui)||kendo.widgetInstance(t,kendo.mobile.ui)||kendo.widgetInstance(t,kendo.dataviz.ui)}function _(e,t){var n=e.$root||e,i=/^\$(digest|apply)$/.test(n.$$phase);t?i?t():n.$apply(t):i||n.$digest()}function y(t,n){t.$destroy(),n&&e(n).removeData("$scope").removeData("$$kendoScope").removeData("$isolateScope").removeData("$isolateScopeNoTemplate").removeClass("ng-scope")}function w(n,i,o){var r,s,a;if(e.isArray(n))return t.forEach(n,function(e){w(e,i,o)});if("string"==typeof n){for(r=n.split("."),s=kendo;s&&r.length>0;)s=s[r.shift()];if(!s)return z.push([n,i,o]),!1;n=s.prototype}return a=n[i],n[i]=function(){var e=this,t=arguments;return o.apply({self:e,next:function(){return a.apply(e,arguments.length>0?arguments:t)}},t)},!0}var b,x,k,C,S,T,A,D,M,E,P,I,R,B,z,L;t&&t.injector&&(b=t.module("kendo.directives",[]),x=t.injector(["ng"]),k=x.get("$parse"),C=x.get("$timeout"),T=x.get("$log"),D=function(){var e={TreeList:"TreeListDataSource",TreeView:"HierarchicalDataSource",Scheduler:"SchedulerDataSource",PanelBar:"$PLAIN",Menu:"$PLAIN",ContextMenu:"$PLAIN"},t=function(e,t){return"$PLAIN"==t?e:kendo.data[t].create(e)};return function(n,i,o,r){var s=e[o]||"DataSource",a=n.$eval(r),l=t(a,s);return n.$watch(r,function(e){var n,o=v(i);o&&"function"==typeof o.setDataSource&&e!==a&&(n=t(e,s),o.setDataSource(n),a=e)}),l}}(),M={kDataSource:!0,kOptions:!0,kRebind:!0,kNgModel:!0,kNgDelay:!0},E={name:!0,title:!0,style:!0},P=/^(input|select|textarea)$/i,b.factory("directiveFactory",["$compile",function(t){var n,i,r=!1;return S=t,i=function(t,i){return{restrict:"AC",require:["?ngModel","^?form"],scope:!1,controller:["$scope","$attrs","$element",function(e,t){var n=this;n.template=function(e,n){t[e]=kendo.stringify(n)},e.$on("$destroy",function(){n.template=null,n=null})}],link:function(s,a,l,c){var h,u=e(a),d=t.replace(/([A-Z])/g,"-$1");u.attr(d,u.attr("data-"+d)),u[0].removeAttribute("data-"+d),h=o(s,a,l,t,i,c),h&&(n&&clearTimeout(n),n=setTimeout(function(){s.$emit("kendoRendered"),r||(r=!0,e("form").each(function(){var t=e(this).controller("form");t&&t.$setPristine()}))}))}}},{create:i}}]),I={Editor:"textarea",NumericTextBox:"input",DatePicker:"input",DateTimePicker:"input",TimePicker:"input",AutoComplete:"input",ColorPicker:"input",MaskedTextBox:"input",MultiSelect:"input",Upload:"input",Validator:"form",Button:"button",MobileButton:"a",MobileBackButton:"a",MobileDetailButton:"a",ListView:"ul",MobileListView:"ul",TreeView:"ul",Menu:"ul",ContextMenu:"ul",ActionSheet:"ul"},R=["MobileView","MobileDrawer","MobileLayout","MobileSplitView","MobilePane","MobileModalView"],B=["MobileApplication","MobileView","MobileModalView","MobileLayout","MobileActionSheet","MobileDrawer","MobileSplitView","MobilePane","MobileScrollView","MobilePopOver"],t.forEach(["MobileNavBar","MobileButton","MobileBackButton","MobileDetailButton","MobileTabStrip","MobileScrollView","MobileScroller"],function(e){B.push(e),e="kendo"+e,b.directive(e,function(){return{restrict:"A",link:function(t,n,i){o(t,n,i,e,e)}}})}),z=[],kendo.onWidgetRegistered(function(t){z=e.grep(z,function(e){return!w.apply(null,e)}),m(t.widget,"Mobile"==t.prefix)}),w(["ui.Widget","mobile.ui.Widget"],"angular",function(o,r){var s,a=this.self;return"init"==o?(!r&&A&&(r=A),A=null,r&&r.$angular&&(a.$angular_scope=r.$angular[0],a.$angular_init(a.element,r)),n):(s=a.$angular_scope,s&&i(function(){var i,l,c=r(),h=c.elements,u=c.data;if(h.length>0)switch(o){case"cleanup":t.forEach(h,function(t){var n=e(t).data("$$kendoScope");n&&n!==s&&n.$$kendoScope&&y(n,t)});break;case"compile":i=a.element.injector(),l=i?i.get("$compile"):S,t.forEach(h,function(t,i){var o,r;c.scopeFrom?o=c.scopeFrom:(r=u&&u[i],r!==n?(o=e.extend(s.$new(),r),o.$$kendoScope=!0):o=s),e(t).data("$$kendoScope",o),l(t)(o)}),_(s)}}),n)}),w("ui.Widget","$angular_getLogicValue",function(){return this.self.value()}),w("ui.Widget","$angular_setLogicValue",function(e){this.self.value(e)}),w("ui.Select","$angular_getLogicValue",function(){var e=this.self.dataItem(),t=this.self.options.dataValueField;return e?this.self.options.valuePrimitive?t?e[t]:e:e.toJSON():null}),w("ui.Select","$angular_setLogicValue",function(e){var t=this.self,i=t.options,o=i.dataValueField,r=i.text||"";e===n&&(e=""),o&&!i.valuePrimitive&&e&&(r=e[i.dataTextField]||"",e=e[o||i.dataTextField]),t.options.autoBind!==!1||t.listView.isBound()?t.value(e):!r&&e&&i.valuePrimitive?t.value(e):t._preselect(e,r)}),w("ui.MultiSelect","$angular_getLogicValue",function(){var t=this.self.dataItems().slice(0),n=this.self.options.dataValueField;return n&&this.self.options.valuePrimitive&&(t=e.map(t,function(e){return e[n]})),t}),w("ui.MultiSelect","$angular_setLogicValue",function(t){var n,i,o,r;null==t&&(t=[]),n=this.self,i=n.options,o=i.dataValueField,r=t,o&&!i.valuePrimitive&&(t=e.map(t,function(e){return e[o]})),i.autoBind!==!1||i.valuePrimitive||n.listView.isBound()?n.value(t):n._preselect(r,t)}),w("ui.AutoComplete","$angular_getLogicValue",function(){var e,t,n,i,o,r=this.self.options,s=this.self.value().split(r.separator),a=r.valuePrimitive,l=this.self.dataSource.data(),c=[];for(e=0,t=l.length;t>e;e++)for(n=l[e],i=r.dataTextField?n[r.dataTextField]:n,o=0;s.length>o;o++)if(i===s[o]){c.push(a?i:n.toJSON());break}return c}),w("ui.AutoComplete","$angular_setLogicValue",function(t){null==t&&(t=[]);var n=this.self,i=n.options.dataTextField;i&&!n.options.valuePrimitive&&(t=e.map(t,function(e){return e[i]})),n.value(t)}),w("ui.Widget","$angular_init",function(t,n){var i,o,r,s,a=this.self;if(n&&!e.isArray(n))for(i=a.$angular_scope,o=a.events.length;--o>=0;)r=a.events[o],s=n[r],s&&"string"==typeof s&&(n[r]=a.$angular_makeEventHandler(r,i,s))}),w("ui.Widget","$angular_makeEventHandler",function(e,t,n){return n=k(n),function(e){_(t,function(){n(t,{kendoEvent:e})})}}),w(["ui.Grid","ui.ListView","ui.TreeView"],"$angular_makeEventHandler",function(e,n,i){return"change"!=e?this.next():(i=k(i),function(e){var o,r,s,a,l,c,h,u,d,f=e.sender,p=f.options,g={kendoEvent:e};for(t.isString(p.selectable)&&(o=-1!==p.selectable.indexOf("cell"),r=-1!==p.selectable.indexOf("multiple")),s=g.selected=this.select(),a=g.data=[],l=g.columns=[],h=0;s.length>h;h++)u=o?s[h].parentNode:s[h],d=f.dataItem(u),o?(t.element.inArray(d,a)<0&&a.push(d),c=t.element(s[h]).index(),t.element.inArray(c,l)<0&&l.push(c)):a.push(d);r||(g.dataItem=g.data=a[0],g.selected=s[0]),_(n,function(){i(n,g)})})}),w("ui.Grid","$angular_init",function(i,o){if(this.next(),o.columns){var r=e.extend({},kendo.Template,o.templateSettings);t.forEach(o.columns,function(e){!e.field||e.template||e.format||e.values||e.encoded!==n&&!e.encoded||(e.template="#: "+kendo.expr(e.field,r.paramName)+"# ")})}}),w("mobile.ui.ButtonGroup","value",function(e){var t=this.self;return null!=e&&(t.select(t.element.children("li.km-button").eq(e)),t.trigger("change"),t.trigger("select",{index:t.selectedIndex})),t.selectedIndex}),w("mobile.ui.ButtonGroup","_select",function(){this.next(),this.self.trigger("change")}),b.directive("kendoMobileApplication",function(){return{terminal:!0,link:function(e,t,n){o(e,t,n,"kendoMobileApplication","kendoMobileApplication")}}}).directive("kendoMobileView",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileView","kendoMobileView")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileDrawer",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileDrawer","kendoMobileDrawer")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileModalView",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileModalView","kendoMobileModalView")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileSplitView",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileSplitView","kendoMobileSplitView")},post:function(e,t,n){n._instance._layout()}}}}).directive("kendoMobilePane",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,o(e,t,n,"kendoMobilePane","kendoMobilePane")}}}}).directive("kendoMobileLayout",function(){return{link:{pre:function(e,t,n){o(e,t,n,"kendoMobileLayout","kendoMobileLayout")}}}}).directive("kendoMobileActionSheet",function(){return{restrict:"A",link:function(t,n,i){n.find("a[k-action]").each(function(){e(this).attr("data-"+kendo.ns+"action",e(this).attr("k-action"))}),o(t,n,i,"kendoMobileActionSheet","kendoMobileActionSheet")}}}).directive("kendoMobilePopOver",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,o(e,t,n,"kendoMobilePopOver","kendoMobilePopOver")}}}}).directive("kendoViewTitle",function(){return{restrict:"E",replace:!0,template:function(e){return""+e.html()+" "}}}).directive("kendoMobileHeader",function(){return{restrict:"E",link:function(e,t){t.addClass("km-header").attr("data-role","header")}}}).directive("kendoMobileFooter",function(){return{restrict:"E",link:function(e,t){t.addClass("km-footer").attr("data-role","footer")}}}).directive("kendoMobileScrollViewPage",function(){return{restrict:"E",replace:!0,template:function(e){return""+e.html()+"
"}}}),t.forEach(["align","icon","rel","transition","actionsheetContext"],function(e){var t="k"+e.slice(0,1).toUpperCase()+e.slice(1);b.directive(t,function(){return{restrict:"A",priority:2,link:function(n,i,o){i.attr(kendo.attr(kendo.toHyphens(e)),n.$eval(o[t]))}}})}),L={TreeMap:["Template"],MobileListView:["HeaderTemplate","Template"],MobileScrollView:["EmptyTemplate","Template"],Grid:["AltRowTemplate","DetailTemplate","RowTemplate"],ListView:["EditTemplate","Template","AltTemplate"],Pager:["SelectTemplate","LinkTemplate"],PivotGrid:["ColumnHeaderTemplate","DataCellTemplate","RowHeaderTemplate"],Scheduler:["AllDayEventTemplate","DateHeaderTemplate","EventTemplate","MajorTimeHeaderTemplate","MinorTimeHeaderTemplate"],TreeView:["Template"],Validator:["ErrorTemplate"]},function(){var e={};t.forEach(L,function(n,i){t.forEach(n,function(t){e[t]||(e[t]=[]),e[t].push("?^^kendo"+i)})}),t.forEach(e,function(e,t){var n="k"+t,i=kendo.toHyphens(n);b.directive(n,function(){return{restrict:"A",require:e,terminal:!0,compile:function(t,o){if(""===o[n]){t.removeAttr(i);var r=t[0].outerHTML;return function(o,s,a,l){for(var c;!c&&l.length;)c=l.shift();c?(c.template(n,r),t.remove()):T.warn(i+" without a matching parent widget found. It can be one of the following: "+e.join(", "))}}}}})})}())}(window.kendo.jQuery,window.angular)}(),function(){!function(e,t,n){function i(e,t){var i=e.getAttribute(t);return null===i?i=n:"null"===i?i=null:"true"===i?i=!0:"false"===i?i=!1:p.test(i)?i=parseFloat(i):d.test(i)&&!f.test(i)&&(i=Function("return ("+i+")")()),i}function o(e,t){var n={};return Object.keys(t).concat("dataSource").forEach(function(t){e.hasAttribute(kendo.toHyphens(t))&&(n[t]=i(e,kendo.toHyphens(t)))}),n}function r(e){var t={};return Object.keys(e).forEach(function(n){"_"!=n[0]&&(t[n]=e[n])}),t}function s(e,t){var n=document.createEvent("CustomEvent");n.initCustomEvent(e,!1,!0,r(t)),this.dispatchEvent(n),n.defaultPrevented&&t.preventDefault()}function a(e,t){var n,i=Object.keys(t);for(n=0;i.length>=n;n++)if("function"==typeof t[i[n]])e[i[n]]||(e[i[n]]=t[i[n]].bind(e.widget));else{if("options"===i[n])continue;e[i[n]]=e[i[n]]||t[i[n]]}}function l(t,n){var i=n.prototype.options,r=Object.create(HTMLElement.prototype);Object.defineProperty(r,"options",{get:function(){return this.widget.options},set:function(n){var i,o,r,s=this.widget;n=e.extend(!0,{},s.options,n),i=e(s.wrapper)[0],o=e(s.element)[0],s._destroy(),r=document.createElement(c[t]||"div"),i&&o&&(i.parentNode.replaceChild(o,i),e(o).replaceWith(r)),s.value&&(n.value=s.value()),s.init(r,n),this.bindEvents()}}),r.bindEvents=function(){n.prototype.events.forEach(function(e){this.widget.bind(e,s.bind(this,e)),this.hasAttribute(h+e)&&this.bind(e,function(t){window[this.getAttribute(h+e)].call(this,t)}.bind(this))}.bind(this))},r.attachedCallback=function(){var r,s=this,l=document.createElement(c[t]||"div");e(l).append(s.childNodes),e(l).attr("class",e(s).attr("class")),e(l).attr("style",e(s).attr("style")),s.appendChild(l),s.widget=new n(l,o(s,i)),r=s.widget;do a(s,r);while(r=Object.getPrototypeOf(r));this.bindEvents()},r.detachedCallback=function(){kendo.destroy(this.element)},kendo.webComponents.push("kendo-"+t),document.registerElement("kendo-"+t,{prototype:r})}var c,h,u,d,f,p;kendo.support.customElements&&!kendo.webComponents.length&&(!t||1!=t.version.major&&!t.injector)&&(c={editor:"textarea",numerictextbox:"input",datepicker:"input",datetimepicker:"input",timepicker:"input",autocomplete:"input",colorpicker:"input",maskedtextbox:"input",dropdownlist:"select",multiselect:"select",upload:"input",validator:"form",button:"button",mobilebutton:"a",mobilebackbutton:"a",mobiledetailbutton:"a",listview:"ul",mobilelistview:"ul",treeview:"ul",menu:"ul",contextmenu:"ul",actionsheet:"ul"},h="on-",u=[],kendo.onWidgetRegistered(function(e){var t=e.prefix+e.widget.prototype.options.name.toLowerCase();-1===u.indexOf(t)&&(u.push(t),l(t,e.widget))}),d=/^\s*(?:\{(?:.|\r\n|\n)*\}|\[(?:.|\r\n|\n)*\])\s*$/,f=/^\{(\d+)(:[^\}]+)?\}|^\[[A-Za-z_]*\]$/,p=/^(\+|-?)\d+(\.?)\d*$/)}(window.kendo.jQuery,window.angular)}(),function(){!function(e,t){var n,i;t&&t.register&&(n=this&&this.__decorate||function(e,t,n,i){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,i);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,i){return void(i&&i(t,n))},void 0);case 4:return e.reduceRight(function(e,i){return i&&i(t,n,e)||e},i)}},i=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},t.register("kendo/angular2",["angular2/angular2"],function(t){var o,r;return{setters:[function(e){o=e}],execute:function(){r=function(){function t(e,t){var n=this;this.elementRef=t,this.onChange=function(){},this.onTouched=function(){},this.element=t.nativeElement,this.element.addEventListener("change",function(){n.onChange(n.element.value())}),this.element.addEventListener("spin",function(){n.onChange(n.element.value())}),e.valueAccessor=this,this.cd=e,e.valueAccessor=this}return t.prototype.writeValue=function(e){this.element.value(e)},t.prototype.registerOnChange=function(e){this.onChange=e},t.prototype.registerOnTouched=function(e){this.onTouched=e},t=n([o.Directive({selector:e.webComponents.join(",")}),i("design:paramtypes",[o.NgControl,o.ElementRef])],t)}(),t("KendoValueAccessor",r)}}}))}(window.kendo,window.System)}(),function(){"bundle all"}(),function(){!function(e){var t=window.kendo,n=t.ui.Widget,i=e.proxy,o=Math.abs,r=20,s=n.extend({init:function(e,o){function r(e){return function(t){a._triggerTouch(e,t)}}function s(e){return function(t){a.trigger(e,{touches:t.touches,distance:t.distance,center:t.center,event:t.event})}}var a=this;n.fn.init.call(a,e,o),o=a.options,e=a.element,a.wrapper=e,a.events=new t.UserEvents(e,{filter:o.filter,surface:o.surface,minHold:o.minHold,multiTouch:o.multiTouch,allowSelection:!0,press:r("touchstart"),hold:r("hold"),tap:i(a,"_tap"),gesturestart:s("gesturestart"),gesturechange:s("gesturechange"),gestureend:s("gestureend")}),o.enableSwipe?(a.events.bind("start",i(a,"_swipestart")),a.events.bind("move",i(a,"_swipemove"))):(a.events.bind("start",i(a,"_dragstart")),a.events.bind("move",r("drag")),a.events.bind("end",r("dragend"))),t.notify(a)},events:["touchstart","dragstart","drag","dragend","tap","doubletap","hold","swipe","gesturestart","gesturechange","gestureend"],options:{name:"Touch",surface:null,global:!1,multiTouch:!1,enableSwipe:!1,minXDelta:30,maxYDelta:20,maxDuration:1e3,minHold:800,doubleTapTimeout:800},cancel:function(){this.events.cancel()},_triggerTouch:function(e,t){this.trigger(e,{touch:t.touch,event:t.event})&&t.preventDefault()},_tap:function(e){var n=this,i=n.lastTap,o=e.touch;i&&n.options.doubleTapTimeout>o.endTime-i.endTime&&t.touchDelta(o,i).distance=o(e.y.velocity)&&e.sender.capture()},_swipemove:function(e){var t=this,n=t.options,i=e.touch,r=e.event.timeStamp-i.startTime,s=i.x.initialDelta>0?"right":"left";o(i.x.initialDelta)>=n.minXDelta&&o(i.y.initialDelta)r&&(t.trigger("swipe",{direction:s,touch:e.touch}),i.cancel())}});t.ui.plugin(s)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e){var t,n,i=e.find(x("popover")),o=a.roles;for(t=0,n=i.length;n>t;t++)r.initWidget(i[t],{},o)}function i(e){r.triggeredByInput(e)||e.preventDefault()}function o(t){t.each(function(){r.initWidget(e(this),{},a.roles)})}var r=window.kendo,s=r.mobile,a=s.ui,l=r.attr,c=a.Widget,h=r.ViewClone,u="init",d='
',f="beforeShow",p="show",g="afterShow",m="beforeHide",v="transitionEnd",_="transitionStart",y="hide",w="destroy",b=r.attrValue,x=r.roleSelector,k=r.directiveSelector,C=r.compileMobileDirective,S=c.extend({init:function(t,n){c.fn.init.call(this,t,n),this.params={},e.extend(this,n),this.transition=this.transition||this.defaultTransition,this._id(),this.options.$angular?this._overlay():(this._layout(),this._overlay(),this._scroller(),this._model())},events:[u,f,p,g,m,y,w,_,v],options:{name:"View",title:"",layout:null,getLayout:e.noop,reload:!1,transition:"",defaultTransition:"",useNativeScrolling:!1,stretch:!1,zoom:!1,model:null,modelScope:window,scroller:{},initWidgets:!0},enable:function(e){t===e&&(e=!0),e?this.overlay.hide():this.overlay.show()},destroy:function(){this.layout&&this.layout.detach(this),this.trigger(w),c.fn.destroy.call(this),this.scroller&&this.scroller.destroy(),this.options.$angular&&this.element.scope().$destroy(),r.destroy(this.element)},purge:function(){this.destroy(),this.element.remove()},triggerBeforeShow:function(){return this.trigger(f,{view:this})?!1:!0},triggerBeforeHide:function(){return this.trigger(m,{view:this})?!1:!0},showStart:function(){var e=this.element;e.css("display",""),this.inited?this._invokeNgController():(this.inited=!0,this.trigger(u,{view:this})),this.layout&&this.layout.attach(this),this._padIfNativeScrolling(),this.trigger(p,{view:this}),r.resize(e)},showEnd:function(){this.trigger(g,{view:this}),this._padIfNativeScrolling()},hideEnd:function(){var e=this;e.element.hide(),e.trigger(y,{view:e}),e.layout&&e.layout.trigger(y,{view:e,layout:e.layout})},beforeTransition:function(e){this.trigger(_,{type:e})},afterTransition:function(e){this.trigger(v,{type:e})},_padIfNativeScrolling:function(){if(s.appLevelNativeScrolling()){var e=r.support.mobileOS&&r.support.mobileOS.android,t=s.application.skin()||"",n=s.application.os.android||t.indexOf("android")>-1,i="flat"===t||t.indexOf("material")>-1,o=!e&&!n||i?"header":"footer",a=!e&&!n||i?"footer":"header";this.content.css({paddingTop:this[o].height(),paddingBottom:this[a].height()})}},contentElement:function(){var e=this;return e.options.stretch?e.content:e.scrollerContent},clone:function(){return new h(this)},_scroller:function(){var t=this;s.appLevelNativeScrolling()||(t.options.stretch?t.content.addClass("km-stretched-view"):(t.content.kendoMobileScroller(e.extend(t.options.scroller,{zoom:t.options.zoom,useNative:t.options.useNativeScrolling})),t.scroller=t.content.data("kendoMobileScroller"),t.scrollerContent=t.scroller.scrollElement),r.support.kineticScrollNeeded&&(e(t.element).on("touchmove",".km-header",i),t.options.useNativeScrolling||t.options.stretch||e(t.element).on("touchmove",".km-content",i)))},_model:function(){var e=this,t=e.element,i=e.options.model;"string"==typeof i&&(i=r.getter(i)(e.options.modelScope)),e.model=i,n(t),e.element.css("display",""),e.options.initWidgets&&(i?r.bind(t,i,a,r.ui,r.dataviz.ui):s.init(t.children())),e.element.css("display","none")},_id:function(){var e=this.element,t=e.attr("id")||"";this.id=b(e,"url")||"#"+t,"#"==this.id&&(this.id=r.guid(),e.attr("id",this.id))},_layout:function(){var e=x("content"),t=this.element;t.addClass("km-view"),this.header=t.children(x("header")).addClass("km-header"),this.footer=t.children(x("footer")).addClass("km-footer"),t.children(e)[0]||t.wrapInner("
'),this.content=t.children(x("content")).addClass("km-content"),this.element.prepend(this.header).append(this.footer),this.layout=this.options.getLayout(this.layout),this.layout&&this.layout.setup(this)},_overlay:function(){this.overlay=e(d).appendTo(this.element)},_invokeNgController:function(){var t,n,i;this.options.$angular&&(t=this.element.controller(),n=this.options.$angular[0],t&&(i=e.proxy(this,"_callController",t,n),/^\$(digest|apply)$/.test(n.$$phase)?i():n.$apply(i)))},_callController:function(e,t){this.element.injector().invoke(e.constructor,e,{$scope:t})}}),T=c.extend({init:function(e,t){c.fn.init.call(this,e,t),e=this.element,this.header=e.children(this._locate("header")).addClass("km-header"),this.footer=e.children(this._locate("footer")).addClass("km-footer"),this.elements=this.header.add(this.footer),n(e),this.options.$angular||r.mobile.init(this.element.children()),this.element.detach(),this.trigger(u,{layout:this})},_locate:function(e){return this.options.$angular?k(e):x(e)},options:{name:"Layout",id:null,platform:null},events:[u,p,y],setup:function(e){e.header[0]||(e.header=this.header),e.footer[0]||(e.footer=this.footer)},detach:function(e){var t=this;e.header===t.header&&t.header[0]&&e.element.prepend(t.header.detach()[0].cloneNode(!0)),e.footer===t.footer&&t.footer.length&&e.element.append(t.footer.detach()[0].cloneNode(!0))},attach:function(e){var t=this,n=t.currentView;n&&t.detach(n),e.header===t.header&&(t.header.detach(),e.element.children(x("header")).remove(),e.element.prepend(t.header)),e.footer===t.footer&&(t.footer.detach(),e.element.children(x("footer")).remove(),e.element.append(t.footer)),t.trigger(p,{layout:t,view:e}),t.currentView=e}}),A=r.Observable,D=/]*>(([\u000a\u000d\u2028\u2029]|.)*)<\/body>/i,M="loadStart",E="loadComplete",P="showStart",I="sameViewRequested",R="viewShow",B="viewTypeDetermined",z="after",L=A.extend({init:function(t){var n,i,s,a,l=this;if(A.fn.init.call(l),e.extend(l,t),l.sandbox=e("
"),s=l.container,n=l._hideViews(s),l.rootView=n.first(),!l.rootView[0]&&t.rootNeeded)throw i=s[0]==r.mobile.application.element[0]?'Your kendo mobile application element does not contain any direct child elements with data-role="view" attribute set. Make sure that you instantiate the mobile application using the correct container.':'Your pane element does not contain any direct child elements with data-role="view" attribute set.',Error(i);l.layouts={},l.viewContainer=new r.ViewContainer(l.container),l.viewContainer.bind("accepted",function(e){e.view.params=l.params}),l.viewContainer.bind("complete",function(e){l.trigger(R,{view:e.view})}),l.viewContainer.bind(z,function(){l.trigger(z)}),this.getLayoutProxy=e.proxy(this,"_getLayout"),l._setupLayouts(s),a=s.children(l._locate("modalview drawer")),l.$angular?(l.$angular[0].viewOptions={defaultTransition:l.transition,loader:l.loader,container:l.container,getLayout:l.getLayoutProxy},a.each(function(n,i){C(e(i),t.$angular[0])})):o(a),this.bind(this.events,t);
},events:[P,z,R,M,E,I,B],destroy:function(){r.destroy(this.container);for(var e in this.layouts)this.layouts[e].destroy()},view:function(){return this.viewContainer.view},showView:function(e,t,n){if(e=e.replace(RegExp("^"+this.remoteViewURLPrefix),""),""===e&&this.remoteViewURLPrefix&&(e="/"),e.replace(/^#/,"")===this.url)return this.trigger(I),!1;this.trigger(P);var i=this,o=function(n){return i.viewContainer.show(n,t,e)},s=i._findViewElement(e),a=r.widgetInstance(s);return i.url=e.replace(/^#/,""),i.params=n,a&&a.reload&&(a.purge(),s=[]),this.trigger(B,{remote:0===s.length,url:e}),s[0]?(a||(a=i._createView(s)),o(a)):(this.serverNavigation?location.href=e:i._loadView(e,o),!0)},append:function(e,t){var n,i,r,s=this.sandbox,a=(t||"").split("?")[0],c=this.container;return D.test(e)&&(e=RegExp.$1),s[0].innerHTML=e,c.append(s.children("script, style")),n=this._hideViews(s),r=n.first(),r.length||(n=r=s.wrapInner("
").children()),a&&r.hide().attr(l("url"),a),this._setupLayouts(s),i=s.children(this._locate("modalview drawer")),c.append(s.children(this._locate("layout modalview drawer")).add(n)),o(i),this._createView(r)},_locate:function(e){return this.$angular?k(e):x(e)},_findViewElement:function(e){var t,n=e.split("?")[0];return n?(t=this.container.children("["+l("url")+"='"+n+"']"),t[0]||-1!==n.indexOf("/")||(t=this.container.children("#"===n.charAt(0)?n:"#"+n)),t):this.rootView},_createView:function(e){return this.$angular?C(e,this.$angular[0]):r.initWidget(e,{defaultTransition:this.transition,loader:this.loader,container:this.container,getLayout:this.getLayoutProxy,modelScope:this.modelScope,reload:b(e,"reload")},a.roles)},_getLayout:function(e){return""===e?null:e?this.layouts[e]:this.layouts[this.layout]},_loadView:function(t,n){this._xhr&&this._xhr.abort(),this.trigger(M),this._xhr=e.get(r.absoluteURL(t,this.remoteViewURLPrefix),"html").always(e.proxy(this,"_xhrComplete",n,t))},_xhrComplete:function(e,t,n){var i=!0;if("object"==typeof n&&0===n.status){if(!(n.responseText&&n.responseText.length>0))return;i=!0,n=n.responseText}this.trigger(E),i&&e(this.append(n,t))},_hideViews:function(e){return e.children(this._locate("view splitview")).hide()},_setupLayouts:function(t){var n,i=this;t.children(i._locate("layout")).each(function(){n=i.$angular?C(e(this),i.$angular[0]):r.initWidget(e(this),{},a.roles);var t=n.options.platform;t&&t!==s.application.os.name?n.destroy():i.layouts[n.options.id]=n})}});r.mobile.ViewEngine=L,a.plugin(S),a.plugin(T)}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.mobile.ui,i=n.Widget,o=e.map(t.eventMap,function(e){return e}).join(" ").split(" "),r=i.extend({init:function(t,n){var o=this,r=e('
');i.fn.init.call(o,r,n),o.container=t,o.captureEvents=!1,o._attachCapture(),r.append(o.options.loading).hide().appendTo(t)},options:{name:"Loader",loading:"Loading... ",timeout:100},show:function(){var e=this;clearTimeout(e._loading),e.options.loading!==!1&&(e.captureEvents=!0,e._loading=setTimeout(function(){e.element.show()},e.options.timeout))},hide:function(){this.captureEvents=!1,clearTimeout(this._loading),this.element.hide()},changeMessage:function(e){this.options.loading=e,this.element.find(">h1").html(e)},transition:function(){this.captureEvents=!0,this.container.css("pointer-events","none")},transitionDone:function(){this.captureEvents=!1,this.container.css("pointer-events","")},_attachCapture:function(){function e(e){n.captureEvents&&e.preventDefault()}var t,n=this;for(n.captureEvents=!1,t=0;o.length>t;t++)n.container[0].addEventListener(o[t],e,!0)}});n.plugin(r)}(window.kendo.jQuery)}(),function(){!function(e,t){var n=window.kendo,i=n.mobile,o=n.roleSelector,r=i.ui,s=r.Widget,a=i.ViewEngine,l=r.View,c=i.ui.Loader,h="external",u="href",d="#!",f="navigate",p="viewShow",g="sameViewRequested",m=n.support.mobileOS,v=m.ios&&!m.appMode&&m.flatVersion>=700,_=/popover|actionsheet|modalview|drawer/,y="#:back",w=n.attrValue,b=s.extend({init:function(e,t){var i=this;s.fn.init.call(i,e,t),t=i.options,e=i.element,e.addClass("km-pane"),i.options.collapsible&&e.addClass("km-collapsible-pane"),this.history=[],this.historyCallback=function(e,t,n){var o=i.transition;return i.transition=null,v&&n&&(o="none"),i.viewEngine.showView(e,o,t)},this._historyNavigate=function(e){if(e===y){if(1===i.history.length)return;i.history.pop(),e=i.history[i.history.length-1]}else i.history.push(e);i.historyCallback(e,n.parseQueryStringParams(e))},this._historyReplace=function(e){var t=n.parseQueryStringParams(e);i.history[i.history.length-1]=e,i.historyCallback(e,t)},i.loader=new c(e,{loading:i.options.loading}),i.viewEngine=new a({container:e,transition:t.transition,modelScope:t.modelScope,rootNeeded:!t.initial,serverNavigation:t.serverNavigation,remoteViewURLPrefix:t.root||"",layout:t.layout,$angular:t.$angular,loader:i.loader,showStart:function(){i.loader.transition(),i.closeActiveDialogs()},after:function(){i.loader.transitionDone()},viewShow:function(e){i.trigger(p,e)},loadStart:function(){i.loader.show()},loadComplete:function(){i.loader.hide()},sameViewRequested:function(){i.trigger(g)},viewTypeDetermined:function(e){e.remote&&i.options.serverNavigation||i.trigger(f,{url:e.url})}}),this._setPortraitWidth(),n.onResize(function(){i._setPortraitWidth()}),i._setupAppLinks()},closeActiveDialogs:function(){var t=this.element.find(o("actionsheet popover modalview")).filter(":visible");t.each(function(){n.widgetInstance(e(this),r).close()})},navigateToInitial:function(){var e=this.options.initial;return e&&this.navigate(e),e},options:{name:"Pane",portraitWidth:"",transition:"",layout:"",collapsible:!1,initial:null,modelScope:window,loading:"Loading... "},events:[f,p,g],append:function(e){return this.viewEngine.append(e)},destroy:function(){s.fn.destroy.call(this),this.viewEngine.destroy(),this.userEvents.destroy()},navigate:function(e,t){e instanceof l&&(e=e.id),this.transition=t,this._historyNavigate(e)},replace:function(e,t){e instanceof l&&(e=e.id),this.transition=t,this._historyReplace(e)},bindToRouter:function(e){var t=this,i=this.history,o=this.viewEngine;e.bind("init",function(t){var r,s=t.url,a=e.pushState?s:"/";o.rootView.attr(n.attr("url"),a),r=i.length,"/"===s&&r&&(e.navigate(i[r-1],!0),t.preventDefault())}),e.bind("routeMissing",function(e){t.historyCallback(e.url,e.params,e.backButtonPressed)||e.preventDefault()}),e.bind("same",function(){t.trigger(g)}),t._historyNavigate=function(t){e.navigate(t)},t._historyReplace=function(t){e.replace(t)}},hideLoading:function(){this.loader.hide()},showLoading:function(){this.loader.show()},changeLoadingMessage:function(e){this.loader.changeMessage(e)},view:function(){return this.viewEngine.view()},_setPortraitWidth:function(){var e,t=this.options.portraitWidth;t&&(e=n.mobile.application.element.is(".km-vertical")?t:"auto",this.element.css("width",e))},_setupAppLinks:function(){var t=this,i="tab",r="[data-"+n.ns+"navigate-on-press]",s=e.map(["button","backbutton","detailbutton","listview-link"],function(e){return o(e)+":not("+r+")"}).join(",");this.element.handler(this).on("down",o(i)+","+r,"_mouseup").on("click",o(i)+","+s+","+r,"_appLinkClick"),this.userEvents=new n.UserEvents(this.element,{filter:s,tap:function(e){e.event.currentTarget=e.touch.currentTarget,t._mouseup(e.event)}}),this.element.css("-ms-touch-action","")},_appLinkClick:function(t){var n=e(t.currentTarget).attr("href"),i=n&&"#"!==n[0]&&this.options.serverNavigation;i||w(e(t.currentTarget),"rel")==h||t.preventDefault()},_mouseup:function(o){if(!(o.which>1||o.isDefaultPrevented())){var s=this,a=e(o.currentTarget),l=w(a,"transition"),c=w(a,"rel")||"",f=w(a,"target"),p=a.attr(u),g=v&&0===a[0].offsetHeight,m=p&&"#"!==p[0]&&this.options.serverNavigation;g||m||c===h||t===p||p===d||(a.attr(u,d),setTimeout(function(){a.attr(u,p)}),c.match(_)?(n.widgetInstance(e(p),r).openFor(a),("actionsheet"===c||"drawer"===c)&&o.stopPropagation()):("_top"===f?s=i.application.pane:f&&(s=e("#"+f).data("kendoMobilePane")),s.navigate(p,l)),o.preventDefault())}}});b.wrap=function(e){e.is(o("view"))||(e=e.wrap("
').parent());var t=e.wrap('').parent(),i=new b(t);return i.navigate(""),i},r.plugin(b)}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.mobile,i=n.ui,o="hide",r="open",s="close",a='',l='',c='',h="km-up km-down km-left km-right",u=i.Widget,d={down:{origin:"bottom center",position:"top center"},up:{origin:"top center",position:"bottom center"},left:{origin:"center left",position:"center right",collision:"fit flip"},right:{origin:"center right",position:"center left",collision:"fit flip"}},f={animation:{open:{effects:"fade:in",duration:0},close:{effects:"fade:out",duration:400}}},p={horizontal:{offset:"top",size:"height"},vertical:{offset:"left",size:"width"}},g={up:"down",down:"up",left:"right",right:"left"},m=u.extend({init:function(n,i){var r,s,h=this,g=n.closest(".km-modalview-wrapper"),m=n.closest(".km-root").children(".km-pane").first(),v=g[0]?g:m;i.viewport?m=i.viewport:m[0]||(m=window),i.container?v=i.container:v[0]||(v=document.body),r={viewport:m,copyAnchorStyles:!1,autosize:!0,open:function(){h.overlay.show()},activate:e.proxy(h._activate,h),deactivate:function(){h.overlay.hide(),h._apiCall||h.trigger(o),h._apiCall=!1}},u.fn.init.call(h,n,i),n=h.element,i=h.options,n.wrap(a).addClass("km-popup").show(),s=h.options.direction.match(/left|right/)?"horizontal":"vertical",h.dimensions=p[s],h.wrapper=n.parent().css({width:i.width,height:i.height}).addClass("km-popup-wrapper km-"+i.direction).hide(),h.arrow=e(l).prependTo(h.wrapper).hide(),h.overlay=e(c).appendTo(v).hide(),r.appendTo=h.overlay,i.className&&h.overlay.addClass(i.className),h.popup=new t.ui.Popup(h.wrapper,e.extend(!0,r,f,d[i.direction]))},options:{name:"Popup",width:240,height:"",direction:"down",container:null,viewport:null},events:[o],show:function(t){this.popup.options.anchor=e(t),this.popup.open()},hide:function(){this._apiCall=!0,this.popup.close()},destroy:function(){u.fn.destroy.call(this),this.popup.destroy(),this.overlay.remove()},target:function(){return this.popup.options.anchor},_activate:function(){var t=this,n=t.options.direction,i=t.dimensions,o=i.offset,r=t.popup,s=r.options.anchor,a=e(s).offset(),l=e(r.element).offset(),c=r.flipped?g[n]:n,u=2*t.arrow[i.size](),d=t.element[i.size]()-t.arrow[i.size](),f=e(s)[i.size](),p=a[o]-l[o]+f/2;u>p&&(p=u),p>d&&(p=d),t.wrapper.removeClass(h).addClass("km-"+c),t.arrow.css(o,p).show()}}),v=u.extend({init:function(n,o){var r,a=this;a.initialOpen=!1,u.fn.init.call(a,n,o),r=e.extend({className:"km-popover-root",hide:function(){a.trigger(s)}},this.options.popup),a.popup=new m(a.element,r),a.popup.overlay.on("move",function(e){e.target==a.popup.overlay[0]&&e.preventDefault()}),a.pane=new i.Pane(a.element,e.extend(this.options.pane,{$angular:this.options.$angular})),t.notify(a,i)},options:{name:"PopOver",popup:{},pane:{}},events:[r,s],open:function(e){this.popup.show(e),this.initialOpen?this.pane.view()._invokeNgController():(this.pane.navigateToInitial()||this.pane.navigate(""),this.popup.popup._position(),this.initialOpen=!0)},openFor:function(e){this.open(e),this.trigger(r,{target:this.popup.target()})},close:function(){this.popup.hide()},destroy:function(){u.fn.destroy.call(this),this.pane.destroy(),this.popup.destroy(),t.destroy(this.element)}});i.plugin(m),i.plugin(v)}(window.kendo.jQuery)}(),function(){!function(e,t){var n=window.kendo,i=n.mobile.ui,o=n.ui.Popup,r='
',s="hide",a=i.Widget,l=a.extend({init:function(t,i){var l=this,c=n.mobile.application,h=n.support.mobileOS,u=c?c.os.name:h?h.name:"ios",d="ios"===u||"wp"===u||(c?c.os.skin:!1),f="blackberry"===u,p=i.align||(d?"bottom center":f?"center right":"center center"),g=i.position||(d?"bottom center":f?"center right":"center center"),m=i.effect||(d?"slideIn:up":f?"slideIn:left":"fade:in"),v=e(r).handler(l).hide();a.fn.init.call(l,t,i),l.shim=v,t=l.element,i=l.options,i.className&&l.shim.addClass(i.className),i.modal||l.shim.on("down","_hide"),(c?c.element:e(document.body)).append(v),l.popup=new o(l.element,{anchor:v,modal:!0,appendTo:v,origin:p,position:g,animation:{open:{effects:m,duration:i.duration},close:{duration:i.duration}},close:function(e){var t=!1;l._apiCall||(t=l.trigger(s)),t&&e.preventDefault(),l._apiCall=!1},deactivate:function(){v.hide()},open:function(){v.show()}}),n.notify(l)},events:[s],options:{name:"Shim",modal:!1,align:t,position:t,effect:t,duration:200},show:function(){this.popup.open()},hide:function(){this._apiCall=!0,this.popup.close()},destroy:function(){a.fn.destroy.call(this),this.shim.kendoDestroy(),this.popup.destroy(),this.shim.remove()},_hide:function(t){t&&e.contains(this.shim.children().children(".k-popup")[0],t.target)||this.popup.close()}});i.plugin(l)}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.mobile.ui,i=n.Shim,o=n.Widget,r="beforeOpen",s="open",a="close",l="init",c='
',h=n.View.extend({init:function(e,t){var n=this;o.fn.init.call(n,e,t),n._id(),n._wrap(),n._shim(),this.options.$angular||(n._layout(),n._scroller(),n._model()),n.element.css("display",""),n.trigger(l)},events:[l,r,s,a],options:{name:"ModalView",modal:!0,width:null,height:null},destroy:function(){o.fn.destroy.call(this),this.shim.destroy()},open:function(t){var n=this;n.target=e(t),n.shim.show(),n._invokeNgController(),n.trigger("show",{view:n})},openFor:function(e){this.trigger(r,{target:e})||(this.open(e),this.trigger(s,{target:e}))},close:function(){this.element.is(":visible")&&!this.trigger(a)&&this.shim.hide()},_wrap:function(){var e,t,n=this,i=n.element,o=n.options;e=i[0].style.width||"auto",t=i[0].style.height||"auto",i.addClass("km-modalview").wrap(c),n.wrapper=i.parent().css({width:o.width||e||300,height:o.height||t||300}).addClass("auto"==t?" km-auto-height":""),i.css({width:"",height:""})},_shim:function(){var e=this;e.shim=new i(e.wrapper,{modal:e.options.modal,position:"center center",align:"center center",effect:"fade:in",className:"km-modalview-root",hide:function(t){e.trigger(a)&&t.preventDefault()}})}});n.plugin(h)}(window.kendo.jQuery)}(),function(){!function(e,t){var n=window.kendo,i=n.mobile,o=n.support.mobileOS,r=n.effects.Transition,s=n.roleSelector,a="x",l=i.ui,c=!(o.ios&&7==o.majorVersion&&!o.appMode),h="beforeShow",u="init",d="show",f="hide",p="afterHide",g={enable:e.noop},m=l.View.extend({init:function(t,o){var r,a,l,h,d;if(e(t).parent().prepend(t),i.ui.Widget.fn.init.call(this,t,o),this.options.$angular||(this._layout(),this._scroller()),this._model(),r=this.element.closest(s("pane")).data("kendoMobilePane"))this.pane=r,this.pane.bind("viewShow",function(e){h._viewShow(e)}),this.pane.bind("sameViewRequested",function(){h.hide()}),a=this.userEvents=new n.UserEvents(r.element,{filter:s("view splitview"),allowSelection:!0});else{if(this.currentView=g,l=e(this.options.container),!l)throw Error("The drawer needs a container configuration option set.");a=this.userEvents=new n.UserEvents(l,{allowSelection:!0}),this._attachTransition(l)}h=this,d=function(e){h.visible&&(h.hide(),e.preventDefault())},this.options.swipeToOpen&&c?(a.bind("press",function(){h.transition.cancel()}),a.bind("start",function(e){h._start(e)}),a.bind("move",function(e){h._update(e)}),a.bind("end",function(e){h._end(e)}),a.bind("tap",d)):a.bind("press",d),this.leftPositioned="left"===this.options.position,this.visible=!1,this.element.hide().addClass("km-drawer").addClass(this.leftPositioned?"km-left-drawer":"km-right-drawer"),this.trigger(u)},options:{name:"Drawer",position:"left",views:[],swipeToOpenViews:[],swipeToOpen:!0,title:"",container:null},events:[h,f,p,u,d],show:function(){this._activate()&&this._show()},hide:function(){this.currentView&&(this.currentView.enable(),m.current=null,this._moveViewTo(0),this.trigger(f,{view:this}))},openFor:function(){this.visible?this.hide():this.show()},destroy:function(){l.View.fn.destroy.call(this),this.userEvents.destroy()},_activate:function(){if(this.visible)return!0;var e=this._currentViewIncludedIn(this.options.views);return!e||this.trigger(h,{view:this})?!1:(this._setAsCurrent(),this.element.show(),this.trigger(d,{view:this}),this._invokeNgController(),!0)},_currentViewIncludedIn:function(t){if(!this.pane||!t.length)return!0;var n=this.pane.view();return e.inArray(n.id.replace("#",""),t)>-1||e.inArray(n.element.attr("id"),t)>-1},_show:function(){this.currentView.enable(!1),this.visible=!0;var e=this.element.width();this.leftPositioned||(e=-e),this._moveViewTo(e)},_setAsCurrent:function(){m.last!==this&&(m.last&&m.last.element.hide(),this.element.show()),m.last=this,m.current=this},_moveViewTo:function(e){this.userEvents.cancel(),this.transition.moveTo({location:e,duration:400,ease:r.easeOutExpo})},_viewShow:function(e){return this.currentView&&this.currentView.enable(),this.currentView===e.view?(this.hide(),t):(this.currentView=e.view,this._attachTransition(e.view.element),t)},_attachTransition:function(e){var t=this,i=this.movable,o=i&&i.x;this.transition&&(this.transition.cancel(),this.movable.moveAxis("x",0)),i=this.movable=new n.ui.Movable(e),this.transition=new r({axis:a,movable:this.movable,onEnd:function(){0===i[a]&&(e[0].style.cssText="",t.element.hide(),t.trigger(p),t.visible=!1)}}),o&&(e.addClass("k-fx-hidden"),n.animationFrame(function(){e.removeClass("k-fx-hidden"),t.movable.moveAxis(a,o),t.hide()}))},_start:function(e){var i,o,r,s,a,l=e.sender;return Math.abs(e.x.velocity)e.x.velocity,(r&&a||s&&!a)&&this._activate()?(l.capture(),t):(l.cancel(),t))},_update:function(e){var t,n=this.movable,i=n.x+e.x.delta;t=this.leftPositioned?Math.min(Math.max(0,i),this.element.width()):Math.max(Math.min(0,i),-this.element.width()),this.movable.moveAxis(a,t),e.event.preventDefault(),e.event.stopPropagation()},_end:function(e){var t,n=e.x.velocity,i=Math.abs(this.movable.x)>this.element.width()/2,o=.8;t=this.leftPositioned?n>-o&&(n>o||i):o>n&&(-o>n||i),t?this._show():this.hide()}});l.plugin(m)}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.mobile.ui,i=n.Widget,o="
",r=n.View,s=r.extend({init:function(r,s){var a,l,c=this;i.fn.init.call(c,r,s),r=c.element,e.extend(c,s),c._id(),c.options.$angular?c._overlay():(c._layout(),c._overlay()),c._style(),l=r.children(c._locate("modalview")),c.options.$angular?l.each(function(n,i){t.compileMobileDirective(e(i),s.$angular[0])}):t.mobile.init(l),c.panes=[],c._paramsHistory=[],c.options.$angular?(c.element.children(t.directiveSelector("pane")).each(function(){a=t.compileMobileDirective(e(this),s.$angular[0]),c.panes.push(a)}),c.element.children(t.directiveSelector("header footer")).each(function(){t.compileMobileDirective(e(this),s.$angular[0])})):c.content.children(t.roleSelector("pane")).each(function(){a=t.initWidget(this,{},n.roles),c.panes.push(a)}),c.expandedPaneShim=e(o).appendTo(c.element),c._shimUserEvents=new t.UserEvents(c.expandedPaneShim,{tap:function(){c.collapsePanes()}})},_locate:function(e){return this.options.$angular?t.directiveSelector(e):t.roleSelector(e)},options:{name:"SplitView",style:"horizontal"},expandPanes:function(){this.element.addClass("km-expanded-splitview")},collapsePanes:function(){this.element.removeClass("km-expanded-splitview")},_layout:function(){var e=this,n=e.element;e.transition=t.attrValue(n,"transition"),t.mobile.ui.View.prototype._layout.call(this),t.mobile.init(this.header.add(this.footer)),e.element.addClass("km-splitview"),e.content.addClass("km-split-content")},_style:function(){var t,n=this.options.style,i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-split-"+this)}))},showStart:function(){var t=this;t.element.css("display",""),t.inited?this._invokeNgController():(t.inited=!0,e.each(t.panes,function(){this.options.initial?this.navigateToInitial():this.navigate("")}),t.trigger("init",{view:t})),t.trigger("show",{view:t})}});n.plugin(s)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t){var n=[];return p&&n.push("km-on-"+p.name),n.push(e.skin?"km-"+e.skin:"ios"==e.name&&e.majorVersion>6?"km-ios7":"km-"+e.name),("ios"==e.name&&7>e.majorVersion||"ios"!=e.name)&&n.push("km-"+e.name+e.majorVersion),n.push("km-"+e.majorVersion),n.push("km-m"+(e.minorVersion?e.minorVersion[0]:0)),e.variant&&(e.skin&&e.skin===e.name||!e.skin||e.setDefaultPlatform===!1)&&n.push("km-"+(e.skin?e.skin:e.name)+"-"+e.variant),e.cordova&&n.push("km-cordova"),n.push(e.appMode?"km-app":"km-web"),t&&t.statusBarStyle&&n.push("km-"+t.statusBarStyle+"-status-bar"),n.join(" ")}function i(t){return"km-wp-"+(t.noVariantSet?0===parseInt(e("
").css("background-color").split(",")[1],10)?"dark":"light":t.variant+" km-wp-"+t.variant+"-force")}function o(e){return p.wp?"-kendo-landscape"==e.css("animation-name"):Math.abs(window.orientation)/90==1}function r(e){return o(e)?b:v}function s(e){e.parent().addBack().css("min-height",window.innerHeight)}function a(){e("meta[name=viewport]").remove(),z.append(k({height:", width=device-width"+(o()?", height="+window.innerHeight+"px":h.mobileOS.flatVersion>=600&&700>h.mobileOS.flatVersion?", height="+window.innerWidth+"px":", height=device-height")}))}var l=window.kendo,c=l.mobile,h=l.support,u=c.ui.Widget,d=c.ui.Pane,f="ios7",p=h.mobileOS,g="blackberry"==p.device&&p.flatVersion>=600&&1e3>p.flatVersion&&p.appMode,m=.93,v="km-vertical",_="chrome"===p.browser,y=p.ios&&p.flatVersion>=700&&800>p.flatVersion&&(p.appMode||_),w=Math.abs(window.orientation)/90==1,b="km-horizontal",x={ios7:{ios:!0,browser:"default",device:"iphone",flatVersion:"700",majorVersion:"7",minorVersion:"0.0",name:"ios",tablet:!1},ios:{ios:!0,browser:"default",device:"iphone",flatVersion:"612",majorVersion:"6",minorVersion:"1.2",name:"ios",tablet:!1},android:{android:!0,browser:"default",device:"android",flatVersion:"442",majorVersion:"4",minorVersion:"4.2",name:"android",tablet:!1},blackberry:{blackberry:!0,browser:"default",device:"blackberry",flatVersion:"710",majorVersion:"7",minorVersion:"1.0",name:"blackberry",tablet:!1},meego:{meego:!0,browser:"default",device:"meego",flatVersion:"850",majorVersion:"8",minorVersion:"5.0",name:"meego",tablet:!1},wp:{wp:!0,browser:"default",device:"wp",flatVersion:"800",majorVersion:"8",minorVersion:"0.0",name:"wp",tablet:!1}},k=l.template(' ',{usedWithBlock:!1}),C=l.template(' ',{usedWithBlock:!1}),S=l.template("",{usedWithBlock:!1}),T=p.android&&"chrome"!=p.browser||p.blackberry,A=l.template(' ',{usedWithBlock:!1}),D=("iphone"==p.device||"ipod"==p.device)&&7>p.majorVersion,M=("iphone"==p.device||"ipod"==p.device)&&p.majorVersion>=7,E=M?"none":null,P="mobilesafari"==p.browser?60:0,I=20,R=e(window),B=window.screen,z=e("head"),L="init",F=e.proxy,O=u.extend({init:function(t,n){c.application=this,e(e.proxy(this,"bootstrap",t,n))},bootstrap:function(t,n){var i,o,r;t=e(t),t[0]||(t=e(document.body)),u.fn.init.call(this,t,n),this.element.removeAttr("data-"+l.ns+"role"),this._setupPlatform(),this._attachMeta(),this._setupElementClass(),this._attachHideBarHandlers(),i=e.extend({},this.options),delete i.name,o=this,r=function(){o.pane=new d(o.element,i),o.pane.navigateToInitial(),o.options.updateDocumentTitle&&o._setupDocumentTitle(),o._startHistory(),o.trigger(L)},this.options.$angular?setTimeout(r):r()},options:{name:"Application",hideAddressBar:!0,browserHistory:!0,historyTransition:E,modelScope:window,statusBarStyle:"black",transition:"",retina:!1,platform:null,skin:null,updateDocumentTitle:!0,useNativeScrolling:!1},events:[L],navigate:function(e,t){this.pane.navigate(e,t)},replace:function(e,t){this.pane.replace(e,t)},scroller:function(){return this.view().scroller},hideLoading:function(){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler.");this.pane.hideLoading()},showLoading:function(){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler.");this.pane.showLoading()},changeLoadingMessage:function(e){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider changing the message in the application init event handler.");this.pane.changeLoadingMessage(e)},view:function(){return this.pane.view()},skin:function(e){var t=this;return arguments.length?(t.options.skin=e||"",t.element[0].className="km-pane",t._setupPlatform(),t._setupElementClass(),t.options.skin):t.options.skin},destroy:function(){u.fn.destroy.call(this),this.pane.destroy(),this.router.destroy()},_setupPlatform:function(){var t=this,o=t.options.platform,r=t.options.skin,s=[],a=p||x[f];o&&(a.setDefaultPlatform=!0,"string"==typeof o?(s=o.split("-"),a=e.extend({variant:s[1]},a,x[s[0]])):a=o),r&&(s=r.split("-"),p||(a.setDefaultPlatform=!1),a=e.extend({},a,{skin:s[0],variant:s[1]})),a.variant||(a.noVariantSet=!0,a.variant="dark"),t.os=a,t.osCssClass=n(t.os,t.options),"wp"==a.name&&(t.refreshBackgroundColorProxy||(t.refreshBackgroundColorProxy=e.proxy(function(){(t.os.variant&&t.os.skin&&t.os.skin===t.os.name||!t.os.skin)&&t.element.removeClass("km-wp-dark km-wp-light km-wp-dark-force km-wp-light-force").addClass(i(t.os))},t)),e(document).off("visibilitychange",t.refreshBackgroundColorProxy),e(document).off("resume",t.refreshBackgroundColorProxy),a.skin||(t.element.parent().css("overflow","hidden"),e(document).on("visibilitychange",t.refreshBackgroundColorProxy),e(document).on("resume",t.refreshBackgroundColorProxy),t.refreshBackgroundColorProxy()))},_startHistory:function(){this.options.browserHistory?(this.router=new l.Router({pushState:this.options.pushState,root:this.options.root,hashBang:this.options.hashBang}),this.pane.bindToRouter(this.router),this.router.start()):this.options.initial||this.pane.navigate("")},_resizeToScreenHeight:function(){var t,n=e("meta[name=apple-mobile-web-app-status-bar-style]").attr("content").match(/black-translucent|hidden/),i=this.element;t=_?window.innerHeight:o(i)?n?w?B.availWidth+I:B.availWidth:w?B.availWidth:B.availWidth-I:n?w?B.availHeight:B.availHeight+I:w?B.availHeight-I:B.availHeight,i.height(t)},_setupElementClass:function(){var t,n=this,i=n.element;i.parent().addClass("km-root km-"+(n.os.tablet?"tablet":"phone")),i.addClass(n.osCssClass+" "+r(i)),this.options.useNativeScrolling&&i.parent().addClass("km-native-scrolling"),_&&i.addClass("km-ios-chrome"),h.wpDevicePixelRatio&&i.parent().css("font-size",h.wpDevicePixelRatio+"em"),this.options.retina&&(i.parent().addClass("km-retina"),i.parent().css("font-size",h.devicePixelRatio*m+"em")),g&&a(),n.options.useNativeScrolling?i.parent().addClass("km-native-scrolling"):T&&(t=(screen.availWidth>screen.availHeight?screen.availWidth:screen.availHeight)+200,e(S({width:t,height:t})).appendTo(z)),y&&n._resizeToScreenHeight(),l.onResize(function(){i.removeClass("km-horizontal km-vertical").addClass(r(i)),n.options.useNativeScrolling&&s(i),y&&n._resizeToScreenHeight(),g&&a(),l.resize(i)})},_clearExistingMeta:function(){z.find("meta").filter("[name|='apple-mobile-web-app'],[name|='msapplication-tap'],[name='viewport']").remove()},_attachMeta:function(){var e,t=this.options,n=t.icon;if(this._clearExistingMeta(),g||z.prepend(k({height:"",scale:this.options.retina?1/h.devicePixelRatio:"1.0"})),z.prepend(C(t)),n){"string"==typeof n&&(n={"":n});for(e in n)z.prepend(A({icon:n[e],size:e}))}t.useNativeScrolling&&s(this.element)},_attachHideBarHandlers:function(){var e=this,t=F(e,"_hideBar");!h.mobileOS.appMode&&e.options.hideAddressBar&&D&&!e.options.useNativeScrolling&&(e._initialHeight={},R.on("load",t),l.onResize(function(){setTimeout(window.scrollTo,0,0,1)}))},_setupDocumentTitle:function(){var e=this,n=document.title;e.pane.bind("viewShow",function(e){var i=e.view.title;document.title=i!==t?i:n})},_hideBar:function(){var t=this,n=t.element;n.height(l.support.transforms.css+"calc(100% + "+P+"px)"),e(window).trigger(l.support.resize)}});l.mobile.Application=O,l.ui.plugin(O,l.mobile,"Mobile")}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.support,i=t.mobile.ui,o=i.Shim,r=i.Popup,s=i.Widget,a="open",l="close",c="command",h="li>a",u="actionsheetContext",d='
',f=t.template('#:cancel# '),p=s.extend({init:function(a,l){var c,u,p,g=this,m=n.mobileOS;s.fn.init.call(g,a,l),l=g.options,p=l.type,a=g.element,u="auto"===p?m&&m.tablet:"tablet"===p,c=u?r:o,l.cancelTemplate&&(f=t.template(l.cancelTemplate)),a.addClass("km-actionsheet").append(f({cancel:g.options.cancel})).wrap(d).on("up",h,"_click").on("click",h,t.preventDefault),g.view().bind("destroy",function(){g.destroy()}),g.wrapper=a.parent().addClass(p?" km-actionsheet-"+p:""),g.shim=new c(g.wrapper,e.extend({modal:m.ios&&7>m.majorVersion,className:"km-actionsheet-root"},g.options.popup)),g._closeProxy=e.proxy(g,"_close"),g._shimHideProxy=e.proxy(g,"_shimHide"),g.shim.bind("hide",g._shimHideProxy),u&&t.onResize(g._closeProxy),t.notify(g,i)},events:[a,l,c],options:{name:"ActionSheet",cancel:"Cancel",type:"auto",popup:{height:"auto"}},open:function(t,n){var i=this;i.target=e(t),i.context=n,i.shim.show(t)},close:function(){this.context=this.target=null,this.shim.hide()},openFor:function(e){var t=this,n=e.data(u);t.open(e,n),t.trigger(a,{target:e,context:n})},destroy:function(){s.fn.destroy.call(this),t.unbindResize(this._closeProxy),this.shim.destroy()},_click:function(n){var i,o,r,s;n.isDefaultPrevented()||(i=e(n.currentTarget),o=i.data("action"),o&&(r={target:this.target,context:this.context},s=this.options.$angular,s?this.element.injector().get("$parse")(o)(s[0])(r):t.getter(o)(window)(r)),this.trigger(c,{target:this.target,context:this.context,currentTarget:i}),n.preventDefault(),this._close())},_shimHide:function(e){this.trigger(l)?e.preventDefault():this.context=this.target=null},_close:function(e){this.trigger(l)?e.preventDefault():this.close()}});i.plugin(p)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(t,n,i){e(n.target).closest(".km-button,.km-detail").toggleClass("km-state-active",i),h&&t.deactivateTimeoutID&&(clearTimeout(t.deactivateTimeoutID),t.deactivateTimeoutID=0)}function i(t){return e(''+t+" ")}var o=window.kendo,r=o.mobile,s=r.ui,a=s.Widget,l=o.support,c=l.mobileOS,h=c.android&&c.flatVersion>=300,u="click",d="disabled",f="km-state-disabled",p=a.extend({init:function(e,t){var i,r=this;a.fn.init.call(r,e,t),i="up"===r.options.clickOn,r._wrap(),r._style(),i||r.element.attr("data-navigate-on-press",!0),r.options.enable=r.options.enable&&!r.element.attr(d),r.enable(r.options.enable),r._userEvents=new o.UserEvents(r.element,{allowSelection:!i,press:function(e){r._activate(e)},release:function(e){n(r,e,!1),i||e.event.stopPropagation();
}}),r._userEvents.bind(i?"tap":"press",function(e){r._release(e)}),h&&r.element.on("move",function(e){r._timeoutDeactivate(e)})},destroy:function(){a.fn.destroy.call(this),this._userEvents.destroy()},events:[u],options:{name:"Button",icon:"",style:"",badge:"",clickOn:"up",enable:!0},badge:function(e){var t=this.badgeElement=this.badgeElement||i(e).appendTo(this.element);return e||0===e?(t.html(e),this):e===!1?(t.empty().remove(),this.badgeElement=!1,this):t.html()},enable:function(e){var n=this.element;t===e&&(e=!0),this.options.enable=e,e?n.removeAttr(d):n.attr(d,d),n.toggleClass(f,!e)},_timeoutDeactivate:function(e){this.deactivateTimeoutID||(this.deactivateTimeoutID=setTimeout(n,500,this,e,!1))},_activate:function(e){var t=document.activeElement,i=t?t.nodeName:"";this.options.enable&&(n(this,e,!0),("INPUT"==i||"TEXTAREA"==i)&&t.blur())},_release:function(n){var i=this;if(!(n.which>1))return i.options.enable?(i.trigger(u,{target:e(n.target),button:i.element})&&n.preventDefault(),t):(n.preventDefault(),t)},_style:function(){var t,n=this.options.style,i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-"+this)}))},_wrap:function(){var t=this,n=t.options.icon,o=t.options.badge,r=' ').children("span.km-text")),!l[0]&&n&&(a[0]||(r+=" km-notext"),t.iconElement=s.prepend(e(r+'" />'))),(o||0===o)&&(t.badgeElement=i(o).appendTo(s))}}),g=p.extend({options:{name:"BackButton",style:"back"},init:function(e,n){var i=this;p.fn.init.call(i,e,n),t===i.element.attr("href")&&i.element.attr("href","#:back")}}),m=p.extend({options:{name:"DetailButton",style:""},init:function(e,t){p.fn.init.call(this,e,t)},_style:function(){var t,n=this.options.style+" detail",i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-"+this)}))},_wrap:function(){var t=this,n=t.options.icon,i=' ')))}});s.plugin(p),s.plugin(g),s.plugin(m)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(t){return e(''+t+" ")}var i=window.kendo,o=i.mobile.ui,r=o.Widget,s="km-state-active",a="km-state-disabled",l="select",c="li:not(."+s+")",h=r.extend({init:function(e,t){var n=this;r.fn.init.call(n,e,t),n.element.addClass("km-buttongroup").find("li").each(n._button),n.element.on(n.options.selectOn,c,"_select"),n._enable=!0,n.select(n.options.index),n.options.enable||(n._enable=!1,n.wrapper.addClass(a))},events:[l],options:{name:"ButtonGroup",selectOn:"down",index:-1,enable:!0},current:function(){return this.element.find("."+s)},select:function(n){var i=this,o=-1;n!==t&&-1!==n&&i._enable&&!e(n).is("."+a)&&(i.current().removeClass(s),"number"==typeof n?(o=n,n=e(i.element[0].children[n])):n.nodeType&&(n=e(n),o=n.index()),n.addClass(s),i.selectedIndex=o)},badge:function(t,i){var o,r=this.element;return isNaN(t)||(t=r.children().get(t)),t=r.find(t),o=e(t.children(".km-badge")[0]||n(i).appendTo(t)),i||0===i?(o.html(i),this):i===!1?(o.empty().remove(),this):o.html()},enable:function(e){var n=this.wrapper;t===e&&(e=!0),e?n.removeClass(a):n.addClass(a),this._enable=this.options.enable=e},_button:function(){var t=e(this).addClass("km-button"),o=i.attrValue(t,"icon"),r=i.attrValue(t,"badge"),s=t.children("span"),a=t.find("img").addClass("km-image");s[0]||(s=t.wrapInner(" ").children("span")),s.addClass("km-text"),!a[0]&&o&&t.prepend(e(' ')),(r||0===r)&&n(r).appendTo(t)},_select:function(e){e.which>1||e.isDefaultPrevented()||!this._enable||(this.select(e.currentTarget),this.trigger(l,{index:this.selectedIndex}))}});o.plugin(h)}(window.kendo.jQuery)}(),function(){!function(e){var t=window.kendo,n=t.mobile.ui,i=n.Widget,o="km-collapsible",r="km-collapsible-header",s="km-collapsible-content",a="km-collapsibleinset",l="
",c="
",h="km-collapsed",u="km-expanded",d="km-animated",f="left",p="expand",g="collapse",m=i.extend({init:function(n,r){var s=this,l=e(n);i.fn.init.call(s,l,r),l.addClass(o),s._buildHeader(),s.content=l.children().not(s.header).wrapAll(c).parent(),s._userEvents=new t.UserEvents(s.header,{tap:function(){s.toggle()}}),l.addClass(s.options.collapsed?h:u),s.options.inset&&l.addClass(a),s.options.animation?(s.content.addClass(d),s.content.height(0),s.options.collapsed&&s.content.hide()):s.options.collapsed&&s.content.hide()},events:[p,g],options:{name:"Collapsible",collapsed:!0,collapseIcon:"arrow-n",expandIcon:"arrow-s",iconPosition:f,animation:!0,inset:!1},destroy:function(){i.fn.destroy.call(this),this._userEvents.destroy()},expand:function(e){var n=this.options.collapseIcon,i=this.content,o=t.support.mobileOS.ios;this.trigger(p)||(n&&this.header.find(".km-icon").removeClass().addClass("km-icon km-"+n),this.element.removeClass(h).addClass(u),this.options.animation&&!e?(i.off("transitionend"),i.show(),o&&i.removeClass(d),i.height(this._getContentHeight()),o&&i.addClass(d),t.resize(i)):i.show())},collapse:function(e){var t=this.options.expandIcon,n=this.content;this.trigger(g)||(t&&this.header.find(".km-icon").removeClass().addClass("km-icon km-"+t),this.element.removeClass(u).addClass(h),this.options.animation&&!e?(n.one("transitionend",function(){n.hide()}),n.height(0)):n.hide())},toggle:function(e){this.isCollapsed()?this.expand(e):this.collapse(e)},isCollapsed:function(){return this.element.hasClass(h)},resize:function(){!this.isCollapsed()&&this.options.animation&&this.content.height(this._getContentHeight())},_buildHeader:function(){var t=this.element.children(":header").wrapAll(l),n=e(' '),i=this.options.collapsed?this.options.expandIcon:this.options.collapseIcon,o=this.options.iconPosition;i&&(t.prepend(n),n.addClass("km-"+i)),this.header=t.parent(),this.header.addClass("km-icon-"+o)},_getContentHeight:function(){var e,t=this.content.attr("style");return this.content.css({position:"absolute",visibility:"hidden",height:"auto"}),e=this.content.height(),this.content.attr("style",t?t:""),e}});n.plugin(m)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(){return this.nodeType===v.TEXT_NODE&&this.nodeValue.match(U)}function i(e,t){t&&!e[0].querySelector(".km-icon")&&e.prepend(' ')}function o(e){i(e,T(e,"icon")),i(e,T(e.children(C),"icon"))}function r(e){var t=e.parent(),o=e.add(t.children(m.roleSelector("detailbutton"))),r=t.contents().not(o).not(n);r.length||(e.addClass("km-listview-link").attr(m.attr("role"),"listview-link"),i(e,T(t,"icon")),i(e,T(e,"icon")))}function s(e){if(e[0].querySelector("input[type=checkbox],input[type=radio]")){var t=e.parent();t.contents().not(e).not(function(){return 3==this.nodeType})[0]||(e.addClass("km-listview-label"),e.children("[type=checkbox],[type=radio]").addClass("km-widget km-icon km-check"))}}function a(t,n){e(t).css("transform","translate3d(0px, "+n+"px, 0px)")}var l,c,h,u,d,f,p,g,m=window.kendo,v=window.Node,_=m.mobile,y=_.ui,w=m.data.DataSource,b=y.DataBoundWidget,x=".km-list > li, > li:not(.km-group-container)",k=".km-listview-link, .km-listview-label",C="["+m.attr("icon")+"]",S=e.proxy,T=m.attrValue,A="km-group-title",D="km-state-active",M='',E=m.template('#= this.headerTemplate(data) #
#= kendo.render(this.template, data.items)# '),P='
',I=m.template(''),R=".kendoMobileListView",B="styled",z="dataBound",L="dataBinding",F="itemChange",O="click",N="change",V="progress",H="function",U=/^\s+$/,j=/button/,W=m.Class.extend({init:function(e){var t,n,i=e.scroller();i&&(this.options=e.options,this.element=e.element,this.scroller=e.scroller(),this._shouldFixHeaders(),t=this,n=function(){t._cacheHeaders()},e.bind("resize",n),e.bind(B,n),e.bind(z,n),i.bind("scroll",function(e){t._fixHeader(e)}))},_fixHeader:function(t){if(this.fixedHeaders){var n,i,o,r=0,s=this.scroller,a=this.headers,l=t.scrollTop;do{if(n=a[r++],!n){o=e("
");break}i=n.offset,o=n.header}while(i+1>l);this.currentHeader!=r&&(s.fixedContainer.html(o.clone()),this.currentHeader=r)}},_shouldFixHeaders:function(){this.fixedHeaders="group"===this.options.type&&this.options.fixedHeaders},_cacheHeaders:function(){if(this._shouldFixHeaders(),this.fixedHeaders){var t=[],n=this.scroller.scrollTop;this.element.find("."+A).each(function(i,o){o=e(o),t.unshift({offset:o.position().top+n,header:o})}),this.headers=t,this._fixHeader({scrollTop:n})}}}),G=function(){return{page:1}},q=m.Class.extend({init:function(e){var t=this,n=e.options,i=e.scroller(),o=n.pullParameters||G;this.listView=e,this.scroller=i,e.bind("_dataSource",function(e){t.setDataSource(e.dataSource)}),i.setOptions({pullToRefresh:!0,pull:function(){t._pulled||(t._pulled=!0,t.dataSource.read(o.call(e,t._first)))},messages:{pullTemplate:n.messages.pullTemplate,releaseTemplate:n.messages.releaseTemplate,refreshTemplate:n.messages.refreshTemplate}})},setDataSource:function(e){var t=this;this._first=e.view()[0],this.dataSource=e,e.bind("change",function(){t._change()}),e.bind("error",function(){t._change()})},_change:function(){var e,t=this.scroller,n=this.dataSource;this._pulled&&t.pullHandled(),(this._pulled||!this._first)&&(e=n.view(),e[0]&&(this._first=e[0])),this._pulled=!1}}),$=m.Observable.extend({init:function(e){var t=this;m.Observable.fn.init.call(t),t.buffer=e.buffer,t.height=e.height,t.item=e.item,t.items=[],t.footer=e.footer,t.buffer.bind("reset",function(){t.refresh()})},refresh:function(){for(var e,t,n,i,o=this.buffer,r=this.items,s=!1;r.length;)r.pop().destroy();for(this.offset=o.offset,e=this.item,i=0;o.viewSize>i;i++){if(i===o.total()){s=!0;break}n=e(this.content(this.offset+r.length)),n.below(t),t=n,r.push(n)}this.itemCount=r.length,this.trigger("reset"),this._resize(),s&&this.trigger("endReached")},totalHeight:function(){if(!this.items[0])return 0;var e=this,t=e.items,n=t[0].top,i=t[t.length-1].bottom,o=(i-n)/e.itemCount,r=e.buffer.length-e.offset-e.itemCount;return(this.footer?this.footer.height:0)+i+r*o},batchUpdate:function(e){var t,n,i=this.height(),o=this.items,r=this.offset;if(o[0]){if(this.lastDirection)for(;o[o.length-1].bottom>e+2*i&&0!==this.offset;)this.offset--,t=o.pop(),t.update(this.content(this.offset)),t.above(o[0]),o.unshift(t);else for(;e-i>o[0].top;){if(n=this.offset+this.itemCount,n===this.buffer.total()){this.trigger("endReached");break}if(n===this.buffer.length)break;t=o.shift(),t.update(this.content(this.offset+this.itemCount)),t.below(o[o.length-1]),o.push(t),this.offset++}r!==this.offset&&this._resize()}},update:function(e){var t,n,i,o,r=this,s=this.items,a=this.height(),l=this.itemCount,c=a/2,h=(this.lastTop||0)>e,u=e-c,d=e+a+c;s[0]&&(this.lastTop=e,this.lastDirection=h,h?s[0].top>u&&s[s.length-1].bottom>d+c&&this.offset>0&&(this.offset--,t=s.pop(),n=s[0],t.update(this.content(this.offset)),s.unshift(t),t.above(n),r._resize()):d>s[s.length-1].bottom&&u-c>s[0].top&&(o=this.offset+l,o===this.buffer.total()?this.trigger("endReached"):o!==this.buffer.length&&(t=s.shift(),i=s[s.length-1],s.push(t),t.update(this.content(this.offset+this.itemCount)),r.offset++,t.below(i),r._resize())))},content:function(e){return this.buffer.at(e)},destroy:function(){this.unbind()},_resize:function(){var e=this.items,t=0,n=0,i=e[0],o=e[e.length-1];i&&(t=i.top,n=o.bottom),this.trigger("resize",{top:t,bottom:n}),this.footer&&this.footer.below(o)}});m.mobile.ui.VirtualList=$,l=m.Class.extend({init:function(t,n){var i=t.append([n],!0)[0],o=i.offsetHeight;e.extend(this,{top:0,element:i,listView:t,height:o,bottom:o})},update:function(e){this.element=this.listView.setDataItem(this.element,e)},above:function(e){e&&(this.height=this.element.offsetHeight,this.top=e.top-this.height,this.bottom=e.top,a(this.element,this.top))},below:function(e){e&&(this.height=this.element.offsetHeight,this.top=e.bottom,this.bottom=this.top+this.height,a(this.element,this.top))},destroy:function(){m.destroy(this.element),e(this.element).remove()}}),c='
',h=m.Class.extend({init:function(t){this.element=e(' ').appendTo(t.element),this._loadIcon=e(c).appendTo(this.element)},enable:function(){this.element.show(),this.height=this.element.outerHeight(!0)},disable:function(){this.element.hide(),this.height=0},below:function(e){e&&(this.top=e.bottom,this.bottom=this.height+this.top,a(this.element,this.top))}}),u=h.extend({init:function(t,n){this._loadIcon=e(c).hide(),this._loadButton=e(''+t.options.messages.loadMoreText+" ").hide(),this.element=e(' ').append(this._loadIcon).append(this._loadButton).appendTo(t.element);var i=this;this._loadButton.kendoMobileButton().data("kendoMobileButton").bind("click",function(){i._hideShowButton(),n.next()}),n.bind("resize",function(){i._showLoadButton()}),this.height=this.element.outerHeight(!0),this.disable()},_hideShowButton:function(){this._loadButton.hide(),this.element.addClass("km-scroller-refresh"),this._loadIcon.css("display","block")},_showLoadButton:function(){this._loadButton.show(),this.element.removeClass("km-scroller-refresh"),this._loadIcon.hide()}}),d=m.Class.extend({init:function(e){var t=this;this.chromeHeight=e.wrapper.children().not(e.element).outerHeight()||0,this.listView=e,this.scroller=e.scroller(),this.options=e.options,e.bind("_dataSource",function(e){t.setDataSource(e.dataSource,e.empty)}),e.bind("resize",function(){t.list.items.length&&(t.scroller.reset(),t.buffer.range(0),t.list.refresh())}),this.scroller.makeVirtual(),this.scroller.bind("scroll",function(e){t.list.update(e.scrollTop)}),this.scroller.bind("scrollEnd",function(e){t.list.batchUpdate(e.scrollTop)})},destroy:function(){this.list.unbind(),this.buffer.unbind()},setDataSource:function(t,n){var i,o,r,s,a=this,c=this.options,d=this.listView,f=d.scroller(),p=c.loadMore;if(this.dataSource=t,i=t.pageSize()||c.virtualViewSize,!i&&!n)throw Error("the DataSource does not have page size configured. Page Size setting is mandatory for the mobile listview virtual scrolling to work as expected.");this.buffer&&this.buffer.destroy(),o=new m.data.Buffer(t,Math.floor(i/2),p),r=p?new u(d,o):new h(d),this.list&&this.list.destroy(),s=new $({buffer:o,footer:r,item:function(e){return new l(d,e)},height:function(){return f.height()}}),s.bind("resize",function(){a.updateScrollerSize(),d.updateSize()}),s.bind("reset",function(){a.footer.enable()}),s.bind("endReached",function(){r.disable(),a.updateScrollerSize()}),o.bind("expand",function(){s.lastDirection=!1,s.batchUpdate(f.scrollTop)}),e.extend(this,{buffer:o,scroller:f,list:s,footer:r})},updateScrollerSize:function(){this.scroller.virtualSize(0,this.list.totalHeight()+this.chromeHeight)},refresh:function(){this.list.refresh()},reset:function(){this.buffer.range(0),this.list.refresh()}}),f=m.Class.extend({init:function(e){var t,n=this;this.listView=e,this.options=e.options,t=this,this._refreshHandler=function(e){t.refresh(e)},this._progressHandler=function(){e.showLoading()},e.bind("_dataSource",function(e){n.setDataSource(e.dataSource)})},destroy:function(){this._unbindDataSource()},reset:function(){},refresh:function(e){var n,i,o,r,s,a,l,c=e&&e.action,h=e&&e.items,u=this.listView,d=this.dataSource,f=this.options.appendOnRefresh,p=d.view(),g=d.group(),m=g&&g[0];return"itemchange"===c?(u._hasBindingTarget()||(n=u.findByDataItem(h)[0],n&&u.setDataItem(n,h[0])),t):(s="add"===c&&!m||f&&!u._filter,a="remove"===c&&!m,s?i=[]:a&&(i=u.findByDataItem(h)),u.trigger(L,{action:c||"rebind",items:h,removedItems:i,index:e&&e.index})?(this._shouldShowLoading()&&u.hideLoading(),t):("add"!==c||m?"remove"!==c||m?m?u.replaceGrouped(p):f&&!u._filter?(o=u.prepend(p),r=p):u.replace(p):(o=[],u.remove(h)):(l=p.indexOf(h[0]),l>-1&&(o=u.insertAt(h,l),r=h)),this._shouldShowLoading()&&u.hideLoading(),u.trigger(z,{ns:y,addedItems:o,addedDataItems:r}),t))},setDataSource:function(e){this.dataSource&&this._unbindDataSource(),this.dataSource=e,e.bind(N,this._refreshHandler),this._shouldShowLoading()&&this.dataSource.bind(V,this._progressHandler)},_unbindDataSource:function(){this.dataSource.unbind(N,this._refreshHandler).unbind(V,this._progressHandler)},_shouldShowLoading:function(){var e=this.options;return!e.pullToRefresh&&!e.loadMore&&!e.endlessScroll}}),p=m.Class.extend({init:function(t){var n=this,i=t.options.filterable,o="change paste",r=this;this.listView=t,this.options=i,t.element.before(I({placeholder:i.placeholder||"Search..."})),i.autoFilter!==!1&&(o+=" keyup"),this.element=t.wrapper.find(".km-search-form"),this.searchInput=t.wrapper.find("input[type=search]").closest("form").on("submit"+R,function(e){e.preventDefault()}).end().on("focus"+R,function(){n._oldFilter=n.searchInput.val()}).on(o.split(" ").join(R+" ")+R,S(this._filterChange,this)),this.clearButton=t.wrapper.find(".km-filter-reset").on(O,S(this,"_clearFilter")).hide(),this._dataSourceChange=e.proxy(this._refreshInput,this),t.bind("_dataSource",function(e){e.dataSource.bind("change",r._dataSourceChange)})},_refreshInput:function(){var e=this.listView.dataSource.filter(),t=this.listView._filter.searchInput;t.val(e&&e.filters[0].field===this.listView.options.filterable.field?e.filters[0].value:"")},_search:function(e){this._filter=!0,this.clearButton[e?"show":"hide"](),this.listView.dataSource.filter(e)},_filterChange:function(e){var t=this;"paste"==e.type&&this.options.autoFilter!==!1?setTimeout(function(){t._applyFilter()},1):this._applyFilter()},_applyFilter:function(){var e=this.options,t=this.searchInput.val(),n=t.length?{field:e.field,operator:e.operator||"startswith",ignoreCase:e.ignoreCase,value:t}:null;t!==this._oldFilter&&(this._oldFilter=t,this._search(n))},_clearFilter:function(e){this.searchInput.val(""),this._search(null),e.preventDefault()}}),g=b.extend({init:function(t,n){var i=this;b.fn.init.call(this,t,n),t=this.element,n=this.options,n.scrollTreshold&&(n.scrollThreshold=n.scrollTreshold),t.on("down",k,"_highlight").on("move up cancel",k,"_dim"),this._userEvents=new m.UserEvents(t,{filter:x,allowSelection:!0,tap:function(e){i._click(e)}}),t.css("-ms-touch-action","auto"),t.wrap(P),this.wrapper=this.element.parent(),this._headerFixer=new W(this),this._itemsCache={},this._templates(),this.virtual=n.endlessScroll||n.loadMore,this._style(),this.options.$angular&&(this.virtual||this.options.pullToRefresh)?setTimeout(e.proxy(this,"_start")):this._start()},_start:function(){var e=this.options;this.options.filterable&&(this._filter=new p(this)),this._itemBinder=this.virtual?new d(this):new f(this),this.options.pullToRefresh&&(this._pullToRefreshHandler=new q(this)),this.setDataSource(e.dataSource),this._enhanceItems(this.items()),m.notify(this,y)},events:[O,L,z,F],options:{name:"ListView",style:"",type:"flat",autoBind:!0,fixedHeaders:!1,template:"#:data#",headerTemplate:'#:value# ',appendOnRefresh:!1,loadMore:!1,endlessScroll:!1,scrollThreshold:30,pullToRefresh:!1,messages:{loadMoreText:"Press to load more",pullTemplate:"Pull to refresh",releaseTemplate:"Release to refresh",refreshTemplate:"Refreshing"},pullOffset:140,filterable:!1,virtualViewSize:null},refresh:function(){this._itemBinder.refresh()},reset:function(){this._itemBinder.reset()},setDataSource:function(e){var t=!e;this.dataSource=w.create(e),this.trigger("_dataSource",{dataSource:this.dataSource,empty:t}),this.options.autoBind&&!t&&(this.items().remove(),this.dataSource.fetch())},destroy:function(){b.fn.destroy.call(this),m.destroy(this.element),this._userEvents.destroy(),this._itemBinder&&this._itemBinder.destroy(),this.element.unwrap(),delete this.element,delete this.wrapper,delete this._userEvents},items:function(){return"group"===this.options.type?this.element.find(".km-list").children():this.element.children().not(".km-load-more")},scroller:function(){return this._scrollerInstance||(this._scrollerInstance=this.element.closest(".km-scroll-wrapper").data("kendoMobileScroller")),this._scrollerInstance},showLoading:function(){var e=this.view();e&&e.loader&&e.loader.show()},hideLoading:function(){var e=this.view();e&&e.loader&&e.loader.hide()},insertAt:function(e,t,n){var i=this;return i._renderItems(e,function(o){if(0===t?i.element.prepend(o):-1===t?i.element.append(o):i.items().eq(t-1).after(o),n)for(var r=0;o.length>r;r++)i.trigger(F,{item:o.eq(r),data:e[r],ns:y})})},append:function(e,t){return this.insertAt(e,-1,t)},prepend:function(e,t){return this.insertAt(e,0,t)},replace:function(e){return this.options.type="flat",this._angularItems("cleanup"),this.element.empty(),this._userEvents.cancel(),this._style(),this.insertAt(e,0)},replaceGrouped:function(t){this.options.type="group",this._angularItems("cleanup"),this.element.empty();var n=e(m.render(this.groupTemplate,t));this._enhanceItems(n.children("ul").children("li")),this.element.append(n),_.init(n),this._style(),this._angularItems("compile")},remove:function(e){var t=this.findByDataItem(e);this.angular("cleanup",function(){return{elements:t}}),m.destroy(t),t.remove()},findByDataItem:function(e){var t,n,i=[];for(t=0,n=e.length;n>t;t++)i[t]="[data-"+m.ns+"uid="+e[t].uid+"]";return this.element.find(i.join(","))},setDataItem:function(t,n){var i=this,o=function(o){var r=e(o[0]);m.destroy(t),i.angular("cleanup",function(){return{elements:[e(t)]}}),e(t).replaceWith(r),i.trigger(F,{item:r,data:n,ns:y})};return this._renderItems([n],o)[0]},updateSize:function(){this._size=this.getSize()},_renderItems:function(t,n){var i=e(m.render(this.template,t));return n(i),this.angular("compile",function(){return{elements:i,data:t.map(function(e){return{dataItem:e}})}}),_.init(i),this._enhanceItems(i),i},_dim:function(e){this._toggle(e,!1)},_highlight:function(e){this._toggle(e,!0)},_toggle:function(t,n){if(!(t.which>1)){var i=e(t.currentTarget),o=i.parent(),r=T(i,"role")||"",s=!r.match(j),a=t.isDefaultPrevented();s&&o.toggleClass(D,n&&!a)}},_templates:function(){var e=this.options.template,t=this.options.headerTemplate,n=' data-uid="#=arguments[0].uid || ""#"',i={},o={};typeof e===H&&(i.template=e,e="#=this.template(data)#"),this.template=S(m.template(""+e+" "),i),o.template=this.template,typeof t===H&&(o._headerTemplate=t,t="#=this._headerTemplate(data)#"),o.headerTemplate=m.template(t),this.groupTemplate=S(E,o)},_click:function(t){if(!(t.event.which>1||t.event.isDefaultPrevented())){var n,i=t.target,o=e(t.event.target),r=o.closest(m.roleSelector("button","detailbutton","backbutton")),s=m.widgetInstance(r,y),a=i.attr(m.attr("uid"));a&&(n=this.dataSource.getByUid(a)),this.trigger(O,{target:o,item:i,dataItem:n,button:s})&&t.preventDefault()}},_styleGroups:function(){var t=this.element.children();t.children("ul").addClass("km-list"),t.each(function(){var t=e(this),n=t.contents().first();t.addClass("km-group-container"),n.is("ul")||n.is("div."+A)||n.wrap(M)})},_style:function(){var e=this.options,t="group"===e.type,n=this.element,i="inset"===e.style;n.addClass("km-listview").toggleClass("km-list",!t).toggleClass("km-virtual-list",this.virtual).toggleClass("km-listinset",!t&&i).toggleClass("km-listgroup",t&&!i).toggleClass("km-listgroupinset",t&&i),n.parents(".km-listview")[0]||n.closest(".km-content").toggleClass("km-insetcontent",i),t&&this._styleGroups(),this.trigger(B)},_enhanceItems:function(t){t.each(function(){var t,n=e(this),i=!1;n.children().each(function(){t=e(this),t.is("a")?(r(t),i=!0):t.is("label")&&(s(t),i=!0)}),i||o(n)})}}),y.plugin(g)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(n,i){var r=i.find("["+o.attr("align")+"="+n+"]");return r[0]?e('
').append(r).prependTo(i):t}function i(t){var n=t.siblings(),i=!!t.children("ul")[0],r=!!n[0]&&""===e.trim(t.text()),s=!(!o.mobile.application||!o.mobile.application.element.is(".km-android"));t.prevAll().toggleClass("km-absolute",i),t.toggleClass("km-show-title",r),t.toggleClass("km-fill-title",r&&!e.trim(t.html())),t.toggleClass("km-no-title",i),t.toggleClass("km-hide-title",s&&!n.children().is(":visible"))}var o=window.kendo,r=o.mobile,s=r.ui,a=s.Widget,l=a.extend({init:function(t,i){var o=this;a.fn.init.call(o,t,i),t=o.element,o.container().bind("show",e.proxy(this,"refresh")),t.addClass("km-navbar").wrapInner(e('
')),o.leftElement=n("left",t),o.rightElement=n("right",t),o.centerElement=t.find(".km-view-title")},options:{name:"NavBar"},title:function(e){this.element.find(o.roleSelector("view-title")).text(e),i(this.centerElement)},refresh:function(e){var t=e.view;this.title(t.options.title)},destroy:function(){a.fn.destroy.call(this),o.destroy(this.element)}});s.plugin(l)}(window.kendo.jQuery)}(),function(){!function(e,t){var n,i,o,r,s,a,l,c,h=window.kendo,u=h.mobile,d=u.ui,f=e.proxy,p=h.effects.Transition,g=h.ui.Pane,m=h.ui.PaneDimensions,v=d.DataBoundWidget,_=h.data.DataSource,y=h.data.Buffer,w=h.data.BatchBuffer,b=Math,x=b.abs,k=b.ceil,C=b.round,S=b.max,T=b.min,A=b.floor,D="change",M="changing",E="refresh",P="km-current-page",I="km-virtual-page",R="function",B="itemChange",z="cleanup",L=3,F=-1,O=0,N=1,V=-1,H=0,U=1,j=h.Class.extend({init:function(t){var n=this,i=e(" ");t.element.append(i),this._changeProxy=f(n,"_change"),this._refreshProxy=f(n,"_refresh"),t.bind(D,this._changeProxy),t.bind(E,this._refreshProxy),e.extend(n,{element:i,scrollView:t})},items:function(){return this.element.children()},_refresh:function(e){var t,n="";for(t=0;e.pageCount>t;t++)n+=" ";this.element.html(n),this.items().eq(e.page).addClass(P)},_change:function(e){this.items().removeClass(P).eq(e.page).addClass(P)},destroy:function(){this.scrollView.unbind(D,this._changeProxy),this.scrollView.unbind(E,this._refreshProxy),this.element.remove()}});h.mobile.ui.ScrollViewPager=j,n="transitionEnd",i="dragStart",o="dragEnd",r=h.Observable.extend({init:function(t,r){var s,a,l,c,u,d,f=this;h.Observable.fn.init.call(this),this.element=t,this.container=t.parent(),s=new h.ui.Movable(f.element),a=new p({axis:"x",movable:s,onEnd:function(){f.trigger(n)}}),l=new h.UserEvents(t,{start:function(e){2*x(e.x.velocity)>=x(e.y.velocity)?l.capture():l.cancel(),f.trigger(i,e),a.cancel()},allowSelection:!0,end:function(e){f.trigger(o,e)}}),c=new m({element:f.element,container:f.container}),u=c.x,u.bind(D,function(){f.trigger(D)}),d=new g({dimensions:c,userEvents:l,movable:s,elastic:!0}),e.extend(f,{duration:r&&r.duration||1,movable:s,transition:a,userEvents:l,dimensions:c,dimension:u,pane:d}),this.bind([n,i,o,D],r)},size:function(){return{width:this.dimensions.x.getSize(),height:this.dimensions.y.getSize()}},total:function(){return this.dimension.getTotal()},offset:function(){return-this.movable.x},updateDimension:function(){this.dimension.update(!0)},refresh:function(){this.dimensions.refresh()},moveTo:function(e){this.movable.moveAxis("x",-e)},transitionTo:function(e,t,n){n?this.moveTo(-e):this.transition.moveTo({location:e,duration:this.duration,ease:t})}}),h.mobile.ui.ScrollViewElasticPane=r,s=h.Observable.extend({init:function(e,t,n){var i=this;h.Observable.fn.init.call(this),i.element=e,i.pane=t,i._getPages(),this.page=0,this.pageSize=n.pageSize||1,this.contentHeight=n.contentHeight,this.enablePager=n.enablePager,this.pagerOverlay=n.pagerOverlay},scrollTo:function(e,t){this.page=e,this.pane.transitionTo(-e*this.pane.size().width,p.easeOutExpo,t)},paneMoved:function(e,t,n,i){var o,r,s=this,a=s.pane,l=a.size().width*s.pageSize,c=C,h=t?p.easeOutBack:p.easeOutExpo;e===V?c=k:e===U&&(c=A),r=c(a.offset()/l),o=S(s.minSnap,T(-r*l,s.maxSnap)),r!=s.page&&n&&n({currentPage:s.page,nextPage:r})&&(o=-s.page*a.size().width),a.transitionTo(o,h,i)},updatePage:function(){var e=this.pane,t=C(e.offset()/e.size().width);return t!=this.page?(this.page=t,!0):!1},forcePageUpdate:function(){return this.updatePage()},resizeTo:function(e){var t,n,i=this.pane,o=e.width;this.pageElements.width(o),"100%"===this.contentHeight&&(t=this.element.parent().height(),this.enablePager===!0&&(n=this.element.parent().find("ol.km-pages"),!this.pagerOverlay&&n.length&&(t-=n.outerHeight(!0))),this.element.css("height",t),this.pageElements.css("height",t)),i.updateDimension(),this._paged||(this.page=A(i.offset()/o)),this.scrollTo(this.page,!0),this.pageCount=k(i.total()/o),this.minSnap=-(this.pageCount-1)*o,this.maxSnap=0},_getPages:function(){this.pageElements=this.element.find(h.roleSelector("page")),this._paged=this.pageElements.length>0}}),h.mobile.ui.ScrollViewContent=s,a=h.Observable.extend({init:function(e,t,n){var i=this;h.Observable.fn.init.call(this),i.element=e,i.pane=t,i.options=n,i._templates(),i.page=n.page||0,i.pages=[],i._initPages(),i.resizeTo(i.pane.size()),i.pane.dimension.forceEnabled()},setDataSource:function(e){this.dataSource=_.create(e),this._buffer(),this._pendingPageRefresh=!1,this._pendingWidgetRefresh=!1},_viewShow:function(){var e=this;e._pendingWidgetRefresh&&(setTimeout(function(){e._resetPages()},0),e._pendingWidgetRefresh=!1)},_buffer:function(){var e=this.options.itemsPerPage;this.buffer&&this.buffer.destroy(),this.buffer=e>1?new w(this.dataSource,e):new y(this.dataSource,3*e),this._resizeProxy=f(this,"_onResize"),this._resetProxy=f(this,"_onReset"),this._endReachedProxy=f(this,"_onEndReached"),this.buffer.bind({resize:this._resizeProxy,reset:this._resetProxy,endreached:this._endReachedProxy})},_templates:function(){var e=this.options.template,t=this.options.emptyTemplate,n={},i={};typeof e===R&&(n.template=e,e="#=this.template(data)#"),this.template=f(h.template(e),n),typeof t===R&&(i.emptyTemplate=t,t="#=this.emptyTemplate(data)#"),this.emptyTemplate=f(h.template(t),i)},_initPages:function(){var e,t,n=this.pages,i=this.element;for(t=0;L>t;t++)e=new l(i),n.push(e);this.pane.updateDimension()},resizeTo:function(e){var t,n,i,o=this.pages,r=this.pane;for(t=0;o.length>t;t++)o[t].setWidth(e.width);"auto"===this.options.contentHeight?this.element.css("height",this.pages[1].element.height()):"100%"===this.options.contentHeight&&(n=this.element.parent().height(),this.options.enablePager===!0&&(i=this.element.parent().find("ol.km-pages"),!this.options.pagerOverlay&&i.length&&(n-=i.outerHeight(!0))),this.element.css("height",n),o[0].element.css("height",n),o[1].element.css("height",n),o[2].element.css("height",n)),r.updateDimension(),this._repositionPages(),this.width=e.width},scrollTo:function(e){var t,n=this.buffer;n.syncDataSource(),t=n.at(e),t&&(this._updatePagesContent(e),this.page=e)},paneMoved:function(e,t,n,i){var o,r=this,s=r.pane,a=s.size().width,l=s.offset(),c=Math.abs(l)>=a/3,u=t?h.effects.Transition.easeOutBack:h.effects.Transition.easeOutExpo,d=r.page+2>r.buffer.total(),f=0;e===U?0!==r.page&&(f=-1):e!==V||d?l>0&&c&&!d?f=1:0>l&&c&&0!==r.page&&(f=-1):f=1,o=r.page,f&&(o=f>0?o+1:o-1),n&&n({currentPage:r.page,nextPage:o})&&(f=0),0===f?r._cancelMove(u,i):-1===f?r._moveBackward(i):1===f&&r._moveForward(i)},updatePage:function(){var e=this.pages;return 0===this.pane.offset()?!1:(this.pane.offset()>0?(e.push(this.pages.shift()),this.page++,this.setPageContent(e[2],this.page+1)):(e.unshift(this.pages.pop()),this.page--,this.setPageContent(e[0],this.page-1)),this._repositionPages(),this._resetMovable(),!0)},forcePageUpdate:function(){var e=this.pane.offset(),t=3*this.pane.size().width/4;
return x(e)>t?this.updatePage():!1},_resetMovable:function(){this.pane.moveTo(0)},_moveForward:function(e){this.pane.transitionTo(-this.width,h.effects.Transition.easeOutExpo,e)},_moveBackward:function(e){this.pane.transitionTo(this.width,h.effects.Transition.easeOutExpo,e)},_cancelMove:function(e,t){this.pane.transitionTo(0,e,t)},_resetPages:function(){this.page=this.options.page||0,this._updatePagesContent(this.page),this._repositionPages(),this.trigger("reset")},_onResize:function(){this.pageCount=k(this.dataSource.total()/this.options.itemsPerPage),this._pendingPageRefresh&&(this._updatePagesContent(this.page),this._pendingPageRefresh=!1),this.trigger("resize")},_onReset:function(){this.pageCount=k(this.dataSource.total()/this.options.itemsPerPage),this._resetPages()},_onEndReached:function(){this._pendingPageRefresh=!0},_repositionPages:function(){var e=this.pages;e[0].position(F),e[1].position(O),e[2].position(N)},_updatePagesContent:function(e){var t=this.pages,n=e||0;this.setPageContent(t[0],n-1),this.setPageContent(t[1],n),this.setPageContent(t[2],n+1)},setPageContent:function(t,n){var i=this.buffer,o=this.template,r=this.emptyTemplate,s=null;n>=0&&(s=i.at(n),e.isArray(s)&&!s.length&&(s=null)),this.trigger(z,{item:t.element}),t.content(null!==s?o(s):r({})),h.mobile.init(t.element),this.trigger(B,{item:t.element,data:s,ns:h.mobile.ui})}}),h.mobile.ui.VirtualScrollViewContent=a,l=h.Class.extend({init:function(t){this.element=e("
"),this.width=t.width(),this.element.width(this.width),t.append(this.element)},content:function(e){this.element.html(e)},position:function(e){this.element.css("transform","translate3d("+this.width*e+"px, 0, 0)")},setWidth:function(e){this.width=e,this.element.width(e)}}),h.mobile.ui.VirtualPage=l,c=v.extend({init:function(e,t){var n,i,o,l=this;v.fn.init.call(l,e,t),t=l.options,e=l.element,h.stripWhitespace(e[0]),e.wrapInner("
").addClass("km-scrollview"),this.options.enablePager&&(this.pager=new j(this),this.options.pagerOverlay&&e.addClass("km-scrollview-overlay")),l.inner=e.children().first(),l.page=0,l.inner.css("height",t.contentHeight),l.pane=new r(l.inner,{duration:this.options.duration,transitionEnd:f(this,"_transitionEnd"),dragStart:f(this,"_dragStart"),dragEnd:f(this,"_dragEnd"),change:f(this,E)}),l.bind("resize",function(){l.pane.refresh()}),l.page=t.page,n=0===this.inner.children().length,i=n?new a(l.inner,l.pane,t):new s(l.inner,l.pane,t),i.page=l.page,i.bind("reset",function(){this._pendingPageRefresh=!1,l._syncWithContent(),l.trigger(E,{pageCount:i.pageCount,page:i.page})}),i.bind("resize",function(){l.trigger(E,{pageCount:i.pageCount,page:i.page})}),i.bind(B,function(e){l.trigger(B,e),l.angular("compile",function(){return{elements:e.item,data:[{dataItem:e.data}]}})}),i.bind(z,function(e){l.angular("cleanup",function(){return{elements:e.item}})}),l._content=i,l.setDataSource(t.dataSource),o=l.container(),o.nullObject?(l.viewInit(),l.viewShow()):o.bind("show",f(this,"viewShow")).bind("init",f(this,"viewInit"))},options:{name:"ScrollView",page:0,duration:400,velocityThreshold:.8,contentHeight:"auto",pageSize:1,itemsPerPage:1,bounceVelocityThreshold:1.6,enablePager:!0,pagerOverlay:!1,autoBind:!0,template:"",emptyTemplate:""},events:[M,D,E],destroy:function(){v.fn.destroy.call(this),h.destroy(this.element)},viewInit:function(){this.options.autoBind&&this._content.scrollTo(this._content.page,!0)},viewShow:function(){this.pane.refresh()},refresh:function(){var e=this._content;e.resizeTo(this.pane.size()),this.page=e.page,this.trigger(E,{pageCount:e.pageCount,page:e.page})},content:function(e){this.element.children().first().html(e),this._content._getPages(),this.pane.refresh()},value:function(e){var n=this.dataSource;return e?(this.scrollTo(n.indexOf(e),!0),t):n.at(this.page)},scrollTo:function(e,t){this._content.scrollTo(e,t),this._syncWithContent()},prev:function(){var e=this,n=e.page-1;e._content instanceof a?e._content.paneMoved(U,t,function(t){return e.trigger(M,t)}):n>-1&&e.scrollTo(n)},next:function(){var e=this,n=e.page+1;e._content instanceof a?e._content.paneMoved(V,t,function(t){return e.trigger(M,t)}):e._content.pageCount>n&&e.scrollTo(n)},setDataSource:function(e){if(this._content instanceof a){var t=!e;this.dataSource=_.create(e),this._content.setDataSource(this.dataSource),this.options.autoBind&&!t&&this.dataSource.fetch()}},items:function(){return this.element.find("."+I)},_syncWithContent:function(){var e,n,i=this._content.pages,o=this._content.buffer;this.page=this._content.page,e=o?o.at(this.page):t,e instanceof Array||(e=[e]),n=i?i[1].element:t,this.trigger(D,{page:this.page,element:n,data:e})},_dragStart:function(){this._content.forcePageUpdate()&&this._syncWithContent()},_dragEnd:function(e){var t=this,n=e.x.velocity,i=this.options.velocityThreshold,o=H,r=x(n)>this.options.bounceVelocityThreshold;n>i?o=U:-i>n&&(o=V),this._content.paneMoved(o,r,function(e){return t.trigger(M,e)})},_transitionEnd:function(){this._content.updatePage()&&this._syncWithContent()}}),d.plugin(c)}(window.kendo.jQuery)}(),function(){!function(e,t){function n(e,t,n){return Math.max(t,Math.min(n,e))}var i=window.kendo,o=i.mobile.ui,r=o.Widget,s=i.support,a="change",l="km-switch-on",c="km-switch-off",h="margin-left",u="km-state-active",d="km-state-disabled",f="disabled",p=s.transitions.css+"transform",g=e.proxy,m=' {0} {1} ',v=r.extend({init:function(t,n){var o,s=this;r.fn.init.call(s,t,n),n=s.options,s.wrapper=e(i.format(m,n.onLabel,n.offLabel)),s.handle=s.wrapper.find(".km-switch-handle"),s.background=s.wrapper.find(".km-switch-background"),s.wrapper.insertBefore(s.element).prepend(s.element),s._drag(),s.origin=parseInt(s.background.css(h),10),s.constrain=0,s.snapPoint=0,t=s.element[0],t.type="checkbox",s._animateBackground=!0,o=s.options.checked,null===o&&(o=t.checked),s.check(o),s.options.enable=s.options.enable&&!s.element.attr(f),s.enable(s.options.enable),s.refresh(),i.notify(s,i.mobile.ui)},refresh:function(){var e=this,t=e.handle.outerWidth(!0);e.width=e.wrapper.width(),e.constrain=e.width-t,e.snapPoint=e.constrain/2,"number"!=typeof e.origin&&(e.origin=parseInt(e.background.css(h),10)),e.background.data("origin",e.origin),e.check(e.element[0].checked)},events:[a],options:{name:"Switch",onLabel:"on",offLabel:"off",checked:null,enable:!0},check:function(e){var n=this,i=n.element[0];return e===t?i.checked:(n._position(e?n.constrain:0),i.checked=e,n.wrapper.toggleClass(l,e).toggleClass(c,!e),t)},value:function(){return this.check.apply(this,arguments)},destroy:function(){r.fn.destroy.call(this),this.userEvents.destroy()},toggle:function(){var e=this;e.check(!e.element[0].checked)},enable:function(e){var n=this.element,i=this.wrapper;t===e&&(e=!0),this.options.enable=e,e?n.removeAttr(f):n.attr(f,f),i.toggleClass(d,!e)},_resize:function(){this.refresh()},_move:function(e){var t=this;e.preventDefault(),t._position(n(t.position+e.x.delta,0,t.width-t.handle.outerWidth(!0)))},_position:function(e){var t=this;t.position=e,t.handle.css(p,"translatex("+e+"px)"),t._animateBackground&&t.background.css(h,t.origin+e)},_start:function(){this.options.enable?(this.userEvents.capture(),this.handle.addClass(u)):this.userEvents.cancel()},_stop:function(){var e=this;e.handle.removeClass(u),e._toggle(e.position>e.snapPoint)},_toggle:function(e){var t,n=this,o=n.handle,r=n.element[0],s=r.checked,h=i.mobile.application&&i.mobile.application.os.wp?100:200;n.wrapper.toggleClass(l,e).toggleClass(c,!e),n.position=t=e*n.constrain,n._animateBackground&&n.background.kendoStop(!0,!0).kendoAnimate({effects:"slideMargin",offset:t,reset:!0,reverse:!e,axis:"left",duration:h}),o.kendoStop(!0,!0).kendoAnimate({effects:"slideTo",duration:h,offset:t+"px,0",reset:!0,complete:function(){s!==e&&(r.checked=e,n.trigger(a,{checked:e}))}})},_drag:function(){var e=this;e.userEvents=new i.UserEvents(e.wrapper,{tap:function(){e.options.enable&&e._toggle(!e.element[0].checked)},start:g(e._start,e),move:g(e._move,e),end:g(e._stop,e)})}});o.plugin(v)}(window.kendo.jQuery)}(),function(){!function(e){function t(t){return e(''+t+" ")}var n=window.kendo,i=n.mobile.ui,o=i.Widget,r="km-state-active",s="select",a=o.extend({init:function(t,n){var i=this;o.fn.init.call(i,t,n),i.container().bind("show",e.proxy(this,"refresh")),i.element.addClass("km-tabstrip").find("a").each(i._buildButton).eq(i.options.selectedIndex).addClass(r),i.element.on("down","a","_release")},events:[s],switchTo:function(t){var n,i,o=this.element.find("a"),r=0,s=o.length;if(!isNaN(t))return this._setActiveItem(o.eq(t)),!0;for(;s>r;r++)if(n=o[r],i=n.href.replace(/(\#.+)(\?.+)$/,"$1"),-1!==i.indexOf(t,i.length-t.length))return this._setActiveItem(e(n)),!0;return!1},switchByFullUrl:function(e){var t;t=this.element.find("a[href$='"+e+"']"),this._setActiveItem(t)},clear:function(){this.currentItem().removeClass(r)},currentItem:function(){return this.element.children("."+r)},badge:function(n,i){var o,r=this.element;return isNaN(n)||(n=r.children().get(n)),n=r.find(n),o=e(n.find(".km-badge")[0]||t(i).insertAfter(n.children(".km-icon"))),i||0===i?(o.html(i),this):i===!1?(o.empty().remove(),this):o.html()},_release:function(t){if(!(t.which>1)){var n=this,i=e(t.currentTarget);i[0]!==n.currentItem()[0]&&(n.trigger(s,{item:i})?t.preventDefault():n._setActiveItem(i))}},_setActiveItem:function(e){e[0]&&(this.clear(),e.addClass(r))},_buildButton:function(){var i=e(this),o=n.attrValue(i,"icon"),r=n.attrValue(i,"badge"),s=i.find("img"),a=e(' ');i.addClass("km-button").attr(n.attr("role"),"tab").contents().not(s).wrapAll(' '),s[0]?s.addClass("km-image").prependTo(i):(i.prepend(a),o&&(a.addClass("km-"+o),(r||0===r)&&t(r).insertAfter(a)))},refresh:function(e){var t=e.view.id;t&&!this.switchTo(e.view.id)&&this.switchTo(t)},options:{name:"TabStrip",selectedIndex:0,enable:!0}});i.plugin(a)}(window.kendo.jQuery)}(),function(){"bundle all"}();return window.kendo},typeof define=="function"&&define.amd?define:function(_,f){f()});