XWWitPark/witpark_jzzs/xw_jzzs_web/public/lib/jstree/jstree.min.js
2024-09-12 08:10:00 +08:00

2 lines
135 KiB
JavaScript

/* 2020-9-22 15:23:19 | 版权所有 军懋国兴 */
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(S,E){"use strict";if(!S.jstree){var s=0,a=!1,n=!1,o=!1,r=[],e=S("script:last").attr("src"),y=window.document;S.jstree={version:"3.3.7",defaults:{plugins:[]},plugins:{},path:e&&-1!==e.indexOf("/")?e.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},S.jstree.create=function(e,r){var i=new S.jstree.core(++s),t=r;return r=S.extend(!0,{},S.jstree.defaults,r),t&&t.plugins&&(r.plugins=t.plugins),S.each(r.plugins,function(e,t){"core"!==e&&(i=i.plugin(t,r[t]))}),S(e).data("jstree",i),i.init(e,r),i},S.jstree.destroy=function(){S(".jstree:jstree").jstree("destroy"),S(y).off(".jstree")},S.jstree.core=function(e){this._id=e,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},S.jstree.reference=function(t){var r=null,e=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!e||!e.length)try{e=S(t)}catch(e){}if(!e||!e.length)try{e=S("#"+t.replace(S.jstree.idregex,"\\$&"))}catch(e){}return e&&e.length&&(e=e.closest(".jstree")).length&&(e=e.data("jstree"))?r=e:S(".jstree").each(function(){var e=S(this).data("jstree");return e&&e._model.data[t]?(r=e,!1):void 0}),r},S.fn.jstree=function(r){var i="string"==typeof r,s=Array.prototype.slice.call(arguments,1),a=null;return!(!0===r&&!this.length)&&(this.each(function(){var e=S.jstree.reference(this),t=i&&e?e[r]:null;return a=i&&t?t.apply(e,s):null,e||i||r!==E&&!S.isPlainObject(r)||S.jstree.create(this,r),(e&&!i||!0===r)&&(a=e||!1),(null===a||a===E)&&void 0}),null!==a&&a!==E?a:this)},S.expr.pseudos.jstree=S.expr.createPseudo(function(e){return function(e){return S(e).hasClass("jstree")&&S(e).data("jstree")!==E}}),S.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:S.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(e){e.type="click",S(e.currentTarget).trigger(e)},enter:function(e){e.type="click",S(e.currentTarget).trigger(e)},left:function(e){var t;e.preventDefault(),this.is_open(e.currentTarget)?this.close_node(e.currentTarget):(t=this.get_parent(e.currentTarget))&&t.id!==S.jstree.root&&this.get_node(t,!0).children(".jstree-anchor").focus()},up:function(e){e.preventDefault();var t=this.get_prev_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},right:function(e){var t;e.preventDefault(),this.is_closed(e.currentTarget)?this.open_node(e.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):!this.is_open(e.currentTarget)||(t=this.get_node(e.currentTarget,!0).children(".jstree-children")[0])&&S(this._firstChild(t)).children(".jstree-anchor").focus()},down:function(e){e.preventDefault();var t=this.get_next_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},"*":function(){this.open_all()},home:function(e){e.preventDefault();var t=this._firstChild(this.get_container_ul()[0]);t&&S(t).children(".jstree-anchor").filter(":visible").focus()},end:function(e){e.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(e){e.preventDefault(),this.edit(e.currentTarget)}}},S.jstree.core.prototype={plugin:function(e,t){var r=S.jstree.plugins[e];return r?(this._data[e]={},r.prototype=this,new r(t,this)):this},init:function(e,t){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[S.jstree.root]={id:S.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=S(e).addClass("jstree jstree-"+this._id),this.settings=t,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.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),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("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(S.jstree.root)},destroy:function(e){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,r=y.createElement("LI");return r.setAttribute("role","treeitem"),(e=y.createElement("I")).className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),r.appendChild(e),(e=y.createElement("A")).className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),(t=y.createElement("I")).className="jstree-icon jstree-themeicon",t.setAttribute("role","presentation"),e.appendChild(t),r.appendChild(e),e=t=null,r},_kbevent_to_func:function(e){var t=[];e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),t.push({8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"}[e.which]||e.which),t=t.sort().join("-").toLowerCase();var r,i,s=this.settings.core.keyboard;for(r in s)if(s.hasOwnProperty(r)&&("-"!==(i=r)&&"+"!==i&&(i=(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),i===t))return s[r];return null},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(){var a="",n=null,t=0;this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(y.selection&&y.selection.empty)y.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}}).on("mousedown.jstree",S.proxy(function(e){e.target===this.element[0]&&(e.preventDefault(),t=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(e){e.preventDefault()}).on("click.jstree",".jstree-ocl",S.proxy(function(e){this.toggle_node(e.target)},this)).on("dblclick.jstree",".jstree-anchor",S.proxy(function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))},this)).on("click.jstree",".jstree-anchor",S.proxy(function(e){e.preventDefault(),e.currentTarget!==y.activeElement&&S(e.currentTarget).focus(),this.activate_node(e.currentTarget,e)},this)).on("keydown.jstree",".jstree-anchor",S.proxy(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===e.which?e.which=39:39===e.which&&(e.which=37));var t=this._kbevent_to_func(e);if(t){var r=t.call(this,e);if(!1===r||!0===r)return r}},this)).on("load_node.jstree",S.proxy(function(e,t){t.status&&(t.node.id!==S.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(S.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){for(var e=[],t=0,r=this._data.core.selected.length;t<r;t++)e=e.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,r=(e=S.vakata.array_unique(e)).length;t<r;t++)this.open_node(e[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",S.proxy(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;n&&clearTimeout(n),n=setTimeout(function(){a=""},500);var r=String.fromCharCode(e.which).toLowerCase(),t=this.element.find(".jstree-anchor").filter(":visible"),i=t.index(y.activeElement)||0,s=!1;if(1<(a+=r).length){if(t.slice(i).each(S.proxy(function(e,t){return 0===S(t).text().toLowerCase().indexOf(a)?(S(t).focus(),!(s=!0)):void 0},this)),s)return;if(t.slice(0,i).each(S.proxy(function(e,t){return 0===S(t).text().toLowerCase().indexOf(a)?(S(t).focus(),!(s=!0)):void 0},this)),s)return}if(new RegExp("^"+r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(a)){if(t.slice(i+1).each(S.proxy(function(e,t){return S(t).text().toLowerCase().charAt(0)===r?(S(t).focus(),!(s=!0)):void 0},this)),s)return;if(t.slice(0,i+1).each(S.proxy(function(e,t){return S(t).text().toLowerCase().charAt(0)===r?(S(t).focus(),!(s=!0)):void 0},this)),s)return}},this)).on("init.jstree",S.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._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",S.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[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",S.proxy(function(e){this._data.core.focused=null,S(e.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",S.proxy(function(e){var t=this.get_node(e.currentTarget);t&&t.id&&(this._data.core.focused=t.id),this.element.find(".jstree-hovered").not(e.currentTarget).mouseleave(),S(e.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",S.proxy(function(){var e;500<new Date-t&&!this._data.core.focused&&this.settings.core.restore_focus&&(t=0,(e=this.get_node(this.element.attr("aria-activedescendant"),!0))&&e.find("> .jstree-anchor").focus())},this)).on("mouseenter.jstree",".jstree-anchor",S.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",S.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),S(y).off(".jstree-"+this._id)},trigger:function(e,t){((t=t||{}).instance=this).element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(e){var t=this.settings.core.strings;return S.isFunction(t)?t.call(this,e):t&&t[e]?t[e]:e},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(e,t){var r;e&&e.id&&(e=e.id),e instanceof jQuery&&e.length&&e[0].id&&(e=e[0].id);try{if(this._model.data[e])e=this._model.data[e];else if("string"==typeof e&&this._model.data[e.replace(/^#/,"")])e=this._model.data[e.replace(/^#/,"")];else if("string"==typeof e&&(r=S("#"+e.replace(S.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])e=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=this.element.find(e)).length&&this._model.data[r.closest(".jstree-node").attr("id")])e=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=this.element.find(e)).length||!r.hasClass("jstree"))return!1;e=this._model.data[S.jstree.root]}return t&&(e=e.id===S.jstree.root?this.element:S("#"+e.id.replace(S.jstree.idregex,"\\$&"),this.element)),e}catch(e){return!1}},get_path:function(e,t,r){if(!(e=e.parents?e:this.get_node(e))||e.id===S.jstree.root||!e.parents)return!1;var i,s,a=[];for(a.push(r?e.id:e.text),i=0,s=e.parents.length;i<s;i++)a.push(r?e.parents[i]:this.get_text(e.parents[i]));return a=a.reverse().slice(1),t?a.join(t):a},get_next_dom:function(e,t){var r;if((e=this.get_node(e,!0))[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&S(r)}if(!e||!e.length)return!1;if(t){for(r=e[0];(r=this._nextSibling(r))&&0===r.offsetHeight;);return!!r&&S(r)}if(e.hasClass("jstree-open")){for(r=this._firstChild(e.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return S(r)}for(r=e[0];(r=this._nextSibling(r))&&0===r.offsetHeight;);return null!==r?S(r):e.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(e,t){var r;if((e=this.get_node(e,!0))[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&S(r)}if(!e||!e.length)return!1;if(t){for(r=e[0];(r=this._previousSibling(r))&&0===r.offsetHeight;);return!!r&&S(r)}for(r=e[0];(r=this._previousSibling(r))&&0===r.offsetHeight;);if(null===r)return!(!(r=e[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&S(r);for(e=S(r);e.hasClass("jstree-open");)e=e.children(".jstree-children").first().children(".jstree-node:visible:last");return e},get_parent:function(e){return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&e.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||0<e.children.length)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(n,o){var e,t,r,i,s;if(S.isArray(n))return this._load_nodes(n.slice(),o),!0;if(!(n=this.get_node(n)))return o&&o.call(this,n,!1),!1;if(n.state.loaded){for(n.state.loaded=!1,r=0,i=n.parents.length;r<i;r++)this._model.data[n.parents[r]].children_d=S.vakata.array_filter(this._model.data[n.parents[r]].children_d,function(e){return-1===S.inArray(e,n.children_d)});for(e=0,t=n.children_d.length;e<t;e++)this._model.data[n.children_d[e]].state.selected&&(s=!0),delete this._model.data[n.children_d[e]];s&&(this._data.core.selected=S.vakata.array_filter(this._data.core.selected,function(e){return-1===S.inArray(e,n.children_d)})),n.children=[],n.children_d=[],s&&this.trigger("changed",{action:"load_node",node:n,selected:this._data.core.selected})}return n.state.failed=!1,n.state.loading=!0,this.get_node(n,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(n,S.proxy(function(e){(n=this._model.data[n.id]).state.loading=!1,n.state.loaded=e,n.state.failed=!n.state.loaded;for(var t=this.get_node(n,!0),r=0,i=this._model.data,s=!1,r=0,a=n.children.length;r<a;r++)if(i[n.children[r]]&&!i[n.children[r]].state.hidden){s=!0;break}n.state.loaded&&t&&t.length&&(t.removeClass("jstree-closed jstree-open jstree-leaf"),s?"#"!==n.id&&t.addClass(n.state.opened?"jstree-open":"jstree-closed"):t.addClass("jstree-leaf")),t.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:n,status:e}),o&&o.call(this,n,e)},this)),!0},_load_nodes:function(e,t,r,i){for(var s=!0,a=function(){this._load_nodes(e,t,!0)},n=this._model.data,o=[],d=0,c=e.length;d<c;d++)n[e[d]]&&(!n[e[d]].state.loaded&&!n[e[d]].state.failed||!r&&i)&&(this.is_loading(e[d])||this.load_node(e[d],a),s=!1);if(s){for(d=0,c=e.length;d<c;d++)n[e[d]]&&n[e[d]].state.loaded&&o.push(e[d]);t&&!t.done&&(t.call(this,o),t.done=!0)}},load_all:function(e,t){if(e=e||S.jstree.root,!(e=this.get_node(e)))return!1;var r,i,s=[],a=this._model.data,n=a[e.id].children_d;for(e.state&&!e.state.loaded&&s.push(e.id),r=0,i=n.length;r<i;r++)a[n[r]]&&a[n[r]].state&&!a[n[r]].state.loaded&&s.push(n[r]);s.length?this._load_nodes(s,function(){this.load_all(e,t)}):(t&&t.call(this,e),this.trigger("load_all",{node:e}))},_load_node:function(s,a){function n(){return 3!==this.nodeType&&8!==this.nodeType}var e,t=this.settings.core.data;return t?S.isFunction(t)?t.call(this,s,S.proxy(function(e){!1===e?a.call(this,!1):this["string"==typeof e?"_append_html_data":"_append_json_data"](s,"string"==typeof e?S(S.parseHTML(e)).filter(n):e,function(e){a.call(this,e)})},this)):"object"==_typeof(t)?t.url?(t=S.extend(!0,{},t),S.isFunction(t.url)&&(t.url=t.url.call(this,s)),S.isFunction(t.data)&&(t.data=t.data.call(this,s)),S.ajax(t).done(S.proxy(function(e,t,r){var i=r.getResponseHeader("Content-Type");return i&&-1!==i.indexOf("json")||"object"==_typeof(e)?this._append_json_data(s,e,function(e){a.call(this,e)}):i&&-1!==i.indexOf("html")||"string"==typeof e?this._append_html_data(s,S(S.parseHTML(e)).filter(n),function(e){a.call(this,e)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:s.id,xhr:r})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1))},this)).fail(S.proxy(function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:s.id,xhr:e})},a.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=S.isArray(t)?S.extend(!0,[],t):S.isPlainObject(t)?S.extend(!0,{},t):t,s.id===S.jstree.root?this._append_json_data(s,e,function(e){a.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:s.id})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1))):"string"==typeof t?s.id===S.jstree.root?this._append_html_data(s,S(S.parseHTML(t)).filter(n),function(e){a.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:s.id})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1)):a.call(this,!1):s.id===S.jstree.root?this._append_html_data(s,this._data.core.original_container_html.clone(!0),function(e){a.call(this,e)}):a.call(this,!1)},_node_changed:function(e){(e=this.get_node(e))&&-1===S.inArray(e.id,this._model.changed)&&this._model.changed.push(e.id)},_append_html_data:function(e,t,r){(e=this.get_node(e)).children=[],e.children_d=[];var i,s,a,n=t.is("ul")?t.children():t,o=e.id,d=[],c=[],l=this._model.data,h=l[o],_=this._data.core.selected.length;for(n.each(S.proxy(function(e,t){(i=this._parse_model_from_html(S(t),o,h.parents.concat()))&&(d.push(i),c.push(i),l[i].children_d.length&&(c=c.concat(l[i].children_d)))},this)),h.children=d,h.children_d=c,s=0,a=h.parents.length;s<a;s++)l[h.parents[s]].children_d=l[h.parents[s]].children_d.concat(c);this.trigger("model",{nodes:c,parent:o}),o!==S.jstree.root?(this._node_changed(o),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==_&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.call(this,!0)},_append_json_data:function(e,t,d,r){if(null!==this.element){(e=this.get_node(e)).children=[],e.children_d=[],t.d&&("string"==typeof(t=t.d)&&(t=JSON.parse(t))),S.isArray(t)||(t=[t]);var i=null,s={df:this._model.default_state,dat:t,par:e.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},a=function(e,l){e.data&&(e=e.data);var t,r,i,s,a=e.dat,n=e.par,o=[],d=[],h=[],_=e.df,u=e.t_id,g=e.t_cnt,f=e.m,c=f[n],p=e.sel;if(a.length&&a[0].id!==l&&a[0].parent!==l){for(r=0,i=a.length;r<i;r++)a[r].children||(a[r].children=[]),a[r].state||(a[r].state={}),f[a[r].id.toString()]=a[r];for(r=0,i=a.length;r<i;r++)f[a[r].parent.toString()]?(f[a[r].parent.toString()].children.push(a[r].id.toString()),c.children_d.push(a[r].id.toString())):(this._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:a[r].id.toString(),parent:a[r].parent.toString()})},this.settings.core.error.call(this,this._data.core.last_error));for(r=0,i=c.children.length;r<i;r++)t=function e(t,r,i){i=i?i.concat():[],r&&i.unshift(r);var s,a,n,o,d=t.id.toString(),c={id:d,text:t.text||"",icon:t.icon===l||t.icon,parent:r,parents:i,children:t.children||[],children_d:t.children_d||[],data:t.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in _)_.hasOwnProperty(s)&&(c.state[s]=_[s]);if(t&&t.data&&t.data.jstree&&t.data.jstree.icon&&(c.icon=t.data.jstree.icon),c.icon!==l&&null!==c.icon&&""!==c.icon||(c.icon=!0),t&&t.data&&(c.data=t.data,t.data.jstree))for(s in t.data.jstree)t.data.jstree.hasOwnProperty(s)&&(c.state[s]=t.data.jstree[s]);if(t&&"object"==_typeof(t.state))for(s in t.state)t.state.hasOwnProperty(s)&&(c.state[s]=t.state[s]);if(t&&"object"==_typeof(t.li_attr))for(s in t.li_attr)t.li_attr.hasOwnProperty(s)&&(c.li_attr[s]=t.li_attr[s]);if(c.li_attr.id||(c.li_attr.id=d),t&&"object"==_typeof(t.a_attr))for(s in t.a_attr)t.a_attr.hasOwnProperty(s)&&(c.a_attr[s]=t.a_attr[s]);for(t&&t.children&&!0===t.children&&(c.state.loaded=!1,c.children=[],c.children_d=[]),s=0,a=(f[c.id]=c).children.length;s<a;s++)n=e(f[c.children[s]],c.id,i),o=f[n],c.children_d.push(n),o.children_d.length&&(c.children_d=c.children_d.concat(o.children_d));return delete t.data,delete t.children,f[c.id].original=t,c.state.selected&&h.push(c.id),c.id}(f[c.children[r]],n,c.parents.concat()),d.push(t),f[t].children_d.length&&(d=d.concat(f[t].children_d));for(r=0,i=c.parents.length;r<i;r++)f[c.parents[r]].children_d=f[c.parents[r]].children_d.concat(d);s={cnt:g,mod:f,sel:p,par:n,dpc:d,add:h}}else{for(r=0,i=a.length;r<i;r++)(t=function e(t,r,i){i=i?i.concat():[],r&&i.unshift(r);for(var s,a,n,o,d,c=!1;c="j"+u+"_"+ ++g,f[c];);for(s in d={id:!1,text:"string"==typeof t?t:"",icon:"object"!=_typeof(t)||t.icon===l||t.icon,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},_)_.hasOwnProperty(s)&&(d.state[s]=_[s]);if(t&&t.id&&(d.id=t.id.toString()),t&&t.text&&(d.text=t.text),t&&t.data&&t.data.jstree&&t.data.jstree.icon&&(d.icon=t.data.jstree.icon),d.icon!==l&&null!==d.icon&&""!==d.icon||(d.icon=!0),t&&t.data&&(d.data=t.data,t.data.jstree))for(s in t.data.jstree)t.data.jstree.hasOwnProperty(s)&&(d.state[s]=t.data.jstree[s]);if(t&&"object"==_typeof(t.state))for(s in t.state)t.state.hasOwnProperty(s)&&(d.state[s]=t.state[s]);if(t&&"object"==_typeof(t.li_attr))for(s in t.li_attr)t.li_attr.hasOwnProperty(s)&&(d.li_attr[s]=t.li_attr[s]);if(d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString()),d.id||(d.id=c),d.li_attr.id||(d.li_attr.id=d.id),t&&"object"==_typeof(t.a_attr))for(s in t.a_attr)t.a_attr.hasOwnProperty(s)&&(d.a_attr[s]=t.a_attr[s]);if(t&&t.children&&t.children.length){for(s=0,a=t.children.length;s<a;s++)n=e(t.children[s],d.id,i),o=f[n],d.children.push(n),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d));d.children_d=d.children_d.concat(d.children)}return t&&t.children&&!0===t.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),delete t.data,delete t.children,d.original=t,(f[d.id]=d).state.selected&&h.push(d.id),d.id}(a[r],n,c.parents.concat()))&&(o.push(t),d.push(t),f[t].children_d.length&&(d=d.concat(f[t].children_d)));for(c.children=o,c.children_d=d,r=0,i=c.parents.length;r<i;r++)f[c.parents[r]].children_d=f[c.parents[r]].children_d.concat(d);s={cnt:g,mod:f,sel:p,par:n,dpc:d,add:h}}return"undefined"!=typeof window&&void 0!==window.document?s:void postMessage(s)},n=function(e,t){if(null!==this.element){this._cnt=e.cnt;var r,i=this._model.data;for(r in i)i.hasOwnProperty(r)&&i[r].state&&i[r].state.loading&&e.mod[r]&&(e.mod[r].state.loading=!0);if(this._model.data=e.mod,t){var s,a=e.add,n=e.sel,o=this._data.core.selected.slice(),i=this._model.data;if(n.length!==o.length||S.vakata.array_unique(n.concat(o)).length!==n.length){for(r=0,s=n.length;r<s;r++)-1===S.inArray(n[r],a)&&-1===S.inArray(n[r],o)&&(i[n[r]].state.selected=!1);for(r=0,s=o.length;r<s;r++)-1===S.inArray(o[r],n)&&(i[o[r]].state.selected=!0)}}e.add.length&&(this._data.core.selected=this._data.core.selected.concat(e.add)),this.trigger("model",{nodes:e.dpc,parent:e.par}),e.par!==S.jstree.root?(this._node_changed(e.par),this.redraw()):this.redraw(!0),e.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+a.toString()],{type:"text/javascript"}))),!this._data.core.working||r?(this._data.core.working=!0,(i=new window.Worker(this._wrk)).onmessage=S.proxy(function(e){n.call(this,e.data,!0);try{i.terminate(),i=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),s.par?i.postMessage(s):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([e,t,d,!0])}catch(e){n.call(this,a(s),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else n.call(this,a(s),!1)}},_parse_model_from_html:function(e,t,r){r=r?[].concat(r):[],t&&r.unshift(t);var i,s,a,n,o,d=this._model.data,c={id:!1,text:!1,icon:!0,parent:t,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in this._model.default_state)this._model.default_state.hasOwnProperty(a)&&(c.state[a]=this._model.default_state[a]);if(n=S.vakata.attributes(e,!0),S.each(n,function(e,t){return!(t=S.trim(t)).length||(c.li_attr[e]=t,void("id"===e&&(c.id=t.toString())))}),(n=e.children("a").first()).length&&(n=S.vakata.attributes(n,!0),S.each(n,function(e,t){(t=S.trim(t)).length&&(c.a_attr[e]=t)})),(n=e.children("a").first().length?e.children("a").first().clone():e.clone()).children("ins, i, ul").remove(),n=n.html(),n=S("<div />").html(n),c.text=this.settings.core.force_text?n.text():n.html(),n=e.data(),c.data=n?S.extend(!0,{},n):null,c.state.opened=e.hasClass("jstree-open"),c.state.selected=e.children("a").hasClass("jstree-clicked"),c.state.disabled=e.children("a").hasClass("jstree-disabled"),c.data&&c.data.jstree)for(a in c.data.jstree)c.data.jstree.hasOwnProperty(a)&&(c.state[a]=c.data.jstree[a]);for((n=e.children("a").children(".jstree-themeicon")).length&&(c.icon=!n.hasClass("jstree-themeicon-hidden")&&n.attr("rel")),c.state.icon!==E&&(c.icon=c.state.icon),c.icon!==E&&null!==c.icon&&""!==c.icon||(c.icon=!0),n=e.children("ul").children("li");d[o="j"+this._id+"_"+ ++this._cnt];);return c.id=c.li_attr.id?c.li_attr.id.toString():o,n.length?(n.each(S.proxy(function(e,t){i=this._parse_model_from_html(S(t),c.id,r),s=this._model.data[i],c.children.push(i),s.children_d.length&&(c.children_d=c.children_d.concat(s.children_d))},this)),c.children_d=c.children_d.concat(c.children)):e.hasClass("jstree-closed")&&(c.state.loaded=!1),c.li_attr.class&&(c.li_attr.class=c.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),c.a_attr.class&&(c.a_attr.class=c.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),(d[c.id]=c).state.selected&&this._data.core.selected.push(c.id),c.id},_parse_model_from_flat_json:function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);var i,s,a,n,o=e.id.toString(),d=this._model.data,c=this._model.default_state,l={id:o,text:e.text||"",icon:e.icon===E||e.icon,parent:t,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in c)c.hasOwnProperty(i)&&(l.state[i]=c[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),l.icon!==E&&null!==l.icon&&""!==l.icon||(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==_typeof(e.state))for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==_typeof(e.li_attr))for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id||(l.li_attr.id=o),e&&"object"==_typeof(e.a_attr))for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),i=0,s=(d[l.id]=l).children.length;i<s;i++)n=d[a=this._parse_model_from_flat_json(d[l.children[i]],l.id,r)],l.children_d.push(a),n.children_d.length&&(l.children_d=l.children_d.concat(n.children_d));return delete e.data,delete e.children,d[l.id].original=e,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);for(var i,s,a,n,o,d=!1,c=this._model.data,l=this._model.default_state;c[d="j"+this._id+"_"+ ++this._cnt];);for(i in o={id:!1,text:"string"==typeof e?e:"",icon:"object"!=_typeof(e)||e.icon===E||e.icon,parent:t,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l)l.hasOwnProperty(i)&&(o.state[i]=l[i]);if(e&&e.id&&(o.id=e.id.toString()),e&&e.text&&(o.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(o.icon=e.data.jstree.icon),o.icon!==E&&null!==o.icon&&""!==o.icon||(o.icon=!0),e&&e.data&&(o.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(o.state[i]=e.data.jstree[i]);if(e&&"object"==_typeof(e.state))for(i in e.state)e.state.hasOwnProperty(i)&&(o.state[i]=e.state[i]);if(e&&"object"==_typeof(e.li_attr))for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(o.li_attr[i]=e.li_attr[i]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=d),o.li_attr.id||(o.li_attr.id=o.id),e&&"object"==_typeof(e.a_attr))for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(o.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,s=e.children.length;i<s;i++)n=c[a=this._parse_model_from_json(e.children[i],o.id,r)],o.children.push(a),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return e&&e.children&&!0===e.children&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete e.data,delete e.children,o.original=e,(c[o.id]=o).state.selected&&this._data.core.selected.push(o.id),o.id},_redraw:function(){for(var e,t=this._model.force_full_redraw?this._model.data[S.jstree.root].children.concat([]):this._model.changed.concat([]),r=y.createElement("UL"),i=this._data.core.focused,s=0,a=t.length;s<a;s++)(e=this.redraw_node(t[s],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&r.appendChild(e);this._model.force_full_redraw&&(r.className=this.get_container_ul()[0].className,r.setAttribute("role","group"),this.element.empty().append(r)),null!==i&&this.settings.core.restore_focus&&((e=this.get_node(i,!0))&&e.length&&e.children(".jstree-anchor")[0]!==y.activeElement?e.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:t})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(e){var t,r=this.get_node(e),i=!1,s=!1,a=y;if(!r)return!1;if(r.id===S.jstree.root)return this.redraw(!0);if(!(e=this.get_node(e,!0))||!e.length)return!1;if(e.children(".jstree-children").remove(),e=e[0],r.children.length&&r.state.loaded){for((s=a.createElement("UL")).setAttribute("role","group"),s.className="jstree-children",i=0,t=r.children.length;i<t;i++)s.appendChild(this.redraw_node(r.children[i],!0,!0));e.appendChild(s)}},redraw_node:function(e,t,r,i){var s,a,n=this.get_node(e),o=!1,d=!1,c=!1,l=!1,h=!1,_=!1,u="",g=y,f=this._model.data,p=!1,m=null,v=!1,j=!1;if(!n)return!1;if(n.id===S.jstree.root)return this.redraw(!0);if(t=t||0===n.children.length,e=y.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(n.id[0])?"\\3"+n.id[0]+" "+n.id.substr(1).replace(S.jstree.idregex,"\\$&"):n.id.replace(S.jstree.idregex,"\\$&"))):y.getElementById(n.id))e=S(e),r||((o=e.parent().parent()[0])===this.element[0]&&(o=null),d=e.index()),t||!n.children.length||e.children(".jstree-children").length||(t=!0),t||(c=e.children(".jstree-children")[0]),p=e.children(".jstree-anchor")[0]===y.activeElement,e.remove();else if(t=!0,!r){if(!(null===(o=n.parent!==S.jstree.root?S("#"+n.parent.replace(S.jstree.idregex,"\\$&"),this.element)[0]:null)||o&&f[n.parent].state.opened))return!1;d=S.inArray(n.id,null===o?f[S.jstree.root].children:f[n.parent].children)}for(l in e=this._data.core.node.cloneNode(!0),u="jstree-node ",n.li_attr)if(n.li_attr.hasOwnProperty(l)){if("id"===l)continue;"class"!==l?e.setAttribute(l,n.li_attr[l]):u+=n.li_attr[l]}for(n.a_attr.id||(n.a_attr.id=n.id+"_anchor"),e.setAttribute("aria-selected",!!n.state.selected),e.setAttribute("aria-level",n.parents.length),e.setAttribute("aria-labelledby",n.a_attr.id),n.state.disabled&&e.setAttribute("aria-disabled",!0),l=0,h=n.children.length;l<h;l++)if(!f[n.children[l]].state.hidden){v=!0;break}if(null!==n.parent&&f[n.parent]&&!n.state.hidden&&(l=S.inArray(n.id,f[n.parent].children),j=n.id,-1!==l))for(l++,h=f[n.parent].children.length;l<h&&(f[f[n.parent].children[l]].state.hidden||(j=f[n.parent].children[l]),j===n.id);l++);for(h in n.state.hidden&&(u+=" jstree-hidden"),n.state.loading&&(u+=" jstree-loading"),n.state.loaded&&!v?u+=" jstree-leaf":(u+=n.state.opened&&n.state.loaded?" jstree-open":" jstree-closed",e.setAttribute("aria-expanded",n.state.opened&&n.state.loaded)),j===n.id&&(u+=" jstree-last"),e.id=n.id,e.className=u,u=(n.state.selected?" jstree-clicked":"")+(n.state.disabled?" jstree-disabled":""),n.a_attr)if(n.a_attr.hasOwnProperty(h)){if("href"===h&&"#"===n.a_attr[h])continue;"class"!==h?e.childNodes[1].setAttribute(h,n.a_attr[h]):u+=" "+n.a_attr[h]}if(u.length&&(e.childNodes[1].className="jstree-anchor "+u),(n.icon&&!0!==n.icon||!1===n.icon)&&(!1===n.icon?e.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===n.icon.indexOf("/")&&-1===n.icon.indexOf(".")?e.childNodes[1].childNodes[0].className+=" "+n.icon+" jstree-themeicon-custom":(e.childNodes[1].childNodes[0].style.backgroundImage='url("'+n.icon+'")',e.childNodes[1].childNodes[0].style.backgroundPosition="center center",e.childNodes[1].childNodes[0].style.backgroundSize="auto",e.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?e.childNodes[1].appendChild(g.createTextNode(n.text)):e.childNodes[1].innerHTML+=n.text,t&&n.children.length&&(n.state.opened||i)&&n.state.loaded){for((_=g.createElement("UL")).setAttribute("role","group"),_.className="jstree-children",l=0,h=n.children.length;l<h;l++)_.appendChild(this.redraw_node(n.children[l],t,!0));e.appendChild(_)}if(c&&e.appendChild(c),!r){for(l=0,h=(o=o||this.element[0]).childNodes.length;l<h;l++)if(o.childNodes[l]&&o.childNodes[l].className&&-1!==o.childNodes[l].className.indexOf("jstree-children")){m=o.childNodes[l];break}m||((m=g.createElement("UL")).setAttribute("role","group"),m.className="jstree-children",o.appendChild(m)),d<(o=m).childNodes.length?o.insertBefore(e,o.childNodes[d]):o.appendChild(e),p&&(s=this.element[0].scrollTop,a=this.element[0].scrollLeft,e.childNodes[1].focus(),this.element[0].scrollTop=s,this.element[0].scrollLeft=a)}return n.state.opened&&!n.state.loaded&&(n.state.opened=!1,setTimeout(S.proxy(function(){this.open_node(n.id,!1,0)},this),0)),e},open_node:function(e,r,i){var t,s,a,n;if(S.isArray(e)){for(t=0,s=(e=e.slice()).length;t<s;t++)this.open_node(e[t],r,i);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(i=i===E?this.settings.core.animation:i,this.is_closed(e)?this.is_loaded(e)?(a=this.get_node(e,!0),n=this,a.length&&(i&&a.children(".jstree-children").length&&a.children(".jstree-children").stop(!0,!0),e.children.length&&!this._firstChild(a.children(".jstree-children")[0])&&this.draw_children(e),i?(this.trigger("before_open",{node:e}),a.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(i,function(){this.style.display="",n.element&&n.trigger("after_open",{node:e})})):(this.trigger("before_open",{node:e}),a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].setAttribute("aria-expanded",!0))),e.state.opened=!0,r&&r.call(this,e,!0),a.length||this.trigger("before_open",{node:e}),this.trigger("open_node",{node:e}),i&&a.length||this.trigger("after_open",{node:e}),!0):this.is_loading(e)?setTimeout(S.proxy(function(){this.open_node(e,r,i)},this),500):void this.load_node(e,function(e,t){return t?this.open_node(e,r,i):!!r&&r.call(this,e,!1)}):(r&&r.call(this,e,!1),!1))},_open_to:function(e){if(!(e=this.get_node(e))||e.id===S.jstree.root)return!1;for(var t=e.parents,r=0,i=t.length;r<i;r+=1)r!==S.jstree.root&&this.open_node(t[r],!1,0);return S("#"+e.id.replace(S.jstree.idregex,"\\$&"),this.element)},close_node:function(e,t){var r,i,s,a;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.close_node(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(!this.is_closed(e)&&(t=t===E?this.settings.core.animation:t,a=(s=this).get_node(e,!0),e.state.opened=!1,this.trigger("close_node",{node:e}),void(a.length?t?a.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(t,function(){this.style.display="",a.children(".jstree-children").remove(),s.element&&s.trigger("after_close",{node:e})}):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:e})):this.trigger("after_close",{node:e}))))},toggle_node:function(e){var t,r;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.toggle_node(e[t]);return!0}return this.is_closed(e)?this.open_node(e):this.is_open(e)?this.close_node(e):void 0},open_all:function(e,r,i){if(e=e||S.jstree.root,!(e=this.get_node(e)))return!1;var t,s,a,n=e.id===S.jstree.root?this.get_container_ul():this.get_node(e,!0);if(!n.length){for(t=0,s=e.children_d.length;t<s;t++)this.is_closed(this._model.data[e.children_d[t]])&&(this._model.data[e.children_d[t]].state.opened=!0);return this.trigger("open_all",{node:e})}i=i||n,(n=(a=this).is_closed(e)?n.find(".jstree-closed").addBack():n.find(".jstree-closed")).each(function(){a.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,r,i)},r||0)}),0===i.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(i)})},close_all:function(e,t){if(e=e||S.jstree.root,!(e=this.get_node(e)))return!1;var r,i,s=e.id===S.jstree.root?this.get_container_ul():this.get_node(e,!0),a=this;for(s.length&&(s=this.is_open(e)?s.find(".jstree-open").addBack():s.find(".jstree-open"),S(s.get().reverse()).each(function(){a.close_node(this,t||0)})),r=0,i=e.children_d.length;r<i;r++)this._model.data[e.children_d[r]].state.opened=!1;this.trigger("close_all",{node:e})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(e){var t,r;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.enable_node(e[t]);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(e.state.disabled=!1,this.get_node(e,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:e}))},disable_node:function(e){var t,r;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.disable_node(e[t]);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(e.state.disabled=!0,this.get_node(e,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:e}))},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(e,t){var r,i;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.hide_node(e[r],!0);return t||this.redraw(),!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&void(e.state.hidden||(e.state.hidden=!0,this._node_changed(e.parent),t||this.redraw(),this.trigger("hide_node",{node:e})))},show_node:function(e,t){var r,i;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.show_node(e[r],!0);return t||this.redraw(),!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&void(e.state.hidden&&(e.state.hidden=!1,this._node_changed(e.parent),t||this.redraw(),this.trigger("show_node",{node:e})))},hide_all:function(e){var t,r=this._model.data,i=[];for(t in r)r.hasOwnProperty(t)&&t!==S.jstree.root&&!r[t].state.hidden&&(r[t].state.hidden=!0,i.push(t));return this._model.force_full_redraw=!0,e||this.redraw(),this.trigger("hide_all",{nodes:i}),i},show_all:function(e){var t,r=this._model.data,i=[];for(t in r)r.hasOwnProperty(t)&&t!==S.jstree.root&&r[t].state.hidden&&(r[t].state.hidden=!1,i.push(t));return this._model.force_full_redraw=!0,e||this.redraw(),this.trigger("show_all",{nodes:i}),i},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(t&&"object"==_typeof(t)||(t={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==E?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),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){for(var r=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,a=!1,n=0,o=s.length;n<o;n+=1)s[n]===r&&(a=!a),s[n]===i&&(a=!a),this.is_disabled(s[n])||!a&&s[n]!==r&&s[n]!==i?this.deselect_node(s[n],!0,t):this.is_hidden(s[n])||this.select_node(s[n],!0,!1,t);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:t})}else this.is_selected(e)?this.deselect_node(e,!1,t):this.select_node(e,!1,!1,t);else!this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,t):(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),event:t})},hover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),r=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout(function(){r.attr("aria-activedescendant",e[0].id)},0)},dehover_node:function(e){return!!((e=this.get_node(e,!0))&&e.length&&e.children(".jstree-hovered").length)&&(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)}))},select_node:function(e,t,r,i){var s,a,n;if(S.isArray(e)){for(a=0,n=(e=e.slice()).length;a<n;a++)this.select_node(e[a],t,r,i);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(s=this.get_node(e,!0),void(e.state.selected||(e.state.selected=!0,this._data.core.selected.push(e.id),r||(s=this._open_to(e)),s&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:e,selected:this._data.core.selected,event:i}),t||this.trigger("changed",{action:"select_node",node:e,selected:this._data.core.selected,event:i}))))},deselect_node:function(e,t,r){var i,s,a;if(S.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.deselect_node(e[i],t,r);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(a=this.get_node(e,!0),void(e.state.selected&&(e.state.selected=!1,this._data.core.selected=S.vakata.array_remove_item(this._data.core.selected,e.id),a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:e,selected:this._data.core.selected,event:r}),t||this.trigger("changed",{action:"deselect_node",node:e,selected:this._data.core.selected,event:r}))))},select_all:function(e){var t,r,i=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[S.jstree.root].children_d.concat(),t=0,r=this._data.core.selected.length;t<r;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].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:i})},deselect_all:function(e){for(var t=this._data.core.selected.concat([]),r=0,i=this._data.core.selected.length;r<i;r++)this._model.data[this._data.core.selected[r]]&&(this._model.data[this._data.core.selected[r]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),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.id===S.jstree.root)&&e.state.selected},get_selected:function(e){return e?S.map(this._data.core.selected,S.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected.slice()},get_top_selected:function(e){for(var t,r,i=this.get_selected(!0),s={},a=0,n=i.length;a<n;a++)s[i[a].id]=i[a];for(a=0,n=i.length;a<n;a++)for(t=0,r=i[a].children_d.length;t<r;t++)s[i[a].children_d[t]]&&delete s[i[a].children_d[t]];for(a in i=[],s)s.hasOwnProperty(a)&&i.push(a);return e?S.map(i,S.proxy(function(e){return this.get_node(e)},this)):i},get_bottom_selected:function(e){for(var t=this.get_selected(!0),r=[],i=0,s=t.length;i<s;i++)t[i].children.length||r.push(t[i].id);return e?S.map(r,S.proxy(function(e){return this.get_node(e)},this)):r},get_state:function(){var e,t={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(e in this._model.data)this._model.data.hasOwnProperty(e)&&e!==S.jstree.root&&(this._model.data[e].state.loaded&&this.settings.core.loaded_state&&t.core.loaded.push(e),this._model.data[e].state.opened&&t.core.open.push(e),this._model.data[e].state.selected&&t.core.selected.push(e));return t},set_state:function(t,r){if(t){if(t.core&&t.core.selected&&t.core.initial_selection===E&&(t.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),t.core){var i,e;if(t.core.loaded)return this.settings.core.loaded_state&&S.isArray(t.core.loaded)&&t.core.loaded.length?this._load_nodes(t.core.loaded,function(e){delete t.core.loaded,this.set_state(t,r)}):(delete t.core.loaded,this.set_state(t,r)),!1;if(t.core.open)return S.isArray(t.core.open)&&t.core.open.length?this._load_nodes(t.core.open,function(e){this.open_node(e,!1,0),delete t.core.open,this.set_state(t,r)}):(delete t.core.open,this.set_state(t,r)),!1;if(t.core.scroll)return t.core.scroll&&t.core.scroll.left!==E&&this.element.scrollLeft(t.core.scroll.left),t.core.scroll&&t.core.scroll.top!==E&&this.element.scrollTop(t.core.scroll.top),delete t.core.scroll,this.set_state(t,r),!1;if(t.core.selected)return i=this,t.core.initial_selection!==E&&t.core.initial_selection!==this._data.core.selected.concat([]).sort().join(",")||(this.deselect_all(),S.each(t.core.selected,function(e,t){i.select_node(t,!1,!0)})),delete t.core.initial_selection,delete t.core.selected,this.set_state(t,r),!1;for(e in t)t.hasOwnProperty(e)&&"core"!==e&&-1===S.inArray(e,this.settings.plugins)&&delete t[e];if(S.isEmptyObject(t.core))return delete t.core,this.set_state(t,r),!1}return!S.isEmptyObject(t)||(t=null,r&&r.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(e,t){this._data.core.state=!0===t?{}:this.get_state(),t&&S.isFunction(t)&&(this._data.core.state=t.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[S.jstree.root]={id:S.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var r=this.get_container_ul()[0].className;e||(this.element.html("<ul class='"+r+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(S.jstree.root,function(e,t){t&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(S.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===S.jstree.root)return!1;var r=[],e=[],i=this._data.core.selected.concat([]);e.push(t.id),!0===t.state.opened&&r.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){e.push(this.id),r.push(this.id)}),this._load_nodes(e,S.proxy(function(e){this.open_node(r,!1,0),this.select_node(i),this.trigger("refresh_node",{node:t,nodes:e})},this),!1,!0)},set_id:function(e,t){if(!(e=this.get_node(e))||e.id===S.jstree.root)return!1;var r,i,s=this._model.data,a=e.id;for(t=t.toString(),s[e.parent].children[S.inArray(e.id,s[e.parent].children)]=t,r=0,i=e.parents.length;r<i;r++)s[e.parents[r]].children_d[S.inArray(e.id,s[e.parents[r]].children_d)]=t;for(r=0,i=e.children.length;r<i;r++)s[e.children[r]].parent=t;for(r=0,i=e.children_d.length;r<i;r++)s[e.children_d[r]].parents[S.inArray(e.id,s[e.children_d[r]].parents)]=t;return-1!==(r=S.inArray(e.id,this._data.core.selected))&&(this._data.core.selected[r]=t),(r=this.get_node(e.id,!0))&&(r.attr("id",t),this.element.attr("aria-activedescendant")===e.id&&this.element.attr("aria-activedescendant",t)),delete s[e.id],e.id=t,s[e.li_attr.id=t]=e,this.trigger("set_id",{node:e,new:e.id,old:a}),!0},get_text:function(e){return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&e.text},set_text:function(e,t){var r,i;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.set_text(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(e.text=t,this.get_node(e,!0).length&&this.redraw_node(e.id),this.trigger("set_text",{obj:e,text:t}),!0)},get_json:function(e,t,r){if(!(e=this.get_node(e||S.jstree.root)))return!1;t&&t.flat&&!r&&(r=[]);var i,s,a={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:S.extend(!0,{},e.li_attr),a_attr:S.extend(!0,{},e.a_attr),state:{},data:(!t||!t.no_data)&&S.extend(!0,S.isArray(e.data)?[]:{},e.data)};if(t&&t.flat?a.parent=e.parent:a.children=[],t&&t.no_state)delete a.state;else for(i in e.state)e.state.hasOwnProperty(i)&&(a.state[i]=e.state[i]);if(t&&t.no_li_attr&&delete a.li_attr,t&&t.no_a_attr&&delete a.a_attr,t&&t.no_id&&(delete a.id,a.li_attr&&a.li_attr.id&&delete a.li_attr.id,a.a_attr&&a.a_attr.id&&delete a.a_attr.id),t&&t.flat&&e.id!==S.jstree.root&&r.push(a),!t||!t.no_children)for(i=0,s=e.children.length;i<s;i++)t&&t.flat?this.get_json(e.children[i],t,r):a.children.push(this.get_json(e.children[i],t));return t&&t.flat?r:e.id===S.jstree.root?a.children:a},create_node:function(e,t,r,i,s){if(null===e&&(e=S.jstree.root),!(e=this.get_node(e)))return!1;if(!(r=r===E?"last":r).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(e))return this.load_node(e,function(){this.create_node(e,t,r,i,!0)});var a,n,o,d;switch((t="string"==typeof(t=t||{text:this.get_string("New node")})?{text:t}:S.extend(!0,{},t)).text===E&&(t.text=this.get_string("New node")),e.id===S.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":a=this.get_node(e.parent),r=S.inArray(e.id,a.children),e=a;break;case"after":a=this.get_node(e.parent),r=S.inArray(e.id,a.children)+1,e=a;break;case"inside":case"first":r=0;break;case"last":r=e.children.length;break;default:r=r||0}if(r>e.children.length&&(r=e.children.length),t.id||(t.id=!0),!this.check("create_node",t,e,r))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===t.id&&delete t.id,!(t=this._parse_model_from_json(t,e.id,e.parents.concat())))return!1;for(a=this.get_node(t),(n=[]).push(t),n=n.concat(a.children_d),this.trigger("model",{nodes:n,parent:e.id}),e.children_d=e.children_d.concat(n),o=0,d=e.parents.length;o<d;o++)this._model.data[e.parents[o]].children_d=this._model.data[e.parents[o]].children_d.concat(n);for(t=a,a=[],o=0,d=e.children.length;o<d;o++)a[r<=o?o+1:o]=e.children[o];return a[r]=t.id,e.children=a,this.redraw_node(e,!0),this.trigger("create_node",{node:this.get_node(t),parent:e.id,position:r}),i&&i.call(this,this.get_node(t)),t.id},rename_node:function(e,t){var r,i,s;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.rename_node(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(s=e.text,this.check("rename_node",e,this.get_parent(e),t)?(this.set_text(e,t),this.trigger("rename_node",{node:e,text:t,old:s}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(e){var t,r,i,s,a,n,o,d,c,l,h,_;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.delete_node(e[t]);return!0}if(!(e=this.get_node(e))||e.id===S.jstree.root)return!1;if(i=this.get_node(e.parent),s=S.inArray(e.id,i.children),l=!1,!this.check("delete_node",e,i,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==s&&(i.children=S.vakata.array_remove(i.children,s)),(a=e.children_d.concat([])).push(e.id),n=0,o=e.parents.length;n<o;n++)this._model.data[e.parents[n]].children_d=S.vakata.array_filter(this._model.data[e.parents[n]].children_d,function(e){return-1===S.inArray(e,a)});for(d=0,c=a.length;d<c;d++)if(this._model.data[a[d]].state.selected){l=!0;break}for(l&&(this._data.core.selected=S.vakata.array_filter(this._data.core.selected,function(e){return-1===S.inArray(e,a)})),this.trigger("delete_node",{node:e,parent:i.id}),l&&this.trigger("changed",{action:"delete_node",node:e,selected:this._data.core.selected,parent:i.id}),d=0,c=a.length;d<c;d++)delete this._model.data[a[d]];return-1!==S.inArray(this._data.core.focused,a)&&(this._data.core.focused=null,h=this.element[0].scrollTop,_=this.element[0].scrollLeft,i.id===S.jstree.root?this._model.data[S.jstree.root].children[0]&&this.get_node(this._model.data[S.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(i,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=h,this.element[0].scrollLeft=_),this.redraw_node(i,!0),!0},check:function(e,t,r,i,s){t=t&&t.id?t:this.get_node(t),r=r&&r.id?r:this.get_node(r);var a=e.match(/^move_node|copy_node|create_node$/i)?r:t,n=this.settings.core.check_callback;return"move_node"!==e&&"copy_node"!==e||s&&s.is_multi||t.id!==r.id&&("move_node"!==e||S.inArray(t.id,r.children)!==i)&&-1===S.inArray(r.id,t.children_d)?(a&&a.data&&(a=a.data),a&&a.functions&&(!1===a.functions[e]||!0===a.functions[e])?(!1===a.functions[e]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),a.functions[e]):!(!1===n||S.isFunction(n)&&!1===n.call(this,e,t,r,i,s)||n&&!1===n[e])||!(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})})):!(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})})},last_error:function(){return this._data.core.last_error},move_node:function(e,t,r,i,s,a,n){var o,d,c,l,h,_,u,g,f,p,m,v,j,y;if(t=this.get_node(t),r=r===E?0:r,!t)return!1;if(!r.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(t))return this.load_node(t,function(){this.move_node(e,t,r,i,!0,!1,n)});if(S.isArray(e)){if(1!==e.length){for(o=0,d=e.length;o<d;o++)(f=this.move_node(e[o],t,r,i,s,!1,n))&&(t=f,r="after");return this.redraw(),!0}e=e[0]}if(!(e=e&&e.id?e:this.get_node(e))||e.id===S.jstree.root)return!1;if(c=(e.parent||S.jstree.root).toString(),h=r.toString().match(/^(before|after)$/)&&t.id!==S.jstree.root?this.get_node(t.parent):t,u=!(_=n||(this._model.data[e.id]?this:S.jstree.reference(e.id)))||!_._id||this._id!==_._id,l=_&&_._id&&c&&_._model.data[c]&&_._model.data[c].children?S.inArray(e.id,_._model.data[c].children):-1,_&&_._id&&(e=_._model.data[e.id]),u)return!!(f=this.copy_node(e,t,r,i,s,!1,n))&&(_&&_.delete_node(e),f);switch(t.id===S.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=S.inArray(t.id,h.children);break;case"after":r=S.inArray(t.id,h.children)+1;break;case"inside":case"first":r=0;break;case"last":r=h.children.length;break;default:r=r||0}if(r>h.children.length&&(r=h.children.length),!this.check("move_node",e,h,r,{core:!0,origin:n,is_multi:_&&_._id&&_._id!==this._id,is_foreign:!_||!_._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(e.parent===h.id){for(g=h.children.concat(),-1!==(f=S.inArray(e.id,g))&&(g=S.vakata.array_remove(g,f),f<r&&r--),f=[],p=0,m=g.length;p<m;p++)f[r<=p?p+1:p]=g[p];f[r]=e.id,h.children=f,this._node_changed(h.id),this.redraw(h.id===S.jstree.root)}else{for((f=e.children_d.concat()).push(e.id),p=0,m=e.parents.length;p<m;p++){for(g=[],v=0,j=(y=_._model.data[e.parents[p]].children_d).length;v<j;v++)-1===S.inArray(y[v],f)&&g.push(y[v]);_._model.data[e.parents[p]].children_d=g}for(_._model.data[c].children=S.vakata.array_remove_item(_._model.data[c].children,e.id),p=0,m=h.parents.length;p<m;p++)this._model.data[h.parents[p]].children_d=this._model.data[h.parents[p]].children_d.concat(f);for(g=[],p=0,m=h.children.length;p<m;p++)g[r<=p?p+1:p]=h.children[p];for(g[r]=e.id,h.children=g,h.children_d.push(e.id),h.children_d=h.children_d.concat(e.children_d),e.parent=h.id,(f=h.parents.concat()).unshift(h.id),y=e.parents.length,f=(e.parents=f).concat(),p=0,m=e.children_d.length;p<m;p++)this._model.data[e.children_d[p]].parents=this._model.data[e.children_d[p]].parents.slice(0,-1*y),Array.prototype.push.apply(this._model.data[e.children_d[p]].parents,f);c!==S.jstree.root&&h.id!==S.jstree.root||(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(c),this._node_changed(h.id)),a||this.redraw()}return i&&i.call(this,e,h,r),this.trigger("move_node",{node:e,parent:h.id,position:r,old_parent:c,old_position:l,is_multi:_&&_._id&&_._id!==this._id,is_foreign:!_||!_._id,old_instance:_,new_instance:this}),e.id},copy_node:function(e,t,r,i,s,a,n){var o,d,c,l,h,_,u,g,f,p;if(t=this.get_node(t),r=r===E?0:r,!t)return!1;if(!r.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(t))return this.load_node(t,function(){this.copy_node(e,t,r,i,!0,!1,n)});if(S.isArray(e)){if(1!==e.length){for(o=0,d=e.length;o<d;o++)(l=this.copy_node(e[o],t,r,i,s,!0,n))&&(t=l,r="after");return this.redraw(),!0}e=e[0]}if(!(e=e&&e.id?e:this.get_node(e))||e.id===S.jstree.root)return!1;switch(g=(e.parent||S.jstree.root).toString(),f=r.toString().match(/^(before|after)$/)&&t.id!==S.jstree.root?this.get_node(t.parent):t,(p=n||(this._model.data[e.id]?this:S.jstree.reference(e.id)))&&p._id&&(this._id,p._id),p&&p._id&&(e=p._model.data[e.id]),t.id===S.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=S.inArray(t.id,f.children);break;case"after":r=S.inArray(t.id,f.children)+1;break;case"inside":case"first":r=0;break;case"last":r=f.children.length;break;default:r=r||0}if(r>f.children.length&&(r=f.children.length),!this.check("copy_node",e,f,r,{core:!0,origin:n,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(u=p?p.get_json(e,{no_id:!0,no_data:!0,no_state:!0}):e))return!1;if(!0===u.id&&delete u.id,!(u=this._parse_model_from_json(u,f.id,f.parents.concat())))return!1;for(l=this.get_node(u),e&&e.state&&!1===e.state.loaded&&(l.state.loaded=!1),(c=[]).push(u),c=c.concat(l.children_d),this.trigger("model",{nodes:c,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(c);for(c=[],h=0,_=f.children.length;h<_;h++)c[r<=h?h+1:h]=f.children[h];return c[r]=l.id,f.children=c,f.children_d.push(l.id),f.children_d=f.children_d.concat(l.children_d),f.id===S.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(f.id),a||this.redraw(f.id===S.jstree.root),i&&i.call(this,l,f,r),this.trigger("copy_node",{node:l,original:e,parent:f.id,position:r,old_parent:g,old_position:p&&p._id&&g&&p._model.data[g]&&p._model.data[g].children?S.inArray(e.id,p._model.data[g].children):-1,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id,old_instance:p,new_instance:this}),l.id},cut:function(e){if(e=e||this._data.core.selected.concat(),S.isArray(e)||(e=[e]),!e.length)return!1;for(var t,r=[],i=0,s=e.length;i<s;i++)(t=this.get_node(e[i]))&&t.id&&t.id!==S.jstree.root&&r.push(t);return!!r.length&&(a=r,n="move_node",void(o=this).trigger("cut",{node:e}))},copy:function(e){if(e=e||this._data.core.selected.concat(),S.isArray(e)||(e=[e]),!e.length)return!1;for(var t,r=[],i=0,s=e.length;i<s;i++)(t=this.get_node(e[i]))&&t.id&&t.id!==S.jstree.root&&r.push(t);return!!r.length&&(a=r,n="copy_node",void(o=this).trigger("copy",{node:e}))},get_buffer:function(){return{mode:n,node:a,inst:o}},can_paste:function(){return!1!==n&&!1!==a},paste:function(e,t){return!!((e=this.get_node(e))&&n&&n.match(/^(copy_node|move_node)$/)&&a)&&(this[n](a,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:a,mode:n}),void(o=n=a=!1))},clear_buffer:function(){o=n=a=!1,this.trigger("clear_buffer")},edit:function(s,e,a){var t,r,n,o,d,c,l,i,h,_=!1;return!!(s=this.get_node(s))&&(this.check("edit",s,this.get_parent(s))?(h=s,e="string"==typeof e?e:s.text,this.set_text(s,""),s=this._open_to(s),h.text=e,t=this._data.core.rtl,r=this.element.width(),this._data.core.focused=h.id,n=s.children(".jstree-anchor").focus(),o=S("<span>"),d=e,c=S("<div />",{css:{position:"absolute",top:"-200px",left:t?"0px":"-1000px",visibility:"hidden"}}).appendTo(y.body),l=S("<input />",{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:S.proxy(function(e){e.stopImmediatePropagation(),e.preventDefault();var t,r=o.children(".jstree-rename-input").val(),i=this.settings.core.force_text;""===r&&(r=d),c.remove(),o.replaceWith(n),o.remove(),d=i?d:S("<div></div>").append(S.parseHTML(d)).html(),s=this.get_node(s),this.set_text(s,d),(t=!!this.rename_node(s,i?S("<div></div>").text(r).text():S("<div></div>").append(S.parseHTML(r)).html()))||this.set_text(s,d),this._data.core.focused=h.id,setTimeout(S.proxy(function(){var e=this.get_node(h.id,!0);e.length&&(this._data.core.focused=h.id,e.children(".jstree-anchor").focus())},this),0),a&&a.call(this,h,t,_),l=null},this),keydown:function(e){var t=e.which;27===t&&(_=!0,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(){l.width(Math.min(c.text("pW"+this.value).width(),r))},keypress:function(e){return 13!==e.which&&void 0}}),i={fontFamily:n.css("fontFamily")||"",fontSize:n.css("fontSize")||"",fontWeight:n.css("fontWeight")||"",fontStyle:n.css("fontStyle")||"",fontStretch:n.css("fontStretch")||"",fontVariant:n.css("fontVariant")||"",letterSpacing:n.css("letterSpacing")||"",wordSpacing:n.css("wordSpacing")||""},o.attr("class",n.attr("class")).append(n.contents().clone()).append(l),n.replaceWith(o),c.css(i),l.css(i).width(Math.min(c.text("pW"+l[0].value).width(),r))[0].select(),void S(y).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(e){l&&e.target!==l&&S(l).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(e,t){if(!e)return!1;!0===t&&(t=(this.settings.core.themes.dir||S.jstree.path+"/themes")+"/"+e+"/style.css"),t&&-1===S.inArray(t,r)&&(S("head").append('<link rel="stylesheet" href="'+t+'" type="text/css" />'),r.push(t)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=e,this.element.addClass("jstree-"+e),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+e+"-responsive"),this.trigger("set_theme",{theme:e})},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)&&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"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},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"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_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"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(e,t){var r,i,s,a;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.set_icon(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(a=e.icon,e.icon=!0===t||null===t||t===E||""===t||t,s=this.get_node(e,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===t?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),this.hide_icon(e)):(!0===t||null===t||t===E||""===t?s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"):-1===t.indexOf("/")&&-1===t.indexOf(".")?(s.removeClass(a).css("background",""),s.addClass(t+" jstree-themeicon-custom").attr("rel",t)):(s.removeClass(a).css("background",""),s.addClass("jstree-themeicon-custom").css("background","url('"+t+"') center center no-repeat").attr("rel",t)),!1===a&&this.show_icon(e)),!0)},get_icon:function(e){return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&e.icon},hide_icon:function(e){var t,r;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.hide_icon(e[t]);return!0}return!(!(e=this.get_node(e))||e===S.jstree.root)&&(e.icon=!1,this.get_node(e,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(e){var t,r,i;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.show_icon(e[t]);return!0}return!(!(e=this.get_node(e))||e===S.jstree.root)&&(i=this.get_node(e,!0),e.icon=!i.length||i.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),e.icon||(e.icon=!0),i.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},S.vakata={},S.vakata.attributes=function(e,r){e=S(e)[0];var i=r?{}:[];return e&&e.attributes&&S.each(e.attributes,function(e,t){-1===S.inArray(t.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==t.value&&""!==S.trim(t.value)&&(r?i[t.name]=t.value:i.push(t.name))}),i},S.vakata.array_unique=function(e){for(var t=[],r={},i=0,s=e.length;i<s;i++)r[e[i]]===E&&(t.push(e[i]),r[e[i]]=!0);return t},S.vakata.array_remove=function(e,t){return e.splice(t,1),e},S.vakata.array_remove_item=function(e,t){var r=S.inArray(t,e);return-1!==r?S.vakata.array_remove(e,r):e},S.vakata.array_filter=function(e,t,r,i,s){if(e.filter)return e.filter(t,r);for(s in i=[],e)~~s+""==s+""&&0<=s&&t.call(r,e[s],+s,e)&&i.push(e[s]);return i},S.jstree.plugins.changed=function(e,a){var n=[];this.trigger=function(e,t){if(t=t||{},"changed"===e.replace(".jstree","")){t.changed={selected:[],deselected:[]};for(var r={},i=0,s=n.length;i<s;i++)r[n[i]]=1;for(i=0,s=t.selected.length;i<s;i++)r[t.selected[i]]?r[t.selected[i]]=2:t.changed.selected.push(t.selected[i]);for(i=0,s=n.length;i<s;i++)1===r[n[i]]&&t.changed.deselected.push(n[i]);n=t.selected.slice()}a.trigger.call(this,e,t)},this.refresh=function(e,t){return n=[],a.refresh.apply(this,arguments)}};var d,c,l=y.createElement("I");l.className="jstree-icon jstree-checkbox",l.setAttribute("role","presentation"),S.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},S.jstree.plugins.checkbox=function(e,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",S.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",S.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",S.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(S.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",S.proxy(function(e,t){for(var r=this._model.data,i=(r[t.parent],t.nodes),s=0,a=i.length;s<a;s++)r[i[s]].state.checked=r[i[s]].state.checked||r[i[s]].original&&r[i[s]].original.state&&r[i[s]].original.state.checked,r[i[s]].state.checked&&this._data.checkbox.selected.push(i[s])},this)),-1===this.settings.checkbox.cascade.indexOf("up")&&-1===this.settings.checkbox.cascade.indexOf("down")||this.element.on("model.jstree",S.proxy(function(e,t){var r,i,s,a,n,o,d=this._model.data,c=d[t.parent],l=t.nodes,h=[],_=this.settings.checkbox.cascade,u=this.settings.checkbox.tie_selection;if(-1!==_.indexOf("down"))if(c.state[u?"selected":"checked"]){for(i=0,s=l.length;i<s;i++)d[l[i]].state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected=this._data[u?"core":"checkbox"].selected.concat(l)}else for(i=0,s=l.length;i<s;i++)if(d[l[i]].state[u?"selected":"checked"]){for(a=0,n=d[l[i]].children_d.length;a<n;a++)d[d[l[i]].children_d[a]].state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected=this._data[u?"core":"checkbox"].selected.concat(d[l[i]].children_d)}if(-1!==_.indexOf("up")){for(i=0,s=c.children_d.length;i<s;i++)d[c.children_d[i]].children.length||h.push(d[c.children_d[i]].parent);for(a=0,n=(h=S.vakata.array_unique(h)).length;a<n;a++)for(c=d[h[a]];c&&c.id!==S.jstree.root;){for(i=r=0,s=c.children.length;i<s;i++)r+=d[c.children[i]].state[u?"selected":"checked"];if(r!==s)break;c.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(c.id),(o=this.get_node(c,!0))&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[u?"core":"checkbox"].selected=S.vakata.array_unique(this._data[u?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",S.proxy(function(e,t){var r,i,s=t.node,a=this._model.data,n=this.get_node(s.parent),o=this.settings.checkbox.cascade,d=this.settings.checkbox.tie_selection,c={},l=this._data[d?"core":"checkbox"].selected;for(u=0,g=l.length;u<g;u++)c[l[u]]=!0;if(-1!==o.indexOf("down"))for(var h=this._cascade_new_checked_state(s.id,!0),_=s.children_d.concat(s.id),u=0,g=_.length;u<g;u++)-1<h.indexOf(_[u])?c[_[u]]=!0:delete c[_[u]];if(-1!==o.indexOf("up"))for(;n&&n.id!==S.jstree.root;){for(u=r=0,g=n.children.length;u<g;u++)r+=a[n.children[u]].state[d?"selected":"checked"];if(r!==g)break;n.state[d?"selected":"checked"]=!0,c[n.id]=!0,(i=this.get_node(n,!0))&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}for(u in l=[],c)c.hasOwnProperty(u)&&l.push(u);this._data[d?"core":"checkbox"].selected=l},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",S.proxy(function(e,t){for(var r,i=this.get_node(S.jstree.root),s=this._model.data,a=0,n=i.children_d.length;a<n;a++)(r=s[i.children_d[a]])&&r.original&&r.original.state&&r.original.state.undetermined&&(r.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",S.proxy(function(e,t){var r,i,s,a,n=t.node,o=(this.get_node(n,!0),this.settings.checkbox.cascade),d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,l=n.children_d.concat(n.id);if(-1!==o.indexOf("down")&&(a=this._cascade_new_checked_state(n.id,!1),c=c.filter(function(e){return-1===l.indexOf(e)||-1<a.indexOf(e)})),-1!==o.indexOf("up")&&-1===c.indexOf(n.id)){for(r=0,i=n.parents.length;r<i;r++)(s=this._model.data[n.parents[r]]).state[d?"selected":"checked"]=!1,s&&s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=!1),(s=this.get_node(n.parents[r],!0))&&s.length&&s.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked");c=c.filter(function(e){return-1===n.parents.indexOf(e)})}this._data[d?"core":"checkbox"].selected=c},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",S.proxy(function(e,t){for(var r,i,s,a,n=this.get_node(t.parent),o=this._model.data,d=this.settings.checkbox.tie_selection;n&&n.id!==S.jstree.root&&!n.state[d?"selected":"checked"];){for(r=s=0,i=n.children.length;r<i;r++)s+=o[n.children[r]].state[d?"selected":"checked"];if(!(0<i&&s===i))break;n.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(n.id),(a=this.get_node(n,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}},this)).on("move_node.jstree",S.proxy(function(e,t){var r,i,s,a,n,o=t.is_multi,d=t.old_parent,c=this.get_node(t.parent),l=this._model.data,h=this.settings.checkbox.tie_selection;if(!o)for(r=this.get_node(d);r&&r.id!==S.jstree.root&&!r.state[h?"selected":"checked"];){for(s=i=0,a=r.children.length;s<a;s++)i+=l[r.children[s]].state[h?"selected":"checked"];if(!(0<a&&i===a))break;r.state[h?"selected":"checked"]=!0,this._data[h?"core":"checkbox"].selected.push(r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),r=this.get_node(r.parent)}for(r=c;r&&r.id!==S.jstree.root;){for(s=i=0,a=r.children.length;s<a;s++)i+=l[r.children[s]].state[h?"selected":"checked"];if(i===a)r.state[h?"selected":"checked"]||(r.state[h?"selected":"checked"]=!0,this._data[h?"core":"checkbox"].selected.push(r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"));else{if(!r.state[h?"selected":"checked"])break;r.state[h?"selected":"checked"]=!1,this._data[h?"core":"checkbox"].selected=S.vakata.array_remove_item(this._data[h?"core":"checkbox"].selected,r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass(h?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}},this))},this.get_undetermined=function(e){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];for(var r,i,s={},a=this._model.data,t=this.settings.checkbox.tie_selection,n=this._data[t?"core":"checkbox"].selected,o=[],d=this,c=[],l=0,h=n.length;l<h;l++)if(a[n[l]]&&a[n[l]].parents)for(r=0,i=a[n[l]].parents.length;r<i&&s[a[n[l]].parents[r]]===E;r++)a[n[l]].parents[r]!==S.jstree.root&&(s[a[n[l]].parents[r]]=!0,o.push(a[n[l]].parents[r]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var e,t=d.get_node(this);if(t)if(t.state.loaded){for(l=0,h=t.children_d.length;l<h;l++)if(!(e=a[t.children_d[l]]).state.loaded&&e.original&&e.original.state&&e.original.state.undetermined&&!0===e.original.state.undetermined)for(s[e.id]===E&&e.id!==S.jstree.root&&(s[e.id]=!0,o.push(e.id)),r=0,i=e.parents.length;r<i;r++)s[e.parents[r]]===E&&e.parents[r]!==S.jstree.root&&(s[e.parents[r]]=!0,o.push(e.parents[r]))}else if(t.original&&t.original.state&&t.original.state.undetermined&&!0===t.original.state.undetermined)for(s[t.id]===E&&t.id!==S.jstree.root&&(s[t.id]=!0,o.push(t.id)),r=0,i=t.parents.length;r<i;r++)s[t.parents[r]]===E&&t.parents[r]!==S.jstree.root&&(s[t.parents[r]]=!0,o.push(t.parents[r]))}),l=0,h=o.length;l<h;l++)a[o[l]].state[t?"selected":"checked"]||c.push(e?a[o[l]]:o[l]);return c},this._undetermined=function(){if(null!==this.element){var e,t,r,i=this.get_undetermined(!1);for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,t=i.length;e<t;e++)(r=this.get_node(i[e],!0))&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(e,t,r,i){if(e=d.redraw_node.apply(this,arguments)){for(var s=null,a=null,n=0,o=e.childNodes.length;n<o;n++)if(e.childNodes[n]&&e.childNodes[n].className&&-1!==e.childNodes[n].className.indexOf("jstree-anchor")){s=e.childNodes[n];break}s&&(!this.settings.checkbox.tie_selection&&this._model.data[e.id].state.checked&&(s.className+=" jstree-checked"),a=l.cloneNode(!1),this._model.data[e.id].state.checkbox_disabled&&(a.className+=" jstree-checkbox-disabled"),s.insertBefore(a,s.childNodes[0]))}return r||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(S.proxy(this._undetermined,this),50)),e},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(e){e=this.get_node(e);var t,r,i=this.settings.checkbox.cascade,s=this.settings.checkbox.tie_selection,a=this._data[s?"core":"checkbox"].selected,n=this._model.data;if(!e||!0===e.state[s?"selected":"checked"]||-1===i.indexOf("undetermined")||-1===i.indexOf("down")&&-1===i.indexOf("up"))return!1;if(!e.state.loaded&&!0===e.original.state.undetermined)return!0;for(t=0,r=e.children_d.length;t<r;t++)if(-1!==S.inArray(e.children_d[t],a)||!n[e.children_d[t]].state.loaded&&n[e.children_d[t]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(e){var t,r,i;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.disable_checkbox(e[t]);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(i=this.get_node(e,!0),void(e.state.checkbox_disabled||(e.state.checkbox_disabled=!0,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:e}))))},this.enable_checkbox=function(e){var t,r,i;if(S.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.enable_checkbox(e[t]);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(i=this.get_node(e,!0),void(e.state.checkbox_disabled&&(e.state.checkbox_disabled=!1,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:e}))))},this.activate_node=function(e,t){return!S(t.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||S(t.target).hasClass("jstree-checkbox"))&&(t.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!S(t.target).hasClass("jstree-checkbox")?d.activate_node.call(this,e,t):!this.is_disabled(e)&&(this.is_checked(e)?this.uncheck_node(e,t):this.check_node(e,t),void this.trigger("activate_node",{node:this.get_node(e)})))},this._cascade_new_checked_state=function(e,t){var r,i,s=this.settings.checkbox.tie_selection,a=this._model.data[e],n=[],o=[];if(!this.settings.checkbox.cascade_to_disabled&&a.state.disabled||!this.settings.checkbox.cascade_to_hidden&&a.state.hidden)c=this.get_checked_descendants(e),a.state[s?"selected":"checked"]&&c.push(a.id),n=n.concat(c);else{if(a.children)for(r=0,i=a.children.length;r<i;r++){var d=a.children[r],c=this._cascade_new_checked_state(d,t),n=n.concat(c);-1<c.indexOf(d)&&o.push(d)}var l=this.get_node(a,!0),h=0<o.length&&o.length<a.children.length;a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=h),!h&&t&&o.length===a.children.length?(a.state[s?"selected":"checked"]=t,n.push(a.id),l.attr("aria-selected",!0).children(".jstree-anchor").addClass(s?"jstree-clicked":"jstree-checked")):(a.state[s?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(s?"jstree-clicked":"jstree-checked"))}return n},this.get_checked_descendants=function(e){var t=this,r=t.settings.checkbox.tie_selection;return t._model.data[e].children_d.filter(function(e){return t._model.data[e].state[r?"selected":"checked"]})},this.check_node=function(e,t){if(this.settings.checkbox.tie_selection)return this.select_node(e,!1,!0,t);var r,i,s;if(S.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.check_node(e[i],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(r=this.get_node(e,!0),void(e.state.checked||(e.state.checked=!0,this._data.checkbox.selected.push(e.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:e,selected:this._data.checkbox.selected,event:t}))))},this.uncheck_node=function(e,t){if(this.settings.checkbox.tie_selection)return this.deselect_node(e,!1,t);var r,i,s;if(S.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.uncheck_node(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===S.jstree.root)&&(s=this.get_node(e,!0),void(e.state.checked&&(e.state.checked=!1,this._data.checkbox.selected=S.vakata.array_remove_item(this._data.checkbox.selected,e.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:e,selected:this._data.checkbox.selected,event:t}))))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var e,t;this._data.checkbox.selected.concat([]);for(this._data.checkbox.selected=this._model.data[S.jstree.root].children_d.concat(),e=0,t=this._data.checkbox.selected.length;e<t;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();for(var e=this._data.checkbox.selected.concat([]),t=0,r=this._data.checkbox.selected.length;t<r;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:e})},this.is_checked=function(e){return this.settings.checkbox.tie_selection?this.is_selected(e):!(!(e=this.get_node(e))||e.id===S.jstree.root)&&e.state.checked},this.get_checked=function(e){return this.settings.checkbox.tie_selection?this.get_selected(e):e?S.map(this._data.checkbox.selected,S.proxy(function(e){return this.get_node(e)},this)):this._data.checkbox.selected},this.get_top_checked=function(e){if(this.settings.checkbox.tie_selection)return this.get_top_selected(e);for(var t,r,i=this.get_checked(!0),s={},a=0,n=i.length;a<n;a++)s[i[a].id]=i[a];for(a=0,n=i.length;a<n;a++)for(t=0,r=i[a].children_d.length;t<r;t++)s[i[a].children_d[t]]&&delete s[i[a].children_d[t]];for(a in i=[],s)s.hasOwnProperty(a)&&i.push(a);return e?S.map(i,S.proxy(function(e){return this.get_node(e)},this)):i},this.get_bottom_checked=function(e){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(e);for(var t=this.get_checked(!0),r=[],i=0,s=t.length;i<s;i++)t[i].children.length||r.push(t[i].id);return e?S.map(r,S.proxy(function(e){return this.get_node(e)},this)):r},this.load_node=function(e,t){var r,i,s;if(!S.isArray(e)&&!this.settings.checkbox.tie_selection&&((s=this.get_node(e))&&s.state.loaded))for(r=0,i=s.children_d.length;r<i;r++)this._model.data[s.children_d[r]].state.checked&&(this._data.checkbox.selected=S.vakata.array_remove_item(this._data.checkbox.selected,s.children_d[r]));return d.load_node.apply(this,arguments)},this.get_state=function(){var e=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(e.checkbox=this._data.checkbox.selected.slice()),e},this.set_state=function(e,t){var r,i=d.set_state.apply(this,arguments);return i&&e.checkbox?(this.settings.checkbox.tie_selection||(this.uncheck_all(),r=this,S.each(e.checkbox,function(e,t){r.check_node(t)})),delete e.checkbox,this.set_state(e,t),!1):i},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},S.jstree.defaults.conditionalselect=function(){return!0},S.jstree.plugins.conditionalselect=function(e,r){this.activate_node=function(e,t){return this.settings.conditionalselect.call(this,this.get_node(e),t)?r.activate_node.call(this,e,t):void 0}},S.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(e){var r=S.jstree.reference(e.reference),t=r.get_node(e.reference);r.create_node(t,{},"last",function(t){try{r.edit(t)}catch(e){setTimeout(function(){r.edit(t)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(e){var t=S.jstree.reference(e.reference),r=t.get_node(e.reference);t.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(e){var t=S.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.delete_node(t.get_selected()):t.delete_node(r)}},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(e){var t=S.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.cut(t.get_top_selected()):t.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(e){var t=S.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.copy(t.get_top_selected()):t.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(e){return!S.jstree.reference(e.reference).can_paste()},separator_after:!1,label:"Paste",action:function(e){var t=S.jstree.reference(e.reference),r=t.get_node(e.reference);t.paste(r)}}}}}}},S.jstree.plugins.contextmenu=function(e,a){this.bind=function(){a.bind.call(this);var t,r,i=0,s=null;this.element.on("init.jstree loading.jstree ready.jstree",S.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",S.proxy(function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),i=e.ctrlKey?+new Date:0,(t||s)&&(i=+new Date+1e4),s&&clearTimeout(s),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))},this)).on("click.jstree",".jstree-anchor",S.proxy(function(e){this._data.contextmenu.visible&&(!i||250<new Date-i)&&S.vakata.context.hide(),i=0},this)).on("touchstart.jstree",".jstree-anchor",function(e){e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(t=e.originalEvent.changedTouches[0].clientX,r=e.originalEvent.changedTouches[0].clientY,s=setTimeout(function(){S(e.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(e){s&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(10<Math.abs(t-e.originalEvent.changedTouches[0].clientX)||10<Math.abs(r-e.originalEvent.changedTouches[0].clientY))&&(clearTimeout(s),S.vakata.context.hide())}).on("touchend.vakata.jstree",function(e){s&&clearTimeout(s)}),S(y).on("context_hide.vakata.jstree",S.proxy(function(e,t){this._data.contextmenu.visible=!1,S(t.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&S.vakata.context.hide(),a.teardown.call(this)},this.show_contextmenu=function(t,r,i,e){if(!(t=this.get_node(t))||t.id===S.jstree.root)return!1;var s,a=this.settings.contextmenu,n=this.get_node(t,!0).children(".jstree-anchor"),o=!1;!a.show_at_node&&r!==E&&i!==E||(s=n.offset(),r=s.left,i=s.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(t)&&this.activate_node(t,e),o=a.items,S.isFunction(o)&&(o=o.call(this,t,S.proxy(function(e){this._show_contextmenu(t,r,i,e)},this))),S.isPlainObject(o)&&this._show_contextmenu(t,r,i,o)},this._show_contextmenu=function(e,t,r,i){var s=this.get_node(e,!0).children(".jstree-anchor");S(y).one("context_show.vakata.jstree",S.proxy(function(e,t){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";S(t.element).addClass(r),s.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,S.vakata.context.show(s,{x:t,y:r},i),this.trigger("show_contextmenu",{node:e,x:t,y:r})}},m={element:p=!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1},(f=S).vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(e){f(y).triggerHandler("context_"+e+".vakata",{reference:m.reference,element:m.element,position:{x:m.position_x,y:m.position_y}})},_execute:function(e){return!(!(e=m.items[e])||e._disabled&&(!f.isFunction(e._disabled)||e._disabled({item:e,reference:m.reference,element:m.element}))||!e.action)&&e.action.call(null,{item:e,reference:m.reference,element:m.element,position:{x:m.position_x,y:m.position_y}})},_parse:function(e,t){if(!e)return!1;t||(m.html="",m.items=[]);var r,i="",s=!1;return t&&(i+="<ul>"),f.each(e,function(e,t){return!t||(m.items.push(t),!s&&t.separator_before&&(i+="<li class='vakata-context-separator'><a href='#' "+(f.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),s=!1,i+="<li class='"+(t._class||"")+(!0===t._disabled||f.isFunction(t._disabled)&&t._disabled({item:t,reference:m.reference,element:m.element})?" vakata-contextmenu-disabled ":"")+"' "+(t.shortcut?" data-shortcut='"+t.shortcut+"' ":"")+">",i+="<a href='#' rel='"+(m.items.length-1)+"' "+(t.title?"title='"+t.title+"'":"")+">",f.vakata.context.settings.icons&&(i+="<i ",t.icon&&(i+=-1!==t.icon.indexOf("/")||-1!==t.icon.indexOf(".")?" style='background:url(\""+t.icon+"\") center center no-repeat' ":" class='"+t.icon+"' "),i+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),i+=(f.isFunction(t.label)?t.label({item:e,reference:m.reference,element:m.element}):t.label)+(t.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+t.shortcut+'">'+(t.shortcut_label||"")+"</span>":"")+"</a>",t.submenu&&((r=f.vakata.context._parse(t.submenu,!0))&&(i+=r)),i+="</li>",void(t.separator_after&&(i+="<li class='vakata-context-separator'><a href='#' "+(f.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",s=!0)))}),i=i.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),t&&(i+="</ul>"),t||(m.html=i,f.vakata.context._trigger("parse")),10<i.length&&i},_show_submenu:function(e){var t,r,i,s,a,n,o,d;(e=f(e)).length&&e.children("ul").length&&(t=e.children("ul"),i=(r=e.offset().left)+e.outerWidth(),s=e.offset().top,a=t.width(),n=t.height(),o=f(window).width()+f(window).scrollLeft(),d=f(window).height()+f(window).scrollTop(),p?e[i-(a+10+e.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):e[o<i+a&&o-i<r?"addClass":"removeClass"]("vakata-context-right"),d<s+n+10&&t.css("bottom","-1px"),e.hasClass("vakata-context-right")?r<a&&t.css("margin-right",r-a):o-i<a&&t.css("margin-left",o-i-a),t.show())},show:function(e,t,r){var i,s,a,n,o,d,c,l;switch(m.element&&m.element.length&&m.element.width(""),!0){case!t&&!e:return!1;case!!t&&!!e:m.reference=e,m.position_x=t.x,m.position_y=t.y;break;case!t&&!!e:i=(m.reference=e).offset(),m.position_x=i.left+e.outerHeight(),m.position_y=i.top;break;case!!t&&!e:m.position_x=t.x,m.position_y=t.y}e&&!r&&f(e).data("vakata_contextmenu")&&(r=f(e).data("vakata_contextmenu")),f.vakata.context._parse(r)&&m.element.html(m.html),m.items.length&&(m.element.appendTo(y.body),s=m.element,a=m.position_x,n=m.position_y,o=s.width(),d=s.height(),c=f(window).width()+f(window).scrollLeft(),l=f(window).height()+f(window).scrollTop(),!p||(a-=s.outerWidth()-f(e).outerWidth())<f(window).scrollLeft()+20&&(a=f(window).scrollLeft()+20),c<a+o+20&&(a=c-(o+20)),l<n+d+20&&(n=l-(d+20)),m.element.css({left:a,top:n}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),m.is_visible=!0,f.vakata.context._trigger("show"))},hide:function(){m.is_visible&&(m.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),m.is_visible=!1,f.vakata.context._trigger("hide"))}},f(function(){p="rtl"===f(y.body).css("direction");var t=!1;m.element=f("<ul class='vakata-context'></ul>"),m.element.on("mouseenter","li",function(e){e.stopImmediatePropagation(),f.contains(this,e.relatedTarget)||(t&&clearTimeout(t),m.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),f(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),f.vakata.context._show_submenu(this))}).on("mouseleave","li",function(e){f.contains(this,e.relatedTarget)||f(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(e){f(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),f.vakata.context.settings.hide_onmouseleave&&(t=setTimeout(function(){f.vakata.context.hide()},f.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(e){e.preventDefault(),f(this).blur().parent().hasClass("vakata-context-disabled")||!1===f.vakata.context._execute(f(this).attr("rel"))||f.vakata.context.hide()}).on("keydown","a",function(e){var t=null;switch(e.which){case 13:case 32:e.type="click",e.preventDefault(),f(e.currentTarget).trigger(e);break;case 37:m.is_visible&&(m.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 38:m.is_visible&&((t=m.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(t=m.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),t.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 39:m.is_visible&&(m.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(),e.stopImmediatePropagation(),e.preventDefault());break;case 40:m.is_visible&&((t=m.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(t=m.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),t.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 27:f.vakata.context.hide(),e.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=m.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()}),f(y).on("mousedown.vakata.jstree",function(e){m.is_visible&&m.element[0]!==e.target&&!f.contains(m.element[0],e.target)&&f.vakata.context.hide()}).on("context_show.vakata.jstree",function(e,t){m.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),p&&m.element.addClass("vakata-context-rtl").css("direction","rtl"),m.element.find("ul").hide().end()})}),S.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1},S.jstree.plugins.dnd=function(e,o){this.init=function(e,t){o.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in y.createElement("span")},this.bind=function(){o.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",S.proxy(function(e){if(this.settings.dnd.large_drag_target&&S(e.target).closest(".jstree-node")[0]!==e.currentTarget)return!0;if("touchstart"===e.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!S(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var t=this.get_node(e.target),r=this.is_selected(t)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,i=1<r?r+" "+this.get_string("nodes"):this.get_text(e.currentTarget);if(this.settings.core.force_text&&(i=S.vakata.html.escape(i)),t&&t.id&&t.id!==S.jstree.root&&(1===e.which||"touchstart"===e.type||"dragstart"===e.type)&&(!0===this.settings.dnd.is_draggable||S.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,1<r?this.get_top_selected(!0):[t],e))){if(d={jstree:!0,origin:this,obj:this.get_node(t,!0),nodes:1<r?this.get_top_selected():[t.id]},c=e.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),S.vakata.dnd.start(e,d,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+i+'<ins class="jstree-copy" style="display:none;">+</ins></div>');S.vakata.dnd._trigger("start",e,{helper:S(),element:c,data:d})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(e){return e.preventDefault(),S.vakata.dnd._trigger("move",e,{helper:S(),element:c,data:d}),!1}).on("drop.jstree",S.proxy(function(e){return e.preventDefault(),S.vakata.dnd._trigger("stop",e,{helper:S(),element:c,data:d}),!1},this))},this.redraw_node=function(e,t,r,i){if((e=o.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{for(var s=null,a=0,n=e.childNodes.length;a<n;a++)if(e.childNodes[a]&&e.childNodes[a].className&&-1!==e.childNodes[a].className.indexOf("jstree-anchor")){s=e.childNodes[a];break}s&&s.setAttribute("draggable",!0)}return e}},S(function(){var C=!1,A=!1,T=!1,N=!1,O=S('<div id="jstree-marker">&#160;</div>').hide();S(y).on("dragover.vakata.jstree",function(e){c&&S.vakata.dnd._trigger("move",e,{helper:S(),element:c,data:d})}).on("drop.vakata.jstree",function(e){c&&(S.vakata.dnd._trigger("stop",e,{helper:S(),element:c,data:d}),d=c=null)}).on("dnd_start.vakata.jstree",function(e,t){T=C=!1,t&&t.data&&t.data.jstree&&O.appendTo(y.body)}).on("dnd_move.vakata.jstree",function(e,s){var a=s.event.target!==T.target;if(!N||s.event&&"dragover"===s.event.type&&!a||clearTimeout(N),s&&s.data&&s.data.jstree&&(!s.event.target.id||"jstree-marker"!==s.event.target.id)){T=s.event;var n,t,o,d,c,l,h,_,u,g,f,p,m,v,j,y,k,x,b=S.jstree.reference(s.event.target),w=!1;if(b&&b._data&&b._data.dnd)if(O.attr("class","jstree-"+b.get_theme()+(b.settings.core.themes.responsive?" jstree-dnd-responsive":"")),k=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)),s.helper.children().attr("class","jstree-"+b.get_theme()+" jstree-"+b.get_theme()+"-"+b.get_theme_variant()+" "+(b.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[k?"show":"hide"](),s.event.target!==b.element[0]&&s.event.target!==b.get_container_ul()[0]||0!==b.get_container_ul().children().length){if((w=b.settings.dnd.large_drop_target?S(s.event.target).closest(".jstree-node").children(".jstree-anchor"):S(s.event.target).closest(".jstree-anchor"))&&w.length&&w.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(n=w.offset(),t=(s.event.pageY!==E?s.event.pageY:s.event.originalEvent.pageY)-n.top,c=w.outerHeight(),_=t<c/3?["b","i","a"]:c-c/3<t?["a","i","b"]:c/2<t?["i","a","b"]:["i","b","a"],S.each(_,function(e,t){switch(t){case"b":o=n.left-6,d=n.top,l=b.get_parent(w),h=w.parent().index();break;case"i":j=b.settings.dnd.inside_pos,y=b.get_node(w.parent()),o=n.left-2,d=n.top+c/2+1,l=y.id,h="first"===j?0:"last"===j?y.children.length:Math.min(j,y.children.length);break;case"a":o=n.left-6,d=n.top+c,l=b.get_parent(w),h=w.parent().index()+1}for(u=!0,g=0,f=s.data.nodes.length;g<f;g++)if(p=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",m=h,"move_node"==p&&"a"===t&&s.data.origin&&s.data.origin===b&&l===b.get_parent(s.data.nodes[g])&&(v=b.get_node(l),m>S.inArray(s.data.nodes[g],v.children)&&--m),!(u=u&&(b&&b.settings&&b.settings.dnd&&!1===b.settings.dnd.check_while_dragging||b.check(p,s.data.origin&&s.data.origin!==b?s.data.origin.get_node(s.data.nodes[g]):s.data.nodes[g],l,m,{dnd:!0,ref:b.get_node(w.parent()),pos:t,origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==b,is_foreign:!s.data.origin})))){b&&b.last_error&&(A=b.last_error());break}return"i"===t&&w.parent().is(".jstree-closed")&&b.settings.dnd.open_timeout&&(!s.event||"dragover"!==s.event.type||a)&&(N&&clearTimeout(N),N=setTimeout((i=w,function(){r.open_node(i)}),(r=b).settings.dnd.open_timeout)),u?((x=b.get_node(l,!0)).hasClass(".jstree-dnd-parent")||(S(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),x.addClass("jstree-dnd-parent")),C={ins:b,par:l,pos:"i"!==t||"last"!==j||0!==h||b.is_loaded(y)?h:"last"},O.css({left:o+"px",top:d+"px"}).show(),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=k?"copy":"move"),A={},!(_=!0)):void 0;var r,i}),!0===_))return}else{for(u=!0,g=0,f=s.data.nodes.length;g<f&&(u=u&&b.check(s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",s.data.origin&&s.data.origin!==b?s.data.origin.get_node(s.data.nodes[g]):s.data.nodes[g],S.jstree.root,"last",{dnd:!0,ref:b.get_node(S.jstree.root),pos:"i",origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==b,is_foreign:!s.data.origin}));g++);if(u)return C={ins:b,par:S.jstree.root,pos:"last"},O.hide(),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=k?"copy":"move"))}S(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),C=!1,s.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),s.event.originalEvent&&s.event.originalEvent.dataTransfer,O.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(O.hide(),T=C=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(e,t){if(S(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),N&&clearTimeout(N),t&&t.data&&t.data.jstree){O.hide().detach();var r,i,s=[];if(C){for(r=0,i=t.data.nodes.length;r<i;r++)s[r]=t.data.origin?t.data.origin.get_node(t.data.nodes[r]):t.data.nodes[r];C.ins[t.data.origin&&(t.data.origin.settings.dnd.always_copy||t.data.origin.settings.dnd.copy&&(t.event.metaKey||t.event.ctrlKey))?"copy_node":"move_node"](s,C.par,C.pos,!1,!1,!1,t.data.origin)}else(r=S(t.event.target).closest(".jstree")).length&&A&&A.error&&"check"===A.error&&((r=r.jstree(!0))&&r.settings.core.error.call(this,A));C=T=!1}}).on("keyup.jstree keydown.jstree",function(e,t){(t=S.vakata.dnd._get())&&t.data&&t.data.jstree&&("keyup"===e.type&&27===e.which?(N&&clearTimeout(N),N=T=A=C=!1,O.hide().detach(),S.vakata.dnd._clean()):(t.helper.find(".jstree-copy").first()[t.data.origin&&(t.data.origin.settings.dnd.always_copy||t.data.origin.settings.dnd.copy&&(e.metaKey||e.ctrlKey))?"show":"hide"](),T&&(T.metaKey=e.metaKey,T.ctrlKey=e.ctrlKey,S.vakata.dnd._trigger("move",T))))})}),g={element:!((u=S).vakata.html={div:u("<div />"),escape:function(e){return u.vakata.html.div.text(e).html()},strip:function(e){return u.vakata.html.div.empty().append(u.parseHTML(e)).text()}}),target:!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,is_touch:!1},u.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(e,t,r){r===E&&(r=u.vakata.dnd._get()),r.event=t,u(y).triggerHandler("dnd_"+e+".vakata",r)},_get:function(){return{data:g.data,element:g.element,helper:g.helper}},_clean:function(){g.helper&&g.helper.remove(),g.scroll_i&&(clearInterval(g.scroll_i),g.scroll_i=!1),g={element:!1,target:!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,is_touch:!1},u(y).off("mousemove.vakata.jstree touchmove.vakata.jstree",u.vakata.dnd.drag),u(y).off("mouseup.vakata.jstree touchend.vakata.jstree",u.vakata.dnd.stop)},_scroll:function(e){if(!g.scroll_e||!g.scroll_l&&!g.scroll_t)return g.scroll_i&&(clearInterval(g.scroll_i),g.scroll_i=!1),!1;if(!g.scroll_i)return g.scroll_i=setInterval(u.vakata.dnd._scroll,100),!1;if(!0===e)return!1;var t=g.scroll_e.scrollTop(),r=g.scroll_e.scrollLeft();g.scroll_e.scrollTop(t+g.scroll_t*u.vakata.dnd.settings.scroll_speed),g.scroll_e.scrollLeft(r+g.scroll_l*u.vakata.dnd.settings.scroll_speed),t===g.scroll_e.scrollTop()&&r===g.scroll_e.scrollLeft()||u.vakata.dnd._trigger("scroll",g.scroll_e)},start:function(e,t,r){"touchstart"===e.type&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(e.pageX=e.originalEvent.changedTouches[0].pageX,e.pageY=e.originalEvent.changedTouches[0].pageY,e.target=y.elementFromPoint(e.originalEvent.changedTouches[0].pageX-window.pageXOffset,e.originalEvent.changedTouches[0].pageY-window.pageYOffset)),g.is_drag&&u.vakata.dnd.stop({});try{e.currentTarget.unselectable="on",e.currentTarget.onselectstart=function(){return!1},e.currentTarget.style&&(e.currentTarget.style.touchAction="none",e.currentTarget.style.msTouchAction="none",e.currentTarget.style.MozUserSelect="none")}catch(e){}return g.init_x=e.pageX,g.init_y=e.pageY,g.data=t,g.is_down=!0,g.element=e.currentTarget,g.target=e.target,g.is_touch="touchstart"===e.type,!1!==r&&(g.helper=u("<div id='vakata-dnd'></div>").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),u(y).on("mousemove.vakata.jstree touchmove.vakata.jstree",u.vakata.dnd.drag),u(y).on("mouseup.vakata.jstree touchend.vakata.jstree",u.vakata.dnd.stop),!1},drag:function(r){if("touchmove"===r.type&&r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(r.pageX=r.originalEvent.changedTouches[0].pageX,r.pageY=r.originalEvent.changedTouches[0].pageY,r.target=y.elementFromPoint(r.originalEvent.changedTouches[0].pageX-window.pageXOffset,r.originalEvent.changedTouches[0].pageY-window.pageYOffset)),g.is_down){if(!g.is_drag){if(!(Math.abs(r.pageX-g.init_x)>(g.is_touch?u.vakata.dnd.settings.threshold_touch:u.vakata.dnd.settings.threshold)||Math.abs(r.pageY-g.init_y)>(g.is_touch?u.vakata.dnd.settings.threshold_touch:u.vakata.dnd.settings.threshold)))return;g.helper&&(g.helper.appendTo(y.body),g.helper_w=g.helper.outerWidth()),g.is_drag=!0,u(g.target).one("click.vakata",!1),u.vakata.dnd._trigger("start",r)}var e,t,i,s,a=!1,n=!1,o=!1,d=!1,c=!1,l=!1;return g.scroll_t=0,g.scroll_l=0,g.scroll_e=!1,u(u(r.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(u(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var e=u(this),t=e.offset();return this.scrollHeight>this.offsetHeight&&(t.top+e.height()-r.pageY<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_t=1),r.pageY-t.top<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(t.left+e.width()-r.pageX<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_l=1),r.pageX-t.left<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_l=-1)),g.scroll_t||g.scroll_l?(g.scroll_e=u(this),!1):void 0}),g.scroll_e||(a=u(y),n=u(window),o=a.height(),e=n.height(),d=a.width(),t=n.width(),i=a.scrollTop(),s=a.scrollLeft(),e<o&&r.pageY-i<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_t=-1),e<o&&e-(r.pageY-i)<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_t=1),t<d&&r.pageX-s<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_l=-1),t<d&&t-(r.pageX-s)<u.vakata.dnd.settings.scroll_proximity&&(g.scroll_l=1),(g.scroll_t||g.scroll_l)&&(g.scroll_e=a)),g.scroll_e&&u.vakata.dnd._scroll(!0),g.helper&&(c=parseInt(r.pageY+u.vakata.dnd.settings.helper_top,10),l=parseInt(r.pageX+u.vakata.dnd.settings.helper_left,10),o&&o<c+25&&(c=o-50),d&&l+g.helper_w>d&&(l=d-(g.helper_w+2)),g.helper.css({left:l+"px",top:c+"px"})),u.vakata.dnd._trigger("move",r),!1}},stop:function(e){var t;return"touchend"===e.type&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(e.pageX=e.originalEvent.changedTouches[0].pageX,e.pageY=e.originalEvent.changedTouches[0].pageY,e.target=y.elementFromPoint(e.originalEvent.changedTouches[0].pageX-window.pageXOffset,e.originalEvent.changedTouches[0].pageY-window.pageYOffset)),g.is_drag?(e.target!==g.target&&u(g.target).off("click.vakata"),u.vakata.dnd._trigger("stop",e)):"touchend"===e.type&&e.target===g.target&&(t=setTimeout(function(){u(e.target).click()},100),u(e.target).one("click",function(){t&&clearTimeout(t)})),u.vakata.dnd._clean(),!1}},S.jstree.defaults.massload=null,S.jstree.plugins.massload=function(e,l){this.init=function(e,t){this._data.massload={},l.init.call(this,e,t)},this._load_nodes=function(a,n,o,d){var e,t,c,r=this.settings.massload,i=(JSON.stringify(a),[]),s=this._model.data;if(!o){for(e=0,t=a.length;e<t;e++)s[a[e]]&&(s[a[e]].state.loaded||s[a[e]].state.failed)&&!d||(i.push(a[e]),(c=this.get_node(a[e],!0))&&c.length&&c.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if(S.isFunction(r))return r.call(this,i,S.proxy(function(e){var t,r;if(e)for(t in e)e.hasOwnProperty(t)&&(this._data.massload[t]=e[t]);for(t=0,r=a.length;t<r;t++)(c=this.get_node(a[t],!0))&&c.length&&c.removeClass("jstree-loading").attr("aria-busy",!1);l._load_nodes.call(this,a,n,o,d)},this));if("object"==_typeof(r)&&r&&r.url)return r=S.extend(!0,{},r),S.isFunction(r.url)&&(r.url=r.url.call(this,i)),S.isFunction(r.data)&&(r.data=r.data.call(this,i)),S.ajax(r).done(S.proxy(function(e,t,r){var i,s;if(e)for(i in e)e.hasOwnProperty(i)&&(this._data.massload[i]=e[i]);for(i=0,s=a.length;i<s;i++)(c=this.get_node(a[i],!0))&&c.length&&c.removeClass("jstree-loading").attr("aria-busy",!1);l._load_nodes.call(this,a,n,o,d)},this)).fail(S.proxy(function(e){l._load_nodes.call(this,a,n,o,d)},this))}}return l._load_nodes.call(this,a,n,o,d)},this._load_node=function(e,t){var r,i,s=this._data.massload[e.id];return s?(r=this["string"==typeof s?"_append_html_data":"_append_json_data"](e,"string"==typeof s?S(S.parseHTML(s)).filter(function(){return 3!==this.nodeType}):s,function(e){t.call(this,e)}),(i=this.get_node(e.id,!0))&&i.length&&i.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[e.id],r):l._load_node.call(this,e,t)}},S.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},S.jstree.plugins.search=function(e,o){this.bind=function(){o.bind.call(this),this._data.search.str="",this._data.search.dom=S(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",S.proxy(function(e,t){if(this._data.search.som&&t.res.length){for(var r,i,s=this._model.data,a=[],n=0,o=t.res.length;n<o;n++)if(s[t.res[n]]&&!s[t.res[n]].state.hidden&&(a.push(t.res[n]),a=a.concat(s[t.res[n]].parents),this._data.search.smc))for(r=0,i=s[t.res[n]].children_d.length;r<i;r++)s[s[t.res[n]].children_d[r]]&&!s[s[t.res[n]].children_d[r]].state.hidden&&a.push(s[t.res[n]].children_d[r]);a=S.vakata.array_remove_item(S.vakata.array_unique(a),S.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(a,!0),this.redraw(!0)}},this)).on("clear_search.jstree",S.proxy(function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(i,e,t,r,s,a){if(!1===i||""===S.trim(i.toString()))return this.clear_search();r=(r=this.get_node(r))&&r.id?r.id:null,i=i.toString();var n,o,d=this.settings.search,c=!!d.ajax&&d.ajax,l=this._model.data,h=null,_=[],u=[];if(this._data.search.res.length&&!s&&this.clear_search(),t===E&&(t=d.show_only_matches),a===E&&(a=d.show_only_matches_children),!e&&!1!==c)return S.isFunction(c)?c.call(this,i,S.proxy(function(e){e&&e.d&&(e=e.d),this._load_nodes(S.isArray(e)?S.vakata.array_unique(e):[],function(){this.search(i,!0,t,r,s,a)})},this),r):((c=S.extend({},c)).data||(c.data={}),c.data.str=i,r&&(c.data.inside=r),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=S.ajax(c).fail(S.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(c)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(S.proxy(function(e){e&&e.d&&(e=e.d),this._load_nodes(S.isArray(e)?S.vakata.array_unique(e):[],function(){this.search(i,!0,t,r,s,a)})},this)),this._data.search.lastRequest);if(s||(this._data.search.str=i,this._data.search.dom=S(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=t,this._data.search.smc=a),h=new S.vakata.search(i,!0,{caseSensitive:d.case_sensitive,fuzzy:d.fuzzy}),S.each(l[r||S.jstree.root].children_d,function(e,t){var r=l[t];r.text&&!r.state.hidden&&(!d.search_leaves_only||r.state.loaded&&0===r.children.length)&&(d.search_callback&&d.search_callback.call(this,i,r)||!d.search_callback&&h.search(r.text).isMatch)&&(_.push(t),u=u.concat(r.parents))}),_.length){for(n=0,o=(u=S.vakata.array_unique(u)).length;n<o;n++)u[n]!==S.jstree.root&&l[u[n]]&&!0===this.open_node(u[n],null,0)&&this._data.search.opn.push(u[n]);s?(this._data.search.dom=this._data.search.dom.add(S(this.element[0].querySelectorAll("#"+S.map(_,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(S.jstree.idregex,"\\$&"):e.replace(S.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=S.vakata.array_unique(this._data.search.res.concat(_))):(this._data.search.dom=S(this.element[0].querySelectorAll("#"+S.map(_,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(S.jstree.idregex,"\\$&"):e.replace(S.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=_),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:i,res:this._data.search.res,show_only_matches:t})},this.clear_search=function(){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.res.length&&(this._data.search.dom=S(this.element[0].querySelectorAll("#"+S.map(this._data.search.res,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(S.jstree.idregex,"\\$&"):e.replace(S.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=S()},this.redraw_node=function(e,t,r,i){if((e=o.redraw_node.apply(this,arguments))&&-1!==S.inArray(e.id,this._data.search.res)){for(var s=null,a=0,n=e.childNodes.length;a<n;a++)if(e.childNodes[a]&&e.childNodes[a].className&&-1!==e.childNodes[a].className.indexOf("jstree-anchor")){s=e.childNodes[a];break}s&&(s.className+=" jstree-search")}return e}},(_=S).vakata.search=function(p,e,m){m=m||{},!1!==(m=_.extend({},_.vakata.search.defaults,m)).fuzzy&&(m.fuzzy=!0),p=m.caseSensitive?p:p.toLowerCase();var v,j,y,t,k=m.location,s=m.distance,x=m.threshold,b=p.length;return 32<b&&(m.fuzzy=!1),m.fuzzy&&(v=1<<b-1,j=function(){for(var e={},t=0,t=0;t<b;t++)e[p.charAt(t)]=0;for(t=0;t<b;t++)e[p.charAt(t)]|=1<<b-t-1;return e}(),y=function(e,t){var r=e/b,i=Math.abs(k-t);return s?r+i/s:i?1:r}),t=function(e){if(e=m.caseSensitive?e:e.toLowerCase(),p===e||-1!==e.indexOf(p))return{isMatch:!0,score:0};if(!m.fuzzy)return{isMatch:!1,score:1};var t,r,i,s,a,n,o,d,c,l=e.length,h=x,_=e.indexOf(p,k),u=b+l,g=1,f=[];for(-1!==_&&(h=Math.min(y(0,_),h),-1!==(_=e.lastIndexOf(p,k+b))&&(h=Math.min(y(0,_),h))),_=-1,t=0;t<b;t++){for(i=0,s=u;i<s;)y(t,k+s)<=h?i=s:u=s,s=Math.floor((u-i)/2+i);for(u=s,n=Math.max(1,k-s+1),o=Math.min(k+s,l)+b,(d=new Array(o+2))[o+1]=(1<<t)-1,r=o;n<=r;r--)if(c=j[e.charAt(r-1)],d[r]=0===t?(d[r+1]<<1|1)&c:(d[r+1]<<1|1)&c|(a[r+1]|a[r])<<1|1|a[r+1],d[r]&v&&(g=y(t,r-1))<=h){if(h=g,_=r-1,f.push(_),!(k<_))break;n=Math.max(1,2*k-_)}if(y(t+1,k)>h)break;a=d}return{isMatch:0<=_,score:g}},!0===e?{search:t}:t(e)},_.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1},S.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1};var i=!(S.jstree.plugins.sort=function(e,t){this.bind=function(){t.bind.call(this),this.element.on("model.jstree",S.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",S.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",S.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(e,t){var r,i;if((e=this.get_node(e))&&e.children&&e.children.length&&(e.children.sort(S.proxy(this.settings.sort,this)),t))for(r=0,i=e.children_d.length;r<i;r++)this.sort(e.children_d[r],!1)}});S.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},S.jstree.plugins.state=function(e,t){this.bind=function(){t.bind.call(this);var r=S.proxy(function(){this.element.on(this.settings.state.events,S.proxy(function(){i&&clearTimeout(i),i=setTimeout(S.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",S.proxy(function(e,t){this.element.one("restore_state.jstree",r),this.restore_state()||r()},this))},this.save_state=function(){var e=this.get_state();this.settings.state.preserve_loaded||delete e.core.loaded;var t={state:e,ttl:this.settings.state.ttl,sec:+new Date};S.vakata.storage.set(this.settings.state.key,JSON.stringify(t))},this.restore_state=function(){var r=S.vakata.storage.get(this.settings.state.key);if(r)try{r=JSON.parse(r)}catch(e){return!1}return!(r&&r.ttl&&r.sec&&new Date-r.sec>r.ttl)&&(r&&r.state&&(r=r.state),r&&S.isFunction(this.settings.state.filter)&&(r=this.settings.state.filter.call(this,r)),!!r&&(this.settings.state.preserve_loaded||delete r.core.loaded,this.element.one("set_state.jstree",function(e,t){t.instance.trigger("restore_state",{state:S.extend(!0,{},r)})}),this.set_state(r),!0))},this.clear_state=function(){return S.vakata.storage.del(this.settings.state.key)}},S.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)}},S.jstree.defaults.types={default:{}},S.jstree.defaults.types[S.jstree.root]={},S.jstree.plugins.types=function(e,l){this.init=function(e,t){var r,i;if(t&&t.types&&t.types.default)for(r in t.types)if("default"!==r&&r!==S.jstree.root&&t.types.hasOwnProperty(r))for(i in t.types.default)t.types.default.hasOwnProperty(i)&&t.types[r][i]===E&&(t.types[r][i]=t.types.default[i]);l.init.call(this,e,t),this._model.data[S.jstree.root].type=S.jstree.root},this.refresh=function(e,t){l.refresh.call(this,e,t),this._model.data[S.jstree.root].type=S.jstree.root},this.bind=function(){this.element.on("model.jstree",S.proxy(function(e,t){for(var r,i=this._model.data,s=t.nodes,a=this.settings.types,n="default",o=0,d=s.length;o<d;o++){if(n="default",i[s[o]].original&&i[s[o]].original.type&&a[i[s[o]].original.type]&&(n=i[s[o]].original.type),i[s[o]].data&&i[s[o]].data.jstree&&i[s[o]].data.jstree.type&&a[i[s[o]].data.jstree.type]&&(n=i[s[o]].data.jstree.type),i[s[o]].type=n,!0===i[s[o]].icon&&a[n].icon!==E&&(i[s[o]].icon=a[n].icon),a[n].li_attr!==E&&"object"==_typeof(a[n].li_attr))for(r in a[n].li_attr)if(a[n].li_attr.hasOwnProperty(r)){if("id"===r)continue;i[s[o]].li_attr[r]===E?i[s[o]].li_attr[r]=a[n].li_attr[r]:"class"===r&&(i[s[o]].li_attr.class=a[n].li_attr.class+" "+i[s[o]].li_attr.class)}if(a[n].a_attr!==E&&"object"==_typeof(a[n].a_attr))for(r in a[n].a_attr)if(a[n].a_attr.hasOwnProperty(r)){if("id"===r)continue;i[s[o]].a_attr[r]===E?i[s[o]].a_attr[r]=a[n].a_attr[r]:"href"===r&&"#"===i[s[o]].a_attr[r]?i[s[o]].a_attr.href=a[n].a_attr.href:"class"===r&&(i[s[o]].a_attr.class=a[n].a_attr.class+" "+i[s[o]].a_attr.class)}}i[S.jstree.root].type=S.jstree.root},this)),l.bind.call(this)},this.get_json=function(e,t,r){var i,s,a=this._model.data,n=t?S.extend(!0,{},t,{no_id:!1}):{},o=l.get_json.call(this,e,n,r);if(!1===o)return!1;if(S.isArray(o))for(i=0,s=o.length;i<s;i++)o[i].type=o[i].id&&a[o[i].id]&&a[o[i].id].type?a[o[i].id].type:"default",t&&t.no_id&&(delete o[i].id,o[i].li_attr&&o[i].li_attr.id&&delete o[i].li_attr.id,o[i].a_attr&&o[i].a_attr.id&&delete o[i].a_attr.id);else o.type=o.id&&a[o.id]&&a[o.id].type?a[o.id].type:"default",t&&t.no_id&&(o=this._delete_ids(o));return o},this._delete_ids=function(e){if(S.isArray(e)){for(var t=0,r=e.length;t<r;t++)e[t]=this._delete_ids(e[t]);return e}return delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id,e.children&&S.isArray(e.children)&&(e.children=this._delete_ids(e.children)),e},this.check=function(e,t,r,i,s){if(!1===l.check.call(this,e,t,r,i,s))return!1;t=t&&t.id?t:this.get_node(t),r=r&&r.id?r:this.get_node(r);var a,n,o,d,c=(c=t&&t.id?s&&s.origin?s.origin:S.jstree.reference(t.id):null)&&c._model&&c._model.data?c._model.data:null;switch(e){case"create_node":case"move_node":case"copy_node":if("move_node"!==e||-1===S.inArray(t.id,r.children)){if((a=this.get_rules(r)).max_children!==E&&-1!==a.max_children&&a.max_children===r.children.length)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});if(a.valid_children!==E&&-1!==a.valid_children&&-1===S.inArray(t.type||"default",a.valid_children))return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});if(c&&t.children_d&&t.parents){for(o=n=0,d=t.children_d.length;o<d;o++)n=Math.max(n,c[t.children_d[o]].parents.length);n=n-t.parents.length+1}(n<=0||n===E)&&(n=1);do{if(a.max_depth!==E&&-1!==a.max_depth&&a.max_depth<n)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});r=this.get_node(r.parent),a=this.get_rules(r),n++}while(r)}}return!0},this.get_rules=function(e){if(!(e=this.get_node(e)))return!1;var t=this.get_type(e,!0);return t.max_depth===E&&(t.max_depth=-1),t.max_children===E&&(t.max_children=-1),t.valid_children===E&&(t.valid_children=-1),t},this.get_type=function(e,t){return!!(e=this.get_node(e))&&(t?S.extend({type:e.type},this.settings.types[e.type]):e.type)},this.set_type=function(e,t){var r,i,s,a,n,o,d,c,l=this._model.data;if(S.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.set_type(e[i],t);return!0}if(r=this.settings.types,e=this.get_node(e),!r[t]||!e)return!1;if((d=this.get_node(e,!0))&&d.length&&(c=d.children(".jstree-anchor")),a=e.type,n=this.get_icon(e),e.type=t,!0!==n&&r[a]&&(r[a].icon===E||n!==r[a].icon)||this.set_icon(e,r[t].icon===E||r[t].icon),r[a]&&r[a].li_attr!==E&&"object"==_typeof(r[a].li_attr))for(o in r[a].li_attr)if(r[a].li_attr.hasOwnProperty(o)){if("id"===o)continue;"class"===o?(l[e.id].li_attr.class=(l[e.id].li_attr.class||"").replace(r[a].li_attr[o],""),d&&d.removeClass(r[a].li_attr[o])):l[e.id].li_attr[o]===r[a].li_attr[o]&&(l[e.id].li_attr[o]=null,d&&d.removeAttr(o))}if(r[a]&&r[a].a_attr!==E&&"object"==_typeof(r[a].a_attr))for(o in r[a].a_attr)if(r[a].a_attr.hasOwnProperty(o)){if("id"===o)continue;"class"===o?(l[e.id].a_attr.class=(l[e.id].a_attr.class||"").replace(r[a].a_attr[o],""),c&&c.removeClass(r[a].a_attr[o])):l[e.id].a_attr[o]===r[a].a_attr[o]&&("href"===o?(l[e.id].a_attr[o]="#",c&&c.attr("href","#")):(delete l[e.id].a_attr[o],c&&c.removeAttr(o)))}if(r[t].li_attr!==E&&"object"==_typeof(r[t].li_attr))for(o in r[t].li_attr)if(r[t].li_attr.hasOwnProperty(o)){if("id"===o)continue;l[e.id].li_attr[o]===E?(l[e.id].li_attr[o]=r[t].li_attr[o],d&&("class"===o?d.addClass(r[t].li_attr[o]):d.attr(o,r[t].li_attr[o]))):"class"===o&&(l[e.id].li_attr.class=r[t].li_attr[o]+" "+l[e.id].li_attr.class,d&&d.addClass(r[t].li_attr[o]))}if(r[t].a_attr!==E&&"object"==_typeof(r[t].a_attr))for(o in r[t].a_attr)if(r[t].a_attr.hasOwnProperty(o)){if("id"===o)continue;l[e.id].a_attr[o]===E?(l[e.id].a_attr[o]=r[t].a_attr[o],c&&("class"===o?c.addClass(r[t].a_attr[o]):c.attr(o,r[t].a_attr[o]))):"href"===o&&"#"===l[e.id].a_attr[o]?(l[e.id].a_attr.href=r[t].a_attr.href,c&&c.attr("href",r[t].a_attr.href)):"class"===o&&(l[e.id].a_attr.class=r[t].a_attr.class+" "+l[e.id].a_attr.class,c&&c.addClass(r[t].a_attr[o]))}return!0}},S.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},S.jstree.plugins.unique=function(e,f){this.check=function(e,t,r,i,s){if(!1===f.check.call(this,e,t,r,i,s))return!1;if(t=t&&t.id?t:this.get_node(t),!(r=r&&r.id?r:this.get_node(r))||!r.children)return!0;for(var a,n="rename_node"===e?i:t.text,o=[],d=this.settings.unique.case_sensitive,c=this.settings.unique.trim_whitespace,l=this._model.data,h=0,_=r.children.length;h<_;h++)a=l[r.children[h]].text,d||(a=a.toLowerCase()),c&&(a=a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),o.push(a);switch(d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),e){case"delete_node":return!0;case"rename_node":return a=t.text||"",d||(a=a.toLowerCase()),c&&(a=a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(h=-1===S.inArray(n,o)||t.text&&a===n)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"create_node":return(h=-1===S.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"copy_node":return(h=-1===S.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"move_node":return(h=t.parent===r.id&&(!s||!s.is_multi)||-1===S.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h}return!0},this.create_node=function(e,t,r,i,s){if(!t||t.text===E){if(null===e&&(e=S.jstree.root),!(e=this.get_node(e)))return f.create_node.call(this,e,t,r,i,s);if(!(r=r===E?"last":r).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(e))return f.create_node.call(this,e,t,r,i,s);t=t||{};for(var a,n,o=this._model.data,d=this.settings.unique.case_sensitive,c=this.settings.unique.trim_whitespace,l=this.settings.unique.duplicate,h=a=this.get_string("New node"),_=[],u=0,g=e.children.length;u<g;u++)n=o[e.children[u]].text,d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),_.push(n);for(u=1,n=h,d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==S.inArray(n,_);)n=h=l.call(this,a,++u).toString(),d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));t.text=h}return f.create_node.call(this,e,t,r,i,s)}};var h=y.createElement("DIV");if(h.setAttribute("unselectable","on"),h.setAttribute("role","presentation"),h.className="jstree-wholerow",h.innerHTML="&#160;",S.jstree.plugins.wholerow=function(e,a){this.bind=function(){a.bind.call(this),this.element.on("ready.jstree set_state.jstree",S.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",S.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",S.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",S.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");for(var r=!1,i=0,s=t.selected.length;i<s;i++)(r=this.get_node(t.selected[i],!0))&&r.length&&r.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",S.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",S.proxy(function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",S.proxy(function(e){var t;this._data.contextmenu&&(e.preventDefault(),t=S.Event("contextmenu",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,pageX:e.pageX,pageY:e.pageY}),S(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t))},this)).on("click.jstree",".jstree-wholerow",function(e){e.stopImmediatePropagation();var t=S.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});S(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()}).on("dblclick.jstree",".jstree-wholerow",function(e){e.stopImmediatePropagation();var t=S.Event("dblclick",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});S(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",S.proxy(function(e){e.stopImmediatePropagation();var t=S.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});S(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",S.proxy(function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",S.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),a.teardown.call(this)},this.redraw_node=function(e,t,r,i){var s;return(e=a.redraw_node.apply(this,arguments))&&(s=h.cloneNode(!0),-1!==S.inArray(e.id,this._data.core.selected)&&(s.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===e.id&&(s.className+=" jstree-wholerow-hovered"),e.insertBefore(s,e.childNodes[0])),e}},window.customElements&&Object&&Object.create){var t=Object.create(HTMLElement.prototype);t.createdCallback=function(){var e,t={core:{},plugins:[]};for(e in S.jstree.plugins)S.jstree.plugins.hasOwnProperty(e)&&this.attributes[e]&&(t.plugins.push(e),this.getAttribute(e)&&JSON.parse(this.getAttribute(e))&&(t[e]=JSON.parse(this.getAttribute(e))));for(e in S.jstree.defaults.core)S.jstree.defaults.core.hasOwnProperty(e)&&this.attributes[e]&&(t.core[e]=JSON.parse(this.getAttribute(e))||this.getAttribute(e));S(this).jstree(t)};try{window.customElements.define("vakata-jstree",function(){},{prototype:t})}catch(e){}}}var _,u,g,f,p,m});