UNPKG

yunkong2.admin

Version:

The adapter opens a webserver for the yunkong2 admin UI.

1 lines 110 kB
!function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=e(require("jquery"))):e(jQuery)}(function(C){"use strict";if(!C.ui||!C.ui.fancytree){var o,e,g=null,y=new RegExp(/\.|\//),t=/[&<>"'\/]/g,n=/[<>"'\/]/g,c="$recursive_request",r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},i={16:!0,17:!0,18:!0},f={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={0:"",1:"left",2:"middle",3:"right"},v="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),m={},u="columns types".split(" "),x="checkbox expanded extraClasses folder icon iconTooltip key lazy radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),s={},b={},l={active:!0,children:!0,data:!0,focus:!0};for(o=0;o<v.length;o++)m[v[o]]=!0;for(o=0;o<x.length;o++)e=x[o],s[e]=!0,e!==e.toLowerCase()&&(b[e.toLowerCase()]=e);return k(C.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),A.prototype={_findDirectChild:function(e){var t,n,r=this.children;if(r)if("string"==typeof e){for(t=0,n=r.length;t<n;t++)if(r[t].key===e)return r[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){k(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var t=0,n=e.length;t<n;t++)this.children.push(new A(this,e[t]))},addChildren:function(e,t){var n,r,i,o,a=this.getFirstChild(),s=this.getLastChild(),l=[];for(C.isPlainObject(e)&&(e=[e]),this.children||(this.children=[]),n=0,r=e.length;n<r;n++)l.push(new A(this,e[n]));if(o=l[0],null==t?this.children=this.children.concat(l):(t=this._findDirectChild(t),k(0<=(i=C.inArray(t,this.children)),"insertBefore must be an existing child"),this.children.splice.apply(this.children,[i,0].concat(l))),a&&!t){for(n=0,r=l.length;n<r;n++)l[n].render();a!==this.getFirstChild()&&a.renderStatus(),s!==this.getLastChild()&&s.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===l.length?l[0]:null),o},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,t){switch(void 0!==t&&"over"!==t||(t="child"),t){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var n=this.children?this.children[0]:null;return this.addChildren(e,n);case"child":case"over":return this.addChildren(e)}k(!1,"Invalid mode: "+t)},addPagingNode:function(e,t){var n,r;if(t=t||"child",!1!==e)return e=C.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},e),this.partload=!0,this.addNode(e,t);for(n=this.children.length-1;0<=n;n--)"paging"===(r=this.children[n]).statusNodeType&&this.removeChild(r);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyPatch:function(e){if(null===e)return this.remove(),_(this);var t,n,r={children:!0,expanded:!0,parent:!0};for(t in e)n=e[t],r[t]||C.isFunction(n)||(s[t]?this[t]=n:this.data[t]=n);return e.hasOwnProperty("children")&&(this.removeChildren(),e.children&&this._setChildren(e.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),e.hasOwnProperty("expanded")?this.setExpanded(e.expanded):_(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,r,i=this.children;if(!i)return 0;if(r=i.length,!1!==e)for(t=0,n=r;t<n;t++)r+=i[t].countChildren();return r},debug:function(e){2<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},findAll:function(t){t=C.isFunction(t)?t:T(t);var n=[];return this.visit(function(e){t(e)&&n.push(e)}),n},findFirst:function(t){t=C.isFunction(t)?t:T(t);var n=null;return this.visit(function(e){if(t(e))return n=e,!1}),n},_changeSelectStatusAttrs:function(e){var t=!1,n=this.tree.options,r=g.evalOption("unselectable",this,this,n,!1),i=g.evalOption("unselectableStatus",this,this,n,void 0);switch(r&&null!=i&&(e=i),e){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:k(!1,"invalid state: "+e)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit(function(e){e._changeSelectStatusAttrs(t)}),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){var u=this.tree.options;k(3===u.selectMode,"expected selectMode 3"),function e(t){var n,r,i,o,a,s,l,d,c=t.children;if(c&&c.length){for(l=!(s=!0),n=0,r=c.length;n<r;n++)o=e(i=c[n]),g.evalOption("unselectableIgnore",i,i,u,!1)||(!1!==o&&(l=!0),!0!==o&&(s=!1));a=!!s||!!l&&void 0}else a=null==(d=g.evalOption("unselectableStatus",t,t,u,void 0))?!!t.selected:!!d;return t._changeSelectStatusAttrs(a),a}(this),this.visitParents(function(e){var t,n,r,i,o,a=e.children,s=!0,l=!1;for(t=0,n=a.length;t<n;t++)r=a[t],g.evalOption("unselectableIgnore",r,r,u,!1)||(((i=null==(o=g.evalOption("unselectableStatus",r,r,u,void 0))?!!r.selected:!!o)||r.partsel)&&(l=!0),i||(s=!1));i=!!s||!!l&&void 0,e._changeSelectStatusAttrs(i)})},fromDict:function(e){for(var t in e)s[t]?this[t]=e[t]:"data"===t?C.extend(this.data,e.data):C.isFunction(e[t])||l[t]||(this.data[t]=e[t]);e.children&&(this.removeChildren(),this.addChildren(e.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return C.inArray(this,this.parent.children)},getIndexHier:function(e,n){e=e||".";var r,i=[];return C.each(this.getParentList(!1,!0),function(e,t){r=""+(t.getIndex()+1),n&&(r=("0000000"+r).substr(-n)),i.push(r)}),i.join(e)},getKeyPath:function(e){var t=[],n=this.tree.options.keyPathSeparator;return this.visitParents(function(e){e.parent&&t.unshift(e.key)},!e),n+t.join(n)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=0,t=n.length-1;e<t;e++)if(n[e]===this)return n[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var n=[],r=t?this:this.parent;r;)(e||r.parent)&&n.unshift(r),r=r.parent;return n},getPrevSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=1,t=n.length;e<t;e++)if(n[e]===this)return n[e-1]}return null},getSelectedNodes:function(t){var n=[];return this.visit(function(e){if(e.selected&&(n.push(e),!0===t))return"skip"}),n},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){1<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(e){if(!e||e.tree!==this.tree)return!1;for(var t=this.parent;t;){if(t===e)return!0;t===t.parent&&C.error("Recursive parent link: "+t),t=t.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,n=this.getParentList(!1,!1);for(e=0,t=n.length;e<t;e++)if(!n[e].expanded)return!1;return!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var t,n,r=this,i=this.isExpanded();return k(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(n=this.tree._triggerNodeEvent("lazyLoad",this))?_(this):(k("boolean"!=typeof n,"lazyLoad event must return source in data.result"),t=this.tree._callHook("nodeLoadChildren",this,n),i?(this.expanded=!0,t.always(function(){r.render()})):t.always(function(){r.renderStatus()}),t)):_(this)},makeVisible:function(e){var t,n=this,r=[],i=new C.Deferred,o=this.getParentList(!1,!1),a=o.length,s=!(e&&!0===e.noAnimation),l=!(e&&!1===e.scrollIntoView);for(t=a-1;0<=t;t--)r.push(o[t].setExpanded(!0,e));return C.when.apply(C,r).done(function(){l?n.scrollIntoView(s).done(function(){i.resolve()}):i.resolve()}),i.promise()},moveTo:function(t,e,n){void 0===e||"over"===e?e="child":"firstChild"===e&&(t.children&&t.children.length?(e="before",t=t.children[0]):e="child");var r,i=this.parent,o="child"===e?t:t.parent;if(this!==t){if(this.parent?o.isDescendantOf(this)&&C.error("Cannot move a node to its own descendant"):C.error("Cannot move system root"),o!==i&&i.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===o)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else k(0<=(r=C.inArray(this,this.parent.children)),"invalid source parent"),this.parent.children.splice(r,1);if((this.parent=o).hasChildren())switch(e){case"child":o.children.push(this);break;case"before":k(0<=(r=C.inArray(t,o.children)),"invalid target parent"),o.children.splice(r,0,this);break;case"after":k(0<=(r=C.inArray(t,o.children)),"invalid target parent"),o.children.splice(r+1,0,this);break;default:C.error("Invalid mode "+e)}else o.children=[this];n&&t.visit(n,!0),o===i?o.triggerModifyChild("move",this):o.triggerModifyChild("add",this),this.tree!==t.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(e){e.tree=t.tree},!0)),i.isDescendantOf(o)||i.render(),o.isDescendantOf(i)||o===i||o.render()}},navigate:function(t,n){var e,r,i,o=C.ui.keyCode,a=null;function s(e){if(e){try{e.makeVisible({scrollIntoView:!1})}catch(e){}return C(e.span).is(":visible")?!1===n?e.setFocus():e.setActive():(e.debug("Navigate: skipping hidden node"),void e.navigate(t,n))}}switch(t){case o.BACKSPACE:this.parent&&this.parent.parent&&(i=s(this.parent));break;case o.HOME:this.tree.visit(function(e){if(C(e.span).is(":visible"))return i=s(e),!1});break;case o.END:this.tree.visit(function(e){C(e.span).is(":visible")&&(i=e)}),i&&(i=s(i));break;case o.LEFT:this.expanded?(this.setExpanded(!1),i=s(this)):this.parent&&this.parent.parent&&(i=s(this.parent));break;case o.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(i=s(this.children[0])):(this.setExpanded(),i=s(this));break;case o.UP:for(a=this.getPrevSibling();a&&!C(a.span).is(":visible");)a=a.getPrevSibling();for(;a&&a.expanded&&a.children&&a.children.length;)a=a.children[a.children.length-1];!a&&this.parent&&this.parent.parent&&(a=this.parent),i=s(a);break;case o.DOWN:if(this.expanded&&this.children&&this.children.length)a=this.children[0];else for(e=(r=this.getParentList(!1,!0)).length-1;0<=e;e--){for(a=r[e].getNextSibling();a&&!C(a.span).is(":visible");)a=a.getNextSibling();if(a)break}i=s(a);break;default:!1}return i||_()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(e){var t,n=this.parent,r=C.inArray(this,n.children),i=this;return k(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(t=this.tree._callHook("nodeLoadChildren",this,e)).done(function(e){var t=i.children;for(o=0;o<t.length;o++)t[o].parent=n;n.children.splice.apply(n.children,[r+1,0].concat(t)),i.children=null,i.remove(),n.render()}).fail(function(){i.setExpanded()}),t},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(e,t){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var n=this;switch(e){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger expand"),n.setExpanded(!0)},t);break;case"activate":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger activate"),n.setActive(!0)},t);break;default:C.error("Invalid mode "+e)}},scrollIntoView:function(e,t){var n;void 0!==t&&((n=t).tree&&void 0!==n.statusNodeType)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),t={topNode:t});var r,i,o,a=C.extend({effects:!0===e?{duration:200,queue:!1}:e,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},t),s=new C.Deferred,l=this,d=C(this.span).height(),c=C(a.scrollParent),u=a.scrollOfs.top||0,p=a.scrollOfs.bottom||0,h=c.height(),f=c.scrollTop(),g=c,y=c[0]===window,v=a.topNode||null,m=null;return C(this.span).is(":visible")?(y?(i=C(this.span).offset().top,r=v&&v.span?C(v.span).offset().top:0,g=C("html,body")):(k(c[0]!==document&&c[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),o=c.offset().top,i=C(this.span).offset().top-o+f,r=v?C(v.span).offset().top-o+f:0,h-=Math.max(0,c.innerHeight()-c[0].clientHeight)),i<f+u?m=i-u:f+h-p<i+d&&(m=i+d-h+p,v&&(k(v.isRootNode()||C(v.span).is(":visible"),"topNode must be visible"),r<m&&(m=r-u))),null!==m?a.effects?(a.effects.complete=function(){s.resolveWith(l)},g.stop(!0).animate({scrollTop:m},a.effects)):(g[0].scrollTop=m,s.resolveWith(this)):s.resolveWith(this),s.promise()):(this.warn("scrollIntoView(): node is invisible."),_())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,n){return this.tree._callHook("nodeSetStatus",this,e,t,n)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var n,r,i=this.children;if(i){if(e=e||function(e,t){var n=e.title.toLowerCase(),r=t.title.toLowerCase();return n===r?0:r<n?1:-1},i.sort(e),t)for(n=0,r=i.length;n<r;n++)i[n].children&&i[n].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(e,t){var n,r,i,o={},a=this;if(C.each(x,function(e,t){(a[t]||!1===a[t])&&(o[t]=a[t])}),C.isEmptyObject(this.data)||(o.data=C.extend({},this.data),C.isEmptyObject(o.data)&&delete o.data),t&&t(o,a),e&&this.hasChildren())for(o.children=[],n=0,r=this.children.length;n<r;n++)(i=this.children[n]).isStatusNode()||o.children.push(i.toDict(!0,t));return o},toggleClass:function(e,t){var n,r,i=e.match(/\S+/g)||[],o=0,a=!1,s=this[this.tree.statusClassPropName],l=" "+(this.extraClasses||"")+" ";for(s&&C(s).toggleClass(e,t);n=i[o++];)if(r=0<=l.indexOf(" "+n+" "),t=void 0===t?!r:!!t)r||(l+=n+" ",a=!0);else for(;-1<l.indexOf(" "+n+" ");)l=l.replace(" "+n+" "," ");return this.extraClasses=C.trim(l),a},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(e,t,n){var r,i=this.tree.options.modifyChild;i&&(t&&t.parent!==this&&C.error("childNode "+t+" is not a child of "+this),r={node:this,tree:this.tree,operation:e,childNode:t||null},n&&C.extend(r,n),i({type:"modifyChild"},r))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var n,r,i=!0,o=this.children;if(!0===t&&(!1===(i=e(this))||"skip"===i))return i;if(o)for(n=0,r=o.length;n<r&&!1!==(i=o[n].visit(e,!0));n++);return i},visitAndLoad:function(n,e,t){var r,i,o,a=this;return!n||!0!==e||!1!==(i=n(a))&&"skip"!==i?a.children||a.lazy?(r=new C.Deferred,o=[],a.load().done(function(){for(var e=0,t=a.children.length;e<t;e++){if(!1===(i=a.children[e].visitAndLoad(n,!0,!0))){r.reject();break}"skip"!==i&&o.push(i)}C.when.apply(this,o).then(function(){r.resolve()})}),r.promise()):_():t?i:_()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var n=this.parent;n;){if(!1===e(n))return!1;n=n.parent}return!0},visitSiblings:function(e,t){var n,r,i,o=this.parent.children;for(n=0,r=o.length;n<r;n++)if(i=o[n],(t||i!==this)&&!1===e(i))return!1;return!0},warn:function(e){Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments)}},F.prototype={_makeHookContext:function(e,t,n){var r,i;return void 0!==e.node?(t&&e.originalEvent!==t&&C.error("invalid args"),r=e):e.tree?r={node:e,tree:i=e.tree,widget:i.widget,options:i.widget.options,originalEvent:t,typeInfo:i.types[e.type]||{}}:e.widget?r={node:null,tree:e,widget:e.widget,options:e.widget.options,originalEvent:t}:C.error("invalid args"),n&&C.extend(r,n),r},_callHook:function(e,t,n){var r=this._makeHookContext(t),i=this[e],o=Array.prototype.slice.call(arguments,2);return C.isFunction(i)||C.error("_callHook('"+e+"') is not a function"),o.unshift(r),i.apply(this,o)},_setExpiringValue:function(e,t,n){this._tempCache[e]={value:t,expire:Date.now()+(+n||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_requireExtension:function(e,t,n,r){n=!!n;var i=this._local.name,o=this.options.extensions,a=C.inArray(e,o)<C.inArray(i,o),s=t&&null==this.ext[e],l=!s&&null!=n&&n!==a;return k(i&&i!==e,"invalid or same name"),!s&&!l||(r||(s||t?(r="'"+i+"' extension requires '"+e+"'",l&&(r+=" to be registered "+(n?"before":"after")+" itself")):r="If used together, `"+e+"` must be registered "+(n?"before":"after")+" `"+i+"`"),C.error(r),!1)},activateKey:function(e){var t=this.getNodeByKey(e);return t?t.setActive():this.activeNode&&this.activeNode.setActive(!1),t},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyPatch:function(e){var t,n,r,i,o,a,s=e.length,l=[];for(n=0;n<s;n++)k(2===(r=e[n]).length,"patchList must be an array of length-2-arrays"),i=r[0],o=r[1],(a=null===i?this.rootNode:this.getNodeByKey(i))?(t=new C.Deferred,l.push(t),a.applyPatch(o).always(S(t,a))):this.warn("could not find node with key '"+i+"'");return C.when.apply(C,l).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){2<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:((this._enableUpdate=e)?(this.debug("enableUpdate(true): redraw "),this.render()):this.debug("enableUpdate(false)..."),!e)},error:function(e){Array.prototype.unshift.call(arguments,this.toString()),d("error",arguments)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(t,n,e){var r;t="string"==typeof t?(r=new RegExp("^"+t,"i"),function(e){return r.test(e.title)}):t,n=n||this.getFirstChild();var i=null,o=n.parent.children,a=null,l=function(e,t,n){var r,i,o=e.children,a=o.length,s=o[t];if(s&&!1===n(s))return!1;if(s&&s.children&&s.expanded&&!1===l(s,0,n))return!1;for(r=t+1;r<a;r++)if(!1===l(e,r,n))return!1;return(i=e.parent)?l(i,i.children.indexOf(e)+1,n):l(e,0,n)};return l(n.parent,o.indexOf(n),function(e){return e!==i&&(i=i||e,C(e.span).is(":visible")?(!t(e)||(a=e)===n)&&void 0:void e.debug("quicksearch: skipping hidden node"))}),a},generateFormElements:function(e,t,n){n=n||{};var r,i="string"==typeof e?e:"ft_"+this._id+"[]",o="string"==typeof t?t:"ft_"+this._id+"_active",a="fancytree_result_"+this._id,s=C("#"+a),l=3===this.options.selectMode&&!1!==n.stopOnParents;function d(e){s.append(C("<input>",{type:"checkbox",name:i,value:e.key,checked:!0}))}s.length?s.empty():s=C("<div>",{id:a}).hide().insertAfter(this.$container),!1!==t&&this.activeNode&&s.append(C("<input>",{type:"radio",name:o,value:this.activeNode.key,checked:!0})),n.filter?this.visit(function(e){var t=n.filter(e);if("skip"===t)return t;!1!==t&&d(e)}):!1!==e&&(r=this.getSelectedNodes(l),C.each(r,function(e,t){d(t)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(t,e){var n,r;return!e&&(n=document.getElementById(this.options.idPrefix+t))?n.ftnode?n.ftnode:null:(e=e||this.rootNode,r=null,e.visit(function(e){if(e.key===t)return r=e,!1},!0),r)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){1<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},loadKeyPath:function(e,t){var r,n,i,o=this,a=new C.Deferred,s=this.getRootNode(),l=this.options.keyPathSeparator,d=[],c=C.extend({},t);for("function"==typeof t?r=t:t&&t.callback&&(r=t.callback),c.callback=function(e,t,n){r&&r.call(e,t,n),a.notifyWith(e,[{node:t,status:n}])},null==c.matchKey&&(c.matchKey=function(e,t){return e.key===t}),C.isArray(e)||(e=[e]),n=0;n<e.length;n++)(i=e[n]).charAt(0)===l&&(i=i.substr(1)),d.push(i.split(l));return setTimeout(function(){o._loadKeyPathImpl(a,c,s,d).done(function(){a.resolve()})},0),a.promise()},_loadKeyPathImpl:function(e,o,t,n){var r,i,a,s,l,d,c,u,p=this;function h(e,t){var n,r,i=e.children;if(i)for(n=0,r=i.length;n<r;n++)if(o.matchKey(i[n],t))return i[n];return null}for(l={},i=0;i<n.length;i++)for(c=n[i],d=t;c.length;){if(a=c.shift(),!(s=h(d,a))){this.warn("loadKeyPath: key not found: "+a+" (parent: "+d+")"),o.callback(this,a,"error");break}if(0===c.length){o.callback(this,s,"ok");break}if(s.lazy&&void 0===s.hasChildren()){o.callback(this,s,"loaded"),l[a=s.key]?l[a].pathSegList.push(c):l[a]={parent:s,pathSegList:[c]};break}o.callback(this,s,"loaded"),d=s}function f(t,n,e){o.callback(p,n,"loading"),n.load().done(function(){p._loadKeyPathImpl.call(p,t,o,n,e).always(S(t,p))}).fail(function(e){p.warn("loadKeyPath: error loading lazy "+n),o.callback(p,s,"error"),t.rejectWith(p)})}for(var g in r=[],l){var y=l[g];u=new C.Deferred,r.push(u),f(u,y.parent,y.pathSegList)}return C.when.apply(C,r).promise()},reactivate:function(e){var t,n=this.activeNode;return n?(this.activeNode=null,t=n.setActive(!0,{noFocus:!0}),e&&n.setFocus(),t):_()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},toDict:function(e,t){var n=this.rootNode.toDict(!0,t);return e?n:n.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,n,r){var i=this._makeHookContext(t,n,r),o=this.widget._trigger(e,n,i);return!1!==o&&void 0!==i.result?i.result:o},_triggerTreeEvent:function(e,t,n){var r=this._makeHookContext(this,t,n),i=this.widget._trigger(e,t,r);return!1!==i&&void 0!==r.result?r.result:i},visit:function(e){return this.rootNode.visit(e,!1)},warn:function(e){Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments)}},C.extend(F.prototype,{nodeClick:function(e){var t,n,r=e.targetType,i=e.node;if("expander"===r){if(i.isLoading())return void i.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===r)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(t=!(n=!1),i.folder)switch(e.options.clickFolderMode){case 2:t=!(n=!0);break;case 3:n=t=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),n&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var n,r,i,o=e.node;if(o.parent)for(r=0,i=(n=o.parent.children).length;r<i;r++)n[r]!==o&&n[r].expanded&&this._callHook("nodeSetExpanded",n[r],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(e){var t,n,r,i=e.originalEvent,o=e.node,a=e.tree,s=e.options,l=i.which,d=String.fromCharCode(l),c=!(i.altKey||i.ctrlKey||i.metaKey||i.shiftKey),u=C(i.target),p=!0,h=!(i.ctrlKey||!s.autoActivate);if(o||(r=this.getActiveNode()||this.getFirstChild())&&(r.setFocus(),(o=e.node=this.focusNode).debug("Keydown force focus on active node")),s.quicksearch&&c&&/\w/.test(d)&&!f[l]&&!u.is(":input:enabled"))return 500<(n=(new Date).getTime())-a.lastQuicksearchTime&&(a.lastQuicksearchTerm=""),a.lastQuicksearchTime=n,a.lastQuicksearchTerm+=d,(t=a.findNextNode(a.lastQuicksearchTerm,a.getActiveNode()))&&t.setActive(),void i.preventDefault();switch(g.eventToString(i)){case"+":case"=":a.nodeSetExpanded(e,!0);break;case"-":a.nodeSetExpanded(e,!1);break;case"space":o.isPagingNode()?a._triggerNodeEvent("clickPaging",e,i):g.evalOption("checkbox",o,o,s,!1)?a.nodeToggleSelected(e):a.nodeSetActive(e,!0);break;case"return":a.nodeSetActive(e,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":o.navigate(i.which,h,!0);break;default:p=!1}p&&i.preventDefault()},nodeLoadChildren:function(o,a){var t,n,e,s=o.tree,l=o.node,d=(new Date).getTime();if(C.isFunction(a)&&(a=a.call(s,{type:"source"},o),k(!C.isFunction(a),"source callback must not return another function")),a.url&&(l._requestId&&l.warn("Recursive load request #"+d+" while #"+l._requestId+" is pending."),t=C.extend({},o.options.ajax,a),l._requestId=d,e=t.debugDelay?(n=t.debugDelay,C.isArray(n)&&(n=n[0]+Math.random()*(n[1]-n[0])),l.warn("nodeLoadChildren waiting debugDelay "+Math.round(n)+" ms ..."),t.debugDelay=!1,C.Deferred(function(e){setTimeout(function(){C.ajax(t).done(function(){e.resolveWith(this,arguments)}).fail(function(){e.rejectWith(this,arguments)})},n)})):C.ajax(t),a=new C.Deferred,e.done(function(e,t,n){var r,i;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof e||C.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),l._requestId&&l._requestId>d)a.rejectWith(this,[c]);else{if(o.options.postProcess){try{i=s._triggerNodeEvent("postProcess",o,o.originalEvent,{response:e,error:null,dataType:this.dataType})}catch(e){i={error:e,message:""+e,details:"postProcess failed"}}if(i.error)return r=C.isPlainObject(i.error)?i.error:{message:i.error},r=s._makeHookContext(l,null,r),void a.rejectWith(this,[r]);e=C.isArray(i)?i:e}else e&&e.hasOwnProperty("d")&&o.options.enableAspx&&(e="string"==typeof e.d?C.parseJSON(e.d):e.d);a.resolveWith(this,[e])}}).fail(function(e,t,n){var r=s._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:n,details:e.status+": "+n});a.rejectWith(this,[r])})),C.isFunction(a.then)&&C.isFunction(a.catch)&&(e=a,a=new C.Deferred,e.then(function(e){a.resolve(e)},function(e){a.reject(e)})),C.isFunction(a.promise))s.nodeSetStatus(o,"loading"),a.done(function(e){s.nodeSetStatus(o,"ok"),l._requestId=null}).fail(function(e){var t;e!==c?(e.node&&e.error&&e.message?t=e:"[object Object]"===(t=s._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(t.message=""),l.warn("Load children failed ("+t.message+")",t),!1!==s._triggerNodeEvent("loadError",t,null)&&s.nodeSetStatus(o,"error",t.message,t.details)):l.warn("Ignored response for obsolete load request #"+d+" (expected #"+l._requestId+")")});else if(o.options.postProcess){var r=s._triggerNodeEvent("postProcess",o,o.originalEvent,{response:a,error:null,dataType:typeof a});a=C.isArray(r)?r:a}return C.when(a).done(function(e){var n;C.isPlainObject(e)&&(k(l.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),k(C.isArray(e.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),e=(n=e).children,delete n.children,C.each(u,function(e,t){void 0!==n[t]&&(s[t]=n[t],delete n[t])}),C.extend(s.data,n)),k(C.isArray(e),"expected array of children"),l._setChildren(e),s._triggerNodeEvent("loadChildren",l)})},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(e,t){var n,r=e.node,i=C.extend({},e,{node:t}),o=r.children;if(1===o.length)return k(t===o[0],"invalid single child"),this.nodeRemoveChildren(e);this.activeNode&&(t===this.activeNode||this.activeNode.isDescendantOf(t))&&this.activeNode.setActive(!1),this.focusNode&&(t===this.focusNode||this.focusNode.isDescendantOf(t))&&(this.focusNode=null),this.nodeRemoveMarkup(i),this.nodeRemoveChildren(i),k(0<=(n=C.inArray(t,o)),"invalid child"),r.triggerModifyChild("remove",t),t.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,t),o.splice(n,1)},nodeRemoveChildMarkup:function(e){var t=e.node;t.ul&&(t.isRootNode()?C(t.ul).empty():(C(t.ul).remove(),t.ul=null),t.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(e){var t=e.tree,n=e.node;n.children&&(this.activeNode&&this.activeNode.isDescendantOf(n)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(n)&&(this.focusNode=null),this.nodeRemoveChildMarkup(e),C.extend({},e),n.triggerModifyChild("remove",null),n.visit(function(e){e.parent=null,t._callHook("treeRegisterNode",t,!1,e)}),n.lazy?n.children=[]:n.children=null,n.isRootNode()||(n.expanded=!1),this.nodeRenderStatus(e))},nodeRemoveMarkup:function(e){var t=e.node;t.li&&(C(t.li).remove(),t.li=null),this.nodeRemoveChildMarkup(e)},nodeRender:function(e,t,n,r,i){var o,a,s,l,d,c,u,p=e.node,h=e.tree,f=e.options,g=f.aria,y=!1,v=p.parent,m=!v,x=p.children,b=null;if(!1!==h._enableUpdate&&(m||v.ul)){if(k(m||v.ul,"parent UL must exist"),m||(p.li&&(t||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?b=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(e)),p.li?this.nodeRenderStatus(e):(y=!0,p.li=document.createElement("li"),(p.li.ftnode=p).key&&f.generateIds&&(p.li.id=f.idPrefix+p.key),p.span=document.createElement("span"),p.span.className="fancytree-node",g&&!p.tr&&C(p.li).attr("role","treeitem"),p.li.appendChild(p.span),this.nodeRenderTitle(e),f.createNode&&f.createNode.call(h,{type:"createNode"},e)),f.renderNode&&f.renderNode.call(h,{type:"renderNode"},e)),x){if(m||p.expanded||!0===n){for(p.ul||(p.ul=document.createElement("ul"),(!0!==r||i)&&p.expanded||(p.ul.style.display="none"),g&&C(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,d=x.length;l<d;l++)u=C.extend({},e,{node:x[l]}),this.nodeRender(u,t,n,!1,!0);for(o=p.ul.firstChild;o;)o=(s=o.ftnode)&&s.parent!==p?(p.debug("_fixParent: remove missing "+s,o),c=o.nextSibling,o.parentNode.removeChild(o),c):o.nextSibling;for(o=p.ul.firstChild,l=0,d=x.length-1;l<d;l++)(a=x[l])!==(s=o.ftnode)?p.ul.insertBefore(a.li,s.li):o=o.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(e));m||y&&v.ul.insertBefore(p.li,b)}},nodeRenderTitle:function(e,t){var n,r,i,o,a,s,l,d=e.node,c=e.tree,u=e.options,p=u.aria,h=d.getLevel(),f=[];void 0!==t&&(d.title=t),d.span&&!1!==c._enableUpdate&&(a=p&&!1!==d.hasChildren()?" role='button'":"",h<u.minExpandLevel?(d.lazy||(d.expanded=!0),1<h&&f.push("<span "+a+" class='fancytree-expander fancytree-expander-fixed'></span>")):f.push("<span "+a+" class='fancytree-expander'></span>"),(n=g.evalOption("checkbox",d,d,u,!1))&&!d.isStatusNode()&&(a=p?" role='checkbox'":"",r="fancytree-checkbox",("radio"===n||d.parent&&d.parent.radiogroup)&&(r+=" fancytree-radio"),f.push("<span "+a+" class='"+r+"'></span>")),void 0!==d.data.iconClass&&(d.icon?C.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(d.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),d.icon=d.data.iconClass)),!1!==(i=g.evalOption("icon",d,d,u,!0))&&(a=p?" role='presentation'":"",l=(l=g.evalOption("iconTooltip",d,d,u,null))?" title='"+E(l)+"'":"","string"==typeof i?y.test(i)?(i="/"===i.charAt(0)?i:(u.imagePath||"")+i,f.push("<img src='"+i+"' class='fancytree-icon'"+l+" alt='' />")):f.push("<span "+a+" class='fancytree-custom-icon "+i+"'"+l+"></span>"):i.text?f.push("<span "+a+" class='fancytree-custom-icon "+(i.addClass||"")+"'"+l+">"+i.text+"</span>"):f.push("<span "+a+" class='fancytree-icon'"+l+"></span>")),o="",u.renderTitle&&(o=u.renderTitle.call(c,{type:"renderTitle"},e)||""),o||(!0===(s=g.evalOption("tooltip",d,d,u,null))&&(s=d.title),o="<span class='fancytree-title'"+(s=s?" title='"+E(s)+"'":"")+(u.titlesTabbable?" tabindex='0'":"")+">"+(u.escapeTitles?g.escapeHtml(d.title):d.title)+"</span>"),f.push(o),d.span.innerHTML=f.join(""),this.nodeRenderStatus(e),u.enhanceTitle&&(e.$title=C(">span.fancytree-title",d.span),o=u.enhanceTitle.call(c,{type:"enhanceTitle"},e)||""))},nodeRenderStatus:function(e){var t,n=e.node,r=e.tree,i=e.options,o=n.hasChildren(),a=n.isLastSibling(),s=i.aria,l=i._classNames,d=[],c=n[r.statusClassPropName];c&&!1!==r._enableUpdate&&(s&&(t=C(n.tr||n.li)),d.push(l.node),r.activeNode===n&&d.push(l.active),r.focusNode===n&&d.push(l.focused),n.expanded&&d.push(l.expanded),s&&(!1!==o?t.attr("aria-expanded",Boolean(n.expanded)):t.removeAttr("aria-expanded")),n.folder&&d.push(l.folder),!1!==o&&d.push(l.hasChildren),a&&d.push(l.lastsib),n.lazy&&null==n.children&&d.push(l.lazy),n.partload&&d.push(l.partload),n.partsel&&d.push(l.partsel),g.evalOption("unselectable",n,n,i,!1)&&d.push(l.unselectable),n._isLoading&&d.push(l.loading),n._error&&d.push(l.error),n.statusNodeType&&d.push(l.statusNodePrefix+n.statusNodeType),n.selected?(d.push(l.selected),s&&t.attr("aria-selected",!0)):s&&t.attr("aria-selected",!1),n.extraClasses&&d.push(n.extraClasses),!1===o?d.push(l.combinedExpanderPrefix+"n"+(a?"l":"")):d.push(l.combinedExpanderPrefix+(n.expanded?"e":"c")+(n.lazy&&null==n.children?"d":"")+(a?"l":"")),d.push(l.combinedIconPrefix+(n.expanded?"e":"c")+(n.folder?"f":"")),c.className=d.join(" "),n.li&&C(n.li).toggleClass(l.lastsib,a))},nodeSetActive:function(e,t,n){n=n||{};var r,i=e.node,o=e.tree,a=e.options,s=!0===n.noEvents,l=!0===n.noFocus;return i===o.activeNode===(t=!1!==t)?_(i):t&&!s&&!1===this._triggerNodeEvent("beforeActivate",i,e.originalEvent)?N(i,["rejected"]):(t?(o.activeNode&&(k(o.activeNode!==i,"node was active (inconsistency)"),r=C.extend({},e,{node:o.activeNode}),o.nodeSetActive(r,!1),k(null===o.activeNode,"deactivate was out of sync?")),a.activeVisible&&i.makeVisible({scrollIntoView:l&&null==o.focusNode}),o.activeNode=i,o.nodeRenderStatus(e),l||o.nodeSetFocus(e),s||o._triggerNodeEvent("activate",i,e.originalEvent)):(k(o.activeNode===i,"node was not active (inconsistency)"),o.activeNode=null,this.nodeRenderStatus(e),s||e.tree._triggerNodeEvent("deactivate",i,e.originalEvent)),_(i))},nodeSetExpanded:function(r,i,e){e=e||{};var t,n,o,a,s,l,d=r.node,c=r.tree,u=r.options,p=!0===e.noAnimation,h=!0===e.noEvents;if(i=!1!==i,d.expanded&&i||!d.expanded&&!i)return _(d);if(i&&!d.lazy&&!d.hasChildren())return _(d);if(!i&&d.getLevel()<u.minExpandLevel)return N(d,["locked"]);if(!1===this._triggerNodeEvent("beforeExpand",d,r.originalEvent))return N(d,["rejected"]);if(p||d.isVisible()||(p=e.noAnimation=!0),n=new C.Deferred,i&&!d.expanded&&u.autoCollapse){s=d.getParentList(!1,!0),l=u.autoCollapse;try{for(u.autoCollapse=!1,o=0,a=s.length;o<a;o++)this._callHook("nodeCollapseSiblings",s[o],e)}finally{u.autoCollapse=l}}return n.done(function(){var e=d.getLastChild();i&&u.autoScroll&&!p&&e?e.scrollIntoView(!0,{topNode:d}).always(function(){h||r.tree._triggerNodeEvent(i?"expand":"collapse",r)}):h||r.tree._triggerNodeEvent(i?"expand":"collapse",r)}),t=function(e){var t=u._classNames,n=u.toggleEffect;if(d.expanded=i,c._callHook("nodeRender",r,!1,!1,!0),d.ul)if("none"!==d.ul.style.display===!!d.expanded)d.warn("nodeSetExpanded: UL.style.display already set");else{if(n&&!p)return C(d.li).addClass(t.animating),void C(d.ul).addClass(t.animating).toggle(n.effect,n.options,n.duration,function(){C(this).removeClass(t.animating),C(d.li).removeClass(t.animating),e()});d.ul.style.display=d.expanded||!parent?"":"none"}e()},i&&d.lazy&&void 0===d.hasChildren()?d.load().done(function(){n.notifyWith&&n.notifyWith(d,["loaded"]),t(function(){n.resolveWith(d)})}).fail(function(e){t(function(){n.rejectWith(d,["load failed ("+e+")"])})}):t(function(){n.resolveWith(d)}),n.promise()},nodeSetFocus:function(e,t){var n,r=e.tree,i=e.node,o=r.options,a=!!e.originalEvent&&C(e.originalEvent.target).is(":input");if(t=!1!==t,r.focusNode){if(r.focusNode===i&&t)return;n=C.extend({},e,{node:r.focusNode}),r.focusNode=null,this._triggerNodeEvent("blur",n),this._callHook("nodeRenderStatus",n)}t&&(this.hasFocus()||(i.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",e,!0,{calledByNode:!0})),i.makeVisible({scrollIntoView:!1}),r.focusNode=i,o.titlesTabbable?a||C(i.span).find(".fancytree-title").focus():0===C(document.activeElement).closest(".fancytree-container").length&&C(r.$container).focus(),o.aria&&C(r.$container).attr("aria-activedescendant",C(i.tr||i.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",e),o.autoScroll&&i.scrollIntoView(),this._callHook("nodeRenderStatus",e))},nodeSetSelected:function(e,t,n){n=n||{};var r=e.node,i=e.tree,o=e.options,a=!0===n.noEvents,s=r.parent;if(t=!1!==t,!g.evalOption("unselectable",r,r,o,!1)){if(r._lastSelectIntent=t,!!r.selected===t&&(3!==o.selectMode||!r.partsel||t))return t;if(!a&&!1===this._triggerNodeEvent("beforeSelect",r,e.originalEvent))return!!r.selected;t&&1===o.selectMode?(i.lastSelectedNode&&i.lastSelectedNode.setSelected(!1),r.selected=t):3!==o.selectMode||!s||s.radiogroup||r.radiogroup?s&&s.radiogroup?r.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===r)},!0):r.selected=t:(r.selected=t,r.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),i.lastSelectedNode=t?r:null,a||i._triggerNodeEvent("select",e)}},nodeSetStatus:function(e,t,n,r){var i=e.node,o=e.tree;function a(e,t){var n=i.children?i.children[0]:null;return n&&n.isStatusNode()?(C.extend(n,e),n.statusNodeType=t,o._callHook("nodeRenderTitle",n)):(i._setChildren([e]),i.children[0].statusNodeType=t,o.render()),i.children[0]}switch(t){case"ok":!function(){var e=i.children?i.children[0]:null;if(e&&e.isStatusNode()){try{i.ul&&(i.ul.removeChild(e.li),e.li=null)}catch(e){}1===i.children.length?i.children=[]:i.children.shift()}}(),i._isLoading=!1,i._error=null,i.renderStatus();break;case"loading":i.parent||a({title:o.options.strings.loading+(n?" ("+n+")":""),checkbox:!1,tooltip:r},t),i._isLoading=!0,i._error=null,i.renderStatus();break;case"error":a({title:o.options.strings.loadError+(n?" ("+n+")":""),checkbox:!1,tooltip:r},t),i._isLoading=!1,i._error={message:n,details:r},i.renderStatus();break;case"nodata":a({title:o.options.strings.noData,checkbox:!1,tooltip:r},t),i._isLoading=!1,i._error=null,i.renderStatus();break;default:C.error("invalid node status "+t)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,n=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(n=!1,t.selected=!0),t._lastSelectIntent=n,this.nodeSetSelected(e,n)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden")},treeInit:function(e){var n=e.tree,r=n.options;n.$container.attr("tabindex",r.tabindex),C.each(u,function(e,t){void 0!==r[t]&&(n.info("Move option "+t+" to tree"),n[t]=r[t],delete r[t])}),r.rtl?n.$container.attr("DIR","RTL").addClass("fancytree-rtl"):n.$container.removeAttr("DIR").removeClass("fancytree-rtl"),r.aria&&(n.$container.attr("role","tree"),1!==r.selectMode&&n.$container.attr("aria-multiselectable",!0)),this.treeLoad(e)},treeLoad:function(e,t){var n,r,i,o=e.tree,a=e.widget.element,s=C.extend({},e,{node:this.rootNode});if(o.rootNode.children&&this.treeClear(e),t=t||this.options.source)"string"==typeof t&&C.error("Not implemented");else switch(r=a.data("type")||"html"){case"html":(i=a.find(">ul:first")).addClass("ui-fancytree-source ui-helper-hidden"),t=C.ui.fancytree.parseHtml(i),this.data=C.extend(this.data,w(i));break;case"json":t=C.parseJSON(a.text()),a.contents().filter(function(){return 3===this.nodeType}).remove(),C.isPlainObject(t)&&(k(C.isArray(t.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),t=(n=t).children,delete n.children,C.each(u,function(e,t){void 0!==n[t]&&(o[t]=n[t],delete n[t])}),C.extend(o.data,n));break;default:C.error("Invalid data-type: "+r)}return this.nodeLoadChildren(s,t).done(function(){o.render(),3===e.options.selectMode&&o.rootNode.fixSelection3FromEndNodes(),o.activeNode&&o.options.activeVisible&&o.activeNode.makeVisible(),o._triggerTreeEvent("init",null,{status:!0})}).fail(function(){o.render(),o._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,n){},treeSetFocus:function(e,t,n){var r;(t=!1!==t)!==this.hasFocus()&&(!(this._hasFocus=t)&&this.focusNode?this.focusNode.setFocus(!1):!t||n&&n.calledByNode||C(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",t),this._triggerTreeEvent(t?"focusTree":"blurTree"),t&&!this.activeNode&&(r=this._lastMousedownNode||this.getFirstChild())&&r.setFocus())},treeSetOption:function(e,t,n){var r=e.tree,i=!0,o=!1,a=!1;switch(t){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":a=o=!0;break;case"escapeTitles":case"tooltip":a=!0;break;case"rtl":!1===n?r.$container.removeAttr("DIR").removeClass("fancytree-rtl"):r.$container.attr("DIR","RTL").addClass("fancytree-rtl"),a=!0;break;case"source":i=!1,r._callHook("treeLoad",r,n),a=!0}r.debug("set option "+t+"="+n+" <"+typeof n+">"),i&&(this.widget._super?this.widget._super.call(this.widget,t,n):C.Widget.prototype._setOption.call(this.widget,t,n)),o&&r._callHook("treeCreate",r),a&&r.render(!0,!1)}}),C.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"blind",options:{direction:"vertical",scale:"box"},duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new F(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var e,t,n,r=this.options,i=r.extensions;this.tree;for(n=0;n<i.length;n++)t=i[n],(e=C.ui.fancytree._extensions[t])||C.error("Could not apply extension '"+t+"' (it is not registered, did you forget to include it?)"),this.tree.options[t]=C.extend(!0,{},e.options,this.tree.options[t]),k(void 0===this.tree.ext[t],"Extension name must not exist as Fancytree.ext attribute: '"+t+"'"),this.tree.ext[t]={},h(this.tree,0,e,t),e;void 0!==r.icons&&(!0!==r.icon?C.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),r.icon=r.icons)),void 0!==r.iconClass&&(r.icon?C.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),r.icon=r.iconClass)),void 0!==r.tabbable&&(r.tabindex=r.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+r.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),C.Widget.prototype.destroy.call(this)},_unbind:function(){var e=this.tree._ns;this.element.off(e),this.tree.$container.off(e),C(document).off(e)},_bind:function(){var a=this,s=this.options,o=this.tree,e=o._ns;this._unbind(),o.$container.on("focusin"+e+" focusout"+e,function(e){var t=g.getNode(e),n="focusin"===e.type;n&&o._getExpiringValue("focusin")?g.info("Ignored double focusin."):(o._setExpiringValue("focusin",!0,50),n&&!t&&(t=o._getExpiringValue("mouseDownNode"))&&g.info("Reconstruct mouse target for focusin from recent event."),t?o._callHook("nodeSetFocus",o._makeHookContext(t,e),n):o.tbody&&C(e.target).parents("table.fancytree-container > thead").length?o.debug("Ignore focus event outside table body.",e):o._callHook("treeSetFocus",o,n))}).on("selectstart"+e,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+e,function(e){if(s.disabled||!1===s.keyboard)return!0;var t,n=o.focusNode,r=o._makeHookContext(n||o,e),i=o.phase;try{return o.phase="userEvent","preventNav"===(t=n?o._triggerNodeEvent("keydown",n,e):o._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=o._callHook("nodeKeydown",r)),t}finally{o.phase=i}}).on("mousedown"+e,function(e){var t=g.getEventTarget(e);o._lastMousedownNode=t?t.node:null,o._setExpiringValue("mouseDownNode",o._lastMousedownNode)}).on("click"+e+" dblclick"+e,function(e){if(s.disabled)return!0;var t,n=g.getEventTarget(e),r=n.node,i=a.tree,o=i.phase;if(!r)return!0;t=i._makeHookContext(r,e);try{switch(i.phase="userEvent",e.type){case"click":return t.targetType=n.type,r.isPagingNode()?!0===i._triggerNodeEvent("clickPaging",t,e):!1!==i._triggerNodeEvent("click",t,e)&&i._callHook("nodeClick",t);case"dblclick":return t.targetType=n.type,!1!==i._triggerNodeEvent("dblclick",t,e)&&i._callHook("nodeDblclick",t)}}finally{i.phase=o}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(e){return this.tree.getNodeByKey(e)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),g=C.ui.fancytree,C.extend(C.ui.fancytree,{version:"2.27.0",buildType:"production",debugLevel:1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:F,_FancytreeNodeClass:A,jquerySupports:{positionMyOfs:function(e,t,n,r){var i,o,a,s=C.map(C.trim(e).split("."),function(e){return parseInt(e,10)}),l=C.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)});for(i=0;i<l.length;i++)if((o=s[i]||0)!==(a=l[i]||0))return a<o;return!0}(C.ui.version,1,9)},assert:function(e,t){return k(e,t)},createTree:function(e,t){return C(e).fancytree(t).fancytree("getTree")},debounce:function(t,n,r,i){var o;return 3===arguments.length&&"boolean"!=typeof r&&(i=r,r=!1),function(){var e=arguments;i=i||this,r&&!o&&n.apply(i,e),clearTimeout(o),o=setTimeout(function(){r||n.apply(i,e),o=null},t)}},debug:function(e){2<=C.ui.fancytree.debugLevel&&d("log",arguments)},error:function(e){d("error",arguments)},escapeHtml:function(e){return(""+