jstree-min.js 138 KB
!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(e,t){"use strict";
/*!
 * jsTree 3.3.9
 * http://jstree.com/
 *
 * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com)
 *
 * Licensed same as jquery - under the terms of the MIT License
 *   http://www.opensource.org/licenses/mit-license.php
 */
/*!
 * if using jslint please allow for the jQuery global and use following options:
 * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true
 */if(!e.jstree){var r=0,i=!1,s=!1,a=!1,n=[],o=e("script:last").attr("src"),d=window.document,c=window.setImmediate,l=window.Promise;!c&&l&&(c=function(e,t){l.resolve(t).then(e)}),e.jstree={version:"3.3.9",defaults:{plugins:[]},plugins:{},path:o&&-1!==o.indexOf("/")?o.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,i){var s=new e.jstree.core(++r),a=i;return i=e.extend(!0,{},e.jstree.defaults,i),a&&a.plugins&&(i.plugins=a.plugins),e.each(i.plugins,(function(e,t){"core"!==e&&(s=s.plugin(t,i[t]))})),e(t).data("jstree",s),s.init(t,i),s},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(d).off(".jstree")},e.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}}},e.jstree.reference=function(t){var r=null,i=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!i||!i.length)try{i=e(t)}catch(e){}if(!i||!i.length)try{i=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return i&&i.length&&(i=i.closest(".jstree")).length&&(i=i.data("jstree"))?r=i:e(".jstree").each((function(){var i=e(this).data("jstree");if(i&&i._model.data[t])return r=i,!1})),r},e.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 n=e.jstree.reference(this),o=i&&n?n[r]:null;if(a=i&&o?o.apply(n,s):null,n||i||r!==t&&!e.isPlainObject(r)||e.jstree.create(this,r),(n&&!i||!0===r)&&(a=n||!1),null!==a&&a!==t)return!1})),null!==a&&a!==t?a:this)},e.expr.pseudos.jstree=e.expr.createPseudo((function(r){return function(r){return e(r).hasClass("jstree")&&e(r).data("jstree")!==t}})),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.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(t){t.type="click",e(t.currentTarget).trigger(t)},enter:function(t){t.type="click",e(t.currentTarget).trigger(t)},left:function(t){if(t.preventDefault(),this.is_open(t.currentTarget))this.close_node(t.currentTarget);else{var r=this.get_parent(t.currentTarget);r&&r.id!==e.jstree.root&&this.get_node(r,!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(t){if(t.preventDefault(),this.is_closed(t.currentTarget))this.open_node(t.currentTarget,(function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}));else if(this.is_open(t.currentTarget)){var r=this.get_node(t.currentTarget,!0).children(".jstree-children")[0];r&&e(this._firstChild(r)).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(e){this.open_all()},home:function(t){t.preventDefault();var r=this._firstChild(this.get_container_ul()[0]);r&&e(r).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)}}},e.jstree.core.prototype={plugin:function(t,r){var i=e.jstree.plugins[t];return i?(this._data[t]={},i.prototype=this,new i(r,this)):this},init:function(t,r){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=r,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='treeitem'><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(e.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=d.createElement("LI"),t,r;return e.setAttribute("role","treeitem"),(t=d.createElement("I")).className="jstree-icon jstree-ocl",t.setAttribute("role","presentation"),e.appendChild(t),(t=d.createElement("A")).className="jstree-anchor",t.setAttribute("href","#"),t.setAttribute("tabindex","-1"),(r=d.createElement("I")).className="jstree-icon jstree-themeicon",r.setAttribute("role","presentation"),t.appendChild(r),e.appendChild(t),t=r=null,e},_kbevent_to_func:function(e){var t={8:"Backspace",9:"Tab",13:"Enter",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:"-"},r=[];if(e.ctrlKey&&r.push("ctrl"),e.altKey&&r.push("alt"),e.shiftKey&&r.push("shift"),r.push(t[e.which]||e.which),"shift-shift"===(r=r.sort().join("-").toLowerCase())||"ctrl-ctrl"===r||"alt-alt"===r)return null;var i=this.settings.core.keyboard,s,a;for(s in i)if(i.hasOwnProperty(s)&&("-"!==(a=s)&&"+"!==a&&(a=(a=a.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),a===r))return i[s];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 t="",r=null,i=0;this.element.on("dblclick.jstree",(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(d.selection&&d.selection.empty)d.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}})).on("mousedown.jstree",e.proxy((function(e){e.target===this.element[0]&&(e.preventDefault(),i=+new Date)}),this)).on("mousedown.jstree",".jstree-ocl",(function(e){e.preventDefault()})).on("click.jstree",".jstree-ocl",e.proxy((function(e){this.toggle_node(e.target)}),this)).on("dblclick.jstree",".jstree-anchor",e.proxy((function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this.settings.core.dblclick_toggle&&this.toggle_node(e.target)}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(t){t.preventDefault(),t.currentTarget!==d.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)}),this)).on("keydown.jstree",".jstree-anchor",e.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",e.proxy((function(t,r){r.status&&(r.node.id!==e.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(e.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){var t=[],r,i;for(r=0,i=this._data.core.selected.length;r<i;r++)t=t.concat(this._model.data[this._data.core.selected[r]].parents);for(r=0,i=(t=e.vakata.array_unique(t)).length;r<i;r++)this.open_node(t[r],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}}),this),0))}),this)).on("keypress.jstree",e.proxy((function(i){if(i.target.tagName&&"input"===i.target.tagName.toLowerCase())return!0;r&&clearTimeout(r),r=setTimeout((function(){t=""}),500);var s=String.fromCharCode(i.which).toLowerCase(),a=this.element.find(".jstree-anchor").filter(":visible"),n=a.index(d.activeElement)||0,o=!1;if((t+=s).length>1){if(a.slice(n).each(e.proxy((function(r,i){if(0===e(i).text().toLowerCase().indexOf(t))return e(i).focus(),o=!0,!1}),this)),o)return;if(a.slice(0,n).each(e.proxy((function(r,i){if(0===e(i).text().toLowerCase().indexOf(t))return e(i).focus(),o=!0,!1}),this)),o)return}if(new RegExp("^"+s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(a.slice(n+1).each(e.proxy((function(t,r){if(e(r).text().toLowerCase().charAt(0)===s)return e(r).focus(),o=!0,!1}),this)),o)return;if(a.slice(0,n+1).each(e.proxy((function(t,r){if(e(r).text().toLowerCase().charAt(0)===s)return e(r).focus(),o=!0,!1}),this)),o)return}}),this)).on("init.jstree",e.proxy((function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)}),this)).on("loading.jstree",e.proxy((function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()}),this)).on("blur.jstree",".jstree-anchor",e.proxy((function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")}),this)).on("focus.jstree",".jstree-anchor",e.proxy((function(t){var r=this.get_node(t.currentTarget);r&&r.id&&(this._data.core.focused=r.id),this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave"),e(t.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")}),this)).on("focus.jstree",e.proxy((function(){if(+new Date-i>500&&!this._data.core.focused&&this.settings.core.restore_focus){i=0;var e=this.get_node(this.element.attr("aria-activedescendant"),!0);e&&e.find("> .jstree-anchor").focus()}}),this)).on("mouseenter.jstree",".jstree-anchor",e.proxy((function(e){this.hover_node(e.currentTarget)}),this)).on("mouseleave.jstree",".jstree-anchor",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},unbind:function(){this.element.off(".jstree"),e(d).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var r=this.settings.core.strings;return e.isFunction(r)?r.call(this,t):r&&r[t]?r[t]:t},_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(t,r){var i;t&&t.id&&(t=t.id),t instanceof e&&t.length&&t[0].id&&(t=t[0].id);try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(i=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[i.closest(".jstree-node").attr("id")])t=this._model.data[i.closest(".jstree-node").attr("id")];else if((i=this.element.find(t)).length&&this._model.data[i.closest(".jstree-node").attr("id")])t=this._model.data[i.closest(".jstree-node").attr("id")];else{if(!(i=this.element.find(t)).length||!i.hasClass("jstree"))return!1;t=this._model.data[e.jstree.root]}return r&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(e){return!1}},get_path:function(t,r,i){if(!(t=t.parents?t:this.get_node(t))||t.id===e.jstree.root||!t.parents)return!1;var s,a,n=[];for(n.push(i?t.id:t.text),s=0,a=t.parents.length;s<a;s++)n.push(i?t.parents[s]:this.get_text(t.parents[s]));return n=n.reverse().slice(1),r?n.join(r):n},get_next_dom:function(t,r){var i;if((t=this.get_node(t,!0))[0]===this.element[0]){for(i=this._firstChild(this.get_container_ul()[0]);i&&0===i.offsetHeight;)i=this._nextSibling(i);return!!i&&e(i)}if(!t||!t.length)return!1;if(r){i=t[0];do{i=this._nextSibling(i)}while(i&&0===i.offsetHeight);return!!i&&e(i)}if(t.hasClass("jstree-open")){for(i=this._firstChild(t.children(".jstree-children")[0]);i&&0===i.offsetHeight;)i=this._nextSibling(i);if(null!==i)return e(i)}i=t[0];do{i=this._nextSibling(i)}while(i&&0===i.offsetHeight);return null!==i?e(i):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,r){var i;if((t=this.get_node(t,!0))[0]===this.element[0]){for(i=this.get_container_ul()[0].lastChild;i&&0===i.offsetHeight;)i=this._previousSibling(i);return!!i&&e(i)}if(!t||!t.length)return!1;if(r){i=t[0];do{i=this._previousSibling(i)}while(i&&0===i.offsetHeight);return!!i&&e(i)}i=t[0];do{i=this._previousSibling(i)}while(i&&0===i.offsetHeight);if(null!==i){for(t=e(i);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return!(!(i=t[0].parentNode.parentNode)||!i.className||-1===i.className.indexOf("jstree-node"))&&e(i)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.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||e.children.length>0)},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(t,r){var i,s,a,n,o;if(e.isArray(t))return this._load_nodes(t.slice(),r),!0;if(!(t=this.get_node(t)))return r&&r.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,a=0,n=t.parents.length;a<n;a++)this._model.data[t.parents[a]].children_d=e.vakata.array_filter(this._model.data[t.parents[a]].children_d,(function(r){return-1===e.inArray(r,t.children_d)}));for(i=0,s=t.children_d.length;i<s;i++)this._model.data[t.children_d[i]].state.selected&&(o=!0),delete this._model.data[t.children_d[i]];o&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(r){return-1===e.inArray(r,t.children_d)}))),t.children=[],t.children_d=[],o&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy((function(e){(t=this._model.data[t.id]).state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var i=this.get_node(t,!0),s=0,a=0,n=this._model.data,o=!1;for(s=0,a=t.children.length;s<a;s++)if(n[t.children[s]]&&!n[t.children[s]].state.hidden){o=!0;break}t.state.loaded&&i&&i.length&&(i.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&i.addClass(t.state.opened?"jstree-open":"jstree-closed"):i.addClass("jstree-leaf")),i.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),r&&r.call(this,t,e)}),this)),!0},_load_nodes:function(e,t,r,i){var s=!0,a=function(){this._load_nodes(e,t,!0)},n=this._model.data,o,d,c=[];for(o=0,d=e.length;o<d;o++)n[e[o]]&&(!n[e[o]].state.loaded&&!n[e[o]].state.failed||!r&&i)&&(this.is_loading(e[o])||this.load_node(e[o],a),s=!1);if(s){for(o=0,d=e.length;o<d;o++)n[e[o]]&&n[e[o]].state.loaded&&c.push(e[o]);t&&!t.done&&(t.call(this,c),t.done=!0)}},load_all:function(t,r){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var i=[],s=this._model.data,a=s[t.id].children_d,n,o;for(t.state&&!t.state.loaded&&i.push(t.id),n=0,o=a.length;n<o;n++)s[a[n]]&&s[a[n]].state&&!s[a[n]].state.loaded&&i.push(a[n]);i.length?this._load_nodes(i,(function(){this.load_all(t,r)})):(r&&r.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,r){var i=this.settings.core.data,s,a=function e(){return 3!==this.nodeType&&8!==this.nodeType};return i?e.isFunction(i)?i.call(this,t,e.proxy((function(i){!1===i?r.call(this,!1):this["string"==typeof i?"_append_html_data":"_append_json_data"](t,"string"==typeof i?e(e.parseHTML(i)).filter(a):i,(function(e){r.call(this,e)}))}),this)):"object"==typeof i?i.url?(i=e.extend(!0,{},i),e.isFunction(i.url)&&(i.url=i.url.call(this,t)),e.isFunction(i.data)&&(i.data=i.data.call(this,t)),e.ajax(i).done(e.proxy((function(i,s,n){var o=n.getResponseHeader("Content-Type");return o&&-1!==o.indexOf("json")||"object"==typeof i?this._append_json_data(t,i,(function(e){r.call(this,e)})):o&&-1!==o.indexOf("html")||"string"==typeof i?this._append_html_data(t,e(e.parseHTML(i)).filter(a),(function(e){r.call(this,e)})):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:n})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1))}),this)).fail(e.proxy((function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},r.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)}),this))):(s=e.isArray(i)?e.extend(!0,[],i):e.isPlainObject(i)?e.extend(!0,{},i):i,t.id===e.jstree.root?this._append_json_data(t,s,(function(e){r.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1))):"string"==typeof i?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(i)).filter(a),(function(e){r.call(this,e)})):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),r.call(this,!1)):r.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),(function(e){r.call(this,e)})):r.call(this,!1)},_node_changed:function(t){(t=this.get_node(t))&&-1===e.inArray(t.id,this._model.changed)&&this._model.changed.push(t.id)},_append_html_data:function(t,r,i){(t=this.get_node(t)).children=[],t.children_d=[];var s=r.is("ul")?r.children():r,a=t.id,n=[],o=[],d=this._model.data,c=d[a],l=this._data.core.selected.length,h,_,u;for(s.each(e.proxy((function(t,r){(h=this._parse_model_from_html(e(r),a,c.parents.concat()))&&(n.push(h),o.push(h),d[h].children_d.length&&(o=o.concat(d[h].children_d)))}),this)),c.children=n,c.children_d=o,_=0,u=c.parents.length;_<u;_++)d[c.parents[_]].children_d=d[c.parents[_]].children_d.concat(o);this.trigger("model",{nodes:o,parent:a}),a!==e.jstree.root?(this._node_changed(a),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==l&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),i.call(this,!0)},_append_json_data:function(t,r,i,s){if(null!==this.element){(t=this.get_node(t)).children=[],t.children_d=[],r.d&&"string"==typeof(r=r.d)&&(r=JSON.parse(r)),e.isArray(r)||(r=[r]);var a=null,n={df:this._model.default_state,dat:r,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},o=this,d=function(e,t){e.data&&(e=e.data);var r=e.dat,i=e.par,s=[],a=[],n=[],d=e.df,c=e.t_id,l=e.t_cnt,h=e.m,_=h[i],u=e.sel,g,f,p,m,v=function(e,r,i){i=i?i.concat():[],r&&i.unshift(r);var s=e.id.toString(),a,o,c,l,_={id:s,text:e.text||"",icon:e.icon===t||e.icon,parent:r,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in d)d.hasOwnProperty(a)&&(_.state[a]=d[a]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(_.icon=e.data.jstree.icon),_.icon!==t&&null!==_.icon&&""!==_.icon||(_.icon=!0),e&&e.data&&(_.data=e.data,e.data.jstree))for(a in e.data.jstree)e.data.jstree.hasOwnProperty(a)&&(_.state[a]=e.data.jstree[a]);if(e&&"object"==typeof e.state)for(a in e.state)e.state.hasOwnProperty(a)&&(_.state[a]=e.state[a]);if(e&&"object"==typeof e.li_attr)for(a in e.li_attr)e.li_attr.hasOwnProperty(a)&&(_.li_attr[a]=e.li_attr[a]);if(_.li_attr.id||(_.li_attr.id=s),e&&"object"==typeof e.a_attr)for(a in e.a_attr)e.a_attr.hasOwnProperty(a)&&(_.a_attr[a]=e.a_attr[a]);for(e&&e.children&&!0===e.children&&(_.state.loaded=!1,_.children=[],_.children_d=[]),h[_.id]=_,a=0,o=_.children.length;a<o;a++)c=v(h[_.children[a]],_.id,i),l=h[c],_.children_d.push(c),l.children_d.length&&(_.children_d=_.children_d.concat(l.children_d));return delete e.data,delete e.children,h[_.id].original=e,_.state.selected&&n.push(_.id),_.id},j=function(e,r,i){i=i?i.concat():[],r&&i.unshift(r);var s=!1,a,o,_,u,g;do{s="j"+c+"_"+ ++l}while(h[s]);for(a in g={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},d)d.hasOwnProperty(a)&&(g.state[a]=d[a]);if(e&&e.id&&(g.id=e.id.toString()),e&&e.text&&(g.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(g.icon=e.data.jstree.icon),g.icon!==t&&null!==g.icon&&""!==g.icon||(g.icon=!0),e&&e.data&&(g.data=e.data,e.data.jstree))for(a in e.data.jstree)e.data.jstree.hasOwnProperty(a)&&(g.state[a]=e.data.jstree[a]);if(e&&"object"==typeof e.state)for(a in e.state)e.state.hasOwnProperty(a)&&(g.state[a]=e.state[a]);if(e&&"object"==typeof e.li_attr)for(a in e.li_attr)e.li_attr.hasOwnProperty(a)&&(g.li_attr[a]=e.li_attr[a]);if(g.li_attr.id&&!g.id&&(g.id=g.li_attr.id.toString()),g.id||(g.id=s),g.li_attr.id||(g.li_attr.id=g.id),e&&"object"==typeof e.a_attr)for(a in e.a_attr)e.a_attr.hasOwnProperty(a)&&(g.a_attr[a]=e.a_attr[a]);if(e&&e.children&&e.children.length){for(a=0,o=e.children.length;a<o;a++)_=j(e.children[a],g.id,i),u=h[_],g.children.push(_),u.children_d.length&&(g.children_d=g.children_d.concat(u.children_d));g.children_d=g.children_d.concat(g.children)}return e&&e.children&&!0===e.children&&(g.state.loaded=!1,g.children=[],g.children_d=[]),delete e.data,delete e.children,g.original=e,h[g.id]=g,g.state.selected&&n.push(g.id),g.id};if(r.length&&r[0].id!==t&&r[0].parent!==t){for(f=0,p=r.length;f<p;f++)r[f].children||(r[f].children=[]),r[f].state||(r[f].state={}),h[r[f].id.toString()]=r[f];for(f=0,p=r.length;f<p;f++)h[r[f].parent.toString()]?(h[r[f].parent.toString()].children.push(r[f].id.toString()),_.children_d.push(r[f].id.toString())):void 0!==o&&(o._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:r[f].id.toString(),parent:r[f].parent.toString()})},o.settings.core.error.call(o,o._data.core.last_error));for(f=0,p=_.children.length;f<p;f++)g=v(h[_.children[f]],i,_.parents.concat()),a.push(g),h[g].children_d.length&&(a=a.concat(h[g].children_d));for(f=0,p=_.parents.length;f<p;f++)h[_.parents[f]].children_d=h[_.parents[f]].children_d.concat(a);m={cnt:l,mod:h,sel:u,par:i,dpc:a,add:n}}else{for(f=0,p=r.length;f<p;f++)(g=j(r[f],i,_.parents.concat()))&&(s.push(g),a.push(g),h[g].children_d.length&&(a=a.concat(h[g].children_d)));for(_.children=s,_.children_d=a,f=0,p=_.parents.length;f<p;f++)h[_.parents[f]].children_d=h[_.parents[f]].children_d.concat(a);m={cnt:l,mod:h,sel:u,par:i,dpc:a,add:n}}if("undefined"!=typeof window&&void 0!==window.document)return m;postMessage(m)},l=function(t,r){if(null!==this.element){this._cnt=t.cnt;var s,a=this._model.data;for(s in a)a.hasOwnProperty(s)&&a[s].state&&a[s].state.loading&&t.mod[s]&&(t.mod[s].state.loading=!0);if(this._model.data=t.mod,r){var n,d=t.add,l=t.sel,h=this._data.core.selected.slice();if(a=this._model.data,l.length!==h.length||e.vakata.array_unique(l.concat(h)).length!==l.length){for(s=0,n=l.length;s<n;s++)-1===e.inArray(l[s],d)&&-1===e.inArray(l[s],h)&&(a[l[s]].state.selected=!1);for(s=0,n=h.length;s<n;s++)-1===e.inArray(h[s],l)&&(a[h[s]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!r&&c?c((function(){i.call(o,!0)})):i.call(o,!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 = "+d.toString()],{type:"text/javascript"}))),!this._data.core.working||s?(this._data.core.working=!0,(a=new window.Worker(this._wrk)).onmessage=e.proxy((function(e){l.call(this,e.data,!0);try{a.terminate(),a=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),n.par?a.postMessage(n):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([t,r,i,!0])}catch(e){l.call(this,d(n),!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 l.call(this,d(n),!1)}},_parse_model_from_html:function(r,i,s){s=s?[].concat(s):[],i&&s.unshift(i);var a,n,o=this._model.data,d={id:!1,text:!1,icon:!0,parent:i,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},c,l,h;for(c in this._model.default_state)this._model.default_state.hasOwnProperty(c)&&(d.state[c]=this._model.default_state[c]);if(l=e.vakata.attributes(r,!0),e.each(l,(function(t,r){if(!(r=e.trim(r)).length)return!0;d.li_attr[t]=r,"id"===t&&(d.id=r.toString())})),(l=r.children("a").first()).length&&(l=e.vakata.attributes(l,!0),e.each(l,(function(t,r){(r=e.trim(r)).length&&(d.a_attr[t]=r)}))),(l=r.children("a").first().length?r.children("a").first().clone():r.clone()).children("ins, i, ul").remove(),l=l.html(),l=e("<div />").html(l),d.text=this.settings.core.force_text?l.text():l.html(),l=r.data(),d.data=l?e.extend(!0,{},l):null,d.state.opened=r.hasClass("jstree-open"),d.state.selected=r.children("a").hasClass("jstree-clicked"),d.state.disabled=r.children("a").hasClass("jstree-disabled"),d.data&&d.data.jstree)for(c in d.data.jstree)d.data.jstree.hasOwnProperty(c)&&(d.state[c]=d.data.jstree[c]);(l=r.children("a").children(".jstree-themeicon")).length&&(d.icon=!l.hasClass("jstree-themeicon-hidden")&&l.attr("rel")),d.state.icon!==t&&(d.icon=d.state.icon),d.icon!==t&&null!==d.icon&&""!==d.icon||(d.icon=!0),l=r.children("ul").children("li");do{h="j"+this._id+"_"+ ++this._cnt}while(o[h]);return d.id=d.li_attr.id?d.li_attr.id.toString():h,l.length?(l.each(e.proxy((function(t,r){a=this._parse_model_from_html(e(r),d.id,s),n=this._model.data[a],d.children.push(a),n.children_d.length&&(d.children_d=d.children_d.concat(n.children_d))}),this)),d.children_d=d.children_d.concat(d.children)):r.hasClass("jstree-closed")&&(d.state.loaded=!1),d.li_attr.class&&(d.li_attr.class=d.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),d.a_attr.class&&(d.a_attr.class=d.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),o[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_parse_model_from_flat_json:function(e,r,i){i=i?i.concat():[],r&&i.unshift(r);var s=e.id.toString(),a=this._model.data,n=this._model.default_state,o,d,c,l,h={id:s,text:e.text||"",icon:e.icon===t||e.icon,parent:r,parents:i,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in n)n.hasOwnProperty(o)&&(h.state[o]=n[o]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),h.icon!==t&&null!==h.icon&&""!==h.icon||(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(o in e.data.jstree)e.data.jstree.hasOwnProperty(o)&&(h.state[o]=e.data.jstree[o]);if(e&&"object"==typeof e.state)for(o in e.state)e.state.hasOwnProperty(o)&&(h.state[o]=e.state[o]);if(e&&"object"==typeof e.li_attr)for(o in e.li_attr)e.li_attr.hasOwnProperty(o)&&(h.li_attr[o]=e.li_attr[o]);if(h.li_attr.id||(h.li_attr.id=s),e&&"object"==typeof e.a_attr)for(o in e.a_attr)e.a_attr.hasOwnProperty(o)&&(h.a_attr[o]=e.a_attr[o]);for(e&&e.children&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),a[h.id]=h,o=0,d=h.children.length;o<d;o++)l=a[c=this._parse_model_from_flat_json(a[h.children[o]],h.id,i)],h.children_d.push(c),l.children_d.length&&(h.children_d=h.children_d.concat(l.children_d));return delete e.data,delete e.children,a[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,r,i){i=i?i.concat():[],r&&i.unshift(r);var s=!1,a,n,o,d,c=this._model.data,l=this._model.default_state,h;do{s="j"+this._id+"_"+ ++this._cnt}while(c[s]);for(a in h={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l)l.hasOwnProperty(a)&&(h.state[a]=l[a]);if(e&&e.id&&(h.id=e.id.toString()),e&&e.text&&(h.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),h.icon!==t&&null!==h.icon&&""!==h.icon||(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(a in e.data.jstree)e.data.jstree.hasOwnProperty(a)&&(h.state[a]=e.data.jstree[a]);if(e&&"object"==typeof e.state)for(a in e.state)e.state.hasOwnProperty(a)&&(h.state[a]=e.state[a]);if(e&&"object"==typeof e.li_attr)for(a in e.li_attr)e.li_attr.hasOwnProperty(a)&&(h.li_attr[a]=e.li_attr[a])
;if(h.li_attr.id&&!h.id&&(h.id=h.li_attr.id.toString()),h.id||(h.id=s),h.li_attr.id||(h.li_attr.id=h.id),e&&"object"==typeof e.a_attr)for(a in e.a_attr)e.a_attr.hasOwnProperty(a)&&(h.a_attr[a]=e.a_attr[a]);if(e&&e.children&&e.children.length){for(a=0,n=e.children.length;a<n;a++)d=c[o=this._parse_model_from_json(e.children[a],h.id,i)],h.children.push(o),d.children_d.length&&(h.children_d=h.children_d.concat(d.children_d));h.children_d=h.children.concat(h.children_d)}return e&&e.children&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),delete e.data,delete e.children,h.original=e,c[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_redraw:function(){var t=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),r=d.createElement("UL"),i,s,a,n=this._data.core.focused;for(s=0,a=t.length;s<a;s++)(i=this.redraw_node(t[s],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&r.appendChild(i);this._model.force_full_redraw&&(r.className=this.get_container_ul()[0].className,r.setAttribute("role","group"),this.element.empty().append(r)),null!==n&&this.settings.core.restore_focus&&((i=this.get_node(n,!0))&&i.length&&i.children(".jstree-anchor")[0]!==d.activeElement?i.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(t){var r=this.get_node(t),i=!1,s=!1,a=!1,n=d;if(!r)return!1;if(r.id===e.jstree.root)return this.redraw(!0);if(!(t=this.get_node(t,!0))||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],r.children.length&&r.state.loaded){for((a=n.createElement("UL")).setAttribute("role","group"),a.className="jstree-children",i=0,s=r.children.length;i<s;i++)a.appendChild(this.redraw_node(r.children[i],!0,!0));t.appendChild(a)}},redraw_node:function(t,r,i,s){var a=this.get_node(t),n=!1,o=!1,c=!1,l=!1,h=!1,_=!1,u="",g=d,f=this._model.data,p=!1,m=!1,v=null,j=0,y=0,k=!1,x=!1;if(!a)return!1;if(a.id===e.jstree.root)return this.redraw(!0);if(r=r||0===a.children.length,t=d.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(a.id[0])?"\\3"+a.id[0]+" "+a.id.substr(1).replace(e.jstree.idregex,"\\$&"):a.id.replace(e.jstree.idregex,"\\$&"))):d.getElementById(a.id))t=e(t),i||((n=t.parent().parent()[0])===this.element[0]&&(n=null),o=t.index()),r||!a.children.length||t.children(".jstree-children").length||(r=!0),r||(c=t.children(".jstree-children")[0]),p=t.children(".jstree-anchor")[0]===d.activeElement,t.remove();else if(r=!0,!i){if(!(null===(n=a.parent!==e.jstree.root?e("#"+a.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||n&&f[a.parent].state.opened))return!1;o=e.inArray(a.id,null===n?f[e.jstree.root].children:f[a.parent].children)}for(l in t=this._data.core.node.cloneNode(!0),u="jstree-node ",a.li_attr)if(a.li_attr.hasOwnProperty(l)){if("id"===l)continue;"class"!==l?t.setAttribute(l,a.li_attr[l]):u+=a.li_attr[l]}for(a.a_attr.id||(a.a_attr.id=a.id+"_anchor"),t.setAttribute("aria-selected",!!a.state.selected),t.setAttribute("aria-level",a.parents.length),t.setAttribute("aria-labelledby",a.a_attr.id),a.state.disabled&&t.setAttribute("aria-disabled",!0),l=0,h=a.children.length;l<h;l++)if(!f[a.children[l]].state.hidden){k=!0;break}if(null!==a.parent&&f[a.parent]&&!a.state.hidden&&(l=e.inArray(a.id,f[a.parent].children),x=a.id,-1!==l))for(l++,h=f[a.parent].children.length;l<h&&(f[f[a.parent].children[l]].state.hidden||(x=f[a.parent].children[l]),x===a.id);l++);for(h in a.state.hidden&&(u+=" jstree-hidden"),a.state.loading&&(u+=" jstree-loading"),a.state.loaded&&!k?u+=" jstree-leaf":(u+=a.state.opened&&a.state.loaded?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",a.state.opened&&a.state.loaded)),x===a.id&&(u+=" jstree-last"),t.id=a.id,t.className=u,u=(a.state.selected?" jstree-clicked":"")+(a.state.disabled?" jstree-disabled":""),a.a_attr)if(a.a_attr.hasOwnProperty(h)){if("href"===h&&"#"===a.a_attr[h])continue;"class"!==h?t.childNodes[1].setAttribute(h,a.a_attr[h]):u+=" "+a.a_attr[h]}if(u.length&&(t.childNodes[1].className="jstree-anchor "+u),(a.icon&&!0!==a.icon||!1===a.icon)&&(!1===a.icon?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===a.icon.indexOf("/")&&-1===a.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+a.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+a.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(g.createTextNode(a.text)):t.childNodes[1].innerHTML+=a.text,r&&a.children.length&&(a.state.opened||s)&&a.state.loaded){for((_=g.createElement("UL")).setAttribute("role","group"),_.className="jstree-children",l=0,h=a.children.length;l<h;l++)_.appendChild(this.redraw_node(a.children[l],r,!0));t.appendChild(_)}if(c&&t.appendChild(c),!i){for(n||(n=this.element[0]),l=0,h=n.childNodes.length;l<h;l++)if(n.childNodes[l]&&n.childNodes[l].className&&-1!==n.childNodes[l].className.indexOf("jstree-children")){v=n.childNodes[l];break}v||((v=g.createElement("UL")).setAttribute("role","group"),v.className="jstree-children",n.appendChild(v)),o<(n=v).childNodes.length?n.insertBefore(t,n.childNodes[o]):n.appendChild(t),p&&(j=this.element[0].scrollTop,y=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=j,this.element[0].scrollLeft=y)}return a.state.opened&&!a.state.loaded&&(a.state.opened=!1,setTimeout(e.proxy((function(){this.open_node(a.id,!1,0)}),this),0)),t},open_node:function(r,i,s){var a,n,o,d;if(e.isArray(r)){for(a=0,n=(r=r.slice()).length;a<n;a++)this.open_node(r[a],i,s);return!0}return!(!(r=this.get_node(r))||r.id===e.jstree.root)&&(s=s===t?this.settings.core.animation:s,this.is_closed(r)?this.is_loaded(r)?(o=this.get_node(r,!0),d=this,o.length&&(s&&o.children(".jstree-children").length&&o.children(".jstree-children").stop(!0,!0),r.children.length&&!this._firstChild(o.children(".jstree-children")[0])&&this.draw_children(r),s?(this.trigger("before_open",{node:r}),o.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(s,(function(){this.style.display="",d.element&&d.trigger("after_open",{node:r})}))):(this.trigger("before_open",{node:r}),o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),r.state.opened=!0,i&&i.call(this,r,!0),o.length||this.trigger("before_open",{node:r}),this.trigger("open_node",{node:r}),s&&o.length||this.trigger("after_open",{node:r}),!0):this.is_loading(r)?setTimeout(e.proxy((function(){this.open_node(r,i,s)}),this),500):void this.load_node(r,(function(e,t){return t?this.open_node(e,i,s):!!i&&i.call(this,e,!1)})):(i&&i.call(this,r,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var r,i,s=t.parents;for(r=0,i=s.length;r<i;r+=1)r!==e.jstree.root&&this.open_node(s[r],!1,0);return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(r,i){var s,a,n,o;if(e.isArray(r)){for(s=0,a=(r=r.slice()).length;s<a;s++)this.close_node(r[s],i);return!0}return!(!(r=this.get_node(r))||r.id===e.jstree.root)&&(!this.is_closed(r)&&(i=i===t?this.settings.core.animation:i,n=this,o=this.get_node(r,!0),r.state.opened=!1,this.trigger("close_node",{node:r}),void(o.length?i?o.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(i,(function(){this.style.display="",o.children(".jstree-children").remove(),n.element&&n.trigger("after_close",{node:r})})):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:r})):this.trigger("after_close",{node:r}))))},toggle_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.toggle_node(t[r]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,r,i){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var s=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),a,n,o;if(!s.length){for(a=0,n=t.children_d.length;a<n;a++)this.is_closed(this._model.data[t.children_d[a]])&&(this._model.data[t.children_d[a]].state.opened=!0);return this.trigger("open_all",{node:t})}i=i||s,o=this,(s=this.is_closed(t)?s.find(".jstree-closed").addBack():s.find(".jstree-closed")).each((function(){o.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(t,r){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var i=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),s=this,a,n;for(i.length&&(i=this.is_open(t)?i.find(".jstree-open").addBack():i.find(".jstree-open"),e(i.get().reverse()).each((function(){s.close_node(this,r||0)}))),a=0,n=t.children_d.length;a<n;a++)this._model.data[t.children_d[a]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.enable_node(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),this.trigger("enable_node",{node:t})},disable_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.disable_node(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),this.trigger("disable_node",{node:t})},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(t,r){var i,s;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.hide_node(t[i],!0);return r||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),r||this.redraw(),this.trigger("hide_node",{node:t}))},show_node:function(t,r){var i,s;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.show_node(t[i],!0);return r||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),r||this.redraw(),this.trigger("show_node",{node:t}))},hide_all:function(t){var r,i=this._model.data,s=[];for(r in i)i.hasOwnProperty(r)&&r!==e.jstree.root&&!i[r].state.hidden&&(i[r].state.hidden=!0,s.push(r));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:s}),s},show_all:function(t){var r,i=this._model.data,s=[];for(r in i)i.hasOwnProperty(r)&&r!==e.jstree.root&&i[r].state.hidden&&(i[r].state.hidden=!1,s.push(r));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:s}),s},activate_node:function(e,r){if(this.is_disabled(e))return!1;if(r&&"object"==typeof r||(r={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?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&&(r.metaKey||r.ctrlKey||r.shiftKey)&&(!r.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(r.shiftKey){var i=this.get_node(e).id,s=this._data.core.last_clicked.id,a=this.get_node(this._data.core.last_clicked.parent).children,n=!1,o,d;for(o=0,d=a.length;o<d;o+=1)a[o]===i&&(n=!n),a[o]===s&&(n=!n),this.is_disabled(a[o])||!n&&a[o]!==i&&a[o]!==s?this.deselect_node(a[o],!0,r):this.is_hidden(a[o])||this.select_node(a[o],!0,!1,r);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:r})}else this.is_selected(e)?this.deselect_node(e,!1,r):this.select_node(e,!1,!1,r);else!this.settings.core.multiple&&(r.metaKey||r.ctrlKey||r.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,r):(this.deselect_all(!0),this.select_node(e,!1,!1,r),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:r})},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){if(!(e=this.get_node(e,!0))||!e.length||!e.children(".jstree-hovered").length)return!1;e.children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)})},select_node:function(t,r,i,s){var a,n,o,d;if(e.isArray(t)){for(n=0,o=(t=t.slice()).length;n<o;n++)this.select_node(t[n],r,i,s);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;a=this.get_node(t,!0),t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),i||(a=this._open_to(t)),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:s}),r||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:s}))},deselect_node:function(t,r,i){var s,a,n;if(e.isArray(t)){for(s=0,a=(t=t.slice()).length;s<a;s++)this.deselect_node(t[s],r,i);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;n=this.get_node(t,!0),t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:i}),r||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:i}))},select_all:function(t){var r=this._data.core.selected.concat([]),i,s;for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),i=0,s=this._data.core.selected.length;i<s;i++)this._model.data[this._data.core.selected[i]]&&(this._model.data[this._data.core.selected[i]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:r})},deselect_all:function(e){var t=this._data.core.selected.concat([]),r,i;for(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(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.selected},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.core.selected.slice()},get_top_selected:function(t){var r=this.get_selected(!0),i={},s,a,n,o;for(s=0,a=r.length;s<a;s++)i[r[s].id]=r[s];for(s=0,a=r.length;s<a;s++)for(n=0,o=r[s].children_d.length;n<o;n++)i[r[s].children_d[n]]&&delete i[r[s].children_d[n]];for(s in r=[],i)i.hasOwnProperty(s)&&r.push(s);return t?e.map(r,e.proxy((function(e){return this.get_node(e)}),this)):r},get_bottom_selected:function(t){var r=this.get_selected(!0),i=[],s,a;for(s=0,a=r.length;s<a;s++)r[s].children.length||i.push(r[s].id);return t?e.map(i,e.proxy((function(e){return this.get_node(e)}),this)):i},get_state:function(){var t={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},
/*!
					'themes' : {
						'name' : this.get_theme(),
						'icons' : this._data.core.themes.icons,
						'dots' : this._data.core.themes.dots
					},
					*/
selected:[]}},r;for(r in this._model.data)this._model.data.hasOwnProperty(r)&&r!==e.jstree.root&&(this._model.data[r].state.loaded&&this.settings.core.loaded_state&&t.core.loaded.push(r),this._model.data[r].state.opened&&t.core.open.push(r),this._model.data[r].state.selected&&t.core.selected.push(r));return t},set_state:function(r,i){if(r){if(r.core&&r.core.selected&&r.core.initial_selection===t&&(r.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),r.core){var s,a,n,o,d;if(r.core.loaded)return this.settings.core.loaded_state&&e.isArray(r.core.loaded)&&r.core.loaded.length?this._load_nodes(r.core.loaded,(function(e){delete r.core.loaded,this.set_state(r,i)})):(delete r.core.loaded,this.set_state(r,i)),!1;if(r.core.open)return e.isArray(r.core.open)&&r.core.open.length?this._load_nodes(r.core.open,(function(e){this.open_node(e,!1,0),delete r.core.open,this.set_state(r,i)})):(delete r.core.open,this.set_state(r,i)),!1;if(r.core.scroll)return r.core.scroll&&r.core.scroll.left!==t&&this.element.scrollLeft(r.core.scroll.left),r.core.scroll&&r.core.scroll.top!==t&&this.element.scrollTop(r.core.scroll.top),delete r.core.scroll,this.set_state(r,i),!1;if(r.core.selected)return o=this,r.core.initial_selection!==t&&r.core.initial_selection!==this._data.core.selected.concat([]).sort().join(",")||(this.deselect_all(),e.each(r.core.selected,(function(e,t){o.select_node(t,!1,!0)}))),delete r.core.initial_selection,delete r.core.selected,this.set_state(r,i),!1;for(d in r)r.hasOwnProperty(d)&&"core"!==d&&-1===e.inArray(d,this.settings.plugins)&&delete r[d];if(e.isEmptyObject(r.core))return delete r.core,this.set_state(r,i),!1}return!e.isEmptyObject(r)||(r=null,i&&i.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(t,r){this._data.core.state=!0===r?{}:this.get_state(),r&&e.isFunction(r)&&(this._data.core.state=r.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.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 i=this.get_container_ul()[0].className;t||(this.element.html("<ul class='"+i+"' 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(e.jstree.root,(function(t,r){r&&(this.get_container_ul()[0].className=i,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.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===e.jstree.root)return!1;var r=[],i=[],s=this._data.core.selected.concat([]);i.push(t.id),!0===t.state.opened&&r.push(t.id),this.get_node(t,!0).find(".jstree-open").each((function(){i.push(this.id),r.push(this.id)})),this._load_nodes(i,e.proxy((function(e){this.open_node(r,!1,0),this.select_node(s),this.trigger("refresh_node",{node:t,nodes:e})}),this),!1,!0)},set_id:function(t,r){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var i,s,a=this._model.data,n=t.id;for(r=r.toString(),a[t.parent].children[e.inArray(t.id,a[t.parent].children)]=r,i=0,s=t.parents.length;i<s;i++)a[t.parents[i]].children_d[e.inArray(t.id,a[t.parents[i]].children_d)]=r;for(i=0,s=t.children.length;i<s;i++)a[t.children[i]].parent=r;for(i=0,s=t.children_d.length;i<s;i++)a[t.children_d[i]].parents[e.inArray(t.id,a[t.children_d[i]].parents)]=r;return-1!==(i=e.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[i]=r),(i=this.get_node(t.id,!0))&&(i.attr("id",r),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",r)),delete a[t.id],t.id=r,t.li_attr.id=r,a[r]=t,this.trigger("set_id",{node:t,new:t.id,old:n}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.text},set_text:function(t,r){var i,s;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.set_text(t[i],r);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.text=r,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:r}),!0)},get_json:function(t,r,i){if(!(t=this.get_node(t||e.jstree.root)))return!1;r&&r.flat&&!i&&(i=[]);var s={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:(!r||!r.no_data)&&e.extend(!0,e.isArray(t.data)?[]:{},t.data)},a,n;if(r&&r.flat?s.parent=t.parent:s.children=[],r&&r.no_state)delete s.state;else for(a in t.state)t.state.hasOwnProperty(a)&&(s.state[a]=t.state[a]);if(r&&r.no_li_attr&&delete s.li_attr,r&&r.no_a_attr&&delete s.a_attr,r&&r.no_id&&(delete s.id,s.li_attr&&s.li_attr.id&&delete s.li_attr.id,s.a_attr&&s.a_attr.id&&delete s.a_attr.id),r&&r.flat&&t.id!==e.jstree.root&&i.push(s),!r||!r.no_children)for(a=0,n=t.children.length;a<n;a++)r&&r.flat?this.get_json(t.children[a],r,i):s.children.push(this.get_json(t.children[a],r));return r&&r.flat?i:t.id===e.jstree.root?s.children:s},create_node:function(r,i,s,a,n){if(null===r&&(r=e.jstree.root),!(r=this.get_node(r)))return!1;if(!(s=s===t?"last":s).toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(r))return this.load_node(r,(function(){this.create_node(r,i,s,a,!0)}));var o,d,c,l;switch(i||(i={text:this.get_string("New node")}),(i="string"==typeof i?{text:i}:e.extend(!0,{},i)).text===t&&(i.text=this.get_string("New node")),r.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":o=this.get_node(r.parent),s=e.inArray(r.id,o.children),r=o;break;case"after":o=this.get_node(r.parent),s=e.inArray(r.id,o.children)+1,r=o;break;case"inside":case"first":s=0;break;case"last":s=r.children.length;break;default:s||(s=0);break}if(s>r.children.length&&(s=r.children.length),i.id||(i.id=!0),!this.check("create_node",i,r,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===i.id&&delete i.id,!(i=this._parse_model_from_json(i,r.id,r.parents.concat())))return!1;for(o=this.get_node(i),(d=[]).push(i),d=d.concat(o.children_d),this.trigger("model",{nodes:d,parent:r.id}),r.children_d=r.children_d.concat(d),c=0,l=r.parents.length;c<l;c++)this._model.data[r.parents[c]].children_d=this._model.data[r.parents[c]].children_d.concat(d);for(i=o,o=[],c=0,l=r.children.length;c<l;c++)o[c>=s?c+1:c]=r.children[c];return o[s]=i.id,r.children=o,this.redraw_node(r,!0),this.trigger("create_node",{node:this.get_node(i),parent:r.id,position:s}),a&&a.call(this,this.get_node(i)),i.id},rename_node:function(t,r){var i,s,a;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.rename_node(t[i],r);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(a=t.text,this.check("rename_node",t,this.get_parent(t),r)?(this.set_text(t,r),this.trigger("rename_node",{node:t,text:r,old:a}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(t){var r,i,s,a,n,o,d,c,l,h,_,u;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.delete_node(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;if(s=this.get_node(t.parent),a=e.inArray(t.id,s.children),h=!1,!this.check("delete_node",t,s,a))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==a&&(s.children=e.vakata.array_remove(s.children,a)),(n=t.children_d.concat([])).push(t.id),o=0,d=t.parents.length;o<d;o++)this._model.data[t.parents[o]].children_d=e.vakata.array_filter(this._model.data[t.parents[o]].children_d,(function(t){return-1===e.inArray(t,n)}));for(c=0,l=n.length;c<l;c++)if(this._model.data[n[c]].state.selected){h=!0;break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,(function(t){return-1===e.inArray(t,n)}))),this.trigger("delete_node",{node:t,parent:s.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),c=0,l=n.length;c<l;c++)delete this._model.data[n[c]];return-1!==e.inArray(this._data.core.focused,n)&&(this._data.core.focused=null,_=this.element[0].scrollTop,u=this.element[0].scrollLeft,s.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(s,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=_,this.element[0].scrollLeft=u),this.redraw_node(s,!0),!0},check:function(t,r,i,s,a){r=r&&r.id?r:this.get_node(r),i=i&&i.id?i:this.get_node(i);var n=t.match(/^move_node|copy_node|create_node$/i)?i:r,o=this.settings.core.check_callback;if("move_node"===t||"copy_node"===t){if(!(a&&a.is_multi||"move_node"!==t||e.inArray(r.id,i.children)!==s))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:t,pos:s,obj:!(!r||!r.id)&&r.id,par:!(!i||!i.id)&&i.id})},!1;if(!(a&&a.is_multi||r.id!==i.id&&("move_node"!==t||e.inArray(r.id,i.children)!==s)&&-1===e.inArray(i.id,r.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:s,obj:!(!r||!r.id)&&r.id,par:!(!i||!i.id)&&i.id})},!1}return n&&n.data&&(n=n.data),n&&n.functions&&(!1===n.functions[t]||!0===n.functions[t])?(!1===n.functions[t]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!r||!r.id)&&r.id,par:!(!i||!i.id)&&i.id})}),n.functions[t]):!(!1===o||e.isFunction(o)&&!1===o.call(this,t,r,i,s,a)||o&&!1===o[t])||(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!r||!r.id)&&r.id,par:!(!i||!i.id)&&i.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(r,i,s,a,n,o,d){var c,l,h,_,u,g,f,p,m,v,j,y,k,x;if(i=this.get_node(i),s=s===t?0:s,!i)return!1;if(!s.toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(i))return this.load_node(i,(function(){this.move_node(r,i,s,a,!0,!1,d)}));if(e.isArray(r)){if(1!==r.length){for(c=0,l=r.length;c<l;c++)(m=this.move_node(r[c],i,s,a,n,!1,d))&&(i=m,s="after");return this.redraw(),!0}r=r[0]}if(!(r=r&&r.id?r:this.get_node(r))||r.id===e.jstree.root)return!1;if(h=(r.parent||e.jstree.root).toString(),u=s.toString().match(/^(before|after)$/)&&i.id!==e.jstree.root?this.get_node(i.parent):i,f=!(g=d||(this._model.data[r.id]?this:e.jstree.reference(r.id)))||!g._id||this._id!==g._id,_=g&&g._id&&h&&g._model.data[h]&&g._model.data[h].children?e.inArray(r.id,g._model.data[h].children):-1,g&&g._id&&(r=g._model.data[r.id]),f)return!!(m=this.copy_node(r,i,s,a,n,!1,d))&&(g&&g.delete_node(r),m);switch(i.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,u.children);break;case"after":s=e.inArray(i.id,u.children)+1;break;case"inside":case"first":s=0;break;case"last":s=u.children.length;break;default:s||(s=0);break}if(s>u.children.length&&(s=u.children.length),!this.check("move_node",r,u,s,{core:!0,origin:d,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(r.parent===u.id){for(p=u.children.concat(),-1!==(m=e.inArray(r.id,p))&&(p=e.vakata.array_remove(p,m),s>m&&s--),m=[],v=0,j=p.length;v<j;v++)m[v>=s?v+1:v]=p[v];m[s]=r.id,u.children=m,this._node_changed(u.id),this.redraw(u.id===e.jstree.root)}else{for((m=r.children_d.concat()).push(r.id),v=0,j=r.parents.length;v<j;v++){for(p=[],y=0,k=(x=g._model.data[r.parents[v]].children_d).length;y<k;y++)-1===e.inArray(x[y],m)&&p.push(x[y]);g._model.data[r.parents[v]].children_d=p}for(g._model.data[h].children=e.vakata.array_remove_item(g._model.data[h].children,r.id),v=0,j=u.parents.length;v<j;v++)this._model.data[u.parents[v]].children_d=this._model.data[u.parents[v]].children_d.concat(m);for(p=[],v=0,j=u.children.length;v<j;v++)p[v>=s?v+1:v]=u.children[v];for(p[s]=r.id,u.children=p,u.children_d.push(r.id),u.children_d=u.children_d.concat(r.children_d),r.parent=u.id,(m=u.parents.concat()).unshift(u.id),x=r.parents.length,r.parents=m,m=m.concat(),v=0,j=r.children_d.length;v<j;v++)this._model.data[r.children_d[v]].parents=this._model.data[r.children_d[v]].parents.slice(0,-1*x),Array.prototype.push.apply(this._model.data[r.children_d[v]].parents,m);h!==e.jstree.root&&u.id!==e.jstree.root||(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(u.id)),o||this.redraw()}return a&&a.call(this,r,u,s),this.trigger("move_node",{node:r,parent:u.id,position:s,old_parent:h,old_position:_,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id,old_instance:g,new_instance:this}),r.id},copy_node:function(r,i,s,a,n,o,d){var c,l,h,_,u,g,f,p,m,v,j;if(i=this.get_node(i),s=s===t?0:s,!i)return!1;if(!s.toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(i))return this.load_node(i,(function(){this.copy_node(r,i,s,a,!0,!1,d)}));if(e.isArray(r)){if(1!==r.length){for(c=0,l=r.length;c<l;c++)(_=this.copy_node(r[c],i,s,a,n,!0,d))&&(i=_,s="after");return this.redraw(),!0}r=r[0]}if(!(r=r&&r.id?r:this.get_node(r))||r.id===e.jstree.root)return!1;switch(p=(r.parent||e.jstree.root).toString(),m=s.toString().match(/^(before|after)$/)&&i.id!==e.jstree.root?this.get_node(i.parent):i,j=!(v=d||(this._model.data[r.id]?this:e.jstree.reference(r.id)))||!v._id||this._id!==v._id,v&&v._id&&(r=v._model.data[r.id]),i.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(i.id,m.children);break;case"after":s=e.inArray(i.id,m.children)+1;break;case"inside":case"first":s=0;break;case"last":s=m.children.length;break;default:s||(s=0);break}if(s>m.children.length&&(s=m.children.length),!this.check("copy_node",r,m,s,{core:!0,origin:d,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(f=v?v.get_json(r,{no_id:!0,no_data:!0,no_state:!0}):r))return!1;if(!0===f.id&&delete f.id,!(f=this._parse_model_from_json(f,m.id,m.parents.concat())))return!1;for(_=this.get_node(f),r&&r.state&&!1===r.state.loaded&&(_.state.loaded=!1),(h=[]).push(f),h=h.concat(_.children_d),this.trigger("model",{nodes:h,parent:m.id}),u=0,g=m.parents.length;u<g;u++)this._model.data[m.parents[u]].children_d=this._model.data[m.parents[u]].children_d.concat(h);for(h=[],u=0,g=m.children.length;u<g;u++)h[u>=s?u+1:u]=m.children[u];return h[s]=_.id,m.children=h,m.children_d.push(_.id),m.children_d=m.children_d.concat(_.children_d),m.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(m.id),o||this.redraw(m.id===e.jstree.root),a&&a.call(this,_,m,s),this.trigger("copy_node",{node:_,original:r,parent:m.id,position:s,old_parent:p,old_position:v&&v._id&&p&&v._model.data[p]&&v._model.data[p].children?e.inArray(r.id,v._model.data[p].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),_.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var r=[],n,o,d;for(o=0,d=t.length;o<d;o++)(n=this.get_node(t[o]))&&n.id&&n.id!==e.jstree.root&&r.push(n);if(!r.length)return!1;i=r,a=this,s="move_node",this.trigger("cut",{node:t})},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var r=[],n,o,d;for(o=0,d=t.length;o<d;o++)(n=this.get_node(t[o]))&&n.id&&n.id!==e.jstree.root&&r.push(n);if(!r.length)return!1;i=r,a=this,s="copy_node",this.trigger("copy",{node:t})},get_buffer:function(){return{mode:s,node:i,inst:a}},can_paste:function(){return!1!==s&&!1!==i},paste:function(e,t){if(!((e=this.get_node(e))&&s&&s.match(/^(copy_node|move_node)$/)&&i))return!1;this[s](i,e,t,!1,!1,!1,a)&&this.trigger("paste",{parent:e.id,node:i,mode:s}),i=!1,s=!1,a=!1},clear_buffer:function(){i=!1,s=!1,a=!1,this.trigger("clear_buffer")},edit:function(t,r,i){var s,a,n,o,c,l,h,_,u,g=!1;return!!(t=this.get_node(t))&&(this.check("edit",t,this.get_parent(t))?(u=t,r="string"==typeof r?r:t.text,this.set_text(t,""),t=this._open_to(t),u.text=r,s=this._data.core.rtl,a=this.element.width(),this._data.core.focused=u.id,n=t.children(".jstree-anchor").focus(),o=e("<span>"),
/*!
			oi = obj.children("i:visible"),
			ai = a.children("i:visible"),
			w1 = oi.width() * oi.length,
			w2 = ai.width() * ai.length,
			*/
c=r,l=e("<div />",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo(d.body),h=e("<input />",{value:c,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy((function(r){r.stopImmediatePropagation(),r.preventDefault();var s,a=o.children(".jstree-rename-input").val(),d=this.settings.core.force_text,_;""===a&&(a=c),l.remove(),o.replaceWith(n),o.remove(),c=d?c:e("<div></div>").append(e.parseHTML(c)).html(),t=this.get_node(t),this.set_text(t,c),(_=!!this.rename_node(t,d?e("<div></div>").text(a).text():e("<div></div>").append(e.parseHTML(a)).html()))||this.set_text(t,c),this._data.core.focused=u.id,setTimeout(e.proxy((function(){var e=this.get_node(u.id,!0);e.length&&(this._data.core.focused=u.id,e.children(".jstree-anchor").focus())}),this),0),i&&i.call(this,u,_,g),h=null}),this),keydown:function(e){var t=e.which;27===t&&(g=!0,this.value=c),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(l.text("pW"+this.value).width(),a))},keypress:function(e){if(13===e.which)return!1}}),_={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(h),n.replaceWith(o),l.css(_),h.css(_).width(Math.min(l.text("pW"+h[0].value).width(),a))[0].select(),void e(d).one("mousedown.jstree touchstart.jstree dnd_start.vakata",(function(t){h&&t.target!==h&&e(h).blur()}))):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(t,r){if(!t)return!1;if(!0===r){var i=this.settings.core.themes.dir;i||(i=e.jstree.path+"/themes"),r=i+"/"+t+"/style.css"}r&&-1===e.inArray(r,n)&&(e("head").append('<link rel="stylesheet" href="'+r+'" type="text/css" />'),n.push(r)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),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(r,i){var s,a,n,o;if(e.isArray(r)){for(s=0,a=(r=r.slice()).length;s<a;s++)this.set_icon(r[s],i);return!0}return!(!(r=this.get_node(r))||r.id===e.jstree.root)&&(o=r.icon,r.icon=!0===i||null===i||i===t||""===i||i,n=this.get_node(r,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===i?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),this.hide_icon(r)):!0===i||null===i||i===t||""===i?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),!1===o&&this.show_icon(r)):-1===i.indexOf("/")&&-1===i.indexOf(".")?(n.removeClass(o).css("background",""),n.addClass(i+" jstree-themeicon-custom").attr("rel",i),!1===o&&this.show_icon(r)):(n.removeClass(o).css("background",""),n.addClass("jstree-themeicon-custom").css("background","url('"+i+"') center center no-repeat").attr("rel",i),!1===o&&this.show_icon(r)),!0)},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.hide_icon(t[r]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(t){var r,i,s;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.show_icon(t[r]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(s=this.get_node(t,!0),t.icon=!s.length||s.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),s.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},e.vakata={},e.vakata.attributes=function(t,r){t=e(t)[0];var i=r?{}:[];return t&&t.attributes&&e.each(t.attributes,(function(t,s){-1===e.inArray(s.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==s.value&&""!==e.trim(s.value)&&(r?i[s.name]=s.value:i.push(s.name))})),i},e.vakata.array_unique=function(e){var r=[],i,s,a,n={};for(i=0,a=e.length;i<a;i++)n[e[i]]===t&&(r.push(e[i]),n[e[i]]=!0);return r},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,r){var i=e.inArray(r,t);return-1!==i?e.vakata.array_remove(t,i):t},e.vakata.array_filter=function(e,t,r,i,s){if(e.filter)return e.filter(t,r);for(s in i=[],e)~~s+""==s+""&&s>=0&&t.call(r,e[s],+s,e)&&i.push(e[s]);return i},e.jstree.plugins.changed=function(e,t){var r=[];this.trigger=function(e,i){var s,a;if(i||(i={}),"changed"===e.replace(".jstree","")){i.changed={selected:[],deselected:[]};var n={};for(s=0,a=r.length;s<a;s++)n[r[s]]=1;for(s=0,a=i.selected.length;s<a;s++)n[i.selected[s]]?n[i.selected[s]]=2:i.changed.selected.push(i.selected[s]);for(s=0,a=r.length;s<a;s++)1===n[r[s]]&&i.changed.deselected.push(r[s]);r=i.selected.slice()}t.trigger.call(this,e,i)},this.refresh=function(e,i){return r=[],t.refresh.apply(this,arguments)}};var h=d.createElement("I"),_,u;h.className="jstree-icon jstree-checkbox",h.setAttribute("role","presentation"),e.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},e.jstree.plugins.checkbox=function(r,i){this.bind=function(){i.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",e.proxy((function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")}),this)).on("loading.jstree",e.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",e.proxy((function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)}),this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy((function(e,t){var r=this._model.data,i=r[t.parent],s=t.nodes,a,n;for(a=0,n=s.length;a<n;a++)r[s[a]].state.checked=r[s[a]].state.checked||r[s[a]].original&&r[s[a]].original.state&&r[s[a]].original.state.checked,r[s[a]].state.checked&&this._data.checkbox.selected.push(s[a])}),this)),-1===this.settings.checkbox.cascade.indexOf("up")&&-1===this.settings.checkbox.cascade.indexOf("down")||this.element.on("model.jstree",e.proxy((function(t,r){var i=this._model.data,s=i[r.parent],a=r.nodes,n=[],o,d,c,l,h,_,u=this.settings.checkbox.cascade,g=this.settings.checkbox.tie_selection;if(-1!==u.indexOf("down"))if(s.state[g?"selected":"checked"]){for(d=0,c=a.length;d<c;d++)i[a[d]].state[g?"selected":"checked"]=!0;this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(a)}else for(d=0,c=a.length;d<c;d++)if(i[a[d]].state[g?"selected":"checked"]){for(l=0,h=i[a[d]].children_d.length;l<h;l++)i[i[a[d]].children_d[l]].state[g?"selected":"checked"]=!0;this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(i[a[d]].children_d)}if(-1!==u.indexOf("up")){for(d=0,c=s.children_d.length;d<c;d++)i[s.children_d[d]].children.length||n.push(i[s.children_d[d]].parent);for(l=0,h=(n=e.vakata.array_unique(n)).length;l<h;l++)for(s=i[n[l]];s&&s.id!==e.jstree.root;){for(o=0,d=0,c=s.children.length;d<c;d++)o+=i[s.children[d]].state[g?"selected":"checked"];if(o!==c)break;s.state[g?"selected":"checked"]=!0,this._data[g?"core":"checkbox"].selected.push(s.id),(_=this.get_node(s,!0))&&_.length&&_.attr("aria-selected",!0).children(".jstree-anchor").addClass(g?"jstree-clicked":"jstree-checked"),s=this.get_node(s.parent)}}this._data[g?"core":"checkbox"].selected=e.vakata.array_unique(this._data[g?"core":"checkbox"].selected)}),this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy((function(t,r){var i=this,s=r.node,a=this._model.data,n=this.get_node(s.parent),o,d,c,l,h=this.settings.checkbox.cascade,_=this.settings.checkbox.tie_selection,u={},g=this._data[_?"core":"checkbox"].selected;for(o=0,d=g.length;o<d;o++)u[g[o]]=!0;if(-1!==h.indexOf("down")){var f=this._cascade_new_checked_state(s.id,!0),p=s.children_d.concat(s.id);for(o=0,d=p.length;o<d;o++)f.indexOf(p[o])>-1?u[p[o]]=!0:delete u[p[o]]}if(-1!==h.indexOf("up"))for(;n&&n.id!==e.jstree.root;){for(c=0,o=0,d=n.children.length;o<d;o++)c+=a[n.children[o]].state[_?"selected":"checked"];if(c!==d)break;n.state[_?"selected":"checked"]=!0,u[n.id]=!0,(l=this.get_node(n,!0))&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}for(o in g=[],u)u.hasOwnProperty(o)&&g.push(o);this._data[_?"core":"checkbox"].selected=g}),this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy((function(t,r){var i=this.get_node(e.jstree.root),s=this._model.data,a,n,o;for(a=0,n=i.children_d.length;a<n;a++)(o=s[i.children_d[a]])&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1)}),this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy((function(t,r){var i=this,s=r.node,a=this.get_node(s,!0),n,o,d,c=this.settings.checkbox.cascade,l=this.settings.checkbox.tie_selection,h=this._data[l?"core":"checkbox"].selected,_=[],u=s.children_d.concat(s.id);if(-1!==c.indexOf("down")){var g=this._cascade_new_checked_state(s.id,!1);h=e.vakata.array_filter(h,(function(e){return-1===u.indexOf(e)||g.indexOf(e)>-1}))}if(-1!==c.indexOf("up")&&-1===h.indexOf(s.id)){for(n=0,o=s.parents.length;n<o;n++)(d=this._model.data[s.parents[n]]).state[l?"selected":"checked"]=!1,d&&d.original&&d.original.state&&d.original.state.undetermined&&(d.original.state.undetermined=!1),(d=this.get_node(s.parents[n],!0))&&d.length&&d.attr("aria-selected",!1).children(".jstree-anchor").removeClass(l?"jstree-clicked":"jstree-checked");h=e.vakata.array_filter(h,(function(e){return-1===s.parents.indexOf(e)}))}this._data[l?"core":"checkbox"].selected=h}),this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy((function(t,r){for(var i=this.get_node(r.parent),s=this._model.data,a,n,o,d,c=this.settings.checkbox.tie_selection;i&&i.id!==e.jstree.root&&!i.state[c?"selected":"checked"];){for(o=0,a=0,n=i.children.length;a<n;a++)o+=s[i.children[a]].state[c?"selected":"checked"];if(!(n>0&&o===n))break;i.state[c?"selected":"checked"]=!0,this._data[c?"core":"checkbox"].selected.push(i.id),(d=this.get_node(i,!0))&&d.length&&d.attr("aria-selected",!0).children(".jstree-anchor").addClass(c?"jstree-clicked":"jstree-checked"),i=this.get_node(i.parent)}}),this)).on("move_node.jstree",e.proxy((function(t,r){var i=r.is_multi,s=r.old_parent,a=this.get_node(r.parent),n=this._model.data,o,d,c,l,h,_=this.settings.checkbox.tie_selection;if(!i)for(o=this.get_node(s);o&&o.id!==e.jstree.root&&!o.state[_?"selected":"checked"];){for(d=0,c=0,l=o.children.length;c<l;c++)d+=n[o.children[c]].state[_?"selected":"checked"];if(!(l>0&&d===l))break;o.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(o.id),(h=this.get_node(o,!0))&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"),o=this.get_node(o.parent)}for(o=a;o&&o.id!==e.jstree.root;){for(d=0,c=0,l=o.children.length;c<l;c++)d+=n[o.children[c]].state[_?"selected":"checked"];if(d===l)o.state[_?"selected":"checked"]||(o.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(o.id),(h=this.get_node(o,!0))&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"));else{if(!o.state[_?"selected":"checked"])break;o.state[_?"selected":"checked"]=!1,this._data[_?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[_?"core":"checkbox"].selected,o.id),(h=this.get_node(o,!0))&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(_?"jstree-clicked":"jstree-checked")}o=this.get_node(o.parent)}}),this))},this.get_undetermined=function(r){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var i,s,a,n,o={},d=this._model.data,c=this.settings.checkbox.tie_selection,l=this._data[c?"core":"checkbox"].selected,h=[],_=this,u=[];for(i=0,s=l.length;i<s;i++)if(d[l[i]]&&d[l[i]].parents)for(a=0,n=d[l[i]].parents.length;a<n&&o[d[l[i]].parents[a]]===t;a++)d[l[i]].parents[a]!==e.jstree.root&&(o[d[l[i]].parents[a]]=!0,h.push(d[l[i]].parents[a]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each((function(){var r=_.get_node(this),c;if(r)if(r.state.loaded){for(i=0,s=r.children_d.length;i<s;i++)if(!(c=d[r.children_d[i]]).state.loaded&&c.original&&c.original.state&&c.original.state.undetermined&&!0===c.original.state.undetermined)for(o[c.id]===t&&c.id!==e.jstree.root&&(o[c.id]=!0,h.push(c.id)),a=0,n=c.parents.length;a<n;a++)o[c.parents[a]]===t&&c.parents[a]!==e.jstree.root&&(o[c.parents[a]]=!0,h.push(c.parents[a]))}else if(r.original&&r.original.state&&r.original.state.undetermined&&!0===r.original.state.undetermined)for(o[r.id]===t&&r.id!==e.jstree.root&&(o[r.id]=!0,h.push(r.id)),a=0,n=r.parents.length;a<n;a++)o[r.parents[a]]===t&&r.parents[a]!==e.jstree.root&&(o[r.parents[a]]=!0,h.push(r.parents[a]))})),i=0,s=h.length;i<s;i++)d[h[i]].state[c?"selected":"checked"]||u.push(r?d[h[i]]:h[i]);return u},this._undetermined=function(){if(null!==this.element){var e=this.get_undetermined(!1),t,r,i;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),t=0,r=e.length;t<r;t++)(i=this.get_node(e[t],!0))&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,r,s,a){if(t=i.redraw_node.apply(this,arguments)){var n,o,d=null,c=null;for(n=0,o=t.childNodes.length;n<o;n++)if(t.childNodes[n]&&t.childNodes[n].className&&-1!==t.childNodes[n].className.indexOf("jstree-anchor")){d=t.childNodes[n];break}d&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(d.className+=" jstree-checked"),c=h.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(c.className+=" jstree-checkbox-disabled"),d.insertBefore(c,d.childNodes[0]))}return s||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},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(t){t=this.get_node(t);var r=this.settings.checkbox.cascade,i,s,a=this.settings.checkbox.tie_selection,n=this._data[a?"core":"checkbox"].selected,o=this._model.data;if(!t||!0===t.state[a?"selected":"checked"]||-1===r.indexOf("undetermined")||-1===r.indexOf("down")&&-1===r.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(i=0,s=t.children_d.length;i<s;i++)if(-1!==e.inArray(t.children_d[i],n)||!o[t.children_d[i]].state.loaded&&o[t.children_d[i]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(t){var r,i,s;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.disable_checkbox(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;s=this.get_node(t,!0),t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))},this.enable_checkbox=function(t){var r,i,s;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.enable_checkbox(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;s=this.get_node(t,!0),t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))},this.activate_node=function(t,r){return!e(r.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(r.target).hasClass("jstree-checkbox"))&&(r.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(r.target).hasClass("jstree-checkbox")?i.activate_node.call(this,t,r):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,r):this.check_node(t,r),void this.trigger("activate_node",{node:this.get_node(t)})))},this._cascade_new_checked_state=function(e,t){var r=this,i=this.settings.checkbox.tie_selection,s=this._model.data[e],a=[],n=[],o,d,c;if(!this.settings.checkbox.cascade_to_disabled&&s.state.disabled||!this.settings.checkbox.cascade_to_hidden&&s.state.hidden)c=this.get_checked_descendants(e),s.state[i?"selected":"checked"]&&c.push(s.id),a=a.concat(c);else{if(s.children)for(o=0,d=s.children.length;o<d;o++){var l=s.children[o];c=this._cascade_new_checked_state(l,t),a=a.concat(c),c.indexOf(l)>-1&&n.push(l)}var h=this.get_node(s,!0),_=n.length>0&&n.length<s.children.length;s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=_),_?(s.state[i?"selected":"checked"]=!1,h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(i?"jstree-clicked":"jstree-checked")):t&&n.length===s.children.length?(s.state[i?"selected":"checked"]=t,a.push(s.id),h.attr("aria-selected",!0).children(".jstree-anchor").addClass(i?"jstree-clicked":"jstree-checked")):(s.state[i?"selected":"checked"]=!1,h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(i?"jstree-clicked":"jstree-checked"))}return a},this.get_checked_descendants=function(t){var r=this,i=r.settings.checkbox.tie_selection,s=r._model.data[t];return e.vakata.array_filter(s.children_d,(function(e){return r._model.data[e].state[i?"selected":"checked"]}))},this.check_node=function(t,r){if(this.settings.checkbox.tie_selection)return this.select_node(t,!1,!0,r);var i,s,a,n;if(e.isArray(t)){for(s=0,a=(t=t.slice()).length;s<a;s++)this.check_node(t[s],r);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;i=this.get_node(t,!0),t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),i&&i.length&&i.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:r}))},this.uncheck_node=function(t,r){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,r);var i,s,a;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.uncheck_node(t[i],r);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;a=this.get_node(t,!0),t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),a.length&&a.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:r}))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var t=this._data.checkbox.selected.concat([]),r,i;for(this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),r=0,i=this._data.checkbox.selected.length;r<i;r++)this._model.data[this._data.checkbox.selected[r]]&&(this._model.data[this._data.checkbox.selected[r]].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();var e=this._data.checkbox.selected.concat([]),t,r;for(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(t){return this.settings.checkbox.tie_selection?this.is_selected(t):!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.checked},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy((function(e){return this.get_node(e)}),this)):this._data.checkbox.selected.slice()},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);var r=this.get_checked(!0),i={},s,a,n,o;for(s=0,a=r.length;s<a;s++)i[r[s].id]=r[s];for(s=0,a=r.length;s<a;s++)for(n=0,o=r[s].children_d.length;n<o;n++)i[r[s].children_d[n]]&&delete i[r[s].children_d[n]];for(s in r=[],i)i.hasOwnProperty(s)&&r.push(s);return t?e.map(r,e.proxy((function(e){return this.get_node(e)}),this)):r},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var r=this.get_checked(!0),i=[],s,a;for(s=0,a=r.length;s<a;s++)r[s].children.length||i.push(r[s].id);return t?e.map(i,e.proxy((function(e){return this.get_node(e)}),this)):i},this.load_node=function(t,r){var s,a,n,o,d,c;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(c=this.get_node(t))&&c.state.loaded)for(s=0,a=c.children_d.length;s<a;s++)this._model.data[c.children_d[s]].state.checked&&(d=!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,c.children_d[s]));return i.load_node.apply(this,arguments)},this.get_state=function(){var e=i.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(e.checkbox=this._data.checkbox.selected.slice()),e},this.set_state=function(t,r){var s=i.set_state.apply(this,arguments);if(s&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var a=this;e.each(t.checkbox,(function(e,t){a.check_node(t)}))}return delete t.checkbox,this.set_state(t,r),!1}return s},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),i.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,r){if(this.settings.conditionalselect.call(this,this.get_node(e),r))return t.activate_node.call(this,e,r)}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,r){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.create_node(i,{},"last",(function(e){try{r.edit(e)}catch(t){setTimeout((function(){r.edit(e)}),0)}}))}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",
/*!
					"shortcut"			: 113,
					"shortcut_label"	: 'F2',
					"icon"				: "glyphicon glyphicon-leaf",
					*/
action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.edit(i)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.is_selected(i)?r.delete_node(r.get_selected()):r.delete_node(i)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.is_selected(i)?r.cut(r.get_top_selected()):r.cut(i)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.is_selected(i)?r.copy(r.get_top_selected()):r.copy(i)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var r=e.jstree.reference(t.reference),i=r.get_node(t.reference);r.paste(i)}}}}}}},e.jstree.plugins.contextmenu=function(r,i){this.bind=function(){i.bind.call(this);var t=0,r=null,s,a;this.element.on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-contextmenu")}),this)).on("contextmenu.jstree",".jstree-anchor",e.proxy((function(e,i){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),t=e.ctrlKey?+new Date:0,(i||r)&&(t=+new Date+1e4),r&&clearTimeout(r),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))}),this)).on("click.jstree",".jstree-anchor",e.proxy((function(r){this._data.contextmenu.visible&&(!t||+new Date-t>250)&&e.vakata.context.hide(),t=0}),this)).on("touchstart.jstree",".jstree-anchor",(function(t){t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(s=t.originalEvent.changedTouches[0].clientX,a=t.originalEvent.changedTouches[0].clientY,r=setTimeout((function(){e(t.currentTarget).trigger("contextmenu",!0)}),750))})).on("touchmove.vakata.jstree",(function(t){r&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(Math.abs(s-t.originalEvent.changedTouches[0].clientX)>10||Math.abs(a-t.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(r),e.vakata.context.hide())})).on("touchend.vakata.jstree",(function(e){r&&clearTimeout(r)})),
/*!
			if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {
				var el = null, tm = null;
				this.element
					.on("touchstart", ".jstree-anchor", function (e) {
						el = e.currentTarget;
						tm = +new Date();
						$(document).one("touchend", function (e) {
							e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
							e.currentTarget = e.target;
							tm = ((+(new Date())) - tm);
							if(e.target === el && tm > 600 && tm < 1000) {
								e.preventDefault();
								$(el).trigger('contextmenu', e);
							}
							el = null;
							tm = null;
						});
					});
			}
			*/
e(d).on("context_hide.vakata.jstree",e.proxy((function(t,r){this._data.contextmenu.visible=!1,e(r.reference).removeClass("jstree-context")}),this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(r,i,s,a){if(!(r=this.get_node(r))||r.id===e.jstree.root)return!1;var n=this.settings.contextmenu,o,d=this.get_node(r,!0).children(".jstree-anchor"),c=!1,l=!1;(n.show_at_node||i===t||s===t)&&(c=d.offset(),i=c.left,s=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(r)&&this.activate_node(r,a),l=n.items,e.isFunction(l)&&(l=l.call(this,r,e.proxy((function(e){this._show_contextmenu(r,i,s,e)}),this))),e.isPlainObject(l)&&this._show_contextmenu(r,i,s,l)},this._show_contextmenu=function(t,r,i,s){var a,n=this.get_node(t,!0).children(".jstree-anchor");e(d).one("context_show.vakata.jstree",e.proxy((function(t,r){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(r.element).addClass(i),n.addClass("jstree-context")}),this)),this._data.contextmenu.visible=!0,e.vakata.context.show(n,{x:r,y:i},s),this.trigger("show_contextmenu",{node:t,x:r,y:i})}},function(e){var t=!1,r={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(d).triggerHandler("context_"+t+".vakata",{reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}})},_execute:function(t){return!(!(t=r.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:r.reference,element:r.element}))||!t.action)&&t.action.call(null,{item:t,reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}})},_parse:function(t,i){if(!t)return!1;i||(r.html="",r.items=[]);var s="",a=!1,n;return i&&(s+="<ul>"),e.each(t,(function(t,i){if(!i)return!0;r.items.push(i),!a&&i.separator_before&&(s+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),a=!1,s+="<li class='"+(i._class||"")+(!0===i._disabled||e.isFunction(i._disabled)&&i._disabled({item:i,reference:r.reference,element:r.element})?" vakata-contextmenu-disabled ":"")+"' "+(i.shortcut?" data-shortcut='"+i.shortcut+"' ":"")+">",s+="<a href='#' rel='"+(r.items.length-1)+"' "+(i.title?"title='"+i.title+"'":"")+">",e.vakata.context.settings.icons&&(s+="<i ",i.icon&&(-1!==i.icon.indexOf("/")||-1!==i.icon.indexOf(".")?s+=" style='background:url(\""+i.icon+"\") center center no-repeat' ":s+=" class='"+i.icon+"' "),s+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),s+=(e.isFunction(i.label)?i.label({item:t,reference:r.reference,element:r.element}):i.label)+(i.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+i.shortcut+'">'+(i.shortcut_label||"")+"</span>":"")+"</a>",i.submenu&&(n=e.vakata.context._parse(i.submenu,!0))&&(s+=n),s+="</li>",i.separator_after&&(s+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",a=!0)})),s=s.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),i&&(s+="</ul>"),i||(r.html=s,e.vakata.context._trigger("parse")),s.length>10&&s},_show_submenu:function(r){if((r=e(r)).length&&r.children("ul").length){var i=r.children("ul"),s=r.offset().left,a=s+r.outerWidth(),n=r.offset().top,o=i.width(),d=i.height(),c=e(window).width()+e(window).scrollLeft(),l=e(window).height()+e(window).scrollTop();t?r[a-(o+10+r.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):r[a+o>c&&s>c-a?"addClass":"removeClass"]("vakata-context-right"),n+d+10>l&&i.css("bottom","-1px"),r.hasClass("vakata-context-right")?s<o&&i.css("margin-right",s-o):c-a<o&&i.css("margin-left",c-a-o),i.show()}},show:function(i,s,a){var n,o,c,l,h,_,u,g,f=!0;switch(r.element&&r.element.length&&r.element.width(""),!0){case!s&&!i:return!1;case!!s&&!!i:r.reference=i,r.position_x=s.x,r.position_y=s.y;break;case!s&&!!i:r.reference=i,n=i.offset(),r.position_x=n.left+i.outerHeight(),r.position_y=n.top;break;case!!s&&!i:r.position_x=s.x,r.position_y=s.y;break}i&&!a&&e(i).data("vakata_contextmenu")&&(a=e(i).data("vakata_contextmenu")),e.vakata.context._parse(a)&&r.element.html(r.html),r.items.length&&(r.element.appendTo(d.body),o=r.element,c=r.position_x,l=r.position_y,h=o.width(),_=o.height(),u=e(window).width()+e(window).scrollLeft(),g=e(window).height()+e(window).scrollTop(),t&&(c-=o.outerWidth()-e(i).outerWidth())<e(window).scrollLeft()+20&&(c=e(window).scrollLeft()+20),c+h+20>u&&(c=u-(h+20)),l+_+20>g&&(l=g-(_+20)),r.element.css({left:c,top:l}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),r.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){r.is_visible&&(r.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),r.is_visible=!1,e.vakata.context._trigger("hide"))}},e((function(){t="rtl"===e(d.body).css("direction");var i=!1;r.element=e("<ul class='vakata-context'></ul>"),r.element.on("mouseenter","li",(function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(i&&clearTimeout(i),r.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))})).on("mouseleave","li",(function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")})).on("mouseleave",(function(t){var r;e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(i=setTimeout((r=this,function(){e.vakata.context.hide()}),e.vakata.context.settings.hide_onmouseleave))})).on("click","a",(function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()})).on("keydown","a",(function(t){var i=null;switch(t.which){case 13:case 32:t.type="click",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:r.is_visible&&(r.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(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:r.is_visible&&((i=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(i=r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:r.is_visible&&(r.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:r.is_visible&&((i=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(i=r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault();break;default:break}})).on("keydown",(function(e){e.preventDefault();var t=r.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()})),e(d).on("mousedown.vakata.jstree",(function(t){r.is_visible&&r.element[0]!==t.target&&!e.contains(r.element[0],t.target)&&e.vakata.context.hide()})).on("context_show.vakata.jstree",(function(e,i){r.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&r.element.addClass("vakata-context-rtl").css("direction","rtl"),r.element.find("ul").hide().end()}))}))}(e),e.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},e.jstree.plugins.dnd=function(t,r){this.init=function(e,t){r.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in d.createElement("span")},this.bind=function(){r.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",e.proxy((function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0;if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var r=this.get_node(t.target),i=this.is_selected(r)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,s=i>1?i+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(s=e.vakata.html.escape(s)),r&&r.id&&r.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i>1?this.get_top_selected(!0):[r],t))){if(_={jstree:!0,origin:this,obj:this.get_node(r,!0),nodes:i>1?this.get_top_selected():[r.id]},u=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,_,'<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>'+s+'<ins class="jstree-copy" style="display:none;">+</ins></div>');e.vakata.dnd._trigger("start",t,{helper:e(),element:u,data:_})}}),this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",(function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:_}),!1})).on("drop.jstree",e.proxy((function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:_}),!1}),this))},this.redraw_node=function(e,t,i,s){if((e=r.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{var a,n,o=null;for(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")){o=e.childNodes[a];break}o&&o.setAttribute("draggable",!0)}return e}},e((function(){var r=!1,i=!1,s=!1,a=!1,n=e('<div id="jstree-marker">&#160;</div>').hide();e(d).on("dragover.vakata.jstree",(function(t){u&&e.vakata.dnd._trigger("move",t,{helper:e(),element:u,data:_})})).on("drop.vakata.jstree",(function(t){u&&(e.vakata.dnd._trigger("stop",t,{helper:e(),element:u,data:_}),u=null,_=null)})).on("dnd_start.vakata.jstree",(function(e,t){r=!1,s=!1,t&&t.data&&t.data.jstree&&n.appendTo(d.body)})).on("dnd_move.vakata.jstree",(function(o,d){var c=d.event.target!==s.target;if(a&&(d.event&&"dragover"===d.event.type&&!c||clearTimeout(a)),d&&d.data&&d.data.jstree&&(!d.event.target.id||"jstree-marker"!==d.event.target.id)){s=d.event;var l=e.jstree.reference(d.event.target),h=!1,_=!1,u=!1,g,f,p,m,v,j,y,k,x,b,w,C,A,T,N,O,S,E;if(l&&l._data&&l._data.dnd)if(n.attr("class","jstree-"+l.get_theme()+(l.settings.core.themes.responsive?" jstree-dnd-responsive":"")),O=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey)),d.helper.children().attr("class","jstree-"+l.get_theme()+" jstree-"+l.get_theme()+"-"+l.get_theme_variant()+" "+(l.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[O?"show":"hide"](),d.event.target!==l.element[0]&&d.event.target!==l.get_container_ul()[0]||0!==l.get_container_ul().children().length){if((h=l.settings.dnd.large_drop_target?e(d.event.target).closest(".jstree-node").children(".jstree-anchor"):e(d.event.target).closest(".jstree-anchor"))&&h.length&&h.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(_=h.offset(),u=(d.event.pageY!==t?d.event.pageY:d.event.originalEvent.pageY)-_.top,m=h.outerHeight(),y=u<m/3?["b","i","a"]:u>m-m/3?["a","i","b"]:u>m/2?["i","a","b"]:["i","b","a"],e.each(y,(function(t,s){switch(s){case"b":f=_.left-6,p=_.top,v=l.get_parent(h),j=h.parent().index(),E="jstree-below";break;case"i":T=l.settings.dnd.inside_pos,N=l.get_node(h.parent()),f=_.left-2,p=_.top+m/2+1,v=N.id,j="first"===T?0:"last"===T?N.children.length:Math.min(T,N.children.length),E="jstree-inside";break;case"a":f=_.left-6,p=_.top+m,v=l.get_parent(h),j=h.parent().index()+1,E="jstree-above";break}for(k=!0,x=0,b=d.data.nodes.length;x<b;x++)if(w=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",C=j,"move_node"===w&&"a"===s&&d.data.origin&&d.data.origin===l&&v===l.get_parent(d.data.nodes[x])&&(A=l.get_node(v),C>e.inArray(d.data.nodes[x],A.children)&&(C-=1)),!(k=k&&(l&&l.settings&&l.settings.dnd&&!1===l.settings.dnd.check_while_dragging||l.check(w,d.data.origin&&d.data.origin!==l?d.data.origin.get_node(d.data.nodes[x]):d.data.nodes[x],v,C,{dnd:!0,ref:l.get_node(h.parent()),pos:s,origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==l,is_foreign:!d.data.origin})))){l&&l.last_error&&(i=l.last_error());break}var o,u;if("i"===s&&h.parent().is(".jstree-closed")&&l.settings.dnd.open_timeout&&(d.event&&"dragover"===d.event.type&&!c||(a&&clearTimeout(a),a=setTimeout((o=l,u=h,function(){o.open_node(u)}),l.settings.dnd.open_timeout))),k)return(S=l.get_node(v,!0)).hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),S.addClass("jstree-dnd-parent")),r={ins:l,par:v,pos:"i"!==s||"last"!==T||0!==j||l.is_loaded(N)?j:"last"},n.css({left:f+"px",top:p+"px"}).show(),n.removeClass("jstree-above jstree-inside jstree-below").addClass(E),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=O?"copy":"move"),i={},y=!0,!1})),!0===y))return}else{for(k=!0,x=0,b=d.data.nodes.length;x<b&&(k=k&&l.check(d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",d.data.origin&&d.data.origin!==l?d.data.origin.get_node(d.data.nodes[x]):d.data.nodes[x],e.jstree.root,"last",{dnd:!0,ref:l.get_node(e.jstree.root),pos:"i",origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==l,is_foreign:!d.data.origin}));x++);if(k)return r={ins:l,par:e.jstree.root,pos:"last"},n.hide(),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=O?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),r=!1,d.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),d.event.originalEvent&&d.event.originalEvent.dataTransfer,n.hide()}})).on("dnd_scroll.vakata.jstree",(function(e,t){t&&t.data&&t.data.jstree&&(n.hide(),r=!1,s=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))})).on("dnd_stop.vakata.jstree",(function(t,o){if(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),a&&clearTimeout(a),o&&o.data&&o.data.jstree){n.hide().detach();var d,c,l=[];if(r){for(d=0,c=o.data.nodes.length;d<c;d++)l[d]=o.data.origin?o.data.origin.get_node(o.data.nodes[d]):o.data.nodes[d];r.ins[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node"](l,r.par,r.pos,!1,!1,!1,o.data.origin)}else(d=e(o.event.target).closest(".jstree")).length&&i&&i.error&&"check"===i.error&&(d=d.jstree(!0))&&d.settings.core.error.call(this,i);s=!1,r=!1}})).on("keyup.jstree keydown.jstree",(function(t,o){(o=e.vakata.dnd._get())&&o.data&&o.data.jstree&&("keyup"===t.type&&27===t.which?(a&&clearTimeout(a),r=!1,i=!1,s=!1,a=!1,n.hide().detach(),e.vakata.dnd._clean()):(o.helper.find(".jstree-copy").first()[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),s&&(s.metaKey=t.metaKey,s.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",s))))}))})),function(e){e.vakata.html={div:e("<div />"),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}};var r={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};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(r,i,s){s===t&&(s=e.vakata.dnd._get()),s.event=i,e(d).triggerHandler("dnd_"+r+".vakata",s)},_get:function(){return{data:r.data,element:r.element,helper:r.helper}},_clean:function(){r.helper&&r.helper.remove(),r.scroll_i&&(clearInterval(r.scroll_i),r.scroll_i=!1),r={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=null,e(d).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(d).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!r.scroll_e||!r.scroll_l&&!r.scroll_t)return r.scroll_i&&(clearInterval(r.scroll_i),r.scroll_i=!1),!1;if(!r.scroll_i)return r.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(!0===t)return!1;var i=r.scroll_e.scrollTop(),s=r.scroll_e.scrollLeft();r.scroll_e.scrollTop(i+r.scroll_t*e.vakata.dnd.settings.scroll_speed),r.scroll_e.scrollLeft(s+r.scroll_l*e.vakata.dnd.settings.scroll_speed),i===r.scroll_e.scrollTop()&&s===r.scroll_e.scrollLeft()||e.vakata.dnd._trigger("scroll",r.scroll_e)},start:function(t,i,s){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(e){}return r.init_x=t.pageX,r.init_y=t.pageY,r.data=i,r.is_down=!0,r.element=t.currentTarget,r.target=t.target,r.is_touch="touchstart"===t.type,!1!==s&&(r.helper=e("<div id='vakata-dnd'></div>").html(s).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(d).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(d).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_down){if(!r.is_drag){if(!(Math.abs(t.pageX-r.init_x)>(r.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-r.init_y)>(r.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;r.helper&&(r.helper.appendTo(d.body),r.helper_w=r.helper.outerWidth()),r.is_drag=!0,e(r.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var i=!1,s=!1,a=!1,n=!1,o=!1,c=!1,l=!1,h=!1,_=!1,u=!1;return r.scroll_t=0,r.scroll_l=0,r.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter((function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)})).each((function(){var i=e(this),s=i.offset();if(this.scrollHeight>this.offsetHeight&&(s.top+i.height()-t.pageY<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=1),t.pageY-s.top<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(s.left+i.width()-t.pageX<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=1),t.pageX-s.left<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=-1)),r.scroll_t||r.scroll_l)return r.scroll_e=e(this),!1})),r.scroll_e||(i=e(d),s=e(window),a=i.height(),n=s.height(),o=i.width(),c=s.width(),l=i.scrollTop(),h=i.scrollLeft(),a>n&&t.pageY-l<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=-1),a>n&&n-(t.pageY-l)<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_t=1),o>c&&t.pageX-h<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=-1),o>c&&c-(t.pageX-h)<e.vakata.dnd.settings.scroll_proximity&&(r.scroll_l=1),(r.scroll_t||r.scroll_l)&&(r.scroll_e=i)),r.scroll_e&&e.vakata.dnd._scroll(!0),r.helper&&(_=parseInt(t.pageY+e.vakata.dnd.settings.helper_top,10),u=parseInt(t.pageX+e.vakata.dnd.settings.helper_left,10),a&&_+25>a&&(_=a-50),o&&u+r.helper_w>o&&(u=o-(r.helper_w+2)),r.helper.css({left:u+"px",top:_+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=d.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),r.is_drag)t.target!==r.target&&e(r.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===r.target){var i=setTimeout((function(){e(t.target).click()}),100);e(t.target).one("click",(function(){i&&clearTimeout(i)}))}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,r){this.init=function(e,t){this._data.massload={},r.init.call(this,e,t)},this._load_nodes=function(t,i,s,a){var n=this.settings.massload,o=[],d=this._model.data,c,l,h;if(!s){for(c=0,l=t.length;c<l;c++)d[t[c]]&&(d[t[c]].state.loaded||d[t[c]].state.failed)&&!a||(o.push(t[c]),(h=this.get_node(t[c],!0))&&h.length&&h.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},o.length){if(e.isFunction(n))return n.call(this,o,e.proxy((function(e){var n,o;if(e)for(n in e)e.hasOwnProperty(n)&&(this._data.massload[n]=e[n]);for(n=0,o=t.length;n<o;n++)(h=this.get_node(t[n],!0))&&h.length&&h.removeClass("jstree-loading").attr("aria-busy",!1);r._load_nodes.call(this,t,i,s,a)}),this));if("object"==typeof n&&n&&n.url)return n=e.extend(!0,{},n),e.isFunction(n.url)&&(n.url=n.url.call(this,o)),e.isFunction(n.data)&&(n.data=n.data.call(this,o)),e.ajax(n).done(e.proxy((function(e,n,o){var d,c;if(e)for(d in e)e.hasOwnProperty(d)&&(this._data.massload[d]=e[d]);for(d=0,c=t.length;d<c;d++)(h=this.get_node(t[d],!0))&&h.length&&h.removeClass("jstree-loading").attr("aria-busy",!1);r._load_nodes.call(this,t,i,s,a)}),this)).fail(e.proxy((function(e){r._load_nodes.call(this,t,i,s,a)}),this))}}return r._load_nodes.call(this,t,i,s,a)},this._load_node=function(t,i){var s=this._data.massload[t.id],a=null,n;return s?(a=this["string"==typeof s?"_append_html_data":"_append_json_data"](t,"string"==typeof s?e(e.parseHTML(s)).filter((function(){return 3!==this.nodeType})):s,(function(e){i.call(this,e)})),(n=this.get_node(t.id,!0))&&n.length&&n.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],a):r._load_node.call(this,t,i)}},e.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},e.jstree.plugins.search=function(r,i){this.bind=function(){i.bind.call(this),this._data.search.str="",this._data.search.dom=e(),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",e.proxy((function(t,r){if(this._data.search.som&&r.res.length){var i=this._model.data,s,a,n=[],o,d;for(s=0,a=r.res.length;s<a;s++)if(i[r.res[s]]&&!i[r.res[s]].state.hidden&&(n.push(r.res[s]),n=n.concat(i[r.res[s]].parents),this._data.search.smc))for(o=0,d=i[r.res[s]].children_d.length;o<d;o++)i[i[r.res[s]].children_d[o]]&&!i[i[r.res[s]].children_d[o]].state.hidden&&n.push(i[r.res[s]].children_d[o]);n=e.vakata.array_remove_item(e.vakata.array_unique(n),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(n,!0),this.redraw(!0)}}),this)).on("clear_search.jstree",e.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(r,i,s,a,n,o){if(!1===r||""===e.trim(r.toString()))return this.clear_search();a=(a=this.get_node(a))&&a.id?a.id:null,r=r.toString();var d=this.settings.search,c=!!d.ajax&&d.ajax,l=this._model.data,h=null,_=[],u=[],g,f;if(this._data.search.res.length&&!n&&this.clear_search(),s===t&&(s=d.show_only_matches),o===t&&(o=d.show_only_matches_children),!i&&!1!==c)return e.isFunction(c)?c.call(this,r,e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(r,!0,s,a,n,o)}))}),this),a):((c=e.extend({},c)).data||(c.data={}),c.data.str=r,a&&(c.data.inside=a),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=e.ajax(c).fail(e.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(e.proxy((function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],(function(){this.search(r,!0,s,a,n,o)}))}),this)),this._data.search.lastRequest);if(n||(this._data.search.str=r,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=s,this._data.search.smc=o),h=new e.vakata.search(r,!0,{caseSensitive:d.case_sensitive,fuzzy:d.fuzzy}),e.each(l[a||e.jstree.root].children_d,(function(e,t){var i=l[t];i.text&&!i.state.hidden&&(!d.search_leaves_only||i.state.loaded&&0===i.children.length)&&(d.search_callback&&d.search_callback.call(this,r,i)||!d.search_callback&&h.search(i.text).isMatch)&&(_.push(t),u=u.concat(i.parents))})),_.length){for(g=0,f=(u=e.vakata.array_unique(u)).length;g<f;g++)u[g]!==e.jstree.root&&l[u[g]]&&!0===this.open_node(u[g],null,0)&&this._data.search.opn.push(u[g]);n?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(_,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")})).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(_))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(_,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.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:r,res:this._data.search.res,show_only_matches:s})},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=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,(function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.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=e()},this.redraw_node=function(t,r,s,a){if((t=i.redraw_node.apply(this,arguments))&&-1!==e.inArray(t.id,this._data.search.res)){var n,o,d=null;for(n=0,o=t.childNodes.length;n<o;n++)if(t.childNodes[n]&&t.childNodes[n].className&&-1!==t.childNodes[n].className.indexOf("jstree-anchor")){d=t.childNodes[n];break}d&&(d.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,r,i){i=i||{},!1!==(i=e.extend({},e.vakata.search.defaults,i)).fuzzy&&(i.fuzzy=!0),t=i.caseSensitive?t:t.toLowerCase();var s=i.location,a=i.distance,n=i.threshold,o=t.length,d,c,l,h;return o>32&&(i.fuzzy=!1),i.fuzzy&&(d=1<<o-1,c=function(){var e={},r=0;for(r=0;r<o;r++)e[t.charAt(r)]=0;for(r=0;r<o;r++)e[t.charAt(r)]|=1<<o-r-1;return e}(),l=function(e,t){var r=e/o,i=Math.abs(s-t);return a?r+i/a:i?1:r}),h=function(e){if(e=i.caseSensitive?e:e.toLowerCase(),t===e||-1!==e.indexOf(t))return{isMatch:!0,score:0};if(!i.fuzzy)return{isMatch:!1,score:1};var r,a,h=e.length,_=n,u=e.indexOf(t,s),g,f,p=o+h,m,v,j,y,k,x=1,b=[];for(-1!==u&&(_=Math.min(l(0,u),_),-1!==(u=e.lastIndexOf(t,s+o))&&(_=Math.min(l(0,u),_))),u=-1,r=0;r<o;r++){for(g=0,f=p;g<f;)l(r,s+f)<=_?g=f:p=f,f=Math.floor((p-g)/2+g);for(p=f,v=Math.max(1,s-f+1),j=Math.min(s+f,h)+o,(y=new Array(j+2))[j+1]=(1<<r)-1,a=j;a>=v;a--)if(k=c[e.charAt(a-1)],y[a]=0===r?(y[a+1]<<1|1)&k:(y[a+1]<<1|1)&k|(m[a+1]|m[a])<<1|1|m[a+1],y[a]&d&&(x=l(r,a-1))<=_){if(_=x,u=a-1,b.push(u),!(u>s))break;v=Math.max(1,2*s-u)}if(l(r+1,s)>_)break;m=y}return{isMatch:u>=0,score:x}},!0===r?{search:h}:h(r)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,r){this.bind=function(){r.bind.call(this),this.element.on("model.jstree",e.proxy((function(e,t){this.sort(t.parent,!0)}),this)).on("rename_node.jstree create_node.jstree",e.proxy((function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)}),this)).on("move_node.jstree copy_node.jstree",e.proxy((function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)}),this))},this.sort=function(t,r){var i,s;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),r))for(i=0,s=t.children_d.length;i<s;i++)this.sort(t.children_d[i],!1)}};var g=!1;e.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},e.jstree.plugins.state=function(t,r){this.bind=function(){r.bind.call(this);var t=e.proxy((function(){this.element.on(this.settings.state.events,e.proxy((function(){g&&clearTimeout(g),g=setTimeout(e.proxy((function(){this.save_state()}),this),100)}),this)),this.trigger("state_ready")}),this);this.element.on("ready.jstree",e.proxy((function(e,r){this.element.one("restore_state.jstree",t),this.restore_state()||t()}),this))},this.save_state=function(){var t=this.get_state();this.settings.state.preserve_loaded||delete t.core.loaded;var r={state:t,ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,JSON.stringify(r))},this.restore_state=function(){
var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.settings.state.preserve_loaded||delete t.core.loaded,this.element.one("set_state.jstree",(function(r,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})})),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={default:{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(r,i){this.init=function(r,s){var a,n;if(s&&s.types&&s.types.default)for(a in s.types)if("default"!==a&&a!==e.jstree.root&&s.types.hasOwnProperty(a))for(n in s.types.default)s.types.default.hasOwnProperty(n)&&s.types[a][n]===t&&(s.types[a][n]=s.types.default[n]);i.init.call(this,r,s),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,r){i.refresh.call(this,t,r),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy((function(r,i){var s=this._model.data,a=i.nodes,n=this.settings.types,o,d,c="default",l;for(o=0,d=a.length;o<d;o++){if(c="default",s[a[o]].original&&s[a[o]].original.type&&n[s[a[o]].original.type]&&(c=s[a[o]].original.type),s[a[o]].data&&s[a[o]].data.jstree&&s[a[o]].data.jstree.type&&n[s[a[o]].data.jstree.type]&&(c=s[a[o]].data.jstree.type),s[a[o]].type=c,!0===s[a[o]].icon&&n[c].icon!==t&&(s[a[o]].icon=n[c].icon),n[c].li_attr!==t&&"object"==typeof n[c].li_attr)for(l in n[c].li_attr)if(n[c].li_attr.hasOwnProperty(l)){if("id"===l)continue;s[a[o]].li_attr[l]===t?s[a[o]].li_attr[l]=n[c].li_attr[l]:"class"===l&&(s[a[o]].li_attr.class=n[c].li_attr.class+" "+s[a[o]].li_attr.class)}if(n[c].a_attr!==t&&"object"==typeof n[c].a_attr)for(l in n[c].a_attr)if(n[c].a_attr.hasOwnProperty(l)){if("id"===l)continue;s[a[o]].a_attr[l]===t?s[a[o]].a_attr[l]=n[c].a_attr[l]:"href"===l&&"#"===s[a[o]].a_attr[l]?s[a[o]].a_attr.href=n[c].a_attr.href:"class"===l&&(s[a[o]].a_attr.class=n[c].a_attr.class+" "+s[a[o]].a_attr.class)}}s[e.jstree.root].type=e.jstree.root}),this)),i.bind.call(this)},this.get_json=function(t,r,s){var a,n,o=this._model.data,d=r?e.extend(!0,{},r,{no_id:!1}):{},c=i.get_json.call(this,t,d,s);if(!1===c)return!1;if(e.isArray(c))for(a=0,n=c.length;a<n;a++)c[a].type=c[a].id&&o[c[a].id]&&o[c[a].id].type?o[c[a].id].type:"default",r&&r.no_id&&(delete c[a].id,c[a].li_attr&&c[a].li_attr.id&&delete c[a].li_attr.id,c[a].a_attr&&c[a].a_attr.id&&delete c[a].a_attr.id);else c.type=c.id&&o[c.id]&&o[c.id].type?o[c.id].type:"default",r&&r.no_id&&(c=this._delete_ids(c));return c},this._delete_ids=function(t){if(e.isArray(t)){for(var r=0,i=t.length;r<i;r++)t[r]=this._delete_ids(t[r]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(r,s,a,n,o){if(!1===i.check.call(this,r,s,a,n,o))return!1;s=s&&s.id?s:this.get_node(s),a=a&&a.id?a:this.get_node(a);var d=s&&s.id?o&&o.origin?o.origin:e.jstree.reference(s.id):null,c,l,h,_;switch(d=d&&d._model&&d._model.data?d._model.data:null,r){case"create_node":case"move_node":case"copy_node":if("move_node"!==r||-1===e.inArray(s.id,a.children)){if((c=this.get_rules(a)).max_children!==t&&-1!==c.max_children&&c.max_children===a.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:!(!s||!s.id)&&s.id,par:!(!a||!a.id)&&a.id})},!1;if(c.valid_children!==t&&-1!==c.valid_children&&-1===e.inArray(s.type||"default",c.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:!(!s||!s.id)&&s.id,par:!(!a||!a.id)&&a.id})},!1;if(d&&s.children_d&&s.parents){for(l=0,h=0,_=s.children_d.length;h<_;h++)l=Math.max(l,d[s.children_d[h]].parents.length);l=l-s.parents.length+1}(l<=0||l===t)&&(l=1);do{if(c.max_depth!==t&&-1!==c.max_depth&&c.max_depth<l)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+r,data:JSON.stringify({chk:r,pos:n,obj:!(!s||!s.id)&&s.id,par:!(!a||!a.id)&&a.id})},!1;a=this.get_node(a.parent),c=this.get_rules(a),l++}while(a)}break}return!0},this.get_rules=function(e){if(!(e=this.get_node(e)))return!1;var r=this.get_type(e,!0);return r.max_depth===t&&(r.max_depth=-1),r.max_children===t&&(r.max_children=-1),r.valid_children===t&&(r.valid_children=-1),r},this.get_type=function(t,r){return!!(t=this.get_node(t))&&(r?e.extend({type:t.type},this.settings.types[t.type]):t.type)},this.set_type=function(r,i){var s=this._model.data,a,n,o,d,c,l,h,_;if(e.isArray(r)){for(n=0,o=(r=r.slice()).length;n<o;n++)this.set_type(r[n],i);return!0}if(a=this.settings.types,r=this.get_node(r),!a[i]||!r)return!1;if((h=this.get_node(r,!0))&&h.length&&(_=h.children(".jstree-anchor")),d=r.type,c=this.get_icon(r),r.type=i,(!0===c||!a[d]||a[d].icon!==t&&c===a[d].icon)&&this.set_icon(r,a[i].icon===t||a[i].icon),a[d]&&a[d].li_attr!==t&&"object"==typeof a[d].li_attr)for(l in a[d].li_attr)if(a[d].li_attr.hasOwnProperty(l)){if("id"===l)continue;"class"===l?(s[r.id].li_attr.class=(s[r.id].li_attr.class||"").replace(a[d].li_attr[l],""),h&&h.removeClass(a[d].li_attr[l])):s[r.id].li_attr[l]===a[d].li_attr[l]&&(s[r.id].li_attr[l]=null,h&&h.removeAttr(l))}if(a[d]&&a[d].a_attr!==t&&"object"==typeof a[d].a_attr)for(l in a[d].a_attr)if(a[d].a_attr.hasOwnProperty(l)){if("id"===l)continue;"class"===l?(s[r.id].a_attr.class=(s[r.id].a_attr.class||"").replace(a[d].a_attr[l],""),_&&_.removeClass(a[d].a_attr[l])):s[r.id].a_attr[l]===a[d].a_attr[l]&&("href"===l?(s[r.id].a_attr[l]="#",_&&_.attr("href","#")):(delete s[r.id].a_attr[l],_&&_.removeAttr(l)))}if(a[i].li_attr!==t&&"object"==typeof a[i].li_attr)for(l in a[i].li_attr)if(a[i].li_attr.hasOwnProperty(l)){if("id"===l)continue;s[r.id].li_attr[l]===t?(s[r.id].li_attr[l]=a[i].li_attr[l],h&&("class"===l?h.addClass(a[i].li_attr[l]):h.attr(l,a[i].li_attr[l]))):"class"===l&&(s[r.id].li_attr.class=a[i].li_attr[l]+" "+s[r.id].li_attr.class,h&&h.addClass(a[i].li_attr[l]))}if(a[i].a_attr!==t&&"object"==typeof a[i].a_attr)for(l in a[i].a_attr)if(a[i].a_attr.hasOwnProperty(l)){if("id"===l)continue;s[r.id].a_attr[l]===t?(s[r.id].a_attr[l]=a[i].a_attr[l],_&&("class"===l?_.addClass(a[i].a_attr[l]):_.attr(l,a[i].a_attr[l]))):"href"===l&&"#"===s[r.id].a_attr[l]?(s[r.id].a_attr.href=a[i].a_attr.href,_&&_.attr("href",a[i].a_attr.href)):"class"===l&&(s[r.id].a_attr.class=a[i].a_attr.class+" "+s[r.id].a_attr.class,_&&_.addClass(a[i].a_attr[l]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(r,i){this.check=function(t,r,s,a,n){if(!1===i.check.call(this,t,r,s,a,n))return!1;if(r=r&&r.id?r:this.get_node(r),!(s=s&&s.id?s:this.get_node(s))||!s.children)return!0;var o="rename_node"===t?a:r.text,d=[],c=this.settings.unique.case_sensitive,l=this.settings.unique.trim_whitespace,h=this._model.data,_,u,g;for(_=0,u=s.children.length;_<u;_++)g=h[s.children[_]].text,c||(g=g.toLowerCase()),l&&(g=g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),d.push(g);switch(c||(o=o.toLowerCase()),l&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),t){case"delete_node":return!0;case"rename_node":return g=r.text||"",c||(g=g.toLowerCase()),l&&(g=g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(_=-1===e.inArray(o,d)||r.text&&g===o)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})}),_;case"create_node":return(_=-1===e.inArray(o,d))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})}),_;case"copy_node":return(_=-1===e.inArray(o,d))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})}),_;case"move_node":return(_=r.parent===s.id&&(!n||!n.is_multi)||-1===e.inArray(o,d))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:a,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})}),_}return!0},this.create_node=function(r,s,a,n,o){if(!s||s.text===t){if(null===r&&(r=e.jstree.root),!(r=this.get_node(r)))return i.create_node.call(this,r,s,a,n,o);if(!(a=a===t?"last":a).toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(r))return i.create_node.call(this,r,s,a,n,o);s||(s={});var d,c,l,h,_,u=this._model.data,g=this.settings.unique.case_sensitive,f=this.settings.unique.trim_whitespace,p=this.settings.unique.duplicate,m;for(c=d=this.get_string("New node"),l=[],h=0,_=r.children.length;h<_;h++)m=u[r.children[h]].text,g||(m=m.toLowerCase()),f&&(m=m.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),l.push(m);for(h=1,m=c,g||(m=m.toLowerCase()),f&&(m=m.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==e.inArray(m,l);)m=c=p.call(this,d,++h).toString(),g||(m=m.toLowerCase()),f&&(m=m.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));s.text=c}return i.create_node.call(this,r,s,a,n,o)}};var f=d.createElement("DIV");if(f.setAttribute("unselectable","on"),f.setAttribute("role","presentation"),f.className="jstree-wholerow",f.innerHTML="&#160;",e.jstree.plugins.wholerow=function(t,r){this.bind=function(){r.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy((function(){this.hide_dots()}),this)).on("init.jstree loading.jstree ready.jstree",e.proxy((function(){this.get_container_ul().addClass("jstree-wholerow-ul")}),this)).on("deselect_all.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")}),this)).on("changed.jstree",e.proxy((function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var r=!1,i,s;for(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",e.proxy((function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}),this)).on("hover_node.jstree dehover_node.jstree",e.proxy((function(e,t){"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",e.proxy((function(t){if(this._data.contextmenu){t.preventDefault();var r=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r)}}),this))
/*!
				.on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) {
						if(e.target === e.currentTarget) {
							var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor");
							e.target = a[0];
							a.trigger(e);
						}
					})
				*/.on("click.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var r=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()})).on("dblclick.jstree",".jstree-wholerow",(function(t){t.stopImmediatePropagation();var r=e.Event("dblclick",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()})).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy((function(t){t.stopImmediatePropagation();var r=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus()}),this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy((function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1}),this)).on("mouseleave.jstree",".jstree-node",e.proxy((function(e){this.dehover_node(e.currentTarget)}),this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),r.teardown.call(this)},this.redraw_node=function(t,i,s,a){if(t=r.redraw_node.apply(this,arguments)){var n=f.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(n.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(n.className+=" jstree-wholerow-hovered"),t.insertBefore(n,t.childNodes[0])}return t}},window.customElements&&Object&&Object.create){var p=Object.create(HTMLElement.prototype);p.createdCallback=function(){var t={core:{},plugins:[]},r;for(r in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(r)&&this.attributes[r]&&(t.plugins.push(r),this.getAttribute(r)&&JSON.parse(this.getAttribute(r))&&(t[r]=JSON.parse(this.getAttribute(r))));for(r in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(r)&&this.attributes[r]&&(t.core[r]=JSON.parse(this.getAttribute(r))||this.getAttribute(r));e(this).jstree(t)};try{window.customElements.define("vakata-jstree",(function(){}),{prototype:p})}catch(e){}}}}));