text: /*
   2013-2021 (c) Sahana Software Foundation
   @license MIT
  
   requires jQuery 1.9.1+
   requires jQuery UI 1.10 widget factory
   requires jQuery jstree 3.0.3
  
   2015-2021 (c) Sahana Software Foundation
   @license MIT
  
   requires jQuery 1.9.1+
   requires jQuery UI 1.10 widget factory
   requires jQuery jstree 3.0.3
   jsTree 3.3.8
   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
   'themes' : {
        'name' : this.get_theme(),
        'icons' : this._data.core.themes.icons,
        'dots' : this._data.core.themes.dots
       },
   oi = obj.children("i:visible"),
     ai = a.children("i:visible"),
     w1 = oi.width() * oi.length,
     w2 = ai.width() * ai.length,
   "shortcut"			: 113,
       "shortcut_label"	: 'F2',
       "icon"				: "glyphicon glyphicon-leaf",
   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;
        });
       });
     }
   .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);
        }
       })
  */
  (function(f){"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function(f,E){if(!f.jstree){var W=0,t=!1,v=!1,y=!1,C=[],D=f("script:last").attr("src"),z=window.document;f.jstree={version:"3.3.8",defaults:{plugins:[]},plugins:{},path:D&&-1!==D.indexOf("/")?D.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"};f.jstree.create=function(a,d){var b=new f.jstree.core(++W),
  c=d;d=f.extend(!0,{},f.jstree.defaults,d);c&&c.plugins&&(d.plugins=c.plugins);f.each(d.plugins,function(e,h){"core"!==e&&(b=b.plugin(h,d[h]))});f(a).data("jstree",b);b.init(a,d);return b};f.jstree.destroy=function(){f(".jstree:jstree").jstree("destroy");f(z).off(".jstree")};f.jstree.core=function(a){this._id=a;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}}};f.jstree.reference=function(a){var d=
  null,b=null;!a||!a.id||a.tagName&&a.nodeType||(a=a.id);if(!b||!b.length)try{b=f(a)}catch(c){}if(!b||!b.length)try{b=f("#"+a.replace(f.jstree.idregex,"\\$&"))}catch(c){}b&&b.length&&(b=b.closest(".jstree")).length&&(b=b.data("jstree"))?d=b:f(".jstree").each(function(){var c=f(this).data("jstree");if(c&&c._model.data[a])return d=c,!1});return d};f.fn.jstree=function(a){var d="string"===typeof a,b=Array.prototype.slice.call(arguments,1),c=null;if(!0===a&&!this.length)return!1;this.each(function(){var e=
  f.jstree.reference(this),h=d&&e?e[a]:null;c=d&&h?h.apply(e,b):null;e||d||a!==E&&!f.isPlainObject(a)||f.jstree.create(this,a);if(e&&!d||!0===a)c=e||!1;if(null!==c&&c!==E)return!1});return null!==c&&c!==E?c:this};f.expr.pseudos.jstree=f.expr.createPseudo(function(a){return function(d){return f(d).hasClass("jstree")&&f(d).data("jstree")!==E}});f.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:f.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,
  stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(a){a.type="click";f(a.currentTarget).trigger(a)},enter:function(a){a.type="click";f(a.currentTarget).trigger(a)},left:function(a){a.preventDefault();this.is_open(a.currentTarget)?this.close_node(a.currentTarget):(a=this.get_parent(a.currentTarget))&&a.id!==f.jstree.root&&this.get_node(a,!0).children(".jstree-anchor").focus()},up:function(a){a.preventDefault();
  (a=this.get_prev_dom(a.currentTarget))&&a.length&&a.children(".jstree-anchor").focus()},right:function(a){a.preventDefault();this.is_closed(a.currentTarget)?this.open_node(a.currentTarget,function(d){this.get_node(d,!0).children(".jstree-anchor").focus()}):this.is_open(a.currentTarget)&&(a=this.get_node(a.currentTarget,!0).children(".jstree-children")[0])&&f(this._firstChild(a)).children(".jstree-anchor").focus()},down:function(a){a.preventDefault();(a=this.get_next_dom(a.currentTarget))&&a.length&&
  a.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(a){a.preventDefault();(a=this._firstChild(this.get_container_ul()[0]))&&f(a).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault();this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault();this.edit(a.currentTarget)}}};f.jstree.core.prototype={plugin:function(a,d){var b=f.jstree.plugins[a];return b?(this._data[a]={},b.prototype=this,
  new b(d,this)):this},init:function(a,d){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}};this._model.data[f.jstree.root]={id:f.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}};this.element=f(a).addClass("jstree jstree-"+this._id);this.settings=d;this._data.core.ready=!1;this._data.core.loaded=!1;this._data.core.rtl="rtl"===this.element.css("direction");this.element[this._data.core.rtl?
  "addClass":"removeClass"]("jstree-rtl");this.element.attr("role","tree");this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0);this.element.attr("tabindex")||this.element.attr("tabindex","0");this.bind();this.trigger("init");this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0);this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove();
  this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>");this.element.attr("aria-activedescendant","j"+this._id+"_loading");this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||
  24;this._data.core.node=this._create_prototype_node();this.trigger("loading");this.load_node(f.jstree.root)},destroy:function(a){this.trigger("destroy");if(this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(d){}a||this.element.empty();this.teardown()},_create_prototype_node:function(){var a=z.createElement("LI");a.setAttribute("role","treeitem");var d=z.createElement("I");d.className="jstree-icon jstree-ocl";d.setAttribute("role","presentation");a.appendChild(d);d=z.createElement("A");
  d.className="jstree-anchor";d.setAttribute("href","#");d.setAttribute("tabindex","-1");var b=z.createElement("I");b.className="jstree-icon jstree-themeicon";b.setAttribute("role","presentation");d.appendChild(b);a.appendChild(d);return a},_kbevent_to_func:function(a){var d=[];a.ctrlKey&&d.push("ctrl");a.altKey&&d.push("alt");a.shiftKey&&d.push("shift");d.push({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:"-"}[a.which]||a.which);d=d.sort().join("-").toLowerCase();a=this.settings.core.keyboard;var b;for(b in a)if(a.hasOwnProperty(b)){var c=b;"-"!==c&&"+"!==c&&(c=c.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+",
  "-PLUS"),c=c.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase());if(c===d)return a[b]}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 a="",d=null,b=0;this.element.on("dblclick.jstree",function(c){if(c.target.tagName&&"input"===c.target.tagName.toLowerCase())return!0;
  if(z.selection&&z.selection.empty)z.selection.empty();else if(window.getSelection){c=window.getSelection();try{c.removeAllRanges(),c.collapse()}catch(e){}}}).on("mousedown.jstree",f.proxy(function(c){c.target===this.element[0]&&(c.preventDefault(),b=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(c){c.preventDefault()}).on("click.jstree",".jstree-ocl",f.proxy(function(c){this.toggle_node(c.target)},this)).on("dblclick.jstree",".jstree-anchor",f.proxy(function(c){if(c.target.tagName&&
  "input"===c.target.tagName.toLowerCase())return!0;this.settings.core.dblclick_toggle&&this.toggle_node(c.target)},this)).on("click.jstree",".jstree-anchor",f.proxy(function(c){c.preventDefault();c.currentTarget!==z.activeElement&&f(c.currentTarget).focus();this.activate_node(c.currentTarget,c)},this)).on("keydown.jstree",".jstree-anchor",f.proxy(function(c){if(c.target.tagName&&"input"===c.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===c.which?c.which=39:39===c.which&&(c.which=37));
  var e=this._kbevent_to_func(c);if(e&&(c=e.call(this,c),!1===c||!0===c))return c},this)).on("load_node.jstree",f.proxy(function(c,e){e.status&&(e.node.id!==f.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(f.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){this._data.core.ready=
  !0;if(this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var h=[],g;var k=0;for(g=this._data.core.selected.length;k<g;k++)h=h.concat(this._model.data[this._data.core.selected[k]].parents);h=f.vakata.array_unique(h);k=0;for(g=h.length;k<g;k++)this.open_node(h[k],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",f.proxy(function(c){if(c.target.tagName&&"input"===c.target.tagName.toLowerCase())return!0;
  d&&clearTimeout(d);d=setTimeout(function(){a=""},500);var e=String.fromCharCode(c.which).toLowerCase();c=this.element.find(".jstree-anchor").filter(":visible");var h=c.index(z.activeElement)||0,g=!1;a+=e;if(1<a.length){c.slice(h).each(f.proxy(function(k,l){if(0===f(l).text().toLowerCase().indexOf(a))return f(l).focus(),g=!0,!1},this));if(g)return;c.slice(0,h).each(f.proxy(function(k,l){if(0===f(l).text().toLowerCase().indexOf(a))return f(l).focus(),g=!0,!1},this));if(g)return}(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,
  "\\$&")+"+$")).test(a)&&(c.slice(h+1).each(f.proxy(function(k,l){if(f(l).text().toLowerCase().charAt(0)===e)return f(l).focus(),g=!0,!1},this)),g||c.slice(0,h+1).each(f.proxy(function(k,l){if(f(l).text().toLowerCase().charAt(0)===e)return f(l).focus(),g=!0,!1},this)))},this)).on("init.jstree",f.proxy(function(){var c=this.settings.core.themes;this._data.core.themes.dots=c.dots;this._data.core.themes.stripes=c.stripes;this._data.core.themes.icons=c.icons;this._data.core.themes.ellipsis=c.ellipsis;
  this.set_theme(c.name||"default",c.url);this.set_theme_variant(c.variant)},this)).on("loading.jstree",f.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"]();this[this._data.core.themes.icons?"show_icons":"hide_icons"]();this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]();this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",f.proxy(function(c){this._data.core.focused=null;f(c.currentTarget).filter(".jstree-hovered").trigger("mouseleave");
  this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",f.proxy(function(c){var e=this.get_node(c.currentTarget);e&&e.id&&(this._data.core.focused=e.id);this.element.find(".jstree-hovered").not(c.currentTarget).trigger("mouseleave");f(c.currentTarget).trigger("mouseenter");this.element.attr("tabindex","-1")},this)).on("focus.jstree",f.proxy(function(){if(500<+new Date-b&&!this._data.core.focused&&this.settings.core.restore_focus){b=0;var c=this.get_node(this.element.attr("aria-activedescendant"),
  !0);c&&c.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",f.proxy(function(c){this.hover_node(c.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",f.proxy(function(c){this.dehover_node(c.currentTarget)},this))},unbind:function(){this.element.off(".jstree");f(z).off(".jstree-"+this._id)},trigger:function(a,d){d||={};d.instance=this;this.element.triggerHandler(a.replace(".jstree","")+".jstree",d)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},
  get_string:function(a){var d=this.settings.core.strings;return f.isFunction(d)?d.call(this,a):d&&d[a]?d[a]:a},_firstChild:function(a){for(a=a?a.firstChild:null;null!==a&&1!==a.nodeType;)a=a.nextSibling;return a},_nextSibling:function(a){for(a=a?a.nextSibling:null;null!==a&&1!==a.nodeType;)a=a.nextSibling;return a},_previousSibling:function(a){for(a=a?a.previousSibling:null;null!==a&&1!==a.nodeType;)a=a.previousSibling;return a},get_node:function(a,d){a&&a.id&&(a=a.id);a instanceof f&&a.length&&a[0].id&&
  (a=a[0].id);var b;try{if(this._model.data[a])a=this._model.data[a];else if("string"===typeof a&&this._model.data[a.replace(/^#/,"")])a=this._model.data[a.replace(/^#/,"")];else if("string"===typeof a&&(b=f("#"+a.replace(f.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[b.closest(".jstree-node").attr("id")])a=this._model.data[b.closest(".jstree-node").attr("id")];else if((b=this.element.find(a)).length&&this._model.data[b.closest(".jstree-node").attr("id")])a=this._model.data[b.closest(".jstree-node").attr("id")];
  else if((b=this.element.find(a)).length&&b.hasClass("jstree"))a=this._model.data[f.jstree.root];else return!1;d&&(a=a.id===f.jstree.root?this.element:f("#"+a.id.replace(f.jstree.idregex,"\\$&"),this.element));return a}catch(c){return!1}},get_path:function(a,d,b){a=a.parents?a:this.get_node(a);if(!a||a.id===f.jstree.root||!a.parents)return!1;var c,e=[];e.push(b?a.id:a.text);var h=0;for(c=a.parents.length;h<c;h++)e.push(b?a.parents[h]:this.get_text(a.parents[h]));e=e.reverse().slice(1);return d?e.join(d):
  e},get_next_dom:function(a,d){a=this.get_node(a,!0);if(a[0]===this.element[0]){for(d=this._firstChild(this.get_container_ul()[0]);d&&0===d.offsetHeight;)d=this._nextSibling(d);return d?f(d):!1}if(!a||!a.length)return!1;if(d){d=a[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?f(d):!1}if(a.hasClass("jstree-open")){for(d=this._firstChild(a.children(".jstree-children")[0]);d&&0===d.offsetHeight;)d=this._nextSibling(d);if(null!==d)return f(d)}d=a[0];do d=this._nextSibling(d);while(d&&
  0===d.offsetHeight);return null!==d?f(d):a.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(a,d){a=this.get_node(a,!0);if(a[0]===this.element[0]){for(d=this.get_container_ul()[0].lastChild;d&&0===d.offsetHeight;)d=this._previousSibling(d);return d?f(d):!1}if(!a||!a.length)return!1;if(d){d=a[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?f(d):!1}d=a[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){for(a=
  f(d);a.hasClass("jstree-open");)a=a.children(".jstree-children").first().children(".jstree-node:visible:last");return a}return(d=a[0].parentNode.parentNode)&&d.className&&-1!==d.className.indexOf("jstree-node")?f(d):!1},get_parent:function(a){return(a=this.get_node(a))&&a.id!==f.jstree.root?a.parent:!1},get_children_dom:function(a){a=this.get_node(a,!0);return a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):
  !1},is_parent:function(a){return(a=this.get_node(a))&&(!1===a.state.loaded||0<a.children.length)},is_loaded:function(a){return(a=this.get_node(a))&&a.state.loaded},is_loading:function(a){return(a=this.get_node(a))&&a.state&&a.state.loading},is_open:function(a){return(a=this.get_node(a))&&a.state.opened},is_closed:function(a){return(a=this.get_node(a))&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(a,d){var b,c;if(f.isArray(a))return this._load_nodes(a.slice(),
  d),!0;a=this.get_node(a);if(!a)return d&&d.call(this,a,!1),!1;if(a.state.loaded){a.state.loaded=!1;var e=0;for(b=a.parents.length;e<b;e++)this._model.data[a.parents[e]].children_d=f.vakata.array_filter(this._model.data[a.parents[e]].children_d,function(h){return-1===f.inArray(h,a.children_d)});e=0;for(b=a.children_d.length;e<b;e++)this._model.data[a.children_d[e]].state.selected&&(c=!0),delete this._model.data[a.children_d[e]];c&&(this._data.core.selected=f.vakata.array_filter(this._data.core.selected,
  function(h){return-1===f.inArray(h,a.children_d)}));a.children=[];a.children_d=[];c&&this.trigger("changed",{action:"load_node",node:a,selected:this._data.core.selected})}a.state.failed=!1;a.state.loading=!0;this.get_node(a,!0).addClass("jstree-loading").attr("aria-busy",!0);this._load_node(a,f.proxy(function(h){a=this._model.data[a.id];a.state.loading=!1;a.state.loaded=h;a.state.failed=!a.state.loaded;var g=this.get_node(a,!0),k,l=this._model.data,m=!1;var n=0;for(k=a.children.length;n<k;n++)if(l[a.children[n]]&&
  !l[a.children[n]].state.hidden){m=!0;break}a.state.loaded&&g&&g.length&&(g.removeClass("jstree-closed jstree-open jstree-leaf"),m?"#"!==a.id&&g.addClass(a.state.opened?"jstree-open":"jstree-closed"):g.addClass("jstree-leaf"));g.removeClass("jstree-loading").attr("aria-busy",!1);this.trigger("load_node",{node:a,status:h});d&&d.call(this,a,h)},this));return!0},_load_nodes:function(a,d,b,c){var e=!0,h=function(){this._load_nodes(a,d,!0)},g=this._model.data,k,l=[];var m=0;for(k=a.length;m<k;m++)g[a[m]]&&
  (!g[a[m]].state.loaded&&!g[a[m]].state.failed||!b&&c)&&(this.is_loading(a[m])||this.load_node(a[m],h),e=!1);if(e){m=0;for(k=a.length;m<k;m++)g[a[m]]&&g[a[m]].state.loaded&&l.push(a[m]);d&&!d.done&&(d.call(this,l),d.done=!0)}},load_all:function(a,d){a||(a=f.jstree.root);a=this.get_node(a);if(!a)return!1;var b=[],c=this._model.data,e=c[a.id].children_d,h;a.state&&!a.state.loaded&&b.push(a.id);var g=0;for(h=e.length;g<h;g++)c[e[g]]&&c[e[g]].state&&!c[e[g]].state.loaded&&b.push(e[g]);b.length?this._load_nodes(b,
  function(){this.load_all(a,d)}):(d&&d.call(this,a),this.trigger("load_all",{node:a}))},_load_node:function(a,d){var b=this.settings.core.data,c=function(){return 3!==this.nodeType&&8!==this.nodeType};if(!b)return a.id===f.jstree.root?this._append_html_data(a,this._data.core.original_container_html.clone(!0),function(e){d.call(this,e)}):d.call(this,!1);if(f.isFunction(b))return b.call(this,a,f.proxy(function(e){if(!1===e)d.call(this,!1);else this["string"===typeof e?"_append_html_data":"_append_json_data"](a,
  "string"===typeof e?f(f.parseHTML(e)).filter(c):e,function(h){d.call(this,h)})},this));if("object"===typeof b){if(b.url)return b=f.extend(!0,{},b),f.isFunction(b.url)&&(b.url=b.url.call(this,a)),f.isFunction(b.data)&&(b.data=b.data.call(this,a)),f.ajax(b).done(f.proxy(function(e,h,g){if((h=g.getResponseHeader("Content-Type"))&&-1!==h.indexOf("json")||"object"===typeof e)return this._append_json_data(a,e,function(k){d.call(this,k)});if(h&&-1!==h.indexOf("html")||"string"===typeof e)return this._append_html_data(a,
  f(f.parseHTML(e)).filter(c),function(k){d.call(this,k)});this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:a.id,xhr:g})};this.settings.core.error.call(this,this._data.core.last_error);return d.call(this,!1)},this)).fail(f.proxy(function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:a.id,xhr:e})};d.call(this,!1);this.settings.core.error.call(this,this._data.core.last_error)},
  this));b=f.isArray(b)?f.extend(!0,[],b):f.isPlainObject(b)?f.extend(!0,{},b):b;if(a.id===f.jstree.root)return this._append_json_data(a,b,function(e){d.call(this,e)});this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:a.id})};this.settings.core.error.call(this,this._data.core.last_error);return d.call(this,!1)}if("string"===typeof b){if(a.id===f.jstree.root)return this._append_html_data(a,f(f.parseHTML(b)).filter(c),function(e){d.call(this,
  e)});this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:a.id})};this.settings.core.error.call(this,this._data.core.last_error)}return d.call(this,!1)},_node_changed:function(a){(a=this.get_node(a))&&-1===f.inArray(a.id,this._model.changed)&&this._model.changed.push(a.id)},_append_html_data:function(a,d,b){a=this.get_node(a);a.children=[];a.children_d=[];d=d.is("ul")?d.children():d;var c=a.id,e=[],h=[],g=this._model.data,k=g[c];
  a=this._data.core.selected.length;var l,m;d.each(f.proxy(function(n,q){if(l=this._parse_model_from_html(f(q),c,k.parents.concat()))e.push(l),h.push(l),g[l].children_d.length&&(h=h.concat(g[l].children_d))},this));k.children=e;k.children_d=h;d=0;for(m=k.parents.length;d<m;d++)g[k.parents[d]].children_d=g[k.parents[d]].children_d.concat(h);this.trigger("model",{nodes:h,parent:c});c!==f.jstree.root?(this._node_changed(c),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),
  this.redraw(!0));this._data.core.selected.length!==a&&this.trigger("changed",{action:"model",selected:this._data.core.selected});b.call(this,!0)},_append_json_data:function(a,d,b,c){if(null!==this.element){a=this.get_node(a);a.children=[];a.children_d=[];d.d&&(d=d.d,"string"===typeof d&&(d=JSON.parse(d)));f.isArray(d)||(d=[d]);var e=null,h={df:this._model.default_state,dat:d,par:a.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},g=this,k=function(m,n){m.data&&(m=m.data);
  var q=m.dat,r=m.par,u=[],w=[],p=[],A=m.df,I=m.t_id,R=m.t_cnt,J=m.m,N=J[r];m=m.sel;var M,O=function(x,B,Q){Q=Q?Q.concat():[];B&&Q.unshift(B);var V=x.id.toString();B={id:V,text:x.text||"",icon:x.icon!==n?x.icon:!0,parent:B,parents:Q,children:x.children||[],children_d:x.children_d||[],data:x.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(F in A)A.hasOwnProperty(F)&&(B.state[F]=A[F]);x&&x.data&&x.data.jstree&&x.data.jstree.icon&&(B.icon=x.data.jstree.icon);if(B.icon===n||null===B.icon||
  ""===B.icon)B.icon=!0;if(x&&x.data&&(B.data=x.data,x.data.jstree))for(F in x.data.jstree)x.data.jstree.hasOwnProperty(F)&&(B.state[F]=x.data.jstree[F]);if(x&&"object"===typeof x.state)for(F in x.state)x.state.hasOwnProperty(F)&&(B.state[F]=x.state[F]);if(x&&"object"===typeof x.li_attr)for(F in x.li_attr)x.li_attr.hasOwnProperty(F)&&(B.li_attr[F]=x.li_attr[F]);B.li_attr.id||(B.li_attr.id=V);if(x&&"object"===typeof x.a_attr)for(F in x.a_attr)x.a_attr.hasOwnProperty(F)&&(B.a_attr[F]=x.a_attr[F]);x&&
  x.children&&!0===x.children&&(B.state.loaded=!1,B.children=[],B.children_d=[]);J[B.id]=B;var F=0;for(V=B.children.length;F<V;F++){var X=O(J[B.children[F]],B.id,Q);var Y=J[X];B.children_d.push(X);Y.children_d.length&&(B.children_d=B.children_d.concat(Y.children_d))}delete x.data;delete x.children;J[B.id].original=x;B.state.selected&&p.push(B.id);return B.id},T=function(x,B,Q){Q=Q?Q.concat():[];B&&Q.unshift(B);do var V="j"+I+"_"+ ++R;while(J[V]);B={id:!1,text:"string"===typeof x?x:"",icon:"object"===
  typeof x&&x.icon!==n?x.icon:!0,parent:B,parents:Q,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(F in A)A.hasOwnProperty(F)&&(B.state[F]=A[F]);x&&x.id&&(B.id=x.id.toString());x&&x.text&&(B.text=x.text);x&&x.data&&x.data.jstree&&x.data.jstree.icon&&(B.icon=x.data.jstree.icon);if(B.icon===n||null===B.icon||""===B.icon)B.icon=!0;if(x&&x.data&&(B.data=x.data,x.data.jstree))for(F in x.data.jstree)x.data.jstree.hasOwnProperty(F)&&(B.state[F]=x.data.jstree[F]);
  if(x&&"object"===typeof x.state)for(F in x.state)x.state.hasOwnProperty(F)&&(B.state[F]=x.state[F]);if(x&&"object"===typeof x.li_attr)for(F in x.li_attr)x.li_attr.hasOwnProperty(F)&&(B.li_attr[F]=x.li_attr[F]);B.li_attr.id&&!B.id&&(B.id=B.li_attr.id.toString());B.id||(B.id=V);B.li_attr.id||(B.li_attr.id=B.id);if(x&&"object"===typeof x.a_attr)for(F in x.a_attr)x.a_attr.hasOwnProperty(F)&&(B.a_attr[F]=x.a_attr[F]);if(x&&x.children&&x.children.length){var F=0;for(V=x.children.length;F<V;F++){var X=T(x.children[F],
  B.id,Q);var Y=J[X];B.children.push(X);Y.children_d.length&&(B.children_d=B.children_d.concat(Y.children_d))}B.children_d=B.children_d.concat(B.children)}x&&x.children&&!0===x.children&&(B.state.loaded=!1,B.children=[],B.children_d=[]);delete x.data;delete x.children;B.original=x;J[B.id]=B;B.state.selected&&p.push(B.id);return B.id};if(q.length&&q[0].id!==n&&q[0].parent!==n){var H=0;for(M=q.length;H<M;H++)q[H].children||(q[H].children=[]),q[H].state||(q[H].state={}),J[q[H].id.toString()]=q[H];H=0;
  for(M=q.length;H<M;H++)J[q[H].parent.toString()]?(J[q[H].parent.toString()].children.push(q[H].id.toString()),N.children_d.push(q[H].id.toString())):"undefined"!==typeof g&&(g._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:q[H].id.toString(),parent:q[H].parent.toString()})},g.settings.core.error.call(g,g._data.core.last_error));H=0;for(M=N.children.length;H<M;H++){var S=O(J[N.children[H]],r,N.parents.concat());w.push(S);J[S].children_d.length&&
  (w=w.concat(J[S].children_d))}}else{H=0;for(M=q.length;H<M;H++)if(S=T(q[H],r,N.parents.concat()))u.push(S),w.push(S),J[S].children_d.length&&(w=w.concat(J[S].children_d));N.children=u;N.children_d=w}H=0;for(M=N.parents.length;H<M;H++)J[N.parents[H]].children_d=J[N.parents[H]].children_d.concat(w);q={cnt:R,mod:J,sel:m,par:r,dpc:w,add:p};if("undefined"===typeof window||"undefined"===typeof window.document)postMessage(q);else return q},l=function(m,n){if(null!==this.element){this._cnt=m.cnt;var q=this._model.data;
  for(p in q)q.hasOwnProperty(p)&&q[p].state&&q[p].state.loading&&m.mod[p]&&(m.mod[p].state.loading=!0);this._model.data=m.mod;if(n){var r=m.add,u=m.sel,w=this._data.core.selected.slice();q=this._model.data;if(u.length!==w.length||f.vakata.array_unique(u.concat(w)).length!==u.length){var p=0;for(n=u.length;p<n;p++)-1===f.inArray(u[p],r)&&-1===f.inArray(u[p],w)&&(q[u[p]].state.selected=!1);p=0;for(n=w.length;p<n;p++)-1===f.inArray(w[p],u)&&(q[w[p]].state.selected=!0)}}m.add.length&&(this._data.core.selected=
  this._data.core.selected.concat(m.add));this.trigger("model",{nodes:m.dpc,parent:m.par});m.par!==f.jstree.root?(this._node_changed(m.par),this.redraw()):this.redraw(!0);m.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected});b.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+k.toString()],{type:"text/javascript"}))),!this._data.core.working||
  c?(this._data.core.working=!0,e=new window.Worker(this._wrk),e.onmessage=f.proxy(function(m){l.call(this,m.data,!0);try{e.terminate(),e=null}catch(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),h.par?e.postMessage(h):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([a,d,b,!0])}catch(m){l.call(this,
  k(h),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else l.call(this,k(h),!1)}},_parse_model_from_html:function(a,d,b){b=b?[].concat(b):[];d&&b.unshift(d);var c,e,h=this._model.data,g={id:!1,text:!1,icon:!0,parent:d,parents:b,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(k in this._model.default_state)this._model.default_state.hasOwnProperty(k)&&(g.state[k]=
  this._model.default_state[k]);d=f.vakata.attributes(a,!0);f.each(d,function(l,m){m=f.trim(m);if(!m.length)return!0;g.li_attr[l]=m;"id"===l&&(g.id=m.toString())});d=a.children("a").first();d.length&&(d=f.vakata.attributes(d,!0),f.each(d,function(l,m){m=f.trim(m);m.length&&(g.a_attr[l]=m)}));d=a.children("a").first().length?a.children("a").first().clone():a.clone();d.children("ins, i, ul").remove();d=d.html();d=f("<div />").html(d);g.text=this.settings.core.force_text?d.text():d.html();d=a.data();g.data=
  d?f.extend(!0,{},d):null;g.state.opened=a.hasClass("jstree-open");g.state.selected=a.children("a").hasClass("jstree-clicked");g.state.disabled=a.children("a").hasClass("jstree-disabled");if(g.data&&g.data.jstree)for(k in g.data.jstree)g.data.jstree.hasOwnProperty(k)&&(g.state[k]=g.data.jstree[k]);d=a.children("a").children(".jstree-themeicon");d.length&&(g.icon=d.hasClass("jstree-themeicon-hidden")?!1:d.attr("rel"));g.state.icon!==E&&(g.icon=g.state.icon);if(g.icon===E||null===g.icon||""===g.icon)g.icon=
  !0;d=a.children("ul").children("li");do var k="j"+this._id+"_"+ ++this._cnt;while(h[k]);g.id=g.li_attr.id?g.li_attr.id.toString():k;d.length?(d.each(f.proxy(function(l,m){c=this._parse_model_from_html(f(m),g.id,b);e=this._model.data[c];g.children.push(c);e.children_d.length&&(g.children_d=g.children_d.concat(e.children_d))},this)),g.children_d=g.children_d.concat(g.children)):a.hasClass("jstree-closed")&&(g.state.loaded=!1);g.li_attr["class"]&&(g.li_attr["class"]=g.li_attr["class"].replace("jstree-closed",
  "").replace("jstree-open",""));g.a_attr["class"]&&(g.a_attr["class"]=g.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled",""));h[g.id]=g;g.state.selected&&this._data.core.selected.push(g.id);return g.id},_parse_model_from_flat_json:function(a,d,b){b=b?b.concat():[];d&&b.unshift(d);var c=a.id.toString(),e=this._model.data,h=this._model.default_state;d={id:c,text:a.text||"",icon:a.icon!==E?a.icon:!0,parent:d,parents:b,children:a.children||[],children_d:a.children_d||[],data:a.data,
  state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(g in h)h.hasOwnProperty(g)&&(d.state[g]=h[g]);a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(d.icon=a.data.jstree.icon);if(d.icon===E||null===d.icon||""===d.icon)d.icon=!0;if(a&&a.data&&(d.data=a.data,a.data.jstree))for(g in a.data.jstree)a.data.jstree.hasOwnProperty(g)&&(d.state[g]=a.data.jstree[g]);if(a&&"object"===typeof a.state)for(g in a.state)a.state.hasOwnProperty(g)&&(d.state[g]=a.state[g]);if(a&&"object"===typeof a.li_attr)for(g in a.li_attr)a.li_attr.hasOwnProperty(g)&&
  (d.li_attr[g]=a.li_attr[g]);d.li_attr.id||(d.li_attr.id=c);if(a&&"object"===typeof a.a_attr)for(g in a.a_attr)a.a_attr.hasOwnProperty(g)&&(d.a_attr[g]=a.a_attr[g]);a&&a.children&&!0===a.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]);e[d.id]=d;var g=0;for(c=d.children.length;g<c;g++){h=this._parse_model_from_flat_json(e[d.children[g]],d.id,b);var k=e[h];d.children_d.push(h);k.children_d.length&&(d.children_d=d.children_d.concat(k.children_d))}delete a.data;delete a.children;e[d.id].original=
  a;d.state.selected&&this._data.core.selected.push(d.id);return d.id},_parse_model_from_json:function(a,d,b){b=b?b.concat():[];d&&b.unshift(d);var c=this._model.data;var e=this._model.default_state;do var h="j"+this._id+"_"+ ++this._cnt;while(c[h]);d={id:!1,text:"string"===typeof a?a:"",icon:"object"===typeof a&&a.icon!==E?a.icon:!0,parent:d,parents:b,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(g in e)e.hasOwnProperty(g)&&(d.state[g]=e[g]);a&&a.id&&
  (d.id=a.id.toString());a&&a.text&&(d.text=a.text);a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(d.icon=a.data.jstree.icon);if(d.icon===E||null===d.icon||""===d.icon)d.icon=!0;if(a&&a.data&&(d.data=a.data,a.data.jstree))for(g in a.data.jstree)a.data.jstree.hasOwnProperty(g)&&(d.state[g]=a.data.jstree[g]);if(a&&"object"===typeof a.state)for(g in a.state)a.state.hasOwnProperty(g)&&(d.state[g]=a.state[g]);if(a&&"object"===typeof a.li_attr)for(g in a.li_attr)a.li_attr.hasOwnProperty(g)&&(d.li_attr[g]=
  a.li_attr[g]);d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString());d.id||(d.id=h);d.li_attr.id||(d.li_attr.id=d.id);if(a&&"object"===typeof a.a_attr)for(g in a.a_attr)a.a_attr.hasOwnProperty(g)&&(d.a_attr[g]=a.a_attr[g]);if(a&&a.children&&a.children.length){var g=0;for(h=a.children.length;g<h;g++){e=this._parse_model_from_json(a.children[g],d.id,b);var k=c[e];d.children.push(e);k.children_d.length&&(d.children_d=d.children_d.concat(k.children_d))}d.children_d=d.children.concat(d.children_d)}a&&a.children&&
  !0===a.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]);delete a.data;delete a.children;d.original=a;c[d.id]=d;d.state.selected&&this._data.core.selected.push(d.id);return d.id},_redraw:function(){var a=this._model.force_full_redraw?this._model.data[f.jstree.root].children.concat([]):this._model.changed.concat([]),d=z.createElement("UL"),b,c,e=this._data.core.focused;var h=0;for(c=a.length;h<c;h++)(b=this.redraw_node(a[h],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&
  d.appendChild(b);this._model.force_full_redraw&&(d.className=this.get_container_ul()[0].className,d.setAttribute("role","group"),this.element.empty().append(d));null!==e&&this.settings.core.restore_focus&&((b=this.get_node(e,!0))&&b.length&&b.children(".jstree-anchor")[0]!==z.activeElement?b.children(".jstree-anchor").focus():this._data.core.focused=null);this._model.force_full_redraw=!1;this._model.changed=[];this.trigger("redraw",{nodes:a})},redraw:function(a){a&&(this._model.force_full_redraw=
  !0);this._redraw()},draw_children:function(a){var d=this.get_node(a),b;if(!d)return!1;if(d.id===f.jstree.root)return this.redraw(!0);a=this.get_node(a,!0);if(!a||!a.length)return!1;a.children(".jstree-children").remove();a=a[0];if(d.children.length&&d.state.loaded){var c=z.createElement("UL");c.setAttribute("role","group");c.className="jstree-children";var e=0;for(b=d.children.length;e<b;e++)c.appendChild(this.redraw_node(d.children[e],!0,!0));a.appendChild(c)}},redraw_node:function(a,d,b,c){var e=
  this.get_node(a),h=!1,g=!1,k=!1,l=!1,m=!1,n=!1,q="";n=this._model.data;var r=!1,u=null;q=m=0;var w=!1,p=!1;if(!e)return!1;if(e.id===f.jstree.root)return this.redraw(!0);d=d||0===e.children.length;if(a=z.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(e.id[0])?"\\3"+e.id[0]+" "+e.id.substr(1).replace(f.jstree.idregex,"\\$&"):e.id.replace(f.jstree.idregex,"\\$&"))):z.getElementById(e.id))a=f(a),b||(h=a.parent().parent()[0],h===this.element[0]&&(h=null),g=a.index()),d||!e.children.length||
  a.children(".jstree-children").length||(d=!0),d||(k=a.children(".jstree-children")[0]),r=a.children(".jstree-anchor")[0]===z.activeElement,a.remove();else if(d=!0,!b){h=e.parent!==f.jstree.root?f("#"+e.parent.replace(f.jstree.idregex,"\\$&"),this.element)[0]:null;if(!(null===h||h&&n[e.parent].state.opened))return!1;g=f.inArray(e.id,null===h?n[f.jstree.root].children:n[e.parent].children)}a=this._data.core.node.cloneNode(!0);q="jstree-node ";for(l in e.li_attr)e.li_attr.hasOwnProperty(l)&&"id"!==l&&
  ("class"!==l?a.setAttribute(l,e.li_attr[l]):q+=e.li_attr[l]);e.a_attr.id||(e.a_attr.id=e.id+"_anchor");a.setAttribute("aria-selected",!!e.state.selected);a.setAttribute("aria-level",e.parents.length);a.setAttribute("aria-labelledby",e.a_attr.id);e.state.disabled&&a.setAttribute("aria-disabled",!0);l=0;for(m=e.children.length;l<m;l++)if(!n[e.children[l]].state.hidden){w=!0;break}if(null!==e.parent&&n[e.parent]&&!e.state.hidden&&(l=f.inArray(e.id,n[e.parent].children),p=e.id,-1!==l))for(l++,m=n[e.parent].children.length;l<
  m&&(n[n[e.parent].children[l]].state.hidden||(p=n[e.parent].children[l]),p===e.id);l++);e.state.hidden&&(q+=" jstree-hidden");e.state.loading&&(q+=" jstree-loading");e.state.loaded&&!w?q+=" jstree-leaf":(q+=e.state.opened&&e.state.loaded?" jstree-open":" jstree-closed",a.setAttribute("aria-expanded",e.state.opened&&e.state.loaded));p===e.id&&(q+=" jstree-last");a.id=e.id;a.className=q;q=(e.state.selected?" jstree-clicked":"")+(e.state.disabled?" jstree-disabled":"");for(m in e.a_attr)!e.a_attr.hasOwnProperty(m)||
  "href"===m&&"#"===e.a_attr[m]||("class"!==m?a.childNodes[1].setAttribute(m,e.a_attr[m]):q+=" "+e.a_attr[m]);q.length&&(a.childNodes[1].className="jstree-anchor "+q);if(e.icon&&!0!==e.icon||!1===e.icon)!1===e.icon?a.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===e.icon.indexOf("/")&&-1===e.icon.indexOf(".")?a.childNodes[1].childNodes[0].className+=" "+e.icon+" jstree-themeicon-custom":(a.childNodes[1].childNodes[0].style.backgroundImage='url("'+e.icon+'")',a.childNodes[1].childNodes[0].style.backgroundPosition=
  "center center",a.childNodes[1].childNodes[0].style.backgroundSize="auto",a.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom");this.settings.core.force_text?a.childNodes[1].appendChild(z.createTextNode(e.text)):a.childNodes[1].innerHTML+=e.text;if(d&&e.children.length&&(e.state.opened||c)&&e.state.loaded){n=z.createElement("UL");n.setAttribute("role","group");n.className="jstree-children";l=0;for(m=e.children.length;l<m;l++)n.appendChild(this.redraw_node(e.children[l],d,!0));a.appendChild(n)}k&&
  a.appendChild(k);if(!b){h||=this.element[0];l=0;for(m=h.childNodes.length;l<m;l++)if(h.childNodes[l]&&h.childNodes[l].className&&-1!==h.childNodes[l].className.indexOf("jstree-children")){u=h.childNodes[l];break}u||(u=z.createElement("UL"),u.setAttribute("role","group"),u.className="jstree-children",h.appendChild(u));h=u;g<h.childNodes.length?h.insertBefore(a,h.childNodes[g]):h.appendChild(a);r&&(m=this.element[0].scrollTop,q=this.element[0].scrollLeft,a.childNodes[1].focus(),this.element[0].scrollTop=
  m,this.element[0].scrollLeft=q)}e.state.opened&&!e.state.loaded&&(e.state.opened=!1,setTimeout(f.proxy(function(){this.open_node(e.id,!1,0)},this),0));return a},open_node:function(a,d,b){var c;if(f.isArray(a)){a=a.slice();var e=0;for(c=a.length;e<c;e++)this.open_node(a[e],d,b);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;b=b===E?this.settings.core.animation:b;if(!this.is_closed(a))return d&&d.call(this,a,!1),!1;if(this.is_loaded(a)){e=this.get_node(a,!0);var h=this;e.length&&(b&&
  e.children(".jstree-children").length&&e.children(".jstree-children").stop(!0,!0),a.children.length&&!this._firstChild(e.children(".jstree-children")[0])&&this.draw_children(a),b?(this.trigger("before_open",{node:a}),e.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(b,function(){this.style.display="";h.element&&h.trigger("after_open",{node:a})})):(this.trigger("before_open",
  {node:a}),e[0].className=e[0].className.replace("jstree-closed","jstree-open"),e[0].setAttribute("aria-expanded",!0)));a.state.opened=!0;d&&d.call(this,a,!0);e.length||this.trigger("before_open",{node:a});this.trigger("open_node",{node:a});b&&e.length||this.trigger("after_open",{node:a});return!0}if(this.is_loading(a))return setTimeout(f.proxy(function(){this.open_node(a,d,b)},this),500);this.load_node(a,function(g,k){return k?this.open_node(g,d,b):d?d.call(this,g,!1):!1})},_open_to:function(a){a=
  this.get_node(a);if(!a||a.id===f.jstree.root)return!1;var d,b=a.parents;var c=0;for(d=b.length;c<d;c+=1)c!==f.jstree.root&&this.open_node(b[c],!1,0);return f("#"+a.id.replace(f.jstree.idregex,"\\$&"),this.element)},close_node:function(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<b;c++)this.close_node(a[c],d);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root||this.is_closed(a))return!1;d=d===E?this.settings.core.animation:d;var e=this;var h=this.get_node(a,!0);a.state.opened=
  !1;this.trigger("close_node",{node:a});h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="";h.children(".jstree-children").remove();e.element&&e.trigger("after_close",{node:a})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.attr("aria-expanded",!1).children(".jstree-children").remove(),
  this.trigger("after_close",{node:a})):this.trigger("after_close",{node:a})},toggle_node:function(a){var d;if(f.isArray(a)){a=a.slice();var b=0;for(d=a.length;b<d;b++)this.toggle_node(a[b]);return!0}if(this.is_closed(a))return this.open_node(a);if(this.is_open(a))return this.close_node(a)},open_all:function(a,d,b){a||(a=f.jstree.root);a=this.get_node(a);if(!a)return!1;var c=a.id===f.jstree.root?this.get_container_ul():this.get_node(a,!0),e;if(!c.length){c=0;for(e=a.children_d.length;c<e;c++)this.is_closed(this._model.data[a.children_d[c]])&&
  (this._model.data[a.children_d[c]].state.opened=!0);return this.trigger("open_all",{node:a})}b=b||c;var h=this;c=this.is_closed(a)?c.find(".jstree-closed").addBack():c.find(".jstree-closed");c.each(function(){h.open_node(this,function(g,k){k&&this.is_parent(g)&&this.open_all(g,d,b)},d||0)});0===b.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(b)})},close_all:function(a,d){a||(a=f.jstree.root);a=this.get_node(a);if(!a)return!1;var b=a.id===f.jstree.root?this.get_container_ul():
  this.get_node(a,!0),c=this,e;b.length&&(b=this.is_open(a)?b.find(".jstree-open").addBack():b.find(".jstree-open"),f(b.get().reverse()).each(function(){c.close_node(this,d||0)}));b=0;for(e=a.children_d.length;b<e;b++)this._model.data[a.children_d[b]].state.opened=!1;this.trigger("close_all",{node:a})},is_disabled:function(a){return(a=this.get_node(a))&&a.state&&a.state.disabled},enable_node:function(a){var d;if(f.isArray(a)){a=a.slice();var b=0;for(d=a.length;b<d;b++)this.enable_node(a[b]);return!0}a=
  this.get_node(a);if(!a||a.id===f.jstree.root)return!1;a.state.disabled=!1;this.get_node(a,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1);this.trigger("enable_node",{node:a})},disable_node:function(a){var d;if(f.isArray(a)){a=a.slice();var b=0;for(d=a.length;b<d;b++)this.disable_node(a[b]);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;a.state.disabled=!0;this.get_node(a,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",
  !0);this.trigger("disable_node",{node:a})},is_hidden:function(a){a=this.get_node(a);return!0===a.state.hidden},hide_node:function(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<b;c++)this.hide_node(a[c],!0);d||this.redraw();return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;a.state.hidden||(a.state.hidden=!0,this._node_changed(a.parent),d||this.redraw(),this.trigger("hide_node",{node:a}))},show_node:function(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<
  b;c++)this.show_node(a[c],!0);d||this.redraw();return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;a.state.hidden&&(a.state.hidden=!1,this._node_changed(a.parent),d||this.redraw(),this.trigger("show_node",{node:a}))},hide_all:function(a){var d,b=this._model.data,c=[];for(d in b)b.hasOwnProperty(d)&&d!==f.jstree.root&&!b[d].state.hidden&&(b[d].state.hidden=!0,c.push(d));this._model.force_full_redraw=!0;a||this.redraw();this.trigger("hide_all",{nodes:c});return c},show_all:function(a){var d,
  b=this._model.data,c=[];for(d in b)b.hasOwnProperty(d)&&d!==f.jstree.root&&b[d].state.hidden&&(b[d].state.hidden=!1,c.push(d));this._model.force_full_redraw=!0;a||this.redraw();this.trigger("show_all",{nodes:c});return c},activate_node:function(a,d){if(this.is_disabled(a))return!1;d&&"object"===typeof d||(d={});this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==E?this.get_node(this._data.core.last_clicked.id):null;this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&
  (this._data.core.last_clicked=null);!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1]));if(this.settings.core.multiple&&(d.metaKey||d.ctrlKey||d.shiftKey)&&(!d.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(d.shiftKey){var b=this.get_node(a).id,c=this._data.core.last_clicked.id,e=this.get_node(this._data.core.last_clicked.parent).children,
  h=!1,g;var k=0;for(g=e.length;k<g;k+=1)e[k]===b&&(h=!h),e[k]===c&&(h=!h),this.is_disabled(e[k])||!h&&e[k]!==b&&e[k]!==c?this.deselect_node(e[k],!0,d):this.is_hidden(e[k])||this.select_node(e[k],!0,!1,d);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:d})}else this.is_selected(a)?this.deselect_node(a,!1,d):this.select_node(a,!1,!1,d);else!this.settings.core.multiple&&(d.metaKey||d.ctrlKey||d.shiftKey)&&this.is_selected(a)?this.deselect_node(a,
  !1,d):(this.deselect_all(!0),this.select_node(a,!1,!1,d),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:d})},hover_node:function(a){a=this.get_node(a,!0);if(!a||!a.length||a.children(".jstree-hovered").length)return!1;var d=this.element.find(".jstree-hovered"),b=this.element;d&&d.length&&this.dehover_node(d);a.children(".jstree-anchor").addClass("jstree-hovered");this.trigger("hover_node",{node:this.get_node(a)});setTimeout(function(){b.attr("aria-activedescendant",
  a[0].id)},0)},dehover_node:function(a){a=this.get_node(a,!0);if(!a||!a.length||!a.children(".jstree-hovered").length)return!1;a.children(".jstree-anchor").removeClass("jstree-hovered");this.trigger("dehover_node",{node:this.get_node(a)})},select_node:function(a,d,b,c){var e;if(f.isArray(a)){a=a.slice();var h=0;for(e=a.length;h<e;h++)this.select_node(a[h],d,b,c);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;h=this.get_node(a,!0);a.state.selected||(a.state.selected=!0,this._data.core.selected.push(a.id),
  b||(h=this._open_to(a)),h&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:a,selected:this._data.core.selected,event:c}),d||this.trigger("changed",{action:"select_node",node:a,selected:this._data.core.selected,event:c}))},deselect_node:function(a,d,b){var c;if(f.isArray(a)){a=a.slice();var e=0;for(c=a.length;e<c;e++)this.deselect_node(a[e],d,b);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;e=this.get_node(a,
  !0);a.state.selected&&(a.state.selected=!1,this._data.core.selected=f.vakata.array_remove_item(this._data.core.selected,a.id),e.length&&e.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:a,selected:this._data.core.selected,event:b}),d||this.trigger("changed",{action:"deselect_node",node:a,selected:this._data.core.selected,event:b}))},select_all:function(a){var d=this._data.core.selected.concat([]),b;this._data.core.selected=this._model.data[f.jstree.root].children_d.concat();
  var c=0;for(b=this._data.core.selected.length;c<b;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!0);this.redraw(!0);this.trigger("select_all",{selected:this._data.core.selected});a||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:d})},deselect_all:function(a){var d=this._data.core.selected.concat([]),b;var c=0;for(b=this._data.core.selected.length;c<b;c++)this._model.data[this._data.core.selected[c]]&&
  (this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[];this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1);this.trigger("deselect_all",{selected:this._data.core.selected,node:d});a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:d})},is_selected:function(a){return(a=this.get_node(a))&&a.id!==f.jstree.root?a.state.selected:!1},get_selected:function(a){return a?f.map(this._data.core.selected,
  f.proxy(function(d){return this.get_node(d)},this)):this._data.core.selected.slice()},get_top_selected:function(a){var d=this.get_selected(!0),b={},c,e;var h=0;for(c=d.length;h<c;h++)b[d[h].id]=d[h];h=0;for(c=d.length;h<c;h++){var g=0;for(e=d[h].children_d.length;g<e;g++)b[d[h].children_d[g]]&&delete b[d[h].children_d[g]]}d=[];for(h in b)b.hasOwnProperty(h)&&d.push(h);return a?f.map(d,f.proxy(function(k){return this.get_node(k)},this)):d},get_bottom_selected:function(a){var d=this.get_selected(!0),
  b=[],c;var e=0;for(c=d.length;e<c;e++)d[e].children.length||b.push(d[e].id);return a?f.map(b,f.proxy(function(h){return this.get_node(h)},this)):b},get_state:function(){var a={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},d;for(d in this._model.data)this._model.data.hasOwnProperty(d)&&d!==f.jstree.root&&(this._model.data[d].state.loaded&&this.settings.core.loaded_state&&a.core.loaded.push(d),this._model.data[d].state.opened&&a.core.open.push(d),
  this._model.data[d].state.selected&&a.core.selected.push(d));return a},set_state:function(a,d){if(a){a.core&&a.core.selected&&a.core.initial_selection===E&&(a.core.initial_selection=this._data.core.selected.concat([]).sort().join(","));if(a.core){var b;if(a.core.loaded)return this.settings.core.loaded_state&&f.isArray(a.core.loaded)&&a.core.loaded.length?this._load_nodes(a.core.loaded,function(e){delete a.core.loaded;this.set_state(a,d)}):(delete a.core.loaded,this.set_state(a,d)),!1;if(a.core.open)return f.isArray(a.core.open)&&
  a.core.open.length?this._load_nodes(a.core.open,function(e){this.open_node(e,!1,0);delete a.core.open;this.set_state(a,d)}):(delete a.core.open,this.set_state(a,d)),!1;if(a.core.scroll)return a.core.scroll&&a.core.scroll.left!==E&&this.element.scrollLeft(a.core.scroll.left),a.core.scroll&&a.core.scroll.top!==E&&this.element.scrollTop(a.core.scroll.top),delete a.core.scroll,this.set_state(a,d),!1;if(a.core.selected){var c=this;if(a.core.initial_selection===E||a.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))this.deselect_all(),
  f.each(a.core.selected,function(e,h){c.select_node(h,!1,!0)});delete a.core.initial_selection;delete a.core.selected;this.set_state(a,d);return!1}for(b in a)a.hasOwnProperty(b)&&"core"!==b&&-1===f.inArray(b,this.settings.plugins)&&delete a[b];if(f.isEmptyObject(a.core))return delete a.core,this.set_state(a,d),!1}return f.isEmptyObject(a)?(a=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(a,d){this._data.core.state=!0===d?{}:this.get_state();d&&f.isFunction(d)&&(this._data.core.state=
  d.call(this,this._data.core.state));this._cnt=0;this._model.data={};this._model.data[f.jstree.root]={id:f.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 b=this.get_container_ul()[0].className;a||(this.element.html("<ul class='"+b+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+
  this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"));this.load_node(f.jstree.root,function(c,e){e&&(this.get_container_ul()[0].className=b,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(f.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}));this._data.core.state=null})},refresh_node:function(a){a=this.get_node(a);
  if(!a||a.id===f.jstree.root)return!1;var d=[],b=[],c=this._data.core.selected.concat([]);b.push(a.id);!0===a.state.opened&&d.push(a.id);this.get_node(a,!0).find(".jstree-open").each(function(){b.push(this.id);d.push(this.id)});this._load_nodes(b,f.proxy(function(e){this.open_node(d,!1,0);this.select_node(c);this.trigger("refresh_node",{node:a,nodes:e})},this),!1,!0)},set_id:function(a,d){a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;var b,c=this._model.data,e=a.id;d=d.toString();c[a.parent].children[f.inArray(a.id,
  c[a.parent].children)]=d;var h=0;for(b=a.parents.length;h<b;h++)c[a.parents[h]].children_d[f.inArray(a.id,c[a.parents[h]].children_d)]=d;h=0;for(b=a.children.length;h<b;h++)c[a.children[h]].parent=d;h=0;for(b=a.children_d.length;h<b;h++)c[a.children_d[h]].parents[f.inArray(a.id,c[a.children_d[h]].parents)]=d;h=f.inArray(a.id,this._data.core.selected);-1!==h&&(this._data.core.selected[h]=d);if(h=this.get_node(a.id,!0))h.attr("id",d),this.element.attr("aria-activedescendant")===a.id&&this.element.attr("aria-activedescendant",
  d);delete c[a.id];a.id=d;a.li_attr.id=d;c[d]=a;this.trigger("set_id",{node:a,"new":a.id,old:e});return!0},get_text:function(a){return(a=this.get_node(a))&&a.id!==f.jstree.root?a.text:!1},set_text:function(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<b;c++)this.set_text(a[c],d);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;a.text=d;this.get_node(a,!0).length&&this.redraw_node(a.id);this.trigger("set_text",{obj:a,text:d});return!0},get_json:function(a,d,b){a=this.get_node(a||
  f.jstree.root);if(!a)return!1;d&&d.flat&&!b&&(b=[]);var c={id:a.id,text:a.text,icon:this.get_icon(a),li_attr:f.extend(!0,{},a.li_attr),a_attr:f.extend(!0,{},a.a_attr),state:{},data:d&&d.no_data?!1:f.extend(!0,f.isArray(a.data)?[]:{},a.data)},e;d&&d.flat?c.parent=a.parent:c.children=[];if(d&&d.no_state)delete c.state;else for(h in a.state)a.state.hasOwnProperty(h)&&(c.state[h]=a.state[h]);d&&d.no_li_attr&&delete c.li_attr;d&&d.no_a_attr&&delete c.a_attr;d&&d.no_id&&(delete c.id,c.li_attr&&c.li_attr.id&&
  delete c.li_attr.id,c.a_attr&&c.a_attr.id&&delete c.a_attr.id);d&&d.flat&&a.id!==f.jstree.root&&b.push(c);if(!d||!d.no_children){var h=0;for(e=a.children.length;h<e;h++)d&&d.flat?this.get_json(a.children[h],d,b):c.children.push(this.get_json(a.children[h],d))}return d&&d.flat?b:a.id===f.jstree.root?c.children:c},create_node:function(a,d,b,c,e){null===a&&(a=f.jstree.root);a=this.get_node(a);if(!a)return!1;b=b===E?"last":b;if(!b.toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(a))return this.load_node(a,
  function(){this.create_node(a,d,b,c,!0)});d||={text:this.get_string("New node")};d="string"===typeof d?{text:d}:f.extend(!0,{},d);d.text===E&&(d.text=this.get_string("New node"));var h;a.id===f.jstree.root&&("before"===b&&(b="first"),"after"===b&&(b="last"));switch(b){case "before":e=this.get_node(a.parent);b=f.inArray(a.id,e.children);a=e;break;case "after":e=this.get_node(a.parent);b=f.inArray(a.id,e.children)+1;a=e;break;case "inside":case "first":b=0;break;case "last":b=a.children.length;break;
  default:b||=0}b>a.children.length&&(b=a.children.length);d.id||(d.id=!0);if(!this.check("create_node",d,a,b))return this.settings.core.error.call(this,this._data.core.last_error),!1;!0===d.id&&delete d.id;d=this._parse_model_from_json(d,a.id,a.parents.concat());if(!d)return!1;e=this.get_node(d);var g=[];g.push(d);g=g.concat(e.children_d);this.trigger("model",{nodes:g,parent:a.id});a.children_d=a.children_d.concat(g);var k=0;for(h=a.parents.length;k<h;k++)this._model.data[a.parents[k]].children_d=
  this._model.data[a.parents[k]].children_d.concat(g);d=e;e=[];k=0;for(h=a.children.length;k<h;k++)e[k>=b?k+1:k]=a.children[k];e[b]=d.id;a.children=e;this.redraw_node(a,!0);this.trigger("create_node",{node:this.get_node(d),parent:a.id,position:b});c&&c.call(this,this.get_node(d));return d.id},rename_node:function(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<b;c++)this.rename_node(a[c],d);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;c=a.text;if(!this.check("rename_node",
  a,this.get_parent(a),d))return this.settings.core.error.call(this,this._data.core.last_error),!1;this.set_text(a,d);this.trigger("rename_node",{node:a,text:d,old:c});return!0},delete_node:function(a){var d,b;if(f.isArray(a)){a=a.slice();var c=0;for(d=a.length;c<d;c++)this.delete_node(a[c]);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;c=this.get_node(a.parent);var e=f.inArray(a.id,c.children);d=!1;if(!this.check("delete_node",a,c,e))return this.settings.core.error.call(this,this._data.core.last_error),
  !1;-1!==e&&(c.children=f.vakata.array_remove(c.children,e));var h=a.children_d.concat([]);h.push(a.id);e=0;for(b=a.parents.length;e<b;e++)this._model.data[a.parents[e]].children_d=f.vakata.array_filter(this._model.data[a.parents[e]].children_d,function(g){return-1===f.inArray(g,h)});e=0;for(b=h.length;e<b;e++)if(this._model.data[h[e]].state.selected){d=!0;break}d&&(this._data.core.selected=f.vakata.array_filter(this._data.core.selected,function(g){return-1===f.inArray(g,h)}));this.trigger("delete_node",
  {node:a,parent:c.id});d&&this.trigger("changed",{action:"delete_node",node:a,selected:this._data.core.selected,parent:c.id});e=0;for(b=h.length;e<b;e++)delete this._model.data[h[e]];-1!==f.inArray(this._data.core.focused,h)&&(this._data.core.focused=null,a=this.element[0].scrollTop,d=this.element[0].scrollLeft,c.id===f.jstree.root?this._model.data[f.jstree.root].children[0]&&this.get_node(this._model.data[f.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(c,!0).children(".jstree-anchor").focus(),
  this.element[0].scrollTop=a,this.element[0].scrollLeft=d);this.redraw_node(c,!0);return!0},check:function(a,d,b,c,e){d=d&&d.id?d:this.get_node(d);b=b&&b.id?b:this.get_node(b);var h=a.match(/^move_node|copy_node|create_node$/i)?b:d,g=this.settings.core.check_callback;if("move_node"===a||"copy_node"===a){if(!(e&&e.is_multi||"move_node"!==a||f.inArray(d.id,b.children)!==c))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:a,
  pos:c,obj:d&&d.id?d.id:!1,par:b&&b.id?b.id:!1})},!1;if(!(e&&e.is_multi||d.id!==b.id&&("move_node"!==a||f.inArray(d.id,b.children)!==c)&&-1===f.inArray(b.id,d.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:a,pos:c,obj:d&&d.id?d.id:!1,par:b&&b.id?b.id:!1})},!1}h&&h.data&&(h=h.data);return h&&h.functions&&(!1===h.functions[a]||!0===h.functions[a])?(!1===h.functions[a]&&(this._data.core.last_error={error:"check",
  plugin:"core",id:"core_02",reason:"Node data prevents function: "+a,data:JSON.stringify({chk:a,pos:c,obj:d&&d.id?d.id:!1,par:b&&b.id?b.id:!1})}),h.functions[a]):!1===g||f.isFunction(g)&&!1===g.call(this,a,d,b,c,e)||g&&!1===g[a]?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+a,data:JSON.stringify({chk:a,pos:c,obj:d&&d.id?d.id:!1,par:b&&b.id?b.id:!1})},!1):!0},last_error:function(){return this._data.core.last_error},
  move_node:function(a,d,b,c,e,h,g){var k,l,m,n;d=this.get_node(d);b=b===E?0:b;if(!d)return!1;if(!b.toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(a,d,b,c,!0,!1,g)});if(f.isArray(a))if(1===a.length)a=a[0];else{h=0;for(k=a.length;h<k;h++)if(l=this.move_node(a[h],d,b,c,e,!1,g))d=l,b="after";this.redraw();return!0}a=a&&a.id?a:this.get_node(a);if(!a||a.id===f.jstree.root)return!1;k=(a.parent||f.jstree.root).toString();var q=b.toString().match(/^(before|after)$/)&&
  d.id!==f.jstree.root?this.get_node(d.parent):d;var r=g?g:this._model.data[a.id]?this:f.jstree.reference(a.id);l=!r||!r._id||this._id!==r._id;var u=r&&r._id&&k&&r._model.data[k]&&r._model.data[k].children?f.inArray(a.id,r._model.data[k].children):-1;r&&r._id&&(a=r._model.data[a.id]);if(l)return(l=this.copy_node(a,d,b,c,e,!1,g))?(r&&r.delete_node(a),l):!1;d.id===f.jstree.root&&("before"===b&&(b="first"),"after"===b&&(b="last"));switch(b){case "before":b=f.inArray(d.id,q.children);break;case "after":b=
  f.inArray(d.id,q.children)+1;break;case "inside":case "first":b=0;break;case "last":b=q.children.length;break;default:b||=0}b>q.children.length&&(b=q.children.length);if(!this.check("move_node",a,q,b,{core:!0,origin:g,is_multi:r&&r._id&&r._id!==this._id,is_foreign:!r||!r._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(a.parent===q.id){e=q.children.concat();l=f.inArray(a.id,e);-1!==l&&(e=f.vakata.array_remove(e,l),b>l&&b--);l=[];var w=0;for(m=e.length;w<m;w++)l[w>=
  b?w+1:w]=e[w];l[b]=a.id;q.children=l;this._node_changed(q.id);this.redraw(q.id===f.jstree.root)}else{l=a.children_d.concat();l.push(a.id);w=0;for(m=a.parents.length;w<m;w++){e=[];var p=r._model.data[a.parents[w]].children_d;var A=0;for(n=p.length;A<n;A++)-1===f.inArray(p[A],l)&&e.push(p[A]);r._model.data[a.parents[w]].children_d=e}r._model.data[k].children=f.vakata.array_remove_item(r._model.data[k].children,a.id);w=0;for(m=q.parents.length;w<m;w++)this._model.data[q.parents[w]].children_d=this._model.data[q.parents[w]].children_d.concat(l);
  e=[];w=0;for(m=q.children.length;w<m;w++)e[w>=b?w+1:w]=q.children[w];e[b]=a.id;q.children=e;q.children_d.push(a.id);q.children_d=q.children_d.concat(a.children_d);a.parent=q.id;l=q.parents.concat();l.unshift(q.id);p=a.parents.length;a.parents=l;l=l.concat();w=0;for(m=a.children_d.length;w<m;w++)this._model.data[a.children_d[w]].parents=this._model.data[a.children_d[w]].parents.slice(0,-1*p),Array.prototype.push.apply(this._model.data[a.children_d[w]].parents,l);if(k===f.jstree.root||q.id===f.jstree.root)this._model.force_full_redraw=
  !0;this._model.force_full_redraw||(this._node_changed(k),this._node_changed(q.id));h||this.redraw()}c&&c.call(this,a,q,b);this.trigger("move_node",{node:a,parent:q.id,position:b,old_parent:k,old_position:u,is_multi:r&&r._id&&r._id!==this._id,is_foreign:!r||!r._id,old_instance:r,new_instance:this});return a.id},copy_node:function(a,d,b,c,e,h,g){var k,l,m,n;d=this.get_node(d);b=b===E?0:b;if(!d)return!1;if(!b.toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(a,
  d,b,c,!0,!1,g)});if(f.isArray(a))if(1===a.length)a=a[0];else{h=0;for(k=a.length;h<k;h++)if(l=this.copy_node(a[h],d,b,c,e,!0,g))d=l,b="after";this.redraw();return!0}a=a&&a.id?a:this.get_node(a);if(!a||a.id===f.jstree.root)return!1;k=(a.parent||f.jstree.root).toString();var q=b.toString().match(/^(before|after)$/)&&d.id!==f.jstree.root?this.get_node(d.parent):d;(n=g?g:this._model.data[a.id]?this:f.jstree.reference(a.id))&&n._id&&(a=n._model.data[a.id]);d.id===f.jstree.root&&("before"===b&&(b="first"),
  "after"===b&&(b="last"));switch(b){case "before":b=f.inArray(d.id,q.children);break;case "after":b=f.inArray(d.id,q.children)+1;break;case "inside":case "first":b=0;break;case "last":b=q.children.length;break;default:b||=0}b>q.children.length&&(b=q.children.length);if(!this.check("copy_node",a,q,b,{core:!0,origin:g,is_multi:n&&n._id&&n._id!==this._id,is_foreign:!n||!n._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;var r=n?n.get_json(a,{no_id:!0,no_data:!0,no_state:!0}):
  a;if(!r)return!1;!0===r.id&&delete r.id;r=this._parse_model_from_json(r,q.id,q.parents.concat());if(!r)return!1;l=this.get_node(r);a&&a.state&&!1===a.state.loaded&&(l.state.loaded=!1);e=[];e.push(r);e=e.concat(l.children_d);this.trigger("model",{nodes:e,parent:q.id});r=0;for(m=q.parents.length;r<m;r++)this._model.data[q.parents[r]].children_d=this._model.data[q.parents[r]].children_d.concat(e);e=[];r=0;for(m=q.children.length;r<m;r++)e[r>=b?r+1:r]=q.children[r];e[b]=l.id;q.children=e;q.children_d.push(l.id);
  q.children_d=q.children_d.concat(l.children_d);q.id===f.jstree.root&&(this._model.force_full_redraw=!0);this._model.force_full_redraw||this._node_changed(q.id);h||this.redraw(q.id===f.jstree.root);c&&c.call(this,l,q,b);this.trigger("copy_node",{node:l,original:a,parent:q.id,position:b,old_parent:k,old_position:n&&n._id&&k&&n._model.data[k]&&n._model.data[k].children?f.inArray(a.id,n._model.data[k].children):-1,is_multi:n&&n._id&&n._id!==this._id,is_foreign:!n||!n._id,old_instance:n,new_instance:this});
  return l.id},cut:function(a){a||=this._data.core.selected.concat();f.isArray(a)||(a=[a]);if(!a.length)return!1;var d=[],b,c;var e=0;for(c=a.length;e<c;e++)(b=this.get_node(a[e]))&&b.id&&b.id!==f.jstree.root&&d.push(b);if(!d.length)return!1;t=d;y=this;v="move_node";this.trigger("cut",{node:a})},copy:function(a){a||=this._data.core.selected.concat();f.isArray(a)||(a=[a]);if(!a.length)return!1;var d=[],b,c;var e=0;for(c=a.length;e<c;e++)(b=this.get_node(a[e]))&&b.id&&b.id!==f.jstree.root&&d.push(b);
  if(!d.length)return!1;t=d;y=this;v="copy_node";this.trigger("copy",{node:a})},get_buffer:function(){return{mode:v,node:t,inst:y}},can_paste:function(){return!1!==v&&!1!==t},paste:function(a,d){a=this.get_node(a);if(!(a&&v&&v.match(/^(copy_node|move_node)$/)&&t))return!1;this[v](t,a,d,!1,!1,!1,y)&&this.trigger("paste",{parent:a.id,node:t,mode:v});y=v=t=!1},clear_buffer:function(){y=v=t=!1;this.trigger("clear_buffer")},edit:function(a,d,b){var c=!1;a=this.get_node(a);if(!a)return!1;if(!this.check("edit",
  a,this.get_parent(a)))return this.settings.core.error.call(this,this._data.core.last_error),!1;var e=a;d="string"===typeof d?d:a.text;this.set_text(a,"");a=this._open_to(a);e.text=d;var h=this._data.core.rtl;var g=this.element.width();this._data.core.focused=e.id;var k=a.children(".jstree-anchor").focus();var l=f("<span>");var m=d;var n=f("<div />",{css:{position:"absolute",top:"-200px",left:h?"0px":"-1000px",visibility:"hidden"}}).appendTo(z.body);var q=f("<input />",{value:m,"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:f.proxy(function(r){r.stopImmediatePropagation();r.preventDefault();r=l.children(".jstree-rename-input").val();var u=this.settings.core.force_text;""===r&&(r=m);n.remove();l.replaceWith(k);l.remove();m=u?m:f("<div></div>").append(f.parseHTML(m)).html();a=this.get_node(a);this.set_text(a,m);(r=!!this.rename_node(a,
  u?f("<div></div>").text(r).text():f("<div></div>").append(f.parseHTML(r)).html()))||this.set_text(a,m);this._data.core.focused=e.id;setTimeout(f.proxy(function(){var w=this.get_node(e.id,!0);w.length&&(this._data.core.focused=e.id,w.children(".jstree-anchor").focus())},this),0);b&&b.call(this,e,r,c);q=null},this),keydown:function(r){var u=r.which;27===u&&(c=!0,this.value=m);27!==u&&13!==u&&37!==u&&38!==u&&39!==u&&40!==u&&32!==u||r.stopImmediatePropagation();if(27===u||13===u)r.preventDefault(),this.blur()},
  click:function(r){r.stopImmediatePropagation()},mousedown:function(r){r.stopImmediatePropagation()},keyup:function(r){q.width(Math.min(n.text("pW"+this.value).width(),g))},keypress:function(r){if(13===r.which)return!1}});d={fontFamily:k.css("fontFamily")||"",fontSize:k.css("fontSize")||"",fontWeight:k.css("fontWeight")||"",fontStyle:k.css("fontStyle")||"",fontStretch:k.css("fontStretch")||"",fontVariant:k.css("fontVariant")||"",letterSpacing:k.css("letterSpacing")||"",wordSpacing:k.css("wordSpacing")||
  ""};l.attr("class",k.attr("class")).append(k.contents().clone()).append(q);k.replaceWith(l);n.css(d);q.css(d).width(Math.min(n.text("pW"+q[0].value).width(),g))[0].select();f(z).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(r){q&&r.target!==q&&f(q).blur()})},set_theme:function(a,d){if(!a)return!1;!0===d&&((d=this.settings.core.themes.dir)||(d=f.jstree.path+"/themes"),d=d+"/"+a+"/style.css");d&&-1===f.inArray(d,C)&&(f("head").append('<link rel="stylesheet" href="'+d+'" type="text/css" />'),
  C.push(d));this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name);this._data.core.themes.name=a;this.element.addClass("jstree-"+a);this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+a+"-responsive");this.trigger("set_theme",{theme:a})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant);
  (this._data.core.themes.variant=a)&&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(a,d){var b;if(f.isArray(a)){a=a.slice();var c=0;for(b=a.length;c<b;c++)this.set_icon(a[c],d);return!0}a=this.get_node(a);if(!a||a.id===f.jstree.root)return!1;b=a.icon;a.icon=!0===d||null===d||d===E||""===d?!0:d;c=this.get_node(a,!0).children(".jstree-anchor").children(".jstree-themeicon");!1===d?(c.removeClass("jstree-themeicon-custom "+b).css("background","").removeAttr("rel"),
  this.hide_icon(a)):(!0===d||null===d||d===E||""===d?c.removeClass("jstree-themeicon-custom "+b).css("background","").removeAttr("rel"):-1===d.indexOf("/")&&-1===d.indexOf(".")?(c.removeClass(b).css("background",""),c.addClass(d+" jstree-themeicon-custom").attr("rel",d)):(c.removeClass(b).css("background",""),c.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d)),!1===b&&this.show_icon(a));return!0},get_icon:function(a){return(a=this.get_node(a))&&
  a.id!==f.jstree.root?a.icon:!1},hide_icon:function(a){var d;if(f.isArray(a)){a=a.slice();var b=0;for(d=a.length;b<d;b++)this.hide_icon(a[b]);return!0}a=this.get_node(a);if(!a||a===f.jstree.root)return!1;a.icon=!1;this.get_node(a,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden");return!0},show_icon:function(a){var d;if(f.isArray(a)){a=a.slice();var b=0;for(d=a.length;b<d;b++)this.show_icon(a[b]);return!0}a=this.get_node(a);if(!a||a===f.jstree.root)return!1;
  b=this.get_node(a,!0);a.icon=b.length?b.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0;a.icon||(a.icon=!0);b.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden");return!0}};f.vakata={};f.vakata.attributes=function(a,d){a=f(a)[0];var b=d?{}:[];a&&a.attributes&&f.each(a.attributes,function(c,e){-1===f.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==f.trim(e.value)&&(d?b[e.name]=
  e.value:b.push(e.name))});return b};f.vakata.array_unique=function(a){var d=[],b,c={};var e=0;for(b=a.length;e<b;e++)c[a[e]]===E&&(d.push(a[e]),c[a[e]]=!0);return d};f.vakata.array_remove=function(a,d){a.splice(d,1);return a};f.vakata.array_remove_item=function(a,d){d=f.inArray(d,a);return-1!==d?f.vakata.array_remove(a,d):a};f.vakata.array_filter=function(a,d,b,c,e){if(a.filter)return a.filter(d,b);c=[];for(e in a)~~e+""===e+""&&0<=e&&d.call(b,a[e],+e,a)&&c.push(a[e]);return c};f.jstree.plugins.changed=
  function(a,d){var b=[];this.trigger=function(c,e){var h;e||={};if("changed"===c.replace(".jstree","")){e.changed={selected:[],deselected:[]};var g={};var k=0;for(h=b.length;k<h;k++)g[b[k]]=1;k=0;for(h=e.selected.length;k<h;k++)g[e.selected[k]]?g[e.selected[k]]=2:e.changed.selected.push(e.selected[k]);k=0;for(h=b.length;k<h;k++)1===g[b[k]]&&e.changed.deselected.push(b[k]);b=e.selected.slice()}d.trigger.call(this,c,e)};this.refresh=function(c,e){b=[];return d.refresh.apply(this,arguments)}};var K=z.createElement("I");
  K.className="jstree-icon jstree-checkbox";K.setAttribute("role","presentation");f.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};f.jstree.plugins.checkbox=function(a,d){this.bind=function(){d.bind.call(this);this._data.checkbox.uto=!1;this._data.checkbox.selected=[];this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined");this.element.on("init.jstree",
  f.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible;this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked");this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",f.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this));if(-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",
  f.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto);this._data.checkbox.uto=setTimeout(f.proxy(this._undetermined,this),50)},this));if(!this.settings.checkbox.tie_selection)this.element.on("model.jstree",f.proxy(function(b,c){b=this._model.data;c=c.nodes;var e;var h=0;for(e=c.length;h<e;h++)b[c[h]].state.checked=b[c[h]].state.checked||b[c[h]].original&&b[c[h]].original.state&&b[c[h]].original.state.checked,b[c[h]].state.checked&&this._data.checkbox.selected.push(c[h])},
  this));if(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))this.element.on("model.jstree",f.proxy(function(b,c){b=this._model.data;var e=b[c.parent],h=c.nodes;c=[];var g,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection;if(-1!==l.indexOf("down"))if(e.state[m?"selected":"checked"]){var n=0;for(g=h.length;n<g;n++)b[h[n]].state[m?"selected":"checked"]=!0;this._data[m?"core":"checkbox"].selected=this._data[m?"core":"checkbox"].selected.concat(h)}else for(n=
  0,g=h.length;n<g;n++)if(b[h[n]].state[m?"selected":"checked"]){var q=0;for(k=b[h[n]].children_d.length;q<k;q++)b[b[h[n]].children_d[q]].state[m?"selected":"checked"]=!0;this._data[m?"core":"checkbox"].selected=this._data[m?"core":"checkbox"].selected.concat(b[h[n]].children_d)}if(-1!==l.indexOf("up")){n=0;for(g=e.children_d.length;n<g;n++)b[e.children_d[n]].children.length||c.push(b[e.children_d[n]].parent);c=f.vakata.array_unique(c);q=0;for(k=c.length;q<k;q++)for(e=b[c[q]];e&&e.id!==f.jstree.root;){n=
  h=0;for(g=e.children.length;n<g;n++)h+=b[e.children[n]].state[m?"selected":"checked"];if(h===g)e.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(e.id),(n=this.get_node(e,!0))&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked");else break;e=this.get_node(e.parent)}}this._data[m?"core":"checkbox"].selected=f.vakata.array_unique(this._data[m?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?
  "select_node.jstree":"check_node.jstree",f.proxy(function(b,c){var e=c.node;b=this._model.data;c=this.get_node(e.parent);var h;var g=this.settings.checkbox.cascade;var k=this.settings.checkbox.tie_selection,l={},m=this._data[k?"core":"checkbox"].selected;var n=0;for(h=m.length;n<h;n++)l[m[n]]=!0;if(-1!==g.indexOf("down"))for(m=this._cascade_new_checked_state(e.id,!0),e=e.children_d.concat(e.id),n=0,h=e.length;n<h;n++)-1<m.indexOf(e[n])?l[e[n]]=!0:delete l[e[n]];if(-1!==g.indexOf("up"))for(;c&&c.id!==
  f.jstree.root;){n=g=0;for(h=c.children.length;n<h;n++)g+=b[c.children[n]].state[k?"selected":"checked"];if(g===h)c.state[k?"selected":"checked"]=!0,l[c.id]=!0,(h=this.get_node(c,!0))&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass(k?"jstree-clicked":"jstree-checked");else break;c=this.get_node(c.parent)}m=[];for(n in l)l.hasOwnProperty(n)&&m.push(n);this._data[k?"core":"checkbox"].selected=m},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",
  f.proxy(function(b,c){b=this.get_node(f.jstree.root);c=this._model.data;var e,h;var g=0;for(e=b.children_d.length;g<e;g++)(h=c[b.children_d[g]])&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",f.proxy(function(b,c){var e=c.node;this.get_node(e,!0);var h;var g=this.settings.checkbox.cascade;b=this.settings.checkbox.tie_selection;c=this._data[b?"core":"checkbox"].selected;
  var k=e.children_d.concat(e.id);if(-1!==g.indexOf("down")){var l=this._cascade_new_checked_state(e.id,!1);c=f.vakata.array_filter(c,function(n){return-1===k.indexOf(n)||-1<l.indexOf(n)})}if(-1!==g.indexOf("up")&&-1===c.indexOf(e.id)){g=0;for(h=e.parents.length;g<h;g++){var m=this._model.data[e.parents[g]];m.state[b?"selected":"checked"]=!1;m&&m.original&&m.original.state&&m.original.state.undetermined&&(m.original.state.undetermined=!1);(m=this.get_node(e.parents[g],!0))&&m.length&&m.attr("aria-selected",
  !1).children(".jstree-anchor").removeClass(b?"jstree-clicked":"jstree-checked")}c=f.vakata.array_filter(c,function(n){return-1===e.parents.indexOf(n)})}this._data[b?"core":"checkbox"].selected=c},this));if(-1!==this.settings.checkbox.cascade.indexOf("up"))this.element.on("delete_node.jstree",f.proxy(function(b,c){b=this.get_node(c.parent);c=this._model.data;for(var e,h,g,k=this.settings.checkbox.tie_selection;b&&b.id!==f.jstree.root&&!b.state[k?"selected":"checked"];){e=g=0;for(h=b.children.length;e<
  h;e++)g+=c[b.children[e]].state[k?"selected":"checked"];if(0<h&&g===h)b.state[k?"selected":"checked"]=!0,this._data[k?"core":"checkbox"].selected.push(b.id),(e=this.get_node(b,!0))&&e.length&&e.attr("aria-selected",!0).children(".jstree-anchor").addClass(k?"jstree-clicked":"jstree-checked");else break;b=this.get_node(b.parent)}},this)).on("move_node.jstree",f.proxy(function(b,c){var e=c.is_multi,h=c.old_parent;c=this.get_node(c.parent);b=this._model.data;var g,k=this.settings.checkbox.tie_selection;
  if(!e)for(e=this.get_node(h);e&&e.id!==f.jstree.root&&!e.state[k?"selected":"checked"];){var l=h=0;for(g=e.children.length;l<g;l++)h+=b[e.children[l]].state[k?"selected":"checked"];if(0<g&&h===g)e.state[k?"selected":"checked"]=!0,this._data[k?"core":"checkbox"].selected.push(e.id),(h=this.get_node(e,!0))&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass(k?"jstree-clicked":"jstree-checked");else break;e=this.get_node(e.parent)}for(e=c;e&&e.id!==f.jstree.root;){l=h=0;for(g=e.children.length;l<
  g;l++)h+=b[e.children[l]].state[k?"selected":"checked"];if(h===g)e.state[k?"selected":"checked"]||(e.state[k?"selected":"checked"]=!0,this._data[k?"core":"checkbox"].selected.push(e.id),(h=this.get_node(e,!0))&&h.length&&h.attr("aria-selected",!0).children(".jstree-anchor").addClass(k?"jstree-clicked":"jstree-checked"));else if(e.state[k?"selected":"checked"])e.state[k?"selected":"checked"]=!1,this._data[k?"core":"checkbox"].selected=f.vakata.array_remove_item(this._data[k?"core":"checkbox"].selected,
  e.id),(h=this.get_node(e,!0))&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(k?"jstree-clicked":"jstree-checked");else break;e=this.get_node(e.parent)}},this))};this.get_undetermined=function(b){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var c,e,h={},g=this._model.data,k=this.settings.checkbox.tie_selection,l=this._data[k?"core":"checkbox"].selected,m=[],n=this,q=[];var r=0;for(c=l.length;r<c;r++)if(g[l[r]]&&g[l[r]].parents){var u=0;for(e=
  g[l[r]].parents.length;u<e&&h[g[l[r]].parents[u]]===E;u++)g[l[r]].parents[u]!==f.jstree.root&&(h[g[l[r]].parents[u]]=!0,m.push(g[l[r]].parents[u]))}this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var w=n.get_node(this);if(w)if(w.state.loaded)for(r=0,c=w.children_d.length;r<c;r++){var p=g[w.children_d[r]];if(!p.state.loaded&&p.original&&p.original.state&&p.original.state.undetermined&&!0===p.original.state.undetermined)for(h[p.id]===E&&p.id!==f.jstree.root&&(h[p.id]=
  !0,m.push(p.id)),u=0,e=p.parents.length;u<e;u++)h[p.parents[u]]===E&&p.parents[u]!==f.jstree.root&&(h[p.parents[u]]=!0,m.push(p.parents[u]))}else if(w.original&&w.original.state&&w.original.state.undetermined&&!0===w.original.state.undetermined)for(h[w.id]===E&&w.id!==f.jstree.root&&(h[w.id]=!0,m.push(w.id)),u=0,e=w.parents.length;u<e;u++)h[w.parents[u]]===E&&w.parents[u]!==f.jstree.root&&(h[w.parents[u]]=!0,m.push(w.parents[u]))});r=0;for(c=m.length;r<c;r++)g[m[r]].state[k?"selected":"checked"]||
  q.push(b?g[m[r]]:m[r]);return q};this._undetermined=function(){if(null!==this.element){var b=this.get_undetermined(!1),c,e;this.element.find(".jstree-undetermined").removeClass("jstree-undetermined");var h=0;for(c=b.length;h<c;h++)(e=this.get_node(b[h],!0))&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}};this.redraw_node=function(b,c,e,h){if(b=d.redraw_node.apply(this,arguments)){var g,k=null;var l=0;for(g=b.childNodes.length;l<g;l++)if(b.childNodes[l]&&
  b.childNodes[l].className&&-1!==b.childNodes[l].className.indexOf("jstree-anchor")){k=b.childNodes[l];break}k&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(k.className+=" jstree-checked"),l=K.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(l.className+=" jstree-checkbox-disabled"),k.insertBefore(l,k.childNodes[0]))}e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=
  setTimeout(f.proxy(this._undetermined,this),50));return b};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(b){b=this.get_node(b);var c=this.settings.checkbox.cascade;
  var e=this.settings.checkbox.tie_selection;var h=this._data[e?"core":"checkbox"].selected,g=this._model.data;if(!b||!0===b.state[e?"selected":"checked"]||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&!0===b.original.state.undetermined)return!0;c=0;for(e=b.children_d.length;c<e;c++)if(-1!==f.inArray(b.children_d[c],h)||!g[b.children_d[c]].state.loaded&&g[b.children_d[c]].original.state.undetermined)return!0;return!1};this.disable_checkbox=
  function(b){var c;if(f.isArray(b)){b=b.slice();var e=0;for(c=b.length;e<c;e++)this.disable_checkbox(b[e]);return!0}b=this.get_node(b);if(!b||b.id===f.jstree.root)return!1;e=this.get_node(b,!0);b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b}))};this.enable_checkbox=function(b){var c;if(f.isArray(b)){b=b.slice();var e=0;for(c=b.length;e<c;e++)this.enable_checkbox(b[e]);
  return!0}b=this.get_node(b);if(!b||b.id===f.jstree.root)return!1;e=this.get_node(b,!0);b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b}))};this.activate_node=function(b,c){if(f(c.target).hasClass("jstree-checkbox-disabled"))return!1;this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||f(c.target).hasClass("jstree-checkbox"))&&
  (c.ctrlKey=!0);if(this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!f(c.target).hasClass("jstree-checkbox"))return d.activate_node.call(this,b,c);if(this.is_disabled(b))return!1;this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c);this.trigger("activate_node",{node:this.get_node(b)})};this._cascade_new_checked_state=function(b,c){var e=this.settings.checkbox.tie_selection,h=this._model.data[b],g=[],k=[],l;if(!this.settings.checkbox.cascade_to_disabled&&h.state.disabled||
  !this.settings.checkbox.cascade_to_hidden&&h.state.hidden){var m=this.get_checked_descendants(b);h.state[e?"selected":"checked"]&&m.push(h.id);g=g.concat(m)}else{if(h.children)for(b=0,l=h.children.length;b<l;b++){var n=h.children[b];m=this._cascade_new_checked_state(n,c);g=g.concat(m);-1<m.indexOf(n)&&k.push(n)}b=this.get_node(h,!0);l=0<k.length&&k.length<h.children.length;h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=l);l?(h.state[e?"selected":"checked"]=
  !1,b.attr("aria-selected",!1).children(".jstree-anchor").removeClass(e?"jstree-clicked":"jstree-checked")):c&&k.length===h.children.length?(h.state[e?"selected":"checked"]=c,g.push(h.id),b.attr("aria-selected",!0).children(".jstree-anchor").addClass(e?"jstree-clicked":"jstree-checked")):(h.state[e?"selected":"checked"]=!1,b.attr("aria-selected",!1).children(".jstree-anchor").removeClass(e?"jstree-clicked":"jstree-checked"))}return g};this.get_checked_descendants=function(b){var c=this,e=c.settings.checkbox.tie_selection;
  return f.vakata.array_filter(c._model.data[b].children_d,function(h){return c._model.data[h].state[e?"selected":"checked"]})};this.check_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.select_node(b,!1,!0,c);var e;if(f.isArray(b)){b=b.slice();var h=0;for(e=b.length;h<e;h++)this.check_node(b[h],c);return!0}b=this.get_node(b);if(!b||b.id===f.jstree.root)return!1;h=this.get_node(b,!0);b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),h&&h.length&&h.children(".jstree-anchor").addClass("jstree-checked"),
  this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c}))};this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var e;if(f.isArray(b)){b=b.slice();var h=0;for(e=b.length;h<e;h++)this.uncheck_node(b[h],c);return!0}b=this.get_node(b);if(!b||b.id===f.jstree.root)return!1;h=this.get_node(b,!0);b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=f.vakata.array_remove_item(this._data.checkbox.selected,b.id),h.length&&
  h.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c}))};this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();this._data.checkbox.selected.concat([]);var b;this._data.checkbox.selected=this._model.data[f.jstree.root].children_d.concat();var c=0;for(b=this._data.checkbox.selected.length;c<b;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].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 b=this._data.checkbox.selected.concat([]),c;var e=0;for(c=this._data.checkbox.selected.length;e<c;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:b})};this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b))&&b.id!==f.jstree.root?b.state.checked:!1};this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?f.map(this._data.checkbox.selected,f.proxy(function(c){return this.get_node(c)},this)):this._data.checkbox.selected.slice()};this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);
  var c=this.get_checked(!0),e={},h,g;var k=0;for(h=c.length;k<h;k++)e[c[k].id]=c[k];k=0;for(h=c.length;k<h;k++){var l=0;for(g=c[k].children_d.length;l<g;l++)e[c[k].children_d[l]]&&delete e[c[k].children_d[l]]}c=[];for(k in e)e.hasOwnProperty(k)&&c.push(k);return b?f.map(c,f.proxy(function(m){return this.get_node(m)},this)):c};this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),e=[],h;var g=0;for(h=c.length;g<h;g++)c[g].children.length||
  e.push(c[g].id);return b?f.map(e,f.proxy(function(k){return this.get_node(k)},this)):e};this.load_node=function(b,c){var e,h;if(!f.isArray(b)&&!this.settings.checkbox.tie_selection&&(h=this.get_node(b))&&h.state.loaded){var g=0;for(e=h.children_d.length;g<e;g++)this._model.data[h.children_d[g]].state.checked&&(this._data.checkbox.selected=f.vakata.array_remove_item(this._data.checkbox.selected,h.children_d[g]))}return d.load_node.apply(this,arguments)};this.get_state=function(){var b=d.get_state.apply(this,
  arguments);if(this.settings.checkbox.tie_selection)return b;b.checkbox=this._data.checkbox.selected.slice();return b};this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var h=this;f.each(b.checkbox,function(g,k){h.check_node(k)})}delete b.checkbox;this.set_state(b,c);return!1}return e};this.refresh=function(b,c){this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]);return d.refresh.apply(this,
  arguments)}};f.jstree.defaults.conditionalselect=function(){return!0};f.jstree.plugins.conditionalselect=function(a,d){this.activate_node=function(b,c){if(this.settings.conditionalselect.call(this,this.get_node(b),c))return d.activate_node.call(this,b,c)}};f.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(a,d){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);
  c.create_node(b,{},"last",function(e){try{c.edit(e)}catch(h){setTimeout(function(){c.edit(e)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);c.edit(b)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);c.is_selected(b)?c.delete_node(c.get_selected()):c.delete_node(b)}},
  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(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);c.is_selected(b)?c.cut(c.get_top_selected()):c.cut(b)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);c.is_selected(b)?c.copy(c.get_top_selected()):c.copy(b)}},paste:{separator_before:!1,
  icon:!1,_disabled:function(b){return!f.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=f.jstree.reference(b.reference);b=c.get_node(b.reference);c.paste(b)}}}}}}};f.jstree.plugins.contextmenu=function(a,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,h;this.element.on("init.jstree loading.jstree ready.jstree",f.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",f.proxy(function(g,
  k){if("input"!==g.target.tagName.toLowerCase()){g.preventDefault();b=g.ctrlKey?+new Date:0;if(k||c)b=+new Date+1E4;c&&clearTimeout(c);this.is_loading(g.currentTarget)||this.show_contextmenu(g.currentTarget,g.pageX,g.pageY,g)}},this)).on("click.jstree",".jstree-anchor",f.proxy(function(g){this._data.contextmenu.visible&&(!b||250<+new Date-b)&&f.vakata.context.hide();b=0},this)).on("touchstart.jstree",".jstree-anchor",function(g){g.originalEvent&&g.originalEvent.changedTouches&&g.originalEvent.changedTouches[0]&&
  (e=g.originalEvent.changedTouches[0].clientX,h=g.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){f(g.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(g){c&&g.originalEvent&&g.originalEvent.changedTouches&&g.originalEvent.changedTouches[0]&&(10<Math.abs(e-g.originalEvent.changedTouches[0].clientX)||10<Math.abs(h-g.originalEvent.changedTouches[0].clientY))&&(clearTimeout(c),f.vakata.context.hide())}).on("touchend.vakata.jstree",function(g){c&&clearTimeout(c)});
  f(z).on("context_hide.vakata.jstree",f.proxy(function(g,k){this._data.contextmenu.visible=!1;f(k.reference).removeClass("jstree-context")},this))};this.teardown=function(){this._data.contextmenu.visible&&f.vakata.context.hide();d.teardown.call(this)};this.show_contextmenu=function(b,c,e,h){b=this.get_node(b);if(!b||b.id===f.jstree.root)return!1;var g=this.settings.contextmenu,k=this.get_node(b,!0).children(".jstree-anchor"),l=!1;l=!1;if(g.show_at_node||c===E||e===E)l=k.offset(),c=l.left,e=l.top+this._data.core.li_height;
  this.settings.contextmenu.select_node&&!this.is_selected(b)&&this.activate_node(b,h);l=g.items;f.isFunction(l)&&(l=l.call(this,b,f.proxy(function(m){this._show_contextmenu(b,c,e,m)},this)));f.isPlainObject(l)&&this._show_contextmenu(b,c,e,l)};this._show_contextmenu=function(b,c,e,h){var g=this.get_node(b,!0).children(".jstree-anchor");f(z).one("context_show.vakata.jstree",f.proxy(function(k,l){k="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";f(l.element).addClass(k);g.addClass("jstree-context")},
  this));this._data.contextmenu.visible=!0;f.vakata.context.show(g,{x:c,y:e},h);this.trigger("show_contextmenu",{node:b,x:c,y:e})}};(function(a){var d=!1,b=!1,c=!1,e=0,h=0,g=[],k="",l=!1;a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(m){a(z).triggerHandler("context_"+m+".vakata",{reference:c,element:b,position:{x:e,y:h}})},_execute:function(m){return(m=g[m])&&(!m._disabled||a.isFunction(m._disabled)&&!m._disabled({item:m,reference:c,element:b}))&&m.action?m.action.call(null,
  {item:m,reference:c,element:b,position:{x:e,y:h}}):!1},_parse:function(m,n){if(!m)return!1;n||(k="",g=[]);var q="",r=!1,u;n&&(q+="<ul>");a.each(m,function(w,p){if(!p)return!0;g.push(p);!r&&p.separator_before&&(q+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>");r=!1;q+="<li class='"+(p._class||"")+(!0===p._disabled||a.isFunction(p._disabled)&&p._disabled({item:p,reference:c,element:b})?" vakata-contextmenu-disabled ":
  "")+"' "+(p.shortcut?" data-shortcut='"+p.shortcut+"' ":"")+">";q+="<a href='#' rel='"+(g.length-1)+"' "+(p.title?"title='"+p.title+"'":"")+">";a.vakata.context.settings.icons&&(q+="<i ",p.icon&&(q=-1!==p.icon.indexOf("/")||-1!==p.icon.indexOf(".")?q+(" style='background:url(\""+p.icon+"\") center center no-repeat' "):q+(" class='"+p.icon+"' ")),q+="></i><span class='vakata-contextmenu-sep'>&#160;</span>");q+=(a.isFunction(p.label)?p.label({item:w,reference:c,element:b}):p.label)+(p.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+
  p.shortcut+'">'+(p.shortcut_label||"")+"</span>":"")+"</a>";p.submenu&&(u=a.vakata.context._parse(p.submenu,!0))&&(q+=u);q+="</li>";p.separator_after&&(q+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",r=!0)});q=q.replace(/<li class='vakata-context-separator'><\/li>$/,"");n&&(q+="</ul>");n||(k=q,a.vakata.context._trigger("parse"));return 10<q.length?q:!1},_show_submenu:function(m){m=a(m);if(m.length&&m.children("ul").length){var n=
  m.children("ul"),q=m.offset().left,r=q+m.outerWidth(),u=m.offset().top,w=n.width(),p=n.height(),A=a(window).width()+a(window).scrollLeft(),I=a(window).height()+a(window).scrollTop();if(d)m[0>r-(w+10+m.outerWidth())?"addClass":"removeClass"]("vakata-context-left");else m[r+w>A&&q>A-r?"addClass":"removeClass"]("vakata-context-right");u+p+10>I&&n.css("bottom","-1px");m.hasClass("vakata-context-right")?q<w&&n.css("margin-right",q-w):A-r<w&&n.css("margin-left",A-r-w);n.show()}},show:function(m,n,q){b&&
  b.length&&b.width("");switch(!0){case !n&&!m:return!1;case !!n&&!!m:c=m;e=n.x;h=n.y;break;case !n&&!!m:c=m;n=m.offset();e=n.left+m.outerHeight();h=n.top;break;case !!n&&!m:e=n.x,h=n.y}m&&!q&&a(m).data("vakata_contextmenu")&&(q=a(m).data("vakata_contextmenu"));a.vakata.context._parse(q)&&b.html(k);if(g.length){b.appendTo(z.body);q=b;n=e;var r=h;var u=q.width();var w=q.height();var p=a(window).width()+a(window).scrollLeft();var A=a(window).height()+a(window).scrollTop();d&&(n-=q.outerWidth()-a(m).outerWidth(),
  n<a(window).scrollLeft()+20&&(n=a(window).scrollLeft()+20));n+u+20>p&&(n=p-(u+20));r+w+20>A&&(r=A-(w+20));b.css({left:n,top:r}).show().find("a").first().focus().parent().addClass("vakata-context-hover");l=!0;a.vakata.context._trigger("show")}},hide:function(){l&&(b.hide().find("ul").hide().end().find(":focus").blur().end().detach(),l=!1,a.vakata.context._trigger("hide"))}};a(function(){d="rtl"===a(z.body).css("direction");var m=!1;b=a("<ul class='vakata-context'></ul>");b.on("mouseenter","li",function(n){n.stopImmediatePropagation();
  a.contains(this,n.relatedTarget)||(m&&clearTimeout(m),b.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(n){a.contains(this,n.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(n){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
  a.vakata.context.settings.hide_onmouseleave&&(m=setTimeout(function(q){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(n){n.preventDefault();a(this).blur().parent().hasClass("vakata-context-disabled")||!1===a.vakata.context._execute(a(this).attr("rel"))||a.vakata.context.hide()}).on("keydown","a",function(n){switch(n.which){case 13:case 32:n.type="click";n.preventDefault();a(n.currentTarget).trigger(n);break;case 37:l&&(b.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),
  n.stopImmediatePropagation(),n.preventDefault());break;case 38:if(l){var q=b.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first();q.length||(q=b.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last());q.addClass("vakata-context-hover").children("a").focus();n.stopImmediatePropagation();n.preventDefault()}break;case 39:l&&(b.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),
  n.stopImmediatePropagation(),n.preventDefault());break;case 40:l&&(q=b.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),q.length||(q=b.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),q.addClass("vakata-context-hover").children("a").focus(),n.stopImmediatePropagation(),n.preventDefault());break;case 27:a.vakata.context.hide(),n.preventDefault()}}).on("keydown",
  function(n){n.preventDefault();n=b.find(".vakata-contextmenu-shortcut-"+n.which).parent();n.parent().not(".vakata-context-disabled")&&n.click()});a(z).on("mousedown.vakata.jstree",function(n){l&&b[0]!==n.target&&!a.contains(b[0],n.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(n,q){b.find("li:has(ul)").children("a").addClass("vakata-context-parent");d&&b.addClass("vakata-context-rtl").css("direction","rtl");b.find("ul").hide().end()})})})(f);f.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};var L,G;f.jstree.plugins.dnd=function(a,d){this.init=function(b,c){d.init.call(this,b,c);this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in z.createElement("span")};this.bind=function(){d.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",f.proxy(function(b){if(this.settings.dnd.large_drag_target&&f(b.target).closest(".jstree-node")[0]!==b.currentTarget||"touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!f(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),e=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,h=1<e?e+" "+this.get_string("nodes"):
  this.get_text(b.currentTarget);this.settings.core.force_text&&(h=f.vakata.html.escape(h));if(c&&c.id&&c.id!==f.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(!0===this.settings.dnd.is_draggable||f.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,1<e?this.get_top_selected(!0):[c],b)))if(L={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:1<e?this.get_top_selected():[c.id]},G=b.currentTarget,this.settings.dnd.use_html5)f.vakata.dnd._trigger("start",
  b,{helper:f(),element:G,data:L});else return this.element.trigger("mousedown.jstree"),f.vakata.dnd.start(b,L,'<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>'+h+'<ins class="jstree-copy" style="display:none;">+</ins></div>')},this));if(this.settings.dnd.use_html5)this.element.on("dragover.jstree",function(b){b.preventDefault();
  f.vakata.dnd._trigger("move",b,{helper:f(),element:G,data:L});return!1}).on("drop.jstree",f.proxy(function(b){b.preventDefault();f.vakata.dnd._trigger("stop",b,{helper:f(),element:G,data:L});return!1},this))};this.redraw_node=function(b,c,e,h){if((b=d.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)b.setAttribute("draggable",!0);else{var g,k=null;var l=0;for(g=b.childNodes.length;l<g;l++)if(b.childNodes[l]&&b.childNodes[l].className&&-1!==b.childNodes[l].className.indexOf("jstree-anchor")){k=
  b.childNodes[l];break}k&&k.setAttribute("draggable",!0)}return b}};f(function(){var a=!1,d=!1,b=!1,c=!1,e=f('<div id="jstree-marker">&#160;</div>').hide();f(z).on("dragover.vakata.jstree",function(h){G&&f.vakata.dnd._trigger("move",h,{helper:f(),element:G,data:L})}).on("drop.vakata.jstree",function(h){G&&(f.vakata.dnd._trigger("stop",h,{helper:f(),element:G,data:L}),L=G=null)}).on("dnd_start.vakata.jstree",function(h,g){b=a=!1;g&&g.data&&g.data.jstree&&e.appendTo(z.body)}).on("dnd_move.vakata.jstree",
  function(h,g){var k=g.event.target!==b.target;c&&(!g.event||"dragover"!==g.event.type||k)&&clearTimeout(c);if(g&&g.data&&g.data.jstree&&(!g.event.target.id||"jstree-marker"!==g.event.target.id)){b=g.event;var l=f.jstree.reference(g.event.target),m=!1,n=!1;h=!1;var q,r,u,w,p,A,I,R,J,N,M;if(l&&l._data&&l._data.dnd){e.attr("class","jstree-"+l.get_theme()+(l.settings.core.themes.responsive?" jstree-dnd-responsive":""));var O=g.data.origin&&(g.data.origin.settings.dnd.always_copy||g.data.origin.settings.dnd.copy&&
  (g.event.metaKey||g.event.ctrlKey));g.helper.children().attr("class","jstree-"+l.get_theme()+" jstree-"+l.get_theme()+"-"+l.get_theme_variant()+" "+(l.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[O?"show":"hide"]();if(g.event.target!==l.element[0]&&g.event.target!==l.get_container_ul()[0]||0!==l.get_container_ul().children().length){if((m=l.settings.dnd.large_drop_target?f(g.event.target).closest(".jstree-node").children(".jstree-anchor"):f(g.event.target).closest(".jstree-anchor"))&&
  m.length&&m.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")){n=m.offset();h=(g.event.pageY!==E?g.event.pageY:g.event.originalEvent.pageY)-n.top;var T=m.outerHeight();var H=h<T/3?["b","i","a"]:h>T-T/3?["a","i","b"]:h>T/2?["i","a","b"]:["i","b","a"];f.each(H,function(B,Q){switch(Q){case "b":q=n.left-6;r=n.top;u=l.get_parent(m);w=m.parent().index();break;case "i":J=l.settings.dnd.inside_pos;N=l.get_node(m.parent());q=n.left-2;r=n.top+T/2+1;u=N.id;w="first"===J?0:"last"===J?N.children.length:
  Math.min(J,N.children.length);break;case "a":q=n.left-6,r=n.top+T,u=l.get_parent(m),w=m.parent().index()+1}S=!0;x=0;for(p=g.data.nodes.length;x<p;x++)if(A=g.data.origin&&(g.data.origin.settings.dnd.always_copy||g.data.origin.settings.dnd.copy&&(g.event.metaKey||g.event.ctrlKey))?"copy_node":"move_node",I=w,"move_node"===A&&"a"===Q&&g.data.origin&&g.data.origin===l&&u===l.get_parent(g.data.nodes[x])&&(R=l.get_node(u),I>f.inArray(g.data.nodes[x],R.children)&&--I),S=S&&(l&&l.settings&&l.settings.dnd&&
  !1===l.settings.dnd.check_while_dragging||l.check(A,g.data.origin&&g.data.origin!==l?g.data.origin.get_node(g.data.nodes[x]):g.data.nodes[x],u,I,{dnd:!0,ref:l.get_node(m.parent()),pos:Q,origin:g.data.origin,is_multi:g.data.origin&&g.data.origin!==l,is_foreign:!g.data.origin})),!S){l&&l.last_error&&(d=l.last_error());break}"i"===Q&&m.parent().is(".jstree-closed")&&l.settings.dnd.open_timeout&&(!g.event||"dragover"!==g.event.type||k)&&(c&&clearTimeout(c),c=setTimeout(function(V,F){return function(){V.open_node(F)}}(l,
  m),l.settings.dnd.open_timeout));if(S)return M=l.get_node(u,!0),M.hasClass(".jstree-dnd-parent")||(f(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),M.addClass("jstree-dnd-parent")),a={ins:l,par:u,pos:"i"!==Q||"last"!==J||0!==w||l.is_loaded(N)?w:"last"},e.css({left:q+"px",top:r+"px"}).show(),g.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),g.event.originalEvent&&g.event.originalEvent.dataTransfer&&(g.event.originalEvent.dataTransfer.dropEffect=O?"copy":"move"),
  d={},H=!0,!1});if(!0===H)return}}else{var S=!0;var x=0;for(p=g.data.nodes.length;x<p&&(S=S&&l.check(g.data.origin&&(g.data.origin.settings.dnd.always_copy||g.data.origin.settings.dnd.copy&&(g.event.metaKey||g.event.ctrlKey))?"copy_node":"move_node",g.data.origin&&g.data.origin!==l?g.data.origin.get_node(g.data.nodes[x]):g.data.nodes[x],f.jstree.root,"last",{dnd:!0,ref:l.get_node(f.jstree.root),pos:"i",origin:g.data.origin,is_multi:g.data.origin&&g.data.origin!==l,is_foreign:!g.data.origin}),S);x++);
  if(S){a={ins:l,par:f.jstree.root,pos:"last"};e.hide();g.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok");g.event.originalEvent&&g.event.originalEvent.dataTransfer&&(g.event.originalEvent.dataTransfer.dropEffect=O?"copy":"move");return}}}f(".jstree-dnd-parent").removeClass("jstree-dnd-parent");a=!1;g.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er");e.hide()}}).on("dnd_scroll.vakata.jstree",function(h,g){g&&g.data&&g.data.jstree&&(e.hide(),
  b=a=!1,g.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(h,g){f(".jstree-dnd-parent").removeClass("jstree-dnd-parent");c&&clearTimeout(c);if(g&&g.data&&g.data.jstree){e.hide().detach();var k,l=[];if(a){h=0;for(k=g.data.nodes.length;h<k;h++)l[h]=g.data.origin?g.data.origin.get_node(g.data.nodes[h]):g.data.nodes[h];a.ins[g.data.origin&&(g.data.origin.settings.dnd.always_copy||g.data.origin.settings.dnd.copy&&(g.event.metaKey||
  g.event.ctrlKey))?"copy_node":"move_node"](l,a.par,a.pos,!1,!1,!1,g.data.origin)}else h=f(g.event.target).closest(".jstree"),h.length&&d&&d.error&&"check"===d.error&&(h=h.jstree(!0))&&h.settings.core.error.call(this,d);a=b=!1}}).on("keyup.jstree keydown.jstree",function(h,g){(g=f.vakata.dnd._get())&&g.data&&g.data.jstree&&("keyup"===h.type&&27===h.which?(c&&clearTimeout(c),c=b=d=a=!1,e.hide().detach(),f.vakata.dnd._clean()):(g.helper.find(".jstree-copy").first()[g.data.origin&&(g.data.origin.settings.dnd.always_copy||
  g.data.origin.settings.dnd.copy&&(h.metaKey||h.ctrlKey))?"show":"hide"](),b&&(b.metaKey=h.metaKey,b.ctrlKey=h.ctrlKey,f.vakata.dnd._trigger("move",b))))})});(function(a){a.vakata.html={div:a("<div />"),escape:function(p){return a.vakata.html.div.text(p).html()},strip:function(p){return a.vakata.html.div.empty().append(a.parseHTML(p)).text()}};var d=!1,b=!1,c=!1,e=!1,h=!1,g=0,k=!1,l=0,m=0,n=0,q=0,r=!1,u=!1,w=!1;a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,
  threshold:5,threshold_touch:10},_trigger:function(p,A,I){I===E&&(I=a.vakata.dnd._get());I.event=A;a(z).triggerHandler("dnd_"+p+".vakata",I)},_get:function(){return{data:k,element:d,helper:h}},_clean:function(){h&&h.remove();u&&(clearInterval(u),u=!1);h=e=c=b=d=!1;g=0;k=!1;q=n=m=l=0;w=u=r=!1;a(z).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag);a(z).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(p){if(!r||!n&&!q)return u&&(clearInterval(u),
  u=!1),!1;if(!u)return u=setInterval(a.vakata.dnd._scroll,100),!1;if(!0===p)return!1;p=r.scrollTop();var A=r.scrollLeft();r.scrollTop(p+q*a.vakata.dnd.settings.scroll_speed);r.scrollLeft(A+n*a.vakata.dnd.settings.scroll_speed);p===r.scrollTop()&&A===r.scrollLeft()||a.vakata.dnd._trigger("scroll",r)},start:function(p,A,I){"touchstart"===p.type&&p.originalEvent&&p.originalEvent.changedTouches&&p.originalEvent.changedTouches[0]&&(p.pageX=p.originalEvent.changedTouches[0].pageX,p.pageY=p.originalEvent.changedTouches[0].pageY,
  p.target=z.elementFromPoint(p.originalEvent.changedTouches[0].pageX-window.pageXOffset,p.originalEvent.changedTouches[0].pageY-window.pageYOffset));e&&a.vakata.dnd.stop({});try{p.currentTarget.unselectable="on",p.currentTarget.onselectstart=function(){return!1},p.currentTarget.style&&(p.currentTarget.style.touchAction="none",p.currentTarget.style.msTouchAction="none",p.currentTarget.style.MozUserSelect="none")}catch(R){}l=p.pageX;m=p.pageY;k=A;c=!0;d=p.currentTarget;b=p.target;w="touchstart"===p.type;
  !1!==I&&(h=a("<div id='vakata-dnd'></div>").html(I).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"}));a(z).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag);a(z).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop);return!1},drag:function(p){"touchmove"===p.type&&p.originalEvent&&p.originalEvent.changedTouches&&p.originalEvent.changedTouches[0]&&(p.pageX=p.originalEvent.changedTouches[0].pageX,p.pageY=
  p.originalEvent.changedTouches[0].pageY,p.target=z.elementFromPoint(p.originalEvent.changedTouches[0].pageX-window.pageXOffset,p.originalEvent.changedTouches[0].pageY-window.pageYOffset));if(c){if(!e)if(Math.abs(p.pageX-l)>(w?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(p.pageY-m)>(w?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold))h&&(h.appendTo(z.body),g=h.outerWidth()),e=!0,a(b).one("click.vakata",!1),a.vakata.dnd._trigger("start",p);else return;
  var A=!1,I=!1,R=!1,J=!1,N=!1,M=I=!1,O=!1;J=A=!1;n=q=0;r=!1;a(a(p.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var T=a(this),H=T.offset();this.scrollHeight>this.offsetHeight&&(H.top+T.height()-p.pageY<a.vakata.dnd.settings.scroll_proximity&&(q=1),p.pageY-H.top<a.vakata.dnd.settings.scroll_proximity&&(q=-1));this.scrollWidth>this.offsetWidth&&
  (H.left+T.width()-p.pageX<a.vakata.dnd.settings.scroll_proximity&&(n=1),p.pageX-H.left<a.vakata.dnd.settings.scroll_proximity&&(n=-1));if(q||n)return r=a(this),!1});!r&&(A=a(z),I=a(window),R=A.height(),J=I.height(),N=A.width(),I=I.width(),M=A.scrollTop(),O=A.scrollLeft(),R>J&&p.pageY-M<a.vakata.dnd.settings.scroll_proximity&&(q=-1),R>J&&J-(p.pageY-M)<a.vakata.dnd.settings.scroll_proximity&&(q=1),N>I&&p.pageX-O<a.vakata.dnd.settings.scroll_proximity&&(n=-1),N>I&&I-(p.pageX-O)<a.vakata.dnd.settings.scroll_proximity&&
  (n=1),q||n)&&(r=A);r&&a.vakata.dnd._scroll(!0);h&&(A=parseInt(p.pageY+a.vakata.dnd.settings.helper_top,10),J=parseInt(p.pageX+a.vakata.dnd.settings.helper_left,10),R&&A+25>R&&(A=R-50),N&&J+g>N&&(J=N-(g+2)),h.css({left:J+"px",top:A+"px"}));a.vakata.dnd._trigger("move",p);return!1}},stop:function(p){"touchend"===p.type&&p.originalEvent&&p.originalEvent.changedTouches&&p.originalEvent.changedTouches[0]&&(p.pageX=p.originalEvent.changedTouches[0].pageX,p.pageY=p.originalEvent.changedTouches[0].pageY,
  p.target=z.elementFromPoint(p.originalEvent.changedTouches[0].pageX-window.pageXOffset,p.originalEvent.changedTouches[0].pageY-window.pageYOffset));if(e)p.target!==b&&a(b).off("click.vakata"),a.vakata.dnd._trigger("stop",p);else if("touchend"===p.type&&p.target===b){var A=setTimeout(function(){a(p.target).click()},100);a(p.target).one("click",function(){A&&clearTimeout(A)})}a.vakata.dnd._clean();return!1}}})(f);f.jstree.defaults.massload=null;f.jstree.plugins.massload=function(a,d){this.init=function(b,
  c){this._data.massload={};d.init.call(this,b,c)};this._load_nodes=function(b,c,e,h){var g=this.settings.massload;JSON.stringify(b);var k=[],l=this._model.data,m,n;if(!e){var q=0;for(m=b.length;q<m;q++)if(!l[b[q]]||!l[b[q]].state.loaded&&!l[b[q]].state.failed||h)k.push(b[q]),(n=this.get_node(b[q],!0))&&n.length&&n.addClass("jstree-loading").attr("aria-busy",!0);this._data.massload={};if(k.length){if(f.isFunction(g))return g.call(this,k,f.proxy(function(r){if(r)for(u in r)r.hasOwnProperty(u)&&(this._data.massload[u]=
  r[u]);var u=0;for(r=b.length;u<r;u++)(n=this.get_node(b[u],!0))&&n.length&&n.removeClass("jstree-loading").attr("aria-busy",!1);d._load_nodes.call(this,b,c,e,h)},this));if("object"===typeof g&&g&&g.url)return g=f.extend(!0,{},g),f.isFunction(g.url)&&(g.url=g.url.call(this,k)),f.isFunction(g.data)&&(g.data=g.data.call(this,k)),f.ajax(g).done(f.proxy(function(r,u,w){if(r)for(p in r)r.hasOwnProperty(p)&&(this._data.massload[p]=r[p]);var p=0;for(r=b.length;p<r;p++)(n=this.get_node(b[p],!0))&&n.length&&
  n.removeClass("jstree-loading").attr("aria-busy",!1);d._load_nodes.call(this,b,c,e,h)},this)).fail(f.proxy(function(r){d._load_nodes.call(this,b,c,e,h)},this))}}return d._load_nodes.call(this,b,c,e,h)};this._load_node=function(b,c){var e=this._data.massload[b.id],h=null;return e?(h=this["string"===typeof e?"_append_html_data":"_append_json_data"](b,"string"===typeof e?f(f.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(g){c.call(this,g)}),(e=this.get_node(b.id,!0))&&e.length&&
  e.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],h):d._load_node.call(this,b,c)}};f.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};f.jstree.plugins.search=function(a,d){this.bind=function(){d.bind.call(this);this._data.search.str="";this._data.search.dom=f();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",f.proxy(function(b,c){if(this._data.search.som&&c.res.length){b=this._model.data;var e,h=[],g;var k=0;for(e=c.res.length;k<e;k++)if(b[c.res[k]]&&!b[c.res[k]].state.hidden&&(h.push(c.res[k]),h=h.concat(b[c.res[k]].parents),this._data.search.smc)){var l=0;for(g=b[c.res[k]].children_d.length;l<g;l++)b[b[c.res[k]].children_d[l]]&&!b[b[c.res[k]].children_d[l]].state.hidden&&h.push(b[c.res[k]].children_d[l])}h=f.vakata.array_remove_item(f.vakata.array_unique(h),
  f.jstree.root);this._data.search.hdn=this.hide_all(!0);this.show_node(h,!0);this.redraw(!0)}},this)).on("clear_search.jstree",f.proxy(function(b,c){this._data.search.som&&c.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))};this.search=function(b,c,e,h,g,k){if(!1===b||""===f.trim(b.toString()))return this.clear_search();h=(h=this.get_node(h))&&h.id?h.id:null;b=b.toString();var l=this.settings.search,m=l.ajax?l.ajax:!1,n=this._model.data,q=null,r=[],u=[],w;this._data.search.res.length&&
  !g&&this.clear_search();e===E&&(e=l.show_only_matches);k===E&&(k=l.show_only_matches_children);if(!c&&!1!==m){if(f.isFunction(m))return m.call(this,b,f.proxy(function(p){p&&p.d&&(p=p.d);this._load_nodes(f.isArray(p)?f.vakata.array_unique(p):[],function(){this.search(b,!0,e,h,g,k)})},this),h);m=f.extend({},m);m.data||(m.data={});m.data.str=b;h&&(m.data.inside=h);this._data.search.lastRequest&&this._data.search.lastRequest.abort();this._data.search.lastRequest=f.ajax(m).fail(f.proxy(function(){this._data.core.last_error=
  {error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(m)};this.settings.core.error.call(this,this._data.core.last_error)},this)).done(f.proxy(function(p){p&&p.d&&(p=p.d);this._load_nodes(f.isArray(p)?f.vakata.array_unique(p):[],function(){this.search(b,!0,e,h,g,k)})},this));return this._data.search.lastRequest}g||(this._data.search.str=b,this._data.search.dom=f(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=
  k);q=new f.vakata.search(b,!0,{caseSensitive:l.case_sensitive,fuzzy:l.fuzzy});f.each(n[h?h:f.jstree.root].children_d,function(p,A){p=n[A];p.text&&!p.state.hidden&&(!l.search_leaves_only||p.state.loaded&&0===p.children.length)&&(l.search_callback&&l.search_callback.call(this,b,p)||!l.search_callback&&q.search(p.text).isMatch)&&(r.push(A),u=u.concat(p.parents))});if(r.length){u=f.vakata.array_unique(u);c=0;for(w=u.length;c<w;c++)u[c]!==f.jstree.root&&n[u[c]]&&!0===this.open_node(u[c],null,0)&&this._data.search.opn.push(u[c]);
  g?(this._data.search.dom=this._data.search.dom.add(f(this.element[0].querySelectorAll("#"+f.map(r,function(p){return-1!=="0123456789".indexOf(p[0])?"\\3"+p[0]+" "+p.substr(1).replace(f.jstree.idregex,"\\$&"):p.replace(f.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=f.vakata.array_unique(this._data.search.res.concat(r))):(this._data.search.dom=f(this.element[0].querySelectorAll("#"+f.map(r,function(p){return-1!=="0123456789".indexOf(p[0])?"\\3"+p[0]+" "+p.substr(1).replace(f.jstree.idregex,
  "\\$&"):p.replace(f.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=r);this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:b,res:this._data.search.res,show_only_matches:e})};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=f(this.element[0].querySelectorAll("#"+f.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(f.jstree.idregex,"\\$&"):b.replace(f.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=f()};this.redraw_node=function(b,c,e,h){if((b=d.redraw_node.apply(this,arguments))&&
  -1!==f.inArray(b.id,this._data.search.res)){var g,k=null;var l=0;for(g=b.childNodes.length;l<g;l++)if(b.childNodes[l]&&b.childNodes[l].className&&-1!==b.childNodes[l].className.indexOf("jstree-anchor")){k=b.childNodes[l];break}k&&(k.className+=" jstree-search")}return b}};(function(a){a.vakata.search=function(d,b,c){c=c||{};c=a.extend({},a.vakata.search.defaults,c);!1!==c.fuzzy&&(c.fuzzy=!0);d=c.caseSensitive?d:d.toLowerCase();var e=c.location,h=c.distance,g=c.threshold,k=d.length;32<k&&(c.fuzzy=
  !1);if(c.fuzzy){var l=1<<k-1;var m=function(){var r={},u;for(u=0;u<k;u++)r[d.charAt(u)]=0;for(u=0;u<k;u++)r[d.charAt(u)]|=1<<k-u-1;return r}();var n=function(r,u){r/=k;u=Math.abs(e-u);return h?r+u/h:u?1:r}}var q=function(r){r=c.caseSensitive?r:r.toLowerCase();if(d===r||-1!==r.indexOf(d))return{isMatch:!0,score:0};if(!c.fuzzy)return{isMatch:!1,score:1};var u,w=r.length,p=g,A=r.indexOf(d,e),I,R=k+w,J=1,N=[];-1!==A&&(p=Math.min(n(0,A),p),A=r.lastIndexOf(d,e+k),-1!==A&&(p=Math.min(n(0,A),p)));A=-1;for(u=
  0;u<k;u++){var M=0;for(I=R;M<I;)n(u,e+I)<=p?M=I:R=I,I=Math.floor((R-M)/2+M);R=I;M=Math.max(1,e-I+1);var O=Math.min(e+I,w)+k;I=Array(O+2);for(I[O+1]=(1<<u)-1;O>=M;O--){var T=m[r.charAt(O-1)];I[O]=0===u?(I[O+1]<<1|1)&T:(I[O+1]<<1|1)&T|(H[O+1]|H[O])<<1|1|H[O+1];if(I[O]&l&&(J=n(u,O-1),J<=p))if(p=J,A=O-1,N.push(A),A>e)M=Math.max(1,2*e-A);else break}if(n(u+1,e)>p)break;var H=I}return{isMatch:0<=A,score:J}};return!0===b?{search:q}:q(b)};a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,
  caseSensitive:!1}})(f);f.jstree.defaults.sort=function(a,d){return this.get_text(a)>this.get_text(d)?1:-1};f.jstree.plugins.sort=function(a,d){this.bind=function(){d.bind.call(this);this.element.on("model.jstree",f.proxy(function(b,c){this.sort(c.parent,!0)},this)).on("rename_node.jstree create_node.jstree",f.proxy(function(b,c){this.sort(c.parent||c.node.parent,!1);this.redraw_node(c.parent||c.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",f.proxy(function(b,c){this.sort(c.parent,
  !1);this.redraw_node(c.parent,!0)},this))};this.sort=function(b,c){var e;if((b=this.get_node(b))&&b.children&&b.children.length&&(b.children.sort(f.proxy(this.settings.sort,this)),c))for(c=0,e=b.children_d.length;c<e;c++)this.sort(b.children_d[c],!1)}};var P=!1;f.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};f.jstree.plugins.state=function(a,d){this.bind=function(){d.bind.call(this);
  var b=f.proxy(function(){this.element.on(this.settings.state.events,f.proxy(function(){P&&clearTimeout(P);P=setTimeout(f.proxy(function(){this.save_state()},this),100)},this));this.trigger("state_ready")},this);this.element.on("ready.jstree",f.proxy(function(c,e){this.element.one("restore_state.jstree",b);this.restore_state()||b()},this))};this.save_state=function(){var b=this.get_state();this.settings.state.preserve_loaded||delete b.core.loaded;f.vakata.storage.set(this.settings.state.key,JSON.stringify({state:b,
  ttl:this.settings.state.ttl,sec:+new Date}))};this.restore_state=function(){var b=f.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}if(b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl)return!1;b&&b.state&&(b=b.state);b&&f.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b));return b?(this.settings.state.preserve_loaded||delete b.core.loaded,this.element.one("set_state.jstree",function(c,e){e.instance.trigger("restore_state",{state:f.extend(!0,
  {},b)})}),this.set_state(b),!0):!1};this.clear_state=function(){return f.vakata.storage.del(this.settings.state.key)}};(function(a,d){a.vakata.storage={set:function(b,c){return window.localStorage.setItem(b,c)},get:function(b){return window.localStorage.getItem(b)},del:function(b){return window.localStorage.removeItem(b)}}})(f);f.jstree.defaults.types={"default":{}};f.jstree.defaults.types[f.jstree.root]={};f.jstree.plugins.types=function(a,d){this.init=function(b,c){var e,h;if(c&&c.types&&c.types["default"])for(e in c.types)if("default"!==
  e&&e!==f.jstree.root&&c.types.hasOwnProperty(e))for(h in c.types["default"])c.types["default"].hasOwnProperty(h)&&c.types[e][h]===E&&(c.types[e][h]=c.types["default"][h]);d.init.call(this,b,c);this._model.data[f.jstree.root].type=f.jstree.root};this.refresh=function(b,c){d.refresh.call(this,b,c);this._model.data[f.jstree.root].type=f.jstree.root};this.bind=function(){this.element.on("model.jstree",f.proxy(function(b,c){b=this._model.data;c=c.nodes;var e=this.settings.types,h,g;var k=0;for(h=c.length;k<
  h;k++){var l="default";b[c[k]].original&&b[c[k]].original.type&&e[b[c[k]].original.type]&&(l=b[c[k]].original.type);b[c[k]].data&&b[c[k]].data.jstree&&b[c[k]].data.jstree.type&&e[b[c[k]].data.jstree.type]&&(l=b[c[k]].data.jstree.type);b[c[k]].type=l;!0===b[c[k]].icon&&e[l].icon!==E&&(b[c[k]].icon=e[l].icon);if(e[l].li_attr!==E&&"object"===typeof e[l].li_attr)for(g in e[l].li_attr)e[l].li_attr.hasOwnProperty(g)&&"id"!==g&&(b[c[k]].li_attr[g]===E?b[c[k]].li_attr[g]=e[l].li_attr[g]:"class"===g&&(b[c[k]].li_attr["class"]=
  e[l].li_attr["class"]+" "+b[c[k]].li_attr["class"]));if(e[l].a_attr!==E&&"object"===typeof e[l].a_attr)for(g in e[l].a_attr)e[l].a_attr.hasOwnProperty(g)&&"id"!==g&&(b[c[k]].a_attr[g]===E?b[c[k]].a_attr[g]=e[l].a_attr[g]:"href"===g&&"#"===b[c[k]].a_attr[g]?b[c[k]].a_attr.href=e[l].a_attr.href:"class"===g&&(b[c[k]].a_attr["class"]=e[l].a_attr["class"]+" "+b[c[k]].a_attr["class"]))}b[f.jstree.root].type=f.jstree.root},this));d.bind.call(this)};this.get_json=function(b,c,e){var h=this._model.data,g=
  c?f.extend(!0,{},c,{no_id:!1}):{};g=d.get_json.call(this,b,g,e);if(!1===g)return!1;if(f.isArray(g))for(b=0,e=g.length;b<e;b++)g[b].type=g[b].id&&h[g[b].id]&&h[g[b].id].type?h[g[b].id].type:"default",c&&c.no_id&&(delete g[b].id,g[b].li_attr&&g[b].li_attr.id&&delete g[b].li_attr.id,g[b].a_attr&&g[b].a_attr.id&&delete g[b].a_attr.id);else g.type=g.id&&h[g.id]&&h[g.id].type?h[g.id].type:"default",c&&c.no_id&&(g=this._delete_ids(g));return g};this._delete_ids=function(b){if(f.isArray(b)){for(var c=0,e=
  b.length;c<e;c++)b[c]=this._delete_ids(b[c]);return b}delete b.id;b.li_attr&&b.li_attr.id&&delete b.li_attr.id;b.a_attr&&b.a_attr.id&&delete b.a_attr.id;b.children&&f.isArray(b.children)&&(b.children=this._delete_ids(b.children));return b};this.check=function(b,c,e,h,g){if(!1===d.check.call(this,b,c,e,h,g))return!1;c=c&&c.id?c:this.get_node(c);e=e&&e.id?e:this.get_node(e);g=c&&c.id?g&&g.origin?g.origin:f.jstree.reference(c.id):null;var k,l;g=g&&g._model&&g._model.data?g._model.data:null;switch(b){case "create_node":case "move_node":case "copy_node":if("move_node"!==
  b||-1===f.inArray(c.id,e.children)){var m=this.get_rules(e);if(m.max_children!==E&&-1!==m.max_children&&m.max_children===e.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})},!1;if(m.valid_children!==E&&-1!==m.valid_children&&-1===f.inArray(c.type||"default",m.valid_children))return this._data.core.last_error={error:"check",plugin:"types",
  id:"types_02",reason:"valid_children prevents function: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})},!1;if(g&&c.children_d&&c.parents){var n=k=0;for(l=c.children_d.length;n<l;n++)k=Math.max(k,g[c.children_d[n]].parents.length);k=k-c.parents.length+1}if(0>=k||k===E)k=1;do{if(m.max_depth!==E&&-1!==m.max_depth&&m.max_depth<k)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+b,data:JSON.stringify({chk:b,
  pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})},!1;e=this.get_node(e.parent);m=this.get_rules(e);k++}while(e)}}return!0};this.get_rules=function(b){b=this.get_node(b);if(!b)return!1;b=this.get_type(b,!0);b.max_depth===E&&(b.max_depth=-1);b.max_children===E&&(b.max_children=-1);b.valid_children===E&&(b.valid_children=-1);return b};this.get_type=function(b,c){return(b=this.get_node(b))?c?f.extend({type:b.type},this.settings.types[b.type]):b.type:!1};this.set_type=function(b,c){var e=this._model.data,
  h,g,k,l;if(f.isArray(b)){b=b.slice();e=0;for(h=b.length;e<h;e++)this.set_type(b[e],c);return!0}h=this.settings.types;b=this.get_node(b);if(!h[c]||!b)return!1;(k=this.get_node(b,!0))&&k.length&&(l=k.children(".jstree-anchor"));var m=b.type;var n=this.get_icon(b);b.type=c;(!0===n||!h[m]||h[m].icon!==E&&n===h[m].icon)&&this.set_icon(b,h[c].icon!==E?h[c].icon:!0);if(h[m]&&h[m].li_attr!==E&&"object"===typeof h[m].li_attr)for(g in h[m].li_attr)h[m].li_attr.hasOwnProperty(g)&&"id"!==g&&("class"===g?(e[b.id].li_attr["class"]=
  (e[b.id].li_attr["class"]||"").replace(h[m].li_attr[g],""),k&&k.removeClass(h[m].li_attr[g])):e[b.id].li_attr[g]===h[m].li_attr[g]&&(e[b.id].li_attr[g]=null,k&&k.removeAttr(g)));if(h[m]&&h[m].a_attr!==E&&"object"===typeof h[m].a_attr)for(g in h[m].a_attr)h[m].a_attr.hasOwnProperty(g)&&"id"!==g&&("class"===g?(e[b.id].a_attr["class"]=(e[b.id].a_attr["class"]||"").replace(h[m].a_attr[g],""),l&&l.removeClass(h[m].a_attr[g])):e[b.id].a_attr[g]===h[m].a_attr[g]&&("href"===g?(e[b.id].a_attr[g]="#",l&&l.attr("href",
  "#")):(delete e[b.id].a_attr[g],l&&l.removeAttr(g))));if(h[c].li_attr!==E&&"object"===typeof h[c].li_attr)for(g in h[c].li_attr)h[c].li_attr.hasOwnProperty(g)&&"id"!==g&&(e[b.id].li_attr[g]===E?(e[b.id].li_attr[g]=h[c].li_attr[g],k&&("class"===g?k.addClass(h[c].li_attr[g]):k.attr(g,h[c].li_attr[g]))):"class"===g&&(e[b.id].li_attr["class"]=h[c].li_attr[g]+" "+e[b.id].li_attr["class"],k&&k.addClass(h[c].li_attr[g])));if(h[c].a_attr!==E&&"object"===typeof h[c].a_attr)for(g in h[c].a_attr)h[c].a_attr.hasOwnProperty(g)&&
  "id"!==g&&(e[b.id].a_attr[g]===E?(e[b.id].a_attr[g]=h[c].a_attr[g],l&&("class"===g?l.addClass(h[c].a_attr[g]):l.attr(g,h[c].a_attr[g]))):"href"===g&&"#"===e[b.id].a_attr[g]?(e[b.id].a_attr.href=h[c].a_attr.href,l&&l.attr("href",h[c].a_attr.href)):"class"===g&&(e[b.id].a_attr["class"]=h[c].a_attr["class"]+" "+e[b.id].a_attr["class"],l&&l.addClass(h[c].a_attr[g])));return!0}};f.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(a,d){return a+" ("+d+")"}};f.jstree.plugins.unique=
  function(a,d){this.check=function(b,c,e,h,g){if(!1===d.check.call(this,b,c,e,h,g))return!1;c=c&&c.id?c:this.get_node(c);e=e&&e.id?e:this.get_node(e);if(!e||!e.children)return!0;var k="rename_node"===b?h:c.text,l=[],m=this.settings.unique.case_sensitive,n=this.settings.unique.trim_whitespace,q=this._model.data,r;var u=0;for(r=e.children.length;u<r;u++){var w=q[e.children[u]].text;m||(w=w.toLowerCase());n&&(w=w.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));l.push(w)}m||(k=k.toLowerCase());n&&(k=
  k.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));switch(b){case "rename_node":return w=c.text||"",m||(w=w.toLowerCase()),n&&(w=w.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),u=-1===f.inArray(k,l)||c.text&&w===k,u||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+k+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),u;case "create_node":return u=-1===f.inArray(k,l),u||(this._data.core.last_error=
  {error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+k+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),u;case "copy_node":return u=-1===f.inArray(k,l),u||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+k+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),u;case "move_node":return u=c.parent===e.id&&(!g||!g.is_multi)||
  -1===f.inArray(k,l),u||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+k+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:h,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),u}return!0};this.create_node=function(b,c,e,h,g){if(!c||c.text===E){null===b&&(b=f.jstree.root);b=this.get_node(b);if(!b)return d.create_node.call(this,b,c,e,h,g);e=e===E?"last":e;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(b))return d.create_node.call(this,
  b,c,e,h,g);c||={};var k,l,m=this._model.data,n=this.settings.unique.case_sensitive,q=this.settings.unique.trim_whitespace,r=this.settings.unique.duplicate;var u=k=this.get_string("New node");var w=[];var p=0;for(l=b.children.length;p<l;p++){var A=m[b.children[p]].text;n||(A=A.toLowerCase());q&&(A=A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));w.push(A)}p=1;A=u;n||(A=A.toLowerCase());for(q&&(A=A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==f.inArray(A,w);)A=u=r.call(this,k,++p).toString(),
  n||(A=A.toLowerCase()),q&&(A=A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));c.text=u}return d.create_node.call(this,b,c,e,h,g)}};var U=z.createElement("DIV");U.setAttribute("unselectable","on");U.setAttribute("role","presentation");U.className="jstree-wholerow";U.innerHTML="&#160;";f.jstree.plugins.wholerow=function(a,d){this.bind=function(){d.bind.call(this);this.element.on("ready.jstree set_state.jstree",f.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",
  f.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",f.proxy(function(b,c){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",f.proxy(function(b,c){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var e;var h=0;for(e=c.selected.length;h<e;h++)(b=this.get_node(c.selected[h],!0))&&b.length&&b.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},
  this)).on("open_node.jstree",f.proxy(function(b,c){this.get_node(c.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",f.proxy(function(b,c){if("hover_node"!==b.type||!this.is_disabled(c.node))this.get_node(c.node,!0).children(".jstree-wholerow")["hover_node"===b.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",f.proxy(function(b){if(this._data.contextmenu){b.preventDefault();
  var c=f.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});f(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=f.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});f(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",
  ".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=f.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});f(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",f.proxy(function(b){b.stopImmediatePropagation();var c=f.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});f(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},
  this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",f.proxy(function(b){b.stopImmediatePropagation();this.is_disabled(b.currentTarget)||this.hover_node(b.currentTarget);return!1},this)).on("mouseleave.jstree",".jstree-node",f.proxy(function(b){this.dehover_node(b.currentTarget)},this))};this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove();d.teardown.call(this)};this.redraw_node=function(b,c,e,h){if(b=d.redraw_node.apply(this,arguments)){var g=U.cloneNode(!0);
  -1!==f.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked");this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered");b.insertBefore(g,b.childNodes[0])}return b}};if(window.customElements&&Object&&Object.create){D=Object.create(HTMLElement.prototype);D.createdCallback=function(){var a={core:{},plugins:[]},d;for(d in f.jstree.plugins)f.jstree.plugins.hasOwnProperty(d)&&this.attributes[d]&&(a.plugins.push(d),this.getAttribute(d)&&
  JSON.parse(this.getAttribute(d))&&(a[d]=JSON.parse(this.getAttribute(d))));for(d in f.jstree.defaults.core)f.jstree.defaults.core.hasOwnProperty(d)&&this.attributes[d]&&(a.core[d]=JSON.parse(this.getAttribute(d))||this.getAttribute(d));f(this).jstree(a)};try{window.customElements.define("vakata-jstree",function(){},{prototype:D})}catch(a){}}}});
  (function(f,E){var W=0;f.widget("s3.hierarchicalopts",{options:{selected:null,multiple:!0,leafonly:!0,cascade:!1,bulkSelect:!1,cascadeOptionInTree:!0,noneSelectedText:"Select",selectedText:"selected",noOptionsText:"No options available",selectAllText:"Select All",deselectAllText:"Deselect All",icons:!1,stripes:!0,htmlTitles:!0},_create:function(){var t=f(this.element),v=this.options;this.id=W;W+=1;this._namespace=".hierarchicalopts"+W;this.treeID=t.attr("id")+"-tree";this.input=t.find(".s3-hierarchy-input").first();
  this.input.data("input",!0);var y=v.selected;y&&this.input.val(this._stringifySelection(y));this.button=f('<button type="button" class="s3-hierarchy-button ui-multiselect ui-widget ui-state-default ui-corner-all"><span class="ui-icon ui-icon-triangle-1-s"></span></button>');this.buttonText=f("<span>"+v.noneSelectedText+"</span>").appendTo(this.button);this.noopts=f('<span class="no-options-available">'+v.noOptionsText+"</span>").hide();this.tree=t.find(".s3-hierarchy-tree").first();this.wrapper=this.tree.closest(".s3-hierarchy-wrapper").hide().before(this.noopts).before(this.button).detach().appendTo("body");
  this.manualCascadeOption=this._isBulk=this._isOpen=!1},_init:function(){this.refresh()},_destroy:function(){f.Widget.prototype.destroy.call(this);this._unbindEvents();f(this.button).remove();f(this.noopts).remove();f(this.tree).detach().appendTo(this.element).show()},refresh:function(){this._unbindEvents();var t=this.options,v=this.tree,y=this;if(v.find("li").length){this.noopts.hide();this.button.show();this.input.next(".error_wrapper").insertAfter(this.button).one("click",function(){f(this).fadeOut()});
  var C=this.input.val();if(C){C=this._parseSelection(C);var D=this.treeID;f.each(C,function(){f("#"+D+"-"+this).data("jstree",{selected:!0})})}C=v.find("> ul > li");if(1==C.length){C=C.first();var z=C.data("jstree");C.data("jstree",f.extend({},z,{opened:!0}))}C=t.multiple;z=t.leafonly;var K=t.cascade,L=!1,G=null,P=["sort","checkbox"];this.input.data("multiple",C);(K||z)&&C?L=!0:C&&(t.cascadeOptionInTree?this.manualCascadeOption=!0:(G=function(a){return v.jstree("is_parent",a)?(f.vakata.context.settings.icons=
  !1,{select_all:{label:y.options.selectAllText,icon:!1,action:function(d){y._selectBranch(a)}},deselect_all:{label:y.options.deselectAllText,icon:!1,action:function(d){y._deselectBranch(a)}}}):null},P.push("contextmenu")));v.jstree({core:{themes:{name:"s3",icons:t.icons,stripes:t.stripes},animation:100,multiple:C,check_callback:!0},checkbox:{three_state:L},sort:function(a,d){var b=this.get_text(a)>this.get_text(d)?1:-1;try{var c=this.get_node(a).li_attr.rel}catch(h){c=null}try{var e=this.get_node(d).li_attr.rel}catch(h){e=
  null}return"bulk"==c?-1:"bulk"==e?1:"none"==c?-1:"none"==e?1:b},contextmenu:{items:G,select_node:!1,icons:!1},plugins:P});var U=jQuery.jstree.reference(v);C&&((t.bulkSelect||this.manualCascadeOption)&&t.cascadeOptionInTree?(this.wrapper.find(".s3-hierarchy-header").hide(),U.create_node("#",{id:this.treeID+"-select-all",text:t.selectAllText,li_attr:{rel:"bulk","class":"s3-hierarchy-action-node"}},"first")):this.wrapper.find(".s3-hierarchy-header").removeClass("hide").show());v.on("ready.jstree",function(){var a=
  U.get_checked();y._updateButtonText(a)});this._bindEvents()}else this.button.hide(),this.noopts.show()},_setOption:function(t,v){if("selected"===t){var y=jQuery.jstree.reference(f(this.tree));if(y&&(y.uncheck_all(),v)){this.input.val(this._stringifySelection(v));var C=this.treeID;f.each(v,function(){y.check_node("#"+C+"-"+this)});this._updateButtonText(v)}}this._super(t,v)},_updateSelectedNodes:function(){var t=jQuery.jstree.reference(f(this.tree)),v=this._parseSelection(this.input.val()),y=[],C=
  [],D=this.options.leafonly,z=t.get_checked(!0);f(z).each(function(){var L=f(this).attr("id");if("bulk"!=f(this).attr("rel")&&L&&(!D||t.is_leaf(this))){var G=L.split("-").pop();"None"!=G&&(G=parseInt(G));G&&(y.push(G),C.push(L))}});z=!1;var K=f(y).not(v).get();K.length?z=!0:(K=f(v).not(y).get(),K.length&&(z=!0));v=this.input.val(this._stringifySelection(y));this._updateButtonText(C);z&&(v.change(),f(this.element).trigger("select.s3hierarchy"));return!0},_updateButtonText:function(t){var v=this.options,
  y=0;t&&(y=t.length);if(y)if(1<y)t=v.selectedText.replace("#",y);else{for(var C=[],D=0;D<y;D++)C.push(f("#"+t[D]+" > a").text().replace(/^\s+|\s+$/g,""));t=C.length?C.join(" "):v.noneSelectedText}else t=v.noneSelectedText;this.buttonText.text(t)},_updateAndClose:function(){if(!this._isBulk){this._updateSelectedNodes();var t=this.wrapper,v=this;if(v.options.multiple)t.unbind("mouseleave.hierarchicalopts").one("mouseleave.hierarchicalopts",function(){window.setTimeout(function(){v.closeMenu()},100)});
  else window.setTimeout(function(){v.closeMenu()},100)}},_selectNode:function(t){var v=this.options,y=jQuery.jstree.reference(f(this.tree)),C=v.multiple,D=v.leafonly;if(C)this._isBulk||"bulk"!=t.li_attr.rel||((v=y.get_parent(t))&&"#"!=v?(v=y.get_node(v),this._selectBranch(v,!0)):y.select_all());else{var z=t.id;f(y.get_checked(!0)).each(function(){z==this.id||D&&!y.is_leaf(this)||y.uncheck_node(this)})}if(D&&!C&&!y.is_leaf(t))return y.deselect_node(t),!1;this._updateAndClose()},_deselectNode:function(t){var v=
  jQuery.jstree.reference(f(this.tree));if(!this._isBulk){if("bulk"==t.li_attr.rel)(t=v.get_parent(t))&&"#"!=t?(t=v.get_node(t),this._deselectBranch(t,!0)):v.deselect_all();else if(t=v.get_parent(t))if(t=v.get_node(t+"-select-all"))this._isBulk=!0,v.uncheck_node(t),this._isBulk=!1;if(t=v.get_node(this.treeID+"-select-all"))this._isBulk=!0,v.uncheck_node(t),this._isBulk=!1}this._updateSelectedNodes()},_openNode:function(t){var v=jQuery.jstree.reference(f(this.tree)),y=v.get_parent(t);y.length&&v.open_node(y,
  !1,!0);if(this.manualCascadeOption){var C=t.id;y=v.get_node(C+"-select-all");y||(t=v.create_node(t,{id:C+"-select-all",text:this.options.selectAllText,li_attr:{rel:"bulk","class":"s3-hierarchy-action-node"}},"first"),y=v.get_node(t));(t=v.get_node(this.treeID+"-select-all"))&&v.is_checked(t)&&(this._isBulk=!0,v.check_node(y),this._isBulk=!1)}},_selectBranch:function(t,v){var y=jQuery.jstree.reference(f(this.tree)),C=this;this._isBulk=!0;y.open_node(t,function(){var D=y.get_children_dom(t);f(D).each(function(){C._selectBranch(this)});
  v||y.check_node(t)});this._isBulk=!1;this._updateAndClose()},_deselectBranch:function(t,v){var y=jQuery.jstree.reference(f(this.tree)),C=this;this._isBulk=!0;y.open_node(t,function(){var D=y.get_children_dom(t);f(D).each(function(){C._deselectBranch(this)});v||y.uncheck_node(t)});this._isBulk=!1;this._updateSelectedNodes()},set:function(t){var v=jQuery.jstree.reference(f(this.tree)),y=this.treeID;this._isBulk=!0;v.uncheck_all();v.close_all();if(t){var C=function(D,z){if(D=v.get_parent(D))"#"!=D?(C(D),
  v.open_node(D,z)):z&&z()};t.forEach(function(D){var z=v.get_node(y+"-"+D);z&&C(z,function(){v.check_node(z)})})}this._isBulk=!1;this._updateSelectedNodes()},get:function(){return this._parseSelection(this.input.val())},reset:function(){var t=jQuery.jstree.reference(f(this.tree));this._isBulk=!0;t.uncheck_all();t.close_all();this._isBulk=!1;this._updateSelectedNodes();return!0},_setMenuPosition:function(t,v){var y=v.offset(),C={position:"absolute",top:y.top+v.outerHeight(),minWidth:v.outerWidth()-
  8};"rtl"===f("body").css("direction")?C.right=f(window).width()-(y.left+v.outerWidth()):C.left=y.left;t.css(C)},openMenu:function(){this._isOpen&&this.closeMenu();var t=f(this.button),v=f(this.wrapper),y=this;this._setMenuPosition(v,t);f(window).on("resize"+this._namespace+"-mpos",function(){y._setMenuPosition(v,t)});v.show();f(this.tree).jstree("set_focus");this._isOpen=!0;t.addClass("ui-state-active");f(this).trigger("open")},closeMenu:function(){f(window).off(this._namespace+"-mpos");f(this.tree).jstree("unset_focus").unbind("click.hierarchicalopts").unbind("mouseleave.hierarchicalopts");
  f(this.wrapper).fadeOut(50);this._isOpen=!1;f(this.button).removeClass("ui-state-active");f(this).trigger("close")},addNode:function(t,v,y,C){var D=this.tree,z=this.treeID,K="#";t&&(K=f("#"+z+"-"+t),K.length||(K="#"));v=z+"-"+v;D.jstree("create_node",K,{id:v,text:y,li_attr:{rel:"leaf"}},"last");t&&(K.attr({rel:"parent"}),D.jstree("open_node",K));C&&D.jstree("check_node",f("#"+v))},_parseSelection:function(t){if(t)t=JSON.parse(t);else return[];t?t.constructor!==Array&&(t=[t]):t=[];return t},_stringifySelection:function(t){if(!this.options.multiple)if(t.length)t=
  t[0];else return"";return JSON.stringify(t)},_bindEvents:function(){var t=this,v=f(this.wrapper),y=f(this.tree),C=f(this.button),D=this._namespace,z=this.options,K=jQuery.jstree.reference(y),L=f.vakata.context.settings.icons;f(document).bind("context_show.vakata",function(){v.unbind("mouseleave.hierarchicalopts");f.vakata.context.settings.icons=L});y.bind("select_node.jstree",function(G,P){t._selectNode(P.node)}).bind("deselect_node.jstree",function(G,P){t._deselectNode(P.node)}).bind("open_node.jstree",
  function(G,P){t._openNode(P.node)});C.bind("click"+D,function(){t._isOpen?t.closeMenu():t.openMenu()}).bind("keyup"+D,function(G){G.preventDefault();switch(G.keyCode){case 27:case 38:case 37:t.closeMenu();break;case 39:case 40:t.openMenu()}}).bind("mouseenter"+D,function(){C.hasClass("ui-state-disabled")||f(this).addClass("ui-state-hover")}).bind("mouseleave"+D,function(){f(this).removeClass("ui-state-hover")}).bind("focus"+D,function(){C.hasClass("ui-state-disabled")||f(this).addClass("ui-state-focus")}).bind("blur"+
  D,function(){f(this).removeClass("ui-state-focus")});z.multiple&&z.bulkSelect&&!z.cascadeOptionInTree&&(v.find(".s3-hierarchy-select-all").bind("click"+D,function(G){G.preventDefault();K.select_all();t._updateSelectedNodes()}),v.find(".s3-hierarchy-deselect-all").bind("click"+D,function(G){G.preventDefault();K.deselect_all();t._updateSelectedNodes()}),v.find(".s3-hierarchy-header").bind("click"+D,function(G){G.preventDefault();G.stopPropagation()}).bind("mousedown"+D,function(G){G.preventDefault();
  G.stopPropagation()}));f(document).bind("mousedown"+D,function(G){var P=G.target;if(f(".jstree-contextmenu").has(P).length||3==G.which)return v.unbind("mouseleave.hierarchicalopts"),!0;y.is(P)||C.is(P)||0!==y.has(P).length||0!==C.has(P).length||t.closeMenu()});return!0},_unbindEvents:function(){var t=f(this.tree);f(this.button);var v=this._namespace;t.unbind("select_node.jstree").unbind("deselect_node.jstree").unbind("loaded.jstree").unbind("open_node.jstree");f(this.button).unbind(v);f(document).unbind(v);
  return!0}})})(jQuery);
  (function(f,E){var W=0;f.widget("s3.hierarchicalcrud",{options:{widgetID:null,ajaxURL:null,openLabel:"Open",openURL:null,editTitle:"Edit Record",editLabel:"Edit",editURL:null,deleteLabel:"Delete",deleteURL:null,deleteRoot:!0,addTitle:"Add Record",addLabel:"Add",addURL:null,icons:!1,stripes:!0,htmlTitles:!0},_create:function(){this.treeID=f(this.element).attr("id")+"-tree";this.id=W;W+=1},_init:function(){this.tree=f(this.element).find(".s3-hierarchy-tree");this.refresh()},_destroy:function(){f.Widget.prototype.destroy.call(this)},refresh:function(){var t=
  this.tree,v=this.options;this._unbindEvents();var y=t.find("> ul > li");if(1==y.length){y=y.first();var C=y.data("jstree");y.data("jstree",f.extend({},C,{opened:!0}))}var D=this;t.jstree({core:{themes:{name:"s3",icons:v.icons,stripes:v.stripes},animation:100,multiple:!1,check_callback:!0},contextmenu:{items:function(z){var K=!0;"#"==t.jstree(!0).get_parent(z)&&(K=v.deleteRoot);var L={open:{label:D.options.openLabel,action:function(G){D._openNode(z)},separator_after:!0}};v.editURL&&(L.edit={label:D.options.editLabel,
  action:function(G){D._editNode(z)}});K&&v.deleteURL&&(L.delete={label:D.options.deleteLabel,separator_after:!0,action:function(G){D._deleteNode(z)}});v.addURL&&(L.add={label:D.options.addLabel,action:function(G){D._addNode(z)}});return L},select_node:!0},plugins:["sort","contextmenu"]});this._bindEvents()},_openNode:function(t){var v=this.options.openURL;t=t.id;v&&t&&(t=parseInt(t.split("-").pop()))&&(v=v.replace("[id]",t).replace("%5Bid%5D",t),window.location.href=v)},refreshNode:function(t){var v=
  this.options.ajaxURL,y=t.attr("id");if(v&&y&&(y=parseInt(y.split("-").pop()))){var C=this.tree,D=this.treeID;f.getJSONS3(v+"?node="+y,function(z){z.label&&C.jstree("rename_node",t,z.label);if(z=z.children){C.jstree("open_node",t,!1,!1);for(var K,L,G,P=0,U=0,a=z.length;U<a;U++)K=z[U],L=D+"-"+K.node,(G=C.jstree("get_node","#"+L,!0))?C.jstree("rename_node",G,K.label):(C.jstree("create_node",t,{id:L,text:K.label,li_attr:{rel:"leaf"}}),P++);P&&(C.jstree("open_node",t),t.attr({rel:"parent"}))}})}},_editNode:function(t){var v=
  this.options.editURL;t=t.id;if(v&&t){var y=parseInt(t.split("-").pop());y&&(v=v.replace("[id]",y).replace("%5Bid%5D",y).split("?")[0],v+="?node="+t+"&hierarchy="+this.options.widgetID,t=S3.uid(),v=f('<iframe id="'+t+'" src='+v+" onload=\"S3.popup_loaded('"+t+'\')" class="loading" marginWidth="0" marginHeight="0" frameBorder="0"></iframe>').appendTo("body"),this._openPopup(v,this.options.editTitle))}},_addNode:function(t){var v=this.options.addURL;t=t.id;if(v&&t){var y=parseInt(t.split("-").pop());
  y&&(v=v.split("?")[0],v+="?node="+t+"&link_to_parent="+y+"&hierarchy="+this.options.widgetID,t=S3.uid(),v=f('<iframe id="'+t+'" src='+v+" onload=\"S3.popup_loaded('"+t+'\')" class="loading" marginWidth="0" marginHeight="0" frameBorder="0"></iframe>').appendTo("body"),this._openPopup(v,this.options.addTitle))}},_deleteNode:function(t){if(!confirm(i18n.delete_confirmation))return!1;var v=this.options.deleteURL,y=t.id,C=this.tree;v&&y&&(y=parseInt(y.split("-").pop()))&&(v=v.replace("[id]",y).replace("%5Bid%5D",
  y).split("?")[0],f.ajaxS3({type:"POST",url:v+"?recursive=1",data:{},dataType:"JSON",success:function(D){C.jstree("delete_node",t)},error:function(D,z,K){z=D.responseText;if("{"==z[0])try{z=JSON.parse(D.responseText),S3.showAlert(z.message,"error")}catch(L){}}}))},_openPopup:function(t,v){t.dialog({close:function(y,C){if(self.parent){var D=self.parent.$("iframe.ui-dialog-content"),z=D.width();D.width(0);window.setTimeout(function(){D.width(z)},300)}t.remove()},minHeight:480,modal:!0,open:function(y,
  C){f(".ui-widget-overlay").bind("click",function(){t.dialog("close")})},title:v,minWidth:320,closeText:""})},_bindEvents:function(){return!0},_unbindEvents:function(){return!0}})})(jQuery);
  