YUI.add("tree-node",function(r,e){function t(e,t){this.id=this._yuid=(t=t||{}).id||this.id||r.guid("treeNode-"),this.tree=e,this.children=t.children||[],this.data=t.data||{},this.state=t.state||{},t.canHaveChildren?this.canHaveChildren=t.canHaveChildren:this.children.length&&(this.canHaveChildren=!0),r.mix(this,t);for(var i=0,n=this.children.length;i<n;i++)this.children[i].parent=this}t.prototype={_isIndexStale:!0,_isYUITreeNode:!0,_serializable:["canHaveChildren","data","id","state"],append:function(e,t){return this.tree.appendNode(this,e,t)},depth:function(){if(this.isRoot())return 0;for(var e=0,t=this.parent;t;)e+=1,t=t.parent;return e},empty:function(e){return this.tree.emptyNode(this,e)},find:function(e,t,i){return this.tree.findNode(this,e,t,i)},hasChildren:function(){return!!this.children.length},index:function(){return this.parent?this.parent.indexOf(this):-1},indexOf:function(e){return this._isIndexStale&&this._reindex(),void 0===(e=this._indexMap[e.id])?-1:e},insert:function(e,t){return this.tree.insertNode(this,e,t)},isInTree:function(){return!(!this.tree||this.tree.rootNode!==this)||!(!this.parent||!this.parent.isInTree())},isRoot:function(){return!(!this.tree||this.tree.rootNode!==this)},next:function(){if(this.parent)return this.parent.children[this.index()+1]},prepend:function(e,t){return this.tree.prependNode(this,e,t)},previous:function(){if(this.parent)return this.parent.children[this.index()-1]},remove:function(e){return this.tree.removeNode(this,e)},size:function(){for(var e=this.children,t=e.length,i=t,n=0;n<t;n++)i+=e[n].size();return i},toJSON:function(){var e,t,i,n={};if(this.state.destroyed)return null;for(e=0,i=this._serializable.length;e<i;e++)(t=this._serializable[e])in this&&(n[t]=this[t]);if(this.canHaveChildren)for(n.children=[],e=0,i=this.children.length;e<i;e++)n.children.push(this.children[e].toJSON());return n},traverse:function(e,t,i){return this.tree.traverseNode(this,e,t,i)},_reindex:function(){for(var e=this.children,t={},i=0,n=e.length;i<n;i++)t[e[i].id]=i;this._indexMap=t,this._isIndexStale=!1}},r.namespace("Tree").Node=t},"patched-v3.18.4");