/
bundle.admin.pagetree.min.js
1 lines (1 loc) · 171 KB
/
bundle.admin.pagetree.min.js
1
cmsWebpackJsonp([1],{103:function(e,t,i){var r=i(1)("iterator"),s=!1;try{var n=[7][r]();n.return=function(){s=!0},Array.from(n,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!s)return!1;var i=!1;try{var n=[7],a=n[r]();a.next=function(){return{done:i=!0}},n[r]=function(){return a},e(n)}catch(e){}return i}},104:function(e,t){function i(e){if(null!=e){try{return s.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var r=Function.prototype,s=r.toString;e.exports=i},106:function(e,t){function i(e){return function(t){return e(t)}}e.exports=i},107:function(e,t,i){function r(e,t){return!!(null==e?0:e.length)&&s(e,t,0)>-1}var s=i(180);e.exports=r},108:function(e,t){function i(e,t,i,r){for(var s=e.length,n=i+(r?1:-1);r?n--:++n<s;)if(t(e[n],n,e))return n;return-1}e.exports=i},109:function(e,t){function i(e,t,i){for(var r=-1,s=null==e?0:e.length;++r<s;)if(i(t,e[r]))return!0;return!1}e.exports=i},110:function(e,t,i){function r(e,t){return a(n(e,t,s),e+"")}var s=i(63),n=i(183),a=i(185);e.exports=r},111:function(e,t,i){function r(e){return n(e)&&s(e)}var s=i(52),n=i(24);e.exports=r},147:function(e,t,i){"use strict";t.__esModule=!0;var r=i(148),s=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return(0,s.default)(e)}},148:function(e,t,i){e.exports={default:i(149),__esModule:!0}},149:function(e,t,i){i(20),i(150),e.exports=i(2).Array.from},150:function(e,t,i){"use strict";var r=i(19),s=i(8),n=i(27),a=i(98),o=i(99),d=i(49),c=i(151),l=i(57);s(s.S+s.F*!i(103)(function(e){Array.from(e)}),"Array",{from:function(e){var t,i,s,h,_=n(e),u="function"==typeof this?this:Array,g=arguments.length,f=g>1?arguments[1]:void 0,p=void 0!==f,m=0,v=l(_);if(p&&(f=r(f,g>2?arguments[2]:void 0,2)),void 0==v||u==Array&&o(v))for(t=d(_.length),i=new u(t);t>m;m++)c(i,m,p?f(_[m],m):_[m]);else for(h=v.call(_),i=new u;!(s=h.next()).done;m++)c(i,m,p?a(h,f,[s.value,m],!0):s.value);return i.length=m,i}})},151:function(e,t,i){"use strict";var r=i(4),s=i(18);e.exports=function(e,t,i){t in e?r.f(e,t,s(0,i)):e[t]=i}},153:function(e,t){function i(){this.__data__=[],this.size=0}e.exports=i},154:function(e,t,i){function r(e){var t=this.__data__,i=s(t,e);return!(i<0)&&(i==t.length-1?t.pop():a.call(t,i,1),--this.size,!0)}var s=i(32),n=Array.prototype,a=n.splice;e.exports=r},155:function(e,t,i){function r(e){var t=this.__data__,i=s(t,e);return i<0?void 0:t[i][1]}var s=i(32);e.exports=r},156:function(e,t,i){function r(e){return s(this.__data__,e)>-1}var s=i(32);e.exports=r},157:function(e,t,i){function r(e,t){var i=this.__data__,r=s(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var s=i(32);e.exports=r},158:function(e,t,i){function r(e){return!(!a(e)||n(e))&&(s(e)?g:c).test(o(e))}var s=i(82),n=i(159),a=i(15),o=i(104),d=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Function.prototype,h=Object.prototype,_=l.toString,u=h.hasOwnProperty,g=RegExp("^"+_.call(u).replace(d,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},159:function(e,t,i){function r(e){return!!n&&n in e}var s=i(160),n=function(){var e=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=r},160:function(e,t,i){var r=i(12),s=r["__core-js_shared__"];e.exports=s},161:function(e,t){function i(e,t){return null==e?void 0:e[t]}e.exports=i},162:function(e,t,i){function r(){this.size=0,this.__data__={hash:new s,map:new(a||n),string:new s}}var s=i(163),n=i(61),a=i(81);e.exports=r},163:function(e,t,i){function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}var s=i(164),n=i(165),a=i(166),o=i(167),d=i(168);r.prototype.clear=s,r.prototype.delete=n,r.prototype.get=a,r.prototype.has=o,r.prototype.set=d,e.exports=r},164:function(e,t,i){function r(){this.__data__=s?s(null):{},this.size=0}var s=i(33);e.exports=r},165:function(e,t){function i(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=i},166:function(e,t,i){function r(e){var t=this.__data__;if(s){var i=t[e];return i===n?void 0:i}return o.call(t,e)?t[e]:void 0}var s=i(33),n="__lodash_hash_undefined__",a=Object.prototype,o=a.hasOwnProperty;e.exports=r},167:function(e,t,i){function r(e){var t=this.__data__;return s?void 0!==t[e]:a.call(t,e)}var s=i(33),n=Object.prototype,a=n.hasOwnProperty;e.exports=r},168:function(e,t,i){function r(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=s&&void 0===t?n:t,this}var s=i(33),n="__lodash_hash_undefined__";e.exports=r},169:function(e,t,i){function r(e){var t=s(this,e).delete(e);return this.size-=t?1:0,t}var s=i(34);e.exports=r},170:function(e,t){function i(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=i},171:function(e,t,i){function r(e){return s(this,e).get(e)}var s=i(34);e.exports=r},172:function(e,t,i){function r(e){return s(this,e).has(e)}var s=i(34);e.exports=r},173:function(e,t,i){function r(e,t){var i=s(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var s=i(34);e.exports=r},174:function(e,t){function i(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=i},175:function(e,t){function i(e){return this.__data__.has(e)}e.exports=i},179:function(e,t,i){function r(e,t,i,r){var h=-1,_=n,u=!0,g=e.length,f=[],p=t.length;if(!g)return f;i&&(t=o(t,d(i))),r?(_=a,u=!1):t.length>=l&&(_=c,u=!1,t=new s(t));e:for(;++h<g;){var m=e[h],v=null==i?m:i(m);if(m=r||0!==m?m:0,u&&v===v){for(var j=p;j--;)if(t[j]===v)continue e;f.push(m)}else _(t,v,r)||f.push(m)}return f}var s=i(84),n=i(107),a=i(109),o=i(62),d=i(106),c=i(85),l=200;e.exports=r},180:function(e,t,i){function r(e,t,i){return t===t?a(e,t,i):s(e,n,i)}var s=i(108),n=i(181),a=i(182);e.exports=r},181:function(e,t){function i(e){return e!==e}e.exports=i},182:function(e,t){function i(e,t,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}e.exports=i},183:function(e,t,i){function r(e,t,i){return t=n(void 0===t?e.length-1:t,0),function(){for(var r=arguments,a=-1,o=n(r.length-t,0),d=Array(o);++a<o;)d[a]=r[t+a];a=-1;for(var c=Array(t+1);++a<t;)c[a]=r[a];return c[t]=i(d),s(e,this,c)}}var s=i(184),n=Math.max;e.exports=r},184:function(e,t){function i(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}e.exports=i},185:function(e,t,i){var r=i(186),s=i(189),n=s(r);e.exports=n},186:function(e,t,i){var r=i(187),s=i(188),n=i(63),a=s?function(e,t){return s(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:n;e.exports=a},187:function(e,t){function i(e){return function(){return e}}e.exports=i},188:function(e,t,i){var r=i(21),s=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=s},189:function(e,t){function i(e){var t=0,i=0;return function(){var a=n(),o=s-(a-i);if(i=a,o>0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var r=800,s=16,n=Date.now;e.exports=i},21:function(e,t,i){function r(e,t){var i=n(e,t);return s(i)?i:void 0}var s=i(158),n=i(161);e.exports=r},227:function(e,t,i){var r,s,n;!function(a){"use strict";s=[i(0)],r=a,void 0!==(n="function"==typeof r?r.apply(t,s):r)&&(e.exports=n)}(function(e,t){"use strict";if(!e.jstree){var i,r,s=0,n=!1,a=!1,o=!1,d=[],c=e("script:last").attr("src"),l=window.document,h=l.createElement("LI");h.setAttribute("role","treeitem"),i=l.createElement("I"),i.className="jstree-icon jstree-ocl",i.setAttribute("role","presentation"),h.appendChild(i),i=l.createElement("A"),i.className="jstree-anchor",i.setAttribute("href","#"),i.setAttribute("tabindex","-1"),r=l.createElement("I"),r.className="jstree-icon jstree-themeicon",r.setAttribute("role","presentation"),i.appendChild(r),h.appendChild(i),i=r=null,e.jstree={version:"{{VERSION}}",defaults:{plugins:[]},plugins:{},path:c&&-1!==c.indexOf("/")?c.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,i){var r=new e.jstree.core(++s),n=i;return i=e.extend(!0,{},e.jstree.defaults,i),n&&n.plugins&&(i.plugins=n.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(r=r.plugin(t,i[t]))}),e(t).data("jstree",r),r.init(t,i),r},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(l).off(".jstree")},e.jstree.core=function(e){this._id=e,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},e.jstree.reference=function(t){var i=null,r=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!r||!r.length)try{r=e(t)}catch(e){}if(!r||!r.length)try{r=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return r&&r.length&&(r=r.closest(".jstree")).length&&(r=r.data("jstree"))?i=r:e(".jstree").each(function(){var r=e(this).data("jstree");return r&&r._model.data[t]?(i=r,!1):void 0}),i},e.fn.jstree=function(i){var r="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=null;return!(!0===i&&!this.length)&&(this.each(function(){var a=e.jstree.reference(this),o=r&&a?a[i]:null;return n=r&&o?o.apply(a,s):null,a||r||i!==t&&!e.isPlainObject(i)||e.jstree.create(this,i),(a&&!r||!0===i)&&(n=a||!1),(null===n||n===t)&&void 0}),null!==n&&n!==t?n:this)},e.expr[":"].jstree=e.expr.createPseudo(function(i){return function(i){return e(i).hasClass("jstree")&&e(i).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0},e.jstree.core.prototype={plugin:function(t,i){var r=e.jstree.plugins[t];return r?(this._data[t]={},r.prototype=this,new r(i,this)):this},init:function(t,i){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=i,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='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().height()||24,this.trigger("loading"),this.load_node(e.jstree.root)},destroy:function(e){if(this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var t="",i=null,r=0;this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(l.selection&&l.selection.empty)l.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}}).on("mousedown.jstree",e.proxy(function(e){e.target===this.element[0]&&(e.preventDefault(),r=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(e){e.preventDefault()}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("dblclick.jstree",".jstree-anchor",e.proxy(function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),t.currentTarget!==l.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){if(t.target.tagName&&"input"===t.target.tagName.toLowerCase())return!0;if(32!==t.which&&13!==t.which&&(t.shiftKey||t.ctrlKey||t.altKey||t.metaKey))return!0;var i=null;switch(this._data.core.rtl&&(37===t.which?t.which=39:39===t.which&&(t.which=37)),t.which){case 32:t.ctrlKey&&(t.type="click",e(t.currentTarget).trigger(t));break;case 13:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(i=this.get_parent(t.currentTarget))&&i.id!==e.jstree.root&&this.get_node(i,!0).children(".jstree-anchor").focus();break;case 38:t.preventDefault(),(i=this.get_prev_dom(t.currentTarget))&&i.length&&i.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):this.is_open(t.currentTarget)&&(i=this.get_node(t.currentTarget,!0).children(".jstree-children")[0])&&e(this._firstChild(i)).children(".jstree-anchor").focus();break;case 40:t.preventDefault(),(i=this.get_next_dom(t.currentTarget))&&i.length&&i.children(".jstree-anchor").focus();break;case 106:this.open_all();break;case 36:t.preventDefault(),(i=this._firstChild(this.get_container_ul()[0]))&&e(i).children(".jstree-anchor").filter(":visible").focus();break;case 35:t.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus();break;case 113:t.preventDefault(),this.edit(t.currentTarget)}},this)).on("load_node.jstree",e.proxy(function(t,i){i.status&&(i.node.id!==e.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(e.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var t,i,r=[];for(t=0,i=this._data.core.selected.length;i>t;t++)r=r.concat(this._model.data[this._data.core.selected[t]].parents);for(r=e.vakata.array_unique(r),t=0,i=r.length;i>t;t++)this.open_node(r[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",e.proxy(function(r){if(r.target.tagName&&"input"===r.target.tagName.toLowerCase())return!0;i&&clearTimeout(i),i=setTimeout(function(){t=""},500);var s=String.fromCharCode(r.which).toLowerCase(),n=this.element.find(".jstree-anchor").filter(":visible"),a=n.index(l.activeElement)||0,o=!1;if(t+=s,t.length>1){if(n.slice(a).each(e.proxy(function(i,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),o=!0,!1):void 0},this)),o)return;if(n.slice(0,a).each(e.proxy(function(i,r){return 0===e(r).text().toLowerCase().indexOf(t)?(e(r).focus(),o=!0,!1):void 0},this)),o)return}if(new RegExp("^"+s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(n.slice(a+1).each(e.proxy(function(t,i){return e(i).text().toLowerCase().charAt(0)===s?(e(i).focus(),o=!0,!1):void 0},this)),o)return;if(n.slice(0,a+1).each(e.proxy(function(t,i){return e(i).text().toLowerCase().charAt(0)===s?(e(i).focus(),o=!0,!1):void 0},this)),o)return}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("blur.jstree",".jstree-anchor",e.proxy(function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){var i=this.get_node(t.currentTarget);i&&i.id&&(this._data.core.focused=i.id),this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",e.proxy(function(){if(+new Date-r>500&&!this._data.core.focused){r=0;var e=this.get_node(this.element.attr("aria-activedescendant"),!0);e&&e.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(l).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var i=this.settings.core.strings;return e.isFunction(i)?i.call(this,t):i&&i[t]?i[t]:t},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(t,i){t&&t.id&&(t=t.id);var r;try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(r=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=e(t,this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=e(t,this.element)).length||!r.hasClass("jstree"))return!1;t=this._model.data[e.jstree.root]}return i&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(e){return!1}},get_path:function(t,i,r){if(!(t=t.parents?t:this.get_node(t))||t.id===e.jstree.root||!t.parents)return!1;var s,n,a=[];for(a.push(r?t.id:t.text),s=0,n=t.parents.length;n>s;s++)a.push(r?t.parents[s]:this.get_text(t.parents[s]));return a=a.reverse().slice(1),i?a.join(i):a},get_next_dom:function(t,i){var r;if(t=this.get_node(t,!0),t[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(i){r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}if(t.hasClass("jstree-open")){for(r=this._firstChild(t.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return e(r)}r=t[0];do{r=this._nextSibling(r)}while(r&&0===r.offsetHeight);return null!==r?e(r):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,i){var r;if(t=this.get_node(t,!0),t[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&e(r)}if(!t||!t.length)return!1;if(i){r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);return!!r&&e(r)}r=t[0];do{r=this._previousSibling(r)}while(r&&0===r.offsetHeight);if(null!==r){for(t=e(r);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return!(!(r=t[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&e(r)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||e.children.length>0)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,i){var r,s,n,a,o;if(e.isArray(t))return this._load_nodes(t.slice(),i),!0;if(!(t=this.get_node(t)))return i&&i.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,n=0,a=t.parents.length;a>n;n++)this._model.data[t.parents[n]].children_d=e.vakata.array_filter(this._model.data[t.parents[n]].children_d,function(i){return-1===e.inArray(i,t.children_d)});for(r=0,s=t.children_d.length;s>r;r++)this._model.data[t.children_d[r]].state.selected&&(o=!0),delete this._model.data[t.children_d[r]];o&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(i){return-1===e.inArray(i,t.children_d)})),t.children=[],t.children_d=[],o&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy(function(e){t=this._model.data[t.id],t.state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var r=this.get_node(t,!0),s=0,n=0,a=this._model.data,o=!1;for(s=0,n=t.children.length;n>s;s++)if(a[t.children[s]]&&!a[t.children[s]].state.hidden){o=!0;break}t.state.loaded&&r&&r.length&&(r.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&r.addClass(t.state.opened?"jstree-open":"jstree-closed"):r.addClass("jstree-leaf")),r.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),i&&i.call(this,t,e)},this)),!0},_load_nodes:function(e,t,i,r){var s,n,a=!0,o=function(){this._load_nodes(e,t,!0)},d=this._model.data,c=[];for(s=0,n=e.length;n>s;s++)d[e[s]]&&(!d[e[s]].state.loaded&&!d[e[s]].state.failed||!i&&r)&&(this.is_loading(e[s])||this.load_node(e[s],o),a=!1);if(a){for(s=0,n=e.length;n>s;s++)d[e[s]]&&d[e[s]].state.loaded&&c.push(e[s]);t&&!t.done&&(t.call(this,c),t.done=!0)}},load_all:function(t,i){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,s,n=[],a=this._model.data,o=a[t.id].children_d;for(t.state&&!t.state.loaded&&n.push(t.id),r=0,s=o.length;s>r;r++)a[o[r]]&&a[o[r]].state&&!a[o[r]].state.loaded&&n.push(o[r]);n.length?this._load_nodes(n,function(){this.load_all(t,i)}):(i&&i.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,i){var r,s=this.settings.core.data;return s?e.isFunction(s)?s.call(this,t,e.proxy(function(r){!1===r?i.call(this,!1):this["string"==typeof r?"_append_html_data":"_append_json_data"](t,"string"==typeof r?e(e.parseHTML(r)).filter(function(){return 3!==this.nodeType}):r,function(e){i.call(this,e)})},this)):"object"==typeof s?s.url?(s=e.extend(!0,{},s),e.isFunction(s.url)&&(s.url=s.url.call(this,t)),e.isFunction(s.data)&&(s.data=s.data.call(this,t)),e.ajax(s).done(e.proxy(function(r,s,n){var a=n.getResponseHeader("Content-Type");return a&&-1!==a.indexOf("json")||"object"==typeof r?this._append_json_data(t,r,function(e){i.call(this,e)}):a&&-1!==a.indexOf("html")||"string"==typeof r?this._append_html_data(t,e(e.parseHTML(r)).filter(function(){return 3!==this.nodeType}),function(e){i.call(this,e)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:n})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))},this)).fail(e.proxy(function(e){i.call(this,!1),this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},this.settings.core.error.call(this,this._data.core.last_error)},this))):(r=e.isArray(s)||e.isPlainObject(s)?JSON.parse(JSON.stringify(s)):s,t.id===e.jstree.root?this._append_json_data(t,r,function(e){i.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))):"string"==typeof s?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(s)).filter(function(){return 3!==this.nodeType}),function(e){i.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1)):i.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),function(e){i.call(this,e)}):i.call(this,!1)},_node_changed:function(e){(e=this.get_node(e))&&this._model.changed.push(e.id)},_append_html_data:function(t,i,r){t=this.get_node(t),t.children=[],t.children_d=[];var s,n,a,o=i.is("ul")?i.children():i,d=t.id,c=[],l=[],h=this._model.data,_=h[d],u=this._data.core.selected.length;for(o.each(e.proxy(function(t,i){(s=this._parse_model_from_html(e(i),d,_.parents.concat()))&&(c.push(s),l.push(s),h[s].children_d.length&&(l=l.concat(h[s].children_d)))},this)),_.children=c,_.children_d=l,n=0,a=_.parents.length;a>n;n++)h[_.parents[n]].children_d=h[_.parents[n]].children_d.concat(l);this.trigger("model",{nodes:l,parent:d}),d!==e.jstree.root?(this._node_changed(d),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==u&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.call(this,!0)},_append_json_data:function(t,i,r,s){if(null!==this.element){t=this.get_node(t),t.children=[],t.children_d=[],i.d&&"string"==typeof(i=i.d)&&(i=JSON.parse(i)),e.isArray(i)||(i=[i]);var n=null,a={df:this._model.default_state,dat:i,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},o=function(e,t){e.data&&(e=e.data);var i,r,s,n,a=e.dat,o=e.par,d=[],c=[],l=[],h=e.df,_=e.t_id,u=e.t_cnt,g=e.m,f=g[o],p=e.sel,m=function(e,i,r){r=r?r.concat():[],i&&r.unshift(i);var s,n,a,o,d=e.id.toString(),c={id:d,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in h)h.hasOwnProperty(s)&&(c.state[s]=h[s]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(c.icon=e.data.jstree.icon),c.icon!==t&&null!==c.icon&&""!==c.icon||(c.icon=!0),e&&e.data&&(c.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(c.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(c.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(c.li_attr[s]=e.li_attr[s]);if(c.li_attr.id||(c.li_attr.id=d),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(c.a_attr[s]=e.a_attr[s]);for(e&&e.children&&!0===e.children&&(c.state.loaded=!1,c.children=[],c.children_d=[]),g[c.id]=c,s=0,n=c.children.length;n>s;s++)a=m(g[c.children[s]],c.id,r),o=g[a],c.children_d.push(a),o.children_d.length&&(c.children_d=c.children_d.concat(o.children_d));return delete e.data,delete e.children,g[c.id].original=e,c.state.selected&&l.push(c.id),c.id},v=function(e,i,r){r=r?r.concat():[],i&&r.unshift(i);var s,n,a,o,d,c=!1;do{c="j"+_+"_"+ ++u}while(g[c]);d={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in h)h.hasOwnProperty(s)&&(d.state[s]=h[s]);if(e&&e.id&&(d.id=e.id.toString()),e&&e.text&&(d.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),d.icon!==t&&null!==d.icon&&""!==d.icon||(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(d.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(d.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(d.li_attr[s]=e.li_attr[s]);if(d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString()),d.id||(d.id=c),d.li_attr.id||(d.li_attr.id=d.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(d.a_attr[s]=e.a_attr[s]);if(e&&e.children&&e.children.length){for(s=0,n=e.children.length;n>s;s++)a=v(e.children[s],d.id,r),o=g[a],d.children.push(a),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d));d.children_d=d.children_d.concat(d.children)}return e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),delete e.data,delete e.children,d.original=e,g[d.id]=d,d.state.selected&&l.push(d.id),d.id};if(a.length&&a[0].id!==t&&a[0].parent!==t){for(r=0,s=a.length;s>r;r++)a[r].children||(a[r].children=[]),g[a[r].id.toString()]=a[r];for(r=0,s=a.length;s>r;r++)g[a[r].parent.toString()].children.push(a[r].id.toString()),f.children_d.push(a[r].id.toString());for(r=0,s=f.children.length;s>r;r++)i=m(g[f.children[r]],o,f.parents.concat()),c.push(i),g[i].children_d.length&&(c=c.concat(g[i].children_d));for(r=0,s=f.parents.length;s>r;r++)g[f.parents[r]].children_d=g[f.parents[r]].children_d.concat(c);n={cnt:u,mod:g,sel:p,par:o,dpc:c,add:l}}else{for(r=0,s=a.length;s>r;r++)(i=v(a[r],o,f.parents.concat()))&&(d.push(i),c.push(i),g[i].children_d.length&&(c=c.concat(g[i].children_d)));for(f.children=d,f.children_d=c,r=0,s=f.parents.length;s>r;r++)g[f.parents[r]].children_d=g[f.parents[r]].children_d.concat(c);n={cnt:u,mod:g,sel:p,par:o,dpc:c,add:l}}return"undefined"!=typeof window&&void 0!==window.document?n:void postMessage(n)},d=function(t,i){if(null!==this.element){this._cnt=t.cnt;var s,n=this._model.data;for(s in n)n.hasOwnProperty(s)&&n[s].state&&n[s].state.loading&&t.mod[s]&&(t.mod[s].state.loading=!0);if(this._model.data=t.mod,i){var a,o=t.add,d=t.sel,c=this._data.core.selected.slice();if(n=this._model.data,d.length!==c.length||e.vakata.array_unique(d.concat(c)).length!==d.length){for(s=0,a=d.length;a>s;s++)-1===e.inArray(d[s],o)&&-1===e.inArray(d[s],c)&&(n[d[s]].state.selected=!1);for(s=0,a=c.length;a>s;s++)-1===e.inArray(c[s],d)&&(n[c[s]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.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 = "+o.toString()],{type:"text/javascript"}))),!this._data.core.working||s?(this._data.core.working=!0,n=new window.Worker(this._wrk),n.onmessage=e.proxy(function(e){d.call(this,e.data,!0);try{n.terminate(),n=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),a.par?n.postMessage(a):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,i,r,!0])}catch(e){d.call(this,o(a),!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 d.call(this,o(a),!1)}},_parse_model_from_html:function(i,r,s){s=s?[].concat(s):[],r&&s.unshift(r);var n,a,o,d,c,l=this._model.data,h={id:!1,text:!1,icon:!0,parent:r,parents:s,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(o in this._model.default_state)this._model.default_state.hasOwnProperty(o)&&(h.state[o]=this._model.default_state[o]);if(d=e.vakata.attributes(i,!0),e.each(d,function(t,i){return i=e.trim(i),!i.length||(h.li_attr[t]=i,void("id"===t&&(h.id=i.toString())))}),d=i.children("a").first(),d.length&&(d=e.vakata.attributes(d,!0),e.each(d,function(t,i){i=e.trim(i),i.length&&(h.a_attr[t]=i)})),d=i.children("a").first().length?i.children("a").first().clone():i.clone(),d.children("ins, i, ul").remove(),d=d.html(),d=e("<div />").html(d),h.text=this.settings.core.force_text?d.text():d.html(),d=i.data(),h.data=d?e.extend(!0,{},d):null,h.state.opened=i.hasClass("jstree-open"),h.state.selected=i.children("a").hasClass("jstree-clicked"),h.state.disabled=i.children("a").hasClass("jstree-disabled"),h.data&&h.data.jstree)for(o in h.data.jstree)h.data.jstree.hasOwnProperty(o)&&(h.state[o]=h.data.jstree[o]);d=i.children("a").children(".jstree-themeicon"),d.length&&(h.icon=!d.hasClass("jstree-themeicon-hidden")&&d.attr("rel")),h.state.icon!==t&&(h.icon=h.state.icon),h.icon!==t&&null!==h.icon&&""!==h.icon||(h.icon=!0),d=i.children("ul").children("li");do{c="j"+this._id+"_"+ ++this._cnt}while(l[c]);return h.id=h.li_attr.id?h.li_attr.id.toString():c,d.length?(d.each(e.proxy(function(t,i){n=this._parse_model_from_html(e(i),h.id,s),a=this._model.data[n],h.children.push(n),a.children_d.length&&(h.children_d=h.children_d.concat(a.children_d))},this)),h.children_d=h.children_d.concat(h.children)):i.hasClass("jstree-closed")&&(h.state.loaded=!1),h.li_attr.class&&(h.li_attr.class=h.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),h.a_attr.class&&(h.a_attr.class=h.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),l[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_flat_json:function(e,i,r){r=r?r.concat():[],i&&r.unshift(i);var s,n,a,o,d=e.id.toString(),c=this._model.data,l=this._model.default_state,h={id:d,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in l)l.hasOwnProperty(s)&&(h.state[s]=l[s]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),h.icon!==t&&null!==h.icon&&""!==h.icon||(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(h.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(h.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(h.li_attr[s]=e.li_attr[s]);if(h.li_attr.id||(h.li_attr.id=d),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(h.a_attr[s]=e.a_attr[s]);for(e&&e.children&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),c[h.id]=h,s=0,n=h.children.length;n>s;s++)a=this._parse_model_from_flat_json(c[h.children[s]],h.id,r),o=c[a],h.children_d.push(a),o.children_d.length&&(h.children_d=h.children_d.concat(o.children_d));return delete e.data,delete e.children,c[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,i,r){r=r?r.concat():[],i&&r.unshift(i);var s,n,a,o,d,c=!1,l=this._model.data,h=this._model.default_state;do{c="j"+this._id+"_"+ ++this._cnt}while(l[c]);d={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in h)h.hasOwnProperty(s)&&(d.state[s]=h[s]);if(e&&e.id&&(d.id=e.id.toString()),e&&e.text&&(d.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),d.icon!==t&&null!==d.icon&&""!==d.icon||(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(d.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(d.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(d.li_attr[s]=e.li_attr[s]);if(d.li_attr.id&&!d.id&&(d.id=d.li_attr.id.toString()),d.id||(d.id=c),d.li_attr.id||(d.li_attr.id=d.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(d.a_attr[s]=e.a_attr[s]);if(e&&e.children&&e.children.length){for(s=0,n=e.children.length;n>s;s++)a=this._parse_model_from_json(e.children[s],d.id,r),o=l[a],d.children.push(a),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d));d.children_d=d.children_d.concat(d.children)}return e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),delete e.data,delete e.children,d.original=e,l[d.id]=d,d.state.selected&&this._data.core.selected.push(d.id),d.id},_redraw:function(){var t,i,r,s=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),n=l.createElement("UL"),a=this._data.core.focused;for(i=0,r=s.length;r>i;i++)(t=this.redraw_node(s[i],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&n.appendChild(t);this._model.force_full_redraw&&(n.className=this.get_container_ul()[0].className,n.setAttribute("role","group"),this.element.empty().append(n)),null!==a&&(t=this.get_node(a,!0),t&&t.length&&t.children(".jstree-anchor")[0]!==l.activeElement?t.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:s})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(t){var i=this.get_node(t),r=!1,s=!1,n=!1,a=l;if(!i)return!1;if(i.id===e.jstree.root)return this.redraw(!0);if(!(t=this.get_node(t,!0))||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],i.children.length&&i.state.loaded){for(n=a.createElement("UL"),n.setAttribute("role","group"),n.className="jstree-children",r=0,s=i.children.length;s>r;r++)n.appendChild(this.redraw_node(i.children[r],!0,!0));t.appendChild(n)}},redraw_node:function(t,i,r,s){var n=this.get_node(t),a=!1,o=!1,d=!1,c=!1,_=!1,u=!1,g="",f=l,p=this._model.data,m=!1,v=null,j=0,y=0,x=!1,k=!1;if(!n)return!1;if(n.id===e.jstree.root)return this.redraw(!0);if(i=i||0===n.children.length,t=l.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(n.id[0])?"\\3"+n.id[0]+" "+n.id.substr(1).replace(e.jstree.idregex,"\\$&"):n.id.replace(e.jstree.idregex,"\\$&"))):l.getElementById(n.id))t=e(t),r||(a=t.parent().parent()[0],a===this.element[0]&&(a=null),o=t.index()),i||!n.children.length||t.children(".jstree-children").length||(i=!0),i||(d=t.children(".jstree-children")[0]),m=t.children(".jstree-anchor")[0]===l.activeElement,t.remove();else if(i=!0,!r){if(!(null===(a=n.parent!==e.jstree.root?e("#"+n.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||a&&p[n.parent].state.opened))return!1;o=e.inArray(n.id,null===a?p[e.jstree.root].children:p[n.parent].children)}t=h.cloneNode(!0),g="jstree-node ";for(c in n.li_attr)if(n.li_attr.hasOwnProperty(c)){if("id"===c)continue;"class"!==c?t.setAttribute(c,n.li_attr[c]):g+=n.li_attr[c]}for(n.a_attr.id||(n.a_attr.id=n.id+"_anchor"),t.setAttribute("aria-selected",!!n.state.selected),t.setAttribute("aria-level",n.parents.length),t.setAttribute("aria-labelledby",n.a_attr.id),n.state.disabled&&t.setAttribute("aria-disabled",!0),c=0,_=n.children.length;_>c;c++)if(!p[n.children[c]].state.hidden){x=!0;break}if(null!==n.parent&&p[n.parent]&&!n.state.hidden&&(c=e.inArray(n.id,p[n.parent].children),k=n.id,-1!==c))for(c++,_=p[n.parent].children.length;_>c&&(p[p[n.parent].children[c]].state.hidden||(k=p[n.parent].children[c]),k===n.id);c++);n.state.hidden&&(g+=" jstree-hidden"),n.state.loaded&&!x?g+=" jstree-leaf":(g+=n.state.opened&&n.state.loaded?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",n.state.opened&&n.state.loaded)),k===n.id&&(g+=" jstree-last"),t.id=n.id,t.className=g,g=(n.state.selected?" jstree-clicked":"")+(n.state.disabled?" jstree-disabled":"");for(_ in n.a_attr)if(n.a_attr.hasOwnProperty(_)){if("href"===_&&"#"===n.a_attr[_])continue;"class"!==_?t.childNodes[1].setAttribute(_,n.a_attr[_]):g+=" "+n.a_attr[_]}if(g.length&&(t.childNodes[1].className="jstree-anchor "+g),(n.icon&&!0!==n.icon||!1===n.icon)&&(!1===n.icon?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===n.icon.indexOf("/")&&-1===n.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+n.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+n.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(f.createTextNode(n.text)):t.childNodes[1].innerHTML+=n.text,i&&n.children.length&&(n.state.opened||s)&&n.state.loaded){for(u=f.createElement("UL"),u.setAttribute("role","group"),u.className="jstree-children",c=0,_=n.children.length;_>c;c++)u.appendChild(this.redraw_node(n.children[c],i,!0));t.appendChild(u)}if(d&&t.appendChild(d),!r){for(a||(a=this.element[0]),c=0,_=a.childNodes.length;_>c;c++)if(a.childNodes[c]&&a.childNodes[c].className&&-1!==a.childNodes[c].className.indexOf("jstree-children")){v=a.childNodes[c];break}v||(v=f.createElement("UL"),v.setAttribute("role","group"),v.className="jstree-children",a.appendChild(v)),a=v,o<a.childNodes.length?a.insertBefore(t,a.childNodes[o]):a.appendChild(t),m&&(j=this.element[0].scrollTop,y=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=j,this.element[0].scrollLeft=y)}return n.state.opened&&!n.state.loaded&&(n.state.opened=!1,setTimeout(e.proxy(function(){this.open_node(n.id,!1,0)},this),0)),t},open_node:function(i,r,s){var n,a,o,d;if(e.isArray(i)){for(i=i.slice(),n=0,a=i.length;a>n;n++)this.open_node(i[n],r,s);return!0}return!(!(i=this.get_node(i))||i.id===e.jstree.root)&&(s=s===t?this.settings.core.animation:s,this.is_closed(i)?this.is_loaded(i)?(o=this.get_node(i,!0),d=this,o.length&&(s&&o.children(".jstree-children").length&&o.children(".jstree-children").stop(!0,!0),i.children.length&&!this._firstChild(o.children(".jstree-children")[0])&&this.draw_children(i),s?(this.trigger("before_open",{node:i}),o.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(s,function(){this.style.display="",d.trigger("after_open",{node:i})})):(this.trigger("before_open",{node:i}),o[0].className=o[0].className.replace("jstree-closed","jstree-open"),o[0].setAttribute("aria-expanded",!0))),i.state.opened=!0,r&&r.call(this,i,!0),o.length||this.trigger("before_open",{node:i}),this.trigger("open_node",{node:i}),s&&o.length||this.trigger("after_open",{node:i}),!0):this.is_loading(i)?setTimeout(e.proxy(function(){this.open_node(i,r,s)},this),500):void this.load_node(i,function(e,t){return t?this.open_node(e,r,s):!!r&&r.call(this,e,!1)}):(r&&r.call(this,i,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var i,r,s=t.parents;for(i=0,r=s.length;r>i;i+=1)i!==e.jstree.root&&this.open_node(s[i],!1,0);return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(i,r){var s,n,a,o;if(e.isArray(i)){for(i=i.slice(),s=0,n=i.length;n>s;s++)this.close_node(i[s],r);return!0}return!(!(i=this.get_node(i))||i.id===e.jstree.root)&&(!this.is_closed(i)&&(r=r===t?this.settings.core.animation:r,a=this,o=this.get_node(i,!0),i.state.opened=!1,this.trigger("close_node",{node:i}),void(o.length?r?o.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(r,function(){this.style.display="",o.children(".jstree-children").remove(),a.trigger("after_close",{node:i})}):(o[0].className=o[0].className.replace("jstree-open","jstree-closed"),o.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:i})):this.trigger("after_close",{node:i}))))},toggle_node:function(t){var i,r;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.toggle_node(t[i]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,i,r){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var s,n,a,o=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0);if(!o.length){for(s=0,n=t.children_d.length;n>s;s++)this.is_closed(this._model.data[t.children_d[s]])&&(this._model.data[t.children_d[s]].state.opened=!0);return this.trigger("open_all",{node:t})}r=r||o,a=this,o=this.is_closed(t)?o.find(".jstree-closed").addBack():o.find(".jstree-closed"),o.each(function(){a.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,i,r)},i||0)}),0===r.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(r)})},close_all:function(t,i){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var r,s,n=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),a=this;for(n.length&&(n=this.is_open(t)?n.find(".jstree-open").addBack():n.find(".jstree-open"),e(n.get().reverse()).each(function(){a.close_node(this,i||0)})),r=0,s=t.children_d.length;s>r;r++)this._model.data[t.children_d[r]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(t){var i,r;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.enable_node(t[i]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:t}))},disable_node:function(t){var i,r;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.disable_node(t[i]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:t}))},is_hidden:function(e){return e=this.get_node(e),!0===e.state.hidden},hide_node:function(t,i){var r,s;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.hide_node(t[r],!0);return i||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),i||this.redraw(),this.trigger("hide_node",{node:t})))},show_node:function(t,i){var r,s;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.show_node(t[r],!0);return i||this.redraw(),!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&void(t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),i||this.redraw(),this.trigger("show_node",{node:t})))},hide_all:function(t){var i,r=this._model.data,s=[];for(i in r)r.hasOwnProperty(i)&&i!==e.jstree.root&&!r[i].state.hidden&&(r[i].state.hidden=!0,s.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:s}),s},show_all:function(t){var i,r=this._model.data,s=[];for(i in r)r.hasOwnProperty(i)&&i!==e.jstree.root&&r[i].state.hidden&&(r[i].state.hidden=!1,s.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:s}),s},activate_node:function(e,i){if(this.is_disabled(e))return!1;if(i&&"object"==typeof i||(i={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&(!i.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(i.shiftKey){var r,s,n=this.get_node(e).id,a=this._data.core.last_clicked.id,o=this.get_node(this._data.core.last_clicked.parent).children,d=!1;for(r=0,s=o.length;s>r;r+=1)o[r]===n&&(d=!d),o[r]===a&&(d=!d),this.is_disabled(o[r])||!d&&o[r]!==n&&o[r]!==a?this.deselect_node(o[r],!0,i):this.is_hidden(o[r])||this.select_node(o[r],!0,!1,i);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:i})}else this.is_selected(e)?this.deselect_node(e,!1,i):this.select_node(e,!1,!1,i);else!this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,i):(this.deselect_all(!0),this.select_node(e,!1,!1,i),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:i})},hover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),i=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout(function(){i.attr("aria-activedescendant",e[0].id)},0)},dehover_node:function(e){return!!((e=this.get_node(e,!0))&&e.length&&e.children(".jstree-hovered").length)&&(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)}))},select_node:function(t,i,r,s){var n,a,o;if(e.isArray(t)){for(t=t.slice(),a=0,o=t.length;o>a;a++)this.select_node(t[a],i,r,s);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(n=this.get_node(t,!0),void(t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),r||(n=this._open_to(t)),n&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:s}),i||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:s}))))},deselect_node:function(t,i,r){var s,n,a;if(e.isArray(t)){for(t=t.slice(),s=0,n=t.length;n>s;s++)this.deselect_node(t[s],i,r);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(a=this.get_node(t,!0),void(t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:r}))))},select_all:function(t){var i,r,s=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),i=0,r=this._data.core.selected.length;r>i;i++)this._model.data[this._data.core.selected[i]]&&(this._model.data[this._data.core.selected[i]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:s})},deselect_all:function(e){var t,i,r=this._data.core.selected.concat([]);for(t=0,i=this._data.core.selected.length;i>t;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:r}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:r})},is_selected:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.selected},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected.slice()},get_top_selected:function(t){var i,r,s,n,a=this.get_selected(!0),o={};for(i=0,r=a.length;r>i;i++)o[a[i].id]=a[i];for(i=0,r=a.length;r>i;i++)for(s=0,n=a[i].children_d.length;n>s;s++)o[a[i].children_d[s]]&&delete o[a[i].children_d[s]];a=[];for(i in o)o.hasOwnProperty(i)&&a.push(i);return t?e.map(a,e.proxy(function(e){return this.get_node(e)},this)):a},get_bottom_selected:function(t){var i,r,s=this.get_selected(!0),n=[];for(i=0,r=s.length;r>i;i++)s[i].children.length||n.push(s[i].id);return t?e.map(n,e.proxy(function(e){return this.get_node(e)},this)):n},get_state:function(){var t,i={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==e.jstree.root&&(this._model.data[t].state.opened&&i.core.open.push(t),this._model.data[t].state.selected&&i.core.selected.push(t));return i},set_state:function(i,r){if(i){if(i.core){var s,n;if(i.core.open)return e.isArray(i.core.open)&&i.core.open.length?this._load_nodes(i.core.open,function(e){this.open_node(e,!1,0),delete i.core.open,this.set_state(i,r)},!0):(delete i.core.open,this.set_state(i,r)),!1;if(i.core.scroll)return i.core.scroll&&i.core.scroll.left!==t&&this.element.scrollLeft(i.core.scroll.left),i.core.scroll&&i.core.scroll.top!==t&&this.element.scrollTop(i.core.scroll.top),delete i.core.scroll,this.set_state(i,r),!1;if(i.core.selected)return s=this,this.deselect_all(),e.each(i.core.selected,function(e,t){s.select_node(t,!1,!0)}),delete i.core.selected,this.set_state(i,r),!1;for(n in i)i.hasOwnProperty(n)&&"core"!==n&&-1===e.inArray(n,this.settings.plugins)&&delete i[n];if(e.isEmptyObject(i.core))return delete i.core,this.set_state(i,r),!1}return!e.isEmptyObject(i)||(i=null,r&&r.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(t,i){this._data.core.state=!0===i?{}:this.get_state(),i&&e.isFunction(i)&&(this._data.core.state=i.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var r=this.get_container_ul()[0].className;t||(this.element.html("<ul class='"+r+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(e.jstree.root,function(t,i){i&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var i=[],r=[],s=this._data.core.selected.concat([]);r.push(t.id),!0===t.state.opened&&i.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){r.push(this.id),i.push(this.id)}),this._load_nodes(r,e.proxy(function(e){this.open_node(i,!1,0),this.select_node(s),this.trigger("refresh_node",{node:t,nodes:e})},this),!1,!0)},set_id:function(t,i){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var r,s,n=this._model.data,a=t.id;for(i=i.toString(),n[t.parent].children[e.inArray(t.id,n[t.parent].children)]=i,r=0,s=t.parents.length;s>r;r++)n[t.parents[r]].children_d[e.inArray(t.id,n[t.parents[r]].children_d)]=i;for(r=0,s=t.children.length;s>r;r++)n[t.children[r]].parent=i;for(r=0,s=t.children_d.length;s>r;r++)n[t.children_d[r]].parents[e.inArray(t.id,n[t.children_d[r]].parents)]=i;return r=e.inArray(t.id,this._data.core.selected),-1!==r&&(this._data.core.selected[r]=i),r=this.get_node(t.id,!0),r&&(r.attr("id",i),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",i)),delete n[t.id],t.id=i,t.li_attr.id=i,n[i]=t,this.trigger("set_id",{node:t,new:t.id,old:a}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.text},set_text:function(t,i){var r,s;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.set_text(t[r],i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(t.text=i,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:i}),!0)},get_json:function(t,i,r){if(!(t=this.get_node(t||e.jstree.root)))return!1;i&&i.flat&&!r&&(r=[]);var s,n,a={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:(!i||!i.no_data)&&e.extend(!0,{},t.data)};if(i&&i.flat?a.parent=t.parent:a.children=[],!i||!i.no_state)for(s in t.state)t.state.hasOwnProperty(s)&&(a.state[s]=t.state[s]);if(i&&i.no_id&&(delete a.id,a.li_attr&&a.li_attr.id&&delete a.li_attr.id,a.a_attr&&a.a_attr.id&&delete a.a_attr.id),i&&i.flat&&t.id!==e.jstree.root&&r.push(a),!i||!i.no_children)for(s=0,n=t.children.length;n>s;s++)i&&i.flat?this.get_json(t.children[s],i,r):a.children.push(this.get_json(t.children[s],i));return i&&i.flat?r:t.id===e.jstree.root?a.children:a},create_node:function(i,r,s,n,a){if(null===i&&(i=e.jstree.root),!(i=this.get_node(i)))return!1;if(s=s===t?"last":s,!s.toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return this.load_node(i,function(){this.create_node(i,r,s,n,!0)});r||(r={text:this.get_string("New node")}),"string"==typeof r&&(r={text:r}),r.text===t&&(r.text=this.get_string("New node"));var o,d,c,l;switch(i.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":o=this.get_node(i.parent),s=e.inArray(i.id,o.children),i=o;break;case"after":o=this.get_node(i.parent),s=e.inArray(i.id,o.children)+1,i=o;break;case"inside":case"first":s=0;break;case"last":s=i.children.length;break;default:s||(s=0)}if(s>i.children.length&&(s=i.children.length),r.id||(r.id=!0),!this.check("create_node",r,i,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===r.id&&delete r.id,!(r=this._parse_model_from_json(r,i.id,i.parents.concat())))return!1;for(o=this.get_node(r),d=[],d.push(r),d=d.concat(o.children_d),this.trigger("model",{nodes:d,parent:i.id}),i.children_d=i.children_d.concat(d),c=0,l=i.parents.length;l>c;c++)this._model.data[i.parents[c]].children_d=this._model.data[i.parents[c]].children_d.concat(d);for(r=o,o=[],c=0,l=i.children.length;l>c;c++)o[c>=s?c+1:c]=i.children[c];return o[s]=r.id,i.children=o,this.redraw_node(i,!0),n&&n.call(this,this.get_node(r)),this.trigger("create_node",{node:this.get_node(r),parent:i.id,position:s}),r.id},rename_node:function(t,i){var r,s,n;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.rename_node(t[r],i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(n=t.text,this.check("rename_node",t,this.get_parent(t),i)?(this.set_text(t,i),this.trigger("rename_node",{node:t,text:i,old:n}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(t){var i,r,s,n,a,o,d,c,l,h,_,u;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.delete_node(t[i]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;if(s=this.get_node(t.parent),n=e.inArray(t.id,s.children),h=!1,!this.check("delete_node",t,s,n))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==n&&(s.children=e.vakata.array_remove(s.children,n)),a=t.children_d.concat([]),a.push(t.id),o=0,d=t.parents.length;d>o;o++)this._model.data[t.parents[o]].children_d=e.vakata.array_filter(this._model.data[t.parents[o]].children_d,function(t){return-1===e.inArray(t,a)});for(c=0,l=a.length;l>c;c++)if(this._model.data[a[c]].state.selected){h=!0;break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(t){return-1===e.inArray(t,a)})),this.trigger("delete_node",{node:t,parent:s.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),c=0,l=a.length;l>c;c++)delete this._model.data[a[c]];return-1!==e.inArray(this._data.core.focused,a)&&(this._data.core.focused=null,_=this.element[0].scrollTop,u=this.element[0].scrollLeft,s.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(s,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=_,this.element[0].scrollLeft=u),this.redraw_node(s,!0),!0},check:function(t,i,r,s,n){i=i&&i.id?i:this.get_node(i),r=r&&r.id?r:this.get_node(r);var a=t.match(/^move_node|copy_node|create_node$/i)?r:i,o=this.settings.core.check_callback;return"move_node"!==t||n&&n.is_multi||i.id!==r.id&&("move_node"!==t||e.inArray(i.id,r.children)!==s)&&-1===e.inArray(r.id,i.children_d)?(a&&a.data&&(a=a.data),a&&a.functions&&(!1===a.functions[t]||!0===a.functions[t])?(!1===a.functions[t]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),a.functions[t]):!(!1===o||e.isFunction(o)&&!1===o.call(this,t,i,r,s,n)||o&&!1===o[t])||(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})},!1)):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(i,r,s,n,a,o,d){var c,l,h,_,u,g,f,p,m,v,j,y,x,k;if(r=this.get_node(r),s=s===t?0:s,!r)return!1;if(!s.toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(r))return this.load_node(r,function(){this.move_node(i,r,s,n,!0,!1,d)});if(e.isArray(i)){if(1!==i.length){for(c=0,l=i.length;l>c;c++)(m=this.move_node(i[c],r,s,n,a,!1,d))&&(r=m,s="after");return this.redraw(),!0}i=i[0]}if(!(i=i&&i.id?i:this.get_node(i))||i.id===e.jstree.root)return!1;if(h=(i.parent||e.jstree.root).toString(),u=s.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,g=d||(this._model.data[i.id]?this:e.jstree.reference(i.id)),f=!g||!g._id||this._id!==g._id,_=g&&g._id&&h&&g._model.data[h]&&g._model.data[h].children?e.inArray(i.id,g._model.data[h].children):-1,g&&g._id&&(i=g._model.data[i.id]),f)return!!(m=this.copy_node(i,r,s,n,a,!1,d))&&(g&&g.delete_node(i),m);switch(r.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(r.id,u.children);break;case"after":s=e.inArray(r.id,u.children)+1;break;case"inside":case"first":s=0;break;case"last":s=u.children.length;break;default:s||(s=0)}if(s>u.children.length&&(s=u.children.length),!this.check("move_node",i,u,s,{core:!0,origin:d,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(i.parent===u.id){for(p=u.children.concat(),m=e.inArray(i.id,p),-1!==m&&(p=e.vakata.array_remove(p,m),s>m&&s--),m=[],v=0,j=p.length;j>v;v++)m[v>=s?v+1:v]=p[v];m[s]=i.id,u.children=m,this._node_changed(u.id),this.redraw(u.id===e.jstree.root)}else{for(m=i.children_d.concat(),m.push(i.id),v=0,j=i.parents.length;j>v;v++){for(p=[],k=g._model.data[i.parents[v]].children_d,y=0,x=k.length;x>y;y++)-1===e.inArray(k[y],m)&&p.push(k[y]);g._model.data[i.parents[v]].children_d=p}for(g._model.data[h].children=e.vakata.array_remove_item(g._model.data[h].children,i.id),v=0,j=u.parents.length;j>v;v++)this._model.data[u.parents[v]].children_d=this._model.data[u.parents[v]].children_d.concat(m);for(p=[],v=0,j=u.children.length;j>v;v++)p[v>=s?v+1:v]=u.children[v];for(p[s]=i.id,u.children=p,u.children_d.push(i.id),u.children_d=u.children_d.concat(i.children_d),i.parent=u.id,m=u.parents.concat(),m.unshift(u.id),k=i.parents.length,i.parents=m,m=m.concat(),v=0,j=i.children_d.length;j>v;v++)this._model.data[i.children_d[v]].parents=this._model.data[i.children_d[v]].parents.slice(0,-1*k),Array.prototype.push.apply(this._model.data[i.children_d[v]].parents,m);h!==e.jstree.root&&u.id!==e.jstree.root||(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(u.id)),o||this.redraw()}return n&&n.call(this,i,u,s),this.trigger("move_node",{node:i,parent:u.id,position:s,old_parent:h,old_position:_,is_multi:g&&g._id&&g._id!==this._id,is_foreign:!g||!g._id,old_instance:g,new_instance:this}),i.id},copy_node:function(i,r,s,n,a,o,d){var c,l,h,_,u,g,f,p,m,v;if(r=this.get_node(r),s=s===t?0:s,!r)return!1;if(!s.toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(r))return this.load_node(r,function(){this.copy_node(i,r,s,n,!0,!1,d)});if(e.isArray(i)){if(1!==i.length){for(c=0,l=i.length;l>c;c++)(_=this.copy_node(i[c],r,s,n,a,!0,d))&&(r=_,s="after");return this.redraw(),!0}i=i[0]}if(!(i=i&&i.id?i:this.get_node(i))||i.id===e.jstree.root)return!1;switch(p=(i.parent||e.jstree.root).toString(),m=s.toString().match(/^(before|after)$/)&&r.id!==e.jstree.root?this.get_node(r.parent):r,v=d||(this._model.data[i.id]?this:e.jstree.reference(i.id)),!v||!v._id||this._id!==v._id,v&&v._id&&(i=v._model.data[i.id]),r.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(r.id,m.children);break;case"after":s=e.inArray(r.id,m.children)+1;break;case"inside":case"first":s=0;break;case"last":s=m.children.length;break;default:s||(s=0)}if(s>m.children.length&&(s=m.children.length),!this.check("copy_node",i,m,s,{core:!0,origin:d,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(f=v?v.get_json(i,{no_id:!0,no_data:!0,no_state:!0}):i))return!1;if(!0===f.id&&delete f.id,!(f=this._parse_model_from_json(f,m.id,m.parents.concat())))return!1;for(_=this.get_node(f),i&&i.state&&!1===i.state.loaded&&(_.state.loaded=!1),h=[],h.push(f),h=h.concat(_.children_d),this.trigger("model",{nodes:h,parent:m.id}),u=0,g=m.parents.length;g>u;u++)this._model.data[m.parents[u]].children_d=this._model.data[m.parents[u]].children_d.concat(h);for(h=[],u=0,g=m.children.length;g>u;u++)h[u>=s?u+1:u]=m.children[u];return h[s]=_.id,m.children=h,m.children_d.push(_.id),m.children_d=m.children_d.concat(_.children_d),m.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(m.id),o||this.redraw(m.id===e.jstree.root),n&&n.call(this,_,m,s),this.trigger("copy_node",{node:_,original:i,parent:m.id,position:s,old_parent:p,old_position:v&&v._id&&p&&v._model.data[p]&&v._model.data[p].children?e.inArray(i.id,v._model.data[p].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),_.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var i,r,s,d=[];for(r=0,s=t.length;s>r;r++)(i=this.get_node(t[r]))&&i.id&&i.id!==e.jstree.root&&d.push(i);return!!d.length&&(n=d,o=this,a="move_node",void this.trigger("cut",{node:t}))},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var i,r,s,d=[];for(r=0,s=t.length;s>r;r++)(i=this.get_node(t[r]))&&i.id&&i.id!==e.jstree.root&&d.push(i);return!!d.length&&(n=d,o=this,a="copy_node",void this.trigger("copy",{node:t}))},get_buffer:function(){return{mode:a,node:n,inst:o}},can_paste:function(){return!1!==a&&!1!==n},paste:function(e,t){return!!((e=this.get_node(e))&&a&&a.match(/^(copy_node|move_node)$/)&&n)&&(this[a](n,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:n,mode:a}),n=!1,a=!1,void(o=!1))},clear_buffer:function(){n=!1,a=!1,o=!1,this.trigger("clear_buffer")},edit:function(t,i,r){var s,n,a,o,d,c,h,_,u,g=!1;return!!(t=this.get_node(t))&&(!1===this.settings.core.check_callback?(this._data.core.last_error={error:"check",plugin:"core",id:"core_07",reason:"Could not edit node because of check_callback"},this.settings.core.error.call(this,this._data.core.last_error),!1):(u=t,i="string"==typeof i?i:t.text,this.set_text(t,""),t=this._open_to(t),u.text=i,s=this._data.core.rtl,n=this.element.width(),this._data.core.focused=u.id,a=t.children(".jstree-anchor").focus(),o=e("<span>"),d=i,c=e("<div />",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),h=e("<input />",{value:d,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(i){i.stopImmediatePropagation(),i.preventDefault();var s,n=o.children(".jstree-rename-input"),l=n.val(),_=this.settings.core.force_text;""===l&&(l=d),c.remove(),o.replaceWith(a),o.remove(),d=_?d:e("<div></div>").append(e.parseHTML(d)).html(),this.set_text(t,d),s=!!this.rename_node(t,_?e("<div></div>").text(l).text():e("<div></div>").append(e.parseHTML(l)).html()),s||this.set_text(t,d),this._data.core.focused=u.id,setTimeout(e.proxy(function(){var e=this.get_node(u.id,!0);e.length&&(this._data.core.focused=u.id,e.children(".jstree-anchor").focus())},this),0),r&&r.call(this,u,s,g),h=null},this),keydown:function(e){var t=e.which;27===t&&(g=!0,this.value=d),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(c.text("pW"+this.value).width(),n))},keypress:function(e){return 13!==e.which&&void 0}}),_={fontFamily:a.css("fontFamily")||"",fontSize:a.css("fontSize")||"",fontWeight:a.css("fontWeight")||"",fontStyle:a.css("fontStyle")||"",fontStretch:a.css("fontStretch")||"",fontVariant:a.css("fontVariant")||"",letterSpacing:a.css("letterSpacing")||"",wordSpacing:a.css("wordSpacing")||""},o.attr("class",a.attr("class")).append(a.contents().clone()).append(h),a.replaceWith(o),c.css(_),h.css(_).width(Math.min(c.text("pW"+h[0].value).width(),n))[0].select(),void e(l).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(t){h&&t.target!==h&&e(h).blur()})))},set_theme:function(t,i){if(!t)return!1;if(!0===i){var r=this.settings.core.themes.dir;r||(r=e.jstree.path+"/themes"),i=r+"/"+t+"/style.css"}i&&-1===e.inArray(i,d)&&(e("head").append('<link rel="stylesheet" href="'+i+'" type="text/css" />'),d.push(i)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(i,r){var s,n,a,o;if(e.isArray(i)){for(i=i.slice(),s=0,n=i.length;n>s;s++)this.set_icon(i[s],r);return!0}return!(!(i=this.get_node(i))||i.id===e.jstree.root)&&(o=i.icon,i.icon=!0===r||null===r||r===t||""===r||r,a=this.get_node(i,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===r?this.hide_icon(i):!0===r||null===r||r===t||""===r?(a.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),!1===o&&this.show_icon(i)):-1===r.indexOf("/")&&-1===r.indexOf(".")?(a.removeClass(o).css("background",""),a.addClass(r+" jstree-themeicon-custom").attr("rel",r),!1===o&&this.show_icon(i)):(a.removeClass(o).css("background",""),a.addClass("jstree-themeicon-custom").css("background","url('"+r+"') center center no-repeat").attr("rel",r),!1===o&&this.show_icon(i)),!0)},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var i,r;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.hide_icon(t[i]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(t){var i,r,s;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.show_icon(t[i]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(s=this.get_node(t,!0),t.icon=!s.length||s.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),s.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},e.vakata={},e.vakata.attributes=function(t,i){t=e(t)[0];var r=i?{}:[];return t&&t.attributes&&e.each(t.attributes,function(t,s){-1===e.inArray(s.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==s.value&&""!==e.trim(s.value)&&(i?r[s.name]=s.value:r.push(s.name))}),r},e.vakata.array_unique=function(e){var i,r,s=[],n={};for(i=0,r=e.length;r>i;i++)n[e[i]]===t&&(s.push(e[i]),n[e[i]]=!0);return s},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,i){var r=e.inArray(i,t);return-1!==r?e.vakata.array_remove(t,r):t},e.vakata.array_filter=function(e,t,i,r,s){if(e.filter)return e.filter(t,i);r=[];for(s in e)~~s+""==s+""&&s>=0&&t.call(i,e[s],+s,e)&&r.push(e[s]);return r},e.jstree.plugins.changed=function(e,t){var i=[];this.trigger=function(e,r){var s,n;if(r||(r={}),"changed"===e.replace(".jstree","")){r.changed={selected:[],deselected:[]};var a={};for(s=0,n=i.length;n>s;s++)a[i[s]]=1;for(s=0,n=r.selected.length;n>s;s++)a[r.selected[s]]?a[r.selected[s]]=2:r.changed.selected.push(r.selected[s]);for(s=0,n=i.length;n>s;s++)1===a[i[s]]&&r.changed.deselected.push(i[s]);i=r.selected.slice()}t.trigger.call(this,e,r)},this.refresh=function(e,r){return i=[],t.refresh.apply(this,arguments)}};var _=l.createElement("I");_.className="jstree-icon jstree-checkbox",_.setAttribute("role","presentation"),e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0},e.jstree.plugins.checkbox=function(i,r){this.bind=function(){r.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",e.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",e.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy(function(e,t){var i,r,s=this._model.data,n=(s[t.parent],t.nodes);for(i=0,r=n.length;r>i;i++)s[n[i]].state.checked=s[n[i]].state.checked||s[n[i]].original&&s[n[i]].original.state&&s[n[i]].original.state.checked,s[n[i]].state.checked&&this._data.checkbox.selected.push(n[i])},this)),-1===this.settings.checkbox.cascade.indexOf("up")&&-1===this.settings.checkbox.cascade.indexOf("down")||this.element.on("model.jstree",e.proxy(function(t,i){var r,s,n,a,o,d,c=this._model.data,l=c[i.parent],h=i.nodes,_=[],u=this.settings.checkbox.cascade,g=this.settings.checkbox.tie_selection;if(-1!==u.indexOf("down"))if(l.state[g?"selected":"checked"]){for(s=0,n=h.length;n>s;s++)c[h[s]].state[g?"selected":"checked"]=!0;this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(h)}else for(s=0,n=h.length;n>s;s++)if(c[h[s]].state[g?"selected":"checked"]){for(a=0,o=c[h[s]].children_d.length;o>a;a++)c[c[h[s]].children_d[a]].state[g?"selected":"checked"]=!0;this._data[g?"core":"checkbox"].selected=this._data[g?"core":"checkbox"].selected.concat(c[h[s]].children_d)}if(-1!==u.indexOf("up")){for(s=0,n=l.children_d.length;n>s;s++)c[l.children_d[s]].children.length||_.push(c[l.children_d[s]].parent);for(_=e.vakata.array_unique(_),a=0,o=_.length;o>a;a++)for(l=c[_[a]];l&&l.id!==e.jstree.root;){for(r=0,s=0,n=l.children.length;n>s;s++)r+=c[l.children[s]].state[g?"selected":"checked"];if(r!==n)break;l.state[g?"selected":"checked"]=!0,this._data[g?"core":"checkbox"].selected.push(l.id),d=this.get_node(l,!0),d&&d.length&&d.attr("aria-selected",!0).children(".jstree-anchor").addClass(g?"jstree-clicked":"jstree-checked"),l=this.get_node(l.parent)}}this._data[g?"core":"checkbox"].selected=e.vakata.array_unique(this._data[g?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy(function(t,i){var r,s,n,a,o=i.node,d=this._model.data,c=this.get_node(o.parent),l=this.get_node(o,!0),h=this.settings.checkbox.cascade,_=this.settings.checkbox.tie_selection,u={},g=this._data[_?"core":"checkbox"].selected;for(r=0,s=g.length;s>r;r++)u[g[r]]=!0;if(-1!==h.indexOf("down"))for(r=0,s=o.children_d.length;s>r;r++)u[o.children_d[r]]=!0,a=d[o.children_d[r]],a.state[_?"selected":"checked"]=!0,a&&a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=!1);if(-1!==h.indexOf("up"))for(;c&&c.id!==e.jstree.root;){for(n=0,r=0,s=c.children.length;s>r;r++)n+=d[c.children[r]].state[_?"selected":"checked"];if(n!==s)break;c.state[_?"selected":"checked"]=!0,u[c.id]=!0,a=this.get_node(c,!0),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}g=[];for(r in u)u.hasOwnProperty(r)&&g.push(r);this._data[_?"core":"checkbox"].selected=g,-1!==h.indexOf("down")&&l.length&&l.find(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!0)},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy(function(t,i){var r,s,n,a=this.get_node(e.jstree.root),o=this._model.data;for(r=0,s=a.children_d.length;s>r;r++)(n=o[a.children_d[r]])&&n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy(function(t,i){var r,s,n,a=i.node,o=this.get_node(a,!0),d=this.settings.checkbox.cascade,c=this.settings.checkbox.tie_selection,l=this._data[c?"core":"checkbox"].selected,h={};if(a&&a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=!1),-1!==d.indexOf("down"))for(r=0,s=a.children_d.length;s>r;r++)n=this._model.data[a.children_d[r]],n.state[c?"selected":"checked"]=!1,n&&n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=!1);if(-1!==d.indexOf("up"))for(r=0,s=a.parents.length;s>r;r++)n=this._model.data[a.parents[r]],n.state[c?"selected":"checked"]=!1,n&&n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=!1),(n=this.get_node(a.parents[r],!0))&&n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass(c?"jstree-clicked":"jstree-checked");for(h={},r=0,s=l.length;s>r;r++)-1!==d.indexOf("down")&&-1!==e.inArray(l[r],a.children_d)||-1!==d.indexOf("up")&&-1!==e.inArray(l[r],a.parents)||(h[l[r]]=!0);l=[];for(r in h)h.hasOwnProperty(r)&&l.push(r);this._data[c?"core":"checkbox"].selected=l,-1!==d.indexOf("down")&&o.length&&o.find(".jstree-anchor").removeClass(c?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!1)},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy(function(t,i){for(var r,s,n,a,o=this.get_node(i.parent),d=this._model.data,c=this.settings.checkbox.tie_selection;o&&o.id!==e.jstree.root&&!o.state[c?"selected":"checked"];){for(n=0,r=0,s=o.children.length;s>r;r++)n+=d[o.children[r]].state[c?"selected":"checked"];if(!(s>0&&n===s))break;o.state[c?"selected":"checked"]=!0,this._data[c?"core":"checkbox"].selected.push(o.id),a=this.get_node(o,!0),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(c?"jstree-clicked":"jstree-checked"),o=this.get_node(o.parent)}},this)).on("move_node.jstree",e.proxy(function(t,i){var r,s,n,a,o,d=i.is_multi,c=i.old_parent,l=this.get_node(i.parent),h=this._model.data,_=this.settings.checkbox.tie_selection;if(!d)for(r=this.get_node(c);r&&r.id!==e.jstree.root&&!r.state[_?"selected":"checked"];){for(s=0,n=0,a=r.children.length;a>n;n++)s+=h[r.children[n]].state[_?"selected":"checked"];if(!(a>0&&s===a))break;r.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(r.id),o=this.get_node(r,!0),o&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"),r=this.get_node(r.parent)}for(r=l;r&&r.id!==e.jstree.root;){for(s=0,n=0,a=r.children.length;a>n;n++)s+=h[r.children[n]].state[_?"selected":"checked"];if(s===a)r.state[_?"selected":"checked"]||(r.state[_?"selected":"checked"]=!0,this._data[_?"core":"checkbox"].selected.push(r.id),(o=this.get_node(r,!0))&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(_?"jstree-clicked":"jstree-checked"));else{if(!r.state[_?"selected":"checked"])break;r.state[_?"selected":"checked"]=!1,this._data[_?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[_?"core":"checkbox"].selected,r.id),(o=this.get_node(r,!0))&&o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass(_?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}},this))},this._undetermined=function(){if(null!==this.element){var i,r,s,n,a={},o=this._model.data,d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,l=[],h=this;for(i=0,r=c.length;r>i;i++)if(o[c[i]]&&o[c[i]].parents)for(s=0,n=o[c[i]].parents.length;n>s&&a[o[c[i]].parents[s]]===t;s++)o[c[i]].parents[s]!==e.jstree.root&&(a[o[c[i]].parents[s]]=!0,l.push(o[c[i]].parents[s]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var d,c=h.get_node(this);if(c.state.loaded){for(i=0,r=c.children_d.length;r>i;i++)if(d=o[c.children_d[i]],!d.state.loaded&&d.original&&d.original.state&&d.original.state.undetermined&&!0===d.original.state.undetermined)for(a[d.id]===t&&d.id!==e.jstree.root&&(a[d.id]=!0,l.push(d.id)),s=0,n=d.parents.length;n>s;s++)a[d.parents[s]]===t&&d.parents[s]!==e.jstree.root&&(a[d.parents[s]]=!0,l.push(d.parents[s]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&!0===c.original.state.undetermined)for(a[c.id]===t&&c.id!==e.jstree.root&&(a[c.id]=!0,l.push(c.id)),s=0,n=c.parents.length;n>s;s++)a[c.parents[s]]===t&&c.parents[s]!==e.jstree.root&&(a[c.parents[s]]=!0,l.push(c.parents[s]))}),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),i=0,r=l.length;r>i;i++)o[l[i]].state[d?"selected":"checked"]||(c=this.get_node(l[i],!0))&&c.length&&c.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,i,s,n){if(t=r.redraw_node.apply(this,arguments)){var a,o,d=null,c=null;for(a=0,o=t.childNodes.length;o>a;a++)if(t.childNodes[a]&&t.childNodes[a].className&&-1!==t.childNodes[a].className.indexOf("jstree-anchor")){d=t.childNodes[a];break}d&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(d.className+=" jstree-checked"),c=_.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(c.className+=" jstree-checkbox-disabled"),d.insertBefore(c,d.childNodes[0]))}return s||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(t){t=this.get_node(t);var i,r,s=this.settings.checkbox.cascade,n=this.settings.checkbox.tie_selection,a=this._data[n?"core":"checkbox"].selected,o=this._model.data;if(!t||!0===t.state[n?"selected":"checked"]||-1===s.indexOf("undetermined")||-1===s.indexOf("down")&&-1===s.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(i=0,r=t.children_d.length;r>i;i++)if(-1!==e.inArray(t.children_d[i],a)||!o[t.children_d[i]].state.loaded&&o[t.children_d[i]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(t){var i,r,s;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.disable_checkbox(t[i]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))))},this.enable_checkbox=function(t){var i,r,s;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;r>i;i++)this.enable_checkbox(t[i]);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,s&&s.length&&s.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))))},this.activate_node=function(t,i){return!e(i.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(i.target).hasClass("jstree-checkbox"))&&(i.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(i.target).hasClass("jstree-checkbox")?r.activate_node.call(this,t,i):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,i):this.check_node(t,i),void this.trigger("activate_node",{node:this.get_node(t)})))},this.check_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.select_node(t,!1,!0,i);var r,s,n;if(e.isArray(t)){for(t=t.slice(),s=0,n=t.length;n>s;s++)this.check_node(t[s],i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(r=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:i}))))},this.uncheck_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,i);var r,s,n;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.uncheck_node(t[r],i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(n=this.get_node(t,!0),void(t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),n.length&&n.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:i}))))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var t,i;this._data.checkbox.selected.concat([]);for(this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),t=0,i=this._data.checkbox.selected.length;i>t;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var e,t,i=this._data.checkbox.selected.concat([]);for(e=0,t=this._data.checkbox.selected.length;t>e;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:i})},this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.state.checked},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.checkbox.selected},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);var i,r,s,n,a=this.get_checked(!0),o={};for(i=0,r=a.length;r>i;i++)o[a[i].id]=a[i];for(i=0,r=a.length;r>i;i++)for(s=0,n=a[i].children_d.length;n>s;s++)o[a[i].children_d[s]]&&delete o[a[i].children_d[s]];a=[];for(i in o)o.hasOwnProperty(i)&&a.push(i);return t?e.map(a,e.proxy(function(e){return this.get_node(e)},this)):a},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var i,r,s=this.get_checked(!0),n=[];for(i=0,r=s.length;r>i;i++)s[i].children.length||n.push(s[i].id);return t?e.map(n,e.proxy(function(e){return this.get_node(e)},this)):n},this.load_node=function(t,i){var s,n,a;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(a=this.get_node(t))&&a.state.loaded)for(s=0,n=a.children_d.length;n>s;s++)this._model.data[a.children_d[s]].state.checked&&(!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,a.children_d[s]));return r.load_node.apply(this,arguments)},this.get_state=function(){var e=r.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?e:(e.checkbox=this._data.checkbox.selected.slice(),e)},this.set_state=function(t,i){var s=r.set_state.apply(this,arguments);if(s&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var n=this;e.each(t.checkbox,function(e,t){n.check_node(t)})}return delete t.checkbox,this.set_state(t,i),!1}return s},this.refresh=function(e,t){return this.settings.checkbox.tie_selection||(this._data.checkbox.selected=[]),r.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,i){this.settings.conditionalselect.call(this,this.get_node(e),i)&&t.activate_node.call(this,e,i)}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,i){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.create_node(r,{},"last",function(e){setTimeout(function(){i.edit(e)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.is_selected(r)?i.delete_node(i.get_selected()):i.delete_node(r)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.is_selected(r)?i.cut(i.get_top_selected()):i.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.is_selected(r)?i.copy(i.get_top_selected()):i.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var i=e.jstree.reference(t.reference),r=i.get_node(t.reference);i.paste(r)}}}}}}},e.jstree.plugins.contextmenu=function(i,r){this.bind=function(){r.bind.call(this);var t,i,s=0,n=null;this.element.on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e,t){e.preventDefault(),s=e.ctrlKey?+new Date:0,(t||n)&&(s=+new Date+1e4),n&&clearTimeout(n),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){this._data.contextmenu.visible&&(!s||+new Date-s>250)&&e.vakata.context.hide(),s=0},this)).on("touchstart.jstree",".jstree-anchor",function(r){r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(t=r.pageX,i=r.pageY,n=setTimeout(function(){e(r.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(e){n&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(Math.abs(t-e.pageX)>50||Math.abs(i-e.pageY)>50)&&clearTimeout(n)}).on("touchend.vakata.jstree",function(e){n&&clearTimeout(n)}),e(l).on("context_hide.vakata.jstree",e.proxy(function(e,t){this._data.contextmenu.visible=!1,t.reference.removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),r.teardown.call(this)},this.show_contextmenu=function(i,r,s,n){if(!(i=this.get_node(i))||i.id===e.jstree.root)return!1;var a=this.settings.contextmenu,o=this.get_node(i,!0),d=o.children(".jstree-anchor"),c=!1,l=!1;(a.show_at_node||r===t||s===t)&&(c=d.offset(),r=c.left,s=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(i)&&this.activate_node(i,n),l=a.items,e.isFunction(l)&&(l=l.call(this,i,e.proxy(function(e){this._show_contextmenu(i,r,s,e)},this))),e.isPlainObject(l)&&this._show_contextmenu(i,r,s,l)},this._show_contextmenu=function(t,i,r,s){var n=this.get_node(t,!0),a=n.children(".jstree-anchor");e(l).one("context_show.vakata.jstree",e.proxy(function(t,i){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(i.element).addClass(r),a.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(a,{x:i,y:r},s),this.trigger("show_contextmenu",{node:t,x:i,y:r})}},function(e){var t=!1,i={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(l).triggerHandler("context_"+t+".vakata",{reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_execute:function(t){return!(!(t=i.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:i.reference,element:i.element}))||!t.action)&&t.action.call(null,{item:t,reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_parse:function(t,r){if(!t)return!1;r||(i.html="",i.items=[]);var s,n="",a=!1;return r&&(n+="<ul>"),e.each(t,function(t,r){return!r||(i.items.push(r),!a&&r.separator_before&&(n+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>"),a=!1,n+="<li class='"+(r._class||"")+(!0===r._disabled||e.isFunction(r._disabled)&&r._disabled({item:r,reference:i.reference,element:i.element})?" vakata-contextmenu-disabled ":"")+"' "+(r.shortcut?" data-shortcut='"+r.shortcut+"' ":"")+">",n+="<a href='#' rel='"+(i.items.length-1)+"'>",e.vakata.context.settings.icons&&(n+="<i ",r.icon&&(n+=-1!==r.icon.indexOf("/")||-1!==r.icon.indexOf(".")?" style='background:url(\""+r.icon+"\") center center no-repeat' ":" class='"+r.icon+"' "),n+="></i><span class='vakata-contextmenu-sep'> </span>"),n+=(e.isFunction(r.label)?r.label({item:t,reference:i.reference,element:i.element}):r.label)+(r.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+r.shortcut+'">'+(r.shortcut_label||"")+"</span>":"")+"</a>",r.submenu&&(s=e.vakata.context._parse(r.submenu,!0))&&(n+=s),n+="</li>",void(r.separator_after&&(n+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>",a=!0)))}),n=n.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),r&&(n+="</ul>"),r||(i.html=n,e.vakata.context._trigger("parse")),n.length>10&&n},_show_submenu:function(i){if(i=e(i),i.length&&i.children("ul").length){var r=i.children("ul"),s=i.offset().left,n=s+i.outerWidth(),a=i.offset().top,o=r.width(),d=r.height(),c=e(window).width()+e(window).scrollLeft(),l=e(window).height()+e(window).scrollTop();t?i[n-(o+10+i.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):i[n+o>c&&s>c-n?"addClass":"removeClass"]("vakata-context-right"),a+d+10>l&&r.css("bottom","-1px"),i.hasClass("vakata-context-right")?o>s&&r.css("margin-right",s-o):o>c-n&&r.css("margin-left",c-n-o),r.show()}},show:function(r,s,n){var a,o,d,c,l,h,_,u;switch(i.element&&i.element.length&&i.element.width(""),!0){case!s&&!r:return!1;case!!s&&!!r:i.reference=r,i.position_x=s.x,i.position_y=s.y;break;case!s&&!!r:i.reference=r,a=r.offset(),i.position_x=a.left+r.outerHeight(),i.position_y=a.top;break;case!!s&&!r:i.position_x=s.x,i.position_y=s.y}r&&!n&&e(r).data("vakata_contextmenu")&&(n=e(r).data("vakata_contextmenu")),e.vakata.context._parse(n)&&i.element.html(i.html),i.items.length&&(i.element.appendTo("body"),o=i.element,d=i.position_x,c=i.position_y,l=o.width(),h=o.height(),_=e(window).width()+e(window).scrollLeft(),u=e(window).height()+e(window).scrollTop(),t&&(d-=o.outerWidth()-e(r).outerWidth())<e(window).scrollLeft()+20&&(d=e(window).scrollLeft()+20),d+l+20>_&&(d=_-(l+20)),c+h+20>u&&(c=u-(h+20)),i.element.css({left:d,top:c}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),i.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){i.is_visible&&(i.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),i.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){t="rtl"===e("body").css("direction");var r=!1;i.element=e("<ul class='vakata-context'></ul>"),i.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(r&&clearTimeout(r),i.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(r=setTimeout(function(t){return function(){e.vakata.context.hide()}}(),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()}).on("keydown","a",function(t){var r=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:i.is_visible&&(i.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:i.is_visible&&(r=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),r.length||(r=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:i.is_visible&&(i.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:i.is_visible&&(r=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),r.length||(r=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),r.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=i.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()}),e(l).on("mousedown.vakata.jstree",function(t){i.is_visible&&!e.contains(i.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata.jstree",function(e,r){i.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&i.element.addClass("vakata-context-rtl").css("direction","rtl"),i.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var u,g;e.jstree.plugins.dnd=function(t,i){this.init=function(e,t){i.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in l.createElement("span")},this.bind=function(){i.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",e.proxy(function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0;if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var i=this.get_node(t.target),r=this.is_selected(i)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,s=r>1?r+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(s=e.vakata.html.escape(s)),i&&i.id&&i.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,r>1?this.get_top_selected(!0):[i],t))){if(u={jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:r>1?this.get_top_selected():[i.id]},g=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,u,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+s+'<ins class="jstree-copy" style="display:none;">+</ins></div>');e.vakata.dnd._trigger("start",t,{helper:e(),element:g,data:u})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:g,data:u}),!1}).on("drop.jstree",e.proxy(function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:g,data:u}),!1},this))},this.redraw_node=function(e,t,r,s){if((e=i.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{var n,a,o=null;for(n=0,a=e.childNodes.length;a>n;n++)if(e.childNodes[n]&&e.childNodes[n].className&&-1!==e.childNodes[n].className.indexOf("jstree-anchor")){o=e.childNodes[n];break}o&&o.setAttribute("draggable",!0)}return e}},e(function(){var i=!1,r=!1,s=!1,n=!1,a=e('<div id="jstree-marker"> </div>').hide();e(l).on("dnd_start.vakata.jstree",function(e,t){i=!1,s=!1,t&&t.data&&t.data.jstree&&a.appendTo("body")}).on("dnd_move.vakata.jstree",function(o,d){if(n&&(d.event&&"dragover"===d.event.type&&d.event.target===s.target||clearTimeout(n)),d&&d.data&&d.data.jstree&&(!d.event.target.id||"jstree-marker"!==d.event.target.id)){s=d.event;var c,l,h,_,u,g,f,p,m,v,j,y,x,k,b,w=e.jstree.reference(d.event.target),C=!1,S=!1,T=!1;if(w&&w._data&&w._data.dnd)if(a.attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")),b=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey)),d.helper.children().attr("class","jstree-"+w.get_theme()+" jstree-"+w.get_theme()+"-"+w.get_theme_variant()+" "+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[b?"show":"hide"](),d.event.target!==w.element[0]&&d.event.target!==w.get_container_ul()[0]||0!==w.get_container_ul().children().length){if((C=w.settings.dnd.large_drop_target?e(d.event.target).closest(".jstree-node").children(".jstree-anchor"):e(d.event.target).closest(".jstree-anchor"))&&C.length&&C.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(S=C.offset(),T=(d.event.pageY!==t?d.event.pageY:d.event.originalEvent.pageY)-S.top,h=C.outerHeight(),g=h/3>T?["b","i","a"]:T>h-h/3?["a","i","b"]:T>h/2?["i","a","b"]:["i","b","a"],e.each(g,function(t,s){switch(s){case"b":c=S.left-6,l=S.top,_=w.get_parent(C),u=C.parent().index();break;case"i":x=w.settings.dnd.inside_pos,k=w.get_node(C.parent()),c=S.left-2,l=S.top+h/2+1,_=k.id,u="first"===x?0:"last"===x?k.children.length:Math.min(x,k.children.length);break;case"a":c=S.left-6,l=S.top+h,_=w.get_parent(C),u=C.parent().index()+1}for(f=!0,p=0,m=d.data.nodes.length;m>p;p++)if(v=d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",j=u,"move_node"===v&&"a"===s&&d.data.origin&&d.data.origin===w&&_===w.get_parent(d.data.nodes[p])&&(y=w.get_node(_),j>e.inArray(d.data.nodes[p],y.children)&&(j-=1)),!(f=f&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(v,d.data.origin&&d.data.origin!==w?d.data.origin.get_node(d.data.nodes[p]):d.data.nodes[p],_,j,{dnd:!0,ref:w.get_node(C.parent()),pos:s,origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==w,is_foreign:!d.data.origin})))){w&&w.last_error&&(r=w.last_error());break}return"i"===s&&C.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(n=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,C),w.settings.dnd.open_timeout)),f?(i={ins:w,par:_,pos:"i"!==s||"last"!==x||0!==u||w.is_loaded(k)?u:"last"},a.css({left:c+"px",top:l+"px"}).show(),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=b?"copy":"move"),r={},g=!0,!1):void 0}),!0===g))return}else{for(f=!0,p=0,m=d.data.nodes.length;m>p&&(f=f&&w.check(d.data.origin&&(d.data.origin.settings.dnd.always_copy||d.data.origin.settings.dnd.copy&&(d.event.metaKey||d.event.ctrlKey))?"copy_node":"move_node",d.data.origin&&d.data.origin!==w?d.data.origin.get_node(d.data.nodes[p]):d.data.nodes[p],e.jstree.root,"last",{dnd:!0,ref:w.get_node(e.jstree.root),pos:"i",origin:d.data.origin,is_multi:d.data.origin&&d.data.origin!==w,is_foreign:!d.data.origin}));p++);if(f)return i={ins:w,par:e.jstree.root,pos:"last"},a.hide(),d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect=b?"copy":"move"))}i=!1,d.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),d.event.originalEvent&&d.event.originalEvent.dataTransfer&&(d.event.originalEvent.dataTransfer.dropEffect="none"),a.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(a.hide(),i=!1,s=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(t,o){if(n&&clearTimeout(n),o&&o.data&&o.data.jstree){a.hide().detach();var d,c,l=[];if(i){for(d=0,c=o.data.nodes.length;c>d;d++)l[d]=o.data.origin?o.data.origin.get_node(o.data.nodes[d]):o.data.nodes[d];i.ins[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node"](l,i.par,i.pos,!1,!1,!1,o.data.origin)}else d=e(o.event.target).closest(".jstree"),d.length&&r&&r.error&&"check"===r.error&&(d=d.jstree(!0))&&d.settings.core.error.call(this,r);s=!1,i=!1}}).on("keyup.jstree keydown.jstree",function(t,o){(o=e.vakata.dnd._get())&&o.data&&o.data.jstree&&("keyup"===t.type&&27===t.which?(n&&clearTimeout(n),i=!1,r=!1,s=!1,n=!1,a.hide().detach(),e.vakata.dnd._clean()):(o.helper.find(".jstree-copy").first()[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),s&&(s.metaKey=t.metaKey,s.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",s))))})}),function(e){e.vakata.html={div:e("<div />"),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}};var i={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:50},_trigger:function(i,r,s){s===t&&(s=e.vakata.dnd._get()),s.event=r,e(l).triggerHandler("dnd_"+i+".vakata",s)},_get:function(){return{data:i.data,element:i.element,helper:i.helper}},_clean:function(){i.helper&&i.helper.remove(),i.scroll_i&&(clearInterval(i.scroll_i),i.scroll_i=!1),i={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},e(l).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!i.scroll_e||!i.scroll_l&&!i.scroll_t)return i.scroll_i&&(clearInterval(i.scroll_i),i.scroll_i=!1),!1;if(!i.scroll_i)return i.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(!0===t)return!1;var r=i.scroll_e.scrollTop(),s=i.scroll_e.scrollLeft();i.scroll_e.scrollTop(r+i.scroll_t*e.vakata.dnd.settings.scroll_speed),i.scroll_e.scrollLeft(s+i.scroll_l*e.vakata.dnd.settings.scroll_speed),r===i.scroll_e.scrollTop()&&s===i.scroll_e.scrollLeft()||e.vakata.dnd._trigger("scroll",i.scroll_e)},start:function(t,r,s){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(e){}return i.init_x=t.pageX,i.init_y=t.pageY,i.data=r,i.is_down=!0,i.element=t.currentTarget,i.target=t.target,i.is_touch="touchstart"===t.type,!1!==s&&(i.helper=e("<div id='vakata-dnd'></div>").html(s).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(l).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(l).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_down){if(!i.is_drag){if(!(Math.abs(t.pageX-i.init_x)>(i.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-i.init_y)>(i.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;i.helper&&(i.helper.appendTo("body"),i.helper_w=i.helper.outerWidth()),i.is_drag=!0,e.vakata.dnd._trigger("start",t)}var r=!1,s=!1,n=!1,a=!1,o=!1,d=!1,c=!1,h=!1,_=!1,u=!1;return i.scroll_t=0,i.scroll_l=0,i.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var r=e(this),s=r.offset();return this.scrollHeight>this.offsetHeight&&(s.top+r.height()-t.pageY<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),t.pageY-s.top<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(s.left+r.width()-t.pageX<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),t.pageX-s.left<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1)),i.scroll_t||i.scroll_l?(i.scroll_e=e(this),!1):void 0}),i.scroll_e||(r=e(l),s=e(window),n=r.height(),a=s.height(),o=r.width(),d=s.width(),c=r.scrollTop(),h=r.scrollLeft(),n>a&&t.pageY-c<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1),n>a&&a-(t.pageY-c)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),o>d&&t.pageX-h<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1),o>d&&d-(t.pageX-h)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),(i.scroll_t||i.scroll_l)&&(i.scroll_e=r)),i.scroll_e&&e.vakata.dnd._scroll(!0),i.helper&&(_=parseInt(t.pageY+e.vakata.dnd.settings.helper_top,10),u=parseInt(t.pageX+e.vakata.dnd.settings.helper_left,10),n&&_+25>n&&(_=n-50),o&&u+i.helper_w>o&&(u=o-(i.helper_w+2)),i.helper.css({left:u+"px",top:_+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=l.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag)e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===i.target){var r=setTimeout(function(){e(t.target).click()},100);e(t.target).one("click",function(){r&&clearTimeout(r)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,i){this.init=function(e,t){this._data.massload={},i.init.call(this,e,t)},this._load_nodes=function(t,r,s,n){var a,o,d,c=this.settings.massload,l=(JSON.stringify(t),[]),h=this._model.data;if(!s){for(a=0,o=t.length;o>a;a++)h[t[a]]&&(h[t[a]].state.loaded||h[t[a]].state.failed)&&!n||(l.push(t[a]),(d=this.get_node(t[a],!0))&&d.length&&d.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},l.length){if(e.isFunction(c))return c.call(this,l,e.proxy(function(e){var a,o;if(e)for(a in e)e.hasOwnProperty(a)&&(this._data.massload[a]=e[a]);for(a=0,o=t.length;o>a;a++)(d=this.get_node(t[a],!0))&&d.length&&d.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,r,s,n)},this));if("object"==typeof c&&c&&c.url)return c=e.extend(!0,{},c),e.isFunction(c.url)&&(c.url=c.url.call(this,l)),e.isFunction(c.data)&&(c.data=c.data.call(this,l)),e.ajax(c).done(e.proxy(function(e,a,o){var c,l;if(e)for(c in e)e.hasOwnProperty(c)&&(this._data.massload[c]=e[c]);for(c=0,l=t.length;l>c;c++)(d=this.get_node(t[c],!0))&&d.length&&d.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,r,s,n)},this)).fail(e.proxy(function(e){i._load_nodes.call(this,t,r,s,n)},this))}}return i._load_nodes.call(this,t,r,s,n)},this._load_node=function(t,r){var s,n=this._data.massload[t.id],a=null;return n?(a=this["string"==typeof n?"_append_html_data":"_append_json_data"](t,"string"==typeof n?e(e.parseHTML(n)).filter(function(){return 3!==this.nodeType}):n,function(e){r.call(this,e)}),s=this.get_node(t.id,!0),s&&s.length&&s.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],a):i._load_node.call(this,t,r)}},e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(i,r){this.bind=function(){r.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",e.proxy(function(t,i){if(this._data.search.som&&i.res.length){var r,s,n,a,o=this._model.data,d=[];for(r=0,s=i.res.length;s>r;r++)if(o[i.res[r]]&&!o[i.res[r]].state.hidden&&(d.push(i.res[r]),d=d.concat(o[i.res[r]].parents),this._data.search.smc))for(n=0,a=o[i.res[r]].children_d.length;a>n;n++)o[o[i.res[r]].children_d[n]]&&!o[o[i.res[r]].children_d[n]].state.hidden&&d.push(o[i.res[r]].children_d[n]);d=e.vakata.array_remove_item(e.vakata.array_unique(d),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(d,!0),this.redraw(!0)}},this)).on("clear_search.jstree",e.proxy(function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(i,r,s,n,a,o){if(!1===i||""===e.trim(i.toString()))return this.clear_search();n=this.get_node(n),n=n&&n.id?n.id:null,i=i.toString();var d,c,l=this.settings.search,h=!!l.ajax&&l.ajax,_=this._model.data,u=null,g=[],f=[];if(this._data.search.res.length&&!a&&this.clear_search(),s===t&&(s=l.show_only_matches),o===t&&(o=l.show_only_matches_children),!r&&!1!==h)return e.isFunction(h)?h.call(this,i,e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(i,!0,s,n,a)})},this),n):(h=e.extend({},h),h.data||(h.data={}),h.data.str=i,n&&(h.data.inside=n),e.ajax(h).fail(e.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(h)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(i,!0,s,n,a)})},this)));if(a||(this._data.search.str=i,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=s,this._data.search.smc=o),u=new e.vakata.search(i,!0,{caseSensitive:l.case_sensitive,fuzzy:l.fuzzy}),e.each(_[n||e.jstree.root].children_d,function(e,t){var r=_[t];r.text&&!r.state.hidden&&(!l.search_leaves_only||r.state.loaded&&0===r.children.length)&&(l.search_callback&&l.search_callback.call(this,i,r)||!l.search_callback&&u.search(r.text).isMatch)&&(g.push(t),f=f.concat(r.parents))}),g.length){for(f=e.vakata.array_unique(f),d=0,c=f.length;c>d;d++)f[d]!==e.jstree.root&&_[f[d]]&&!0===this.open_node(f[d],null,0)&&this._data.search.opn.push(f[d]);a?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(g,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(g))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(g,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=g),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:i,res:this._data.search.res,show_only_matches:s})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this.redraw_node=function(t,i,s,n){if((t=r.redraw_node.apply(this,arguments))&&-1!==e.inArray(t.id,this._data.search.res)){var a,o,d=null;for(a=0,o=t.childNodes.length;o>a;a++)if(t.childNodes[a]&&t.childNodes[a].className&&-1!==t.childNodes[a].className.indexOf("jstree-anchor")){d=t.childNodes[a];break}d&&(d.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,i,r){r=r||{},r=e.extend({},e.vakata.search.defaults,r),!1!==r.fuzzy&&(r.fuzzy=!0),t=r.caseSensitive?t:t.toLowerCase();var s,n,a,o,d=r.location,c=r.distance,l=r.threshold,h=t.length;return h>32&&(r.fuzzy=!1),r.fuzzy&&(s=1<<h-1,n=function(){var e={},i=0;for(i=0;h>i;i++)e[t.charAt(i)]=0;for(i=0;h>i;i++)e[t.charAt(i)]|=1<<h-i-1;return e}(),a=function(e,t){var i=e/h,r=Math.abs(d-t);return c?i+r/c:r?1:i}),o=function(e){if(e=r.caseSensitive?e:e.toLowerCase(),t===e||-1!==e.indexOf(t))return{isMatch:!0,score:0};if(!r.fuzzy)return{isMatch:!1,score:1};var i,o,c,_,u,g,f,p,m,v=e.length,j=l,y=e.indexOf(t,d),x=h+v,k=1,b=[];for(-1!==y&&(j=Math.min(a(0,y),j),-1!==(y=e.lastIndexOf(t,d+h))&&(j=Math.min(a(0,y),j))),y=-1,i=0;h>i;i++){for(c=0,_=x;_>c;)a(i,d+_)<=j?c=_:x=_,_=Math.floor((x-c)/2+c);for(x=_,g=Math.max(1,d-_+1),f=Math.min(d+_,v)+h,p=new Array(f+2),p[f+1]=(1<<i)-1,o=f;o>=g;o--)if(m=n[e.charAt(o-1)],p[o]=0===i?(p[o+1]<<1|1)&m:(p[o+1]<<1|1)&m|(u[o+1]|u[o])<<1|1|u[o+1],p[o]&s&&(k=a(i,o-1),j>=k)){if(j=k,y=o-1,b.push(y),!(y>d))break;g=Math.max(1,2*d-y)}if(a(i+1,d)>j)break;u=p}return{isMatch:y>=0,score:k}},!0===i?{search:o}:o(i)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,i){this.bind=function(){i.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,i){var r,s;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),i))for(r=0,s=t.children_d.length;s>r;r++)this.sort(t.children_d[r],!1)}};var f=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1},e.jstree.plugins.state=function(t,i){this.bind=function(){i.bind.call(this);var t=e.proxy(function(){this.element.on(this.settings.state.events,e.proxy(function(){f&&clearTimeout(f),f=setTimeout(e.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",e.proxy(function(e,i){this.element.one("restore_state.jstree",t),this.restore_state()||t()},this))},this.save_state=function(){var t={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,JSON.stringify(t))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(i,r){r.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={default:{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(i,r){this.init=function(i,s){var n,a;if(s&&s.types&&s.types.default)for(n in s.types)if("default"!==n&&n!==e.jstree.root&&s.types.hasOwnProperty(n))for(a in s.types.default)s.types.default.hasOwnProperty(a)&&s.types[n][a]===t&&(s.types[n][a]=s.types.default[a]);r.init.call(this,i,s),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,i){r.refresh.call(this,t,i),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy(function(i,r){var s,n,a,o=this._model.data,d=r.nodes,c=this.settings.types,l="default";for(s=0,n=d.length;n>s;s++){if(l="default",o[d[s]].original&&o[d[s]].original.type&&c[o[d[s]].original.type]&&(l=o[d[s]].original.type),o[d[s]].data&&o[d[s]].data.jstree&&o[d[s]].data.jstree.type&&c[o[d[s]].data.jstree.type]&&(l=o[d[s]].data.jstree.type),o[d[s]].type=l,!0===o[d[s]].icon&&c[l].icon!==t&&(o[d[s]].icon=c[l].icon),c[l].li_attr!==t&&"object"==typeof c[l].li_attr)for(a in c[l].li_attr)if(c[l].li_attr.hasOwnProperty(a)){if("id"===a)continue;o[d[s]].li_attr[a]===t?o[d[s]].li_attr[a]=c[l].li_attr[a]:"class"===a&&(o[d[s]].li_attr.class=c[l].li_attr.class+" "+o[d[s]].li_attr.class)}if(c[l].a_attr!==t&&"object"==typeof c[l].a_attr)for(a in c[l].a_attr)if(c[l].a_attr.hasOwnProperty(a)){if("id"===a)continue;o[d[s]].a_attr[a]===t?o[d[s]].a_attr[a]=c[l].a_attr[a]:"href"===a&&"#"===o[d[s]].a_attr[a]?o[d[s]].a_attr.href=c[l].a_attr.href:"class"===a&&(o[d[s]].a_attr.class=c[l].a_attr.class+" "+o[d[s]].a_attr.class)}}o[e.jstree.root].type=e.jstree.root},this)),r.bind.call(this)},this.get_json=function(t,i,s){var n,a,o=this._model.data,d=i?e.extend(!0,{},i,{no_id:!1}):{},c=r.get_json.call(this,t,d,s);if(!1===c)return!1;if(e.isArray(c))for(n=0,a=c.length;a>n;n++)c[n].type=c[n].id&&o[c[n].id]&&o[c[n].id].type?o[c[n].id].type:"default",i&&i.no_id&&(delete c[n].id,c[n].li_attr&&c[n].li_attr.id&&delete c[n].li_attr.id,c[n].a_attr&&c[n].a_attr.id&&delete c[n].a_attr.id);else c.type=c.id&&o[c.id]&&o[c.id].type?o[c.id].type:"default",i&&i.no_id&&(c=this._delete_ids(c));return c},this._delete_ids=function(t){if(e.isArray(t)){for(var i=0,r=t.length;r>i;i++)t[i]=this._delete_ids(t[i]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(i,s,n,a,o){if(!1===r.check.call(this,i,s,n,a,o))return!1;s=s&&s.id?s:this.get_node(s),n=n&&n.id?n:this.get_node(n);var d,c,l,h,_=s&&s.id?o&&o.origin?o.origin:e.jstree.reference(s.id):null;switch(_=_&&_._model&&_._model.data?_._model.data:null,i){case"create_node":case"move_node":case"copy_node":if("move_node"!==i||-1===e.inArray(s.id,n.children)){if(d=this.get_rules(n),d.max_children!==t&&-1!==d.max_children&&d.max_children===n.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+i,data:JSON.stringify({chk:i,pos:a,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;if(d.valid_children!==t&&-1!==d.valid_children&&-1===e.inArray(s.type||"default",d.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+i,data:JSON.stringify({chk:i,pos:a,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;if(_&&s.children_d&&s.parents){for(c=0,l=0,h=s.children_d.length;h>l;l++)c=Math.max(c,_[s.children_d[l]].parents.length);c=c-s.parents.length+1}(0>=c||c===t)&&(c=1);do{if(d.max_depth!==t&&-1!==d.max_depth&&d.max_depth<c)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+i,data:JSON.stringify({chk:i,pos:a,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;n=this.get_node(n.parent),d=this.get_rules(n),c++}while(n)}}return!0},this.get_rules=function(e){if(!(e=this.get_node(e)))return!1;var i=this.get_type(e,!0);return i.max_depth===t&&(i.max_depth=-1),i.max_children===t&&(i.max_children=-1),i.valid_children===t&&(i.valid_children=-1),i},this.get_type=function(t,i){return!!(t=this.get_node(t))&&(i?e.extend({type:t.type},this.settings.types[t.type]):t.type)},this.set_type=function(i,r){var s,n,a,o,d,c,l,h,_=this._model.data;if(e.isArray(i)){for(i=i.slice(),n=0,a=i.length;a>n;n++)this.set_type(i[n],r);return!0}if(s=this.settings.types,i=this.get_node(i),!s[r]||!i)return!1;if(l=this.get_node(i,!0),l&&l.length&&(h=l.children(".jstree-anchor")),o=i.type,d=this.get_icon(i),i.type=r,(!0===d||s[o]&&s[o].icon!==t&&d===s[o].icon)&&this.set_icon(i,s[r].icon===t||s[r].icon),s[o].li_attr!==t&&"object"==typeof s[o].li_attr)for(c in s[o].li_attr)if(s[o].li_attr.hasOwnProperty(c)){if("id"===c)continue;"class"===c?(_[i.id].li_attr.class=(_[i.id].li_attr.class||"").replace(s[o].li_attr[c],""),l&&l.removeClass(s[o].li_attr[c])):_[i.id].li_attr[c]===s[o].li_attr[c]&&(_[i.id].li_attr[c]=null,l&&l.removeAttr(c))}if(s[o].a_attr!==t&&"object"==typeof s[o].a_attr)for(c in s[o].a_attr)if(s[o].a_attr.hasOwnProperty(c)){if("id"===c)continue;"class"===c?(_[i.id].a_attr.class=(_[i.id].a_attr.class||"").replace(s[o].a_attr[c],""),h&&h.removeClass(s[o].a_attr[c])):_[i.id].a_attr[c]===s[o].a_attr[c]&&("href"===c?(_[i.id].a_attr[c]="#",h&&h.attr("href","#")):(delete _[i.id].a_attr[c],h&&h.removeAttr(c)))}if(s[r].li_attr!==t&&"object"==typeof s[r].li_attr)for(c in s[r].li_attr)if(s[r].li_attr.hasOwnProperty(c)){if("id"===c)continue;_[i.id].li_attr[c]===t?(_[i.id].li_attr[c]=s[r].li_attr[c],l&&("class"===c?l.addClass(s[r].li_attr[c]):l.attr(c,s[r].li_attr[c]))):"class"===c&&(_[i.id].li_attr.class=s[r].li_attr[c]+" "+_[i.id].li_attr.class,l&&l.addClass(s[r].li_attr[c]))}if(s[r].a_attr!==t&&"object"==typeof s[r].a_attr)for(c in s[r].a_attr)if(s[r].a_attr.hasOwnProperty(c)){if("id"===c)continue;_[i.id].a_attr[c]===t?(_[i.id].a_attr[c]=s[r].a_attr[c],h&&("class"===c?h.addClass(s[r].a_attr[c]):h.attr(c,s[r].a_attr[c]))):"href"===c&&"#"===_[i.id].a_attr[c]?(_[i.id].a_attr.href=s[r].a_attr.href,h&&h.attr("href",s[r].a_attr.href)):"class"===c&&(_[i.id].a_attr.class=s[r].a_attr.class+" "+_[i.id].a_attr.class,h&&h.addClass(s[r].a_attr[c]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(i,r){this.check=function(t,i,s,n,a){if(!1===r.check.call(this,t,i,s,n,a))return!1;if(i=i&&i.id?i:this.get_node(i),!(s=s&&s.id?s:this.get_node(s))||!s.children)return!0;var o,d,c="rename_node"===t?n:i.text,l=[],h=this.settings.unique.case_sensitive,_=this._model.data;for(o=0,d=s.children.length;d>o;o++)l.push(h?_[s.children[o]].text:_[s.children[o]].text.toLowerCase());switch(h||(c=c.toLowerCase()),t){case"delete_node":return!0;case"rename_node":return o=-1===e.inArray(c,l)||i.text&&i.text[h?"toString":"toLowerCase"]()===c,o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:n,obj:!(!i||!i.id)&&i.id,par:!(!s||!s.id)&&s.id})}),o;case"create_node":return o=-1===e.inArray(c,l),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:n,obj:!(!i||!i.id)&&i.id,par:!(!s||!s.id)&&s.id})}),o;case"copy_node":return o=-1===e.inArray(c,l),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:n,obj:!(!i||!i.id)&&i.id,par:!(!s||!s.id)&&s.id})}),o;case"move_node":return o=i.parent===s.id&&(!a||!a.is_multi)||-1===e.inArray(c,l),o||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+c+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:n,obj:!(!i||!i.id)&&i.id,par:!(!s||!s.id)&&s.id})}),o}return!0},this.create_node=function(i,s,n,a,o){if(!s||s.text===t){if(null===i&&(i=e.jstree.root),!(i=this.get_node(i)))return r.create_node.call(this,i,s,n,a,o);if(n=n===t?"last":n,!n.toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(i))return r.create_node.call(this,i,s,n,a,o);s||(s={});var d,c,l,h,_,u=this._model.data,g=this.settings.unique.case_sensitive,f=this.settings.unique.duplicate;for(c=d=this.get_string("New node"),l=[],h=0,_=i.children.length;_>h;h++)l.push(g?u[i.children[h]].text:u[i.children[h]].text.toLowerCase());for(h=1;-1!==e.inArray(g?c:c.toLowerCase(),l);)c=f.call(this,d,++h).toString();s.text=c}return r.create_node.call(this,i,s,n,a,o)}};var p=l.createElement("DIV");if(p.setAttribute("unselectable","on"),p.setAttribute("role","presentation"),p.className="jstree-wholerow",p.innerHTML=" ",e.jstree.plugins.wholerow=function(t,i){this.bind=function(){i.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var i,r,s=!1;for(i=0,r=t.selected.length;r>i;i++)(s=this.get_node(t.selected[i],!0))&&s.length&&s.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",e.proxy(function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy(function(t){if(this._data.contextmenu){t.preventDefault();var i=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i)}},this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var i=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var i=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),i.teardown.call(this)},this.redraw_node=function(t,r,s,n){if(t=i.redraw_node.apply(this,arguments)){var a=p.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(a.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(a.className+=" jstree-wholerow-hovered"),t.insertBefore(a,t.childNodes[0])}return t}},l.registerElement&&Object&&Object.create){var m=Object.create(HTMLElement.prototype);m.createdCallback=function(){var t,i={core:{},plugins:[]};for(t in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(i.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(i[t]=JSON.parse(this.getAttribute(t))));for(t in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(i.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t));e(this).jstree(i)};try{l.registerElement("vakata-jstree",{prototype:m})}catch(e){}}}})},32:function(e,t,i){function r(e,t){for(var i=e.length;i--;)if(s(e[i][0],t))return i;return-1}var s=i(80);e.exports=r},33:function(e,t,i){var r=i(21),s=r(Object,"create");e.exports=s},34:function(e,t,i){function r(e,t){var i=e.__data__;return s(t)?i["string"==typeof t?"string":"hash"]:i.map}var s=i(170);e.exports=r},344:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=(i(71),i(79),i(147)),s=i.n(r),n=i(345),a=i.n(n),o=i(30),d=i.n(o),c=i(0),l=i.n(c),h=i(102),_=i.n(h),u=i(11),g=i.n(u),f=i(16),p=new g.a({options:{dropdownSelector:".js-cms-pagetree-dropdown",triggerSelector:".js-cms-pagetree-dropdown-trigger",menuSelector:".js-cms-pagetree-dropdown-menu",openCls:"cms-pagetree-dropdown-menu-open"},initialize:function(e){this.options=l.a.extend(!0,{},this.options,e),this.click="click.cms.pagetree.dropdown",this._setupUI(),this._events()},_setupUI:function(){this.ui={container:this.options.container,document:l()(document)}},_events:function(){var e=this;this.ui.container.on(this.click,this.options.triggerSelector,function(t){t.preventDefault(),t.stopImmediatePropagation(),e._toggleDropdown(this)}),this.ui.container.on(this.click,e.options.menuSelector,function(e){e.stopImmediatePropagation()}),this.ui.container.on(this.click,e.options.menuSelector+" a",function(){e.closeAllDropdowns()}),this.ui.document.on(this.click,function(){e.closeAllDropdowns()})},_toggleDropdown:function(e){var t=l()(this.options.dropdownSelector),i=l()(e).closest(this.options.dropdownSelector);if(i.hasClass(this.options.openCls))return t.removeClass(this.options.openCls),!1;t.removeClass(this.options.openCls),i.addClass(this.options.openCls),this._loadContent(i)},_loadContent:function(e){var t=e.data();if(!t.lazyUrl||t.loaded)return!1;var i=setTimeout(function(){e.find(".js-cms-pagetree-dropdown-loader").addClass("cms-loader")},200);l.a.ajax({url:t.lazyUrl,data:t.lazyUrlData}).done(function(t){e.find(".js-cms-pagetree-dropdown-menu").html(t),e.data("loaded",!0),clearTimeout(i)})},closeAllDropdowns:function(){l()(this.options.dropdownSelector).removeClass(this.options.openCls)}}),m=p,v=new g.a({initialize:function(e){var t=this;t.options=l.a.extend(!0,{},t.options,e),t.resize="resize.cms.pagetree.header",t.scroll="scroll.cms.pagetree.header",t.areClonesInDOM=!1,t._setupUI(),t._saveSizes(),t._events()},_setupUI:function(){var e=this.options.container,t=e.find(".jstree-grid-header");this.ui={container:e,window:l()(window),headers:t,columns:e.find(".jstree-grid-column").toArray().map(function(e){return l()(e)}),clones:t.clone().toArray().map(function(e){return l()(e)})}},_saveSizes:function(){this.headersTopOffset=this.ui.headers.offset().top,this.toolbarHeight=0,this._isInSideframe()?this.toolbarHeight=CMS.API.Helpers._getWindow().parent.CMS.$(".cms-toolbar").height():this.toolbarHeight=l()("#branding").height()},_isInSideframe:function(){var e=f.c._getWindow();return!(!e||!e.parent||e.parent===e)},_events:function(){this.ui.window.on([this.resize,this.scroll].join(" "),this._handleResizeOrScroll.bind(this))},_handleResizeOrScroll:function(){var e=this,t=e.ui.window.scrollTop(),i=e.ui.window.scrollLeft();e._shouldStick(t)?e._stickHeader(t,i):e._unstickHeader()},_shouldStick:function(e){return e+this.toolbarHeight>=this.headersTopOffset},_stickHeader:function(e,t){var i=this;i._insertClones(),i.ui.headers.each(function(e){var r=l()(this),s=i.ui.clones[e].css("width"),n=i.ui.clones[e].offset().left;r.css({width:s,left:n-t})}),i.ui.headers.addClass("jstree-grid-header-fixed").css({top:i.toolbarHeight})},_unstickHeader:function(){var e=this;e._detachClones(),e.ui.headers.removeClass("jstree-grid-header-fixed").css({top:0,width:"auto",left:"auto"})},_insertClones:function(){var e=this;e.areClonesInDOM||(e.ui.columns.forEach(function(t,i){t.prepend(e.ui.clones[i])}),e.areClonesInDOM=!0)},_detachClones:function(){var e=this;e.areClonesInDOM&&(e.ui.clones.forEach(function(e){e.detach()}),e.areClonesInDOM=!1)}}),j=v,y=(i(227),i(346),new g.a({options:{pasteSelector:".js-cms-tree-item-paste"},initialize:function(e){var t=l()(".js-cms-pagetree").data("json");if(this.options=l.a.extend(!0,{},this.options,t,e),this.click="click.cms.pagetree",this.clipboard={id:null,origin:null,type:""},this.successTimer=1e3,this._setupUI(),this._events(),f.c.csrf(this.options.csrf),this._setupLanguages(),l.a.isEmptyObject(t)||t.empty){this._getClipboard();var i=this;this.ui.container.on(this.click,this.options.pasteSelector,function(e){e.preventDefault(),l()(this).hasClass("cms-pagetree-dropdown-item-disabled")||i._paste(e)})}else this._setup()},_setupUI:function(){var e=l()(".cms-pagetree");this.ui={container:e,document:l()(document),tree:e.find(".js-cms-pagetree"),dialog:l()(".js-cms-tree-dialog"),siteForm:l()(".js-cms-pagetree-site-form"),languagesSelect:l()(".js-cms-pagetree-languages")}},_setupLanguages:function(){var e=this;this.ui.languagesSelect.on("change",function(){var t=e.ui.languagesSelect.val(),i=new _.a(window.location.href).removeSearch("language").addSearch("language",t).toString();window.location.href=i})},_setup:function(){var e=this,t=[],i={language:this.options.lang.code,openNodes:[]},r=!1;l.a.each(this.options.columns,function(e,i){""===i.key?t.push({wideValueClass:i.wideValueClass,wideValueClassPrefix:i.wideValueClassPrefix,header:i.title,width:i.width||"1%",wideCellClass:i.cls}):t.push({wideValueClass:i.wideValueClass,wideValueClassPrefix:i.wideValueClassPrefix,header:i.title,value:function(e){return e.data?e.data["col"+i.key.replace("-","")]:""},width:i.width||"1%",wideCellClass:i.cls})}),this.options.filtered||(r={url:this.options.urls.tree,cache:!1,data:function(t){return"#"===t.id?i.nodeId=null:i.nodeId=e._storeNodeId(t.data.nodeId),i.openNodes=e._getStoredNodeIds(),i.site=e.options.site,i}}),this.ui.tree.jstree({core:{animation:0,check_callback:function(t,i,r,s,n){return("move_node"===t||"copy_node"===t)&&n&&n.pos&&("i"===n.pos?l()("#jstree-marker").addClass("jstree-marker-child"):l()("#jstree-marker").removeClass("jstree-marker-child")),e._hasPermission(r,"add")},data:r,strings:{"Loading ...":this.options.lang.loading,"New node":this.options.lang.newNode,nodes:this.options.lang.nodes},error:function(t){var i=JSON.parse(t.data);"check"===t.error&&i&&"move_node"===i.chk||e.showError(t.reason)},themes:{name:"django-cms"},multiple:!1},plugins:["dnd","search","grid"],dnd:{inside_pos:"last",drag_selection:!1,is_draggable:function(t){return e._hasPermission(t[0],"move")&&!e.options.filtered},large_drop_target:!0,copy:!0,touch:"selected"},grid:{width:"100%",columns:t}})},_events:function(){var e=this,t=this;this.ui.tree.on("after_close.jstree",function(e,i){t._removeNodeId(i.node.data.nodeId)}),this.ui.tree.on("after_open.jstree",function(e,i){t._storeNodeId(i.node.data.nodeId),this.clipboard&&!this.clipboard.isPasting&&t._updatePasteHelpersState()}),this.ui.document.on("keydown.pagetree.alt-mode",function(e){e.keyCode===f.d.SHIFT&&t.ui.container.addClass("cms-pagetree-alt-mode")}),this.ui.document.on("keyup.pagetree.alt-mode",function(e){e.keyCode===f.d.SHIFT&&t.ui.container.removeClass("cms-pagetree-alt-mode")}),l()(window).on("mousemove.pagetree.alt-mode",d()(function(e){e.shiftKey?t.ui.container.addClass("cms-pagetree-alt-mode"):t.ui.container.removeClass("cms-pagetree-alt-mode")},200)).on("blur.cms",function(){t.ui.container.removeClass("cms-pagetree-alt-mode")}),this.ui.document.on("dnd_start.vakata",function(e,i){var r=l()(i.element),s=r.parent();t._dropdowns.closeAllDropdowns(),s.addClass("jstree-is-dragging"),i.data.nodes.forEach(function(e){[e].concat(t._getDescendantsIds(e)).forEach(function(e){l()(".jsgrid_"+e+"_col").addClass("jstree-is-dragging")})}),s.hasClass("jstree-leaf")||i.helper.addClass("is-stacked")});var i=!1;this.ui.document.on("dnd_move.vakata",function(e,t){t.data.origin&&(t.data.origin.settings.dnd.always_copy||t.data.origin.settings.dnd.copy&&(t.event.metaKey||t.event.ctrlKey))?i||(l()(".jstree-is-dragging").addClass("jstree-is-dragging-copy"),i=!0):i&&(l()(".jstree-is-dragging").removeClass("jstree-is-dragging-copy"),i=!1)}),this.ui.document.on("dnd_stop.vakata",function(e,i){l()(i.element).parent().removeClass("jstree-is-dragging jstree-is-dragging-copy"),i.data.nodes.forEach(function(e){[e].concat(t._getDescendantsIds(e)).forEach(function(e){l()(".jsgrid_"+e+"_col").removeClass("jstree-is-dragging jstree-is-dragging-copy")})})}),this.ui.tree.on("move_node.jstree copy_node.jstree",function(e,i){!t.clipboard.type&&"copy_node"!==e.type||"cut"===t.clipboard.type?t._moveNode(t._getNodePosition(i)).done(function(){var e=t.ui.tree.jstree(!0);e._hide_grid(e.get_node(i.parent)),"#"===i.parent||i.node&&i.node.data&&i.node.data.isHome?e.refresh():e.refresh_node(i.parent)}):t._copyNode(i),t.ui.tree.jstree("open_node",i.parent)}),this.ui.container.on(this.click,".js-cms-tree-item-cut",function(e){e.preventDefault(),t._cutOrCopy({type:"cut",element:l()(this)})}),this.ui.container.on(this.click,".js-cms-tree-item-copy",function(e){e.preventDefault(),t._cutOrCopy({type:"copy",element:l()(this)})}),this.ui.container.on(this.click,this.options.pasteSelector,function(e){e.preventDefault(),l()(this).hasClass("cms-pagetree-dropdown-item-disabled")||t._paste(e)}),this.ui.container.on(this.click,".js-cms-tree-advanced-settings",function(e){if(e.shiftKey){e.preventDefault();var t=l()(this);t.data("url")&&(window.location.href=t.data("url"))}}),this.ui.container.on(this.click,".js-cms-pagetree-add-page",function(t){var i=e._getNodeId(l()(t.target)),r=e.ui.tree.jstree("get_node",i);e._storeNodeId(r.data.id)}),this.ui.document.on(this.click,".messagelist .cms-tree-reload",function(e){e.preventDefault(),t._reloadHelper()}),this.ui.container.find(".js-cms-pagetree-site-trigger").on(this.click,function(e){e.preventDefault();var i=l()(this);if(i.parent().hasClass("active"))return!1;t.ui.siteForm.find("select").val(i.data().id).end().submit()}),this._setupDropdowns(),this._setupSearch(),this._setAjaxPost(".js-cms-tree-item-menu a"),this._setAjaxPost(".js-cms-tree-lang-trigger"),this._setAjaxPost(".js-cms-tree-item-set-home a"),this._setupPageView(),this._setupStickyHeader(),this.ui.tree.on("ready.jstree",function(){return e._getClipboard()})},_getClipboard:function(){this.clipboard=CMS.settings.pageClipboard||this.clipboard,this.clipboard.type&&this.clipboard.origin&&(this._enablePaste(),this._updatePasteHelpersState())},_cutOrCopy:function(e){if("copy"===e.type&&e.element.data().apphook)return this.showError(this.options.lang.apphook),!1;var t=this._getNodeId(e.element.closest(".jstree-grid-cell"));this.clipboard.type===e.type&&t===this.clipboard.id?(this.clipboard.type=null,this.clipboard.id=null,this.clipboard.origin=null,this.clipboard.source_site=null,this._disablePaste()):(this.clipboard.origin=e.element.data().id,this.clipboard.type=e.type,this.clipboard.id=t,this.clipboard.source_site=this.options.site,this._updatePasteHelpersState()),"copy"!==this.clipboard.type&&this.clipboard.type||(CMS.settings.pageClipboard=this.clipboard,f.c.setSettings(CMS.settings))},_paste:function(e){this._disablePaste();var t=this._getNodeId(l()('.js-cms-pagetree-options[data-id="'+this.clipboard.origin+'"]').closest(".jstree-grid-cell")),i=this._getNodeId(l()(e.currentTarget));if(this.clipboard.source_site===this.options.site)"cut"===this.clipboard.type?this.ui.tree.jstree("cut",t):this.ui.tree.jstree("copy",t),this.clipboard.isPasting=!0,this.ui.tree.jstree("paste",i,"last");else{var r=this.ui.tree.jstree("create_node",i,"Loading","last");this.ui.tree.length?(this.ui.tree.jstree("cut",r),this.clipboard.isPasting=!0,this.ui.tree.jstree("paste",i,"last")):("copy"===this.clipboard.type&&this._copyNode(),"cut"===this.clipboard.type&&this._moveNode())}this.clipboard.id=null,this.clipboard.type=null,this.clipboard.origin=null,this.clipboard.isPasting=!1,CMS.settings.pageClipboard=this.clipboard,f.c.setSettings(CMS.settings)},_getStoredNodeIds:function(){return CMS.settings.pagetree||[]},_storeNodeId:function(e){var t=e,i=this._getStoredNodeIds();return-1===i.indexOf(t)&&i.push(t),CMS.settings.pagetree=i,f.c.setSettings(CMS.settings),t},_removeNodeId:function(e){var t=this.ui.tree.jstree(!0),i=t.get_node({id:CMS.$("[data-node-id="+e+"]").attr("id")}).children_d,r=[e].concat(i.map(function(e){var i=t.get_node({id:e});return i&&i.data?i.data.nodeId:i})),n=a.a.apply(void 0,[this._getStoredNodeIds()].concat(s()(r)));return CMS.settings.pagetree=n,f.c.setSettings(CMS.settings),e},_moveNode:function(e){var t=this;return!e.id&&"cut"===this.clipboard.type&&this.clipboard.origin?(e.id=this.clipboard.origin,e.source_site=this.clipboard.source_site):e.site=t.options.site,l.a.ajax({method:"post",url:t.options.urls.move.replace("{id}",e.id),data:e}).done(function(i){i.status&&400===i.status?t.showError(i.content):t._showSuccess(e.id)}).fail(function(e){t.showError(e.statusText)})},_copyNode:function(e){var t=this,i={position:0};e&&(i=t._getNodePosition(e));var r={id:this.clipboard.origin||e.original.data.id,position:i.position};this.clipboard.source_site?r.source_site=this.clipboard.source_site:r.source_site=this.options.site,i.target&&(r.target=i.target),t.options.permission?(l.a.ajax({method:"post",url:t.options.urls.copyPermission.replace("{id}",r.id),data:r}).done(function(e){t.ui.dialog.append(e)}).fail(function(e){t.showError(e.statusText)}),this.ui.dialog.off(this.click,".cancel").on(this.click,".cancel",function(i){i.preventDefault(),t.ui.tree.jstree("delete_node",e.node.id),l()(".js-cms-dialog").remove(),l()(".js-cms-dialog-dimmer").remove()}).off(this.click,".submit").on(this.click,".submit",function(e){e.preventDefault();var i=l()(this),s=i.closest("form").serialize().split("&");i.prop("disabled",!0);for(var n=0;n<s.length;n++)r[s[n].split("=")[0]]=s[n].split("=")[1];t._saveCopiedNode(r)})):this._saveCopiedNode(r)},_saveCopiedNode:function(e){var t=this;return l.a.ajax({method:"post",url:t.options.urls.copy.replace("{id}",e.id),data:e}).done(function(e){e.status&&400===e.status?t.showError(e.content):t._reloadHelper()}).fail(function(e){t.showError(e.statusText)})},_getNodeId:function(e){var t=e.closest(".jstree-grid-cell").attr("class");return t?t.replace(/.*jsgrid_(.+?)_col.*/,"$1"):"#"},_getNodePosition:function(e){var t={},i=this.ui.tree.jstree("get_node",e.node.parent);return t.position=e.position,"#"!==e.parent&&(t.target=i.data.id),e.node&&e.node.data&&(t.id=e.node.data.id),t},_setupDropdowns:function(){this._dropdowns=new m({container:this.ui.container})},_setupPageView:function(){var e=f.c._getWindow(),t=e.parent?e.parent:e;this.ui.container.on(this.click,".js-cms-pagetree-page-view",function(){t.CMS.API.Helpers.setSettings(l.a.extend(!0,{},CMS.settings,{sideframe:{url:null,hidden:!0}}))})},_setupStickyHeader:function(){var e=this;e.ui.tree.on("ready.jstree",function(){e.header=new j({container:e.ui.container})})},_setAjaxPost:function(e){var t=this;this.ui.container.on(this.click,e,function(e){if(e.preventDefault(),!l()(this).closest(".cms-pagetree-dropdown-item-disabled").length){try{window.top.CMS.API.Toolbar.showLoader()}catch(e){}l.a.ajax({method:"post",url:l()(this).attr("href")}).done(function(){try{window.top.CMS.API.Toolbar.hideLoader()}catch(e){}window.self===window.top?t._reloadHelper():f.c.reloadBrowser("REFRESH_PAGE")}).fail(function(e){t.showError(e.statusText)})}})},_setupSearch:function(){var e=this,t=this.click+".search",i=!1,r=this.ui.container.find(".js-cms-pagetree-header-filter-trigger"),s=this.ui.container.find(".js-cms-pagetree-header-filter-container"),n=s.find(".js-cms-pagetree-header-search-close"),a="cms-pagetree-header-filter-active",o=l()(".cms-pagetree-header"),d=this.ui.container.find(".js-cms-pagetree-header-search"),c=this.ui.container.find(".js-cms-pagetree-header-search-copy form"),h=this.ui.container.find(".cms-pagetree-header-filter"),_=h.find("#field-searchbar");_.on("focus",function(e){e.stopImmediatePropagation(),o.addClass(a)}),_.on("blur",function(r){r.stopImmediatePropagation(),setTimeout(function(){i||o.removeClass(a)},200),e.ui.document.off(t)}),r.add(n).on(t,function(n){n.preventDefault(),n.stopImmediatePropagation(),i?(s.hide(),o.removeClass(a),e.ui.document.off(t),i=!1):(s.show(),o.addClass(a),e.ui.document.on(t,function(){i=!0,r.trigger(t)}),i=!0)}),s.on("click",function(e){e.stopImmediatePropagation()}),d.append(c.find('input[type="hidden"]'))},_enablePaste:function(e){var t=void 0===e?this.options.pasteSelector:e+" "+this.options.pasteSelector,i=".js-cms-pagetree-actions-dropdown";void 0!==e&&(i=e+" .js-cms-pagetree-actions-dropdown"),l()(t).removeClass("cms-pagetree-dropdown-item-disabled");var r={};"cut"===this.clipboard.type?r.has_cut=!0:r.has_copy=!0,l()(i).data("lazyUrlData",r)},_disablePaste:function(e){var t=void 0===e?this.options.pasteSelector:e+" "+this.options.pasteSelector,i=".js-cms-pagetree-actions-dropdown";void 0!==e&&(i=e+" .js-cms-pagetree-actions-dropdown"),l()(t).addClass("cms-pagetree-dropdown-item-disabled"),l()(i).removeData("lazyUrlData")},_updatePasteHelpersState:function(){var e=this;if(this.clipboard.type&&this.clipboard.id&&this._enablePaste(),"cut"===this.clipboard.type&&this.clipboard.origin&&this.options.site===this.clipboard.source_site){var t=this._getDescendantsIds(this.clipboard.id),i=[this.clipboard.id];t&&t.length&&(i=i.concat(t)),i.forEach(function(t){e._disablePaste(".jsgrid_"+t+"_col")})}},_showSuccess:function(e){var t=this.ui.tree.find('li[data-id="'+e+'"]');t.addClass("cms-tree-node-success"),setTimeout(function(){t.removeClass("cms-tree-node-success")},this.successTimer),this._disablePaste(),this.clipboard.id=null},_reloadHelper:function(){window.self===window.top?f.c.reloadBrowser():window.location.reload()},showError:function(e){var t=l()(".messagelist"),i=l()(".breadcrumbs"),r=this.options.lang.reload,s='<ul class="messagelist"> <li class="error"> {msg} <a href="#reload" class="cms-tree-reload"> '+r+" </a> </li></ul>",n=s.replace("{msg}","<strong>"+this.options.lang.error+"</strong> "+e);t.length?t.replaceWith(n):i.after(n)},_getDescendantsIds:function(e){return this.ui.tree.jstree(!0).get_node(e).children_d},_hasPermission:function(e,t){return"#"===e.id&&"add"===t?this.options.hasAddRootPermission:"#"!==e.id&&"true"===e.li_attr["data-"+t+"-permission"]}}));y._init=function(){new y},l()(function(){window.CMS.config={isPageTree:!0,settings:{toolbar:"expanded",version:"4.0.1.dev4"},urls:{settings:l()(".js-cms-pagetree").data("settings-url")}},window.CMS.settings=f.c.getSettings(),CMS.PageTree._init()});var x=y;window.CMS.PageTree=x},345:function(e,t,i){var r=i(179),s=i(110),n=i(111),a=s(function(e,t){return n(e)?r(e,t):[]});e.exports=a},346:function(e,t,i){var r,s,n;!function(a){s=[i(0),i(227)],r=a,void 0!==(n="function"==typeof r?r.apply(t,s):r)&&(e.exports=n)}(function(e){var t,i,r,s,n=/^\s*$/g,a=/[\\:&!^|()\[\]<>@*'+~#";,= \/${}%]/g,o=function(e){return(e||"").replace(a,"\\$&")},d=!1,c=function(e,t){return e.find("div[data-jstreegrid='"+t+"']")},l=!1,h=null,_=0,u=0;r=/<\/?[^>]+>/gi,i=function(t,i){var r,s,n,a;return i._gridSettings=i._gridSettings||{},i._gridSettings.indent>0?a=i._gridSettings.indent:(r=e("<div></div>"),s=t.prev("i"),n=s.parent(),r.addClass(i.get_node("#",!0).attr("class")),n.appendTo(r),r.appendTo(e("body")),a=s.width()||24,n.detach(),r.remove(),i._gridSettings.indent=a),a},s=function(e,t){var i=e.get_node(t),r=i.children;return!r||r.length<=0||!i.state.opened?t:s(e,r[r.length-1])},t=function(e,t,i){var s,n="a"===e.get(0).tagName.toLowerCase()?e:e.children("a"),a=i.settings.grid.columns[0];s="",a.title&&("_DATA_"===a.title?s=i.get_text(t):t.attr(a.title)&&(s=t.attr(a.title))),(s=s.replace(r,""))&&n.attr("title",s)},e.jstree.defaults.grid={width:"auto"},e.jstree.plugins.grid=function(i,a){this._initialize=function(){if(!this._initialized){var t,i,r=this.settings.grid||{},s=this.element,n=s.parent(),a=this._gridSettings={columns:r.columns||[],treeClass:"jstree-grid-col-0",context:r.contextmenu||!1,columnWidth:r.columnWidth,defaultConf:{"*display":"inline","*+display":"inline"},isThemeroller:!!this._data.themeroller,treeWidthDiff:0,resizable:r.resizable,indent:0},o=a.columns,c=0;for(i=0;i<r.columns.length;i++)if(r.columns[i].tree){c=i;break}this.uniq=Math.ceil(1e3*Math.random()),this.treecol=c,this.rootid=s.attr("id");if(/msie/.test(navigator.userAgent.toLowerCase())){parseFloat(navigator.appVersion.split("MSIE")[1])<8&&(a.defaultConf.display="inline",a.defaultConf.zoom="1")}for(d||(d=!0,t=[".jstree-grid-cell {vertical-align: top; overflow:hidden;margin-left:0;position:relative;width: 100%;padding-left:7px;white-space: nowrap;}",".jstree-grid-cell span {margin-right:0px;margin-right:0px;*display:inline;*+display:inline;white-space: nowrap;}",".jstree-grid-separator {position:relative; height:24px; float:right;margin-left: -2px; border-width: 0 2px 0 0; *display:inline; *+display:inline; margin-right:0px;width:0px;}",".jstree-grid-header-cell {overflow: hidden; white-space: nowrap;padding: 1px 3px 2px 5px;}",".jstree-grid-header-themeroller {border: 0; padding: 1px 3px;}",".jstree-grid-header-regular {background-color: #EBF3FD;}",".jstree-grid-resizable-separator {cursor: col-resize; width: 2px;}",".jstree-grid-separator-regular {border-color: #d0d0d0; border-style: solid;}",".jstree-grid-cell-themeroller {border: none !important; background: transparent !important;}",".jstree-grid-wrapper {width: 100%; overflow-x: auto;}",".jstree-grid-midwrapper {display: table-row; overflow: visible;}",".jstree-grid-width-auto {width:auto;display:block;}",".jstree-grid-column {display: table-cell; overflow: hidden;}",".jstree-grid-col-0 {width: 100%;}"],e('<style type="text/css">'+t.join("\n")+"</style>").appendTo("head")),this.gridWrapper=e("<div></div>").addClass("jstree-grid-wrapper").appendTo(n),this.midWrapper=e("<div></div>").addClass("jstree-grid-midwrapper").appendTo(this.gridWrapper),r.width&&this.gridWrapper.width(r.width),i=0;i<o.length;i++)e("<div></div>").addClass("jstree-grid-column jstree-grid-column-"+i+" jstree-grid-column-root-"+this.rootid).appendTo(this.midWrapper);this.midWrapper.children("div:eq("+c+")").append(s),s.addClass("jstree-grid-cell"),this._initialized=!0}},this.init=function(e,t){a.init.call(this,e,t),this._initialize()},this.bind=function(){a.bind.call(this),this._initialize(),this.element.on("move_node.jstree create_node.jstree clean_node.jstree change_node.jstree",e.proxy(function(e,t){var i=this.get_node(t||"#",!0);this._prepare_grid(i)},this)).on("delete_node.jstree",e.proxy(function(e,t){if(void 0!==t.node.id){var i,r=this.gridWrapper,s=[t.node.id];for(t.node&&t.node.children_d&&(s=s.concat(t.node.children_d)),i=0;i<s.length;i++)c(r,s[i]).remove()}},this)).on("close_node.jstree",e.proxy(function(e,t){this._hide_grid(t.node)},this)).on("open_node.jstree",e.proxy(function(e,t){},this)).on("load_node.jstree",e.proxy(function(e,t){},this)).on("loaded.jstree",e.proxy(function(e){this._prepare_headers(),this.element.trigger("loaded_grid.jstree")},this)).on("ready.jstree",e.proxy(function(t,i){var r=this.element.find("li a:first").outerHeight();e('<style type="text/css">div.jstree-grid-cell-root-'+this.rootid+" {line-height: "+r+"px}</style>").appendTo("head"),this.gridWrapper.addClass(this.element.attr("class"))},this)).on("move_node.jstree",e.proxy(function(t,i){i.new_instance.element.find("li > a").each(e.proxy(function(e,t){},this))},this)).on("hover_node.jstree",e.proxy(function(e,t,i){var r=t.node.id;null!==this._hover_node&&void 0!==this._hover_node&&c(this.gridWrapper,this._hover_node).removeClass("jstree-hovered"),this._hover_node=r,c(this.gridWrapper,r).addClass("jstree-hovered")},this)).on("dehover_node.jstree",e.proxy(function(e,t,i){var r=t.node.id;this._hover_node=null,c(this.gridWrapper,r).removeClass("jstree-hovered")},this)).on("select_node.jstree",e.proxy(function(e,t,i){var r=t.node.id;c(this.gridWrapper,r).addClass("jstree-clicked"),this.get_node(t.node.id,!0).children("div.jstree-grid-cell").addClass("jstree-clicked")},this)).on("deselect_node.jstree",e.proxy(function(e,t,i){var r=t.node.id;c(this.gridWrapper,r).removeClass("jstree-hovered")},this)).on("deselect_all.jstree",e.proxy(function(e,t,i){var r,s=t.node||[];for(r=0;r<s.length;r++)c(this.gridWrapper,s[r]).removeClass("jstree-clicked")},this)).on("search.jstree",e.proxy(function(e,t){var i=this.gridWrapper;return this._data.search.som&&t.nodes.length&&(i.find("div.jstree-grid-cell:not(:first)").hide(),t.nodes.add(t.nodes.parentsUntil(".jstree")).filter(".jstree-node").each(function(e,t){var r=t.id;r&&c(i,r).show()})),!0},this)).on("clear_search.jstree",e.proxy(function(e,t){return this.gridWrapper.find("div.jstree-grid-cell").show(),!0},this)),this._gridSettings.isThemeroller&&this.element.on("select_node.jstree",e.proxy(function(e,t){t.rslt.obj.children("a").nextAll("div").addClass("ui-state-active")},this)).on("deselect_node.jstree deselect_all.jstree",e.proxy(function(e,t){t.rslt.obj.children("a").nextAll("div").removeClass("ui-state-active")},this)).on("hover_node.jstree",e.proxy(function(e,t){t.rslt.obj.children("a").nextAll("div").addClass("ui-state-hover")},this)).on("dehover_node.jstree",e.proxy(function(e,t){t.rslt.obj.children("a").nextAll("div").removeClass("ui-state-hover")},this))},this.teardown=function(){var e=this.gridWrapper,t=this.element,i=e.parent();t.detach(),e.remove(),i.append(t),a.teardown.call(this)},this._clean_grid=function(e,t){var i=this.gridWrapper;e?c(i,t).remove():i.find("div.jstree-grid-cell:not(:first)").remove()},this._prepare_headers=function(){var t,i,r,s,n,a,o,d,c=this._gridSettings,g=c.columns||[],f=c.columnWidth,p=c.resizable||!1,m=c.isThemeroller,v=m?"themeroller":"regular",j=!1,y=this.gridparent,x=c.defaultConf,k=0,b=0;for(this.parent=y,t=0;t<g.length;t++)s=g[t].headerClass||"",n=g[t].columnClass||"",a=g[t].header||"",a&&(j=!0),r=g[t].width||f,k=m?7:10,"auto"!==r&&"string"!=typeof r&&(r-=k),o=0===t?3:0,i=this.midWrapper.children("div.jstree-grid-column-"+t),d=e("<div></div>").css(x).css({"margin-left":o}).addClass("jstree-grid-div-"+this.uniq+"-"+t+" "+(m?"ui-widget-header ":"")+" jstree-grid-header jstree-grid-header-cell jstree-grid-header-"+v+" "+s+" "+n).html(a),d.addClass((m?"ui-widget-header ":"")+"jstree-grid-header jstree-grid-header-"+v),d.prependTo(i),b+=d.outerWidth(),e("<div class='jstree-grid-separator jstree-grid-separator-"+v+(m?" ui-widget-header":"")+(p?" jstree-grid-resizable-separator":"")+"'> </div>").appendTo(d),i.width(r),i.css("min-width",r),i.css("max-width",r);d.addClass((m?"ui-widget-header ":"")+"jstree-grid-header jstree-grid-header-last jstree-grid-header-"+v),void 0===g[g.length-1].width&&(b-=r,i.css({width:"auto"}),d.addClass("jstree-grid-width-auto").next(".jstree-grid-separator").remove()),j?c.header=void 0:e("div.jstree-grid-header").hide(),!this.bound&&p&&(this.bound=!0,e(document).mouseup(function(){var t,i,r,s,n,a,o;if(l){for(o=h.closest(".jstree-grid-wrapper").find(".jstree"),i=e.jstree.reference(o),r=i.settings.grid.columns,n=h.parent().children("div.jstree-grid-column"),s=[],isNaN(0)&&(i._gridSettings.treeWidthDiff=o.find("ins:eq(0)").width()+o.find("a:eq(0)").width()-i._gridSettings.columns[0].width),l=!1,h=null,t=0;t<r.length;t++)a=parseFloat(n[t].style.width),s[t]={w:a,r:0===t},i._gridSettings.columns[t].width=a;o.trigger("resize_column.jstree-grid",s)}}).mousemove(function(e){if(l){u=e.pageX;var t,i,r,s=u-_;0!==s&&(t=h.width(),i=parseFloat(h.css("width")),i||(i=h.innerWidth()),s=s<0?Math.max(s,-t):s,r=i+s+"px",(s>0||t>0)&&(h.width(r),h.css("min-width",r),h.css("max-width",r),_=u))}}),this.gridWrapper.on("selectstart",".jstree-grid-resizable-separator",function(){return!1}).on("mousedown",".jstree-grid-resizable-separator",function(t){return l=!0,_=t.pageX,h=e(this).closest("div.jstree-grid-column"),!1}).on("dblclick",".jstree-grid-resizable-separator",function(t){var i,r,s=e(this),n=s.closest("div.jstree-grid-column"),a=parseFloat(n.css("width")),o=0,d=n.width();n.find(".jstree-grid-cell").each(function(){var t,i=e(this);i.css("position","absolute"),i.css("width","auto"),t=i.outerWidth(),i.css("position","relative"),t>o&&(o=t)}),i=o-a,i=i<0?Math.max(i,-d):i,r=a+i+"px",n.width(r),n.css("min-width",r),n.css("max-width",r)}))},this.redraw_node=function(e,t,i,r){return e=a.redraw_node.call(this,e,t,i,r),e&&this._prepare_grid(e),e},this.refresh=function(){return this._clean_grid(),a.refresh.apply(this,arguments)},this._hide_grid=function(e){var t,i=e&&e.children_d?e.children_d:[];for(t=0;t<i.length;t++)c(this.gridWrapper,i[t]).remove()},this.holdingCells={},this.getHoldingCells=function(t,i,r){var s,n,a=e(),d=t.children||[];for(n=0;n<d.length;n++)s="jsgrid_"+o(d[n])+"_col"+i,r[s]&&t.state.opened&&(a=a.add(r[s]).add(this.getHoldingCells(this.get_node(d[n]),i,r)));return a},this._edit=function(t,i,r){if(!t)return!1;if(!r)return!1;r=e(r),"div"===r.prop("tagName").toLowerCase()&&(r=r.children("span:first"));var s=this._data.core.rtl,n=this.element.width(),a=t.data[i.value],o=e("<div />",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),d=e("<input />",{value:a,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(){var e=d.val();""===e||e===a?e=a:(t.data[i.value]=e,this.element.trigger("update_cell.jstree-grid",{node:t,col:i.value,value:e,old:a}),this._prepare_grid(this.get_node(t,!0))),d.remove(),r.show()},this),keydown:function(e){var t=e.which;27===t&&(this.value=a),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){d.width(Math.min(o.text("pW"+this.value).width(),n))},keypress:function(e){if(13===e.which)return!1}}),c={fontFamily:r.css("fontFamily")||"",fontSize:r.css("fontSize")||"",fontWeight:r.css("fontWeight")||"",fontStyle:r.css("fontStyle")||"",fontStretch:r.css("fontStretch")||"",fontVariant:r.css("fontVariant")||"",letterSpacing:r.css("letterSpacing")||"",wordSpacing:r.css("wordSpacing")||""};r.hide(),r.parent().append(d),d.css(c).width(Math.min(o.text("pW"+d[0].value).width(),n))[0].select()},this._prepare_grid=function(i){var a,d,l,h,_,u,g,f,p,m,v,j,y,x,k,b,w,C,S,T,A,N,O,P,E,I,D,M=this._gridSettings,z=M.treeClass,L=this,H=M.columns||[],K=M.isThemeroller,W=this.element,q=this.rootid,$=K?"themeroller":"regular",F=this.get_node(i),U=M.columnWidth,Y=M.defaultConf,X=this.midWrapper,J=F.id,B=this.get_node(F.parent).children,V=e.inArray(J,B),R=this.holdingCells,G=!1;if(a=e(i),p=a.children("a"),1===p.length){for(!F.state.opened,b="jsgrid_"+o(J)+"_col",w="#"===F.parent?null:F.parent,p.addClass(z),t(p,a,L),m=p,h=0;h<H.length;h++)this.treecol!==h&&(E=H[h],D=X.children("div:eq("+h+")"),u=E.cellClass||"",g=E.wideCellClass||"",f=E.columnClass||"",D.addClass(f),_=void 0!==E.value&&null!==E.value?"function"==typeof E.value?E.value(F):null!==F.data&&void 0!==F.data&&void 0!==F.data[E.value]?F.data[E.value]:"":"","function"==typeof E.format&&(_=E.format(_)),E.images?(l=E.images[_]||E.images.default)&&(I="*"===l[0]?'<span class="'+l.substr(1)+'"></span>':'<img src="'+l+'">'):I=_,(void 0===I||null===I||n.test(I))&&(I=" "),v=E.valueClass&&null!==F.data&&void 0!==F.data?F.data[E.valueClass]||"":"",v&&E.valueClassPrefix&&""!==E.valueClassPrefix&&(v=E.valueClassPrefix+v),j=E.wideValueClass&&null!==F.data&&void 0!==F.data?F.data[E.wideValueClass]||"":"",j&&E.wideValueClassPrefix&&""!==E.wideValueClassPrefix&&(j=E.wideValueClassPrefix+j),k=E.title&&null!==F.data&&void 0!==F.data?F.data[E.title]||"":"",k=k.replace(r,""),x=7,d=E.width||U,"auto"!==d&&(d-=x),m=D.children("div#"+b+h),(!m||m.length<1)&&(m=e("<div></div>"),e("<span></span>").appendTo(m),m.attr("id",b+h),m.addClass(b),m.attr("data-jstreegrid",J)),T=V<=0?F.parent:s(this,B[V-1]),S=c(D,T),N=V>=B.length-1?"NULL":B[V+1],A=c(D,N),P=F.children&&F.children.length>0?F.children[0]:"NULL",O=c(D,P),C=c(D,w),w?(C&&C.length>0?(S&&S.length>0?m.insertAfter(S):O&&O.length>0?m.insertBefore(O):A&&A.length>0?m.insertBefore(A):m.insertAfter(C),G=!0):G=!1,R[b+h]=m):(S&&S.length>0?m.insertAfter(S):O&&O.length>0?m.insertBefore(O):A&&A.length>0?m.insertBefore(A):m.appendTo(D),G=!0),G&&m.after(this.getHoldingCells(F,h,R)),y=m.children("span"),y.addClass(u+" "+v).html(I),m=m.css(Y).addClass("jstree-grid-cell jstree-grid-cell-root-"+q+" jstree-grid-cell-"+$+" "+g+" "+j+(K?" ui-state-default":"")).addClass("jstree-grid-col-"+h),m.click(function(t,i,r,s,n){return function(n){i.children(".jstree-anchor").trigger("click.jstree",n),t.trigger("select_cell.jstree-grid",[{value:r,column:s.header,node:i,grid:e(this),sourceName:s.value}])}}(W,a,_,E)),m.on("contextmenu",function(t,i,r,s,n){return function(t){M.context&&(t.preventDefault(),e.vakata.context.show(this,{x:t.pageX,y:t.pageY},{edit:{label:"Edit",action:function(e){var r=n.get_node(i);L._edit(r,s,t.target)}}}))}}(0,a,0,E,this)),m.hover(function(e,t){return function(){t.hover_node(e)}}(a,this),function(e,t){return function(){t.dehover_node(e)}}(a,this)),k&&y.attr("title",k));m.addClass("jstree-grid-cell-last"+(K?" ui-state-default":"")),void 0===H[H.length-1].width&&m.addClass("jstree-grid-width-auto").next(".jstree-grid-separator").remove()}this.element.css({"overflow-y":"auto !important"})},this.holdingCells={}}})},52:function(e,t,i){function r(e){return null!=e&&n(e.length)&&!s(e)}var s=i(82),n=i(87);e.exports=r},61:function(e,t,i){function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}var s=i(153),n=i(154),a=i(155),o=i(156),d=i(157);r.prototype.clear=s,r.prototype.delete=n,r.prototype.get=a,r.prototype.has=o,r.prototype.set=d,e.exports=r},62:function(e,t){function i(e,t){for(var i=-1,r=null==e?0:e.length,s=Array(r);++i<r;)s[i]=t(e[i],i,e);return s}e.exports=i},63:function(e,t){function i(e){return e}e.exports=i},80:function(e,t){function i(e,t){return e===t||e!==e&&t!==t}e.exports=i},81:function(e,t,i){var r=i(21),s=i(12),n=r(s,"Map");e.exports=n},82:function(e,t,i){function r(e){if(!n(e))return!1;var t=s(e);return t==o||t==d||t==a||t==c}var s=i(31),n=i(15),a="[object AsyncFunction]",o="[object Function]",d="[object GeneratorFunction]",c="[object Proxy]";e.exports=r},83:function(e,t,i){function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}var s=i(162),n=i(169),a=i(171),o=i(172),d=i(173);r.prototype.clear=s,r.prototype.delete=n,r.prototype.get=a,r.prototype.has=o,r.prototype.set=d,e.exports=r},84:function(e,t,i){function r(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new s;++t<i;)this.add(e[t])}var s=i(83),n=i(174),a=i(175);r.prototype.add=r.prototype.push=n,r.prototype.has=a,e.exports=r},85:function(e,t){function i(e,t){return e.has(t)}e.exports=i},87:function(e,t){function i(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=i},98:function(e,t,i){var r=i(7);e.exports=function(e,t,i,s){try{return s?t(r(i)[0],i[1]):t(i)}catch(t){var n=e.return;throw void 0!==n&&r(n.call(e)),t}}},99:function(e,t,i){var r=i(14),s=i(1)("iterator"),n=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||n[s]===e)}}},[344]);