text: /** 
   * generate-uui v3.0.0
   * 合并构建UUI
   * author : guoyongfeng
   * homepage : https://github.com/iuap-design/generate-uui#readme
   * bugs : https://github.com/iuap-design/generate-uui/issues
   **/ 
  !function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!1,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(e){var t=data.getRoot(e);t||(t={},data.setRoot(e,t)),t[e.data.key.children]=[],t.expandTriggerFlag=!1,t.curSelectedList=[],t.noSelection=!0,t.createdNodes=[],t.zId=0,t._ver=(new Date).getTime()},_initCache=function(e){var t=data.getCache(e);t||(t={},data.setCache(e,t)),t.nodes=[],t.doms=[]},_bindEvent=function(e){var t=e.treeObj,n=consts.event;t.bind(n.NODECREATED,function(t,n,a){tools.apply(e.callback.onNodeCreated,[t,n,a])}),t.bind(n.CLICK,function(t,n,a,o,r){tools.apply(e.callback.onClick,[n,a,o,r])}),t.bind(n.EXPAND,function(t,n,a){tools.apply(e.callback.onExpand,[t,n,a])}),t.bind(n.COLLAPSE,function(t,n,a){tools.apply(e.callback.onCollapse,[t,n,a])}),t.bind(n.ASYNC_SUCCESS,function(t,n,a,o){tools.apply(e.callback.onAsyncSuccess,[t,n,a,o])}),t.bind(n.ASYNC_ERROR,function(t,n,a,o,r,i){tools.apply(e.callback.onAsyncError,[t,n,a,o,r,i])}),t.bind(n.REMOVE,function(t,n,a){tools.apply(e.callback.onRemove,[t,n,a])}),t.bind(n.SELECTED,function(t,n,a,o){tools.apply(e.callback.onSelected,[n,a,o])}),t.bind(n.UNSELECTED,function(t,n,a,o){tools.apply(e.callback.onUnSelected,[n,a,o])})},_unbindEvent=function(e){var t=e.treeObj,n=consts.event;t.unbind(n.NODECREATED).unbind(n.CLICK).unbind(n.EXPAND).unbind(n.COLLAPSE).unbind(n.ASYNC_SUCCESS).unbind(n.ASYNC_ERROR).unbind(n.REMOVE).unbind(n.SELECTED).unbind(n.UNSELECTED)},_eventProxy=function(e){var t=e.target,n=data.getSetting(e.data.treeId),a="",o=null,r="",i="",d=null,s=null,l=null;if(tools.eqs(e.type,"mousedown")?i="mousedown":tools.eqs(e.type,"mouseup")?i="mouseup":tools.eqs(e.type,"contextmenu")?i="contextmenu":tools.eqs(e.type,"click")?tools.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+consts.id.SWITCH)?(a=tools.getNodeMainDom(t).id,r="switchNode"):(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),l&&(a=tools.getNodeMainDom(l).id,r="clickNode")):tools.eqs(e.type,"dblclick")&&(i="dblclick",l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),l&&(a=tools.getNodeMainDom(l).id,r="switchNode")),i.length>0&&0==a.length&&(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),l&&(a=tools.getNodeMainDom(l).id)),a.length>0)switch(o=data.getNodeCache(n,a),r){case"switchNode":o.isParent&&(tools.eqs(e.type,"click")||tools.eqs(e.type,"dblclick")&&tools.apply(n.view.dblClickExpand,[n.treeId,o],n.view.dblClickExpand))?d=handler.onSwitchNode:r="";break;case"clickNode":d=handler.onClickNode}switch(i){case"mousedown":s=handler.onZTreeMousedown;break;case"mouseup":s=handler.onZTreeMouseup;break;case"dblclick":s=handler.onZTreeDblclick;break;case"contextmenu":s=handler.onZTreeContextmenu}var c={stop:!1,node:o,nodeEventType:r,nodeEventCallback:d,treeEventType:i,treeEventCallback:s};return c},_initNode=function(e,t,n,a,o,r,i){if(n){var d=data.getRoot(e),s=e.data.key.children;n.level=t,n.tId=e.treeId+"_"+ ++d.zId,n.parentTId=a?a.tId:null,n.open="string"==typeof n.open?tools.eqs(n.open,"true"):!!n.open,n[s]&&n[s].length>0?(n.isParent=!0,n.zAsync=!0):(n.isParent="string"==typeof n.isParent?tools.eqs(n.isParent,"true"):!!n.isParent,n.open=!(!n.isParent||e.async.enable)&&n.open,n.zAsync=!n.isParent),n.isFirstNode=o,n.isLastNode=r,n.getParentNode=function(){return data.getNodeCache(e,n.parentTId)},n.getPreNode=function(){return data.getPreNode(e,n)},n.getNextNode=function(){return data.getNextNode(e,n)},n.isAjaxing=!1,data.fixPIdKeyValue(e,n)}},_init={bind:[_bindEvent],unbind:[_unbindEvent],caches:[_initCache],nodes:[_initNode],proxys:[_eventProxy],roots:[_initRoot],beforeA:[],afterA:[],innerBeforeA:[],innerAfterA:[],zTreeTools:[]},data={addNodeCache:function(e,t){data.getCache(e).nodes[data.getNodeCacheId(t.tId)]=t},getNodeCacheId:function(e){return e.substring(e.lastIndexOf("_")+1)},addAfterA:function(e){_init.afterA.push(e)},addBeforeA:function(e){_init.beforeA.push(e)},addInnerAfterA:function(e){_init.innerAfterA.push(e)},addInnerBeforeA:function(e){_init.innerBeforeA.push(e)},addInitBind:function(e){_init.bind.push(e)},addInitUnBind:function(e){_init.unbind.push(e)},addInitCache:function(e){_init.caches.push(e)},addInitNode:function(e){_init.nodes.push(e)},addInitProxy:function(e,t){t?_init.proxys.splice(0,0,e):_init.proxys.push(e)},addInitRoot:function(e){_init.roots.push(e)},addNodesData:function(e,t,n){var a=e.data.key.children;t[a]||(t[a]=[]),t[a].length>0&&(t[a][t[a].length-1].isLastNode=!1,view.setNodeLineIcos(e,t[a][t[a].length-1])),t.isParent=!0,t[a]=t[a].concat(n)},addSelectedNode:function(e,t){var n=data.getRoot(e);data.isSelectedNode(e,t)||n.curSelectedList.push(t)},addCreatedNode:function(e,t){if(e.callback.onNodeCreated||e.view.addDiyDom){var n=data.getRoot(e);n.createdNodes.push(t)}},addZTreeTools:function(e){_init.zTreeTools.push(e)},exSetting:function(e){$.extend(!0,_setting,e)},fixPIdKeyValue:function(e,t){e.data.simpleData.enable&&(t[e.data.simpleData.pIdKey]=t.parentTId?t.getParentNode()[e.data.simpleData.idKey]:e.data.simpleData.rootPId)},getAfterA:function(e,t,n){for(var a=0,o=_init.afterA.length;a<o;a++)_init.afterA[a].apply(this,arguments)},getBeforeA:function(e,t,n){for(var a=0,o=_init.beforeA.length;a<o;a++)_init.beforeA[a].apply(this,arguments)},getInnerAfterA:function(e,t,n){for(var a=0,o=_init.innerAfterA.length;a<o;a++)_init.innerAfterA[a].apply(this,arguments)},getInnerBeforeA:function(e,t,n){for(var a=0,o=_init.innerBeforeA.length;a<o;a++)_init.innerBeforeA[a].apply(this,arguments)},getCache:function(e){return caches[e.treeId]},getNextNode:function(e,t){if(!t)return null;for(var n=e.data.key.children,a=t.parentTId?t.getParentNode():data.getRoot(e),o=0,r=a[n].length-1;o<=r;o++)if(a[n][o]===t)return o==r?null:a[n][o+1];return null},getNodeByParam:function(e,t,n,a){if(!t||!n)return null;for(var o=e.data.key.children,r=0,i=t.length;r<i;r++){if(t[r][n]==a)return t[r];var d=data.getNodeByParam(e,t[r][o],n,a);if(d)return d}return null},getNodeCache:function(e,t){if(!t)return null;var n=caches[e.treeId].nodes[data.getNodeCacheId(t)];return n?n:null},getNodeName:function(e,t){var n=e.data.key.name;return""+t[n]},getNodeTitle:function(e,t){var n=""===e.data.key.title?e.data.key.name:e.data.key.title;return""+t[n]},getNodes:function(e){return data.getRoot(e)[e.data.key.children]},getNodesByParam:function(e,t,n,a){if(!t||!n)return[];for(var o=e.data.key.children,r=[],i=0,d=t.length;i<d;i++)t[i][n]==a&&r.push(t[i]),r=r.concat(data.getNodesByParam(e,t[i][o],n,a));return r},getNodesByParamFuzzy:function(e,t,n,a){if(!t||!n)return[];var o=e.data.key.children,r=[];a=a.toLowerCase();for(var i=0,d=t.length;i<d;i++)"string"==typeof t[i][n]&&t[i][n].toLowerCase().indexOf(a)>-1&&r.push(t[i]),r=r.concat(data.getNodesByParamFuzzy(e,t[i][o],n,a));return r},getNodesByFilter:function(e,t,n,a,o){if(!t)return a?null:[];for(var r=e.data.key.children,i=a?null:[],d=0,s=t.length;d<s;d++){if(tools.apply(n,[t[d],o],!1)){if(a)return t[d];i.push(t[d])}var l=data.getNodesByFilter(e,t[d][r],n,a,o);if(a&&l)return l;i=a?l:i.concat(l)}return i},getPreNode:function(e,t){if(!t)return null;for(var n=e.data.key.children,a=t.parentTId?t.getParentNode():data.getRoot(e),o=0,r=a[n].length;o<r;o++)if(a[n][o]===t)return 0==o?null:a[n][o-1];return null},getRoot:function(e){return e?roots[e.treeId]:null},getRoots:function(){return roots},getSetting:function(e){return settings[e]},getSettings:function(){return settings},getZTreeTools:function(e){var t=this.getRoot(this.getSetting(e));return t?t.treeTools:null},initCache:function(e){for(var t=0,n=_init.caches.length;t<n;t++)_init.caches[t].apply(this,arguments)},initNode:function(e,t,n,a,o,r){for(var i=0,d=_init.nodes.length;i<d;i++)_init.nodes[i].apply(this,arguments)},initRoot:function(e){for(var t=0,n=_init.roots.length;t<n;t++)_init.roots[t].apply(this,arguments)},isSelectedNode:function(e,t){for(var n=data.getRoot(e),a=0,o=n.curSelectedList.length;a<o;a++)if(t===n.curSelectedList[a])return!0;return!1},removeNodeCache:function(e,t){var n=e.data.key.children;if(t[n])for(var a=0,o=t[n].length;a<o;a++)arguments.callee(e,t[n][a]);data.getCache(e).nodes[data.getNodeCacheId(t.tId)]=null},removeSelectedNode:function(e,t){for(var n=data.getRoot(e),a=0,o=n.curSelectedList.length;a<o;a++)t!==n.curSelectedList[a]&&data.getNodeCache(e,n.curSelectedList[a].tId)||(n.curSelectedList.splice(a,1),a--,o--)},setCache:function(e,t){caches[e.treeId]=t},setRoot:function(e,t){roots[e.treeId]=t},setZTreeTools:function(e,t){for(var n=0,a=_init.zTreeTools.length;n<a;n++)_init.zTreeTools[n].apply(this,arguments)},transformToArrayFormat:function(e,t){if(!t)return[];var n=e.data.key.children,a=[];if(tools.isArray(t))for(var o=0,r=t.length;o<r;o++)a.push(t[o]),t[o][n]&&(a=a.concat(data.transformToArrayFormat(e,t[o][n])));else a.push(t),t[n]&&(a=a.concat(data.transformToArrayFormat(e,t[n])));return a},transformTozTreeFormat:function(e,t){var n,a,o=e.data.simpleData.idKey,r=e.data.simpleData.pIdKey,i=e.data.key.children;if(!o||""==o||!t)return[];if(tools.isArray(t)){var d=[],s=[];for(n=0,a=t.length;n<a;n++)s[t[n][o]]=t[n];for(n=0,a=t.length;n<a;n++)s[t[n][r]]&&t[n][o]!=t[n][r]?(s[t[n][r]][i]||(s[t[n][r]][i]=[]),s[t[n][r]][i].push(t[n])):d.push(t[n]);return d}return[t]}},event={bindEvent:function(e){for(var t=0,n=_init.bind.length;t<n;t++)_init.bind[t].apply(this,arguments)},unbindEvent:function(e){for(var t=0,n=_init.unbind.length;t<n;t++)_init.unbind[t].apply(this,arguments)},bindTree:function(e){var t={treeId:e.treeId},n=e.treeObj;e.view.txtSelectedEnable||n.bind("selectstart",function(e){var t=e.originalEvent.srcElement.nodeName.toLowerCase();return"input"===t||"textarea"===t}).css({"-moz-user-select":"-moz-none"}),n.bind("click",t,event.proxy),n.bind("dblclick",t,event.proxy),n.bind("mouseover",t,event.proxy),n.bind("mouseout",t,event.proxy),n.bind("mousedown",t,event.proxy),n.bind("mouseup",t,event.proxy),n.bind("contextmenu",t,event.proxy)},unbindTree:function(e){var t=e.treeObj;t.unbind("click",event.proxy).unbind("dblclick",event.proxy).unbind("mouseover",event.proxy).unbind("mouseout",event.proxy).unbind("mousedown",event.proxy).unbind("mouseup",event.proxy).unbind("contextmenu",event.proxy)},doProxy:function(e){for(var t=[],n=0,a=_init.proxys.length;n<a;n++){var o=_init.proxys[n].apply(this,arguments);if(t.push(o),o.stop)break}return t},proxy:function(e){var t=data.getSetting(e.data.treeId);if(!tools.uCanDo(t,e))return!0;for(var n=event.doProxy(e),a=!0,o=!1,r=0,i=n.length;r<i;r++){var d=n[r];d.nodeEventCallback&&(o=!0,a=d.nodeEventCallback.apply(d,[e,d.node])&&a),d.treeEventCallback&&(o=!0,a=d.treeEventCallback.apply(d,[e,d.node])&&a)}return a}},handler={onSwitchNode:function(e,t){var n=data.getSetting(e.data.treeId);if(t.open){if(0==tools.apply(n.callback.beforeCollapse,[n.treeId,t],!0))return!0;data.getRoot(n).expandTriggerFlag=!0,view.switchNode(n,t)}else{if(0==tools.apply(n.callback.beforeExpand,[n.treeId,t],!0))return!0;data.getRoot(n).expandTriggerFlag=!0,view.switchNode(n,t)}return!0},onClickNode:function(e,t){$("#"+e.data.treeId+" a").removeClass("focusNode"),$("#"+t.tId+"_a").addClass("focusNode");var n=data.getSetting(e.data.treeId),a=n.view.autoCancelSelected&&(e.ctrlKey||e.metaKey)&&data.isSelectedNode(n,t)?0:n.view.autoCancelSelected&&(e.ctrlKey||e.metaKey)&&n.view.selectedMulti?2:1;return 0==tools.apply(n.callback.beforeClick,[n.treeId,t,a],!0)||(0===a?view.cancelPreSelectedNode(n,t):view.selectNode(n,t,2===a),n.treeObj.trigger(consts.event.CLICK,[e,n.treeId,t,a]),!0)},onZTreeMousedown:function(e,t){var n=data.getSetting(e.data.treeId);return tools.apply(n.callback.beforeMouseDown,[n.treeId,t],!0)&&tools.apply(n.callback.onMouseDown,[e,n.treeId,t]),!0},onZTreeMouseup:function(e,t){var n=data.getSetting(e.data.treeId);return tools.apply(n.callback.beforeMouseUp,[n.treeId,t],!0)&&tools.apply(n.callback.onMouseUp,[e,n.treeId,t]),!0},onZTreeDblclick:function(e,t){var n=data.getSetting(e.data.treeId);return tools.apply(n.callback.beforeDblClick,[n.treeId,t],!0)&&tools.apply(n.callback.onDblClick,[e,n.treeId,t]),!0},onZTreeContextmenu:function(e,t){var n=data.getSetting(e.data.treeId);return tools.apply(n.callback.beforeRightClick,[n.treeId,t],!0)&&tools.apply(n.callback.onRightClick,[e,n.treeId,t]),"function"!=typeof n.callback.onRightClick}},tools={apply:function(e,t,n){return"function"==typeof e?e.apply(zt,t?t:[]):n},canAsync:function(e,t){var n=e.data.key.children;return e.async.enable&&t&&t.isParent&&!(t.zAsync||t[n]&&t[n].length>0)},clone:function(e){if(null===e)return null;var t=tools.isArray(e)?[]:{};for(var n in e)t[n]=e[n]instanceof Date?new Date(e[n].getTime()):"object"==typeof e[n]?arguments.callee(e[n]):e[n];return t},eqs:function(e,t){return e.toLowerCase()===t.toLowerCase()},isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},$:function(e,t,n){return t&&"string"!=typeof t&&(n=t,t=""),"string"==typeof e?$(e,n?n.treeObj.get(0).ownerDocument:null):$("#"+e.tId+t,n?n.treeObj:null)},getMDom:function(e,t,n){if(!t)return null;for(;t&&t.id!==e.treeId;){for(var a=0,o=n.length;t.tagName&&a<o;a++)if(tools.eqs(t.tagName,n[a].tagName)&&null!==t.getAttribute(n[a].attrName))return t;t=t.parentNode}return null},getNodeMainDom:function(e){return $(e).parent("li").get(0)||$(e).parentsUntil("li").parent().get(0)},isChildOrSelf:function(e,t){return $(e).closest("#"+t).length>0},uCanDo:function(e,t){return!0}},view={addNodes:function(e,t,n,a){if(!e.data.keep.leaf||!t||t.isParent)if(tools.isArray(n)||(n=[n]),e.data.simpleData.enable&&(n=data.transformTozTreeFormat(e,n)),t){var o=$$(t,consts.id.SWITCH,e),r=$$(t,consts.id.ICON,e),i=$$(t,consts.id.UL,e);t.open||(view.replaceSwitchClass(t,o,consts.folder.CLOSE),view.replaceIcoClass(t,r,consts.folder.CLOSE),t.open=!1,i.css({display:"none"})),data.addNodesData(e,t,n),view.createNodes(e,t.level+1,n,t),a||view.expandCollapseParentNode(e,t,!0)}else data.addNodesData(e,data.getRoot(e),n),view.createNodes(e,0,n,null)},appendNodes:function(e,t,n,a,o,r){if(!n)return[];for(var i=[],d=e.data.key.children,s=0,l=n.length;s<l;s++){var c=n[s];if(o){var u=a?a:data.getRoot(e),h=u[d],p=h.length==n.length&&0==s,f=s==n.length-1;data.initNode(e,t,c,a,p,f,r),data.addNodeCache(e,c)}var g=[];c[d]&&c[d].length>0&&(g=view.appendNodes(e,t+1,c[d],c,o,r&&c.open)),r&&(view.makeDOMNodeMainBefore(i,e,c),view.makeDOMNodeLine(i,e,c),data.getBeforeA(e,c,i),view.makeDOMNodeNameBefore(i,e,c),data.getInnerBeforeA(e,c,i),view.makeDOMNodeIcon(i,e,c),data.getInnerAfterA(e,c,i),view.makeDOMNodeNameAfter(i,e,c),data.getAfterA(e,c,i),c.isParent&&c.open&&view.makeUlHtml(e,c,i,g.join("")),view.makeDOMNodeMainAfter(i,e,c),data.addCreatedNode(e,c))}return i},appendParentULDom:function(e,t){var n=[],a=$$(t,e);!a.get(0)&&t.parentTId&&(view.appendParentULDom(e,t.getParentNode()),a=$$(t,e));var o=$$(t,consts.id.UL,e);o.get(0)&&o.remove();var r=e.data.key.children,i=view.appendNodes(e,t.level+1,t[r],t,!1,!0);view.makeUlHtml(e,t,n,i.join("")),a.append(n.join(""))},asyncNode:function(setting,node,isSilent,callback){var i,l;if(node&&!node.isParent)return tools.apply(callback),!1;if(node&&node.isAjaxing)return!1;if(0==tools.apply(setting.callback.beforeAsync,[setting.treeId,node],!0))return tools.apply(callback),!1;if(node){node.isAjaxing=!0;var icoObj=$$(node,consts.id.ICON,setting);icoObj.attr({style:"","class":consts.className.BUTTON+" "+consts.className.ICO_LOADING})}var tmpParam={};for(i=0,l=setting.async.autoParam.length;node&&i<l;i++){var pKey=setting.async.autoParam[i].split("="),spKey=pKey;pKey.length>1&&(spKey=pKey[1],pKey=pKey[0]),tmpParam[spKey]=node[pKey]}if(tools.isArray(setting.async.otherParam))for(i=0,l=setting.async.otherParam.length;i<l;i+=2)tmpParam[setting.async.otherParam[i]]=setting.async.otherParam[i+1];else for(var p in setting.async.otherParam)tmpParam[p]=setting.async.otherParam[p];var _tmpV=data.getRoot(setting)._ver;return setting.async.selfLoadFunc&&"function"==typeof setting.async.selfLoadFunc?setting.async.selfLoadFunc.apply(this,node):$.ajax({contentType:setting.async.contentType,cache:!1,type:setting.async.type,url:tools.apply(setting.async.url,[setting.treeId,node],setting.async.url),data:tmpParam,dataType:setting.async.dataType,success:function(msg){if(_tmpV==data.getRoot(setting)._ver){var newNodes=[];try{newNodes=msg&&0!=msg.length?"string"==typeof msg?eval("("+msg+")"):msg:[]}catch(err){newNodes=msg}node&&(node.isAjaxing=null,node.zAsync=!0),view.setNodeLineIcos(setting,node),newNodes&&""!==newNodes?(newNodes=tools.apply(setting.async.dataFilter,[setting.treeId,node,newNodes],newNodes),view.addNodes(setting,node,newNodes?tools.clone(newNodes):[],!!isSilent)):view.addNodes(setting,node,[],!!isSilent),setting.treeObj.trigger(consts.event.ASYNC_SUCCESS,[setting.treeId,node,msg]),tools.apply(callback)}},error:function(e,t,n){_tmpV==data.getRoot(setting)._ver&&(node&&(node.isAjaxing=null),view.setNodeLineIcos(setting,node),setting.treeObj.trigger(consts.event.ASYNC_ERROR,[setting.treeId,node,e,t,n]))}}),!0},cancelPreSelectedNode:function(e,t,n){var a,o,r=data.getRoot(e).curSelectedList;for(a=r.length-1;a>=0;a--)if(o=r[a],t===o||!t&&(!n||n!==o)){if($$(o,consts.id.A,e).removeClass(consts.node.CURSELECTED),t){data.removeSelectedNode(e,t),e.treeObj.trigger(consts.event.UNSELECTED,[event,e.treeId,o]);break}r.splice(a,1),e.treeObj.trigger(consts.event.UNSELECTED,[event,e.treeId,o])}},createNodeCallback:function(e){if(e.callback.onNodeCreated||e.view.addDiyDom)for(var t=data.getRoot(e);t.createdNodes.length>0;){var n=t.createdNodes.shift();tools.apply(e.view.addDiyDom,[e.treeId,n]),e.callback.onNodeCreated&&e.treeObj.trigger(consts.event.NODECREATED,[e.treeId,n])}},createNodes:function(e,t,n,a){if(n&&0!=n.length){var o=data.getRoot(e),r=e.data.key.children,i=!a||a.open||!!$$(a[r][0],e).get(0);o.createdNodes=[];var d=view.appendNodes(e,t,n,a,!0,i);if(a){var s=$$(a,consts.id.UL,e);s.get(0)&&s.append(d.join(""))}else e.treeObj.append(d.join(""));view.createNodeCallback(e)}},destroy:function(e){e&&(data.initCache(e),data.initRoot(e),event.unbindTree(e),event.unbindEvent(e),e.treeObj.empty(),delete settings[e.treeId])},expandCollapseNode:function(e,t,n,a,o){var r=data.getRoot(e),i=e.data.key.children;if(!t)return void tools.apply(o,[]);if(r.expandTriggerFlag){var d=o;o=function(){d&&d(),t.open?e.treeObj.trigger(consts.event.EXPAND,[e.treeId,t]):e.treeObj.trigger(consts.event.COLLAPSE,[e.treeId,t])},r.expandTriggerFlag=!1}if(!t.open&&t.isParent&&(!$$(t,consts.id.UL,e).get(0)||t[i]&&t[i].length>0&&!$$(t[i][0],e).get(0))&&(view.appendParentULDom(e,t),view.createNodeCallback(e)),t.open==n)return void tools.apply(o,[]);var s=$$(t,consts.id.UL,e),l=$$(t,consts.id.SWITCH,e),c=$$(t,consts.id.ICON,e);t.isParent?(t.open=!t.open,t.iconOpen&&t.iconClose&&c.attr("style",view.makeNodeIcoStyle(e,t)),t.open?(view.replaceSwitchClass(t,l,consts.folder.OPEN),view.replaceIcoClass(t,c,consts.folder.OPEN),0==a||""==e.view.expandSpeed?(s.show(),tools.apply(o,[])):t[i]&&t[i].length>0?s.slideDown(e.view.expandSpeed,o):(s.show(),tools.apply(o,[]))):(view.replaceSwitchClass(t,l,consts.folder.CLOSE),view.replaceIcoClass(t,c,consts.folder.CLOSE),0!=a&&""!=e.view.expandSpeed&&t[i]&&t[i].length>0?s.slideUp(e.view.expandSpeed,o):(s.hide(),tools.apply(o,[])))):tools.apply(o,[])},expandCollapseParentNode:function(e,t,n,a,o){if(t){if(!t.parentTId)return void view.expandCollapseNode(e,t,n,a,o);view.expandCollapseNode(e,t,n,a),t.parentTId&&view.expandCollapseParentNode(e,t.getParentNode(),n,a,o)}},expandCollapseSonNode:function(e,t,n,a,o){var r=data.getRoot(e),i=e.data.key.children,d=t?t[i]:r[i],s=!t&&a,l=data.getRoot(e).expandTriggerFlag;if(data.getRoot(e).expandTriggerFlag=!1,d)for(var c=0,u=d.length;c<u;c++)d[c]&&view.expandCollapseSonNode(e,d[c],n,s);data.getRoot(e).expandTriggerFlag=l,view.expandCollapseNode(e,t,n,a,o)},isSelectedNode:function(e,t){if(!t)return!1;var n,a=data.getRoot(e).curSelectedList;for(n=a.length-1;n>=0;n--)if(t===a[n])return!0;return!1},makeDOMNodeIcon:function(e,t,n){var a=data.getNodeName(t,n),o=t.view.nameIsHTML?a:a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");e.push("<span id='",n.tId,consts.id.ICON,"' title='' treeNode",consts.id.ICON," class='",view.makeNodeIcoClass(t,n),"' style='",view.makeNodeIcoStyle(t,n),"'></span><span id='",n.tId,consts.id.SPAN,"'>",o,"</span>")},makeDOMNodeLine:function(e,t,n){e.push("<span id='",n.tId,consts.id.SWITCH,"' title='' class='",view.makeNodeLineClass(t,n),"' treeNode",consts.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(e,t,n){e.push("</li>")},makeDOMNodeMainBefore:function(e,t,n){e.push("<li id='",n.tId,"' class='",consts.className.LEVEL,n.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(e,t,n){e.push("</a>")},makeDOMNodeNameBefore:function(e,t,n){var a,o=data.getNodeTitle(t,n),r=view.makeNodeUrl(t,n),i=view.makeNodeFontCss(t,n),d=9,s=18,l=21,c=[];a=t.check.enable?s+d+l*(n.level+1)+"px":d+l*(n.level+1)+"px",c.push("padding-left",":",a,";"),c.push("margin-left",":","-"+a,";"),parDomWidth="calc(100% + "+18*(n.level+1)+"px )",c.push("min-width",":",parDomWidth,";");for(var u in i)c.push(u,":",i[u],";");e.push("<a id='",n.tId,consts.id.A,"' class='",consts.className.LEVEL,n.level,"' treeNode",consts.id.A,' onclick="',n.click||"",'" ',null!=r&&r.length>0?"href='"+r+"'":""," target='",view.makeNodeTarget(n),"' style='",c.join(""),"'"),tools.apply(t.view.showTitle,[t.treeId,n],t.view.showTitle)&&o&&e.push("title='",o.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'"),e.push(">")},makeNodeFontCss:function(e,t){var n=tools.apply(e.view.fontCss,[e.treeId,t],e.view.fontCss);return n&&"function"!=typeof n?n:{}},makeNodeIcoClass:function(e,t){var n=["ico"];return t.isAjaxing||(n[0]=(t.iconSkin?t.iconSkin+"_":"")+n[0],t.isParent?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU)),consts.className.BUTTON+" "+n.join("_")},makeNodeIcoStyle:function(e,t){var n=[];if(!t.isAjaxing){var a=t.isParent&&t.iconOpen&&t.iconClose?t.open?t.iconOpen:t.iconClose:t.icon;a&&n.push("background:url(",a,") 0 0 no-repeat;"),0!=e.view.showIcon&&tools.apply(e.view.showIcon,[e.treeId,t],!0)||n.push("width:0px;height:0px;")}return n.join("")},makeNodeLineClass:function(e,t){var n=[];return e.view.showLine?0==t.level&&t.isFirstNode&&t.isLastNode?n.push(consts.line.ROOT):0==t.level&&t.isFirstNode?n.push(consts.line.ROOTS):t.isLastNode?n.push(consts.line.BOTTOM):n.push(consts.line.CENTER):n.push(consts.line.NOLINE),t.isParent?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU),view.makeNodeLineClassEx(t)+n.join("_")},makeNodeLineClassEx:function(e){return consts.className.BUTTON+" "+consts.className.LEVEL+e.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(e){return e.target||"_blank"},makeNodeUrl:function(e,t){var n=e.data.key.url;return t[n]?t[n]:null},makeUlHtml:function(e,t,n,a){n.push("<ul id='",t.tId,consts.id.UL,"' class='",consts.className.LEVEL,t.level," ",view.makeUlLineClass(e,t),"' style='display:",t.open?"block":"none","'>"),n.push(a),n.push("</ul>")},makeUlLineClass:function(e,t){return e.view.showLine&&!t.isLastNode?consts.line.LINE:""},removeChildNodes:function(e,t){if(t){var n=e.data.key.children,a=t[n];if(a){for(var o=0,r=a.length;o<r;o++)data.removeNodeCache(e,a[o]);if(data.removeSelectedNode(e),delete t[n],e.data.keep.parent)$$(t,consts.id.UL,e).empty();else{t.isParent=!1,t.open=!1;var i=$$(t,consts.id.SWITCH,e),d=$$(t,consts.id.ICON,e);view.replaceSwitchClass(t,i,consts.folder.DOCU),view.replaceIcoClass(t,d,consts.folder.DOCU),$$(t,consts.id.UL,e).remove()}}}},setFirstNode:function(e,t){var n=e.data.key.children,a=t[n].length;a>0&&(t[n][0].isFirstNode=!0)},setLastNode:function(e,t){var n=e.data.key.children,a=t[n].length;a>0&&(t[n][a-1].isLastNode=!0)},removeNode:function(e,t){var n=data.getRoot(e),a=e.data.key.children,o=t.parentTId?t.getParentNode():n;if(t.isFirstNode=!1,t.isLastNode=!1,t.getPreNode=function(){return null},t.getNextNode=function(){return null},data.getNodeCache(e,t.tId)){$$(t,e).remove(),data.removeNodeCache(e,t),data.removeSelectedNode(e,t);for(var r=0,i=o[a].length;r<i;r++)if(o[a][r].tId==t.tId){o[a].splice(r,1);break}view.setFirstNode(e,o),view.setLastNode(e,o);var d,s,l,c=o[a].length;if(e.data.keep.parent||0!=c){if(e.view.showLine&&c>0){var u=o[a][c-1];if(d=$$(u,consts.id.UL,e),s=$$(u,consts.id.SWITCH,e),l=$$(u,consts.id.ICON,e),o==n)if(1==o[a].length)view.replaceSwitchClass(u,s,consts.line.ROOT);else{var h=$$(o[a][0],consts.id.SWITCH,e);view.replaceSwitchClass(o[a][0],h,consts.line.ROOTS),view.replaceSwitchClass(u,s,consts.line.BOTTOM)}else view.replaceSwitchClass(u,s,consts.line.BOTTOM);d.removeClass(consts.line.LINE)}}else o.isParent=!1,o.open=!1,d=$$(o,consts.id.UL,e),s=$$(o,consts.id.SWITCH,e),l=$$(o,consts.id.ICON,e),view.replaceSwitchClass(o,s,consts.folder.DOCU),view.replaceIcoClass(o,l,consts.folder.DOCU),d.css("display","none")}},replaceIcoClass:function(e,t,n){if(t&&!e.isAjaxing){var a=t.attr("class");if(void 0!=a){var o=a.split("_");switch(n){case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:o[o.length-1]=n}t.attr("class",o.join("_"))}}},replaceSwitchClass:function(e,t,n){if(t){var a=t.attr("class");if(void 0!=a){var o=a.split("_");switch(n){case consts.line.ROOT:case consts.line.ROOTS:case consts.line.CENTER:case consts.line.BOTTOM:case consts.line.NOLINE:o[0]=view.makeNodeLineClassEx(e)+n;break;case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:o[1]=n}t.attr("class",o.join("_")),n!==consts.folder.DOCU?t.removeAttr("disabled"):t.attr("disabled","disabled")}}},selectNode:function(e,t,n){n||view.cancelPreSelectedNode(e,null,t),$$(t,consts.id.A,e).addClass(consts.node.CURSELECTED),data.addSelectedNode(e,t),e.treeObj.trigger(consts.event.SELECTED,[event,e.treeId,t])},setNodeFontCss:function(e,t){var n=$$(t,consts.id.A,e),a=view.makeNodeFontCss(e,t);a&&n.css(a)},setNodeLineIcos:function(e,t){if(t){var n=$$(t,consts.id.SWITCH,e),a=$$(t,consts.id.UL,e),o=$$(t,consts.id.ICON,e),r=view.makeUlLineClass(e,t);0==r.length?a.removeClass(consts.line.LINE):a.addClass(r),n.attr("class",view.makeNodeLineClass(e,t)),t.isParent?n.removeAttr("disabled"):n.attr("disabled","disabled"),o.removeAttr("style"),o.attr("style",view.makeNodeIcoStyle(e,t)),o.attr("class",view.makeNodeIcoClass(e,t))}},setNodeName:function(e,t){var n=data.getNodeTitle(e,t),a=$$(t,consts.id.SPAN,e);if(a.empty(),e.view.nameIsHTML?a.html(data.getNodeName(e,t)):a.text(data.getNodeName(e,t)),tools.apply(e.view.showTitle,[e.treeId,t],e.view.showTitle)){var o=$$(t,consts.id.A,e);o.attr("title",n?n:"")}},setNodeTarget:function(e,t){var n=$$(t,consts.id.A,e);n.attr("target",view.makeNodeTarget(t))},setNodeUrl:function(e,t){var n=$$(t,consts.id.A,e),a=view.makeNodeUrl(e,t);null==a||0==a.length?n.removeAttr("href"):n.attr("href",a)},switchNode:function(e,t){if(t.open||!tools.canAsync(e,t))view.expandCollapseNode(e,t,!t.open);else if(e.async.enable){if(!view.asyncNode(e,t))return void view.expandCollapseNode(e,t,!t.open)}else t&&view.expandCollapseNode(e,t,!t.open)}};$.fn.zTree={consts:_consts,_z:{tools:tools,view:view,event:event,data:data},getZTreeObj:function(e){var t=data.getZTreeTools(e);return t?t:null},destroy:function(e){if(e&&e.length>0)view.destroy(data.getSetting(e));else for(var t in settings)view.destroy(settings[t])},init:function(e,t,n){var a=tools.clone(_setting);$.extend(!0,a,t),a.treeId=e.attr("id"),a.treeObj=e,a.treeObj.empty(),settings[a.treeId]=a,"undefined"==typeof document.body.style.maxHeight&&(a.view.expandSpeed=""),data.initRoot(a);var o=data.getRoot(a),r=a.data.key.children;n=n?tools.clone(tools.isArray(n)?n:[n]):[],a.data.simpleData.enable?o[r]=data.transformTozTreeFormat(a,n):o[r]=n,data.initCache(a),event.unbindTree(a),event.bindTree(a),event.unbindEvent(a),event.bindEvent(a);var i={setting:a,addNodes:function(e,t,n){function o(){view.addNodes(a,e,r,1==n)}if(!t)return null;if(e||(e=null),e&&!e.isParent&&a.data.keep.leaf)return null;var r=tools.clone(tools.isArray(t)?t:[t]);return tools.canAsync(a,e)?view.asyncNode(a,e,n,o):o(),r},cancelSelectedNode:function(e){view.cancelPreSelectedNode(a,e)},destroy:function(){view.destroy(a)},expandAll:function(e){return e=!!e,view.expandCollapseSonNode(a,null,e,!0),e},expandNode:function(e,t,n,o,r){if(!e||!e.isParent)return null;if(t!==!0&&t!==!1&&(t=!e.open),r=!!r,r&&t&&0==tools.apply(a.callback.beforeExpand,[a.treeId,e],!0))return null;if(r&&!t&&0==tools.apply(a.callback.beforeCollapse,[a.treeId,e],!0))return null;if(t&&e.parentTId&&view.expandCollapseParentNode(a,e.getParentNode(),t,!1),t===e.open&&!n)return null;if(data.getRoot(a).expandTriggerFlag=r,!tools.canAsync(a,e)&&n)view.expandCollapseSonNode(a,e,t,!0,function(){if(o!==!1)try{$$(e,a).focus().blur()}catch(t){}});else if(e.open=!t,view.switchNode(this.setting,e),o!==!1)try{$$(e,a).focus().blur()}catch(i){}return t},getNodes:function(){return data.getNodes(a)},getNodeByParam:function(e,t,n){return e?data.getNodeByParam(a,n?n[a.data.key.children]:data.getNodes(a),e,t):null},getNodeByTId:function(e){return data.getNodeCache(a,e)},getNodesByParam:function(e,t,n){return e?data.getNodesByParam(a,n?n[a.data.key.children]:data.getNodes(a),e,t):null},getNodesByParamFuzzy:function(e,t,n){return e?data.getNodesByParamFuzzy(a,n?n[a.data.key.children]:data.getNodes(a),e,t):null},getNodesByFilter:function(e,t,n,o){return t=!!t,e&&"function"==typeof e?data.getNodesByFilter(a,n?n[a.data.key.children]:data.getNodes(a),e,t,o):t?null:[]},getNodeIndex:function(e){if(!e)return null;for(var t=a.data.key.children,n=e.parentTId?e.getParentNode():data.getRoot(a),o=0,r=n[t].length;o<r;o++)if(n[t][o]==e)return o;return-1},getSelectedNodes:function(){for(var e=[],t=data.getRoot(a).curSelectedList,n=0,o=t.length;n<o;n++)e.push(t[n]);return e},isSelectedNode:function(e){return data.isSelectedNode(a,e)},reAsyncChildNodes:function(e,t,n){if(this.setting.async.enable){var o=!e;if(o&&(e=data.getRoot(a)),"refresh"==t){for(var r=this.setting.data.key.children,i=0,d=e[r]?e[r].length:0;i<d;i++)data.removeNodeCache(a,e[r][i]);if(data.removeSelectedNode(a),e[r]=[],o)this.setting.treeObj.empty();else{var s=$$(e,consts.id.UL,a);s.empty()}}view.asyncNode(this.setting,o?null:e,!!n)}},refresh:function(){this.setting.treeObj.empty();var e=data.getRoot(a),t=e[a.data.key.children];data.initRoot(a),e[a.data.key.children]=t,data.initCache(a),view.createNodes(a,0,e[a.data.key.children])},removeChildNodes:function(e){if(!e)return null;var t=a.data.key.children,n=e[t];return view.removeChildNodes(a,e),n?n:null;
  },removeNode:function(e,t){e&&(t=!!t,t&&0==tools.apply(a.callback.beforeRemove,[a.treeId,e],!0)||(view.removeNode(a,e),t&&this.setting.treeObj.trigger(consts.event.REMOVE,[a.treeId,e])))},selectNode:function(e,t){if(e&&tools.uCanDo(a)){if(t=a.view.selectedMulti&&t,e.parentTId)view.expandCollapseParentNode(a,e.getParentNode(),!0,!1,function(){try{$$(e,a).focus().blur()}catch(t){}});else try{$$(e,a).focus().blur()}catch(n){}view.selectNode(a,e,t)}},transformTozTreeNodes:function(e){return data.transformTozTreeFormat(a,e)},transformToArray:function(e){return data.transformToArrayFormat(a,e)},updateNode:function(e,t){if(e){var n=$$(e,a);n.get(0)&&tools.uCanDo(a)&&(view.setNodeName(a,e),view.setNodeTarget(a,e),view.setNodeUrl(a,e),view.setNodeLineIcos(a,e),view.setNodeFontCss(a,e))}}};return o.treeTools=i,data.setZTreeTools(a,i),o[r]&&o[r].length>0?view.createNodes(a,0,o[r]):a.async.enable&&a.async.url&&""!==a.async.url&&view.asyncNode(a),i}};var zt=$.fn.zTree,$$=tools.$,consts=zt.consts}(jQuery),function(e){var t={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},n={check:{enable:!1,autoCheckTrigger:!1,chkStyle:t.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:t.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}},a=function(e){var t=T.getRoot(e);t.radioCheckedList=[]},o=function(e){},r=function(e){var t=e.treeObj,n=C.event;t.bind(n.CHECK,function(t,n,a,o){t.srcEvent=n,k.apply(e.callback.onCheck,[t,a,o])})},i=function(e){var t=e.treeObj,n=C.event;t.unbind(n.CHECK)},d=function(e){var t=e.target,n=T.getSetting(e.data.treeId),a="",o=null,r="",i="",d=null,s=null;if(k.eqs(e.type,"mouseover")?n.check.enable&&k.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+C.id.CHECK)&&(a=k.getNodeMainDom(t).id,r="mouseoverCheck"):k.eqs(e.type,"mouseout")?n.check.enable&&k.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+C.id.CHECK)&&(a=k.getNodeMainDom(t).id,r="mouseoutCheck"):k.eqs(e.type,"click")&&n.check.enable&&k.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+C.id.CHECK)&&(a=k.getNodeMainDom(t).id,r="checkNode"),a.length>0)switch(o=T.getNodeCache(n,a),r){case"checkNode":d=p.onCheckNode;break;case"mouseoverCheck":d=p.onMouseoverCheck;break;case"mouseoutCheck":d=p.onMouseoutCheck}var l={stop:"checkNode"===r,node:o,nodeEventType:r,nodeEventCallback:d,treeEventType:i,treeEventCallback:s};return l},s=function(e,t,n,a,o,r,i){if(n){var d=e.data.key.checked;if("string"==typeof n[d]&&(n[d]=k.eqs(n[d],"true")),n[d]=!!n[d],n.checkedOld=n[d],"string"==typeof n.nocheck&&(n.nocheck=k.eqs(n.nocheck,"true")),n.nocheck=!!n.nocheck||e.check.nocheckInherit&&a&&!!a.nocheck,"string"==typeof n.chkDisabled&&(n.chkDisabled=k.eqs(n.chkDisabled,"true")),n.chkDisabled=!!n.chkDisabled||e.check.chkDisabledInherit&&a&&!!a.chkDisabled,"string"==typeof n.halfCheck&&(n.halfCheck=k.eqs(n.halfCheck,"true")),n.halfCheck=!!n.halfCheck,n.check_Child_State=-1,n.check_Focus=!1,n.getCheckStatus=function(){return T.getCheckStatus(e,n)},e.check.chkStyle==C.radio.STYLE&&e.check.radioType==C.radio.TYPE_ALL&&n[d]){var s=T.getRoot(e);s.radioCheckedList.push(n)}}},l=function(e,t,n){e.data.key.checked;e.check.enable&&(T.makeChkFlag(e,t),n.push("<span ID='",t.tId,C.id.CHECK,"' class='",m.makeChkClass(e,t),"' treeNode",C.id.CHECK,t.nocheck===!0?" style='display:none;'":"","></span>"))},c=function(e,t){t.checkNode=function(e,t,n,a){var o=this.setting.data.key.checked;if(e.chkDisabled!==!0&&(t!==!0&&t!==!1&&(t=!e[o]),a=!!a,(e[o]!==t||n)&&(!a||0!=k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,e],!0))&&k.uCanDo(this.setting)&&this.setting.check.enable&&e.nocheck!==!0)){e[o]=t;var r=y(e,C.id.CHECK,this.setting);(n||this.setting.check.chkStyle===C.radio.STYLE)&&m.checkNodeRelation(this.setting,e),m.setChkClass(this.setting,r,e),m.repairParentChkClassWithSelf(this.setting,e),a&&this.setting.treeObj.trigger(C.event.CHECK,[null,this.setting.treeId,e])}},t.checkAllNodes=function(e){m.repairAllChk(this.setting,!!e)},t.getCheckedNodes=function(e){var t=this.setting.data.key.children;return e=e!==!1,T.getTreeCheckedNodes(this.setting,T.getRoot(this.setting)[t],e)},t.getChangeCheckedNodes=function(){var e=this.setting.data.key.children;return T.getTreeChangeCheckedNodes(this.setting,T.getRoot(this.setting)[e])},t.setChkDisabled=function(e,t,n,a){t=!!t,n=!!n,a=!!a,m.repairSonChkDisabled(this.setting,e,t,a),m.repairParentChkDisabled(this.setting,e.getParentNode(),t,n)};var n=t.updateNode;t.updateNode=function(e,a){if(n&&n.apply(t,arguments),e&&this.setting.check.enable){var o=y(e,this.setting);if(o.get(0)&&k.uCanDo(this.setting)){var r=y(e,C.id.CHECK,this.setting);1!=a&&this.setting.check.chkStyle!==C.radio.STYLE||m.checkNodeRelation(this.setting,e),m.setChkClass(this.setting,r,e),m.repairParentChkClassWithSelf(this.setting,e)}}}},u={getRadioCheckedList:function(e){for(var t=T.getRoot(e).radioCheckedList,n=0,a=t.length;n<a;n++)T.getNodeCache(e,t[n].tId)||(t.splice(n,1),n--,a--);return t},getCheckStatus:function(e,t){if(!e.check.enable||t.nocheck||t.chkDisabled)return null;var n=e.data.key.checked,a={checked:t[n],half:t.halfCheck?t.halfCheck:e.check.chkStyle==C.radio.STYLE?2===t.check_Child_State:t[n]?t.check_Child_State>-1&&t.check_Child_State<2:t.check_Child_State>0};return a},getTreeCheckedNodes:function(e,t,n,a){if(!t)return[];var o=e.data.key.children,r=e.data.key.checked,i=n&&e.check.chkStyle==C.radio.STYLE&&e.check.radioType==C.radio.TYPE_ALL;a=a?a:[];for(var d=0,s=t.length;d<s&&(t[d].nocheck===!0||t[d].chkDisabled===!0||t[d][r]!=n||(a.push(t[d]),!i))&&(T.getTreeCheckedNodes(e,t[d][o],n,a),!(i&&a.length>0));d++);return a},getTreeChangeCheckedNodes:function(e,t,n){if(!t)return[];var a=e.data.key.children,o=e.data.key.checked;n=n?n:[];for(var r=0,i=t.length;r<i;r++)t[r].nocheck!==!0&&t[r].chkDisabled!==!0&&t[r][o]!=t[r].checkedOld&&n.push(t[r]),T.getTreeChangeCheckedNodes(e,t[r][a],n);return n},makeChkFlag:function(e,t){if(t){var n=e.data.key.children,a=e.data.key.checked,o=-1;if(t[n])for(var r=0,i=t[n].length;r<i;r++){var d=t[n][r],s=-1;if(e.check.chkStyle==C.radio.STYLE){if(s=d.nocheck===!0||d.chkDisabled===!0?d.check_Child_State:d.halfCheck===!0?2:d[a]?2:d.check_Child_State>0?2:0,2==s){o=2;break}0==s&&(o=0)}else if(e.check.chkStyle==C.checkbox.STYLE){if(s=d.nocheck===!0||d.chkDisabled===!0?d.check_Child_State:d.halfCheck===!0?1:d[a]?d.check_Child_State===-1||2===d.check_Child_State?2:1:d.check_Child_State>0?1:0,1===s){o=1;break}if(2===s&&o>-1&&r>0&&s!==o){o=1;break}if(2===o&&s>-1&&s<2){o=1;break}s>-1&&(o=s)}}t.check_Child_State=o}}},h={},p={onCheckNode:function(e,t){if(t.chkDisabled===!0)return!1;var n=T.getSetting(e.data.treeId),a=n.data.key.checked;if(0==k.apply(n.callback.beforeCheck,[n.treeId,t],!0))return!0;t[a]=!t[a],m.checkNodeRelation(n,t);var o=y(t,C.id.CHECK,n);return m.setChkClass(n,o,t),m.repairParentChkClassWithSelf(n,t),n.treeObj.trigger(C.event.CHECK,[e,n.treeId,t]),!0},onMouseoverCheck:function(e,t){if(t.chkDisabled===!0)return!1;var n=T.getSetting(e.data.treeId),a=y(t,C.id.CHECK,n);return t.check_Focus=!0,m.setChkClass(n,a,t),!0},onMouseoutCheck:function(e,t){if(t.chkDisabled===!0)return!1;var n=T.getSetting(e.data.treeId),a=y(t,C.id.CHECK,n);return t.check_Focus=!1,m.setChkClass(n,a,t),!0}},f={},g={checkNodeRelation:function(e,t){var n,a,o,r=e.data.key.children,i=e.data.key.checked,d=C.radio;if(e.check.chkStyle==d.STYLE){var s=T.getRadioCheckedList(e);if(t[i])if(e.check.radioType==d.TYPE_ALL){for(a=s.length-1;a>=0;a--)n=s[a],n[i]&&n!=t&&(n[i]=!1,s.splice(a,1),m.setChkClass(e,y(n,C.id.CHECK,e),n),n.parentTId!=t.parentTId&&m.repairParentChkClassWithSelf(e,n));s.push(t)}else{var l=t.parentTId?t.getParentNode():T.getRoot(e);for(a=0,o=l[r].length;a<o;a++)n=l[r][a],n[i]&&n!=t&&(n[i]=!1,m.setChkClass(e,y(n,C.id.CHECK,e),n))}else if(e.check.radioType==d.TYPE_ALL)for(a=0,o=s.length;a<o;a++)if(t==s[a]){s.splice(a,1);break}}else t[i]&&(!t[r]||0==t[r].length||e.check.chkboxType.Y.indexOf("s")>-1)&&m.setSonNodeCheckBox(e,t,!0),t[i]||t[r]&&0!=t[r].length&&!(e.check.chkboxType.N.indexOf("s")>-1)||m.setSonNodeCheckBox(e,t,!1),t[i]&&e.check.chkboxType.Y.indexOf("p")>-1&&m.setParentNodeCheckBox(e,t,!0),!t[i]&&e.check.chkboxType.N.indexOf("p")>-1&&m.setParentNodeCheckBox(e,t,!1)},makeChkClass:function(e,t){var n=e.data.key.checked,a=C.checkbox,o=C.radio,r="";r=t.chkDisabled===!0?a.DISABLED:t.halfCheck?a.PART:e.check.chkStyle==o.STYLE?t.check_Child_State<1?a.FULL:a.PART:t[n]?2===t.check_Child_State||t.check_Child_State===-1?a.FULL:a.PART:t.check_Child_State<1?a.FULL:a.PART;var i=e.check.chkStyle+"_"+(t[n]?a.TRUE:a.FALSE)+"_"+r;return i=t.check_Focus&&t.chkDisabled!==!0?i+"_"+a.FOCUS:i,C.className.BUTTON+" "+a.DEFAULT+" "+i},repairAllChk:function(e,t){if(e.check.enable&&e.check.chkStyle===C.checkbox.STYLE)for(var n=e.data.key.checked,a=e.data.key.children,o=T.getRoot(e),r=0,i=o[a].length;r<i;r++){var d=o[a][r];d.nocheck!==!0&&d.chkDisabled!==!0&&(d[n]=t),m.setSonNodeCheckBox(e,d,t)}},repairChkClass:function(e,t){if(t&&(T.makeChkFlag(e,t),t.nocheck!==!0)){var n=y(t,C.id.CHECK,e);m.setChkClass(e,n,t)}},repairParentChkClass:function(e,t){if(t&&t.parentTId){var n=t.getParentNode();m.repairChkClass(e,n),m.repairParentChkClass(e,n)}},repairParentChkClassWithSelf:function(e,t){if(t){var n=e.data.key.children;t[n]&&t[n].length>0?m.repairParentChkClass(e,t[n][0]):m.repairParentChkClass(e,t)}},repairSonChkDisabled:function(e,t,n,a){if(t){var o=e.data.key.children;if(t.chkDisabled!=n&&(t.chkDisabled=n),m.repairChkClass(e,t),t[o]&&a)for(var r=0,i=t[o].length;r<i;r++){var d=t[o][r];m.repairSonChkDisabled(e,d,n,a)}}},repairParentChkDisabled:function(e,t,n,a){t&&(t.chkDisabled!=n&&a&&(t.chkDisabled=n),m.repairChkClass(e,t),m.repairParentChkDisabled(e,t.getParentNode(),n,a))},setChkClass:function(e,t,n){t&&(n.nocheck===!0?t.hide():t.show(),t.attr("class",m.makeChkClass(e,n)))},setParentNodeCheckBox:function(e,t,n,a){var o=e.data.key.children,r=e.data.key.checked,i=y(t,C.id.CHECK,e);if(a||(a=t),T.makeChkFlag(e,t),t.nocheck!==!0&&t.chkDisabled!==!0&&(t[r]=n,m.setChkClass(e,i,t),e.check.autoCheckTrigger&&t!=a&&e.treeObj.trigger(C.event.CHECK,[null,e.treeId,t])),t.parentTId){var d=!0;if(!n)for(var s=t.getParentNode()[o],l=0,c=s.length;l<c;l++)if(s[l].nocheck!==!0&&s[l].chkDisabled!==!0&&s[l][r]||(s[l].nocheck===!0||s[l].chkDisabled===!0)&&s[l].check_Child_State>0){d=!1;break}d&&m.setParentNodeCheckBox(e,t.getParentNode(),n,a)}},setSonNodeCheckBox:function(e,t,n,a){if(t){var o=e.data.key.children,r=e.data.key.checked,i=y(t,C.id.CHECK,e);a||(a=t);var d=!1;if(t[o])for(var s=0,l=t[o].length;s<l&&t.chkDisabled!==!0;s++){var c=t[o][s];m.setSonNodeCheckBox(e,c,n,a),c.chkDisabled===!0&&(d=!0)}t!=T.getRoot(e)&&t.chkDisabled!==!0&&(d&&t.nocheck!==!0&&T.makeChkFlag(e,t),t.nocheck!==!0&&t.chkDisabled!==!0?(t[r]=n,d||(t.check_Child_State=t[o]&&t[o].length>0?n?2:0:-1)):t.check_Child_State=-1,m.setChkClass(e,i,t),e.check.autoCheckTrigger&&t!=a&&t.nocheck!==!0&&t.chkDisabled!==!0&&e.treeObj.trigger(C.event.CHECK,[null,e.treeId,t]))}}},v={tools:f,view:g,event:h,data:u};e.extend(!0,e.fn.zTree.consts,t),e.extend(!0,e.fn.zTree._z,v);var N=e.fn.zTree,k=N._z.tools,C=N.consts,m=N._z.view,T=N._z.data,y=(N._z.event,k.$);T.exSetting(n),T.addInitBind(r),T.addInitUnBind(i),T.addInitCache(o),T.addInitNode(s),T.addInitProxy(d,!0),T.addInitRoot(a),T.addBeforeA(l),T.addZTreeTools(c);var b=m.createNodes;m.createNodes=function(e,t,n,a){b&&b.apply(m,arguments),n&&m.repairParentChkClassWithSelf(e,a)};var E=m.removeNode;m.removeNode=function(e,t){var n=t.getParentNode();E&&E.apply(m,arguments),t&&n&&(m.repairChkClass(e,n),m.repairParentChkClass(e,n))};var I=m.appendNodes;m.appendNodes=function(e,t,n,a,o,r){var i="";return I&&(i=I.apply(m,arguments)),a&&T.makeChkFlag(e,a),i}}(jQuery),function(e){var t={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},n={edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}},a=function(e){var t=m.getRoot(e),n=m.getRoots();t.curEditNode=null,t.curEditInput=null,t.curHoverNode=null,t.dragFlag=0,t.dragNodeShowBefore=[],t.dragMaskList=new Array,n.showHoverDom=!0},o=function(e){},r=function(e){var t=e.treeObj,n=k.event;t.bind(n.RENAME,function(t,n,a,o){N.apply(e.callback.onRename,[t,n,a,o])}),t.bind(n.DRAG,function(t,n,a,o){N.apply(e.callback.onDrag,[n,a,o])}),t.bind(n.DRAGMOVE,function(t,n,a,o){N.apply(e.callback.onDragMove,[n,a,o])}),t.bind(n.DROP,function(t,n,a,o,r,i,d){N.apply(e.callback.onDrop,[n,a,o,r,i,d])})},i=function(e){var t=e.treeObj,n=k.event;t.unbind(n.RENAME),t.unbind(n.DRAG),t.unbind(n.DRAGMOVE),t.unbind(n.DROP)},d=function(e){var t=e.target,n=m.getSetting(e.data.treeId),a=e.relatedTarget,o="",r=null,i="",d="",s=null,l=null,c=null;if(N.eqs(e.type,"mouseover")?(c=N.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+k.id.A}]),c&&(o=N.getNodeMainDom(c).id,i="hoverOverNode")):N.eqs(e.type,"mouseout")?(c=N.getMDom(n,a,[{tagName:"a",attrName:"treeNode"+k.id.A}]),c||(o="remove",i="hoverOutNode")):N.eqs(e.type,"mousedown")&&(c=N.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+k.id.A}]),c&&(o=N.getNodeMainDom(c).id,i="mousedownNode")),o.length>0)switch(r=m.getNodeCache(n,o),i){case"mousedownNode":s=h.onMousedownNode;break;case"hoverOverNode":s=h.onHoverOverNode;break;case"hoverOutNode":s=h.onHoverOutNode}var u={stop:!1,node:r,nodeEventType:i,nodeEventCallback:s,treeEventType:d,treeEventCallback:l};return u},s=function(e,t,n,a,o,r,i){n&&(n.isHover=!1,n.editNameFlag=!1)},l=function(e,t){t.cancelEditName=function(e){var t=m.getRoot(this.setting);t.curEditNode&&C.cancelCurEditNode(this.setting,e?e:null,!0)},t.copyNode=function(e,t,n,a){function o(){C.addNodes(r.setting,e,[i],a)}if(!t)return null;if(e&&!e.isParent&&this.setting.data.keep.leaf&&n===k.move.TYPE_INNER)return null;var r=this,i=N.clone(t);return e||(e=null,n=k.move.TYPE_INNER),n==k.move.TYPE_INNER?N.canAsync(this.setting,e)?C.asyncNode(this.setting,e,a,o):o():(C.addNodes(this.setting,e.parentNode,[i],a),C.moveNode(this.setting,e,i,n,!1,a)),i},t.editName=function(e){e&&e.tId&&e===m.getNodeCache(this.setting,e.tId)&&(e.parentTId&&C.expandCollapseParentNode(this.setting,e.getParentNode(),!0),C.editNode(this.setting,e))},t.moveNode=function(e,t,n,a){function o(){C.moveNode(r.setting,e,t,n,!1,a)}if(!t)return t;if(e&&!e.isParent&&this.setting.data.keep.leaf&&n===k.move.TYPE_INNER)return null;if(e&&(t.parentTId==e.tId&&n==k.move.TYPE_INNER||T(t,this.setting).find("#"+e.tId).length>0))return null;e||(e=null);var r=this;return N.canAsync(this.setting,e)&&n===k.move.TYPE_INNER?C.asyncNode(this.setting,e,a,o):o(),t},t.setEditable=function(e){return this.setting.edit.enable=e,this.refresh()}},c={setSonNodeLevel:function(e,t,n){if(n){var a=e.data.key.children;if(n.level=t?t.level+1:0,n[a])for(var o=0,r=n[a].length;o<r;o++)n[a][o]&&m.setSonNodeLevel(e,n,n[a][o])}}},u={},h={onHoverOverNode:function(e,t){var n=m.getSetting(e.data.treeId),a=m.getRoot(n);a.curHoverNode!=t&&h.onHoverOutNode(e),a.curHoverNode=t,C.addHoverDom(n,t)},onHoverOutNode:function(e,t){var n=m.getSetting(e.data.treeId),a=m.getRoot(n);a.curHoverNode&&!m.isSelectedNode(n,a.curHoverNode)&&(C.removeTreeDom(n,a.curHoverNode),a.curHoverNode=null)},onMousedownNode:function(n,a){function o(n){if(0==c.dragFlag&&Math.abs(A-n.clientX)<l.edit.drag.minMoveSize&&Math.abs(x-n.clientY)<l.edit.drag.minMoveSize)return!0;var a,o,i,d,s,h=l.data.key.children;if(w.css("cursor","pointer"),0==c.dragFlag){if(0==N.apply(l.callback.beforeDrag,[l.treeId,f],!0))return r(n),!0;for(a=0,o=f.length;a<o;a++)0==a&&(c.dragNodeShowBefore=[]),i=f[a],i.isParent&&i.open?(C.expandCollapseNode(l,i,!i.open),c.dragNodeShowBefore[i.tId]=!0):c.dragNodeShowBefore[i.tId]=!1;c.dragFlag=1,u.showHoverDom=!1,N.showIfameMask(l,!0);var p=!0,_=-1;if(f.length>1){var $=f[0].parentTId?f[0].getParentNode()[h]:m.getNodes(l);for(s=[],a=0,o=$.length;a<o;a++)if(void 0!==c.dragNodeShowBefore[$[a].tId]&&(p&&_>-1&&_+1!==a&&(p=!1),s.push($[a]),_=a),f.length===s.length){f=s;break}}for(p&&(b=f[0].getPreNode(),E=f[f.length-1].getNextNode()),g=T("<ul class='zTreeDragUL'></ul>",l),a=0,o=f.length;a<o;a++)i=f[a],i.editNameFlag=!1,C.selectNode(l,i,a>0),C.removeTreeDom(l,i),a>l.edit.drag.maxShowNodeNum-1||(d=T("<li id='"+i.tId+"_tmp'></li>",l),d.append(T(i,k.id.A,l).clone()),d.css("padding","0"),d.children("#"+i.tId+k.id.A).removeClass(k.node.CURSELECTED),g.append(d),a==l.edit.drag.maxShowNodeNum-1&&(d=T("<li id='"+i.tId+"_moretmp'><a>  ...  </a></li>",l),g.append(d)));g.attr("id",f[0].tId+k.id.UL+"_tmp"),g.addClass(l.treeObj.attr("class")),g.appendTo(w),v=T("<span class='tmpzTreeMove_arrow'></span>",l),v.attr("id","zTreeMove_arrow_tmp"),v.appendTo(w),l.treeObj.trigger(k.event.DRAG,[n,l.treeId,f])}if(1==c.dragFlag){if(y&&v.attr("id")==n.target.id&&D&&n.clientX+I.scrollLeft()+2>e("#"+D+k.id.A,y).offset().left){var F=e("#"+D+k.id.A,y);n.target=F.length>0?F.get(0):n.target}else y&&(y.removeClass(k.node.TMPTARGET_TREE),D&&e("#"+D+k.id.A,y).removeClass(k.node.TMPTARGET_NODE+"_"+k.move.TYPE_PREV).removeClass(k.node.TMPTARGET_NODE+"_"+t.move.TYPE_NEXT).removeClass(k.node.TMPTARGET_NODE+"_"+t.move.TYPE_INNER));y=null,D=null,S=!1,P=l;var B=m.getSettings();for(var j in B)B[j].treeId&&B[j].edit.enable&&B[j].treeId!=l.treeId&&(n.target.id==B[j].treeId||e(n.target).parents("#"+B[j].treeId).length>0)&&(S=!0,P=B[j]);var U=I.scrollTop(),z=I.scrollLeft(),Y=P.treeObj.offset(),H=P.treeObj.get(0).scrollHeight,K=P.treeObj.get(0).scrollWidth,V=n.clientY+U-Y.top,q=P.treeObj.height()+Y.top-n.clientY-U,W=n.clientX+z-Y.left,G=P.treeObj.width()+Y.left-n.clientX-z,X=V<l.edit.drag.borderMax&&V>l.edit.drag.borderMin,Z=q<l.edit.drag.borderMax&&q>l.edit.drag.borderMin,J=W<l.edit.drag.borderMax&&W>l.edit.drag.borderMin,Q=G<l.edit.drag.borderMax&&G>l.edit.drag.borderMin,ee=V>l.edit.drag.borderMin&&q>l.edit.drag.borderMin&&W>l.edit.drag.borderMin&&G>l.edit.drag.borderMin,te=X&&P.treeObj.scrollTop()<=0,ne=Z&&P.treeObj.scrollTop()+P.treeObj.height()+10>=H,ae=J&&P.treeObj.scrollLeft()<=0,oe=Q&&P.treeObj.scrollLeft()+P.treeObj.width()+10>=K;if(n.target&&N.isChildOrSelf(n.target,P.treeId)){for(var re=n.target;re&&re.tagName&&!N.eqs(re.tagName,"li")&&re.id!=P.treeId;)re=re.parentNode;var ie=!0;for(a=0,o=f.length;a<o;a++){if(i=f[a],re.id===i.tId){ie=!1;break}if(T(i,l).find("#"+re.id).length>0){ie=!1;break}}ie&&n.target&&N.isChildOrSelf(n.target,re.id+k.id.A)&&(y=e(re),D=re.id)}i=f[0],ee&&N.isChildOrSelf(n.target,P.treeId)&&(!y&&(n.target.id==P.treeId||te||ne||ae||oe)&&(S||!S&&i.parentTId)&&(y=P.treeObj),X?P.treeObj.scrollTop(P.treeObj.scrollTop()-10):Z&&P.treeObj.scrollTop(P.treeObj.scrollTop()+10),J?P.treeObj.scrollLeft(P.treeObj.scrollLeft()-10):Q&&P.treeObj.scrollLeft(P.treeObj.scrollLeft()+10),y&&y!=P.treeObj&&y.offset().left<P.treeObj.offset().left&&P.treeObj.scrollLeft(P.treeObj.scrollLeft()+y.offset().left-P.treeObj.offset().left)),g.css({top:n.clientY+U+3+"px",left:n.clientX+z+3+"px"});var de=0,se=0;if(y&&y.attr("id")!=P.treeId){var le=null==D?null:m.getNodeCache(P,D),ce=(n.ctrlKey||n.metaKey)&&l.edit.drag.isMove&&l.edit.drag.isCopy||!l.edit.drag.isMove&&l.edit.drag.isCopy,ue=!(!b||D!==b.tId),he=!(!E||D!==E.tId),pe=i.parentTId&&i.parentTId==D,fe=(ce||!he)&&N.apply(P.edit.drag.prev,[P.treeId,f,le],!!P.edit.drag.prev),ge=(ce||!ue)&&N.apply(P.edit.drag.next,[P.treeId,f,le],!!P.edit.drag.next),ve=(ce||!pe)&&!(P.data.keep.leaf&&!le.isParent)&&N.apply(P.edit.drag.inner,[P.treeId,f,le],!!P.edit.drag.inner);if(fe||ge||ve){var Ne=e("#"+D+k.id.A,y),ke=le.isLastNode?null:e("#"+le.getNextNode().tId+k.id.A,y.next()),Ce=Ne.offset().top,me=Ne.offset().left,Te=fe?ve?.25:ge?.5:1:-1,ye=ge?ve?.75:fe?.5:0:-1,be=(n.clientY+U-Ce)/Ne.height();if((1==Te||be<=Te&&be>=-.2)&&fe?(de=1-v.width(),se=Ce-v.height()/2,L=k.move.TYPE_PREV):(0==ye||be>=ye&&be<=1.2)&&ge?(de=1-v.width(),se=null==ke||le.isParent&&le.open?Ce+Ne.height()-v.height()/2:ke.offset().top-v.height()/2,L=k.move.TYPE_NEXT):(de=5-v.width(),se=Ce,L=k.move.TYPE_INNER),v.css({display:"block",top:se+"px",left:me+de+"px"}),Ne.addClass(k.node.TMPTARGET_NODE+"_"+L),O==D&&R==L||(M=(new Date).getTime()),le&&le.isParent&&L==k.move.TYPE_INNER){var Ee=!0;window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==le.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===le.tId&&(Ee=!1),Ee&&(window.zTreeMoveTimer=setTimeout(function(){L==k.move.TYPE_INNER&&le&&le.isParent&&!le.open&&(new Date).getTime()-M>P.edit.drag.autoOpenTime&&N.apply(P.callback.beforeDragOpen,[P.treeId,le],!0)&&(C.switchNode(P,le),P.edit.drag.autoExpandTrigger&&P.treeObj.trigger(k.event.EXPAND,[P.treeId,le]))},P.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=le.tId)}}else y=null,D="",L=k.move.TYPE_INNER,v.css({display:"none"}),window.zTreeMoveTimer&&(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null)}else L=k.move.TYPE_INNER,y&&N.apply(P.edit.drag.inner,[P.treeId,f,null],!!P.edit.drag.inner)?y.addClass(k.node.TMPTARGET_TREE):y=null,v.css({display:"none"}),window.zTreeMoveTimer&&(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null);O=D,R=L,l.treeObj.trigger(k.event.DRAGMOVE,[n,l.treeId,f])}return!1}function r(n){function a(){if(S){if(!p)for(var e=0,t=f.length;e<t;e++)C.removeNode(l,f[e]);if(L==k.move.TYPE_INNER)C.addNodes(P,b,E);else if(C.addNodes(P,b.getParentNode(),E),L==k.move.TYPE_PREV)for(e=0,t=E.length;e<t;e++)C.moveNode(P,b,E[e],L,!1);else for(e=-1,t=E.length-1;e<t;t--)C.moveNode(P,b,E[t],L,!1)}else if(p&&L==k.move.TYPE_INNER)C.addNodes(P,b,E);else if(p&&C.addNodes(P,b.getParentNode(),E),L!=k.move.TYPE_NEXT)for(e=0,t=E.length;e<t;e++)C.moveNode(P,b,E[e],L,!1);else for(e=-1,t=E.length-1;e<t;t--)C.moveNode(P,b,E[t],L,!1);C.selectNodes(P,E),T(E[0],l).focus().blur(),l.treeObj.trigger(k.event.DROP,[n,P.treeId,E,b,L,p])}if(window.zTreeMoveTimer&&(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null),O=null,R=null,I.unbind("mousemove",o),I.unbind("mouseup",r),I.unbind("selectstart",i),w.css("cursor","auto"),y&&(y.removeClass(k.node.TMPTARGET_TREE),D&&e("#"+D+k.id.A,y).removeClass(k.node.TMPTARGET_NODE+"_"+k.move.TYPE_PREV).removeClass(k.node.TMPTARGET_NODE+"_"+t.move.TYPE_NEXT).removeClass(k.node.TMPTARGET_NODE+"_"+t.move.TYPE_INNER)),N.showIfameMask(l,!1),u.showHoverDom=!0,0!=c.dragFlag){c.dragFlag=0;var d,s,h;for(d=0,s=f.length;d<s;d++)h=f[d],h.isParent&&c.dragNodeShowBefore[h.tId]&&!h.open&&(C.expandCollapseNode(l,h,!h.open),delete c.dragNodeShowBefore[h.tId]);g&&g.remove(),v&&v.remove();var p=(n.ctrlKey||n.metaKey)&&l.edit.drag.isMove&&l.edit.drag.isCopy||!l.edit.drag.isMove&&l.edit.drag.isCopy;if(!p&&y&&D&&f[0].parentTId&&D==f[0].parentTId&&L==k.move.TYPE_INNER&&(y=null),y){var b=null==D?null:m.getNodeCache(P,D);if(0==N.apply(l.callback.beforeDrop,[P.treeId,f,b,L,p],!0))return void C.selectNodes(_,f);var E=p?N.clone(f):f;L==k.move.TYPE_INNER&&N.canAsync(P,b)?C.asyncNode(P,b,!1,a):a()}else C.selectNodes(_,f),l.treeObj.trigger(k.event.DROP,[n,l.treeId,f,null,null,null])}}function i(){return!1}var d,s,l=m.getSetting(n.data.treeId),c=m.getRoot(l),u=m.getRoots();if(2==n.button||!l.edit.enable||!l.edit.drag.isCopy&&!l.edit.drag.isMove)return!0;var h=n.target,p=m.getRoot(l).curSelectedList,f=[];if(m.isSelectedNode(l,a))for(d=0,s=p.length;d<s;d++){if(p[d].editNameFlag&&N.eqs(h.tagName,"input")&&null!==h.getAttribute("treeNode"+k.id.INPUT))return!0;if(f.push(p[d]),f[0].parentTId!==p[d].parentTId){f=[a];break}}else f=[a];C.editNodeBlur=!0,C.cancelCurEditNode(l);var g,v,y,b,E,I=e(l.treeObj.get(0).ownerDocument),w=e(l.treeObj.get(0).ownerDocument.body),S=!1,P=l,_=l,O=null,R=null,D=null,L=k.move.TYPE_INNER,A=n.clientX,x=n.clientY,M=(new Date).getTime();return N.uCanDo(l)&&I.bind("mousemove",o),I.bind("mouseup",r),I.bind("selectstart",i),n.preventDefault&&n.preventDefault(),!0}},p={getAbs:function(e){var t=e.getBoundingClientRect(),n=document.body.scrollTop+document.documentElement.scrollTop,a=document.body.scrollLeft+document.documentElement.scrollLeft;return[t.left+a,t.top+n]},inputFocus:function(e){e.get(0)&&(e.focus(),N.setCursorPosition(e.get(0),e.val().length))},inputSelect:function(e){e.get(0)&&(e.focus(),e.select())},setCursorPosition:function(e,t){if(e.setSelectionRange)e.focus(),e.setSelectionRange(t,t);else if(e.createTextRange){var n=e.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",t),n.select()}},showIfameMask:function(e,t){for(var n=m.getRoot(e);n.dragMaskList.length>0;)n.dragMaskList[0].remove(),n.dragMaskList.shift();if(t)for(var a=T("iframe",e),o=0,r=a.length;o<r;o++){var i=a.get(o),d=N.getAbs(i),s=T("<div id='zTreeMask_"+o+"' class='zTreeMask' style='top:"+d[1]+"px; left:"+d[0]+"px; width:"+i.offsetWidth+"px; height:"+i.offsetHeight+"px;'></div>",e);s.appendTo(T("body",e)),n.dragMaskList.push(s)}}},f={addEditBtn:function(e,t){if(!(t.editNameFlag||T(t,k.id.EDIT,e).length>0)&&N.apply(e.edit.showRenameBtn,[e.treeId,t],e.edit.showRenameBtn)){var n=T(t,k.id.A,e),a="<span class='"+k.className.BUTTON+" edit' id='"+t.tId+k.id.EDIT+"' title='"+N.apply(e.edit.renameTitle,[e.treeId,t],e.edit.renameTitle)+"' treeNode"+k.id.EDIT+" style='display:none;'></span>";n.append(a),T(t,k.id.EDIT,e).bind("click",function(){return!(!N.uCanDo(e)||0==N.apply(e.callback.beforeEditName,[e.treeId,t],!0))&&(C.editNode(e,t),!1)}).show()}},addRemoveBtn:function(e,t){if(!(t.editNameFlag||T(t,k.id.REMOVE,e).length>0)&&N.apply(e.edit.showRemoveBtn,[e.treeId,t],e.edit.showRemoveBtn)){var n=T(t,k.id.A,e),a="<span class='"+k.className.BUTTON+" remove' id='"+t.tId+k.id.REMOVE+"' title='"+N.apply(e.edit.removeTitle,[e.treeId,t],e.edit.removeTitle)+"' treeNode"+k.id.REMOVE+" style='display:none;'></span>";n.append(a),T(t,k.id.REMOVE,e).bind("click",function(){return!(!N.uCanDo(e)||0==N.apply(e.callback.beforeRemove,[e.treeId,t],!0))&&(C.removeNode(e,t),e.treeObj.trigger(k.event.REMOVE,[e.treeId,t]),!1)}).bind("mousedown",function(e){return!0}).show()}},addHoverDom:function(e,t){m.getRoots().showHoverDom&&(t.isHover=!0,e.edit.enable&&(C.addEditBtn(e,t),C.addRemoveBtn(e,t)),N.apply(e.view.addHoverDom,[e.treeId,t]))},cancelCurEditNode:function(e,t,n){var a=m.getRoot(e),o=e.data.key.name,r=a.curEditNode;if(r){var i=a.curEditInput,d=t?t:n?r[o]:i.val();if(N.apply(e.callback.beforeRename,[e.treeId,r,d,n],!0)===!1)return!1;r[o]=d;var s=T(r,k.id.A,e);s.removeClass(k.node.CURSELECTED_EDIT),i.unbind(),C.setNodeName(e,r),r.editNameFlag=!1,a.curEditNode=null,a.curEditInput=null,C.selectNode(e,r,!1),e.treeObj.trigger(k.event.RENAME,[e.treeId,r,n])}return a.noSelection=!0,!0},editNode:function(e,t){var n=m.getRoot(e);if(C.editNodeBlur=!1,m.isSelectedNode(e,t)&&n.curEditNode==t&&t.editNameFlag)return void setTimeout(function(){N.inputFocus(n.curEditInput)},0);var a=e.data.key.name;t.editNameFlag=!0,C.removeTreeDom(e,t),C.cancelCurEditNode(e),C.selectNode(e,t,!1),T(t,k.id.SPAN,e).html("<input type=text class='rename' id='"+t.tId+k.id.INPUT+"' treeNode"+k.id.INPUT+" >");var o=T(t,k.id.INPUT,e);o.attr("value",t[a]),e.edit.editNameSelectAll?N.inputSelect(o):N.inputFocus(o),o.bind("blur",function(t){C.editNodeBlur||C.cancelCurEditNode(e)}).bind("keydown",function(t){"13"==t.keyCode?(C.editNodeBlur=!0,C.cancelCurEditNode(e)):"27"==t.keyCode&&C.cancelCurEditNode(e,null,!0)}).bind("click",function(e){return!1}).bind("dblclick",function(e){return!1}),T(t,k.id.A,e).addClass(k.node.CURSELECTED_EDIT),n.curEditInput=o,n.noSelection=!1,n.curEditNode=t},moveNode:function(e,t,n,a,o,r){var i=m.getRoot(e),d=e.data.key.children;if(t!=n&&(!e.data.keep.leaf||!t||t.isParent||a!=k.move.TYPE_INNER)){var s=n.parentTId?n.getParentNode():i,l=null===t||t==i;l&&null===t&&(t=i),l&&(a=k.move.TYPE_INNER);var c=t.parentTId?t.getParentNode():i;a!=k.move.TYPE_PREV&&a!=k.move.TYPE_NEXT&&(a=k.move.TYPE_INNER),a==k.move.TYPE_INNER&&(l?n.parentTId=null:(t.isParent||(t.isParent=!0,t.open=!!t.open,C.setNodeLineIcos(e,t)),n.parentTId=t.tId));var u,h;if(l)u=e.treeObj,h=u;else{if(r||a!=k.move.TYPE_INNER?r||C.expandCollapseNode(e,t.getParentNode(),!0,!1):C.expandCollapseNode(e,t,!0,!1),u=T(t,e),h=T(t,k.id.UL,e),u.get(0)&&!h.get(0)){var p=[];C.makeUlHtml(e,t,p,""),u.append(p.join(""))}h=T(t,k.id.UL,e)}var f=T(n,e);f.get(0)?u.get(0)||f.remove():f=C.appendNodes(e,n.level,[n],null,!1,!0).join(""),h.get(0)&&a==k.move.TYPE_INNER?h.append(f):u.get(0)&&a==k.move.TYPE_PREV?u.before(f):u.get(0)&&a==k.move.TYPE_NEXT&&u.after(f);var g,v,N=-1,y=0,b=null,E=null,I=n.level;if(n.isFirstNode)N=0,s[d].length>1&&(b=s[d][1],b.isFirstNode=!0);else if(n.isLastNode)N=s[d].length-1,b=s[d][N-1],b.isLastNode=!0;else for(g=0,v=s[d].length;g<v;g++)if(s[d][g].tId==n.tId){N=g;break}if(N>=0&&s[d].splice(N,1),a!=k.move.TYPE_INNER)for(g=0,v=c[d].length;g<v;g++)c[d][g].tId==t.tId&&(y=g);if(a==k.move.TYPE_INNER?(t[d]||(t[d]=new Array),t[d].length>0&&(E=t[d][t[d].length-1],E.isLastNode=!1),t[d].splice(t[d].length,0,n),n.isLastNode=!0,n.isFirstNode=1==t[d].length):t.isFirstNode&&a==k.move.TYPE_PREV?(c[d].splice(y,0,n),E=t,E.isFirstNode=!1,n.parentTId=t.parentTId,n.isFirstNode=!0,n.isLastNode=!1):t.isLastNode&&a==k.move.TYPE_NEXT?(c[d].splice(y+1,0,n),E=t,E.isLastNode=!1,n.parentTId=t.parentTId,n.isFirstNode=!1,n.isLastNode=!0):(a==k.move.TYPE_PREV?c[d].splice(y,0,n):c[d].splice(y+1,0,n),n.parentTId=t.parentTId,n.isFirstNode=!1,n.isLastNode=!1),m.fixPIdKeyValue(e,n),m.setSonNodeLevel(e,n.getParentNode(),n),C.setNodeLineIcos(e,n),C.repairNodeLevelClass(e,n,I),!e.data.keep.parent&&s[d].length<1){s.isParent=!1,s.open=!1;var w=T(s,k.id.UL,e),S=T(s,k.id.SWITCH,e),P=T(s,k.id.ICON,e);C.replaceSwitchClass(s,S,k.folder.DOCU),C.replaceIcoClass(s,P,k.folder.DOCU),w.css("display","none")}else b&&C.setNodeLineIcos(e,b);E&&C.setNodeLineIcos(e,E),e.check&&e.check.enable&&C.repairChkClass&&(C.repairChkClass(e,s),C.repairParentChkClassWithSelf(e,s),s!=n.parent&&C.repairParentChkClassWithSelf(e,n)),r||C.expandCollapseParentNode(e,n.getParentNode(),!0,o)}},removeEditBtn:function(e,t){T(t,k.id.EDIT,e).unbind().remove()},removeRemoveBtn:function(e,t){T(t,k.id.REMOVE,e).unbind().remove()},removeTreeDom:function(e,t){t.isHover=!1,C.removeEditBtn(e,t),C.removeRemoveBtn(e,t),N.apply(e.view.removeHoverDom,[e.treeId,t])},repairNodeLevelClass:function(e,t,n){if(n!==t.level){var a=T(t,e),o=T(t,k.id.A,e),r=T(t,k.id.UL,e),i=k.className.LEVEL+n,d=k.className.LEVEL+t.level;a.removeClass(i),a.addClass(d),o.removeClass(i),o.addClass(d),r.removeClass(i),r.addClass(d)}},selectNodes:function(e,t){for(var n=0,a=t.length;n<a;n++)C.selectNode(e,t[n],n>0)}},g={tools:p,view:f,event:u,data:c};e.extend(!0,e.fn.zTree.consts,t),e.extend(!0,e.fn.zTree._z,g);var v=e.fn.zTree,N=v._z.tools,k=v.consts,C=v._z.view,m=v._z.data,T=(v._z.event,N.$);m.exSetting(n),m.addInitBind(r),m.addInitUnBind(i),m.addInitCache(o),m.addInitNode(s),m.addInitProxy(d),m.addInitRoot(a),m.addZTreeTools(l);var y=C.cancelPreSelectedNode;C.cancelPreSelectedNode=function(e,t){for(var n=m.getRoot(e).curSelectedList,a=0,o=n.length;a<o&&(t&&t!==n[a]||(C.removeTreeDom(e,n[a]),!t));a++);y&&y.apply(C,arguments)};var b=C.createNodes;C.createNodes=function(e,t,n,a){b&&b.apply(C,arguments),n&&C.repairParentChkClassWithSelf&&C.repairParentChkClassWithSelf(e,a)};var E=C.makeNodeUrl;C.makeNodeUrl=function(e,t){
  return e.edit.enable?null:E.apply(C,arguments)};var I=C.removeNode;C.removeNode=function(e,t){var n=m.getRoot(e);n.curEditNode===t&&(n.curEditNode=null),I&&I.apply(C,arguments)};var w=C.selectNode;C.selectNode=function(e,t,n){var a=m.getRoot(e);return(!m.isSelectedNode(e,t)||a.curEditNode!=t||!t.editNameFlag)&&(w&&w.apply(C,arguments),C.addHoverDom(e,t),!0)};var S=N.uCanDo;N.uCanDo=function(e,t){var n=m.getRoot(e);return!(!t||!(N.eqs(t.type,"mouseover")||N.eqs(t.type,"mouseout")||N.eqs(t.type,"mousedown")||N.eqs(t.type,"mouseup")))||(n.curEditNode&&(C.editNodeBlur=!1,n.curEditInput.focus()),!n.curEditNode&&(!S||S.apply(C,arguments)))}}(jQuery),u.TreeAdapter=u.BaseAdapter.extend({initialize:function(e){var t=e.options||{},n=e.model,a="string"==typeof e.el?document.querySelector(e.el):e.el;e.app;this.id=t.id,e=t;var o=this;this.dataTable=u.getJSObject(n,e.data),this.element=a,this.$element=$(a),this.id=e.id,this.element.id=this.id,this.options=e,this.events=$.extend(!0,{},e.events);var r={data:{simpleData:{enable:!0}},check:{chkboxType:{Y:"",N:""}},callback:{beforeClick:function(e,t,a){o.events.beforeClick&&u.getFunction(n,o.events.beforeClick)(e,t,a)},onCheck:function(e,t,n){for(var a=o.tree.getChangeCheckedNodes(),r=0;r<a.length;r++){var i=a[r].id,d=o.getRowIdByIdValue(i),s=o.dataTable.getIndexByRowId(d);a[r].checked?(a[r].checkedOld=!0,1==o.tree.setting.view.selectedMulti?o.dataTable.addRowsSelect([s]):o.dataTable.setRowSelect(s)):(a[r].checkedOld=!1,o.dataTable.setRowUnSelect(s))}},onClick:function(e,t,a){if($("#"+t+" li").removeClass("focusNode"),$("#"+t+" a").removeClass("focusNode"),$("#"+a.tId).addClass("focusNode"),$("#"+a.tId+"_a").addClass("focusNode"),1!=o.tree.setting.view.selectedMulti){var r=a.id,i=o.getRowIdByIdValue(r),d=o.dataTable.getIndexByRowId(i);o.dataTable.setRowSelect(d),o.events.onClick&&u.getFunction(n,o.events.onClick)(e,t,a)}}}},i={};this.options.setting&&(i=u.getJSObject(n,this.options.setting)||u.getJSObject(window,this.options.setting));var d=r.callback,s=i.callback;for(var l in d){var c=d[l],h=s&&s[l];if(h){var p=function(){c.apply(this,arguments),h.apply(this,arguments)};s[l]=p}}var f=$.extend(!0,{},r,i),g=[],v=this.dataTable.rows();if(v.length>0)if(this.options.codeTree){v.sort(function(e,t){var n=e.data,a=t.data,r=n[o.options.idField].value+"",i=a[o.options.idField].value+"";try{return r.localeCompare(i)}catch(d){return 0}});var N=new Array;$.each(v,function(){var e=this.data,t=e[o.options.idField].value;N.push(t)});var k="";$.each(v,function(){var e={},t=this.data,n=t[o.options.idField].value,a=t[o.options.nameField].value,r="",i=-1;if(""!=k)var i=n.indexOf(k);if(0==i)r=k;else for(var d=1;d<k.length;d++){var s=k.substr(0,d),l=n.indexOf(s);if(0!=l)break;var c=$.inArray(s,N);(c>0||0==c)&&(r=s)}e.id=n,e.pId=r,e.name=a,g.push(e),k=n})}else{new Array;$.each(v,function(){var e={},t=this.data,n=t[o.options.idField].value,a=t[o.options.pidField].value,r=t[o.options.nameField].value;e.id=n,e.pId=a,e.name=r,g.push(e)})}return this.tree=$.fn.zTree.init(this.$element,f,g),this.dataTable.on(u.DataTable.ON_ROW_SELECT,function(e){$.each(e.rowIds,function(){var e=o.dataTable.getRowByRowId(this),t=e.data,n=t[o.options.idField].value,a=o.tree.getNodeByParam("id",n);1!=o.tree.setting.view.selectedMulti||a.checked?o.tree.selectNode(a,!1):o.tree.checkNode(a,!0,!1,!0)})}),this.dataTable.on(u.DataTable.ON_ROW_UNSELECT,function(e){$.each(e.rowIds,function(){var e=o.dataTable.getRowByRowId(this),t=e.data,n=t[o.options.idField].value,a=o.tree.getNodeByParam("id",n);1==o.tree.setting.view.selectedMulti&&a.checked?o.tree.checkNode(a,!1,!0,!0):o.tree.cancelSelectedNode(a)})}),this.dataTable.on(u.DataTable.ON_INSERT,function(e){var t=[],n=[],a=!1;$.each(e.rows,function(){var e={},n=!1,r=this.data,i=r[o.options.idField].value,d=r[o.options.pidField].value,s=r[o.options.nameField].value;e.id=i,e.pId=d,e.name=s;var l=o.tree.getNodeByParam("pid",i),c=o.tree.getNodeByParam("id",d);l&&l.length>0&&(a=!0),c&&c.length>0&&(n=!0),!a&&n?o.tree.addNodes(c,e,!0):t.push(e)}),a||(n=o.tree.transformTozTreeNodes(t),o.tree.addNodes(null,n,!0))}),this.dataTable.on(u.DataTable.ON_DELETE,function(e){new Array;if(this.deleteRows.length>0)for(var t=0;t<this.deleteRows.length;t++){var n=this.deleteRows[t],a=n.data,r=a[o.options.idField].value,i=o.tree.getNodeByParam("id",r);o.tree.removeNode(i)}}),this.dataTable.on(u.DataTable.ON_DELETE_ALL,function(e){for(var t=o.tree.getNodes(),n=0,a=t.length;n<a;n++){var r=o.tree.getNodeByParam("id",t[n].id);o.tree.removeNode(r),n--,a=t.length}}),this.dataTable.on(u.DataTable.ON_LOAD,function(e){var e=o.dataTable.rows();if(e.length>0){new Array;$.each(e,function(){var e={},t=this.data,n=t[o.options.idField].value,a=t[o.options.pidField].value,r=t[o.options.nameField].value;e.id=n,e.pId=a,e.name=r,g.push(e)})}this.tree=$.fn.zTree.init(this.$element,f,g)}),this.dataTable.on(u.DataTable.ON_VALUE_CHANGE,function(e){var t=o.dataTable.getRowByRowId(e.rowId);if(t){var n=o.tree.getNodes(),a=t.getValue(o.options.idField),r=o.tree.getNodeByParam("id",a);!r&&n&&(r=n[n.length-1]);var i=e.field,d=e.newValue;if(o.options.idField==i&&r&&(r.id=d,o.tree.updateNode(r)),o.options.nameField==i&&r)r.name=d,o.tree.updateNode(r);else if(o.options.pidField==i){var s=o.tree.getNodeByParam("id",d);o.tree.moveNode(s,r,"inner")}}}),this.getRowIdByIdValue=function(e){var t=this,n=null;return $.each(this.dataTable.rows(),function(){var a=this.data,o=this.rowId;a[t.options.idField].value==e&&(n=o)}),n},this},getName:function(){return"tree"}}),u.compMgr.addDataAdapter({adapter:u.TreeAdapter,name:"tree"});