From 152bd61eeaa3c5e9fbdf04ef86623b0da068b5cb Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Tue, 11 Feb 2014 09:05:00 +0200 Subject: [PATCH] beta7 --- bower.json | 2 +- component.json | 2 +- dist/jstree.js | 2 +- dist/jstree.min.js | 4 ++-- docs/assets/dist/jstree.js | 2 +- docs/assets/dist/jstree.min.js | 4 ++-- docs/jstree.json | 2 +- jstree.jquery.json | 2 +- package.json | 2 +- src/jstree.js | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index 849e1f10..a26addfc 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jstree", - "version": "3.0.0-beta6", + "version": "3.0.0-beta7", "main" : [ "./dist/jstree.min.js", "./dist/themes/default/style.min.css" diff --git a/component.json b/component.json index bc0039da..e6c9088d 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "jstree", "repo": "vakata/jstree", "description": "jsTree is jquery plugin, that provides interactive trees.", - "version": "3.0.0-beta6", + "version": "3.0.0-beta7", "license": "MIT", "keywords": [ "ui", diff --git a/dist/jstree.js b/dist/jstree.js index e77e8198..fe8a12a8 100644 --- a/dist/jstree.js +++ b/dist/jstree.js @@ -67,7 +67,7 @@ * specifies the jstree version in use * @name $.jstree.version */ - version : '3.0.0-beta6', + version : '3.0.0-beta7', /** * holds all the default options used when creating new instances * @name $.jstree.defaults diff --git a/dist/jstree.min.js b/dist/jstree.min.js index 2d295a04..f317af5a 100644 --- a/dist/jstree.min.js +++ b/dist/jstree.min.js @@ -1,4 +1,4 @@ -/*! jsTree - v3.0.0-beta6 - 2014-02-11 - (MIT) */ -(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e,t){"use strict";if(!e.jstree){var n=0,i=!1,s=!1,r=!1,a=[],o=e("script:last").attr("src"),d=document,l=d.createElement("LI"),c,h;l.setAttribute("role","treeitem"),c=d.createElement("I"),c.className="jstree-icon jstree-ocl",l.appendChild(c),c=d.createElement("A"),c.className="jstree-anchor",c.setAttribute("href","#"),h=d.createElement("I"),h.className="jstree-icon jstree-themeicon",c.appendChild(h),l.appendChild(c),c=h=null,e.jstree={version:"3.0.0-beta6",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):""},e.jstree.create=function(t,i){var s=new e.jstree.core(++n),r=i;return i=e.extend(!0,{},e.jstree.defaults,i),r&&r.plugins&&(i.plugins=r.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))}),s.init(t,i),s},e.jstree.core=function(e){this._id=e,this._cnt=0,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[]}}},e.jstree.reference=function(n){if(n&&!e(n).length){n.id&&(n=n.id);var i=null;return e(".jstree").each(function(){var s=e(this).data("jstree");return s&&s._model.data[n]?(i=s,!1):t}),i}return e(n).closest(".jstree").data("jstree")},e.fn.jstree=function(n){var i="string"==typeof n,s=Array.prototype.slice.call(arguments,1),r=null;return this.each(function(){var a=e.jstree.reference(this),o=i&&a?a[n]:null;return r=i&&o?o.apply(a,s):null,a||i||n!==t&&!e.isPlainObject(n)||e(this).data("jstree",new e.jstree.create(this,n)),a&&!i&&(r=a),null!==r&&r!==t?!1:t}),null!==r&&r!==t?r:this},e.expr[":"].jstree=e.expr.createPseudo(function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!0},expand_selected_onload:!0},e.jstree.core.prototype={plugin:function(t,n){var i=e.jstree.plugins[t];return i?(this._data[t]={},i.prototype=this,new i(n,this)):this},init:function(t,n){this._model={data:{"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,this.element.bind("destroyed",e.proxy(this.teardown,this)),this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this._data.core.li_height=this.get_container_ul().children("li:eq(0)").height()||18,this.trigger("loading"),this.load_node("#")},destroy:function(){this.element.unbind("destroyed",this.teardown),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){this.element.on("dblclick.jstree",function(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var e=window.getSelection();try{e.removeAllRanges(),e.collapse()}catch(t){}}}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){var n=null;switch(t.which){case 13:case 32:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 38:t.preventDefault(),n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):(n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 40:t.preventDefault(),n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 46:t.preventDefault(),n=this.get_node(t.currentTarget),n&&n.id&&"#"!==n.id&&(n=this.is_selected(n)?this.get_selected():n);break;case 113:t.preventDefault(),n=this.get_node(t.currentTarget);break;default:}},this)).on("load_node.jstree",e.proxy(function(t,n){if(n.status&&("#"!==n.node.id||this._data.core.loaded||(this._data.core.loaded=!0,this.trigger("loaded")),!this._data.core.ready&&!this.get_container_ul().find(".jstree-loading:eq(0)").length)){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var i=[],s,r;for(s=0,r=this._data.core.selected.length;r>s;s++)i=i.concat(this._model.data[this._data.core.selected[s]].parents);for(i=e.vakata.array_unique(i),s=0,r=i.length;r>s;s++)this.open_node(i[s],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}setTimeout(e.proxy(function(){this.trigger("ready")},this),0)}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter()},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(document).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children("ul:eq(0)")},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){e=e?e.firstChild:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_nextSibling:function(e){e=e?e.nextSibling:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_previousSibling:function(e){e=e?e.previousSibling:null;while(null!==e&&1!==e.nodeType)e=e.previousSibling;return e},get_node:function(t,n){t&&t.id&&(t=t.id);var i;try{if(this._model.data[t])t=this._model.data[t];else if(((i=e(t,this.element)).length||(i=e("#"+t,this.element)).length)&&this._model.data[i.closest("li").attr("id")])t=this._model.data[i.closest("li").attr("id")];else{if(!(i=e(t,this.element)).length||!i.hasClass("jstree"))return!1;t=this._model.data["#"]}return n&&(t="#"===t.id?this.element:e(document.getElementById(t.id))),t}catch(s){return!1}},get_next_dom:function(t,n){var i;return t=this.get_node(t,!0),t[0]===this.element[0]?(i=this._firstChild(this.get_container_ul()[0]),i?e(i):!1):t&&t.length?n?(i=this._nextSibling(t[0]),i?e(i):!1):t.hasClass("jstree-open")?(i=this._firstChild(t.children("ul")[0]),i?e(i):!1):null!==(i=this._nextSibling(t[0]))?e(i):t.parentsUntil(".jstree","li").next("li").eq(0):!1},get_prev_dom:function(t,n){var i;if(t=this.get_node(t,!0),t[0]===this.element[0])return i=this.get_container_ul()[0].lastChild,i?e(i):!1;if(!t||!t.length)return!1;if(n)return i=this._previousSibling(t[0]),i?e(i):!1;if(null!==(i=this._previousSibling(t[0]))){t=e(i);while(t.hasClass("jstree-open"))t=t.children("ul:eq(0)").children("li:last");return t}return i=t[0].parentNode.parentNode,i&&"LI"===i.tagName?e(i):!1},get_parent:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.parent:!1},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children("li"):e&&e.length?e.children("ul").children("li"):!1},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e,!0),e&&e.hasClass("jstree-loading")},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var i,s;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.load_node(t[i],n);return!0}return(t=this.get_node(t))?(this.get_node(t,!0).addClass("jstree-loading"),this._load_node(t,e.proxy(function(e){t.state.loaded=e,this.get_node(t,!0).removeClass("jstree-loading"),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)},this)),!0):(n.call(this,t,!1),!1)},_load_node:function(n,i){var s=this.settings.core.data,r;return s?e.isFunction(s)?s.call(this,n,e.proxy(function(t){return t===!1?i.call(this,!1):i.call(this,this["string"==typeof t?"_append_html_data":"_append_json_data"](n,"string"==typeof t?e(t):t))},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,n)),e.isFunction(s.data)&&(s.data=s.data.call(this,n)),e.ajax(s).done(e.proxy(function(s,r,a){var o=a.getResponseHeader("Content-Type");return-1!==o.indexOf("json")?i.call(this,this._append_json_data(n,s)):-1!==o.indexOf("html")?i.call(this,this._append_html_data(n,e(s))):t},this)).fail(e.proxy(function(){i.call(this,!1)},this))):(r=e.isArray(s)||e.isPlainObject(s)?e.vakata.json.decode(e.vakata.json.encode(s)):s,i.call(this,this._append_json_data(n,r))):"string"==typeof s?i.call(this,this._append_html_data(n,s)):i.call(this,!1):i.call(this,"#"===n.id?this._append_html_data(n,this._data.core.original_container_html.clone(!0)):!1)},_node_changed:function(e){e=this.get_node(e),e&&this._model.changed.push(e.id)},_append_html_data:function(t,n){t=this.get_node(t),t.children=[],t.children_d=[];var i=n.is("ul")?n.children():n,s=t.id,r=[],a=[],o=this._model.data,d=o[s],l=this._data.core.selected.length,c,h,_;for(i.each(e.proxy(function(t,n){c=this._parse_model_from_html(e(n),s,d.parents.concat()),c&&(r.push(c),a.push(c),o[c].children_d.length&&(a=a.concat(o[c].children_d)))},this)),d.children=r,d.children_d=a,h=0,_=d.parents.length;_>h;h++)o[d.parents[h]].children_d=o[d.parents[h]].children_d.concat(a);return this.trigger("model",{nodes:a,parent:s}),"#"!==s?(this._node_changed(s),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==l&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_append_json_data:function(n,i){n=this.get_node(n),n.children=[],n.children_d=[];var s=i,r=n.id,a=[],o=[],d=this._model.data,l=d[r],c=this._data.core.selected.length,h,_,u;if(s.d&&(s=s.d,"string"==typeof s&&(s=e.vakata.json.decode(s))),e.isArray(s)||(s=[s]),s.length&&s[0].id!==t&&s[0].parent!==t){for(_=0,u=s.length;u>_;_++)s[_].children||(s[_].children=[]),d[s[_].id]=s[_];for(_=0,u=s.length;u>_;_++)d[s[_].parent].children.push(s[_].id),l.children_d.push(s[_].id);for(_=0,u=l.children.length;u>_;_++)h=this._parse_model_from_flat_json(d[l.children[_]],r,l.parents.concat()),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d))}else{for(_=0,u=s.length;u>_;_++)h=this._parse_model_from_json(s[_],r,l.parents.concat()),h&&(a.push(h),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d)));for(l.children=a,l.children_d=o,_=0,u=l.parents.length;u>_;_++)d[l.parents[_]].children_d=d[l.parents[_]].children_d.concat(o)}return this.trigger("model",{nodes:o,parent:r}),"#"!==r?(this._node_changed(r),this.redraw()):this.redraw(!0),this._data.core.selected.length!==c&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_parse_model_from_html:function(n,i,s){s=s?[].concat(s):[],i&&s.unshift(i);var r,a,o=this._model.data,d={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l,c,h;for(l in this._model.default_state)this._model.default_state.hasOwnProperty(l)&&(d.state[l]=this._model.default_state[l]);if(c=e.vakata.attributes(n,!0),e.each(c,function(n,i){return i=e.trim(i),i.length?(d.li_attr[n]=i,"id"===n&&(d.id=i),t):!0}),c=n.children("a").eq(0),c.length&&(c=e.vakata.attributes(c,!0),e.each(c,function(t,n){n=e.trim(n),n.length&&(d.a_attr[t]=n)})),c=n.children("a:eq(0)").length?n.children("a:eq(0)").clone():n.clone(),c.children("ins, i, ul").remove(),c=c.html(),c=e("
").html(c),d.text=c.html(),c=n.data(),d.data=c?e.extend(!0,{},c):null,d.state.opened=n.hasClass("jstree-open"),d.state.selected=n.children("a").hasClass("jstree-clicked"),d.state.disabled=n.children("a").hasClass("jstree-disabled"),d.data&&d.data.jstree)for(l in d.data.jstree)d.data.jstree.hasOwnProperty(l)&&(d.state[l]=d.data.jstree[l]);c=n.children("a").children(".jstree-themeicon"),c.length&&(d.icon=c.hasClass("jstree-themeicon-hidden")?!1:c.attr("rel")),d.state.icon&&(d.icon=d.state.icon),c=n.children("ul").children("li");do h="j"+this._id+"_"+ ++this._cnt;while(o[h]);return d.id=d.li_attr.id||h,c.length?(c.each(e.proxy(function(t,n){r=this._parse_model_from_html(e(n),d.id,s),a=this._model.data[r],d.children.push(r),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d))},this)),d.children_d=d.children_d.concat(d.children)):n.hasClass("jstree-closed")&&(d.state.loaded=!1),d.li_attr["class"]&&(d.li_attr["class"]=d.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),d.a_attr["class"]&&(d.a_attr["class"]=d.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),o[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_parse_model_from_flat_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=e.id,r=this._model.data,a=this._model.default_state,o,d,l,c,h={id:s,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:n,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in a)a.hasOwnProperty(o)&&(h.state[o]=a[o]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(o in e.data.jstree)e.data.jstree.hasOwnProperty(o)&&(h.state[o]=e.data.jstree[o]);if(e&&"object"==typeof e.state)for(o in e.state)e.state.hasOwnProperty(o)&&(h.state[o]=e.state[o]);if(e&&"object"==typeof e.li_attr)for(o in e.li_attr)e.li_attr.hasOwnProperty(o)&&(h.li_attr[o]=e.li_attr[o]);if(h.li_attr.id||(h.li_attr.id=s),e&&"object"==typeof e.a_attr)for(o in e.a_attr)e.a_attr.hasOwnProperty(o)&&(h.a_attr[o]=e.a_attr[o]);for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),r[h.id]=h,o=0,d=h.children.length;d>o;o++)l=this._parse_model_from_flat_json(r[h.children[o]],h.id,i),c=r[l],h.children_d.push(l),c.children_d.length&&(h.children_d=h.children_d.concat(c.children_d));return delete e.data,delete e.children,r[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=!1,r,a,o,d,l=this._model.data,c=this._model.default_state,h;do s="j"+this._id+"_"+ ++this._cnt;while(l[s]);h={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:n,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in c)c.hasOwnProperty(r)&&(h.state[r]=c[r]);if(e&&e.id&&(h.id=e.id),e&&e.text&&(h.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(h.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(h.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(h.li_attr[r]=e.li_attr[r]);if(h.li_attr.id&&!h.id&&(h.id=h.li_attr.id),h.id||(h.id=s),h.li_attr.id||(h.li_attr.id=h.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(h.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,a=e.children.length;a>r;r++)o=this._parse_model_from_json(e.children[r],h.id,i),d=l[o],h.children.push(o),d.children_d.length&&(h.children_d=h.children_d.concat(d.children_d));h.children_d=h.children_d.concat(h.children)}return e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),delete e.data,delete e.children,h.original=e,l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_redraw:function(){var e=this._model.force_full_redraw?this._model.data["#"].children.concat([]):this._model.changed.concat([]),t=document.createElement("UL"),n,i,s;for(i=0,s=e.length;s>i;i++)n=this.redraw_node(e[i],!0,this._model.force_full_redraw),n&&this._model.force_full_redraw&&t.appendChild(n);this._model.force_full_redraw&&(t.className=this.get_container_ul()[0].className,this.element.empty().append(t)),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:e})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},redraw_node:function(t,n,i){var s=this.get_node(t),r=!1,a=!1,o=!1,d=!1,c=!1,h=!1,_="",u=document,g=this._model.data;if(!s)return!1;if("#"===s.id)return this.redraw(!0);if(n=n||0===s.children.length,t=u.getElementById(s.id))t=e(t),i||(r=t.parent().parent()[0],r===this.element[0]&&(r=null),a=t.index()),n||!s.children.length||t.children("ul").length||(n=!0),n||(o=t.children("UL")[0]),t.remove();else if(n=!0,!i){if(r="#"!==s.parent?e("#"+s.parent,this.element)[0]:null,!(null===r||r&&g[s.parent].state.opened))return!1;a=e.inArray(s.id,null===r?g["#"].children:g[s.parent].children)}t=l.cloneNode(!0),_="jstree-node ";for(d in s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,s.li_attr[d]):_+=s.li_attr[d]}!s.children.length&&s.state.loaded?_+=" jstree-leaf":(_+=s.state.opened?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",s.state.opened)),null!==s.parent&&g[s.parent].children[g[s.parent].children.length-1]===s.id&&(_+=" jstree-last"),t.id=s.id,t.className=_,_=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":"");for(c in s.a_attr)if(s.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===s.a_attr[c])continue;"class"!==c?t.childNodes[1].setAttribute(c,s.a_attr[c]):_+=" "+s.a_attr[c]}if(_.length&&(t.childNodes[1].className="jstree-anchor "+_),(s.icon&&s.icon!==!0||s.icon===!1)&&(s.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage="url("+s.icon+")",t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),t.childNodes[1].innerHTML+=s.text,n&&s.children.length&&s.state.opened){for(h=u.createElement("UL"),h.setAttribute("role","group"),h.className="jstree-children",d=0,c=s.children.length;c>d;d++)h.appendChild(this.redraw_node(s.children[d],n,!0));t.appendChild(h)}return o&&t.appendChild(o),i||(r||(r=this.element[0]),r.getElementsByTagName("UL").length?r=r.getElementsByTagName("UL")[0]:(d=u.createElement("UL"),d.setAttribute("role","group"),d.className="jstree-children",r.appendChild(d),r=d),r.childNodes.length>a?r.insertBefore(t,r.childNodes[a]):r.appendChild(t)),t},open_node:function(n,i,s){var r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.open_node(n[r],i,s);return!0}if(n=this.get_node(n),!n||"#"===n.id)return!1;if(s=s===t?this.settings.core.animation:s,!this.is_closed(n))return i&&i.call(this,n,!1),!1;if(this.is_loaded(n))o=this.get_node(n,!0),d=this,o.length&&(n.children.length&&!this._firstChild(o.children("ul")[0])&&(n.state.opened=!0,this.redraw_node(n,!0),o=this.get_node(n,!0)),s?o.children("ul").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",d.trigger("after_open",{node:n})}):(o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),n.state.opened=!0,i&&i.call(this,n,!0),this.trigger("open_node",{node:n}),s&&o.length||this.trigger("after_open",{node:n});else{if(this.is_loading(n))return setTimeout(e.proxy(function(){this.open_node(n,i,s)},this),500);this.load_node(n,function(e,t){return t?this.open_node(e,i,s):i?i.call(this,e,!1):!1})}},_open_to:function(t){if(t=this.get_node(t),!t||"#"===t.id)return!1;var n,i,s=t.parents;for(n=0,i=s.length;i>n;n+=1)"#"!==n&&this.open_node(s[n],!1,0);return e(document.getElementById(t.id))},close_node:function(n,i){var s,r,a,o;if(e.isArray(n)){for(n=n.slice(),s=0,r=n.length;r>s;s++)this.close_node(n[s],i);return!0}return n=this.get_node(n),n&&"#"!==n.id?(i=i===t?this.settings.core.animation:i,a=this,o=this.get_node(n,!0),o.length&&(i?o.children("ul").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children("ul").stop(!0,!0).slideUp(i,function(){this.style.display="",o.children("ul").remove(),a.trigger("after_close",{node:n})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children("ul").remove())),n.state.opened=!1,this.trigger("close_node",{node:n}),i&&o.length||this.trigger("after_close",{node:n}),t):!1},toggle_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.toggle_node(n[i]);return!0}return this.is_closed(n)?this.open_node(n):this.is_open(n)?this.close_node(n):t},open_all:function(e,t,n){if(e||(e="#"),e=this.get_node(e),!e)return!1;var i="#"===e.id?this.get_container_ul():this.get_node(e,!0),s,r,a;if(!i.length){for(s=0,r=e.children_d.length;r>s;s++)this.is_closed(this._model.data[e.children_d[s]])&&(this._model.data[e.children_d[s]].state.opened=!0);return this.trigger("open_all",{node:e})}n=n||i,a=this,i=this.is_closed(e)?i.find("li.jstree-closed").addBack():i.find("li.jstree-closed"),i.each(function(){a.open_node(this,function(e,i){i&&this.is_parent(e)&&this.open_all(e,t,n)},t||0)}),0===n.find("li.jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(e,t){if(e||(e="#"),e=this.get_node(e),!e)return!1;var n="#"===e.id?this.get_container_ul():this.get_node(e,!0),i=this,s,r;if(!n.length){for(s=0,r=e.children_d.length;r>s;s++)this._model.data[e.children_d[s]].state.opened=!1;return this.trigger("close_all",{node:e})}n=this.is_open(e)?n.find("li.jstree-open").addBack():n.find("li.jstree-open"),n.vakata_reverse().each(function(){i.close_node(this,t||0)}),this.trigger("close_all",{node:e})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.enable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!1,this.get_node(n,!0).children(".jstree-anchor").removeClass("jstree-disabled"),this.trigger("enable_node",{node:n}),t):!1},disable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.disable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!0,this.get_node(n,!0).children(".jstree-anchor").addClass("jstree-disabled"),this.trigger("disable_node",{node:n}),t):!1},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&(!t.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(t.shiftKey){var n=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,r=!1,a,o;for(a=0,o=s.length;o>a;a+=1)s[a]===n&&(r=!r),s[a]===i&&(r=!r),r||s[a]===n||s[a]===i?this.select_node(s[a],!1,!1,t):this.deselect_node(s[a],!1,!1,t)}else this.is_selected(e)?this.deselect_node(e,!1,!1,t):this.select_node(e,!1,!1,t);else this.deselect_all(!0),this.select_node(e,!1,!1,t),this._data.core.last_clicked=this.get_node(e);this.trigger("activate_node",{node:this.get_node(e)})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered");t&&t.length&&this.dehover_node(t),e.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-hovered"),this.element.attr("aria-activedescendant",e[0].id),this.trigger("hover_node",{node:this.get_node(e)})},dehover_node:function(e){return e=this.get_node(e,!0),e&&e.length&&e.children(".jstree-hovered").length?(e.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)}),t):!1},select_node:function(n,i,s,r){var a,o,d,l;if(e.isArray(n)){for(n=n.slice(),o=0,d=n.length;d>o;o++)this.select_node(n[o],i,s,r);return!0}return n=this.get_node(n),n&&"#"!==n.id?(a=this.get_node(n,!0),n.state.selected||(n.state.selected=!0,this._data.core.selected.push(n.id),s||(a=this._open_to(n)),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:n,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"select_node",node:n,selected:this._data.core.selected,event:r})),t):!1},deselect_node:function(n,i,s){var r,a,o;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.deselect_node(n[r],i,s);return!0}return n=this.get_node(n),n&&"#"!==n.id?(o=this.get_node(n,!0),n.state.selected&&(n.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,n.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:n,selected:this._data.core.selected,event:s}),i||this.trigger("changed",{action:"deselect_node",node:n,selected:this._data.core.selected,event:s})),t):!1},select_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(this._data.core.selected=this._model.data["#"].children_d.concat(),n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),e||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:t})},deselect_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked"),this.trigger("deselect_all",{selected:this._data.core.selected,node:t}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:t})},is_selected:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.state.selected:!1},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected},get_state:function(){var e={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},t;for(t in this._model.data)this._model.data.hasOwnProperty(t)&&"#"!==t&&(this._model.data[t].state.opened&&e.core.open.push(t),this._model.data[t].state.selected&&e.core.selected.push(t));return e},set_state:function(n,i){if(n){if(n.core){var s,r,a,o;if(n.core.open)return e.isArray(n.core.open)?(s=!0,r=!1,a=this,e.each(n.core.open.concat([]),function(t,i){r=a.get_node(i),r&&(a.is_loaded(i)?(a.is_closed(i)&&a.open_node(i,!1,0),n&&n.core&&n.core.open&&e.vakata.array_remove_item(n.core.open,i)):(a.is_loading(i)||a.open_node(i,e.proxy(function(){this.set_state(n)},a),0),s=!1))}),s&&(delete n.core.open,this.set_state(n,i)),!1):(delete n.core.open,this.set_state(n,i),!1);if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,i),!1;if(n.core.selected)return o=this,this.deselect_all(),e.each(n.core.selected,function(e,t){o.select_node(t)}),delete n.core.selected,this.set_state(n,i),!1;if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,i),!1}return e.isEmptyObject(n)?(n=null,i&&i.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(){this._data.core.state=this.get_state(),this._cnt=0,this._model.data={"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},this.element.html(""),this.load_node("#",function(t,n){n&&this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}),this._data.core.state=null})},set_id:function(t,n){if(t=this.get_node(t),!t||"#"===t.id)return!1;var i,s,r=this._model.data;for(r[t.parent].children[e.inArray(t.id,r[t.parent].children)]=n,i=0,s=t.parents.length;s>i;i++)r[t.parents[i]].children_d[e.inArray(t.id,r[t.parents[i]].children_d)]=n;for(i=0,s=t.children.length;s>i;i++)r[t.children[i]].parent=n;for(i=0,s=t.children_d.length;s>i;i++)r[t.children_d[i]].parents[e.inArray(t.id,r[t.children_d[i]].parents)]=n;return i=e.inArray(t.id,this._data.core.selected),-1!==i&&(this._data.core.selected[i]=n),i=this.get_node(t.id,!0),i&&i.attr("id",n),delete r[t.id],t.id=n,r[n]=t,!0},get_text:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.text:!1},set_text:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_text(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(t.text=n,r=this.get_node(t,!0),r.length&&(r=r.children(".jstree-anchor:eq(0)"),a=r.children("I").clone(),r.html(n).prepend(a),this.trigger("set_text",{obj:t,text:n})),!0):!1},get_json:function(e,t,n){if(e=this.get_node(e||"#"),!e)return!1;t.flat&&!n&&(n=[]);var i={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:e.li_attr,a_attr:e.a_attr,state:{},data:t&&t.no_data?!1:e.data},s,r;if(t.flat?i.parent=e.parent:i.children=[],!t||!t.no_state)for(s in e.state)e.state.hasOwnProperty(s)&&(i.state[s]=e.state[s]);if(t&&t.no_id&&(delete i.id,i.li_attr&&i.li_attr.id&&delete i.li_attr.id),t.flat&&"#"!==e.id&&n.push(i),!t||!t.no_children)for(s=0,r=e.children.length;r>s;s++)t.flat?this.get_json(e.children[s],t,n):i.children.push(this.get_json(e.children[s],t)); +/*! jsTree - v3.0.0-beta7 - 2014-02-11 - (MIT) */ +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e,t){"use strict";if(!e.jstree){var n=0,i=!1,s=!1,r=!1,a=[],o=e("script:last").attr("src"),d=document,l=d.createElement("LI"),c,h;l.setAttribute("role","treeitem"),c=d.createElement("I"),c.className="jstree-icon jstree-ocl",l.appendChild(c),c=d.createElement("A"),c.className="jstree-anchor",c.setAttribute("href","#"),h=d.createElement("I"),h.className="jstree-icon jstree-themeicon",c.appendChild(h),l.appendChild(c),c=h=null,e.jstree={version:"3.0.0-beta7",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):""},e.jstree.create=function(t,i){var s=new e.jstree.core(++n),r=i;return i=e.extend(!0,{},e.jstree.defaults,i),r&&r.plugins&&(i.plugins=r.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))}),s.init(t,i),s},e.jstree.core=function(e){this._id=e,this._cnt=0,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[]}}},e.jstree.reference=function(n){if(n&&!e(n).length){n.id&&(n=n.id);var i=null;return e(".jstree").each(function(){var s=e(this).data("jstree");return s&&s._model.data[n]?(i=s,!1):t}),i}return e(n).closest(".jstree").data("jstree")},e.fn.jstree=function(n){var i="string"==typeof n,s=Array.prototype.slice.call(arguments,1),r=null;return this.each(function(){var a=e.jstree.reference(this),o=i&&a?a[n]:null;return r=i&&o?o.apply(a,s):null,a||i||n!==t&&!e.isPlainObject(n)||e(this).data("jstree",new e.jstree.create(this,n)),a&&!i&&(r=a),null!==r&&r!==t?!1:t}),null!==r&&r!==t?r:this},e.expr[":"].jstree=e.expr.createPseudo(function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!0},expand_selected_onload:!0},e.jstree.core.prototype={plugin:function(t,n){var i=e.jstree.plugins[t];return i?(this._data[t]={},i.prototype=this,new i(n,this)):this},init:function(t,n){this._model={data:{"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,this.element.bind("destroyed",e.proxy(this.teardown,this)),this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this._data.core.li_height=this.get_container_ul().children("li:eq(0)").height()||18,this.trigger("loading"),this.load_node("#")},destroy:function(){this.element.unbind("destroyed",this.teardown),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){this.element.on("dblclick.jstree",function(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var e=window.getSelection();try{e.removeAllRanges(),e.collapse()}catch(t){}}}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){var n=null;switch(t.which){case 13:case 32:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 38:t.preventDefault(),n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):(n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 40:t.preventDefault(),n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 46:t.preventDefault(),n=this.get_node(t.currentTarget),n&&n.id&&"#"!==n.id&&(n=this.is_selected(n)?this.get_selected():n);break;case 113:t.preventDefault(),n=this.get_node(t.currentTarget);break;default:}},this)).on("load_node.jstree",e.proxy(function(t,n){if(n.status&&("#"!==n.node.id||this._data.core.loaded||(this._data.core.loaded=!0,this.trigger("loaded")),!this._data.core.ready&&!this.get_container_ul().find(".jstree-loading:eq(0)").length)){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var i=[],s,r;for(s=0,r=this._data.core.selected.length;r>s;s++)i=i.concat(this._model.data[this._data.core.selected[s]].parents);for(i=e.vakata.array_unique(i),s=0,r=i.length;r>s;s++)this.open_node(i[s],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}setTimeout(e.proxy(function(){this.trigger("ready")},this),0)}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter()},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(document).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children("ul:eq(0)")},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){e=e?e.firstChild:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_nextSibling:function(e){e=e?e.nextSibling:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_previousSibling:function(e){e=e?e.previousSibling:null;while(null!==e&&1!==e.nodeType)e=e.previousSibling;return e},get_node:function(t,n){t&&t.id&&(t=t.id);var i;try{if(this._model.data[t])t=this._model.data[t];else if(((i=e(t,this.element)).length||(i=e("#"+t,this.element)).length)&&this._model.data[i.closest("li").attr("id")])t=this._model.data[i.closest("li").attr("id")];else{if(!(i=e(t,this.element)).length||!i.hasClass("jstree"))return!1;t=this._model.data["#"]}return n&&(t="#"===t.id?this.element:e(document.getElementById(t.id))),t}catch(s){return!1}},get_next_dom:function(t,n){var i;return t=this.get_node(t,!0),t[0]===this.element[0]?(i=this._firstChild(this.get_container_ul()[0]),i?e(i):!1):t&&t.length?n?(i=this._nextSibling(t[0]),i?e(i):!1):t.hasClass("jstree-open")?(i=this._firstChild(t.children("ul")[0]),i?e(i):!1):null!==(i=this._nextSibling(t[0]))?e(i):t.parentsUntil(".jstree","li").next("li").eq(0):!1},get_prev_dom:function(t,n){var i;if(t=this.get_node(t,!0),t[0]===this.element[0])return i=this.get_container_ul()[0].lastChild,i?e(i):!1;if(!t||!t.length)return!1;if(n)return i=this._previousSibling(t[0]),i?e(i):!1;if(null!==(i=this._previousSibling(t[0]))){t=e(i);while(t.hasClass("jstree-open"))t=t.children("ul:eq(0)").children("li:last");return t}return i=t[0].parentNode.parentNode,i&&"LI"===i.tagName?e(i):!1},get_parent:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.parent:!1},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children("li"):e&&e.length?e.children("ul").children("li"):!1},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e,!0),e&&e.hasClass("jstree-loading")},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var i,s;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.load_node(t[i],n);return!0}return(t=this.get_node(t))?(this.get_node(t,!0).addClass("jstree-loading"),this._load_node(t,e.proxy(function(e){t.state.loaded=e,this.get_node(t,!0).removeClass("jstree-loading"),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)},this)),!0):(n.call(this,t,!1),!1)},_load_node:function(n,i){var s=this.settings.core.data,r;return s?e.isFunction(s)?s.call(this,n,e.proxy(function(t){return t===!1?i.call(this,!1):i.call(this,this["string"==typeof t?"_append_html_data":"_append_json_data"](n,"string"==typeof t?e(t):t))},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,n)),e.isFunction(s.data)&&(s.data=s.data.call(this,n)),e.ajax(s).done(e.proxy(function(s,r,a){var o=a.getResponseHeader("Content-Type");return-1!==o.indexOf("json")?i.call(this,this._append_json_data(n,s)):-1!==o.indexOf("html")?i.call(this,this._append_html_data(n,e(s))):t},this)).fail(e.proxy(function(){i.call(this,!1)},this))):(r=e.isArray(s)||e.isPlainObject(s)?e.vakata.json.decode(e.vakata.json.encode(s)):s,i.call(this,this._append_json_data(n,r))):"string"==typeof s?i.call(this,this._append_html_data(n,s)):i.call(this,!1):i.call(this,"#"===n.id?this._append_html_data(n,this._data.core.original_container_html.clone(!0)):!1)},_node_changed:function(e){e=this.get_node(e),e&&this._model.changed.push(e.id)},_append_html_data:function(t,n){t=this.get_node(t),t.children=[],t.children_d=[];var i=n.is("ul")?n.children():n,s=t.id,r=[],a=[],o=this._model.data,d=o[s],l=this._data.core.selected.length,c,h,_;for(i.each(e.proxy(function(t,n){c=this._parse_model_from_html(e(n),s,d.parents.concat()),c&&(r.push(c),a.push(c),o[c].children_d.length&&(a=a.concat(o[c].children_d)))},this)),d.children=r,d.children_d=a,h=0,_=d.parents.length;_>h;h++)o[d.parents[h]].children_d=o[d.parents[h]].children_d.concat(a);return this.trigger("model",{nodes:a,parent:s}),"#"!==s?(this._node_changed(s),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==l&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_append_json_data:function(n,i){n=this.get_node(n),n.children=[],n.children_d=[];var s=i,r=n.id,a=[],o=[],d=this._model.data,l=d[r],c=this._data.core.selected.length,h,_,u;if(s.d&&(s=s.d,"string"==typeof s&&(s=e.vakata.json.decode(s))),e.isArray(s)||(s=[s]),s.length&&s[0].id!==t&&s[0].parent!==t){for(_=0,u=s.length;u>_;_++)s[_].children||(s[_].children=[]),d[s[_].id]=s[_];for(_=0,u=s.length;u>_;_++)d[s[_].parent].children.push(s[_].id),l.children_d.push(s[_].id);for(_=0,u=l.children.length;u>_;_++)h=this._parse_model_from_flat_json(d[l.children[_]],r,l.parents.concat()),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d))}else{for(_=0,u=s.length;u>_;_++)h=this._parse_model_from_json(s[_],r,l.parents.concat()),h&&(a.push(h),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d)));for(l.children=a,l.children_d=o,_=0,u=l.parents.length;u>_;_++)d[l.parents[_]].children_d=d[l.parents[_]].children_d.concat(o)}return this.trigger("model",{nodes:o,parent:r}),"#"!==r?(this._node_changed(r),this.redraw()):this.redraw(!0),this._data.core.selected.length!==c&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_parse_model_from_html:function(n,i,s){s=s?[].concat(s):[],i&&s.unshift(i);var r,a,o=this._model.data,d={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l,c,h;for(l in this._model.default_state)this._model.default_state.hasOwnProperty(l)&&(d.state[l]=this._model.default_state[l]);if(c=e.vakata.attributes(n,!0),e.each(c,function(n,i){return i=e.trim(i),i.length?(d.li_attr[n]=i,"id"===n&&(d.id=i),t):!0}),c=n.children("a").eq(0),c.length&&(c=e.vakata.attributes(c,!0),e.each(c,function(t,n){n=e.trim(n),n.length&&(d.a_attr[t]=n)})),c=n.children("a:eq(0)").length?n.children("a:eq(0)").clone():n.clone(),c.children("ins, i, ul").remove(),c=c.html(),c=e("
").html(c),d.text=c.html(),c=n.data(),d.data=c?e.extend(!0,{},c):null,d.state.opened=n.hasClass("jstree-open"),d.state.selected=n.children("a").hasClass("jstree-clicked"),d.state.disabled=n.children("a").hasClass("jstree-disabled"),d.data&&d.data.jstree)for(l in d.data.jstree)d.data.jstree.hasOwnProperty(l)&&(d.state[l]=d.data.jstree[l]);c=n.children("a").children(".jstree-themeicon"),c.length&&(d.icon=c.hasClass("jstree-themeicon-hidden")?!1:c.attr("rel")),d.state.icon&&(d.icon=d.state.icon),c=n.children("ul").children("li");do h="j"+this._id+"_"+ ++this._cnt;while(o[h]);return d.id=d.li_attr.id||h,c.length?(c.each(e.proxy(function(t,n){r=this._parse_model_from_html(e(n),d.id,s),a=this._model.data[r],d.children.push(r),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d))},this)),d.children_d=d.children_d.concat(d.children)):n.hasClass("jstree-closed")&&(d.state.loaded=!1),d.li_attr["class"]&&(d.li_attr["class"]=d.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),d.a_attr["class"]&&(d.a_attr["class"]=d.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),o[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_parse_model_from_flat_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=e.id,r=this._model.data,a=this._model.default_state,o,d,l,c,h={id:s,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:n,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in a)a.hasOwnProperty(o)&&(h.state[o]=a[o]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(o in e.data.jstree)e.data.jstree.hasOwnProperty(o)&&(h.state[o]=e.data.jstree[o]);if(e&&"object"==typeof e.state)for(o in e.state)e.state.hasOwnProperty(o)&&(h.state[o]=e.state[o]);if(e&&"object"==typeof e.li_attr)for(o in e.li_attr)e.li_attr.hasOwnProperty(o)&&(h.li_attr[o]=e.li_attr[o]);if(h.li_attr.id||(h.li_attr.id=s),e&&"object"==typeof e.a_attr)for(o in e.a_attr)e.a_attr.hasOwnProperty(o)&&(h.a_attr[o]=e.a_attr[o]);for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),r[h.id]=h,o=0,d=h.children.length;d>o;o++)l=this._parse_model_from_flat_json(r[h.children[o]],h.id,i),c=r[l],h.children_d.push(l),c.children_d.length&&(h.children_d=h.children_d.concat(c.children_d));return delete e.data,delete e.children,r[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=!1,r,a,o,d,l=this._model.data,c=this._model.default_state,h;do s="j"+this._id+"_"+ ++this._cnt;while(l[s]);h={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:n,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in c)c.hasOwnProperty(r)&&(h.state[r]=c[r]);if(e&&e.id&&(h.id=e.id),e&&e.text&&(h.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(h.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(h.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(h.li_attr[r]=e.li_attr[r]);if(h.li_attr.id&&!h.id&&(h.id=h.li_attr.id),h.id||(h.id=s),h.li_attr.id||(h.li_attr.id=h.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(h.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,a=e.children.length;a>r;r++)o=this._parse_model_from_json(e.children[r],h.id,i),d=l[o],h.children.push(o),d.children_d.length&&(h.children_d=h.children_d.concat(d.children_d));h.children_d=h.children_d.concat(h.children)}return e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),delete e.data,delete e.children,h.original=e,l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_redraw:function(){var e=this._model.force_full_redraw?this._model.data["#"].children.concat([]):this._model.changed.concat([]),t=document.createElement("UL"),n,i,s;for(i=0,s=e.length;s>i;i++)n=this.redraw_node(e[i],!0,this._model.force_full_redraw),n&&this._model.force_full_redraw&&t.appendChild(n);this._model.force_full_redraw&&(t.className=this.get_container_ul()[0].className,this.element.empty().append(t)),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:e})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},redraw_node:function(t,n,i){var s=this.get_node(t),r=!1,a=!1,o=!1,d=!1,c=!1,h=!1,_="",u=document,g=this._model.data;if(!s)return!1;if("#"===s.id)return this.redraw(!0);if(n=n||0===s.children.length,t=u.getElementById(s.id))t=e(t),i||(r=t.parent().parent()[0],r===this.element[0]&&(r=null),a=t.index()),n||!s.children.length||t.children("ul").length||(n=!0),n||(o=t.children("UL")[0]),t.remove();else if(n=!0,!i){if(r="#"!==s.parent?e("#"+s.parent,this.element)[0]:null,!(null===r||r&&g[s.parent].state.opened))return!1;a=e.inArray(s.id,null===r?g["#"].children:g[s.parent].children)}t=l.cloneNode(!0),_="jstree-node ";for(d in s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,s.li_attr[d]):_+=s.li_attr[d]}!s.children.length&&s.state.loaded?_+=" jstree-leaf":(_+=s.state.opened?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",s.state.opened)),null!==s.parent&&g[s.parent].children[g[s.parent].children.length-1]===s.id&&(_+=" jstree-last"),t.id=s.id,t.className=_,_=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":"");for(c in s.a_attr)if(s.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===s.a_attr[c])continue;"class"!==c?t.childNodes[1].setAttribute(c,s.a_attr[c]):_+=" "+s.a_attr[c]}if(_.length&&(t.childNodes[1].className="jstree-anchor "+_),(s.icon&&s.icon!==!0||s.icon===!1)&&(s.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage="url("+s.icon+")",t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),t.childNodes[1].innerHTML+=s.text,n&&s.children.length&&s.state.opened){for(h=u.createElement("UL"),h.setAttribute("role","group"),h.className="jstree-children",d=0,c=s.children.length;c>d;d++)h.appendChild(this.redraw_node(s.children[d],n,!0));t.appendChild(h)}return o&&t.appendChild(o),i||(r||(r=this.element[0]),r.getElementsByTagName("UL").length?r=r.getElementsByTagName("UL")[0]:(d=u.createElement("UL"),d.setAttribute("role","group"),d.className="jstree-children",r.appendChild(d),r=d),r.childNodes.length>a?r.insertBefore(t,r.childNodes[a]):r.appendChild(t)),t},open_node:function(n,i,s){var r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.open_node(n[r],i,s);return!0}if(n=this.get_node(n),!n||"#"===n.id)return!1;if(s=s===t?this.settings.core.animation:s,!this.is_closed(n))return i&&i.call(this,n,!1),!1;if(this.is_loaded(n))o=this.get_node(n,!0),d=this,o.length&&(n.children.length&&!this._firstChild(o.children("ul")[0])&&(n.state.opened=!0,this.redraw_node(n,!0),o=this.get_node(n,!0)),s?o.children("ul").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",d.trigger("after_open",{node:n})}):(o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),n.state.opened=!0,i&&i.call(this,n,!0),this.trigger("open_node",{node:n}),s&&o.length||this.trigger("after_open",{node:n});else{if(this.is_loading(n))return setTimeout(e.proxy(function(){this.open_node(n,i,s)},this),500);this.load_node(n,function(e,t){return t?this.open_node(e,i,s):i?i.call(this,e,!1):!1})}},_open_to:function(t){if(t=this.get_node(t),!t||"#"===t.id)return!1;var n,i,s=t.parents;for(n=0,i=s.length;i>n;n+=1)"#"!==n&&this.open_node(s[n],!1,0);return e(document.getElementById(t.id))},close_node:function(n,i){var s,r,a,o;if(e.isArray(n)){for(n=n.slice(),s=0,r=n.length;r>s;s++)this.close_node(n[s],i);return!0}return n=this.get_node(n),n&&"#"!==n.id?(i=i===t?this.settings.core.animation:i,a=this,o=this.get_node(n,!0),o.length&&(i?o.children("ul").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children("ul").stop(!0,!0).slideUp(i,function(){this.style.display="",o.children("ul").remove(),a.trigger("after_close",{node:n})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children("ul").remove())),n.state.opened=!1,this.trigger("close_node",{node:n}),i&&o.length||this.trigger("after_close",{node:n}),t):!1},toggle_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.toggle_node(n[i]);return!0}return this.is_closed(n)?this.open_node(n):this.is_open(n)?this.close_node(n):t},open_all:function(e,t,n){if(e||(e="#"),e=this.get_node(e),!e)return!1;var i="#"===e.id?this.get_container_ul():this.get_node(e,!0),s,r,a;if(!i.length){for(s=0,r=e.children_d.length;r>s;s++)this.is_closed(this._model.data[e.children_d[s]])&&(this._model.data[e.children_d[s]].state.opened=!0);return this.trigger("open_all",{node:e})}n=n||i,a=this,i=this.is_closed(e)?i.find("li.jstree-closed").addBack():i.find("li.jstree-closed"),i.each(function(){a.open_node(this,function(e,i){i&&this.is_parent(e)&&this.open_all(e,t,n)},t||0)}),0===n.find("li.jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(e,t){if(e||(e="#"),e=this.get_node(e),!e)return!1;var n="#"===e.id?this.get_container_ul():this.get_node(e,!0),i=this,s,r;if(!n.length){for(s=0,r=e.children_d.length;r>s;s++)this._model.data[e.children_d[s]].state.opened=!1;return this.trigger("close_all",{node:e})}n=this.is_open(e)?n.find("li.jstree-open").addBack():n.find("li.jstree-open"),n.vakata_reverse().each(function(){i.close_node(this,t||0)}),this.trigger("close_all",{node:e})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.enable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!1,this.get_node(n,!0).children(".jstree-anchor").removeClass("jstree-disabled"),this.trigger("enable_node",{node:n}),t):!1},disable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.disable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!0,this.get_node(n,!0).children(".jstree-anchor").addClass("jstree-disabled"),this.trigger("disable_node",{node:n}),t):!1},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&(!t.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(t.shiftKey){var n=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,r=!1,a,o;for(a=0,o=s.length;o>a;a+=1)s[a]===n&&(r=!r),s[a]===i&&(r=!r),r||s[a]===n||s[a]===i?this.select_node(s[a],!1,!1,t):this.deselect_node(s[a],!1,!1,t)}else this.is_selected(e)?this.deselect_node(e,!1,!1,t):this.select_node(e,!1,!1,t);else this.deselect_all(!0),this.select_node(e,!1,!1,t),this._data.core.last_clicked=this.get_node(e);this.trigger("activate_node",{node:this.get_node(e)})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered");t&&t.length&&this.dehover_node(t),e.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-hovered"),this.element.attr("aria-activedescendant",e[0].id),this.trigger("hover_node",{node:this.get_node(e)})},dehover_node:function(e){return e=this.get_node(e,!0),e&&e.length&&e.children(".jstree-hovered").length?(e.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)}),t):!1},select_node:function(n,i,s,r){var a,o,d,l;if(e.isArray(n)){for(n=n.slice(),o=0,d=n.length;d>o;o++)this.select_node(n[o],i,s,r);return!0}return n=this.get_node(n),n&&"#"!==n.id?(a=this.get_node(n,!0),n.state.selected||(n.state.selected=!0,this._data.core.selected.push(n.id),s||(a=this._open_to(n)),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:n,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"select_node",node:n,selected:this._data.core.selected,event:r})),t):!1},deselect_node:function(n,i,s){var r,a,o;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.deselect_node(n[r],i,s);return!0}return n=this.get_node(n),n&&"#"!==n.id?(o=this.get_node(n,!0),n.state.selected&&(n.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,n.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:n,selected:this._data.core.selected,event:s}),i||this.trigger("changed",{action:"deselect_node",node:n,selected:this._data.core.selected,event:s})),t):!1},select_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(this._data.core.selected=this._model.data["#"].children_d.concat(),n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),e||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:t})},deselect_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked"),this.trigger("deselect_all",{selected:this._data.core.selected,node:t}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:t})},is_selected:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.state.selected:!1},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected},get_state:function(){var e={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},t;for(t in this._model.data)this._model.data.hasOwnProperty(t)&&"#"!==t&&(this._model.data[t].state.opened&&e.core.open.push(t),this._model.data[t].state.selected&&e.core.selected.push(t));return e},set_state:function(n,i){if(n){if(n.core){var s,r,a,o;if(n.core.open)return e.isArray(n.core.open)?(s=!0,r=!1,a=this,e.each(n.core.open.concat([]),function(t,i){r=a.get_node(i),r&&(a.is_loaded(i)?(a.is_closed(i)&&a.open_node(i,!1,0),n&&n.core&&n.core.open&&e.vakata.array_remove_item(n.core.open,i)):(a.is_loading(i)||a.open_node(i,e.proxy(function(){this.set_state(n)},a),0),s=!1))}),s&&(delete n.core.open,this.set_state(n,i)),!1):(delete n.core.open,this.set_state(n,i),!1);if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,i),!1;if(n.core.selected)return o=this,this.deselect_all(),e.each(n.core.selected,function(e,t){o.select_node(t)}),delete n.core.selected,this.set_state(n,i),!1;if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,i),!1}return e.isEmptyObject(n)?(n=null,i&&i.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(){this._data.core.state=this.get_state(),this._cnt=0,this._model.data={"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},this.element.html(""),this.load_node("#",function(t,n){n&&this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}),this._data.core.state=null})},set_id:function(t,n){if(t=this.get_node(t),!t||"#"===t.id)return!1;var i,s,r=this._model.data;for(r[t.parent].children[e.inArray(t.id,r[t.parent].children)]=n,i=0,s=t.parents.length;s>i;i++)r[t.parents[i]].children_d[e.inArray(t.id,r[t.parents[i]].children_d)]=n;for(i=0,s=t.children.length;s>i;i++)r[t.children[i]].parent=n;for(i=0,s=t.children_d.length;s>i;i++)r[t.children_d[i]].parents[e.inArray(t.id,r[t.children_d[i]].parents)]=n;return i=e.inArray(t.id,this._data.core.selected),-1!==i&&(this._data.core.selected[i]=n),i=this.get_node(t.id,!0),i&&i.attr("id",n),delete r[t.id],t.id=n,r[n]=t,!0},get_text:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.text:!1},set_text:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_text(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(t.text=n,r=this.get_node(t,!0),r.length&&(r=r.children(".jstree-anchor:eq(0)"),a=r.children("I").clone(),r.html(n).prepend(a),this.trigger("set_text",{obj:t,text:n})),!0):!1},get_json:function(e,t,n){if(e=this.get_node(e||"#"),!e)return!1;t.flat&&!n&&(n=[]);var i={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:e.li_attr,a_attr:e.a_attr,state:{},data:t&&t.no_data?!1:e.data},s,r;if(t.flat?i.parent=e.parent:i.children=[],!t||!t.no_state)for(s in e.state)e.state.hasOwnProperty(s)&&(i.state[s]=e.state[s]);if(t&&t.no_id&&(delete i.id,i.li_attr&&i.li_attr.id&&delete i.li_attr.id),t.flat&&"#"!==e.id&&n.push(i),!t||!t.no_children)for(s=0,r=e.children.length;r>s;s++)t.flat?this.get_json(e.children[s],t,n):i.children.push(this.get_json(e.children[s],t)); return t.flat?n:"#"===e.id?i.children:i},create_node:function(n,i,s,r,a){if(n=this.get_node(n),!n)return!1;if(s=s===t?"last":s,!s.match(/^(before|after)$/)&&!a&&!this.is_loaded(n))return this.load_node(n,function(){this.create_node(n,i,s,r,!0)});i||(i={text:this.get_string("New node")}),i.text===t&&(i.text=this.get_string("New node"));var o,d,l,c;switch("#"===n.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":o=this.get_node(n.parent),s=e.inArray(n.id,o.children),n=o;break;case"after":o=this.get_node(n.parent),s=e.inArray(n.id,o.children)+1,n=o;break;case"inside":case"first":s=0;break;case"last":s=n.children.length;break;default:s||(s=0)}if(s>n.children.length&&(s=n.children.length),i.id||(i.id=!0),!this.check("create_node",i,n,s))return!1;if(i.id===!0&&delete i.id,i=this._parse_model_from_json(i,n.id,n.parents.concat()),!i)return!1;for(o=this.get_node(i),d=[],d.push(i),d=d.concat(o.children_d),this.trigger("model",{nodes:d,parent:n.id}),n.children_d=n.children_d.concat(d),l=0,c=n.parents.length;c>l;l++)this._model.data[n.parents[l]].children_d=this._model.data[n.parents[l]].children_d.concat(d);for(i=o,o=[],l=0,c=n.children.length;c>l;l++)o[l>=s?l+1:l]=n.children[l];return o[s]=i.id,n.children=o,this.redraw_node(n,!0),r&&r.call(this,this.get_node(i)),this.trigger("create_node",{node:this.get_node(i),parent:n.id,position:s}),i.id},rename_node:function(t,n){var i,s,r;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.rename_node(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(r=t.text,this.check("rename_node",t,this.get_parent(t),n)?(this.set_text(t,n),this.trigger("rename_node",{node:t,text:n,old:r}),!0):!1):!1},delete_node:function(t){var n,i,s,r,a,o,d,l,c,h;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.delete_node(t[n]);return!0}if(t=this.get_node(t),!t||"#"===t.id)return!1;if(s=this.get_node(t.parent),r=e.inArray(t.id,s.children),h=!1,!this.check("delete_node",t,s,r))return!1;for(-1!==r&&(s.children=e.vakata.array_remove(s.children,r)),a=t.children_d.concat([]),a.push(t.id),l=0,c=a.length;c>l;l++){for(o=0,d=t.parents.length;d>o;o++)r=e.inArray(a[l],this._model.data[t.parents[o]].children_d),-1!==r&&(this._model.data[t.parents[o]].children_d=e.vakata.array_remove(this._model.data[t.parents[o]].children_d,r));this._model.data[a[l]].state.selected&&(h=!0,r=e.inArray(a[l],this._data.core.selected),-1!==r&&(this._data.core.selected=e.vakata.array_remove(this._data.core.selected,r)))}for(this.trigger("delete_node",{node:t,parent:s.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),l=0,c=a.length;c>l;l++)delete this._model.data[a[l]];return this.redraw_node(s,!0),!0},check:function(t,n,i,s){n=n&&n.id?n:this.get_node(n),i=i&&i.id?i:this.get_node(i);var r=t.match(/^move_node|copy_node|create_node$/i)?i:n,a=this.settings.core.check_callback;return"move_node"!==t||n.id!==i.id&&e.inArray(n.id,i.children)!==s&&-1===e.inArray(i.id,n.children_d)?(r=this.get_node(r,!0),r.length&&(r=r.data("jstree")),r&&r.functions&&(r.functions[t]===!1||r.functions[t]===!0)?r.functions[t]:a===!1||e.isFunction(a)&&a.call(this,t,n,i,s)===!1||a&&a[t]===!1?!1:!0):!1},move_node:function(n,i,s,r,a){var o,d,l,c,h,_,u,g,f,p,m,v,j;if(e.isArray(n)){for(n=n.reverse().slice(),o=0,d=n.length;d>o;o++)this.move_node(n[o],i,s,r,a);return!0}if(n=n&&n.id?n:this.get_node(n),i=this.get_node(i),s=s===t?0:s,!i||!n||"#"===n.id)return!1;if(!(""+s).match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return this.load_node(i,function(){this.move_node(n,i,s,r,!0)});if(l=""+(n.parent||"#"),c=(""+s).match(/^(before|after)$/)&&"#"!==i.id?this.get_node(i.parent):i,h=this._model.data[n.id]?this:e.jstree.reference(n.id),_=!h||!h._id||this._id!==h._id)return this.copy_node(n,i,s,r,a)?(h&&h.delete_node(n),!0):!1;switch("#"===c.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,c.children);break;case"after":s=e.inArray(i.id,c.children)+1;break;case"inside":case"first":s=0;break;case"last":s=c.children.length;break;default:s||(s=0)}if(s>c.children.length&&(s=c.children.length),!this.check("move_node",n,c,s))return!1;if(n.parent===c.id){for(u=c.children.concat(),g=e.inArray(n.id,u),-1!==g&&(u=e.vakata.array_remove(u,g),s>g&&s--),g=[],f=0,p=u.length;p>f;f++)g[f>=s?f+1:f]=u[f];g[s]=n.id,c.children=g,this._node_changed(c.id),this.redraw("#"===c.id)}else{for(g=n.children_d.concat(),g.push(n.id),f=0,p=n.parents.length;p>f;f++){for(u=[],j=h._model.data[n.parents[f]].children_d,m=0,v=j.length;v>m;m++)-1===e.inArray(j[m],g)&&u.push(j[m]);h._model.data[n.parents[f]].children_d=u}for(h._model.data[l].children=e.vakata.array_remove_item(h._model.data[l].children,n.id),f=0,p=c.parents.length;p>f;f++)this._model.data[c.parents[f]].children_d=this._model.data[c.parents[f]].children_d.concat(g);for(u=[],f=0,p=c.children.length;p>f;f++)u[f>=s?f+1:f]=c.children[f];for(u[s]=n.id,c.children=u,c.children_d.push(n.id),c.children_d=c.children_d.concat(n.children_d),n.parent=c.id,g=c.parents.concat(),g.unshift(c.id),j=n.parents.length,n.parents=g,g=g.concat(),f=0,p=n.children_d.length;p>f;f++)this._model.data[n.children_d[f]].parents=this._model.data[n.children_d[f]].parents.slice(0,-1*j),Array.prototype.push.apply(this._model.data[n.children_d[f]].parents,g);this._node_changed(l),this._node_changed(c.id),this.redraw("#"===l||"#"===c.id)}return r&&r.call(this,n,c,s),this.trigger("move_node",{node:n,parent:c.id,position:s,old_parent:l,is_multi:_,old_instance:h,new_instance:this}),!0},copy_node:function(n,i,s,r,a){var o,d,l,c,h,_,u,g,f,p,m;if(e.isArray(n)){for(n=n.reverse().slice(),o=0,d=n.length;d>o;o++)this.copy_node(n[o],i,s,r,a);return!0}if(n=n&&n.id?n:this.get_node(n),i=this.get_node(i),s=s===t?0:s,!i||!n||"#"===n.id)return!1;if(!(""+s).match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return this.load_node(i,function(){this.copy_node(n,i,s,r,!0)});switch(g=""+(n.parent||"#"),f=(""+s).match(/^(before|after)$/)&&"#"!==i.id?this.get_node(i.parent):i,p=this._model.data[n.id]?this:e.jstree.reference(n.id),m=!p||!p._id||this._id!==p._id,"#"===f.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,f.children);break;case"after":s=e.inArray(i.id,f.children)+1;break;case"inside":case"first":s=0;break;case"last":s=f.children.length;break;default:s||(s=0)}if(s>f.children.length&&(s=f.children.length),!this.check("copy_node",n,f,s))return!1;if(u=p?p.get_json(n,{no_id:!0,no_data:!0,no_state:!0}):n,!u)return!1;if(u.id===!0&&delete u.id,u=this._parse_model_from_json(u,f.id,f.parents.concat()),!u)return!1;for(c=this.get_node(u),l=[],l.push(u),l=l.concat(c.children_d),this.trigger("model",{nodes:l,parent:f.id}),h=0,_=f.parents.length;_>h;h++)this._model.data[f.parents[h]].children_d=this._model.data[f.parents[h]].children_d.concat(l);for(l=[],h=0,_=f.children.length;_>h;h++)l[h>=s?h+1:h]=f.children[h];return l[s]=c.id,f.children=l,f.children_d.push(c.id),f.children_d=f.children_d.concat(c.children_d),this._node_changed(f.id),this.redraw("#"===f.id),r&&r.call(this,c,f,s),this.trigger("copy_node",{node:c,original:n,parent:f.id,position:s,old_parent:g,is_multi:m,old_instance:p,new_instance:this}),c.id},cut:function(n){if(n||(n=this._data.core.selected.concat()),e.isArray(n)||(n=[n]),!n.length)return!1;var a=[],o,d,l;for(d=0,l=n.length;l>d;d++)o=this.get_node(n[d]),o&&o.id&&"#"!==o.id&&a.push(o);return a.length?(i=a,r=this,s="move_node",this.trigger("cut",{node:n}),t):!1},copy:function(n){if(n||(n=this._data.core.selected.concat()),e.isArray(n)||(n=[n]),!n.length)return!1;var a=[],o,d,l;for(d=0,l=n.length;l>d;d++)o=this.get_node(n[d]),o&&o.id&&"#"!==o.id&&a.push(o);return a.length?(i=a,r=this,s="copy_node",this.trigger("copy",{node:n}),t):!1},get_buffer:function(){return{mode:s,node:i,inst:r}},can_paste:function(){return s!==!1&&i!==!1},paste:function(e){return e=this.get_node(e),e&&s&&s.match(/^(copy_node|move_node)$/)&&i?(this[s](i,e)&&this.trigger("paste",{parent:e.id,node:i,mode:s}),i=!1,s=!1,r=!1,t):!1},edit:function(n,i){if(n=this._open_to(n),!n||!n.length)return!1;var s=this._data.core.rtl,r=this.element.width(),a=n.children(".jstree-anchor"),o=e(""),d="string"==typeof i?i:this.get_text(n),l=e("
",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=e("",{value:d,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(){var e=o.children(".jstree-rename-input"),t=e.val();""===t&&(t=d),l.remove(),o.replaceWith(a),o.remove(),this.set_text(n,d),this.rename_node(n,t)===!1&&this.set_text(n,d)},this),keydown:function(e){var t=e.which;27===t&&(this.value=d),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){c.width(Math.min(l.text("pW"+this.value).width(),r))},keypress:function(e){return 13===e.which?!1:t}}),h={fontFamily:a.css("fontFamily")||"",fontSize:a.css("fontSize")||"",fontWeight:a.css("fontWeight")||"",fontStyle:a.css("fontStyle")||"",fontStretch:a.css("fontStretch")||"",fontVariant:a.css("fontVariant")||"",letterSpacing:a.css("letterSpacing")||"",wordSpacing:a.css("wordSpacing")||""};this.set_text(n,""),o.attr("class",a.attr("class")).append(a.contents().clone()).append(c),a.replaceWith(o),l.css(h),c.css(h).width(Math.min(l.text("pW"+c[0].value).width(),r))[0].select()},set_theme:function(t,n){if(!t)return!1;if(n===!0){var i=this.settings.core.themes.dir;i||(i=e.jstree.path+"/themes"),n=i+"/"+t+"/style.css"}n&&-1===e.inArray(n,a)&&(e("head").append(''),a.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_icon(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(a=t.icon,t.icon=n,r=this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon"),n===!1?this.hide_icon(t):n===!0?r.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"):-1===n.indexOf("/")&&-1===n.indexOf(".")?(r.removeClass(a).css("background",""),r.addClass(n+" jstree-themeicon-custom").attr("rel",n)):(r.removeClass(a).css("background",""),r.addClass("jstree-themeicon-custom").css("background","url('"+n+"') center center no-repeat").attr("rel",n)),!0):!1},get_icon:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.icon:!1},hide_icon:function(t){var n,i;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.hide_icon(t[n]);return!0}return t=this.get_node(t),t&&"#"!==t?(t.icon=!1,this.get_node(t,!0).children("a").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(t){var n,i,s;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.show_icon(t[n]);return!0}return t=this.get_node(t),t&&"#"!==t?(s=this.get_node(t,!0),t.icon=s.length?s.children("a").children(".jstree-themeicon").attr("rel"):!0,t.icon||(t.icon=!0),s.children("a").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},e.vakata={},e.fn.vakata_reverse=[].reverse,e.vakata.attributes=function(t,n){t=e(t)[0];var i=n?{}:[];return t&&t.attributes&&e.each(t.attributes,function(t,s){-1===e.inArray(s.nodeName.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==s.nodeValue&&""!==e.trim(s.nodeValue)&&(n?i[s.nodeName]=s.nodeValue:i.push(s.nodeName))}),i},e.vakata.array_unique=function(e){var t=[],n,i,s;for(n=0,s=e.length;s>n;n++){for(i=0;n>=i;i++)if(e[n]===e[i])break;i===n&&t.push(e[n])}return t},e.vakata.array_remove=function(e,t,n){var i=e.slice((n||t)+1||e.length);return e.length=0>t?e.length+t:t,e.push.apply(e,i),e},e.vakata.array_remove_item=function(t,n){var i=e.inArray(n,t);return-1!==i?e.vakata.array_remove(t,i):t},function(){var t={},n=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},i=n(window.navigator.userAgent);i.browser&&(t[i.browser]=!0,t.version=i.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),e.vakata.browser=t}(),e.vakata.browser.msie&&8>e.vakata.browser.version&&(e.jstree.defaults.core.animation=0),function(e,t){e.vakata.json={encode:window.JSON.stringify,decode:window.JSON.parse}}(jQuery);var _=document.createElement("I");_.className="jstree-icon jstree-checkbox",e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0},e.jstree.plugins.checkbox=function(t,n){this.bind=function(){n.bind.call(this),this._data.checkbox.uto=!1,this.element.on("init.jstree",e.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked")},this)).on("loading.jstree",e.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),this.settings.checkbox.three_state&&this.element.on("changed.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)},this)).on("model.jstree",e.proxy(function(t,n){var i=this._model.data,s=i[n.parent],r=n.nodes,a=[],o,d,l,c,h,_;if(s.state.selected){for(d=0,l=r.length;l>d;d++)i[r[d]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(r)}else for(d=0,l=r.length;l>d;d++)if(i[r[d]].state.selected){for(c=0,h=i[r[d]].children_d.length;h>c;c++)i[i[r[d]].children_d[c]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(i[r[d]].children_d)}for(d=0,l=s.children_d.length;l>d;d++)i[s.children_d[d]].children.length||a.push(i[s.children_d[d]].parent);for(a=e.vakata.array_unique(a),c=0,h=a.length;h>c;c++){s=i[a[c]];while(s&&"#"!==s.id){for(o=0,d=0,l=s.children.length;l>d;d++)o+=i[s.children[d]].state.selected;if(o!==l)break;s.state.selected=!0,this._data.core.selected.push(s.id),_=this.get_node(s,!0),_&&_.length&&_.children(".jstree-anchor").addClass("jstree-clicked"),s=this.get_node(s.parent)}}this._data.core.selected=e.vakata.array_unique(this._data.core.selected)},this)).on("select_node.jstree",e.proxy(function(t,n){var i=n.node,s=this._model.data,r=this.get_node(i.parent),a=this.get_node(i,!0),o,d,l,c;for(this._data.core.selected=e.vakata.array_unique(this._data.core.selected.concat(i.children_d)),o=0,d=i.children_d.length;d>o;o++)s[i.children_d[o]].state.selected=!0;while(r&&"#"!==r.id){for(l=0,o=0,d=r.children.length;d>o;o++)l+=s[r.children[o]].state.selected;if(l!==d)break;r.state.selected=!0,this._data.core.selected.push(r.id),c=this.get_node(r,!0),c&&c.length&&c.children(".jstree-anchor").addClass("jstree-clicked"),r=this.get_node(r.parent)}a.length&&a.find(".jstree-anchor").addClass("jstree-clicked")},this)).on("deselect_node.jstree",e.proxy(function(t,n){var i=n.node,s=this.get_node(i,!0),r,a,o;for(r=0,a=i.children_d.length;a>r;r++)this._model.data[i.children_d[r]].state.selected=!1;for(r=0,a=i.parents.length;a>r;r++)this._model.data[i.parents[r]].state.selected=!1,o=this.get_node(i.parents[r],!0),o&&o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked");for(o=[],r=0,a=this._data.core.selected.length;a>r;r++)-1===e.inArray(this._data.core.selected[r],i.children_d)&&-1===e.inArray(this._data.core.selected[r],i.parents)&&o.push(this._data.core.selected[r]);this._data.core.selected=e.vakata.array_unique(o),s.length&&s.find(".jstree-anchor").removeClass("jstree-clicked")},this)).on("delete_node.jstree",e.proxy(function(e,t){var n=this.get_node(t.parent),i=this._model.data,s,r,a,o;while(n&&"#"!==n.id){for(a=0,s=0,r=n.children.length;r>s;s++)a+=i[n.children[s]].state.selected;if(a!==r)break;n.state.selected=!0,this._data.core.selected.push(n.id),o=this.get_node(n,!0),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked"),n=this.get_node(n.parent)}},this)).on("move_node.jstree",e.proxy(function(t,n){var i=n.is_multi,s=n.old_parent,r=this.get_node(n.parent),a=this._model.data,o,d,l,c,h;if(!i){o=this.get_node(s);while(o&&"#"!==o.id){for(d=0,l=0,c=o.children.length;c>l;l++)d+=a[o.children[l]].state.selected;if(d!==c)break;o.state.selected=!0,this._data.core.selected.push(o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").addClass("jstree-clicked"),o=this.get_node(o.parent)}}o=r;while(o&&"#"!==o.id){for(d=0,l=0,c=o.children.length;c>l;l++)d+=a[o.children[l]].state.selected;if(d===c)o.state.selected||(o.state.selected=!0,this._data.core.selected.push(o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").addClass("jstree-clicked"));else{if(!o.state.selected)break;o.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").removeClass("jstree-clicked")}o=this.get_node(o.parent)}},this))},this._undetermined=function(){var t,n,i=this._model.data,s=this._data.core.selected,r=[],a=this;for(t=0,n=s.length;n>t;t++)i[s[t]]&&i[s[t]].parents&&(r=r.concat(i[s[t]].parents));for(this.element.find(".jstree-closed").not(":has(ul)").each(function(){var e=a.get_node(this);!e.state.loaded&&e.original&&e.original.state&&e.original.state.undetermined&&e.original.state.undetermined===!0&&(r.push(e.id),r=r.concat(e.parents))}),r=e.vakata.array_unique(r),t=e.inArray("#",r),-1!==t&&(r=e.vakata.array_remove(r,t)),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),t=0,n=r.length;n>t;t++)i[r[t]].state.selected||(s=this.get_node(r[t],!0),s&&s.length&&s.children("a").children(".jstree-checkbox").addClass("jstree-undetermined"))},this.redraw_node=function(t,i,s){if(t=n.redraw_node.call(this,t,i,s)){var r=t.getElementsByTagName("A")[0];r.insertBefore(_.cloneNode(),r.childNodes[0])}return!s&&this.settings.checkbox.three_state&&(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.activate_node=function(t,i){return(this.settings.checkbox.whole_node||e(i.target).hasClass("jstree-checkbox"))&&(i.ctrlKey=!0),n.activate_node.call(this,t,i)},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.element.children("ul").removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.element.children("ul").addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,n){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.create_node(i,{},"last",function(e){setTimeout(function(){n.edit(e)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.edit(i)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.delete_node(n.get_selected()):n.delete_node(i)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.cut(n.get_selected()):n.cut(i)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.copy(n.get_selected()):n.copy(i)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.paste(i)}}}}}}},e.jstree.plugins.contextmenu=function(n,i){this.bind=function(){i.bind.call(this),this.element.on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e){e.preventDefault(),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){this._data.contextmenu.visible&&e.vakata.context.hide()},this)),e(document).on("context_hide.vakata",e.proxy(function(){this._data.contextmenu.visible=!1},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(n,i,s,r){if(n=this.get_node(n),!n||"#"===n.id)return!1;var a=this.settings.contextmenu,o=this.get_node(n,!0),d=o.children(".jstree-anchor"),l=!1,c=!1;(a.show_at_node||i===t||s===t)&&(l=d.offset(),i=l.left,s=l.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&(this.deselect_all(),this.select_node(n,!1,!1,r)),c=a.items,e.isFunction(c)&&(c=c.call(this,n,e.proxy(function(e){this._show_contextmenu(n,i,s,e)},this))),e.isPlainObject(c)&&this._show_contextmenu(n,i,s,c)},this._show_contextmenu=function(t,n,i,s){var r=this.get_node(t,!0),a=r.children(".jstree-anchor");e(document).one("context_show.vakata",e.proxy(function(t,n){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(i)},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(a,{x:n,y:i},s),this.trigger("show_contextmenu",{node:t,x:n,y:i})}},function(e){var n=!1,i={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(document).triggerHandler("context_"+t+".vakata",{reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_execute:function(t){return t=i.items[t],t&&(!t._disabled||e.isFunction(t._disabled)&&!t._disabled({item:t,reference:i.reference,element:i.element}))&&t.action?t.action.call(null,{item:t,reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}}):!1},_parse:function(n,s){if(!n)return!1;s||(i.html="",i.items=[]);var r="",a=!1,o;return s&&(r+=""),s||(i.html=r,e.vakata.context._trigger("parse")),r.length>10?r:!1},_show_submenu:function(t){if(t=e(t),t.length&&t.children("ul").length){var i=t.children("ul"),s=t.offset().left+t.outerWidth(),r=t.offset().top,a=i.width(),o=i.height(),d=e(window).width()+e(window).scrollLeft(),l=e(window).height()+e(window).scrollTop();n?t[0>s-(a+10+t.outerWidth())?"addClass":"removeClass"]("vakata-context-left"):t[s+a+10>d?"addClass":"removeClass"]("vakata-context-right"),r+o+10>l&&i.css("bottom","-1px"),i.show()}},show:function(t,s,r){var a,o,d,l,c,h,_,u,g=!0;switch(i.element&&i.element.length&&i.element.width(""),g){case!s&&!t:return!1;case!!s&&!!t:i.reference=t,i.position_x=s.x,i.position_y=s.y;break;case!s&&!!t:i.reference=t,a=t.offset(),i.position_x=a.left+t.outerHeight(),i.position_y=a.top;break;case!!s&&!t:i.position_x=s.x,i.position_y=s.y}t&&!r&&e(t).data("vakata_contextmenu")&&(r=e(t).data("vakata_contextmenu")),e.vakata.context._parse(r)&&i.element.html(i.html),i.items.length&&(o=i.element,d=i.position_x,l=i.position_y,c=o.width(),h=o.height(),_=e(window).width()+e(window).scrollLeft(),u=e(window).height()+e(window).scrollTop(),n&&(d-=o.outerWidth(),e(window).scrollLeft()+20>d&&(d=e(window).scrollLeft()+20)),d+c+20>_&&(d=_-(c+20)),l+h+20>u&&(l=u-(h+20)),i.element.css({left:d,top:l}).show().find("a:eq(0)").focus().parent().addClass("vakata-context-hover"),i.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){i.is_visible&&(i.element.hide().find("ul").hide().end().find(":focus").blur(),i.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){n="rtl"===e("body").css("direction");var t=!1;i.element=e("
    "),i.element.on("mouseenter","li",function(n){n.stopImmediatePropagation(),e.contains(this,n.relatedTarget)||(t&&clearTimeout(t),i.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(n){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(t=setTimeout(function(t){return function(){e.vakata.context.hide()}}(this),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(e){e.preventDefault()}).on("mouseup","a",function(t){e(this).blur().parent().hasClass("vakata-context-disabled")||e.vakata.context._execute(e(this).attr("rel"))===!1||e.vakata.context.hide()}).on("keydown","a",function(t){var n=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:i.is_visible&&(i.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:i.is_visible&&(i.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault();break;default:}}).on("keydown",function(e){e.preventDefault();var t=i.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.mouseup()}).appendTo("body"),e(document).on("mousedown",function(t){i.is_visible&&!e.contains(i.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata",function(e,t){i.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),n&&i.element.addClass("vakata-context-rtl").css("direction","rtl"),i.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0},e.jstree.plugins.dnd=function(n,i){this.bind=function(){i.bind.call(this),this.element.on("mousedown touchstart",".jstree-anchor",e.proxy(function(n){var i=this.get_node(n.target),s=this.is_selected(i)?this.get_selected().length:1;return i&&i.id&&"#"!==i.id&&(1===n.which||"touchstart"===n.type)&&(this.settings.dnd.is_draggable===!0||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i))?(this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(n,{jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:s>1?this.get_selected():[i.id]},'
    '+(s>1?s+" "+this.get_string("nodes"):this.get_text(n.currentTarget,!0))+'
    ')):t},this))}},e(function(){var n=!1,i=!1,s=e('
     
    ').hide().appendTo("body");e(document).bind("dnd_start.vakata",function(e,t){n=!1}).bind("dnd_move.vakata",function(r,a){if(i&&clearTimeout(i),a.data.jstree&&(!a.event.target.id||"jstree-marker"!==a.event.target.id)){var o=e.jstree.reference(a.event.target),d=!1,l=!1,c=!1,h,_,u,g,f,p,m,v,j,y,x,k;if(o&&o._data&&o._data.dnd)if(s.attr("class","jstree-"+o.get_theme()),a.helper.children().attr("class","jstree-"+o.get_theme()).find(".jstree-copy:eq(0)")[a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"show":"hide"](),a.event.target!==o.element[0]&&a.event.target!==o.get_container_ul()[0]||0!==o.get_container_ul().children().length){if(d=e(a.event.target).closest("a"),d&&d.length&&d.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(l=d.offset(),c=a.event.pageY-l.top,u=d.height(),p=u/3>c?["b","i","a"]:c>u-u/3?["a","i","b"]:c>u/2?["i","a","b"]:["i","b","a"],e.each(p,function(r,c){switch(c){case"b":h=l.left-6,_=l.top-5,g=o.get_parent(d),f=d.parent().index(); break;case"i":h=l.left-2,_=l.top-5+u/2+1,g=d.parent(),f=0;break;case"a":h=l.left-6,_=l.top-5+u,g=o.get_parent(d),f=d.parent().index()+1}for(m=!0,v=0,j=a.data.nodes.length;j>v;v++)if(y=a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"copy_node":"move_node",x=f,"move_node"===y&&"a"===c&&a.data.origin&&a.data.origin===o&&g===o.get_parent(a.data.nodes[v])&&(k=o.get_node(g),x>e.inArray(a.data.nodes[v],k.children)&&(x-=1)),m=m&&(o&&o.settings&&o.settings.dnd&&o.settings.dnd.check_while_dragging===!1||o.check(y,a.data.origin&&a.data.origin!==o?a.data.origin.get_node(a.data.nodes[v]):a.data.nodes[v],g,x)),!m)break;return m?("i"===c&&d.parent().is(".jstree-closed")&&o.settings.dnd.open_timeout&&(i=setTimeout(function(e,t){return function(){e.open_node(t)}}(o,d),o.settings.dnd.open_timeout)),n={ins:o,par:g,pos:f},s.css({left:h+"px",top:_+"px"}).show(),a.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),p=!0,!1):t}),p===!0))return}else{for(m=!0,v=0,j=a.data.nodes.length;j>v;v++)if(m=m&&o.check(a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"copy_node":"move_node",a.data.nodes[v],"#","last"),!m)break;if(m)return n={ins:o,par:"#",pos:"last"},s.hide(),a.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),t}n=!1,a.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),s.hide()}}).bind("dnd_scroll.vakata",function(e,t){t.data.jstree&&(s.hide(),n=!1,t.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(e,t){if(i&&clearTimeout(i),t.data.jstree&&(s.hide(),n)){var r,a,o=[];for(r=0,a=t.data.nodes.length;a>r;r++)o[r]=t.data.origin?t.data.origin.get_node(t.data.nodes[r]):t.data.nodes[r];n.ins[t.data.origin&&t.data.origin.settings.dnd.copy&&(t.event.metaKey||t.event.ctrlKey)?"copy_node":"move_node"](o,n.par,n.pos)}}).bind("keyup keydown",function(t,n){n=e.vakata.dnd._get(),n.data&&n.data.jstree&&n.helper.find(".jstree-copy:eq(0)")[n.data.origin&&n.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey)?"show":"hide"]()})}),function(e){e.fn.vakata_reverse=[].reverse;var n={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5},_trigger:function(t,n){var i=e.vakata.dnd._get();i.event=n,e(document).triggerHandler("dnd_"+t+".vakata",i)},_get:function(){return{data:n.data,element:n.element,helper:n.helper}},_clean:function(){n.helper&&n.helper.remove(),n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),n={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1},e(document).off("mousemove touchmove",e.vakata.dnd.drag),e(document).off("mouseup touchend",e.vakata.dnd.stop)},_scroll:function(t){if(!n.scroll_e||!n.scroll_l&&!n.scroll_t)return n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),!1;if(!n.scroll_i)return n.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(t===!0)return!1;var i=n.scroll_e.scrollTop(),s=n.scroll_e.scrollLeft();n.scroll_e.scrollTop(i+n.scroll_t*e.vakata.dnd.settings.scroll_speed),n.scroll_e.scrollLeft(s+n.scroll_l*e.vakata.dnd.settings.scroll_speed),(i!==n.scroll_e.scrollTop()||s!==n.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",n.scroll_e)},start:function(t,i,s){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.targetTouches&&t.originalEvent.targetTouches[0]&&(t.pageX=t.originalEvent.targetTouches[0].pageX,t.pageY=t.originalEvent.targetTouches[0].pageY,t.target=document.elementFromPoint(t.originalEvent.targetTouches[0].pageX-window.pageXOffset,t.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.MozUserSelect="none")}catch(r){}return n.init_x=t.pageX,n.init_y=t.pageY,n.data=i,n.is_down=!0,n.element=t.currentTarget,s!==!1&&(n.helper=e("
    ").html(s).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(i){if("touchmove"===i.type&&i.originalEvent&&i.originalEvent.targetTouches&&i.originalEvent.targetTouches[0]&&(i.pageX=i.originalEvent.targetTouches[0].pageX,i.pageY=i.originalEvent.targetTouches[0].pageY,i.target=document.elementFromPoint(i.originalEvent.targetTouches[0].pageX-window.pageXOffset,i.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_down){if(!n.is_drag){if(!(Math.abs(i.pageX-n.init_x)>e.vakata.dnd.settings.threshold||Math.abs(i.pageY-n.init_y)>e.vakata.dnd.settings.threshold))return;n.helper&&(n.helper.appendTo("body"),n.helper_w=n.helper.outerWidth()),n.is_drag=!0,e.vakata.dnd._trigger("start",i)}var s=!1,r=!1,a=!1,o=!1,d=!1,l=!1,c=!1,h=!1,_=!1,u=!1;n.scroll_t=0,n.scroll_l=0,n.scroll_e=!1,e(i.target).parentsUntil("body").addBack().vakata_reverse().filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var s=e(this),r=s.offset();return this.scrollHeight>this.offsetHeight&&(r.top+s.height()-i.pageYthis.offsetWidth&&(r.left+s.width()-i.pageXo&&i.pageY-co&&o-(i.pageY-c)l&&i.pageX-hl&&l-(i.pageX-h)a&&(_=a-50),d&&u+n.helper_w>d&&(u=d-(n.helper_w+2)),n.helper.css({left:u+"px",top:_+"px"})),e.vakata.dnd._trigger("move",i)}},stop:function(t){"touchend"===t.type&&t.originalEvent&&t.originalEvent.targetTouches&&t.originalEvent.targetTouches[0]&&(t.pageX=t.originalEvent.targetTouches[0].pageX,t.pageY=t.originalEvent.targetTouches[0].pageY,t.target=document.elementFromPoint(t.originalEvent.targetTouches[0].pageX-window.pageXOffset,t.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd._trigger("stop",t),e.vakata.dnd._clean()}}}(jQuery),e.jstree.defaults.search={ajax:!1,fuzzy:!0,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0},e.jstree.plugins.search=function(t,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.sln=null,this.settings.search.show_only_matches&&this.element.on("search.jstree",function(t,n){n.nodes.length&&(e(this).find("li").hide().filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last"),n.nodes.parentsUntil(".jstree").addBack().show().filter("ul").each(function(){e(this).children("li:visible").eq(-1).addClass("jstree-last")}))}).on("clear_search.jstree",function(t,n){n.nodes.length&&e(this).find("li").css("display","").filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last")})},this.search=function(t,n){if(t===!1||""===e.trim(t))return this.clear_search();var i=this.settings.search,s=i.ajax?e.extend({},i.ajax):!1,r=null,a=[],o=[],d,l;if(this._data.search.res.length&&this.clear_search(),!n&&s!==!1)return s.data||(s.data={}),s.data.str=t,e.ajax(i.ajax).done(e.proxy(function(n){n&&n.d&&(n=n.d),this._data.search.sln=e.isArray(n)?n:[],this._search_load(t)},this));if(this._data.search.str=t,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],r=new e.vakata.search(t,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),e.each(this._model.data,function(e,t){t.text&&r.search(t.text).isMatch&&(a.push(e),o=o.concat(t.parents))}),a.length){for(o=e.vakata.array_unique(o),this._search_open(o),d=0,l=a.length;l>d;d++)r=this.get_node(a[d],!0),r&&(this._data.search.dom=this._data.search.dom.add(r));this._data.search.res=a,this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:t,res:this._data.search.res})},this.clear_search=function(){this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"),this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this._search_open=function(t){var n=this;e.each(t.concat([]),function(e,i){i=document.getElementById(i),i&&n.is_closed(i)&&(n._data.search.opn.push(i.id),n.open_node(i,function(){n._search_open(t)},0))})},this._search_load=function(t){var n=!0,i=this,s=i._model.data;e.isArray(this._data.search.sln)&&(this._data.search.sln.length?(e.each(this._data.search.sln,function(r,a){s[a]&&(e.vakata.array_remove_item(i._data.search.sln,a),s[a].state.loaded||(i.load_node(a,function(e,n){n&&i._search_load(t)}),n=!1))}),n&&(this._data.search.sln=[],this._search_load(t))):(this._data.search.sln=null,this.search(t,!0)))}},function(e){e.vakata.search=function(e,t,n){n=n||{},n.fuzzy!==!1&&(n.fuzzy=!0),e=n.caseSensitive?e:e.toLowerCase();var i=n.location||0,s=n.distance||100,r=n.threshold||.6,a=e.length,o,d,l,c;return a>32&&(n.fuzzy=!1),n.fuzzy&&(o=1<n;n++)t[e.charAt(n)]=0;for(n=0;a>n;n++)t[e.charAt(n)]|=1<s;s++){g=0,f=p;while(f>g)_>=l(s,i+f)?g=f:p=f,f=Math.floor((p-g)/2+g);for(p=f,v=Math.max(1,i-f+1),j=Math.min(i+f,h)+a,y=Array(j+2),y[j+1]=(1<=v;c--)if(x=d[t.charAt(c-1)],y[c]=0===s?(1|y[c+1]<<1)&x:(1|y[c+1]<<1)&x|(1|(m[c+1]|m[c])<<1)|m[c+1],y[c]&o&&(k=l(s,c-1),_>=k)){if(_=k,u=c-1,b.push(u),!(u>i))break;v=Math.max(1,2*i-u)}if(l(s+1,i)>_)break;m=y}return{isMatch:u>=0,score:k}},t===!0?{search:c}:c(t)}}(jQuery),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,n){var i,s;if(t=this.get_node(t),t&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(i=0,s=t.children_d.length;s>i;i++)this.sort(t.children_d[i],!1)}};var u=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree",ttl:!1,filter:!1},e.jstree.plugins.state=function(t,n){this.bind=function(){n.bind.call(this);var t=e.proxy(function(){this.element.on(this.settings.state.events,e.proxy(function(){u&&clearTimeout(u),u=setTimeout(e.proxy(function(){this.save_state()},this),100)},this))},this);this.element.on("ready.jstree",e.proxy(function(e,n){this.element.one("restore_state.jstree",t),this.restore_state()||t()},this))},this.save_state=function(){var t={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,e.vakata.json.encode(t))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=e.vakata.json.decode(t)}catch(n){return!1}return t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl?!1:(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),t?(this.element.one("set_state.jstree",function(n,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0):!1)},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(jQuery),e.jstree.defaults.types={"#":{},"default":{}},e.jstree.plugins.types=function(n,i){this.init=function(t,n){if(n&&n.types&&n.types["default"])for(var s in n.types)"default"!==s&&"#"!==s&&n.types.hasOwnProperty(s)&&(n.types[s]=e.extend(!0,{},n.types["default"],n.types[s]));i.init.call(this,t,n),this._model.data["#"].type="#"},this.bind=function(){i.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,n){var i=this._model.data,s=n.nodes,r=this.settings.types,a,o,d="default";for(a=0,o=s.length;o>a;a++)d="default",i[s[a]].original&&i[s[a]].original.type&&r[i[s[a]].original.type]&&(d=i[s[a]].original.type),i[s[a]].data&&i[s[a]].data.jstree&&i[s[a]].data.jstree.type&&r[i[s[a]].data.jstree.type]&&(d=i[s[a]].data.jstree.type),i[s[a]].type=d,i[s[a]].icon===!0&&r[d].icon!==t&&(i[s[a]].icon=r[d].icon)},this))},this.get_json=function(t,n){var s,r,a=this._model.data,o=n?e.extend(!0,{},n,{no_id:!1}):{},d=i.get_json.call(this,t,o);if(d===!1)return!1;if(e.isArray(d))for(s=0,r=d.length;r>s;s++)d[s].type=d[s].id&&a[d[s].id]&&a[d[s].id].type?a[d[s].id].type:"default",n&&n.no_id&&(delete d[s].id,d[s].li_attr&&d[s].li_attr.id&&delete d[s].li_attr.id);else d.type=d.id&&a[d.id]&&a[d.id].type?a[d.id].type:"default",n&&n.no_id&&(delete d.id,d.li_attr&&d.li_attr.id&&delete d.li_attr.id);return d},this.check=function(n,s,r,a){if(i.check.call(this,n,s,r,a)===!1)return!1;s=s&&s.id?s:this.get_node(s),r=r&&r.id?r:this.get_node(r);var o=s&&s.id?e.jstree.reference(s.id):null,d,l,c,h;switch(o=o&&o._model&&o._model.data?o._model.data:null,n){case"create_node":case"move_node":case"copy_node":if("move_node"!==n||-1===e.inArray(s.id,r.children)){if(d=this.get_rules(r),d.max_children!==t&&-1!==d.max_children&&d.max_children===r.children.length)return!1;if(d.valid_children!==t&&-1!==d.valid_children&&-1===e.inArray(s.type,d.valid_children))return!1;if(o&&s.children_d&&s.parents){for(l=0,c=0,h=s.children_d.length;h>c;c++)l=Math.max(l,o[s.children_d[c]].parents.length);l=l-s.parents.length+1}0>=l&&(l=1);do{if(d.max_depth!==t&&-1!==d.max_depth&&l>d.max_depth)return!1;r=this.get_node(r.parent),d=this.get_rules(r),l++}while(r)}}return!0},this.get_rules=function(e){if(e=this.get_node(e),!e)return!1;var n=this.get_type(e,!0);return n.max_depth===t&&(n.max_depth=-1),n.max_children===t&&(n.max_children=-1),n.valid_children===t&&(n.valid_children=-1),n},this.get_type=function(t,n){return t=this.get_node(t),t?n?e.extend({type:t.type},this.settings.types[t.type]):t.type:!1},this.set_type=function(n,i){var s,r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.set_type(n[r],i);return!0}return s=this.settings.types,n=this.get_node(n),s[i]&&n?(o=n.type,d=this.get_icon(n),n.type=i,(d===!0||s[o]&&s[o].icon&&d===s[o].icon)&&this.set_icon(n,s[i].icon!==t?s[i].icon:!0),!0):!1}},e.jstree.plugins.unique=function(t,n){this.check=function(t,i,s,r){if(n.check.call(this,t,i,s,r)===!1)return!1;if(i=i&&i.id?i:this.get_node(i),s=s&&s.id?s:this.get_node(s),!s||!s.children)return!0;var a="rename_node"===t?r:i.text,o=[],d=this._model.data,l,c;for(l=0,c=s.children.length;c>l;l++)o.push(d[s.children[l]].text);switch(t){case"delete_node":return!0;case"rename_node":case"copy_node":return-1===e.inArray(a,o);case"move_node":return i.parent===s.id||-1===e.inArray(a,o)}return!0}};var g=document.createElement("DIV");g.setAttribute("unselectable","on"),g.className="jstree-wholerow",g.innerHTML=" ",e.jstree.plugins.wholerow=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("loading",e.proxy(function(){g.style.height=this._data.core.li_height+"px"},this)).on("ready.jstree set_state.jstree",e.proxy(function(){this.hide_dots()},this)).on("ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var n=!1,i,s;for(i=0,s=t.selected.length;s>i;i++)n=this.get_node(t.selected[i],!0),n&&n.length&&n.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).closest("li").children("a:eq(0)").trigger("contextmenu",t)},this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,i,s){if(t=n.redraw_node.call(this,t,i,s)){var r=g.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(r.className+=" jstree-wholerow-clicked"),t.insertBefore(r,t.childNodes[0])}return t}}}}); \ No newline at end of file diff --git a/docs/assets/dist/jstree.js b/docs/assets/dist/jstree.js index e77e8198..fe8a12a8 100644 --- a/docs/assets/dist/jstree.js +++ b/docs/assets/dist/jstree.js @@ -67,7 +67,7 @@ * specifies the jstree version in use * @name $.jstree.version */ - version : '3.0.0-beta6', + version : '3.0.0-beta7', /** * holds all the default options used when creating new instances * @name $.jstree.defaults diff --git a/docs/assets/dist/jstree.min.js b/docs/assets/dist/jstree.min.js index 2d295a04..f317af5a 100644 --- a/docs/assets/dist/jstree.min.js +++ b/docs/assets/dist/jstree.min.js @@ -1,4 +1,4 @@ -/*! jsTree - v3.0.0-beta6 - 2014-02-11 - (MIT) */ -(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e,t){"use strict";if(!e.jstree){var n=0,i=!1,s=!1,r=!1,a=[],o=e("script:last").attr("src"),d=document,l=d.createElement("LI"),c,h;l.setAttribute("role","treeitem"),c=d.createElement("I"),c.className="jstree-icon jstree-ocl",l.appendChild(c),c=d.createElement("A"),c.className="jstree-anchor",c.setAttribute("href","#"),h=d.createElement("I"),h.className="jstree-icon jstree-themeicon",c.appendChild(h),l.appendChild(c),c=h=null,e.jstree={version:"3.0.0-beta6",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):""},e.jstree.create=function(t,i){var s=new e.jstree.core(++n),r=i;return i=e.extend(!0,{},e.jstree.defaults,i),r&&r.plugins&&(i.plugins=r.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))}),s.init(t,i),s},e.jstree.core=function(e){this._id=e,this._cnt=0,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[]}}},e.jstree.reference=function(n){if(n&&!e(n).length){n.id&&(n=n.id);var i=null;return e(".jstree").each(function(){var s=e(this).data("jstree");return s&&s._model.data[n]?(i=s,!1):t}),i}return e(n).closest(".jstree").data("jstree")},e.fn.jstree=function(n){var i="string"==typeof n,s=Array.prototype.slice.call(arguments,1),r=null;return this.each(function(){var a=e.jstree.reference(this),o=i&&a?a[n]:null;return r=i&&o?o.apply(a,s):null,a||i||n!==t&&!e.isPlainObject(n)||e(this).data("jstree",new e.jstree.create(this,n)),a&&!i&&(r=a),null!==r&&r!==t?!1:t}),null!==r&&r!==t?r:this},e.expr[":"].jstree=e.expr.createPseudo(function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!0},expand_selected_onload:!0},e.jstree.core.prototype={plugin:function(t,n){var i=e.jstree.plugins[t];return i?(this._data[t]={},i.prototype=this,new i(n,this)):this},init:function(t,n){this._model={data:{"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,this.element.bind("destroyed",e.proxy(this.teardown,this)),this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("
    "),this._data.core.li_height=this.get_container_ul().children("li:eq(0)").height()||18,this.trigger("loading"),this.load_node("#")},destroy:function(){this.element.unbind("destroyed",this.teardown),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){this.element.on("dblclick.jstree",function(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var e=window.getSelection();try{e.removeAllRanges(),e.collapse()}catch(t){}}}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){var n=null;switch(t.which){case 13:case 32:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 38:t.preventDefault(),n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):(n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 40:t.preventDefault(),n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 46:t.preventDefault(),n=this.get_node(t.currentTarget),n&&n.id&&"#"!==n.id&&(n=this.is_selected(n)?this.get_selected():n);break;case 113:t.preventDefault(),n=this.get_node(t.currentTarget);break;default:}},this)).on("load_node.jstree",e.proxy(function(t,n){if(n.status&&("#"!==n.node.id||this._data.core.loaded||(this._data.core.loaded=!0,this.trigger("loaded")),!this._data.core.ready&&!this.get_container_ul().find(".jstree-loading:eq(0)").length)){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var i=[],s,r;for(s=0,r=this._data.core.selected.length;r>s;s++)i=i.concat(this._model.data[this._data.core.selected[s]].parents);for(i=e.vakata.array_unique(i),s=0,r=i.length;r>s;s++)this.open_node(i[s],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}setTimeout(e.proxy(function(){this.trigger("ready")},this),0)}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter()},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(document).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children("ul:eq(0)")},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){e=e?e.firstChild:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_nextSibling:function(e){e=e?e.nextSibling:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_previousSibling:function(e){e=e?e.previousSibling:null;while(null!==e&&1!==e.nodeType)e=e.previousSibling;return e},get_node:function(t,n){t&&t.id&&(t=t.id);var i;try{if(this._model.data[t])t=this._model.data[t];else if(((i=e(t,this.element)).length||(i=e("#"+t,this.element)).length)&&this._model.data[i.closest("li").attr("id")])t=this._model.data[i.closest("li").attr("id")];else{if(!(i=e(t,this.element)).length||!i.hasClass("jstree"))return!1;t=this._model.data["#"]}return n&&(t="#"===t.id?this.element:e(document.getElementById(t.id))),t}catch(s){return!1}},get_next_dom:function(t,n){var i;return t=this.get_node(t,!0),t[0]===this.element[0]?(i=this._firstChild(this.get_container_ul()[0]),i?e(i):!1):t&&t.length?n?(i=this._nextSibling(t[0]),i?e(i):!1):t.hasClass("jstree-open")?(i=this._firstChild(t.children("ul")[0]),i?e(i):!1):null!==(i=this._nextSibling(t[0]))?e(i):t.parentsUntil(".jstree","li").next("li").eq(0):!1},get_prev_dom:function(t,n){var i;if(t=this.get_node(t,!0),t[0]===this.element[0])return i=this.get_container_ul()[0].lastChild,i?e(i):!1;if(!t||!t.length)return!1;if(n)return i=this._previousSibling(t[0]),i?e(i):!1;if(null!==(i=this._previousSibling(t[0]))){t=e(i);while(t.hasClass("jstree-open"))t=t.children("ul:eq(0)").children("li:last");return t}return i=t[0].parentNode.parentNode,i&&"LI"===i.tagName?e(i):!1},get_parent:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.parent:!1},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children("li"):e&&e.length?e.children("ul").children("li"):!1},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e,!0),e&&e.hasClass("jstree-loading")},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var i,s;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.load_node(t[i],n);return!0}return(t=this.get_node(t))?(this.get_node(t,!0).addClass("jstree-loading"),this._load_node(t,e.proxy(function(e){t.state.loaded=e,this.get_node(t,!0).removeClass("jstree-loading"),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)},this)),!0):(n.call(this,t,!1),!1)},_load_node:function(n,i){var s=this.settings.core.data,r;return s?e.isFunction(s)?s.call(this,n,e.proxy(function(t){return t===!1?i.call(this,!1):i.call(this,this["string"==typeof t?"_append_html_data":"_append_json_data"](n,"string"==typeof t?e(t):t))},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,n)),e.isFunction(s.data)&&(s.data=s.data.call(this,n)),e.ajax(s).done(e.proxy(function(s,r,a){var o=a.getResponseHeader("Content-Type");return-1!==o.indexOf("json")?i.call(this,this._append_json_data(n,s)):-1!==o.indexOf("html")?i.call(this,this._append_html_data(n,e(s))):t},this)).fail(e.proxy(function(){i.call(this,!1)},this))):(r=e.isArray(s)||e.isPlainObject(s)?e.vakata.json.decode(e.vakata.json.encode(s)):s,i.call(this,this._append_json_data(n,r))):"string"==typeof s?i.call(this,this._append_html_data(n,s)):i.call(this,!1):i.call(this,"#"===n.id?this._append_html_data(n,this._data.core.original_container_html.clone(!0)):!1)},_node_changed:function(e){e=this.get_node(e),e&&this._model.changed.push(e.id)},_append_html_data:function(t,n){t=this.get_node(t),t.children=[],t.children_d=[];var i=n.is("ul")?n.children():n,s=t.id,r=[],a=[],o=this._model.data,d=o[s],l=this._data.core.selected.length,c,h,_;for(i.each(e.proxy(function(t,n){c=this._parse_model_from_html(e(n),s,d.parents.concat()),c&&(r.push(c),a.push(c),o[c].children_d.length&&(a=a.concat(o[c].children_d)))},this)),d.children=r,d.children_d=a,h=0,_=d.parents.length;_>h;h++)o[d.parents[h]].children_d=o[d.parents[h]].children_d.concat(a);return this.trigger("model",{nodes:a,parent:s}),"#"!==s?(this._node_changed(s),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==l&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_append_json_data:function(n,i){n=this.get_node(n),n.children=[],n.children_d=[];var s=i,r=n.id,a=[],o=[],d=this._model.data,l=d[r],c=this._data.core.selected.length,h,_,u;if(s.d&&(s=s.d,"string"==typeof s&&(s=e.vakata.json.decode(s))),e.isArray(s)||(s=[s]),s.length&&s[0].id!==t&&s[0].parent!==t){for(_=0,u=s.length;u>_;_++)s[_].children||(s[_].children=[]),d[s[_].id]=s[_];for(_=0,u=s.length;u>_;_++)d[s[_].parent].children.push(s[_].id),l.children_d.push(s[_].id);for(_=0,u=l.children.length;u>_;_++)h=this._parse_model_from_flat_json(d[l.children[_]],r,l.parents.concat()),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d))}else{for(_=0,u=s.length;u>_;_++)h=this._parse_model_from_json(s[_],r,l.parents.concat()),h&&(a.push(h),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d)));for(l.children=a,l.children_d=o,_=0,u=l.parents.length;u>_;_++)d[l.parents[_]].children_d=d[l.parents[_]].children_d.concat(o)}return this.trigger("model",{nodes:o,parent:r}),"#"!==r?(this._node_changed(r),this.redraw()):this.redraw(!0),this._data.core.selected.length!==c&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_parse_model_from_html:function(n,i,s){s=s?[].concat(s):[],i&&s.unshift(i);var r,a,o=this._model.data,d={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l,c,h;for(l in this._model.default_state)this._model.default_state.hasOwnProperty(l)&&(d.state[l]=this._model.default_state[l]);if(c=e.vakata.attributes(n,!0),e.each(c,function(n,i){return i=e.trim(i),i.length?(d.li_attr[n]=i,"id"===n&&(d.id=i),t):!0}),c=n.children("a").eq(0),c.length&&(c=e.vakata.attributes(c,!0),e.each(c,function(t,n){n=e.trim(n),n.length&&(d.a_attr[t]=n)})),c=n.children("a:eq(0)").length?n.children("a:eq(0)").clone():n.clone(),c.children("ins, i, ul").remove(),c=c.html(),c=e("
    ").html(c),d.text=c.html(),c=n.data(),d.data=c?e.extend(!0,{},c):null,d.state.opened=n.hasClass("jstree-open"),d.state.selected=n.children("a").hasClass("jstree-clicked"),d.state.disabled=n.children("a").hasClass("jstree-disabled"),d.data&&d.data.jstree)for(l in d.data.jstree)d.data.jstree.hasOwnProperty(l)&&(d.state[l]=d.data.jstree[l]);c=n.children("a").children(".jstree-themeicon"),c.length&&(d.icon=c.hasClass("jstree-themeicon-hidden")?!1:c.attr("rel")),d.state.icon&&(d.icon=d.state.icon),c=n.children("ul").children("li");do h="j"+this._id+"_"+ ++this._cnt;while(o[h]);return d.id=d.li_attr.id||h,c.length?(c.each(e.proxy(function(t,n){r=this._parse_model_from_html(e(n),d.id,s),a=this._model.data[r],d.children.push(r),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d))},this)),d.children_d=d.children_d.concat(d.children)):n.hasClass("jstree-closed")&&(d.state.loaded=!1),d.li_attr["class"]&&(d.li_attr["class"]=d.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),d.a_attr["class"]&&(d.a_attr["class"]=d.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),o[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_parse_model_from_flat_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=e.id,r=this._model.data,a=this._model.default_state,o,d,l,c,h={id:s,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:n,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in a)a.hasOwnProperty(o)&&(h.state[o]=a[o]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(o in e.data.jstree)e.data.jstree.hasOwnProperty(o)&&(h.state[o]=e.data.jstree[o]);if(e&&"object"==typeof e.state)for(o in e.state)e.state.hasOwnProperty(o)&&(h.state[o]=e.state[o]);if(e&&"object"==typeof e.li_attr)for(o in e.li_attr)e.li_attr.hasOwnProperty(o)&&(h.li_attr[o]=e.li_attr[o]);if(h.li_attr.id||(h.li_attr.id=s),e&&"object"==typeof e.a_attr)for(o in e.a_attr)e.a_attr.hasOwnProperty(o)&&(h.a_attr[o]=e.a_attr[o]);for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),r[h.id]=h,o=0,d=h.children.length;d>o;o++)l=this._parse_model_from_flat_json(r[h.children[o]],h.id,i),c=r[l],h.children_d.push(l),c.children_d.length&&(h.children_d=h.children_d.concat(c.children_d));return delete e.data,delete e.children,r[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=!1,r,a,o,d,l=this._model.data,c=this._model.default_state,h;do s="j"+this._id+"_"+ ++this._cnt;while(l[s]);h={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:n,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in c)c.hasOwnProperty(r)&&(h.state[r]=c[r]);if(e&&e.id&&(h.id=e.id),e&&e.text&&(h.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(h.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(h.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(h.li_attr[r]=e.li_attr[r]);if(h.li_attr.id&&!h.id&&(h.id=h.li_attr.id),h.id||(h.id=s),h.li_attr.id||(h.li_attr.id=h.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(h.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,a=e.children.length;a>r;r++)o=this._parse_model_from_json(e.children[r],h.id,i),d=l[o],h.children.push(o),d.children_d.length&&(h.children_d=h.children_d.concat(d.children_d));h.children_d=h.children_d.concat(h.children)}return e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),delete e.data,delete e.children,h.original=e,l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_redraw:function(){var e=this._model.force_full_redraw?this._model.data["#"].children.concat([]):this._model.changed.concat([]),t=document.createElement("UL"),n,i,s;for(i=0,s=e.length;s>i;i++)n=this.redraw_node(e[i],!0,this._model.force_full_redraw),n&&this._model.force_full_redraw&&t.appendChild(n);this._model.force_full_redraw&&(t.className=this.get_container_ul()[0].className,this.element.empty().append(t)),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:e})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},redraw_node:function(t,n,i){var s=this.get_node(t),r=!1,a=!1,o=!1,d=!1,c=!1,h=!1,_="",u=document,g=this._model.data;if(!s)return!1;if("#"===s.id)return this.redraw(!0);if(n=n||0===s.children.length,t=u.getElementById(s.id))t=e(t),i||(r=t.parent().parent()[0],r===this.element[0]&&(r=null),a=t.index()),n||!s.children.length||t.children("ul").length||(n=!0),n||(o=t.children("UL")[0]),t.remove();else if(n=!0,!i){if(r="#"!==s.parent?e("#"+s.parent,this.element)[0]:null,!(null===r||r&&g[s.parent].state.opened))return!1;a=e.inArray(s.id,null===r?g["#"].children:g[s.parent].children)}t=l.cloneNode(!0),_="jstree-node ";for(d in s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,s.li_attr[d]):_+=s.li_attr[d]}!s.children.length&&s.state.loaded?_+=" jstree-leaf":(_+=s.state.opened?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",s.state.opened)),null!==s.parent&&g[s.parent].children[g[s.parent].children.length-1]===s.id&&(_+=" jstree-last"),t.id=s.id,t.className=_,_=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":"");for(c in s.a_attr)if(s.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===s.a_attr[c])continue;"class"!==c?t.childNodes[1].setAttribute(c,s.a_attr[c]):_+=" "+s.a_attr[c]}if(_.length&&(t.childNodes[1].className="jstree-anchor "+_),(s.icon&&s.icon!==!0||s.icon===!1)&&(s.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage="url("+s.icon+")",t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),t.childNodes[1].innerHTML+=s.text,n&&s.children.length&&s.state.opened){for(h=u.createElement("UL"),h.setAttribute("role","group"),h.className="jstree-children",d=0,c=s.children.length;c>d;d++)h.appendChild(this.redraw_node(s.children[d],n,!0));t.appendChild(h)}return o&&t.appendChild(o),i||(r||(r=this.element[0]),r.getElementsByTagName("UL").length?r=r.getElementsByTagName("UL")[0]:(d=u.createElement("UL"),d.setAttribute("role","group"),d.className="jstree-children",r.appendChild(d),r=d),r.childNodes.length>a?r.insertBefore(t,r.childNodes[a]):r.appendChild(t)),t},open_node:function(n,i,s){var r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.open_node(n[r],i,s);return!0}if(n=this.get_node(n),!n||"#"===n.id)return!1;if(s=s===t?this.settings.core.animation:s,!this.is_closed(n))return i&&i.call(this,n,!1),!1;if(this.is_loaded(n))o=this.get_node(n,!0),d=this,o.length&&(n.children.length&&!this._firstChild(o.children("ul")[0])&&(n.state.opened=!0,this.redraw_node(n,!0),o=this.get_node(n,!0)),s?o.children("ul").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",d.trigger("after_open",{node:n})}):(o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),n.state.opened=!0,i&&i.call(this,n,!0),this.trigger("open_node",{node:n}),s&&o.length||this.trigger("after_open",{node:n});else{if(this.is_loading(n))return setTimeout(e.proxy(function(){this.open_node(n,i,s)},this),500);this.load_node(n,function(e,t){return t?this.open_node(e,i,s):i?i.call(this,e,!1):!1})}},_open_to:function(t){if(t=this.get_node(t),!t||"#"===t.id)return!1;var n,i,s=t.parents;for(n=0,i=s.length;i>n;n+=1)"#"!==n&&this.open_node(s[n],!1,0);return e(document.getElementById(t.id))},close_node:function(n,i){var s,r,a,o;if(e.isArray(n)){for(n=n.slice(),s=0,r=n.length;r>s;s++)this.close_node(n[s],i);return!0}return n=this.get_node(n),n&&"#"!==n.id?(i=i===t?this.settings.core.animation:i,a=this,o=this.get_node(n,!0),o.length&&(i?o.children("ul").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children("ul").stop(!0,!0).slideUp(i,function(){this.style.display="",o.children("ul").remove(),a.trigger("after_close",{node:n})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children("ul").remove())),n.state.opened=!1,this.trigger("close_node",{node:n}),i&&o.length||this.trigger("after_close",{node:n}),t):!1},toggle_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.toggle_node(n[i]);return!0}return this.is_closed(n)?this.open_node(n):this.is_open(n)?this.close_node(n):t},open_all:function(e,t,n){if(e||(e="#"),e=this.get_node(e),!e)return!1;var i="#"===e.id?this.get_container_ul():this.get_node(e,!0),s,r,a;if(!i.length){for(s=0,r=e.children_d.length;r>s;s++)this.is_closed(this._model.data[e.children_d[s]])&&(this._model.data[e.children_d[s]].state.opened=!0);return this.trigger("open_all",{node:e})}n=n||i,a=this,i=this.is_closed(e)?i.find("li.jstree-closed").addBack():i.find("li.jstree-closed"),i.each(function(){a.open_node(this,function(e,i){i&&this.is_parent(e)&&this.open_all(e,t,n)},t||0)}),0===n.find("li.jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(e,t){if(e||(e="#"),e=this.get_node(e),!e)return!1;var n="#"===e.id?this.get_container_ul():this.get_node(e,!0),i=this,s,r;if(!n.length){for(s=0,r=e.children_d.length;r>s;s++)this._model.data[e.children_d[s]].state.opened=!1;return this.trigger("close_all",{node:e})}n=this.is_open(e)?n.find("li.jstree-open").addBack():n.find("li.jstree-open"),n.vakata_reverse().each(function(){i.close_node(this,t||0)}),this.trigger("close_all",{node:e})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.enable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!1,this.get_node(n,!0).children(".jstree-anchor").removeClass("jstree-disabled"),this.trigger("enable_node",{node:n}),t):!1},disable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.disable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!0,this.get_node(n,!0).children(".jstree-anchor").addClass("jstree-disabled"),this.trigger("disable_node",{node:n}),t):!1},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&(!t.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(t.shiftKey){var n=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,r=!1,a,o;for(a=0,o=s.length;o>a;a+=1)s[a]===n&&(r=!r),s[a]===i&&(r=!r),r||s[a]===n||s[a]===i?this.select_node(s[a],!1,!1,t):this.deselect_node(s[a],!1,!1,t)}else this.is_selected(e)?this.deselect_node(e,!1,!1,t):this.select_node(e,!1,!1,t);else this.deselect_all(!0),this.select_node(e,!1,!1,t),this._data.core.last_clicked=this.get_node(e);this.trigger("activate_node",{node:this.get_node(e)})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered");t&&t.length&&this.dehover_node(t),e.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-hovered"),this.element.attr("aria-activedescendant",e[0].id),this.trigger("hover_node",{node:this.get_node(e)})},dehover_node:function(e){return e=this.get_node(e,!0),e&&e.length&&e.children(".jstree-hovered").length?(e.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)}),t):!1},select_node:function(n,i,s,r){var a,o,d,l;if(e.isArray(n)){for(n=n.slice(),o=0,d=n.length;d>o;o++)this.select_node(n[o],i,s,r);return!0}return n=this.get_node(n),n&&"#"!==n.id?(a=this.get_node(n,!0),n.state.selected||(n.state.selected=!0,this._data.core.selected.push(n.id),s||(a=this._open_to(n)),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:n,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"select_node",node:n,selected:this._data.core.selected,event:r})),t):!1},deselect_node:function(n,i,s){var r,a,o;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.deselect_node(n[r],i,s);return!0}return n=this.get_node(n),n&&"#"!==n.id?(o=this.get_node(n,!0),n.state.selected&&(n.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,n.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:n,selected:this._data.core.selected,event:s}),i||this.trigger("changed",{action:"deselect_node",node:n,selected:this._data.core.selected,event:s})),t):!1},select_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(this._data.core.selected=this._model.data["#"].children_d.concat(),n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),e||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:t})},deselect_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked"),this.trigger("deselect_all",{selected:this._data.core.selected,node:t}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:t})},is_selected:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.state.selected:!1},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected},get_state:function(){var e={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},t;for(t in this._model.data)this._model.data.hasOwnProperty(t)&&"#"!==t&&(this._model.data[t].state.opened&&e.core.open.push(t),this._model.data[t].state.selected&&e.core.selected.push(t));return e},set_state:function(n,i){if(n){if(n.core){var s,r,a,o;if(n.core.open)return e.isArray(n.core.open)?(s=!0,r=!1,a=this,e.each(n.core.open.concat([]),function(t,i){r=a.get_node(i),r&&(a.is_loaded(i)?(a.is_closed(i)&&a.open_node(i,!1,0),n&&n.core&&n.core.open&&e.vakata.array_remove_item(n.core.open,i)):(a.is_loading(i)||a.open_node(i,e.proxy(function(){this.set_state(n)},a),0),s=!1))}),s&&(delete n.core.open,this.set_state(n,i)),!1):(delete n.core.open,this.set_state(n,i),!1);if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,i),!1;if(n.core.selected)return o=this,this.deselect_all(),e.each(n.core.selected,function(e,t){o.select_node(t)}),delete n.core.selected,this.set_state(n,i),!1;if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,i),!1}return e.isEmptyObject(n)?(n=null,i&&i.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(){this._data.core.state=this.get_state(),this._cnt=0,this._model.data={"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},this.element.html(""),this.load_node("#",function(t,n){n&&this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}),this._data.core.state=null})},set_id:function(t,n){if(t=this.get_node(t),!t||"#"===t.id)return!1;var i,s,r=this._model.data;for(r[t.parent].children[e.inArray(t.id,r[t.parent].children)]=n,i=0,s=t.parents.length;s>i;i++)r[t.parents[i]].children_d[e.inArray(t.id,r[t.parents[i]].children_d)]=n;for(i=0,s=t.children.length;s>i;i++)r[t.children[i]].parent=n;for(i=0,s=t.children_d.length;s>i;i++)r[t.children_d[i]].parents[e.inArray(t.id,r[t.children_d[i]].parents)]=n;return i=e.inArray(t.id,this._data.core.selected),-1!==i&&(this._data.core.selected[i]=n),i=this.get_node(t.id,!0),i&&i.attr("id",n),delete r[t.id],t.id=n,r[n]=t,!0},get_text:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.text:!1},set_text:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_text(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(t.text=n,r=this.get_node(t,!0),r.length&&(r=r.children(".jstree-anchor:eq(0)"),a=r.children("I").clone(),r.html(n).prepend(a),this.trigger("set_text",{obj:t,text:n})),!0):!1},get_json:function(e,t,n){if(e=this.get_node(e||"#"),!e)return!1;t.flat&&!n&&(n=[]);var i={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:e.li_attr,a_attr:e.a_attr,state:{},data:t&&t.no_data?!1:e.data},s,r;if(t.flat?i.parent=e.parent:i.children=[],!t||!t.no_state)for(s in e.state)e.state.hasOwnProperty(s)&&(i.state[s]=e.state[s]);if(t&&t.no_id&&(delete i.id,i.li_attr&&i.li_attr.id&&delete i.li_attr.id),t.flat&&"#"!==e.id&&n.push(i),!t||!t.no_children)for(s=0,r=e.children.length;r>s;s++)t.flat?this.get_json(e.children[s],t,n):i.children.push(this.get_json(e.children[s],t)); +/*! jsTree - v3.0.0-beta7 - 2014-02-11 - (MIT) */ +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e,t){"use strict";if(!e.jstree){var n=0,i=!1,s=!1,r=!1,a=[],o=e("script:last").attr("src"),d=document,l=d.createElement("LI"),c,h;l.setAttribute("role","treeitem"),c=d.createElement("I"),c.className="jstree-icon jstree-ocl",l.appendChild(c),c=d.createElement("A"),c.className="jstree-anchor",c.setAttribute("href","#"),h=d.createElement("I"),h.className="jstree-icon jstree-themeicon",c.appendChild(h),l.appendChild(c),c=h=null,e.jstree={version:"3.0.0-beta7",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):""},e.jstree.create=function(t,i){var s=new e.jstree.core(++n),r=i;return i=e.extend(!0,{},e.jstree.defaults,i),r&&r.plugins&&(i.plugins=r.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))}),s.init(t,i),s},e.jstree.core=function(e){this._id=e,this._cnt=0,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[]}}},e.jstree.reference=function(n){if(n&&!e(n).length){n.id&&(n=n.id);var i=null;return e(".jstree").each(function(){var s=e(this).data("jstree");return s&&s._model.data[n]?(i=s,!1):t}),i}return e(n).closest(".jstree").data("jstree")},e.fn.jstree=function(n){var i="string"==typeof n,s=Array.prototype.slice.call(arguments,1),r=null;return this.each(function(){var a=e.jstree.reference(this),o=i&&a?a[n]:null;return r=i&&o?o.apply(a,s):null,a||i||n!==t&&!e.isPlainObject(n)||e(this).data("jstree",new e.jstree.create(this,n)),a&&!i&&(r=a),null!==r&&r!==t?!1:t}),null!==r&&r!==t?r:this},e.expr[":"].jstree=e.expr.createPseudo(function(n){return function(n){return e(n).hasClass("jstree")&&e(n).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!0},expand_selected_onload:!0},e.jstree.core.prototype={plugin:function(t,n){var i=e.jstree.plugins[t];return i?(this._data[t]={},i.prototype=this,new i(n,this)):this},init:function(t,n){this._model={data:{"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=n,this.element.bind("destroyed",e.proxy(this.teardown,this)),this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this._data.core.li_height=this.get_container_ul().children("li:eq(0)").height()||18,this.trigger("loading"),this.load_node("#")},destroy:function(){this.element.unbind("destroyed",this.teardown),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){this.element.on("dblclick.jstree",function(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var e=window.getSelection();try{e.removeAllRanges(),e.collapse()}catch(t){}}}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){var n=null;switch(t.which){case 13:case 32:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 38:t.preventDefault(),n=this.get_prev_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):(n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus());break;case 40:t.preventDefault(),n=this.get_next_dom(t.currentTarget),n&&n.length&&n.children(".jstree-anchor").focus();break;case 46:t.preventDefault(),n=this.get_node(t.currentTarget),n&&n.id&&"#"!==n.id&&(n=this.is_selected(n)?this.get_selected():n);break;case 113:t.preventDefault(),n=this.get_node(t.currentTarget);break;default:}},this)).on("load_node.jstree",e.proxy(function(t,n){if(n.status&&("#"!==n.node.id||this._data.core.loaded||(this._data.core.loaded=!0,this.trigger("loaded")),!this._data.core.ready&&!this.get_container_ul().find(".jstree-loading:eq(0)").length)){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var i=[],s,r;for(s=0,r=this._data.core.selected.length;r>s;s++)i=i.concat(this._model.data[this._data.core.selected[s]].parents);for(i=e.vakata.array_unique(i),s=0,r=i.length;r>s;s++)this.open_node(i[s],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}setTimeout(e.proxy(function(){this.trigger("ready")},this),0)}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter()},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(document).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children("ul:eq(0)")},get_string:function(t){var n=this.settings.core.strings;return e.isFunction(n)?n.call(this,t):n&&n[t]?n[t]:t},_firstChild:function(e){e=e?e.firstChild:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_nextSibling:function(e){e=e?e.nextSibling:null;while(null!==e&&1!==e.nodeType)e=e.nextSibling;return e},_previousSibling:function(e){e=e?e.previousSibling:null;while(null!==e&&1!==e.nodeType)e=e.previousSibling;return e},get_node:function(t,n){t&&t.id&&(t=t.id);var i;try{if(this._model.data[t])t=this._model.data[t];else if(((i=e(t,this.element)).length||(i=e("#"+t,this.element)).length)&&this._model.data[i.closest("li").attr("id")])t=this._model.data[i.closest("li").attr("id")];else{if(!(i=e(t,this.element)).length||!i.hasClass("jstree"))return!1;t=this._model.data["#"]}return n&&(t="#"===t.id?this.element:e(document.getElementById(t.id))),t}catch(s){return!1}},get_next_dom:function(t,n){var i;return t=this.get_node(t,!0),t[0]===this.element[0]?(i=this._firstChild(this.get_container_ul()[0]),i?e(i):!1):t&&t.length?n?(i=this._nextSibling(t[0]),i?e(i):!1):t.hasClass("jstree-open")?(i=this._firstChild(t.children("ul")[0]),i?e(i):!1):null!==(i=this._nextSibling(t[0]))?e(i):t.parentsUntil(".jstree","li").next("li").eq(0):!1},get_prev_dom:function(t,n){var i;if(t=this.get_node(t,!0),t[0]===this.element[0])return i=this.get_container_ul()[0].lastChild,i?e(i):!1;if(!t||!t.length)return!1;if(n)return i=this._previousSibling(t[0]),i?e(i):!1;if(null!==(i=this._previousSibling(t[0]))){t=e(i);while(t.hasClass("jstree-open"))t=t.children("ul:eq(0)").children("li:last");return t}return i=t[0].parentNode.parentNode,i&&"LI"===i.tagName?e(i):!1},get_parent:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.parent:!1},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children("li"):e&&e.length?e.children("ul").children("li"):!1},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e,!0),e&&e.hasClass("jstree-loading")},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,n){var i,s;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.load_node(t[i],n);return!0}return(t=this.get_node(t))?(this.get_node(t,!0).addClass("jstree-loading"),this._load_node(t,e.proxy(function(e){t.state.loaded=e,this.get_node(t,!0).removeClass("jstree-loading"),this.trigger("load_node",{node:t,status:e}),n&&n.call(this,t,e)},this)),!0):(n.call(this,t,!1),!1)},_load_node:function(n,i){var s=this.settings.core.data,r;return s?e.isFunction(s)?s.call(this,n,e.proxy(function(t){return t===!1?i.call(this,!1):i.call(this,this["string"==typeof t?"_append_html_data":"_append_json_data"](n,"string"==typeof t?e(t):t))},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,n)),e.isFunction(s.data)&&(s.data=s.data.call(this,n)),e.ajax(s).done(e.proxy(function(s,r,a){var o=a.getResponseHeader("Content-Type");return-1!==o.indexOf("json")?i.call(this,this._append_json_data(n,s)):-1!==o.indexOf("html")?i.call(this,this._append_html_data(n,e(s))):t},this)).fail(e.proxy(function(){i.call(this,!1)},this))):(r=e.isArray(s)||e.isPlainObject(s)?e.vakata.json.decode(e.vakata.json.encode(s)):s,i.call(this,this._append_json_data(n,r))):"string"==typeof s?i.call(this,this._append_html_data(n,s)):i.call(this,!1):i.call(this,"#"===n.id?this._append_html_data(n,this._data.core.original_container_html.clone(!0)):!1)},_node_changed:function(e){e=this.get_node(e),e&&this._model.changed.push(e.id)},_append_html_data:function(t,n){t=this.get_node(t),t.children=[],t.children_d=[];var i=n.is("ul")?n.children():n,s=t.id,r=[],a=[],o=this._model.data,d=o[s],l=this._data.core.selected.length,c,h,_;for(i.each(e.proxy(function(t,n){c=this._parse_model_from_html(e(n),s,d.parents.concat()),c&&(r.push(c),a.push(c),o[c].children_d.length&&(a=a.concat(o[c].children_d)))},this)),d.children=r,d.children_d=a,h=0,_=d.parents.length;_>h;h++)o[d.parents[h]].children_d=o[d.parents[h]].children_d.concat(a);return this.trigger("model",{nodes:a,parent:s}),"#"!==s?(this._node_changed(s),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==l&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_append_json_data:function(n,i){n=this.get_node(n),n.children=[],n.children_d=[];var s=i,r=n.id,a=[],o=[],d=this._model.data,l=d[r],c=this._data.core.selected.length,h,_,u;if(s.d&&(s=s.d,"string"==typeof s&&(s=e.vakata.json.decode(s))),e.isArray(s)||(s=[s]),s.length&&s[0].id!==t&&s[0].parent!==t){for(_=0,u=s.length;u>_;_++)s[_].children||(s[_].children=[]),d[s[_].id]=s[_];for(_=0,u=s.length;u>_;_++)d[s[_].parent].children.push(s[_].id),l.children_d.push(s[_].id);for(_=0,u=l.children.length;u>_;_++)h=this._parse_model_from_flat_json(d[l.children[_]],r,l.parents.concat()),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d))}else{for(_=0,u=s.length;u>_;_++)h=this._parse_model_from_json(s[_],r,l.parents.concat()),h&&(a.push(h),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d)));for(l.children=a,l.children_d=o,_=0,u=l.parents.length;u>_;_++)d[l.parents[_]].children_d=d[l.parents[_]].children_d.concat(o)}return this.trigger("model",{nodes:o,parent:r}),"#"!==r?(this._node_changed(r),this.redraw()):this.redraw(!0),this._data.core.selected.length!==c&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!0},_parse_model_from_html:function(n,i,s){s=s?[].concat(s):[],i&&s.unshift(i);var r,a,o=this._model.data,d={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l,c,h;for(l in this._model.default_state)this._model.default_state.hasOwnProperty(l)&&(d.state[l]=this._model.default_state[l]);if(c=e.vakata.attributes(n,!0),e.each(c,function(n,i){return i=e.trim(i),i.length?(d.li_attr[n]=i,"id"===n&&(d.id=i),t):!0}),c=n.children("a").eq(0),c.length&&(c=e.vakata.attributes(c,!0),e.each(c,function(t,n){n=e.trim(n),n.length&&(d.a_attr[t]=n)})),c=n.children("a:eq(0)").length?n.children("a:eq(0)").clone():n.clone(),c.children("ins, i, ul").remove(),c=c.html(),c=e("
    ").html(c),d.text=c.html(),c=n.data(),d.data=c?e.extend(!0,{},c):null,d.state.opened=n.hasClass("jstree-open"),d.state.selected=n.children("a").hasClass("jstree-clicked"),d.state.disabled=n.children("a").hasClass("jstree-disabled"),d.data&&d.data.jstree)for(l in d.data.jstree)d.data.jstree.hasOwnProperty(l)&&(d.state[l]=d.data.jstree[l]);c=n.children("a").children(".jstree-themeicon"),c.length&&(d.icon=c.hasClass("jstree-themeicon-hidden")?!1:c.attr("rel")),d.state.icon&&(d.icon=d.state.icon),c=n.children("ul").children("li");do h="j"+this._id+"_"+ ++this._cnt;while(o[h]);return d.id=d.li_attr.id||h,c.length?(c.each(e.proxy(function(t,n){r=this._parse_model_from_html(e(n),d.id,s),a=this._model.data[r],d.children.push(r),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d))},this)),d.children_d=d.children_d.concat(d.children)):n.hasClass("jstree-closed")&&(d.state.loaded=!1),d.li_attr["class"]&&(d.li_attr["class"]=d.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),d.a_attr["class"]&&(d.a_attr["class"]=d.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),o[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_parse_model_from_flat_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=e.id,r=this._model.data,a=this._model.default_state,o,d,l,c,h={id:s,text:e.text||"",icon:e.icon!==t?e.icon:!0,parent:n,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in a)a.hasOwnProperty(o)&&(h.state[o]=a[o]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(o in e.data.jstree)e.data.jstree.hasOwnProperty(o)&&(h.state[o]=e.data.jstree[o]);if(e&&"object"==typeof e.state)for(o in e.state)e.state.hasOwnProperty(o)&&(h.state[o]=e.state[o]);if(e&&"object"==typeof e.li_attr)for(o in e.li_attr)e.li_attr.hasOwnProperty(o)&&(h.li_attr[o]=e.li_attr[o]);if(h.li_attr.id||(h.li_attr.id=s),e&&"object"==typeof e.a_attr)for(o in e.a_attr)e.a_attr.hasOwnProperty(o)&&(h.a_attr[o]=e.a_attr[o]);for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),r[h.id]=h,o=0,d=h.children.length;d>o;o++)l=this._parse_model_from_flat_json(r[h.children[o]],h.id,i),c=r[l],h.children_d.push(l),c.children_d.length&&(h.children_d=h.children_d.concat(c.children_d));return delete e.data,delete e.children,r[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,n,i){i=i?i.concat():[],n&&i.unshift(n);var s=!1,r,a,o,d,l=this._model.data,c=this._model.default_state,h;do s="j"+this._id+"_"+ ++this._cnt;while(l[s]);h={id:!1,text:"string"==typeof e?e:"",icon:"object"==typeof e&&e.icon!==t?e.icon:!0,parent:n,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in c)c.hasOwnProperty(r)&&(h.state[r]=c[r]);if(e&&e.id&&(h.id=e.id),e&&e.text&&(h.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),e&&e.data&&(h.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(h.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(h.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(h.li_attr[r]=e.li_attr[r]);if(h.li_attr.id&&!h.id&&(h.id=h.li_attr.id),h.id||(h.id=s),h.li_attr.id||(h.li_attr.id=h.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(h.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,a=e.children.length;a>r;r++)o=this._parse_model_from_json(e.children[r],h.id,i),d=l[o],h.children.push(o),d.children_d.length&&(h.children_d=h.children_d.concat(d.children_d));h.children_d=h.children_d.concat(h.children)}return e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),delete e.data,delete e.children,h.original=e,l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_redraw:function(){var e=this._model.force_full_redraw?this._model.data["#"].children.concat([]):this._model.changed.concat([]),t=document.createElement("UL"),n,i,s;for(i=0,s=e.length;s>i;i++)n=this.redraw_node(e[i],!0,this._model.force_full_redraw),n&&this._model.force_full_redraw&&t.appendChild(n);this._model.force_full_redraw&&(t.className=this.get_container_ul()[0].className,this.element.empty().append(t)),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:e})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},redraw_node:function(t,n,i){var s=this.get_node(t),r=!1,a=!1,o=!1,d=!1,c=!1,h=!1,_="",u=document,g=this._model.data;if(!s)return!1;if("#"===s.id)return this.redraw(!0);if(n=n||0===s.children.length,t=u.getElementById(s.id))t=e(t),i||(r=t.parent().parent()[0],r===this.element[0]&&(r=null),a=t.index()),n||!s.children.length||t.children("ul").length||(n=!0),n||(o=t.children("UL")[0]),t.remove();else if(n=!0,!i){if(r="#"!==s.parent?e("#"+s.parent,this.element)[0]:null,!(null===r||r&&g[s.parent].state.opened))return!1;a=e.inArray(s.id,null===r?g["#"].children:g[s.parent].children)}t=l.cloneNode(!0),_="jstree-node ";for(d in s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,s.li_attr[d]):_+=s.li_attr[d]}!s.children.length&&s.state.loaded?_+=" jstree-leaf":(_+=s.state.opened?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",s.state.opened)),null!==s.parent&&g[s.parent].children[g[s.parent].children.length-1]===s.id&&(_+=" jstree-last"),t.id=s.id,t.className=_,_=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":"");for(c in s.a_attr)if(s.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===s.a_attr[c])continue;"class"!==c?t.childNodes[1].setAttribute(c,s.a_attr[c]):_+=" "+s.a_attr[c]}if(_.length&&(t.childNodes[1].className="jstree-anchor "+_),(s.icon&&s.icon!==!0||s.icon===!1)&&(s.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage="url("+s.icon+")",t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),t.childNodes[1].innerHTML+=s.text,n&&s.children.length&&s.state.opened){for(h=u.createElement("UL"),h.setAttribute("role","group"),h.className="jstree-children",d=0,c=s.children.length;c>d;d++)h.appendChild(this.redraw_node(s.children[d],n,!0));t.appendChild(h)}return o&&t.appendChild(o),i||(r||(r=this.element[0]),r.getElementsByTagName("UL").length?r=r.getElementsByTagName("UL")[0]:(d=u.createElement("UL"),d.setAttribute("role","group"),d.className="jstree-children",r.appendChild(d),r=d),r.childNodes.length>a?r.insertBefore(t,r.childNodes[a]):r.appendChild(t)),t},open_node:function(n,i,s){var r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.open_node(n[r],i,s);return!0}if(n=this.get_node(n),!n||"#"===n.id)return!1;if(s=s===t?this.settings.core.animation:s,!this.is_closed(n))return i&&i.call(this,n,!1),!1;if(this.is_loaded(n))o=this.get_node(n,!0),d=this,o.length&&(n.children.length&&!this._firstChild(o.children("ul")[0])&&(n.state.opened=!0,this.redraw_node(n,!0),o=this.get_node(n,!0)),s?o.children("ul").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",d.trigger("after_open",{node:n})}):(o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),n.state.opened=!0,i&&i.call(this,n,!0),this.trigger("open_node",{node:n}),s&&o.length||this.trigger("after_open",{node:n});else{if(this.is_loading(n))return setTimeout(e.proxy(function(){this.open_node(n,i,s)},this),500);this.load_node(n,function(e,t){return t?this.open_node(e,i,s):i?i.call(this,e,!1):!1})}},_open_to:function(t){if(t=this.get_node(t),!t||"#"===t.id)return!1;var n,i,s=t.parents;for(n=0,i=s.length;i>n;n+=1)"#"!==n&&this.open_node(s[n],!1,0);return e(document.getElementById(t.id))},close_node:function(n,i){var s,r,a,o;if(e.isArray(n)){for(n=n.slice(),s=0,r=n.length;r>s;s++)this.close_node(n[s],i);return!0}return n=this.get_node(n),n&&"#"!==n.id?(i=i===t?this.settings.core.animation:i,a=this,o=this.get_node(n,!0),o.length&&(i?o.children("ul").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children("ul").stop(!0,!0).slideUp(i,function(){this.style.display="",o.children("ul").remove(),a.trigger("after_close",{node:n})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children("ul").remove())),n.state.opened=!1,this.trigger("close_node",{node:n}),i&&o.length||this.trigger("after_close",{node:n}),t):!1},toggle_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.toggle_node(n[i]);return!0}return this.is_closed(n)?this.open_node(n):this.is_open(n)?this.close_node(n):t},open_all:function(e,t,n){if(e||(e="#"),e=this.get_node(e),!e)return!1;var i="#"===e.id?this.get_container_ul():this.get_node(e,!0),s,r,a;if(!i.length){for(s=0,r=e.children_d.length;r>s;s++)this.is_closed(this._model.data[e.children_d[s]])&&(this._model.data[e.children_d[s]].state.opened=!0);return this.trigger("open_all",{node:e})}n=n||i,a=this,i=this.is_closed(e)?i.find("li.jstree-closed").addBack():i.find("li.jstree-closed"),i.each(function(){a.open_node(this,function(e,i){i&&this.is_parent(e)&&this.open_all(e,t,n)},t||0)}),0===n.find("li.jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(e,t){if(e||(e="#"),e=this.get_node(e),!e)return!1;var n="#"===e.id?this.get_container_ul():this.get_node(e,!0),i=this,s,r;if(!n.length){for(s=0,r=e.children_d.length;r>s;s++)this._model.data[e.children_d[s]].state.opened=!1;return this.trigger("close_all",{node:e})}n=this.is_open(e)?n.find("li.jstree-open").addBack():n.find("li.jstree-open"),n.vakata_reverse().each(function(){i.close_node(this,t||0)}),this.trigger("close_all",{node:e})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.enable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!1,this.get_node(n,!0).children(".jstree-anchor").removeClass("jstree-disabled"),this.trigger("enable_node",{node:n}),t):!1},disable_node:function(n){var i,s;if(e.isArray(n)){for(n=n.slice(),i=0,s=n.length;s>i;i++)this.disable_node(n[i]);return!0}return n=this.get_node(n),n&&"#"!==n.id?(n.state.disabled=!0,this.get_node(n,!0).children(".jstree-anchor").addClass("jstree-disabled"),this.trigger("disable_node",{node:n}),t):!1},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&(!t.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(t.shiftKey){var n=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,r=!1,a,o;for(a=0,o=s.length;o>a;a+=1)s[a]===n&&(r=!r),s[a]===i&&(r=!r),r||s[a]===n||s[a]===i?this.select_node(s[a],!1,!1,t):this.deselect_node(s[a],!1,!1,t)}else this.is_selected(e)?this.deselect_node(e,!1,!1,t):this.select_node(e,!1,!1,t);else this.deselect_all(!0),this.select_node(e,!1,!1,t),this._data.core.last_clicked=this.get_node(e);this.trigger("activate_node",{node:this.get_node(e)})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered");t&&t.length&&this.dehover_node(t),e.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-hovered"),this.element.attr("aria-activedescendant",e[0].id),this.trigger("hover_node",{node:this.get_node(e)})},dehover_node:function(e){return e=this.get_node(e,!0),e&&e.length&&e.children(".jstree-hovered").length?(e.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)}),t):!1},select_node:function(n,i,s,r){var a,o,d,l;if(e.isArray(n)){for(n=n.slice(),o=0,d=n.length;d>o;o++)this.select_node(n[o],i,s,r);return!0}return n=this.get_node(n),n&&"#"!==n.id?(a=this.get_node(n,!0),n.state.selected||(n.state.selected=!0,this._data.core.selected.push(n.id),s||(a=this._open_to(n)),a&&a.length&&a.children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:n,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"select_node",node:n,selected:this._data.core.selected,event:r})),t):!1},deselect_node:function(n,i,s){var r,a,o;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.deselect_node(n[r],i,s);return!0}return n=this.get_node(n),n&&"#"!==n.id?(o=this.get_node(n,!0),n.state.selected&&(n.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,n.id),o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:n,selected:this._data.core.selected,event:s}),i||this.trigger("changed",{action:"deselect_node",node:n,selected:this._data.core.selected,event:s})),t):!1},select_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(this._data.core.selected=this._model.data["#"].children_d.concat(),n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),e||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:t})},deselect_all:function(e){var t=this._data.core.selected.concat([]),n,i;for(n=0,i=this._data.core.selected.length;i>n;n++)this._model.data[this._data.core.selected[n]]&&(this._model.data[this._data.core.selected[n]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked"),this.trigger("deselect_all",{selected:this._data.core.selected,node:t}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:t})},is_selected:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.state.selected:!1},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected},get_state:function(){var e={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},t;for(t in this._model.data)this._model.data.hasOwnProperty(t)&&"#"!==t&&(this._model.data[t].state.opened&&e.core.open.push(t),this._model.data[t].state.selected&&e.core.selected.push(t));return e},set_state:function(n,i){if(n){if(n.core){var s,r,a,o;if(n.core.open)return e.isArray(n.core.open)?(s=!0,r=!1,a=this,e.each(n.core.open.concat([]),function(t,i){r=a.get_node(i),r&&(a.is_loaded(i)?(a.is_closed(i)&&a.open_node(i,!1,0),n&&n.core&&n.core.open&&e.vakata.array_remove_item(n.core.open,i)):(a.is_loading(i)||a.open_node(i,e.proxy(function(){this.set_state(n)},a),0),s=!1))}),s&&(delete n.core.open,this.set_state(n,i)),!1):(delete n.core.open,this.set_state(n,i),!1);if(n.core.scroll)return n.core.scroll&&n.core.scroll.left!==t&&this.element.scrollLeft(n.core.scroll.left),n.core.scroll&&n.core.scroll.top!==t&&this.element.scrollTop(n.core.scroll.top),delete n.core.scroll,this.set_state(n,i),!1;if(n.core.selected)return o=this,this.deselect_all(),e.each(n.core.selected,function(e,t){o.select_node(t)}),delete n.core.selected,this.set_state(n,i),!1;if(e.isEmptyObject(n.core))return delete n.core,this.set_state(n,i),!1}return e.isEmptyObject(n)?(n=null,i&&i.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(){this._data.core.state=this.get_state(),this._cnt=0,this._model.data={"#":{id:"#",parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}}},this.element.html(""),this.load_node("#",function(t,n){n&&this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}),this._data.core.state=null})},set_id:function(t,n){if(t=this.get_node(t),!t||"#"===t.id)return!1;var i,s,r=this._model.data;for(r[t.parent].children[e.inArray(t.id,r[t.parent].children)]=n,i=0,s=t.parents.length;s>i;i++)r[t.parents[i]].children_d[e.inArray(t.id,r[t.parents[i]].children_d)]=n;for(i=0,s=t.children.length;s>i;i++)r[t.children[i]].parent=n;for(i=0,s=t.children_d.length;s>i;i++)r[t.children_d[i]].parents[e.inArray(t.id,r[t.children_d[i]].parents)]=n;return i=e.inArray(t.id,this._data.core.selected),-1!==i&&(this._data.core.selected[i]=n),i=this.get_node(t.id,!0),i&&i.attr("id",n),delete r[t.id],t.id=n,r[n]=t,!0},get_text:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.text:!1},set_text:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_text(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(t.text=n,r=this.get_node(t,!0),r.length&&(r=r.children(".jstree-anchor:eq(0)"),a=r.children("I").clone(),r.html(n).prepend(a),this.trigger("set_text",{obj:t,text:n})),!0):!1},get_json:function(e,t,n){if(e=this.get_node(e||"#"),!e)return!1;t.flat&&!n&&(n=[]);var i={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:e.li_attr,a_attr:e.a_attr,state:{},data:t&&t.no_data?!1:e.data},s,r;if(t.flat?i.parent=e.parent:i.children=[],!t||!t.no_state)for(s in e.state)e.state.hasOwnProperty(s)&&(i.state[s]=e.state[s]);if(t&&t.no_id&&(delete i.id,i.li_attr&&i.li_attr.id&&delete i.li_attr.id),t.flat&&"#"!==e.id&&n.push(i),!t||!t.no_children)for(s=0,r=e.children.length;r>s;s++)t.flat?this.get_json(e.children[s],t,n):i.children.push(this.get_json(e.children[s],t)); return t.flat?n:"#"===e.id?i.children:i},create_node:function(n,i,s,r,a){if(n=this.get_node(n),!n)return!1;if(s=s===t?"last":s,!s.match(/^(before|after)$/)&&!a&&!this.is_loaded(n))return this.load_node(n,function(){this.create_node(n,i,s,r,!0)});i||(i={text:this.get_string("New node")}),i.text===t&&(i.text=this.get_string("New node"));var o,d,l,c;switch("#"===n.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":o=this.get_node(n.parent),s=e.inArray(n.id,o.children),n=o;break;case"after":o=this.get_node(n.parent),s=e.inArray(n.id,o.children)+1,n=o;break;case"inside":case"first":s=0;break;case"last":s=n.children.length;break;default:s||(s=0)}if(s>n.children.length&&(s=n.children.length),i.id||(i.id=!0),!this.check("create_node",i,n,s))return!1;if(i.id===!0&&delete i.id,i=this._parse_model_from_json(i,n.id,n.parents.concat()),!i)return!1;for(o=this.get_node(i),d=[],d.push(i),d=d.concat(o.children_d),this.trigger("model",{nodes:d,parent:n.id}),n.children_d=n.children_d.concat(d),l=0,c=n.parents.length;c>l;l++)this._model.data[n.parents[l]].children_d=this._model.data[n.parents[l]].children_d.concat(d);for(i=o,o=[],l=0,c=n.children.length;c>l;l++)o[l>=s?l+1:l]=n.children[l];return o[s]=i.id,n.children=o,this.redraw_node(n,!0),r&&r.call(this,this.get_node(i)),this.trigger("create_node",{node:this.get_node(i),parent:n.id,position:s}),i.id},rename_node:function(t,n){var i,s,r;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.rename_node(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(r=t.text,this.check("rename_node",t,this.get_parent(t),n)?(this.set_text(t,n),this.trigger("rename_node",{node:t,text:n,old:r}),!0):!1):!1},delete_node:function(t){var n,i,s,r,a,o,d,l,c,h;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.delete_node(t[n]);return!0}if(t=this.get_node(t),!t||"#"===t.id)return!1;if(s=this.get_node(t.parent),r=e.inArray(t.id,s.children),h=!1,!this.check("delete_node",t,s,r))return!1;for(-1!==r&&(s.children=e.vakata.array_remove(s.children,r)),a=t.children_d.concat([]),a.push(t.id),l=0,c=a.length;c>l;l++){for(o=0,d=t.parents.length;d>o;o++)r=e.inArray(a[l],this._model.data[t.parents[o]].children_d),-1!==r&&(this._model.data[t.parents[o]].children_d=e.vakata.array_remove(this._model.data[t.parents[o]].children_d,r));this._model.data[a[l]].state.selected&&(h=!0,r=e.inArray(a[l],this._data.core.selected),-1!==r&&(this._data.core.selected=e.vakata.array_remove(this._data.core.selected,r)))}for(this.trigger("delete_node",{node:t,parent:s.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),l=0,c=a.length;c>l;l++)delete this._model.data[a[l]];return this.redraw_node(s,!0),!0},check:function(t,n,i,s){n=n&&n.id?n:this.get_node(n),i=i&&i.id?i:this.get_node(i);var r=t.match(/^move_node|copy_node|create_node$/i)?i:n,a=this.settings.core.check_callback;return"move_node"!==t||n.id!==i.id&&e.inArray(n.id,i.children)!==s&&-1===e.inArray(i.id,n.children_d)?(r=this.get_node(r,!0),r.length&&(r=r.data("jstree")),r&&r.functions&&(r.functions[t]===!1||r.functions[t]===!0)?r.functions[t]:a===!1||e.isFunction(a)&&a.call(this,t,n,i,s)===!1||a&&a[t]===!1?!1:!0):!1},move_node:function(n,i,s,r,a){var o,d,l,c,h,_,u,g,f,p,m,v,j;if(e.isArray(n)){for(n=n.reverse().slice(),o=0,d=n.length;d>o;o++)this.move_node(n[o],i,s,r,a);return!0}if(n=n&&n.id?n:this.get_node(n),i=this.get_node(i),s=s===t?0:s,!i||!n||"#"===n.id)return!1;if(!(""+s).match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return this.load_node(i,function(){this.move_node(n,i,s,r,!0)});if(l=""+(n.parent||"#"),c=(""+s).match(/^(before|after)$/)&&"#"!==i.id?this.get_node(i.parent):i,h=this._model.data[n.id]?this:e.jstree.reference(n.id),_=!h||!h._id||this._id!==h._id)return this.copy_node(n,i,s,r,a)?(h&&h.delete_node(n),!0):!1;switch("#"===c.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,c.children);break;case"after":s=e.inArray(i.id,c.children)+1;break;case"inside":case"first":s=0;break;case"last":s=c.children.length;break;default:s||(s=0)}if(s>c.children.length&&(s=c.children.length),!this.check("move_node",n,c,s))return!1;if(n.parent===c.id){for(u=c.children.concat(),g=e.inArray(n.id,u),-1!==g&&(u=e.vakata.array_remove(u,g),s>g&&s--),g=[],f=0,p=u.length;p>f;f++)g[f>=s?f+1:f]=u[f];g[s]=n.id,c.children=g,this._node_changed(c.id),this.redraw("#"===c.id)}else{for(g=n.children_d.concat(),g.push(n.id),f=0,p=n.parents.length;p>f;f++){for(u=[],j=h._model.data[n.parents[f]].children_d,m=0,v=j.length;v>m;m++)-1===e.inArray(j[m],g)&&u.push(j[m]);h._model.data[n.parents[f]].children_d=u}for(h._model.data[l].children=e.vakata.array_remove_item(h._model.data[l].children,n.id),f=0,p=c.parents.length;p>f;f++)this._model.data[c.parents[f]].children_d=this._model.data[c.parents[f]].children_d.concat(g);for(u=[],f=0,p=c.children.length;p>f;f++)u[f>=s?f+1:f]=c.children[f];for(u[s]=n.id,c.children=u,c.children_d.push(n.id),c.children_d=c.children_d.concat(n.children_d),n.parent=c.id,g=c.parents.concat(),g.unshift(c.id),j=n.parents.length,n.parents=g,g=g.concat(),f=0,p=n.children_d.length;p>f;f++)this._model.data[n.children_d[f]].parents=this._model.data[n.children_d[f]].parents.slice(0,-1*j),Array.prototype.push.apply(this._model.data[n.children_d[f]].parents,g);this._node_changed(l),this._node_changed(c.id),this.redraw("#"===l||"#"===c.id)}return r&&r.call(this,n,c,s),this.trigger("move_node",{node:n,parent:c.id,position:s,old_parent:l,is_multi:_,old_instance:h,new_instance:this}),!0},copy_node:function(n,i,s,r,a){var o,d,l,c,h,_,u,g,f,p,m;if(e.isArray(n)){for(n=n.reverse().slice(),o=0,d=n.length;d>o;o++)this.copy_node(n[o],i,s,r,a);return!0}if(n=n&&n.id?n:this.get_node(n),i=this.get_node(i),s=s===t?0:s,!i||!n||"#"===n.id)return!1;if(!(""+s).match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return this.load_node(i,function(){this.copy_node(n,i,s,r,!0)});switch(g=""+(n.parent||"#"),f=(""+s).match(/^(before|after)$/)&&"#"!==i.id?this.get_node(i.parent):i,p=this._model.data[n.id]?this:e.jstree.reference(n.id),m=!p||!p._id||this._id!==p._id,"#"===f.id&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,f.children);break;case"after":s=e.inArray(i.id,f.children)+1;break;case"inside":case"first":s=0;break;case"last":s=f.children.length;break;default:s||(s=0)}if(s>f.children.length&&(s=f.children.length),!this.check("copy_node",n,f,s))return!1;if(u=p?p.get_json(n,{no_id:!0,no_data:!0,no_state:!0}):n,!u)return!1;if(u.id===!0&&delete u.id,u=this._parse_model_from_json(u,f.id,f.parents.concat()),!u)return!1;for(c=this.get_node(u),l=[],l.push(u),l=l.concat(c.children_d),this.trigger("model",{nodes:l,parent:f.id}),h=0,_=f.parents.length;_>h;h++)this._model.data[f.parents[h]].children_d=this._model.data[f.parents[h]].children_d.concat(l);for(l=[],h=0,_=f.children.length;_>h;h++)l[h>=s?h+1:h]=f.children[h];return l[s]=c.id,f.children=l,f.children_d.push(c.id),f.children_d=f.children_d.concat(c.children_d),this._node_changed(f.id),this.redraw("#"===f.id),r&&r.call(this,c,f,s),this.trigger("copy_node",{node:c,original:n,parent:f.id,position:s,old_parent:g,is_multi:m,old_instance:p,new_instance:this}),c.id},cut:function(n){if(n||(n=this._data.core.selected.concat()),e.isArray(n)||(n=[n]),!n.length)return!1;var a=[],o,d,l;for(d=0,l=n.length;l>d;d++)o=this.get_node(n[d]),o&&o.id&&"#"!==o.id&&a.push(o);return a.length?(i=a,r=this,s="move_node",this.trigger("cut",{node:n}),t):!1},copy:function(n){if(n||(n=this._data.core.selected.concat()),e.isArray(n)||(n=[n]),!n.length)return!1;var a=[],o,d,l;for(d=0,l=n.length;l>d;d++)o=this.get_node(n[d]),o&&o.id&&"#"!==o.id&&a.push(o);return a.length?(i=a,r=this,s="copy_node",this.trigger("copy",{node:n}),t):!1},get_buffer:function(){return{mode:s,node:i,inst:r}},can_paste:function(){return s!==!1&&i!==!1},paste:function(e){return e=this.get_node(e),e&&s&&s.match(/^(copy_node|move_node)$/)&&i?(this[s](i,e)&&this.trigger("paste",{parent:e.id,node:i,mode:s}),i=!1,s=!1,r=!1,t):!1},edit:function(n,i){if(n=this._open_to(n),!n||!n.length)return!1;var s=this._data.core.rtl,r=this.element.width(),a=n.children(".jstree-anchor"),o=e(""),d="string"==typeof i?i:this.get_text(n),l=e("
    ",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=e("",{value:d,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(){var e=o.children(".jstree-rename-input"),t=e.val();""===t&&(t=d),l.remove(),o.replaceWith(a),o.remove(),this.set_text(n,d),this.rename_node(n,t)===!1&&this.set_text(n,d)},this),keydown:function(e){var t=e.which;27===t&&(this.value=d),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){c.width(Math.min(l.text("pW"+this.value).width(),r))},keypress:function(e){return 13===e.which?!1:t}}),h={fontFamily:a.css("fontFamily")||"",fontSize:a.css("fontSize")||"",fontWeight:a.css("fontWeight")||"",fontStyle:a.css("fontStyle")||"",fontStretch:a.css("fontStretch")||"",fontVariant:a.css("fontVariant")||"",letterSpacing:a.css("letterSpacing")||"",wordSpacing:a.css("wordSpacing")||""};this.set_text(n,""),o.attr("class",a.attr("class")).append(a.contents().clone()).append(c),a.replaceWith(o),l.css(h),c.css(h).width(Math.min(l.text("pW"+c[0].value).width(),r))[0].select()},set_theme:function(t,n){if(!t)return!1;if(n===!0){var i=this.settings.core.themes.dir;i||(i=e.jstree.path+"/themes"),n=i+"/"+t+"/style.css"}n&&-1===e.inArray(n,a)&&(e("head").append(''),a.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(t,n){var i,s,r,a;if(e.isArray(t)){for(t=t.slice(),i=0,s=t.length;s>i;i++)this.set_icon(t[i],n);return!0}return t=this.get_node(t),t&&"#"!==t.id?(a=t.icon,t.icon=n,r=this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon"),n===!1?this.hide_icon(t):n===!0?r.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"):-1===n.indexOf("/")&&-1===n.indexOf(".")?(r.removeClass(a).css("background",""),r.addClass(n+" jstree-themeicon-custom").attr("rel",n)):(r.removeClass(a).css("background",""),r.addClass("jstree-themeicon-custom").css("background","url('"+n+"') center center no-repeat").attr("rel",n)),!0):!1},get_icon:function(e){return e=this.get_node(e),e&&"#"!==e.id?e.icon:!1},hide_icon:function(t){var n,i;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.hide_icon(t[n]);return!0}return t=this.get_node(t),t&&"#"!==t?(t.icon=!1,this.get_node(t,!0).children("a").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(t){var n,i,s;if(e.isArray(t)){for(t=t.slice(),n=0,i=t.length;i>n;n++)this.show_icon(t[n]);return!0}return t=this.get_node(t),t&&"#"!==t?(s=this.get_node(t,!0),t.icon=s.length?s.children("a").children(".jstree-themeicon").attr("rel"):!0,t.icon||(t.icon=!0),s.children("a").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},e.vakata={},e.fn.vakata_reverse=[].reverse,e.vakata.attributes=function(t,n){t=e(t)[0];var i=n?{}:[];return t&&t.attributes&&e.each(t.attributes,function(t,s){-1===e.inArray(s.nodeName.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==s.nodeValue&&""!==e.trim(s.nodeValue)&&(n?i[s.nodeName]=s.nodeValue:i.push(s.nodeName))}),i},e.vakata.array_unique=function(e){var t=[],n,i,s;for(n=0,s=e.length;s>n;n++){for(i=0;n>=i;i++)if(e[n]===e[i])break;i===n&&t.push(e[n])}return t},e.vakata.array_remove=function(e,t,n){var i=e.slice((n||t)+1||e.length);return e.length=0>t?e.length+t:t,e.push.apply(e,i),e},e.vakata.array_remove_item=function(t,n){var i=e.inArray(n,t);return-1!==i?e.vakata.array_remove(t,i):t},function(){var t={},n=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},i=n(window.navigator.userAgent);i.browser&&(t[i.browser]=!0,t.version=i.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),e.vakata.browser=t}(),e.vakata.browser.msie&&8>e.vakata.browser.version&&(e.jstree.defaults.core.animation=0),function(e,t){e.vakata.json={encode:window.JSON.stringify,decode:window.JSON.parse}}(jQuery);var _=document.createElement("I");_.className="jstree-icon jstree-checkbox",e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0},e.jstree.plugins.checkbox=function(t,n){this.bind=function(){n.bind.call(this),this._data.checkbox.uto=!1,this.element.on("init.jstree",e.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked")},this)).on("loading.jstree",e.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),this.settings.checkbox.three_state&&this.element.on("changed.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)},this)).on("model.jstree",e.proxy(function(t,n){var i=this._model.data,s=i[n.parent],r=n.nodes,a=[],o,d,l,c,h,_;if(s.state.selected){for(d=0,l=r.length;l>d;d++)i[r[d]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(r)}else for(d=0,l=r.length;l>d;d++)if(i[r[d]].state.selected){for(c=0,h=i[r[d]].children_d.length;h>c;c++)i[i[r[d]].children_d[c]].state.selected=!0;this._data.core.selected=this._data.core.selected.concat(i[r[d]].children_d)}for(d=0,l=s.children_d.length;l>d;d++)i[s.children_d[d]].children.length||a.push(i[s.children_d[d]].parent);for(a=e.vakata.array_unique(a),c=0,h=a.length;h>c;c++){s=i[a[c]];while(s&&"#"!==s.id){for(o=0,d=0,l=s.children.length;l>d;d++)o+=i[s.children[d]].state.selected;if(o!==l)break;s.state.selected=!0,this._data.core.selected.push(s.id),_=this.get_node(s,!0),_&&_.length&&_.children(".jstree-anchor").addClass("jstree-clicked"),s=this.get_node(s.parent)}}this._data.core.selected=e.vakata.array_unique(this._data.core.selected)},this)).on("select_node.jstree",e.proxy(function(t,n){var i=n.node,s=this._model.data,r=this.get_node(i.parent),a=this.get_node(i,!0),o,d,l,c;for(this._data.core.selected=e.vakata.array_unique(this._data.core.selected.concat(i.children_d)),o=0,d=i.children_d.length;d>o;o++)s[i.children_d[o]].state.selected=!0;while(r&&"#"!==r.id){for(l=0,o=0,d=r.children.length;d>o;o++)l+=s[r.children[o]].state.selected;if(l!==d)break;r.state.selected=!0,this._data.core.selected.push(r.id),c=this.get_node(r,!0),c&&c.length&&c.children(".jstree-anchor").addClass("jstree-clicked"),r=this.get_node(r.parent)}a.length&&a.find(".jstree-anchor").addClass("jstree-clicked")},this)).on("deselect_node.jstree",e.proxy(function(t,n){var i=n.node,s=this.get_node(i,!0),r,a,o;for(r=0,a=i.children_d.length;a>r;r++)this._model.data[i.children_d[r]].state.selected=!1;for(r=0,a=i.parents.length;a>r;r++)this._model.data[i.parents[r]].state.selected=!1,o=this.get_node(i.parents[r],!0),o&&o.length&&o.children(".jstree-anchor").removeClass("jstree-clicked");for(o=[],r=0,a=this._data.core.selected.length;a>r;r++)-1===e.inArray(this._data.core.selected[r],i.children_d)&&-1===e.inArray(this._data.core.selected[r],i.parents)&&o.push(this._data.core.selected[r]);this._data.core.selected=e.vakata.array_unique(o),s.length&&s.find(".jstree-anchor").removeClass("jstree-clicked")},this)).on("delete_node.jstree",e.proxy(function(e,t){var n=this.get_node(t.parent),i=this._model.data,s,r,a,o;while(n&&"#"!==n.id){for(a=0,s=0,r=n.children.length;r>s;s++)a+=i[n.children[s]].state.selected;if(a!==r)break;n.state.selected=!0,this._data.core.selected.push(n.id),o=this.get_node(n,!0),o&&o.length&&o.children(".jstree-anchor").addClass("jstree-clicked"),n=this.get_node(n.parent)}},this)).on("move_node.jstree",e.proxy(function(t,n){var i=n.is_multi,s=n.old_parent,r=this.get_node(n.parent),a=this._model.data,o,d,l,c,h;if(!i){o=this.get_node(s);while(o&&"#"!==o.id){for(d=0,l=0,c=o.children.length;c>l;l++)d+=a[o.children[l]].state.selected;if(d!==c)break;o.state.selected=!0,this._data.core.selected.push(o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").addClass("jstree-clicked"),o=this.get_node(o.parent)}}o=r;while(o&&"#"!==o.id){for(d=0,l=0,c=o.children.length;c>l;l++)d+=a[o.children[l]].state.selected;if(d===c)o.state.selected||(o.state.selected=!0,this._data.core.selected.push(o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").addClass("jstree-clicked"));else{if(!o.state.selected)break;o.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,o.id),h=this.get_node(o,!0),h&&h.length&&h.children(".jstree-anchor").removeClass("jstree-clicked")}o=this.get_node(o.parent)}},this))},this._undetermined=function(){var t,n,i=this._model.data,s=this._data.core.selected,r=[],a=this;for(t=0,n=s.length;n>t;t++)i[s[t]]&&i[s[t]].parents&&(r=r.concat(i[s[t]].parents));for(this.element.find(".jstree-closed").not(":has(ul)").each(function(){var e=a.get_node(this);!e.state.loaded&&e.original&&e.original.state&&e.original.state.undetermined&&e.original.state.undetermined===!0&&(r.push(e.id),r=r.concat(e.parents))}),r=e.vakata.array_unique(r),t=e.inArray("#",r),-1!==t&&(r=e.vakata.array_remove(r,t)),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),t=0,n=r.length;n>t;t++)i[r[t]].state.selected||(s=this.get_node(r[t],!0),s&&s.length&&s.children("a").children(".jstree-checkbox").addClass("jstree-undetermined"))},this.redraw_node=function(t,i,s){if(t=n.redraw_node.call(this,t,i,s)){var r=t.getElementsByTagName("A")[0];r.insertBefore(_.cloneNode(),r.childNodes[0])}return!s&&this.settings.checkbox.three_state&&(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.activate_node=function(t,i){return(this.settings.checkbox.whole_node||e(i.target).hasClass("jstree-checkbox"))&&(i.ctrlKey=!0),n.activate_node.call(this,t,i)},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.element.children("ul").removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.element.children("ul").addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,n){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.create_node(i,{},"last",function(e){setTimeout(function(){n.edit(e)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.edit(i)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.delete_node(n.get_selected()):n.delete_node(i)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.cut(n.get_selected()):n.cut(i)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.is_selected(i)?n.copy(n.get_selected()):n.copy(i)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var n=e.jstree.reference(t.reference),i=n.get_node(t.reference);n.paste(i)}}}}}}},e.jstree.plugins.contextmenu=function(n,i){this.bind=function(){i.bind.call(this),this.element.on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e){e.preventDefault(),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){this._data.contextmenu.visible&&e.vakata.context.hide()},this)),e(document).on("context_hide.vakata",e.proxy(function(){this._data.contextmenu.visible=!1},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(n,i,s,r){if(n=this.get_node(n),!n||"#"===n.id)return!1;var a=this.settings.contextmenu,o=this.get_node(n,!0),d=o.children(".jstree-anchor"),l=!1,c=!1;(a.show_at_node||i===t||s===t)&&(l=d.offset(),i=l.left,s=l.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&(this.deselect_all(),this.select_node(n,!1,!1,r)),c=a.items,e.isFunction(c)&&(c=c.call(this,n,e.proxy(function(e){this._show_contextmenu(n,i,s,e)},this))),e.isPlainObject(c)&&this._show_contextmenu(n,i,s,c)},this._show_contextmenu=function(t,n,i,s){var r=this.get_node(t,!0),a=r.children(".jstree-anchor");e(document).one("context_show.vakata",e.proxy(function(t,n){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(i)},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(a,{x:n,y:i},s),this.trigger("show_contextmenu",{node:t,x:n,y:i})}},function(e){var n=!1,i={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(document).triggerHandler("context_"+t+".vakata",{reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_execute:function(t){return t=i.items[t],t&&(!t._disabled||e.isFunction(t._disabled)&&!t._disabled({item:t,reference:i.reference,element:i.element}))&&t.action?t.action.call(null,{item:t,reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}}):!1},_parse:function(n,s){if(!n)return!1;s||(i.html="",i.items=[]);var r="",a=!1,o;return s&&(r+=""),s||(i.html=r,e.vakata.context._trigger("parse")),r.length>10?r:!1},_show_submenu:function(t){if(t=e(t),t.length&&t.children("ul").length){var i=t.children("ul"),s=t.offset().left+t.outerWidth(),r=t.offset().top,a=i.width(),o=i.height(),d=e(window).width()+e(window).scrollLeft(),l=e(window).height()+e(window).scrollTop();n?t[0>s-(a+10+t.outerWidth())?"addClass":"removeClass"]("vakata-context-left"):t[s+a+10>d?"addClass":"removeClass"]("vakata-context-right"),r+o+10>l&&i.css("bottom","-1px"),i.show()}},show:function(t,s,r){var a,o,d,l,c,h,_,u,g=!0;switch(i.element&&i.element.length&&i.element.width(""),g){case!s&&!t:return!1;case!!s&&!!t:i.reference=t,i.position_x=s.x,i.position_y=s.y;break;case!s&&!!t:i.reference=t,a=t.offset(),i.position_x=a.left+t.outerHeight(),i.position_y=a.top;break;case!!s&&!t:i.position_x=s.x,i.position_y=s.y}t&&!r&&e(t).data("vakata_contextmenu")&&(r=e(t).data("vakata_contextmenu")),e.vakata.context._parse(r)&&i.element.html(i.html),i.items.length&&(o=i.element,d=i.position_x,l=i.position_y,c=o.width(),h=o.height(),_=e(window).width()+e(window).scrollLeft(),u=e(window).height()+e(window).scrollTop(),n&&(d-=o.outerWidth(),e(window).scrollLeft()+20>d&&(d=e(window).scrollLeft()+20)),d+c+20>_&&(d=_-(c+20)),l+h+20>u&&(l=u-(h+20)),i.element.css({left:d,top:l}).show().find("a:eq(0)").focus().parent().addClass("vakata-context-hover"),i.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){i.is_visible&&(i.element.hide().find("ul").hide().end().find(":focus").blur(),i.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){n="rtl"===e("body").css("direction");var t=!1;i.element=e("
      "),i.element.on("mouseenter","li",function(n){n.stopImmediatePropagation(),e.contains(this,n.relatedTarget)||(t&&clearTimeout(t),i.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(n){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(t=setTimeout(function(t){return function(){e.vakata.context.hide()}}(this),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(e){e.preventDefault()}).on("mouseup","a",function(t){e(this).blur().parent().hasClass("vakata-context-disabled")||e.vakata.context._execute(e(this).attr("rel"))===!1||e.vakata.context.hide()}).on("keydown","a",function(t){var n=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:i.is_visible&&(i.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:i.is_visible&&(i.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault();break;default:}}).on("keydown",function(e){e.preventDefault();var t=i.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.mouseup()}).appendTo("body"),e(document).on("mousedown",function(t){i.is_visible&&!e.contains(i.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata",function(e,t){i.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),n&&i.element.addClass("vakata-context-rtl").css("direction","rtl"),i.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0},e.jstree.plugins.dnd=function(n,i){this.bind=function(){i.bind.call(this),this.element.on("mousedown touchstart",".jstree-anchor",e.proxy(function(n){var i=this.get_node(n.target),s=this.is_selected(i)?this.get_selected().length:1;return i&&i.id&&"#"!==i.id&&(1===n.which||"touchstart"===n.type)&&(this.settings.dnd.is_draggable===!0||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i))?(this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(n,{jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:s>1?this.get_selected():[i.id]},'
      '+(s>1?s+" "+this.get_string("nodes"):this.get_text(n.currentTarget,!0))+'
      ')):t},this))}},e(function(){var n=!1,i=!1,s=e('
       
      ').hide().appendTo("body");e(document).bind("dnd_start.vakata",function(e,t){n=!1}).bind("dnd_move.vakata",function(r,a){if(i&&clearTimeout(i),a.data.jstree&&(!a.event.target.id||"jstree-marker"!==a.event.target.id)){var o=e.jstree.reference(a.event.target),d=!1,l=!1,c=!1,h,_,u,g,f,p,m,v,j,y,x,k;if(o&&o._data&&o._data.dnd)if(s.attr("class","jstree-"+o.get_theme()),a.helper.children().attr("class","jstree-"+o.get_theme()).find(".jstree-copy:eq(0)")[a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"show":"hide"](),a.event.target!==o.element[0]&&a.event.target!==o.get_container_ul()[0]||0!==o.get_container_ul().children().length){if(d=e(a.event.target).closest("a"),d&&d.length&&d.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(l=d.offset(),c=a.event.pageY-l.top,u=d.height(),p=u/3>c?["b","i","a"]:c>u-u/3?["a","i","b"]:c>u/2?["i","a","b"]:["i","b","a"],e.each(p,function(r,c){switch(c){case"b":h=l.left-6,_=l.top-5,g=o.get_parent(d),f=d.parent().index(); break;case"i":h=l.left-2,_=l.top-5+u/2+1,g=d.parent(),f=0;break;case"a":h=l.left-6,_=l.top-5+u,g=o.get_parent(d),f=d.parent().index()+1}for(m=!0,v=0,j=a.data.nodes.length;j>v;v++)if(y=a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"copy_node":"move_node",x=f,"move_node"===y&&"a"===c&&a.data.origin&&a.data.origin===o&&g===o.get_parent(a.data.nodes[v])&&(k=o.get_node(g),x>e.inArray(a.data.nodes[v],k.children)&&(x-=1)),m=m&&(o&&o.settings&&o.settings.dnd&&o.settings.dnd.check_while_dragging===!1||o.check(y,a.data.origin&&a.data.origin!==o?a.data.origin.get_node(a.data.nodes[v]):a.data.nodes[v],g,x)),!m)break;return m?("i"===c&&d.parent().is(".jstree-closed")&&o.settings.dnd.open_timeout&&(i=setTimeout(function(e,t){return function(){e.open_node(t)}}(o,d),o.settings.dnd.open_timeout)),n={ins:o,par:g,pos:f},s.css({left:h+"px",top:_+"px"}).show(),a.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),p=!0,!1):t}),p===!0))return}else{for(m=!0,v=0,j=a.data.nodes.length;j>v;v++)if(m=m&&o.check(a.data.origin&&a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey)?"copy_node":"move_node",a.data.nodes[v],"#","last"),!m)break;if(m)return n={ins:o,par:"#",pos:"last"},s.hide(),a.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),t}n=!1,a.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),s.hide()}}).bind("dnd_scroll.vakata",function(e,t){t.data.jstree&&(s.hide(),n=!1,t.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(e,t){if(i&&clearTimeout(i),t.data.jstree&&(s.hide(),n)){var r,a,o=[];for(r=0,a=t.data.nodes.length;a>r;r++)o[r]=t.data.origin?t.data.origin.get_node(t.data.nodes[r]):t.data.nodes[r];n.ins[t.data.origin&&t.data.origin.settings.dnd.copy&&(t.event.metaKey||t.event.ctrlKey)?"copy_node":"move_node"](o,n.par,n.pos)}}).bind("keyup keydown",function(t,n){n=e.vakata.dnd._get(),n.data&&n.data.jstree&&n.helper.find(".jstree-copy:eq(0)")[n.data.origin&&n.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey)?"show":"hide"]()})}),function(e){e.fn.vakata_reverse=[].reverse;var n={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5},_trigger:function(t,n){var i=e.vakata.dnd._get();i.event=n,e(document).triggerHandler("dnd_"+t+".vakata",i)},_get:function(){return{data:n.data,element:n.element,helper:n.helper}},_clean:function(){n.helper&&n.helper.remove(),n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),n={element:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1},e(document).off("mousemove touchmove",e.vakata.dnd.drag),e(document).off("mouseup touchend",e.vakata.dnd.stop)},_scroll:function(t){if(!n.scroll_e||!n.scroll_l&&!n.scroll_t)return n.scroll_i&&(clearInterval(n.scroll_i),n.scroll_i=!1),!1;if(!n.scroll_i)return n.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(t===!0)return!1;var i=n.scroll_e.scrollTop(),s=n.scroll_e.scrollLeft();n.scroll_e.scrollTop(i+n.scroll_t*e.vakata.dnd.settings.scroll_speed),n.scroll_e.scrollLeft(s+n.scroll_l*e.vakata.dnd.settings.scroll_speed),(i!==n.scroll_e.scrollTop()||s!==n.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",n.scroll_e)},start:function(t,i,s){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.targetTouches&&t.originalEvent.targetTouches[0]&&(t.pageX=t.originalEvent.targetTouches[0].pageX,t.pageY=t.originalEvent.targetTouches[0].pageY,t.target=document.elementFromPoint(t.originalEvent.targetTouches[0].pageX-window.pageXOffset,t.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.MozUserSelect="none")}catch(r){}return n.init_x=t.pageX,n.init_y=t.pageY,n.data=i,n.is_down=!0,n.element=t.currentTarget,s!==!1&&(n.helper=e("
      ").html(s).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(i){if("touchmove"===i.type&&i.originalEvent&&i.originalEvent.targetTouches&&i.originalEvent.targetTouches[0]&&(i.pageX=i.originalEvent.targetTouches[0].pageX,i.pageY=i.originalEvent.targetTouches[0].pageY,i.target=document.elementFromPoint(i.originalEvent.targetTouches[0].pageX-window.pageXOffset,i.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_down){if(!n.is_drag){if(!(Math.abs(i.pageX-n.init_x)>e.vakata.dnd.settings.threshold||Math.abs(i.pageY-n.init_y)>e.vakata.dnd.settings.threshold))return;n.helper&&(n.helper.appendTo("body"),n.helper_w=n.helper.outerWidth()),n.is_drag=!0,e.vakata.dnd._trigger("start",i)}var s=!1,r=!1,a=!1,o=!1,d=!1,l=!1,c=!1,h=!1,_=!1,u=!1;n.scroll_t=0,n.scroll_l=0,n.scroll_e=!1,e(i.target).parentsUntil("body").addBack().vakata_reverse().filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var s=e(this),r=s.offset();return this.scrollHeight>this.offsetHeight&&(r.top+s.height()-i.pageYthis.offsetWidth&&(r.left+s.width()-i.pageXo&&i.pageY-co&&o-(i.pageY-c)l&&i.pageX-hl&&l-(i.pageX-h)a&&(_=a-50),d&&u+n.helper_w>d&&(u=d-(n.helper_w+2)),n.helper.css({left:u+"px",top:_+"px"})),e.vakata.dnd._trigger("move",i)}},stop:function(t){"touchend"===t.type&&t.originalEvent&&t.originalEvent.targetTouches&&t.originalEvent.targetTouches[0]&&(t.pageX=t.originalEvent.targetTouches[0].pageX,t.pageY=t.originalEvent.targetTouches[0].pageY,t.target=document.elementFromPoint(t.originalEvent.targetTouches[0].pageX-window.pageXOffset,t.originalEvent.targetTouches[0].pageY-window.pageYOffset)),n.is_drag&&e.vakata.dnd._trigger("stop",t),e.vakata.dnd._clean()}}}(jQuery),e.jstree.defaults.search={ajax:!1,fuzzy:!0,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0},e.jstree.plugins.search=function(t,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.sln=null,this.settings.search.show_only_matches&&this.element.on("search.jstree",function(t,n){n.nodes.length&&(e(this).find("li").hide().filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last"),n.nodes.parentsUntil(".jstree").addBack().show().filter("ul").each(function(){e(this).children("li:visible").eq(-1).addClass("jstree-last")}))}).on("clear_search.jstree",function(t,n){n.nodes.length&&e(this).find("li").css("display","").filter(".jstree-last").filter(function(){return this.nextSibling}).removeClass("jstree-last")})},this.search=function(t,n){if(t===!1||""===e.trim(t))return this.clear_search();var i=this.settings.search,s=i.ajax?e.extend({},i.ajax):!1,r=null,a=[],o=[],d,l;if(this._data.search.res.length&&this.clear_search(),!n&&s!==!1)return s.data||(s.data={}),s.data.str=t,e.ajax(i.ajax).done(e.proxy(function(n){n&&n.d&&(n=n.d),this._data.search.sln=e.isArray(n)?n:[],this._search_load(t)},this));if(this._data.search.str=t,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],r=new e.vakata.search(t,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),e.each(this._model.data,function(e,t){t.text&&r.search(t.text).isMatch&&(a.push(e),o=o.concat(t.parents))}),a.length){for(o=e.vakata.array_unique(o),this._search_open(o),d=0,l=a.length;l>d;d++)r=this.get_node(a[d],!0),r&&(this._data.search.dom=this._data.search.dom.add(r));this._data.search.res=a,this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:t,res:this._data.search.res})},this.clear_search=function(){this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"),this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this._search_open=function(t){var n=this;e.each(t.concat([]),function(e,i){i=document.getElementById(i),i&&n.is_closed(i)&&(n._data.search.opn.push(i.id),n.open_node(i,function(){n._search_open(t)},0))})},this._search_load=function(t){var n=!0,i=this,s=i._model.data;e.isArray(this._data.search.sln)&&(this._data.search.sln.length?(e.each(this._data.search.sln,function(r,a){s[a]&&(e.vakata.array_remove_item(i._data.search.sln,a),s[a].state.loaded||(i.load_node(a,function(e,n){n&&i._search_load(t)}),n=!1))}),n&&(this._data.search.sln=[],this._search_load(t))):(this._data.search.sln=null,this.search(t,!0)))}},function(e){e.vakata.search=function(e,t,n){n=n||{},n.fuzzy!==!1&&(n.fuzzy=!0),e=n.caseSensitive?e:e.toLowerCase();var i=n.location||0,s=n.distance||100,r=n.threshold||.6,a=e.length,o,d,l,c;return a>32&&(n.fuzzy=!1),n.fuzzy&&(o=1<n;n++)t[e.charAt(n)]=0;for(n=0;a>n;n++)t[e.charAt(n)]|=1<s;s++){g=0,f=p;while(f>g)_>=l(s,i+f)?g=f:p=f,f=Math.floor((p-g)/2+g);for(p=f,v=Math.max(1,i-f+1),j=Math.min(i+f,h)+a,y=Array(j+2),y[j+1]=(1<=v;c--)if(x=d[t.charAt(c-1)],y[c]=0===s?(1|y[c+1]<<1)&x:(1|y[c+1]<<1)&x|(1|(m[c+1]|m[c])<<1)|m[c+1],y[c]&o&&(k=l(s,c-1),_>=k)){if(_=k,u=c-1,b.push(u),!(u>i))break;v=Math.max(1,2*i-u)}if(l(s+1,i)>_)break;m=y}return{isMatch:u>=0,score:k}},t===!0?{search:c}:c(t)}}(jQuery),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,n){var i,s;if(t=this.get_node(t),t&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(i=0,s=t.children_d.length;s>i;i++)this.sort(t.children_d[i],!1)}};var u=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree",ttl:!1,filter:!1},e.jstree.plugins.state=function(t,n){this.bind=function(){n.bind.call(this);var t=e.proxy(function(){this.element.on(this.settings.state.events,e.proxy(function(){u&&clearTimeout(u),u=setTimeout(e.proxy(function(){this.save_state()},this),100)},this))},this);this.element.on("ready.jstree",e.proxy(function(e,n){this.element.one("restore_state.jstree",t),this.restore_state()||t()},this))},this.save_state=function(){var t={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,e.vakata.json.encode(t))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=e.vakata.json.decode(t)}catch(n){return!1}return t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl?!1:(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),t?(this.element.one("set_state.jstree",function(n,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0):!1)},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(jQuery),e.jstree.defaults.types={"#":{},"default":{}},e.jstree.plugins.types=function(n,i){this.init=function(t,n){if(n&&n.types&&n.types["default"])for(var s in n.types)"default"!==s&&"#"!==s&&n.types.hasOwnProperty(s)&&(n.types[s]=e.extend(!0,{},n.types["default"],n.types[s]));i.init.call(this,t,n),this._model.data["#"].type="#"},this.bind=function(){i.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,n){var i=this._model.data,s=n.nodes,r=this.settings.types,a,o,d="default";for(a=0,o=s.length;o>a;a++)d="default",i[s[a]].original&&i[s[a]].original.type&&r[i[s[a]].original.type]&&(d=i[s[a]].original.type),i[s[a]].data&&i[s[a]].data.jstree&&i[s[a]].data.jstree.type&&r[i[s[a]].data.jstree.type]&&(d=i[s[a]].data.jstree.type),i[s[a]].type=d,i[s[a]].icon===!0&&r[d].icon!==t&&(i[s[a]].icon=r[d].icon)},this))},this.get_json=function(t,n){var s,r,a=this._model.data,o=n?e.extend(!0,{},n,{no_id:!1}):{},d=i.get_json.call(this,t,o);if(d===!1)return!1;if(e.isArray(d))for(s=0,r=d.length;r>s;s++)d[s].type=d[s].id&&a[d[s].id]&&a[d[s].id].type?a[d[s].id].type:"default",n&&n.no_id&&(delete d[s].id,d[s].li_attr&&d[s].li_attr.id&&delete d[s].li_attr.id);else d.type=d.id&&a[d.id]&&a[d.id].type?a[d.id].type:"default",n&&n.no_id&&(delete d.id,d.li_attr&&d.li_attr.id&&delete d.li_attr.id);return d},this.check=function(n,s,r,a){if(i.check.call(this,n,s,r,a)===!1)return!1;s=s&&s.id?s:this.get_node(s),r=r&&r.id?r:this.get_node(r);var o=s&&s.id?e.jstree.reference(s.id):null,d,l,c,h;switch(o=o&&o._model&&o._model.data?o._model.data:null,n){case"create_node":case"move_node":case"copy_node":if("move_node"!==n||-1===e.inArray(s.id,r.children)){if(d=this.get_rules(r),d.max_children!==t&&-1!==d.max_children&&d.max_children===r.children.length)return!1;if(d.valid_children!==t&&-1!==d.valid_children&&-1===e.inArray(s.type,d.valid_children))return!1;if(o&&s.children_d&&s.parents){for(l=0,c=0,h=s.children_d.length;h>c;c++)l=Math.max(l,o[s.children_d[c]].parents.length);l=l-s.parents.length+1}0>=l&&(l=1);do{if(d.max_depth!==t&&-1!==d.max_depth&&l>d.max_depth)return!1;r=this.get_node(r.parent),d=this.get_rules(r),l++}while(r)}}return!0},this.get_rules=function(e){if(e=this.get_node(e),!e)return!1;var n=this.get_type(e,!0);return n.max_depth===t&&(n.max_depth=-1),n.max_children===t&&(n.max_children=-1),n.valid_children===t&&(n.valid_children=-1),n},this.get_type=function(t,n){return t=this.get_node(t),t?n?e.extend({type:t.type},this.settings.types[t.type]):t.type:!1},this.set_type=function(n,i){var s,r,a,o,d;if(e.isArray(n)){for(n=n.slice(),r=0,a=n.length;a>r;r++)this.set_type(n[r],i);return!0}return s=this.settings.types,n=this.get_node(n),s[i]&&n?(o=n.type,d=this.get_icon(n),n.type=i,(d===!0||s[o]&&s[o].icon&&d===s[o].icon)&&this.set_icon(n,s[i].icon!==t?s[i].icon:!0),!0):!1}},e.jstree.plugins.unique=function(t,n){this.check=function(t,i,s,r){if(n.check.call(this,t,i,s,r)===!1)return!1;if(i=i&&i.id?i:this.get_node(i),s=s&&s.id?s:this.get_node(s),!s||!s.children)return!0;var a="rename_node"===t?r:i.text,o=[],d=this._model.data,l,c;for(l=0,c=s.children.length;c>l;l++)o.push(d[s.children[l]].text);switch(t){case"delete_node":return!0;case"rename_node":case"copy_node":return-1===e.inArray(a,o);case"move_node":return i.parent===s.id||-1===e.inArray(a,o)}return!0}};var g=document.createElement("DIV");g.setAttribute("unselectable","on"),g.className="jstree-wholerow",g.innerHTML=" ",e.jstree.plugins.wholerow=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("loading",e.proxy(function(){g.style.height=this._data.core.li_height+"px"},this)).on("ready.jstree set_state.jstree",e.proxy(function(){this.hide_dots()},this)).on("ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var n=!1,i,s;for(i=0,s=t.selected.length;s>i;i++)n=this.get_node(t.selected[i],!0),n&&n.length&&n.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).closest("li").children("a:eq(0)").trigger("contextmenu",t)},this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest("li").children("a:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,i,s){if(t=n.redraw_node.call(this,t,i,s)){var r=g.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(r.className+=" jstree-wholerow-clicked"),t.insertBefore(r,t.childNodes[0])}return t}}}}); \ No newline at end of file diff --git a/docs/jstree.json b/docs/jstree.json index 8b93aca2..95154e6d 100644 --- a/docs/jstree.json +++ b/docs/jstree.json @@ -75,7 +75,7 @@ }, "isPrivate": false, "ignore": false, - "code": "version : '3.0.0-beta6'," + "code": "version : '3.0.0-beta7'," }, { "tags": [ diff --git a/jstree.jquery.json b/jstree.jquery.json index f325b3b9..4d9b9ea9 100644 --- a/jstree.jquery.json +++ b/jstree.jquery.json @@ -2,7 +2,7 @@ "name": "jstree", "title": "jsTree", "description": "Tree view for jQuery", - "version": "3.0.0-beta6", + "version": "3.0.0-beta7", "homepage": "http://jstree.com", "keywords": [ "ui", diff --git a/package.json b/package.json index 2d6c32fe..052b7e7b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jstree", "title": "jsTree", "description": "jQuery tree plugin", - "version": "3.0.0-beta6", + "version": "3.0.0-beta7", "homepage": "http://jstree.com", "author": { "name": "Ivan Bozhanov", diff --git a/src/jstree.js b/src/jstree.js index 9509869c..da3b9bb0 100644 --- a/src/jstree.js +++ b/src/jstree.js @@ -67,7 +67,7 @@ * specifies the jstree version in use * @name $.jstree.version */ - version : '3.0.0-beta6', + version : '3.0.0-beta7', /** * holds all the default options used when creating new instances * @name $.jstree.defaults