/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.popup.min"],function(){!function(e,t){function n(e,t){return e=e.split(" ")[!t+0]||e,e.replace("top","up").replace("bottom","down")}function i(e,t,n){e=e.split(" ")[!t+0]||e;var i={origin:["bottom",n?"right":"left"],position:["top",n?"right":"left"]},r=/left|right/.test(e);return r?(i.origin=["top",e],i.position[1]=l.directions[e].reverse):(i.origin[0]=e,i.position[0]=l.directions[e].reverse),i.origin=i.origin.join(" "),i.position=i.position.join(" "),i}function r(t,n){try{return e.contains(t,n)}catch(i){return!1}}function o(t){t=e(t),t.addClass("k-item").children(x).addClass(O),t.children("a").addClass(y).children(x).addClass(O),t.filter(":not([disabled])").addClass(M),t.filter(".k-separator:empty").append(" "),t.filter("li[disabled]").addClass(j).removeAttr("disabled").attr("aria-disabled",!0),t.filter("[role]").length||t.attr("role","menuitem"),t.children("."+y).length||t.contents().filter(function(){return!(this.nodeName.match(b)||3==this.nodeType&&!e.trim(this.nodeValue))}).wrapAll(""),a(t),s(t)}function a(t){t=e(t),t.find("> .k-link > [class*=k-i-arrow]").remove(),t.filter(":has(.k-group)").children(".k-link:not(:has([class*=k-i-arrow]))").each(function(){var t=e(this),n=t.parent().parent();t.append("")})}function s(t){t=e(t),t.filter(".k-first:not(:first-child)").removeClass(D),t.filter(".k-last:not(:last-child)").removeClass(H),t.filter(":first-child").addClass(D),t.filter(":last-child").addClass(H)}var l=window.kendo,c=l.ui,d=l._activeElement,u=l.support.touch&&l.support.mobileOS,p=u||l.support.pointers,m="mousedown",f="click",h=e.extend,v=e.proxy,g=e.each,k=l.template,_=l.keys,C=c.Widget,b=/^(ul|a|div)$/i,w=".kendoMenu",x="img",T="open",I="k-menu",y="k-link",H="k-last",A="close",P="timer",D="k-first",O="k-image",E="select",R="zIndex",U="activate",S="deactivate",z="touchstart"+w+" MSPointerDown"+w,L=l.support.pointers?"MSPointerOver":"mouseenter",B=l.support.pointers?"MSPointerOut":"mouseleave",G="kendoPopup",M="k-state-default",N="k-state-hover",W="k-state-focused",j="k-state-disabled",V=".k-group",q=":not(.k-list) > .k-item",F=".k-item.k-state-disabled",Z=".k-item:not(.k-state-disabled)",$=".k-item:not(.k-state-disabled) > .k-link",Q=":not(.k-item.k-separator)",J=Q+":eq(0)",K=Q+":last",X="div:not(.k-animation-container,.k-list-container)",Y={content:k("
#= content(item) #
"),group:k(""),itemWrapper:k("<#= tag(item) # class='#= textClass(item) #'#= textAttributes(item) #>#= image(item) ##= sprite(item) ##= text(item) ##= arrow(data) #"),item:k(""),image:k(""),arrow:k(""),sprite:k(""),empty:k("")},et={wrapperCssClass:function(e,t){var n="k-item",i=t.index;return n+=t.enabled===!1?" k-state-disabled":" k-state-default",e.firstLevel&&0===i&&(n+=" k-first"),i==e.length-1&&(n+=" k-last"),t.cssClass&&(n+=" "+t.cssClass),n},textClass:function(){return y},textAttributes:function(e){return e.url?" href='"+e.url+"'":""},arrowClass:function(e,t){var n="k-icon";return n+=t.horizontal?" k-i-arrow-s":" k-i-arrow-e"},text:function(e){return e.encoded===!1?e.text:l.htmlEncode(e.text)},tag:function(e){return e.url?"a":"span"},groupAttributes:function(e){return e.expanded!==!0?" style='display:none'":""},groupCssClass:function(){return"k-group"},content:function(e){return e.content?e.content:" "}},tt=C.extend({init:function(t,n){var i=this;C.fn.init.call(i,t,n),t=i.wrapper=i.element,n=i.options,i._initData(n),i._updateClasses(),i._animations(n),i.nextItemZIndex=100,i._tabindex(),i._focusProxy=v(i._focusHandler,i),t.on(z,i._focusProxy).on(f+w,F,!1).on(f+w,Z,v(i._click,i)).on("keydown"+w,v(i._keydown,i)).on("focus"+w,v(i._focus,i)).on("focus"+w,".k-content",v(i._focus,i)).on(z+" "+m+w,".k-content",v(i._preventClose,i)).on("blur"+w,v(i._removeHoverItem,i)).on("blur"+w,"[tabindex]",v(i._checkActiveElement,i)).on(L+w,Z,v(i._mouseenter,i)).on(B+w,Z,v(i._mouseleave,i)).on(L+w+" "+B+w+" "+m+w+" "+f+w,$,v(i._toggleHover,i)),n.openOnClick&&(i.clicked=!1,i._documentClickHandler=v(i._documentClick,i),e(document).click(i._documentClickHandler)),t.attr("role","menubar"),t[0].id&&(i._ariaId=l.format("{0}_mn_active",t[0].id)),l.notify(i)},events:[T,A,U,S,E],options:{name:"Menu",animation:{open:{duration:200},close:{duration:100}},orientation:"horizontal",direction:"default",openOnClick:!1,closeOnClick:!0,hoverDelay:100},_initData:function(e){var t=this;e.dataSource&&(t.element.empty(),t.append(e.dataSource,t.element))},setOptions:function(e){var t=this.options.animation;this._animations(e),e.animation=h(!0,t,e.animation),"dataSource"in e&&this._initData(e),C.fn.setOptions.call(this,e)},destroy:function(){var t=this;C.fn.destroy.call(t),t.element.off(w),t._documentClickHandler&&e(document).unbind("click",t._documentClickHandler)},enable:function(e,t){return this._toggleDisabled(e,t!==!1),this},disable:function(e){return this._toggleDisabled(e,!1),this},append:function(e,t){t=this.element.find(t);var n=this._insert(e,t,t.length?t.find("> .k-group, > .k-animation-container > .k-group"):null);return g(n.items,function(){n.group.append(this),a(this)}),a(t),s(n.group.find(".k-first, .k-last").add(n.items)),this},insertBefore:function(e,t){t=this.element.find(t);var n=this._insert(e,t,t.parent());return g(n.items,function(){t.before(this),a(this),s(this)}),s(t),this},insertAfter:function(e,t){t=this.element.find(t);var n=this._insert(e,t,t.parent());return g(n.items,function(){t.after(this),a(this),s(this)}),s(t),this},_insert:function(t,n,i){var r,a,s,l,c=this;return n&&n.length||(i=c.element),s=e.isPlainObject(t),l={firstLevel:i.hasClass(I),horizontal:i.hasClass(I+"-horizontal"),expanded:!0,length:i.children().length},n&&!i.length&&(i=e(tt.renderGroup({group:l})).appendTo(n)),s||e.isArray(t)?r=e.map(s?[t]:t,function(t,n){return"string"==typeof t?e(t):e(tt.renderItem({group:l,item:h(t,{index:n})}))}):(r=e(t),a=r.find("> ul").addClass("k-group").attr("role","menu"),r=r.filter("li"),r.add(a.find("> li")).each(function(){o(this)})),{items:r,group:i}},remove:function(e){var t,n,i,r;return e=this.element.find(e),t=this,n=e.parentsUntil(t.element,q),i=e.parent("ul"),e.remove(),i&&!i.children(q).length&&(r=i.parent(".k-animation-container"),r.length?r.remove():i.remove()),n.length&&(n=n.eq(0),a(n),s(n)),t},open:function(r){var o=this,a=o.options,s="horizontal"==a.orientation,c=a.direction,d=l.support.isRtl(o.wrapper);return r=o.element.find(r),/^(top|bottom|default)$/.test(c)&&(c=d?s?(c+" left").replace("default","bottom"):"left":s?(c+" right").replace("default","bottom"):"right"),r.siblings().find(">.k-popup:visible,>.k-animation-container>.k-popup:visible").each(function(){var t=e(this).data("kendoPopup");t&&t.close()}),r.each(function(){var r=e(this);clearTimeout(r.data(P)),r.data(P,setTimeout(function(){var e,l,u,m,f,v,g=r.find(".k-group:first:hidden");g[0]&&o.trigger(T,{item:r[0]})===!1&&(r.data(R,r.css(R)),r.css(R,o.nextItemZIndex++),e=g.data(G),l=r.parent().hasClass(I),u=l&&s,m=i(c,l,d),f=a.animation.open.effects,v=f!==t?f:"slideIn:"+n(c,l),e?(e=g.data(G),e.options.origin=m.origin,e.options.position=m.position,e.options.animation.open.effects=v):e=g.kendoPopup({activate:function(){o.trigger(U,{item:this.wrapper.parent()})},deactivate:function(){o.trigger(S,{item:this.wrapper.parent()})},origin:m.origin,position:m.position,collision:a.popupCollision!==t?a.popupCollision:u?"fit":"fit flip",anchor:r,appendTo:r,animation:{open:h(!0,{effects:v},a.animation.open),close:a.animation.close},close:function(e){var t=e.sender.wrapper.parent();o.trigger(A,{item:t[0]})?e.preventDefault():(t.css(R,t.data(R)),t.removeData(R),p&&(t.removeClass(N),o._removeHoverItem()))}}).data(G),g.removeAttr("aria-hidden"),e.open())},o.options.hoverDelay))}),o},close:function(t){var n=this,i=n.element;return t=i.find(t),t.length||(t=i.find(">.k-item")),t.each(function(){var t=e(this);clearTimeout(t.data(P)),t.data(P,setTimeout(function(){var e=t.find(".k-group:not(.k-list-container):first:visible").data(G);e&&(e.close(),e.element.attr("aria-hidden",!0))},n.options.hoverDelay))}),n},_toggleDisabled:function(t,n){this.element.find(t).each(function(){e(this).toggleClass(M,n).toggleClass(j,!n).attr("aria-disabled",!n)})},_toggleHover:function(t){var n=e(l.eventTarget(t)||t.target).closest(q),i=t.type==L||-1!==m.indexOf(t.type);n.parents("li."+j).length||n.toggleClass(N,i||"mousedown"==t.type||"click"==t.type),this._removeHoverItem()},_preventClose:function(){this.options.closeOnClick||(this._closurePrevented=!0)},_checkActiveElement:function(t){var n=this,i=e(this._hoverItem()[0]||(t?t.currentTarget:{})),o=n._findRootParent(i)[0];this._closurePrevented||setTimeout(function(){(!document.hasFocus()||!r(o,l._activeElement())&&t&&!r(o,t.currentTarget))&&n.close(o)},0),this._closurePrevented=!1},_removeHoverItem:function(){var e=this._hoverItem();e&&e.hasClass(W)&&(e.removeClass(W),this._oldHoverItem=null)},_updateClasses:function(){var e,t=this.element;t.addClass("k-widget k-reset k-header "+I).addClass(I+"-"+this.options.orientation),t.find("li > ul").addClass("k-group").attr("role","menu").attr("aria-hidden",t.is(":visible")).end().find("li > div").addClass("k-content").attr("tabindex","-1"),e=t.find("> li,.k-group > li"),e.each(function(){o(this)})},_mouseenter:function(t){var n=this,i=e(t.currentTarget),o=i.children(".k-animation-container").length||i.children(V).length;t.delegateTarget==i.parents(".k-menu")[0]&&((!n.options.openOnClick||n.clicked)&&!r(t.currentTarget,t.relatedTarget)&&o&&n.open(i),(n.options.openOnClick&&n.clicked||p)&&i.siblings().each(v(function(e,t){n.close(t)},n)))},_mouseleave:function(n){var i=this,o=e(n.currentTarget),a=o.children(".k-animation-container").length||o.children(V).length;return o.parentsUntil(".k-animation-container",".k-list-container,.k-calendar-container")[0]?(n.stopImmediatePropagation(),t):(i.options.openOnClick||u||l.support.pointers&&2==n.originalEvent.pointerType||r(n.currentTarget,n.relatedTarget)||!a||i.close(o),t)},_click:function(n){var i,r,o,a=this,s=a.options,c=e(l.eventTarget(n)),d=c[0]?c[0].nodeName.toUpperCase():"",u="INPUT"==d||"SELECT"==d||"BUTTON"==d,p=c.closest("."+y),m=c.closest(q),f=p.attr("href"),h=!!f&&f!==e("").attr("href");if(!m.children(X)[0])return m.hasClass(j)?(n.preventDefault(),t):(n.handled||!a.trigger(E,{item:m[0]})||u||n.preventDefault(),n.handled=!0,r=m.children(V+",.k-animation-container"),o=r.is(":visible"),s.closeOnClick&&!h&&(!r.length||s.openOnClick&&o)?(m.removeClass(N).css("height"),a._oldHoverItem=a._findRootParent(m),a.close(p.parentsUntil(a.element,q)),a.clicked=!1,-1!="MSPointerUp".indexOf(n.type)&&n.preventDefault(),t):((m.parent().hasClass(I)&&s.openOnClick||l.support.touch)&&(h||u||n.preventDefault(),a.clicked=!0,i=r.is(":visible")?A:T,(s.closeOnClick||i!=A)&&a[i](m)),t))},_documentClick:function(e){r(this.element[0],e.target)||(this.clicked=!1)},_focus:function(n){var i=this,r=n.target,o=i._hoverItem(),a=d();return r==i.wrapper[0]||e(r).is(":focusable")?(a===n.currentTarget&&(o.length?i._moveHover([],o):i._oldHoverItem||i._moveHover([],i.wrapper.children().first())),t):(n.stopPropagation(),e(r).closest(".k-content").closest(".k-group").closest(".k-item").addClass(W),i.wrapper.focus(),t)},_keydown:function(e){var n,i,r,o=this,a=e.keyCode,s=o._oldHoverItem,c=l.support.isRtl(o.wrapper);if(e.target==e.currentTarget||a==_.ESC){if(s||(s=o._oldHoverItem=o._hoverItem()),i=o._itemBelongsToVertival(s),r=o._itemHasChildren(s),a==_.RIGHT)n=o[c?"_itemLeft":"_itemRight"](s,i,r);else if(a==_.LEFT)n=o[c?"_itemRight":"_itemLeft"](s,i,r);else if(a==_.DOWN)n=o._itemDown(s,i,r);else if(a==_.UP)n=o._itemUp(s,i,r);else if(a==_.ESC)n=o._itemEsc(s,i);else if(a==_.ENTER||a==_.SPACEBAR)n=s.children(".k-link"),n.length>0&&(o._click({target:n[0],preventDefault:function(){}}),o._moveHover(s,o._findRootParent(s)));else if(a==_.TAB)return n=o._findRootParent(s),o._moveHover(s,n),o._checkActiveElement(),t;n&&n[0]&&(e.preventDefault(),e.stopPropagation())}},_hoverItem:function(){return this.wrapper.find(".k-item.k-state-hover,.k-item.k-state-focused").filter(":visible")},_itemBelongsToVertival:function(e){var t=this.wrapper.hasClass("k-menu-vertical");return e.length?e.parent().hasClass("k-group")||t:t},_itemHasChildren:function(e){return e.length?e.children("ul.k-group, div.k-animation-container").length>0:!1},_moveHover:function(e,t){var n=this,i=n._ariaId;e.length&&t.length&&(e.removeClass(W),e[0].id===i&&e.removeAttr("id")),t.length&&(t[0].id&&(i=t[0].id),t.addClass(W),n._oldHoverItem=t,i&&(n.element.removeAttr("aria-activedescendant"),t.attr("id",i),n.element.attr("aria-activedescendant",i)))},_findRootParent:function(e){return e.parent().hasClass("k-menu")?e:e.parentsUntil(".k-menu","li.k-item").last()},_isRootItem:function(e){return e.parent().hasClass("k-menu")},_itemRight:function(e,t,n){var i,r,o=this;if(!e.hasClass(j))return t?n?(o.open(e),i=e.find(".k-group").children().first()):"horizontal"==o.options.orientation&&(r=o._findRootParent(e),o.close(r),i=r.nextAll(J)):(i=e.nextAll(J),i.length||(i=e.prevAll(K))),i&&!i.length?i=o.wrapper.children(".k-item").first():i||(i=[]),o._moveHover(e,i),i},_itemLeft:function(e,t){var n,i=this;return t?(n=e.parent().closest(".k-item"),i.close(n),i._isRootItem(n)&&"horizontal"==i.options.orientation&&(n=n.prevAll(J))):(n=e.prevAll(J),n.length||(n=e.nextAll(K))),n.length||(n=i.wrapper.children(".k-item").last()),i._moveHover(e,n),n},_itemDown:function(e,t,n){var i,r=this;if(t)i=e.nextAll(J);else{if(!n||e.hasClass(j))return;r.open(e),i=e.find(".k-group").children().first()}return!i.length&&e.length?i=e.parent().children().first():e.length||(i=r.wrapper.children(".k-item").first()),r._moveHover(e,i),i},_itemUp:function(e,t){var n,i=this;if(t)return n=e.prevAll(J),!n.length&&e.length?n=e.parent().children().last():e.length||(n=i.wrapper.children(".k-item").last()),i._moveHover(e,n),n},_itemEsc:function(e,t){var n,i=this;return t?(n=e.parent().closest(".k-item"),i.close(n),i._moveHover(e,n),n):e},_focusHandler:function(t){var n=this,i=e(l.eventTarget(t)).closest(q);setTimeout(function(){n._moveHover([],i),i.children(".k-content")[0]&&i.parent().closest(".k-item").removeClass(W)},200)},_animations:function(e){e&&"animation"in e&&!e.animation&&(e.animation={open:{effects:{}},close:{hide:!0,effects:{}}})}});h(tt,{renderItem:function(e){e=h({menu:{},group:{}},e);var t=Y.empty,n=e.item;return Y.item(h(e,{image:n.imageUrl?Y.image:t,sprite:n.spriteCssClass?Y.sprite:t,itemWrapper:Y.itemWrapper,renderContent:tt.renderContent,arrow:n.items||n.content?Y.arrow:t,subGroup:tt.renderGroup},et))},renderGroup:function(e){return Y.group(h({renderItems:function(e){for(var t="",n=0,i=e.items,r=i?i.length:0,o=h({length:r},e.group);r>n;n++)t+=tt.renderItem(h(e,{group:o,item:h({index:n},i[n])}));return t}},e,et))},renderContent:function(e){return Y.content(h(e,et))}}),l.ui.plugin(tt)}(window.kendo.jQuery)});