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